diff options
author | bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> | 2019-12-02 22:04:20 +0100 |
---|---|---|
committer | Daniel <daniel112092@gmail.com> | 2019-12-02 22:04:20 +0100 |
commit | 1d3caaf08b6be1f545dce06656f61c1d132efc1c (patch) | |
tree | 5f9d83f35d9a7b9f391eeb6f5d8bbb38e62495e7 /src/main/java/gregtech/common/GT_Proxy.java | |
parent | 330eeb88b0227f60144ed59b28f017f00d520291 (diff) | |
download | GT5-Unofficial-1d3caaf08b6be1f545dce06656f61c1d132efc1c.tar.gz GT5-Unofficial-1d3caaf08b6be1f545dce06656f61c1d132efc1c.tar.bz2 GT5-Unofficial-1d3caaf08b6be1f545dce06656f61c1d132efc1c.zip |
improved loading times a lot (#211)
* improved loading times a lot
+ whitelisted only a few materials that really get changed with gt
+ code maintenance
+ tested and ready for shipping
Signed-off-by: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com>
* improved readability
Signed-off-by: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com>
* improved loading times by buffing recipes
+ buffer increases performance by another ~40%
Signed-off-by: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com>
* Fixed breaking bug
+ added a config option to disable material whitelist
Signed-off-by: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com>
Diffstat (limited to 'src/main/java/gregtech/common/GT_Proxy.java')
-rw-r--r-- | src/main/java/gregtech/common/GT_Proxy.java | 64 |
1 files changed, 34 insertions, 30 deletions
diff --git a/src/main/java/gregtech/common/GT_Proxy.java b/src/main/java/gregtech/common/GT_Proxy.java index f99d4083c9..6b98488ee5 100644 --- a/src/main/java/gregtech/common/GT_Proxy.java +++ b/src/main/java/gregtech/common/GT_Proxy.java @@ -21,7 +21,10 @@ 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.*; +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.util.*; import gregtech.common.entities.GT_Entity_Arrow; import gregtech.common.gui.GT_ContainerVolumetricFlask; @@ -171,6 +174,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { public boolean mHideRecyclingRecipes = true; public boolean mPollution = true; public boolean mExplosionItemDrop = false; + public boolean mUseGreatlyShrukenReplacementList = true; public int mSkeletonsShootGTArrows = 16; public int mMaxEqualEntitiesAtOneSpot = 3; public int mFlintChance = 30; @@ -246,7 +250,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { 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, new Object[]{aOre.mEvent.Ore})); + 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."); @@ -344,7 +348,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { ItemList.IC2_Hops.set(GT_ModHandler.getIC2Item("hops", 1L)); ItemList.IC2_Resin.set(GT_ModHandler.getIC2Item("resin", 1L)); ItemList.IC2_Plantball.set(GT_ModHandler.getIC2Item("plantBall", 1L)); - ItemList.IC2_PlantballCompressed.set(GT_ModHandler.getIC2Item("compressedPlantBall", 1L, ItemList.IC2_Plantball.get(1L, new Object[0]))); + ItemList.IC2_PlantballCompressed.set(GT_ModHandler.getIC2Item("compressedPlantBall", 1L, ItemList.IC2_Plantball.get(1L))); ItemList.IC2_Crop_Seeds.set(GT_ModHandler.getIC2Item("cropSeed", 1L)); ItemList.IC2_Grin_Powder.set(GT_ModHandler.getIC2Item("grinPowder", 1L)); ItemList.IC2_Energium_Dust.set(GT_ModHandler.getIC2Item("energiumDust", 1L)); @@ -393,11 +397,11 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { ItemList.Food_Baked_Potato.set(new ItemStack(Items.baked_potato, 1, 0)); ItemList.Food_Poisonous_Potato.set(new ItemStack(Items.poisonous_potato, 1, 0)); - OrePrefixes.bottle.mContainerItem = ItemList.Bottle_Empty.get(1L, new Object[0]); + OrePrefixes.bottle.mContainerItem = ItemList.Bottle_Empty.get(1L); OrePrefixes.bucket.mContainerItem = new ItemStack(Items.bucket, 1); - OrePrefixes.cellPlasma.mContainerItem = ItemList.Cell_Empty.get(1L, new Object[0]); - OrePrefixes.cellMolten.mContainerItem = ItemList.Cell_Empty.get(1L, new Object[0]); - OrePrefixes.cell.mContainerItem = ItemList.Cell_Empty.get(1L, new Object[0]); + OrePrefixes.cellPlasma.mContainerItem = ItemList.Cell_Empty.get(1L); + OrePrefixes.cellMolten.mContainerItem = ItemList.Cell_Empty.get(1L); + OrePrefixes.cell.mContainerItem = ItemList.Cell_Empty.get(1L); GregTech_API.sFrostHazmatList.add(GT_ModHandler.getIC2Item("hazmatHelmet", 1L, 32767)); GregTech_API.sFrostHazmatList.add(GT_ModHandler.getIC2Item("hazmatChestplate", 1L, 32767)); @@ -435,8 +439,8 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { GT_ModHandler.sNonReplaceableItems.add(new ItemStack(Items.bow, 1, 32767)); GT_ModHandler.sNonReplaceableItems.add(new ItemStack(Items.fishing_rod, 1, 32767)); - GT_ModHandler.sNonReplaceableItems.add(ItemList.IC2_ForgeHammer.getWithDamage(1L, 32767L, new Object[0])); - GT_ModHandler.sNonReplaceableItems.add(ItemList.IC2_WireCutter.getWithDamage(1L, 32767L, new Object[0])); + GT_ModHandler.sNonReplaceableItems.add(ItemList.IC2_ForgeHammer.getWithDamage(1L, 32767L)); + GT_ModHandler.sNonReplaceableItems.add(ItemList.IC2_WireCutter.getWithDamage(1L, 32767L)); GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getIC2Item("painter", 1L, 32767)); GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getIC2Item("blackPainter", 1L, 32767)); GT_ModHandler.sNonReplaceableItems.add(GT_ModHandler.getIC2Item("redPainter", 1L, 32767)); @@ -528,8 +532,8 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { new Thread(new GT_PlayerActivityLogger()).start(); } GregTech_API.sPostloadStarted = true; - GT_OreDictUnificator.addItemData(new ItemStack(Items.iron_door, 1), new ItemData(Materials.Iron, 21772800L, new MaterialStack[0])); - GT_OreDictUnificator.addItemData(new ItemStack(Items.wooden_door, 1, 32767), new ItemData(Materials.Wood, 21772800L, new MaterialStack[0])); + GT_OreDictUnificator.addItemData(new ItemStack(Items.iron_door, 1), new ItemData(Materials.Iron, 21772800L)); + GT_OreDictUnificator.addItemData(new ItemStack(Items.wooden_door, 1, 32767), new ItemData(Materials.Wood, 21772800L)); for (FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) { if ((tData.filledContainer.getItem() == Items.potionitem) && (tData.filledContainer.getItemDamage() == 0)) { tData.fluid.amount = 0; @@ -728,7 +732,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { if ((this.mSkeletonsShootGTArrows > 0) && (aEvent.entity.getClass() == EntityArrow.class) && (aEvent.entity.worldObj.rand.nextInt(this.mSkeletonsShootGTArrows) == 0) && ((((EntityArrow) aEvent.entity).shootingEntity instanceof EntitySkeleton))) { - aEvent.entity.worldObj.spawnEntityInWorld(new GT_Entity_Arrow((EntityArrow) aEvent.entity, (ItemStack) OrePrefixes.arrowGtWood.mPrefixedItems + aEvent.entity.worldObj.spawnEntityInWorld(new GT_Entity_Arrow((EntityArrow) aEvent.entity, OrePrefixes.arrowGtWood.mPrefixedItems .get(aEvent.entity.worldObj.rand.nextInt(OrePrefixes.arrowGtWood.mPrefixedItems.size())))); aEvent.entity.setDead(); } @@ -928,7 +932,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { } else if (aEvent.Name.contains(" ")) { GT_Log.ore.println(tModToName + " is getting re-registered because the OreDict Name containing invalid spaces."); - GT_OreDictUnificator.registerOre(aEvent.Name.replaceAll(" ", ""), GT_Utility.copyAmount(1L, new Object[]{aEvent.Ore})); + GT_OreDictUnificator.registerOre(aEvent.Name.replaceAll(" ", ""), GT_Utility.copyAmount(1L, aEvent.Ore)); aEvent.Ore.setStackDisplayName("Invalid OreDictionary Tag"); return; } @@ -979,7 +983,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { return; } if (!aPrefix.isIgnored(aMaterial)) { - aPrefix.add(GT_Utility.copyAmount(1L, new Object[]{aEvent.Ore})); + aPrefix.add(GT_Utility.copyAmount(1L, aEvent.Ore)); } if (aMaterial != Materials._NULL) { Materials tReRegisteredMaterial; @@ -987,7 +991,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { tReRegisteredMaterial, aEvent.Ore)) { tReRegisteredMaterial = (Materials) i$.next(); } - aMaterial.add(GT_Utility.copyAmount(1L, new Object[]{aEvent.Ore})); + aMaterial.add(GT_Utility.copyAmount(1L, aEvent.Ore)); if (GregTech_API.sThaumcraftCompat != null && aPrefix.doGenerateItem(aMaterial) && !aPrefix.isIgnored(aMaterial)) { List<TC_AspectStack> tAspects = new ArrayList<TC_AspectStack>(); @@ -1133,11 +1137,11 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { return; } } else { - aPrefix.add(GT_Utility.copyAmount(1L, new Object[]{aEvent.Ore})); + aPrefix.add(GT_Utility.copyAmount(1L, aEvent.Ore)); } } } else if (aPrefix.mIsSelfReferencing) { - aPrefix.add(GT_Utility.copyAmount(1L, new Object[]{aEvent.Ore})); + aPrefix.add(GT_Utility.copyAmount(1L, aEvent.Ore)); } else { GT_Log.ore.println(tModToName + " uses a Prefix as full OreDict Name, and is therefor invalid."); aEvent.Ore.setStackDisplayName("Invalid OreDictionary Tag"); @@ -1157,12 +1161,12 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { break; case plank: if (tName.equals("Wood")) { - GT_OreDictUnificator.addItemData(aEvent.Ore, new ItemData(Materials.Wood, 3628800L, new MaterialStack[0])); + GT_OreDictUnificator.addItemData(aEvent.Ore, new ItemData(Materials.Wood, 3628800L)); } break; case slab: if (tName.equals("Wood")) { - GT_OreDictUnificator.addItemData(aEvent.Ore, new ItemData(Materials.Wood, 1814400L, new MaterialStack[0])); + GT_OreDictUnificator.addItemData(aEvent.Ore, new ItemData(Materials.Wood, 1814400L)); } break; case sheet: @@ -1262,7 +1266,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { if (((tEntity instanceof EntityItem)) && (this.mItemDespawnTime != 6000) && (((EntityItem) tEntity).lifespan == 6000)) { ((EntityItem) tEntity).lifespan = this.mItemDespawnTime; } else if (((tEntity instanceof EntityLivingBase)) && (this.mMaxEqualEntitiesAtOneSpot > 0) && (!(tEntity instanceof EntityPlayer)) - && (((EntityLivingBase) tEntity).canBePushed()) && (((EntityLivingBase) tEntity).getHealth() > 0.0F)) { + && (tEntity.canBePushed()) && (((EntityLivingBase) tEntity).getHealth() > 0.0F)) { List tList = tEntity.worldObj.getEntitiesWithinAABBExcludingEntity(tEntity, tEntity.boundingBox.expand(0.20000000298023224D, 0.0D, 0.20000000298023224D)); Class tClass = tEntity.getClass(); @@ -1571,7 +1575,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { } int rFuelValue = 0; if ((aFuel.getItem() instanceof GT_MetaGenerated_Item)) { - Short tFuelValue = (Short) ((GT_MetaGenerated_Item) aFuel.getItem()).mBurnValues.get(Short.valueOf((short) aFuel.getItemDamage())); + Short tFuelValue = ((GT_MetaGenerated_Item) aFuel.getItem()).mBurnValues.get(Short.valueOf((short) aFuel.getItemDamage())); if (tFuelValue != null) { rFuelValue = Math.max(rFuelValue, tFuelValue.shortValue()); } @@ -1674,10 +1678,10 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { rFuelValue = Math.max(rFuelValue, 600); } else if (GT_Utility.areStacksEqual(aFuel, new ItemStack(Items.wooden_door, 1))) { rFuelValue = Math.max(rFuelValue, 600); - } else if (GT_Utility.areStacksEqual(aFuel, ItemList.Block_MSSFUEL.get(1, new Object[0]))) { + } else if (GT_Utility.areStacksEqual(aFuel, ItemList.Block_MSSFUEL.get(1))) { rFuelValue = Math.max(rFuelValue, 150000); } - if (GT_Utility.areStacksEqual(aFuel, ItemList.Block_SSFUEL.get(1, new Object[0]))) { + if (GT_Utility.areStacksEqual(aFuel, ItemList.Block_SSFUEL.get(1))) { rFuelValue = Math.max(rFuelValue, 100000); } @@ -1685,28 +1689,28 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { } public Fluid addAutoGeneratedCorrespondingFluid(Materials aMaterial){ - return addFluid(aMaterial.mName.toLowerCase(Locale.ENGLISH), "molten.autogenerated", aMaterial.mDefaultLocalName, aMaterial, - aMaterial.mRGBa, 1, aMaterial.getLiquidTemperature(), GT_OreDictUnificator.get(OrePrefixes.cell, aMaterial, 1L), ItemList.Cell_Empty.get(1L, new Object[0]), 1000); + return addFluid(aMaterial.mName.toLowerCase(Locale.ENGLISH), "molten.autogenerated", aMaterial.mDefaultLocalName, aMaterial, + aMaterial.mRGBa, 1, aMaterial.getLiquidTemperature(), GT_OreDictUnificator.get(OrePrefixes.cell, aMaterial, 1L), ItemList.Cell_Empty.get(1L), 1000); } public Fluid addAutoGeneratedCorrespondingGas(Materials aMaterial) { - return addFluid(aMaterial.mName.toLowerCase(Locale.ENGLISH), "molten.autogenerated", aMaterial.mDefaultLocalName, aMaterial, - aMaterial.mRGBa, 2, aMaterial.getGasTemperature(), GT_OreDictUnificator.get(OrePrefixes.cell, aMaterial, 1L), ItemList.Cell_Empty.get(1L, new Object[0]), 1000); + return addFluid(aMaterial.mName.toLowerCase(Locale.ENGLISH), "molten.autogenerated", aMaterial.mDefaultLocalName, aMaterial, + aMaterial.mRGBa, 2, aMaterial.getGasTemperature(), GT_OreDictUnificator.get(OrePrefixes.cell, aMaterial, 1L), ItemList.Cell_Empty.get(1L), 1000); } public Fluid addAutogeneratedMoltenFluid(Materials aMaterial) { return addFluid("molten." + aMaterial.mName.toLowerCase(Locale.ENGLISH), "molten.autogenerated", "Molten " + aMaterial.mDefaultLocalName, aMaterial, - aMaterial.mMoltenRGBa, 4, aMaterial.mMeltingPoint <= 0 ? 1000 : aMaterial.mMeltingPoint, GT_OreDictUnificator.get(OrePrefixes.cellMolten, aMaterial, 1L), ItemList.Cell_Empty.get(1L, new Object[0]), 144); + aMaterial.mMoltenRGBa, 4, aMaterial.mMeltingPoint <= 0 ? 1000 : aMaterial.mMeltingPoint, GT_OreDictUnificator.get(OrePrefixes.cellMolten, aMaterial, 1L), ItemList.Cell_Empty.get(1L), 144); } public Fluid addAutogeneratedWetFluid(Materials aMaterial) { return addFluid("wet." + aMaterial.mName.toLowerCase(Locale.ENGLISH), "wet.autogenerated", "Wet " + aMaterial.mDefaultLocalName, aMaterial, - aMaterial.mMoltenRGBa, 4, aMaterial.mMeltingPoint <= 0 ? 1000 : aMaterial.mMeltingPoint, GT_OreDictUnificator.get(OrePrefixes.cell, aMaterial, 1L), ItemList.Cell_Empty.get(1L, new Object[0]), 144); + aMaterial.mMoltenRGBa, 4, aMaterial.mMeltingPoint <= 0 ? 1000 : aMaterial.mMeltingPoint, GT_OreDictUnificator.get(OrePrefixes.cell, aMaterial, 1L), ItemList.Cell_Empty.get(1L), 144); } public Fluid addAutogeneratedPlasmaFluid(Materials aMaterial) { return addFluid("plasma." + aMaterial.mName.toLowerCase(Locale.ENGLISH), "plasma.autogenerated", aMaterial.mDefaultLocalName + " Plasma", aMaterial, - aMaterial.mMoltenRGBa, 3, 10000, GT_OreDictUnificator.get(OrePrefixes.cellPlasma, aMaterial, 1L), ItemList.Cell_Empty.get(1L, new Object[0]), 1000); + aMaterial.mMoltenRGBa, 3, 10000, GT_OreDictUnificator.get(OrePrefixes.cellPlasma, aMaterial, 1L), ItemList.Cell_Empty.get(1L), 1000); } public void addAutoGeneratedHydroCrackedFluids(Materials aMaterial){ |