diff options
Diffstat (limited to 'patch-remap/og/net/minecraft/world/entity/vehicle/EntityBoat.patch')
-rw-r--r-- | patch-remap/og/net/minecraft/world/entity/vehicle/EntityBoat.patch | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/patch-remap/og/net/minecraft/world/entity/vehicle/EntityBoat.patch b/patch-remap/og/net/minecraft/world/entity/vehicle/EntityBoat.patch new file mode 100644 index 0000000000..3541afdcf1 --- /dev/null +++ b/patch-remap/og/net/minecraft/world/entity/vehicle/EntityBoat.patch @@ -0,0 +1,114 @@ +--- a/net/minecraft/world/entity/vehicle/EntityBoat.java ++++ b/net/minecraft/world/entity/vehicle/EntityBoat.java +@@ -55,6 +55,15 @@ + import net.minecraft.world.phys.shapes.VoxelShapes; + 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 EntityBoat extends VehicleEntity implements VariantHolder<EntityBoat.EnumBoatType> { + + private static final DataWatcherObject<Integer> DATA_ID_TYPE = DataWatcher.defineId(EntityBoat.class, DataWatcherRegistry.INT); +@@ -92,6 +101,14 @@ + private float bubbleAngle; + private float bubbleAngleO; + ++ // 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 EntityBoat(EntityTypes<? extends EntityBoat> entitytypes, World world) { + super(entitytypes, world); + this.paddlePositions = new float[2]; +@@ -192,9 +209,29 @@ + public void push(Entity entity) { + if (entity instanceof EntityBoat) { + 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); + } + +@@ -288,6 +325,7 @@ + return this.getDirection().getClockWise(); + } + ++ private Location lastLocation; // CraftBukkit + @Override + public void tick() { + this.oldStatus = this.status; +@@ -328,6 +366,22 @@ + this.setDeltaMovement(Vec3D.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) { +@@ -813,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; +@@ -826,6 +885,7 @@ + } + } + } ++ } // CraftBukkit end + } + + this.resetFallDistance(); |