From a21896331e11bb1c98f26108aa6edef871eee637 Mon Sep 17 00:00:00 2001 From: BlueHero233 Date: Mon, 14 Oct 2024 17:44:29 -0300 Subject: [PATCH 1/4] First Commit --- .../core/block/machine/BlockPooCollector.java | 2 +- .../machines/TileEntityAdvPooCollector.java | 133 +++--------------- .../TileEntityBaseFluidCollector.java | 76 ++++------ .../machines/TileEntityPooCollector.java | 117 +++------------ 4 files changed, 68 insertions(+), 260 deletions(-) diff --git a/src/main/java/gtPlusPlus/core/block/machine/BlockPooCollector.java b/src/main/java/gtPlusPlus/core/block/machine/BlockPooCollector.java index b7c84ddc8ce..6bc75469885 100644 --- a/src/main/java/gtPlusPlus/core/block/machine/BlockPooCollector.java +++ b/src/main/java/gtPlusPlus/core/block/machine/BlockPooCollector.java @@ -75,7 +75,7 @@ public void registerBlockIcons(final IIconRegister p_149651_1_) { } /** - * Called upon block activation (right click on the block.) + * Called upon block activation (right-click on the block.) */ @Override public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, diff --git a/src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityAdvPooCollector.java b/src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityAdvPooCollector.java index 83a56ff287c..f9e3818e6f4 100644 --- a/src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityAdvPooCollector.java +++ b/src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityAdvPooCollector.java @@ -1,39 +1,16 @@ package gtPlusPlus.core.tileentities.machines; -import java.util.ArrayList; - -import net.minecraft.entity.item.EntityItem; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GTOreDictUnificator; import net.minecraft.entity.passive.EntityAnimal; -import net.minecraft.entity.passive.EntityChicken; -import net.minecraft.entity.passive.EntityCow; -import net.minecraft.entity.passive.EntityHorse; -import net.minecraft.entity.passive.EntityMooshroom; -import net.minecraft.entity.passive.EntitySheep; -import net.minecraft.entity.passive.EntityVillager; -import net.minecraft.entity.passive.IAnimals; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.Fluid; -import gtPlusPlus.core.item.chemistry.AgriculturalChem; +import net.minecraft.item.ItemStack; import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; public class TileEntityAdvPooCollector extends TileEntityBaseFluidCollector { public TileEntityAdvPooCollector() { - super(18, 128000); - } - - @Override - public boolean canFill(ForgeDirection from, Fluid fluid) { - return false; - } - - @Override - public boolean canDrain(ForgeDirection from, Fluid fluid) { - return true; + super(36, 256000); } @Override @@ -41,101 +18,35 @@ public void onPreLogicTick() {} @Override public boolean addDrop(V aPooMaker) { - int aChance = MathUtils.randInt(0, 50000); + int aChance = MathUtils.randInt(0, 250); + ItemStack aPoop = null; if (aChance > 0) { - ItemStack aPoop; - if (aChance <= 200) { - aPoop = ItemUtils.getItemStackOfAmountFromOreDict("dustManureByproducts", 1); - } else if (aChance <= 1000) { - aPoop = ItemUtils.getItemStackOfAmountFromOreDict("dustSmallManureByproducts", 1); - } else if (aChance <= 2000) { - aPoop = ItemUtils.getItemStackOfAmountFromOreDict("dustTinyManureByproducts", 1); - } else { - return false; - } - - // Add to inventory if not full, else espawn in world - if (!this.mInventory.addItemStack(aPoop)) { - EntityItem entity = new EntityItem(worldObj, xCoord, yCoord + 1.5, zCoord, aPoop); - worldObj.spawnEntityInWorld(entity); + if (aChance <= 2) { + aPoop = GTOreDictUnificator.get(OrePrefixes.dust, "dustManureByproducts", 1); + } else if (aChance <= 10) { + aPoop = GTOreDictUnificator.get(OrePrefixes.dustSmall, "dustSmallManureByproducts", 1); + } else if (aChance <= 25) { + aPoop = GTOreDictUnificator.get(OrePrefixes.dustTiny, "dustTinyManureByproducts", 1); } + // Add to inventory if not full + if (!this.mInventory.isFull()) + this.mInventory.addItemStack(aPoop); } - return false; } - private static final ArrayList aEntityToDrain = new ArrayList<>(); - - @Override - public ArrayList aThingsToLookFor() { - if (aEntityToDrain.isEmpty()) { - aEntityToDrain.add(EntityAnimal.class); - aEntityToDrain.add(IAnimals.class); - aEntityToDrain.add(EntityVillager.class); - aEntityToDrain.add(EntityPlayer.class); - } - return aEntityToDrain; - } - @Override public int onPostTick(V aPooMaker) { if (this.tank.getFluidAmount() < this.tank.getCapacity()) { int aPooAmount = 0; - // Vanilla Animals - if (aPooMaker instanceof EntityChicken) { - aPooAmount = MathUtils.randInt(1, 40); - } else if (aPooMaker instanceof EntityHorse) { - aPooAmount = MathUtils.randInt(20, 40); - } else if (aPooMaker instanceof EntityCow) { - aPooAmount = MathUtils.randInt(18, 45); - } else if (aPooMaker instanceof EntityMooshroom) { - aPooAmount = 17; - } else if (aPooMaker instanceof EntitySheep) { - aPooAmount = MathUtils.randInt(8, 30); - } else { - if (aPooMaker instanceof IAnimals) { - aPooAmount = MathUtils.randInt(5, 35); - } else if (aPooMaker instanceof EntityVillager) { - aPooAmount = MathUtils.randInt(25, 30); - } else if (aPooMaker instanceof EntityPlayer) { - aPooAmount = MathUtils.randInt(1, 3); - } else { - aPooAmount = MathUtils.randInt(1, 10); - } + // EntityAnimal includes chicken, cow, horse, mooshroom?, ocelot, pig, sheep and wolf + if (aPooMaker instanceof EntityAnimal) { + // advanced poo collector is 4x better than basic one + aPooAmount = 40; } aPooAmount = Math.max(Math.min(this.tank.getCapacity() - this.tank.getFluidAmount(), aPooAmount), 1); - return Math.max( - 1, - (aPooAmount - * MathUtils - .getRandomFromArray(new int[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 4 }) - / 10)); - } else { - return 0; - } - } - - @Override - public Fluid fluidToProvide() { - return AgriculturalChem.PoopJuice; - } - - @Override - public ItemStack itemToSpawnInWorldIfTankIsFull() { - int a = MathUtils.randInt(0, 75); - ItemStack aItem = null; - if (a <= 30) { - aItem = ItemUtils.getSimpleStack(AgriculturalChem.dustDirt); - } else if (a <= 40) { - aItem = ItemUtils.getItemStackOfAmountFromOreDict("dustManureByproducts", 1); - } else if (a <= 55) { - aItem = ItemUtils.getItemStackOfAmountFromOreDict("dustSmallManureByproducts", 1); - } - return aItem; - } - - @Override - public int getBaseTickRate() { - return MathUtils.randInt(50, 200); + // if tank isnt full return a value between 40 and 160L + return aPooAmount * MathUtils.randInt(1,4); + } else return 0; } } diff --git a/src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityBaseFluidCollector.java b/src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityBaseFluidCollector.java index cf6ad5b6639..19b5d2aa280 100644 --- a/src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityBaseFluidCollector.java +++ b/src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityBaseFluidCollector.java @@ -1,10 +1,10 @@ package gtPlusPlus.core.tileentities.machines; -import java.util.ArrayList; + import java.util.List; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.item.ItemStack; +import gtPlusPlus.core.item.chemistry.AgriculturalChem; +import net.minecraft.entity.passive.EntityAnimal; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; @@ -23,9 +23,7 @@ import gtPlusPlus.api.objects.minecraft.BTF_FluidTank; import gtPlusPlus.api.objects.minecraft.BlockPos; import gtPlusPlus.core.tileentities.base.TileEntityBase; -import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; public abstract class TileEntityBaseFluidCollector extends TileEntityBase implements IFluidHandler { @@ -144,12 +142,6 @@ public final void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt readFromNBT(tag); } - public int getBaseTickRate() { - return MathUtils.randInt(200, 300); - } - - public abstract ArrayList aThingsToLookFor(); - public abstract void onPreLogicTick(); public final void logicTick() { @@ -157,35 +149,28 @@ public final void logicTick() { if (this.worldObj == null || this.worldObj.isRemote) { return; } - if (internalTickCounter % getBaseTickRate() == 0) { + // Linear tick rate for all collectors + if (internalTickCounter % 20 == 0) { if (internalBlockLocation == null) { internalBlockLocation = new BlockPos(this); } BlockPos p = internalBlockLocation; - if (p != null) { - if (p.world != null) { - World w = this.worldObj; - if (w == null) { - return; - } - Chunk c = w.getChunkFromBlockCoords(p.xPos, p.zPos); - if (c != null) { - if (c.isChunkLoaded) { - int startX = p.xPos - 2; - int startY = p.yPos; - int startZ = p.zPos - 2; - int endX = p.xPos + 3; - int endY = p.yPos + 5; - int endZ = p.zPos + 3; - AxisAlignedBB box = AxisAlignedBB.getBoundingBox(startX, startY, startZ, endX, endY, endZ); - if (box != null) { - for (Class c2 : aThingsToLookFor()) { - tickEntityType(w, box, c2); - } - } else { - return; - } - } + if (p.world != null) { + World w = this.worldObj; + if (w == null) { + return; + } + Chunk c = w.getChunkFromBlockCoords(p.xPos, p.zPos); + if (c != null) { + if (c.isChunkLoaded) { + int startX = p.xPos - 2; + int startY = p.yPos; + int startZ = p.zPos - 2; + int endX = p.xPos + 3; + int endY = p.yPos + 5; + int endZ = p.zPos + 3; + AxisAlignedBB box = AxisAlignedBB.getBoundingBox(startX, startY, startZ, endX, endY, endZ); + tickEntityType(w, box, EntityAnimal.class); } } } @@ -209,16 +194,7 @@ public final void interactWithEntities(List entities) { int aFluidAmount = onPostTick(aEntity); aFluidAmount = Math .max(Math.min(this.tank.getCapacity() - this.tank.getFluidAmount(), aFluidAmount), 1); - this.tank.fill(FluidUtils.getFluidStack(fluidToProvide(), aFluidAmount), true); - } else { - ItemStack aDirtStack = ItemUtils.getSimpleStack(itemToSpawnInWorldIfTankIsFull(), 1); - if (!ItemUtils.checkForInvalidItems(aDirtStack)) { - return; - } - if (!this.mInventory.addItemStack(aDirtStack)) { - EntityItem entity = new EntityItem(worldObj, xCoord, yCoord + 1.5, zCoord, aDirtStack); - worldObj.spawnEntityInWorld(entity); - } + this.tank.fill(FluidUtils.getFluidStack(AgriculturalChem.PoopJuice, aFluidAmount), true); } } } @@ -226,14 +202,10 @@ public final void interactWithEntities(List entities) { /** * Return the amount of fluid for this entity type * - * @param aEntity - * @return + * @param aEntity takes the entity inside the bounding box + * @return aPooAmount */ public abstract int onPostTick(V aEntity); public abstract boolean addDrop(V aPooMaker); - - public abstract Fluid fluidToProvide(); - - public abstract ItemStack itemToSpawnInWorldIfTankIsFull(); } diff --git a/src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityPooCollector.java b/src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityPooCollector.java index ba7433bfd23..40799677aff 100644 --- a/src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityPooCollector.java +++ b/src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityPooCollector.java @@ -1,37 +1,17 @@ package gtPlusPlus.core.tileentities.machines; -import java.util.ArrayList; -import net.minecraft.entity.item.EntityItem; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GTOreDictUnificator; import net.minecraft.entity.passive.EntityAnimal; -import net.minecraft.entity.passive.EntityChicken; -import net.minecraft.entity.passive.EntityCow; -import net.minecraft.entity.passive.EntityHorse; -import net.minecraft.entity.passive.EntityMooshroom; -import net.minecraft.entity.passive.EntitySheep; -import net.minecraft.entity.passive.IAnimals; -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.Fluid; -import gtPlusPlus.core.item.chemistry.AgriculturalChem; +import net.minecraft.item.ItemStack; import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; public class TileEntityPooCollector extends TileEntityBaseFluidCollector { public TileEntityPooCollector() { - super(9, 8000); - } - - @Override - public boolean canFill(ForgeDirection from, Fluid fluid) { - return false; - } - - @Override - public boolean canDrain(ForgeDirection from, Fluid fluid) { - return true; + super(9, 64000); } @Override @@ -39,91 +19,36 @@ public void onPreLogicTick() {} @Override public boolean addDrop(V aPooMaker) { - int aChance = MathUtils.randInt(0, 50000); + int aChance = MathUtils.randInt(0, 1000); + ItemStack aPoop = null; if (aChance > 0) { - ItemStack aPoop; - if (aChance <= 100) { - aPoop = ItemUtils.getItemStackOfAmountFromOreDict("dustManureByproducts", 1); - } else if (aChance <= 500) { - aPoop = ItemUtils.getItemStackOfAmountFromOreDict("dustSmallManureByproducts", 1); - } else if (aChance <= 1250) { - aPoop = ItemUtils.getItemStackOfAmountFromOreDict("dustTinyManureByproducts", 1); - } else { - return false; - } - if (!ItemUtils.checkForInvalidItems(aPoop)) { - return false; - } - - // Add poop to world - // Logger.INFO("Adding animal waste for "+aPooMaker.getCommandSenderName()); - - // Add to inventory if not full, else espawn in world - if (!this.mInventory.addItemStack(aPoop)) { - EntityItem entity = new EntityItem(worldObj, xCoord, yCoord + 1.5, zCoord, aPoop); - worldObj.spawnEntityInWorld(entity); + if (aChance <= 2) { + aPoop = GTOreDictUnificator.get(OrePrefixes.dust, "dustManureByproducts", 1); + } else if (aChance <= 10) { + aPoop = GTOreDictUnificator.get(OrePrefixes.dustSmall, "dustSmallManureByproducts", 1); + } else if (aChance <= 25) { + aPoop = GTOreDictUnificator.get(OrePrefixes.dustTiny, "dustTinyManureByproducts", 1); } + // Add to inventory if not full + if (!this.mInventory.isFull()) + this.mInventory.addItemStack(aPoop); } - return false; } - private static final ArrayList aEntityToDrain = new ArrayList<>(); - - @Override - public ArrayList aThingsToLookFor() { - if (aEntityToDrain.isEmpty()) { - aEntityToDrain.add(EntityAnimal.class); - aEntityToDrain.add(IAnimals.class); - } - return aEntityToDrain; - } - @Override public int onPostTick(V aPooMaker) { if (this.tank.getFluidAmount() < this.tank.getCapacity()) { int aPooAmount = 0; - // Vanilla Animals - if (aPooMaker instanceof EntityChicken) { - aPooAmount = MathUtils.randInt(1, 40); - } else if (aPooMaker instanceof EntityHorse) { - aPooAmount = MathUtils.randInt(20, 40); - } else if (aPooMaker instanceof EntityCow) { - aPooAmount = MathUtils.randInt(18, 45); - } else if (aPooMaker instanceof EntityMooshroom) { - aPooAmount = 17; - } else if (aPooMaker instanceof EntitySheep) { - aPooAmount = MathUtils.randInt(8, 30); - } else { - if (aPooMaker instanceof IAnimals) { - aPooAmount = MathUtils.randInt(5, 35); - } else { - aPooAmount = MathUtils.randInt(1, 10); - } + // EntityAnimal includes chicken, cow, horse, mooshroom?, ocelot, pig, sheep and wolf + if (aPooMaker instanceof EntityAnimal) { + aPooAmount = 10; } - aPooAmount = Math.max((Math.min(this.tank.getCapacity() - this.tank.getFluidAmount(), aPooAmount) / 10), 1); - return aPooAmount; + aPooAmount = Math.max((Math.min(this.tank.getCapacity() - this.tank.getFluidAmount(), aPooAmount)), 1); + // if tank isnt full return a value between 10 and 40L + return aPooAmount * MathUtils.randInt(1,4); } else { return 0; } } - - @Override - public Fluid fluidToProvide() { - return AgriculturalChem.PoopJuice; - } - - @Override - public ItemStack itemToSpawnInWorldIfTankIsFull() { - int a = MathUtils.randInt(0, 100); - ItemStack aItem = null; - if (a <= 30) { - aItem = ItemUtils.getSimpleStack(AgriculturalChem.dustDirt); - } else if (a <= 40) { - aItem = ItemUtils.getItemStackOfAmountFromOreDict("dustSmallManureByproducts", 1); - } else if (a <= 55) { - aItem = ItemUtils.getItemStackOfAmountFromOreDict("dustTinyManureByproducts", 1); - } - return aItem; - } } From faf7a0269b620c14ec3beeda4eddd99878d524d7 Mon Sep 17 00:00:00 2001 From: BlueHero233 Date: Fri, 8 Nov 2024 12:25:01 -0300 Subject: [PATCH 2/4] Downtier the poop collectors for more sensible recipes --- .../core/recipe/RecipesMachines.java | 24 +++++++++---------- .../machines/TileEntityAdvPooCollector.java | 13 +++++----- .../TileEntityBaseFluidCollector.java | 3 +-- .../machines/TileEntityPooCollector.java | 10 ++++---- 4 files changed, 24 insertions(+), 26 deletions(-) diff --git a/src/main/java/gtPlusPlus/core/recipe/RecipesMachines.java b/src/main/java/gtPlusPlus/core/recipe/RecipesMachines.java index 5f37d75c6f7..9edcac6b3c8 100644 --- a/src/main/java/gtPlusPlus/core/recipe/RecipesMachines.java +++ b/src/main/java/gtPlusPlus/core/recipe/RecipesMachines.java @@ -1008,27 +1008,27 @@ private static void runModRecipes() { // Poo Collector GTValues.RA.stdBuilder() .itemInputs( - CI.machineHull_MV, - ItemList.FluidRegulator_MV.get(2), - CI.getTieredComponent(OrePrefixes.pipeMedium, 2, 2), - MaterialsAlloy.EGLIN_STEEL.getPlate(4), + GregtechItemList.GTFluidTank_LV.get(1), + ItemList.FluidRegulator_LV.get(2), + GTOreDictUnificator.get(OrePrefixes.pipeMedium, Materials.Bronze, 2), + GTOreDictUnificator.get(OrePrefixes.plate, Materials.Steel, 6), MaterialsAlloy.POTIN.getScrew(6)) - .itemOutputs(ItemUtils.getSimpleStack(ModBlocks.blockPooCollector)) + .itemOutputs(ItemUtils.getSimpleStack(ModBlocks.blockPooCollector, 0, 1)) .fluidInputs(MaterialsAlloy.TUMBAGA.getFluidStack(144 * 4)) - .duration(60 * SECONDS) + .duration(1 * MINUTES) .eut(TierEU.RECIPE_LV) .addTo(assemblerRecipes); // Adv. Poo Collector GTValues.RA.stdBuilder() .itemInputs( - CI.getTieredMachineHull(-1), ItemUtils.getSimpleStack(ModBlocks.blockPooCollector), - ItemList.FluidRegulator_IV.get(2), - CI.getTieredComponent(OrePrefixes.pipeHuge, 6, 4), - CI.getTieredComponent(OrePrefixes.screw, 6, 16)) + ItemList.FluidRegulator_HV.get(2), + GTOreDictUnificator.get(OrePrefixes.pipeHuge, Materials.StainlessSteel, 2), + GTOreDictUnificator.get(OrePrefixes.plate, Materials.Polytetrafluoroethylene, 6), + GTOreDictUnificator.get(OrePrefixes.screw, Materials.BlueAlloy, 6)) .itemOutputs(ItemUtils.getSimpleStack(ModBlocks.blockPooCollector, 8, 1)) - .fluidInputs(CI.getAlternativeTieredFluid(5, 144 * 9)) - .duration(5 * MINUTES) + .fluidInputs(new FluidStack(FluidRegistry.getFluid("molten.borosilicateglass"), 144 * 8)) + .duration(1 * MINUTES) .eut(TierEU.RECIPE_HV) .addTo(assemblerRecipes); diff --git a/src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityAdvPooCollector.java b/src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityAdvPooCollector.java index f9e3818e6f4..f25b5a0cfa9 100644 --- a/src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityAdvPooCollector.java +++ b/src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityAdvPooCollector.java @@ -1,10 +1,10 @@ package gtPlusPlus.core.tileentities.machines; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.util.GTOreDictUnificator; import net.minecraft.entity.passive.EntityAnimal; - import net.minecraft.item.ItemStack; + +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GTOreDictUnificator; import gtPlusPlus.core.util.math.MathUtils; public class TileEntityAdvPooCollector extends TileEntityBaseFluidCollector { @@ -18,9 +18,11 @@ public void onPreLogicTick() {} @Override public boolean addDrop(V aPooMaker) { + // Generate a random integer from 0 to 250 int aChance = MathUtils.randInt(0, 250); ItemStack aPoop = null; if (aChance > 0) { + // if said integer is bigger than 0, has a 0.8% 4% and 10% chances of giving Manure byproducts if (aChance <= 2) { aPoop = GTOreDictUnificator.get(OrePrefixes.dust, "dustManureByproducts", 1); } else if (aChance <= 10) { @@ -29,8 +31,7 @@ public boolean addDrop(V aPooMaker) { aPoop = GTOreDictUnificator.get(OrePrefixes.dustTiny, "dustTinyManureByproducts", 1); } // Add to inventory if not full - if (!this.mInventory.isFull()) - this.mInventory.addItemStack(aPoop); + if (!this.mInventory.isFull()) this.mInventory.addItemStack(aPoop); } return false; } @@ -46,7 +47,7 @@ public int onPostTick(V aPooMaker) { } aPooAmount = Math.max(Math.min(this.tank.getCapacity() - this.tank.getFluidAmount(), aPooAmount), 1); // if tank isnt full return a value between 40 and 160L - return aPooAmount * MathUtils.randInt(1,4); + return aPooAmount * MathUtils.randInt(1, 4); } else return 0; } } diff --git a/src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityBaseFluidCollector.java b/src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityBaseFluidCollector.java index 19b5d2aa280..cb78ad9a55d 100644 --- a/src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityBaseFluidCollector.java +++ b/src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityBaseFluidCollector.java @@ -1,9 +1,7 @@ package gtPlusPlus.core.tileentities.machines; - import java.util.List; -import gtPlusPlus.core.item.chemistry.AgriculturalChem; import net.minecraft.entity.passive.EntityAnimal; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; @@ -22,6 +20,7 @@ import gtPlusPlus.api.objects.minecraft.BTF_FluidTank; import gtPlusPlus.api.objects.minecraft.BlockPos; +import gtPlusPlus.core.item.chemistry.AgriculturalChem; import gtPlusPlus.core.tileentities.base.TileEntityBase; import gtPlusPlus.core.util.minecraft.FluidUtils; diff --git a/src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityPooCollector.java b/src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityPooCollector.java index 40799677aff..71aff43eaa4 100644 --- a/src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityPooCollector.java +++ b/src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityPooCollector.java @@ -1,11 +1,10 @@ package gtPlusPlus.core.tileentities.machines; +import net.minecraft.entity.passive.EntityAnimal; +import net.minecraft.item.ItemStack; import gregtech.api.enums.OrePrefixes; import gregtech.api.util.GTOreDictUnificator; -import net.minecraft.entity.passive.EntityAnimal; - -import net.minecraft.item.ItemStack; import gtPlusPlus.core.util.math.MathUtils; public class TileEntityPooCollector extends TileEntityBaseFluidCollector { @@ -30,8 +29,7 @@ public boolean addDrop(V aPooMaker) { aPoop = GTOreDictUnificator.get(OrePrefixes.dustTiny, "dustTinyManureByproducts", 1); } // Add to inventory if not full - if (!this.mInventory.isFull()) - this.mInventory.addItemStack(aPoop); + if (!this.mInventory.isFull()) this.mInventory.addItemStack(aPoop); } return false; } @@ -46,7 +44,7 @@ public int onPostTick(V aPooMaker) { } aPooAmount = Math.max((Math.min(this.tank.getCapacity() - this.tank.getFluidAmount(), aPooAmount)), 1); // if tank isnt full return a value between 10 and 40L - return aPooAmount * MathUtils.randInt(1,4); + return aPooAmount * MathUtils.randInt(1, 4); } else { return 0; } From 3b2f96fc8680f10d2cefa801df8d5ea2103b4143 Mon Sep 17 00:00:00 2001 From: BlueHero233 Date: Fri, 8 Nov 2024 12:56:13 -0300 Subject: [PATCH 3/4] Add FermenterRecipes for Fertile and Manure Slurry to Methane gas --- .../loaders/postload/recipes/FermenterRecipes.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main/java/gregtech/loaders/postload/recipes/FermenterRecipes.java b/src/main/java/gregtech/loaders/postload/recipes/FermenterRecipes.java index b314044bdb1..f230454d7fd 100644 --- a/src/main/java/gregtech/loaders/postload/recipes/FermenterRecipes.java +++ b/src/main/java/gregtech/loaders/postload/recipes/FermenterRecipes.java @@ -269,5 +269,18 @@ public void run() { .eut(2) .addTo(fermentingRecipes); + GTValues.RA.stdBuilder() + .fluidInputs(getFluidStack("fluid.fertile.manure.slurry", 1000)) + .fluidOutputs(Materials.Methane.getGas(100)) + .duration(1 * MINUTES) + .eut(2) + .addTo(fermentingRecipes); + + GTValues.RA.stdBuilder() + .fluidInputs(getFluidStack("fluid.manure.slurry", 1000)) + .fluidOutputs(Materials.Methane.getGas(50)) + .duration(1 * MINUTES) + .eut(2) + .addTo(fermentingRecipes); } } From 8fa3f213ca1356fc420acf8539f9760436798d1d Mon Sep 17 00:00:00 2001 From: BlueHero233 Date: Thu, 14 Nov 2024 17:13:58 -0300 Subject: [PATCH 4/4] Add Chlorinating Agent for future recipe, Simplify FMS recipe with bone meal and minced meat (temp) --- .../java/gregtech/api/enums/Materials.java | 1 + .../loaders/materials/MaterialsInit1.java | 1 + .../postload/recipes/ChemicalRecipes.java | 14 ++++ .../core/item/chemistry/AgriculturalChem.java | 77 ++++++------------- 4 files changed, 38 insertions(+), 55 deletions(-) diff --git a/src/main/java/gregtech/api/enums/Materials.java b/src/main/java/gregtech/api/enums/Materials.java index 76a626744e7..f27ad2bf57d 100644 --- a/src/main/java/gregtech/api/enums/Materials.java +++ b/src/main/java/gregtech/api/enums/Materials.java @@ -615,6 +615,7 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { public static Materials Quicklime; public static Materials Potash; public static Materials SodaAsh; + public static Materials CalciumHypochlorite; public static Materials BioDiesel; public static Materials NitrationMixture; diff --git a/src/main/java/gregtech/loaders/materials/MaterialsInit1.java b/src/main/java/gregtech/loaders/materials/MaterialsInit1.java index e76d4eda206..bba01e4f133 100644 --- a/src/main/java/gregtech/loaders/materials/MaterialsInit1.java +++ b/src/main/java/gregtech/loaders/materials/MaterialsInit1.java @@ -624,6 +624,7 @@ public static void load() { Materials.Quicklime = new MaterialBuilder(622, TextureSet.SET_DULL , "Quicklime").addDustItems().setRGB(240, 240, 240).setColor(Dyes.dyeWhite).setMaterialList(new MaterialStack(Calcium, 1), new MaterialStack(Oxygen, 1)).addElectrolyzerRecipe().constructMaterial(); Materials.Potash = new MaterialBuilder(623, TextureSet.SET_DULL , "Potash").addDustItems().setRGB(120, 66, 55).setColor(Dyes.dyeBrown).setMaterialList(new MaterialStack(Potassium, 2), new MaterialStack(Oxygen, 1)).addElectrolyzerRecipe().constructMaterial(); Materials.SodaAsh = new MaterialBuilder(624, TextureSet.SET_DULL , "Soda Ash").addDustItems().setRGB(220, 220, 255).setColor(Dyes.dyeWhite).setMaterialList(new MaterialStack(Sodium, 2), new MaterialStack(Carbon, 1), new MaterialStack(Oxygen, 3)).addElectrolyzerRecipe().constructMaterial(); + Materials.CalciumHypochlorite = new MaterialBuilder(571, TextureSet.SET_DULL , "Calcium Hypochlorite").addDustItems().setRGB(240,235, 245).setColor(Dyes.dyeWhite).setMaterialList(new MaterialStack(Calcium, 1), new MaterialStack(Oxygen, 2), new MaterialStack(Chlorine, 2)).addElectrolyzerRecipe().constructMaterial(); Materials.BioDiesel = new MaterialBuilder(627, TextureSet.SET_FLUID , "Bio Diesel").addCell().addFluid().setRGB(255, 128, 0).setColor(Dyes.dyeOrange).setFuelType(MaterialBuilder.DIESEL).setFuelPower(320).constructMaterial(); Materials.NitrationMixture = new MaterialBuilder(628, TextureSet.SET_FLUID , "Nitration Mixture").addCell().setRGB(230, 226, 171).setColor(Dyes.dyeBrown).constructMaterial(); Materials.Glycerol = new MaterialBuilder(629, TextureSet.SET_FLUID , "Glycerol").addCell().addFluid().setRGB(135, 222, 135).setColor(Dyes.dyeLime).setFuelType(MaterialBuilder.SEMIFLUID).setFuelPower(164).setMaterialList(new MaterialStack(Carbon, 3), new MaterialStack(Hydrogen, 8), new MaterialStack(Oxygen, 3)).addElectrolyzerRecipe().constructMaterial(); diff --git a/src/main/java/gregtech/loaders/postload/recipes/ChemicalRecipes.java b/src/main/java/gregtech/loaders/postload/recipes/ChemicalRecipes.java index 60fba5404a5..e52c0db723c 100644 --- a/src/main/java/gregtech/loaders/postload/recipes/ChemicalRecipes.java +++ b/src/main/java/gregtech/loaders/postload/recipes/ChemicalRecipes.java @@ -33,6 +33,7 @@ import gregtech.api.util.GTOreDictUnificator; import gregtech.api.util.GTUtility; import gtPlusPlus.core.item.ModItems; +import gtPlusPlus.core.util.minecraft.ItemUtils; public class ChemicalRecipes implements Runnable { @@ -669,6 +670,19 @@ public void registerBoth() { .eut(TierEU.RECIPE_LV) .addTo(UniversalChemical); + // 2 Cl2 + 2 Ca(OH)2 = CaCl2 + Ca(OCl)2 + 2H20 + + GTValues.RA.stdBuilder() + .itemInputs(ItemUtils.getItemStackOfAmountFromOreDict("dustCalciumHydroxide", 2)) + .itemOutputs( + WerkstoffLoader.CalciumChloride.get(OrePrefixes.dust, 1), + GTOreDictUnificator.get(OrePrefixes.dust, Materials.CalciumHypochlorite, 1)) + .fluidInputs(Materials.Chlorine.getGas(4000)) + .fluidOutputs(Materials.Water.getFluid(2000)) + .duration(25 * SECONDS) + .eut(TierEU.RECIPE_LV) + .addTo(UniversalChemical); + // C + 4H = CH4 GTValues.RA.stdBuilder() diff --git a/src/main/java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java b/src/main/java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java index 5c587bc4c56..faaf00c37df 100644 --- a/src/main/java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java +++ b/src/main/java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java @@ -26,6 +26,7 @@ import forestry.core.items.ItemRegistryCore; import forestry.plugins.PluginCore; import gregtech.api.enums.GTValues; +import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; import gregtech.api.enums.Mods; import gregtech.api.enums.OrePrefixes; @@ -343,13 +344,10 @@ public AgriculturalChem() { private static final ArrayList mNuts = new ArrayList<>(); private static final ArrayList mSeeds = new ArrayList<>(); private static final ArrayList mPeat = new ArrayList<>(); - private static final ArrayList mBones = new ArrayList<>(); - private static final ArrayList mBoneMeal = new ArrayList<>(); private static final ArrayList mList_Master_Meats = new ArrayList<>(); private static final ArrayList mList_Master_FruitVege = new ArrayList<>(); private static final ArrayList mList_Master_Seeds = new ArrayList<>(); - private static final ArrayList mList_Master_Bones = new ArrayList<>(); private static void processAllOreDict() { processOreDict("listAllmeatraw", mMeats); @@ -359,8 +357,6 @@ private static void processAllOreDict() { processOreDict("listAllnut", mNuts); processOreDict("listAllSeed", mSeeds); processOreDict("brickPeat", mPeat); - processOreDict("bone", mBones); - processOreDict("dustBone", mBoneMeal); // Just make a mega list, makes life easier. if (!mMeats.isEmpty()) { mList_Master_Meats.addAll(mMeats); @@ -390,22 +386,6 @@ private static void processAllOreDict() { if (!mSeeds.isEmpty()) { mList_Master_Seeds.addAll(mSeeds); } - if (!mBoneMeal.isEmpty()) { - mList_Master_Bones.addAll(mBoneMeal); - } - if (!mBones.isEmpty()) { - for (ItemStack g : mBones) { - boolean foundDupe = false; - for (ItemStack old : mList_Master_Bones) { - if (GTUtility.areStacksEqual(g, old)) { - foundDupe = true; - break; - } - } - if (foundDupe) continue; - mList_Master_Bones.add(g); - } - } } private static void processOreDict(String aOreName, ArrayList aMap) { @@ -446,35 +426,24 @@ private static void addBasicSlurryRecipes() { private static void addAdvancedSlurryRecipes() { - ItemStack aCircuit = GTUtility.getIntegratedCircuit(10); - ItemStack aBone; - ItemStack aMeat; - ItemStack aEmptyCells = Materials.Empty.getCells(2); - ItemStack aInputCells = ItemUtils.getItemStackOfAmountFromOreDict("cellRawAnimalWaste", 2); - FluidStack aOutput = FluidUtils.getFluidStack(FertileManureSlurry, 1000); - for (FluidStack aBloodStack : mBloodFluids) { - for (ItemStack aBoneStack : mList_Master_Bones) { - aBone = ItemUtils.getSimpleStack(aBoneStack, 2); - for (ItemStack aMeatStack : mList_Master_Meats) { - aMeat = ItemUtils.getSimpleStack(aMeatStack, 5); - // Poop Juice to Fertile Slurry - GTValues.RA.stdBuilder() - .itemInputs(aCircuit, aBone, aMeat, aInputCells) - .itemOutputs(aEmptyCells) - .fluidInputs(aBloodStack) - .fluidOutputs(aOutput) - .duration(8 * SECONDS) - .eut(TierEU.RECIPE_MV / 2) - .addTo(mixerRecipes); - } - } + // Poop Juice to Fertile Slurry + GTValues.RA.stdBuilder() + .itemInputs( + GTUtility.getIntegratedCircuit(10), + ItemList.Dye_Bonemeal.get(2L), + GTOreDictUnificator.get(OrePrefixes.dust, Materials.MeatRaw, 5), + ItemUtils.getItemStackOfAmountFromOreDict("cellRawAnimalWaste", 2)) + .itemOutputs(Materials.Empty.getCells(2)) + .fluidInputs(aBloodStack) + .fluidOutputs(FluidUtils.getFluidStack(FertileManureSlurry, 1000)) + .duration(4 * SECONDS) + .eut(TierEU.RECIPE_MV) + .addTo(mixerRecipes); } } private static void addBasicOrganiseFertRecipes() { - FluidStack aInputFluid = FluidUtils.getFluidStack(ManureSlurry, 1000); - ItemStack aOutputDust = ItemUtils.getSimpleStack(dustOrganicFertilizer, 3); ItemStack aPeat; ItemStack aMeat; for (ItemStack aPeatStack : mPeat) { @@ -483,8 +452,8 @@ private static void addBasicOrganiseFertRecipes() { aMeat = ItemUtils.getSimpleStack(aMeatStack, 5); GTValues.RA.stdBuilder() .itemInputs(aPeat, aMeat) - .itemOutputs(aOutputDust) - .fluidInputs(aInputFluid) + .itemOutputs(ItemUtils.getSimpleStack(dustOrganicFertilizer, 3)) + .fluidInputs(FluidUtils.getFluidStack(ManureSlurry, 1000)) .duration(20 * SECONDS) .eut(TierEU.RECIPE_MV) .addTo(UniversalChemical); @@ -494,8 +463,8 @@ private static void addBasicOrganiseFertRecipes() { aMeat = ItemUtils.getSimpleStack(aMeatStack, 9); GTValues.RA.stdBuilder() .itemInputs(aPeat, aMeat) - .itemOutputs(aOutputDust) - .fluidInputs(aInputFluid) + .itemOutputs(ItemUtils.getSimpleStack(dustOrganicFertilizer, 3)) + .fluidInputs(FluidUtils.getFluidStack(ManureSlurry, 1000)) .duration(10 * SECONDS) .eut(TierEU.RECIPE_MV) .addTo(UniversalChemical); @@ -504,8 +473,6 @@ private static void addBasicOrganiseFertRecipes() { } private static void addAdvancedOrganiseFertRecipes() { - FluidStack aInputFluid = FluidUtils.getFluidStack(FertileManureSlurry, 1000); - ItemStack aOutputDust = ItemUtils.getSimpleStack(dustOrganicFertilizer, 7); ItemStack aPeat; ItemStack aMeat; for (ItemStack aPeatStack : mPeat) { @@ -514,8 +481,8 @@ private static void addAdvancedOrganiseFertRecipes() { aMeat = ItemUtils.getSimpleStack(aMeatStack, 7); GTValues.RA.stdBuilder() .itemInputs(aPeat, aMeat) - .itemOutputs(aOutputDust) - .fluidInputs(aInputFluid) + .itemOutputs(ItemUtils.getSimpleStack(dustOrganicFertilizer, 7)) + .fluidInputs(FluidUtils.getFluidStack(FertileManureSlurry, 1000)) .duration(10 * SECONDS) .eut(140) .addTo(UniversalChemical); @@ -525,8 +492,8 @@ private static void addAdvancedOrganiseFertRecipes() { aMeat = ItemUtils.getSimpleStack(aMeatStack, 12); GTValues.RA.stdBuilder() .itemInputs(aPeat, aMeat) - .itemOutputs(aOutputDust) - .fluidInputs(aInputFluid) + .itemOutputs(ItemUtils.getSimpleStack(dustOrganicFertilizer, 7)) + .fluidInputs(FluidUtils.getFluidStack(FertileManureSlurry, 1000)) .duration(5 * SECONDS) .eut(140) .addTo(UniversalChemical);