2021-03-15 23:00:00 +01:00
|
|
|
--- a/net/minecraft/world/item/ItemBoat.java
|
|
|
|
+++ b/net/minecraft/world/item/ItemBoat.java
|
2024-04-23 17:15:00 +02:00
|
|
|
@@ -61,6 +61,13 @@
|
2019-04-23 04:00:00 +02:00
|
|
|
}
|
|
|
|
|
2020-06-25 02:00:00 +02:00
|
|
|
if (movingobjectpositionblock.getType() == MovingObjectPosition.EnumMovingObjectType.BLOCK) {
|
2016-02-29 22:32:46 +01:00
|
|
|
+ // CraftBukkit start - Boat placement
|
2023-06-17 06:31:40 +02:00
|
|
|
+ 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());
|
2014-11-25 22:32:16 +01:00
|
|
|
+
|
2016-02-29 22:32:46 +01:00
|
|
|
+ if (event.isCancelled()) {
|
2021-03-15 23:00:00 +01:00
|
|
|
+ return InteractionResultWrapper.pass(itemstack);
|
2016-02-29 22:32:46 +01:00
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2023-12-05 17:40:00 +01:00
|
|
|
EntityBoat entityboat = this.getBoat(world, movingobjectpositionblock, itemstack, entityhuman);
|
2019-04-23 04:00:00 +02:00
|
|
|
|
2022-12-07 17:00:00 +01:00
|
|
|
entityboat.setVariant(this.type);
|
2024-04-23 17:15:00 +02:00
|
|
|
@@ -69,7 +76,15 @@
|
2020-01-21 22:00:00 +01:00
|
|
|
return InteractionResultWrapper.fail(itemstack);
|
2017-03-21 23:03:20 +01:00
|
|
|
} else {
|
|
|
|
if (!world.isClientSide) {
|
2021-11-21 23:00:00 +01:00
|
|
|
- world.addFreshEntity(entityboat);
|
2019-12-19 02:53:27 +01:00
|
|
|
+ // CraftBukkit start
|
2022-10-02 00:07:14 +02:00
|
|
|
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPlaceEvent(world, movingobjectpositionblock.getBlockPos(), movingobjectpositionblock.getDirection(), entityhuman, entityboat, enumhand).isCancelled()) {
|
2020-01-21 22:00:00 +01:00
|
|
|
+ return InteractionResultWrapper.fail(itemstack);
|
2019-12-19 02:53:27 +01:00
|
|
|
+ }
|
|
|
|
+
|
2021-11-21 23:00:00 +01:00
|
|
|
+ if (!world.addFreshEntity(entityboat)) {
|
2021-03-15 23:00:00 +01:00
|
|
|
+ return InteractionResultWrapper.pass(itemstack);
|
2019-12-19 02:53:27 +01:00
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2024-04-23 17:15:00 +02:00
|
|
|
world.gameEvent((Entity) entityhuman, (Holder) GameEvent.ENTITY_PLACE, movingobjectpositionblock.getLocation());
|
|
|
|
itemstack.consume(1, entityhuman);
|
|
|
|
}
|
|
|
|
@@ -85,7 +100,7 @@
|
2023-12-05 17:40:00 +01:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2024-04-23 17:15:00 +02:00
|
|
|
if (world instanceof WorldServer worldserver) {
|
|
|
|
EntityTypes.createDefaultStackConfig(worldserver, itemstack, entityhuman).accept(object);
|