aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/og/net/minecraft/world/entity/vehicle
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/og/net/minecraft/world/entity/vehicle')
-rw-r--r--patch-remap/og/net/minecraft/world/entity/vehicle/ChestBoat.patch68
-rw-r--r--patch-remap/og/net/minecraft/world/entity/vehicle/EntityBoat.patch114
-rw-r--r--patch-remap/og/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.patch208
-rw-r--r--patch-remap/og/net/minecraft/world/entity/vehicle/EntityMinecartCommandBlock.patch15
-rw-r--r--patch-remap/og/net/minecraft/world/entity/vehicle/EntityMinecartContainer.patch75
-rw-r--r--patch-remap/og/net/minecraft/world/entity/vehicle/EntityMinecartTNT.patch30
-rw-r--r--patch-remap/og/net/minecraft/world/entity/vehicle/VehicleEntity.patch62
7 files changed, 572 insertions, 0 deletions
diff --git a/patch-remap/og/net/minecraft/world/entity/vehicle/ChestBoat.patch b/patch-remap/og/net/minecraft/world/entity/vehicle/ChestBoat.patch
new file mode 100644
index 0000000000..fa8f1a63b7
--- /dev/null
+++ b/patch-remap/og/net/minecraft/world/entity/vehicle/ChestBoat.patch
@@ -0,0 +1,68 @@
+--- a/net/minecraft/world/entity/vehicle/ChestBoat.java
++++ b/net/minecraft/world/entity/vehicle/ChestBoat.java
+@@ -23,6 +23,13 @@
+ import net.minecraft.world.item.Items;
+ import net.minecraft.world.level.World;
+ import net.minecraft.world.level.gameevent.GameEvent;
++// CraftBukkit start
++import java.util.List;
++import org.bukkit.Location;
++import org.bukkit.craftbukkit.entity.CraftHumanEntity;
++import org.bukkit.entity.HumanEntity;
++import org.bukkit.inventory.InventoryHolder;
++// CraftBukkit end
+
+ public class ChestBoat extends EntityBoat implements HasCustomInventoryScreen, ContainerEntity {
+
+@@ -238,4 +245,51 @@
+ public void stopOpen(EntityHuman entityhuman) {
+ this.level().gameEvent(GameEvent.CONTAINER_CLOSE, this.position(), GameEvent.a.of((Entity) entityhuman));
+ }
++
++ // CraftBukkit start
++ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
++ private int maxStack = MAX_STACK;
++
++ @Override
++ public List<ItemStack> getContents() {
++ return this.itemStacks;
++ }
++
++ @Override
++ public void onOpen(CraftHumanEntity who) {
++ transaction.add(who);
++ }
++
++ @Override
++ public void onClose(CraftHumanEntity who) {
++ transaction.remove(who);
++ }
++
++ @Override
++ public List<HumanEntity> getViewers() {
++ return transaction;
++ }
++
++ @Override
++ public InventoryHolder getOwner() {
++ org.bukkit.entity.Entity entity = getBukkitEntity();
++ if (entity instanceof InventoryHolder) return (InventoryHolder) entity;
++ return null;
++ }
++
++ @Override
++ public int getMaxStackSize() {
++ return maxStack;
++ }
++
++ @Override
++ public void setMaxStackSize(int size) {
++ maxStack = size;
++ }
++
++ @Override
++ public Location getLocation() {
++ return getBukkitEntity().getLocation();
++ }
++ // CraftBukkit end
+ }
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();
diff --git a/patch-remap/og/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.patch b/patch-remap/og/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.patch
new file mode 100644
index 0000000000..fa2f12d6d9
--- /dev/null
+++ b/patch-remap/og/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.patch
@@ -0,0 +1,208 @@
+--- a/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java
++++ b/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java
+@@ -48,6 +48,14 @@
+ import net.minecraft.world.phys.Vec3D;
+ 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.VehicleEntityCollisionEvent;
++import org.bukkit.util.Vector;
++// CraftBukkit end
++
+ public abstract class EntityMinecartAbstract extends VehicleEntity {
+
+ private static final float LOWERED_PASSENGER_ATTACHMENT_Y = 0.0F;
+@@ -88,6 +96,17 @@
+ enummap.put(BlockPropertyTrackPosition.NORTH_EAST, Pair.of(baseblockposition2, baseblockposition1));
+ });
+
++ // CraftBukkit start
++ public boolean slowWhenEmpty = true;
++ private double derailedX = 0.5;
++ private double derailedY = 0.5;
++ private double derailedZ = 0.5;
++ private double flyingX = 0.95;
++ private double flyingY = 0.95;
++ private double flyingZ = 0.95;
++ public double maxSpeed = 0.4D;
++ // CraftBukkit end
++
+ protected EntityMinecartAbstract(EntityTypes<?> entitytypes, World world) {
+ super(entitytypes, world);
+ this.targetDeltaMovement = Vec3D.ZERO;
+@@ -128,7 +147,7 @@
+ object = new EntityMinecartRideable(worldserver, d0, d1, d2);
+ }
+
+- Object object1 = object;
++ EntityMinecartAbstract object1 = (EntityMinecartAbstract) object; // CraftBukkit- decompile error
+
+ EntityTypes.createDefaultStackConfig(worldserver, itemstack, entityhuman).accept(object1);
+ return (EntityMinecartAbstract) object1;
+@@ -267,6 +286,14 @@
+
+ @Override
+ public void tick() {
++ // CraftBukkit start
++ double prevX = this.getX();
++ double prevY = this.getY();
++ double prevZ = this.getZ();
++ float prevYaw = this.getYRot();
++ float prevPitch = this.getXRot();
++ // CraftBukkit end
++
+ if (this.getHurtTime() > 0) {
+ this.setHurtTime(this.getHurtTime() - 1);
+ }
+@@ -276,7 +303,7 @@
+ }
+
+ this.checkBelowWorld();
+- this.handleNetherPortal();
++ // this.handleNetherPortal(); // CraftBukkit - handled in postTick
+ if (this.level().isClientSide) {
+ if (this.lerpSteps > 0) {
+ this.lerpPositionAndRotationStep(this.lerpSteps, this.lerpX, this.lerpY, this.lerpZ, this.lerpYRot, this.lerpXRot);
+@@ -334,6 +361,18 @@
+ }
+
+ this.setRot(this.getYRot(), this.getXRot());
++ // CraftBukkit start
++ org.bukkit.World bworld = this.level().getWorld();
++ Location from = new Location(bworld, prevX, prevY, prevZ, prevYaw, prevPitch);
++ Location to = CraftLocation.toBukkit(this.position(), bworld, this.getYRot(), this.getXRot());
++ Vehicle vehicle = (Vehicle) this.getBukkitEntity();
++
++ this.level().getCraftServer().getPluginManager().callEvent(new org.bukkit.event.vehicle.VehicleUpdateEvent(vehicle));
++
++ if (!from.equals(to)) {
++ this.level().getCraftServer().getPluginManager().callEvent(new org.bukkit.event.vehicle.VehicleMoveEvent(vehicle, from, to));
++ }
++ // CraftBukkit end
+ if (this.getMinecartType() == EntityMinecartAbstract.EnumMinecartType.RIDEABLE && this.getDeltaMovement().horizontalDistanceSqr() > 0.01D) {
+ List<Entity> list = this.level().getEntities((Entity) this, this.getBoundingBox().inflate(0.20000000298023224D, 0.0D, 0.20000000298023224D), IEntitySelector.pushableBy(this));
+
+@@ -344,8 +383,26 @@
+ Entity entity = (Entity) iterator.next();
+
+ if (!(entity instanceof EntityHuman) && !(entity instanceof EntityIronGolem) && !(entity instanceof EntityMinecartAbstract) && !this.isVehicle() && !entity.isPassenger()) {
++ // CraftBukkit start
++ VehicleEntityCollisionEvent collisionEvent = new VehicleEntityCollisionEvent(vehicle, entity.getBukkitEntity());
++ this.level().getCraftServer().getPluginManager().callEvent(collisionEvent);
++
++ if (collisionEvent.isCancelled()) {
++ continue;
++ }
++ // CraftBukkit end
+ entity.startRiding(this);
+ } else {
++ // CraftBukkit start
++ if (!this.isPassengerOfSameVehicle(entity)) {
++ VehicleEntityCollisionEvent collisionEvent = new VehicleEntityCollisionEvent(vehicle, entity.getBukkitEntity());
++ this.level().getCraftServer().getPluginManager().callEvent(collisionEvent);
++
++ if (collisionEvent.isCancelled()) {
++ continue;
++ }
++ }
++ // CraftBukkit end
+ entity.push(this);
+ }
+ }
+@@ -357,6 +414,14 @@
+ Entity entity1 = (Entity) iterator1.next();
+
+ if (!this.hasPassenger(entity1) && entity1.isPushable() && entity1 instanceof EntityMinecartAbstract) {
++ // CraftBukkit start
++ VehicleEntityCollisionEvent collisionEvent = new VehicleEntityCollisionEvent(vehicle, entity1.getBukkitEntity());
++ this.level().getCraftServer().getPluginManager().callEvent(collisionEvent);
++
++ if (collisionEvent.isCancelled()) {
++ continue;
++ }
++ // CraftBukkit end
+ entity1.push(this);
+ }
+ }
+@@ -373,7 +438,7 @@
+ }
+
+ protected double getMaxSpeed() {
+- return (this.isInWater() ? 4.0D : 8.0D) / 20.0D;
++ return (this.isInWater() ? this.maxSpeed / 2.0D: this.maxSpeed); // CraftBukkit
+ }
+
+ public void activateMinecart(int i, int j, int k, boolean flag) {}
+@@ -384,12 +449,16 @@
+
+ this.setDeltaMovement(MathHelper.clamp(vec3d.x, -d0, d0), vec3d.y, MathHelper.clamp(vec3d.z, -d0, d0));
+ if (this.onGround()) {
+- this.setDeltaMovement(this.getDeltaMovement().scale(0.5D));
++ // CraftBukkit start - replace magic numbers with our variables
++ this.setDeltaMovement(new Vec3D(this.getDeltaMovement().x * this.derailedX, this.getDeltaMovement().y * this.derailedY, this.getDeltaMovement().z * this.derailedZ));
++ // CraftBukkit end
+ }
+
+ this.move(EnumMoveType.SELF, this.getDeltaMovement());
+ if (!this.onGround()) {
+- this.setDeltaMovement(this.getDeltaMovement().scale(0.95D));
++ // CraftBukkit start - replace magic numbers with our variables
++ this.setDeltaMovement(new Vec3D(this.getDeltaMovement().x * this.flyingX, this.getDeltaMovement().y * this.flyingY, this.getDeltaMovement().z * this.flyingZ));
++ // CraftBukkit end
+ }
+
+ }
+@@ -585,7 +654,7 @@
+ }
+
+ protected void applyNaturalSlowdown() {
+- double d0 = this.isVehicle() ? 0.997D : 0.96D;
++ double d0 = this.isVehicle() || !this.slowWhenEmpty ? 0.997D : 0.96D; // CraftBukkit - add !this.slowWhenEmpty
+ Vec3D vec3d = this.getDeltaMovement();
+
+ vec3d = vec3d.multiply(d0, 0.0D, d0);
+@@ -724,6 +793,14 @@
+ if (!this.level().isClientSide) {
+ if (!entity.noPhysics && !this.noPhysics) {
+ if (!this.hasPassenger(entity)) {
++ // CraftBukkit start
++ VehicleEntityCollisionEvent collisionEvent = new VehicleEntityCollisionEvent((Vehicle) this.getBukkitEntity(), entity.getBukkitEntity());
++ this.level().getCraftServer().getPluginManager().callEvent(collisionEvent);
++
++ if (collisionEvent.isCancelled()) {
++ return;
++ }
++ // CraftBukkit end
+ double d0 = entity.getX() - this.getX();
+ double d1 = entity.getZ() - this.getZ();
+ double d2 = d0 * d0 + d1 * d1;
+@@ -898,4 +975,26 @@
+
+ private EnumMinecartType() {}
+ }
++
++ // CraftBukkit start - Methods for getting and setting flying and derailed velocity modifiers
++ public Vector getFlyingVelocityMod() {
++ return new Vector(flyingX, flyingY, flyingZ);
++ }
++
++ public void setFlyingVelocityMod(Vector flying) {
++ flyingX = flying.getX();
++ flyingY = flying.getY();
++ flyingZ = flying.getZ();
++ }
++
++ public Vector getDerailedVelocityMod() {
++ return new Vector(derailedX, derailedY, derailedZ);
++ }
++
++ public void setDerailedVelocityMod(Vector derailed) {
++ derailedX = derailed.getX();
++ derailedY = derailed.getY();
++ derailedZ = derailed.getZ();
++ }
++ // CraftBukkit end
+ }
diff --git a/patch-remap/og/net/minecraft/world/entity/vehicle/EntityMinecartCommandBlock.patch b/patch-remap/og/net/minecraft/world/entity/vehicle/EntityMinecartCommandBlock.patch
new file mode 100644
index 0000000000..fc124c7edf
--- /dev/null
+++ b/patch-remap/og/net/minecraft/world/entity/vehicle/EntityMinecartCommandBlock.patch
@@ -0,0 +1,15 @@
+--- a/net/minecraft/world/entity/vehicle/EntityMinecartCommandBlock.java
++++ b/net/minecraft/world/entity/vehicle/EntityMinecartCommandBlock.java
+@@ -143,5 +143,12 @@
+ public boolean isValid() {
+ return !EntityMinecartCommandBlock.this.isRemoved();
+ }
++
++ // CraftBukkit start
++ @Override
++ public org.bukkit.command.CommandSender getBukkitSender(CommandListenerWrapper wrapper) {
++ return (org.bukkit.craftbukkit.entity.CraftMinecartCommand) EntityMinecartCommandBlock.this.getBukkitEntity();
++ }
++ // CraftBukkit end
+ }
+ }
diff --git a/patch-remap/og/net/minecraft/world/entity/vehicle/EntityMinecartContainer.patch b/patch-remap/og/net/minecraft/world/entity/vehicle/EntityMinecartContainer.patch
new file mode 100644
index 0000000000..b5693bdfa2
--- /dev/null
+++ b/patch-remap/og/net/minecraft/world/entity/vehicle/EntityMinecartContainer.patch
@@ -0,0 +1,75 @@
+--- a/net/minecraft/world/entity/vehicle/EntityMinecartContainer.java
++++ b/net/minecraft/world/entity/vehicle/EntityMinecartContainer.java
+@@ -18,6 +18,14 @@
+ import net.minecraft.world.item.ItemStack;
+ import net.minecraft.world.level.World;
+
++// CraftBukkit start
++import java.util.List;
++import org.bukkit.Location;
++import org.bukkit.craftbukkit.entity.CraftHumanEntity;
++import org.bukkit.entity.HumanEntity;
++import org.bukkit.inventory.InventoryHolder;
++// CraftBukkit end
++
+ public abstract class EntityMinecartContainer extends EntityMinecartAbstract implements ContainerEntity {
+
+ private NonNullList<ItemStack> itemStacks;
+@@ -25,14 +33,55 @@
+ public MinecraftKey lootTable;
+ public long lootTableSeed;
+
++ // CraftBukkit start
++ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
++ private int maxStack = MAX_STACK;
++
++ public List<ItemStack> getContents() {
++ return this.itemStacks;
++ }
++
++ public void onOpen(CraftHumanEntity who) {
++ transaction.add(who);
++ }
++
++ public void onClose(CraftHumanEntity who) {
++ transaction.remove(who);
++ }
++
++ public List<HumanEntity> getViewers() {
++ return transaction;
++ }
++
++ public InventoryHolder getOwner() {
++ org.bukkit.entity.Entity cart = getBukkitEntity();
++ if(cart instanceof InventoryHolder) return (InventoryHolder) cart;
++ return null;
++ }
++
++ @Override
++ public int getMaxStackSize() {
++ return maxStack;
++ }
++
++ public void setMaxStackSize(int size) {
++ maxStack = size;
++ }
++
++ @Override
++ public Location getLocation() {
++ return getBukkitEntity().getLocation();
++ }
++ // CraftBukkit end
++
+ protected EntityMinecartContainer(EntityTypes<?> entitytypes, World world) {
+ super(entitytypes, world);
+- this.itemStacks = NonNullList.withSize(36, ItemStack.EMPTY);
++ this.itemStacks = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY); // CraftBukkit - SPIGOT-3513
+ }
+
+ protected EntityMinecartContainer(EntityTypes<?> entitytypes, double d0, double d1, double d2, World world) {
+ super(entitytypes, world, d0, d1, d2);
+- this.itemStacks = NonNullList.withSize(36, ItemStack.EMPTY);
++ this.itemStacks = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY); // CraftBukkit - SPIGOT-3513
+ }
+
+ @Override
diff --git a/patch-remap/og/net/minecraft/world/entity/vehicle/EntityMinecartTNT.patch b/patch-remap/og/net/minecraft/world/entity/vehicle/EntityMinecartTNT.patch
new file mode 100644
index 0000000000..9e12da637f
--- /dev/null
+++ b/patch-remap/og/net/minecraft/world/entity/vehicle/EntityMinecartTNT.patch
@@ -0,0 +1,30 @@
+--- a/net/minecraft/world/entity/vehicle/EntityMinecartTNT.java
++++ b/net/minecraft/world/entity/vehicle/EntityMinecartTNT.java
+@@ -23,6 +23,10 @@
+ import net.minecraft.world.level.block.state.IBlockData;
+ import net.minecraft.world.level.material.Fluid;
+
++// CraftBukkit start
++import org.bukkit.event.entity.ExplosionPrimeEvent;
++// CraftBukkit end
++
+ public class EntityMinecartTNT extends EntityMinecartAbstract {
+
+ private static final byte EVENT_PRIME = 10;
+@@ -115,7 +119,15 @@
+ d1 = 5.0D;
+ }
+
+- this.level().explode(this, damagesource, (ExplosionDamageCalculator) null, this.getX(), this.getY(), this.getZ(), (float) (4.0D + this.random.nextDouble() * 1.5D * d1), false, World.a.TNT);
++ // CraftBukkit start
++ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), (float) (4.0D + this.random.nextDouble() * 1.5D * d1), false);
++ this.level().getCraftServer().getPluginManager().callEvent(event);
++ if (event.isCancelled()) {
++ fuse = -1;
++ return;
++ }
++ this.level().explode(this, damagesource, (ExplosionDamageCalculator) null, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), World.a.TNT);
++ // CraftBukkit end
+ this.discard();
+ }
+
diff --git a/patch-remap/og/net/minecraft/world/entity/vehicle/VehicleEntity.patch b/patch-remap/og/net/minecraft/world/entity/vehicle/VehicleEntity.patch
new file mode 100644
index 0000000000..ea7db6b296
--- /dev/null
+++ b/patch-remap/og/net/minecraft/world/entity/vehicle/VehicleEntity.patch
@@ -0,0 +1,62 @@
+--- a/net/minecraft/world/entity/vehicle/VehicleEntity.java
++++ b/net/minecraft/world/entity/vehicle/VehicleEntity.java
+@@ -13,6 +13,12 @@
+ import net.minecraft.world.level.World;
+ import net.minecraft.world.level.gameevent.GameEvent;
+
++// CraftBukkit start
++import org.bukkit.entity.Vehicle;
++import org.bukkit.event.vehicle.VehicleDamageEvent;
++import org.bukkit.event.vehicle.VehicleDestroyEvent;
++// CraftBukkit end
++
+ public abstract class VehicleEntity extends Entity {
+
+ protected static final DataWatcherObject<Integer> DATA_ID_HURT = DataWatcher.defineId(VehicleEntity.class, DataWatcherRegistry.INT);
+@@ -29,6 +35,18 @@
+ if (this.isInvulnerableTo(damagesource)) {
+ return false;
+ } else {
++ // CraftBukkit start
++ Vehicle vehicle = (Vehicle) this.getBukkitEntity();
++ org.bukkit.entity.Entity attacker = (damagesource.getEntity() == null) ? null : damagesource.getEntity().getBukkitEntity();
++
++ VehicleDamageEvent event = new VehicleDamageEvent(vehicle, attacker, (double) f);
++ this.level().getCraftServer().getPluginManager().callEvent(event);
++
++ if (event.isCancelled()) {
++ return false;
++ }
++ f = (float) event.getDamage();
++ // CraftBukkit end
+ this.setHurtDir(-this.getHurtDir());
+ this.setHurtTime(10);
+ this.markHurt();
+@@ -38,9 +56,27 @@
+
+ if ((flag || this.getDamage() <= 40.0F) && !this.shouldSourceDestroy(damagesource)) {
+ if (flag) {
++ // CraftBukkit start
++ VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, attacker);
++ this.level().getCraftServer().getPluginManager().callEvent(destroyEvent);
++
++ if (destroyEvent.isCancelled()) {
++ this.setDamage(40.0F); // Maximize damage so this doesn't get triggered again right away
++ return true;
++ }
++ // CraftBukkit end
+ this.discard();
+ }
+ } else {
++ // CraftBukkit start
++ VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, attacker);
++ this.level().getCraftServer().getPluginManager().callEvent(destroyEvent);
++
++ if (destroyEvent.isCancelled()) {
++ this.setDamage(40.0F); // Maximize damage so this doesn't get triggered again right away
++ return true;
++ }
++ // CraftBukkit end
+ this.destroy(damagesource);
+ }
+