From d8da94ede0ae3df9ea5c47145043c09874bffebe Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Wed, 13 Mar 2019 12:30:37 +0000 Subject: % Mild improvements to BTF_Inventory.java. % Finished Agricultural Sewer. --- .../api/objects/minecraft/BTF_Inventory.java | 43 ++++++++++ .../core/block/machine/Machine_PooCollector.java | 30 ++++--- .../gtPlusPlus/core/recipe/RECIPES_Machines.java | 16 ++++ .../machines/TileEntityPooCollector.java | 94 ++++++++++++++++++---- .../gtPlusPlus/core/util/minecraft/ItemUtils.java | 2 +- 5 files changed, 157 insertions(+), 28 deletions(-) (limited to 'src/Java') diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/BTF_Inventory.java b/src/Java/gtPlusPlus/api/objects/minecraft/BTF_Inventory.java index 25968f1908..43a325f190 100644 --- a/src/Java/gtPlusPlus/api/objects/minecraft/BTF_Inventory.java +++ b/src/Java/gtPlusPlus/api/objects/minecraft/BTF_Inventory.java @@ -3,6 +3,7 @@ package gtPlusPlus.api.objects.minecraft; import java.util.ArrayList; import gregtech.api.util.GT_Utility; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.tileentities.base.TileEntityBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.ISidedInventory; @@ -160,5 +161,47 @@ public class BTF_Inventory implements ISidedInventory{ return this.mTile != null ? mTile.getInventoryName() : ""; } + public boolean isFull() { + for (int s=0;s animals) { for (EntityAnimal aPooMaker : animals) { - Logger.INFO("Sewer found "+aPooMaker.getCommandSenderName()); + //Logger.INFO("Sewer found "+aPooMaker.getCommandSenderName()); + addDrop(aPooMaker); + if (this.tank.getFluidAmount() < this.tank.getCapacity()) { + + int aPooAmount = 0; + 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 { + aPooAmount = MathUtils.randInt(5, 35); + } + + aPooAmount = Math.max(Math.min(this.tank.getCapacity()-this.tank.getFluidAmount(), aPooAmount), 1); + + this.tank.fill(FluidUtils.getFluidStack(AgriculturalChem.PoopJuice, aPooAmount), true); + } + else { + ItemStack aDirtStack = ItemUtils.getSimpleStack(AgriculturalChem.dustDirt); + if (!this.mInventory.addItemStack(aDirtStack)) { + EntityItem entity = new EntityItem(worldObj, xCoord, yCoord+1.5, zCoord, aDirtStack); + worldObj.spawnEntityInWorld(entity); + } + } } } public boolean addDrop(EntityAnimal aAnimal) { + int aChance = MathUtils.randInt(0, 50000); + 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; + } + //Add poop to world + Logger.INFO("Adding animal waste for "+aAnimal.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); + } + + } + + return false; } diff --git a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java index 9ce51d5858..d32ff4e160 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java @@ -663,7 +663,7 @@ public class ItemUtils { } public static String getArrayStackNames(final ItemStack[] aStack) { - String itemNames = "Item Array: "; + String itemNames = ""; int aPos = 0; for (final ItemStack alph : aStack) { if (alph == null) { -- cgit