diff options
Diffstat (limited to 'patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/vehicle/Boat.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/vehicle/Boat.java.patch | 118 |
1 files changed, 118 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/vehicle/Boat.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/vehicle/Boat.java.patch new file mode 100644 index 0000000000..341637cd7d --- /dev/null +++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/vehicle/Boat.java.patch @@ -0,0 +1,118 @@ +--- a/net/minecraft/world/entity/vehicle/Boat.java ++++ b/net/minecraft/world/entity/vehicle/Boat.java +@@ -55,6 +55,15 @@ + import net.minecraft.world.phys.shapes.VoxelShape; + import org.joml.Vector3f; + ++// CraftBukkit start ++import org.bukkit.Location; ++import org.bukkit.craftbukkit.util.CraftLocation; ++import org.bukkit.entity.Vehicle; ++import org.bukkit.event.vehicle.VehicleDestroyEvent; ++import org.bukkit.event.vehicle.VehicleEntityCollisionEvent; ++import org.bukkit.event.vehicle.VehicleMoveEvent; ++// CraftBukkit end ++ + public class Boat extends VehicleEntity implements VariantHolder<Boat.Type> { + + private static final EntityDataAccessor<Integer> DATA_ID_TYPE = SynchedEntityData.defineId(Boat.class, EntityDataSerializers.INT); +@@ -92,8 +101,16 @@ + private float bubbleAngle; + private float bubbleAngleO; + +- public Boat(EntityType<? extends Boat> entitytype, Level level) { +- super(entitytype, level); ++ // CraftBukkit start ++ // PAIL: Some of these haven't worked since a few updates, and since 1.9 they are less and less applicable. ++ public double maxSpeed = 0.4D; ++ public double occupiedDeceleration = 0.2D; ++ public double unoccupiedDeceleration = -1; ++ public boolean landBoats = false; ++ // CraftBukkit end ++ ++ public Boat(EntityType<? extends Boat> entityType, Level level) { ++ super(entityType, level); + this.paddlePositions = new float[2]; + this.blocksBuilding = true; + } +@@ -202,9 +209,29 @@ + public void push(Entity entity) { + if (entity instanceof Boat) { + if (entity.getBoundingBox().minY < this.getBoundingBox().maxY) { ++ // CraftBukkit start ++ if (!this.isPassengerOfSameVehicle(entity)) { ++ VehicleEntityCollisionEvent event = new VehicleEntityCollisionEvent((Vehicle) this.getBukkitEntity(), entity.getBukkitEntity()); ++ this.level().getCraftServer().getPluginManager().callEvent(event); ++ ++ if (event.isCancelled()) { ++ return; ++ } ++ } ++ // CraftBukkit end + super.push(entity); + } + } else if (entity.getBoundingBox().minY <= this.getBoundingBox().minY) { ++ // CraftBukkit start ++ if (!this.isPassengerOfSameVehicle(entity)) { ++ VehicleEntityCollisionEvent event = new VehicleEntityCollisionEvent((Vehicle) this.getBukkitEntity(), entity.getBukkitEntity()); ++ this.level().getCraftServer().getPluginManager().callEvent(event); ++ ++ if (event.isCancelled()) { ++ return; ++ } ++ } ++ // CraftBukkit end + super.push(entity); + } + +@@ -308,6 +325,7 @@ + return this.getDirection().getClockWise(); + } + ++ private Location lastLocation; // CraftBukkit + @Override + @Override + public void tick() { +@@ -349,6 +366,22 @@ + this.setDeltaMovement(Vec3.ZERO); + } + ++ // CraftBukkit start ++ org.bukkit.Server server = this.level().getCraftServer(); ++ org.bukkit.World bworld = this.level().getWorld(); ++ ++ Location to = CraftLocation.toBukkit(this.position(), bworld, this.getYRot(), this.getXRot()); ++ Vehicle vehicle = (Vehicle) this.getBukkitEntity(); ++ ++ server.getPluginManager().callEvent(new org.bukkit.event.vehicle.VehicleUpdateEvent(vehicle)); ++ ++ if (lastLocation != null && !lastLocation.equals(to)) { ++ VehicleMoveEvent event = new VehicleMoveEvent(vehicle, lastLocation, to); ++ server.getPluginManager().callEvent(event); ++ } ++ lastLocation = vehicle.getLocation(); ++ // CraftBukkit end ++ + this.tickBubbleColumn(); + + for (int i = 0; i <= 1; ++i) { +@@ -841,6 +867,11 @@ + + this.causeFallDamage(this.fallDistance, 1.0F, this.damageSources().fall()); + if (!this.level().isClientSide && !this.isRemoved()) { ++ // CraftBukkit start ++ Vehicle vehicle = (Vehicle) this.getBukkitEntity(); ++ VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, null); ++ this.level().getCraftServer().getPluginManager().callEvent(destroyEvent); ++ if (!destroyEvent.isCancelled()) { + this.kill(); + if (this.level().getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) { + int i; +@@ -854,6 +885,7 @@ + } + } + } ++ } // CraftBukkit end + } + + this.resetFallDistance(); |