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

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/WorldServer.java
+++ b/net/minecraft/server/WorldServer.java
@@ -34,6 +34,16 @@
@@ -36,6 +36,16 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -17,7 +17,7 @@
public class WorldServer extends World {
private static final Logger LOGGER = LogManager.getLogger();
@@ -58,12 +68,29 @@
@@ -60,12 +70,29 @@
@Nullable
private final MobSpawnerTrader mobSpawnerTrader;
@@ -50,7 +50,7 @@
this.nextTickListBlock = new TickListServer<>(this, (block) -> {
return block == null || block.getBlockData().isAir();
}, IRegistry.BLOCK::getKey, IRegistry.BLOCK::get, this::b);
@@ -85,9 +112,44 @@
@@ -87,9 +114,44 @@
this.getWorldData().setGameType(minecraftserver.getGamemode());
}
@@ -70,7 +70,7 @@
+ Block type = getType(pos).getBlock();
+
+ if (result != null && type != Blocks.AIR) {
+ if (!result.q().a(type)) {
+ if (!result.getTileType().isValidBlock(type)) {
+ result = fixTileEntity(pos, type, result);
+ }
+ }
@@ -93,10 +93,10 @@
+ }
+ // CraftBukkit end
+
public void doTick(BooleanSupplier booleansupplier) {
GameProfilerFiller gameprofilerfiller = this.getMethodProfiler();
@@ -162,6 +224,7 @@
@Override
public BiomeBase a(int i, int j, int k) {
return this.getChunkProvider().getChunkGenerator().getWorldChunkManager().getBiome(i, j, k);
@@ -169,6 +231,7 @@
this.rainLevel = MathHelper.a(this.rainLevel, 0.0F, 1.0F);
}
@@ -104,7 +104,7 @@
if (this.lastRainLevel != this.rainLevel) {
this.server.getPlayerList().a((Packet) (new PacketPlayOutGameStateChange(7, this.rainLevel)), this.worldProvider.getDimensionManager());
}
@@ -180,13 +243,34 @@
@@ -187,13 +250,34 @@
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(7, this.rainLevel));
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(8, this.thunderLevel));
}
@@ -140,8 +140,8 @@
})) {
this.C = false;
if (this.getGameRules().getBoolean(GameRules.DO_DAYLIGHT_CYCLE)) {
@@ -225,7 +309,7 @@
this.ae();
@@ -228,7 +312,7 @@
this.ad();
this.ticking = false;
gameprofilerfiller.exitEnter("entities");
- boolean flag3 = !this.players.isEmpty() || !this.getForceLoadedChunks().isEmpty();
@@ -149,7 +149,7 @@
if (flag3) {
this.resetEmptyTime();
@@ -239,6 +323,11 @@
@@ -242,6 +326,11 @@
for (i = 0; i < this.globalEntityList.size(); ++i) {
entity = (Entity) this.globalEntityList.get(i);
@@ -161,7 +161,7 @@
this.a((entity1) -> {
++entity1.ticksLived;
entity1.tick();
@@ -257,6 +346,7 @@
@@ -260,6 +349,7 @@
Entity entity1 = (Entity) entry.getValue();
Entity entity2 = entity1.getVehicle();
@@ -169,15 +169,24 @@
if (!this.server.getSpawnAnimals() && (entity1 instanceof EntityAnimal || entity1 instanceof EntityWaterAnimal)) {
entity1.die();
}
@@ -264,6 +354,7 @@
@@ -267,6 +357,7 @@
if (!this.server.getSpawnNPCs() && entity1 instanceof NPC) {
entity1.die();
}
+ // CraftBukkit end */
if (entity2 != null) {
if (!entity2.dead && entity2.w(entity1)) {
@@ -324,10 +415,10 @@
gameprofilerfiller.enter("checkDespawn");
if (!entity1.dead) {
@@ -312,7 +403,7 @@
}
private void ab() {
- ((List) this.players.stream().filter(EntityLiving::isSleeping).collect(Collectors.toList())).forEach((entityplayer) -> {
+ (this.players.stream().filter(EntityLiving::isSleeping).collect(Collectors.toList())).forEach((entityplayer) -> { // CraftBukkit - decompile error
entityplayer.wakeup(false, false);
});
}
@@ -339,10 +430,10 @@
entityhorseskeleton.r(true);
entityhorseskeleton.setAgeRaw(0);
entityhorseskeleton.setPosition((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
@@ -190,7 +199,7 @@
}
}
@@ -338,11 +429,11 @@
@@ -353,11 +444,11 @@
BiomeBase biomebase = this.getBiome(blockposition);
if (biomebase.a((IWorldReader) this, blockposition1)) {
@@ -203,8 +212,8 @@
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition, Blocks.SNOW.getBlockData(), null); // CraftBukkit
}
if (flag && this.getBiome(blockposition1).b() == BiomeBase.Precipitation.RAIN) {
@@ -389,7 +480,7 @@
if (flag && this.getBiome(blockposition1).d() == BiomeBase.Precipitation.RAIN) {
@@ -404,7 +495,7 @@
protected BlockPosition a(BlockPosition blockposition) {
BlockPosition blockposition1 = this.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING, blockposition);
AxisAlignedBB axisalignedbb = (new AxisAlignedBB(blockposition1, new BlockPosition(blockposition1.getX(), this.getBuildHeight(), blockposition1.getZ()))).g(3.0D);
@@ -213,7 +222,7 @@
return entityliving != null && entityliving.isAlive() && this.f(entityliving.getChunkCoordinates());
});
@@ -418,7 +509,7 @@
@@ -433,7 +524,7 @@
while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
@@ -222,7 +231,7 @@
++i;
} else if (entityplayer.isSleeping()) {
++j;
@@ -436,10 +527,22 @@
@@ -451,10 +542,22 @@
}
private void clearWeather() {
@@ -247,7 +256,7 @@
}
public void resetEmptyTime() {
@@ -477,6 +580,7 @@
@@ -490,6 +593,7 @@
return IRegistry.ENTITY_TYPE.getKey(entity.getEntityType()).toString();
});
entity.tick();
@@ -255,8 +264,8 @@
this.getMethodProfiler().exit();
}
@@ -562,6 +666,22 @@
BlockPosition blockposition = worldchunkmanager.a(0, 0, 256, list, random);
@@ -573,6 +677,22 @@
BlockPosition blockposition = worldchunkmanager.a(0, this.getSeaLevel(), 0, 256, list, random);
ChunkCoordIntPair chunkcoordintpair = blockposition == null ? new ChunkCoordIntPair(0, 0) : new ChunkCoordIntPair(blockposition);
+ // CraftBukkit start
@@ -278,7 +287,16 @@
if (blockposition == null) {
WorldServer.LOGGER.warn("Unable to find spawn biome");
}
@@ -637,6 +757,7 @@
@@ -625,7 +745,7 @@
}
protected void g() {
- WorldGenFeatureConfigured<?, ?> worldgenfeatureconfigured = WorldGenerator.BONUS_CHEST.b((WorldGenFeatureConfiguration) WorldGenFeatureConfiguration.e);
+ WorldGenFeatureConfigured<?, ?> worldgenfeatureconfigured = WorldGenerator.BONUS_CHEST.b(WorldGenFeatureConfiguration.e); // CraftBukkit - decompile error
worldgenfeatureconfigured.a(this, this.getChunkProvider().getChunkGenerator(), this.random, new BlockPosition(this.worldData.b(), this.worldData.c(), this.worldData.d()));
}
@@ -639,6 +759,7 @@
ChunkProviderServer chunkproviderserver = this.getChunkProvider();
if (!flag1) {
@@ -286,24 +304,23 @@
if (iprogressupdate != null) {
iprogressupdate.a(new ChatMessage("menu.savingLevel", new Object[0]));
}
@@ -648,6 +769,16 @@
@@ -650,6 +771,15 @@
chunkproviderserver.save(flag);
}
+
+ // CraftBukkit start - moved from MinecraftServer.saveChunks
+ // PAIL - rename
+ WorldServer worldserver1 = this;
+ WorldData worlddata = worldserver1.getWorldData();
+
+ worldserver1.getWorldBorder().a(worlddata);
+ worlddata.c(this.server.getBossBattleCustomData().c());
+ worldserver1.getDataManager().saveWorldData(worlddata, this.server.getPlayerList().r());
+ worldserver1.getWorldBorder().save(worlddata);
+ worlddata.setCustomBossEvents(this.server.getBossBattleCustomData().save());
+ worldserver1.getDataManager().saveWorldData(worlddata, this.server.getPlayerList().save());
+ // CraftBukkit end
}
protected void k_() throws ExceptionWorldConflict {
@@ -719,7 +850,8 @@
protected void m_() throws ExceptionWorldConflict {
@@ -721,7 +851,8 @@
if (entity instanceof EntityInsentient) {
EntityInsentient entityinsentient = (EntityInsentient) entity;
@@ -313,7 +330,7 @@
continue;
}
}
@@ -736,11 +868,24 @@
@@ -738,11 +869,24 @@
@Override
public boolean addEntity(Entity entity) {
@@ -340,7 +357,7 @@
}
public void addEntityTeleport(Entity entity) {
@@ -790,13 +935,18 @@
@@ -792,13 +936,18 @@
this.registerEntity(entityplayer);
}
@@ -358,10 +375,10 @@
+ return false;
+ }
+ // CraftBukkit end
IChunkAccess ichunkaccess = this.getChunkAt(MathHelper.floor(entity.locX / 16.0D), MathHelper.floor(entity.locZ / 16.0D), ChunkStatus.FULL, entity.attachedToPlayer);
IChunkAccess ichunkaccess = this.getChunkAt(MathHelper.floor(entity.locX() / 16.0D), MathHelper.floor(entity.locZ() / 16.0D), ChunkStatus.FULL, entity.attachedToPlayer);
if (!(ichunkaccess instanceof Chunk)) {
@@ -824,7 +974,7 @@
@@ -826,7 +975,7 @@
if (entity1 == null) {
return false;
} else {
@@ -370,42 +387,42 @@
return true;
}
}
@@ -875,10 +1025,17 @@
@@ -877,10 +1026,17 @@
}
this.getScoreboard().a(entity);
+ // CraftBukkit start - SPIGOT-5278
+ if (entity instanceof EntityDrowned) {
+ this.H.remove(((EntityDrowned) entity).b);
+ this.H.remove(((EntityDrowned) entity).c);
+ this.navigators.remove(((EntityDrowned) entity).navigationWater);
+ this.navigators.remove(((EntityDrowned) entity).navigationLand);
+ } else
+ // CraftBukkit end
if (entity instanceof EntityInsentient) {
this.H.remove(((EntityInsentient) entity).getNavigation());
this.navigators.remove(((EntityInsentient) entity).getNavigation());
}
+ entity.valid = false; // CraftBukkit
}
private void registerEntity(Entity entity) {
@@ -899,9 +1056,16 @@
@@ -901,9 +1057,16 @@
this.entitiesByUUID.put(entity.getUniqueID(), entity);
this.getChunkProvider().addEntity(entity);
+ // CraftBukkit start - SPIGOT-5278
+ if (entity instanceof EntityDrowned) {
+ this.H.add(((EntityDrowned) entity).b);
+ this.H.add(((EntityDrowned) entity).c);
+ this.navigators.add(((EntityDrowned) entity).navigationWater);
+ this.navigators.add(((EntityDrowned) entity).navigationLand);
+ } else
+ // CraftBukkit end
if (entity instanceof EntityInsentient) {
this.H.add(((EntityInsentient) entity).getNavigation());
this.navigators.add(((EntityInsentient) entity).getNavigation());
}
+ entity.valid = true; // CraftBukkit
}
}
@@ -932,6 +1096,18 @@
@@ -934,6 +1097,18 @@
}
public void strikeLightning(EntityLightning entitylightning) {
@@ -422,9 +439,9 @@
+ }
+ // CraftBukkit end
this.globalEntityList.add(entitylightning);
this.server.getPlayerList().sendPacketNearby((EntityHuman) null, entitylightning.locX, entitylightning.locY, entitylightning.locZ, 512.0D, this.worldProvider.getDimensionManager(), new PacketPlayOutSpawnEntityWeather(entitylightning));
this.server.getPlayerList().sendPacketNearby((EntityHuman) null, entitylightning.locX(), entitylightning.locY(), entitylightning.locZ(), 512.0D, this.worldProvider.getDimensionManager(), new PacketPlayOutSpawnEntityWeather(entitylightning));
}
@@ -940,6 +1116,12 @@
@@ -942,6 +1117,12 @@
public void a(int i, BlockPosition blockposition, int j) {
Iterator iterator = this.server.getPlayerList().getPlayers().iterator();
@@ -437,9 +454,9 @@
while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
@@ -948,6 +1130,12 @@
double d1 = (double) blockposition.getY() - entityplayer.locY;
double d2 = (double) blockposition.getZ() - entityplayer.locZ;
@@ -950,6 +1131,12 @@
double d1 = (double) blockposition.getY() - entityplayer.locY();
double d2 = (double) blockposition.getZ() - entityplayer.locZ();
+ // CraftBukkit start
+ if (entityhuman != null && entityhuman instanceof EntityPlayer && !entityplayer.getBukkitEntity().canSee(((EntityPlayer) entityhuman).getBukkitEntity())) {
@@ -450,10 +467,10 @@
if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) {
entityplayer.playerConnection.sendPacket(new PacketPlayOutBlockBreakAnimation(i, blockposition, j));
}
@@ -1008,6 +1196,14 @@
@@ -1010,6 +1197,14 @@
@Override
public Explosion createExplosion(@Nullable Entity entity, DamageSource damagesource, double d0, double d1, double d2, float f, boolean flag, Explosion.Effect explosion_effect) {
public Explosion createExplosion(@Nullable Entity entity, @Nullable DamageSource damagesource, double d0, double d1, double d2, float f, boolean flag, Explosion.Effect explosion_effect) {
+ // CraftBukkit start
+ Explosion explosion = super.createExplosion(entity, damagesource, d0, d1, d2, f, flag, explosion_effect);
+
@@ -465,7 +482,7 @@
Explosion explosion = new Explosion(this, entity, d0, d1, d2, f, flag, explosion_effect);
if (damagesource != null) {
@@ -1016,6 +1212,8 @@
@@ -1018,6 +1213,8 @@
explosion.a();
explosion.a(false);
@@ -474,17 +491,17 @@
if (explosion_effect == Explosion.Effect.NONE) {
explosion.clearBlocks();
}
@@ -1080,13 +1278,20 @@
@@ -1082,13 +1279,20 @@
}
public <T extends ParticleParam> int a(T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6) {
- PacketPlayOutWorldParticles packetplayoutworldparticles = new PacketPlayOutWorldParticles(t0, false, (float) d0, (float) d1, (float) d2, (float) d3, (float) d4, (float) d5, (float) d6, i);
- PacketPlayOutWorldParticles packetplayoutworldparticles = new PacketPlayOutWorldParticles(t0, false, d0, d1, d2, (float) d3, (float) d4, (float) d5, (float) d6, i);
+ // CraftBukkit - visibility api support
+ return sendParticles(null, t0, d0, d1, d2, i, d3, d4, d5, d6, false);
+ }
+
+ public <T extends ParticleParam> int sendParticles(EntityPlayer sender, T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6, boolean force) {
+ PacketPlayOutWorldParticles packetplayoutworldparticles = new PacketPlayOutWorldParticles(t0, force, (float) d0, (float) d1, (float) d2, (float) d3, (float) d4, (float) d5, (float) d6, i);
+ PacketPlayOutWorldParticles packetplayoutworldparticles = new PacketPlayOutWorldParticles(t0, force, d0, d1, d2, (float) d3, (float) d4, (float) d5, (float) d6, i);
+ // CraftBukkit end
int j = 0;
@@ -497,7 +514,7 @@
++j;
}
}
@@ -1169,7 +1374,13 @@
@@ -1170,7 +1374,13 @@
@Override
public WorldMap a(String s) {
return (WorldMap) this.getMinecraftServer().getWorldServer(DimensionManager.OVERWORLD).getWorldPersistentData().b(() -> {