Files
Postea/src/main/java/com/colen/postea/Postea.java
T

133 lines
5.1 KiB
Java
Raw Normal View History

2023-10-21 23:35:00 +01:00
package com.colen.postea;
2023-10-21 23:10:28 +01:00
2023-10-30 01:28:47 +00:00
import com.colen.postea.API.BlockReplacementManager;
2023-10-28 20:00:24 +01:00
import com.colen.postea.API.TileEntityReplacementManager;
2023-10-31 00:27:30 +00:00
import com.colen.postea.Utility.BlockConversionInfo;
import com.colen.postea.Utility.BlockInfo;
2023-10-21 23:10:28 +01:00
import cpw.mods.fml.common.Mod;
2023-10-24 01:44:51 +01:00
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
2023-10-31 00:27:30 +00:00
import net.minecraft.block.Block;
2023-10-28 20:00:24 +01:00
import net.minecraft.init.Blocks;
import net.minecraft.nbt.NBTTagCompound;
2023-10-29 23:53:12 +00:00
import net.minecraft.nbt.NBTTagList;
import java.util.function.Function;
2023-10-21 23:10:28 +01:00
2023-10-31 00:27:30 +00:00
import static com.colen.postea.Utility.PosteaUtilities.cleanseNBT;
2023-10-21 23:10:28 +01:00
@Mod(modid = Tags.MODID, version = Tags.VERSION, name = Tags.MODNAME, acceptedMinecraftVersions = "[1.7.10]")
@SuppressWarnings("unused")
public class Postea {
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) {
//ItemStackReplacementManager.addItemReplacement(Item.getItemFromBlock(Blocks.grass), 0, Item.getItemFromBlock(Blocks.coal_ore), 10);
2023-10-29 01:06:18 +01:00
// BlockReplacementManager.addBlockReplacement(GregTech_API.sBlockOres1, 6, Blocks.emerald_ore, 0);
// BlockReplacementManager.addBlockReplacement(GregTech_API.sBlockOres1, 16022, Blocks.nether_brick, 0);
// BlockReplacementManager.addBlockReplacement(GregTech_API.sBlockOres1, 1018, Blocks.end_stone, 0);
// Define the transformation function
2023-10-29 21:18:26 +00:00
/* Function<NBTTagCompound, NBTTagCompound> myTransformer = (tag) -> {
2023-10-29 01:06:18 +01:00
if (tag.getInteger("m") == 86) {
tag.setInteger("m", 323);
return tag;
}
return tag;
2023-10-29 21:18:26 +00:00
};*/
2023-10-29 01:37:24 +00:00
//TileEntityReplacementManager.tileEntityFixer("GT_TileEntity_Ores", myTransformer);
2023-10-30 20:02:08 +00:00
TileEntityReplacementManager.tileEntityTransformer("GT_TileEntity_Ores", (tag, world) -> {
if (world.provider.dimensionId == -1) {
2023-10-31 00:27:30 +00:00
return new BlockInfo(Blocks.wool, 1);
2023-10-30 20:02:08 +00:00
}
if (world.provider.dimensionId == 1) {
2023-10-31 00:27:30 +00:00
return new BlockInfo(Blocks.wool, 2);
2023-10-29 01:37:24 +00:00
}
2023-10-28 20:00:24 +01:00
2023-10-31 00:27:30 +00:00
return new BlockInfo(Blocks.wool, 3);
2023-10-29 01:37:24 +00:00
});
2023-10-29 21:18:26 +00:00
2023-10-29 23:53:12 +00:00
/* 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);
});*/
2023-10-30 20:02:08 +00:00
TileEntityReplacementManager.tileEntityTransformer("Chest", (tag, world) -> {
2023-10-29 23:53:12 +00:00
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;
};
2023-10-31 00:27:30 +00:00
return new BlockInfo(Blocks.chest, 0, chestTransformer);
2023-10-29 21:18:26 +00:00
});
2023-10-29 23:53:12 +00:00
2023-10-30 01:28:47 +00:00
2023-10-31 00:27:30 +00:00
Function<BlockConversionInfo, BlockConversionInfo> blockTransformer = (blockConversionInfoOld) -> {
BlockConversionInfo blockConversionInfoNew = new BlockConversionInfo();
2023-10-29 23:53:12 +00:00
2023-10-31 01:09:19 +00:00
if ((blockConversionInfoOld.x == 334 && blockConversionInfoOld.y == 4 && blockConversionInfoOld.z == 73)) {
2023-10-31 00:27:30 +00:00
blockConversionInfoNew.blockID = Block.getIdFromBlock(Blocks.wool);
blockConversionInfoNew.metadata = 1;
2023-10-31 01:09:19 +00:00
} else {
blockConversionInfoNew.blockID = blockConversionInfoOld.blockID;
blockConversionInfoNew.metadata = blockConversionInfoOld.metadata;
2023-10-31 00:27:30 +00:00
}
return blockConversionInfoNew;
};
2023-10-29 23:53:12 +00:00
2023-10-31 00:27:30 +00:00
BlockReplacementManager.addBlockReplacement("minecraft:grass", blockTransformer);
2023-10-29 23:53:12 +00:00
2023-10-28 20:00:24 +01:00
}
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent event) {
//BlockReplacementManager.addBlockReplacement(GregTech_API.sBlockOres1, 0, Blocks.chest, 0);
2023-10-24 01:44:51 +01:00
}
2023-10-21 23:10:28 +01:00
}