Commits
1 - | --- ../work/decompile-8eb82bde//net/minecraft/server/Chunk.java 2014-11-28 17:43:42.981707438 +0000 |
2 - | +++ src/main/java/net/minecraft/server/Chunk.java 2014-11-28 17:38:22.000000000 +0000 |
1 + | --- ../work/decompile-8eb82bde/net/minecraft/server/Chunk.java 2014-12-21 17:32:05.580576417 +0000 |
2 + | +++ src/main/java/net/minecraft/server/Chunk.java 2014-12-21 17:32:05.580576417 +0000 |
3 3 | |
4 4 | package net.minecraft.server; |
5 5 | |
6 6 | import com.google.common.base.Predicate; |
7 7 | +import com.google.common.collect.Lists; // CraftBukkit |
8 8 | import com.google.common.collect.Maps; |
9 9 | import com.google.common.collect.Queues; |
10 10 | import java.util.Arrays; |
11 11 | |
12 12 | import org.apache.logging.log4j.LogManager; |
72 72 | + } |
73 73 | } |
74 74 | |
75 75 | + public org.bukkit.Chunk bukkitChunk; |
76 76 | + public boolean mustSave; |
77 77 | + // CraftBukkit end |
78 78 | + |
79 79 | public Chunk(World world, ChunkSnapshot chunksnapshot, int i, int j) { |
80 80 | this(world, i, j); |
81 81 | short short0 = 256; |
82 - | |
83 - | flag = j >= i1; |
84 - | } |
85 - | |
86 - | - chunksection.setType(i, j & 15, k, iblockdata); |
87 - | + // CraftBukkit start - Delay removing containers until after they're cleaned up |
88 - | + if (!(block1 instanceof IContainer)) { |
89 - | + chunksection.setType(i, j & 15, k, iblockdata); |
90 - | + } |
91 - | + // CraftBukkit end |
92 - | + |
93 - | + |
94 - | if (block1 != block) { |
95 - | if (!this.world.isStatic) { |
96 - | block1.remove(this.world, blockposition, iblockdata1); |
97 - | |
98 - | } |
99 - | } |
100 - | |
101 - | + // CraftBukkit start - Delay removing containers until after they're cleaned up |
102 - | + if (block1 instanceof IContainer) { |
103 - | + chunksection.setType(i, j & 15, k, iblockdata); |
104 - | + } |
105 - | + // CraftBukkit end |
106 - | + |
107 - | if (chunksection.b(i, j & 15, k) != block) { |
108 - | return null; |
109 - | } else { |
110 - | |
82 + | |
111 83 | } |
112 84 | } |
113 85 | |
114 86 | - if (!this.world.isStatic && block1 != block) { |
115 87 | + // CraftBukkit - Don't place while processing the BlockPlaceEvent, unless it's a BlockContainer. Prevents blocks such as TNT from activating when cancelled. |
116 88 | + if (!this.world.isStatic && block1 != block && (!this.world.captureBlockStates || block instanceof BlockContainer)) { |
117 89 | block.onPlace(this.world, blockposition, iblockdata); |
118 90 | } |
119 91 | |
120 - | |
92 + | |
121 93 | int j = MathHelper.floor(entity.locZ / 16.0D); |
122 94 | |
123 95 | if (i != this.locX || j != this.locZ) { |
124 96 | - Chunk.c.warn("Wrong location! (" + i + ", " + j + ") should be (" + this.locX + ", " + this.locZ + "), " + entity, new Object[] { entity}); |
125 97 | + // CraftBukkit start |
126 98 | + Bukkit.getLogger().warning("Wrong location for " + entity + " in world '" + world.getWorld().getName() + "'!"); |
127 99 | + // Chunk.c.warn("Wrong location! (" + i + ", " + j + ") should be (" + this.locX + ", " + this.locZ + "), " + entity, new Object[] { entity}); |
128 100 | + Bukkit.getLogger().warning("Entity is at " + entity.locX + "," + entity.locZ + " (chunk " + i + "," + j + ") but was stored in chunk " + this.locX + "," + this.locZ); |
129 101 | + // CraftBukkit end |
130 102 | entity.die(); |
131 103 | } |
132 104 | |
133 - | |
105 + | |
134 106 | |
135 107 | tileentity.D(); |
136 108 | this.tileEntities.put(blockposition, tileentity); |
137 109 | + // CraftBukkit start |
138 110 | + } else { |
139 111 | + System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ() |
140 112 | + + " (" + org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(getType(blockposition)) + ") where there was no entity tile!"); |
141 113 | + System.out.println("Chunk coordinates: " + (this.locX * 16) + "," + (this.locZ * 16)); |
142 114 | + new Exception().printStackTrace(); |
143 115 | + // CraftBukkit end |
144 116 | } |
145 117 | } |
146 118 | |
147 - | |
119 + | |
148 120 | } |
149 121 | |
150 122 | for (int i = 0; i < this.entitySlices.length; ++i) { |
151 123 | - this.world.c((Collection) this.entitySlices[i]); |
152 124 | + // CraftBukkit start |
153 125 | + List<Entity> newList = Lists.newArrayList(this.entitySlices[i]); |
154 126 | + java.util.Iterator<Entity> iter = newList.iterator(); |
155 127 | + while (iter.hasNext()) { |
156 128 | + Entity entity = iter.next(); |
157 129 | + |