@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/ItemBoat.java
|
||||
+++ b/net/minecraft/world/item/ItemBoat.java
|
||||
@@ -61,6 +61,13 @@
|
||||
@@ -58,6 +58,13 @@
|
||||
}
|
||||
|
||||
if (movingobjectpositionblock.getType() == MovingObjectPosition.EnumMovingObjectType.BLOCK) {
|
||||
@@ -8,35 +8,26 @@
|
||||
+ org.bukkit.event.player.PlayerInteractEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent(entityhuman, org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK, movingobjectpositionblock.getBlockPos(), movingobjectpositionblock.getDirection(), itemstack, false, enumhand, movingobjectpositionblock.getLocation());
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return InteractionResultWrapper.pass(itemstack);
|
||||
+ return EnumInteractionResult.PASS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
EntityBoat entityboat = this.getBoat(world, movingobjectpositionblock, itemstack, entityhuman);
|
||||
AbstractBoat abstractboat = this.getBoat(world, movingobjectpositionblock, itemstack, entityhuman);
|
||||
|
||||
entityboat.setVariant(this.type);
|
||||
@@ -69,7 +76,15 @@
|
||||
return InteractionResultWrapper.fail(itemstack);
|
||||
} else {
|
||||
if (!world.isClientSide) {
|
||||
- world.addFreshEntity(entityboat);
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPlaceEvent(world, movingobjectpositionblock.getBlockPos(), movingobjectpositionblock.getDirection(), entityhuman, entityboat, enumhand).isCancelled()) {
|
||||
+ return InteractionResultWrapper.fail(itemstack);
|
||||
+ }
|
||||
if (abstractboat == null) {
|
||||
@@ -68,7 +75,15 @@
|
||||
return EnumInteractionResult.FAIL;
|
||||
} else {
|
||||
if (!world.isClientSide) {
|
||||
- world.addFreshEntity(abstractboat);
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPlaceEvent(world, movingobjectpositionblock.getBlockPos(), movingobjectpositionblock.getDirection(), entityhuman, abstractboat, enumhand).isCancelled()) {
|
||||
+ return EnumInteractionResult.FAIL;
|
||||
+ }
|
||||
+
|
||||
+ if (!world.addFreshEntity(entityboat)) {
|
||||
+ return InteractionResultWrapper.pass(itemstack);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.gameEvent((Entity) entityhuman, (Holder) GameEvent.ENTITY_PLACE, movingobjectpositionblock.getLocation());
|
||||
itemstack.consume(1, entityhuman);
|
||||
}
|
||||
@@ -85,7 +100,7 @@
|
||||
|
||||
private EntityBoat getBoat(World world, MovingObjectPosition movingobjectposition, ItemStack itemstack, EntityHuman entityhuman) {
|
||||
Vec3D vec3d = movingobjectposition.getLocation();
|
||||
- Object object = this.hasChest ? new ChestBoat(world, vec3d.x, vec3d.y, vec3d.z) : new EntityBoat(world, vec3d.x, vec3d.y, vec3d.z);
|
||||
+ EntityBoat object = this.hasChest ? new ChestBoat(world, vec3d.x, vec3d.y, vec3d.z) : new EntityBoat(world, vec3d.x, vec3d.y, vec3d.z); // CraftBukkit - decompile error
|
||||
|
||||
if (world instanceof WorldServer worldserver) {
|
||||
EntityTypes.createDefaultStackConfig(worldserver, itemstack, entityhuman).accept(object);
|
||||
+ if (!world.addFreshEntity(abstractboat)) {
|
||||
+ return EnumInteractionResult.PASS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.gameEvent((Entity) entityhuman, (Holder) GameEvent.ENTITY_PLACE, movingobjectpositionblock.getLocation());
|
||||
itemstack.consume(1, entityhuman);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user