diff --git a/src/main/java/gregtechmod/GT_Mod.java b/src/main/java/gregtechmod/GT_Mod.java index 4b8e418b..525e84d0 100644 --- a/src/main/java/gregtechmod/GT_Mod.java +++ b/src/main/java/gregtechmod/GT_Mod.java @@ -535,9 +535,10 @@ public void preload(FMLPreInitializationEvent aEvent) { new GT_NetworkHandler().run(); new GT_ConnectionHandler().run(); - RecipeSorter.register("gregtechmod:shaped" , GT_Shaped_Recipe.class , RecipeSorter.Category.SHAPED , "after:minecraft:shaped"); - RecipeSorter.register("gregtechmod:shapeless" , GT_Shapeless_Recipe.class , RecipeSorter.Category.SHAPELESS , "after:minecraft:shapeless"); - RecipeSorter.register("gregtechmod:shapeless_nbt_keeping" , GT_Shapeless_NBT_Keeping_Recipe.class , RecipeSorter.Category.SHAPELESS , "after:minecraft:shapeless"); + RecipeSorter.register("gregtech_addon:shaped" , GT_Shaped_Recipe.class , RecipeSorter.Category.SHAPED , "after:forge:shapedore before:minecraft:shapeless"); + RecipeSorter.register("gregtech_addon:shaped_nbt_keeping" , GT_Shapeless_NBT_Keeping_Recipe.class , RecipeSorter.Category.SHAPED , "after:gregtech_addon:shaped before:minecraft:shapeless"); + RecipeSorter.register("gregtech_addon:shapeless" , GT_Shapeless_Recipe.class , RecipeSorter.Category.SHAPELESS , "after:minecraft:shapeless"); + RecipeSorter.register("gregtech_addon:shapeless_nbt_keeping" , GT_Shapeless_NBT_Keeping_Recipe.class , RecipeSorter.Category.SHAPELESS , "after:gregtech_addon:shapeless"); GregTech_API.sPreloadFinished = true; GT_Log.log.info("Preload-Phase finished!"); @@ -896,9 +897,9 @@ public void postload(FMLPostInitializationEvent aEvent) { });} catch(Throwable e) {} */ - @EventHandler - public void start(FMLServerStartingEvent aEvent) { - if(!mDoNotInit) { + @EventHandler + public void start(FMLServerStartingEvent aEvent) { + if (!mDoNotInit) { for (Runnable tRunnable : GregTech_API.sBeforeGTServerstart) { try { tRunnable.run(); @@ -906,31 +907,12 @@ public void start(FMLServerStartingEvent aEvent) { GT_Log.log.catching(e); } } - - mUniverse = null; - GT_TickHandler.isFirstTick = true; - NetworkRegistry.INSTANCE.registerGuiHandler(GregTech_API.gregtechmod, new GT_GUIHandler()); - - try { - for (IMetaTileEntity tMetaTileEntity : GregTech_API.mMetaTileList) { - if (tMetaTileEntity != null) tMetaTileEntity.onServerStart(); - } - } catch(Throwable e) { - GT_Log.log.catching(e); - } - - for (FluidContainerData data : FluidContainerRegistry.getRegisteredFluidContainerData()) { - if (data.filledContainer.getItem() == Items.potionitem) { - data.fluid.amount = 0; - break; - } - } - GT_Log.log.info("ServerStart-Phase started!"); - mUniverse = null; - GT_TickHandler.isFirstTick = true; - NetworkRegistry.INSTANCE.registerGuiHandler(GregTech_API.gregtechmod, new GT_GUIHandler()); - + GT_Log.log.info("ServerStart-Phase started!"); + mUniverse = null; + GT_TickHandler.isFirstTick = true; + NetworkRegistry.INSTANCE.registerGuiHandler(GregTech_API.gregtechmod, new GT_GUIHandler()); + for (IMetaTileEntity mte : GregTech_API.mMetaTileList) { try { if (mte != null) @@ -939,144 +921,12 @@ public void start(FMLServerStartingEvent aEvent) { GT_Log.log.catching(e); } } - -// GT_Log.log.info("Unificating outputs of all known Recipe Types."); -// ArrayList items = new ArrayList(); -// GT_Log.log.info("IC2 Machines"); -// -// for (ic2.api.recipe.RecipeOutput recipeOut : ic2.api.recipe.Recipes.cannerBottle.getRecipes().values()) { -// for (ItemStack recipeItem : recipeOut.items) { -// items.add(recipeItem); -// } -// } -// -// for (ic2.api.recipe.RecipeOutput recipeOut : ic2.api.recipe.Recipes.centrifuge.getRecipes().values()) { -// for (ItemStack recipeItem : recipeOut.items) { -// items.add(recipeItem); -// } -// } -// -// for (ic2.api.recipe.RecipeOutput recipeOut : ic2.api.recipe.Recipes.compressor.getRecipes().values()) { -// for (ItemStack recipeItem : recipeOut.items) { -// items.add(recipeItem); -// } -// } -// -// for (ic2.api.recipe.RecipeOutput recipeOut : ic2.api.recipe.Recipes.extractor.getRecipes().values()) { -// for (ItemStack recipeItem : recipeOut.items) { -// items.add(recipeItem); -// } -// } -// -// for (ic2.api.recipe.RecipeOutput recipeOut : ic2.api.recipe.Recipes.macerator.getRecipes().values()) { -// for (ItemStack recipeItem : recipeOut.items) { -// items.add(recipeItem); -// } -// } -// -// for (ic2.api.recipe.RecipeOutput recipeOut : ic2.api.recipe.Recipes.metalformerCutting.getRecipes().values()) { -// for (ItemStack recipeItem : recipeOut.items) { -// items.add(recipeItem); -// } -// } -// -// for (ic2.api.recipe.RecipeOutput recipeOut : ic2.api.recipe.Recipes.metalformerRolling.getRecipes().values()) { -// for (ItemStack recipeItem : recipeOut.items) { -// items.add(recipeItem); -// } -// } -// -// for (ic2.api.recipe.RecipeOutput recipeOut : ic2.api.recipe.Recipes.matterAmplifier.getRecipes().values()) { -// for (ItemStack recipeItem : recipeOut.items) { -// items.add(recipeItem); -// } -// } -// -// for (ic2.api.recipe.RecipeOutput recipeOut : ic2.api.recipe.Recipes.oreWashing.getRecipes().values()) { -// for (ItemStack recipeItem : recipeOut.items) { -// items.add(recipeItem); -// } -// } -// -// GT_Log.log.info("Dungeon Loot"); -// for (WeightedRandomChestContent chestContent : ChestGenHooks.getInfo("dungeonChest").getItems(new Random())) { -// items.add(chestContent.theItemId); -// } -// -// for (WeightedRandomChestContent chestContent : ChestGenHooks.getInfo("bonusChest").getItems(new Random())) { -// items.add(chestContent.theItemId); -// } -// -// for (WeightedRandomChestContent chestContent : ChestGenHooks.getInfo("villageBlacksmith").getItems(new Random())) { -// items.add(chestContent.theItemId); -// } -// -// for (WeightedRandomChestContent chestContent : ChestGenHooks.getInfo("strongholdCrossing").getItems(new Random())) { -// items.add(chestContent.theItemId); -// } -// -// for (WeightedRandomChestContent chestContent : ChestGenHooks.getInfo("strongholdLibrary").getItems(new Random())) { -// items.add(chestContent.theItemId); -// } -// -// for (WeightedRandomChestContent chestContent : ChestGenHooks.getInfo("strongholdCorridor").getItems(new Random())) { -// items.add(chestContent.theItemId); -// } -// -// for (WeightedRandomChestContent chestContent : ChestGenHooks.getInfo("pyramidJungleDispenser").getItems(new Random())) { -// items.add(chestContent.theItemId); -// } -// -// for (WeightedRandomChestContent chestContent : ChestGenHooks.getInfo("pyramidJungleChest").getItems(new Random())) { -// items.add(chestContent.theItemId); -// } -// -// for (WeightedRandomChestContent chestContent : ChestGenHooks.getInfo("pyramidDesertyChest").getItems(new Random())) { -// items.add(chestContent.theItemId); -// } -// -// for (WeightedRandomChestContent chestContent : ChestGenHooks.getInfo("mineshaftCorridor").getItems(new Random())) { -// items.add(chestContent.theItemId); -// } -// -// GT_Log.log.info("Smelting"); -// @SuppressWarnings("unchecked") -// List furnItems = new ArrayList<>(FurnaceRecipes.smelting().getSmeltingList().values()); -// for (ItemStack item : furnItems) { -// items.add(item); -// } -// -// if(sCraftingUnification) { -// GT_Log.log.info("Crafting Recipes"); -// @SuppressWarnings("unchecked") -// List recipes = CraftingManager.getInstance().getRecipeList(); -// for (IRecipe recipe : recipes) { -// items.add(recipe.getRecipeOutput()); -// } -// } -// -// items.removeIf(item -> item == null); -// for (ItemStack item : items) { -// if (GT_OreDictHandler.instance.mRegisteredStacks.contains(item)) { -// GT_Log.log.error("GT-ERR-01: @ " + item.getUnlocalizedName() + " " + item.getDisplayName()); -// GT_Log.log.error("A Recipe used an OreDict Item as Output directly, without copying it before!!! This is a typical CallByReference/CallByValue Error"); -// GT_Log.log.error("Said Item will be renamed to make the invalid Recipe visible, so that you can report it properly."); -// GT_Log.log.error("Please check all Recipes outputting this Item, and report the Recipes to their Owner."); -// GT_Log.log.error("The Owner of the ==>RECIPE<==, NOT the Owner of the Item, which has been mentioned above!!!"); -// GT_Log.log.error("And ONLY Recipes which are ==>OUTPUTTING<== the Item, sorry but I don\'t want failed Bug Reports."); -// GT_Log.log.error("GregTech just reports this Error to you, so you can report it to the Mod causing the Problem."); -// GT_Log.log.error("Even though I make that Bug visible, I can not and will not fix that for you, that\'s for the causing Mod to fix."); -// GT_Log.log.error("And speaking of failed Reports:"); -// GT_Log.log.error("Both IC2 and GregTech CANNOT be the CAUSE of this Problem, so don\'t report it to either of them."); -// GT_Log.log.error("I REPEAT, BOTH, IC2 and GregTech CANNOT be the source of THIS BUG. NO MATTER WHAT."); -// GT_Log.log.error("Asking in the IC2 Forums, which Mod is causing that won\'t help anyone, since it is not possible to determine, which Mod it is."); -// GT_Log.log.error("If it would be possible, then I would have had added the Mod which is causing it to the Message already. But it is not possible."); -// GT_Log.log.error("Sorry, but this Error is serious enough to justify this Wall-O-Text and the partially Allcapsed Language."); -// item.setStackDisplayName("ERROR! PLEASE CHECK YOUR LOG FOR \'GT-ERR-01\'!"); -// } else { -//// GT_OreDictUnificator.setStack(item); -// } -// } + + for (FluidContainerData data : FluidContainerRegistry.getRegisteredFluidContainerData()) { + if (data.filledContainer.getItem() == Items.potionitem) { + data.fluid.amount = 0; + } + } GT_Log.log.info("ServerStart-Phase finished!"); for (Runnable toRun : GregTech_API.sAfterGTServerstart) { @@ -1086,8 +936,8 @@ public void start(FMLServerStartingEvent aEvent) { GT_Log.log.catching(e); } } - } - } + } + } @EventHandler public void start(FMLServerStartedEvent aEvent) { @@ -1228,18 +1078,12 @@ public void stop(FMLServerStoppingEvent aEvent) { @SubscribeEvent public void onFluidContainerRegistration(FluidContainerRegisterEvent aFluidEvent) { if (this.tNothingRegistered) { - FluidContainerData[] arr$ = FluidContainerRegistry.getRegisteredFluidContainerData(); - int len$ = arr$.length; - - for (int i$ = 0; i$ < len$; ++i$) { - FluidContainerData tData = arr$[i$]; + for (FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) { if (tData.filledContainer.getItem() == Items.potionitem) { tData.fluid.amount = 0; } - - GT_OreDictUnificator.addToBlacklist(tData.filledContainer); } - + this.tNothingRegistered = false; } diff --git a/src/main/java/gregtechmod/common/GT_OreDictHandler.java b/src/main/java/gregtechmod/common/GT_OreDictHandler.java index 6344d13f..98b4f061 100644 --- a/src/main/java/gregtechmod/common/GT_OreDictHandler.java +++ b/src/main/java/gregtechmod/common/GT_OreDictHandler.java @@ -43,7 +43,6 @@ public class GT_OreDictHandler { private final List mIgnoredNames = Arrays.asList(new String[]{"whiteStone", "stoneSlab", "clayBowl", "clayPlate", "ceramicBowl", "ceramicPlate", "ovenRack", "clayCup", "ceramicCup", "batteryBox", "transmutationStone", "torchRedstoneActive", "coal", "charcoal", "cloth", "cobblestoneSlab", "stoneBrickSlab", "cobblestoneWall", "stoneBrickWall", "cobblestoneStair", "stoneBrickStair", "blockCloud", "blockDirt", "blockTyrian", "blockCarpet", "blockFft", "blockLavastone", "blockHolystone", "blockConcrete", "sunnariumPart", "brSmallMachineCyaniteProcessor", "meteoriteCoal", "blockCobble", "pressOreProcessor", "crusherOreProcessor", "grinderOreProcessor", "blockRubber", "blockHoney", "blockHoneydew", "blockPeat", "blockRadioactive", "blockSlime", "blockCocoa", "blockSugarCane", "blockLeather", "blockClayBrick", "solarPanelHV", "cableRedNet", "stoneBowl", "crafterWood", "taintedSoil", "brickXyEngineering", "breederUranium", "wireMill", "chunkLazurite", "aluminumNatural", "aluminiumNatural", "naturalAluminum", "naturalAluminium", "antimatterMilligram", "antimatterGram", "strangeMatter", "coalGenerator", "electricFurnace", "unfinishedTank", "valvePart", "aquaRegia", "leatherSeal", "leatherSlimeSeal", "hambone", "slimeball", "enrichedUranium", "camoPaste"}); private final List mInvalidNames = Arrays.asList(new String[]{"bloodstoneOre", "universalCable", "bronzeTube", "ironTube", "netherTube", "obbyTube", "infiniteBattery", "eliteBattery", "advancedBattery", "10kEUStore", "blueDye", "MonazitOre", "quartzCrystal", "whiteLuminiteCrystal", "darkStoneIngot", "invisiumIngot", "demoniteOrb", "enderGem", "starconiumGem", "osmoniumIngot", "tapaziteGem", "zectiumIngot", "foolsRubyGem", "rubyGem", "meteoriteGem", "adamiteShard", "sapphireGem", "copperIngot", "ironStick", "goldStick", "diamondStick", "reinforcedStick", "draconicStick", "emeraldStick", "copperStick", "tinStick", "silverStick", "bronzeStick", "steelStick", "leadStick", "manyullynStick", "arditeStick", "cobaltStick", "aluminiumStick", "alumiteStick", "oilsandsOre", "copperWire", "superconductorWire", "sulfuricAcid", "conveyorBelt", "ironWire", "aluminumWire", "aluminiumWire", "silverWire", "tinWire", "dustSiliconSmall", "AluminumOre", "plateHeavyT2", "blockWool", "alloyPlateEnergizedHardened", "gasWood", "alloyPlateEnergized", "SilverOre", "LeadOre", "TinOre", "CopperOre", "silverOre", "leadOre", "tinOre", "copperOre", "bauxiteOre", "HSLivingmetalIngot", "oilMoving", "oilStill", "oilBucket", "petroleumOre", "dieselFuel", "diamondNugget", "planks", "wood", "stick", "sticks", "naquadah", "obsidianRod", "stoneRod", "thaumiumRod", "steelRod", "netherrackRod", "woodRod", "ironRod", "cactusRod", "flintRod", "copperRod", "cobaltRod", "alumiteRod", "blueslimeRod", "arditeRod", "manyullynRod", "bronzeRod", "boneRod", "slimeRod"}); private final List mIgnoredPrefixes = Arrays.asList(new String[]{"reactor", "mffs", "projred", "ganys"}); - public final List mRegisteredStacks = new ArrayList<>(); private boolean mActivated = false; @SubscribeEvent @@ -72,7 +71,6 @@ public void registerOre(OreRegisterEvent aEvent) { GT_Log.ore.println(e + " is ambiguous, this is an Error."); GT_Log.log.warn("WARNING: The OreDict-Registration of " + aEvent.Name + " by " + aMod + " is ambiguous. Please check if the Item hasn\'t already been registered under that Name, before registering it a second time!"); } else { - this.mRegisteredStacks.add(aEvent.Ore); if (aEvent.Name.startsWith("item") && this.mIgnoredItems.contains(aEvent.Name)) { GT_Log.ore.println(e); if (aEvent.Name.equals("itemCopperWire")) { @@ -104,7 +102,6 @@ public void registerOre(OreRegisterEvent aEvent) { GT_Log.ore.println(e + " is getting re-registered because the OreDict Name containing invalid spaces."); GT_Log.log.warn("WARNING: \'" + aEvent.Name + "\' is an invalid OreDictionary Name, as it contains spaces! Register it without spaces to fix that."); GT_OreDictUnificator.registerOre(aEvent.Name.replaceAll(" ", ""), GT_Utility.copyAmount(1L, aEvent.Ore)); - aEvent.Ore.setStackDisplayName("Invalid OreDictionary Tag"); } else if(this.mInvalidNames.contains(aEvent.Name)) { GT_Log.ore.println(e + " is wrongly registered and therefor getting ignored."); GT_Log.log.error("WARNING: \'" + aEvent.Name + "\' is an invalid OreDictionary Name. The Name doesn\'t fit to the Type of Item and/or doesn\'t follow a proper OreDictionary Convention. If you are the Owner of the Mod who adds this Item, please do the following: "); @@ -161,7 +158,7 @@ public void registerOre(OreRegisterEvent aEvent) { OrePrefixes aPrefix = OrePrefixes.getOrePrefix(aEvent.Name); String tName = ""; if(aPrefix == null) { - if(aEvent.Name.toLowerCase().equals(aEvent.Name)) { + if(aEvent.Name.toLowerCase().equals(aEvent.Name) && !aEvent.Name.equals("glowstone")) { GT_Log.log.error("Improperly registered Ore: " + aEvent.Name + " !!!Improperly registered Ore detected!!! This Object does not follow any OreDictionary Convention, as it is 100% lowercased!!! Please report this to its Modauthor for a fix. If nothing proper is found, a good suggestion for its Name would be \'" + aMod + ":" + aEvent.Name + "\' don\'t forget to insert the \':\' inbetween the Mod ID and OreDict Name, that is the most important part."); GT_Log.ore.println(e + " is invalid due to being solely lowercased."); return; @@ -396,12 +393,15 @@ public void registerOre(OreRegisterEvent aEvent) { } } } else { - if(!aPrefix.mIsSelfReferencing) { - GT_Log.log.error("WARNING: \'" + aEvent.Name + "\' is an OreDictionary Name which may cause Problems, due to being a Prefix, please use another one."); - GT_Log.log.error("Private Prefixes are a solution. Please use \'" + aMod + ":" + aEvent.Name + "\' don\'t forget to insert the \':\' inbetween the Mod ID and OreDict Name, that is the most important part."); - GT_Log.ore.println(e + " uses a Prefix as full OreDict Name, and is therefor invalid."); - aEvent.Ore.setStackDisplayName("Invalid OreDictionary Tag"); - return; + if (aEvent.Name.equals("sand")) { + GT_OreDictUnificator.registerOre(OrePrefixes.block, Materials.Sand, aEvent.Ore); + } else if (aEvent.Name.equals("dye")) { + GT_OreDictUnificator.registerOre(Dyes.dyeWhite, aEvent.Ore); + } else if (!aPrefix.mIsSelfReferencing) { + GT_Log.log.error("WARNING: \'" + aEvent.Name + "\' is an OreDictionary Name which may cause Problems, due to being a Prefix, please use another one."); + GT_Log.log.error("Private Prefixes are a solution. Please use \'" + aMod + ":" + aEvent.Name + "\' don\'t forget to insert the \':\' inbetween the Mod ID and OreDict Name, that is the most important part."); + GT_Log.ore.println(e + " uses a Prefix as full OreDict Name, and is therefor invalid."); + return; } aPrefix.add(GT_Utility.copyAmount(1L, aEvent.Ore)); @@ -476,25 +476,22 @@ public void registerOre(OreRegisterEvent aEvent) { GT_Log.ore.println(e); List list = mEvents.get(aPrefix); OreDictEntry entry = OreDictEntry.create(aEvent.Name); + ItemStack copy = aEvent.Ore.copy(); if (list != null) { int idx = list.indexOf(entry); if (idx >= 0) { - list.get(idx).add(aMod, aEvent.Ore); + list.get(idx).add(aMod, copy); } else { - entry.add(aMod, aEvent.Ore); + entry.add(aMod, copy); list.add(entry); } } else { list = new ArrayList<>(); - entry.add(aMod, aEvent.Ore); + entry.add(aMod, copy); list.add(entry); } this.mEvents.put(aPrefix, list); -// if(this.mActivated) { -// this.registerRecipes(aEvent, aMod); -// } - } } else { GT_Log.ore.println(e + " is using a private Prefix and is therefor getting ignored properly.");