aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com>2020-01-07 15:49:37 +0100
committerbartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com>2020-01-07 15:49:37 +0100
commit22ac800273f3774331ca4e817d89233d18819000 (patch)
treea77b8c9258697fd49159a41f596b14f3a5dae740 /src
parent501134f1e1457fb3b5762f12471e1c930ee1fa94 (diff)
downloadGT5-Unofficial-22ac800273f3774331ca4e817d89233d18819000.tar.gz
GT5-Unofficial-22ac800273f3774331ca4e817d89233d18819000.tar.bz2
GT5-Unofficial-22ac800273f3774331ca4e817d89233d18819000.zip
Fixes:
+ Ores not beeing detected by Miners + CircuitImprints not craftable/recipe buildup when server changes Refractored some code Signed-off-by: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Former-commit-id: 2f2d7b4977334c7faba8185ecb76229c57b939a3
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java144
-rw-r--r--src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGeneratedBlock_Item.java3
-rw-r--r--src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Blocks.java8
-rw-r--r--src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Ores.java5
-rw-r--r--src/main/java/com/github/bartimaeusnek/bartworks/system/material/CircuitGeneration/CircuitImprintLoader.java294
-rw-r--r--src/main/java/com/github/bartimaeusnek/bartworks/system/material/WerkstoffLoader.java98
-rw-r--r--src/main/java/com/github/bartimaeusnek/bartworks/util/NEIbartworksConfig.java3
7 files changed, 305 insertions, 250 deletions
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java b/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java
index cf0c828cc5..f1ad6e2b2a 100644
--- a/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java
+++ b/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java
@@ -120,9 +120,9 @@ public final class MainMod {
if (Loader.isModLoaded("miscutils") && ConfigHandler.GTppLogDisabler) {
try {
- Field loggerField = FieldUtils.getField(Class.forName("gtPlusPlus.api.objects.Logger"),"modLogger",true);
- FieldUtils.removeFinalModifier(loggerField,true);
- loggerField.set(null,(Logger)new STFUGTPPLOG());
+ Field loggerField = FieldUtils.getField(Class.forName("gtPlusPlus.api.objects.Logger"), "modLogger", true);
+ FieldUtils.removeFinalModifier(loggerField, true);
+ loggerField.set(null, (Logger) new STFUGTPPLOG());
} catch (IllegalAccessException | ClassNotFoundException e) {
e.printStackTrace();
}
@@ -180,8 +180,8 @@ public final class MainMod {
NetworkRegistry.INSTANCE.registerGuiHandler(MainMod.instance, MainMod.GH);
if (ConfigHandler.BioLab) {
new GTNHBlocks().run();
- for (Map.Entry<BioVatLogicAdder.BlockMetaPair, Byte>pair : BioVatLogicAdder.BioVatGlass.getGlassMap().entrySet()){
- GT_OreDictUnificator.registerOre("blockGlass"+VN[pair.getValue()],new ItemStack(pair.getKey().getBlock(),1,pair.getKey().getaByte()));
+ for (Map.Entry<BioVatLogicAdder.BlockMetaPair, Byte> pair : BioVatLogicAdder.BioVatGlass.getGlassMap().entrySet()) {
+ GT_OreDictUnificator.registerOre("blockGlass" + VN[pair.getValue()], new ItemStack(pair.getKey().getBlock(), 1, pair.getKey().getaByte()));
}
}
@@ -191,18 +191,18 @@ public final class MainMod {
new ThreadedLoader().run();
else
INSTANCE.run();
- GT_LanguageManager.addStringLocalization("achievement.gt.blockmachines.electricimplosioncompressor","Electric Implosions?");
- GT_LanguageManager.addStringLocalization("achievement.gt.blockmachines.electricimplosioncompressor.desc","Basically a giant Hammer that presses Stuff - No more TNT!");
- GT_LanguageManager.addStringLocalization("achievement.gt.blockmachines.dehp","Heat from below!");
- GT_LanguageManager.addStringLocalization("achievement.gt.blockmachines.dehp.desc","Get ALL the thermal energy!");
- GT_LanguageManager.addStringLocalization("achievement.gt.blockmachines.circuitassemblyline","Cheaper Circuits?");
- GT_LanguageManager.addStringLocalization("achievement.gt.blockmachines.circuitassemblyline.desc","Well, yes, but actually no...");
- GT_LanguageManager.addStringLocalization("metaitem.01.tooltip.nqgen","Can be used as Enriched Naquadah Fuel Substitute");
+ GT_LanguageManager.addStringLocalization("achievement.gt.blockmachines.electricimplosioncompressor", "Electric Implosions?");
+ GT_LanguageManager.addStringLocalization("achievement.gt.blockmachines.electricimplosioncompressor.desc", "Basically a giant Hammer that presses Stuff - No more TNT!");
+ GT_LanguageManager.addStringLocalization("achievement.gt.blockmachines.dehp", "Heat from below!");
+ GT_LanguageManager.addStringLocalization("achievement.gt.blockmachines.dehp.desc", "Get ALL the thermal energy!");
+ GT_LanguageManager.addStringLocalization("achievement.gt.blockmachines.circuitassemblyline", "Cheaper Circuits?");
+ GT_LanguageManager.addStringLocalization("achievement.gt.blockmachines.circuitassemblyline.desc", "Well, yes, but actually no...");
+ GT_LanguageManager.addStringLocalization("metaitem.01.tooltip.nqgen", "Can be used as Enriched Naquadah Fuel Substitute");
}
}
@Mod.EventHandler
- public void onServerStarting(FMLServerStartingEvent event){
+ public void onServerStarting(FMLServerStartingEvent event) {
event.registerServerCommand(new SummonRuin());
event.registerServerCommand(new ChangeConfig());
event.registerServerCommand(new PrintRecipeListToFile());
@@ -212,6 +212,7 @@ public final class MainMod {
public void onServerStarted(FMLServerStartedEvent event) {
MainMod.runOnPlayerJoined(ConfigHandler.classicMode, ConfigHandler.disableExtraGassesForEBF);
}
+
@Mod.EventHandler
public void onModLoadingComplete(FMLLoadCompleteEvent event) {
removeIC2Recipes();
@@ -227,7 +228,6 @@ public final class MainMod {
public static void runOnPlayerJoined(boolean classicMode, boolean extraGasRecipes) {
OreDictHandler.adaptCacheForWorld();
-
CircuitImprintLoader.run();
if (!recipesAdded) {
@@ -246,12 +246,12 @@ public final class MainMod {
private static void fixEnergyRequirements() {
maploop:
- for (GT_Recipe.GT_Recipe_Map map : GT_Recipe.GT_Recipe_Map.sMappings){
- for (GT_Recipe recipe : map.mRecipeList){
+ for (GT_Recipe.GT_Recipe_Map map : GT_Recipe.GT_Recipe_Map.sMappings) {
+ for (GT_Recipe recipe : map.mRecipeList) {
if (recipe.mFakeRecipe)
continue maploop;
- for (int i = 0; i < (VN.length-1); i++) {
- if (recipe.mEUt == BW_Util.getTierVoltage(i)){
+ for (int i = 0; i < (VN.length - 1); i++) {
+ if (recipe.mEUt == BW_Util.getTierVoltage(i)) {
recipe.mEUt = BW_Util.getMachineVoltageFromTier(i);
}
}
@@ -293,61 +293,61 @@ public final class MainMod {
MainMod.runMoltenUnificationEnfocement(werkstoff);
MainMod.runUnficationDeleter(werkstoff);
for (String s : oreDictNames)
- for (OrePrefixes prefixes : OrePrefixes.values()) {
- if (OreDictionary.getOres(prefixes + s).size() > 1) {
- for (int j = 0; j < OreDictionary.getOres(prefixes + s).size(); j++) {
- ItemStack toReplace = OreDictionary.getOres(prefixes + s).get(j);
- ItemStack replacement = werkstoff.get(prefixes);
- if (GT_Utility.areStacksEqual(toReplace,replacement) || replacement == null || replacement.getItem() == null)
- continue;
- if (toReplace != null) {
- for (GT_Recipe.GT_Recipe_Map map : GT_Recipe.GT_Recipe_Map.sMappings) {
- HashSet<GT_Recipe> toRem = new HashSet<>();
- for (GT_Recipe recipe : map.mRecipeList) {
- boolean removal = map.equals(GT_Recipe.GT_Recipe_Map.sFluidExtractionRecipes) || map.equals(GT_Recipe.GT_Recipe_Map.sFluidSolidficationRecipes);
- for (int i = 0; i < recipe.mInputs.length; i++) {
- if (GT_Utility.areStacksEqual(recipe.mInputs[i], toReplace)) {
- if (removal)
- toRem.add(recipe);
- else {
- int amount = recipe.mInputs[i].stackSize;
- recipe.mInputs[i] = replacement.splitStack(amount);
+ for (OrePrefixes prefixes : OrePrefixes.values()) {
+ if (OreDictionary.getOres(prefixes + s).size() > 1) {
+ for (int j = 0; j < OreDictionary.getOres(prefixes + s).size(); j++) {
+ ItemStack toReplace = OreDictionary.getOres(prefixes + s).get(j);
+ ItemStack replacement = werkstoff.get(prefixes);
+ if (GT_Utility.areStacksEqual(toReplace, replacement) || replacement == null || replacement.getItem() == null)
+ continue;
+ if (toReplace != null) {
+ for (GT_Recipe.GT_Recipe_Map map : GT_Recipe.GT_Recipe_Map.sMappings) {
+ HashSet<GT_Recipe> toRem = new HashSet<>();
+ for (GT_Recipe recipe : map.mRecipeList) {
+ boolean removal = map.equals(GT_Recipe.GT_Recipe_Map.sFluidExtractionRecipes) || map.equals(GT_Recipe.GT_Recipe_Map.sFluidSolidficationRecipes);
+ for (int i = 0; i < recipe.mInputs.length; i++) {
+ if (GT_Utility.areStacksEqual(recipe.mInputs[i], toReplace)) {
+ if (removal)
+ toRem.add(recipe);
+ else {
+ int amount = recipe.mInputs[i].stackSize;
+ recipe.mInputs[i] = replacement.splitStack(amount);
+ }
}
}
- }
- for (int i = 0; i < recipe.mOutputs.length; i++) {
- if (GT_Utility.areStacksEqual(recipe.mOutputs[i], toReplace)) {
- if (removal)
- toRem.add(recipe);
- else {
- int amount = recipe.mOutputs[i].stackSize;
- recipe.mOutputs[i] = replacement.splitStack(amount);
+ for (int i = 0; i < recipe.mOutputs.length; i++) {
+ if (GT_Utility.areStacksEqual(recipe.mOutputs[i], toReplace)) {
+ if (removal)
+ toRem.add(recipe);
+ else {
+ int amount = recipe.mOutputs[i].stackSize;
+ recipe.mOutputs[i] = replacement.splitStack(amount);
+ }
}
}
- }
- if (recipe.mSpecialItems instanceof ItemStack) {
- if (GT_Utility.areStacksEqual((ItemStack) recipe.mSpecialItems, toReplace)) {
- if (removal)
- toRem.add(recipe);
- else {
- int amount = ((ItemStack) recipe.mSpecialItems).stackSize;
- recipe.mSpecialItems = replacement.splitStack(amount);
+ if (recipe.mSpecialItems instanceof ItemStack) {
+ if (GT_Utility.areStacksEqual((ItemStack) recipe.mSpecialItems, toReplace)) {
+ if (removal)
+ toRem.add(recipe);
+ else {
+ int amount = ((ItemStack) recipe.mSpecialItems).stackSize;
+ recipe.mSpecialItems = replacement.splitStack(amount);
+ }
}
}
}
+ map.mRecipeList.removeAll(toRem);
}
- map.mRecipeList.removeAll(toRem);
}
}
}
}
- }
}
}
}
@SuppressWarnings("ALL")
- private static void runMoltenUnificationEnfocement(Werkstoff werkstoff){
+ private static void runMoltenUnificationEnfocement(Werkstoff werkstoff) {
if (werkstoff.getGenerationFeatures().enforceUnification && werkstoff.getGenerationFeatures().hasMolten()) {
try {
FluidContainerRegistry.FluidContainerData data = new FluidContainerRegistry.FluidContainerData(new FluidStack(Objects.requireNonNull(molten.get(werkstoff)), 144), werkstoff.get(cellMolten), Materials.Empty.getCells(1));
@@ -415,26 +415,26 @@ public final class MainMod {
for (OrePrefixes prefixes : OrePrefixes.values())
if ((werkstoff.getGenerationFeatures().toGenerate & Werkstoff.GenerationFeatures.prefixLogic.get(prefixes)) != 0 && ((werkstoff.getGenerationFeatures().blacklist & Werkstoff.GenerationFeatures.prefixLogic.get(prefixes)) == 0)) {
- GT_OreDictUnificator.set(prefixes,werkstoff.getBridgeMaterial(),werkstoff.get(prefixes),true,true);
+ GT_OreDictUnificator.set(prefixes, werkstoff.getBridgeMaterial(), werkstoff.get(prefixes), true, true);
for (ItemStack stack : OreDictionary.getOres(prefixes + werkstoff.getVarName())) {
- GT_OreDictUnificator.addAssociation(prefixes,werkstoff.getBridgeMaterial(),stack,false);
+ GT_OreDictUnificator.addAssociation(prefixes, werkstoff.getBridgeMaterial(), stack, false);
GT_OreDictUnificator.getAssociation(stack).mUnificationTarget = werkstoff.get(prefixes);
}
}
}
- private static ArrayListMultimap<SubTag,GT_Recipe> getRecipesToChange(SubTag... GasTags){
+ private static ArrayListMultimap<SubTag, GT_Recipe> getRecipesToChange(SubTag... GasTags) {
Iterator<GT_Recipe> it = GT_Recipe.GT_Recipe_Map.sBlastRecipes.mRecipeList.iterator();
- ArrayListMultimap<SubTag,GT_Recipe> toAdd = ArrayListMultimap.create();
+ ArrayListMultimap<SubTag, GT_Recipe> toAdd = ArrayListMultimap.create();
while (it.hasNext()) {
GT_Recipe recipe = it.next();
if (recipe.mFluidInputs != null && recipe.mFluidInputs.length > 0) {
String FluidString = recipe.mFluidInputs[0].getFluid().getName().replaceAll("molten", "").replaceAll("fluid", "");
Materials mat = Materials.get(FluidString.substring(0, 1).toUpperCase() + FluidString.substring(1));
if (mat != Materials._NULL) {
- for (SubTag tag : GasTags){
+ for (SubTag tag : GasTags) {
if (mat.contains(tag)) {
- DebugLog.log("Found EBF Recipe to change, Output:"+ BW_Util.translateGTItemStack(recipe.mOutputs[0]));
+ DebugLog.log("Found EBF Recipe to change, Output:" + BW_Util.translateGTItemStack(recipe.mOutputs[0]));
toAdd.put(tag, recipe);
}
}
@@ -444,10 +444,10 @@ public final class MainMod {
return toAdd;
}
- private static HashSet<ItemStack> getNoGasItems(ArrayListMultimap<SubTag,GT_Recipe> base){
+ private static HashSet<ItemStack> getNoGasItems(ArrayListMultimap<SubTag, GT_Recipe> base) {
Iterator<GT_Recipe> it = GT_Recipe.GT_Recipe_Map.sBlastRecipes.mRecipeList.iterator();
HashSet<ItemStack> toAdd = new HashSet<>();
- ArrayListMultimap<SubTag,GT_Recipe> repToAdd = ArrayListMultimap.create();
+ ArrayListMultimap<SubTag, GT_Recipe> repToAdd = ArrayListMultimap.create();
while (it.hasNext()) {
GT_Recipe recipe = it.next();
for (SubTag tag : base.keySet())
@@ -457,7 +457,7 @@ public final class MainMod {
for (int i = 0; i < recipe.mInputs.length; i++) {
if ((recipe.mFluidInputs == null || recipe.mFluidInputs.length == 0) && BW_Util.checkStackAndPrefix(recipe.mInputs[i]) && BW_Util.checkStackAndPrefix(baseRe.mInputs[i]) && GT_OreDictUnificator.getAssociation(recipe.mInputs[i]).mMaterial.mMaterial.equals(GT_OreDictUnificator.getAssociation(baseRe.mInputs[i]).mMaterial.mMaterial) && GT_Utility.areStacksEqual(recipe.mOutputs[0], baseRe.mOutputs[0])) {
toAdd.add(recipe.mOutputs[0]);
- repToAdd.put(tag,recipe);
+ repToAdd.put(tag, recipe);
continue recipeLoop;
}
}
@@ -467,7 +467,7 @@ public final class MainMod {
return toAdd;
}
- private static void editRecipes(ArrayListMultimap<SubTag,GT_Recipe> base, HashSet<ItemStack> noGas) {
+ private static void editRecipes(ArrayListMultimap<SubTag, GT_Recipe> base, HashSet<ItemStack> noGas) {
if (GT_Recipe.GT_Recipe_Map.sBlastRecipes.mRecipeFluidNameMap.contains(Objects.requireNonNull(fluids.get(Oganesson)).getName()))
return;
HashSet<GT_Recipe> toAdd = new HashSet<>();
@@ -480,13 +480,13 @@ public final class MainMod {
for (Werkstoff werkstoff : Werkstoff.werkstoffHashMap.values()) {
if (!werkstoff.contains(GasTag))
continue;
- int time = (int) ((double) recipe.mDuration / 200D * (200D + (werkstoff.getStats().getProtons() >= mat.getProtons() ? (double) mat.getProtons() - (double) werkstoff.getStats().getProtons() : (double) mat.getProtons()*2.75D - (double) werkstoff.getStats().getProtons())));
+ int time = (int) ((double) recipe.mDuration / 200D * (200D + (werkstoff.getStats().getProtons() >= mat.getProtons() ? (double) mat.getProtons() - (double) werkstoff.getStats().getProtons() : (double) mat.getProtons() * 2.75D - (double) werkstoff.getStats().getProtons())));
toAdd.add(new BWRecipes.DynamicGTRecipe(false, recipe.mInputs, recipe.mOutputs, recipe.mSpecialItems, recipe.mChances, new FluidStack[]{new FluidStack(Objects.requireNonNull(fluids.get(werkstoff)), recipe.mFluidInputs[0].amount)}, recipe.mFluidOutputs, time, recipe.mEUt, recipe.mSpecialValue));
}
for (Materials materials : Materials.values()) {
if (!materials.contains(GasTag))
continue;
- int time = (int) ((double) recipe.mDuration / 200D * (200D + (materials.getProtons() >= mat.getProtons() ? (double) mat.getProtons() - (double) materials.getProtons() : (double) mat.getProtons()*2.75D - (double) materials.getProtons())));
+ int time = (int) ((double) recipe.mDuration / 200D * (200D + (materials.getProtons() >= mat.getProtons() ? (double) mat.getProtons() - (double) materials.getProtons() : (double) mat.getProtons() * 2.75D - (double) materials.getProtons())));
toAdd.add(new BWRecipes.DynamicGTRecipe(false, recipe.mInputs, recipe.mOutputs, recipe.mSpecialItems, recipe.mChances, new FluidStack[]{materials.getGas(recipe.mFluidInputs[0].amount)}, recipe.mFluidOutputs, time, recipe.mEUt, recipe.mSpecialValue));
}
for (ItemStack is : noGas) {
@@ -510,17 +510,17 @@ public final class MainMod {
GT_Recipe.GT_Recipe_Map.sBlastRecipes.mRecipeList.removeAll(base.get(GasTag));
}
HashSet<GT_Recipe> duplicates = new HashSet<>();
- for (GT_Recipe recipe : toAdd){
- for (GT_Recipe recipe2 : toAdd){
+ for (GT_Recipe recipe : toAdd) {
+ for (GT_Recipe recipe2 : toAdd) {
if (recipe.mEUt != recipe2.mEUt || recipe.mDuration != recipe2.mDuration || recipe.mSpecialValue != recipe2.mSpecialValue || recipe == recipe2 || recipe.mInputs.length != recipe2.mInputs.length || recipe.mFluidInputs.length != recipe2.mFluidInputs.length)
continue;
boolean isSame = true;
for (int i = 0; i < recipe.mInputs.length; i++) {
- if (!GT_Utility.areStacksEqual(recipe.mInputs[i],recipe2.mInputs[i]))
+ if (!GT_Utility.areStacksEqual(recipe.mInputs[i], recipe2.mInputs[i]))
isSame = false;
}
for (int i = 0; i < recipe.mFluidInputs.length; i++) {
- if (!GT_Utility.areFluidsEqual(recipe.mFluidInputs[i],recipe2.mFluidInputs[i]))
+ if (!GT_Utility.areFluidsEqual(recipe.mFluidInputs[i], recipe2.mFluidInputs[i]))
isSame = false;
}
if (isSame)
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGeneratedBlock_Item.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGeneratedBlock_Item.java
index d50511337d..0e2121a0ae 100644
--- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGeneratedBlock_Item.java
+++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGeneratedBlock_Item.java
@@ -72,9 +72,8 @@ public class BW_MetaGeneratedBlock_Item extends BW_ItemBlocks {
}
BW_MetaGenerated_Block_TE tTileEntity = (BW_MetaGenerated_Block_TE) aWorld.getTileEntity(aX, aY, aZ);
tTileEntity.mMetaData = tDamage;
- } else if (!aWorld.setBlock(aX, aY, aZ, this.field_150939_a, 0, 3)) {
+ } else if (!aWorld.setBlock(aX, aY, aZ, this.field_150939_a, 0, 3))
return false;
- }
if (aWorld.getBlock(aX, aY, aZ) == this.field_150939_a) {
this.field_150939_a.onBlockPlacedBy(aWorld, aX, aY, aZ, aPlayer, aStack);
this.field_150939_a.onPostBlockPlaced(aWorld, aX, aY, aZ, tDamage);
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Blocks.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Blocks.java
index 1b3a645e5c..154efe029a 100644
--- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Blocks.java
+++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Blocks.java
@@ -48,12 +48,11 @@ public abstract class BW_MetaGenerated_Blocks extends BW_TileEntityContainer {
this.setResistance(5.0F);
this.setBlockTextureName("stone");
this.setCreativeTab(metaTab);
- for (Werkstoff w : Werkstoff.werkstoffHashSet)
- doRegistrationStuff(w);
+ Werkstoff.werkstoffHashSet.forEach(this::doRegistrationStuff);
}
@SideOnly(Side.CLIENT)
- public final BW_MetaGenerated_Block_TE getProperTileEntityForRendering(){
+ public final BW_MetaGenerated_Block_TE getProperTileEntityForRendering() {
return (BW_MetaGenerated_Block_TE) createNewTileEntity(null,0);
}
@@ -69,9 +68,8 @@ public abstract class BW_MetaGenerated_Blocks extends BW_TileEntityContainer {
}
public int getRenderType() {
- if (BW_Renderer_Block_Ores.INSTANCE == null) {
+ if (BW_Renderer_Block_Ores.INSTANCE == null)
return super.getRenderType();
- }
return BW_Renderer_Block_Ores.INSTANCE.mRenderID;
}
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Ores.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Ores.java
index dc4bc47673..7cea9d0588 100644
--- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Ores.java
+++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Ores.java
@@ -45,12 +45,13 @@ public class BW_MetaGenerated_Ores extends BW_MetaGenerated_Blocks {
super(p_i45386_1_, tileEntity, blockName);
}
- protected void doRegistrationStuff(Werkstoff w){
+ protected void doRegistrationStuff(Werkstoff w) {
if (w != null) {
if ((w.getGenerationFeatures().toGenerate & 0b1000) == 0 || ((w.getGenerationFeatures().blacklist & 0b1000) != 0))
return;
GT_ModHandler.addValuableOre(this, w.getmID(), 1);
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + "." + w.getmID() + ".name", w.getDefaultName() + OrePrefixes.ore.mLocalizedMaterialPost);
+
}
}
@@ -113,7 +114,7 @@ public class BW_MetaGenerated_Ores extends BW_MetaGenerated_Blocks {
}
@SuppressWarnings("unused")
- private boolean checkForAir(IBlockAccess aWorld, int aX, int aY, int aZ){
+ private boolean checkForAir(IBlockAccess aWorld, int aX, int aY, int aZ) {
for (int x = -1; x <= 1; x++) {
for (int y = -1; y <= 1; y++) {
for (int z = -1; z <= 1; z++) {
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/CircuitGeneration/CircuitImprintLoader.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/CircuitGeneration/CircuitImprintLoader.java
index 361648f276..4ffade4528 100644
--- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/CircuitGeneration/CircuitImprintLoader.java
+++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/CircuitGeneration/CircuitImprintLoader.java
@@ -46,111 +46,73 @@ import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe;
import java.util.HashSet;
-import java.util.Iterator;
public class CircuitImprintLoader {
- public static final ArrayListMultimap<NBTTagCompound,GT_Recipe> recipeTagMap = ArrayListMultimap.create();
-
- static final HashBiMap<CircuitData,ItemStack> bwCircuitTagMap = HashBiMap.create(20);
public static short reverseIDs = Short.MAX_VALUE-1;
- public static HashBiMap<Short, ItemList> circuitIIconRefs = HashBiMap.create(20);
-
-// /**
-// * stack is assumed valid
-// **/
-// private static NBTTagCompound getUniqueIdentifierFromStack(ItemStack stack){
-// NBTTagCompound tagCompound = new NBTTagCompound();
-// tagCompound.setString("Name", stack.getUnlocalizedName());
-// tagCompound.setString("ODName", OreDictionary.getOreName(OreDictionary.getOreID(stack)));
-// tagCompound.setShort("Damage", (short)stack.getItemDamage());
-//
-// return tagCompound;
-// }
-//
-// private static ItemStack getStackFromUniqueIdentifier(NBTTagCompound tagCompound){
-// return OreDictionary.getOres(tagCompound.getString("ODName")).stream().filter(
-// e ->
-// e.getItemDamage() == tagCompound.getShort("Damage")
-// && e.getUnlocalizedName().equals(tagCompound.getString("Name"))
-//
-// ).findFirst().orElse(null);
-// }
-
- public static NBTTagCompound getTagFromStack(ItemStack stack){
- if (GT_Utility.isStackValid(stack))
- return stack.copy().splitStack(1).writeToNBT(new NBTTagCompound());
- return new NBTTagCompound();
- }
- public static ItemStack getStackFromTag(NBTTagCompound tagCompound){
- return ItemStack.loadItemStackFromNBT(tagCompound);
- }
+ public static final ArrayListMultimap<NBTTagCompound,GT_Recipe> recipeTagMap = ArrayListMultimap.create();
+ public static final HashBiMap<Short, ItemList> circuitIIconRefs = HashBiMap.create(20);
+ public static final HashSet<ItemStack> blacklistSet = new HashSet<>();
+ static final HashBiMap<CircuitData,ItemStack> bwCircuitTagMap = HashBiMap.create(20);
+ private static final HashSet<IRecipe> recipeWorldCache = new HashSet<>();
+ private static final HashSet<GT_Recipe> gtrecipeWorldCache = new HashSet<>();
public static void run() {
- boolean newServer = false;
- if (BWRecipes.instance.getMappingsFor(BWRecipes.CIRCUITASSEMBLYLINE).mRecipeList.size() > 0){
- BWRecipes.instance.getMappingsFor(BWRecipes.CIRCUITASSEMBLYLINE).mRecipeList.clear();
- recipeTagMap.clear();
- newServer = true;
- }
-
- Iterator<GT_Recipe> it = GT_Recipe.GT_Recipe_Map.sCircuitAssemblerRecipes.mRecipeList.iterator();
- GT_Recipe circuitRecipe;
-
HashSet<GT_Recipe> toRem = new HashSet<>();
HashSet<GT_Recipe> toAdd = new HashSet<>();
- while (it.hasNext()) {
- circuitRecipe = it.next();
-
- ItemStack[] outputs = circuitRecipe.mOutputs;
-
- if (outputs.length < 1)
- continue;
-
- int[] oreIDS = OreDictionary.getOreIDs(outputs[0]);
-
- if (oreIDS.length < 1)
- continue;
-
- String name = OreDictionary.getOreName(oreIDS[0]);
-
- if (name.contains("Circuit") || name.contains("circuit")) {
-
- CircuitImprintLoader.recipeTagMap.put(CircuitImprintLoader.getTagFromStack(outputs[0]), circuitRecipe.copy());
+ boolean newServer = checkAndDeleteCALRecipes();
+ GT_Recipe.GT_Recipe_Map.sCircuitAssemblerRecipes.mRecipeList.forEach(e -> CircuitImprintLoader.handleCircuitRecipeRebuilding(e, toRem, toAdd));
+ exchangeRecipesInList(toRem,toAdd,newServer);
+ makeCircuitImprintRecipes(newServer);
+ }
- if (circuitRecipe.mFluidInputs[0].isFluidEqual(Materials.SolderingAlloy.getMolten(0))) {
+ private static void handleCircuitRecipeRebuilding(GT_Recipe circuitRecipe, HashSet<GT_Recipe> toRem, HashSet<GT_Recipe> toAdd) {
+ ItemStack[] outputs = circuitRecipe.mOutputs;
+ String name = getTypeFromOreDict(outputs);
- GT_Recipe newRecipe = CircuitImprintLoader.reBuildRecipe(circuitRecipe);
+ if (name.contains("Circuit") || name.contains("circuit")) {
- if (newRecipe != null)
- BWRecipes.instance.getMappingsFor(BWRecipes.CIRCUITASSEMBLYLINE).addRecipe(newRecipe);
+ CircuitImprintLoader.recipeTagMap.put(CircuitImprintLoader.getTagFromStack(outputs[0]), circuitRecipe.copy());
- if (circuitRecipe.mEUt > BW_Util.getTierVoltage(ConfigHandler.cutoffTier)) {
- toRem.add(circuitRecipe);
- toAdd.add(CircuitImprintLoader.makeMoreExpensive(circuitRecipe));
- }
+ if (circuitRecipe.mFluidInputs[0].isFluidEqual(Materials.SolderingAlloy.getMolten(0))) {
+ GT_Recipe newRecipe = CircuitImprintLoader.reBuildRecipe(circuitRecipe);
+ if (newRecipe != null)
+ BWRecipes.instance.getMappingsFor(BWRecipes.CIRCUITASSEMBLYLINE).addRecipe(newRecipe);
+ addCutoffRecipeToSets(toRem,toAdd,circuitRecipe);
+ } else {
+ if (circuitRecipe.mEUt > BW_Util.getTierVoltage(ConfigHandler.cutoffTier))
+ toRem.add(circuitRecipe);
+ }
+ }
+ }
- } else {
+ private static String getTypeFromOreDict(ItemStack[] outputs) {
+ int[] oreIDS = OreDictionary.getOreIDs(outputs[0]);
- if (circuitRecipe.mEUt > BW_Util.getTierVoltage(ConfigHandler.cutoffTier))
- toRem.add(circuitRecipe);
+ if (oreIDS.length < 1)
+ return "";
- }
- }
- }
+ return OreDictionary.getOreName(oreIDS[0]);
+ }
+ private static void exchangeRecipesInList(HashSet<GT_Recipe> toRem, HashSet<GT_Recipe> toAdd, boolean newServer) {
if (!newServer) {
GT_Recipe.GT_Recipe_Map.sCircuitAssemblerRecipes.mRecipeList.addAll(toAdd);
GT_Recipe.GT_Recipe_Map.sCircuitAssemblerRecipes.mRecipeList.removeAll(toRem);
}
+ }
- makeCircuitImprintRecipes();
+ private static void addCutoffRecipeToSets(HashSet<GT_Recipe> toRem, HashSet<GT_Recipe> toAdd, GT_Recipe circuitRecipe) {
+ if (circuitRecipe.mEUt > BW_Util.getTierVoltage(ConfigHandler.cutoffTier)) {
+ toRem.add(circuitRecipe);
+ toAdd.add(CircuitImprintLoader.makeMoreExpensive(circuitRecipe));
+ }
}
@SuppressWarnings("deprecation")
- public static GT_Recipe makeMoreExpensive(GT_Recipe original){
+ public static GT_Recipe makeMoreExpensive(GT_Recipe original) {
GT_Recipe newRecipe = original.copy();
for (ItemStack is : newRecipe.mInputs){
int[] oreIDs = OreDictionary.getOreIDs(is);
@@ -165,51 +127,71 @@ public class CircuitImprintLoader {
return newRecipe;
}
- @SuppressWarnings("deprecation")
- public static GT_Recipe reBuildRecipe(GT_Recipe original){
- ItemStack out = original.copy().getOutput(0);
- out.stackSize *= 16;
- ItemStack[] in = new ItemStack[6];
- BiMap<ItemList, Short> inversed = CircuitImprintLoader.circuitIIconRefs.inverse();
- for (int i = 0; i < 6; i++) {
- try {
- for (ItemList il : inversed.keySet()){
- if (GT_Utility.areStacksEqual(il.get(1), original.mInputs[i])) {
- in[i] = BW_Meta_Items.getNEWCIRCUITS().getStack(inversed.get(il), original.mInputs[i].stackSize);
- }
+ public static GT_Recipe reBuildRecipe(GT_Recipe original) {
+ ItemStack[] in = new ItemStack[6];
+ BiMap<ItemList, Short> inversed = CircuitImprintLoader.circuitIIconRefs.inverse();
+
+ for (int i = 0; i < 6; i++) {
+ try {
+ replaceCircuits(inversed,original,in,i);
+ replaceComponents(in,original,i);
+ } catch (ArrayIndexOutOfBoundsException e) {
+ break;
+ } catch (NullPointerException e) {
+ e.printStackTrace();
+ }
+ }
- }
- if (original.mInputs[i] != null && in[i] == null){
- if (BW_Util.checkStackAndPrefix(original.mInputs[i]) && GT_OreDictUnificator.getAssociation(original.mInputs[i]).mPrefix == OrePrefixes.wireGt01){
- in[i] = GT_OreDictUnificator.get(OrePrefixes.wireGt16,GT_OreDictUnificator.getAssociation(original.mInputs[i]).mMaterial.mMaterial,original.mInputs[i].stackSize);
- }
- else if (BW_Util.checkStackAndPrefix(original.mInputs[i]) && GT_OreDictUnificator.getAssociation(original.mInputs[i]).mPrefix == OrePrefixes.wireFine){
- in[i] = GT_OreDictUnificator.get(OrePrefixes.wireGt04,GT_OreDictUnificator.getAssociation(original.mInputs[i]).mMaterial.mMaterial,original.mInputs[i].stackSize);
- }
- else {
- in[i] = original.mInputs[i].copy();
- in[i].stackSize *= 16;
- if (in[i].stackSize > in[i].getItem().getItemStackLimit() || in[i].stackSize > in[i].getMaxStackSize())
- in[i].stackSize = in[i].getMaxStackSize();
- }
-// if (in[i].stackSize > 64)
-// return null;
- }
- } catch (ArrayIndexOutOfBoundsException e){
- break;
- } catch (NullPointerException e){
- e.printStackTrace();
- }
+ if (CircuitImprintLoader.checkForBlacklistedComponents(in)) {
+ return null;
}
- if (CircuitImprintLoader.checkForBlacklistedComponents(in)){
- return null;
+
+ return new BWRecipes.DynamicGTRecipe(false, in, new ItemStack[]{getOutputMultiplied(original)}, BW_Meta_Items.getNEWCIRCUITS().getStackWithNBT(CircuitImprintLoader.getTagFromStack(original.mOutputs[0]), 0, 0), null, original.mFluidInputs, null, original.mDuration * 16, original.mEUt, 0);
+ }
+
+ private static ItemStack getOutputMultiplied(GT_Recipe original){
+ ItemStack out = original.copy().getOutput(0);
+ out.stackSize *= 16;
+ return out;
+ }
+
+ private static void replaceCircuits(BiMap<ItemList, Short> inversed, GT_Recipe original, ItemStack[] in, int index){
+ for (ItemList il : inversed.keySet()) {
+ if (GT_Utility.areStacksEqual(il.get(1), original.mInputs[index])) {
+ in[index] = BW_Meta_Items.getNEWCIRCUITS().getStack(inversed.get(il), original.mInputs[index].stackSize);
+ }
}
- return new BWRecipes.DynamicGTRecipe(false,in,new ItemStack[]{out},BW_Meta_Items.getNEWCIRCUITS().getStackWithNBT(CircuitImprintLoader.getTagFromStack(original.mOutputs[0]),0,0),null, original.mFluidInputs,null,original.mDuration * 16,original.mEUt,0);
}
- public static final HashSet<ItemStack> blacklistSet = new HashSet<>();
+ @SuppressWarnings("deprecation")
+ private static void replaceComponents(ItemStack[] in, GT_Recipe original, int index) throws ArrayIndexOutOfBoundsException {
+ if (original.mInputs[index] != null && in[index] == null) {
+ //big wires
+ if (BW_Util.checkStackAndPrefix(original.mInputs[index]) && GT_OreDictUnificator.getAssociation(original.mInputs[index]).mPrefix == OrePrefixes.wireGt01) {
+ in[index] = GT_OreDictUnificator.get(OrePrefixes.wireGt16, GT_OreDictUnificator.getAssociation(original.mInputs[index]).mMaterial.mMaterial, original.mInputs[index].stackSize);
+ //fine wires
+ } else if (BW_Util.checkStackAndPrefix(original.mInputs[index]) && GT_OreDictUnificator.getAssociation(original.mInputs[index]).mPrefix == OrePrefixes.wireFine) {
+ in[index] = GT_OreDictUnificator.get(OrePrefixes.wireGt04, GT_OreDictUnificator.getAssociation(original.mInputs[index]).mMaterial.mMaterial, original.mInputs[index].stackSize);
+ //other components
+ } else {
+ in[index] = original.mInputs[index].copy();
+ in[index].stackSize *= 16;
+ if (in[index].stackSize > in[index].getItem().getItemStackLimit() || in[index].stackSize > in[index].getMaxStackSize())
+ in[index].stackSize = in[index].getMaxStackSize();
+ }
+ }
+ }
- private static boolean checkForBlacklistedComponents(ItemStack[] itemStacks){
+ private static void makeCircuitImprintRecipes(boolean newServer) {
+ if (newServer)
+ removeOldRecipesFromRegistries();
+ CircuitImprintLoader.recipeTagMap.keySet().forEach(e -> {
+ makeAndAddSlicingRecipe(e);
+ makeAndAddCraftingRecipes(e);
+ });
+ }
+
+ private static boolean checkForBlacklistedComponents(ItemStack[] itemStacks) {
for (ItemStack is: itemStacks){
for (ItemStack is2 : CircuitImprintLoader.blacklistSet){
if (GT_Utility.areStacksEqual(is,is2))
@@ -219,10 +201,7 @@ public class CircuitImprintLoader {
return false;
}
- private static HashSet<IRecipe> recipeWorldCache = new HashSet<>();
- private static HashSet<GT_Recipe> gtrecipeWorldCache = new HashSet<>();
-
- private static void removeOldRecipesFromRegistries(){
+ private static void removeOldRecipesFromRegistries() {
recipeWorldCache.forEach(CraftingManager.getInstance().getRecipeList()::remove);
BWCoreStaticReplacementMethodes.RECENTLYUSEDRECIPES.clear();
gtrecipeWorldCache.forEach(GT_Recipe.GT_Recipe_Map.sSlicerRecipes.mRecipeList::remove);
@@ -239,34 +218,59 @@ public class CircuitImprintLoader {
gtrecipeWorldCache.clear();
}
- private static void makeCircuitImprintRecipes() {
+ private static void makeAndAddSlicingRecipe(NBTTagCompound tag) {
+ ItemStack stack = CircuitImprintLoader.getStackFromTag(tag);
+ int eut = Integer.MAX_VALUE;
- removeOldRecipesFromRegistries();
+ for (GT_Recipe recipe : CircuitImprintLoader.recipeTagMap.get(tag)) {
+ eut = Math.min(eut, recipe.mEUt);
+ }
+ eut = Math.min(eut, BW_Util.getMachineVoltageFromTier(BW_Util.getCircuitTierFromOreDictName(OreDictionary.getOreName(OreDictionary.getOreIDs(stack)[0]))));
+ GT_Recipe slicingRecipe = new BWRecipes.DynamicGTRecipe(true,new ItemStack[]{stack,ItemList.Shape_Slicer_Flat.get(0)},new ItemStack[]{BW_Meta_Items.getNEWCIRCUITS().getStackWithNBT(tag,1,1)},null,null,null,null,300,eut, BW_Util.CLEANROOM);
+ gtrecipeWorldCache.add(slicingRecipe);
+ GT_Recipe.GT_Recipe_Map.sSlicerRecipes.add(slicingRecipe);
+ }
- for (NBTTagCompound tag : CircuitImprintLoader.recipeTagMap.keySet()){
- ItemStack stack = CircuitImprintLoader.getStackFromTag(tag);
- int eut = Integer.MAX_VALUE;
+ private static void makeAndAddCraftingRecipes(NBTTagCompound tag) {
+ ItemStack circuit = BW_Meta_Items.getNEWCIRCUITS().getStackWithNBT(tag,0,1);
+ Object[] imprintRecipe = {
+ " X ",
+ "GPG",
+ " X ",
+ 'P', BW_Meta_Items.getNEWCIRCUITS().getStackWithNBT(tag,1,1),
+ 'G', WerkstoffLoader.Prasiolite.get(OrePrefixes.gemExquisite,1),
+ 'X', BW_Meta_Items.getNEWCIRCUITS().getStack(3)
+ };
+
+ IRecipe bwrecipe = new BWRecipes.BWNBTDependantCraftingRecipe(circuit,imprintRecipe);
+ ShapedOreRecipe gtrecipe = BW_Util.createGTCraftingRecipe(circuit, GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GT_ModHandler.RecipeBits.KEEPNBT | GT_ModHandler.RecipeBits.BUFFERED, imprintRecipe);
+
+ //Adds the actual recipe
+ recipeWorldCache.add(bwrecipe);
+ GameRegistry.addRecipe(bwrecipe);
+ //Adds the NEI visual recipe
+ recipeWorldCache.add(gtrecipe);
+ GameRegistry.addRecipe(gtrecipe);
+ }
- for (GT_Recipe recipe : CircuitImprintLoader.recipeTagMap.get(tag)) {
- eut = Math.min(eut, recipe.mEUt);
- }
+ public static NBTTagCompound getTagFromStack(ItemStack stack) {
+ if (GT_Utility.isStackValid(stack))
+ return stack.copy().splitStack(1).writeToNBT(new NBTTagCompound());
+ return new NBTTagCompound();
+ }
- eut = Math.min(eut, BW_Util.getMachineVoltageFromTier(BW_Util.getCircuitTierFromOreDictName(OreDictionary.getOreName(OreDictionary.getOreIDs(stack)[0]))));
- GT_Recipe slicingRecipe = new BWRecipes.DynamicGTRecipe(true,new ItemStack[]{stack,ItemList.Shape_Slicer_Flat.get(0)},new ItemStack[]{BW_Meta_Items.getNEWCIRCUITS().getStackWithNBT(tag,1,1)},null,null,null,null,300,eut, BW_Util.CLEANROOM);
- gtrecipeWorldCache.add(slicingRecipe);
- GT_Recipe.GT_Recipe_Map.sSlicerRecipes.add(slicingRecipe);
-
- ShapedOreRecipe gtrecipe = BW_Util.createGTCraftingRecipe(BW_Meta_Items.getNEWCIRCUITS().getStackWithNBT(tag,0,1), GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GT_ModHandler.RecipeBits.KEEPNBT | GT_ModHandler.RecipeBits.BUFFERED, new Object[]{
- " X ",
- "GPG",
- " X ",
- 'P', BW_Meta_Items.getNEWCIRCUITS().getStackWithNBT(tag,1,1),
- 'G', WerkstoffLoader.Prasiolite.get(OrePrefixes.gemExquisite,1),
- 'X', BW_Meta_Items.getNEWCIRCUITS().getStack(3)});
- recipeWorldCache.add(gtrecipe);
- GameRegistry.addRecipe(gtrecipe);
+ public static ItemStack getStackFromTag(NBTTagCompound tagCompound) {
+ return ItemStack.loadItemStackFromNBT(tagCompound);
+ }
+ private static boolean checkAndDeleteCALRecipes() {
+ boolean newServer = false;
+ if (BWRecipes.instance.getMappingsFor(BWRecipes.CIRCUITASSEMBLYLINE).mRecipeList.size() > 0){
+ BWRecipes.instance.getMappingsFor(BWRecipes.CIRCUITASSEMBLYLINE).mRecipeList.clear();
+ recipeTagMap.clear();
+ newServer = true;
}
-
+ return newServer;
}
+
} \ No newline at end of file
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/WerkstoffLoader.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/WerkstoffLoader.java
index 7f960e8258..ec43fce23c 100644
--- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/WerkstoffLoader.java
+++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/WerkstoffLoader.java
@@ -1356,7 +1356,7 @@ public class WerkstoffLoader implements Runnable {
return WerkstoffLoader.getCorrespondingItemStack(orePrefixes, werkstoff, 1);
}
- public static ItemStack getCorrespondingItemStack(OrePrefixes orePrefixes, Werkstoff werkstoff, int amount) {
+ private static ItemStack getCorrespondingItemStackUnsafe(OrePrefixes orePrefixes, Werkstoff werkstoff, int amount){
if (!werkstoff.getGenerationFeatures().enforceUnification) {
ItemStack ret = OreDictHandler.getItemStack(werkstoff.getVarName(), orePrefixes, amount);
if (ret != null)
@@ -1369,6 +1369,15 @@ public class WerkstoffLoader implements Runnable {
else if (orePrefixes == block)
return new ItemStack(WerkstoffLoader.BWBlocks,amount,werkstoff.getmID());
else if (WerkstoffLoader.items.get(orePrefixes) == null)
+ return null;
+ return new ItemStack(WerkstoffLoader.items.get(orePrefixes), amount, werkstoff.getmID()).copy();
+ }
+
+ public static ItemStack getCorrespondingItemStack(OrePrefixes orePrefixes, Werkstoff werkstoff, int amount) {
+ ItemStack stack = getCorrespondingItemStackUnsafe(orePrefixes, werkstoff, amount);
+ if (stack != null)
+ return stack;
+ else
MainMod.LOGGER.catching(Level.ERROR,new Exception("NO SUCH ITEM! "+orePrefixes+werkstoff.getVarName() +" If you encounter this as a user, make sure to contact the authors of the pack/the mods you're playing! " +
"If you are a Developer, you forgot to enable "+orePrefixes+" OrePrefix for Werkstoff "+werkstoff.getDefaultName()));
return new ItemStack(WerkstoffLoader.items.get(orePrefixes), amount, werkstoff.getmID()).copy();
@@ -1640,11 +1649,10 @@ public class WerkstoffLoader implements Runnable {
}
private static void runGTItemDataRegistrator() {
- // HashSet<Materials> toRem = new HashSet<>();
for (Werkstoff werkstoff : Werkstoff.werkstoffHashSet) {
//int aMetaItemSubID, TextureSet aIconSet, float aToolSpeed, int aDurability, int aToolQuality, int aTypes, int aR, int aG, int aB, int aA, String aName, String aDefaultLocalName, int aFuelType, int aFuelPower, int aMeltingPoint, int aBlastFurnaceTemp, boolean aBlastFurnaceRequired, boolean aTransparent, int aOreValue, int aDensityMultiplier, int aDensityDivider, Dyes aColor, String aConfigSection, boolean aCustomOre, String aCustomID
Materials werkstoffBridgeMaterial = werkstoff.getBridgeMaterial() != null ? werkstoff.getBridgeMaterial() : Materials.get(werkstoff.getVarName()) != Materials._NULL ? Materials.get(werkstoff.getVarName()) :
- new Materials(-1, werkstoff.getTexSet(), werkstoff.getToolSpeed(), werkstoff.getDurability(), werkstoff.getToolQuality(),0, werkstoff.getRGBA()[0],werkstoff.getRGBA()[1], werkstoff.getRGBA()[2], werkstoff.getRGBA()[3], werkstoff.getVarName(), werkstoff.getDefaultName(),0,0,werkstoff.getStats().meltingPoint,werkstoff.getStats().meltingPoint,werkstoff.getStats().isBlastFurnace(),false,0,1,1,null);
+ new Materials(-1, werkstoff.getTexSet(), werkstoff.getToolSpeed(), werkstoff.getDurability(), werkstoff.getToolQuality(), 0, werkstoff.getRGBA()[0], werkstoff.getRGBA()[1], werkstoff.getRGBA()[2], werkstoff.getRGBA()[3], werkstoff.getVarName(), werkstoff.getDefaultName(), 0, 0, werkstoff.getStats().meltingPoint, werkstoff.getStats().meltingPoint, werkstoff.getStats().isBlastFurnace(), false, 0, 1, 1, null);
for (OrePrefixes prefixes : values()) {
if (!(prefixes == cell && werkstoff.getType().equals(Werkstoff.Types.ELEMENT))) {
if (prefixes == dust && werkstoff.getType().equals(Werkstoff.Types.ELEMENT)) {
@@ -1655,7 +1663,7 @@ public class WerkstoffLoader implements Runnable {
if (e.mLinkedMaterials.size() > 0)
break;
werkstoffBridgeMaterial = werkstoff.getBridgeMaterial() != null ? werkstoff.getBridgeMaterial() : Materials.get(werkstoff.getVarName()) != Materials._NULL ? Materials.get(werkstoff.getVarName()) :
- new Materials(-1, werkstoff.getTexSet(), werkstoff.getToolSpeed(), werkstoff.getDurability(), werkstoff.getToolQuality(),0, werkstoff.getRGBA()[0],werkstoff.getRGBA()[1], werkstoff.getRGBA()[2], werkstoff.getRGBA()[3], werkstoff.getVarName(), werkstoff.getDefaultName(),0,0,werkstoff.getStats().meltingPoint,werkstoff.getStats().meltingPoint,werkstoff.getStats().isBlastFurnace(),false,0,1,1,null);
+ new Materials(-1, werkstoff.getTexSet(), werkstoff.getToolSpeed(), werkstoff.getDurability(), werkstoff.getToolQuality(), 0, werkstoff.getRGBA()[0], werkstoff.getRGBA()[1], werkstoff.getRGBA()[2], werkstoff.getRGBA()[3], werkstoff.getVarName(), werkstoff.getDefaultName(), 0, 0, werkstoff.getStats().meltingPoint, werkstoff.getStats().meltingPoint, werkstoff.getStats().isBlastFurnace(), false, 0, 1, 1, null);
werkstoffBridgeMaterial.mElement = e;
e.mLinkedMaterials = new ArrayList<>();
e.mLinkedMaterials.add(werkstoffBridgeMaterial);
@@ -1693,6 +1701,7 @@ public class WerkstoffLoader implements Runnable {
werkstoffBridgeMaterial.mFluid = werkstoff.getFluidOrGas(1).getFluid();
werkstoffBridgeMaterial.mGas = werkstoff.getFluidOrGas(1).getFluid();
}
+
if (werkstoff.getGenerationFeatures().hasMolten()) {
werkstoffBridgeMaterial.mStandardMoltenFluid = werkstoff.getMolten(1).getFluid();
}
@@ -1701,33 +1710,74 @@ public class WerkstoffLoader implements Runnable {
try {
Field f = Materials.class.getField("mLocalizedName");
f.set(werkstoffBridgeMaterial, werkstoff.getDefaultName());
- } catch (NoSuchFieldException | IllegalAccessException ignored){}
+ } catch (NoSuchFieldException | IllegalAccessException ignored) {
+ }
werkstoffBridgeMaterial.mChemicalFormula = werkstoff.getToolTip();
if (Loader.isModLoaded("Thaumcraft"))
werkstoffBridgeMaterial.mAspects = werkstoff.getGTWrappedTCAspects();
werkstoffBridgeMaterial.mMaterialInto = werkstoffBridgeMaterial;
werkstoffBridgeMaterial.mHandleMaterial = werkstoff.contains(SubTag.BURNING) ? Materials.Blaze : werkstoff.contains(SubTag.MAGICAL) ? Materials.Thaumium : werkstoffBridgeMaterial.mDurability > 5120 ? Materials.TungstenSteel : werkstoffBridgeMaterial.mDurability > 1280 ? Materials.Steel : Materials.Wood;
- //toRem.add(werkstoffBridgeMaterial);
- if (werkstoff.getStats().isRadioactive()){
- werkstoffBridgeMaterial.setEnchantmentForArmors(Enchantment_Radioactivity.INSTANCE,werkstoff.getStats().getEnchantmentlvl());
- werkstoffBridgeMaterial.setEnchantmentForTools(Enchantment_Radioactivity.INSTANCE,werkstoff.getStats().getEnchantmentlvl());
+ if (werkstoff.getStats().isRadioactive()) {
+ werkstoffBridgeMaterial.setEnchantmentForArmors(Enchantment_Radioactivity.INSTANCE, werkstoff.getStats().getEnchantmentlvl());
+ werkstoffBridgeMaterial.setEnchantmentForTools(Enchantment_Radioactivity.INSTANCE, werkstoff.getStats().getEnchantmentlvl());
}
werkstoff.setBridgeMaterial(werkstoffBridgeMaterial);
- if (WerkstoffLoader.items.get(prefixes) != null)
- if ((werkstoff.getGenerationFeatures().toGenerate & Werkstoff.GenerationFeatures.prefixLogic.get(prefixes)) != 0 && (werkstoff.getGenerationFeatures().blacklist & Werkstoff.GenerationFeatures.prefixLogic.get(prefixes)) == 0 && werkstoff.get(prefixes) != null && werkstoff.get(prefixes).getItem() != null)
- GT_OreDictUnificator.addAssociation(prefixes, werkstoffBridgeMaterial, werkstoff.get(prefixes), false);
+ //if (WerkstoffLoader.items.get(prefixes) != null)
}
}
}
-// try {
-// Field f = Materials.class.getDeclaredField("MATERIALS_MAP");
-// f.setAccessible(true);
-// Map<String, Materials> MATERIALS_MAP = (Map<String, Materials>) f.get(null);
-// for (Materials o : toRem)
-// MATERIALS_MAP.remove(o.mName);
-// } catch (NoSuchFieldException | IllegalAccessException | ClassCastException e) {
-// e.printStackTrace();
-// }
+ addAssociationToItems();
+ addFakeItemDataToInWorldBlocksAndCleanUpFakeData();
+ }
+
+ public static void addAssociationToItems() {
+ Arrays.stream(values()).forEach( prefixes -> {
+ Werkstoff.werkstoffHashSet.stream()
+ .filter(werkstoff -> werkstoff.hasItemType(prefixes) && (werkstoff.getGenerationFeatures().blacklist & Werkstoff.GenerationFeatures.prefixLogic.get(prefixes)) == 0)
+ .forEach(werkstoff -> {
+ Materials werkstoffBridgeMaterial = werkstoff.getBridgeMaterial();
+ ItemStack stack = WerkstoffLoader.getCorrespondingItemStackUnsafe(prefixes, werkstoff, 1);
+ if (stack != null && stack.getItem() != null) {
+ GT_OreDictUnificator.addAssociation(prefixes, werkstoffBridgeMaterial, stack, false);
+ GT_OreDictUnificator.set(prefixes, werkstoffBridgeMaterial, stack, true, true);
+ }
+ });
+ });
+ }
+
+ /**
+ * very hacky way to make my ores/blocks/smallores detectable by gt assosication in world, well at least the prefix.
+ * used for the miners mostly
+ * removing this hacky material from the materials map instantly. we only need the item data.
+ */
+ private static void addFakeItemDataToInWorldBlocksAndCleanUpFakeData() {
+
+ Map<String, Materials> MATERIALS_MAP = null;
+
+ try {
+ Field f = Materials.class.getDeclaredField("MATERIALS_MAP");
+ f.setAccessible(true);
+ MATERIALS_MAP = (Map<String, Materials>) f.get(null);
+ } catch (NoSuchFieldException | IllegalAccessException | ClassCastException e) {
+ e.printStackTrace();
+ }
+
+ if (MATERIALS_MAP == null)
+ throw new NullPointerException("MATERIALS_MAP null!");
+
+ Materials oreMat = new Materials(-1,null,0,0,0,false,"bwores","bwores",null,true,null);
+ Materials smallOreMat = new Materials(-1,null,0,0,0,false,"bwsmallores","bwsmallores",null,true,null);
+ Materials blockMat = new Materials(-1,null,0,0,0,false,"bwblocks","bwblocks",null,true,null);
+
+ for (int i = 0; i < 16; i++) {
+ GT_OreDictUnificator.addAssociation(ore, oreMat, new ItemStack(BWOres,1,i), true);
+ GT_OreDictUnificator.addAssociation(oreSmall, smallOreMat, new ItemStack(BWSmallOres,1,i), true);
+ GT_OreDictUnificator.addAssociation(block, blockMat, new ItemStack(BWBlocks,1,i), true);
+ }
+
+ MATERIALS_MAP.remove("bwores");
+ MATERIALS_MAP.remove("bwsmallores");
+ MATERIALS_MAP.remove("bwblocks");
}
private void addTools(Werkstoff werkstoff){
@@ -1834,8 +1884,8 @@ public class WerkstoffLoader implements Runnable {
if (werkstoff.getGenerationFeatures().hasOres()) {
GT_OreDictUnificator.registerOre(ore + werkstoff.getVarName(), werkstoff.get(ore));
GT_OreDictUnificator.registerOre(oreSmall + werkstoff.getVarName(), werkstoff.get(oreSmall));
- werkstoff.getADDITIONAL_OREDICT().forEach( e -> OreDictionary.registerOre(ore+e, werkstoff.get(ore)));
- werkstoff.getADDITIONAL_OREDICT().forEach( e -> OreDictionary.registerOre(oreSmall+e, werkstoff.get(oreSmall)));
+ werkstoff.getADDITIONAL_OREDICT().forEach( e -> OreDictionary.registerOre(ore+e, werkstoff.get(ore)));
+ werkstoff.getADDITIONAL_OREDICT().forEach( e -> OreDictionary.registerOre(oreSmall+e, werkstoff.get(oreSmall)));
}
if (werkstoff.getGenerationFeatures().hasGems())
@@ -1850,7 +1900,7 @@ public class WerkstoffLoader implements Runnable {
.forEach(s -> ENABLED_ORE_PREFIXES
.stream()
.filter(o -> Objects.nonNull(werkstoff.get(o)))
- .forEach( od -> OreDictionary.registerOre(od+s, werkstoff.get(od))));
+ .forEach(od -> OreDictionary.registerOre(od+s, werkstoff.get(od))));
}
GT_OreDictUnificator.registerOre("craftingIndustrialDiamond", WerkstoffLoader.CubicZirconia.get(gemExquisite));
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/util/NEIbartworksConfig.java b/src/main/java/com/github/bartimaeusnek/bartworks/util/NEIbartworksConfig.java
index 2b740e35d5..faa06e135d 100644
--- a/src/main/java/com/github/bartimaeusnek/bartworks/util/NEIbartworksConfig.java
+++ b/src/main/java/com/github/bartimaeusnek/bartworks/util/NEIbartworksConfig.java
@@ -72,5 +72,8 @@ public class NEIbartworksConfig implements IConfigureNEI {
stack.setItemDamage(Short.MAX_VALUE);
API.hideItem(stack);
}
+// for (int i = 0; i < Short.MAX_VALUE; i++) {
+// API.addItemListEntry(new ItemStack(WerkstoffLoader.BWOres,1,i));
+// }
}
} \ No newline at end of file