[1.12.x] Added BucketUse event to ForgeUniversal Bucket (#4454)

This commit is contained in:
mcenderdragon 2017-11-17 22:10:23 +01:00 committed by LexManos
parent 7a31b10364
commit f97c535fa4

View file

@ -37,6 +37,7 @@ import net.minecraft.util.text.translation.I18n;
import net.minecraft.world.World;
import net.minecraftforge.common.capabilities.ICapabilityProvider;
import net.minecraftforge.event.entity.player.FillBucketEvent;
import net.minecraftforge.event.ForgeEventFactory;
import net.minecraftforge.fluids.capability.IFluidHandlerItem;
import net.minecraftforge.fluids.capability.wrappers.FluidBucketWrapper;
import net.minecraftforge.fml.common.eventhandler.Event;
@ -160,6 +161,9 @@ public class UniversalBucket extends Item
// clicked on a block?
RayTraceResult mop = this.rayTrace(world, player, false);
ActionResult<ItemStack> ret = ForgeEventFactory.onBucketUse(player, world, itemstack, mop);
if (ret != null) return ret;
if(mop == null || mop.typeOfHit != RayTraceResult.Type.BLOCK)
{
return ActionResult.newResult(EnumActionResult.PASS, itemstack);