Compare commits

...

3 Commits

24 changed files with 356 additions and 102 deletions

2
.gitignore vendored
View File

@ -36,3 +36,5 @@ loom-cache/
__pycache__/
*.pyc
run-*/

View File

@ -25,3 +25,21 @@ java {
languageVersion = JavaLanguageVersion.of(17)
}
}
loom {
runs {
server {
server()
runDir "run-server"
}
client1 {
client()
runDir "run-1"
}
client2 {
client()
runDir "run-2"
}
}
}

307
chipper
View File

@ -1,119 +1,226 @@
#!/usr/bin/env bash
# Do NOT use `set -e` with Gradle
set -u
RUN_DIR="run"
OPTIONS_SRC="./config/options.txt"
OPTIONS_DST="$RUN_DIR/options.txt"
GRADLE="./gradlew"
GRADLE_FLAGS=(
GRADLE_BASE_FLAGS=(
"--console=plain"
"--configuration-cache"
"--no-daemon"
"-Dfabric.development=true"
"-Dminecraft.api.env=dev"
"-Dminecraft.session.disable=true"
)
# ---------- helpers ----------
OPTIONS_SRC="./config/options.txt"
inject_options() {
if [[ -f "$OPTIONS_SRC" ]]; then
echo "[*] Injecting options.txt..."
cp "$OPTIONS_SRC" "$OPTIONS_DST"
else
echo "[!] Warning: $OPTIONS_SRC not found, skipping injection"
fi
}
ROLE=""
ROLE_INDEX=""
PASSTHROUGH=()
ensure_run_dir() {
if [[ ! -d "$RUN_DIR" ]]; then
echo "[*] Creating run directory..."
mkdir -p "$RUN_DIR"
fi
}
# ---------- utils ----------
# ---------- actions ----------
rand() { shuf -i 0-$(($1 - 1)) -n 1; }
clean() {
clear
echo "[*] Running gradle clean..."
$GRADLE clean "${GRADLE_FLAGS[@]}"
}
build() {
clear
ensure_run_dir
inject_options
echo "[*] Running client..."
$GRADLE runClient "${GRADLE_FLAGS[@]}"
}
show_tree() {
clear
echo "[*] Project tree (respecting .gitignore):"
tree --gitignore
}
ship() {
clear
echo "[*] Building project..."
$GRADLE build "${GRADLE_FLAGS[@]}"
echo "[+] Build ready to ship."
}
# ---------- help ----------
help_menu() {
cat <<'EOF'
🐿️ S Q U I R R E L B U I L D T O O L 🐿️
Usage:
./chipper [option]
Options:
--clean Run gradle clean
--build Run client (fast path)
--tree Show project tree only
--ship Build project
--help Show this help menu
Notes:
- Uses Gradle configuration cache
- Plain console output (no fake progress)
- Safe to Ctrl+C after EXECUTION starts
The squirrel believes in you.
EOF
}
# ---------- argument parsing ----------
if [[ $# -eq 0 ]]; then
help_menu
exit 0
fi
case "$1" in
--clean)
clean
parse_args() {
local cleaned=()
for ((i=0; i<${#ARGS[@]}; i++)); do
case "${ARGS[$i]}" in
-s|--server)
ROLE="server"
;;
--build)
build
-p1|--player1)
ROLE="client"
ROLE_INDEX=1
;;
--tree)
show_tree
-p2|--player2)
ROLE="client"
ROLE_INDEX=2
;;
--ship)
ship
;;
--help|-h)
help_menu
--)
PASSTHROUGH=( "${ARGS[@]:$((i+1))}" )
break
;;
*)
echo "[!] Unknown option: $1"
echo ""
help_menu
cleaned+=( "${ARGS[$i]}" )
;;
esac
done
ARGS=( "${cleaned[@]}" )
}
# ---------- run-dir helpers ----------
prepare_run_dir() {
local dir="$1"
rm -rf "$dir"
mkdir -p "$dir"
}
inject_options() {
local dir="$1"
# options.txt
if [[ -f "$OPTIONS_SRC" ]]; then
cp "$OPTIONS_SRC" "$dir/options.txt"
fi
# servers.dat (client server list)
if [[ -f "./config/servers.dat" ]]; then
cp "./config/servers.dat" "$dir/servers.dat"
fi
}
ensure_server_files() {
local dir="$1"
[[ -f "$dir/eula.txt" ]] || echo "eula=true" > "$dir/eula.txt"
if [[ ! -f "$dir/server.properties" ]]; then
cat > "$dir/server.properties" <<EOF
online-mode=false
server-port=25565
level-name=world
enable-command-block=true
EOF
fi
}
# ---------- squirrel ----------
header() {
local action="$1"
local squirrels=(
' /\_/\
( o.o )
> ^ <'
' /\_/\
( -.- )
o_(")(")'
' /\_/\
( @.@ )
> ~ <'
)
clear
echo "${squirrels[$(rand ${#squirrels[@]})]}"
echo
case "$action" in
run) echo "🐿️ running chipper" ;;
clean) echo "🐿️ cleaning workspace" ;;
build) echo "🐿️ building project" ;;
tree) echo "🐿️ observing project tree" ;;
*) echo "🐿️ thinking..." ;;
esac
echo
}
# ---------- commands ----------
cmd_run() {
header run
case "$ROLE" in
server)
run_dir="run-server"
prepare_run_dir "$run_dir"
inject_options "$run_dir"
ensure_server_files "$run_dir"
echo "🖥️🐿️ starting dedicated server"
exec "$GRADLE" runServer "${GRADLE_BASE_FLAGS[@]}" "${PASSTHROUGH[@]}"
;;
client)
run_dir="run-$ROLE_INDEX"
task="runClient$ROLE_INDEX"
prepare_run_dir "$run_dir"
inject_options "$run_dir"
echo "🎮🐿️ starting client $ROLE_INDEX"
exec "$GRADLE" "$task" "${GRADLE_BASE_FLAGS[@]}" "${PASSTHROUGH[@]}"
;;
*)
echo "❌🐿️ no role selected"
echo "👉🐿️ use one of:"
echo " --server"
echo " --player1"
echo " --player2"
exit 1
;;
esac
}
cmd_clean() {
header clean
"$GRADLE" clean "${GRADLE_BASE_FLAGS[@]}" "${PASSTHROUGH[@]}"
}
cmd_build() {
header build
"$GRADLE" build "${GRADLE_BASE_FLAGS[@]}" "${PASSTHROUGH[@]}"
}
cmd_tree() {
header tree
tree --gitignore
}
cmd_help() {
cat <<'EOF'
/\_/\
( o.o )
> ^ <
🐿️ C H I P P E R
Usage:
./chipper run [role] [-- passthrough]
Roles:
-s, --server Start ONLY server
-p1, --player1 Start ONLY client 1
-p2, --player2 Start ONLY client 2
Other commands:
clean Gradle clean
build Gradle build
tree Show project tree
help Show this menu
Examples:
./chipper run --server
./chipper run --player1
./chipper run --player2
./chipper run --player1 -- --debug
./chipper build
./chipper tree
Notes:
- No legacy player spawning
- Each role has its own run directory
- options.txt injected per run dir
- Everything after `--` is forwarded
- The squirrel is mandatory
EOF
}
# ---------- entry ----------
ARGS=( "$@" )
parse_args
case "${ARGS[0]:-help}" in
run) cmd_run ;;
clean) cmd_clean ;;
build) cmd_build ;;
tree) cmd_tree ;;
help|-h) cmd_help ;;
*)
echo "[!] Unknown command: ${ARGS[0]}"
cmd_help
exit 1
;;
esac

