Misc bugfixes

Fixed OreDict, closes #14, #17
This commit is contained in:
TheDarkDnKTv 2020-08-16 20:34:34 +03:00
parent 1dbdafa782
commit 51d5f85a73
4 changed files with 56 additions and 24 deletions

View file

@ -461,8 +461,8 @@ public class GT_Mod implements IGT_Mod {
GameRegistry.registerBlock(GregTech_API.sBlockList[0] = new GT_BlockMetaID_Block (), GT_MetaBlock_Item.class , GregTech_API.sBlockList[0].getUnlocalizedName());
GameRegistry.registerBlock(GregTech_API.sBlockList[1] = new GT_BlockMetaID_Machine(), GT_MetaMachine_Item.class , GregTech_API.sBlockList[1].getUnlocalizedName());
GameRegistry.registerBlock(GregTech_API.sBlockList[2] = new GT_BlockMetaID_Ore (), GT_MetaOre_Item.class , GregTech_API.sBlockList[2].getUnlocalizedName());
GameRegistry.registerBlock(GregTech_API.sBlockList[3] = new GT_BlockMetaID_Block2 (), GT_MetaBlock2_Item.class , GregTech_API.sBlockList[3].getUnlocalizedName());
GameRegistry.registerBlock(GregTech_API.sBlockList[4] = new GT_Block_LightSource (), ItemBlock.class , GregTech_API.sBlockList[4].getUnlocalizedName());
GameRegistry.registerBlock(GregTech_API.sBlockList[3] = new GT_Block_LightSource (), ItemBlock.class , GregTech_API.sBlockList[3].getUnlocalizedName());
GameRegistry.registerBlock(GregTech_API.sBlockList[4] = new GT_BlockMetaID_Block2 (), GT_MetaBlock2_Item.class , GregTech_API.sBlockList[4].getUnlocalizedName());
GameRegistry.registerBlock(GregTech_API.sBlockList[5] = new GT_BlockMetaID_Stone1 (), GT_MetaStone1_Item.class , GregTech_API.sBlockList[5].getUnlocalizedName());
GregTech_API.registerMachineBlock(GregTech_API.sBlockList[0], new boolean[]{true, true, false, false, false, false, true, false, false, false, true, false, false, true, true, true});

View file

@ -8,7 +8,9 @@ import gregtechmod.api.util.GT_Utility;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import com.google.common.collect.ImmutableMap;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
@ -554,6 +556,8 @@ public enum Materials {
@Deprecated Wolframium (Tungsten, false),
@Deprecated Wolfram (Tungsten, false),
@Deprecated WrougtIron (WroughtIron, false);
public static final Map<String, Materials> exceptions;
static {
Thorium .add(SubTag.ENCHANTMENT_GLOW);
@ -829,12 +833,37 @@ public enum Materials {
FoolsRuby.mChemicalFormula = Ruby.mChemicalFormula;
Naquadah.mChemicalFormula = "Nq";
ImmutableMap.Builder<String, Materials> builder = new ImmutableMap.Builder<>();
builder.put("Brick" , Clay );
builder.put("BrickNether" , NetherBrick );
builder.put("GlassColorless" , SiliconDioxide);
builder.put("Glass" , SiliconDioxide);
builder.put("GlassBlack" , SiliconDioxide);
builder.put("GlassRed" , SiliconDioxide);
builder.put("GlassGreen" , SiliconDioxide);
builder.put("GlassBrown" , SiliconDioxide);
builder.put("GlassBlue" , SiliconDioxide);
builder.put("GlassPurple" , SiliconDioxide);
builder.put("GlassCyan" , SiliconDioxide);
builder.put("GlassLightGray" , SiliconDioxide);
builder.put("GlassGray" , SiliconDioxide);
builder.put("GlassPink" , SiliconDioxide);
builder.put("GlassLime" , SiliconDioxide);
builder.put("GlassYellow" , SiliconDioxide);
builder.put("GlassLightBlue" , SiliconDioxide);
builder.put("GlassMagenta" , SiliconDioxide);
builder.put("GlassOrange" , SiliconDioxide);
builder.put("GlassWhite" , SiliconDioxide);
exceptions = builder.build();
}
public static Materials get(String aMaterialName) {
Object tObject = GT_Utility.getFieldContent(Materials.class, aMaterialName, false, false);
if (tObject != null && tObject instanceof Materials) return (Materials)tObject;
return _NULL;
return exceptions.containsKey(aMaterialName) ? exceptions.get(aMaterialName) : _NULL;
}
public static Materials getRealMaterial(String aMaterialName) {
@ -847,7 +876,7 @@ public enum Materials {
if (tMaterial.mBlastFurnaceRequired) tMaterial.mBlastFurnaceRequired = aConfiguration.get(GT_ConfigCategories.Materials.blastfurnacerequirements, tString, true);
if (tMaterial.mAmplificationValue > 0) tMaterial.mAmplificationValue = aConfiguration.get(GT_ConfigCategories.Materials.UUM_MaterialCost, tString, tMaterial.mAmplificationValue);
if (tMaterial.mUUMEnergy > 0) tMaterial.mUUMEnergy = aConfiguration.get(GT_ConfigCategories.Materials.UUM_EnergyCost, tString, tMaterial.mUUMEnergy);
// if (tMaterial.mBlastFurnaceRequired && aConfiguration.get(GT_ConfigCategories.Materials.blastinductionsmelter, tString, tMaterial.mBlastFurnaceTemp < 1500)) GT_ModHandler.ThermalExpansion.addSmelterBlastOre(tMaterial); // TODO: recipe
// if (tMaterial.mBlastFurnaceRequired && aConfiguration.get(GT_ConfigCategories.Materials.blastinductionsmelter, tString, tMaterial.mBlastFurnaceTemp < 1500)) GT_ModHandler.ThermalExpansion.addSmelterBlastOre(tMaterial); // TODO: blast recipe
}
}

View file

@ -877,14 +877,14 @@ public class GT_BlockMetaID_Machine extends BlockContainer implements IDebugable
}
@Override
public TileEntity createNewTileEntity(World aWorld, int meta) { // TODO: there wasnt meta before
public TileEntity createNewTileEntity(World aWorld, int meta) {
return GregTech_API.constructBaseMetaTileEntity();
}
@Override
public TileEntity createTileEntity(World aWorld, int aMeta) {
switch(aMeta) {
case 0: return GregTech_API.constructBaseMetaTileEntity(); // TODO
case 0: return GregTech_API.constructBaseMetaTileEntity();
case 1: return new BaseMetaPipeEntity();
case 2: return new BaseMetaPipeEntity();
case 3: return new BaseMetaPipeEntity();

View file

@ -2,6 +2,7 @@ package gregtechmod.loaders.preload;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
@ -68,10 +69,10 @@ import net.minecraft.potion.Potion;
public class GT_ItemLoader implements Runnable {
@Override
public void run() {
GT_Log.log.info("GT_Mod: Register Armor Textures.");
GT_Log.log.info("Register Armor Textures.");
int tArmorID1 = GT_Mod.gregtechproxy.addArmor("lapotronpack"), tArmorID2 = GT_Mod.gregtechproxy.addArmor("lithiumbatpack"), tArmorID3 = GT_Mod.gregtechproxy.addArmor("cloakingdevice");
GT_Log.log.info("GT_Mod: Register Meta-ID Items.");
GT_Log.log.info("Register Meta-ID Items.");
GregTech_API.sItemList[ 0] = new GT_MetaItem_Material ("GT_Materials");
GregTech_API.sItemList[ 1] = new GT_MetaItem_Dust ("GT_Dusts");
GregTech_API.sItemList[ 2] = new GT_MetaItem_Cell ("GT_Cells");
@ -81,7 +82,7 @@ public class GT_ItemLoader implements Runnable {
GregTech_API.sItemList[ 6] = new GT_MetaItem_DirtyDust ("GT_DirtyDusts");
GregTech_API.sItemList[ 7] = new GT_MetaItem_TinyDust ("GT_TinyDusts");
GT_Log.log.info("GT_Mod: Adding All Sub-Items with their OreDict and LiquidDict Entries.");
GT_Log.log.info("Adding All Sub-Items with their OreDict and LiquidDict Entries.");
GT_Items.Credit_Copper.set( GT_MetaItem_Material.addItem( 0, "Copper Credit" , null, "0.125 Credits" , false)); // TODO: LOCALE
GT_Items.Credit_Silver.set( GT_MetaItem_Material.addItem( 1, "Silver Credit" , null, "8 Credits" , false));
GT_Items.Credit_Gold.set( GT_MetaItem_Material.addItem( 2, "Gold Credit" , null, "64 Credits" , false));
@ -635,11 +636,11 @@ public class GT_ItemLoader implements Runnable {
GT_Items.Circuit_Integrated.set((GregTech_API.sItemList[10] = new GT_IntegratedCircuit_Item("GregTech_Integrated_Circuit")));
GT_OreDictUnificator.addToBlacklist(GT_Items.Circuit_Integrated.getWildcard(1));
GT_Log.log.info("GT_Mod: Register Regular Items.");
GT_Items.Display_Fluid.set( (GregTech_API.sItemList[15] = new GT_FluidDisplayItem("GregTech_FluidDisplay")));
GT_Items.NC_SensorCard.set( (GregTech_API.sItemList[16] = (GT_Generic_Item) GT_Utility.callConstructor("gregtechmod.common.items.GT_SensorCard_Item", 0, (Object) null, false, "GregTech_Sensorcard")));
GT_Log.log.info("Register Regular Items.");
GT_Items.Display_Fluid.set((GregTech_API.sItemList[15] = new GT_FluidDisplayItem("GregTech_FluidDisplay")));
GT_Items.NC_SensorCard.set((GregTech_API.sItemList[16] = (GT_Generic_Item) GT_Utility.callConstructor("gregtechmod.common.items.GT_SensorCard_Item", 0, (Object) null, false, "GregTech_Sensorcard")));
if (GregTech_API.sItemList[16] == null) {
GT_Items.NC_SensorCard.set( (GregTech_API.sItemList[16] = new GT_Generic_Item("GregTech_Sensorcard", "Nuclear Control not installed")));
GT_Items.NC_SensorCard.set((GregTech_API.sItemList[16] = new GT_Generic_Item("GregTech_Sensorcard", "Nuclear Control not installed")));
}
GT_Items.NC_SensorKit.set((GregTech_API.sItemList[17] = new GT_SensorKit_Item("GregTech_Sensorkit")));
@ -786,7 +787,9 @@ public class GT_ItemLoader implements Runnable {
GT_Items.Tool_Hammer_Plastic.set((GregTech_API.sItemList[142] = new GT_SoftHammer_Item("GT_Hammer_Plastic", 1280, 5)));
GT_Log.log.info("GT_Mod: Register items");
GT_Log.log.info("Register items");
ArrayList<Item> gtItems = new ArrayList<>(Arrays.asList(GregTech_API.sItemList));
gtItems.removeIf(i -> i == null);
for (Item item : GregTech_API.sItemList) {
if (item != null) {
GameRegistry.registerItem(item, item.getUnlocalizedName());
@ -794,19 +797,19 @@ public class GT_ItemLoader implements Runnable {
}
GT_Log.log.info("GT_Mod: Hiding certain Items from NEI.");
GT_Log.log.info("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[5]));
codechicken.nei.api.API.hideItem(new ItemStack(GregTech_API.sItemList[6]));
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[16]));
codechicken.nei.api.API.hideItem(GT_ModHandler.getIC2Item("wrench", 1L));
codechicken.nei.api.API.hideItem(GT_ModHandler.getIC2Item("electricWrench", 1L));
codechicken.nei.api.API.hideItem(GT_ModHandler.getIC2Item("chainsaw", 1L));
codechicken.nei.api.API.hideItem(new ItemStack(GregTech_API.sItemList[ 4], 1, GregTech_API.ITEM_WILDCARD_DAMAGE));
codechicken.nei.api.API.hideItem(new ItemStack(GregTech_API.sItemList[ 5], 1, GregTech_API.ITEM_WILDCARD_DAMAGE));
codechicken.nei.api.API.hideItem(new ItemStack(GregTech_API.sItemList[ 6], 1, GregTech_API.ITEM_WILDCARD_DAMAGE));
codechicken.nei.api.API.hideItem(new ItemStack(GregTech_API.sItemList[ 7], 1, GregTech_API.ITEM_WILDCARD_DAMAGE));
codechicken.nei.api.API.hideItem(new ItemStack(GregTech_API.sItemList[15], 1, GregTech_API.ITEM_WILDCARD_DAMAGE));
codechicken.nei.api.API.hideItem(new ItemStack(GregTech_API.sItemList[16], 1, GregTech_API.ITEM_WILDCARD_DAMAGE));
codechicken.nei.api.API.hideItem(GT_ModHandler.getIC2Item("wrench", 1));
codechicken.nei.api.API.hideItem(GT_ModHandler.getIC2Item("electricWrench", 1));
codechicken.nei.api.API.hideItem(GT_ModHandler.getIC2Item("chainsaw", 1));
} catch (Throwable e) {
if (GregTech_API.DEBUG_MODE) {
GT_Log.log.catching(e);