#1181: Consolidate Location conversion code
By: Doc <nachito94@msn.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -124,8 +124,65 @@
|
||||
@@ -124,8 +124,66 @@
|
||||
import net.minecraft.world.scores.ScoreboardTeamBase;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
+import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||
+import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.craftbukkit.util.CraftLocation;
|
||||
+import org.bukkit.entity.Pose;
|
||||
+import org.bukkit.event.entity.EntityAirChangeEvent;
|
||||
+import org.bukkit.event.entity.EntityCombustEvent;
|
||||
@@ -66,7 +67,7 @@
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
public static final String ID_TAG = "id";
|
||||
public static final String PASSENGERS_TAG = "Passengers";
|
||||
@@ -236,6 +293,25 @@
|
||||
@@ -236,6 +294,25 @@
|
||||
public boolean hasVisualFire;
|
||||
@Nullable
|
||||
private IBlockData feetBlockState;
|
||||
@@ -92,7 +93,7 @@
|
||||
|
||||
public Entity(EntityTypes<?> entitytypes, World world) {
|
||||
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
|
||||
@@ -367,6 +443,12 @@
|
||||
@@ -367,6 +444,12 @@
|
||||
public void onClientRemoval() {}
|
||||
|
||||
public void setPose(EntityPose entitypose) {
|
||||
@@ -105,7 +106,7 @@
|
||||
this.entityData.set(Entity.DATA_POSE, entitypose);
|
||||
}
|
||||
|
||||
@@ -391,6 +473,33 @@
|
||||
@@ -391,6 +474,33 @@
|
||||
}
|
||||
|
||||
protected void setRot(float f, float f1) {
|
||||
@@ -139,7 +140,7 @@
|
||||
this.setYRot(f % 360.0F);
|
||||
this.setXRot(f1 % 360.0F);
|
||||
}
|
||||
@@ -432,6 +541,15 @@
|
||||
@@ -432,6 +542,15 @@
|
||||
this.baseTick();
|
||||
}
|
||||
|
||||
@@ -155,7 +156,7 @@
|
||||
public void baseTick() {
|
||||
this.level.getProfiler().push("entityBaseTick");
|
||||
this.feetBlockState = null;
|
||||
@@ -446,7 +564,7 @@
|
||||
@@ -446,7 +565,7 @@
|
||||
this.walkDistO = this.walkDist;
|
||||
this.xRotO = this.getXRot();
|
||||
this.yRotO = this.getYRot();
|
||||
@@ -164,7 +165,7 @@
|
||||
if (this.canSpawnSprintParticle()) {
|
||||
this.spawnSprintParticle();
|
||||
}
|
||||
@@ -481,6 +599,10 @@
|
||||
@@ -481,6 +600,10 @@
|
||||
if (this.isInLava()) {
|
||||
this.lavaHurt();
|
||||
this.fallDistance *= 0.5F;
|
||||
@@ -175,7 +176,7 @@
|
||||
}
|
||||
|
||||
this.checkOutOfWorld();
|
||||
@@ -524,15 +646,48 @@
|
||||
@@ -524,15 +647,48 @@
|
||||
|
||||
public void lavaHurt() {
|
||||
if (!this.fireImmune()) {
|
||||
@@ -225,7 +226,7 @@
|
||||
int j = i * 20;
|
||||
|
||||
if (this instanceof EntityLiving) {
|
||||
@@ -646,6 +801,28 @@
|
||||
@@ -646,6 +802,28 @@
|
||||
block.updateEntityAfterFallOn(this.level, this);
|
||||
}
|
||||
|
||||
@@ -254,7 +255,7 @@
|
||||
if (this.onGround) {
|
||||
block.stepOn(this.level, blockposition, iblockdata, this);
|
||||
}
|
||||
@@ -948,6 +1125,20 @@
|
||||
@@ -948,6 +1126,20 @@
|
||||
return SoundEffects.GENERIC_SPLASH;
|
||||
}
|
||||
|
||||
@@ -275,7 +276,7 @@
|
||||
protected void checkInsideBlocks() {
|
||||
AxisAlignedBB axisalignedbb = this.getBoundingBox();
|
||||
BlockPosition blockposition = BlockPosition.containing(axisalignedbb.minX + 1.0E-7D, axisalignedbb.minY + 1.0E-7D, axisalignedbb.minZ + 1.0E-7D);
|
||||
@@ -1311,6 +1502,7 @@
|
||||
@@ -1311,6 +1503,7 @@
|
||||
this.yo = d1;
|
||||
this.zo = d4;
|
||||
this.setPos(d3, d1, d4);
|
||||
@@ -283,7 +284,7 @@
|
||||
}
|
||||
|
||||
public void moveTo(Vec3D vec3d) {
|
||||
@@ -1505,6 +1697,12 @@
|
||||
@@ -1505,6 +1698,12 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -296,7 +297,7 @@
|
||||
public void awardKillScore(Entity entity, int i, DamageSource damagesource) {
|
||||
if (entity instanceof EntityPlayer) {
|
||||
CriterionTriggers.ENTITY_KILLED_PLAYER.trigger((EntityPlayer) entity, this, damagesource);
|
||||
@@ -1538,7 +1736,7 @@
|
||||
@@ -1538,7 +1737,7 @@
|
||||
} else {
|
||||
String s = this.getEncodeId();
|
||||
|
||||
@@ -305,7 +306,7 @@
|
||||
return false;
|
||||
} else {
|
||||
nbttagcompound.putString("id", s);
|
||||
@@ -1563,6 +1761,18 @@
|
||||
@@ -1563,6 +1762,18 @@
|
||||
Vec3D vec3d = this.getDeltaMovement();
|
||||
|
||||
nbttagcompound.put("Motion", this.newDoubleList(vec3d.x, vec3d.y, vec3d.z));
|
||||
@@ -324,7 +325,7 @@
|
||||
nbttagcompound.put("Rotation", this.newFloatList(this.getYRot(), this.getXRot()));
|
||||
nbttagcompound.putFloat("FallDistance", this.fallDistance);
|
||||
nbttagcompound.putShort("Fire", (short) this.remainingFireTicks);
|
||||
@@ -1571,6 +1781,25 @@
|
||||
@@ -1571,6 +1782,25 @@
|
||||
nbttagcompound.putBoolean("Invulnerable", this.invulnerable);
|
||||
nbttagcompound.putInt("PortalCooldown", this.portalCooldown);
|
||||
nbttagcompound.putUUID("UUID", this.getUUID());
|
||||
@@ -350,7 +351,7 @@
|
||||
IChatBaseComponent ichatbasecomponent = this.getCustomName();
|
||||
|
||||
if (ichatbasecomponent != null) {
|
||||
@@ -1638,6 +1867,11 @@
|
||||
@@ -1638,6 +1868,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -362,7 +363,7 @@
|
||||
return nbttagcompound;
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
|
||||
@@ -1721,6 +1955,45 @@
|
||||
@@ -1721,6 +1956,45 @@
|
||||
} else {
|
||||
throw new IllegalStateException("Entity has invalid position");
|
||||
}
|
||||
@@ -408,7 +409,7 @@
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.addCategory("Entity being loaded");
|
||||
@@ -1796,9 +2069,22 @@
|
||||
@@ -1796,9 +2070,22 @@
|
||||
} else if (this.level.isClientSide) {
|
||||
return null;
|
||||
} else {
|
||||
@@ -431,7 +432,7 @@
|
||||
this.level.addFreshEntity(entityitem);
|
||||
return entityitem;
|
||||
}
|
||||
@@ -1894,7 +2180,7 @@
|
||||
@@ -1894,7 +2181,7 @@
|
||||
|
||||
this.setPose(EntityPose.STANDING);
|
||||
this.vehicle = entity;
|
||||
@@ -440,7 +441,7 @@
|
||||
entity.getIndirectPassengersStream().filter((entity2) -> {
|
||||
return entity2 instanceof EntityPlayer;
|
||||
}).forEach((entity2) -> {
|
||||
@@ -1925,7 +2211,7 @@
|
||||
@@ -1925,7 +2212,7 @@
|
||||
Entity entity = this.vehicle;
|
||||
|
||||
this.vehicle = null;
|
||||
@@ -449,7 +450,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1934,10 +2220,31 @@
|
||||
@@ -1934,10 +2221,31 @@
|
||||
this.removeVehicle();
|
||||
}
|
||||
|
||||
@@ -482,7 +483,7 @@
|
||||
if (this.passengers.isEmpty()) {
|
||||
this.passengers = ImmutableList.of(entity);
|
||||
} else {
|
||||
@@ -1954,12 +2261,32 @@
|
||||
@@ -1954,12 +2262,32 @@
|
||||
|
||||
this.gameEvent(GameEvent.ENTITY_MOUNT, entity);
|
||||
}
|
||||
@@ -516,7 +517,7 @@
|
||||
if (this.passengers.size() == 1 && this.passengers.get(0) == entity) {
|
||||
this.passengers = ImmutableList.of();
|
||||
} else {
|
||||
@@ -1971,6 +2298,7 @@
|
||||
@@ -1971,6 +2299,7 @@
|
||||
entity.boardingCooldown = 60;
|
||||
this.gameEvent(GameEvent.ENTITY_DISMOUNT, entity);
|
||||
}
|
||||
@@ -524,7 +525,7 @@
|
||||
}
|
||||
|
||||
protected boolean canAddPassenger(Entity entity) {
|
||||
@@ -2037,14 +2365,20 @@
|
||||
@@ -2037,14 +2366,20 @@
|
||||
|
||||
if (this.isInsidePortal) {
|
||||
MinecraftServer minecraftserver = worldserver.getServer();
|
||||
@@ -548,7 +549,7 @@
|
||||
this.level.getProfiler().pop();
|
||||
}
|
||||
|
||||
@@ -2164,6 +2498,13 @@
|
||||
@@ -2164,6 +2499,13 @@
|
||||
}
|
||||
|
||||
public void setSwimming(boolean flag) {
|
||||
@@ -562,7 +563,7 @@
|
||||
this.setSharedFlag(4, flag);
|
||||
}
|
||||
|
||||
@@ -2209,8 +2550,12 @@
|
||||
@@ -2209,8 +2551,12 @@
|
||||
return this.getTeam() != null ? this.getTeam().isAlliedTo(scoreboardteambase) : false;
|
||||
}
|
||||
|
||||
@@ -576,7 +577,7 @@
|
||||
}
|
||||
|
||||
public boolean getSharedFlag(int i) {
|
||||
@@ -2229,7 +2574,7 @@
|
||||
@@ -2229,7 +2575,7 @@
|
||||
}
|
||||
|
||||
public int getMaxAirSupply() {
|
||||
@@ -585,7 +586,7 @@
|
||||
}
|
||||
|
||||
public int getAirSupply() {
|
||||
@@ -2237,7 +2582,18 @@
|
||||
@@ -2237,7 +2583,18 @@
|
||||
}
|
||||
|
||||
public void setAirSupply(int i) {
|
||||
@@ -605,7 +606,7 @@
|
||||
}
|
||||
|
||||
public int getTicksFrozen() {
|
||||
@@ -2264,11 +2620,41 @@
|
||||
@@ -2264,11 +2621,41 @@
|
||||
|
||||
public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) {
|
||||
this.setRemainingFireTicks(this.remainingFireTicks + 1);
|
||||
@@ -649,7 +650,7 @@
|
||||
}
|
||||
|
||||
public void onAboveBubbleCol(boolean flag) {
|
||||
@@ -2433,15 +2819,38 @@
|
||||
@@ -2433,15 +2820,38 @@
|
||||
|
||||
@Nullable
|
||||
public Entity changeDimension(WorldServer worldserver) {
|
||||
@@ -690,7 +691,7 @@
|
||||
this.level.getProfiler().popPush("reloading");
|
||||
Entity entity = this.getType().create(worldserver);
|
||||
|
||||
@@ -2450,9 +2859,17 @@
|
||||
@@ -2450,9 +2860,17 @@
|
||||
entity.moveTo(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, entity.getXRot());
|
||||
entity.setDeltaMovement(shapedetectorshape.speed);
|
||||
worldserver.addDuringTeleport(entity);
|
||||
@@ -710,7 +711,7 @@
|
||||
}
|
||||
|
||||
this.removeAfterChangingDimensions();
|
||||
@@ -2473,20 +2890,34 @@
|
||||
@@ -2473,20 +2891,34 @@
|
||||
|
||||
@Nullable
|
||||
protected ShapeDetectorShape findDimensionEntryPoint(WorldServer worldserver) {
|
||||
@@ -750,7 +751,7 @@
|
||||
IBlockData iblockdata = this.level.getBlockState(this.portalEntrancePos);
|
||||
EnumDirection.EnumAxis enumdirection_enumaxis;
|
||||
Vec3D vec3d;
|
||||
@@ -2503,8 +2934,8 @@
|
||||
@@ -2503,8 +2935,8 @@
|
||||
vec3d = new Vec3D(0.5D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
@@ -761,7 +762,7 @@
|
||||
}
|
||||
} else {
|
||||
BlockPosition blockposition1;
|
||||
@@ -2514,8 +2945,14 @@
|
||||
@@ -2514,8 +2946,14 @@
|
||||
} else {
|
||||
blockposition1 = worldserver.getHeightmapPos(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver.getSharedSpawnPos());
|
||||
}
|
||||
@@ -777,7 +778,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2523,8 +2960,23 @@
|
||||
@@ -2523,8 +2961,23 @@
|
||||
return BlockPortalShape.getRelativePosition(blockutil_rectangle, enumdirection_enumaxis, this.position(), this.getDimensions(this.getPose()));
|
||||
}
|
||||
|
||||
@@ -787,7 +788,7 @@
|
||||
+ protected CraftPortalEvent callPortalEvent(Entity entity, WorldServer exitWorldServer, Position exitPosition, PlayerTeleportEvent.TeleportCause cause, int searchRadius, int creationRadius) {
|
||||
+ org.bukkit.entity.Entity bukkitEntity = entity.getBukkitEntity();
|
||||
+ Location enter = bukkitEntity.getLocation();
|
||||
+ Location exit = new Location(exitWorldServer.getWorld(), exitPosition.x(), exitPosition.y(), exitPosition.z());
|
||||
+ Location exit = CraftLocation.toBukkit(exitPosition, exitWorldServer.getWorld());
|
||||
+
|
||||
+ EntityPortalEvent event = new EntityPortalEvent(bukkitEntity, enter, exit, searchRadius);
|
||||
+ event.getEntity().getServer().getPluginManager().callEvent(event);
|
||||
@@ -803,7 +804,7 @@
|
||||
}
|
||||
|
||||
public boolean canChangeDimensions() {
|
||||
@@ -2644,6 +3096,12 @@
|
||||
@@ -2644,6 +3097,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -816,7 +817,7 @@
|
||||
public boolean teleportTo(WorldServer worldserver, double d0, double d1, double d2, Set<RelativeMovement> set, float f, float f1) {
|
||||
float f2 = MathHelper.clamp(f1, -90.0F, 90.0F);
|
||||
|
||||
@@ -2773,7 +3231,26 @@
|
||||
@@ -2773,7 +3232,26 @@
|
||||
}
|
||||
|
||||
public final void setBoundingBox(AxisAlignedBB axisalignedbb) {
|
||||
@@ -844,7 +845,7 @@
|
||||
}
|
||||
|
||||
protected float getEyeHeight(EntityPose entitypose, EntitySize entitysize) {
|
||||
@@ -3084,6 +3561,11 @@
|
||||
@@ -3084,6 +3562,11 @@
|
||||
vec3d = vec3d.add(vec3d1);
|
||||
++k1;
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
import org.joml.Vector3f;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.server.level.WorldServer;
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.craftbukkit.util.CraftLocation;
|
||||
+import org.bukkit.event.entity.EntityTeleportEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
if (enumdirection != null) {
|
||||
+ // CraftBukkit start
|
||||
+ EntityTeleportEvent teleport = new EntityTeleportEvent(this.getBukkitEntity(), this.getBukkitEntity().getLocation(), new Location(this.level.getWorld(), blockposition1.getX(), blockposition1.getY(), blockposition1.getZ()));
|
||||
+ EntityTeleportEvent teleport = new EntityTeleportEvent(this.getBukkitEntity(), this.getBukkitEntity().getLocation(), CraftLocation.toBukkit(blockposition1, this.level.getWorld()));
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(teleport);
|
||||
+ if (!teleport.isCancelled()) {
|
||||
+ Location to = teleport.getTo();
|
||||
|
||||
@@ -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 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
--- a/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java
|
||||
+++ b/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java
|
||||
@@ -47,6 +47,15 @@
|
||||
@@ -47,6 +47,16 @@
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
+// 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 abstract class EntityMinecartAbstract extends Entity {
|
||||
|
||||
private static final DataWatcherObject<Integer> DATA_ID_HURT = DataWatcher.defineId(EntityMinecartAbstract.class, DataWatcherRegistry.INT);
|
||||
@@ -89,6 +98,17 @@
|
||||
@@ -89,6 +99,17 @@
|
||||
private double lyd;
|
||||
private double lzd;
|
||||
|
||||
@@ -34,7 +35,7 @@
|
||||
protected EntityMinecartAbstract(EntityTypes<?> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
this.blocksBuilding = true;
|
||||
@@ -215,6 +235,19 @@
|
||||
@@ -215,6 +236,19 @@
|
||||
if (this.isInvulnerableTo(damagesource)) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -54,7 +55,7 @@
|
||||
this.setHurtDir(-this.getHurtDir());
|
||||
this.setHurtTime(10);
|
||||
this.markHurt();
|
||||
@@ -223,6 +256,15 @@
|
||||
@@ -223,6 +257,15 @@
|
||||
boolean flag = damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).getAbilities().instabuild;
|
||||
|
||||
if (flag || this.getDamage() > 40.0F) {
|
||||
@@ -70,7 +71,7 @@
|
||||
this.ejectPassengers();
|
||||
if (flag && !this.hasCustomName()) {
|
||||
this.discard();
|
||||
@@ -284,6 +326,14 @@
|
||||
@@ -284,6 +327,14 @@
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
@@ -85,7 +86,7 @@
|
||||
if (this.getHurtTime() > 0) {
|
||||
this.setHurtTime(this.getHurtTime() - 1);
|
||||
}
|
||||
@@ -293,7 +343,7 @@
|
||||
@@ -293,7 +344,7 @@
|
||||
}
|
||||
|
||||
this.checkOutOfWorld();
|
||||
@@ -94,14 +95,14 @@
|
||||
double d0;
|
||||
|
||||
if (this.level.isClientSide) {
|
||||
@@ -359,6 +409,18 @@
|
||||
@@ -359,6 +410,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 = 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();
|
||||
+
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(new org.bukkit.event.vehicle.VehicleUpdateEvent(vehicle));
|
||||
@@ -113,7 +114,7 @@
|
||||
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));
|
||||
|
||||
@@ -367,8 +429,26 @@
|
||||
@@ -367,8 +430,26 @@
|
||||
Entity entity = (Entity) list.get(l);
|
||||
|
||||
if (!(entity instanceof EntityHuman) && !(entity instanceof EntityIronGolem) && !(entity instanceof EntityMinecartAbstract) && !this.isVehicle() && !entity.isPassenger()) {
|
||||
@@ -140,7 +141,7 @@
|
||||
entity.push(this);
|
||||
}
|
||||
}
|
||||
@@ -380,6 +460,14 @@
|
||||
@@ -380,6 +461,14 @@
|
||||
Entity entity1 = (Entity) iterator.next();
|
||||
|
||||
if (!this.hasPassenger(entity1) && entity1.isPushable() && entity1 instanceof EntityMinecartAbstract) {
|
||||
@@ -155,7 +156,7 @@
|
||||
entity1.push(this);
|
||||
}
|
||||
}
|
||||
@@ -396,7 +484,7 @@
|
||||
@@ -396,7 +485,7 @@
|
||||
}
|
||||
|
||||
protected double getMaxSpeed() {
|
||||
@@ -164,7 +165,7 @@
|
||||
}
|
||||
|
||||
public void activateMinecart(int i, int j, int k, boolean flag) {}
|
||||
@@ -407,12 +495,16 @@
|
||||
@@ -407,12 +496,16 @@
|
||||
|
||||
this.setDeltaMovement(MathHelper.clamp(vec3d.x, -d0, d0), vec3d.y, MathHelper.clamp(vec3d.z, -d0, d0));
|
||||
if (this.onGround) {
|
||||
@@ -183,7 +184,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -603,7 +695,7 @@
|
||||
@@ -603,7 +696,7 @@
|
||||
}
|
||||
|
||||
protected void applyNaturalSlowdown() {
|
||||
@@ -192,7 +193,7 @@
|
||||
Vec3D vec3d = this.getDeltaMovement();
|
||||
|
||||
vec3d = vec3d.multiply(d0, 0.0D, d0);
|
||||
@@ -742,6 +834,14 @@
|
||||
@@ -742,6 +835,14 @@
|
||||
if (!this.level.isClientSide) {
|
||||
if (!entity.noPhysics && !this.noPhysics) {
|
||||
if (!this.hasPassenger(entity)) {
|
||||
@@ -207,7 +208,7 @@
|
||||
double d0 = entity.getX() - this.getX();
|
||||
double d1 = entity.getZ() - this.getZ();
|
||||
double d2 = d0 * d0 + d1 * d1;
|
||||
@@ -916,4 +1016,26 @@
|
||||
@@ -916,4 +1017,26 @@
|
||||
|
||||
private EnumMinecartType() {}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
--- a/net/minecraft/world/inventory/InventoryEnderChest.java
|
||||
+++ b/net/minecraft/world/inventory/InventoryEnderChest.java
|
||||
@@ -8,13 +8,31 @@
|
||||
@@ -8,13 +8,32 @@
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.entity.TileEntityEnderChest;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.craftbukkit.util.CraftLocation;
|
||||
+import org.bukkit.inventory.InventoryHolder;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
@@ -22,7 +23,7 @@
|
||||
+
|
||||
+ @Override
|
||||
+ public Location getLocation() {
|
||||
+ return this.activeChest != null ? new Location(this.activeChest.getLevel().getWorld(), this.activeChest.getBlockPos().getX(), this.activeChest.getBlockPos().getY(), this.activeChest.getBlockPos().getZ()) : null;
|
||||
+ return this.activeChest != null ? CraftLocation.toBukkit(this.activeChest.getBlockPos(), this.activeChest.getLevel().getWorld()) : null;
|
||||
+ }
|
||||
|
||||
- public InventoryEnderChest() {
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
+// CraftBukkit start
|
||||
+import com.mojang.serialization.Dynamic;
|
||||
+import java.util.List;
|
||||
+import java.util.Map;
|
||||
+import java.util.Objects;
|
||||
+import net.minecraft.core.EnumDirection;
|
||||
@@ -33,6 +32,7 @@
|
||||
+import org.bukkit.craftbukkit.block.CraftBlock;
|
||||
+import org.bukkit.craftbukkit.block.CraftBlockState;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
+import org.bukkit.craftbukkit.util.CraftLocation;
|
||||
+import org.bukkit.craftbukkit.util.CraftMagicNumbers;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.block.BlockFertilizeEvent;
|
||||
@@ -122,7 +122,7 @@
|
||||
+ world.captureBlockStates = false;
|
||||
+ if (enuminteractionresult.consumesAction() && world.captureTreeGeneration && world.capturedBlockStates.size() > 0) {
|
||||
+ world.captureTreeGeneration = false;
|
||||
+ Location location = new Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
+ Location location = CraftLocation.toBukkit(blockposition, world.getWorld());
|
||||
+ TreeType treeType = BlockSapling.treeType;
|
||||
+ BlockSapling.treeType = null;
|
||||
+ List<CraftBlockState> blocks = new java.util.ArrayList<>(world.capturedBlockStates.values());
|
||||
|
||||
@@ -97,7 +97,7 @@
|
||||
+
|
||||
+ List<org.bukkit.block.Block> blockList = new ObjectArrayList<>();
|
||||
+ for (int i1 = this.toBlow.size() - 1; i1 >= 0; i1--) {
|
||||
+ BlockPosition cpos = (BlockPosition) this.toBlow.get(i1);
|
||||
+ BlockPosition cpos = this.toBlow.get(i1);
|
||||
+ org.bukkit.block.Block bblock = bworld.getBlockAt(cpos.getX(), cpos.getY(), cpos.getZ());
|
||||
+ if (!bblock.getType().isAir()) {
|
||||
+ blockList.add(bblock);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockSapling.java
|
||||
+++ b/net/minecraft/world/level/block/BlockSapling.java
|
||||
@@ -15,12 +15,20 @@
|
||||
@@ -15,12 +15,21 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.TreeType;
|
||||
+import org.bukkit.block.BlockState;
|
||||
+import org.bukkit.craftbukkit.util.CraftLocation;
|
||||
+import org.bukkit.event.world.StructureGrowEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
@@ -21,7 +22,7 @@
|
||||
|
||||
protected BlockSapling(WorldGenTreeProvider worldgentreeprovider, BlockBase.Info blockbase_info) {
|
||||
super(blockbase_info);
|
||||
@@ -45,7 +53,32 @@
|
||||
@@ -45,7 +54,32 @@
|
||||
if ((Integer) iblockdata.getValue(BlockSapling.STAGE) == 0) {
|
||||
worldserver.setBlock(blockposition, (IBlockData) iblockdata.cycle(BlockSapling.STAGE), 4);
|
||||
} else {
|
||||
@@ -36,7 +37,7 @@
|
||||
+ if (worldserver.capturedBlockStates.size() > 0) {
|
||||
+ TreeType treeType = BlockSapling.treeType;
|
||||
+ BlockSapling.treeType = null;
|
||||
+ Location location = new Location(worldserver.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
+ Location location = CraftLocation.toBukkit(blockposition, worldserver.getWorld());
|
||||
+ java.util.List<BlockState> blocks = new java.util.ArrayList<>(worldserver.capturedBlockStates.values());
|
||||
+ worldserver.capturedBlockStates.clear();
|
||||
+ StructureGrowEvent event = null;
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.world.level.dimension.WorldDimension;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
+import org.bukkit.craftbukkit.util.CraftLocation;
|
||||
+import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
@@ -31,7 +31,7 @@
|
||||
+ // CraftBukkit start - Fire PlayerTeleportEvent
|
||||
+ if (entity1 instanceof EntityPlayer) {
|
||||
+ org.bukkit.craftbukkit.entity.CraftPlayer player = (CraftPlayer) entity1.getBukkitEntity();
|
||||
+ org.bukkit.Location location = new Location(world.getWorld(), (double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.5D, (double) blockposition1.getZ() + 0.5D);
|
||||
+ org.bukkit.Location location = CraftLocation.toBukkit(blockposition1, world.getWorld()).add(0.5D, 0.5D, 0.5D);
|
||||
+ location.setPitch(player.getLocation().getPitch());
|
||||
+ location.setYaw(player.getLocation().getYaw());
|
||||
+
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.Arrays;
|
||||
+import java.util.List;
|
||||
+import java.util.UUID;
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.block.Lectern;
|
||||
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
|
||||
+import org.bukkit.craftbukkit.util.CraftLocation;
|
||||
+import org.bukkit.entity.HumanEntity;
|
||||
+import org.bukkit.inventory.InventoryHolder;
|
||||
+// CraftBukkit end
|
||||
@@ -59,7 +59,7 @@
|
||||
+ @Override
|
||||
+ public Location getLocation() {
|
||||
+ if (level == null) return null;
|
||||
+ return new Location(level.getWorld(), worldPosition.getX(), worldPosition.getY(), worldPosition.getZ());
|
||||
+ return CraftLocation.toBukkit(worldPosition, level.getWorld());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.core.registries.BuiltInRegistries;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.craftbukkit.util.CraftLocation;
|
||||
+import org.bukkit.craftbukkit.util.CraftNamespacedKey;
|
||||
+import org.bukkit.event.world.GenericGameEvent;
|
||||
+// CraftBukkit end
|
||||
@@ -20,7 +20,7 @@
|
||||
int i = gameevent.getNotificationRadius();
|
||||
BlockPosition blockposition = BlockPosition.containing(vec3d);
|
||||
+ // CraftBukkit start
|
||||
+ GenericGameEvent event = new GenericGameEvent(org.bukkit.GameEvent.getByKey(CraftNamespacedKey.fromMinecraft(BuiltInRegistries.GAME_EVENT.getKey(gameevent))), new Location(level.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()), (gameevent_a.sourceEntity() == null) ? null : gameevent_a.sourceEntity().getBukkitEntity(), i, !Bukkit.isPrimaryThread());
|
||||
+ GenericGameEvent event = new GenericGameEvent(org.bukkit.GameEvent.getByKey(CraftNamespacedKey.fromMinecraft(BuiltInRegistries.GAME_EVENT.getKey(gameevent))), CraftLocation.toBukkit(blockposition, level.getWorld()), (gameevent_a.sourceEntity() == null) ? null : gameevent_a.sourceEntity().getBukkitEntity(), i, !Bukkit.isPrimaryThread());
|
||||
+ level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
|
||||
Reference in New Issue
Block a user