mirror of
https://github.com/GTNewHorizons/Postea.git
synced 2026-11-19 11:59:06 +00:00
Refactor
This commit is contained in:
1 parent
52e3e7a3f1
commit
036452b944
2 files changed
+15
-9
No files matched your search
@@ -90,23 +90,21 @@ public class ChunkFixerUtility {
|
||||
}
|
||||
|
||||
private static List<ConversionInfo> removeTileEntities(NBTTagList tileEntities) {
|
||||
|
||||
List<ConversionInfo> conversionInfo = new ArrayList<>();
|
||||
String targetTileEntityId = "GT_TileEntity_Ores";
|
||||
List<Integer> indicesToRemove = new ArrayList<>(); // List to store indices of tileEntities to be removed
|
||||
|
||||
// Loop through each tile entity to check for matches
|
||||
for (int i = 0; i < tileEntities.tagCount(); i++) {
|
||||
NBTTagCompound tileEntity = tileEntities.getCompoundTagAt(i);
|
||||
String tileEntityId = tileEntity.getString("id");
|
||||
|
||||
// If the tile entity matches the target
|
||||
if (tileEntityId.equals(targetTileEntityId)) {
|
||||
// Check if we have a transformer registered for this tile entity ID
|
||||
Function<NBTTagCompound, BlockInfo> transformationFunction = TileEntityReplacementManager.getTileEntityToNormalBlockTransformerFunction(tileEntityId);
|
||||
|
||||
if (transformationFunction != null) {
|
||||
int x = tileEntity.getInteger("x");
|
||||
int y = tileEntity.getInteger("y");
|
||||
int z = tileEntity.getInteger("z");
|
||||
|
||||
Function<NBTTagCompound, BlockInfo> transformationFunction = TileEntityReplacementManager.getTileEntityToNormalBlockTransformerFunction(tileEntityId);
|
||||
BlockInfo blockInfo = transformationFunction.apply(tileEntity);
|
||||
|
||||
conversionInfo.add(new ConversionInfo(x, y, z, blockInfo));
|
||||
@@ -114,7 +112,7 @@ public class ChunkFixerUtility {
|
||||
}
|
||||
}
|
||||
|
||||
// Now remove the tile entities in reverse order to avoid index shifts
|
||||
// Remove the tile entities in reverse order to avoid index shifts
|
||||
Collections.reverse(indicesToRemove);
|
||||
for (int index : indicesToRemove) {
|
||||
tileEntities.removeTag(index);
|
||||
|
||||
@@ -22,13 +22,13 @@ public class Postea {
|
||||
// BlockReplacementManager.addBlockReplacement(GregTech_API.sBlockOres1, 1018, Blocks.end_stone, 0);
|
||||
|
||||
// Define the transformation function
|
||||
Function<NBTTagCompound, NBTTagCompound> myTransformer = (tag) -> {
|
||||
/* Function<NBTTagCompound, NBTTagCompound> myTransformer = (tag) -> {
|
||||
if (tag.getInteger("m") == 86) {
|
||||
tag.setInteger("m", 323);
|
||||
return tag;
|
||||
}
|
||||
return tag;
|
||||
};
|
||||
};*/
|
||||
|
||||
//TileEntityReplacementManager.tileEntityFixer("GT_TileEntity_Ores", myTransformer);
|
||||
TileEntityReplacementManager.tileEntityToNormalBlockTransformer("GT_TileEntity_Ores", (tag) -> {
|
||||
@@ -38,6 +38,14 @@ public class Postea {
|
||||
|
||||
return new ChunkFixerUtility.BlockInfo(Blocks.wool, 1);
|
||||
});
|
||||
|
||||
TileEntityReplacementManager.tileEntityToNormalBlockTransformer("Furnace", (tag) -> {
|
||||
return new ChunkFixerUtility.BlockInfo(Blocks.planks, 3);
|
||||
});
|
||||
|
||||
TileEntityReplacementManager.tileEntityToNormalBlockTransformer("Chest", (tag) -> {
|
||||
return new ChunkFixerUtility.BlockInfo(Blocks.coal_block, 0);
|
||||
});
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
|
||||
Reference in new issue
Block a user