SPIGOT-5375: Add spaces to coordinates from tile fixer

This commit is contained in:
md_5 2019-10-20 08:05:55 +11:00
parent 606c19e26c
commit 12386dd445

View File

@ -50,7 +50,7 @@
this.nextTickListBlock = new TickListServer<>(this, (block) -> { this.nextTickListBlock = new TickListServer<>(this, (block) -> {
return block == null || block.getBlockData().isAir(); return block == null || block.getBlockData().isAir();
}, IRegistry.BLOCK::getKey, IRegistry.BLOCK::get, this::b); }, IRegistry.BLOCK::getKey, IRegistry.BLOCK::get, this::b);
@@ -85,9 +112,41 @@ @@ -85,9 +112,40 @@
this.getWorldData().setGameType(minecraftserver.getGamemode()); this.getWorldData().setGameType(minecraftserver.getGamemode());
} }
@ -75,7 +75,7 @@
+ } + }
+ +
+ private TileEntity fixTileEntity(BlockPosition pos, Block type, TileEntity found) { + private TileEntity fixTileEntity(BlockPosition pos, Block type, TileEntity found) {
+ this.getServer().getLogger().log(Level.SEVERE, "Block at {0},{1},{2} is {3} but has {4}" + ". " + this.getServer().getLogger().log(Level.SEVERE, "Block at {0}, {1}, {2} is {3} but has {4}" + ". "
+ + "Bukkit will attempt to fix this, but there may be additional damage that we cannot recover.", new Object[]{pos.getX(), pos.getY(), pos.getZ(), type, found}); + + "Bukkit will attempt to fix this, but there may be additional damage that we cannot recover.", new Object[]{pos.getX(), pos.getY(), pos.getZ(), type, found});
+ +
+ if (type instanceof ITileEntity) { + if (type instanceof ITileEntity) {
@ -84,7 +84,6 @@
+ this.setTileEntity(pos, replacement); + this.setTileEntity(pos, replacement);
+ return replacement; + return replacement;
+ } else { + } else {
+ this.getServer().getLogger().severe("Don't know how to fix for this type... Can't do anything! :(");
+ return found; + return found;
+ } + }
+ } + }
@ -93,7 +92,7 @@
public void doTick(BooleanSupplier booleansupplier) { public void doTick(BooleanSupplier booleansupplier) {
GameProfilerFiller gameprofilerfiller = this.getMethodProfiler(); GameProfilerFiller gameprofilerfiller = this.getMethodProfiler();
@@ -162,6 +221,7 @@ @@ -162,6 +220,7 @@
this.rainLevel = MathHelper.a(this.rainLevel, 0.0F, 1.0F); this.rainLevel = MathHelper.a(this.rainLevel, 0.0F, 1.0F);
} }
@ -101,7 +100,7 @@
if (this.lastRainLevel != this.rainLevel) { if (this.lastRainLevel != this.rainLevel) {
this.server.getPlayerList().a((Packet) (new PacketPlayOutGameStateChange(7, this.rainLevel)), this.worldProvider.getDimensionManager()); this.server.getPlayerList().a((Packet) (new PacketPlayOutGameStateChange(7, this.rainLevel)), this.worldProvider.getDimensionManager());
} }
@@ -180,13 +240,34 @@ @@ -180,13 +239,34 @@
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(7, this.rainLevel)); this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(7, this.rainLevel));
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(8, this.thunderLevel)); this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(8, this.thunderLevel));
} }
@ -137,7 +136,7 @@
})) { })) {
this.C = false; this.C = false;
if (this.getGameRules().getBoolean(GameRules.DO_DAYLIGHT_CYCLE)) { if (this.getGameRules().getBoolean(GameRules.DO_DAYLIGHT_CYCLE)) {
@@ -225,7 +306,7 @@ @@ -225,7 +305,7 @@
this.ae(); this.ae();
this.ticking = false; this.ticking = false;
gameprofilerfiller.exitEnter("entities"); gameprofilerfiller.exitEnter("entities");
@ -146,7 +145,7 @@
if (flag3) { if (flag3) {
this.resetEmptyTime(); this.resetEmptyTime();
@@ -239,6 +320,11 @@ @@ -239,6 +319,11 @@
for (i = 0; i < this.globalEntityList.size(); ++i) { for (i = 0; i < this.globalEntityList.size(); ++i) {
entity = (Entity) this.globalEntityList.get(i); entity = (Entity) this.globalEntityList.get(i);
@ -158,7 +157,7 @@
this.a((entity1) -> { this.a((entity1) -> {
++entity1.ticksLived; ++entity1.ticksLived;
entity1.tick(); entity1.tick();
@@ -257,6 +343,7 @@ @@ -257,6 +342,7 @@
Entity entity1 = (Entity) entry.getValue(); Entity entity1 = (Entity) entry.getValue();
Entity entity2 = entity1.getVehicle(); Entity entity2 = entity1.getVehicle();
@ -166,7 +165,7 @@
if (!this.server.getSpawnAnimals() && (entity1 instanceof EntityAnimal || entity1 instanceof EntityWaterAnimal)) { if (!this.server.getSpawnAnimals() && (entity1 instanceof EntityAnimal || entity1 instanceof EntityWaterAnimal)) {
entity1.die(); entity1.die();
} }
@@ -264,6 +351,7 @@ @@ -264,6 +350,7 @@
if (!this.server.getSpawnNPCs() && entity1 instanceof NPC) { if (!this.server.getSpawnNPCs() && entity1 instanceof NPC) {
entity1.die(); entity1.die();
} }
@ -174,7 +173,7 @@
if (entity2 != null) { if (entity2 != null) {
if (!entity2.dead && entity2.w(entity1)) { if (!entity2.dead && entity2.w(entity1)) {
@@ -324,10 +412,10 @@ @@ -324,10 +411,10 @@
entityhorseskeleton.r(true); entityhorseskeleton.r(true);
entityhorseskeleton.setAgeRaw(0); entityhorseskeleton.setAgeRaw(0);
entityhorseskeleton.setPosition((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ()); entityhorseskeleton.setPosition((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
@ -187,7 +186,7 @@
} }
} }
@@ -338,11 +426,11 @@ @@ -338,11 +425,11 @@
BiomeBase biomebase = this.getBiome(blockposition); BiomeBase biomebase = this.getBiome(blockposition);
if (biomebase.a((IWorldReader) this, blockposition1)) { if (biomebase.a((IWorldReader) this, blockposition1)) {
@ -201,7 +200,7 @@
} }
if (flag && this.getBiome(blockposition1).b() == BiomeBase.Precipitation.RAIN) { if (flag && this.getBiome(blockposition1).b() == BiomeBase.Precipitation.RAIN) {
@@ -389,7 +477,7 @@ @@ -389,7 +476,7 @@
protected BlockPosition a(BlockPosition blockposition) { protected BlockPosition a(BlockPosition blockposition) {
BlockPosition blockposition1 = this.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING, 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); AxisAlignedBB axisalignedbb = (new AxisAlignedBB(blockposition1, new BlockPosition(blockposition1.getX(), this.getBuildHeight(), blockposition1.getZ()))).g(3.0D);
@ -210,7 +209,7 @@
return entityliving != null && entityliving.isAlive() && this.f(entityliving.getChunkCoordinates()); return entityliving != null && entityliving.isAlive() && this.f(entityliving.getChunkCoordinates());
}); });
@@ -418,7 +506,7 @@ @@ -418,7 +505,7 @@
while (iterator.hasNext()) { while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next(); EntityPlayer entityplayer = (EntityPlayer) iterator.next();
@ -219,7 +218,7 @@
++i; ++i;
} else if (entityplayer.isSleeping()) { } else if (entityplayer.isSleeping()) {
++j; ++j;
@@ -436,10 +524,22 @@ @@ -436,10 +523,22 @@
} }
private void clearWeather() { private void clearWeather() {
@ -244,7 +243,7 @@
} }
public void resetEmptyTime() { public void resetEmptyTime() {
@@ -477,6 +577,7 @@ @@ -477,6 +576,7 @@
return IRegistry.ENTITY_TYPE.getKey(entity.getEntityType()).toString(); return IRegistry.ENTITY_TYPE.getKey(entity.getEntityType()).toString();
}); });
entity.tick(); entity.tick();
@ -252,7 +251,7 @@
this.getMethodProfiler().exit(); this.getMethodProfiler().exit();
} }
@@ -562,6 +663,22 @@ @@ -562,6 +662,22 @@
BlockPosition blockposition = worldchunkmanager.a(0, 0, 256, list, random); BlockPosition blockposition = worldchunkmanager.a(0, 0, 256, list, random);
ChunkCoordIntPair chunkcoordintpair = blockposition == null ? new ChunkCoordIntPair(0, 0) : new ChunkCoordIntPair(blockposition); ChunkCoordIntPair chunkcoordintpair = blockposition == null ? new ChunkCoordIntPair(0, 0) : new ChunkCoordIntPair(blockposition);
@ -275,7 +274,7 @@
if (blockposition == null) { if (blockposition == null) {
WorldServer.LOGGER.warn("Unable to find spawn biome"); WorldServer.LOGGER.warn("Unable to find spawn biome");
} }
@@ -637,6 +754,7 @@ @@ -637,6 +753,7 @@
ChunkProviderServer chunkproviderserver = this.getChunkProvider(); ChunkProviderServer chunkproviderserver = this.getChunkProvider();
if (!flag1) { if (!flag1) {
@ -283,7 +282,7 @@
if (iprogressupdate != null) { if (iprogressupdate != null) {
iprogressupdate.a(new ChatMessage("menu.savingLevel", new Object[0])); iprogressupdate.a(new ChatMessage("menu.savingLevel", new Object[0]));
} }
@@ -648,6 +766,16 @@ @@ -648,6 +765,16 @@
chunkproviderserver.save(flag); chunkproviderserver.save(flag);
} }
@ -300,7 +299,7 @@
} }
protected void k_() throws ExceptionWorldConflict { protected void k_() throws ExceptionWorldConflict {
@@ -719,7 +847,8 @@ @@ -719,7 +846,8 @@
if (entity instanceof EntityInsentient) { if (entity instanceof EntityInsentient) {
EntityInsentient entityinsentient = (EntityInsentient) entity; EntityInsentient entityinsentient = (EntityInsentient) entity;
@ -310,7 +309,7 @@
continue; continue;
} }
} }
@@ -736,11 +865,24 @@ @@ -736,11 +864,24 @@
@Override @Override
public boolean addEntity(Entity entity) { public boolean addEntity(Entity entity) {
@ -337,7 +336,7 @@
} }
public void addEntityTeleport(Entity entity) { public void addEntityTeleport(Entity entity) {
@@ -790,13 +932,18 @@ @@ -790,13 +931,18 @@
this.registerEntity(entityplayer); this.registerEntity(entityplayer);
} }
@ -358,7 +357,7 @@
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)) { if (!(ichunkaccess instanceof Chunk)) {
@@ -824,7 +971,7 @@ @@ -824,7 +970,7 @@
if (entity1 == null) { if (entity1 == null) {
return false; return false;
} else { } else {
@ -367,7 +366,7 @@
return true; return true;
} }
} }
@@ -875,10 +1022,17 @@ @@ -875,10 +1021,17 @@
} }
this.getScoreboard().a(entity); this.getScoreboard().a(entity);
@ -385,7 +384,7 @@
} }
private void registerEntity(Entity entity) { private void registerEntity(Entity entity) {
@@ -899,9 +1053,16 @@ @@ -899,9 +1052,16 @@
this.entitiesByUUID.put(entity.getUniqueID(), entity); this.entitiesByUUID.put(entity.getUniqueID(), entity);
this.getChunkProvider().addEntity(entity); this.getChunkProvider().addEntity(entity);
@ -402,7 +401,7 @@
} }
} }
@@ -932,6 +1093,18 @@ @@ -932,6 +1092,18 @@
} }
public void strikeLightning(EntityLightning entitylightning) { public void strikeLightning(EntityLightning entitylightning) {
@ -421,7 +420,7 @@
this.globalEntityList.add(entitylightning); 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 +1113,12 @@ @@ -940,6 +1112,12 @@
public void a(int i, BlockPosition blockposition, int j) { public void a(int i, BlockPosition blockposition, int j) {
Iterator iterator = this.server.getPlayerList().getPlayers().iterator(); Iterator iterator = this.server.getPlayerList().getPlayers().iterator();
@ -434,7 +433,7 @@
while (iterator.hasNext()) { while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next(); EntityPlayer entityplayer = (EntityPlayer) iterator.next();
@@ -948,6 +1127,12 @@ @@ -948,6 +1126,12 @@
double d1 = (double) blockposition.getY() - entityplayer.locY; double d1 = (double) blockposition.getY() - entityplayer.locY;
double d2 = (double) blockposition.getZ() - entityplayer.locZ; double d2 = (double) blockposition.getZ() - entityplayer.locZ;
@ -447,7 +446,7 @@
if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) { if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) {
entityplayer.playerConnection.sendPacket(new PacketPlayOutBlockBreakAnimation(i, blockposition, j)); entityplayer.playerConnection.sendPacket(new PacketPlayOutBlockBreakAnimation(i, blockposition, j));
} }
@@ -1008,6 +1193,14 @@ @@ -1008,6 +1192,14 @@
@Override @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, DamageSource damagesource, double d0, double d1, double d2, float f, boolean flag, Explosion.Effect explosion_effect) {
@ -462,7 +461,7 @@
Explosion explosion = new Explosion(this, entity, d0, d1, d2, f, flag, explosion_effect); Explosion explosion = new Explosion(this, entity, d0, d1, d2, f, flag, explosion_effect);
if (damagesource != null) { if (damagesource != null) {
@@ -1016,6 +1209,8 @@ @@ -1016,6 +1208,8 @@
explosion.a(); explosion.a();
explosion.a(false); explosion.a(false);
@ -471,7 +470,7 @@
if (explosion_effect == Explosion.Effect.NONE) { if (explosion_effect == Explosion.Effect.NONE) {
explosion.clearBlocks(); explosion.clearBlocks();
} }
@@ -1080,13 +1275,20 @@ @@ -1080,13 +1274,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) { public <T extends ParticleParam> int a(T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6) {
@ -494,7 +493,7 @@
++j; ++j;
} }
} }
@@ -1169,7 +1371,13 @@ @@ -1169,7 +1370,13 @@
@Override @Override
public WorldMap a(String s) { public WorldMap a(String s) {
return (WorldMap) this.getMinecraftServer().getWorldServer(DimensionManager.OVERWORLD).getWorldPersistentData().b(() -> { return (WorldMap) this.getMinecraftServer().getWorldServer(DimensionManager.OVERWORLD).getWorldPersistentData().b(() -> {