diff --git a/src/main/java/net/Chipperfluff/chipi/server/ChipiServerEvents.java b/src/main/java/net/Chipperfluff/chipi/server/ChipiServerEvents.java index bc79f66..ed463ce 100644 --- a/src/main/java/net/Chipperfluff/chipi/server/ChipiServerEvents.java +++ b/src/main/java/net/Chipperfluff/chipi/server/ChipiServerEvents.java @@ -33,6 +33,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); diff --git a/src/main/resources/data/chipi/worldgen/biome_modifier/chipper_ore.json b/src/main/resources/data/chipi/worldgen/biome_modifier/chipper_ore.json index 010384c..4515a24 100644 --- a/src/main/resources/data/chipi/worldgen/biome_modifier/chipper_ore.json +++ b/src/main/resources/data/chipi/worldgen/biome_modifier/chipper_ore.json @@ -1,6 +1,6 @@ { "type": "fabric:add_features", - "biomes": "minecraft:overworld", + "biomes": "#minecraft:is_overworld", "features": [ "chipi:chipper_ore" ], diff --git a/src/main/resources/data/chipi/worldgen/configured_feature/chipper_ore.json b/src/main/resources/data/chipi/worldgen/configured_feature/chipper_ore.json index 521fd9f..4ab21c2 100644 --- a/src/main/resources/data/chipi/worldgen/configured_feature/chipper_ore.json +++ b/src/main/resources/data/chipi/worldgen/configured_feature/chipper_ore.json @@ -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": { diff --git a/src/main/resources/data/chipi/worldgen/placed_feature/chipper_ore.json b/src/main/resources/data/chipi/worldgen/placed_feature/chipper_ore.json index e021a54..d394a53 100644 --- a/src/main/resources/data/chipi/worldgen/placed_feature/chipper_ore.json +++ b/src/main/resources/data/chipi/worldgen/placed_feature/chipper_ore.json @@ -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 } } }, {