SPIGOT-3320: Apply tile entity fixer to more types

This commit is contained in:
md_5 2017-06-11 08:32:29 +10:00
parent ed8c725d19
commit 639aa0cf48

View File

@ -88,7 +88,7 @@
this.getWorldBorder().setCenter(this.worldData.B(), this.worldData.C()); this.getWorldBorder().setCenter(this.worldData.B(), this.worldData.C());
this.getWorldBorder().setDamageAmount(this.worldData.H()); this.getWorldBorder().setDamageAmount(this.worldData.H());
this.getWorldBorder().setDamageBuffer(this.worldData.G()); this.getWorldBorder().setDamageBuffer(this.worldData.G());
@@ -88,9 +121,98 @@ @@ -88,9 +121,146 @@
this.getWorldBorder().setSize(this.worldData.D()); this.getWorldBorder().setSize(this.worldData.D());
} }
@ -155,6 +155,54 @@
+ if (!(result instanceof TileEntityHopper)) { + if (!(result instanceof TileEntityHopper)) {
+ result = fixTileEntity(pos, type, result); + result = fixTileEntity(pos, type, result);
+ } + }
+ } else if (type == Blocks.ENCHANTING_TABLE) {
+ if (!(result instanceof TileEntityEnchantTable)) {
+ result = fixTileEntity(pos, type, result);
+ }
+ } else if (type == Blocks.END_PORTAL) {
+ if (!(result instanceof TileEntityEndGateway)) {
+ result = fixTileEntity(pos, type, result);
+ }
+ } else if (type == Blocks.SKULL) {
+ if (!(result instanceof TileEntitySkull)) {
+ result = fixTileEntity(pos, type, result);
+ }
+ } else if (type == Blocks.DAYLIGHT_DETECTOR || type == Blocks.DAYLIGHT_DETECTOR_INVERTED) {
+ if (!(result instanceof TileEntityLightDetector)) {
+ result = fixTileEntity(pos, type, result);
+ }
+ } else if (type == Blocks.POWERED_COMPARATOR || type == Blocks.UNPOWERED_COMPARATOR) {
+ if (!(result instanceof TileEntityComparator)) {
+ result = fixTileEntity(pos, type, result);
+ }
+ } else if (type == Blocks.FLOWER_POT) {
+ if (!(result instanceof TileEntityFlowerPot)) {
+ result = fixTileEntity(pos, type, result);
+ }
+ } else if (type == Blocks.STANDING_BANNER || type == Blocks.WALL_BANNER) {
+ if (!(result instanceof TileEntityBanner)) {
+ result = fixTileEntity(pos, type, result);
+ }
+ } else if (type == Blocks.STRUCTURE_BLOCK) {
+ if (!(result instanceof TileEntityStructure)) {
+ result = fixTileEntity(pos, type, result);
+ }
+ } else if (type == Blocks.END_PORTAL) {
+ if (!(result instanceof TileEntityEndGateway)) {
+ result = fixTileEntity(pos, type, result);
+ }
+ } else if (type == Blocks.COMMAND_BLOCK) {
+ if (!(result instanceof TileEntityCommand)) {
+ result = fixTileEntity(pos, type, result);
+ }
+ } else if (type == Blocks.STRUCTURE_BLOCK) {
+ if (!(result instanceof TileEntityStructure)) {
+ result = fixTileEntity(pos, type, result);
+ }
+ } else if (type == Blocks.BED) {
+ if (!(result instanceof TileEntityBed)) {
+ result = fixTileEntity(pos, type, result);
+ }
+ } + }
+ +
+ return result; + return result;
@ -187,7 +235,7 @@
public void doTick() { public void doTick() {
super.doTick(); super.doTick();
if (this.getWorldData().isHardcore() && this.getDifficulty() != EnumDifficulty.HARD) { if (this.getWorldData().isHardcore() && this.getDifficulty() != EnumDifficulty.HARD) {
@@ -109,8 +231,11 @@ @@ -109,8 +279,11 @@
} }
this.methodProfiler.a("mobSpawner"); this.methodProfiler.a("mobSpawner");
@ -201,7 +249,7 @@
} }
this.methodProfiler.c("chunkSource"); this.methodProfiler.c("chunkSource");
@@ -139,6 +264,8 @@ @@ -139,6 +312,8 @@
this.portalTravelAgent.a(this.getTime()); this.portalTravelAgent.a(this.getTime());
this.methodProfiler.b(); this.methodProfiler.b();
this.aq(); this.aq();
@ -210,7 +258,7 @@
} }
@Nullable @Nullable
@@ -166,7 +293,7 @@ @@ -166,7 +341,7 @@
if (entityhuman.isSpectator()) { if (entityhuman.isSpectator()) {
++i; ++i;
@ -219,7 +267,7 @@
++j; ++j;
} }
} }
@@ -195,25 +322,46 @@ @@ -195,25 +370,46 @@
} }
private void c() { private void c() {
@ -270,7 +318,7 @@
return false; return false;
} else { } else {
@@ -283,7 +431,7 @@ @@ -283,7 +479,7 @@
entityhorseskeleton.p(true); entityhorseskeleton.p(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());
@ -279,7 +327,7 @@
this.strikeLightning(new EntityLightning(this, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), true)); this.strikeLightning(new EntityLightning(this, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), true));
} else { } else {
this.strikeLightning(new EntityLightning(this, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), false)); this.strikeLightning(new EntityLightning(this, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), false));
@@ -299,11 +447,11 @@ @@ -299,11 +495,11 @@
BlockPosition blockposition1 = blockposition.down(); BlockPosition blockposition1 = blockposition.down();
if (this.v(blockposition1)) { if (this.v(blockposition1)) {
@ -293,7 +341,7 @@
} }
if (flag && this.getBiome(blockposition1).d()) { if (flag && this.getBiome(blockposition1).d()) {
@@ -378,7 +526,7 @@ @@ -378,7 +574,7 @@
public boolean b(BlockPosition blockposition, Block block) { public boolean b(BlockPosition blockposition, Block block) {
NextTickListEntry nextticklistentry = new NextTickListEntry(blockposition, block); NextTickListEntry nextticklistentry = new NextTickListEntry(blockposition, block);
@ -302,7 +350,7 @@
} }
public void a(BlockPosition blockposition, Block block, int i) { public void a(BlockPosition blockposition, Block block, int i) {
@@ -412,8 +560,8 @@ @@ -412,8 +608,8 @@
nextticklistentry.a(j); nextticklistentry.a(j);
} }
@ -313,7 +361,7 @@
this.nextTickList.add(nextticklistentry); this.nextTickList.add(nextticklistentry);
} }
} }
@@ -430,15 +578,15 @@ @@ -430,15 +626,15 @@
nextticklistentry.a((long) i + this.worldData.getTime()); nextticklistentry.a((long) i + this.worldData.getTime());
} }
@ -332,7 +380,7 @@
if (this.emptyTime++ >= 300) { if (this.emptyTime++ >= 300) {
return; return;
} }
@@ -508,11 +656,17 @@ @@ -508,11 +704,17 @@
} else { } else {
int i = this.nextTickList.size(); int i = this.nextTickList.size();
@ -352,7 +400,7 @@
} }
this.methodProfiler.a("cleaning"); this.methodProfiler.a("cleaning");
@@ -525,8 +679,9 @@ @@ -525,8 +727,9 @@
break; break;
} }
@ -363,7 +411,7 @@
this.W.add(nextticklistentry); this.W.add(nextticklistentry);
} }
@@ -596,7 +751,7 @@ @@ -596,7 +799,7 @@
if (blockposition.getX() >= structureboundingbox.a && blockposition.getX() < structureboundingbox.d && blockposition.getZ() >= structureboundingbox.c && blockposition.getZ() < structureboundingbox.f) { if (blockposition.getX() >= structureboundingbox.a && blockposition.getX() < structureboundingbox.d && blockposition.getZ() >= structureboundingbox.c && blockposition.getZ() < structureboundingbox.f) {
if (flag) { if (flag) {
if (i == 0) { if (i == 0) {
@ -372,7 +420,7 @@
} }
iterator.remove(); iterator.remove();
@@ -614,6 +769,7 @@ @@ -614,6 +817,7 @@
return arraylist; return arraylist;
} }
@ -380,7 +428,7 @@
public void entityJoinedWorld(Entity entity, boolean flag) { public void entityJoinedWorld(Entity entity, boolean flag) {
if (!this.getSpawnAnimals() && (entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal)) { if (!this.getSpawnAnimals() && (entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal)) {
entity.die(); entity.die();
@@ -625,6 +781,7 @@ @@ -625,6 +829,7 @@
super.entityJoinedWorld(entity, flag); super.entityJoinedWorld(entity, flag);
} }
@ -388,7 +436,7 @@
private boolean getSpawnNPCs() { private boolean getSpawnNPCs() {
return this.server.getSpawnNPCs(); return this.server.getSpawnNPCs();
@@ -637,7 +794,54 @@ @@ -637,7 +842,54 @@
protected IChunkProvider n() { protected IChunkProvider n() {
IChunkLoader ichunkloader = this.dataManager.createChunkLoader(this.worldProvider); IChunkLoader ichunkloader = this.dataManager.createChunkLoader(this.worldProvider);
@ -444,7 +492,7 @@
} }
public boolean a(EntityHuman entityhuman, BlockPosition blockposition) { public boolean a(EntityHuman entityhuman, BlockPosition blockposition) {
@@ -699,6 +903,23 @@ @@ -699,6 +951,23 @@
int j = this.worldProvider.getSeaLevel(); int j = this.worldProvider.getSeaLevel();
int k = 8; int k = 8;
@ -468,7 +516,7 @@
if (blockposition != null) { if (blockposition != null) {
i = blockposition.getX(); i = blockposition.getX();
k = blockposition.getZ(); k = blockposition.getZ();
@@ -708,7 +929,7 @@ @@ -708,7 +977,7 @@
int l = 0; int l = 0;
@ -477,7 +525,7 @@
i += random.nextInt(64) - random.nextInt(64); i += random.nextInt(64) - random.nextInt(64);
k += random.nextInt(64) - random.nextInt(64); k += random.nextInt(64) - random.nextInt(64);
++l; ++l;
@@ -750,6 +971,7 @@ @@ -750,6 +1019,7 @@
ChunkProviderServer chunkproviderserver = this.getChunkProviderServer(); ChunkProviderServer chunkproviderserver = this.getChunkProviderServer();
if (chunkproviderserver.e()) { if (chunkproviderserver.e()) {
@ -485,7 +533,7 @@
if (iprogressupdate != null) { if (iprogressupdate != null) {
iprogressupdate.a("Saving level"); iprogressupdate.a("Saving level");
} }
@@ -760,7 +982,8 @@ @@ -760,7 +1030,8 @@
} }
chunkproviderserver.a(flag); chunkproviderserver.a(flag);
@ -495,7 +543,7 @@
Iterator iterator = arraylist.iterator(); Iterator iterator = arraylist.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
@@ -795,6 +1018,12 @@ @@ -795,6 +1066,12 @@
} }
} }
@ -508,7 +556,7 @@
this.worldData.a(this.getWorldBorder().getSize()); this.worldData.a(this.getWorldBorder().getSize());
this.worldData.d(this.getWorldBorder().getCenterX()); this.worldData.d(this.getWorldBorder().getCenterX());
this.worldData.c(this.getWorldBorder().getCenterZ()); this.worldData.c(this.getWorldBorder().getCenterZ());
@@ -808,9 +1037,13 @@ @@ -808,9 +1085,13 @@
this.worldMaps.a(); this.worldMaps.a();
} }
@ -524,7 +572,7 @@
public void a(Collection<Entity> collection) { public void a(Collection<Entity> collection) {
ArrayList arraylist = Lists.newArrayList(collection); ArrayList arraylist = Lists.newArrayList(collection);
@@ -829,7 +1062,7 @@ @@ -829,7 +1110,7 @@
private boolean j(Entity entity) { private boolean j(Entity entity) {
if (entity.dead) { if (entity.dead) {
@ -533,7 +581,7 @@
return false; return false;
} else { } else {
UUID uuid = entity.getUniqueID(); UUID uuid = entity.getUniqueID();
@@ -841,7 +1074,7 @@ @@ -841,7 +1122,7 @@
this.f.remove(entity1); this.f.remove(entity1);
} else { } else {
if (!(entity instanceof EntityHuman)) { if (!(entity instanceof EntityHuman)) {
@ -542,7 +590,7 @@
return false; return false;
} }
@@ -894,8 +1127,16 @@ @@ -894,8 +1175,16 @@
} }
public boolean strikeLightning(Entity entity) { public boolean strikeLightning(Entity entity) {
@ -560,7 +608,7 @@
return true; return true;
} else { } else {
return false; return false;
@@ -911,10 +1152,20 @@ @@ -911,10 +1200,20 @@
} }
public Explosion createExplosion(@Nullable Entity entity, double d0, double d1, double d2, float f, boolean flag, boolean flag1) { public Explosion createExplosion(@Nullable Entity entity, double d0, double d1, double d2, float f, boolean flag, boolean flag1) {
@ -581,7 +629,7 @@
if (!flag1) { if (!flag1) {
explosion.clearBlocks(); explosion.clearBlocks();
} }
@@ -960,7 +1211,8 @@ @@ -960,7 +1259,8 @@
BlockActionData blockactiondata = (BlockActionData) iterator.next(); BlockActionData blockactiondata = (BlockActionData) iterator.next();
if (this.a(blockactiondata)) { if (this.a(blockactiondata)) {
@ -591,7 +639,7 @@
} }
} }
@@ -983,6 +1235,7 @@ @@ -983,6 +1283,7 @@
boolean flag = this.isRaining(); boolean flag = this.isRaining();
super.t(); super.t();
@ -599,7 +647,7 @@
if (this.n != this.o) { if (this.n != this.o) {
this.server.getPlayerList().a((Packet) (new PacketPlayOutGameStateChange(7, this.o)), this.worldProvider.getDimensionManager().getDimensionID()); this.server.getPlayerList().a((Packet) (new PacketPlayOutGameStateChange(7, this.o)), this.worldProvider.getDimensionManager().getDimensionID());
} }
@@ -1001,6 +1254,21 @@ @@ -1001,6 +1302,21 @@
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(7, this.o)); this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(7, this.o));
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(8, this.q)); this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(8, this.q));
} }
@ -621,7 +669,7 @@
} }
@@ -1030,10 +1298,20 @@ @@ -1030,10 +1346,20 @@
} }
public void a(EnumParticle enumparticle, boolean flag, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6, int... aint) { public void a(EnumParticle enumparticle, boolean flag, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6, int... aint) {