diff options
Diffstat (limited to 'src/main/java/gregtech/common')
4 files changed, 70 insertions, 73 deletions
diff --git a/src/main/java/gregtech/common/GT_Proxy.java b/src/main/java/gregtech/common/GT_Proxy.java index 3b668d805d..d21491adea 100644 --- a/src/main/java/gregtech/common/GT_Proxy.java +++ b/src/main/java/gregtech/common/GT_Proxy.java @@ -9,6 +9,7 @@ import cpw.mods.fml.common.network.IGuiHandler; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.registry.GameRegistry; import forestry.api.genetics.AlleleManager; +import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.*; import gregtech.api.enums.TC_Aspects.TC_AspectStack; @@ -21,11 +22,7 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.items.GT_MetaGenerated_Item; import gregtech.api.items.GT_MetaGenerated_Tool; import gregtech.api.net.GT_Packet_Pollution; -import gregtech.api.objects.GT_Fluid; -import gregtech.api.objects.GT_FluidStack; -import gregtech.api.objects.GT_UO_DimensionList; -import gregtech.api.objects.ItemData; -import gregtech.api.objects.GT_ChunkManager; +import gregtech.api.objects.*; import gregtech.api.util.*; import gregtech.common.entities.GT_Entity_Arrow; import gregtech.common.gui.GT_ContainerVolumetricFlask; @@ -81,10 +78,9 @@ import net.minecraftforge.oredict.RecipeSorter; import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapelessOreRecipe; import org.apache.commons.lang3.text.WordUtils; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import java.io.File; +import java.lang.reflect.InvocationTargetException; import java.text.DateFormat; import java.util.*; @@ -244,22 +240,6 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { } catch (Throwable e) {e.printStackTrace(GT_Log.err);} } - private static final void registerRecipes(OreDictEventContainer aOre) { - if ((aOre.mEvent.Ore == null) || (aOre.mEvent.Ore.getItem() == null)) { - return; - } - if (aOre.mEvent.Ore.stackSize != 1) { - aOre.mEvent.Ore.stackSize = 1; - } - if (aOre.mPrefix != null) { - if (!aOre.mPrefix.isIgnored(aOre.mMaterial)) { - aOre.mPrefix.processOre(aOre.mMaterial == null ? Materials._NULL : aOre.mMaterial, aOre.mEvent.Name, aOre.mModID, - GT_Utility.copyAmount(1L, aOre.mEvent.Ore)); - } - } else { -// GT_FML_LOGGER.info("Thingy Name: "+ aOre.mEvent.Name+ " !!!Unknown 'Thingy' detected!!! This Object seems to probably not follow a valid OreDictionary Convention, or I missed a Convention. Please report to GregTech Intergalactical for additional compatiblity. This is not an Error, an Issue nor a Lag Source, it is just an Information, which you should pass to me."); - } - } public void onPreLoad() { GT_Log.out.println("GT_Mod: Preload-Phase started!"); @@ -1221,6 +1201,23 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { e.printStackTrace(GT_Log.err); } } + + public static void stepMaterialsVanilla(Collection<GT_Proxy.OreDictEventContainer> mEvents, ProgressManager.ProgressBar progressBar){ + int size = 5; + int sizeStep = mEvents.size() / 20 - 1; + GT_Proxy.OreDictEventContainer tEvent; + for (Iterator<GT_Proxy.OreDictEventContainer> i$ = mEvents.iterator(); i$.hasNext(); GT_Proxy.registerRecipes(tEvent)) { + tEvent = i$.next(); + sizeStep--; + if(sizeStep == 0) { + GT_Mod.GT_FML_LOGGER.info("Baking : " + size + "%", new Object[0]); + sizeStep = mEvents.size()/20-1; + size += 5; + } + progressBar.step(tEvent.mMaterial == null ? "" : tEvent.mMaterial.toString()); + } + ProgressManager.pop(progressBar); + } @SubscribeEvent public void onLivingUpdate(LivingUpdateEvent aEvent) { @@ -1317,6 +1314,22 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { } } + public static void registerRecipes(GT_Proxy.OreDictEventContainer aOre) { + if ((aOre.mEvent.Ore == null) || (aOre.mEvent.Ore.getItem() == null)) { + return; + } + if (aOre.mEvent.Ore.stackSize != 1) { + aOre.mEvent.Ore.stackSize = 1; + } + if (aOre.mPrefix != null) { + if (!aOre.mPrefix.isIgnored(aOre.mMaterial)) { + aOre.mPrefix.processOre(aOre.mMaterial == null ? Materials._NULL : aOre.mMaterial, aOre.mEvent.Name, aOre.mModID, GT_Utility.copyAmount(1L, aOre.mEvent.Ore)); + } + } else { +// GT_FML_LOGGER.info("Thingy Name: "+ aOre.mEvent.Name+ " !!!Unknown 'Thingy' detected!!! This Object seems to probably not follow a valid OreDictionary Convention, or I missed a Convention. Please report to GregTech Intergalactical for additional compatiblity. This is not an Error, an Issue nor a Lag Source, it is just an Information, which you should pass to me."); + } + } + @SubscribeEvent public void onPlayerTickEventServer(TickEvent.PlayerTickEvent aEvent) { if ((aEvent.side.isServer()) && (aEvent.phase == TickEvent.Phase.END) && (!aEvent.player.isDead)) { @@ -1926,26 +1939,20 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { GT_Recipe.reInit(); } + @SuppressWarnings("deprecation") public void activateOreDictHandler() { - final Logger GT_FML_LOGGER = LogManager.getLogger("GregTech GTNH"); - this.mOreDictActivated = true; ProgressManager.ProgressBar progressBar = ProgressManager.push("Register materials", mEvents.size()); - int sizeStep = mEvents.size()/20-1; - int size = 5; - OreDictEventContainer tEvent; - for (Iterator i$ = this.mEvents.iterator(); i$.hasNext(); registerRecipes(tEvent)) { - tEvent = (OreDictEventContainer) i$.next(); - sizeStep--; - progressBar.step(tEvent.mMaterial == null ? "" : tEvent.mMaterial.toString()); - if( sizeStep == 0 ) - { - GT_FML_LOGGER.info("Baking : " + size + "%", new Object[0]); - sizeStep = mEvents.size()/20-1; - size += 5; - } + if (Loader.isModLoaded("betterloadingscreen")){ + GT_Values.cls_enabled = true; + try { + GT_CLS_Compat.stepMaterialsCLS(mEvents, progressBar); + } catch (IllegalAccessException | InvocationTargetException e) { + GT_Mod.GT_FML_LOGGER.catching(e); + } } - ProgressManager.pop(progressBar); + else + GT_Proxy.stepMaterialsVanilla(this.mEvents,progressBar); } public static final HashMap<Integer,HashMap<ChunkCoordIntPair,int []>> dimensionWiseChunkData = new HashMap<>(16);//stores chunk data that is loaded/saved diff --git a/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_01.java b/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_01.java index cb1737d665..fabd9432ac 100644 --- a/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_01.java +++ b/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_01.java @@ -305,7 +305,7 @@ public class GT_MetaGenerated_Item_01 extends GT_MetaGenerated_Item_X32 { GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Aluminium, 4L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Silver, 4L), ItemList.Large_Fluid_Cell_Aluminium.get(1L, new Object[0]), 200, 64); - ItemList.Large_Fluid_Cell_StainlessSteel.set(addItem(tLastID = 408, "Large StainlessSteel Fluid Cell", "", new Object[]{new ItemData(Materials.StainlessSteel, OrePrefixes.plateDouble.mMaterialAmount * 4L, new MaterialStack(Materials.Electrum, OrePrefixes.ring.mMaterialAmount * 4L)), new TC_Aspects.TC_AspectStack(TC_Aspects.VACUOS, 6L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 4L)})); + ItemList.Large_Fluid_Cell_StainlessSteel.set(addItem(tLastID = 408, "Large Stainless Steel Fluid Cell", "", new Object[]{new ItemData(Materials.StainlessSteel, OrePrefixes.plateDouble.mMaterialAmount * 4L, new MaterialStack(Materials.Electrum, OrePrefixes.ring.mMaterialAmount * 4L)), new TC_Aspects.TC_AspectStack(TC_Aspects.VACUOS, 6L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 4L)})); setFluidContainerStats(32000 + tLastID, 64000L, 64L); GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.StainlessSteel, 4L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Electrum, 4L), ItemList.Large_Fluid_Cell_StainlessSteel.get(1L, new Object[0]), 200, 120); diff --git a/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_03.java b/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_03.java index 682f04bf57..f0cb4024d5 100644 --- a/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_03.java +++ b/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_03.java @@ -58,7 +58,10 @@ public class GT_MetaGenerated_Item_03 ItemList.Circuit_Parts_GlassFiber.set(addItem(tLastID = 21, "Glass Fiber", Materials.BorosilicateGlass.mChemicalFormula, o)); ItemList.Circuit_Parts_PetriDish.set(addItem(tLastID = 22, "Petri Dish", "For cultivating cells", o)); ItemList.Circuit_Parts_Reinforced_Glass_Tube.set(addItem(tLastID = 23, "Reinforced Glass Tube", "", o)); -// + ItemList.Circuit_Parts_ResistorASMD.set(addItem(tLastID = 24, "Advanced SMD Resistor", "Advanced Electronic Component", o)); + ItemList.Circuit_Parts_DiodeASMD.set(addItem(tLastID = 25, "Advanced SMD Diode", "Advanced Electronic Component", o)); + ItemList.Circuit_Parts_TransistorASMD.set(addItem(tLastID = 26, "Advanced SMD Transistor", "Advanced Electronic Component", o)); + ItemList.Circuit_Parts_CapacitorASMD.set(addItem(tLastID = 27, "Advanced SMD Capacitor", "Advanced Electronic Component", o)); /** * ICs diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java index 5c0e2cbf25..46ea555ad0 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java @@ -103,12 +103,12 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba this.ready = false; // prospecting ores - HashMap<String, Integer> tOres = new HashMap<String, Integer>(36); + HashMap<String, Integer> tOres = new HashMap<>(36); prospectOres(tOres); // prospecting oils - ArrayList<String> tOils = new ArrayList<String>(); + ArrayList<String> tOils = new ArrayList<>(); prospectOils(tOils); GT_Utility.ItemNBT.setAdvancedProspectionData(mTier, @@ -128,30 +128,31 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba private void prospectOils(ArrayList<String> aOils) { - FluidStack tFluid; - - Chunk tChunk = getBaseMetaTileEntity().getWorld().getChunkFromBlockCoords(getBaseMetaTileEntity().getXCoord(), getBaseMetaTileEntity().getZCoord()); - int oilfieldSize = 8; - int xChunk = Math.floorDiv(tChunk.xPosition , oilfieldSize) * oilfieldSize - ((tChunk.xPosition < 0 && tChunk.xPosition % oilfieldSize != 0) ? oilfieldSize : 0); - int zChunk = Math.floorDiv(tChunk.zPosition , oilfieldSize) * oilfieldSize - ((tChunk.zPosition < 0 && tChunk.zPosition % oilfieldSize != 0) ? oilfieldSize : 0); + int xChunk = (getBaseMetaTileEntity().getXCoord() >> 7) << 3; // oil field aligned chunk coords + int zChunk = (getBaseMetaTileEntity().getZCoord() >> 7) << 3; LinkedHashMap<ChunkCoordIntPair, FluidStack> tFluids = new LinkedHashMap<>(); int oilFieldCount = 0; try { + final int oilfieldSize = 8; for (int z = -1; z <= 1; ++z) { for (int x = -1; x <= 1; ++x) { - ChunkCoordIntPair cInts = getBaseMetaTileEntity().getWorld().getChunkFromChunkCoords(x, z).getChunkCoordIntPair(); - ArrayList<Integer> minMaxValue = new ArrayList<>(); + ChunkCoordIntPair cInts = new ChunkCoordIntPair(x, z); + int min = Integer.MAX_VALUE; + int max = Integer.MIN_VALUE; for (int i = 0; i < oilfieldSize; i++) { for (int j = 0; j < oilfieldSize; j++) { - tChunk = getBaseMetaTileEntity().getWorld().getChunkFromChunkCoords( + Chunk tChunk = getBaseMetaTileEntity().getWorld().getChunkFromChunkCoords( xChunk + i + x * oilfieldSize, zChunk + j + z * oilfieldSize); - tFluid = undergroundOilReadInformation(tChunk); + FluidStack tFluid = undergroundOilReadInformation(tChunk); if (tFluid != null) { - minMaxValue.add(tFluid.amount); + if (tFluid.amount > max) + max = tFluid.amount; + if (tFluid.amount < min) + min = tFluid.amount; if (!tFluids.containsKey(cInts)) { tFluids.put(cInts, tFluid); } @@ -159,20 +160,12 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba } } - int min = Collections.min(minMaxValue); - int max = Collections.max(minMaxValue); aOils.add(++oilFieldCount + "," + min + "-" + max + "," + tFluids.get(cInts).getLocalizedName()); } } - } catch (Exception e) {/*Do nothing*/} + } catch (Exception ignored) {} } - //private void putOil(int x, int z, HashMap<String, Integer> aOils) {//TODO Old method?? - // FluidStack tFluid = GT_Utility.undergroundOil(getBaseMetaTileEntity().getWorld(),x,z,false,0); - // if (tFluid.amount / 5000 > 0) - // aOils.put(x + "," + z + "," + (tFluid.amount / 5000) + "," + tFluid.getLocalizedName(), tFluid.amount / 5000); - //} - private void prospectOres(Map<String, Integer> aOres) { int tLeftXBound = this.getBaseMetaTileEntity().getXCoord() - radius; int tRightXBound = tLeftXBound + 2*radius; @@ -181,20 +174,14 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba int tRightZBound = tLeftZBound + 2*radius; for (int i = tLeftXBound; i <= tRightXBound; i += step) { - if ( (Math.abs(i)/16-1)%3!=0 ) { + if (Math.abs(i >> 4) % 3 != 1) continue; - } for (int k = tLeftZBound; k <= tRightZBound; k += step) { - if ( (Math.abs(k)/16-1)%3!=0 ) { + if (Math.abs(k >> 4) % 3 != 1) continue; - } - - int di = Math.abs(i - this.getBaseMetaTileEntity().getXCoord()); - int dk = Math.abs(k - this.getBaseMetaTileEntity().getZCoord()); - - cX = (Math.floorDiv(i,16))*16; - cZ = (Math.floorDiv(k,16))*16; + cX = (i >> 4) << 4; + cZ = (k >> 4) << 4; String separator = (cX +8)+ "," + (cZ + 8) + " --------"; aOres.put(separator, 1); |