Init of items

This commit is contained in:
TheDarkDnKTv 2020-08-05 22:00:34 +03:00
parent 6d41f6f7d9
commit db088425a3
9 changed files with 73 additions and 55 deletions

View file

@ -32,6 +32,8 @@ import gregtechmod.common.items.GT_MetaMachine_Item;
import gregtechmod.common.items.GT_MetaOre_Item;
import gregtechmod.common.items.GT_MetaStone1_Item;
import gregtechmod.common.render.GT_Block_Renderer;
import gregtechmod.loaders.load.GT_CircuitBehaviorLoad;
import gregtechmod.loaders.load.GT_DictRegistratorPostItem;
import gregtechmod.loaders.load.GT_DictRegistratorPreItem;
import gregtechmod.loaders.load.GT_ItemLoader;
import gregtechmod.loaders.misc.GT_CoverLoader;
@ -248,7 +250,7 @@ public class GT_Mod implements IGT_Mod, IGT_RecipeAdder {
sNerfedStoneTools = GT_Config.sConfigFileStandard.get("general", "smallerStoneToolDurability" , true ).getBoolean(true);
//sPatchLightUpdateLag = GT_Config.sConfigFileStandard.get("general", "patchingLightUpdateLag" , true ).getBoolean(true);
float tScrapChance = GT_Config.sConfigFileStandard.get("general", "weightForScrapFromScrapboxing", 200).getInt(200);
//
// sBlockIDs[ 0] = GT_Config.sConfigFileIDs.getBlock("Block" , sBlockIDs[ 0]).getInt();
// sBlockIDs[ 1] = GT_Config.sConfigFileIDs.getBlock("Machine" , sBlockIDs[ 1]).getInt();
// sBlockIDs[ 2] = GT_Config.sConfigFileIDs.getBlock("Ore" , sBlockIDs[ 2]).getInt();
@ -492,34 +494,34 @@ public class GT_Mod implements IGT_Mod, IGT_RecipeAdder {
// GT_LanguageManager.addStringLocalization("tile.BlockMetaID_Block2." + GT_LanguageManager.mNameList3[i] + ".name", GT_LanguageManager.mRegionalNameList3[i]);
// GT_LanguageManager.addStringLocalization("tile.BlockMetaID_Stone1." + GT_LanguageManager.mNameList4[i] + ".name", GT_LanguageManager.mRegionalNameList4[i]);
// }
//
// GregTech_API.registerMachineBlock(GregTech_API.sBlockList[0].blockID, (1|2|64|1024|8192|16384|32768));
// GregTech_API.registerMachineBlock(GregTech_API.sBlockList[1].blockID, (1));
// GregTech_API.registerMachineBlock(GregTech_API.sBlockList[4].blockID, (256|512|8192));
//
// GT_Log.out.println("GT_Mod: Register old TileEntities.");
GregTech_API.registerMachineBlock(GregTech_API.sBlockList[0], (1|2|64|1024|8192|16384|32768));
GregTech_API.registerMachineBlock(GregTech_API.sBlockList[1], (1));
GregTech_API.registerMachineBlock(GregTech_API.sBlockList[4], (256|512|8192));
GT_Log.log.info("GT_Mod: Register old TileEntities.");
// GameRegistry.registerTileEntity(GT_TileEntity_ComputerCube.class , GT_LanguageManager.mNameList1[ 4]);
// GameRegistry.registerTileEntity(GT_TileEntity_Sonictron.class , GT_LanguageManager.mNameList1[ 6]);
// GameRegistry.registerTileEntity(GT_TileEntity_Superconductor.class , GT_LanguageManager.mNameList1[12]);
// GameRegistry.registerTileEntity(GT_TileEntity_PlayerDetector.class , GT_LanguageManager.mNameList1[13]);
// GameRegistry.registerTileEntity(GT_TileEntity_LightSource.class , "GT_LightSource");
//
// GameRegistry.registerTileEntity(GregTech_API.constructBaseMetaTileEntity().getClass(), "MetatileEntity");
// GameRegistry.registerTileEntity(BaseMetaPipeEntity.class, "MetaPipeEntity");
//
// GT_Log.out.println("GT_Mod: Testing BaseMetaTileEntity.");
GT_Log.log.info("GT_Mod: Testing BaseMetaTileEntity.");
// if (GregTech_API.constructBaseMetaTileEntity() == null) {
// GT_Log.out.println("GT_Mod: Fatal Error ocurred while initializing TileEntities, crashing Minecraft.");
// throw new RuntimeException("");
// }
//
// new GT_MetaTileEntityLoader().run();
new GT_DictRegistratorPreItem().run();
new GT_ItemLoader().run();
// new GT_DictRegistratorPostItem().run();
// new GT_CircuitBehaviorLoad().run();
//
// GT_Log.out.println("GT_Mod: Adding Configs specific for MetaTileEntities");
new GT_DictRegistratorPostItem().run();
new GT_CircuitBehaviorLoad().run();
GT_Log.log.info("GT_Mod: Adding Configs specific for MetaTileEntities");
// try {
// for (IMetaTileEntity tMetaTileEntity : GregTech_API.mMetaTileList) {
// if (tMetaTileEntity != null) tMetaTileEntity.onConfigLoad(GregTech_API.sConfiguration);
@ -527,7 +529,7 @@ public class GT_Mod implements IGT_Mod, IGT_RecipeAdder {
// } catch(Throwable e) {
// e.printStackTrace(GT_Log.err);
// }
GregTech_API.sLoadFinished = true;
GT_Log.log.info("GT_Mod: Load-Phase finished!");
for (Runnable tRunnable : GregTech_API.sAfterGTLoad) {
@ -556,7 +558,7 @@ public class GT_Mod implements IGT_Mod, IGT_RecipeAdder {
GT_Log.log.info("GT_Mod: Beginning PostLoad-Phase.");
GregTech_API.sPostloadStarted = true;
// GT_Log.out.println("GT_Mod: Checking if Items got overloaded.");
GT_Log.log.info("GT_Mod: Checking if Items got overloaded.");
// for (int i = 0; i < GregTech_API.sItemList.length; i++) {
// if (GregTech_API.sItemList[i] != null && Item.itemsList[GregTech_API.sItemList[i].itemID] != GregTech_API.sItemList[i]) {
// GT_Log.err.println("GT_Mod: Another Mods ItemID is conflicting.");

View file

@ -22,6 +22,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
@ -86,7 +87,7 @@ public class GregTech_API {
/** Icon which represents failed rendering */
@SideOnly(Side.CLIENT)
public static IIcon FAIL_ICON = null;
public static IIcon FAIL_ICON;
/** My Creative Tab */
public static final CreativeTabs TAB_GREGTECH = new GT_CreativeTab();
@ -124,7 +125,7 @@ public class GregTech_API {
/** The Icon List for Covers */
@SideOnly(Side.CLIENT)
public static final Map<Integer, IIcon> sCovers = new HashMap<Integer, IIcon>();
public static Map<Integer, IIcon> sCovers;
/** The List of Circuit Behaviors for the Redstone Circuit Block */
public static final Map<Integer, GT_CircuitryBehavior> sCircuitryBehaviors = new HashMap<Integer, GT_CircuitryBehavior>();
@ -187,6 +188,14 @@ public class GregTech_API {
/** If you have to give something a World Parameter but there is no World... */
public static World sDummyWorld;
static {
if (FMLCommonHandler.instance().getSide().isClient()) {
sCovers = new HashMap<Integer, IIcon>();
}
}
/**
* Gets a Block from my Addon.
* @param aIndex Index of my Item:

View file

@ -204,7 +204,7 @@ public class GT_Tool_Item extends GT_Generic_Item {
public void checkEnchantmentEffects(ItemStack aStack) {
if (aStack != null) {
aStack.stackTagCompound.removeTag("ench");
if (aStack.hasTagCompound()) aStack.stackTagCompound.removeTag("ench");
if (!GT_ModHandler.isElectricItem(aStack) || GT_ModHandler.canUseElectricItem(aStack, mEUperBrokenBlock)) {
if (mSilklevel > 0) aStack.addEnchantment(Enchantment.silkTouch , mSilklevel);
if (mFortunelevel > 0) aStack.addEnchantment(Enchantment.fortune , mFortunelevel);

View file

@ -5,21 +5,17 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.registry.LanguageRegistry;
public class GT_CreativeTab extends CreativeTabs {
public static ItemStack icon;
@SuppressWarnings("deprecation")
public GT_CreativeTab() {
super("GregTech");
LanguageRegistry.instance().addStringLocalization("itemGroup.GregTech", "GregTech Intergalactical"); // FIXME: LANG
super("gregtech");
}
@Override
public ItemStack getIconItemStack() {
return icon != null ? icon = GregTech_API.getGregTechItem(55, 1, 0) : new ItemStack(Blocks.iron_block, 1);
return icon != null ? icon : (icon = GregTech_API.getGregTechItem(55, 1, 0)) != null ? icon : new ItemStack(Blocks.iron_block, 1);
}
@Override

View file

@ -78,7 +78,7 @@ public class GT_Debug_Item extends GT_Generic_Item implements IElectricItem {
@Override
public boolean onItemUseFirst(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float aClickX, float aClickY, float aClickZ) {
if (aWorld.isRemote) {
GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(108), 1.0F, aX, aY, aZ);
// GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(108), 1.0F, aX, aY, aZ);
return false;
}
if (aPlayer instanceof EntityPlayerMP && GT_ModHandler.canUseElectricItem(aStack, 25000)) {

View file

@ -13,7 +13,7 @@ import gregtechmod.common.redstonecircuits.GT_Circuit_Timer;
public class GT_CircuitBehaviorLoad implements Runnable {
@Override
public void run() {
GT_Log.out.println("GT_Mod: Register Redstone Circuit behaviours.");
GT_Log.log.info("GT_Mod: Register Redstone Circuit behaviours.");
new GT_Circuit_Timer(0);
new GT_Circuit_BasicLogic(1);
new GT_Circuit_Repeater(2);

View file

@ -6,14 +6,14 @@ import gregtechmod.api.util.GT_Log;
import gregtechmod.api.util.GT_ModHandler;
import gregtechmod.api.util.GT_OreDictUnificator;
import gregtechmod.common.items.GT_MetaItem_Dust;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
public class GT_DictRegistratorPostItem implements Runnable {
@Override
public void run() {
GT_Log.out.println("GT_Mod: Registering GT/IC2-Circuitry and similar to the OreDict.");
GT_Log.log.info("GT_Mod: Registering GT/IC2-Circuitry and similar to the OreDict.");
GT_OreDictUnificator.registerOre("craftingLiBattery" , GregTech_API.getGregTechItem(56, 1, GregTech_API.ITEM_WILDCARD_DAMAGE));
GT_OreDictUnificator.registerOre("craftingLiBattery" , GregTech_API.getGregTechItem(57, 1, GregTech_API.ITEM_WILDCARD_DAMAGE));
GT_OreDictUnificator.registerOre("craftingCircuitTier08" , GregTech_API.getGregTechItem(43, 1, 0));
@ -51,12 +51,12 @@ public class GT_DictRegistratorPostItem implements Runnable {
GT_OreDictUnificator.registerOre("craftingRawMachineTier02" , GT_ModHandler.getIC2Item("advancedMachine", 1));
GT_OreDictUnificator.registerOre("craftingRawMachineTier04" , new ItemStack(GregTech_API.sBlockList[0], 1, 10));
GT_OreDictUnificator.registerOre("craftingRedstoneTorch" , new ItemStack(Block.torchRedstoneIdle, 1, GregTech_API.ITEM_WILDCARD_DAMAGE));
GT_OreDictUnificator.registerOre("craftingRedstoneTorch" , new ItemStack(Block.torchRedstoneActive, 1, GregTech_API.ITEM_WILDCARD_DAMAGE));
GT_OreDictUnificator.registerOre("craftingRedstoneTorch" , new ItemStack(Blocks.unlit_redstone_torch, 1, GregTech_API.ITEM_WILDCARD_DAMAGE));
GT_OreDictUnificator.registerOre("craftingRedstoneTorch" , new ItemStack(Blocks.redstone_torch, 1, GregTech_API.ITEM_WILDCARD_DAMAGE));
GT_OreDictUnificator.registerOre("craftingCircuitTier00" , new ItemStack(Block.torchRedstoneIdle, 1, GregTech_API.ITEM_WILDCARD_DAMAGE));
GT_OreDictUnificator.registerOre("craftingCircuitTier00" , new ItemStack(Block.torchRedstoneActive, 1, GregTech_API.ITEM_WILDCARD_DAMAGE));
GT_OreDictUnificator.registerOre("craftingCircuitTier00" , new ItemStack(Block.lever, 1, GregTech_API.ITEM_WILDCARD_DAMAGE));
GT_OreDictUnificator.registerOre("craftingCircuitTier00" , new ItemStack(Blocks.unlit_redstone_torch, 1, GregTech_API.ITEM_WILDCARD_DAMAGE));
GT_OreDictUnificator.registerOre("craftingCircuitTier00" , new ItemStack(Blocks.redstone_torch, 1, GregTech_API.ITEM_WILDCARD_DAMAGE));
GT_OreDictUnificator.registerOre("craftingCircuitTier00" , new ItemStack(Blocks.lever, 1, GregTech_API.ITEM_WILDCARD_DAMAGE));
GT_OreDictUnificator.registerOre("craftingCircuitTier03" , new ItemStack(GregTech_API.sBlockList[1], 1,69));
@ -64,19 +64,19 @@ public class GT_DictRegistratorPostItem implements Runnable {
GT_OreDictUnificator.registerOre("craftingCircuitTier04" , GT_ModHandler.getIC2Item("advancedCircuit", 1));
GT_OreDictUnificator.registerOre("craftingCircuitTier10" , new ItemStack(GregTech_API.sBlockList[1], 1, 4));
GT_OreDictUnificator.registerOre("craftingWorkBench" , new ItemStack(Block.workbench, 1));
GT_OreDictUnificator.registerOre("craftingWorkBench" , new ItemStack(Blocks.crafting_table, 1));
GT_OreDictUnificator.registerOre("craftingWorkBench" , new ItemStack(GregTech_API.sBlockList[1], 1, 16));
GT_OreDictUnificator.registerOre("craftingPiston" , new ItemStack(Block.pistonBase, 1, GregTech_API.ITEM_WILDCARD_DAMAGE));
GT_OreDictUnificator.registerOre("craftingPiston" , new ItemStack(Block.pistonStickyBase, 1, GregTech_API.ITEM_WILDCARD_DAMAGE));
GT_OreDictUnificator.registerOre("craftingPiston" , new ItemStack(Blocks.piston, 1, GregTech_API.ITEM_WILDCARD_DAMAGE));
GT_OreDictUnificator.registerOre("craftingPiston" , new ItemStack(Blocks.sticky_piston, 1, GregTech_API.ITEM_WILDCARD_DAMAGE));
GT_OreDictUnificator.registerOre("craftingChest" , new ItemStack(GregTech_API.sBlockList[1], 1, 45));
GT_OreDictUnificator.registerOre("craftingChest" , new ItemStack(Block.chest, 1, GregTech_API.ITEM_WILDCARD_DAMAGE));
GT_OreDictUnificator.registerOre("craftingChest" , new ItemStack(Block.chestTrapped, 1, GregTech_API.ITEM_WILDCARD_DAMAGE));
GT_OreDictUnificator.registerOre("craftingChest" , new ItemStack(Blocks.chest, 1, GregTech_API.ITEM_WILDCARD_DAMAGE));
GT_OreDictUnificator.registerOre("craftingChest" , new ItemStack(Blocks.trapped_chest, 1, GregTech_API.ITEM_WILDCARD_DAMAGE));
GT_OreDictUnificator.registerOre("craftingChest" , GT_ModHandler.getIC2Item("personalSafe", 1));
GT_OreDictUnificator.registerOre("craftingFurnace" , new ItemStack(Block.furnaceIdle, 1, GregTech_API.ITEM_WILDCARD_DAMAGE));
GT_OreDictUnificator.registerOre("craftingFurnace" , new ItemStack(Block.furnaceBurning, 1, GregTech_API.ITEM_WILDCARD_DAMAGE));
GT_OreDictUnificator.registerOre("craftingFurnace" , new ItemStack(Blocks.furnace, 1, GregTech_API.ITEM_WILDCARD_DAMAGE));
GT_OreDictUnificator.registerOre("craftingFurnace" , new ItemStack(Blocks.lit_furnace, 1, GregTech_API.ITEM_WILDCARD_DAMAGE));
GT_OreDictUnificator.registerOre("craftingPump" , GT_ModHandler.getIC2Item("pump", 1));
GT_OreDictUnificator.registerOre("craftingElectromagnet" , GT_ModHandler.getIC2Item("magnetizer", 1));
@ -115,15 +115,15 @@ public class GT_DictRegistratorPostItem implements Runnable {
GT_OreDictUnificator.registerOre("molecule_1n" , GregTech_API.getGregTechItem(91, 1, GregTech_API.ITEM_WILDCARD_DAMAGE));
GT_OreDictUnificator.registerOre("paperEmpty" , new ItemStack(Item.paper, 1));
GT_OreDictUnificator.registerOre("paperMap" , new ItemStack(Item.emptyMap, 1));
GT_OreDictUnificator.registerOre("paperMap" , new ItemStack(Item.map, 1));
GT_OreDictUnificator.registerOre("bookEmpty" , new ItemStack(Item.book, 1));
GT_OreDictUnificator.registerOre("bookWritable" , new ItemStack(Item.writableBook, 1));
GT_OreDictUnificator.registerOre("bookWritten" , new ItemStack(Item.writtenBook, 1));
GT_OreDictUnificator.registerOre("bookEnchanted" , new ItemStack(Item.enchantedBook, 1));
GT_OreDictUnificator.registerOre("paperEmpty" , new ItemStack(Items.paper, 1));
GT_OreDictUnificator.registerOre("paperMap" , new ItemStack(Items.map, 1));
GT_OreDictUnificator.registerOre("paperMap" , new ItemStack(Items.map, 1));
GT_OreDictUnificator.registerOre("bookEmpty" , new ItemStack(Items.book, 1));
GT_OreDictUnificator.registerOre("bookWritable" , new ItemStack(Items.writable_book, 1));
GT_OreDictUnificator.registerOre("bookWritten" , new ItemStack(Items.written_book, 1));
GT_OreDictUnificator.registerOre("bookEnchanted" , new ItemStack(Items.enchanted_book, 1));
GT_Log.out.println("GT_Mod: Register colors to the OreDict.");
GT_Log.log.info("GT_Mod: Register colors to the OreDict.");
GT_OreDictUnificator.registerOre("dyeCyan" , GT_MetaItem_Dust.instance.getUnunifiedStack(2, 1));
GT_OreDictUnificator.registerOre("dyeBlue" , GT_MetaItem_Dust.instance.getUnunifiedStack(5, 1));
}

View file

@ -1,5 +1,6 @@
package gregtechmod.loaders.load;
import cpw.mods.fml.common.registry.GameRegistry;
import gregtechmod.GT_Mod;
import gregtechmod.api.GregTech_API;
import gregtechmod.api.enums.Materials;
@ -47,7 +48,9 @@ import gregtechmod.common.items.GT_Vanilla_Pickaxe;
import gregtechmod.common.items.GT_Vanilla_Shovel;
import gregtechmod.common.items.GT_Vanilla_Sword;
import net.minecraft.block.material.Material;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
public class GT_ItemLoader implements Runnable {
@Override
@ -613,13 +616,21 @@ public class GT_ItemLoader implements Runnable {
GregTech_API.sItemList[137] = new GT_Vanilla_Axe (GT_LanguageManager.mNameListItem[137], "TungstenSteel" , 4, 5, 5120 , 12.0F, 3.0F);
GregTech_API.sItemList[138] = new GT_Vanilla_Hoe (GT_LanguageManager.mNameListItem[138], "TungstenSteel" , 4, 5, 5120 , 12.0F, 3.0F);
GT_Log.log.info("GT_Mod: Register items");
for (Item item : GregTech_API.sItemList) {
if (item != null) {
GameRegistry.registerItem(item, item.getUnlocalizedName());
}
}
GT_Log.log.info("GT_Mod: Hiding certain Items from NEI.");
try {
Class.forName("codechicken.nei.api.API");
codechicken.nei.api.API.hideItem(new ItemStack(GregTech_API.sBlockList[3]));
codechicken.nei.api.API.hideItem(new ItemStack(GregTech_API.sItemList[ 4]));
codechicken.nei.api.API.hideItem(new ItemStack(GregTech_API.sItemList[ 7]));
codechicken.nei.api.API.hideItem(new ItemStack(GregTech_API.sItemList[15]));
codechicken.nei.api.API.hideItem(new ItemStack(GregTech_API.sItemList[ 4], 1, OreDictionary.WILDCARD_VALUE));
codechicken.nei.api.API.hideItem(new ItemStack(GregTech_API.sItemList[ 7], 1, OreDictionary.WILDCARD_VALUE));
codechicken.nei.api.API.hideItem(new ItemStack(GregTech_API.sItemList[15], 1, OreDictionary.WILDCARD_VALUE));
codechicken.nei.api.API.hideItem(new ItemStack(GregTech_API.sItemList[16]));
codechicken.nei.api.API.hideItem(GT_ModHandler.getIC2Item("wrench", 1));
codechicken.nei.api.API.hideItem(GT_ModHandler.getIC2Item("electricWrench", 1));

View file

@ -12,7 +12,7 @@ import gregtechmod.common.tileentities.*;
public class GT_MetaTileEntityLoader implements Runnable {
@Override
public void run() {
GT_Log.out.println("GT_Mod: Register MetaTileEntities.");
GT_Log.log.info("GT_Mod: Register MetaTileEntities.");
new GT_MetaTileEntity_ElectricAutoWorkbench ( 16, "GT_E_Craftingtable" , "Electric Craftingtable");
new GT_MetaTileEntity_Translocator ( 17, "GT_Translocator" , "Electric Translocator");
new GT_MetaTileEntity_ElectricBufferSmall ( 18, "GT_E_Buffer_Small" , "Small Electric Buffer");