Configurable components & fixes

This commit is contained in:
Muramasa 2016-08-31 02:22:51 +01:00
parent c66db54eab
commit 415e683a43
13 changed files with 865 additions and 679 deletions

View file

@ -39,10 +39,8 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.WeightedRandomChestContent;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.ChestGenHooks;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry;
@ -261,7 +259,10 @@ public class GT_Mod
}
//GT_Config.troll = (Calendar.getInstance().get(2) + 1 == 4) && (Calendar.getInstance().get(5) >= 1) && (Calendar.getInstance().get(5) <= 2);
new GT_Loader_MaterialProcessing().run();
long startTime = System.nanoTime();
Materials.init();
long stopTime = System.nanoTime();
System.out.println("##### Mats Init: " + (stopTime - startTime));
GT_Log.out.println("GT_Mod: Saving Main Config");
tMainConfig.save();
@ -757,7 +758,7 @@ public class GT_Mod
}
}
GT_Log.out.println("GT_Mod: Dungeon Loot");
for (WeightedRandomChestContent tContent : ChestGenHooks.getInfo("dungeonChest").getItems(new Random())) {
/*for (WeightedRandomChestContent tContent : ChestGenHooks.getInfo("dungeonChest").getItems(new Random())) {
tStacks.add(tContent.theItemId);
}
for (WeightedRandomChestContent tContent : ChestGenHooks.getInfo("bonusChest").getItems(new Random())) {
@ -786,7 +787,7 @@ public class GT_Mod
}
for (WeightedRandomChestContent tContent : ChestGenHooks.getInfo("mineshaftCorridor").getItems(new Random())) {
tStacks.add(tContent.theItemId);
}
}*/
GT_Log.out.println("GT_Mod: Smelting");
Object tStack;
for (Iterator i$ = FurnaceRecipes.smelting().getSmeltingList().values().iterator(); i$.hasNext(); tStacks.add((ItemStack) tStack)) {

File diff suppressed because it is too large Load diff

View file

@ -1,7 +0,0 @@
package gregtech.api.interfaces;
import gregtech.api.enums.Materials;
public interface IComponentRegistrator {
void registerComponents(Materials aMaterial);
}

View file

@ -1,5 +1,9 @@
package gregtech.api.interfaces;
import gregtech.api.enums.Materials;
public interface IMaterialRegistrator {
void onMaterialsInit();
void onComponentRegistration(Materials aMaterial);
}

View file

@ -142,12 +142,17 @@ public abstract class GT_MetaGenerated_Item_X32 extends GT_MetaGenerated_Item {
@Override
@SideOnly(Side.CLIENT)
public final void getSubItems(Item var1, CreativeTabs aCreativeTab, List aList) {
for (int i = 0; i < 32000; i++)
if (doesMaterialAllowGeneration(mGeneratedPrefixList[i / 1000], GregTech_API.sGeneratedMaterials[i % 1000]) && doesShowInCreative(mGeneratedPrefixList[i / 1000], GregTech_API.sGeneratedMaterials[i % 1000], GregTech_API.sDoShowAllItemsInCreative)) {
for (int i = 0; i < 32000; i++) {
OrePrefixes aPrefix = mGeneratedPrefixList[i / 1000];
Materials aMaterial = GregTech_API.sGeneratedMaterials[i % 1000];
if (aPrefix != null && aMaterial != null) {
if (aMaterial.mComponents.contains(aPrefix) && doesMaterialAllowGeneration(aPrefix, aMaterial) && doesShowInCreative(aPrefix, aMaterial, GregTech_API.sDoShowAllItemsInCreative)) {
ItemStack tStack = new ItemStack(this, 1, i);
isItemStackUsable(tStack);
aList.add(tStack);
}
}
}
super.getSubItems(var1, aCreativeTab, aList);
}

View file

@ -14,7 +14,6 @@ import gregtech.api.objects.MaterialStack;
import gregtech.api.util.*;
import gregtech.common.covers.*;
import gregtech.common.items.behaviors.*;
import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_FusionComputer;
import net.minecraft.block.Block;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.item.EntityItem;
@ -25,7 +24,6 @@ import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.util.MathHelper;
import net.minecraftforge.fluids.FluidStack;
import java.util.Collection;
import java.util.List;
@ -862,6 +860,6 @@ public class GT_MetaGenerated_Item_01
}
public boolean doesMaterialAllowGeneration(OrePrefixes aPrefix, Materials aMaterial) {
return (super.doesMaterialAllowGeneration(aPrefix, aMaterial)) && ((aPrefix != OrePrefixes.ingotHot) || (aMaterial.mBlastFurnaceTemp > 1750));
return (super.doesMaterialAllowGeneration(aPrefix, aMaterial));
}
}

View file

@ -1,14 +0,0 @@
package gregtech.loaders.materialprocessing;
import gregtech.api.enums.Materials;
public class ProcessingComponents implements gregtech.api.interfaces.IComponentRegistrator {
public ProcessingComponents() {
Materials.add(this);
}
@Override
public void registerComponents(Materials aMaterial) {
//Disable components by default
}
}

View file

@ -15,7 +15,12 @@ public class ProcessingConfig implements gregtech.api.interfaces.IMaterialRegist
int i = 0;
for (int j = GregTech_API.sMaterialProperties.get("general", "AmountOfCustomMaterialSlots", 16); i < j; i++) {
String aID = (i < 10 ? "0" : "") + i;
new Materials(-1, TextureSet.SET_METALLIC, 1.0F, 0, 0, 0, 255, 255, 255, 0, "CustomMat" + aID, 0, 0, 0, 0, false, false, 1, 1, 1, Dyes._NULL, "custom", true, aID);
new Materials(-1, TextureSet.SET_METALLIC, 1.0F, 0, 0, 0, 255, 255, 255, 0, "CustomMat" + aID, "CustomMat" + aID, 0, 0, 0, 0, false, false, 1, 1, 1, Dyes._NULL, "custom", true, aID);
}
}
@Override
public void onComponentRegistration(Materials aMaterial) {
//NOOP
}
}