View File

@ -72,8 +72,8 @@ tutorialStep:movement
mouseWheelSensitivity:1.0
rawMouseInput:true
glDebugVerbosity:1
skipMultiplayerWarning:false
skipRealms32bitWarning:false
skipMultiplayerWarning:true
skipRealms32bitWarning:true
hideMatchedNames:true
joinedFirstServer:false
hideBundleTutorial:false

BIN
config/servers.dat Normal file

Binary file not shown.

View File

@ -50,6 +50,9 @@ public final class ModTooltips {
if (stack.isOf(ModItems.MEP_MILK))
lines.add(Text.translatable("tooltip.chipi.mep_milk"));
if (stack.isOf(ModItems.PLAYER_MILK))
lines.add(Text.translatable("tooltip.chipi.player_milk"));
// ===== ARMOR =====
if (stack.isOf(ModItems.CHIPPER_HELMET))
lines.add(Text.translatable("tooltip.chipi.chipper_helmet"));

View File

@ -15,4 +15,10 @@ public class ModFoodComponents {
new FoodComponent.Builder()
.alwaysEdible()
.build();
public static final FoodComponent PLAYER_MILK =
new FoodComponent.Builder()
.alwaysEdible()
.build();
}

View File

@ -35,6 +35,7 @@ public class ModItemGroups {
// Food
entries.add(ModItems.MEP_MILK);
entries.add(ModItems.NUT);
entries.add(ModItems.PLAYER_MILK);
// Armor
entries.add(ModItems.CHIPPER_HELMET);

View File

@ -89,6 +89,17 @@ public class ModItems {
new MepMilkItem(new Item.Settings().maxCount(1).recipeRemainder(Items.BUCKET).food(ModFoodComponents.MEP_MILK))
);
public static final Item PLAYER_MILK = Registry.register(
Registries.ITEM,
new Identifier(ChipiMod.MOD_ID, "player_milk"),
new PlayerMilkItem(
new Item.Settings()
.maxCount(1)
.recipeRemainder(Items.BUCKET)
.food(ModFoodComponents.PLAYER_MILK)
)
);
// ===== ARMOR =====
public static final Item CHIPPER_HELMET = Registry.register(

View File

@ -0,0 +1,51 @@
package net.Chipperfluff.chipi.item;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.UseAction;
import net.minecraft.world.World;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.Chipperfluff.chipi.effect.ModEffects;
import net.Chipperfluff.chipi.sound.ModSounds;
import net.minecraft.sound.SoundCategory;
public class PlayerMilkItem extends Item {
public PlayerMilkItem(Settings settings) {
super(settings);
}
@Override
public UseAction getUseAction(ItemStack stack) {
return UseAction.DRINK;
}
@Override
public int getMaxUseTime(ItemStack stack) {
return 32;
}
@Override
public ItemStack finishUsing(ItemStack stack, World world, LivingEntity user) {
if (!world.isClient && user instanceof PlayerEntity player) {
world.playSound(
null,
player.getBlockPos(),
ModSounds.PLAYER_MILK_SONG,
SoundCategory.PLAYERS,
1.0f,
1.0f
);
}
if (user instanceof PlayerEntity player && !player.getAbilities().creativeMode) {
return new ItemStack(Items.BUCKET);
}
return stack;
}
}

View File

@ -19,6 +19,17 @@ import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.GameRules;
import net.minecraft.world.World;
import net.fabricmc.fabric.api.biome.v1.BiomeModifications;
import net.fabricmc.fabric.api.biome.v1.BiomeSelectors;
import net.minecraft.world.gen.GenerationStep;
import net.fabricmc.fabric.api.event.player.UseEntityCallback;
import net.minecraft.util.ActionResult;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
import net.Chipperfluff.chipi.item.ModItems;
public final class ChipiServerEvents {
@ -33,6 +44,44 @@ public final class ChipiServerEvents {
private ChipiServerEvents() {}
public static void register() {
BiomeModifications.addFeature(
BiomeSelectors.foundInOverworld(),
GenerationStep.Feature.UNDERGROUND_ORES,
RegistryKey.of(
RegistryKeys.PLACED_FEATURE,
new Identifier("chipi", "chipper_ore")
)
);
// ===== PLAYER MILK INTERACTION =====
UseEntityCallback.EVENT.register((player, world, hand, entity, hitResult) -> {
if (world.isClient()) return ActionResult.PASS;
if (!(entity instanceof PlayerEntity target)) return ActionResult.PASS;
if (target == player) return ActionResult.FAIL;
ItemStack stack = player.getStackInHand(hand);
if (!stack.isOf(Items.BUCKET)) return ActionResult.PASS;
stack.decrement(1);
ItemStack milk = new ItemStack(ModItems.PLAYER_MILK);
if (!player.getInventory().insertStack(milk)) {
player.dropItem(milk, false);
}
world.playSound(
null,
player.getBlockPos(),
SoundEvents.ENTITY_COW_MILK,
SoundCategory.PLAYERS,
1.0f,
1.1f
);
return ActionResult.SUCCESS;
});
ServerLifecycleEvents.SERVER_STARTED.register(server -> SERVER = server);
ServerTickEvents.END_SERVER_TICK.register(ChipiServerEvents::tickPlayers);
ServerTickEvents.END_WORLD_TICK.register(ChipiServerEvents::handleVoidFailsafe);

View File

@ -9,6 +9,7 @@ import net.minecraft.util.Identifier;
public class ModSounds {
public static final SoundEvent MEP_MILK = register("entity.mep.milk");
public static final SoundEvent PLAYER_MILK_SONG = register("player_milk_song");
private static SoundEvent register(String id) {
Identifier identifier = new Identifier(ChipiMod.MOD_ID, id);

View File

@ -2,18 +2,14 @@
"death.attack.void_block": "§8%1$s stepped beyond safety — the Outside answered.",
"death.attack.chipi.void_block_fire": "§c%1$s tried to save themselves.§r §8It got worse.",
"itemGroup.chipi.chipi": "Chipi",
"effect.chipi.chipi_blessing": "Chipi's Blessing",
"entity.chipi.mep": "Merp :3",
"block.chipi.void_block": "Void Block",
"block.chipi.chipper_frame": "Chipper Frame",
"block.chipi.chipper_portal": "Chipper Portal",
"block.chipi.chipper_ore": "Chipper Ore",
"block.chipi.chipper_alloy_block": "Chipper Alloy Block",
"itemGroup.chipi.chipi": "Chipi",
"item.chipi.void_block": "Void Block",
"item.chipi.chipper_frame": "Chipper Frame",
"item.chipi.chipper_portal": "Chipper Portal",
@ -24,9 +20,6 @@
"item.chipi.chipper_alloy": "Chipper Alloy",
"item.chipi.mep_spawn_egg": "Mep Spawn Egg",
"item.chipi.nut": "Nut",
"item.chipi.mep_milk": "Mep Milk",
"item.chipi.chipper_helmet": "Chipper Helmet",
"item.chipi.chipper_chestplate": "Chipper Chestplate",
"item.chipi.chipper_leggings": "Chipper Leggings",
@ -38,19 +31,20 @@
"item.chipi.chipper_shovel": "Chipper Shovel",
"item.chipi.chipper_hoe": "Chipper Hoe",
"item.chipi.nut": "Nut",
"item.chipi.mep_milk": "Mep Milk",
"item.chipi.player_milk": "Player Milk",
"tooltip.chipi.void_block": "§8It hums quietly.§r §7You are not supposed to notice that.",
"tooltip.chipi.chipper_frame": "§7Built to hold a mistake.§r §8It is doing its best.",
"tooltip.chipi.chipper_portal": "§5Something on the other side noticed you.§r §8It did not look away.",
"tooltip.chipi.chipper_ore": "§7Common.§r §8Suspiciously so.",
"tooltip.chipi.chipper_alloy_block": "§7Pressed together until it stopped complaining.§r §8Mostly.",
"tooltip.chipi.nut": "§7Probably edible.§r §8Confidence not included.",
"tooltip.chipi.raw_chipper_ore": "§7Still warm to the touch.§r §8That seems unnecessary.",
"tooltip.chipi.chipper_ingot": "§7Dense and stubborn.§r §8Refuses to fail politely.",
"tooltip.chipi.chipper_alloy": "§7Stronger than it looks.§r §8Judges you silently.",
"tooltip.chipi.mep_spawn_egg": "§8It already knows where you are.§r §7Spawning is a courtesy.",
"tooltip.chipi.mep_milk": "§7Temporary comfort in liquid form.§r §8The bucket survives.",
"tooltip.chipi.chipper_helmet": "§7Heavy and awkward.§r §8Feels incomplete alone.",
"tooltip.chipi.chipper_chestplate": "§7Looks like armor.§r §8Does nothing by itself.",
@ -61,5 +55,9 @@
"tooltip.chipi.chipper_pickaxe": "§7Fast bite on stone.§r §8Gives up immediately after.",
"tooltip.chipi.chipper_axe": "§7Clean chop.§r §8Handle resents you.",
"tooltip.chipi.chipper_shovel": "§7Quick dig.§r §8Gravel smells weakness.",
"tooltip.chipi.chipper_hoe": "§7Turns soil fast.§r §8Blunts before the sprouts."
"tooltip.chipi.chipper_hoe": "§7Turns soil fast.§r §8Blunts before the sprouts.",
"tooltip.chipi.nut": "§7Probably edible.§r §8Confidence not included.",
"tooltip.chipi.mep_milk": "§7Temporary comfort in liquid form.§r §8The bucket survives.",
"tooltip.chipi.player_milk": "what the fuck did you just just put in me"
}

View File

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "chipi:item/player_milk"
}
}

View File

@ -3,5 +3,10 @@
"sounds": [
"chipi:mep_milk"
]
},
"player_milk_song": {
"sounds": [
"chipi:player_milk"
]
}
}

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 336 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 759 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 263 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 339 B

View File

@ -1,6 +1,6 @@
{
"type": "fabric:add_features",
"biomes": "minecraft:overworld",
"biomes": "#minecraft:is_overworld",
"features": [
"chipi:chipper_ore"
],

View File

@ -1,8 +1,8 @@
{
"type": "minecraft:ore",
"config": {
"size": 5,
"discard_chance_on_air_exposure": 0.0,
"size": 10,
"discard_chance_on_air_exposure": 0.4,
"targets": [
{
"target": {

View File

@ -12,12 +12,8 @@
"type": "minecraft:height_range",
"height": {
"type": "minecraft:uniform",
"min_inclusive": {
"absolute": 40
},
"max_inclusive": {
"absolute": 64
}
"min_inclusive": { "absolute": -24 },
"max_inclusive": { "absolute": 56 }
}
},
{