From 4cbc4b40b3e1d5197b6e390311472fffcf4bec21 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Sun, 27 May 2018 16:16:10 +1000 Subject: $ Hopefully fixed issue where BoP limestone is valid for Fluorite. $ Fixed the ABS not using the correct texture on the top layer input hatch. % More internal work on LFTR rewrite. --- src/Java/gregtech/api/util/Recipe_GT.java | 3 + src/Java/gtPlusPlus/GTplusplus.java | 3 +- src/Java/gtPlusPlus/api/objects/data/AutoMap.java | 10 +++ .../objects/minecraft/NoConflictGTRecipeMap.java | 94 ++++++++++++++++++++-- .../core/handler/events/BlockEventHandler.java | 11 ++- .../gtPlusPlus/core/recipe/RECIPES_GREGTECH.java | 6 +- .../GregtechMetaTileEntity_AlloyBlastSmelter.java | 2 +- .../gregtech/loaders/recipe/RecipeLoader_LFTR.java | 8 +- 8 files changed, 121 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/Java/gregtech/api/util/Recipe_GT.java b/src/Java/gregtech/api/util/Recipe_GT.java index 77d2315836..4cee30a44a 100644 --- a/src/Java/gregtech/api/util/Recipe_GT.java +++ b/src/Java/gregtech/api/util/Recipe_GT.java @@ -17,6 +17,7 @@ import codechicken.nei.PositionedStack; import gtPlusPlus.api.interfaces.IComparableRecipe; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.api.objects.minecraft.NoConflictGTRecipeMap; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.minecraft.RecipeUtils; import gtPlusPlus.nei.GT_NEI_MultiBlockHandler; @@ -250,6 +251,8 @@ public class Recipe_GT extends GT_Recipe implements IComparableRecipe{ //LFTR recipes public static final GT_Recipe_Map sLiquidFluorineThoriumReactorRecipes = new GT_Recipe_Map(new HashSet(50), "gt.recipe.lftr", "Liquid Fluoride Thorium Reactor", null, RES_PATH_GUI + "basicmachines/LFTR", 0, 0, 0, 2, 1, "Start: ", 1, " EU", true, true); + public static final GT_Recipe_Map sLiquidFluorineThoriumReactorRecipesEx = new GT_Recipe_Map(new NoConflictGTRecipeMap(), "gt.recipe.lftr.2", "Liquid Fluoride Thorium Reactor", null, RES_PATH_GUI + "basicmachines/LFTR", 0, 0, 0, 2, 1, "Start: ", 1, " EU", true, true); + //Fission Fuel Plant Recipes //public static final GT_Recipe_Map sFissionFuelProcessing = new GT_Recipe_Map(new HashSet(50), "gt.recipe.fissionfuel", "Fission Fuel Processing", null, RES_PATH_GUI + "basicmachines/LFTR", 0, 0, 0, 9, 1, E, 1, E, true, true); diff --git a/src/Java/gtPlusPlus/GTplusplus.java b/src/Java/gtPlusPlus/GTplusplus.java index 373396f9d5..f80e316b9d 100644 --- a/src/Java/gtPlusPlus/GTplusplus.java +++ b/src/Java/gtPlusPlus/GTplusplus.java @@ -45,7 +45,6 @@ import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtTools; import gtPlusPlus.xmod.gregtech.loaders.GT_Material_Loader; import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_BlastSmelterGT_GTNH; -import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_Recycling; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; @@ -324,7 +323,7 @@ public class GTplusplus implements ActionListener { //GTNH Beta Testers mBetaTestCapes.put(new Pair("bartimaeusnek", "578c2d13-9358-4ae8-95e7-a30ab9f9f3c7")); - //mBetaTestCapes.put(new Pair("cantankerousrex", "")); + mBetaTestCapes.put(new Pair("Prewf", "634433ec-6256-44aa-97b3-a615be18ce23")); //mBetaTestCapes.put(new Pair("cantankerousrex", "")); //mBetaTestCapes.put(new Pair("cantankerousrex", "")); //mBetaTestCapes.put(new Pair("cantankerousrex", "")); diff --git a/src/Java/gtPlusPlus/api/objects/data/AutoMap.java b/src/Java/gtPlusPlus/api/objects/data/AutoMap.java index 7ffa2deb42..b3762dd243 100644 --- a/src/Java/gtPlusPlus/api/objects/data/AutoMap.java +++ b/src/Java/gtPlusPlus/api/objects/data/AutoMap.java @@ -9,6 +9,7 @@ public class AutoMap implements Iterable, Cloneable, Serializable { * The Internal Map */ protected final Map mInternalMap; + protected final Map mInternalNameMap; /** * The Internal ID @@ -23,6 +24,7 @@ public class AutoMap implements Iterable, Cloneable, Serializable { public AutoMap(Map defaultMapType) { mInternalMap = defaultMapType; + mInternalNameMap = new HashMap(); } @Override @@ -46,6 +48,7 @@ public class AutoMap implements Iterable, Cloneable, Serializable { } public synchronized V set(V object){ + mInternalNameMap.put(""+object.hashCode(), (mInternalID+1)); return mInternalMap.put(mInternalID++, object); } @@ -93,5 +96,12 @@ public class AutoMap implements Iterable, Cloneable, Serializable { public synchronized final int getInternalID() { return mInternalID; } + + public synchronized final boolean remove(V value) { + if (this.mInternalMap.containsValue(value)) { + return this.mInternalMap.remove(mInternalNameMap.get(""+value.hashCode()), value); + } + return false; + } } diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/NoConflictGTRecipeMap.java b/src/Java/gtPlusPlus/api/objects/minecraft/NoConflictGTRecipeMap.java index 0aeaedb01d..78e925fe04 100644 --- a/src/Java/gtPlusPlus/api/objects/minecraft/NoConflictGTRecipeMap.java +++ b/src/Java/gtPlusPlus/api/objects/minecraft/NoConflictGTRecipeMap.java @@ -1,13 +1,14 @@ package gtPlusPlus.api.objects.minecraft; import java.util.Collection; +import java.util.Iterator; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_Recipe; import gtPlusPlus.api.objects.data.AutoMap; -public class NoConflictGTRecipeMap { +public class NoConflictGTRecipeMap implements Collection { private AutoMap mRecipeCache = new AutoMap(); private final IGregTechTileEntity mMachineType; @@ -15,25 +16,108 @@ public class NoConflictGTRecipeMap { public NoConflictGTRecipeMap () { this(null); } - + public NoConflictGTRecipeMap (IGregTechTileEntity tile0) { this.mMachineType = tile0; } public boolean put(GT_Recipe recipe) { return add(recipe); } - + public boolean add(GT_Recipe recipe) { return mRecipeCache.setValue(recipe); } - + public Collection getRecipeMap() { return mRecipeCache.values(); } - + public boolean isMapValidForMachine(IGregTechTileEntity tile) { return tile == mMachineType; } + @Override + public boolean addAll(Collection arg0) { + int a = 0; + for (Object v : arg0) { + if (!this.mRecipeCache.containsValue((GT_Recipe) v)) { + this.mRecipeCache.put((GT_Recipe) v); + a++; + } + } + return a > 0; + } + + @Override + public void clear() { + mRecipeCache.clear(); + } + + @Override + public boolean contains(Object arg0) { + return mRecipeCache.containsValue((GT_Recipe) arg0); + } + + @Override + public boolean containsAll(Collection arg0) { + int a = 0; + for (Object v : arg0) { + if (this.mRecipeCache.containsValue((GT_Recipe) v)) { + a++; + } + } + return a == arg0.size(); + } + + @Override + public boolean isEmpty() { + return mRecipeCache.isEmpty(); + } + + @Override + public Iterator iterator() { + return mRecipeCache.iterator(); + } + + @Override + public boolean remove(Object arg0) { + return mRecipeCache.remove((GT_Recipe) arg0); + } + + @Override + public boolean removeAll(Collection arg0) { + int a = 0; + for (Object v : arg0) { + if (this.mRecipeCache.containsValue((GT_Recipe) v)) { + this.mRecipeCache.remove((GT_Recipe) v); + a++; + } + } + return a > 0; + } + + @Override + public boolean retainAll(Collection arg0) { + int mStartSize = this.mRecipeCache.size(); + this.mRecipeCache = (AutoMap) arg0; + int mEndsize = this.mRecipeCache.size(); + return mStartSize != mEndsize; + } + + @Override + public int size() { + return this.mRecipeCache.size(); + } + + @Override + public Object[] toArray() { + return this.mRecipeCache.toArray(); + } + + @Override + public T[] toArray(T[] arg0) { + return (T[]) this.mRecipeCache.toArray(); + } + } diff --git a/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java b/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java index f3b40a7214..aac26418b0 100644 --- a/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java +++ b/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java @@ -15,6 +15,7 @@ import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.core.util.minecraft.ItemUtils; import net.minecraftforge.event.entity.living.LivingDropsEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.world.BlockEvent; @@ -114,13 +115,17 @@ public class BlockEventHandler { ArrayList mBlockTypes = new ArrayList(); if (!oreLimestone.isEmpty()){ for (int i=0;i