44import gregtech .api .metatileentity .MetaTileEntity ;
55import gregtech .api .metatileentity .registry .MTERegistry ;
66
7- import net .minecraft .client .network .NetHandlerPlayClient ;
87import net .minecraft .nbt .NBTTagCompound ;
9- import net .minecraft .network .PacketBuffer ;
10- import net .minecraft .network .play .server .SPacketChunkData ;
118import net .minecraft .util .ResourceLocation ;
129import net .minecraft .util .math .BlockPos ;
1310import net .minecraft .world .World ;
2017public class ClientHandlerHooks {
2118
2219 /**
23- * Initializes any MetaTileEntities right before {@link Chunk#read(PacketBuffer, int, boolean) Chunk.read()} is
24- * called in
25- * {@link NetHandlerPlayClient#handleChunkData(SPacketChunkData) handleChunkData()}.
20+ * Creates a MetaTileEntity from each tag and sets them in the world
2621 *
27- * @param packetIn Chunk Data Packet
22+ * @param world typically client world
23+ * @param tagCompounds list of TileEntity tag data
2824 */
2925 public static void handleTags (World world , List <NBTTagCompound > tagCompounds ) {
30- tagCompounds .forEach (tagCompound -> handleTag (world , tagCompound ));
26+ for (NBTTagCompound tagCompound : tagCompounds ) {
27+ handleTag (world , tagCompound );
28+ }
3129 }
3230
3331 /**
34- * Initializes the MetaTileEntity before it handles
32+ * Creates a MetaTileEntity from the tag and sets it in the world
3533 *
36- * @param packetIn Tile Entity Update Packet
34+ * @param world typically client world
35+ * @param tagCompound TileEntity tag data
3736 */
3837 public static void handleTag (World world , NBTTagCompound tagCompound ) {
3938 MetaTileEntity mte = fromTag (tagCompound );
@@ -45,8 +44,7 @@ public static void handleTag(World world, NBTTagCompound tagCompound) {
4544 }
4645
4746 /**
48- * Creates the correct MetaTileEntity from the given tag and sets the tile entity to the world
49- * IF a TileEntity doesn't already exist at the position
47+ * Creates the correct MetaTileEntity from the given tag
5048 *
5149 * @param tag TileEntity tag data
5250 */
@@ -60,6 +58,13 @@ private static MetaTileEntity fromTag(NBTTagCompound tag) {
6058 return null ;
6159 }
6260
61+ /**
62+ * Sets a copy of the MetaTileEntity to the world IF a TileEntity doesn't already exist at the position
63+ *
64+ * @param world client world
65+ * @param mte MetaTileEntity to set in world
66+ * @param pos Position to place the MetaTileEntity
67+ */
6368 private static void placeTile (World world , MetaTileEntity mte , BlockPos pos ) {
6469 // set te in world directly
6570 // check if world contains a TE at this pos?
0 commit comments