From 0d16bfffc0d577fa23995b1fd55c4bac9e57c2c0 Mon Sep 17 00:00:00 2001 From: Prometheus0000 Date: Wed, 3 Mar 2021 08:56:56 -0500 Subject: #7537 Change tin to iron --- src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/java') diff --git a/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java b/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java index 0578bbe6c7..0409d8c534 100644 --- a/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java +++ b/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java @@ -610,7 +610,7 @@ public class GT_MachineRecipeLoader implements Runnable { for (Materials tMat : Materials.values()) { if (tMat.mStandardMoltenFluid != null && tMat.contains(SubTag.SOLDERING_MATERIAL) && !(GregTech_API.mUseOnlyGoodSolderingMaterials && !tMat.contains(SubTag.SOLDERING_MATERIAL_GOOD))) { int tMultiplier = tMat.contains(SubTag.SOLDERING_MATERIAL_GOOD) ? 1 : tMat.contains(SubTag.SOLDERING_MATERIAL_BAD) ? 4 : 2; - GT_Values.RA.addCircuitAssemblerRecipe(new ItemStack[]{ItemList.Circuit_Board_Coated_Basic.get(1L), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Primitive, 2), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Tin, 2), GT_OreDictUnificator.get(OrePrefixes.screw, Materials.Tin, 4), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Tin, 1),GT_Utility.getIntegratedCircuit(1)}, tMat.getMolten(1152L * tMultiplier / 2L), GT_ModHandler.getModItem("Forestry", "chipsets", 1L, 0), 200, 30); + GT_Values.RA.addCircuitAssemblerRecipe(new ItemStack[]{ItemList.Circuit_Board_Coated_Basic.get(1L), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Primitive, 2), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Iron, 2), GT_OreDictUnificator.get(OrePrefixes.screw, Materials.Iron, 4), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Iron, 1),GT_Utility.getIntegratedCircuit(1)}, tMat.getMolten(1152L * tMultiplier / 2L), GT_ModHandler.getModItem("Forestry", "chipsets", 1L, 0), 200, 30); GT_Values.RA.addCircuitAssemblerRecipe(new ItemStack[]{ItemList.Circuit_Board_Coated_Basic.get(1L), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Basic, 2), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Bronze, 2), GT_OreDictUnificator.get(OrePrefixes.screw, Materials.Bronze, 4), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Bronze, 1),GT_Utility.getIntegratedCircuit(1)}, tMat.getMolten(1152L * tMultiplier / 2L), GT_ModHandler.getModItem("Forestry", "chipsets", 1L, 1), 200, 30); GT_Values.RA.addCircuitAssemblerRecipe(new ItemStack[]{ItemList.Circuit_Board_Phenolic_Good.get(1L), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Good, 2), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Steel, 2), GT_OreDictUnificator.get(OrePrefixes.screw, Materials.Steel, 4), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Steel, 1),GT_Utility.getIntegratedCircuit(1)}, tMat.getMolten(1152L * tMultiplier / 2L), GT_ModHandler.getModItem("Forestry", "chipsets", 1L, 2), 200, 30); GT_Values.RA.addCircuitAssemblerRecipe(new ItemStack[]{ItemList.Circuit_Board_Phenolic_Good.get(1L), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Advanced, 2), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Electrum, 2), GT_OreDictUnificator.get(OrePrefixes.screw, Materials.Electrum, 4), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Electrum, 1),GT_Utility.getIntegratedCircuit(1)}, tMat.getMolten(1152L * tMultiplier / 2L), GT_ModHandler.getModItem("Forestry", "chipsets", 1L, 3), 200, 30); -- cgit From fe1665e6430d935694d0c2f0e369da88646399f2 Mon Sep 17 00:00:00 2001 From: Prometheus0000 Date: Fri, 5 Mar 2021 15:22:36 -0500 Subject: #6953 Change to flawless --- src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/java') diff --git a/src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java b/src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java index 146a0c09fe..ad89a77df7 100644 --- a/src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java +++ b/src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java @@ -554,7 +554,7 @@ public class GT_Loader_MetaTileEntities implements Runnable {//TODO CHECK CIRCUI ItemList.Machine_IV_Lathe.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe(295, "basicmachine.lathe.tier.05", "Advanced Lathe IV", 5, "Produces Rods more efficiently", GT_Recipe.GT_Recipe_Map.sLatheRecipes, 1, 2, 0, 0, 1, "Lathe.png", "", aBoolConst_0, aBoolConst_0, 0, "LATHE", new Object[]{aTextWireCoil, "EMD", "CWP", 'M', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.HULL, 'E', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.MOTOR, 'P', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.PISTON, 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CIRCUIT, 'W', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.WIRE, 'D', OreDictNames.craftingIndustrialDiamond}).getStackForm(1L)); ItemList.Machine_LV_Macerator.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe(301, "basicmachine.macerator.tier.01", "Basic Macerator", 1, "Schreddering your Ores", GT_Recipe.GT_Recipe_Map.sMaceratorRecipes, 1, 1, 0, 0, 1, "Macerator1.png", GregTech_API.sSoundList.get(Integer.valueOf(201)), aBoolConst_0, aBoolConst_0, 1, "MACERATOR", new Object[]{"PEG", "WWM", "CCW", 'M', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.HULL, 'E', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.MOTOR, 'P', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.PISTON, 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CIRCUIT, 'W', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.WIRE, 'G', OrePrefixes.gem.get(Materials.Diamond)}).getStackForm(1L)); - ItemList.Machine_MV_Macerator.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe(302, "basicmachine.macerator.tier.02", "Advanced Macerator", 2, "Schreddering your Ores", GT_Recipe.GT_Recipe_Map.sMaceratorRecipes, 1, 1, 0, 0, 1, "Macerator1.png", GregTech_API.sSoundList.get(Integer.valueOf(201)), aBoolConst_0, aBoolConst_0, 1, "MACERATOR", new Object[]{"PEG", "WWM", "CCW", 'M', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.HULL, 'E', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.MOTOR, 'P', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.PISTON, 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CIRCUIT, 'W', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.WIRE, 'G', OreDictNames.craftingIndustrialDiamond}).getStackForm(1L)); + ItemList.Machine_MV_Macerator.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe(302, "basicmachine.macerator.tier.02", "Advanced Macerator", 2, "Schreddering your Ores", GT_Recipe.GT_Recipe_Map.sMaceratorRecipes, 1, 1, 0, 0, 1, "Macerator1.png", GregTech_API.sSoundList.get(Integer.valueOf(201)), aBoolConst_0, aBoolConst_0, 1, "MACERATOR", new Object[]{"PEG", "WWM", "CCW", 'M', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.HULL, 'E', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.MOTOR, 'P', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.PISTON, 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CIRCUIT, 'W', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.WIRE, 'G', OrePrefixes.gemFlawless.get(Materials.Diamond)}).getStackForm(1L)); ItemList.Machine_HV_Macerator.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe(303, "basicmachine.macerator.tier.03", "Universal Macerator", 3, "Schreddering your Ores with Byproducts", GT_Recipe.GT_Recipe_Map.sMaceratorRecipes, 1, 2, 0, 0, 1, "Macerator2.png", GregTech_API.sSoundList.get(Integer.valueOf(201)), aBoolConst_0, aBoolConst_0, 1, "PULVERIZER", new Object[]{"PEG", "WWM", "CCW", 'M', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.HULL, 'E', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.MOTOR, 'P', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.PISTON, 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CIRCUIT, 'W', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.WIRE, 'G', OreDictNames.craftingGrinder}).getStackForm(1L)); ItemList.Machine_EV_Macerator.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe(304, "basicmachine.macerator.tier.04", "Universal Pulverizer", 4, "Schreddering your Ores with Byproducts", GT_Recipe.GT_Recipe_Map.sMaceratorRecipes, 1, 3, 0, 0, 1, "Macerator3.png", GregTech_API.sSoundList.get(Integer.valueOf(201)), aBoolConst_0, aBoolConst_0, 1, "PULVERIZER", new Object[]{"PEG", "WWM", "CCW", 'M', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.HULL, 'E', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.MOTOR, 'P', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.PISTON, 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CIRCUIT, 'W', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.WIRE, 'G', OreDictNames.craftingGrinder}).getStackForm(1L)); ItemList.Machine_IV_Macerator.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe(305, "basicmachine.macerator.tier.05", "Blend-O-Matic 9001", 5, "Schreddering your Ores with Byproducts", GT_Recipe.GT_Recipe_Map.sMaceratorRecipes, 1, 4, 0, 0, 1, "Macerator4.png", GregTech_API.sSoundList.get(Integer.valueOf(201)), aBoolConst_0, aBoolConst_0, 1, "PULVERIZER", new Object[]{"PEG", "WWM", "CCW", 'M', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.HULL, 'E', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.MOTOR, 'P', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.PISTON, 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CIRCUIT, 'W', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.WIRE, 'G', OreDictNames.craftingGrinder}).getStackForm(1L)); -- cgit From f2ae2693e7458ca00b1cabdeda386db471d88ba7 Mon Sep 17 00:00:00 2001 From: Prometheus0000 Date: Fri, 5 Mar 2021 15:44:11 -0500 Subject: Add 3 more flask recipes --- .../loaders/postload/GT_MachineRecipeLoader.java | 67 ++++++++++++---------- 1 file changed, 38 insertions(+), 29 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java b/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java index 0578bbe6c7..1cb12a4ed4 100644 --- a/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java +++ b/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java @@ -518,35 +518,44 @@ public class GT_MachineRecipeLoader implements Runnable { GT_Values.RA.addAssemblerRecipe(new ItemStack[]{GT_OreDictUnificator.get(OrePrefixes.pipeLarge, Materials.Tin, 2L), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Steel, 9L), GT_Utility.getIntegratedCircuit(24)}, Materials.Tin.getMolten(144L), ItemList.Long_Distance_Pipeline_Item_Pipe.get(64L), 600, 24); {//limiting life time of the variables - ItemStack flask = ItemList.VOLUMETRIC_FLASK.get(1); - NBTTagCompound nbtFlask = new NBTTagCompound(); - nbtFlask.setInteger("Capacity", 144); - flask.setTagCompound(nbtFlask); - GT_Values.RA.addAssemblerRecipe(ItemList.VOLUMETRIC_FLASK.get(1), GT_Utility.getIntegratedCircuit(1), flask, 10, 30); - nbtFlask.setInteger("Capacity", 288); - flask.setTagCompound(nbtFlask); - GT_Values.RA.addAssemblerRecipe(ItemList.VOLUMETRIC_FLASK.get(1), GT_Utility.getIntegratedCircuit(2), flask, 10, 30); - nbtFlask.setInteger("Capacity", 576); - flask.setTagCompound(nbtFlask); - GT_Values.RA.addAssemblerRecipe(ItemList.VOLUMETRIC_FLASK.get(1), GT_Utility.getIntegratedCircuit(3), flask, 10, 30); - nbtFlask.setInteger("Capacity", 720); - flask.setTagCompound(nbtFlask); - GT_Values.RA.addAssemblerRecipe(ItemList.VOLUMETRIC_FLASK.get(1), GT_Utility.getIntegratedCircuit(4), flask, 10, 30); - nbtFlask.setInteger("Capacity", 864); - flask.setTagCompound(nbtFlask); - GT_Values.RA.addAssemblerRecipe(ItemList.VOLUMETRIC_FLASK.get(1), GT_Utility.getIntegratedCircuit(5), flask, 10, 30); - nbtFlask.setInteger("Capacity", 250); - flask.setTagCompound(nbtFlask); - GT_Values.RA.addAssemblerRecipe(ItemList.VOLUMETRIC_FLASK.get(1), GT_Utility.getIntegratedCircuit(10), flask, 10, 30); - nbtFlask.setInteger("Capacity", 500); - flask.setTagCompound(nbtFlask); - GT_Values.RA.addAssemblerRecipe(ItemList.VOLUMETRIC_FLASK.get(1), GT_Utility.getIntegratedCircuit(11), flask, 10, 30); - // make the 1000L recipe actualy in - ItemStack flask500 = flask.copy(); - nbtFlask.setInteger("Capacity", 1000); - flask.setTagCompound(nbtFlask); - GT_Values.RA.addAssemblerRecipe(flask500, GT_Utility.getIntegratedCircuit(24), flask, 10, 30); - } + ItemStack flask = ItemList.VOLUMETRIC_FLASK.get(1); + NBTTagCompound nbtFlask = new NBTTagCompound(); + nbtFlask.setInteger("Capacity", 144); + flask.setTagCompound(nbtFlask); + GT_Values.RA.addAssemblerRecipe(ItemList.VOLUMETRIC_FLASK.get(1), GT_Utility.getIntegratedCircuit(1), flask, 10, 30); + nbtFlask.setInteger("Capacity", 288); + flask.setTagCompound(nbtFlask); + GT_Values.RA.addAssemblerRecipe(ItemList.VOLUMETRIC_FLASK.get(1), GT_Utility.getIntegratedCircuit(2), flask, 10, 30); + nbtFlask.setInteger("Capacity", 576); + flask.setTagCompound(nbtFlask); + GT_Values.RA.addAssemblerRecipe(ItemList.VOLUMETRIC_FLASK.get(1), GT_Utility.getIntegratedCircuit(3), flask, 10, 30); + nbtFlask.setInteger("Capacity", 720); + flask.setTagCompound(nbtFlask); + GT_Values.RA.addAssemblerRecipe(ItemList.VOLUMETRIC_FLASK.get(1), GT_Utility.getIntegratedCircuit(4), flask, 10, 30); + nbtFlask.setInteger("Capacity", 864); + flask.setTagCompound(nbtFlask); + GT_Values.RA.addAssemblerRecipe(ItemList.VOLUMETRIC_FLASK.get(1), GT_Utility.getIntegratedCircuit(5), flask, 10, 30); + nbtFlask.setInteger("Capacity", 72); + flask.setTagCompound(nbtFlask); + GT_Values.RA.addAssemblerRecipe(ItemList.VOLUMETRIC_FLASK.get(1), GT_Utility.getIntegratedCircuit(6), flask, 10, 30); + nbtFlask.setInteger("Capacity", 648); + flask.setTagCompound(nbtFlask); + GT_Values.RA.addAssemblerRecipe(ItemList.VOLUMETRIC_FLASK.get(1), GT_Utility.getIntegratedCircuit(7), flask, 10, 30); + nbtFlask.setInteger("Capacity", 936); + flask.setTagCompound(nbtFlask); + GT_Values.RA.addAssemblerRecipe(ItemList.VOLUMETRIC_FLASK.get(1), GT_Utility.getIntegratedCircuit(8), flask, 10, 30); + nbtFlask.setInteger("Capacity", 250); + flask.setTagCompound(nbtFlask); + GT_Values.RA.addAssemblerRecipe(ItemList.VOLUMETRIC_FLASK.get(1), GT_Utility.getIntegratedCircuit(10), flask, 10, 30); + nbtFlask.setInteger("Capacity", 500); + flask.setTagCompound(nbtFlask); + GT_Values.RA.addAssemblerRecipe(ItemList.VOLUMETRIC_FLASK.get(1), GT_Utility.getIntegratedCircuit(11), flask, 10, 30); + // make the 1000L recipe actualy in + ItemStack flask500 = flask.copy(); + nbtFlask.setInteger("Capacity", 1000); + flask.setTagCompound(nbtFlask); + GT_Values.RA.addAssemblerRecipe(flask500, GT_Utility.getIntegratedCircuit(24), flask, 10, 30); + } GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hull_HV.get(1L), GT_OreDictUnificator.get(OrePrefixes.pipeLarge, Materials.StainlessSteel, 1L), GT_OreDictUnificator.get(OrePrefixes.rotor, Materials.StainlessSteel, 1L), ItemList.Electric_Motor_HV.get(1L), GT_Utility.getIntegratedCircuit(3)}, GT_Values.NF, ItemList.Hatch_Muffler_HV.get(1L), 200, 480); GT_Values.RA.addAssemblerRecipe(new ItemStack[]{ItemList.Hull_EV.get(1L), GT_OreDictUnificator.get(OrePrefixes.pipeLarge, Materials.Titanium, 1L), ItemList.Electric_Motor_EV.get(1L), GT_OreDictUnificator.get(OrePrefixes.rotor, Materials.Titanium, 1L), GT_Utility.getIntegratedCircuit(3)}, GT_Values.NF, ItemList.Hatch_Muffler_EV.get(1L), 200, 1920); -- cgit From bc35fefbc6f9c8c18bfec20942ec76206f840116 Mon Sep 17 00:00:00 2001 From: Prometheus0000 Date: Fri, 5 Mar 2021 15:54:22 -0500 Subject: Add use for fool's ruby AKA spinel --- src/main/java/gregtech/api/enums/Materials.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/gregtech/api/enums/Materials.java b/src/main/java/gregtech/api/enums/Materials.java index d00c3bd8fc..aed17d6499 100644 --- a/src/main/java/gregtech/api/enums/Materials.java +++ b/src/main/java/gregtech/api/enums/Materials.java @@ -234,7 +234,7 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { public static Materials FierySteel = new Materials( 346, TextureSet.SET_FIERY , 8.0F, 256, 3, 1|2 |64|128 , 64, 0, 0, 0, "FierySteel" , "Fiery Steel" , 5, 2048, 1811, 1800, true, false, 1, 1, 1, Dyes.dyeRed , Arrays.asList(new TC_AspectStack(TC_Aspects.PRAECANTATIO, 3), new TC_AspectStack(TC_Aspects.IGNIS, 3), new TC_AspectStack(TC_Aspects.CORPUS, 3))).disableAutoGeneratedBlastFurnaceRecipes(); public static Materials Firestone = new Materials( 347, TextureSet.SET_QUARTZ , 6.0F, 1280, 3, 1 |4|8 |64 , 200, 20, 0, 0, "Firestone" , "Firestone" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeRed ); public static Materials Fluorite = new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 2, 1 |8 , 255, 255, 255, 0, "Fluorite" , "Fluorite" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeGreen ); - public static Materials FoolsRuby = new Materials( 512, TextureSet.SET_RUBY , 1.0F, 0, 2, 1 |4|8 , 255, 100, 100, 127, "FoolsRuby" , "Ruby" , 0, 0, -1, 0, false, true, 3, 1, 1, Dyes.dyeRed , Arrays.asList(new TC_AspectStack(TC_Aspects.LUCRUM, 2), new TC_AspectStack(TC_Aspects.VITREUS, 2))); + public static Materials FoolsRuby = new Materials( 512, TextureSet.SET_RUBY , 1.0F, 0, 2, 1 |4|8 , 255, 100, 100, 127, "FoolsRuby" , "Ruby" , 0, 0, -1, 0, false, true, 3, 1, 1, Dyes.dyeRed , 1, Arrays.asList(new MaterialStack(Magnesium, 1), new MaterialStack(Aluminium, 2), new MaterialStack(Oxygen, 4)), Arrays.asList(new TC_AspectStack(TC_Aspects.LUCRUM, 2), new TC_AspectStack(TC_Aspects.VITREUS, 2))); public static Materials Force = new Materials( 521, TextureSet.SET_DIAMOND , 10.0F, 128, 3, 1|2|4|8 |64|128 , 255, 255, 0, 0, "Force" , "Force" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeYellow , Arrays.asList(new TC_AspectStack(TC_Aspects.POTENTIA, 5))); public static Materials Forcicium = new Materials( 518, TextureSet.SET_DIAMOND , 1.0F, 0, 1, 1 |4|8|16 , 50, 50, 70, 0, "Forcicium" , "Forcicium" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeGreen , Arrays.asList(new TC_AspectStack(TC_Aspects.POTENTIA, 2))); public static Materials Forcillium = new Materials( 519, TextureSet.SET_DIAMOND , 1.0F, 0, 1, 1 |4|8|16 , 50, 50, 70, 0, "Forcillium" , "Forcillium" , 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeGreen , Arrays.asList(new TC_AspectStack(TC_Aspects.POTENTIA, 2))); @@ -1539,7 +1539,6 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { LiveRoot.mChemicalFormula = ""; WoodSealed.mChemicalFormula = ""; Wood.mChemicalFormula = ""; - FoolsRuby.mChemicalFormula = Ruby.mChemicalFormula; Electrotine.mChemicalFormula = "Rp"; Trinium.mChemicalFormula = "Ke"; Naquadah.mChemicalFormula = "Nq"; -- cgit From c16070529a1b036b8fdaebfef48cc2807258de69 Mon Sep 17 00:00:00 2001 From: Prometheus0000 Date: Fri, 5 Mar 2021 17:59:36 -0500 Subject: Makes higher tier materials give more cells --- src/main/java/gregtech/loaders/oreprocessing/ProcessingShaping.java | 4 ++-- src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/gregtech/loaders/oreprocessing/ProcessingShaping.java b/src/main/java/gregtech/loaders/oreprocessing/ProcessingShaping.java index a0bd254204..fa74cd3821 100644 --- a/src/main/java/gregtech/loaders/oreprocessing/ProcessingShaping.java +++ b/src/main/java/gregtech/loaders/oreprocessing/ProcessingShaping.java @@ -90,7 +90,7 @@ public class ProcessingShaping implements gregtech.api.interfaces.IOreRecipeRegi GT_Values.RA.addAlloySmelterRecipe(GT_Utility.copyAmount(1L, aStack), ItemList.Shape_Mold_Bottle.get(0L), new ItemStack(Items.glass_bottle, 1), tAmount * 64, 4); break; case "Steel": - GT_Values.RA.addExtruderRecipe(GT_Utility.copyAmount(2L, aStack), ItemList.Shape_Extruder_Cell.get(0L), ItemList.Cell_Empty.get(tAmount), tAmount * 128, 30); + GT_Values.RA.addExtruderRecipe(GT_Utility.copyAmount(1L, aStack), ItemList.Shape_Extruder_Cell.get(0L), ItemList.Cell_Empty.get(tAmount), tAmount * 128, 30); if (tAmount * 2 <= 64) GT_Values.RA.addExtruderRecipe(GT_Utility.copyAmount(1L, aStack), ItemList.Shape_Extruder_Casing.get(0L), GT_ModHandler.getIC2Item("casingadviron", tAmount * 2), tAmount * 32, 3 * tVoltageMultiplier); if (tAmount * 2 <= 64) @@ -139,7 +139,7 @@ public class ProcessingShaping implements gregtech.api.interfaces.IOreRecipeRegi GT_Values.RA.addAlloySmelterRecipe(GT_Utility.copyAmount(2L, aStack), ItemList.Shape_Mold_Casing.get(0L), GT_ModHandler.getIC2Item("casinggold", tAmount * 3), tAmount * 128, 1 * tVoltageMultiplier); break; case "Polytetrafluoroethylene": - GT_Values.RA.addExtruderRecipe(GT_Utility.copyAmount(2L, aStack), ItemList.Shape_Extruder_Cell.get(0L), ItemList.Cell_Empty.get(tAmount), tAmount * 128, 30); + GT_Values.RA.addExtruderRecipe(GT_Utility.copyAmount(1L, aStack), ItemList.Shape_Extruder_Cell.get(0L), ItemList.Cell_Empty.get(tAmount * 4), tAmount * 128, 30); break; } } diff --git a/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java b/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java index 0578bbe6c7..aba06f86ae 100644 --- a/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java +++ b/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java @@ -1318,9 +1318,8 @@ public class GT_MachineRecipeLoader implements Runnable { GT_Values.RA.addBenderRecipe(GT_OreDictUnificator.get(OrePrefixes.stick, Materials.TungstenSteel, 12L), ItemList.RC_Rebar.get(48L), 2400, 15); GT_Values.RA.addBenderRecipe(GT_OreDictUnificator.get(OrePrefixes.stick, Materials.Iridium, 8L), ItemList.RC_Rebar.get(64L), 2400, 15); GT_Values.RA.addBenderRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Tin, 12L), ItemList.Cell_Empty.get(6L), 1200, 8); - GT_Values.RA.addBenderRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Steel, 12L), ItemList.Cell_Empty.get(6L), 1200, 8); - GT_Values.RA.addBenderRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.SteelMagnetic, 12L), ItemList.Cell_Empty.get(6L), 1200, 8); - GT_Values.RA.addBenderRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Polytetrafluoroethylene, 12L), ItemList.Cell_Empty.get(6L), 1200, 8); + GT_Values.RA.addBenderRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Steel, 12L), ItemList.Cell_Empty.get(12L), 1200, 8); + GT_Values.RA.addBenderRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Polytetrafluoroethylene, 12L), ItemList.Cell_Empty.get(48L), 1200, 8); GT_Values.RA.addBenderRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Iron, 12L), new ItemStack(Items.bucket, 4, 0), 800, 4); GT_Values.RA.addBenderRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.WroughtIron, 12L), new ItemStack(Items.bucket, 4, 0), 800, 4); GT_Values.RA.addBenderRecipe(GT_OreDictUnificator.get(OrePrefixes.itemCasing, Materials.Iron, 2L), GT_ModHandler.getIC2Item("fuelRod", 1L), 100, 8); -- cgit From 173d82fcd2b81d54ee6ec14cf9be047a81d85a5f Mon Sep 17 00:00:00 2001 From: Prometheus0000 Date: Fri, 5 Mar 2021 19:10:17 -0500 Subject: Add electrolyzer recipe for IC2 fertilizer --- src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java b/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java index 0578bbe6c7..c51dfbdbdb 100644 --- a/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java +++ b/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java @@ -1244,8 +1244,8 @@ public class GT_MachineRecipeLoader implements Runnable { GT_Values.RA.addFuel(GT_ModHandler.getModItem("TaintedMagic", "FluxShard", 1L), null, 720, 5); GT_Values.RA.addFuel(GT_ModHandler.getModItem("TaintedMagic", "EldritchShard", 1L), null, 720, 5); GT_Values.RA.addFuel(GT_ModHandler.getModItem("ThaumicTinkerer", "kamiResource", 1L, 6), null, 720, 5); - GT_Values.RA.addFuel(GT_ModHandler.getModItem("ThaumicTinkerer", "kamiResource", 1L, 7), null, 720, 5); - + GT_Values.RA.addFuel(GT_ModHandler.getModItem("ThaumicTinkerer", "kamiResource", 1L, 7), null, 720, 5); + GT_Values.RA.addElectrolyzerRecipe(GT_Utility.getIntegratedCircuit(1), ItemList.Cell_Empty.get(1L), Materials.Water.getFluid(3000L), Materials.Hydrogen.getGas(2000L), GT_OreDictUnificator.get(OrePrefixes.cell, Materials.Oxygen, 1L), GT_Values.NI, GT_Values.NI, GT_Values.NI, GT_Values.NI, GT_Values.NI, null, 2000, 30); GT_Values.RA.addElectrolyzerRecipe(GT_Utility.getIntegratedCircuit(2), ItemList.Cell_Empty.get(1L), GT_ModHandler.getDistilledWater(3000L), Materials.Hydrogen.getGas(2000L), GT_OreDictUnificator.get(OrePrefixes.cell, Materials.Oxygen, 1L), GT_Values.NI, GT_Values.NI, GT_Values.NI, GT_Values.NI, GT_Values.NI, null, 2000, 30); GT_Values.RA.addElectrolyzerRecipe(GT_Utility.getIntegratedCircuit(3), ItemList.Cell_Empty.get(2L), Materials.Water.getFluid(3000L), Materials.Oxygen.getGas(1000L), GT_OreDictUnificator.get(OrePrefixes.cell, Materials.Hydrogen, 2L), GT_Values.NI, GT_Values.NI, GT_Values.NI, GT_Values.NI, GT_Values.NI, null, 2000, 30); @@ -1260,6 +1260,7 @@ public class GT_MachineRecipeLoader implements Runnable { GT_Values.RA.addElectrolyzerRecipe(GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Graphite, 1), 0, GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Carbon, 4), GT_Values.NI, GT_Values.NI, GT_Values.NI, GT_Values.NI, GT_Values.NI, 100, 64); GT_Values.RA.addElectrolyzerRecipe(GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Sphalerite, 2), GT_Values.NI, GT_Values.NF, GT_Values.NF, GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Zinc, 1), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Sulfur, 1), GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Gallium, 1), GT_Values.NI, GT_Values.NI, GT_Values.NI, new int[]{10000, 10000, 2500, 0, 0, 0},200, 30); + GT_Values.RA.addElectrolyzerRecipe(ItemList.IC2_Fertilizer.get(1L), GT_Values.NI, GT_Values.NF, Materials.Water.getFluid(1000L), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Calcite, 1L), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Carbon, 1L), GT_Values.NI, GT_Values.NI, GT_Values.NI, GT_Values.NI, null, 100, 30); GT_Values.RA.addChemicalRecipe(GT_OreDictUnificator.get(OrePrefixes.dust, Materials.NetherQuartz, 3L), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Sodium, 1L), Materials.Water.getFluid(1000L), GT_Values.NF, GT_OreDictUnificator.get(OrePrefixes.gem, Materials.NetherQuartz, 3L), 500); GT_Values.RA.addChemicalRecipe(GT_OreDictUnificator.get(OrePrefixes.dust, Materials.CertusQuartz, 3L), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Sodium, 1L), Materials.Water.getFluid(1000L), GT_Values.NF, GT_OreDictUnificator.get(OrePrefixes.gem, Materials.CertusQuartz, 3L), 500); -- cgit From e2234e949c896786c877113b496f4831d7291382 Mon Sep 17 00:00:00 2001 From: botn365 <42187820+botn365@users.noreply.github.com> Date: Sun, 7 Mar 2021 18:19:27 +0100 Subject: fix all fineWire amount fix all instences where you only get 4 fine wire/ingot instead of 8 when there is no wire version of that material --- .../java/gregtech/loaders/oreprocessing/ProcessingFineWire.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/gregtech/loaders/oreprocessing/ProcessingFineWire.java b/src/main/java/gregtech/loaders/oreprocessing/ProcessingFineWire.java index 88d2411fc1..7ed86696fe 100644 --- a/src/main/java/gregtech/loaders/oreprocessing/ProcessingFineWire.java +++ b/src/main/java/gregtech/loaders/oreprocessing/ProcessingFineWire.java @@ -17,11 +17,11 @@ public class ProcessingFineWire implements gregtech.api.interfaces.IOreRecipeReg public void registerOre(OrePrefixes aPrefix, Materials aMaterial, String aOreDictName, String aModName, ItemStack aStack) { if (!aMaterial.contains(gregtech.api.enums.SubTag.NO_SMASHING)) { - GT_Values.RA.addWiremillRecipe(GT_OreDictUnificator.get(OrePrefixes.ingot, aMaterial, 1L), GT_Utility.copy(GT_OreDictUnificator.get(OrePrefixes.wireGt01, aMaterial, 2L), GT_Utility.copyAmount(4L, aStack)), 100, 4); - GT_Values.RA.addWiremillRecipe(GT_OreDictUnificator.get(OrePrefixes.stick, aMaterial, 1L), GT_Utility.copy(GT_OreDictUnificator.get(OrePrefixes.wireGt01, aMaterial, 1L), GT_Utility.copyAmount(2L, aStack)), 50, 4); + GT_Values.RA.addWiremillRecipe(GT_OreDictUnificator.get(OrePrefixes.ingot, aMaterial, 1L), GT_Utility.copy(GT_OreDictUnificator.get(OrePrefixes.wireGt01, aMaterial, 2L), GT_Utility.copyAmount(8L, aStack)), 500, 4); + GT_Values.RA.addWiremillRecipe(GT_OreDictUnificator.get(OrePrefixes.stick, aMaterial, 1L), GT_Utility.copy(GT_OreDictUnificator.get(OrePrefixes.wireGt01, aMaterial, 1L), GT_Utility.copyAmount(4L, aStack)), 200, 4); } if ((aMaterial.mUnificatable) && (aMaterial.mMaterialInto == aMaterial) && !aMaterial.contains(SubTag.NO_WORKING)) { GT_ModHandler.addCraftingRecipe(GT_Utility.copyAmount(1L, aStack), GT_Proxy.tBits, new Object[]{"Xx", 'X', OrePrefixes.foil.get(aMaterial)}); } } -} \ No newline at end of file +} -- cgit From 21c658e289f96e92c357379bb810c071a35036db Mon Sep 17 00:00:00 2001 From: basdxz Date: Tue, 9 Mar 2021 17:06:19 +0000 Subject: Minor clean up and extension of hatch muffler (#459) * Minor clean up and extension of hatch muffler -Plus like, a small comment here or there * Changes 4 Bart --- .../GT_MetaTileEntity_Hatch_Muffler.java | 53 +++++++++++++--------- .../GT_MetaTileEntity_MultiBlockBase.java | 2 +- 2 files changed, 33 insertions(+), 22 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java index 1e5c86108b..4c48fe09f1 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java @@ -18,7 +18,7 @@ import static gregtech.api.objects.XSTR.XSTR_INSTANCE; public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { public GT_MetaTileEntity_Hatch_Muffler(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 0, "Outputs the Pollution (Might cause ... things)"); + super(aID, aName, aNameRegional, aTier, 0, ""); } public GT_MetaTileEntity_Hatch_Muffler(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { @@ -29,15 +29,21 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { super(aName, aTier, 0, aDescription, aTextures); } + private int[] mFacings; + + /*private void init()*/ { + setInValidFacings(ForgeDirection.DOWN); + } + @Override public String[] getDescription() { - String[] desc = new String[mDescriptionArray.length + 3]; - System.arraycopy(mDescriptionArray, 0, desc, 0, mDescriptionArray.length); - desc[mDescriptionArray.length] = "DO NOT OBSTRUCT THE OUTPUT!"; - desc[mDescriptionArray.length + 1] = "Reduces Pollution to " + calculatePollutionReduction(100) + "%"; - //Pollution Recovery scales from 0% at LV to 100% at UHV Voltage - desc[mDescriptionArray.length + 2] = "Recovers " + (100 - calculatePollutionReduction(100)) + "% of CO2/CO/SO2"; - return desc; + int pollutionReduction = calculatePollutionReduction(100); + return new String[]{ + "Outputs the Pollution (Might cause ... things)", + "DO NOT OBSTRUCT THE OUTPUT!", + "Reduces Pollution to " + pollutionReduction + "%", + "Recovers " + (100 - pollutionReduction) + "% of CO2/CO/SO2" + }; } @Override @@ -55,22 +61,19 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { return true; } - private int[] mFacings; - - /*private void init()*/ { - setInValidFacings(ForgeDirection.DOWN); - } - + //API Code, BartWorks/TecTech based EBF relies on this. It's marked here, not anywhere else. public void setInValidFacings(ForgeDirection... aFacings) { mFacings = Arrays.stream(aFacings).mapToInt(Enum::ordinal).toArray(); } @Override public boolean isFacingValid(byte aFacing) { - for (int x : mFacings) - if (x == aFacing) - return false; - return true; + for (int x : mFacings) { + if (x == aFacing) { + return true; + } + } + return false; } @Override @@ -88,7 +91,8 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { return new GT_MetaTileEntity_Hatch_Muffler(mName, mTier, mDescriptionArray, mTextures); } - public boolean polluteEnvironment() { + //MetaTileEntity is passed so newer muffler hatches can do wacky things with the multis + public boolean polluteEnvironment(MetaTileEntity mte) { if (getBaseMetaTileEntity().getAirAtSide(getBaseMetaTileEntity().getFrontFacing())) { GT_Pollution.addPollution(getBaseMetaTileEntity(), calculatePollutionReduction(10000)); return true; @@ -96,9 +100,15 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { return false; } + @Deprecated + public boolean polluteEnvironment() { + return polluteEnvironment(null); + } + public int calculatePollutionReduction(int aPollution) { - if ((float) mTier < 2) + if ((float) mTier < 2) { return aPollution; + } return (int) ((float) aPollution * ((100F - (12.5F * ((float) mTier - 1F))) / 100F)); } @@ -115,8 +125,9 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPostTick(aBaseMetaTileEntity, aTick); - if (aBaseMetaTileEntity.isClientSide() && this.getBaseMetaTileEntity().isActive()) + if (aBaseMetaTileEntity.isClientSide() && this.getBaseMetaTileEntity().isActive()) { pollutionParticles(this.getBaseMetaTileEntity().getWorld(), "largesmoke"); + } } public void pollutionParticles(World aWorld, String name) { diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java index 6f211631f2..3adff2fc3f 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java @@ -320,7 +320,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) { if (isValidMetaTileEntity(tHatch)) { if (mPollution >= 10000) { - if (tHatch.polluteEnvironment()) { + if (tHatch.polluteEnvironment(this)) { mPollution -= 10000; } } else { -- cgit From 4b6e7cbbe8a2acde5acf93ec176acd3e4d79a338 Mon Sep 17 00:00:00 2001 From: basdxz Date: Tue, 9 Mar 2021 00:47:40 +0000 Subject: Minor clean up and extension of hatch muffler -Plus like, a small comment here or there --- .../GT_MetaTileEntity_Hatch_Muffler.java | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java index 4c48fe09f1..3c967f5552 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java @@ -61,19 +61,21 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { return true; } - //API Code, BartWorks/TecTech based EBF relies on this. It's marked here, not anywhere else. + //API Code, Bartworks relies on this. It's marked here, not anywhere else. public void setInValidFacings(ForgeDirection... aFacings) { mFacings = Arrays.stream(aFacings).mapToInt(Enum::ordinal).toArray(); } @Override public boolean isFacingValid(byte aFacing) { + boolean valid = true; for (int x : mFacings) { if (x == aFacing) { - return true; + valid = false; + break; } } - return false; + return valid; } @Override @@ -91,25 +93,23 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { return new GT_MetaTileEntity_Hatch_Muffler(mName, mTier, mDescriptionArray, mTextures); } - //MetaTileEntity is passed so newer muffler hatches can do wacky things with the multis public boolean polluteEnvironment(MetaTileEntity mte) { + boolean doPollute = false; if (getBaseMetaTileEntity().getAirAtSide(getBaseMetaTileEntity().getFrontFacing())) { GT_Pollution.addPollution(getBaseMetaTileEntity(), calculatePollutionReduction(10000)); - return true; + doPollute = true; } - return false; - } - - @Deprecated - public boolean polluteEnvironment() { - return polluteEnvironment(null); + return doPollute; } public int calculatePollutionReduction(int aPollution) { + int pollutionReduction; if ((float) mTier < 2) { - return aPollution; + pollutionReduction = aPollution; + } else { + pollutionReduction = (int) ((float) aPollution * ((100F - (12.5F * ((float) mTier - 1F))) / 100F)); } - return (int) ((float) aPollution * ((100F - (12.5F * ((float) mTier - 1F))) / 100F)); + return pollutionReduction; } @Override -- cgit From 52d52be168460264682ca046c744114f47969579 Mon Sep 17 00:00:00 2001 From: basdxz Date: Tue, 9 Mar 2021 02:23:24 +0000 Subject: Changes 4 Bart --- .../GT_MetaTileEntity_Hatch_Muffler.java | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java index 3c967f5552..4c48fe09f1 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java @@ -61,21 +61,19 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { return true; } - //API Code, Bartworks relies on this. It's marked here, not anywhere else. + //API Code, BartWorks/TecTech based EBF relies on this. It's marked here, not anywhere else. public void setInValidFacings(ForgeDirection... aFacings) { mFacings = Arrays.stream(aFacings).mapToInt(Enum::ordinal).toArray(); } @Override public boolean isFacingValid(byte aFacing) { - boolean valid = true; for (int x : mFacings) { if (x == aFacing) { - valid = false; - break; + return true; } } - return valid; + return false; } @Override @@ -93,23 +91,25 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { return new GT_MetaTileEntity_Hatch_Muffler(mName, mTier, mDescriptionArray, mTextures); } + //MetaTileEntity is passed so newer muffler hatches can do wacky things with the multis public boolean polluteEnvironment(MetaTileEntity mte) { - boolean doPollute = false; if (getBaseMetaTileEntity().getAirAtSide(getBaseMetaTileEntity().getFrontFacing())) { GT_Pollution.addPollution(getBaseMetaTileEntity(), calculatePollutionReduction(10000)); - doPollute = true; + return true; } - return doPollute; + return false; + } + + @Deprecated + public boolean polluteEnvironment() { + return polluteEnvironment(null); } public int calculatePollutionReduction(int aPollution) { - int pollutionReduction; if ((float) mTier < 2) { - pollutionReduction = aPollution; - } else { - pollutionReduction = (int) ((float) aPollution * ((100F - (12.5F * ((float) mTier - 1F))) / 100F)); + return aPollution; } - return pollutionReduction; + return (int) ((float) aPollution * ((100F - (12.5F * ((float) mTier - 1F))) / 100F)); } @Override -- cgit From 6b4f07405b075035572ddf1c9259c3051806e2cc Mon Sep 17 00:00:00 2001 From: Léa Gris Date: Tue, 9 Mar 2021 18:24:30 +0100 Subject: feat(i18n): translatable muffler description + refactor --- .../GT_MetaTileEntity_Hatch_Muffler.java | 130 ++++++++++++--------- 1 file changed, 72 insertions(+), 58 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java index 4c48fe09f1..e651df066b 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java @@ -1,11 +1,14 @@ package gregtech.api.metatileentity.implementations; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gregtech.GT_Mod; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_LanguageManager; import gregtech.common.GT_Pollution; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -16,34 +19,36 @@ import java.util.Arrays; import static gregtech.api.objects.XSTR.XSTR_INSTANCE; +@SuppressWarnings("unused") // Unused API is expected within scope public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { + private static final String localizedDescFormat = GT_LanguageManager.addStringLocalization( + "gt.blockmachines.hatch.muffler.desc.format", + "Outputs the Pollution (Might cause ... things)%n" + + "DO NOT OBSTRUCT THE OUTPUT!%n" + + "Reduces Pollution to %d%%%n" + + "Recovers %d%% of CO2/CO/SO2"); + private final int pollutionReduction = calculatePollutionReduction(100); + private final int pollutionRecover = 100 - pollutionReduction; + private final String[] description = String.format(localizedDescFormat, pollutionReduction, pollutionRecover) + .split("\\R"); + private final boolean[] facings = new boolean[ForgeDirection.VALID_DIRECTIONS.length]; + public GT_MetaTileEntity_Hatch_Muffler(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, 0, ""); } public GT_MetaTileEntity_Hatch_Muffler(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { - super(aName, aTier, 0, aDescription, aTextures); + this(aName, aTier, new String[]{aDescription}, aTextures); } public GT_MetaTileEntity_Hatch_Muffler(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, 0, aDescription, aTextures); - } - - private int[] mFacings; - - /*private void init()*/ { setInValidFacings(ForgeDirection.DOWN); } @Override public String[] getDescription() { - int pollutionReduction = calculatePollutionReduction(100); - return new String[]{ - "Outputs the Pollution (Might cause ... things)", - "DO NOT OBSTRUCT THE OUTPUT!", - "Reduces Pollution to " + pollutionReduction + "%", - "Recovers " + (100 - pollutionReduction) + "% of CO2/CO/SO2" - }; + return description; } @Override @@ -61,28 +66,18 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { return true; } - //API Code, BartWorks/TecTech based EBF relies on this. It's marked here, not anywhere else. - public void setInValidFacings(ForgeDirection... aFacings) { - mFacings = Arrays.stream(aFacings).mapToInt(Enum::ordinal).toArray(); - } - @Override - public boolean isFacingValid(byte aFacing) { - for (int x : mFacings) { - if (x == aFacing) { - return true; - } - } + public boolean isValidSlot(int aIndex) { return false; } @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { - return true; + public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return false; } @Override - public boolean isValidSlot(int aIndex) { + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { return false; } @@ -91,48 +86,28 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { return new GT_MetaTileEntity_Hatch_Muffler(mName, mTier, mDescriptionArray, mTextures); } - //MetaTileEntity is passed so newer muffler hatches can do wacky things with the multis - public boolean polluteEnvironment(MetaTileEntity mte) { - if (getBaseMetaTileEntity().getAirAtSide(getBaseMetaTileEntity().getFrontFacing())) { - GT_Pollution.addPollution(getBaseMetaTileEntity(), calculatePollutionReduction(10000)); - return true; - } - return false; - } - - @Deprecated - public boolean polluteEnvironment() { - return polluteEnvironment(null); - } - - public int calculatePollutionReduction(int aPollution) { - if ((float) mTier < 2) { - return aPollution; - } - return (int) ((float) aPollution * ((100F - (12.5F * ((float) mTier - 1F))) / 100F)); - } - @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return false; + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + super.onPostTick(aBaseMetaTileEntity, aTick); + if (aBaseMetaTileEntity.isClientSide() && this.getBaseMetaTileEntity().isActive()) { + pollutionParticles(this.getBaseMetaTileEntity().getWorld(), "largesmoke"); + } } @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return false; + public boolean isFacingValid(byte aFacing) { + return facings[aFacing]; } @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - super.onPostTick(aBaseMetaTileEntity, aTick); - if (aBaseMetaTileEntity.isClientSide() && this.getBaseMetaTileEntity().isActive()) { - pollutionParticles(this.getBaseMetaTileEntity().getWorld(), "largesmoke"); - } + public boolean isAccessAllowed(EntityPlayer aPlayer) { + return true; } + @SideOnly(Side.CLIENT) public void pollutionParticles(World aWorld, String name) { boolean chk1, chk2, chk3; - float ran1 = XSTR_INSTANCE.nextFloat(), ran2 = 0, ran3 = 0; + float ran1 = XSTR_INSTANCE.nextFloat(), ran2, ran3; chk1 = ran1 * 100 < calculatePollutionReduction(100); if (GT_Pollution.getPollution(getBaseMetaTileEntity()) >= GT_Mod.gregtechproxy.mPollutionSmogLimit) { ran2 = XSTR_INSTANCE.nextFloat(); @@ -142,6 +117,7 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { if (!(chk1 || chk2 || chk3)) return; } else { if (!chk1) return; + ran2 = ran3 = 0.0F; chk2 = chk3 = false; } @@ -173,4 +149,42 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { if (chk3) aWorld.spawnParticle(name, xPos + ran3 * 0.5F, yPos + XSTR_INSTANCE.nextFloat() * 0.5F, zPos + XSTR_INSTANCE.nextFloat() * 0.5F, xSpd, ySpd, zSpd); } + + public int calculatePollutionReduction(int aPollution) { + if (mTier < 2) { + return aPollution; + } + return (int) ((float) aPollution * ((100F - 12.5F * ((float) mTier - 1F)) / 100F)); + } + + /** + * @return pollution success + * @deprecated replaced by {@link .polluteEnvironment(MetaTileEntity)} + */ + @Deprecated + public boolean polluteEnvironment() { + return polluteEnvironment(null); + } + + /** + * @param mte The multi-block controller's {@link MetaTileEntity} + * MetaTileEntity is passed so newer muffler hatches can do wacky things with the multis + * @return pollution success + */ + public boolean polluteEnvironment(MetaTileEntity mte) { + if (getBaseMetaTileEntity().getAirAtSide(getBaseMetaTileEntity().getFrontFacing())) { + GT_Pollution.addPollution(getBaseMetaTileEntity(), calculatePollutionReduction(10000)); + return true; + } + return false; + } + + /** + * @param aFacings the {@link ForgeDirection} invalid facings + * @apiNote API Code, BartWorks/TecTech based EBF relies on this. It's marked here, not anywhere else. + */ + public void setInValidFacings(ForgeDirection... aFacings) { + Arrays.fill(facings, true); + Arrays.stream(aFacings).forEach(face -> facings[face.ordinal()] = false); + } } -- cgit From 64249330a073f0e3921a9335b71faa9eda9e351a Mon Sep 17 00:00:00 2001 From: repo_alt Date: Wed, 10 Mar 2021 17:30:37 +0300 Subject: Correctly release/reuse channel after ME bus removal and reconnect --- src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java | 4 ++-- .../tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java index 9fd8e75754..5e9715493b 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java @@ -927,12 +927,12 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE tileEntityInvalid = false; leaveEnet(); if (canAccessData()) { + if (GregTech_API.mAE2) + invalidateAE(); mMetaTileEntity.onRemoval(); mMetaTileEntity.setBaseMetaTileEntity(null); } super.invalidate(); - if (GregTech_API.mAE2) - invalidateAE(); } @Override diff --git a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java index 34f99510ea..910ad73d65 100644 --- a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java +++ b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java @@ -54,6 +54,12 @@ public class GT_MetaTileEntity_Hatch_OutputBus_ME extends GT_MetaTileEntity_Hatc return new ITexture[]{aBaseTexture, new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ME_HATCH)}; } + @Override + public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { + super.onFirstTick(aBaseMetaTileEntity); + getProxy(); + } + @Optional.Method(modid = "appliedenergistics2") public int store(final ItemStack stack) { if (stack == null) -- cgit From f03e907ac73d92bfaf5948e1cae7848675439497 Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Wed, 10 Mar 2021 18:21:44 +0100 Subject: Refactor World Events World events have way to many parameters, so the code gets unreadable, this commit fixes that behavior. --- .../interfaces/tileentity/IEnergyConnected.java | 7 +- .../api/metatileentity/MetaPipeEntity.java | 8 +- .../implementations/GT_MetaPipeEntity_Fluid.java | 17 ++- .../GT_MetaTileEntity_BasicMachine_Bronze.java | 17 ++- .../GT_MetaTileEntity_BasicMachine_GT_Recipe.java | 25 ++-- .../GT_MetaTileEntity_Hatch_Muffler.java | 21 ++- src/main/java/gregtech/api/util/GT_FoodStat.java | 7 +- .../gregtech/api/util/PositionedWorldEvent.java | 144 +++++++++++++++++++++ src/main/java/gregtech/common/GT_Client.java | 40 +++--- src/main/java/gregtech/common/GT_Proxy.java | 23 +--- .../common/blocks/GT_Block_Reinforced.java | 6 +- .../gregtech/common/entities/GT_Entity_Arrow.java | 14 +- .../common/items/behaviors/Behaviour_Hoe.java | 5 +- .../boilers/GT_MetaTileEntity_Boiler.java | 16 ++- .../GT_MetaTileEntity_PrimitiveBlastFurnace.java | 12 +- .../steam/GT_MetaTileEntity_Macerator_Bronze.java | 7 +- .../steam/GT_MetaTileEntity_Macerator_Steel.java | 7 +- 17 files changed, 288 insertions(+), 88 deletions(-) create mode 100644 src/main/java/gregtech/api/util/PositionedWorldEvent.java (limited to 'src/main/java') diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java index 47bec844ee..66b0e5b27c 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java @@ -3,9 +3,11 @@ package gregtech.api.interfaces.tileentity; import cofh.api.energy.IEnergyReceiver; import gregtech.GT_Mod; import gregtech.api.GregTech_API; +import gregtech.api.util.PositionedWorldEvent; import gregtech.api.util.GT_Utility; import gregtech.common.GT_Pollution; import ic2.api.energy.tile.IEnergySink; +import net.minecraft.entity.Entity; import net.minecraft.init.Blocks; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; @@ -112,7 +114,10 @@ public interface IEnergyConnected extends IColoredTileEntity, IHasWorldObjectAnd if (GregTech_API.sMachineExplosions) if (GT_Mod.gregtechproxy.mPollution) GT_Pollution.addPollution(tWorld.getChunkFromBlockCoords(tX, tZ), 100000); - tWorld.createExplosion(null, tX + 0.5, tY + 0.5, tZ + 0.5, tStrength, true); + + PositionedWorldEvent event = new PositionedWorldEvent<>(tWorld); + event.setPosition(tX + 0.5, tY + 0.5, tZ + 0.5); + event.createExplosion(tStrength, true); } } } diff --git a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java index 31ec73d04b..8fc06b3dc4 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java @@ -9,6 +9,7 @@ import gregtech.api.interfaces.tileentity.IColoredTileEntity; import gregtech.api.interfaces.tileentity.ICoverable; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.objects.GT_ItemStack; +import gregtech.api.util.PositionedWorldEvent; import gregtech.api.util.GT_Config; import gregtech.api.util.GT_CoverBehavior; import gregtech.api.util.GT_LanguageManager; @@ -697,8 +698,11 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { int tX = getBaseMetaTileEntity().getXCoord(), tY = getBaseMetaTileEntity().getYCoord(), tZ = getBaseMetaTileEntity().getZCoord(); World tWorld = getBaseMetaTileEntity().getWorld(); tWorld.setBlock(tX, tY, tZ, Blocks.air); - if (GregTech_API.sMachineExplosions) - tWorld.createExplosion(null, tX + 0.5, tY + 0.5, tZ + 0.5, tStrength, true); + if (GregTech_API.sMachineExplosions){ + PositionedWorldEvent event = new PositionedWorldEvent<>(tWorld); + event.setPosition(tX + 0.5, tY + 0.5, tZ + 0.5); + event.createExplosion(tStrength, true); + } } @Override diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java index e472305a36..dd207a1b39 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java @@ -17,6 +17,7 @@ import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_CoverBehavior; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_Utility; +import gregtech.api.util.PositionedWorldEvent; import gregtech.common.GT_Client; import gregtech.common.covers.GT_Cover_Drain; import gregtech.common.covers.GT_Cover_FluidRegulator; @@ -444,8 +445,20 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { super.doSound(aIndex, aX, aY, aZ); if (aIndex == 9) { GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(4), 5, 1.0F, aX, aY, aZ); - for (byte i = 0; i < 6; i++) - getBaseMetaTileEntity().getWorld().spawnParticle("largesmoke", aX - 0.5 + XSTR_INSTANCE.nextFloat(), aY - 0.5 + XSTR_INSTANCE.nextFloat(), aZ - 0.5 + XSTR_INSTANCE.nextFloat(), ForgeDirection.getOrientation(i).offsetX / 5.0, ForgeDirection.getOrientation(i).offsetY / 5.0, ForgeDirection.getOrientation(i).offsetZ / 5.0); + PositionedWorldEvent events = new PositionedWorldEvent<>(getBaseMetaTileEntity().getWorld(), "largesmoke"); + + for (int i = 0; i < 6; i++){ + events.setPosition( + aX - 0.5 + XSTR_INSTANCE.nextFloat(), + aY - 0.5 + XSTR_INSTANCE.nextFloat(), + aZ - 0.5 + XSTR_INSTANCE.nextFloat() + ); + events.spawnParticle( + ForgeDirection.getOrientation(i).offsetX / 5.0, + ForgeDirection.getOrientation(i).offsetY / 5.0, + ForgeDirection.getOrientation(i).offsetZ / 5.0 + ); + } } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java index 23aa69213c..50b942d294 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java @@ -8,6 +8,7 @@ import gregtech.api.objects.GT_ItemStack; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_Utility; +import gregtech.api.util.PositionedWorldEvent; import net.minecraft.entity.EntityLivingBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; @@ -153,8 +154,20 @@ public abstract class GT_MetaTileEntity_BasicMachine_Bronze extends GT_MetaTileE super.doSound(aIndex, aX, aY, aZ); if (aIndex == 9) { GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(4), 5, 1.0F, aX, aY, aZ); - for (int l = 0; l < 8; ++l) - getBaseMetaTileEntity().getWorld().spawnParticle("largesmoke", aX - 0.5 + XSTR_INSTANCE.nextFloat(), aY - 0.5 + XSTR_INSTANCE.nextFloat(), aZ - 0.5 + XSTR_INSTANCE.nextFloat(), ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetX / 5.0, ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetY / 5.0, ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetZ / 5.0); + PositionedWorldEvent events = new PositionedWorldEvent<>(getBaseMetaTileEntity().getWorld(), "largesmoke"); + + for (int i = 0; i < 8; i++){ + events.setPosition( + aX - 0.5 + XSTR_INSTANCE.nextFloat(), + aY - 0.5 + XSTR_INSTANCE.nextFloat(), + aZ - 0.5 + XSTR_INSTANCE.nextFloat() + ); + events.spawnParticle( + ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetX / 5.0, + ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetY / 5.0, + ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetZ / 5.0 + ); + } } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java index 147973b183..759c6c4c02 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java @@ -1,11 +1,7 @@ package gregtech.api.metatileentity.implementations; import cpw.mods.fml.common.Loader; -import gregtech.api.enums.ItemList; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.enums.Textures; -import gregtech.api.enums.Tier; +import gregtech.api.enums.*; import gregtech.api.gui.GT_Container_BasicMachine; import gregtech.api.gui.GT_GUIContainer_BasicMachine; import gregtech.api.interfaces.ITexture; @@ -16,6 +12,7 @@ import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; +import gregtech.api.util.PositionedWorldEvent; import ic2.core.Ic2Items; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.init.Blocks; @@ -26,10 +23,7 @@ import net.minecraftforge.oredict.OreDictionary; import java.util.Locale; import java.util.Random; -import static gregtech.api.enums.GT_Values.V; -import static gregtech.api.enums.GT_Values.VN; -import static gregtech.api.enums.GT_Values.W; -import static gregtech.api.enums.GT_Values.ticksBetweenSounds; +import static gregtech.api.enums.GT_Values.*; /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! @@ -806,12 +800,15 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ break; case 1: if (aBaseMetaTileEntity.getFrontFacing() != 1 && aBaseMetaTileEntity.getCoverIDAtSide((byte) 1) == 0 && !aBaseMetaTileEntity.getOpacityAtSide((byte) 1)) { - Random tRandom = aBaseMetaTileEntity.getWorld().rand; - aBaseMetaTileEntity.getWorld().spawnParticle( - "smoke", aBaseMetaTileEntity.getXCoord() + 0.8F - tRandom.nextFloat() * 0.6F, - aBaseMetaTileEntity.getYCoord() + 0.9F + tRandom.nextFloat() * 0.2F, - aBaseMetaTileEntity.getZCoord() + 0.8F - tRandom.nextFloat() * 0.6F, 0.0D, 0.0D, 0.0D + PositionedWorldEvent events = new PositionedWorldEvent<>(aBaseMetaTileEntity.getWorld(), "smoke"); + Random tRandom = events.getWorld().rand; + + events.setPosition( + aBaseMetaTileEntity.getXCoord() + 0.8F - tRandom.nextFloat() * 0.6F, + aBaseMetaTileEntity.getYCoord() + 0.9F + tRandom.nextFloat() * 0.2F, + aBaseMetaTileEntity.getZCoord() + 0.8F - tRandom.nextFloat() * 0.6F ); + events.spawnParticle(0.0D, 0.0D, 0.0D); } break; } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java index e651df066b..d8b1655b43 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java @@ -9,6 +9,7 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_LanguageManager; +import gregtech.api.util.PositionedWorldEvent; import gregtech.common.GT_Pollution; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -140,14 +141,20 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { zSpd = aDir.offsetZ * (0.1F + 0.2F * XSTR_INSTANCE.nextFloat()); } - if (chk1) - aWorld.spawnParticle(name, xPos + ran1 * 0.5F, yPos + XSTR_INSTANCE.nextFloat() * 0.5F, zPos + XSTR_INSTANCE.nextFloat() * 0.5F, xSpd, ySpd, zSpd); + PositionedWorldEvent events = new PositionedWorldEvent<>(aWorld, name); - if (chk2) - aWorld.spawnParticle(name, xPos + ran2 * 0.5F, yPos + XSTR_INSTANCE.nextFloat() * 0.5F, zPos + XSTR_INSTANCE.nextFloat() * 0.5F, xSpd, ySpd, zSpd); - - if (chk3) - aWorld.spawnParticle(name, xPos + ran3 * 0.5F, yPos + XSTR_INSTANCE.nextFloat() * 0.5F, zPos + XSTR_INSTANCE.nextFloat() * 0.5F, xSpd, ySpd, zSpd); + if (chk1) { + events.setPosition(xPos + ran1 * 0.5F, yPos + XSTR_INSTANCE.nextFloat() * 0.5F, zPos + XSTR_INSTANCE.nextFloat() * 0.5F); + events.spawnParticle(xSpd, ySpd, zSpd); + } + if (chk2) { + events.setPosition(xPos + ran2 * 0.5F, yPos + XSTR_INSTANCE.nextFloat() * 0.5F, zPos + XSTR_INSTANCE.nextFloat() * 0.5F); + events.spawnParticle(xSpd, ySpd, zSpd); + } + if (chk3) { + events.setPosition(xPos + ran3 * 0.5F, yPos + XSTR_INSTANCE.nextFloat() * 0.5F, zPos + XSTR_INSTANCE.nextFloat() * 0.5F); + events.spawnParticle(xSpd, ySpd, zSpd); + } } public int calculatePollutionReduction(int aPollution) { diff --git a/src/main/java/gregtech/api/util/GT_FoodStat.java b/src/main/java/gregtech/api/util/GT_FoodStat.java index d0fe9bdbf4..da3b220845 100644 --- a/src/main/java/gregtech/api/util/GT_FoodStat.java +++ b/src/main/java/gregtech/api/util/GT_FoodStat.java @@ -68,7 +68,8 @@ public class GT_FoodStat implements IFoodStat { ItemStack tStack = GT_OreDictUnificator.get(GT_Utility.copy(mEmptyContainer)); if (tStack != null && !aPlayer.inventory.addItemStackToInventory(tStack)) aPlayer.dropPlayerItemWithRandomChoice(tStack, true); - aPlayer.worldObj.playSoundAtEntity(aPlayer, "random.burp", 0.5F, aPlayer.worldObj.rand.nextFloat() * 0.1F + 0.9F); + PositionedWorldEvent event = new PositionedWorldEvent<>(aPlayer.worldObj, "random.burp"); + event.playSoundAtEntity(aPlayer,0.5F, aPlayer.worldObj.rand.nextFloat() * 0.1F + 0.9F); if (!aPlayer.worldObj.isRemote) { if (mMilk) { aPlayer.curePotionEffects(new ItemStack(Items.milk_bucket, 1, 0)); @@ -79,7 +80,9 @@ public class GT_FoodStat implements IFoodStat { } } if (mExplosive) { - aPlayer.worldObj.newExplosion(aPlayer, aPlayer.posX, aPlayer.posY, aPlayer.posZ, 4, true, true); + event.setThing(aPlayer); + event.setPosition(aPlayer.posX, aPlayer.posY, aPlayer.posZ); + event.newExplosion(4,true, true); aPlayer.attackEntityFrom(GT_DamageSources.getExplodingDamage(), Float.MAX_VALUE); } } diff --git a/src/main/java/gregtech/api/util/PositionedWorldEvent.java b/src/main/java/gregtech/api/util/PositionedWorldEvent.java new file mode 100644 index 0000000000..ce5543b320 --- /dev/null +++ b/src/main/java/gregtech/api/util/PositionedWorldEvent.java @@ -0,0 +1,144 @@ +package gregtech.api.util; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; + +@SuppressWarnings("unused") +public class PositionedWorldEvent { + + public PositionedWorldEvent() {} + + public PositionedWorldEvent(World world) { + this.world = world; + } + + public PositionedWorldEvent(Vec3 position) { + this.position = position; + } + + public PositionedWorldEvent(T thing) { + this.thing = thing; + } + + public PositionedWorldEvent(World world, T thing) { + this(world); + this.thing = thing; + } + + public PositionedWorldEvent(World world, Vec3 position) { + this(world); + this.position = position; + } + + public PositionedWorldEvent(Vec3 position, T thing) { + this(position); + this.thing = thing; + } + + public PositionedWorldEvent(T thing, Vec3 position) { + this(position, thing); + } + + public PositionedWorldEvent(World world, Vec3 position, T thing) { + this(world, position); + this.thing = thing; + } + + public PositionedWorldEvent(World world, T thing, Vec3 position) { + this(world, position, thing); + } + + private World world; + private Vec3 position; + private T thing; + + public World getWorld() { + return world; + } + + public void setWorld(World world) { + this.world = world; + } + + public Vec3 getPosition() { + return position; + } + + public void setPosition(Vec3 position) { + this.position = position; + } + + public void setPosition(double x, double y, double z) { + this.position = Vec3.createVectorHelper(x, y, z); + } + + public T getThing() { + return thing; + } + + public void setThing(T thing) { + this.thing = thing; + } + + public void spawnParticle(double motionX, double motionY, double motionZ) { + if (position == null || !(thing instanceof String) || world == null) + return; + + world.spawnParticle((String) thing, position.xCoord, position.yCoord, position.zCoord, motionX, motionY, motionZ); + } + + public void playSoundEffect(float volume, float pitch) { + if (position == null || !(thing instanceof String) || world == null) + return; + + world.playSoundEffect(position.xCoord, position.yCoord, position.zCoord, (String) thing, volume, pitch); + } + + public void playRecord() { + if (position == null || !(thing instanceof String) || world == null) + return; + + world.playRecord((String) thing, (int) position.xCoord, (int) position.yCoord, (int) position.zCoord); + } + + public void playSound(float volume, float pitch, boolean proximity) { + if (position == null || !(thing instanceof String) || world == null) + return; + + world.playSound(position.xCoord, position.yCoord, position.zCoord, (String) thing, volume, pitch, proximity); + } + + public void createExplosion(float strength, boolean isSmoking) { + newExplosion(strength, false, isSmoking); + } + + public void newExplosion(float strength, boolean isFlaming, boolean isSmoking) { + if (position == null || world == null) + return; + + world.newExplosion((Entity) thing, position.xCoord, position.yCoord, position.zCoord, strength, isFlaming, isSmoking); + } + + public boolean extinguishFire(int side) { + if (position == null || world == null) + return false; + + return world.extinguishFire((EntityPlayer) thing, (int) position.xCoord, (int) position.yCoord, (int) position.zCoord, side); + } + + public void playSoundAtEntity(Entity entity, float volume, float pitch) { + if (!(thing instanceof String)) { + return; + } + world.playSoundAtEntity(entity, (String) thing, volume, pitch); + } + + public void playSoundToNearExcept(EntityPlayer player, float volume, float pitch) { + if (!(thing instanceof String)) { + return; + } + world.playSoundToNearExcept(player, (String) thing, volume, pitch); + } +} \ No newline at end of file diff --git a/src/main/java/gregtech/common/GT_Client.java b/src/main/java/gregtech/common/GT_Client.java index e4847543ec..13c9a22a97 100644 --- a/src/main/java/gregtech/common/GT_Client.java +++ b/src/main/java/gregtech/common/GT_Client.java @@ -17,20 +17,10 @@ import gregtech.api.interfaces.tileentity.ICoverable; import gregtech.api.interfaces.tileentity.ITurnable; import gregtech.api.metatileentity.BaseMetaPipeEntity; import gregtech.api.objects.GT_ItemStack; -import gregtech.api.util.GT_Log; -import gregtech.api.util.GT_PlayedSound; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; +import gregtech.api.util.*; import gregtech.common.entities.GT_Entity_Arrow; import gregtech.common.entities.GT_Entity_Arrow_Potion; -import gregtech.common.render.GT_CapeRenderer; -import gregtech.common.render.GT_FlaskRenderer; -import gregtech.common.render.GT_FluidDisplayStackRenderer; -import gregtech.common.render.GT_MetaGenerated_Item_Renderer; -import gregtech.common.render.GT_MetaGenerated_Tool_Renderer; -import gregtech.common.render.GT_PollutionRenderer; -import gregtech.common.render.GT_Renderer_Block; -import gregtech.common.render.GT_Renderer_Entity_Arrow; +import gregtech.common.render.*; import ic2.api.tile.IWrenchable; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; @@ -46,13 +36,7 @@ import net.minecraftforge.oredict.OreDictionary; import org.lwjgl.opengl.GL11; import java.net.URL; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Scanner; +import java.util.*; // Referenced classes of package gregtech.common: // GT_Proxy @@ -648,10 +632,20 @@ public class GT_Client extends GT_Proxy tString = (new StringBuilder()).append(tString).append("wherearewenow").toString(); break; } - if (tString.startsWith("streaming.")) - aWorld.playRecord(tString.substring(10, tString.length()), (int) aX, (int) aY, (int) aZ); - else - aWorld.playSound(aX, aY, aZ, tString, 3F, tString.startsWith("note.") ? (float) Math.pow(2D, (double) (aStack.stackSize - 13) / 12D) : 1.0F, false); + PositionedWorldEvent events = new PositionedWorldEvent<>(aWorld); + events.setPosition(aX, aY, aZ); + if (tString.startsWith("streaming.")){ + events.setThing(tString.substring(10)); + events.playRecord(); + } + else{ + events.setThing(tString); + events.playSound( + 3F, + tString.startsWith("note.") ? (float) Math.pow(2D, (double) (aStack.stackSize - 13) / 12D) : 1.0F, + false + ); + } } public static int hideValue=0; diff --git a/src/main/java/gregtech/common/GT_Proxy.java b/src/main/java/gregtech/common/GT_Proxy.java index e4e3592eb3..e34ae1cada 100644 --- a/src/main/java/gregtech/common/GT_Proxy.java +++ b/src/main/java/gregtech/common/GT_Proxy.java @@ -33,22 +33,8 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.items.GT_MetaGenerated_Item; import gregtech.api.items.GT_MetaGenerated_Tool; -import gregtech.api.objects.GT_ChunkManager; -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.GT_CLS_Compat; -import gregtech.api.util.GT_CoverBehavior; -import gregtech.api.util.GT_LanguageManager; -import gregtech.api.util.GT_Log; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_RecipeRegistrator; -import gregtech.api.util.GT_Shaped_Recipe; -import gregtech.api.util.GT_Shapeless_Recipe; -import gregtech.api.util.GT_Utility; +import gregtech.api.objects.*; +import gregtech.api.util.*; import gregtech.common.entities.GT_Entity_Arrow; import gregtech.common.gui.GT_ContainerVolumetricFlask; import gregtech.common.gui.GT_GUIContainerVolumetricFlask; @@ -781,8 +767,9 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { } aEvent.bow.damageItem(1, aEvent.entityPlayer); aEvent.bow.getItem(); - aEvent.entityPlayer.worldObj.playSoundAtEntity(aEvent.entityPlayer, "random.bow", 1.0F, 0.64893958288F + tSpeed - * 0.5F); + + PositionedWorldEvent events = new PositionedWorldEvent<>(aEvent.entityPlayer.worldObj, "random.bow"); + events.playSoundAtEntity(aEvent.entityPlayer, 1.0F, 0.64893958288F + tSpeed * 0.5F); tArrowEntity.canBePickedUp = 1; if (!aEvent.entityPlayer.capabilities.isCreativeMode) { diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Reinforced.java b/src/main/java/gregtech/common/blocks/GT_Block_Reinforced.java index 6b3b0823fb..aca5963c8a 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Reinforced.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Reinforced.java @@ -11,6 +11,7 @@ import gregtech.api.items.GT_Generic_Block; import gregtech.api.objects.GT_CopiedBlockTexture; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.PositionedWorldEvent; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -255,8 +256,9 @@ public class GT_Block_Reinforced extends GT_Generic_Block { if(!world.isRemote && world.getBlockMetadata(x, y, z)==5){ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, x + 0.5F, y + 0.5F, z + 0.5F, player); world.spawnEntityInWorld(entitytntprimed); - world.playSoundAtEntity(entitytntprimed, "game.tnt.primed", 1.0F, 1.0F); - + PositionedWorldEvent events = new PositionedWorldEvent<>(world, "game.tnt.primed"); + events.playSoundAtEntity(entitytntprimed, 1.0F, 1.0F); + world.setBlockToAir(x, y, z); return false; } diff --git a/src/main/java/gregtech/common/entities/GT_Entity_Arrow.java b/src/main/java/gregtech/common/entities/GT_Entity_Arrow.java index d655a75c99..65fe475360 100644 --- a/src/main/java/gregtech/common/entities/GT_Entity_Arrow.java +++ b/src/main/java/gregtech/common/entities/GT_Entity_Arrow.java @@ -4,6 +4,7 @@ import com.mojang.authlib.GameProfile; import gregtech.api.objects.ItemData; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; +import gregtech.api.util.PositionedWorldEvent; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.enchantment.Enchantment; @@ -241,9 +242,16 @@ public class GT_Entity_Arrow extends EntityArrow { } } } + PositionedWorldEvent events = new PositionedWorldEvent<>(this.worldObj); if (getIsCritical()) { + events.setThing("crit"); for (int i = 0; i < 4; i++) { - this.worldObj.spawnParticle("crit", this.posX + this.motionX * i / 4.0D, this.posY + this.motionY * i / 4.0D, this.posZ + this.motionZ * i / 4.0D, -this.motionX, -this.motionY + 0.2D, -this.motionZ); + events.setPosition( + this.posX + this.motionX * i / 4.0D, + this.posY + this.motionY * i / 4.0D, + this.posZ + this.motionZ * i / 4.0D + ); + events.spawnParticle(-this.motionX, -this.motionY + 0.2D, -this.motionZ); } } this.posX += this.motionX; @@ -266,8 +274,10 @@ public class GT_Entity_Arrow extends EntityArrow { this.rotationYaw = (this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F); float tFrictionMultiplier = 0.99F; if (isInWater()) { + events.setThing("bubble"); + events.setPosition(this.posX - this.motionX * 0.25D, this.posY - this.motionY * 0.25D, this.posZ - this.motionZ * 0.25D); for (int l = 0; l < 4; l++) { - this.worldObj.spawnParticle("bubble", this.posX - this.motionX * 0.25D, this.posY - this.motionY * 0.25D, this.posZ - this.motionZ * 0.25D, this.motionX, this.motionY, this.motionZ); + events.spawnParticle(this.motionX, this.motionY, this.motionZ); } tFrictionMultiplier = 0.8F; } diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_Hoe.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Hoe.java index 98631581ab..149c9b9a82 100644 --- a/src/main/java/gregtech/common/items/behaviors/Behaviour_Hoe.java +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Hoe.java @@ -5,6 +5,7 @@ import gregtech.api.items.GT_MetaBase_Item; import gregtech.api.items.GT_MetaGenerated_Tool; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_Utility; +import gregtech.api.util.PositionedWorldEvent; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -39,7 +40,9 @@ public class Behaviour_Hoe extends Behaviour_None { } Block aBlock = aWorld.getBlock(aX, aY, aZ); if ((aSide != 0) && (GT_Utility.isBlockAir(aWorld, aX, aY + 1, aZ)) && ((aBlock == Blocks.grass) || (aBlock == Blocks.dirt))) { - aWorld.playSoundEffect(aX + 0.5F, aY + 0.5F, aZ + 0.5F, Blocks.farmland.stepSound.getStepResourcePath(), (Blocks.farmland.stepSound.getVolume() + 1.0F) / 2.0F, Blocks.farmland.stepSound.getPitch() * 0.8F); + PositionedWorldEvent events = new PositionedWorldEvent<>(aWorld, Blocks.farmland.stepSound.getStepResourcePath()); + events.setPosition(aX + 0.5F, aY + 0.5F, aZ + 0.5F); + events.playSoundEffect((Blocks.farmland.stepSound.getVolume() + 1.0F) / 2.0F, Blocks.farmland.stepSound.getPitch() * 0.8F); if (aWorld.isRemote) { return true; } diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler.java index f728d375fa..7e564545f1 100644 --- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler.java +++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler.java @@ -8,10 +8,7 @@ import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; import gregtech.api.objects.GT_ItemStack; -import gregtech.api.util.GT_Log; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Utility; +import gregtech.api.util.*; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -265,9 +262,16 @@ public abstract class GT_MetaTileEntity_Boiler extends GT_MetaTileEntity_BasicTa public void doSound(byte aIndex, double aX, double aY, double aZ) { if (aIndex == 1) { - GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(4), 2, 1.0F, aX, aY, aZ); + GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(4), 2, 1.0F, aX, aY, aZ); + PositionedWorldEvent events = new PositionedWorldEvent<>(getBaseMetaTileEntity().getWorld(), "largesmoke"); + for (int l = 0; l < 8; l++) { - getBaseMetaTileEntity().getWorld().spawnParticle("largesmoke", aX - 0.5D + XSTR_INSTANCE.nextFloat(), aY, aZ - 0.5D + XSTR_INSTANCE.nextFloat(), 0.0D, 0.0D, 0.0D); + events.setPosition( + aX - 0.5D + XSTR_INSTANCE.nextFloat(), + aY, + aZ - 0.5D + XSTR_INSTANCE.nextFloat() + ); + events.spawnParticle(0.0D, 0.0D, 0.0D); } } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PrimitiveBlastFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PrimitiveBlastFurnace.java index 225cd24e3e..b29bd73bd1 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PrimitiveBlastFurnace.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PrimitiveBlastFurnace.java @@ -7,6 +7,7 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.objects.GT_ItemStack; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; +import gregtech.api.util.PositionedWorldEvent; import gregtech.common.GT_Pollution; import gregtech.common.gui.GT_Container_PrimitiveBlastFurnace; import gregtech.common.gui.GT_GUIContainer_PrimitiveBlastFurnace; @@ -16,6 +17,7 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.Vec3; import net.minecraft.world.ChunkPosition; import net.minecraftforge.common.util.ForgeDirection; import org.lwjgl.input.Keyboard; @@ -177,10 +179,16 @@ public abstract class GT_MetaTileEntity_PrimitiveBlastFurnace extends MetaTileEn public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { if ((aBaseMetaTileEntity.isClientSide()) && (aBaseMetaTileEntity.isActive())) { - aBaseMetaTileEntity.getWorld().spawnParticle("largesmoke", + + Vec3 position = Vec3.createVectorHelper( aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1) + XSTR_INSTANCE.nextFloat(), aBaseMetaTileEntity.getOffsetY(aBaseMetaTileEntity.getBackFacing(), 1), - aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1) + XSTR_INSTANCE.nextFloat(), 0.0D, 0.3D, 0.0D); + aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1) + XSTR_INSTANCE.nextFloat() + ); + + PositionedWorldEvent events = new PositionedWorldEvent<>(aBaseMetaTileEntity.getWorld(), position,"largesmoke"); + + events.spawnParticle(0.0D, 0.3D, 0.0D); } if (aBaseMetaTileEntity.isServerSide()) { if (this.mUpdate-- == 0) { diff --git a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Bronze.java b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Bronze.java index 90f35edbc3..3f77245887 100644 --- a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Bronze.java +++ b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Bronze.java @@ -11,6 +11,7 @@ import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; +import gregtech.api.util.PositionedWorldEvent; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; @@ -43,8 +44,10 @@ public class GT_MetaTileEntity_Macerator_Bronze extends GT_MetaTileEntity_BasicM public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPreTick(aBaseMetaTileEntity, aTick); if ((aBaseMetaTileEntity.isClientSide()) && (aBaseMetaTileEntity.isActive()) && (aBaseMetaTileEntity.getFrontFacing() != 1) && (aBaseMetaTileEntity.getCoverIDAtSide((byte) 1) == 0) && (!aBaseMetaTileEntity.getOpacityAtSide((byte) 1))) { - Random tRandom = aBaseMetaTileEntity.getWorld().rand; - aBaseMetaTileEntity.getWorld().spawnParticle("smoke", aBaseMetaTileEntity.getXCoord() + 0.8F - tRandom.nextFloat() * 0.6F, aBaseMetaTileEntity.getYCoord() + 0.9F + tRandom.nextFloat() * 0.2F, aBaseMetaTileEntity.getZCoord() + 0.8F - tRandom.nextFloat() * 0.6F, 0.0D, 0.0D, 0.0D); + PositionedWorldEvent events = new PositionedWorldEvent<>(getBaseMetaTileEntity().getWorld(), "smoke"); + Random tRandom = events.getWorld().rand; + events.setPosition(aBaseMetaTileEntity.getXCoord() + 0.8F - tRandom.nextFloat() * 0.6F, aBaseMetaTileEntity.getYCoord() + 0.9F + tRandom.nextFloat() * 0.2F, aBaseMetaTileEntity.getZCoord() + 0.8F - tRandom.nextFloat() * 0.6F); + events.spawnParticle(0.0D, 0.0D, 0.0D); } } diff --git a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Steel.java b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Steel.java index b59f5403b4..a5a0286c03 100644 --- a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Steel.java +++ b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Steel.java @@ -11,6 +11,7 @@ import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; +import gregtech.api.util.PositionedWorldEvent; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; @@ -43,8 +44,10 @@ public class GT_MetaTileEntity_Macerator_Steel extends GT_MetaTileEntity_BasicMa public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPreTick(aBaseMetaTileEntity, aTick); if ((aBaseMetaTileEntity.isClientSide()) && (aBaseMetaTileEntity.isActive()) && (aBaseMetaTileEntity.getFrontFacing() != 1) && (aBaseMetaTileEntity.getCoverIDAtSide((byte) 1) == 0) && (!aBaseMetaTileEntity.getOpacityAtSide((byte) 1))) { - Random tRandom = aBaseMetaTileEntity.getWorld().rand; - aBaseMetaTileEntity.getWorld().spawnParticle("smoke", aBaseMetaTileEntity.getXCoord() + 0.8F - tRandom.nextFloat() * 0.6F, aBaseMetaTileEntity.getYCoord() + 0.9F + tRandom.nextFloat() * 0.2F, aBaseMetaTileEntity.getZCoord() + 0.8F - tRandom.nextFloat() * 0.6F, 0.0D, 0.0D, 0.0D); + PositionedWorldEvent events = new PositionedWorldEvent<>(getBaseMetaTileEntity().getWorld(), "smoke"); + Random tRandom = events.getWorld().rand; + events.setPosition(aBaseMetaTileEntity.getXCoord() + 0.8F - tRandom.nextFloat() * 0.6F, aBaseMetaTileEntity.getYCoord() + 0.9F + tRandom.nextFloat() * 0.2F, aBaseMetaTileEntity.getZCoord() + 0.8F - tRandom.nextFloat() * 0.6F); + events.spawnParticle(0.0D, 0.0D, 0.0D); } } -- cgit From d006460e3e3f2221b82c03b02d282d5ed6767095 Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Wed, 10 Mar 2021 19:47:29 +0100 Subject: Implemented Requests --- .../interfaces/tileentity/IEnergyConnected.java | 4 +-- .../api/metatileentity/MetaPipeEntity.java | 4 +-- .../implementations/GT_MetaPipeEntity_Fluid.java | 25 ++++++++--------- .../GT_MetaTileEntity_BasicMachine_Bronze.java | 24 +++++++--------- .../GT_MetaTileEntity_BasicMachine_GT_Recipe.java | 18 ++++++------ .../GT_MetaTileEntity_Hatch_Muffler.java | 12 ++++---- src/main/java/gregtech/api/util/GT_FoodStat.java | 6 ++-- .../gregtech/api/util/PositionedWorldEvent.java | 32 +++++++++++++++++++--- src/main/java/gregtech/common/GT_Client.java | 12 ++++---- .../gregtech/common/entities/GT_Entity_Arrow.java | 26 ++++++++---------- .../common/items/behaviors/Behaviour_Hoe.java | 6 ++-- .../boilers/GT_MetaTileEntity_Boiler.java | 18 ++++++------ .../steam/GT_MetaTileEntity_Macerator_Bronze.java | 11 +++++--- .../steam/GT_MetaTileEntity_Macerator_Steel.java | 11 +++++--- 14 files changed, 114 insertions(+), 95 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java index 66b0e5b27c..4487ec57d6 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java @@ -116,8 +116,8 @@ public interface IEnergyConnected extends IColoredTileEntity, IHasWorldObjectAnd GT_Pollution.addPollution(tWorld.getChunkFromBlockCoords(tX, tZ), 100000); PositionedWorldEvent event = new PositionedWorldEvent<>(tWorld); - event.setPosition(tX + 0.5, tY + 0.5, tZ + 0.5); - event.createExplosion(tStrength, true); + event.setPosition(tX + 0.5, tY + 0.5, tZ + 0.5) + .createExplosion(tStrength, true); } } } diff --git a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java index 8fc06b3dc4..879982e995 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java @@ -700,8 +700,8 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { tWorld.setBlock(tX, tY, tZ, Blocks.air); if (GregTech_API.sMachineExplosions){ PositionedWorldEvent event = new PositionedWorldEvent<>(tWorld); - event.setPosition(tX + 0.5, tY + 0.5, tZ + 0.5); - event.createExplosion(tStrength, true); + event.setPosition(tX + 0.5, tY + 0.5, tZ + 0.5) + .createExplosion(tStrength, true); } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java index dd207a1b39..8e0c010995 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java @@ -445,20 +445,17 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { super.doSound(aIndex, aX, aY, aZ); if (aIndex == 9) { GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(4), 5, 1.0F, aX, aY, aZ); - PositionedWorldEvent events = new PositionedWorldEvent<>(getBaseMetaTileEntity().getWorld(), "largesmoke"); - - for (int i = 0; i < 6; i++){ - events.setPosition( - aX - 0.5 + XSTR_INSTANCE.nextFloat(), - aY - 0.5 + XSTR_INSTANCE.nextFloat(), - aZ - 0.5 + XSTR_INSTANCE.nextFloat() - ); - events.spawnParticle( - ForgeDirection.getOrientation(i).offsetX / 5.0, - ForgeDirection.getOrientation(i).offsetY / 5.0, - ForgeDirection.getOrientation(i).offsetZ / 5.0 - ); - } + + new PositionedWorldEvent<>(getBaseMetaTileEntity().getWorld(), "largesmoke") + .times(6, (x, i) -> x.setPosition( + aX - 0.5 + XSTR_INSTANCE.nextFloat(), + aY - 0.5 + XSTR_INSTANCE.nextFloat(), + aZ - 0.5 + XSTR_INSTANCE.nextFloat() + ).spawnParticle( + ForgeDirection.getOrientation(i).offsetX / 5.0, + ForgeDirection.getOrientation(i).offsetY / 5.0, + ForgeDirection.getOrientation(i).offsetZ / 5.0 + )); } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java index 50b942d294..7d8d6dbba0 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java @@ -154,20 +154,16 @@ public abstract class GT_MetaTileEntity_BasicMachine_Bronze extends GT_MetaTileE super.doSound(aIndex, aX, aY, aZ); if (aIndex == 9) { GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(4), 5, 1.0F, aX, aY, aZ); - PositionedWorldEvent events = new PositionedWorldEvent<>(getBaseMetaTileEntity().getWorld(), "largesmoke"); - - for (int i = 0; i < 8; i++){ - events.setPosition( - aX - 0.5 + XSTR_INSTANCE.nextFloat(), - aY - 0.5 + XSTR_INSTANCE.nextFloat(), - aZ - 0.5 + XSTR_INSTANCE.nextFloat() - ); - events.spawnParticle( - ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetX / 5.0, - ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetY / 5.0, - ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetZ / 5.0 - ); - } + new PositionedWorldEvent<>(getBaseMetaTileEntity().getWorld(), "largesmoke") + .times(8, x -> x.setPosition( + aX - 0.5 + XSTR_INSTANCE.nextFloat(), + aY - 0.5 + XSTR_INSTANCE.nextFloat(), + aZ - 0.5 + XSTR_INSTANCE.nextFloat() + ).spawnParticle( + ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetX / 5.0, + ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetY / 5.0, + ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetZ / 5.0 + )); } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java index 759c6c4c02..c2e4fc441c 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java @@ -800,15 +800,15 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ break; case 1: if (aBaseMetaTileEntity.getFrontFacing() != 1 && aBaseMetaTileEntity.getCoverIDAtSide((byte) 1) == 0 && !aBaseMetaTileEntity.getOpacityAtSide((byte) 1)) { - PositionedWorldEvent events = new PositionedWorldEvent<>(aBaseMetaTileEntity.getWorld(), "smoke"); - Random tRandom = events.getWorld().rand; - - events.setPosition( - aBaseMetaTileEntity.getXCoord() + 0.8F - tRandom.nextFloat() * 0.6F, - aBaseMetaTileEntity.getYCoord() + 0.9F + tRandom.nextFloat() * 0.2F, - aBaseMetaTileEntity.getZCoord() + 0.8F - tRandom.nextFloat() * 0.6F - ); - events.spawnParticle(0.0D, 0.0D, 0.0D); + + Random tRandom = aBaseMetaTileEntity.getWorld().rand; + new PositionedWorldEvent<>(aBaseMetaTileEntity.getWorld(), "smoke") + .setPosition( + aBaseMetaTileEntity.getXCoord() + 0.8F - tRandom.nextFloat() * 0.6F, + aBaseMetaTileEntity.getYCoord() + 0.9F + tRandom.nextFloat() * 0.2F, + aBaseMetaTileEntity.getZCoord() + 0.8F - tRandom.nextFloat() * 0.6F + ) + .spawnParticle(0.0D, 0.0D, 0.0D); } break; } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java index d8b1655b43..44567c96eb 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java @@ -144,16 +144,16 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { PositionedWorldEvent events = new PositionedWorldEvent<>(aWorld, name); if (chk1) { - events.setPosition(xPos + ran1 * 0.5F, yPos + XSTR_INSTANCE.nextFloat() * 0.5F, zPos + XSTR_INSTANCE.nextFloat() * 0.5F); - events.spawnParticle(xSpd, ySpd, zSpd); + events.setPosition(xPos + ran1 * 0.5F, yPos + XSTR_INSTANCE.nextFloat() * 0.5F, zPos + XSTR_INSTANCE.nextFloat() * 0.5F) + .spawnParticle(xSpd, ySpd, zSpd); } if (chk2) { - events.setPosition(xPos + ran2 * 0.5F, yPos + XSTR_INSTANCE.nextFloat() * 0.5F, zPos + XSTR_INSTANCE.nextFloat() * 0.5F); - events.spawnParticle(xSpd, ySpd, zSpd); + events.setPosition(xPos + ran2 * 0.5F, yPos + XSTR_INSTANCE.nextFloat() * 0.5F, zPos + XSTR_INSTANCE.nextFloat() * 0.5F) + .spawnParticle(xSpd, ySpd, zSpd); } if (chk3) { - events.setPosition(xPos + ran3 * 0.5F, yPos + XSTR_INSTANCE.nextFloat() * 0.5F, zPos + XSTR_INSTANCE.nextFloat() * 0.5F); - events.spawnParticle(xSpd, ySpd, zSpd); + events.setPosition(xPos + ran3 * 0.5F, yPos + XSTR_INSTANCE.nextFloat() * 0.5F, zPos + XSTR_INSTANCE.nextFloat() * 0.5F) + .spawnParticle(xSpd, ySpd, zSpd); } } diff --git a/src/main/java/gregtech/api/util/GT_FoodStat.java b/src/main/java/gregtech/api/util/GT_FoodStat.java index da3b220845..96345ef199 100644 --- a/src/main/java/gregtech/api/util/GT_FoodStat.java +++ b/src/main/java/gregtech/api/util/GT_FoodStat.java @@ -80,9 +80,9 @@ public class GT_FoodStat implements IFoodStat { } } if (mExplosive) { - event.setThing(aPlayer); - event.setPosition(aPlayer.posX, aPlayer.posY, aPlayer.posZ); - event.newExplosion(4,true, true); + event.setThing(aPlayer) + .setPosition(aPlayer.posX, aPlayer.posY, aPlayer.posZ) + .newExplosion(4,true, true); aPlayer.attackEntityFrom(GT_DamageSources.getExplodingDamage(), Float.MAX_VALUE); } } diff --git a/src/main/java/gregtech/api/util/PositionedWorldEvent.java b/src/main/java/gregtech/api/util/PositionedWorldEvent.java index ce5543b320..e8518b5444 100644 --- a/src/main/java/gregtech/api/util/PositionedWorldEvent.java +++ b/src/main/java/gregtech/api/util/PositionedWorldEvent.java @@ -5,6 +5,12 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.Vec3; import net.minecraft.world.World; +import java.util.List; +import java.util.Objects; +import java.util.function.BiConsumer; +import java.util.function.Consumer; +import java.util.function.Supplier; + @SuppressWarnings("unused") public class PositionedWorldEvent { @@ -58,28 +64,32 @@ public class PositionedWorldEvent { return world; } - public void setWorld(World world) { + public PositionedWorldEvent setWorld(World world) { this.world = world; + return this; } public Vec3 getPosition() { return position; } - public void setPosition(Vec3 position) { + public PositionedWorldEvent setPosition(Vec3 position) { this.position = position; + return this; } - public void setPosition(double x, double y, double z) { + public PositionedWorldEvent setPosition(double x, double y, double z) { this.position = Vec3.createVectorHelper(x, y, z); + return this; } public T getThing() { return thing; } - public void setThing(T thing) { + public PositionedWorldEvent setThing(T thing) { this.thing = thing; + return this; } public void spawnParticle(double motionX, double motionY, double motionZ) { @@ -141,4 +151,18 @@ public class PositionedWorldEvent { } world.playSoundToNearExcept(player, (String) thing, volume, pitch); } + + public void times(int times, Consumer> action) { + Objects.requireNonNull(action); + for (int i = 0; i < times; i++) { + action.accept(this); + } + } + + public void times(int times, BiConsumer, Integer> action) { + Objects.requireNonNull(action); + for (int i = 0; i < times; i++) { + action.accept(this, i); + } + } } \ No newline at end of file diff --git a/src/main/java/gregtech/common/GT_Client.java b/src/main/java/gregtech/common/GT_Client.java index 13c9a22a97..88823c9adf 100644 --- a/src/main/java/gregtech/common/GT_Client.java +++ b/src/main/java/gregtech/common/GT_Client.java @@ -632,15 +632,15 @@ public class GT_Client extends GT_Proxy tString = (new StringBuilder()).append(tString).append("wherearewenow").toString(); break; } - PositionedWorldEvent events = new PositionedWorldEvent<>(aWorld); - events.setPosition(aX, aY, aZ); + PositionedWorldEvent events = new PositionedWorldEvent(aWorld) + .setPosition(aX, aY, aZ); if (tString.startsWith("streaming.")){ - events.setThing(tString.substring(10)); - events.playRecord(); + events.setThing(tString.substring(10)) + .playRecord(); } else{ - events.setThing(tString); - events.playSound( + events.setThing(tString) + .playSound( 3F, tString.startsWith("note.") ? (float) Math.pow(2D, (double) (aStack.stackSize - 13) / 12D) : 1.0F, false diff --git a/src/main/java/gregtech/common/entities/GT_Entity_Arrow.java b/src/main/java/gregtech/common/entities/GT_Entity_Arrow.java index 65fe475360..b9973e91fc 100644 --- a/src/main/java/gregtech/common/entities/GT_Entity_Arrow.java +++ b/src/main/java/gregtech/common/entities/GT_Entity_Arrow.java @@ -244,15 +244,11 @@ public class GT_Entity_Arrow extends EntityArrow { } PositionedWorldEvent events = new PositionedWorldEvent<>(this.worldObj); if (getIsCritical()) { - events.setThing("crit"); - for (int i = 0; i < 4; i++) { - events.setPosition( - this.posX + this.motionX * i / 4.0D, - this.posY + this.motionY * i / 4.0D, - this.posZ + this.motionZ * i / 4.0D - ); - events.spawnParticle(-this.motionX, -this.motionY + 0.2D, -this.motionZ); - } + events.setThing("crit").times(4, (x, i) -> x.setPosition( + this.posX + this.motionX * i / 4.0D, + this.posY + this.motionY * i / 4.0D, + this.posZ + this.motionZ * i / 4.0D + ).spawnParticle(-this.motionX, -this.motionY + 0.2D, -this.motionZ)); } this.posX += this.motionX; this.posY += this.motionY; @@ -274,11 +270,13 @@ public class GT_Entity_Arrow extends EntityArrow { this.rotationYaw = (this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F); float tFrictionMultiplier = 0.99F; if (isInWater()) { - events.setThing("bubble"); - events.setPosition(this.posX - this.motionX * 0.25D, this.posY - this.motionY * 0.25D, this.posZ - this.motionZ * 0.25D); - for (int l = 0; l < 4; l++) { - events.spawnParticle(this.motionX, this.motionY, this.motionZ); - } + events.setThing("bubble") + .setPosition( + this.posX - this.motionX * 0.25D, + this.posY - this.motionY * 0.25D, + this.posZ - this.motionZ * 0.25D + ).times(4, x -> x.spawnParticle(this.motionX, this.motionY, this.motionZ)); + tFrictionMultiplier = 0.8F; } if (isWet()) { diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_Hoe.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Hoe.java index 149c9b9a82..b2dc300221 100644 --- a/src/main/java/gregtech/common/items/behaviors/Behaviour_Hoe.java +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Hoe.java @@ -40,9 +40,9 @@ public class Behaviour_Hoe extends Behaviour_None { } Block aBlock = aWorld.getBlock(aX, aY, aZ); if ((aSide != 0) && (GT_Utility.isBlockAir(aWorld, aX, aY + 1, aZ)) && ((aBlock == Blocks.grass) || (aBlock == Blocks.dirt))) { - PositionedWorldEvent events = new PositionedWorldEvent<>(aWorld, Blocks.farmland.stepSound.getStepResourcePath()); - events.setPosition(aX + 0.5F, aY + 0.5F, aZ + 0.5F); - events.playSoundEffect((Blocks.farmland.stepSound.getVolume() + 1.0F) / 2.0F, Blocks.farmland.stepSound.getPitch() * 0.8F); + new PositionedWorldEvent<>(aWorld, Blocks.farmland.stepSound.getStepResourcePath()) + .setPosition(aX + 0.5F, aY + 0.5F, aZ + 0.5F) + .playSoundEffect((Blocks.farmland.stepSound.getVolume() + 1.0F) / 2.0F, Blocks.farmland.stepSound.getPitch() * 0.8F); if (aWorld.isRemote) { return true; } diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler.java index 7e564545f1..5ec08da5f4 100644 --- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler.java +++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler.java @@ -263,16 +263,14 @@ public abstract class GT_MetaTileEntity_Boiler extends GT_MetaTileEntity_BasicTa public void doSound(byte aIndex, double aX, double aY, double aZ) { if (aIndex == 1) { GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(4), 2, 1.0F, aX, aY, aZ); - PositionedWorldEvent events = new PositionedWorldEvent<>(getBaseMetaTileEntity().getWorld(), "largesmoke"); - - for (int l = 0; l < 8; l++) { - events.setPosition( - aX - 0.5D + XSTR_INSTANCE.nextFloat(), - aY, - aZ - 0.5D + XSTR_INSTANCE.nextFloat() - ); - events.spawnParticle(0.0D, 0.0D, 0.0D); - } + + new PositionedWorldEvent<>(getBaseMetaTileEntity().getWorld(), "largesmoke") + .times(8, x -> x.setPosition( + aX - 0.5D + XSTR_INSTANCE.nextFloat(), + aY, + aZ - 0.5D + XSTR_INSTANCE.nextFloat() + ) + .spawnParticle(0.0D, 0.0D, 0.0D)); } } diff --git a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Bronze.java b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Bronze.java index 3f77245887..2c36047919 100644 --- a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Bronze.java +++ b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Bronze.java @@ -44,10 +44,13 @@ public class GT_MetaTileEntity_Macerator_Bronze extends GT_MetaTileEntity_BasicM public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPreTick(aBaseMetaTileEntity, aTick); if ((aBaseMetaTileEntity.isClientSide()) && (aBaseMetaTileEntity.isActive()) && (aBaseMetaTileEntity.getFrontFacing() != 1) && (aBaseMetaTileEntity.getCoverIDAtSide((byte) 1) == 0) && (!aBaseMetaTileEntity.getOpacityAtSide((byte) 1))) { - PositionedWorldEvent events = new PositionedWorldEvent<>(getBaseMetaTileEntity().getWorld(), "smoke"); - Random tRandom = events.getWorld().rand; - events.setPosition(aBaseMetaTileEntity.getXCoord() + 0.8F - tRandom.nextFloat() * 0.6F, aBaseMetaTileEntity.getYCoord() + 0.9F + tRandom.nextFloat() * 0.2F, aBaseMetaTileEntity.getZCoord() + 0.8F - tRandom.nextFloat() * 0.6F); - events.spawnParticle(0.0D, 0.0D, 0.0D); + Random tRandom = getBaseMetaTileEntity().getWorld().rand; + new PositionedWorldEvent<>(getBaseMetaTileEntity().getWorld(), "smoke") + .setPosition( + aBaseMetaTileEntity.getXCoord() + 0.8F - tRandom.nextFloat() * 0.6F, + aBaseMetaTileEntity.getYCoord() + 0.9F + tRandom.nextFloat() * 0.2F, + aBaseMetaTileEntity.getZCoord() + 0.8F - tRandom.nextFloat() * 0.6F + ).spawnParticle(0.0D, 0.0D, 0.0D); } } diff --git a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Steel.java b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Steel.java index a5a0286c03..cba91ea02f 100644 --- a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Steel.java +++ b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Steel.java @@ -44,10 +44,13 @@ public class GT_MetaTileEntity_Macerator_Steel extends GT_MetaTileEntity_BasicMa public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPreTick(aBaseMetaTileEntity, aTick); if ((aBaseMetaTileEntity.isClientSide()) && (aBaseMetaTileEntity.isActive()) && (aBaseMetaTileEntity.getFrontFacing() != 1) && (aBaseMetaTileEntity.getCoverIDAtSide((byte) 1) == 0) && (!aBaseMetaTileEntity.getOpacityAtSide((byte) 1))) { - PositionedWorldEvent events = new PositionedWorldEvent<>(getBaseMetaTileEntity().getWorld(), "smoke"); - Random tRandom = events.getWorld().rand; - events.setPosition(aBaseMetaTileEntity.getXCoord() + 0.8F - tRandom.nextFloat() * 0.6F, aBaseMetaTileEntity.getYCoord() + 0.9F + tRandom.nextFloat() * 0.2F, aBaseMetaTileEntity.getZCoord() + 0.8F - tRandom.nextFloat() * 0.6F); - events.spawnParticle(0.0D, 0.0D, 0.0D); + Random tRandom = getBaseMetaTileEntity().getWorld().rand; + new PositionedWorldEvent<>(getBaseMetaTileEntity().getWorld(), "smoke") + .setPosition( + aBaseMetaTileEntity.getXCoord() + 0.8F - tRandom.nextFloat() * 0.6F, + aBaseMetaTileEntity.getYCoord() + 0.9F + tRandom.nextFloat() * 0.2F, + aBaseMetaTileEntity.getZCoord() + 0.8F - tRandom.nextFloat() * 0.6F + ).spawnParticle(0.0D, 0.0D, 0.0D); } } -- cgit From 5977a6f5327eb0536478d240f4a835ddaecdb517 Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Wed, 10 Mar 2021 19:59:20 +0100 Subject: Added missing --- .../api/interfaces/tileentity/IEnergyConnected.java | 6 +++--- .../java/gregtech/api/metatileentity/MetaPipeEntity.java | 4 ++-- src/main/java/gregtech/common/GT_Proxy.java | 4 ++-- .../java/gregtech/common/blocks/GT_Block_Reinforced.java | 4 ++-- .../multi/GT_MetaTileEntity_PrimitiveBlastFurnace.java | 15 ++++++--------- 5 files changed, 15 insertions(+), 18 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java index 4487ec57d6..813f31e62f 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java @@ -115,9 +115,9 @@ public interface IEnergyConnected extends IColoredTileEntity, IHasWorldObjectAnd if (GT_Mod.gregtechproxy.mPollution) GT_Pollution.addPollution(tWorld.getChunkFromBlockCoords(tX, tZ), 100000); - PositionedWorldEvent event = new PositionedWorldEvent<>(tWorld); - event.setPosition(tX + 0.5, tY + 0.5, tZ + 0.5) - .createExplosion(tStrength, true); + new PositionedWorldEvent<>(tWorld) + .setPosition(tX + 0.5, tY + 0.5, tZ + 0.5) + .createExplosion(tStrength, true); } } } diff --git a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java index 879982e995..4459b2203a 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java @@ -699,8 +699,8 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { World tWorld = getBaseMetaTileEntity().getWorld(); tWorld.setBlock(tX, tY, tZ, Blocks.air); if (GregTech_API.sMachineExplosions){ - PositionedWorldEvent event = new PositionedWorldEvent<>(tWorld); - event.setPosition(tX + 0.5, tY + 0.5, tZ + 0.5) + new PositionedWorldEvent<>(tWorld) + .setPosition(tX + 0.5, tY + 0.5, tZ + 0.5) .createExplosion(tStrength, true); } } diff --git a/src/main/java/gregtech/common/GT_Proxy.java b/src/main/java/gregtech/common/GT_Proxy.java index e34ae1cada..46e01227b4 100644 --- a/src/main/java/gregtech/common/GT_Proxy.java +++ b/src/main/java/gregtech/common/GT_Proxy.java @@ -768,8 +768,8 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { aEvent.bow.damageItem(1, aEvent.entityPlayer); aEvent.bow.getItem(); - PositionedWorldEvent events = new PositionedWorldEvent<>(aEvent.entityPlayer.worldObj, "random.bow"); - events.playSoundAtEntity(aEvent.entityPlayer, 1.0F, 0.64893958288F + tSpeed * 0.5F); + new PositionedWorldEvent<>(aEvent.entityPlayer.worldObj, "random.bow") + .playSoundAtEntity(aEvent.entityPlayer, 1.0F, 0.64893958288F + tSpeed * 0.5F); tArrowEntity.canBePickedUp = 1; if (!aEvent.entityPlayer.capabilities.isCreativeMode) { diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Reinforced.java b/src/main/java/gregtech/common/blocks/GT_Block_Reinforced.java index aca5963c8a..b351c23c4e 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Reinforced.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Reinforced.java @@ -256,8 +256,8 @@ public class GT_Block_Reinforced extends GT_Generic_Block { if(!world.isRemote && world.getBlockMetadata(x, y, z)==5){ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, x + 0.5F, y + 0.5F, z + 0.5F, player); world.spawnEntityInWorld(entitytntprimed); - PositionedWorldEvent events = new PositionedWorldEvent<>(world, "game.tnt.primed"); - events.playSoundAtEntity(entitytntprimed, 1.0F, 1.0F); + new PositionedWorldEvent<>(world, "game.tnt.primed") + .playSoundAtEntity(entitytntprimed, 1.0F, 1.0F); world.setBlockToAir(x, y, z); return false; diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PrimitiveBlastFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PrimitiveBlastFurnace.java index b29bd73bd1..f083fe4e2d 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PrimitiveBlastFurnace.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PrimitiveBlastFurnace.java @@ -180,15 +180,12 @@ public abstract class GT_MetaTileEntity_PrimitiveBlastFurnace extends MetaTileEn public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { if ((aBaseMetaTileEntity.isClientSide()) && (aBaseMetaTileEntity.isActive())) { - Vec3 position = Vec3.createVectorHelper( - aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1) + XSTR_INSTANCE.nextFloat(), - aBaseMetaTileEntity.getOffsetY(aBaseMetaTileEntity.getBackFacing(), 1), - aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1) + XSTR_INSTANCE.nextFloat() - ); - - PositionedWorldEvent events = new PositionedWorldEvent<>(aBaseMetaTileEntity.getWorld(), position,"largesmoke"); - - events.spawnParticle(0.0D, 0.3D, 0.0D); + new PositionedWorldEvent<>(aBaseMetaTileEntity.getWorld(),"largesmoke") + .setPosition( + aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1) + XSTR_INSTANCE.nextFloat(), + aBaseMetaTileEntity.getOffsetY(aBaseMetaTileEntity.getBackFacing(), 1), + aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1) + XSTR_INSTANCE.nextFloat() + ).spawnParticle(0.0D, 0.3D, 0.0D); } if (aBaseMetaTileEntity.isServerSide()) { if (this.mUpdate-- == 0) { -- cgit From f57bb28cca2135e12d9917938f2113b19f7c1ddd Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Wed, 10 Mar 2021 21:27:48 +0100 Subject: Added a few safety measurements --- .../gregtech/api/util/PositionedWorldEvent.java | 34 ++++++++++++---------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/gregtech/api/util/PositionedWorldEvent.java b/src/main/java/gregtech/api/util/PositionedWorldEvent.java index e8518b5444..101e4d3c72 100644 --- a/src/main/java/gregtech/api/util/PositionedWorldEvent.java +++ b/src/main/java/gregtech/api/util/PositionedWorldEvent.java @@ -5,11 +5,9 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.Vec3; import net.minecraft.world.World; -import java.util.List; import java.util.Objects; import java.util.function.BiConsumer; import java.util.function.Consumer; -import java.util.function.Supplier; @SuppressWarnings("unused") public class PositionedWorldEvent { @@ -94,28 +92,31 @@ public class PositionedWorldEvent { public void spawnParticle(double motionX, double motionY, double motionZ) { if (position == null || !(thing instanceof String) || world == null) - return; + throw new IllegalStateException("Position and world must be set, thing must be a string indicating the Particle to be spawned"); world.spawnParticle((String) thing, position.xCoord, position.yCoord, position.zCoord, motionX, motionY, motionZ); } public void playSoundEffect(float volume, float pitch) { if (position == null || !(thing instanceof String) || world == null) - return; + throw new IllegalStateException("Position and world must be set, thing must be a string indicating the SoundEffect to be spawned"); world.playSoundEffect(position.xCoord, position.yCoord, position.zCoord, (String) thing, volume, pitch); } + /** + * Positional Data is rounded down due to this targeting a block. + */ public void playRecord() { if (position == null || !(thing instanceof String) || world == null) - return; + throw new IllegalStateException("Position and world must be set, thing must be a string indicating the Record to be spawned"); world.playRecord((String) thing, (int) position.xCoord, (int) position.yCoord, (int) position.zCoord); } public void playSound(float volume, float pitch, boolean proximity) { if (position == null || !(thing instanceof String) || world == null) - return; + throw new IllegalStateException("Position and world must be set, thing must be a string indicating the Sound to be spawned"); world.playSound(position.xCoord, position.yCoord, position.zCoord, (String) thing, volume, pitch, proximity); } @@ -125,30 +126,33 @@ public class PositionedWorldEvent { } public void newExplosion(float strength, boolean isFlaming, boolean isSmoking) { - if (position == null || world == null) - return; + if (position == null || world == null || thing != null && !(thing instanceof Entity)) + throw new IllegalStateException("Position and world must be set, thing must either be null or an Entity"); world.newExplosion((Entity) thing, position.xCoord, position.yCoord, position.zCoord, strength, isFlaming, isSmoking); } + /** + * Positional Data is rounded down due to this targeting a block. + */ public boolean extinguishFire(int side) { if (position == null || world == null) - return false; + throw new IllegalStateException("Position and world must be set"); return world.extinguishFire((EntityPlayer) thing, (int) position.xCoord, (int) position.yCoord, (int) position.zCoord, side); } public void playSoundAtEntity(Entity entity, float volume, float pitch) { - if (!(thing instanceof String)) { - return; - } + if (world == null || !(thing instanceof String)) + throw new IllegalStateException("World must be set, string indicating the Sound to be spawned"); + world.playSoundAtEntity(entity, (String) thing, volume, pitch); } public void playSoundToNearExcept(EntityPlayer player, float volume, float pitch) { - if (!(thing instanceof String)) { - return; - } + if (world == null || !(thing instanceof String)) + throw new IllegalStateException("World must be set, string indicating the Sound to be spawned"); + world.playSoundToNearExcept(player, (String) thing, volume, pitch); } -- cgit From e735bc65230bdbf1324d3bd2c9b8602d43bb9050 Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Wed, 10 Mar 2021 21:32:12 +0100 Subject: Missed one --- src/main/java/gregtech/api/util/PositionedWorldEvent.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/gregtech/api/util/PositionedWorldEvent.java b/src/main/java/gregtech/api/util/PositionedWorldEvent.java index 101e4d3c72..b615daabf5 100644 --- a/src/main/java/gregtech/api/util/PositionedWorldEvent.java +++ b/src/main/java/gregtech/api/util/PositionedWorldEvent.java @@ -136,8 +136,8 @@ public class PositionedWorldEvent { * Positional Data is rounded down due to this targeting a block. */ public boolean extinguishFire(int side) { - if (position == null || world == null) - throw new IllegalStateException("Position and world must be set"); + if (position == null || world == null || !(thing instanceof EntityPlayer)) + throw new IllegalStateException("Position and world must be set, thing must be a EntityPlayer"); return world.extinguishFire((EntityPlayer) thing, (int) position.xCoord, (int) position.yCoord, (int) position.zCoord, side); } -- cgit From b359d79f77bb3efd6433c845af0a948975651b9a Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Thu, 11 Mar 2021 17:43:44 +0100 Subject: Implemented Builder Pattern --- .../interfaces/tileentity/IEnergyConnected.java | 11 +- .../api/metatileentity/MetaPipeEntity.java | 11 +- .../implementations/GT_MetaPipeEntity_Fluid.java | 21 +- .../GT_MetaTileEntity_BasicMachine_Bronze.java | 28 +- .../GT_MetaTileEntity_BasicMachine_GT_Recipe.java | 19 +- .../GT_MetaTileEntity_Hatch_Muffler.java | 23 +- src/main/java/gregtech/api/util/GT_FoodStat.java | 22 +- .../gregtech/api/util/PositionedWorldEvent.java | 172 ------ .../api/util/WorldSpawnedEventBuilder.java | 602 +++++++++++++++++++++ src/main/java/gregtech/common/GT_Client.java | 20 +- src/main/java/gregtech/common/GT_Proxy.java | 9 +- .../common/blocks/GT_Block_Reinforced.java | 12 +- .../gregtech/common/entities/GT_Entity_Arrow.java | 35 +- .../common/items/behaviors/Behaviour_Hoe.java | 12 +- .../boilers/GT_MetaTileEntity_Boiler.java | 18 +- .../GT_MetaTileEntity_PrimitiveBlastFurnace.java | 11 +- .../steam/GT_MetaTileEntity_Macerator_Bronze.java | 18 +- .../steam/GT_MetaTileEntity_Macerator_Steel.java | 10 +- 18 files changed, 778 insertions(+), 276 deletions(-) delete mode 100644 src/main/java/gregtech/api/util/PositionedWorldEvent.java create mode 100644 src/main/java/gregtech/api/util/WorldSpawnedEventBuilder.java (limited to 'src/main/java') diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java index 813f31e62f..3a8bbdfd70 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java @@ -3,11 +3,10 @@ package gregtech.api.interfaces.tileentity; import cofh.api.energy.IEnergyReceiver; import gregtech.GT_Mod; import gregtech.api.GregTech_API; -import gregtech.api.util.PositionedWorldEvent; +import gregtech.api.util.WorldSpawnedEventBuilder; import gregtech.api.util.GT_Utility; import gregtech.common.GT_Pollution; import ic2.api.energy.tile.IEnergySink; -import net.minecraft.entity.Entity; import net.minecraft.init.Blocks; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; @@ -115,9 +114,11 @@ public interface IEnergyConnected extends IColoredTileEntity, IHasWorldObjectAnd if (GT_Mod.gregtechproxy.mPollution) GT_Pollution.addPollution(tWorld.getChunkFromBlockCoords(tX, tZ), 100000); - new PositionedWorldEvent<>(tWorld) - .setPosition(tX + 0.5, tY + 0.5, tZ + 0.5) - .createExplosion(tStrength, true); + new WorldSpawnedEventBuilder.ExplosionEffectEventBuilder() + .setStrength(tStrength) + .setSmoking(true) + .setPosition(tX + 0.5, tY + 0.5, tZ + 0.5) + .setWorld(tWorld); } } } diff --git a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java index 4459b2203a..0716d84bd6 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java @@ -9,7 +9,7 @@ import gregtech.api.interfaces.tileentity.IColoredTileEntity; import gregtech.api.interfaces.tileentity.ICoverable; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.objects.GT_ItemStack; -import gregtech.api.util.PositionedWorldEvent; +import gregtech.api.util.WorldSpawnedEventBuilder; import gregtech.api.util.GT_Config; import gregtech.api.util.GT_CoverBehavior; import gregtech.api.util.GT_LanguageManager; @@ -699,9 +699,12 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable { World tWorld = getBaseMetaTileEntity().getWorld(); tWorld.setBlock(tX, tY, tZ, Blocks.air); if (GregTech_API.sMachineExplosions){ - new PositionedWorldEvent<>(tWorld) - .setPosition(tX + 0.5, tY + 0.5, tZ + 0.5) - .createExplosion(tStrength, true); + new WorldSpawnedEventBuilder.ExplosionEffectEventBuilder() + .setStrength(tStrength) + .setSmoking(true) + .setPosition(tX + 0.5, tY + 0.5, tZ + 0.5) + .setWorld(tWorld) + .run(); } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java index 8e0c010995..59011d27a8 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java @@ -17,7 +17,7 @@ import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_CoverBehavior; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_Utility; -import gregtech.api.util.PositionedWorldEvent; +import gregtech.api.util.WorldSpawnedEventBuilder; import gregtech.common.GT_Client; import gregtech.common.covers.GT_Cover_Drain; import gregtech.common.covers.GT_Cover_FluidRegulator; @@ -446,16 +446,21 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { if (aIndex == 9) { GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(4), 5, 1.0F, aX, aY, aZ); - new PositionedWorldEvent<>(getBaseMetaTileEntity().getWorld(), "largesmoke") - .times(6, (x, i) -> x.setPosition( + new WorldSpawnedEventBuilder.ParticleEventBuilder() + .setIdentifier("largesmoke") + .setWorld(getBaseMetaTileEntity().getWorld()) + .times(6, (x, i) -> x + .setMotion( + ForgeDirection.getOrientation(i).offsetX / 5.0, + ForgeDirection.getOrientation(i).offsetY / 5.0, + ForgeDirection.getOrientation(i).offsetZ / 5.0 + ) + .setPosition( aX - 0.5 + XSTR_INSTANCE.nextFloat(), aY - 0.5 + XSTR_INSTANCE.nextFloat(), aZ - 0.5 + XSTR_INSTANCE.nextFloat() - ).spawnParticle( - ForgeDirection.getOrientation(i).offsetX / 5.0, - ForgeDirection.getOrientation(i).offsetY / 5.0, - ForgeDirection.getOrientation(i).offsetZ / 5.0 - )); + ).run() + ); } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java index 7d8d6dbba0..45df3c8d3c 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java @@ -8,7 +8,7 @@ import gregtech.api.objects.GT_ItemStack; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_Utility; -import gregtech.api.util.PositionedWorldEvent; +import gregtech.api.util.WorldSpawnedEventBuilder; import net.minecraft.entity.EntityLivingBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; @@ -154,16 +154,22 @@ public abstract class GT_MetaTileEntity_BasicMachine_Bronze extends GT_MetaTileE super.doSound(aIndex, aX, aY, aZ); if (aIndex == 9) { GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(4), 5, 1.0F, aX, aY, aZ); - new PositionedWorldEvent<>(getBaseMetaTileEntity().getWorld(), "largesmoke") - .times(8, x -> x.setPosition( - aX - 0.5 + XSTR_INSTANCE.nextFloat(), - aY - 0.5 + XSTR_INSTANCE.nextFloat(), - aZ - 0.5 + XSTR_INSTANCE.nextFloat() - ).spawnParticle( - ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetX / 5.0, - ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetY / 5.0, - ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetZ / 5.0 - )); + + new WorldSpawnedEventBuilder.ParticleEventBuilder() + .setIdentifier("largesmoke") + .setWorld(getBaseMetaTileEntity().getWorld()) + .times(8, x -> x + .setMotion( + ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetX / 5.0, + ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetY / 5.0, + ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetZ / 5.0 + ) + .setPosition( + aX - 0.5 + XSTR_INSTANCE.nextFloat(), + aY - 0.5 + XSTR_INSTANCE.nextFloat(), + aZ - 0.5 + XSTR_INSTANCE.nextFloat() + ).run() + ); } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java index c2e4fc441c..84b9fd9d5f 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java @@ -12,7 +12,7 @@ import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; -import gregtech.api.util.PositionedWorldEvent; +import gregtech.api.util.WorldSpawnedEventBuilder; import ic2.core.Ic2Items; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.init.Blocks; @@ -802,13 +802,16 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ if (aBaseMetaTileEntity.getFrontFacing() != 1 && aBaseMetaTileEntity.getCoverIDAtSide((byte) 1) == 0 && !aBaseMetaTileEntity.getOpacityAtSide((byte) 1)) { Random tRandom = aBaseMetaTileEntity.getWorld().rand; - new PositionedWorldEvent<>(aBaseMetaTileEntity.getWorld(), "smoke") - .setPosition( - aBaseMetaTileEntity.getXCoord() + 0.8F - tRandom.nextFloat() * 0.6F, - aBaseMetaTileEntity.getYCoord() + 0.9F + tRandom.nextFloat() * 0.2F, - aBaseMetaTileEntity.getZCoord() + 0.8F - tRandom.nextFloat() * 0.6F - ) - .spawnParticle(0.0D, 0.0D, 0.0D); + new WorldSpawnedEventBuilder.ParticleEventBuilder() + .setMotion(0.0D, 0.0D, 0.0D) + .setIdentifier("smoke") + .setPosition( + aBaseMetaTileEntity.getXCoord() + 0.8F - tRandom.nextFloat() * 0.6F, + aBaseMetaTileEntity.getYCoord() + 0.9F + tRandom.nextFloat() * 0.2F, + aBaseMetaTileEntity.getZCoord() + 0.8F - tRandom.nextFloat() * 0.6F + ) + .setWorld(aBaseMetaTileEntity.getWorld()) + .run(); } break; } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java index 44567c96eb..9fbf880336 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java @@ -9,7 +9,7 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_LanguageManager; -import gregtech.api.util.PositionedWorldEvent; +import gregtech.api.util.WorldSpawnedEventBuilder; import gregtech.common.GT_Pollution; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -141,19 +141,26 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { zSpd = aDir.offsetZ * (0.1F + 0.2F * XSTR_INSTANCE.nextFloat()); } - PositionedWorldEvent events = new PositionedWorldEvent<>(aWorld, name); + WorldSpawnedEventBuilder.ParticleEventBuilder events = + (WorldSpawnedEventBuilder.ParticleEventBuilder) + new WorldSpawnedEventBuilder.ParticleEventBuilder() + .setIdentifier(name) + .setWorld(aWorld); if (chk1) { - events.setPosition(xPos + ran1 * 0.5F, yPos + XSTR_INSTANCE.nextFloat() * 0.5F, zPos + XSTR_INSTANCE.nextFloat() * 0.5F) - .spawnParticle(xSpd, ySpd, zSpd); + events.setMotion(xSpd, ySpd, zSpd) + .setPosition(xPos + ran1 * 0.5F, yPos + XSTR_INSTANCE.nextFloat() * 0.5F, zPos + XSTR_INSTANCE.nextFloat() * 0.5F) + .run(); } if (chk2) { - events.setPosition(xPos + ran2 * 0.5F, yPos + XSTR_INSTANCE.nextFloat() * 0.5F, zPos + XSTR_INSTANCE.nextFloat() * 0.5F) - .spawnParticle(xSpd, ySpd, zSpd); + events.setMotion(xSpd, ySpd, zSpd) + .setPosition(xPos + ran2 * 0.5F, yPos + XSTR_INSTANCE.nextFloat() * 0.5F, zPos + XSTR_INSTANCE.nextFloat() * 0.5F) + .run(); } if (chk3) { - events.setPosition(xPos + ran3 * 0.5F, yPos + XSTR_INSTANCE.nextFloat() * 0.5F, zPos + XSTR_INSTANCE.nextFloat() * 0.5F) - .spawnParticle(xSpd, ySpd, zSpd); + events.setMotion(xSpd, ySpd, zSpd) + .setPosition(xPos + ran3 * 0.5F, yPos + XSTR_INSTANCE.nextFloat() * 0.5F, zPos + XSTR_INSTANCE.nextFloat() * 0.5F) + .run(); } } diff --git a/src/main/java/gregtech/api/util/GT_FoodStat.java b/src/main/java/gregtech/api/util/GT_FoodStat.java index 96345ef199..3d55291398 100644 --- a/src/main/java/gregtech/api/util/GT_FoodStat.java +++ b/src/main/java/gregtech/api/util/GT_FoodStat.java @@ -68,8 +68,15 @@ public class GT_FoodStat implements IFoodStat { ItemStack tStack = GT_OreDictUnificator.get(GT_Utility.copy(mEmptyContainer)); if (tStack != null && !aPlayer.inventory.addItemStackToInventory(tStack)) aPlayer.dropPlayerItemWithRandomChoice(tStack, true); - PositionedWorldEvent event = new PositionedWorldEvent<>(aPlayer.worldObj, "random.burp"); - event.playSoundAtEntity(aPlayer,0.5F, aPlayer.worldObj.rand.nextFloat() * 0.1F + 0.9F); + + new WorldSpawnedEventBuilder.SoundAtEntityEventBuilder() + .setIdentifier("random.burp") + .setVolume(0.5F) + .setPitch(aPlayer.worldObj.rand.nextFloat() * 0.1F + 0.9F) + .setEntity(aPlayer) + .setWorld(aPlayer.worldObj) + .run(); + if (!aPlayer.worldObj.isRemote) { if (mMilk) { aPlayer.curePotionEffects(new ItemStack(Items.milk_bucket, 1, 0)); @@ -80,9 +87,14 @@ public class GT_FoodStat implements IFoodStat { } } if (mExplosive) { - event.setThing(aPlayer) - .setPosition(aPlayer.posX, aPlayer.posY, aPlayer.posZ) - .newExplosion(4,true, true); + new WorldSpawnedEventBuilder.ExplosionEffectEventBuilder() + .setSmoking(true) + .setFlaming(true) + .setStrength(4f) + .setPosition(aPlayer.posX, aPlayer.posY, aPlayer.posZ) + .setEntity(aPlayer) + .setWorld(aPlayer.worldObj) + .run(); aPlayer.attackEntityFrom(GT_DamageSources.getExplodingDamage(), Float.MAX_VALUE); } } diff --git a/src/main/java/gregtech/api/util/PositionedWorldEvent.java b/src/main/java/gregtech/api/util/PositionedWorldEvent.java deleted file mode 100644 index b615daabf5..0000000000 --- a/src/main/java/gregtech/api/util/PositionedWorldEvent.java +++ /dev/null @@ -1,172 +0,0 @@ -package gregtech.api.util; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.Vec3; -import net.minecraft.world.World; - -import java.util.Objects; -import java.util.function.BiConsumer; -import java.util.function.Consumer; - -@SuppressWarnings("unused") -public class PositionedWorldEvent { - - public PositionedWorldEvent() {} - - public PositionedWorldEvent(World world) { - this.world = world; - } - - public PositionedWorldEvent(Vec3 position) { - this.position = position; - } - - public PositionedWorldEvent(T thing) { - this.thing = thing; - } - - public PositionedWorldEvent(World world, T thing) { - this(world); - this.thing = thing; - } - - public PositionedWorldEvent(World world, Vec3 position) { - this(world); - this.position = position; - } - - public PositionedWorldEvent(Vec3 position, T thing) { - this(position); - this.thing = thing; - } - - public PositionedWorldEvent(T thing, Vec3 position) { - this(position, thing); - } - - public PositionedWorldEvent(World world, Vec3 position, T thing) { - this(world, position); - this.thing = thing; - } - - public PositionedWorldEvent(World world, T thing, Vec3 position) { - this(world, position, thing); - } - - private World world; - private Vec3 position; - private T thing; - - public World getWorld() { - return world; - } - - public PositionedWorldEvent setWorld(World world) { - this.world = world; - return this; - } - - public Vec3 getPosition() { - return position; - } - - public PositionedWorldEvent setPosition(Vec3 position) { - this.position = position; - return this; - } - - public PositionedWorldEvent setPosition(double x, double y, double z) { - this.position = Vec3.createVectorHelper(x, y, z); - return this; - } - - public T getThing() { - return thing; - } - - public PositionedWorldEvent setThing(T thing) { - this.thing = thing; - return this; - } - - public void spawnParticle(double motionX, double motionY, double motionZ) { - if (position == null || !(thing instanceof String) || world == null) - throw new IllegalStateException("Position and world must be set, thing must be a string indicating the Particle to be spawned"); - - world.spawnParticle((String) thing, position.xCoord, position.yCoord, position.zCoord, motionX, motionY, motionZ); - } - - public void playSoundEffect(float volume, float pitch) { - if (position == null || !(thing instanceof String) || world == null) - throw new IllegalStateException("Position and world must be set, thing must be a string indicating the SoundEffect to be spawned"); - - world.playSoundEffect(position.xCoord, position.yCoord, position.zCoord, (String) thing, volume, pitch); - } - - /** - * Positional Data is rounded down due to this targeting a block. - */ - public void playRecord() { - if (position == null || !(thing instanceof String) || world == null) - throw new IllegalStateException("Position and world must be set, thing must be a string indicating the Record to be spawned"); - - world.playRecord((String) thing, (int) position.xCoord, (int) position.yCoord, (int) position.zCoord); - } - - public void playSound(float volume, float pitch, boolean proximity) { - if (position == null || !(thing instanceof String) || world == null) - throw new IllegalStateException("Position and world must be set, thing must be a string indicating the Sound to be spawned"); - - world.playSound(position.xCoord, position.yCoord, position.zCoord, (String) thing, volume, pitch, proximity); - } - - public void createExplosion(float strength, boolean isSmoking) { - newExplosion(strength, false, isSmoking); - } - - public void newExplosion(float strength, boolean isFlaming, boolean isSmoking) { - if (position == null || world == null || thing != null && !(thing instanceof Entity)) - throw new IllegalStateException("Position and world must be set, thing must either be null or an Entity"); - - world.newExplosion((Entity) thing, position.xCoord, position.yCoord, position.zCoord, strength, isFlaming, isSmoking); - } - - /** - * Positional Data is rounded down due to this targeting a block. - */ - public boolean extinguishFire(int side) { - if (position == null || world == null || !(thing instanceof EntityPlayer)) - throw new IllegalStateException("Position and world must be set, thing must be a EntityPlayer"); - - return world.extinguishFire((EntityPlayer) thing, (int) position.xCoord, (int) position.yCoord, (int) position.zCoord, side); - } - - public void playSoundAtEntity(Entity entity, float volume, float pitch) { - if (world == null || !(thing instanceof String)) - throw new IllegalStateException("World must be set, string indicating the Sound to be spawned"); - - world.playSoundAtEntity(entity, (String) thing, volume, pitch); - } - - public void playSoundToNearExcept(EntityPlayer player, float volume, float pitch) { - if (world == null || !(thing instanceof String)) - throw new IllegalStateException("World must be set, string indicating the Sound to be spawned"); - - world.playSoundToNearExcept(player, (String) thing, volume, pitch); - } - - public void times(int times, Consumer> action) { - Objects.requireNonNull(action); - for (int i = 0; i < times; i++) { - action.accept(this); - } - } - - public void times(int times, BiConsumer, Integer> action) { - Objects.requireNonNull(action); - for (int i = 0; i < times; i++) { - action.accept(this, i); - } - } -} \ No newline at end of file diff --git a/src/main/java/gregtech/api/util/WorldSpawnedEventBuilder.java b/src/main/java/gregtech/api/util/WorldSpawnedEventBuilder.java new file mode 100644 index 0000000000..7977892f06 --- /dev/null +++ b/src/main/java/gregtech/api/util/WorldSpawnedEventBuilder.java @@ -0,0 +1,602 @@ +package gregtech.api.util; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; + +import java.util.Objects; +import java.util.function.BiConsumer; +import java.util.function.Consumer; + +@SuppressWarnings("unused") +public abstract class WorldSpawnedEventBuilder implements Runnable { + + /* Variables */ + + private World world; + + /* Getters, Setters */ + + public World getWorld() { + return world; + } + + public WorldSpawnedEventBuilder setWorld(World world) { + this.world = world; + return this; + } + + /* Methodes */ + + @SuppressWarnings("unchecked") + public void times(int times, Consumer action) { + Objects.requireNonNull(action); + for (int i = 0; i < times; i++) { + action.accept((U) this); + } + } + + @SuppressWarnings("unchecked") + public void times(int times, BiConsumer action) { + Objects.requireNonNull(action); + for (int i = 0; i < times; i++) { + action.accept((U) this, i); + } + } + + /* Interfaces */ + + private interface IPositionedWorldSpawnedEvent { + Vec3 getPosition(); + IPositionedWorldSpawnedEvent setPosition(Vec3 position); + IPositionedWorldSpawnedEvent setPosition(double x, double y, double z); + } + + private interface IEntityWorldSpawnedEvent { + Entity getEntity(); + IEntityWorldSpawnedEvent setEntity(Entity entity); + } + + private interface IEntityPlayerWorldSpawnedEvent { + EntityPlayer getEntityPlayer(); + IEntityPlayerWorldSpawnedEvent setEntityPlayer(EntityPlayer entity); + } + + private interface IStringIdentifierWorldSpawnedEvent { + String getIdentifier(); + IStringIdentifierWorldSpawnedEvent setIdentifier(String identifier); + } + + private interface ISoundWorldSpawnedEvent { + float getPitch(); + float getVolume(); + ISoundWorldSpawnedEvent setPitch(float pitch); + ISoundWorldSpawnedEvent setVolume(float volume); + } + + /* Abstract Classes */ + + private static abstract class EntityWorldSpawnedEventBuilder extends WorldSpawnedEventBuilder implements IEntityWorldSpawnedEvent { + + private Entity entity; + + @Override + public Entity getEntity() { + return entity; + } + + @Override + public EntityWorldSpawnedEventBuilder setEntity(Entity entity) { + this.entity = entity; + return this; + } + } + + private static abstract class PositionedEntityWorldSpawnedEventBuilder extends EntityWorldSpawnedEventBuilder implements IPositionedWorldSpawnedEvent { + + private Vec3 position; + + @Override + public Vec3 getPosition() { + return position; + } + + @Override + public PositionedEntityWorldSpawnedEventBuilder setPosition(Vec3 position) { + this.position = position; + return this; + } + + @Override + public PositionedEntityWorldSpawnedEventBuilder setPosition(double x, double y, double z) { + this.position = Vec3.createVectorHelper(x, y, z); + return this; + } + + } + + private static abstract class PositionedWorldSpawnedEventBuilder extends WorldSpawnedEventBuilder implements IPositionedWorldSpawnedEvent { + private Vec3 position; + + public Vec3 getPosition() { + return position; + } + + public PositionedWorldSpawnedEventBuilder setPosition(Vec3 position) { + this.position = position; + return this; + } + + public PositionedWorldSpawnedEventBuilder setPosition(double x, double y, double z) { + this.position = Vec3.createVectorHelper(x, y, z); + return this; + } + } + + private static abstract class StringIdentifierPositionedWorldSpawnedEventBuilder extends PositionedWorldSpawnedEventBuilder implements IStringIdentifierWorldSpawnedEvent { + private String identifier; + + @Override + public String getIdentifier() { + return identifier; + } + + @Override + public StringIdentifierPositionedWorldSpawnedEventBuilder setIdentifier(String identifier) { + this.identifier = identifier; + return this; + } + } + + private static abstract class SoundStringIdentifierPositionedWorldSpawnedEventBuilder extends StringIdentifierPositionedWorldSpawnedEventBuilder implements ISoundWorldSpawnedEvent { + + private float pitch; + private float volume; + + @Override + public float getPitch() { + return pitch; + } + + @Override + public float getVolume() { + return volume; + } + + @Override + public SoundStringIdentifierPositionedWorldSpawnedEventBuilder setPitch(float pitch) { + this.pitch = pitch; + return this; + } + + @Override + public SoundStringIdentifierPositionedWorldSpawnedEventBuilder setVolume(float volume) { + this.volume = volume; + return this; + } + } + + /* Implementations */ + + public final static class ParticleEventBuilder extends StringIdentifierPositionedWorldSpawnedEventBuilder { + + private Vec3 motion; + + public Vec3 getMotion() { + return motion; + } + + public ParticleEventBuilder setMotion(double x, double y, double z) { + this.motion = Vec3.createVectorHelper(x, y, z); + return this; + } + + + public ParticleEventBuilder setMotion(Vec3 motion) { + this.motion = motion; + return this; + } + + @Override + public ParticleEventBuilder setWorld(World world) { + return (ParticleEventBuilder) super.setWorld(world); + } + + @Override + public ParticleEventBuilder setPosition(Vec3 position) { + return (ParticleEventBuilder) super.setPosition(position); + } + + @Override + public ParticleEventBuilder setPosition(double x, double y, double z) { + return (ParticleEventBuilder) super.setPosition(x, y, z); + } + + @Override + public ParticleEventBuilder setIdentifier(String identifier) { + return (ParticleEventBuilder) super.setIdentifier(identifier); + } + + @Override + public void run() { + if (getPosition() == null || getIdentifier() == null || getMotion() == null || getWorld() == null) + throw new IllegalStateException("Position, identifier, motion and world must be set"); + + getWorld().spawnParticle( + getIdentifier(), + getPosition().xCoord, getPosition().yCoord, getPosition().zCoord, + getMotion().xCoord, getMotion().yCoord, getMotion().zCoord + ); + } + } + + public final static class SoundEffectEventBuilder extends SoundStringIdentifierPositionedWorldSpawnedEventBuilder { + + @Override + public SoundEffectEventBuilder setWorld(World world) { + return (SoundEffectEventBuilder) super.setWorld(world); + } + + @Override + public SoundEffectEventBuilder setPosition(Vec3 position) { + return (SoundEffectEventBuilder) super.setPosition(position); + } + + @Override + public SoundEffectEventBuilder setPosition(double x, double y, double z) { + return (SoundEffectEventBuilder) super.setPosition(x, y, z); + } + + @Override + public SoundEffectEventBuilder setIdentifier(String identifier) { + return (SoundEffectEventBuilder) super.setIdentifier(identifier); + } + + @Override + public SoundEffectEventBuilder setPitch(float pitch) { + return (SoundEffectEventBuilder) super.setPitch(pitch); + } + + @Override + public SoundEffectEventBuilder setVolume(float volume) { + return (SoundEffectEventBuilder) super.setVolume(volume); + } + + @Override + public void run() { + if (getPosition() == null || getIdentifier() == null || getWorld() == null) + throw new IllegalStateException("Position, identifier and world must be set"); + + getWorld().playSoundEffect( + getPosition().xCoord, getPosition().yCoord, getPosition().zCoord, + getIdentifier(), + getPitch(), getVolume() + ); + } + } + + public final static class SoundEventBuilder extends SoundStringIdentifierPositionedWorldSpawnedEventBuilder { + + private boolean proximity; + + public boolean isProximity() { + return proximity; + } + + @Override + public SoundEventBuilder setWorld(World world) { + return (SoundEventBuilder) super.setWorld(world); + } + + @Override + public SoundEventBuilder setPosition(Vec3 position) { + return (SoundEventBuilder) super.setPosition(position); + } + + @Override + public SoundEventBuilder setPosition(double x, double y, double z) { + return (SoundEventBuilder) super.setPosition(x, y, z); + } + + @Override + public SoundEventBuilder setIdentifier(String identifier) { + return (SoundEventBuilder) super.setIdentifier(identifier); + } + + @Override + public SoundEventBuilder setPitch(float pitch) { + return (SoundEventBuilder) super.setPitch(pitch); + } + + @Override + public SoundEventBuilder setVolume(float volume) { + return (SoundEventBuilder) super.setVolume(volume); + } + + public SoundEventBuilder setProximity(boolean proximity) { + this.proximity = proximity; + return this; + } + + @Override + public void run() { + if (getPosition() == null || getIdentifier() == null || getWorld() == null) + throw new IllegalStateException("Position, identifier and world must be set"); + + getWorld().playSound( + getPosition().xCoord, getPosition().yCoord, getPosition().zCoord, + getIdentifier(), + getPitch(), getVolume(), isProximity() + ); + } + } + + /** + * Positional Data is rounded down due to this targeting a block. + */ + public final static class RecordEffectEventBuilder extends StringIdentifierPositionedWorldSpawnedEventBuilder { + + @Override + public RecordEffectEventBuilder setWorld(World world) { + return (RecordEffectEventBuilder) super.setWorld(world); + } + + @Override + public RecordEffectEventBuilder setPosition(Vec3 position) { + return (RecordEffectEventBuilder) super.setPosition(position); + } + + @Override + public RecordEffectEventBuilder setPosition(double x, double y, double z) { + return (RecordEffectEventBuilder) super.setPosition(x, y, z); + } + + @Override + public RecordEffectEventBuilder setIdentifier(String identifier) { + return (RecordEffectEventBuilder) super.setIdentifier(identifier); + } + + @Override + public void run() { + if (getPosition() == null || getIdentifier() == null || getWorld() == null) + throw new IllegalStateException("Position, identifier and world must be set"); + + getWorld().playRecord( + getIdentifier(), + (int) getPosition().xCoord,(int) getPosition().yCoord,(int) getPosition().zCoord + ); + } + } + + public final static class ExplosionEffectEventBuilder extends PositionedEntityWorldSpawnedEventBuilder { + private boolean isFlaming, isSmoking; + private float strength; + + + public float getStrength() { + return strength; + } + + public ExplosionEffectEventBuilder setStrength(float strength) { + this.strength = strength; + return this; + } + + public boolean isFlaming() { + return isFlaming; + } + + public ExplosionEffectEventBuilder setFlaming(boolean flaming) { + isFlaming = flaming; + return this; + } + + public boolean isSmoking() { + return isSmoking; + } + + public ExplosionEffectEventBuilder setSmoking(boolean smoking) { + isSmoking = smoking; + return this; + } + + @Override + public ExplosionEffectEventBuilder setWorld(World world) { + return (ExplosionEffectEventBuilder) super.setWorld(world); + } + + @Override + public ExplosionEffectEventBuilder setEntity(Entity entity) { + return (ExplosionEffectEventBuilder) super.setEntity(entity); + } + + @Override + public ExplosionEffectEventBuilder setPosition(double x, double y, double z) { + return (ExplosionEffectEventBuilder) super.setPosition(x, y, z); + } + + @Override + public void run() { + if (getPosition() == null || getWorld() == null) + throw new IllegalStateException("Position and world must be set"); + + getWorld().newExplosion(getEntity(), getPosition().xCoord, getPosition().yCoord, getPosition().zCoord, strength, isFlaming, isSmoking); + } + } + + /** + * Positional Data is rounded down due to this targeting a block. + */ + public final static class ExtinguishFireEffectEventBuilder extends PositionedWorldSpawnedEventBuilder implements IEntityPlayerWorldSpawnedEvent { + + private int side; + private EntityPlayer entityPlayer; + + public int getSide() { + return side; + } + + public ExtinguishFireEffectEventBuilder setSide(int side) { + this.side = side; + return this; + } + + @Override + public EntityPlayer getEntityPlayer() { + return entityPlayer; + } + + @Override + public ExtinguishFireEffectEventBuilder setEntityPlayer(EntityPlayer entity) { + this.entityPlayer = entity; + return this; + } + + @Override + public ExtinguishFireEffectEventBuilder setWorld(World world) { + return (ExtinguishFireEffectEventBuilder) super.setWorld(world); + } + + @Override + public ExtinguishFireEffectEventBuilder setPosition(Vec3 position) { + return (ExtinguishFireEffectEventBuilder) super.setPosition(position); + } + + @Override + public ExtinguishFireEffectEventBuilder setPosition(double x, double y, double z) { + return (ExtinguishFireEffectEventBuilder) super.setPosition(x, y, z); + } + + @Override + public void run() { + if (getEntityPlayer() == null || getPosition() == null || getWorld() == null) + throw new IllegalStateException("EntityPlayer, position and world must be set"); + + getWorld().extinguishFire(getEntityPlayer(), (int) getPosition().xCoord, (int) getPosition().yCoord, (int) getPosition().zCoord, side); + } + } + + public final static class SoundAtEntityEventBuilder extends EntityWorldSpawnedEventBuilder implements ISoundWorldSpawnedEvent, IStringIdentifierWorldSpawnedEvent { + + private float pitch; + private float volume; + private String identifier; + + @Override + public String getIdentifier() { + return identifier; + } + + @Override + public SoundAtEntityEventBuilder setIdentifier(String identifier) { + this.identifier = identifier; + return this; + } + + @Override + public float getPitch() { + return pitch; + } + + @Override + public float getVolume() { + return volume; + } + + @Override + public SoundAtEntityEventBuilder setPitch(float pitch) { + this.pitch = pitch; + return this; + } + + @Override + public SoundAtEntityEventBuilder setVolume(float volume) { + this.volume = volume; + return this; + } + + @Override + public SoundAtEntityEventBuilder setWorld(World world) { + return (SoundAtEntityEventBuilder) super.setWorld(world); + } + + @Override + public SoundAtEntityEventBuilder setEntity(Entity entity) { + return (SoundAtEntityEventBuilder) super.setEntity(entity); + } + + @Override + public void run() { + if (getWorld() == null || getIdentifier() == null || getEntity() == null) + throw new IllegalStateException("World, Identifier and entity must be set!"); + + getWorld().playSoundAtEntity(getEntity(), getIdentifier(), volume, pitch); + } + } + + public final static class SoundToNearExceptEventBuilder extends WorldSpawnedEventBuilder implements ISoundWorldSpawnedEvent, IStringIdentifierWorldSpawnedEvent, IEntityPlayerWorldSpawnedEvent { + + private float pitch; + private float volume; + private String identifier; + private EntityPlayer entityPlayer; + + @Override + public String getIdentifier() { + return identifier; + } + + @Override + public SoundToNearExceptEventBuilder setIdentifier(String identifier) { + this.identifier = identifier; + return this; + } + + @Override + public float getPitch() { + return pitch; + } + + @Override + public float getVolume() { + return volume; + } + + @Override + public SoundToNearExceptEventBuilder setPitch(float pitch) { + this.pitch = pitch; + return this; + } + + @Override + public SoundToNearExceptEventBuilder setVolume(float volume) { + this.volume = volume; + return this; + } + + @Override + public SoundToNearExceptEventBuilder setWorld(World world) { + return (SoundToNearExceptEventBuilder) super.setWorld(world); + } + + @Override + public void run() { + if (getWorld() == null || getIdentifier() == null || getEntityPlayer() == null) + throw new IllegalStateException("World, Identifier and EntityPlayer must be set!"); + + getWorld().playSoundAtEntity(getEntityPlayer(), getIdentifier(), volume, pitch); + } + + @Override + public EntityPlayer getEntityPlayer() { + return entityPlayer; + } + + @Override + public SoundToNearExceptEventBuilder setEntityPlayer(EntityPlayer entity) { + entityPlayer = entity; + return this; + } + } +} \ No newline at end of file diff --git a/src/main/java/gregtech/common/GT_Client.java b/src/main/java/gregtech/common/GT_Client.java index 88823c9adf..b820c3b53a 100644 --- a/src/main/java/gregtech/common/GT_Client.java +++ b/src/main/java/gregtech/common/GT_Client.java @@ -632,19 +632,19 @@ public class GT_Client extends GT_Proxy tString = (new StringBuilder()).append(tString).append("wherearewenow").toString(); break; } - PositionedWorldEvent events = new PositionedWorldEvent(aWorld) - .setPosition(aX, aY, aZ); if (tString.startsWith("streaming.")){ - events.setThing(tString.substring(10)) - .playRecord(); + new WorldSpawnedEventBuilder.RecordEffectEventBuilder() + .setIdentifier(tString.substring(10)) + .setPosition(aX, aY, aZ) + .run(); } else{ - events.setThing(tString) - .playSound( - 3F, - tString.startsWith("note.") ? (float) Math.pow(2D, (double) (aStack.stackSize - 13) / 12D) : 1.0F, - false - ); + new WorldSpawnedEventBuilder.SoundEventBuilder() + .setVolume(3f) + .setPitch(tString.startsWith("note.") ? (float) Math.pow(2D, (double) (aStack.stackSize - 13) / 12D) : 1.0F) + .setIdentifier(tString) + .setPosition(aX, aY, aZ) + .run(); } } diff --git a/src/main/java/gregtech/common/GT_Proxy.java b/src/main/java/gregtech/common/GT_Proxy.java index 46e01227b4..ecca0097fb 100644 --- a/src/main/java/gregtech/common/GT_Proxy.java +++ b/src/main/java/gregtech/common/GT_Proxy.java @@ -768,8 +768,13 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { aEvent.bow.damageItem(1, aEvent.entityPlayer); aEvent.bow.getItem(); - new PositionedWorldEvent<>(aEvent.entityPlayer.worldObj, "random.bow") - .playSoundAtEntity(aEvent.entityPlayer, 1.0F, 0.64893958288F + tSpeed * 0.5F); + new WorldSpawnedEventBuilder.SoundAtEntityEventBuilder() + .setPitch(0.64893958288F + tSpeed * 0.5F) + .setVolume(1f) + .setIdentifier("random.bow") + .setEntity(aEvent.entityPlayer) + .setWorld(aEvent.entityPlayer.worldObj) + .run(); tArrowEntity.canBePickedUp = 1; if (!aEvent.entityPlayer.capabilities.isCreativeMode) { diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Reinforced.java b/src/main/java/gregtech/common/blocks/GT_Block_Reinforced.java index b351c23c4e..4a63bef40f 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Reinforced.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Reinforced.java @@ -11,7 +11,7 @@ import gregtech.api.items.GT_Generic_Block; import gregtech.api.objects.GT_CopiedBlockTexture; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.PositionedWorldEvent; +import gregtech.api.util.WorldSpawnedEventBuilder; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -256,9 +256,13 @@ public class GT_Block_Reinforced extends GT_Generic_Block { if(!world.isRemote && world.getBlockMetadata(x, y, z)==5){ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, x + 0.5F, y + 0.5F, z + 0.5F, player); world.spawnEntityInWorld(entitytntprimed); - new PositionedWorldEvent<>(world, "game.tnt.primed") - .playSoundAtEntity(entitytntprimed, 1.0F, 1.0F); - + new WorldSpawnedEventBuilder.SoundAtEntityEventBuilder() + .setPitch(1f) + .setVolume(1f) + .setIdentifier("game.tnt.primed") + .setEntity(entitytntprimed) + .setWorld(world) + .run(); world.setBlockToAir(x, y, z); return false; } diff --git a/src/main/java/gregtech/common/entities/GT_Entity_Arrow.java b/src/main/java/gregtech/common/entities/GT_Entity_Arrow.java index b9973e91fc..bc8b918af1 100644 --- a/src/main/java/gregtech/common/entities/GT_Entity_Arrow.java +++ b/src/main/java/gregtech/common/entities/GT_Entity_Arrow.java @@ -4,7 +4,7 @@ import com.mojang.authlib.GameProfile; import gregtech.api.objects.ItemData; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; -import gregtech.api.util.PositionedWorldEvent; +import gregtech.api.util.WorldSpawnedEventBuilder; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.enchantment.Enchantment; @@ -242,13 +242,19 @@ public class GT_Entity_Arrow extends EntityArrow { } } } - PositionedWorldEvent events = new PositionedWorldEvent<>(this.worldObj); + WorldSpawnedEventBuilder.ParticleEventBuilder events = (WorldSpawnedEventBuilder.ParticleEventBuilder) + new WorldSpawnedEventBuilder.ParticleEventBuilder() + .setWorld(this.worldObj); if (getIsCritical()) { - events.setThing("crit").times(4, (x, i) -> x.setPosition( - this.posX + this.motionX * i / 4.0D, - this.posY + this.motionY * i / 4.0D, - this.posZ + this.motionZ * i / 4.0D - ).spawnParticle(-this.motionX, -this.motionY + 0.2D, -this.motionZ)); + events.setIdentifier("crit") + .times(4, (x, i) -> + x.setMotion(-this.motionX, -this.motionY + 0.2D, -this.motionZ) + .setPosition( + this.posX + this.motionX * i / 4.0D, + this.posY + this.motionY * i / 4.0D, + this.posZ + this.motionZ * i / 4.0D + ).run() + ); } this.posX += this.motionX; this.posY += this.motionY; @@ -270,13 +276,14 @@ public class GT_Entity_Arrow extends EntityArrow { this.rotationYaw = (this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F); float tFrictionMultiplier = 0.99F; if (isInWater()) { - events.setThing("bubble") - .setPosition( - this.posX - this.motionX * 0.25D, - this.posY - this.motionY * 0.25D, - this.posZ - this.motionZ * 0.25D - ).times(4, x -> x.spawnParticle(this.motionX, this.motionY, this.motionZ)); - + events.setMotion(-this.motionX, -this.motionY + 0.2D, -this.motionZ) + .setIdentifier("bubble") + .setPosition( + this.posX - this.motionX * 0.25D, + this.posY - this.motionY * 0.25D, + this.posZ - this.motionZ * 0.25D + ) + .times(4, Runnable::run); tFrictionMultiplier = 0.8F; } if (isWet()) { diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_Hoe.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Hoe.java index b2dc300221..8b7947ac7d 100644 --- a/src/main/java/gregtech/common/items/behaviors/Behaviour_Hoe.java +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Hoe.java @@ -5,7 +5,7 @@ import gregtech.api.items.GT_MetaBase_Item; import gregtech.api.items.GT_MetaGenerated_Tool; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_Utility; -import gregtech.api.util.PositionedWorldEvent; +import gregtech.api.util.WorldSpawnedEventBuilder; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -40,9 +40,13 @@ public class Behaviour_Hoe extends Behaviour_None { } Block aBlock = aWorld.getBlock(aX, aY, aZ); if ((aSide != 0) && (GT_Utility.isBlockAir(aWorld, aX, aY + 1, aZ)) && ((aBlock == Blocks.grass) || (aBlock == Blocks.dirt))) { - new PositionedWorldEvent<>(aWorld, Blocks.farmland.stepSound.getStepResourcePath()) - .setPosition(aX + 0.5F, aY + 0.5F, aZ + 0.5F) - .playSoundEffect((Blocks.farmland.stepSound.getVolume() + 1.0F) / 2.0F, Blocks.farmland.stepSound.getPitch() * 0.8F); + new WorldSpawnedEventBuilder.SoundEventBuilder() + .setVolume((Blocks.farmland.stepSound.getVolume() + 1.0F) / 2.0F) + .setPitch(Blocks.farmland.stepSound.getPitch() * 0.8F) + .setIdentifier(Blocks.farmland.stepSound.getStepResourcePath()) + .setPosition(aX + 0.5F, aY + 0.5F, aZ + 0.5F) + .setWorld(aWorld) + .run(); if (aWorld.isRemote) { return true; } diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler.java index 5ec08da5f4..a2dce14cec 100644 --- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler.java +++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler.java @@ -264,13 +264,17 @@ public abstract class GT_MetaTileEntity_Boiler extends GT_MetaTileEntity_BasicTa if (aIndex == 1) { GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(4), 2, 1.0F, aX, aY, aZ); - new PositionedWorldEvent<>(getBaseMetaTileEntity().getWorld(), "largesmoke") - .times(8, x -> x.setPosition( - aX - 0.5D + XSTR_INSTANCE.nextFloat(), - aY, - aZ - 0.5D + XSTR_INSTANCE.nextFloat() - ) - .spawnParticle(0.0D, 0.0D, 0.0D)); + new WorldSpawnedEventBuilder.ParticleEventBuilder() + .setIdentifier("largesmoke") + .setWorld(getBaseMetaTileEntity().getWorld()) + .times(8, x -> x + .setMotion(0D,0D,0D) + .setPosition( + aX - 0.5D + XSTR_INSTANCE.nextFloat(), + aY, + aZ - 0.5D + XSTR_INSTANCE.nextFloat() + ).run() + ); } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PrimitiveBlastFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PrimitiveBlastFurnace.java index f083fe4e2d..763244d5c1 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PrimitiveBlastFurnace.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PrimitiveBlastFurnace.java @@ -7,7 +7,7 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.objects.GT_ItemStack; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; -import gregtech.api.util.PositionedWorldEvent; +import gregtech.api.util.WorldSpawnedEventBuilder; import gregtech.common.GT_Pollution; import gregtech.common.gui.GT_Container_PrimitiveBlastFurnace; import gregtech.common.gui.GT_GUIContainer_PrimitiveBlastFurnace; @@ -17,7 +17,6 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.Vec3; import net.minecraft.world.ChunkPosition; import net.minecraftforge.common.util.ForgeDirection; import org.lwjgl.input.Keyboard; @@ -180,12 +179,16 @@ public abstract class GT_MetaTileEntity_PrimitiveBlastFurnace extends MetaTileEn public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { if ((aBaseMetaTileEntity.isClientSide()) && (aBaseMetaTileEntity.isActive())) { - new PositionedWorldEvent<>(aBaseMetaTileEntity.getWorld(),"largesmoke") + new WorldSpawnedEventBuilder.ParticleEventBuilder() + .setMotion(0D,0.3D,0D) + .setIdentifier("largesmoke") .setPosition( aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1) + XSTR_INSTANCE.nextFloat(), aBaseMetaTileEntity.getOffsetY(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1) + XSTR_INSTANCE.nextFloat() - ).spawnParticle(0.0D, 0.3D, 0.0D); + ) + .setWorld(getBaseMetaTileEntity().getWorld()) + .run(); } if (aBaseMetaTileEntity.isServerSide()) { if (this.mUpdate-- == 0) { diff --git a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Bronze.java b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Bronze.java index 2c36047919..758d206755 100644 --- a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Bronze.java +++ b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Bronze.java @@ -11,7 +11,7 @@ import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; -import gregtech.api.util.PositionedWorldEvent; +import gregtech.api.util.WorldSpawnedEventBuilder; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; @@ -45,12 +45,16 @@ public class GT_MetaTileEntity_Macerator_Bronze extends GT_MetaTileEntity_BasicM super.onPreTick(aBaseMetaTileEntity, aTick); if ((aBaseMetaTileEntity.isClientSide()) && (aBaseMetaTileEntity.isActive()) && (aBaseMetaTileEntity.getFrontFacing() != 1) && (aBaseMetaTileEntity.getCoverIDAtSide((byte) 1) == 0) && (!aBaseMetaTileEntity.getOpacityAtSide((byte) 1))) { Random tRandom = getBaseMetaTileEntity().getWorld().rand; - new PositionedWorldEvent<>(getBaseMetaTileEntity().getWorld(), "smoke") - .setPosition( - aBaseMetaTileEntity.getXCoord() + 0.8F - tRandom.nextFloat() * 0.6F, - aBaseMetaTileEntity.getYCoord() + 0.9F + tRandom.nextFloat() * 0.2F, - aBaseMetaTileEntity.getZCoord() + 0.8F - tRandom.nextFloat() * 0.6F - ).spawnParticle(0.0D, 0.0D, 0.0D); + new WorldSpawnedEventBuilder.ParticleEventBuilder() + .setMotion(0D,0.0D,0D) + .setIdentifier("smoke") + .setPosition( + aBaseMetaTileEntity.getXCoord() + 0.8F - tRandom.nextFloat() * 0.6F, + aBaseMetaTileEntity.getYCoord() + 0.9F + tRandom.nextFloat() * 0.2F, + aBaseMetaTileEntity.getZCoord() + 0.8F - tRandom.nextFloat() * 0.6F + ) + .setWorld(getBaseMetaTileEntity().getWorld()) + .run(); } } diff --git a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Steel.java b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Steel.java index cba91ea02f..235b341210 100644 --- a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Steel.java +++ b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Steel.java @@ -11,7 +11,7 @@ import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; -import gregtech.api.util.PositionedWorldEvent; +import gregtech.api.util.WorldSpawnedEventBuilder; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; @@ -45,12 +45,16 @@ public class GT_MetaTileEntity_Macerator_Steel extends GT_MetaTileEntity_BasicMa super.onPreTick(aBaseMetaTileEntity, aTick); if ((aBaseMetaTileEntity.isClientSide()) && (aBaseMetaTileEntity.isActive()) && (aBaseMetaTileEntity.getFrontFacing() != 1) && (aBaseMetaTileEntity.getCoverIDAtSide((byte) 1) == 0) && (!aBaseMetaTileEntity.getOpacityAtSide((byte) 1))) { Random tRandom = getBaseMetaTileEntity().getWorld().rand; - new PositionedWorldEvent<>(getBaseMetaTileEntity().getWorld(), "smoke") + new WorldSpawnedEventBuilder.ParticleEventBuilder() + .setMotion(0D,0.0D,0D) + .setIdentifier("smoke") .setPosition( aBaseMetaTileEntity.getXCoord() + 0.8F - tRandom.nextFloat() * 0.6F, aBaseMetaTileEntity.getYCoord() + 0.9F + tRandom.nextFloat() * 0.2F, aBaseMetaTileEntity.getZCoord() + 0.8F - tRandom.nextFloat() * 0.6F - ).spawnParticle(0.0D, 0.0D, 0.0D); + ) + .setWorld(getBaseMetaTileEntity().getWorld()) + .run(); } } -- cgit From 6bda527a33fe4a7a5496cbb3185a04087293a18d Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Thu, 11 Mar 2021 17:49:07 +0100 Subject: Minor improvements --- .../GT_MetaTileEntity_BasicMachine_Bronze.java | 10 +++++----- .../implementations/GT_MetaTileEntity_Hatch_Muffler.java | 16 ++++++---------- .../java/gregtech/api/util/WorldSpawnedEventBuilder.java | 1 - .../java/gregtech/common/entities/GT_Entity_Arrow.java | 8 ++++---- .../tileentities/boilers/GT_MetaTileEntity_Boiler.java | 2 +- 5 files changed, 16 insertions(+), 21 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java index 45df3c8d3c..7fdc564b0a 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java @@ -158,12 +158,12 @@ public abstract class GT_MetaTileEntity_BasicMachine_Bronze extends GT_MetaTileE new WorldSpawnedEventBuilder.ParticleEventBuilder() .setIdentifier("largesmoke") .setWorld(getBaseMetaTileEntity().getWorld()) + .setMotion( + ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetX / 5.0, + ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetY / 5.0, + ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetZ / 5.0 + ) .times(8, x -> x - .setMotion( - ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetX / 5.0, - ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetY / 5.0, - ForgeDirection.getOrientation(getBaseMetaTileEntity().getFrontFacing()).offsetZ / 5.0 - ) .setPosition( aX - 0.5 + XSTR_INSTANCE.nextFloat(), aY - 0.5 + XSTR_INSTANCE.nextFloat(), diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java index 9fbf880336..49a28d28ff 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java @@ -141,25 +141,21 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { zSpd = aDir.offsetZ * (0.1F + 0.2F * XSTR_INSTANCE.nextFloat()); } - WorldSpawnedEventBuilder.ParticleEventBuilder events = - (WorldSpawnedEventBuilder.ParticleEventBuilder) - new WorldSpawnedEventBuilder.ParticleEventBuilder() + WorldSpawnedEventBuilder.ParticleEventBuilder events = new WorldSpawnedEventBuilder.ParticleEventBuilder() .setIdentifier(name) - .setWorld(aWorld); + .setWorld(aWorld) + .setMotion(xSpd, ySpd, zSpd); if (chk1) { - events.setMotion(xSpd, ySpd, zSpd) - .setPosition(xPos + ran1 * 0.5F, yPos + XSTR_INSTANCE.nextFloat() * 0.5F, zPos + XSTR_INSTANCE.nextFloat() * 0.5F) + events.setPosition(xPos + ran1 * 0.5F, yPos + XSTR_INSTANCE.nextFloat() * 0.5F, zPos + XSTR_INSTANCE.nextFloat() * 0.5F) .run(); } if (chk2) { - events.setMotion(xSpd, ySpd, zSpd) - .setPosition(xPos + ran2 * 0.5F, yPos + XSTR_INSTANCE.nextFloat() * 0.5F, zPos + XSTR_INSTANCE.nextFloat() * 0.5F) + events.setPosition(xPos + ran2 * 0.5F, yPos + XSTR_INSTANCE.nextFloat() * 0.5F, zPos + XSTR_INSTANCE.nextFloat() * 0.5F) .run(); } if (chk3) { - events.setMotion(xSpd, ySpd, zSpd) - .setPosition(xPos + ran3 * 0.5F, yPos + XSTR_INSTANCE.nextFloat() * 0.5F, zPos + XSTR_INSTANCE.nextFloat() * 0.5F) + events.setPosition(xPos + ran3 * 0.5F, yPos + XSTR_INSTANCE.nextFloat() * 0.5F, zPos + XSTR_INSTANCE.nextFloat() * 0.5F) .run(); } } diff --git a/src/main/java/gregtech/api/util/WorldSpawnedEventBuilder.java b/src/main/java/gregtech/api/util/WorldSpawnedEventBuilder.java index 7977892f06..0989e4da54 100644 --- a/src/main/java/gregtech/api/util/WorldSpawnedEventBuilder.java +++ b/src/main/java/gregtech/api/util/WorldSpawnedEventBuilder.java @@ -192,7 +192,6 @@ public abstract class WorldSpawnedEventBuilder implements Runnable { return this; } - public ParticleEventBuilder setMotion(Vec3 motion) { this.motion = motion; return this; diff --git a/src/main/java/gregtech/common/entities/GT_Entity_Arrow.java b/src/main/java/gregtech/common/entities/GT_Entity_Arrow.java index bc8b918af1..2983a6580c 100644 --- a/src/main/java/gregtech/common/entities/GT_Entity_Arrow.java +++ b/src/main/java/gregtech/common/entities/GT_Entity_Arrow.java @@ -242,14 +242,14 @@ public class GT_Entity_Arrow extends EntityArrow { } } } - WorldSpawnedEventBuilder.ParticleEventBuilder events = (WorldSpawnedEventBuilder.ParticleEventBuilder) - new WorldSpawnedEventBuilder.ParticleEventBuilder() + WorldSpawnedEventBuilder.ParticleEventBuilder events = new WorldSpawnedEventBuilder.ParticleEventBuilder() .setWorld(this.worldObj); + if (getIsCritical()) { events.setIdentifier("crit") + .setMotion(-this.motionX, -this.motionY + 0.2D, -this.motionZ) .times(4, (x, i) -> - x.setMotion(-this.motionX, -this.motionY + 0.2D, -this.motionZ) - .setPosition( + x.setPosition( this.posX + this.motionX * i / 4.0D, this.posY + this.motionY * i / 4.0D, this.posZ + this.motionZ * i / 4.0D diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler.java index a2dce14cec..3e80c33b6d 100644 --- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler.java +++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler.java @@ -267,8 +267,8 @@ public abstract class GT_MetaTileEntity_Boiler extends GT_MetaTileEntity_BasicTa new WorldSpawnedEventBuilder.ParticleEventBuilder() .setIdentifier("largesmoke") .setWorld(getBaseMetaTileEntity().getWorld()) + .setMotion(0D,0D,0D) .times(8, x -> x - .setMotion(0D,0D,0D) .setPosition( aX - 0.5D + XSTR_INSTANCE.nextFloat(), aY, -- cgit From 9a5aa6f3f3a64c46b2a4f119f965f0c755d26cd2 Mon Sep 17 00:00:00 2001 From: Léa Gris Date: Fri, 12 Mar 2021 15:37:41 +0100 Subject: requested changes - Fix modifiers order - Fix redundant string literal - Fix indentation - fix missing run() --- .../interfaces/tileentity/IEnergyConnected.java | 5 ++-- .../implementations/GT_MetaPipeEntity_Fluid.java | 6 ++-- .../api/util/WorldSpawnedEventBuilder.java | 34 +++++++++++----------- 3 files changed, 23 insertions(+), 22 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java index 3a8bbdfd70..158b53068d 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java @@ -3,8 +3,8 @@ package gregtech.api.interfaces.tileentity; import cofh.api.energy.IEnergyReceiver; import gregtech.GT_Mod; import gregtech.api.GregTech_API; -import gregtech.api.util.WorldSpawnedEventBuilder; import gregtech.api.util.GT_Utility; +import gregtech.api.util.WorldSpawnedEventBuilder; import gregtech.common.GT_Pollution; import ic2.api.energy.tile.IEnergySink; import net.minecraft.init.Blocks; @@ -118,7 +118,8 @@ public interface IEnergyConnected extends IColoredTileEntity, IHasWorldObjectAnd .setStrength(tStrength) .setSmoking(true) .setPosition(tX + 0.5, tY + 0.5, tZ + 0.5) - .setWorld(tWorld); + .setWorld(tWorld) + .run(); } } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java index 59011d27a8..e6c24ec4b1 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java @@ -456,9 +456,9 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { ForgeDirection.getOrientation(i).offsetZ / 5.0 ) .setPosition( - aX - 0.5 + XSTR_INSTANCE.nextFloat(), - aY - 0.5 + XSTR_INSTANCE.nextFloat(), - aZ - 0.5 + XSTR_INSTANCE.nextFloat() + aX - 0.5 + XSTR_INSTANCE.nextFloat(), + aY - 0.5 + XSTR_INSTANCE.nextFloat(), + aZ - 0.5 + XSTR_INSTANCE.nextFloat() ).run() ); } diff --git a/src/main/java/gregtech/api/util/WorldSpawnedEventBuilder.java b/src/main/java/gregtech/api/util/WorldSpawnedEventBuilder.java index 0989e4da54..109a534d0d 100644 --- a/src/main/java/gregtech/api/util/WorldSpawnedEventBuilder.java +++ b/src/main/java/gregtech/api/util/WorldSpawnedEventBuilder.java @@ -11,7 +11,7 @@ import java.util.function.Consumer; @SuppressWarnings("unused") public abstract class WorldSpawnedEventBuilder implements Runnable { - + private static final String ILLEGAL_STATE_STR1 = "Position, identifier and world must be set"; /* Variables */ private World world; @@ -77,7 +77,7 @@ public abstract class WorldSpawnedEventBuilder implements Runnable { /* Abstract Classes */ - private static abstract class EntityWorldSpawnedEventBuilder extends WorldSpawnedEventBuilder implements IEntityWorldSpawnedEvent { + private abstract static class EntityWorldSpawnedEventBuilder extends WorldSpawnedEventBuilder implements IEntityWorldSpawnedEvent { private Entity entity; @@ -93,7 +93,7 @@ public abstract class WorldSpawnedEventBuilder implements Runnable { } } - private static abstract class PositionedEntityWorldSpawnedEventBuilder extends EntityWorldSpawnedEventBuilder implements IPositionedWorldSpawnedEvent { + private abstract static class PositionedEntityWorldSpawnedEventBuilder extends EntityWorldSpawnedEventBuilder implements IPositionedWorldSpawnedEvent { private Vec3 position; @@ -116,7 +116,7 @@ public abstract class WorldSpawnedEventBuilder implements Runnable { } - private static abstract class PositionedWorldSpawnedEventBuilder extends WorldSpawnedEventBuilder implements IPositionedWorldSpawnedEvent { + private abstract static class PositionedWorldSpawnedEventBuilder extends WorldSpawnedEventBuilder implements IPositionedWorldSpawnedEvent { private Vec3 position; public Vec3 getPosition() { @@ -134,7 +134,7 @@ public abstract class WorldSpawnedEventBuilder implements Runnable { } } - private static abstract class StringIdentifierPositionedWorldSpawnedEventBuilder extends PositionedWorldSpawnedEventBuilder implements IStringIdentifierWorldSpawnedEvent { + private abstract static class StringIdentifierPositionedWorldSpawnedEventBuilder extends PositionedWorldSpawnedEventBuilder implements IStringIdentifierWorldSpawnedEvent { private String identifier; @Override @@ -149,7 +149,7 @@ public abstract class WorldSpawnedEventBuilder implements Runnable { } } - private static abstract class SoundStringIdentifierPositionedWorldSpawnedEventBuilder extends StringIdentifierPositionedWorldSpawnedEventBuilder implements ISoundWorldSpawnedEvent { + private abstract static class SoundStringIdentifierPositionedWorldSpawnedEventBuilder extends StringIdentifierPositionedWorldSpawnedEventBuilder implements ISoundWorldSpawnedEvent { private float pitch; private float volume; @@ -179,7 +179,7 @@ public abstract class WorldSpawnedEventBuilder implements Runnable { /* Implementations */ - public final static class ParticleEventBuilder extends StringIdentifierPositionedWorldSpawnedEventBuilder { + public static final class ParticleEventBuilder extends StringIdentifierPositionedWorldSpawnedEventBuilder { private Vec3 motion; @@ -230,7 +230,7 @@ public abstract class WorldSpawnedEventBuilder implements Runnable { } } - public final static class SoundEffectEventBuilder extends SoundStringIdentifierPositionedWorldSpawnedEventBuilder { + public static final class SoundEffectEventBuilder extends SoundStringIdentifierPositionedWorldSpawnedEventBuilder { @Override public SoundEffectEventBuilder setWorld(World world) { @@ -265,7 +265,7 @@ public abstract class WorldSpawnedEventBuilder implements Runnable { @Override public void run() { if (getPosition() == null || getIdentifier() == null || getWorld() == null) - throw new IllegalStateException("Position, identifier and world must be set"); + throw new IllegalStateException(ILLEGAL_STATE_STR1); getWorld().playSoundEffect( getPosition().xCoord, getPosition().yCoord, getPosition().zCoord, @@ -275,7 +275,7 @@ public abstract class WorldSpawnedEventBuilder implements Runnable { } } - public final static class SoundEventBuilder extends SoundStringIdentifierPositionedWorldSpawnedEventBuilder { + public static final class SoundEventBuilder extends SoundStringIdentifierPositionedWorldSpawnedEventBuilder { private boolean proximity; @@ -321,7 +321,7 @@ public abstract class WorldSpawnedEventBuilder implements Runnable { @Override public void run() { if (getPosition() == null || getIdentifier() == null || getWorld() == null) - throw new IllegalStateException("Position, identifier and world must be set"); + throw new IllegalStateException(ILLEGAL_STATE_STR1); getWorld().playSound( getPosition().xCoord, getPosition().yCoord, getPosition().zCoord, @@ -334,7 +334,7 @@ public abstract class WorldSpawnedEventBuilder implements Runnable { /** * Positional Data is rounded down due to this targeting a block. */ - public final static class RecordEffectEventBuilder extends StringIdentifierPositionedWorldSpawnedEventBuilder { + public static final class RecordEffectEventBuilder extends StringIdentifierPositionedWorldSpawnedEventBuilder { @Override public RecordEffectEventBuilder setWorld(World world) { @@ -359,7 +359,7 @@ public abstract class WorldSpawnedEventBuilder implements Runnable { @Override public void run() { if (getPosition() == null || getIdentifier() == null || getWorld() == null) - throw new IllegalStateException("Position, identifier and world must be set"); + throw new IllegalStateException(ILLEGAL_STATE_STR1); getWorld().playRecord( getIdentifier(), @@ -368,7 +368,7 @@ public abstract class WorldSpawnedEventBuilder implements Runnable { } } - public final static class ExplosionEffectEventBuilder extends PositionedEntityWorldSpawnedEventBuilder { + public static final class ExplosionEffectEventBuilder extends PositionedEntityWorldSpawnedEventBuilder { private boolean isFlaming, isSmoking; private float strength; @@ -427,7 +427,7 @@ public abstract class WorldSpawnedEventBuilder implements Runnable { /** * Positional Data is rounded down due to this targeting a block. */ - public final static class ExtinguishFireEffectEventBuilder extends PositionedWorldSpawnedEventBuilder implements IEntityPlayerWorldSpawnedEvent { + public static final class ExtinguishFireEffectEventBuilder extends PositionedWorldSpawnedEventBuilder implements IEntityPlayerWorldSpawnedEvent { private int side; private EntityPlayer entityPlayer; @@ -476,7 +476,7 @@ public abstract class WorldSpawnedEventBuilder implements Runnable { } } - public final static class SoundAtEntityEventBuilder extends EntityWorldSpawnedEventBuilder implements ISoundWorldSpawnedEvent, IStringIdentifierWorldSpawnedEvent { + public static final class SoundAtEntityEventBuilder extends EntityWorldSpawnedEventBuilder implements ISoundWorldSpawnedEvent, IStringIdentifierWorldSpawnedEvent { private float pitch; private float volume; @@ -534,7 +534,7 @@ public abstract class WorldSpawnedEventBuilder implements Runnable { } } - public final static class SoundToNearExceptEventBuilder extends WorldSpawnedEventBuilder implements ISoundWorldSpawnedEvent, IStringIdentifierWorldSpawnedEvent, IEntityPlayerWorldSpawnedEvent { + public static final class SoundToNearExceptEventBuilder extends WorldSpawnedEventBuilder implements ISoundWorldSpawnedEvent, IStringIdentifierWorldSpawnedEvent, IEntityPlayerWorldSpawnedEvent { private float pitch; private float volume; -- cgit From 143831a3a2db1812865c7898b5eb68dc16e4cac6 Mon Sep 17 00:00:00 2001 From: Léa Gris Date: Sat, 13 Mar 2021 17:31:19 +0100 Subject: fix(rendering): gregtech stone backgrond orientation on bottom face of ores Stone background on the bottom side of ores, did not use the same flipped orientation as with dumb blocks of the same material, which uses the vanilla block renderer from Minecraft. This patch fixes the rendering of the bottom side of Gregtecg ores which uses te following Gregtech stone backgrounds: - Black Granite - Red Granite - Marble - Basalt --- src/main/java/gregtech/common/blocks/GT_Block_Ores.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/main/java') diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Ores.java b/src/main/java/gregtech/common/blocks/GT_Block_Ores.java index bab31d85ed..f43e93cc0f 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Ores.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Ores.java @@ -8,6 +8,7 @@ import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.objects.GT_CopiedBlockTexture; import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.objects.GT_StdRenderedTexture; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; @@ -58,6 +59,6 @@ public class GT_Block_Ores extends GT_Block_Ores_Abstract { @Override public ITexture[] getTextureSet() { //Must have 16 entries. - return new ITexture[]{new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.netherrack, 0, 0), new GT_CopiedBlockTexture(Blocks.end_stone, 0, 0), new GT_RenderedTexture(Textures.BlockIcons.GRANITE_BLACK_STONE), new GT_RenderedTexture(Textures.BlockIcons.GRANITE_RED_STONE), new GT_RenderedTexture(Textures.BlockIcons.MARBLE_STONE), new GT_RenderedTexture(Textures.BlockIcons.BASALT_STONE), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0)}; + return new ITexture[]{new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.netherrack, 0, 0), new GT_CopiedBlockTexture(Blocks.end_stone, 0, 0), new GT_StdRenderedTexture(Textures.BlockIcons.GRANITE_BLACK_STONE), new GT_StdRenderedTexture(Textures.BlockIcons.GRANITE_RED_STONE), new GT_StdRenderedTexture(Textures.BlockIcons.MARBLE_STONE), new GT_StdRenderedTexture(Textures.BlockIcons.BASALT_STONE), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0)}; } } \ No newline at end of file -- cgit