@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/EntityBoat.java
|
||||
+++ b/net/minecraft/server/EntityBoat.java
|
||||
@@ -3,6 +3,15 @@
|
||||
@@ -4,6 +4,15 @@
|
||||
import java.util.List;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@@ -16,9 +16,9 @@
|
||||
public class EntityBoat extends Entity {
|
||||
|
||||
private static final DataWatcherObject<Integer> b = DataWatcher.a(EntityBoat.class, DataWatcherRegistry.b);
|
||||
@@ -37,6 +46,14 @@
|
||||
@@ -38,6 +47,14 @@
|
||||
private float aK;
|
||||
private float aL;
|
||||
private float aM;
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ // PAIL: Some of these haven't worked since a few updates, and since 1.9 they are less and less applicable.
|
||||
@@ -30,44 +30,44 @@
|
||||
+
|
||||
public EntityBoat(EntityTypes<? extends EntityBoat> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
this.ap = new float[2];
|
||||
@@ -98,6 +115,19 @@
|
||||
if (damagesource instanceof EntityDamageSourceIndirect && damagesource.getEntity() != null && this.w(damagesource.getEntity())) {
|
||||
return false;
|
||||
} else {
|
||||
+ // CraftBukkit start
|
||||
+ Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
||||
+ org.bukkit.entity.Entity attacker = (damagesource.getEntity() == null) ? null : damagesource.getEntity().getBukkitEntity();
|
||||
this.ao = new float[2];
|
||||
@@ -101,6 +118,19 @@
|
||||
if (this.isInvulnerable(damagesource)) {
|
||||
return false;
|
||||
} else if (!this.world.isClientSide && !this.dead) {
|
||||
+ // 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.world.getServer().getPluginManager().callEvent(event);
|
||||
+ VehicleDamageEvent event = new VehicleDamageEvent(vehicle, attacker, (double) f);
|
||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // f = event.getDamage(); // TODO Why don't we do this?
|
||||
+ // CraftBukkit end
|
||||
+ if (event.isCancelled()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // f = event.getDamage(); // TODO Why don't we do this?
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
this.c(-this.o());
|
||||
this.b(10);
|
||||
this.setDamage(this.getDamage() + f * 10.0F);
|
||||
@@ -105,6 +135,15 @@
|
||||
boolean flag = damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).abilities.canInstantlyBuild;
|
||||
this.c(-this.o());
|
||||
this.b(10);
|
||||
this.setDamage(this.getDamage() + f * 10.0F);
|
||||
@@ -108,6 +138,15 @@
|
||||
boolean flag = damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).abilities.canInstantlyBuild;
|
||||
|
||||
if (flag || this.getDamage() > 40.0F) {
|
||||
+ // CraftBukkit start
|
||||
+ VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, attacker);
|
||||
+ this.world.getServer().getPluginManager().callEvent(destroyEvent);
|
||||
if (flag || this.getDamage() > 40.0F) {
|
||||
+ // CraftBukkit start
|
||||
+ VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, attacker);
|
||||
+ this.world.getServer().getPluginManager().callEvent(destroyEvent);
|
||||
+
|
||||
+ if (destroyEvent.isCancelled()) {
|
||||
+ this.setDamage(40F); // Maximize damage so this doesn't get triggered again right away
|
||||
+ return true;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (!flag && this.world.getGameRules().getBoolean(GameRules.DO_ENTITY_DROPS)) {
|
||||
this.a((IMaterial) this.f());
|
||||
}
|
||||
@@ -140,9 +179,29 @@
|
||||
+ if (destroyEvent.isCancelled()) {
|
||||
+ this.setDamage(40F); // Maximize damage so this doesn't get triggered again right away
|
||||
+ return true;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (!flag && this.world.getGameRules().getBoolean(GameRules.DO_ENTITY_DROPS)) {
|
||||
this.a((IMaterial) this.g());
|
||||
}
|
||||
@@ -142,9 +181,29 @@
|
||||
public void collide(Entity entity) {
|
||||
if (entity instanceof EntityBoat) {
|
||||
if (entity.getBoundingBox().minY < this.getBoundingBox().maxY) {
|
||||
@@ -97,15 +97,15 @@
|
||||
super.collide(entity);
|
||||
}
|
||||
|
||||
@@ -176,6 +235,7 @@
|
||||
return this.getDirection().f();
|
||||
@@ -178,6 +237,7 @@
|
||||
return this.getDirection().g();
|
||||
}
|
||||
|
||||
+ private Location lastLocation; // CraftBukkit
|
||||
@Override
|
||||
public void tick() {
|
||||
this.aG = this.aF;
|
||||
@@ -216,6 +276,22 @@
|
||||
this.aF = this.aE;
|
||||
@@ -218,6 +278,22 @@
|
||||
this.setMot(Vec3D.a);
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@
|
||||
this.q();
|
||||
|
||||
for (int i = 0; i <= 1; ++i) {
|
||||
@@ -734,6 +810,11 @@
|
||||
@@ -709,6 +785,11 @@
|
||||
|
||||
this.b(this.fallDistance, 1.0F);
|
||||
if (!this.world.isClientSide && !this.dead) {
|
||||
@@ -140,7 +140,7 @@
|
||||
this.die();
|
||||
if (this.world.getGameRules().getBoolean(GameRules.DO_ENTITY_DROPS)) {
|
||||
int i;
|
||||
@@ -747,6 +828,7 @@
|
||||
@@ -722,6 +803,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user