aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/vehicle/Boat.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/vehicle/Boat.java.patch')
-rw-r--r--patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/vehicle/Boat.java.patch114
1 files changed, 114 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/vehicle/Boat.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/vehicle/Boat.java.patch
new file mode 100644
index 0000000000..4fb52855db
--- /dev/null
+++ b/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/vehicle/Boat.java.patch
@@ -0,0 +1,114 @@
+--- a/net/minecraft/world/entity/vehicle/Boat.java
++++ b/net/minecraft/world/entity/vehicle/Boat.java
+@@ -52,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);
+ private static final EntityDataAccessor<Boolean> DATA_ID_PADDLE_LEFT = SynchedEntityData.defineId(Boat.class, EntityDataSerializers.BOOLEAN);
+@@ -88,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 Boat(EntityType<? extends Boat> entityType, Level level) {
+ super(entityType, level);
+ this.blocksBuilding = true;
+@@ -198,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);
+ }
+ }
+@@ -272,6 +325,7 @@
+ return this.getDirection().getClockWise();
+ }
+
++ private Location lastLocation; // CraftBukkit
+ @Override
+ public void tick() {
+ this.oldStatus = this.status;
+@@ -312,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++) {
+@@ -782,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)) {
+ for (int i = 0; i < 3; i++) {
+@@ -793,6 +885,7 @@
+ }
+ }
+ }
++ } // CraftBukkit end
+ }
+
+ this.resetFallDistance();