mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-26 13:09:22 +01:00
Fixed worms.
This commit is contained in:
parent
a75848e195
commit
097803020c
3 changed files with 5 additions and 11 deletions
|
@ -26,6 +26,7 @@ import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
|
|||
import de.ellpeck.actuallyadditions.mod.inventory.ActuallyContainers;
|
||||
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
||||
import de.ellpeck.actuallyadditions.mod.items.ItemCoffee;
|
||||
import de.ellpeck.actuallyadditions.mod.items.ItemWorm;
|
||||
import de.ellpeck.actuallyadditions.mod.misc.BannerHelper;
|
||||
import de.ellpeck.actuallyadditions.mod.misc.DungeonLoot;
|
||||
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.LaserRelayConnectionHandler;
|
||||
|
@ -108,6 +109,7 @@ public class ActuallyAdditions {
|
|||
MinecraftForge.EVENT_BUS.register(new CommonEvents());
|
||||
MinecraftForge.EVENT_BUS.register(new DungeonLoot());
|
||||
MinecraftForge.EVENT_BUS.addListener(ActuallyAdditions::reloadEvent);
|
||||
MinecraftForge.EVENT_BUS.addListener(ItemWorm::onHoe);
|
||||
InitFluids.init(eventBus);
|
||||
|
||||
eventBus.addListener(this::setup);
|
||||
|
|
|
@ -17,21 +17,14 @@ import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
|
|||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.entity.player.UseHoeEvent;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.EventPriority;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -64,15 +57,14 @@ public class ItemWorm extends ItemBase {
|
|||
return super.useOn(context);
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.LOW)
|
||||
public void onHoe(UseHoeEvent event) {
|
||||
public static void onHoe(UseHoeEvent event) {
|
||||
if (CommonConfig.Other.WORMS.get() && event.getResult() != Event.Result.DENY) {
|
||||
World world = event.getEntity().level;
|
||||
if (!world.isClientSide) {
|
||||
BlockPos pos = event.getContext().getClickedPos();
|
||||
if (world.isEmptyBlock(pos.above())) {
|
||||
BlockState state = world.getBlockState(pos);
|
||||
if (state.getBlock() == Blocks.GRASS && world.random.nextFloat() >= 0.95F) {
|
||||
if (state.getBlock() == Blocks.GRASS_BLOCK && world.random.nextFloat() >= 0.95F) {
|
||||
ItemStack stack = new ItemStack(ActuallyItems.WORM.get(), world.random.nextInt(2) + 1);
|
||||
ItemEntity item = new ItemEntity(world, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, stack);
|
||||
world.addFreshEntity(item);
|
||||
|
|
|
@ -377,7 +377,7 @@
|
|||
"item.actuallyadditions.biomass": "Biomass (wip)",
|
||||
"item.actuallyadditions.biocoal": "Bio Coal (wip)",
|
||||
"item.actuallyadditions.player_probe": "Player Probe (wip)",
|
||||
"item.actuallyadditions.worm": "Worm (wip)",
|
||||
"item.actuallyadditions.worm": "Worm",
|
||||
"item.actuallyadditions.travelers_sack": "Traveler's Sack (wip)",
|
||||
"item.actuallyadditions.bag.storage": "filled slots (wip)",
|
||||
"item.actuallyadditions.void_sack": "Void Sack (wip)",
|
||||
|
|
Loading…
Reference in a new issue