#1181: Consolidate Location conversion code

By: Doc <nachito94@msn.com>
This commit is contained in:
CraftBukkit/Spigot
2023-04-19 19:59:19 +10:00
parent 2ffb1d2479
commit b99d3df2d8
43 changed files with 424 additions and 316 deletions

View File

@@ -1,11 +1,12 @@
--- a/net/minecraft/world/entity/vehicle/EntityBoat.java
+++ b/net/minecraft/world/entity/vehicle/EntityBoat.java
@@ -53,6 +53,15 @@
@@ -53,6 +53,16 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapes;
+// CraftBukkit start
+import org.bukkit.Location;
+import org.bukkit.craftbukkit.util.CraftLocation;
+import org.bukkit.entity.Vehicle;
+import org.bukkit.event.vehicle.VehicleDamageEvent;
+import org.bukkit.event.vehicle.VehicleDestroyEvent;
@@ -16,7 +17,7 @@
public class EntityBoat extends Entity implements VariantHolder<EntityBoat.EnumBoatType> {
private static final DataWatcherObject<Integer> DATA_ID_HURT = DataWatcher.defineId(EntityBoat.class, DataWatcherRegistry.INT);
@@ -93,6 +102,14 @@
@@ -93,6 +103,14 @@
private float bubbleAngle;
private float bubbleAngleO;
@@ -31,7 +32,7 @@
public EntityBoat(EntityTypes<? extends EntityBoat> entitytypes, World world) {
super(entitytypes, world);
this.paddlePositions = new float[2];
@@ -162,6 +179,19 @@
@@ -162,6 +180,19 @@
if (this.isInvulnerableTo(damagesource)) {
return false;
} else if (!this.level.isClientSide && !this.isRemoved()) {
@@ -51,7 +52,7 @@
this.setHurtDir(-this.getHurtDir());
this.setHurtTime(10);
this.setDamage(this.getDamage() + f * 10.0F);
@@ -170,6 +200,15 @@
@@ -170,6 +201,15 @@
boolean flag = damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).getAbilities().instabuild;
if (flag || this.getDamage() > 40.0F) {
@@ -67,7 +68,7 @@
if (!flag && this.level.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {
this.destroy(damagesource);
}
@@ -209,9 +248,29 @@
@@ -209,9 +249,29 @@
public void push(Entity entity) {
if (entity instanceof EntityBoat) {
if (entity.getBoundingBox().minY < this.getBoundingBox().maxY) {
@@ -97,7 +98,7 @@
super.push(entity);
}
@@ -279,6 +338,7 @@
@@ -279,6 +339,7 @@
return this.getDirection().getClockWise();
}
@@ -105,7 +106,7 @@
@Override
public void tick() {
this.oldStatus = this.status;
@@ -319,6 +379,22 @@
@@ -319,6 +380,22 @@
this.setDeltaMovement(Vec3D.ZERO);
}
@@ -113,7 +114,7 @@
+ org.bukkit.Server server = this.level.getCraftServer();
+ org.bukkit.World bworld = this.level.getWorld();
+
+ Location to = new Location(bworld, this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
+ 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));
@@ -128,7 +129,7 @@
this.tickBubbleColumn();
for (int i = 0; i <= 1; ++i) {
@@ -830,6 +906,11 @@
@@ -830,6 +907,11 @@
this.causeFallDamage(this.fallDistance, 1.0F, this.damageSources().fall());
if (!this.level.isClientSide && !this.isRemoved()) {
@@ -140,7 +141,7 @@
this.kill();
if (this.level.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {
int i;
@@ -843,6 +924,7 @@
@@ -843,6 +925,7 @@
}
}
}