Add chipper ore generation and player milk interaction features
This commit is contained in:
parent
0d5bc6a5bf
commit
6c530c2651
@ -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);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"type": "fabric:add_features",
|
||||
"biomes": "minecraft:overworld",
|
||||
"biomes": "#minecraft:is_overworld",
|
||||
"features": [
|
||||
"chipi:chipper_ore"
|
||||
],
|
||||
|
||||
@ -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": {
|
||||
|
||||
@ -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 }
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user