View file

@ -216,7 +216,6 @@ public class GT_Achievements {
if (!GT_Mod.gregtechproxy.mAchievements) {
return null;
}
;
Achievement achievement = new Achievement(textId, textId, this.adjX + x, this.adjY + y, icon, requirement);
if (special) {
achievement.setSpecial();

View file

@ -109,7 +109,7 @@ public class ProcessingDust implements gregtech.api.interfaces.IOreRecipeRegistr
}
switch (aMaterial.mName) {
case "_NULL":
case "NULL":
break;
case "Glass":
GT_ModHandler.addSmeltingRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), new ItemStack(net.minecraft.init.Blocks.glass));

View file

@ -41,7 +41,7 @@ public class ProcessingGem implements gregtech.api.interfaces.IOreRecipeRegistra
gregtech.api.util.GT_RecipeRegistrator.registerUsagesForMaterials(GT_Utility.copyAmount(1L, new Object[]{aStack}), OrePrefixes.plate.get(aMaterial).toString(), !aMaterial.contains(SubTag.NO_SMASHING));
switch (aMaterial.mName) {
case "_NULL":
case "NULL":
break;
case "Coal":
case "Charcoal":

View file

@ -22,7 +22,7 @@ public class ProcessingStone
public void registerOre(OrePrefixes aPrefix, Materials aMaterial, String aOreDictName, String aModName, ItemStack aStack) {
Block aBlock = GT_Utility.getBlockFromStack(aStack);
switch (aMaterial.mName) {
case "_NULL":
case "NULL":
GT_Values.RA.addAssemblerRecipe(GT_Utility.copyAmount(3L, new Object[]{aStack}), new ItemStack(Blocks.redstone_torch, 2), Materials.Redstone.getMolten(144L), new ItemStack(Items.repeater, 1), 100, 4);
break;
case "Sand":

View file

@ -1,13 +1,11 @@
package gregtech.loaders.preload;
import gregtech.api.util.GT_Log;
import gregtech.loaders.materialprocessing.ProcessingComponents;
import gregtech.loaders.materialprocessing.ProcessingConfig;
public class GT_Loader_MaterialProcessing implements Runnable {
public void run() {
GT_Log.out.println("GT_Mod: Register Material processing.");
new ProcessingConfig();
new ProcessingComponents();
}
}