@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java
|
||||
+++ b/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java
|
||||
@@ -50,6 +50,15 @@
|
||||
@@ -49,6 +49,15 @@
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -15,17 +15,8 @@
|
||||
+
|
||||
public abstract class EntityMinecartAbstract extends Entity {
|
||||
|
||||
private static final DataWatcherObject<Integer> DATA_ID_HURT = DataWatcher.a(EntityMinecartAbstract.class, DataWatcherRegistry.INT);
|
||||
@@ -61,7 +70,7 @@
|
||||
private static final ImmutableMap<EntityPose, ImmutableList<Integer>> POSE_DISMOUNT_HEIGHTS = ImmutableMap.of(EntityPose.STANDING, ImmutableList.of(0, 1, -1), EntityPose.CROUCHING, ImmutableList.of(0, 1, -1), EntityPose.SWIMMING, ImmutableList.of(0, 1));
|
||||
protected static final float WATER_SLOWDOWN_FACTOR = 0.95F;
|
||||
private boolean flipped;
|
||||
- private static final Map<BlockPropertyTrackPosition, Pair<BaseBlockPosition, BaseBlockPosition>> EXITS = (Map) SystemUtils.a((Object) Maps.newEnumMap(BlockPropertyTrackPosition.class), (enummap) -> {
|
||||
+ private static final Map<BlockPropertyTrackPosition, Pair<BaseBlockPosition, BaseBlockPosition>> EXITS = (Map) SystemUtils.a(Maps.newEnumMap(BlockPropertyTrackPosition.class), (enummap) -> { // CraftBukkit - decompile error
|
||||
BaseBlockPosition baseblockposition = EnumDirection.WEST.p();
|
||||
BaseBlockPosition baseblockposition1 = EnumDirection.EAST.p();
|
||||
BaseBlockPosition baseblockposition2 = EnumDirection.NORTH.p();
|
||||
@@ -92,6 +101,17 @@
|
||||
private static final DataWatcherObject<Integer> DATA_ID_HURT = DataWatcher.defineId(EntityMinecartAbstract.class, DataWatcherRegistry.INT);
|
||||
@@ -91,6 +100,17 @@
|
||||
private double lyd;
|
||||
private double lzd;
|
||||
|
||||
@@ -43,8 +34,8 @@
|
||||
protected EntityMinecartAbstract(EntityTypes<?> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
this.blocksBuilding = true;
|
||||
@@ -218,6 +238,19 @@
|
||||
if (this.isInvulnerable(damagesource)) {
|
||||
@@ -217,6 +237,19 @@
|
||||
if (this.isInvulnerableTo(damagesource)) {
|
||||
return false;
|
||||
} else {
|
||||
+ // CraftBukkit start - fire VehicleDamageEvent
|
||||
@@ -60,10 +51,10 @@
|
||||
+
|
||||
+ f = (float) event.getDamage();
|
||||
+ // CraftBukkit end
|
||||
this.d(-this.o());
|
||||
this.c(10);
|
||||
this.velocityChanged();
|
||||
@@ -226,6 +259,15 @@
|
||||
this.setHurtDir(-this.getHurtDir());
|
||||
this.setHurtTime(10);
|
||||
this.markHurt();
|
||||
@@ -225,6 +258,15 @@
|
||||
boolean flag = damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).getAbilities().instabuild;
|
||||
|
||||
if (flag || this.getDamage() > 40.0F) {
|
||||
@@ -78,39 +69,39 @@
|
||||
+ // CraftBukkit end
|
||||
this.ejectPassengers();
|
||||
if (flag && !this.hasCustomName()) {
|
||||
this.die();
|
||||
@@ -285,6 +327,14 @@
|
||||
this.discard();
|
||||
@@ -284,6 +326,14 @@
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
+ // CraftBukkit start
|
||||
+ double prevX = this.locX();
|
||||
+ double prevY = this.locY();
|
||||
+ double prevZ = this.locZ();
|
||||
+ double prevX = this.getX();
|
||||
+ double prevY = this.getY();
|
||||
+ double prevZ = this.getZ();
|
||||
+ float prevYaw = this.getYRot();
|
||||
+ float prevPitch = this.getXRot();
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (this.getType() > 0) {
|
||||
this.c(this.getType() - 1);
|
||||
if (this.getHurtTime() > 0) {
|
||||
this.setHurtTime(this.getHurtTime() - 1);
|
||||
}
|
||||
@@ -294,7 +344,7 @@
|
||||
@@ -293,7 +343,7 @@
|
||||
}
|
||||
|
||||
this.aj();
|
||||
- this.doPortalTick();
|
||||
+ // this.doPortalTick(); // CraftBukkit - handled in postTick
|
||||
this.checkOutOfWorld();
|
||||
- this.handleNetherPortal();
|
||||
+ // this.handleNetherPortal(); // CraftBukkit - handled in postTick
|
||||
double d0;
|
||||
|
||||
if (this.level.isClientSide) {
|
||||
@@ -360,6 +410,18 @@
|
||||
@@ -359,6 +409,18 @@
|
||||
}
|
||||
|
||||
this.setYawPitch(this.getYRot(), this.getXRot());
|
||||
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 = new Location(bworld, this.locX(), this.locY(), this.locZ(), this.getYRot(), this.getXRot());
|
||||
+ Location to = new Location(bworld, this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
|
||||
+ Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
||||
+
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(new org.bukkit.event.vehicle.VehicleUpdateEvent(vehicle));
|
||||
@@ -119,10 +110,10 @@
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(new org.bukkit.event.vehicle.VehicleMoveEvent(vehicle, from, to));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (this.getMinecartType() == EntityMinecartAbstract.EnumMinecartType.RIDEABLE && this.getMot().i() > 0.01D) {
|
||||
List<Entity> list = this.level.getEntities(this, this.getBoundingBox().grow(0.20000000298023224D, 0.0D, 0.20000000298023224D), IEntitySelector.a(this));
|
||||
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));
|
||||
|
||||
@@ -368,8 +430,26 @@
|
||||
@@ -367,8 +429,26 @@
|
||||
Entity entity = (Entity) list.get(l);
|
||||
|
||||
if (!(entity instanceof EntityHuman) && !(entity instanceof EntityIronGolem) && !(entity instanceof EntityMinecartAbstract) && !this.isVehicle() && !entity.isPassenger()) {
|
||||
@@ -137,7 +128,7 @@
|
||||
entity.startRiding(this);
|
||||
} else {
|
||||
+ // CraftBukkit start
|
||||
+ if (!this.isSameVehicle(entity)) {
|
||||
+ if (!this.isPassengerOfSameVehicle(entity)) {
|
||||
+ VehicleEntityCollisionEvent collisionEvent = new VehicleEntityCollisionEvent(vehicle, entity.getBukkitEntity());
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(collisionEvent);
|
||||
+
|
||||
@@ -146,13 +137,13 @@
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
entity.collide(this);
|
||||
entity.push(this);
|
||||
}
|
||||
}
|
||||
@@ -381,6 +461,14 @@
|
||||
@@ -380,6 +460,14 @@
|
||||
Entity entity1 = (Entity) iterator.next();
|
||||
|
||||
if (!this.u(entity1) && entity1.isCollidable() && entity1 instanceof EntityMinecartAbstract) {
|
||||
if (!this.hasPassenger(entity1) && entity1.isPushable() && entity1 instanceof EntityMinecartAbstract) {
|
||||
+ // CraftBukkit start
|
||||
+ VehicleEntityCollisionEvent collisionEvent = new VehicleEntityCollisionEvent(vehicle, entity1.getBukkitEntity());
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(collisionEvent);
|
||||
@@ -161,10 +152,10 @@
|
||||
+ continue;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
entity1.collide(this);
|
||||
entity1.push(this);
|
||||
}
|
||||
}
|
||||
@@ -397,7 +485,7 @@
|
||||
@@ -396,7 +484,7 @@
|
||||
}
|
||||
|
||||
protected double getMaxSpeed() {
|
||||
@@ -172,39 +163,39 @@
|
||||
+ return (this.isInWater() ? this.maxSpeed / 2.0D: this.maxSpeed); // CraftBukkit
|
||||
}
|
||||
|
||||
public void a(int i, int j, int k, boolean flag) {}
|
||||
@@ -408,12 +496,16 @@
|
||||
public void activateMinecart(int i, int j, int k, boolean flag) {}
|
||||
@@ -407,12 +495,16 @@
|
||||
|
||||
this.setMot(MathHelper.a(vec3d.x, -d0, d0), vec3d.y, MathHelper.a(vec3d.z, -d0, d0));
|
||||
this.setDeltaMovement(MathHelper.clamp(vec3d.x, -d0, d0), vec3d.y, MathHelper.clamp(vec3d.z, -d0, d0));
|
||||
if (this.onGround) {
|
||||
- this.setMot(this.getMot().a(0.5D));
|
||||
- this.setDeltaMovement(this.getDeltaMovement().scale(0.5D));
|
||||
+ // CraftBukkit start - replace magic numbers with our variables
|
||||
+ this.setMot(new Vec3D(this.getMot().x * this.derailedX, this.getMot().y * this.derailedY, this.getMot().z * this.derailedZ));
|
||||
+ 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.getMot());
|
||||
this.move(EnumMoveType.SELF, this.getDeltaMovement());
|
||||
if (!this.onGround) {
|
||||
- this.setMot(this.getMot().a(0.95D));
|
||||
- this.setDeltaMovement(this.getDeltaMovement().scale(0.95D));
|
||||
+ // CraftBukkit start - replace magic numbers with our variables
|
||||
+ this.setMot(new Vec3D(this.getMot().x * this.flyingX, this.getMot().y * this.flyingY, this.getMot().z * this.flyingZ));
|
||||
+ this.setDeltaMovement(new Vec3D(this.getDeltaMovement().x * this.flyingX, this.getDeltaMovement().y * this.flyingY, this.getDeltaMovement().z * this.flyingZ));
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
}
|
||||
@@ -604,7 +696,7 @@
|
||||
@@ -603,7 +695,7 @@
|
||||
}
|
||||
|
||||
protected void decelerate() {
|
||||
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.getMot();
|
||||
Vec3D vec3d = this.getDeltaMovement();
|
||||
|
||||
vec3d = vec3d.d(d0, 0.0D, d0);
|
||||
@@ -743,6 +835,14 @@
|
||||
vec3d = vec3d.multiply(d0, 0.0D, d0);
|
||||
@@ -742,6 +834,14 @@
|
||||
if (!this.level.isClientSide) {
|
||||
if (!entity.noPhysics && !this.noPhysics) {
|
||||
if (!this.u(entity)) {
|
||||
if (!this.hasPassenger(entity)) {
|
||||
+ // CraftBukkit start
|
||||
+ VehicleEntityCollisionEvent collisionEvent = new VehicleEntityCollisionEvent((Vehicle) this.getBukkitEntity(), entity.getBukkitEntity());
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(collisionEvent);
|
||||
@@ -213,10 +204,10 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
double d0 = entity.locX() - this.locX();
|
||||
double d1 = entity.locZ() - this.locZ();
|
||||
double d0 = entity.getX() - this.getX();
|
||||
double d1 = entity.getZ() - this.getZ();
|
||||
double d2 = d0 * d0 + d1 * d1;
|
||||
@@ -922,4 +1022,26 @@
|
||||
@@ -921,4 +1021,26 @@
|
||||
|
||||
private EnumMinecartType() {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user