From d4d3e2f56d1cffe3700963c01e43f0312618bc04 Mon Sep 17 00:00:00 2001 From: Raycoms Date: Sat, 27 Jul 2024 09:41:53 +0200 Subject: [PATCH] Allow rice to actually drop :D (#10058) Allow rice to actually drop from sugarcane Remove spurious duplicated check for dead bush/chickpea --- .../minecolonies/core/event/EventHandler.java | 24 +++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/minecolonies/core/event/EventHandler.java b/src/main/java/com/minecolonies/core/event/EventHandler.java index 2592555ad4f..7e93795a74d 100755 --- a/src/main/java/com/minecolonies/core/event/EventHandler.java +++ b/src/main/java/com/minecolonies/core/event/EventHandler.java @@ -3,7 +3,10 @@ import com.minecolonies.api.blocks.AbstractBlockHut; import com.minecolonies.api.blocks.ModBlocks; import com.minecolonies.api.blocks.interfaces.IRSComponentBlock; -import com.minecolonies.api.colony.*; +import com.minecolonies.api.colony.ICitizenData; +import com.minecolonies.api.colony.IColony; +import com.minecolonies.api.colony.IColonyManager; +import com.minecolonies.api.colony.IVisitorData; import com.minecolonies.api.colony.buildings.IBuilding; import com.minecolonies.api.colony.buildings.IGuardBuilding; import com.minecolonies.api.colony.interactionhandling.ChatPriority; @@ -12,7 +15,6 @@ import com.minecolonies.api.entity.ai.statemachine.tickratestatemachine.TickRateStateMachine; import com.minecolonies.api.entity.citizen.AbstractEntityCitizen; import com.minecolonies.api.entity.other.AbstractFastMinecoloniesEntity; -import com.minecolonies.api.items.ModItems; import com.minecolonies.api.items.ModTags; import com.minecolonies.api.loot.EntityInBiomeTag; import com.minecolonies.api.util.*; @@ -48,7 +50,6 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.Level; -import net.minecraft.world.level.biome.Biomes; import net.minecraft.world.level.block.BedBlock; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; @@ -132,7 +133,7 @@ public static void onEntityAdded(@NotNull final EntityJoinLevelEvent event) @SubscribeEvent public static void onLootTableLoad(@NotNull final LootTableLoadEvent event) { - if (event.getName().toString().equals("minecraft:blocks/fern")) + if (event.getName().equals(Blocks.FERN.getLootTable())) { event.getTable().addPool(LootPool.lootPool() .add(LootItem.lootTableItem(ModBlocks.blockCabbage) @@ -144,21 +145,21 @@ public static void onLootTableLoad(@NotNull final LootTableLoadEvent event) .when(EntityInBiomeTag.of(ModTags.humidBiomes)) .when(LootItemRandomChanceCondition.randomChance(0.01f))).build()); } - else if (event.getName().toString().equals("minecraft:blocks/sugarcane")) + else if (event.getName().equals(Blocks.SUGAR_CANE.getLootTable())) { event.getTable().addPool(LootPool.lootPool() .add(LootItem.lootTableItem(ModBlocks.blockRice) .when(EntityInBiomeTag.of(ModTags.humidBiomes)) .when(LootItemRandomChanceCondition.randomChance(0.01f))).build()); } - else if (event.getName().toString().equals("minecraft:blocks/dead_bush")) + else if (event.getName().equals(Blocks.DEAD_BUSH.getLootTable())) { event.getTable().addPool(LootPool.lootPool() .add(LootItem.lootTableItem(ModBlocks.blockChickpea) .when(EntityInBiomeTag.of(ModTags.dryBiomes)) .when(LootItemRandomChanceCondition.randomChance(0.01f))).build()); } - else if (event.getName().toString().equals("minecraft:blocks/grass")) + else if (event.getName().equals(Blocks.GRASS.getLootTable())) { event.getTable().addPool(LootPool.lootPool() .add(LootItem.lootTableItem(ModBlocks.blockGarlic) @@ -188,14 +189,7 @@ else if (event.getName().toString().equals("minecraft:blocks/grass")) .when(EntityInBiomeTag.of(ModTags.temperateBiomes)) .when(LootItemRandomChanceCondition.randomChance(0.01f))).build()); } - else if (event.getName().toString().equals("minecraft:blocks/dead_bush")) - { - event.getTable().addPool(LootPool.lootPool() - .add(LootItem.lootTableItem(ModBlocks.blockChickpea) - .when(EntityInBiomeTag.of(ModTags.dryBiomes)) - .when(LootItemRandomChanceCondition.randomChance(0.01f))).build()); - } - else if (event.getName().toString().equals("minecraft:chests/simple_dungeon")) + else if (event.getName().equals(BuiltInLootTables.SIMPLE_DUNGEON)) { event.getTable().addPool(LootPool.lootPool() .add(LootItem.lootTableItem(ModBlocks.blockGarlic)