Update to Minecraft 1.15

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2019-12-11 09:00:00 +11:00
parent 1400103b2f
commit 0e142c7f03
293 changed files with 2875 additions and 2648 deletions

View File

@@ -19,15 +19,15 @@
+
public abstract class EntityHuman extends EntityLiving {
public static final EntitySize bs = EntitySize.b(0.6F, 1.8F);
- private static final Map<EntityPose, EntitySize> b = ImmutableMap.builder().put(EntityPose.STANDING, EntityHuman.bs).put(EntityPose.SLEEPING, EntityHuman.as).put(EntityPose.FALL_FLYING, EntitySize.b(0.6F, 0.6F)).put(EntityPose.SWIMMING, EntitySize.b(0.6F, 0.6F)).put(EntityPose.SPIN_ATTACK, EntitySize.b(0.6F, 0.6F)).put(EntityPose.SNEAKING, EntitySize.b(0.6F, 1.5F)).put(EntityPose.DYING, EntitySize.c(0.2F, 0.2F)).build();
public static final EntitySize bp = EntitySize.b(0.6F, 1.8F);
- private static final Map<EntityPose, EntitySize> b = ImmutableMap.builder().put(EntityPose.STANDING, EntityHuman.bp).put(EntityPose.SLEEPING, EntityHuman.ap).put(EntityPose.FALL_FLYING, EntitySize.b(0.6F, 0.6F)).put(EntityPose.SWIMMING, EntitySize.b(0.6F, 0.6F)).put(EntityPose.SPIN_ATTACK, EntitySize.b(0.6F, 0.6F)).put(EntityPose.CROUCHING, EntitySize.b(0.6F, 1.5F)).put(EntityPose.DYING, EntitySize.c(0.2F, 0.2F)).build();
+ // CraftBukkit - decompile error
+ private static final Map<EntityPose, EntitySize> b = ImmutableMap.<EntityPose, EntitySize>builder().put(EntityPose.STANDING, EntityHuman.bs).put(EntityPose.SLEEPING, EntityHuman.as).put(EntityPose.FALL_FLYING, EntitySize.b(0.6F, 0.6F)).put(EntityPose.SWIMMING, EntitySize.b(0.6F, 0.6F)).put(EntityPose.SPIN_ATTACK, EntitySize.b(0.6F, 0.6F)).put(EntityPose.SNEAKING, EntitySize.b(0.6F, 1.5F)).put(EntityPose.DYING, EntitySize.c(0.2F, 0.2F)).build();
+ private static final Map<EntityPose, EntitySize> b = ImmutableMap.<EntityPose, EntitySize>builder().put(EntityPose.STANDING, EntityHuman.bp).put(EntityPose.SLEEPING, EntityHuman.ap).put(EntityPose.FALL_FLYING, EntitySize.b(0.6F, 0.6F)).put(EntityPose.SWIMMING, EntitySize.b(0.6F, 0.6F)).put(EntityPose.SPIN_ATTACK, EntitySize.b(0.6F, 0.6F)).put(EntityPose.CROUCHING, EntitySize.b(0.6F, 1.5F)).put(EntityPose.DYING, EntitySize.c(0.2F, 0.2F)).build();
private static final DataWatcherObject<Float> c = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.c);
private static final DataWatcherObject<Integer> d = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.b);
protected static final DataWatcherObject<Byte> bt = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.a);
protected static final DataWatcherObject<Byte> bq = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.a);
@@ -27,10 +41,10 @@
protected static final DataWatcherObject<NBTTagCompound> bw = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.p);
protected static final DataWatcherObject<NBTTagCompound> bt = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.p);
private long e;
public final PlayerInventory inventory = new PlayerInventory(this);
- protected InventoryEnderChest enderChest = new InventoryEnderChest();
@@ -36,9 +36,9 @@
public Container activeContainer;
- protected FoodMetaData foodData = new FoodMetaData();
+ protected FoodMetaData foodData = new FoodMetaData(this); // CraftBukkit - add "this" to constructor
protected int bC;
public float bD;
public float bE;
protected int bz;
public float bA;
public float bB;
@@ -58,6 +72,17 @@
@Nullable
public EntityFishingHook hookedFish;
@@ -56,8 +56,8 @@
+
public EntityHuman(World world, GameProfile gameprofile) {
super(EntityTypes.PLAYER, world);
this.bY = ItemStack.a;
@@ -194,7 +219,7 @@
this.bV = ItemStack.a;
@@ -206,7 +231,7 @@
ItemStack itemstack = this.getEquipment(EnumItemSlot.HEAD);
if (itemstack.getItem() == Items.TURTLE_HELMET && !this.a(TagsFluid.WATER)) {
@@ -66,7 +66,7 @@
}
}
@@ -367,7 +392,8 @@
@@ -379,7 +404,8 @@
if (this.world.getDifficulty() == EnumDifficulty.PEACEFUL && this.world.getGameRules().getBoolean(GameRules.NATURAL_REGENERATION)) {
if (this.getHealth() < this.getMaxHealth() && this.ticksLived % 20 == 0) {
@@ -76,15 +76,7 @@
}
if (this.foodData.c() && this.ticksLived % 10 == 0) {
@@ -512,6 +538,7 @@
@Nullable
public EntityItem n(boolean flag) {
+ // Called only when dropped by Q or CTRL-Q
return this.a(this.inventory.splitStack(this.inventory.itemInHandIndex, flag && !this.inventory.getItemInHand().isEmpty() ? this.inventory.getItemInHand().getCount() : 1), false, true);
}
@@ -552,6 +579,30 @@
@@ -563,6 +589,30 @@
entityitem.setMot((double) (-f3 * f2 * 0.3F) + Math.cos((double) f5) * (double) f6, (double) (-f1 * 0.3F + 0.1F + (this.random.nextFloat() - this.random.nextFloat()) * 0.1F), (double) (f4 * f2 * 0.3F) + Math.sin((double) f5) * (double) f6);
}
@@ -115,7 +107,7 @@
return entityitem;
}
}
@@ -626,6 +677,14 @@
@@ -637,6 +687,14 @@
}
this.setScore(nbttagcompound.getInt("Score"));
@@ -129,8 +121,8 @@
+
if (nbttagcompound.hasKeyOfType("SpawnX", 99) && nbttagcompound.hasKeyOfType("SpawnY", 99) && nbttagcompound.hasKeyOfType("SpawnZ", 99)) {
this.g = new BlockPosition(nbttagcompound.getInt("SpawnX"), nbttagcompound.getInt("SpawnY"), nbttagcompound.getInt("SpawnZ"));
this.bU = nbttagcompound.getBoolean("SpawnForced");
@@ -676,6 +735,7 @@
this.bR = nbttagcompound.getBoolean("SpawnForced");
@@ -687,6 +745,7 @@
if (!this.getShoulderEntityRight().isEmpty()) {
nbttagcompound.set("ShoulderEntityRight", this.getShoulderEntityRight());
}
@@ -138,7 +130,7 @@
}
@@ -684,16 +744,17 @@
@@ -700,16 +759,17 @@
if (this.isInvulnerable(damagesource)) {
return false;
} else if (this.abilities.isInvulnerable && !damagesource.ignoresInvulnerability()) {
@@ -158,7 +150,7 @@
}
if (this.world.getDifficulty() == EnumDifficulty.EASY) {
@@ -705,7 +766,13 @@
@@ -721,7 +781,13 @@
}
}
@@ -173,7 +165,7 @@
}
}
}
@@ -720,10 +787,29 @@
@@ -736,10 +802,29 @@
}
public boolean a(EntityHuman entityhuman) {
@@ -206,7 +198,7 @@
}
@Override
@@ -754,8 +840,13 @@
@@ -770,8 +855,13 @@
}
@@ -221,7 +213,7 @@
if (!this.isInvulnerable(damagesource)) {
f = this.applyArmorModifier(damagesource, f);
f = this.applyMagicModifier(damagesource, f);
@@ -781,6 +872,7 @@
@@ -797,6 +887,7 @@
}
}
@@ -229,7 +221,7 @@
}
public void openSign(TileEntitySign tileentitysign) {}
@@ -911,8 +1003,15 @@
@@ -978,8 +1069,15 @@
if (entity instanceof EntityLiving) {
f3 = ((EntityLiving) entity).getHealth();
if (j > 0 && !entity.isBurning()) {
@@ -247,7 +239,7 @@
}
}
@@ -940,8 +1039,11 @@
@@ -1007,8 +1105,11 @@
EntityLiving entityliving = (EntityLiving) iterator.next();
if (entityliving != this && entityliving != entity && !this.r(entityliving) && (!(entityliving instanceof EntityArmorStand) || !((EntityArmorStand) entityliving).isMarker()) && this.h((Entity) entityliving) < 9.0D) {
@@ -260,7 +252,7 @@
}
}
@@ -950,9 +1052,26 @@
@@ -1017,9 +1118,26 @@
}
if (entity instanceof EntityPlayer && entity.velocityChanged) {
@@ -287,7 +279,7 @@
}
if (flag2) {
@@ -997,7 +1116,14 @@
@@ -1064,7 +1182,14 @@
this.a(StatisticList.DAMAGE_DEALT, Math.round(f5 * 10.0F));
if (j > 0) {
@@ -303,7 +295,7 @@
}
if (this.world instanceof WorldServer && f5 > 2.0F) {
@@ -1013,6 +1139,11 @@
@@ -1080,6 +1205,11 @@
if (flag4) {
entity.extinguish();
}
@@ -315,8 +307,8 @@
}
}
@@ -1072,15 +1203,15 @@
return this.bW;
@@ -1139,15 +1269,15 @@
return this.bT;
}
- public Either<EntityHuman.EnumBedResult, Unit> sleep(BlockPosition blockposition) {
@@ -335,7 +327,7 @@
return Either.left(EntityHuman.EnumBedResult.NOT_POSSIBLE_HERE);
}
@@ -1108,6 +1239,34 @@
@@ -1176,6 +1306,34 @@
}
}
}
@@ -368,9 +360,9 @@
+ }
+ // CraftBukkit end
this.e(blockposition);
this.entitySleep(blockposition);
this.sleepTicks = 0;
@@ -1148,6 +1307,24 @@
@@ -1215,6 +1373,23 @@
((WorldServer) this.world).everyoneSleeping();
}
@@ -379,37 +371,36 @@
+ Player player = (Player) this.getBukkitEntity();
+
+ org.bukkit.block.Block bed;
+ BlockPosition blockposition = optional.orElse(null);
+ BlockPosition blockposition = this.getBedPosition().orElse(null);
+ if (blockposition != null) {
+ bed = this.world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+ } else {
+ bed = this.world.getWorld().getBlockAt(player.getLocation());
+ }
+
+ PlayerBedLeaveEvent event = new PlayerBedLeaveEvent(player, bed, flag2);
+ PlayerBedLeaveEvent event = new PlayerBedLeaveEvent(player, bed, true);
+ this.world.getServer().getPluginManager().callEvent(event);
+ flag2 = event.shouldSetSpawnLocation();
+ }
+ // CraftBukkit end
+
this.sleepTicks = flag ? 0 : 100;
if (flag2) {
optional.ifPresent((blockposition) -> {
@@ -1201,9 +1378,11 @@
if (blockposition != null) {
}
@@ -1266,9 +1441,11 @@
this.g = blockposition;
this.bU = flag;
this.bR = flag;
+ this.spawnWorld = this.world.worldData.getName(); // CraftBukkit
} else {
this.g = null;
this.bU = false;
this.bR = false;
+ this.spawnWorld = ""; // CraftBukkit
}
}
@@ -1275,7 +1454,11 @@
@@ -1340,7 +1517,11 @@
this.setMot(vec3d2.x, d3 * 0.6D, vec3d2.z);
this.aO = f;
this.aM = f;
this.fallDistance = 0.0F;
- this.setFlag(7, false);
+ // CraftBukkit start
@@ -420,7 +411,25 @@
} else {
super.e(vec3d);
}
@@ -1597,26 +1780,31 @@
@@ -1466,12 +1647,17 @@
}
public void startGliding() {
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callToggleGlideEvent(this, true).isCancelled()) // CraftBukkit
this.setFlag(7, true);
}
public void stopGliding() {
+ // CraftBukkit start
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callToggleGlideEvent(this, false).isCancelled()) {
this.setFlag(7, true);
this.setFlag(7, false);
+ }
+ // CraftBukkit end
}
@Override
@@ -1686,26 +1872,31 @@
protected void releaseShoulderEntities() {
if (this.e + 20L < this.world.getTime()) {
@@ -449,7 +458,7 @@
((EntityTameableAnimal) entity).setOwnerUUID(this.uniqueID);
}
entity.setPosition(this.locX, this.locY + 0.699999988079071D, this.locZ);
entity.setPosition(this.locX(), this.locY() + 0.699999988079071D, this.locZ());
- ((WorldServer) this.world).addEntitySerialized(entity);
- });
+ return ((WorldServer) this.world).addEntitySerialized(entity, CreatureSpawnEvent.SpawnReason.SHOULDER_ENTITY); // CraftBukkit