Transform from TE -> TE working

This commit is contained in:
Connor Colenso committed 2023-10-29 23:53:12 +00:00
1 parent 036452b944
commit d112fd627f
3 files changed
+99 -19

No files matched your search

+73 -6
View File
@@ -7,6 +7,7 @@ import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import net.minecraft.init.Blocks;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import java.util.function.Function;
@@ -31,7 +32,7 @@ public class Postea {
};*/
//TileEntityReplacementManager.tileEntityFixer("GT_TileEntity_Ores", myTransformer);
TileEntityReplacementManager.tileEntityToNormalBlockTransformer("GT_TileEntity_Ores", (tag) -> {
TileEntityReplacementManager.tileEntityTransformer("GT_TileEntity_Ores", (tag) -> {
if (tag.getInteger("m") == 86) {
return new ChunkFixerUtility.BlockInfo(Blocks.wool, 5);
}
@@ -39,13 +40,79 @@ public class Postea {
return new ChunkFixerUtility.BlockInfo(Blocks.wool, 1);
});
TileEntityReplacementManager.tileEntityToNormalBlockTransformer("Furnace", (tag) -> {
return new ChunkFixerUtility.BlockInfo(Blocks.planks, 3);
/* TileEntityReplacementManager.tileEntityTransformer("Furnace", (tag) -> {
Function<NBTTagCompound, NBTTagCompound> chestTransformer = (oldTag) -> {
NBTTagCompound newTag = cleanseNBT("Chest", oldTag);
NBTTagList tagList = new NBTTagList();
NBTTagCompound stoneAtSlot13 = new NBTTagCompound();
stoneAtSlot13.setByte("Count", (byte) 1);
stoneAtSlot13.setByte("Slot", (byte) 13);
stoneAtSlot13.setShort("Damage", (short) 0);
stoneAtSlot13.setShort("id", (short) 1);
tagList.appendTag(stoneAtSlot13);
newTag.setTag("Items", tagList);
return newTag;
};
return new ChunkFixerUtility.BlockInfo(Blocks.chest, 0, chestTransformer);
});*/
TileEntityReplacementManager.tileEntityTransformer("Chest", (tag) -> {
Function<NBTTagCompound, NBTTagCompound> chestTransformer = (oldTag) -> {
NBTTagCompound newTag = cleanseNBT("Chest", oldTag);
NBTTagList tagList = new NBTTagList();
NBTTagCompound stoneAtSlot12 = new NBTTagCompound();
stoneAtSlot12.setByte("Count", (byte) 2);
stoneAtSlot12.setByte("Slot", (byte) 12);
stoneAtSlot12.setShort("Damage", (short) 0);
stoneAtSlot12.setShort("id", (short) 1);
NBTTagCompound stoneAtSlot14 = new NBTTagCompound();
stoneAtSlot14.setByte("Count", (byte) 4);
stoneAtSlot14.setByte("Slot", (byte) 14);
stoneAtSlot14.setShort("Damage", (short) 3);
stoneAtSlot14.setShort("id", (short) 5);
tagList.appendTag(stoneAtSlot12);
tagList.appendTag(stoneAtSlot14);
newTag.setTag("Items", tagList);
return newTag;
};
return new ChunkFixerUtility.BlockInfo(Blocks.chest, 0, chestTransformer);
});
TileEntityReplacementManager.tileEntityToNormalBlockTransformer("Chest", (tag) -> {
return new ChunkFixerUtility.BlockInfo(Blocks.coal_block, 0);
});
// TileEntityReplacementManager.tileEntityToNormalBlockTransformer("Chest", (tag) -> {
// return new ChunkFixerUtility.BlockInfo(Blocks.coal_block, 0);
// });
}
private NBTTagCompound cleanseNBT(String newTileEntityID, NBTTagCompound tag) {
// Cleans the NBT, so that it replaces the ID and adds the x, y, z coordinates.
NBTTagCompound tagCompound = new NBTTagCompound();
tagCompound.setString("id", newTileEntityID);
tagCompound.setInteger("x", tag.getInteger("x"));
tagCompound.setInteger("y", tag.getInteger("y"));
tagCompound.setInteger("z", tag.getInteger("z"));
return tagCompound;
}
@Mod.EventHandler