From 9fe3f693f1d6d015f45898818b7958b3a57a9f4a Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Fri, 26 Jul 2019 04:23:36 +0100 Subject: + Added config option to adjust ingame BGM delays. (Should be working) + Added a Pest Killer for quick removal of Butterflies and Bats. + Added Hydrogen Cyanide. % Replaced existing assets for the Bat King. % Replaced Bat King Logic, it's now an offensive mob. $ Fixed Bat King model scaling. --- .../core/tileentities/ModTileEntities.java | 20 +- .../machines/TileEntityPestKiller.java | 506 +++++++++++++++++++++ 2 files changed, 522 insertions(+), 4 deletions(-) create mode 100644 src/Java/gtPlusPlus/core/tileentities/machines/TileEntityPestKiller.java (limited to 'src/Java/gtPlusPlus/core/tileentities') diff --git a/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java b/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java index c3670ef959..ada0fd7b86 100644 --- a/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java +++ b/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java @@ -1,14 +1,25 @@ package gtPlusPlus.core.tileentities; import cpw.mods.fml.common.registry.GameRegistry; - import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.general.BlockSuperLight.TileEntitySuperLight; import gtPlusPlus.core.block.machine.Machine_SuperJukebox.TileEntitySuperJukebox; import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.tileentities.general.*; -import gtPlusPlus.core.tileentities.general.redstone.TileEntityRedstoneHandler; -import gtPlusPlus.core.tileentities.machines.*; +import gtPlusPlus.core.tileentities.general.TileEntityCircuitProgrammer; +import gtPlusPlus.core.tileentities.general.TileEntityDecayablesChest; +import gtPlusPlus.core.tileentities.general.TileEntityFirepit; +import gtPlusPlus.core.tileentities.general.TileEntityFishTrap; +import gtPlusPlus.core.tileentities.general.TileEntityInfiniteFluid; +import gtPlusPlus.core.tileentities.general.TileEntityPlayerDoorBase; +import gtPlusPlus.core.tileentities.general.TileEntityXpConverter; +import gtPlusPlus.core.tileentities.machines.TileEntityAdvPooCollector; +import gtPlusPlus.core.tileentities.machines.TileEntityModularityTable; +import gtPlusPlus.core.tileentities.machines.TileEntityPestKiller; +import gtPlusPlus.core.tileentities.machines.TileEntityPooCollector; +import gtPlusPlus.core.tileentities.machines.TileEntityProjectTable; +import gtPlusPlus.core.tileentities.machines.TileEntityTradeTable; +import gtPlusPlus.core.tileentities.machines.TileEntityWorkbench; +import gtPlusPlus.core.tileentities.machines.TileEntityWorkbenchAdvanced; import gtPlusPlus.plugin.villagers.tile.TileEntityGenericSpawner; public class ModTileEntities { @@ -32,6 +43,7 @@ public class ModTileEntities { GameRegistry.registerTileEntity(TileEntityDecayablesChest.class, "TileDecayablesChest"); GameRegistry.registerTileEntity(TileEntitySuperJukebox.class, "TileEntitySuperJukebox"); GameRegistry.registerTileEntity(TileEntitySuperLight.class, "TileEntitySuperLight"); + GameRegistry.registerTileEntity(TileEntityPestKiller.class, "TileEntityPestKiller"); //Mod TEs diff --git a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityPestKiller.java b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityPestKiller.java new file mode 100644 index 0000000000..b518072e48 --- /dev/null +++ b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityPestKiller.java @@ -0,0 +1,506 @@ +package gtPlusPlus.core.tileentities.machines; + +import java.util.ArrayList; +import java.util.List; + +import gregtech.api.util.GT_Utility; +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.api.objects.minecraft.BTF_FluidTank; +import gtPlusPlus.core.inventories.InventoryPestKiller; +import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.core.material.MISC_MATERIALS; +import gtPlusPlus.core.recipe.common.CI; +import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.core.util.minecraft.EntityUtils; +import gtPlusPlus.core.util.minecraft.FluidUtils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import net.minecraft.entity.Entity; +import net.minecraft.entity.passive.EntityBat; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.ISidedInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.DamageSource; +import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidEvent; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.FluidTank; +import net.minecraftforge.fluids.FluidTankInfo; +import net.minecraftforge.fluids.IFluidHandler; +import net.minecraftforge.oredict.OreDictionary; + +public class TileEntityPestKiller extends TileEntity implements ISidedInventory, IFluidHandler { + + private final int mBaseTickRate = 20 * 30; + private final InventoryPestKiller mInventory; + private final FluidTank mTank; + private int mChunkX; + private int mChunkZ; + private boolean mSet = false; + + private int mTickCounter = 0; + private int mUpdateTick = 0; + private boolean mNeedsUpdate = false; + private String mCustomName; + + private static final AutoMap> mEntityMap = new AutoMap>(); + + static { + mEntityMap.put(EntityBat.class); + if (LoadedMods.Forestry) { + mEntityMap.put(ReflectionUtils.getClass("forestry.lepidopterology.entities.EntityButterfly.class")); + } + } + + public TileEntityPestKiller() { + this.mInventory = new InventoryPestKiller(); + mTank = new BTF_FluidTank(2000); + } + + public InventoryPestKiller getInventory() { + return this.mInventory; + } + + public FluidTank getTank() { + return mTank; + } + + private final void setup() { + World w = this.worldObj; + if (w != null) { + Chunk c = w.getChunkFromBlockCoords(this.xCoord, this.zCoord); + if (c != null) { + mChunkX = c.xPosition; + mChunkZ = c.zPosition; + mSet = true; + } + } + } + + @SuppressWarnings("rawtypes") + public boolean tryKillPests() { + int min = 0; + int max = 0; + switch (getTier()) { + case 1: + min = -2; + max = 3; + break; + case 2: + min = -4; + max = 5; + break; + default: + // code block + } + int aChunkCount = 0; + AutoMap entities = new AutoMap(); + if (min != 0 && max != 0) { + for (int x = min; x < max; x++) { + for (int z = min; z < max; z++) { + Chunk c = getChunkFromOffsetIfLoaded(x, z); + if (c != null) { + if (c.hasEntities) { + aChunkCount++; + List[] lists = c.entityLists; + for (List o : lists) { + for (Object e : o) { + if (e instanceof Entity) { + for (Class C : mEntityMap) { + if (e.getClass().equals(C) || C.isAssignableFrom(e.getClass())) { + entities.put((Entity) e); + } + } + } + } + } + } + } + } + } + } else { + Chunk c = getChunkFromOffsetIfLoaded(0, 0); + if (c != null) { + if (c.hasEntities) { + List[] lists = c.entityLists; + for (List o : lists) { + for (Object e : o) { + if (e instanceof Entity) { + for (Class C : mEntityMap) { + if (e.getClass().equals(C) || C.isAssignableFrom(e.getClass())) { + entities.put((Entity) e); + } + } + } + } + } + } + } + } + boolean killed = false; + if (!entities.isEmpty()) { + for (Entity e : entities) { + if (e != null) { + if (e.isEntityAlive()) { + if (this.mTank.getFluidAmount() >= 1 || getTier() == 0) { + if (getTier() > 0) { + int aChanceToUse = MathUtils.randInt(1, (100 * getTier())); + if (aChanceToUse == 1) { + this.mTank.drain(1, true); + } + } + e.performHurtAnimation(); + EntityUtils.doDamage(e, DamageSource.generic, Short.MAX_VALUE); + e.setDead(); + killed = true; + } + } + } + } + } + updateTileEntity(); + return killed; + } + + public Chunk getChunkFromOffsetIfLoaded(int x, int y) { + Chunk c = this.worldObj.getChunkFromChunkCoords(mChunkX + x, mChunkZ + y); + if (c.isChunkLoaded) { + return c; + } + return null; + } + + public int getTier() { + if (this.mTank != null) { + FluidStack f = mTank.getFluid(); + if (f != null) { + if (f.isFluidEqual(FluidUtils.getWildcardFluidStack("formaldehyde", 1))) { + return 1; + } else if (f.isFluidEqual(MISC_MATERIALS.HYDROGEN_CYANIDE.getFluid(1))) { + return 2; + } + } + } + return 0; + } + + @Override + public void updateEntity() { + if (worldObj.isRemote) { + return; + } + if (!mSet) { + setup(); + } + this.mTickCounter++; + if (this.mTank != null) { + if (this.hasFluidSpace()) { + handleInventory(); + } + } + if (this.mTickCounter % this.mBaseTickRate == 0) { + tryKillPests(); + } + updateTick(); + } + + public boolean anyPlayerInRange() { + return this.worldObj.getClosestPlayer(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D, 32) != null; + } + + public NBTTagCompound getTag(final NBTTagCompound nbt, final String tag) { + if (!nbt.hasKey(tag)) { + nbt.setTag(tag, new NBTTagCompound()); + } + return nbt.getCompoundTag(tag); + } + + @Override + public void writeToNBT(final NBTTagCompound nbt) { + mTank.writeToNBT(nbt); + super.writeToNBT(nbt); + // Utils.LOG_MACHINE_INFO("Trying to write NBT data to TE."); + final NBTTagCompound chestData = new NBTTagCompound(); + this.mInventory.writeToNBT(chestData); + nbt.setTag("ContentsChest", chestData); + if (this.hasCustomInventoryName()) { + nbt.setString("CustomName", this.getCustomName()); + } + } + + @Override + public void readFromNBT(final NBTTagCompound nbt) { + mTank.readFromNBT(nbt); + super.readFromNBT(nbt); + // Utils.LOG_MACHINE_INFO("Trying to read NBT data from TE."); + this.mInventory.readFromNBT(nbt.getCompoundTag("ContentsChest")); + if (nbt.hasKey("CustomName", 8)) { + this.setCustomName(nbt.getString("CustomName")); + } + } + + @Override + public int getSizeInventory() { + return this.getInventory().getSizeInventory(); + } + + @Override + public ItemStack getStackInSlot(final int slot) { + return this.getInventory().getStackInSlot(slot); + } + + @Override + public ItemStack decrStackSize(final int slot, final int count) { + return this.getInventory().decrStackSize(slot, count); + } + + @Override + public ItemStack getStackInSlotOnClosing(final int slot) { + return this.getInventory().getStackInSlotOnClosing(slot); + } + + @Override + public void setInventorySlotContents(final int slot, final ItemStack stack) { + this.getInventory().setInventorySlotContents(slot, stack); + } + + @Override + public int getInventoryStackLimit() { + return this.getInventory().getInventoryStackLimit(); + } + + @Override + public boolean isUseableByPlayer(final EntityPlayer entityplayer) { + return this.getInventory().isUseableByPlayer(entityplayer); + } + + @Override + public void openInventory() { + this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, 1); + this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); + this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord - 1, this.zCoord, this.getBlockType()); + this.getInventory().openInventory(); + } + + @Override + public void closeInventory() { + this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, 1); + this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); + this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord - 1, this.zCoord, this.getBlockType()); + this.getInventory().closeInventory(); + } + + @Override + public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) { + return this.getInventory().isItemValidForSlot(slot, itemstack); + } + + @Override + public int[] getAccessibleSlotsFromSide(final int p_94128_1_) { + final int[] accessibleSides = new int[this.getSizeInventory()]; + for (int r = 0; r < this.getInventory().getSizeInventory(); r++) { + accessibleSides[r] = r; + } + return accessibleSides; + + } + + @Override + public boolean canInsertItem(final int aSlot, final ItemStack aStack, final int p_102007_3_) { + if (this.getInventory().getInventory()[0] == null) { + return true; + } else if (GT_Utility.areStacksEqual(aStack, this.getInventory().getInventory()[0])) { + if (this.getInventory().getInventory()[0].stackSize < 64) { + int diff = 64 - this.getInventory().getInventory()[0].stackSize; + if (aStack.stackSize <= diff) { + return true; + } + } + } + return false; + } + + @Override + public boolean canExtractItem(final int aSlot, final ItemStack aStack, final int p_102008_3_) { + if (this.getInventory().getInventory()[1] == null) { + return false; + } else { + return true; + } + } + + public String getCustomName() { + return this.mCustomName; + } + + public void setCustomName(final String customName) { + this.mCustomName = customName; + } + + @Override + public String getInventoryName() { + return this.hasCustomInventoryName() ? this.mCustomName : "container.pestkiller"; + } + + @Override + public boolean hasCustomInventoryName() { + return (this.mCustomName != null) && !this.mCustomName.equals(""); + } + + @Override + public final int fill(ForgeDirection from, FluidStack resource, boolean doFill) { + updateTileEntity(); + return this.mTank.fill(resource, doFill); + } + + @Override + public final FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) { + updateTileEntity(); + return this.mTank.drain(resource.amount, doDrain); + } + + @Override + public final FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) { + FluidStack fluid = this.mTank.getFluid(); + // return this.tank.drain(maxDrain, doDrain); + if (fluid == null) { + return null; + } + + int drained = maxDrain; + if (fluid.amount < drained) { + drained = fluid.amount; + } + + FluidStack stack = new FluidStack(fluid, drained); + if (doDrain) { + fluid.amount -= drained; + if (fluid.amount <= 0) { + fluid = null; + } + + if (this != null) { + FluidEvent.fireEvent(new FluidEvent.FluidDrainingEvent(fluid, this.getWorldObj(), this.xCoord, + this.yCoord, this.zCoord, this.mTank, 0)); + } + } + updateTileEntity(); + return stack; + } + + @Override + public boolean canFill(ForgeDirection from, Fluid fluid) { + return mTank.getFluid() == null || mTank.getFluid().getFluid().equals(fluid); + } + + @Override + public boolean canDrain(ForgeDirection from, Fluid fluid) { + return false; + } + + @Override + public final FluidTankInfo[] getTankInfo(ForgeDirection from) { + return new FluidTankInfo[] { this.mTank.getInfo() }; + } + + @Override + public final Packet getDescriptionPacket() { + NBTTagCompound tag = new NBTTagCompound(); + writeToNBT(tag); + return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, this.blockMetadata, tag); + } + + @Override + public final void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { + NBTTagCompound tag = pkt.func_148857_g(); + readFromNBT(tag); + } + + + public boolean hasFluidSpace() { + if (this.mTank.getFluidAmount() <= 1000) { + return true; + } + return false; + } + + public boolean drainCell() { + boolean didFill = false; + ItemStack aInput = this.getStackInSlot(0); + if (aInput == null) { + return false; + } + aInput = aInput.copy(); + if (aInput != null && (this.getStackInSlot(1) == null || this.getStackInSlot(1).stackSize < 64)) { + ArrayList t1Cells = OreDictionary.getOres("cellFormaldehyde"); + ArrayList t2Cells = OreDictionary.getOres("cellHydrogenCyanide"); + didFill = addFluid(t1Cells, aInput, FluidUtils.getWildcardFluidStack("formaldehyde", 1000)); + if (!didFill) { + didFill = addFluid(t2Cells, aInput, MISC_MATERIALS.HYDROGEN_CYANIDE.getFluid(1000)); + } + } + + return didFill; + } + + public boolean handleInventory() { + if (this.getInventory() != null && drainCell()) { + this.decrStackSize(0, 1); + if (this.getStackInSlot(1) == null) { + this.setInventorySlotContents(1, CI.emptyCells(1)); + } else { + this.getStackInSlot(1).stackSize++; + } + this.updateTileEntity(); + return true; + } else { + return false; + } + } + + public boolean addFluid(ArrayList inputs, ItemStack aInput, FluidStack aFluidForInput) { + for (ItemStack a : inputs) { + if (GT_Utility.areStacksEqual(a, aInput)) { + if (mTank.getFluid() == null || mTank.getFluid() + .isFluidEqual(aFluidForInput)) { + boolean didFill = fill(ForgeDirection.UNKNOWN, aFluidForInput, true) > 0; + return didFill; + } + } else { + continue; + } + } + return false; + } + + public void updateTileEntity() { + this.getInventory().markDirty(); + this.markDirty(); + this.mNeedsUpdate = true; + } + + private final void updateTick() { + if (mNeedsUpdate) { + if (mUpdateTick == 0) { + mUpdateTick = 4; // every 4 ticks it will send an update + } else { + --mUpdateTick; + if (mUpdateTick == 0) { + markDirty(); + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + mNeedsUpdate = false; + } + } + } + } + + + +} -- cgit From 8308ff274b114193fed038daf139c9c94329a666 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Thu, 15 Aug 2019 01:32:23 +0100 Subject: $ Fixed Dehydrator not properly importing Tinkers drying rack recipes. Fixes #487. $ Fixed Pest Killer not detecting butterflies properly. --- .../machines/TileEntityPestKiller.java | 2 +- .../core/util/reflect/ReflectionUtils.java | 61 +++++++++++++++++----- .../gtPlusPlus/xmod/tinkers/HANDLER_Tinkers.java | 2 +- .../xmod/tinkers/util/TinkersDryingRecipe.java | 39 +++++++++++--- 4 files changed, 84 insertions(+), 20 deletions(-) (limited to 'src/Java/gtPlusPlus/core/tileentities') diff --git a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityPestKiller.java b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityPestKiller.java index b518072e48..3ebe5be40d 100644 --- a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityPestKiller.java +++ b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityPestKiller.java @@ -55,7 +55,7 @@ public class TileEntityPestKiller extends TileEntity implements ISidedInventory, static { mEntityMap.put(EntityBat.class); if (LoadedMods.Forestry) { - mEntityMap.put(ReflectionUtils.getClass("forestry.lepidopterology.entities.EntityButterfly.class")); + mEntityMap.put(ReflectionUtils.getClass("forestry.lepidopterology.entities.EntityButterfly")); } } diff --git a/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java b/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java index 19e42735d7..b52c13c563 100644 --- a/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java +++ b/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java @@ -293,7 +293,7 @@ public class ReflectionUtils { return loaded > 0; } - + public static boolean setField(final Object object, final String fieldName, final Object fieldValue) { Class clazz = object.getClass(); @@ -313,8 +313,8 @@ public class ReflectionUtils { } } return false; - - + + } public static boolean setField(final Object object, final Field field, final Object fieldValue) { @@ -484,11 +484,11 @@ public class ReflectionUtils { * Internal Magic that probably should not get exposed. */ - - - - - + + + + + @@ -767,15 +767,52 @@ public class ReflectionUtils { } private static Class getClass_Internal(String string) { + Class aClass = null; if (ReflectionUtils.doesClassExist(string)) { try { - return Class.forName(string); + aClass = Class.forName(string); } catch (ClassNotFoundException e) { - return getNonPublicClass(string); + aClass = getNonPublicClass(string); } } - return null; + + if (aClass == null) { + String aClassName = ""; + Logger.REFLECTION("Splitting "+string+" to try look for hidden classes."); + String[] aData = string.split("\\."); + Logger.REFLECTION("Obtained "+aData.length+" pieces."); + for (int i=0;i<(aData.length-1);i++) { + aClassName += (i > 0) ? "."+aData[i] : ""+aData[i]; + Logger.REFLECTION("Building: "+aClassName); + } + Logger.REFLECTION("Trying to search '"+aClassName+"' for inner classes."); + Class clazz = ReflectionUtils.getClass(aClassName); + + Class[] y = clazz.getDeclaredClasses(); + if (y == null || y.length <= 0) { + Logger.REFLECTION("No hidden inner classes found."); + return null; + } + else { + boolean found = false; + for (Class h : y) { + Logger.REFLECTION("Found hidden inner class: "+h.getCanonicalName()); + if (h.getSimpleName().toLowerCase().equals(aData[aData.length-1].toLowerCase())) { + Logger.REFLECTION("Found correct class. ["+aData[aData.length-1]+"] Caching at correct location: "+string); + Logger.REFLECTION("Found at location: "+h.getCanonicalName()); + ReflectionUtils.mCachedClasses.put(string, h); + aClass = h; + found = true; + break; + } + } + if (!found) { + return null; + } + } + } + return aClass; } /** @@ -803,7 +840,7 @@ public class ReflectionUtils { public static boolean doesFieldExist(String clazz, String string) { return doesFieldExist(ReflectionUtils.getClass(clazz), string); } - + public static boolean doesFieldExist(Class clazz, String string) { if (clazz != null) { if (ReflectionUtils.getField(clazz, string) != null) { diff --git a/src/Java/gtPlusPlus/xmod/tinkers/HANDLER_Tinkers.java b/src/Java/gtPlusPlus/xmod/tinkers/HANDLER_Tinkers.java index f96ca01403..4a3f9cd504 100644 --- a/src/Java/gtPlusPlus/xmod/tinkers/HANDLER_Tinkers.java +++ b/src/Java/gtPlusPlus/xmod/tinkers/HANDLER_Tinkers.java @@ -40,7 +40,7 @@ public class HANDLER_Tinkers { //Generate Drying Rack recipes TinkersDryingRecipe.generateAllDryingRecipes(); - + for (BaseTinkersMaterial y : mTinkerMaterials) { //y.generate(); } diff --git a/src/Java/gtPlusPlus/xmod/tinkers/util/TinkersDryingRecipe.java b/src/Java/gtPlusPlus/xmod/tinkers/util/TinkersDryingRecipe.java index 8be5e35ed6..8bc7ffef29 100644 --- a/src/Java/gtPlusPlus/xmod/tinkers/util/TinkersDryingRecipe.java +++ b/src/Java/gtPlusPlus/xmod/tinkers/util/TinkersDryingRecipe.java @@ -26,9 +26,13 @@ public class TinkersDryingRecipe { List aRecipes = TinkersUtils.getDryingRecipes(); if (aRecipes != null && aRecipes.size() > 0) { for (Object o : aRecipes) { + Logger.INFO("Trying to generate recipe using object of type "+o.getClass().getSimpleName()); generateFromTinkersRecipeObject(o); } } + else { + Logger.INFO("Error generating Drying recipes, map was either null or empty. Null? "+(aRecipes != null)+", Size: "+aRecipes.size()); + } if (!recipes.isEmpty()) { Logger.INFO("Adding "+recipes.size()+" drying rack recipes to the dehydrator."); for (TinkersDryingRecipe r : recipes) { @@ -41,8 +45,8 @@ public class TinkersDryingRecipe { GT_Values.NF, new ItemStack[] {r.result}, new int[] {}, - r.time, - 120); + r.time/10, + 30); } } } @@ -51,9 +55,31 @@ public class TinkersDryingRecipe { Field aTime; Field aInput; Field aOutput; - Class aTinkerClass = ReflectionUtils.getClass("tconstruct.library.crafting.DryingRackRecipes.DryingRecipe"); + Class aTinkerClass = ReflectionUtils.getClass("tconstruct.library.crafting.DryingRackRecipes.DryingRecipe");//o.getClass(); if (aTinkerClass == null || !LoadedMods.TiCon) { - return null; + Logger.INFO("Error generating Drying Recipe, could not find class. Exists? "+ReflectionUtils.doesClassExist("tconstruct.library.crafting.DryingRackRecipes.DryingRecipe")); + Class clazz = ReflectionUtils.getClass("tconstruct.library.crafting.DryingRackRecipes"); + Class[] y = clazz.getDeclaredClasses(); + if (y == null || y.length <= 0) { + Logger.INFO("No hidden inner classes."); + return null; + } + else { + boolean found = false; + for (Class h : y) { + Logger.INFO("Found hidden inner class: "+h.getCanonicalName()); + if (h.getSimpleName().toLowerCase().equals("dryingrecipe")) { + Logger.INFO("Found correct recipe. Caching at correct location."); + ReflectionUtils.mCachedClasses.put("tconstruct.library.crafting.DryingRackRecipes.DryingRecipe", h); + aTinkerClass = h; + found = true; + break; + } + } + if (!found) { + return null; + } + } } aTime = ReflectionUtils.getField(aTinkerClass, "time"); aInput = ReflectionUtils.getField(aTinkerClass, "input"); @@ -64,15 +90,16 @@ public class TinkersDryingRecipe { ItemStack result_internal = (ItemStack) aOutput.get(o); return new TinkersDryingRecipe(input_internal, time_internal, result_internal); } catch (Throwable b) { - + b.printStackTrace(); } return null; } - TinkersDryingRecipe(final ItemStack input, final int time, final ItemStack result) { + public TinkersDryingRecipe(final ItemStack input, final int time, final ItemStack result) { this.time = time; this.input = input; this.result = result; + Logger.INFO("Generating Drying Recipe. Input: "+input.getDisplayName()+", Output: "+result.getDisplayName()); recipes.add(this); } -- cgit From 56c2250dbf7d36ee72580ce9304646dcd1757ac1 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Thu, 15 Aug 2019 03:55:29 +0100 Subject: $ Made code compatible with changes made by @mitchej123 during https://github.com/Blood-Asp/GT5-Unofficial/commit/73ee102b63efd92c0f164a7ed7a79ebcd2619617#diff-3051838621d8ae87aa5ccd1345e1f07d. > I guess this code is never called, or it's inherited. Odd that it hasn't ever broke. --- .../core/tileentities/base/TileEntityBase.java | 18 ++++++++++++++++++ .../base/GregtechMetaPipeEntityBase_Cable.java | 13 +++++++++++++ .../gregtech/common/items/MetaCustomCoverItem.java | 12 ++++++++++-- .../common/items/covers/MetaItemCoverCasings.java | 4 ++++ 4 files changed, 45 insertions(+), 2 deletions(-) (limited to 'src/Java/gtPlusPlus/core/tileentities') diff --git a/src/Java/gtPlusPlus/core/tileentities/base/TileEntityBase.java b/src/Java/gtPlusPlus/core/tileentities/base/TileEntityBase.java index 4f9a8d3748..65ae9218fe 100644 --- a/src/Java/gtPlusPlus/core/tileentities/base/TileEntityBase.java +++ b/src/Java/gtPlusPlus/core/tileentities/base/TileEntityBase.java @@ -1315,6 +1315,24 @@ public class TileEntityBase extends TileEntity implements ILazyCoverable, IGregT } return false; } + + + /** + * Adds support for the newer function added by https://github.com/Blood-Asp/GT5-Unofficial/commit/73ee102b63efd92c0f164a7ed7a79ebcd2619617#diff-3051838621d8ae87aa5ccd1345e1f07d + */ + public boolean inputEnergyFrom(byte arg0, boolean arg1) { + // TODO Auto-generated method stub + return false; + } + + + /** + * Adds support for the newer function added by https://github.com/Blood-Asp/GT5-Unofficial/commit/73ee102b63efd92c0f164a7ed7a79ebcd2619617#diff-3051838621d8ae87aa5ccd1345e1f07d + */ + public boolean outputsEnergyTo(byte arg0, boolean arg1) { + // TODO Auto-generated method stub + return false; + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaPipeEntityBase_Cable.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaPipeEntityBase_Cable.java index d17c820699..4dd5bf25d6 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaPipeEntityBase_Cable.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaPipeEntityBase_Cable.java @@ -5,6 +5,7 @@ import static gregtech.api.enums.GT_Values.VN; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashSet; import cofh.api.energy.IEnergyReceiver; import net.minecraft.entity.Entity; @@ -219,6 +220,18 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements return this.transferElectricity(aSide, aVoltage, aAmperage, new ArrayList<>(Arrays.asList((TileEntity) this.getBaseMetaTileEntity()))); } + + + /** + * Adds support for the newer function added by https://github.com/Blood-Asp/GT5-Unofficial/commit/73ee102b63efd92c0f164a7ed7a79ebcd2619617#diff-3051838621d8ae87aa5ccd1345e1f07d + */ + public long transferElectricity(byte arg0, long arg1, long arg2, HashSet arg3) { + ArrayList aTiles = new ArrayList(); + for (TileEntity y : arg3) { + aTiles.add(y); + } + return transferElectricity(arg0, arg1, arg2, aTiles); + } @Override public long transferElectricity(final byte aSide, long aVoltage, final long aAmperage, diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaCustomCoverItem.java b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaCustomCoverItem.java index 6915ea2112..7c3f764794 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaCustomCoverItem.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaCustomCoverItem.java @@ -58,11 +58,19 @@ public class MetaCustomCoverItem extends Item { Logger.INFO("[Covers] Generated Custom covers for "+mModID+" using "+aTextureCount+" textures from "+mTextureSetName+"."); } + public boolean hide() { + return true; + } + private final void registerCover() { //CommonProxy.registerItemRendererGlobal(this, new CustomItemBlockRenderer()); for (int i=0;i 0 && hide()) { + ItemUtils.hideItemFromNEI(thisStack); + } GregTech_API.registerCover( - ItemUtils.simpleMetaStack(this, i, 1), + thisStack, new GT_MultiTexture( new ITexture[]{ new GT_RenderedTexture(mTextures[i]) @@ -93,7 +101,7 @@ public class MetaCustomCoverItem extends Item { @Override public String getItemStackDisplayName(final ItemStack tItem) { - return EnumChatFormatting.LIGHT_PURPLE + StringUtils.capitalize(mTextureSetName) + " [" + tItem.getItemDamage() + "]"; //super.getItemStackDisplayName(tItem); + return StringUtils.capitalize(mTextureSetName) + " (" + tItem.getItemDamage() + ")"; //super.getItemStackDisplayName(tItem); } private static boolean createNBT(ItemStack rStack) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/items/covers/MetaItemCoverCasings.java b/src/Java/gtPlusPlus/xmod/gregtech/common/items/covers/MetaItemCoverCasings.java index f9a3451106..7af057bc59 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/items/covers/MetaItemCoverCasings.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/items/covers/MetaItemCoverCasings.java @@ -23,6 +23,10 @@ public class MetaItemCoverCasings extends MetaCustomCoverItem { } } + public boolean hide() { + return false; + } + @Override public IIcon getIconFromDamage(int meta) { return this.icons[MathUtils.balance(meta, 0, 15)]; -- cgit From 4a2fa070a2ae91173cf15785c63b4090016323d4 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Fri, 11 Oct 2019 18:14:07 +0100 Subject: $ Fixed many tiny bugs, found by static code analysis. $ Fixed Canning handling further. $ Adjusted the Charcoal Pit fix. --- src/Java/gtPlusPlus/GTplusplus.java | 8 +- .../minecraft/ThreadFakeWorldGenerator.java | 2 +- .../api/objects/minecraft/ThreadPooCollector.java | 2 +- src/Java/gtPlusPlus/api/objects/random/XSTR.java | 2 +- .../biome/type/Biome_AustralianPlains.java | 1 - .../australia/chunk/ChunkProviderAustralia.java | 27 ++--- .../australia/gen/map/component/ComponentHut.java | 4 +- .../core/block/base/BlockBaseModular.java | 2 +- .../core/container/Container_SuperJukebox.java | 4 +- .../core/gui/machine/GUI_PestKiller.java | 4 +- src/Java/gtPlusPlus/core/item/ModItems.java | 8 +- .../core/item/base/dusts/BaseItemDust.java | 121 --------------------- .../core/item/general/ItemControlCore.java | 3 + .../core/item/general/ItemHealingDevice.java | 29 +++-- .../core/item/general/ItemSlowBuildingRing.java | 7 +- .../core/item/tool/misc/DebugScanner.java | 22 ++-- .../core/item/tool/misc/GregtechPump.java | 2 +- src/Java/gtPlusPlus/core/material/Material.java | 17 +-- .../core/material/MaterialGenerator.java | 28 ++++- .../gtPlusPlus/core/recipe/RECIPES_GREGTECH.java | 10 +- .../general/TileEntityCircuitProgrammer.java | 2 +- .../gtPlusPlus/core/util/minecraft/FluidUtils.java | 6 +- .../core/util/minecraft/HazmatUtils.java | 9 +- .../gtPlusPlus/core/util/minecraft/ItemUtils.java | 4 +- .../core/util/minecraft/MaterialUtils.java | 5 +- .../util/minecraft/gregtech/PollutionUtils.java | 2 +- .../everglades/biome/BiomeGenerator_Custom.java | 4 - .../villagers/entity/EntityBaseVillager.java | 5 +- .../villagers/entity/EntityNativeAustralian.java | 7 +- .../ClassTransformer_GT_CharcoalPit.java | 17 ++- .../ClassTransformer_TC_ItemWispEssence.java | 61 ++++++----- .../transformers/Preloader_ClassTransformer2.java | 2 - .../xmod/forestry/bees/custom/GTPP_Bees.java | 1 - .../galacticraft/handler/HandlerTooltip_GC.java | 14 ++- src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java | 3 +- .../interfaces/internal/IGregtech_RecipeAdder.java | 6 +- .../power/GTPP_MTE_BasicLosslessGenerator.java | 4 +- .../GT_MetaTileEntity_SuperBus_Input.java | 2 - .../GT_MetaTileEntity_Hatch_CustomFluidBase.java | 2 +- .../base/GregtechMeta_MultiBlockBase.java | 61 +++++++---- .../gregtech/api/world/GTPP_Worldgen_Boulder.java | 3 +- .../api/world/GTPP_Worldgen_Ore_Normal.java | 3 +- .../xmod/gregtech/common/Meta_GT_Proxy.java | 21 ++-- .../gregtech/common/helpers/TreeFarmHelper.java | 2 +- .../common/items/MetaGeneratedGregtechTools.java | 13 ++- .../GregtechMetaAtmosphericReconditioner.java | 13 ++- ...gtechMetaTileEntity_IndustrialMultiMachine.java | 9 +- .../production/GregtechMTE_MiniFusionPlant.java | 4 +- .../production/GregtechMetaTileEntityTreeFarm.java | 8 +- .../GregtechMetaTileEntity_Refinery.java | 2 - .../gregtech/loaders/RecipeGen_DustGeneration.java | 2 +- .../gregtech/loaders/RecipeGen_FluidCanning.java | 109 +++++++++---------- .../xmod/gregtech/loaders/RecipeGen_Fluids.java | 5 - .../xmod/gregtech/loaders/RecipeGen_Ore.java | 5 +- .../xmod/gregtech/loaders/RecipeGen_Recycling.java | 10 +- .../xmod/gregtech/recipes/GregtechRecipeAdder.java | 20 +++- .../xmod/growthcraft/fishtrap/FishTrapHandler.java | 4 +- .../xmod/thaumcraft/util/ThaumcraftUtils.java | 29 +++-- .../recipe/TF_Gregtech_Recipes.java | 6 +- 59 files changed, 363 insertions(+), 425 deletions(-) (limited to 'src/Java/gtPlusPlus/core/tileentities') diff --git a/src/Java/gtPlusPlus/GTplusplus.java b/src/Java/gtPlusPlus/GTplusplus.java index 8c8b973dc9..ee2bf6c940 100644 --- a/src/Java/gtPlusPlus/GTplusplus.java +++ b/src/Java/gtPlusPlus/GTplusplus.java @@ -105,7 +105,6 @@ public class GTplusplus implements ActionListener { //Mod Instance @Mod.Instance(CORE.MODID) public static GTplusplus instance; - public static Meta_GT_Proxy instanceGtProxy; //Material Loader public static GT_Material_Loader mGregMatLoader; @@ -181,8 +180,7 @@ public class GTplusplus implements ActionListener { mChunkLoading.preInit(event); proxy.preInit(event); Logger.INFO("Setting up our own GT_Proxy."); - instanceGtProxy = Meta_GT_Proxy.instance; - instanceGtProxy.preInit(); + Meta_GT_Proxy.preInit(); Core_Manager.preInit(); } @@ -194,7 +192,7 @@ public class GTplusplus implements ActionListener { proxy.init(event); HazmatUtils.init(); proxy.registerNetworkStuff(); - instanceGtProxy.init(); + Meta_GT_Proxy.init(); Core_Manager.init(); //Used by foreign players to generate .lang files for translation. @@ -211,7 +209,7 @@ public class GTplusplus implements ActionListener { mChunkLoading.postInit(event); proxy.postInit(event); BookHandler.runLater(); - instanceGtProxy.postInit(); + Meta_GT_Proxy.postInit(); Core_Manager.postInit(); //SprinklerHandler.registerModFerts(); diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/ThreadFakeWorldGenerator.java b/src/Java/gtPlusPlus/api/objects/minecraft/ThreadFakeWorldGenerator.java index 393d3260b5..b7462250b1 100644 --- a/src/Java/gtPlusPlus/api/objects/minecraft/ThreadFakeWorldGenerator.java +++ b/src/Java/gtPlusPlus/api/objects/minecraft/ThreadFakeWorldGenerator.java @@ -21,7 +21,7 @@ public class ThreadFakeWorldGenerator extends Thread { public ThreadFakeWorldGenerator() { setName("gtpp.handler.fakeworldtrees"); - run(); + start(); } public static ThreadFakeWorldGenerator getInstance() { diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/ThreadPooCollector.java b/src/Java/gtPlusPlus/api/objects/minecraft/ThreadPooCollector.java index a5f466b19f..0ff6e112ac 100644 --- a/src/Java/gtPlusPlus/api/objects/minecraft/ThreadPooCollector.java +++ b/src/Java/gtPlusPlus/api/objects/minecraft/ThreadPooCollector.java @@ -33,7 +33,7 @@ public class ThreadPooCollector extends Thread { public ThreadPooCollector() { setName("gtpp.handler.poop"); - run(); + start(); } public static ThreadPooCollector getInstance() { diff --git a/src/Java/gtPlusPlus/api/objects/random/XSTR.java b/src/Java/gtPlusPlus/api/objects/random/XSTR.java index 4b5b1298b6..6357e9895c 100644 --- a/src/Java/gtPlusPlus/api/objects/random/XSTR.java +++ b/src/Java/gtPlusPlus/api/objects/random/XSTR.java @@ -33,7 +33,7 @@ import java.util.concurrent.atomic.AtomicLong; * 03.06.2016 * version 0.0.4 */ -public class XSTR extends Random { +public class XSTR extends Random implements Cloneable { private static final long serialVersionUID = 6208727693524452904L; private long seed; diff --git a/src/Java/gtPlusPlus/australia/biome/type/Biome_AustralianPlains.java b/src/Java/gtPlusPlus/australia/biome/type/Biome_AustralianPlains.java index 4ee24aaca5..c04f211fd3 100644 --- a/src/Java/gtPlusPlus/australia/biome/type/Biome_AustralianPlains.java +++ b/src/Java/gtPlusPlus/australia/biome/type/Biome_AustralianPlains.java @@ -16,7 +16,6 @@ import net.minecraftforge.common.BiomeManager; public class Biome_AustralianPlains extends BiomeGenPlains { - protected boolean field_150628_aC; public Biome_AustralianPlains(int p_i1986_1_) { diff --git a/src/Java/gtPlusPlus/australia/chunk/ChunkProviderAustralia.java b/src/Java/gtPlusPlus/australia/chunk/ChunkProviderAustralia.java index 82da02db45..07f5f969e2 100644 --- a/src/Java/gtPlusPlus/australia/chunk/ChunkProviderAustralia.java +++ b/src/Java/gtPlusPlus/australia/chunk/ChunkProviderAustralia.java @@ -9,26 +9,29 @@ import java.util.Map; import java.util.Random; import cpw.mods.fml.common.eventhandler.Event.Result; -import cpw.mods.fml.common.registry.VillagerRegistry; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.australia.gen.map.MapGenLargeRavine; import net.minecraft.block.Block; -import net.minecraft.block.BlockFalling; import net.minecraft.entity.EnumCreatureType; import net.minecraft.init.Blocks; import net.minecraft.util.IProgressUpdate; import net.minecraft.util.MathHelper; -import net.minecraft.world.*; +import net.minecraft.world.ChunkPosition; +import net.minecraft.world.SpawnerAnimals; +import net.minecraft.world.World; +import net.minecraft.world.WorldType; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.IChunkProvider; -import net.minecraft.world.gen.*; +import net.minecraft.world.gen.ChunkProviderGenerate; +import net.minecraft.world.gen.MapGenBase; +import net.minecraft.world.gen.MapGenCaves; +import net.minecraft.world.gen.NoiseGenerator; +import net.minecraft.world.gen.NoiseGeneratorOctaves; +import net.minecraft.world.gen.NoiseGeneratorPerlin; import net.minecraft.world.gen.feature.WorldGenDungeons; -import net.minecraft.world.gen.feature.WorldGenLakes; import net.minecraft.world.gen.structure.MapGenMineshaft; import net.minecraft.world.gen.structure.MapGenScatteredFeature; -import net.minecraft.world.gen.structure.MapGenVillage; - import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.terraingen.ChunkProviderEvent; import net.minecraftforge.event.terraingen.PopulateChunkEvent; @@ -40,16 +43,6 @@ public class ChunkProviderAustralia extends ChunkProviderGenerate implements ICh private NoiseGeneratorOctaves noiseGen2; private NoiseGeneratorOctaves noiseGen3; private NoiseGeneratorPerlin noiseGen4; - - /** - * A NoiseGeneratorOctaves used in generating terrain - */ - public NoiseGeneratorOctaves noiseGen5; - /** - * A NoiseGeneratorOctaves used in generating terrain - */ - public NoiseGeneratorOctaves noiseGen6; - public NoiseGeneratorOctaves mobSpawnerNoise; /** * Reference to the World object. */ diff --git a/src/Java/gtPlusPlus/australia/gen/map/component/ComponentHut.java b/src/Java/gtPlusPlus/australia/gen/map/component/ComponentHut.java index 4af5aa09ab..1f5dd59667 100644 --- a/src/Java/gtPlusPlus/australia/gen/map/component/ComponentHut.java +++ b/src/Java/gtPlusPlus/australia/gen/map/component/ComponentHut.java @@ -79,11 +79,11 @@ public class ComponentHut extends AustraliaComponent { placeDoorAtCurrentPosition( world, this.boundingBox, random, 0, 1, 3, getMetadataWithOffset(Blocks.wooden_door, 1)); } - else if (dir == 0) { + else if (dir == 1) { placeDoorAtCurrentPosition( world, this.boundingBox, random, 3, 1, 6, getMetadataWithOffset(Blocks.wooden_door, 1)); } - else if (dir == 0) { + else if (dir == 2) { placeDoorAtCurrentPosition( world, this.boundingBox, random, 6, 1, 3, getMetadataWithOffset(Blocks.wooden_door, 1)); } diff --git a/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java b/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java index 8310fa3c23..c0113e869b 100644 --- a/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java +++ b/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java @@ -175,7 +175,7 @@ public class BlockBaseModular extends BasicBlock { } } metType = (metType.equals("9j4852jyo3rjmh3owlhw9oe") ? "METALLIC" : metType); - int tier = this.blockMaterial.vTier; + int tier = blockMaterial != null ? this.blockMaterial.vTier : 0; String aType = (this.thisBlock == BlockTypes.FRAME) ? "frameGt" : (tier <= 4 ? "block1" : "block5"); this.blockIcon = iIcon.registerIcon("gregtech" + ":" + "materialicons/"+ metType +"/" + aType); } diff --git a/src/Java/gtPlusPlus/core/container/Container_SuperJukebox.java b/src/Java/gtPlusPlus/core/container/Container_SuperJukebox.java index 34a4e9fa97..f9bf617e1b 100644 --- a/src/Java/gtPlusPlus/core/container/Container_SuperJukebox.java +++ b/src/Java/gtPlusPlus/core/container/Container_SuperJukebox.java @@ -191,7 +191,7 @@ public class Container_SuperJukebox extends Container { @Override public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { - if (tile_entity.getWorldObj().isRemote || tile_entity == null) return null; + if (tile_entity == null || tile_entity.getWorldObj().isRemote) return null; switch (aSlotIndex) { case SLOT_HOLO_PLAY: if (tile_entity == null) return null; @@ -217,7 +217,7 @@ public class Container_SuperJukebox extends Container { @Override public void detectAndSendChanges() { super.detectAndSendChanges(); - if (tile_entity.getWorldObj().isRemote || tile_entity == null) return; + if (tile_entity == null || tile_entity.getWorldObj().isRemote) return; isPlaying = tile_entity.mIsPlaying; isLooping = tile_entity.mIsLooping; diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_PestKiller.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_PestKiller.java index 889b19443e..881c6c82a1 100644 --- a/src/Java/gtPlusPlus/core/gui/machine/GUI_PestKiller.java +++ b/src/Java/gtPlusPlus/core/gui/machine/GUI_PestKiller.java @@ -57,12 +57,10 @@ public class GUI_PestKiller extends GuiContainer { Color startGrad = new Color(50, 50, 50); Color endGrad = new Color(20, 20, 20); Container_PestKiller aCont = (Container_PestKiller) this.inventorySlots; - TileEntityPestKiller aTileKiller = aCont.tile_entity; double aPercentage = 0; double aDivisor = (100/16); - int aFrameHeight = 16; - + int aFrameHeight = 16; boolean didRender = false; if (aCont != null) { diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java index 007079b9c8..96fe5694cc 100644 --- a/src/Java/gtPlusPlus/core/item/ModItems.java +++ b/src/Java/gtPlusPlus/core/item/ModItems.java @@ -1055,10 +1055,10 @@ public final class ModItems { GT_OreDictUnificator.registerOre("platePhasedIron", ItemUtils.getSimpleStack(itemPlatePulsatingIron)); GT_OreDictUnificator.registerOre("blockVibrantAlloy", ItemUtils.getItemStackOfAmountFromOreDict("blockPhasedGold", 1)); - CORE.RA.addFluidExtractionRecipe(MaterialEIO.REDSTONE_ALLOY.getPlate(1), null, MaterialEIO.REDSTONE_ALLOY.getFluid(144), 10000, 16, 4*9); - CORE.RA.addFluidExtractionRecipe(MaterialEIO.REDSTONE_ALLOY.getIngot(1), null, MaterialEIO.REDSTONE_ALLOY.getFluid(144), 10000, 16, 4*9); - CORE.RA.addFluidExtractionRecipe(MaterialEIO.REDSTONE_ALLOY.getNugget(1), null, MaterialEIO.REDSTONE_ALLOY.getFluid(16), 10000, 16, 4); - CORE.RA.addFluidExtractionRecipe(MaterialEIO.REDSTONE_ALLOY.getBlock(1), null, MaterialEIO.REDSTONE_ALLOY.getFluid(1294), 10000, 16, 4*9*9); + CORE.RA.addFluidExtractionRecipe(MaterialEIO.REDSTONE_ALLOY.getPlate(1), null, MaterialEIO.REDSTONE_ALLOY.getFluid(144), 16, 4*9); + CORE.RA.addFluidExtractionRecipe(MaterialEIO.REDSTONE_ALLOY.getIngot(1), null, MaterialEIO.REDSTONE_ALLOY.getFluid(144), 16, 4*9); + CORE.RA.addFluidExtractionRecipe(MaterialEIO.REDSTONE_ALLOY.getNugget(1), null, MaterialEIO.REDSTONE_ALLOY.getFluid(16), 16, 4); + CORE.RA.addFluidExtractionRecipe(MaterialEIO.REDSTONE_ALLOY.getBlock(1), null, MaterialEIO.REDSTONE_ALLOY.getFluid(1294), 16, 4*9*9); } else { diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java index afc4b17354..1b13d34495 100644 --- a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java +++ b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java @@ -1,14 +1,10 @@ package gtPlusPlus.core.item.base.dusts; import gtPlusPlus.core.item.base.BaseItemComponent; -import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.Material; public class BaseItemDust extends BaseItemComponent { - - - private Material dustInfo; private BaseItemComponent[] mSizedDusts = new BaseItemComponent[2]; public BaseItemDust(Material aMat) { @@ -33,127 +29,10 @@ public class BaseItemDust extends BaseItemComponent { } } - private BaseItemDust(final String unlocalizedName, final String materialName, final Material matInfo, final int colour, final String pileSize, final int tier){ - this(unlocalizedName, materialName, matInfo, colour, pileSize, tier, true); - } - private BaseItemDust(String unlocalizedName, String materialName, Material matInfo, int colour, String pileSize, int tier, boolean addRecipes) { super(matInfo, ComponentTypes.DUST); - - try {/* - this.setUnlocalizedName(unlocalizedName); - this.setMaxStackSize(64); - - this.setCreativeTab(tabMisc); - this.colour = colour; - this.mTier = tier; - this.materialName = materialName; - this.dustInfo = matInfo; - this.setTextureName(this.getCorrectTexture(pileSize)); - GameRegistry.registerItem(this, unlocalizedName); - - String temp = ""; - Logger.WARNING("Unlocalized name for OreDict nameGen: "+this.getUnlocalizedName()); - if (this.getUnlocalizedName().contains("item.")){ - temp = this.getUnlocalizedName().replace("item.", ""); - Logger.WARNING("Generating OreDict Name: "+temp); - } - else { - temp = this.getUnlocalizedName(); - } - if (temp.contains("DustTiny")){ - temp = temp.replace("itemD", "d"); - Logger.WARNING("Generating OreDict Name: "+temp); - } - else if (temp.contains("DustSmall")){ - temp = temp.replace("itemD", "d"); - Logger.WARNING("Generating OreDict Name: "+temp); - } - else { - temp = temp.replace("itemD", "d"); - Logger.WARNING("Generating OreDict Name: "+temp); - } - if ((temp != null) && !temp.equals("")){ - GT_OreDictUnificator.registerOre(temp, ItemUtils.getSimpleStack(this)); - } - if (addRecipes){ - this.addFurnaceRecipe(); - this.addMacerationRecipe(); - } - */} - catch (Throwable t) { - t.printStackTrace(); - } - } - - private String getCorrectTexture(final String pileSize){ - - if (!CORE.ConfigSwitches.useGregtechTextures || this.dustInfo.getTextureSet() == null){ - if ((pileSize == "dust") || (pileSize == "Dust")){ - this.setTextureName(CORE.MODID + ":" + "dust");} - else{ - this.setTextureName(CORE.MODID + ":" + "dust"+pileSize); - } - } - - - if (pileSize.toLowerCase().contains("small")){ - return "gregtech" + ":" + "materialicons/"+this.dustInfo.getTextureSet().mSetName+"/dustSmall"; - } - else if (pileSize.toLowerCase().contains("tiny")){ - return "gregtech" + ":" + "materialicons/"+this.dustInfo.getTextureSet().mSetName+"/dustTiny"; - } - return "gregtech" + ":" + "materialicons/"+this.dustInfo.getTextureSet().mSetName+"/dust"; } - /* @Override - public String getItemStackDisplayName(final ItemStack iStack) { - - String unlocal = super.getItemStackDisplayName(iStack); - if (!unlocal.toLowerCase().contains(".name")) { - return unlocal; - } - else { - return unlocal; - } - - }*/ - - /* @Override - public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) { - try { - if (this.dustInfo != null){ - if (entityHolding instanceof EntityPlayer){ - if (!((EntityPlayer) entityHolding).capabilities.isCreativeMode){ - EntityUtils.applyRadiationDamageToEntity(iStack.stackSize, this.dustInfo.vRadiationLevel, world, entityHolding); - } - } - } - } - catch (Throwable t) { - t.printStackTrace(); - } - }*/ - - /*@SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - - if (stack.getDisplayName().toLowerCase().contains("fluorite")){ - list.add("Mined from Sandstone and Limestone."); - } - if (this.dustInfo != null){ - list.add(this.dustInfo.vChemicalFormula); - } - if (this.dustInfo.vRadiationLevel > 0){ - list.add(CORE.GT_Tooltip_Radioactive); - } - - - //} - super.addInformation(stack, aPlayer, list, bool); - }*/ - public static class DustState { static final int NORMAL = (1); static final int SMALL = (10); diff --git a/src/Java/gtPlusPlus/core/item/general/ItemControlCore.java b/src/Java/gtPlusPlus/core/item/general/ItemControlCore.java index 5ef72b6f17..b74b7972be 100644 --- a/src/Java/gtPlusPlus/core/item/general/ItemControlCore.java +++ b/src/Java/gtPlusPlus/core/item/general/ItemControlCore.java @@ -71,6 +71,9 @@ public class ItemControlCore extends Item { @Override public String getItemStackDisplayName(final ItemStack tItem) { + if (tItem == null) { + return "Control Core"; + } String aReturnValue = super.getItemStackDisplayName(tItem); if (tItem != null) { try { diff --git a/src/Java/gtPlusPlus/core/item/general/ItemHealingDevice.java b/src/Java/gtPlusPlus/core/item/general/ItemHealingDevice.java index c8acdc2152..82bb29b5bf 100644 --- a/src/Java/gtPlusPlus/core/item/general/ItemHealingDevice.java +++ b/src/Java/gtPlusPlus/core/item/general/ItemHealingDevice.java @@ -2,23 +2,10 @@ package gtPlusPlus.core.item.general; import java.util.List; -import cpw.mods.fml.common.Optional; -import cpw.mods.fml.common.registry.GameRegistry; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.StatCollector; -import net.minecraft.world.World; - import baubles.api.BaubleType; import baubles.api.IBauble; +import cpw.mods.fml.common.Optional; +import cpw.mods.fml.common.registry.GameRegistry; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; @@ -31,6 +18,16 @@ import gtPlusPlus.xmod.gregtech.common.helpers.ChargingHelper; import ic2.api.item.ElectricItem; import ic2.api.item.IElectricItem; import ic2.api.item.IElectricItemManager; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; @Optional.InterfaceList(value = {@Optional.Interface(iface = "baubles.api.IBauble", modid = "Baubles"), @Optional.Interface(iface = "baubles.api.BaubleType", modid = "Baubles")}) public class ItemHealingDevice extends Item implements IElectricItem, IElectricItemManager, IBauble{ @@ -232,7 +229,7 @@ public class ItemHealingDevice extends Item implements IElectricItem, IElectricI @Override //TODO public void onWornTick(final ItemStack aBaubleStack, final EntityLivingBase arg1) { - if (!arg1.worldObj.isRemote){ + if (arg1 != null && arg1.worldObj != null && !arg1.worldObj.isRemote){ //Try Charge First diff --git a/src/Java/gtPlusPlus/core/item/general/ItemSlowBuildingRing.java b/src/Java/gtPlusPlus/core/item/general/ItemSlowBuildingRing.java index 09c23d3551..c151a16f09 100644 --- a/src/Java/gtPlusPlus/core/item/general/ItemSlowBuildingRing.java +++ b/src/Java/gtPlusPlus/core/item/general/ItemSlowBuildingRing.java @@ -111,11 +111,8 @@ public class ItemSlowBuildingRing extends Item implements IBauble{ private static void doEffect(final EntityLivingBase arg1){ try { // Get World - World aWorld = arg1.worldObj; - if (arg1.worldObj.isRemote){ - return; - } - if (aWorld != null) { + World aWorld = arg1.worldObj; + if (aWorld != null && !aWorld.isRemote) { EntityPlayer aPlayer; if (arg1 instanceof EntityPlayer) { aPlayer = (EntityPlayer) arg1; diff --git a/src/Java/gtPlusPlus/core/item/tool/misc/DebugScanner.java b/src/Java/gtPlusPlus/core/item/tool/misc/DebugScanner.java index d0f3005d00..0170df0dc7 100644 --- a/src/Java/gtPlusPlus/core/item/tool/misc/DebugScanner.java +++ b/src/Java/gtPlusPlus/core/item/tool/misc/DebugScanner.java @@ -7,6 +7,7 @@ import gtPlusPlus.core.util.minecraft.PlayerUtils; import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; @@ -62,19 +63,22 @@ public class DebugScanner extends CoreItem { PlayerUtils.messagePlayer(player, "Invisible? "+entity.isInvisible()); PlayerUtils.messagePlayer(player, "Age: "+entity.ticksExisted); - if (entity instanceof EntityLiving) { - EntityLiving g = (EntityLiving) entity; + if (entity instanceof EntityLivingBase) { + EntityLivingBase g = (EntityLivingBase) entity; PlayerUtils.messagePlayer(player, "Health: "+g.getHealth()+"/"+g.getMaxHealth()); PlayerUtils.messagePlayer(player, "On ground? "+g.onGround); - PlayerUtils.messagePlayer(player, "Can Loot? "+g.canPickUpLoot()); - PlayerUtils.messagePlayer(player, "Child? "+g.isChild()); - if (entity instanceof EntityPlayer) { - EntityPlayer y = (EntityPlayer) entity; - PlayerUtils.messagePlayer(player, "Experience: "+y.experience); - PlayerUtils.messagePlayer(player, "Name: "+y.getCommandSenderName()); - } + PlayerUtils.messagePlayer(player, "Child? "+g.isChild()); + } + if (entity instanceof EntityLiving) { + EntityLiving g = (EntityLiving) entity; + PlayerUtils.messagePlayer(player, "Can Loot? "+g.canPickUpLoot()); } + if (entity instanceof EntityPlayer) { + EntityPlayer y = (EntityPlayer) entity; + PlayerUtils.messagePlayer(player, "Experience: "+y.experience); + PlayerUtils.messagePlayer(player, "Name: "+y.getCommandSenderName()); + } } return true; diff --git a/src/Java/gtPlusPlus/core/item/tool/misc/GregtechPump.java b/src/Java/gtPlusPlus/core/item/tool/misc/GregtechPump.java index 0c31b999cd..a48573888e 100644 --- a/src/Java/gtPlusPlus/core/item/tool/misc/GregtechPump.java +++ b/src/Java/gtPlusPlus/core/item/tool/misc/GregtechPump.java @@ -1127,7 +1127,7 @@ public class GregtechPump extends Item implements ISpecialElectricItem, IElectri else if ((aTileEntity instanceof IFluidTank || aTileEntity instanceof IFluidHandler)) { if (aTileEntity instanceof IFluidTank) { Logger.INFO("Tile Was instanceof IFluidTank."); - FluidStack f = ((IFluidTank) aTileEntity).getFluid(); + FluidStack f = ((IFluidTank) aTileEntity).getFluid(); if (aSetFluid == null) { aSetFluid = f; aSetFluid.amount = f.amount; diff --git a/src/Java/gtPlusPlus/core/material/Material.java b/src/Java/gtPlusPlus/core/material/Material.java index dbcbeac32a..d95b17e75c 100644 --- a/src/Java/gtPlusPlus/core/material/Material.java +++ b/src/Java/gtPlusPlus/core/material/Material.java @@ -237,7 +237,7 @@ public class Material { int hashSize = MathUtils.howManyPlaces(aValueForGen); String a = String.valueOf(aValueForGen); - String b = null; + String b = ""; if (hashSize < 9) { int aSecondHash = this.materialState.hashCode(); @@ -379,9 +379,6 @@ public class Material { aDataSet.put(m.getStackMaterial().vRadiationLevel); } byte aAverage = MathUtils.getByteAverage(aDataSet); - if (aAverage > Byte.MAX_VALUE || aAverage < Byte.MIN_VALUE) { - aAverage = 0; - } if (aAverage > 0) { Logger.MATERIALS(this.getLocalizedName()+" is radioactive due to trace elements. Level: "+aAverage+"."); this.isRadioactive = true; @@ -531,11 +528,6 @@ public class Material { } } - public Material(String string, MaterialState solid, TextureSet setShiny, int i, short[] s, int j, int k, int l, - int m, boolean b, String string2, int n) { - // TODO Auto-generated constructor stub - } - public final TextureSet getTextureSet() { synchronized(this) { return textureSet; @@ -868,10 +860,9 @@ public class Material { ItemStack a1 = getOre(1); Item a2 = a1.getItem(); Block a3 = Block.getBlockFromItem(a2); - - //Logger.DEBUG_MATERIALS("[Invalid Ore] Is a1 valid? "+(a1 != null)); - //Logger.DEBUG_MATERIALS("[Invalid Ore] Is a2 valid? "+(a2 != null)); - //Logger.DEBUG_MATERIALS("[Invalid Ore] Is a3 valid? "+(a3 != null)); + if (a3 != null) { + return a3; + } Block x = Block.getBlockFromItem(ItemUtils.getItemStackOfAmountFromOreDictNoBroken("ore"+Utils.sanitizeString(this.unlocalizedName), stacksize).getItem()); if (x != null){ diff --git a/src/Java/gtPlusPlus/core/material/MaterialGenerator.java b/src/Java/gtPlusPlus/core/material/MaterialGenerator.java index 1757b461ee..797a033dcc 100644 --- a/src/Java/gtPlusPlus/core/material/MaterialGenerator.java +++ b/src/Java/gtPlusPlus/core/material/MaterialGenerator.java @@ -59,10 +59,17 @@ public class MaterialGenerator { @SuppressWarnings("unused") private static volatile Block tempBlock; + + public static boolean addFluidExtractionRecipe(ItemStack aEmpty, ItemStack aRemains, FluidStack aFluid) { + return addFluidExtractionRecipe(aEmpty, aRemains, aFluid, null, null); + } + /** * Called Reflectively from CORE.RA.addFluidExtractionRecipe + * @param aSpecial + * @return */ - private static void addFluidExtractionRecipe(ItemStack aEmpty, ItemStack aRemains, FluidStack aFluid, int aDuration, int aEU) { + public static boolean addFluidExtractionRecipe(ItemStack aEmpty, ItemStack aRemains, FluidStack aFluid, Integer aDuration, Integer aEU) { /*GT_Recipe r = new Recipe_GT( true, new ItemStack[] {aEmpty, aRemains != null ? aRemains : null}, @@ -73,13 +80,22 @@ public class MaterialGenerator { new FluidStack[] {c}, a2, a3, a1);*/ //new RecipeGen_FluidCanning(r, true); - new RecipeGen_FluidCanning(true, aEmpty, aRemains, aFluid, aDuration, aEU); + RecipeGen_FluidCanning g = new RecipeGen_FluidCanning(true, aEmpty, aRemains, aFluid, aDuration, aEU); + if (g != null && g.valid()) { + return true; + } + return false; } + + public static boolean addFluidCannerRecipe(ItemStack aEmpty, ItemStack aFullContainer, FluidStack aFluidIn, FluidStack rFluidOut) { + return addFluidCannerRecipe(aEmpty, aFullContainer, aFluidIn, rFluidOut, null, null); + } /** * Called Reflectively from CORE.RA.addFluidCannerRecipe + * @return */ - private static void addFluidCannerRecipe(ItemStack aFullContainer, ItemStack aEmpty, FluidStack aFluid) { + public static boolean addFluidCannerRecipe(ItemStack aEmpty, ItemStack aFullContainer, FluidStack aFluidIn, FluidStack rFluidOut, Integer aTime, Integer aEu) { /*GT_Recipe r = new Recipe_GT( true, new ItemStack[] {aEmpty}, @@ -90,7 +106,11 @@ public class MaterialGenerator { new FluidStack[] {rFluidOut}, 0, 0, 0);*/ //new RecipeGen_FluidCanning(r, false); - new RecipeGen_FluidCanning(false, aEmpty, aFullContainer, aFluid, null, null); + RecipeGen_FluidCanning g = new RecipeGen_FluidCanning(false, aEmpty, aFullContainer, aFluidIn, null, null, 0); + if (g != null && g.valid()) { + return true; + } + return false; } public static void generate(final Material matInfo){ diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java index c3c8da7761..f237eb9f37 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java @@ -1589,18 +1589,18 @@ public class RECIPES_GREGTECH { private static void fluidExtractorRecipes() { //FLiBe fuel CORE.RA.addFluidExtractionRecipe(ItemUtils.getItemStackOfAmountFromOreDict("dustLi2BeF4", 1), null, - FluidUtils.getFluidStack("li2bef4", 144), 10000, 100, 500); + FluidUtils.getFluidStack("li2bef4", 144), 100, 500); //LFTR Fuel 1 CORE.RA.addFluidExtractionRecipe(NUCLIDE.LiFBeF2ZrF4U235.getDust(1), null, - NUCLIDE.LiFBeF2ZrF4U235.getFluid(144), 10000, 250, 1000); + NUCLIDE.LiFBeF2ZrF4U235.getFluid(144), 250, 1000); CORE.RA.addFluidExtractionRecipe(NUCLIDE.LiFBeF2ZrF4UF4.getDust(1), null, - NUCLIDE.LiFBeF2ZrF4UF4.getFluid(144), 10000, 150, 2000); + NUCLIDE.LiFBeF2ZrF4UF4.getFluid(144), 150, 2000); CORE.RA.addFluidExtractionRecipe(NUCLIDE.LiFBeF2ThF4UF4.getDust(1), null, - NUCLIDE.LiFBeF2ThF4UF4.getFluid(144), 10000, 200, 1500); + NUCLIDE.LiFBeF2ThF4UF4.getFluid(144), 200, 1500); //ZIRCONIUM_TETRAFLUORIDE CORE.RA.addFluidExtractionRecipe(FLUORIDES.ZIRCONIUM_TETRAFLUORIDE.getDust(1), null, - FluidUtils.getFluidStack(ModItems.fluidZrF4, 144), 10000, 200, 512+256); + FluidUtils.getFluidStack(ModItems.fluidZrF4, 144), 200, 512+256); diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityCircuitProgrammer.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityCircuitProgrammer.java index 0cda40c616..0157384cd0 100644 --- a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityCircuitProgrammer.java +++ b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityCircuitProgrammer.java @@ -101,8 +101,8 @@ public class TileEntityCircuitProgrammer extends TileEntity implements ISidedInv } if (doAdd) { ItemStack aOutput = CI.getNumberedCircuit(e); - aOutput.stackSize = aSize; if (aOutput != null) { + aOutput.stackSize = aSize; this.setInventorySlotContents(e, aInputStack); this.setInventorySlotContents(25, aOutput); return true; diff --git a/src/Java/gtPlusPlus/core/util/minecraft/FluidUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/FluidUtils.java index ff60d8c416..8902947c0d 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/FluidUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/FluidUtils.java @@ -149,7 +149,7 @@ public class FluidUtils { public static Fluid addGtFluid(final String aName, final String aLocalized, final GT_Materials aMaterial, final int aState, final long aTemperatureK, final ItemStack aFullContainer, final ItemStack aEmptyContainer, final int aFluidAmount, final boolean aGenerateCell) { - Fluid g = addGTFluid(aName, "fluid.autogenerated", aLocalized, aMaterial.mRGBa, aState, aTemperatureK, aFullContainer, aEmptyContainer, aFluidAmount, aGenerateCell); + Fluid g = addGTFluid(aName, "fluid.autogenerated", aLocalized, aMaterial != null ? aMaterial.mRGBa : new short[]{255, 255, 255, 0}, aState, aTemperatureK, aFullContainer, aEmptyContainer, aFluidAmount, aGenerateCell); if (g != null) { if (aMaterial != null) { switch (aState) { @@ -310,7 +310,7 @@ public class FluidUtils { rFluid.setTemperature((int) (aTemperatureK)); } if ((aFullContainer != null) && (aEmptyContainer != null) && !FluidContainerRegistry.registerFluidContainer(new FluidStack(rFluid, aFluidAmount), aFullContainer, aEmptyContainer)) { - CORE.RA.addFluidCannerRecipe(CI.emptyCells(1), aFullContainer, null, new FluidStack(rFluid, aFluidAmount)); + CORE.RA.addFluidCannerRecipe(CI.emptyCells(1), aFullContainer, new FluidStack(rFluid, aFluidAmount)); } else { //Utils.LOG_INFO("Failed creating recipes to fill/empty cells of "+aName+"."); @@ -466,7 +466,6 @@ public class FluidUtils { dustStack, //Input null, //Input 2 FluidUtils.getFluidStack(gtFluid, amountPerItem), //Fluid Output - 0, //Chance 1*20, //Duration 16 //Eu Tick ); @@ -476,7 +475,6 @@ public class FluidUtils { dustStack2, //Input null, //Input 2 FluidUtils.getFluidStack(gtFluid, amountPerItem), //Fluid Output - 0, //Chance 1*20, //Duration 16 //Eu Tick ); diff --git a/src/Java/gtPlusPlus/core/util/minecraft/HazmatUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/HazmatUtils.java index c529f60ba1..d69dd5d66e 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/HazmatUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/HazmatUtils.java @@ -306,7 +306,14 @@ public class HazmatUtils { //Logger.INFO("[Hazmat] Item was mapped for TTs"); Collections.sort(aTempTooltipData); //Logger.INFO("[Hazmat] Sorted TTs"); - return aTempTooltipData.toArray(); + + String[] mBuiltOutput = new String[aTempTooltipData.size()]; + int aIndex = 0; + for (String i : aTempTooltipData) { + mBuiltOutput[aIndex++] = i; + } + + return mBuiltOutput; } } diff --git a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java index 25d1eb2793..a8cef939be 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java @@ -694,7 +694,9 @@ public class ItemUtils { public static String[] getArrayStackNamesAsArray(final ItemStack[] aStack) { final String[] itemNames = aStack == null ? new String[] {} : new String[aStack.length]; - Logger.INFO(""+aStack.length); + if (aStack != null){ + Logger.INFO(""+aStack.length); + } if (aStack == null || aStack.length < 1) { return itemNames; diff --git a/src/Java/gtPlusPlus/core/util/minecraft/MaterialUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/MaterialUtils.java index 364430b07d..9c623bb9be 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/MaterialUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/MaterialUtils.java @@ -25,6 +25,7 @@ import gtPlusPlus.core.material.state.MaterialState; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.data.EnumUtils; import gtPlusPlus.core.util.data.StringUtils; +import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -207,9 +208,9 @@ public class MaterialUtils { return true; } - public static int getTierOfMaterial(final int aMeltingPoint){ + public static int getTierOfMaterial(final double aMeltingPoint){ - return aMeltingPoint < 1000 ? 0 : (Math.round(aMeltingPoint/1000)); + return aMeltingPoint < 1000 ? 0 : (MathUtils.roundToClosestInt(aMeltingPoint/1000f)); /*if ((aMeltingPoint >= 0) && (aMeltingPoint <= 1000)){ diff --git a/src/Java/gtPlusPlus/core/util/minecraft/gregtech/PollutionUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/gregtech/PollutionUtils.java index 6a41e54ec3..2f42e36bec 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/gregtech/PollutionUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/gregtech/PollutionUtils.java @@ -138,7 +138,7 @@ public class PollutionUtils { if (te == null) { return false; } - return nullifyPollution(te); + return nullifyPollution((IHasWorldObjectAndCoords) te); } public static boolean nullifyPollution(IHasWorldObjectAndCoords aTileOfSomeSort) { diff --git a/src/Java/gtPlusPlus/everglades/biome/BiomeGenerator_Custom.java b/src/Java/gtPlusPlus/everglades/biome/BiomeGenerator_Custom.java index 83dedc376a..0f8acd75b4 100644 --- a/src/Java/gtPlusPlus/everglades/biome/BiomeGenerator_Custom.java +++ b/src/Java/gtPlusPlus/everglades/biome/BiomeGenerator_Custom.java @@ -21,10 +21,6 @@ import net.minecraftforge.event.terraingen.OreGenEvent; import net.minecraftforge.event.terraingen.TerrainGen; public class BiomeGenerator_Custom extends BiomeDecorator { - /** The world the BiomeDecorator is currently decorating */ - public World currentWorld; - /** The Biome Decorator's random number generator. */ - public Random randomGenerator; public WorldGenerator fluoriteGen; diff --git a/src/Java/gtPlusPlus/plugin/villagers/entity/EntityBaseVillager.java b/src/Java/gtPlusPlus/plugin/villagers/entity/EntityBaseVillager.java index 4dc5a15b4b..c29aadb16b 100644 --- a/src/Java/gtPlusPlus/plugin/villagers/entity/EntityBaseVillager.java +++ b/src/Java/gtPlusPlus/plugin/villagers/entity/EntityBaseVillager.java @@ -70,7 +70,7 @@ public class EntityBaseVillager extends EntityVillager { @Override public void readEntityFromNBT(NBTTagCompound aNBT) { if (aNBT.hasKey("aCustomName")) { - if (this.getCustomNameTag() != aNBT.getString("aCustomName")) { + if (!this.getCustomNameTag().equals(aNBT.getString("aCustomName"))) { this.setCustomNameTag(aNBT.getString("aCustomName")); } } @@ -202,9 +202,10 @@ public class EntityBaseVillager extends EntityVillager { protected MerchantRecipeList getBuyingList() { Field v82191; - MerchantRecipeList o; + MerchantRecipeList o = null; v82191 = ReflectionUtils.getField(getClass(), "buyingList"); try { + if (v82191 != null) o = (MerchantRecipeList) v82191.get(this); Logger.WARNING("Is BuyingList Valid? " + (v82191 != null)); return v82191 != null ? o : null; diff --git a/src/Java/gtPlusPlus/plugin/villagers/entity/EntityNativeAustralian.java b/src/Java/gtPlusPlus/plugin/villagers/entity/EntityNativeAustralian.java index 967647cff6..4f9e2954a4 100644 --- a/src/Java/gtPlusPlus/plugin/villagers/entity/EntityNativeAustralian.java +++ b/src/Java/gtPlusPlus/plugin/villagers/entity/EntityNativeAustralian.java @@ -79,7 +79,7 @@ public class EntityNativeAustralian extends EntityVillager { @Override public void readEntityFromNBT(NBTTagCompound aNBT) { if (aNBT.hasKey("aCustomName")) { - if (this.getCustomNameTag() != aNBT.getString("aCustomName")) { + if (!this.getCustomNameTag().equals(aNBT.getString("aCustomName"))) { this.setCustomNameTag(aNBT.getString("aCustomName")); } } @@ -105,7 +105,7 @@ public class EntityNativeAustralian extends EntityVillager { @Override public void setProfession(int p_70938_1_) { - super.setProfession(mRoleID); + super.setProfession(7738); } @Override @@ -190,9 +190,10 @@ public class EntityNativeAustralian extends EntityVillager { protected MerchantRecipeList getBuyingList() { Field v82191; - MerchantRecipeList o; + MerchantRecipeList o = null; v82191 = ReflectionUtils.getField(getClass(), "buyingList"); try { + if (v82191 != null) o = (MerchantRecipeList) v82191.get(this); Logger.WARNING("Is BuyingList Valid? " + (v82191 != null)); return v82191 != null ? o : null; diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_CharcoalPit.java b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_CharcoalPit.java index 8299ea3cb5..9c79db265d 100644 --- a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_CharcoalPit.java +++ b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_CharcoalPit.java @@ -17,6 +17,7 @@ import org.objectweb.asm.MethodVisitor; import cpw.mods.fml.relauncher.FMLRelaunchLog; import gregtech.api.enums.OrePrefixes; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.util.minecraft.ItemUtils; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -30,13 +31,19 @@ public class ClassTransformer_GT_CharcoalPit { private final ClassWriter writer; public static boolean isWoodLog(Block log) { - String tTool = log.getHarvestTool(0); - boolean isLog1 = OrePrefixes.log.contains(new ItemStack(log, 1)) && tTool != null && tTool.equals("axe") && log.getMaterial() == Material.wood; + //Logger.INFO("checking for log"); + boolean isLog1 = OrePrefixes.log.contains(new ItemStack(log, 1)); + if (isLog1) { + //Logger.INFO("Found 1"); + return true; + } ArrayList oredict = OreDictionary.getOres("logWood"); if (oredict.contains(ItemUtils.getSimpleStack(log))) { + //Logger.INFO("found 2"); return true; - } - return isLog1; + } + //Logger.INFO("Did not find. "+(log != null ? ""+log.getLocalizedName() : "Null or invalid block?")); + return false; } public ClassTransformer_GT_CharcoalPit(byte[] basicClass, boolean obfuscated) { @@ -79,7 +86,7 @@ public class ClassTransformer_GT_CharcoalPit { aBlockClassName = "aji"; } if (aMethodName.equals("isWoodLog")) { - mv = cw.visitMethod(ACC_PUBLIC, "woodLog", "(L"+aBlockClassName+";)Z", null, null); + mv = cw.visitMethod(ACC_PUBLIC, "isWoodLog", "(L"+aBlockClassName+";)Z", null, null); mv.visitCode(); Label l0 = new Label(); mv.visitLabel(l0); diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_TC_ItemWispEssence.java b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_TC_ItemWispEssence.java index 06759429b9..8f65709478 100644 --- a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_TC_ItemWispEssence.java +++ b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_TC_ItemWispEssence.java @@ -1,6 +1,36 @@ package gtPlusPlus.preloader.asm.transformers; -import static org.objectweb.asm.Opcodes.*; +import static org.objectweb.asm.Opcodes.AALOAD; +import static org.objectweb.asm.Opcodes.ACC_PUBLIC; +import static org.objectweb.asm.Opcodes.ACONST_NULL; +import static org.objectweb.asm.Opcodes.ALOAD; +import static org.objectweb.asm.Opcodes.ARETURN; +import static org.objectweb.asm.Opcodes.ARRAYLENGTH; +import static org.objectweb.asm.Opcodes.ASM5; +import static org.objectweb.asm.Opcodes.ASTORE; +import static org.objectweb.asm.Opcodes.DUP; +import static org.objectweb.asm.Opcodes.F_APPEND; +import static org.objectweb.asm.Opcodes.F_CHOP; +import static org.objectweb.asm.Opcodes.F_SAME; +import static org.objectweb.asm.Opcodes.F_SAME1; +import static org.objectweb.asm.Opcodes.GETSTATIC; +import static org.objectweb.asm.Opcodes.GOTO; +import static org.objectweb.asm.Opcodes.I2L; +import static org.objectweb.asm.Opcodes.ICONST_0; +import static org.objectweb.asm.Opcodes.IFEQ; +import static org.objectweb.asm.Opcodes.IFLE; +import static org.objectweb.asm.Opcodes.IFNONNULL; +import static org.objectweb.asm.Opcodes.IFNULL; +import static org.objectweb.asm.Opcodes.ILOAD; +import static org.objectweb.asm.Opcodes.INVOKESPECIAL; +import static org.objectweb.asm.Opcodes.INVOKESTATIC; +import static org.objectweb.asm.Opcodes.INVOKEVIRTUAL; +import static org.objectweb.asm.Opcodes.IRETURN; +import static org.objectweb.asm.Opcodes.ISTORE; +import static org.objectweb.asm.Opcodes.L2I; +import static org.objectweb.asm.Opcodes.LDIV; +import static org.objectweb.asm.Opcodes.LREM; +import static org.objectweb.asm.Opcodes.NEW; import org.apache.logging.log4j.Level; import org.objectweb.asm.AnnotationVisitor; @@ -11,12 +41,7 @@ import org.objectweb.asm.Label; import org.objectweb.asm.MethodVisitor; import cpw.mods.fml.relauncher.FMLRelaunchLog; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.preloader.DevHelper; -import net.minecraft.item.ItemStack; -import thaumcraft.api.aspects.Aspect; -import thaumcraft.api.aspects.AspectList; public class ClassTransformer_TC_ItemWispEssence { @@ -246,30 +271,6 @@ public class ClassTransformer_TC_ItemWispEssence { } } - static Aspect[] displayAspects; - - @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack stack, int par2) { - if (stack == null) { - return 0; - } - if (this.getAspects(stack) != null) { - return this.getAspects(stack).getAspects()[0].getColor(); - } else { - int idx = (int) (System.currentTimeMillis() / 500L % (long) displayAspects.length); - return displayAspects[idx].getColor(); - } - } - - public AspectList getAspects(ItemStack itemstack) { - if (itemstack.hasTagCompound()) { - AspectList aspects = new AspectList(); - aspects.readFromNBT(itemstack.getTagCompound()); - return aspects.size() > 0 ? aspects : null; - } else { - return null; - } - } diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_ClassTransformer2.java b/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_ClassTransformer2.java index 390289d162..507e2cf974 100644 --- a/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_ClassTransformer2.java +++ b/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_ClassTransformer2.java @@ -329,8 +329,6 @@ public class Preloader_ClassTransformer2 { Logger.REFLECTION("mItemStorageNBT: "+(mItemStorageNBT != null)); //mItemStorageNBT - - ItemStack rStack = new ItemStack(GregTech_API.sBlockMachines, 1, tID); NBTTagCompound tNBT = new NBTTagCompound(); if (tRecipeStuff != null && !tRecipeStuff.hasNoTags()) tNBT.setTag("GT.CraftingComponents", tRecipeStuff); diff --git a/src/Java/gtPlusPlus/xmod/forestry/bees/custom/GTPP_Bees.java b/src/Java/gtPlusPlus/xmod/forestry/bees/custom/GTPP_Bees.java index fd83cc707d..7d45899911 100644 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/custom/GTPP_Bees.java +++ b/src/Java/gtPlusPlus/xmod/forestry/bees/custom/GTPP_Bees.java @@ -111,7 +111,6 @@ public class GTPP_Bees { input, null, output, - 0, 30, 8); } diff --git a/src/Java/gtPlusPlus/xmod/galacticraft/handler/HandlerTooltip_GC.java b/src/Java/gtPlusPlus/xmod/galacticraft/handler/HandlerTooltip_GC.java index 64f1cfbe23..3b59b58cab 100644 --- a/src/Java/gtPlusPlus/xmod/galacticraft/handler/HandlerTooltip_GC.java +++ b/src/Java/gtPlusPlus/xmod/galacticraft/handler/HandlerTooltip_GC.java @@ -21,6 +21,10 @@ public class HandlerTooltip_GC { private static Class oMainClass; private static Class oFuelLoaderClass; private static HashMap mFuelNames; + + static { + mFuelNames = new LinkedHashMap(); + } @SubscribeEvent public void onItemTooltip(ItemTooltipEvent event) { @@ -38,7 +42,7 @@ public class HandlerTooltip_GC { oFuelLoaderClass = GCFuelLoader; } - Field aField = ReflectionUtils.getField(GCBlocks, "fuelLoader"); + Field aField = ReflectionUtils.getField(oMainClass, "fuelLoader"); if (aField != null) { Block aBlock = (Block) aField.get(null); if (aBlock != null) { @@ -49,10 +53,12 @@ public class HandlerTooltip_GC { } } catch (Throwable t) { } - } + } + if (mFuelNames == null) { + mFuelNames = new LinkedHashMap(); + } - if (mFuelNames == null || mFuelNames.isEmpty()) { - mFuelNames = new LinkedHashMap(); + if (mFuelNames.isEmpty()) { for (int aMapKey : RocketFuels.mValidRocketFuels.keySet()) { Fluid aFuel = RocketFuels.mValidRocketFuels.get(aMapKey); if (aFuel != null) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java b/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java index 0143c9096f..f85d432b0c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java @@ -59,6 +59,7 @@ public class HANDLER_GT { public static final List sWorldgenListEverglades = new ArrayList(); public static final List sWorldgenListAustralia = new ArrayList(); public static final List sCustomWorldgenList = new ArrayList(); + public static GT_MetaGenerated_Tool sMetaGeneratedToolInstance; public static void preInit(){ @@ -88,7 +89,7 @@ public class HANDLER_GT { //Only loads if the config option is true (default: true) if (CORE.ConfigSwitches.enableSkookumChoochers){ - new MetaGeneratedGregtechTools(); + sMetaGeneratedToolInstance= MetaGeneratedGregtechTools.getInstance(); } if (ConfigSwitches.enableOldGTcircuits && !CORE.GTNH){ diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java index 94adb5a92c..2726b140ca 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java @@ -216,10 +216,14 @@ public interface IGregtech_RecipeAdder { public boolean addSmeltingAndAlloySmeltingRecipe(ItemStack aDust, ItemStack aOutput); - public boolean addFluidExtractionRecipe(ItemStack input, ItemStack input2, FluidStack output, int aTime, int aEu, int aSpecial); + public boolean addFluidExtractionRecipe(ItemStack aContainer, ItemStack aFullContainer, FluidStack rFluidOut, int aTime, int aEu); + + public boolean addFluidCannerRecipe(ItemStack aContainer, ItemStack aFullContainer, FluidStack rFluidIn); public boolean addFluidCannerRecipe(ItemStack aContainer, ItemStack aFullContainer, FluidStack rFluidIn, FluidStack rFluidOut); + public boolean addFluidCannerRecipe(ItemStack aContainer, ItemStack aFullContainer, FluidStack rFluidIn, FluidStack rFluidOut, int aTime, int aEu); + /** * Adds a Fusion reactor Recipe * diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java index 1ce7fc49d3..e1b329c07f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java @@ -247,9 +247,9 @@ public abstract class GTPP_MTE_BasicLosslessGenerator extends GTPP_MTE_BasicTank public int getFuelValue(FluidStack aLiquid) { if (aLiquid != null && this.getRecipes() != null) { Collection tRecipeList = this.getRecipes().mRecipeList; - Logger.WARNING("Fuels: "+tRecipeList.size()); if (tRecipeList != null) { - Iterator var4 = tRecipeList.iterator(); + Logger.WARNING("Fuels: "+tRecipeList.size()); + Iterator var4 = tRecipeList.iterator(); while (var4.hasNext()) { GT_Recipe tFuel = (GT_Recipe) var4.next(); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java index e0844bb071..4c60d9a932 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java @@ -9,7 +9,6 @@ import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Utility; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.IInventory; @@ -17,7 +16,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; public class GT_MetaTileEntity_SuperBus_Input extends GT_MetaTileEntity_Hatch_InputBus { - public GT_Recipe_Map mRecipeMap = null; public GT_MetaTileEntity_SuperBus_Input(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GT_MetaTileEntity_Hatch_CustomFluidBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GT_MetaTileEntity_Hatch_CustomFluidBase.java index 839fb3a14a..c9b98a6a64 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GT_MetaTileEntity_Hatch_CustomFluidBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GT_MetaTileEntity_Hatch_CustomFluidBase.java @@ -102,7 +102,7 @@ public class GT_MetaTileEntity_Hatch_CustomFluidBase extends GT_MetaTileEntity_H String[] s2 = new String[]{ "Fluid Input for Multiblocks", "Capacity: " + getCapacity()+"L", - "Accepted Fluid: " + mTempMod + mLockedStack.getLocalizedName() + "Accepted Fluid: " + mTempMod + mLockedStack != null ? mLockedStack.getLocalizedName() : "Empty" }; return s2; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java index 3b8597c5eb..68b81182fc 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java @@ -86,6 +86,18 @@ GT_MetaTileEntity_MultiBlockBase { Logger.MACHINE_INFO("Found .08 findRecipe method? "+(a08 != null)); Logger.MACHINE_INFO("Found .09 findRecipe method? "+(a09 != null)); + if (CORE.DEBUG) { + aLogger = ReflectionUtils.getMethod(Logger.class, "INFO", String.class); + } + else { + aLogger = ReflectionUtils.getMethod(Logger.class, "MACHINE_INFO", String.class); + } + + try { + calculatePollutionReduction = GT_MetaTileEntity_Hatch_Muffler.class.getDeclaredMethod("calculatePollutionReduction", int.class); + } catch (NoSuchMethodException | SecurityException e) {} + + //gregtech.api.util.GT_Recipe.GT_Recipe_Map.findRecipe(IHasWorldObjectAndCoords, GT_Recipe, boolean, long, FluidStack[], ItemStack, ItemStack...) } @@ -523,20 +535,27 @@ GT_MetaTileEntity_MultiBlockBase { public void log(String s) { - boolean isDebugLogging = CORE.DEBUG; - boolean reset = true; + boolean isDebugLogging = CORE.DEBUG; + boolean reset = false; - if (aLogger == null || reset) { + if (reset) { if (isDebugLogging) { - aLogger = ReflectionUtils.getMethod(Logger.class, "INFO", String.class); + aLogger = ReflectionUtils.getMethod( + Logger.class, "INFO", String.class + ); } else { - aLogger = ReflectionUtils.getMethod(Logger.class, "MACHINE_INFO", String.class); + aLogger = ReflectionUtils.getMethod( + Logger.class, "MACHINE_INFO", String.class + ); } } try { aLogger.invoke(null, s); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {} + } + catch (IllegalAccessException | IllegalArgumentException + | InvocationTargetException e) { + } } @@ -1435,13 +1454,15 @@ GT_MetaTileEntity_MultiBlockBase { boolean aExists = false; for (E m : aList) { IGregTechTileEntity b = ((IMetaTileEntity) m).getBaseMetaTileEntity(); - BlockPos aPos = new BlockPos(b); - if (b != null && aPos != null) { - if (aCurPos.equals(aPos)) { - if (GTplusplus.CURRENT_LOAD_PHASE == INIT_PHASE.STARTED) { - log("Found Duplicate "+b.getInventoryName()+" at " + aPos.getLocationString()); + if (b != null) { + BlockPos aPos = new BlockPos(b); + if (aPos != null) { + if (aCurPos.equals(aPos)) { + if (GTplusplus.CURRENT_LOAD_PHASE == INIT_PHASE.STARTED) { + log("Found Duplicate "+b.getInventoryName()+" at " + aPos.getLocationString()); + } + return false; } - return false; } } } @@ -1867,20 +1888,16 @@ GT_MetaTileEntity_MultiBlockBase { } } - private static Method calculatePollutionReduction; + private static Method calculatePollutionReduction = null; public int calculatePollutionReductionForHatch(GT_MetaTileEntity_Hatch_Muffler i , int g) { - if (calculatePollutionReduction == null) { + if (calculatePollutionReduction != null) { try { - calculatePollutionReduction = i.getClass().getDeclaredMethod("calculatePollutionReduction", int.class); - } catch (NoSuchMethodException | SecurityException e) { - calculatePollutionReduction = null; + return (int) calculatePollutionReduction.invoke(i, g); + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + } - } - try { - return (int) calculatePollutionReduction.invoke(i, g); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - return 0; } + return 0; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Boulder.java b/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Boulder.java index c8a7b5119d..ca78a72e04 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Boulder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Boulder.java @@ -3,6 +3,7 @@ package gtPlusPlus.xmod.gregtech.api.world; import java.util.Collection; import java.util.Random; +import gtPlusPlus.core.lib.CORE; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.util.MathHelper; @@ -21,7 +22,7 @@ public class GTPP_Worldgen_Boulder extends GTPP_Worldgen_Ore { int tX = aChunkX + aRandom.nextInt(16), tY = mMinY + aRandom.nextInt(mMaxY - mMinY), tZ = aChunkZ + aRandom.nextInt(16); Block tBlock = aWorld.getBlock(tX, tY - 7, tZ); if (tBlock != null && tBlock.isOpaqueCube() && aWorld.getBlock(tX, tY - 6, tZ).isAir(aWorld, tX, tY - 6, tZ)) { - float math_pi = 3.141593F; + float math_pi = CORE.PI; float var6 = aRandom.nextFloat() * math_pi; float var1b = mSize / 8.0F; float var3b = MathHelper.sin(var6) * var1b; float var4b = MathHelper.cos(var6) * var1b; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Ore_Normal.java b/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Ore_Normal.java index 9d7eb5a020..e66106ad4a 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Ore_Normal.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Ore_Normal.java @@ -3,6 +3,7 @@ package gtPlusPlus.xmod.gregtech.api.world; import java.util.Collection; import java.util.Random; +import gtPlusPlus.core.lib.CORE; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.util.MathHelper; @@ -20,7 +21,7 @@ public class GTPP_Worldgen_Ore_Normal extends GTPP_Worldgen_Ore { for (int i = 0; i < mAmount; i++) { int tX = aChunkX + aRandom.nextInt(16), tY = mMinY + aRandom.nextInt(mMaxY - mMinY), tZ = aChunkZ + aRandom.nextInt(16); if (mAllowToGenerateinVoid || aWorld.getBlock(tX, tY, tZ).isAir(aWorld, tX, tY, tZ)) { - float math_pi = 3.141593F;float var1b = mSize / 8.0F; + float math_pi = CORE.PI;float var1b = mSize / 8.0F; float var6 = aRandom.nextFloat() * math_pi; float var3b = MathHelper.sin(var6) * var1b; float var4b = MathHelper.cos(var6) * var1b; float var8b = -2*var3b;float var9b = -2*var4b; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java b/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java index 629c584f70..2d7151bf45 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java @@ -32,7 +32,6 @@ import gtPlusPlus.api.objects.minecraft.FormattedTooltipString; import gtPlusPlus.core.handler.AchievementHandler; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.ELEMENT; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.MaterialUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; @@ -51,19 +50,16 @@ import net.minecraftforge.fluids.FluidStack; public class Meta_GT_Proxy { static { - instance = new Meta_GT_Proxy(); Logger.INFO("GT_PROXY - initialized."); } - public static final Meta_GT_Proxy instance; - public static List GT_BlockIconload = new ArrayList<>(); public static List GT_ItemIconload = new ArrayList<>(); public static AutoMap GT_ValidHeatingCoilMetas = new AutoMap(); - private static Class sBaseMetaTileEntityClass; - private static Class sBaseMetaTileEntityClass2; + private static Class sBaseMetaTileEntityClass; + private static Class sBaseMetaTileEntityClass2; public static AchievementHandler mAssemblyAchievements; @@ -79,7 +75,7 @@ public class Meta_GT_Proxy { public static Block sBlockMachines; - public void preInit() { + public static void preInit() { //New GT++ Block, yay! (Progress) //sBlockMachines = new GTPP_Block_Machines(); @@ -110,12 +106,12 @@ public class Meta_GT_Proxy { CoverManager.generateCustomCovers(); } - public void init() { + public static void init() { scheduleCoverMapCleaner(); setValidHeatingCoilMetas(); } - public void postInit() { + public static void postInit() { mAssemblyAchievements = new AchievementHandler(); } @@ -317,7 +313,7 @@ public class Meta_GT_Proxy { - public void setValidHeatingCoilMetas() { + public static void setValidHeatingCoilMetas() { for (int i = 0; i <= 6; i++ ) { GT_ValidHeatingCoilMetas.put(i); } @@ -342,7 +338,7 @@ public class Meta_GT_Proxy { } - public void scheduleCoverMapCleaner(){ + public static void scheduleCoverMapCleaner(){ TimerTask repeatedTask = new TimerTask() { public void run() { cleanupOverFlowCoverCache(); @@ -360,6 +356,7 @@ public class Meta_GT_Proxy { long aCurrentTime = System.currentTimeMillis()/1000; for (Object o : cache.values()) { if (o != null && o instanceof HashMap) { + @SuppressWarnings("unchecked") HashMap m = (HashMap) o; if (m != null) { String s = (String) m.get("aCoverKey"); @@ -390,7 +387,7 @@ public class Meta_GT_Proxy { return StaticFields59.getFieldFromGregtechProxy(fieldName); } - public void setCustomGregtechTooltip(String aNbtTagName, FormattedTooltipString aData) { + public static void setCustomGregtechTooltip(String aNbtTagName, FormattedTooltipString aData) { mCustomGregtechMetaTooltips.put(aNbtTagName, aData); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/TreeFarmHelper.java b/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/TreeFarmHelper.java index 4038d5bdf4..8b3fb9a42f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/TreeFarmHelper.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/TreeFarmHelper.java @@ -297,7 +297,7 @@ public class TreeFarmHelper { return true; } else if (aStack.getUnlocalizedName().toLowerCase().contains("mu-metaitem")) { - String[] aData = aStack.getUnlocalizedName().toLowerCase().split("."); + String[] aData = aStack.getUnlocalizedName().toLowerCase().split("//."); if (aData != null && aData.length > 0) { for (String s : aData) { if (s.contains("32120")) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java index 236ae65edb..bc11cb6a11 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java @@ -8,7 +8,6 @@ import gregtech.api.enums.ToolDictNames; import gregtech.api.items.GT_MetaGenerated_Tool; import gregtech.api.objects.GT_HashSet; import gregtech.api.objects.GT_ItemStack; -import gregtech.common.tools.GT_Tool_WireCutter; import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechToolDictNames; import gtPlusPlus.xmod.gregtech.common.tools.TOOL_Gregtech_AngelGrinder; @@ -25,10 +24,18 @@ public class MetaGeneratedGregtechTools extends GT_MetaGenerated_Tool { public static final short ANGLE_GRINDER = 7834; public static final short ELECTRIC_SNIPS = 7934; public static GT_MetaGenerated_Tool INSTANCE; + + static { + INSTANCE = new MetaGeneratedGregtechTools(); + } + + public static GT_MetaGenerated_Tool getInstance() { + return INSTANCE; + } + - public MetaGeneratedGregtechTools() { + private MetaGeneratedGregtechTools() { super("plusplus.metatool.01"); - INSTANCE = this; // Skookum Choocher GregTech_API.registerTool(this.addTool(SKOOKUM_CHOOCHER, "Skookum Choocher", "Can Really Chooch. Does a Skookum job at Hammering and Wrenching stuff.", new TOOL_Gregtech_Choocher(), diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java index 4795b0d0b9..10a1f96be7 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java @@ -710,8 +710,17 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi catch (Throwable t) { aTooltipSuper.put("Maximum pollution removed per second: "+mPollutionReduction); } - aTooltipSuper.put("Air Sides: "+mAirSides); - return aTooltipSuper.toArray(); + aTooltipSuper.put("Air Sides: "+mAirSides); + + String[] mBuiltOutput = new String[aTooltipSuper.size()]; + int aIndex = 0; + for (String i : aTooltipSuper) { + mBuiltOutput[aIndex++] = i; + } + + + + return mBuiltOutput; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java index 2e0eeea844..8b07117596 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java @@ -609,8 +609,13 @@ extends GregtechMeta_MultiBlockBase { } // -- Try not to fail after this point - inputs have already been consumed! -- - ItemStack[] mBuiltOutput = this.mReplicatorOutputMap.toArray(); - + ItemStack[] mBuiltOutput = new ItemStack[this.mReplicatorOutputMap.size()]; + int aIndex = 0; + for (ItemStack i : this.mReplicatorOutputMap) { + mBuiltOutput[aIndex++] = i; + } + + // Convert speed bonus to duration multiplier // e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe duration. aSpeedBonusPercent = Math.max(-99, aSpeedBonusPercent); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_MiniFusionPlant.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_MiniFusionPlant.java index 8925caf480..cb8b7590ee 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_MiniFusionPlant.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_MiniFusionPlant.java @@ -207,7 +207,7 @@ public class GregtechMTE_MiniFusionPlant extends GregtechMeta_MultiBlockBase { FluidStack[] arg5 = (FluidStack[]) tFluidList.toArray(new FluidStack[tFluidList.size()]); GT_Recipe arg6 = getRecipeMap().findRecipe(this.getBaseMetaTileEntity(), this.mLastRecipe, false, this.getMaxInputVoltage(), arg5, new ItemStack[0]); - if (arg6 == null && !this.mRunningOnLoad || this.maxEUStore() < (long) arg6.mSpecialValue) { + if (arg6 == null && !this.mRunningOnLoad || (arg6 != null && this.maxEUStore() < (long) arg6.mSpecialValue)) { //Logger.INFO("Bad Step "+aStep++); //this.turnCasingActive(false); this.mLastRecipe = null; @@ -215,7 +215,7 @@ public class GregtechMTE_MiniFusionPlant extends GregtechMeta_MultiBlockBase { } //Logger.INFO("Step "+aStep++); - if (this.mRunningOnLoad || arg6.isRecipeInputEqual(true, arg5, new ItemStack[0])) { + if (this.mRunningOnLoad || (arg6 != null && arg6.isRecipeInputEqual(true, arg5, new ItemStack[0]))) { //Logger.INFO("Step "+aStep++); this.mLastRecipe = arg6; this.mEUt = this.mLastRecipe.mEUt * 1; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java index 33555c8f51..f3fefdf789 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java @@ -34,6 +34,10 @@ public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase public static int CASING_TEXTURE_ID; public static String mCasingName = "Advanced Cryogenic Casing"; public static TreeGenerator mTreeData; + + static { + mTreeData = new TreeGenerator(); + } public GregtechMetaTileEntityTreeFarm(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); @@ -76,10 +80,6 @@ public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase } }*/ - if (mTreeData == null) { - mTreeData = new TreeGenerator(); - } - diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java index 07c8a4a7ac..24db72fbe0 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java @@ -22,8 +22,6 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; public class GregtechMetaTileEntity_Refinery extends GregtechMeta_MultiBlockBase { - - public GT_Recipe mLastRecipe; public GregtechMetaTileEntity_Refinery(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java index d8a5617b2e..d4a25e03dd 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java @@ -266,7 +266,7 @@ public class RecipeGen_DustGeneration extends RecipeGen_Base { //Get us four ItemStacks to input into the mixer ItemStack input1, input2, input3, input4; - input1 = (inputStacks.length >= 1) ? (input1 = (inputStacks[0] == null) ? null : inputStacks[0]) : null; + input1 = inputStacks[0]; input2 = (inputStacks.length >= 2) ? (input2 = (inputStacks[1] == null) ? null : inputStacks[1]) : null; input3 = (inputStacks.length >= 3) ? (input3 = (inputStacks[2] == null) ? null : inputStacks[2]) : null; input4 = (inputStacks.length >= 4) ? (input4 = (inputStacks[3] == null) ? null : inputStacks[3]) : null; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_FluidCanning.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_FluidCanning.java index 0a20d9357c..ce4a6c629a 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_FluidCanning.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_FluidCanning.java @@ -3,6 +3,7 @@ package gtPlusPlus.xmod.gregtech.loaders; import java.util.HashSet; import java.util.Set; +import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; import gregtech.api.util.GT_Recipe; @@ -26,8 +27,23 @@ public class RecipeGen_FluidCanning extends RecipeGen_Base { private final GT_Recipe recipe; private final boolean isValid; - // Alternative Constructor + public boolean valid() { + return isValid; + } + public RecipeGen_FluidCanning(boolean aExtracting, ItemStack aEmpty, ItemStack aFull, FluidStack aFluid) { + this(aExtracting, aEmpty, aFull, aFluid, null, null, null); + } + + public RecipeGen_FluidCanning(boolean aExtracting, ItemStack aEmpty, ItemStack aFull, FluidStack aFluidIn, FluidStack aFluidOut) { + this(aExtracting, aEmpty, aFull, aFluidIn, aFluidOut, null, null); + } + public RecipeGen_FluidCanning(boolean aExtracting, ItemStack aEmpty, ItemStack aFull, FluidStack aFluid, Integer aDuration, Integer aEUt) { + this(aExtracting, aEmpty, aFull, aFluid, null, aDuration, aEUt); + } + + // Alternative Constructor + public RecipeGen_FluidCanning(boolean aExtracting, ItemStack aEmpty, ItemStack aFull, FluidStack aFluidIn, FluidStack aFluidOut, Integer aDuration, Integer aEUt) { ItemStack aInput; ItemStack aOutput; FluidStack aFluidInput; @@ -35,7 +51,7 @@ public class RecipeGen_FluidCanning extends RecipeGen_Base { // Safety check on the duration if (aDuration == null || aDuration <= 0) { - aDuration = (aFluid != null) ? (aFluid.amount / 62) : (1000 / 62); + aDuration = (aFluidIn != null) ? (aFluidIn.amount / 62) : ((aFluidOut != null) ? (aFluidOut.amount / 62) : 10); } // Safety check on the EU @@ -53,13 +69,13 @@ public class RecipeGen_FluidCanning extends RecipeGen_Base { aInput = aFull; aOutput = aEmpty; aFluidInput = null; - aFluidOutput = aFluid; + aFluidOutput = aFluidIn; } else { aInput = aEmpty; - aOutput = aFull; - aFluidInput = aFluid; - aFluidOutput = null; + aOutput = aFull; + aFluidInput = aFluidIn; + aFluidOutput = aFluidOut != null ? aFluidOut : GT_Values.NF; } //Check validity @@ -69,16 +85,16 @@ public class RecipeGen_FluidCanning extends RecipeGen_Base { new ItemStack[] { aInput }, new ItemStack[] { aOutput }, null, - new int[] {}, + new int[] {10000}, new FluidStack[] { aFluidInput }, new FluidStack[] { aFluidOutput }, aDuration, - 1, + aEUt, 0); // Not Valid - if ((aExtracting && (aInput == null || aOutput == null ||aFluidOutput == null)) || (!aExtracting && (aInput == null || aOutput == null || aFluidInput == null))) { + if ((aExtracting && (aInput == null || aOutput == null ||(aFluidInput == null && aFluidOutput == null))) || (!aExtracting && (aInput == null || aOutput == null || (aFluidInput == null && aFluidOutput == null)))) { isValid = false; disableOptional = aExtracting; recipe = null; @@ -102,77 +118,54 @@ public class RecipeGen_FluidCanning extends RecipeGen_Base { } private void generateRecipes() { - if (isValid && recipe != null) { - //Used to store Fluid extraction state + if (isValid && recipe != null) { if (this.disableOptional) { - addFluidExtractionRecipe( - recipe.mInputs.length >= 1 ? recipe.mInputs[0] : null, //Input - recipe.mInputs.length == 2 ? recipe.mInputs[1] : null, //Input 2 - recipe.mFluidOutputs.length == 1 ? recipe.mFluidOutputs[0] : null, //Fluid Output - recipe.mDuration, //Duration - recipe.mEUt //Eu Tick - ); + addFluidExtractionRecipe(recipe); } else { - addFluidCannerRecipe( - recipe.mInputs.length == 1 ? recipe.mInputs[0] : null, //Input - recipe.mOutputs.length == 1 ? recipe.mOutputs[0] : null, //Input 2 - recipe.mFluidInputs.length == 1 ? recipe.mFluidInputs[0] : null //Fluid Input - ); - + addFluidCannerRecipe(recipe); } - } } - private final boolean addFluidExtractionRecipe(final ItemStack aInput, final ItemStack aRemains, FluidStack aOutput, int aDuration, final int aEUt) { - if (aInput == null || aOutput == null) { - return false; - } - if (aOutput.isFluidEqual(Materials.PhasedGold.getMolten(1L))) { - aOutput = Materials.VibrantAlloy.getMolten(aOutput.amount); - } - if (aOutput.isFluidEqual(Materials.PhasedIron.getMolten(1L))) { - aOutput = Materials.PulsatingIron.getMolten(aOutput.amount); + private final boolean addFluidExtractionRecipe(GT_Recipe aRecipe) { + if (aRecipe != null) { + if ((aRecipe.mDuration = GregTech_API.sRecipeFile.get("fluidextractor", aRecipe.mInputs[0], aRecipe.mDuration)) <= 0) { + return false; + } else { + GT_Recipe_Map.sFluidExtractionRecipes.addRecipe(aRecipe); + return true; + } } - //Logger.INFO(buildLogString()); - boolean result = GT_Values.RA.addFluidExtractionRecipe(aInput, aRemains, aOutput, 10000, aDuration, aEUt); - //Logger.INFO(buildLogString()); - //dumpStack(); - return result; + return false; } - public final boolean addFluidCannerRecipe(final ItemStack aInput, final ItemStack aOutput, FluidStack aFluidInput) { - if (aInput == null || aOutput == null || aFluidInput == null) { - return false; - } - if (aFluidInput.isFluidEqual(Materials.PhasedGold.getMolten(1L))) { - aFluidInput = Materials.VibrantAlloy.getMolten(aFluidInput.amount); - } - if (aFluidInput.isFluidEqual(Materials.PhasedIron.getMolten(1L))) { - aFluidInput = Materials.PulsatingIron.getMolten(aFluidInput.amount); + private final boolean addFluidCannerRecipe(GT_Recipe recipe2) { + if (recipe2 != null) { + if ((recipe2.mDuration = GregTech_API.sRecipeFile.get("fluidcanner", recipe2.mOutputs[0], recipe2.mDuration)) <= 0) { + return false; + } else { + GT_Recipe_Map.sFluidCannerRecipes.addRecipe(recipe2); + return true; + } } - //Logger.INFO(buildLogString()); - boolean result = GT_Values.RA.addFluidCannerRecipe(aInput, aOutput, aFluidInput, GT_Values.NF); - //Logger.INFO(buildLogString()); - //dumpStack(); - return result; - } - + return false; + } + private void dumpStack() { int parents = 2; for (int i=0;i<6;i++) { Logger.INFO((disableOptional ? "EXTRACTING" : "CANNING")+" DEBUG | "+(i == 0 ? "Called from: " : "Parent: ")+ReflectionUtils.getMethodName(i+parents)); } - + } - + private String buildLogString() { int solidSize = getMapSize(GT_Recipe_Map.sCannerRecipes); int fluidSize = getMapSize(GT_Recipe_Map.sFluidCannerRecipes); return (disableOptional ? "EXTRACTING" : "CANNING")+" DEBUG | Solids: "+solidSize+" | Liquids: "+fluidSize+" | "; } - + private final int getMapSize(GT_Recipe_Map aMap) { return aMap.mRecipeList.size(); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java index b3b71c7587..799c6cd63b 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java @@ -51,7 +51,6 @@ public class RecipeGen_Fluids extends RecipeGen_Base { if (CORE.RA.addFluidExtractionRecipe(material.getIngot(1), // Input null, // Input 2 material.getFluid(144), // Fluid Output - 0, // Chance 1 * 20, // Duration material.vVoltageMultiplier // Eu Tick )) { @@ -67,7 +66,6 @@ public class RecipeGen_Fluids extends RecipeGen_Base { if (CORE.RA.addFluidExtractionRecipe(material.getPlate(1), // Input null, // Input 2 material.getFluid(144), // Fluid Output - 0, // Chance 1 * 20, // Duration material.vVoltageMultiplier // Eu Tick )) { @@ -83,7 +81,6 @@ public class RecipeGen_Fluids extends RecipeGen_Base { if (CORE.RA.addFluidExtractionRecipe(material.getPlateDouble(1), // Input null, // Input 2 material.getFluid(288), // Fluid Output - 0, // Chance 1 * 20, // Duration material.vVoltageMultiplier // Eu Tick )) { @@ -99,7 +96,6 @@ public class RecipeGen_Fluids extends RecipeGen_Base { if (CORE.RA.addFluidExtractionRecipe(material.getNugget(1), // Input null, // Input 2 material.getFluid(16), // Fluid Output - 0, // Chance 16, // Duration material.vVoltageMultiplier // Eu Tick )) { @@ -115,7 +111,6 @@ public class RecipeGen_Fluids extends RecipeGen_Base { if (CORE.RA.addFluidExtractionRecipe(material.getBlock(1), // Input null, // Input 2 material.getFluid(144 * 9), // Fluid Output - 0, // Chance 288, // Duration material.vVoltageMultiplier // Eu Tick )) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Ore.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Ore.java index 52f7ab24f3..9b7e1d708d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Ore.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Ore.java @@ -219,9 +219,10 @@ public class RecipeGen_Ore extends RecipeGen_Base { Logger.MATERIALS("material.getCrushed(1): "+(material.getCrushed(1) != null)); Logger.MATERIALS("material.getCrushedPurified(1): "+(material.getCrushedPurified(1) != null)); - Logger.MATERIALS("bonusA.getTinyDust(1): "+(tinyDustA != null)+" | Material: "+(bonusA != null) + " | Material name: "+(bonusA != null ? bonusA.getLocalizedName() : "invalid material")); - Logger.MATERIALS("bonusB.getTinyDust(1): "+(tinyDustB != null)+" | Material: "+(bonusB != null) + " | Material name: "+(bonusB != null ? bonusB.getLocalizedName() : "invalid material")); + Logger.MATERIALS("material.getTinyDust(1): "+(ItemUtils.getItemName(bonusA.getCrushed(1)))); + Logger.MATERIALS("material.getTinyDust(1): "+(ItemUtils.getItemName(bonusB.getCrushed(1)))); + try { //.08 compat if (GT_ModHandler.addThermalCentrifugeRecipe(material.getCrushed(1), 200, material.getCrushedCentrifuged(1), tinyDustB, dustStone)){ diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java index 3328b0894f..58db8a473f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java @@ -7,16 +7,11 @@ import java.util.Map; import org.apache.commons.lang3.reflect.FieldUtils; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; - -import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; - import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.api.objects.data.Pair; @@ -26,6 +21,8 @@ import gtPlusPlus.core.material.state.MaterialState; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; public class RecipeGen_Recycling implements Runnable { @@ -60,6 +57,7 @@ public class RecipeGen_Recycling implements Runnable { public static void generateRecipes(final Material material) { + if (material != null) Logger.WARNING("Generating Recycling recipes for " + material.getLocalizedName()); final OrePrefixes[] mValidPrefixesAsString = { OrePrefixes.ingot, OrePrefixes.ingotHot, OrePrefixes.nugget, @@ -139,7 +137,7 @@ public class RecipeGen_Recycling implements Runnable { //Fluid Extractor if (ItemUtils.checkForInvalidItems(tempStack)) { // mValidItems[mSlotIndex++] = tempStack; - if ((mDust != null) && CORE.RA.addFluidExtractionRecipe(tempStack, null, material.getFluid(mFluidAmount), 0, 30, material.vVoltageMultiplier)) { + if ((mDust != null) && CORE.RA.addFluidExtractionRecipe(tempStack, null, material.getFluid(mFluidAmount), 30, material.vVoltageMultiplier)) { Logger.WARNING("Fluid Recycle Recipe: " + material.getLocalizedName() + " - Success - Recycle " + tempStack.getDisplayName() + " and obtain " + mFluidAmount+"mb of "+material.getFluid(1).getLocalizedName()+"."); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java b/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java index 3c996ef64f..fa6f2ad790 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java @@ -19,7 +19,6 @@ import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.material.ELEMENT; import gtPlusPlus.core.material.MaterialGenerator; import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.data.ArrayUtils; @@ -991,15 +990,24 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { } @Override - public boolean addFluidExtractionRecipe(ItemStack input, ItemStack input2, FluidStack output, int aTime, int aEu, int aSpecial) { - Method aExtractionMethod = ReflectionUtils.getMethod(MaterialGenerator.class, "addFluidExtractionRecipe", new Class[] {ItemStack.class, ItemStack.class, FluidStack.class, int.class, int.class}); - return ReflectionUtils.invoke(null, aExtractionMethod, new Object[] {input, input2, output, aSpecial, aTime, aEu}); + public boolean addFluidExtractionRecipe(ItemStack input, ItemStack input2, FluidStack output, int aTime, int aEu) { + return MaterialGenerator.addFluidExtractionRecipe(input, input2, output, aTime, aEu); + } + + @Override + public boolean addFluidCannerRecipe(ItemStack aFullContainer, ItemStack container, FluidStack rFluidIn) { + return MaterialGenerator.addFluidCannerRecipe(container, aFullContainer, rFluidIn, null); } @Override public boolean addFluidCannerRecipe(ItemStack aFullContainer, ItemStack container, FluidStack rFluidIn, FluidStack rFluidOut) { - Method aExtractionMethod = ReflectionUtils.getMethod(MaterialGenerator.class, "addFluidCannerRecipe", new Class[] {ItemStack.class, ItemStack.class, FluidStack.class}); - return ReflectionUtils.invoke(null, aExtractionMethod, new Object[] {aFullContainer, container, rFluidIn, rFluidOut}); + return MaterialGenerator.addFluidCannerRecipe(container, aFullContainer, rFluidIn, rFluidOut); + } + + + @Override + public boolean addFluidCannerRecipe(ItemStack aFullContainer, ItemStack container, FluidStack rFluidIn, FluidStack rFluidOut, int aTime, int aEu) { + return MaterialGenerator.addFluidCannerRecipe(container, aFullContainer, rFluidIn, rFluidOut, aTime, aEu); } /** diff --git a/src/Java/gtPlusPlus/xmod/growthcraft/fishtrap/FishTrapHandler.java b/src/Java/gtPlusPlus/xmod/growthcraft/fishtrap/FishTrapHandler.java index e394a8b8c0..6933987593 100644 --- a/src/Java/gtPlusPlus/xmod/growthcraft/fishtrap/FishTrapHandler.java +++ b/src/Java/gtPlusPlus/xmod/growthcraft/fishtrap/FishTrapHandler.java @@ -221,10 +221,10 @@ public class FishTrapHandler { private static void addGregtechFluidRecipe(final ItemStack input){ if (LoadedMods.Gregtech){ if (CORE.GTNH) { - CORE.RA.addFluidExtractionRecipe(input, null, FluidUtils.getFluidStack("fishoil", 50), 10000, 16, 4); + CORE.RA.addFluidExtractionRecipe(input, null, FluidUtils.getFluidStack("fishoil", 50), 16, 4); } else { - CORE.RA.addFluidExtractionRecipe(input, null, FluidUtils.getFluidStack("fishoil", 4), 0, 16, 4); //4eu/t total eu used = 64 so time = 64/4 + CORE.RA.addFluidExtractionRecipe(input, null, FluidUtils.getFluidStack("fishoil", 4), 16, 4); //4eu/t total eu used = 64 so time = 64/4 } } } diff --git a/src/Java/gtPlusPlus/xmod/thaumcraft/util/ThaumcraftUtils.java b/src/Java/gtPlusPlus/xmod/thaumcraft/util/ThaumcraftUtils.java index 8beaa8df5e..f23a5db6fe 100644 --- a/src/Java/gtPlusPlus/xmod/thaumcraft/util/ThaumcraftUtils.java +++ b/src/Java/gtPlusPlus/xmod/thaumcraft/util/ThaumcraftUtils.java @@ -38,8 +38,18 @@ import net.minecraft.world.World; public class ThaumcraftUtils { - private static Class mClass_Aspect; + private static Class mClass_Aspect; private static Field mField_Aspects; + + static { + mClass_Aspect = ReflectionUtils.getClass("thaumcraft.api.aspects.Aspect"); + if (mClass_Aspect != null) { + Field aTagF = ReflectionUtils.getField(mClass_Aspect, "tag"); + if (aTagF != null) { + mField_Aspects = aTagF; + } + } + } public static boolean addAspectToItem(ItemStack item, TC_Aspect_Wrapper aspect, int amount) { return addAspectToItem(item, new TC_Aspect_Wrapper[] {aspect}, new Integer[] {amount}); @@ -212,10 +222,10 @@ public class ThaumcraftUtils { } - private static final Class mClass_ThaumcraftApi; - private static final Class mClass_ThaumcraftApiHelper; - private static final Class mClass_AspectList; - private static final Class mClass_ResearchManager; + private static final Class mClass_ThaumcraftApi; + private static final Class mClass_ThaumcraftApiHelper; + private static final Class mClass_AspectList; + private static final Class mClass_ResearchManager; private static final Method mMethod_registerObjectTag1; private static final Method mMethod_registerObjectTag2; private static final Method mMethod_registerComplexObjectTag; @@ -336,12 +346,11 @@ public class ThaumcraftUtils { public static String getTagFromAspectObject(Object aAspect) { - try { - Field aTagF = ReflectionUtils.getField(mClass_Aspect, "tag"); - if (aTagF == null) { + try { + if (mClass_Aspect == null || mField_Aspects == null) { return null; - } - String aTafB = (String) aTagF.get(aAspect); + } + String aTafB = (String) mField_Aspects.get(aAspect); if (aTafB == null) { return null; } diff --git a/src/Java/gtPlusPlus/xmod/thermalfoundation/recipe/TF_Gregtech_Recipes.java b/src/Java/gtPlusPlus/xmod/thermalfoundation/recipe/TF_Gregtech_Recipes.java index 1b2541ff3a..56e577fb7d 100644 --- a/src/Java/gtPlusPlus/xmod/thermalfoundation/recipe/TF_Gregtech_Recipes.java +++ b/src/Java/gtPlusPlus/xmod/thermalfoundation/recipe/TF_Gregtech_Recipes.java @@ -34,7 +34,7 @@ public class TF_Gregtech_Recipes { //Gelid Cryotheum Logger.INFO("Adding Recipes for Gelid Cryotheum"); - CORE.RA.addFluidExtractionRecipe(dust_Cryotheum, GT_Values.NI, getFluidStack("cryotheum", 250), 10000, 200, 240); + CORE.RA.addFluidExtractionRecipe(dust_Cryotheum, GT_Values.NI, getFluidStack("cryotheum", 250), 200, 240); GT_Values.RA.addChemicalBathRecipe((GT_OreDictUnificator.get(OrePrefixes.ore, Materials.Cinnabar, 1L)), getFluidStack("cryotheum", 144), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Cinnabar, 3L), GT_Values.NI, GT_Values.NI, null, 400, 30); //Blizz Powder @@ -48,10 +48,10 @@ public class TF_Gregtech_Recipes { //Blazing Pyrotheum Logger.INFO("Adding Recipes for Blazing Pyrotheum"); - CORE.RA.addFluidExtractionRecipe(dust_Pyrotheum, GT_Values.NI, getFluidStack("pyrotheum", 250), 10000, 200, 240); + CORE.RA.addFluidExtractionRecipe(dust_Pyrotheum, GT_Values.NI, getFluidStack("pyrotheum", 250), 200, 240); //Ender Fluid - CORE.RA.addFluidExtractionRecipe(ItemUtils.getSimpleStack(Items.ender_pearl), GT_Values.NI, getFluidStack("ender", 250), 10000, 100, 30); + CORE.RA.addFluidExtractionRecipe(ItemUtils.getSimpleStack(Items.ender_pearl), GT_Values.NI, getFluidStack("ender", 250), 100, 30); ItemStack dustCoal = ItemUtils.getItemStackOfAmountFromOreDict("dustCoal", 1); -- cgit From d4d38f40f4500c3dfa218b516fc7621d64bc1759 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Fri, 11 Oct 2019 18:27:54 +0100 Subject: + Added Round-Robinator. --- src/Java/gtPlusPlus/core/block/ModBlocks.java | 4 + .../core/block/machine/Machine_RoundRobinator.java | 162 ++++++++++++ .../core/container/Container_RoundRobinator.java | 190 ++++++++++++++ .../core/gui/machine/GUI_RoundRobinator.java | 44 ++++ src/Java/gtPlusPlus/core/handler/GuiHandler.java | 7 +- .../core/inventories/Inventory_RoundRobinator.java | 173 ++++++++++++ .../item/base/itemblock/ItemBlockBasicTile.java | 5 + .../machines/TileEntityRoundRobinator.java | 291 +++++++++++++++++++++ 8 files changed, 875 insertions(+), 1 deletion(-) create mode 100644 src/Java/gtPlusPlus/core/block/machine/Machine_RoundRobinator.java create mode 100644 src/Java/gtPlusPlus/core/container/Container_RoundRobinator.java create mode 100644 src/Java/gtPlusPlus/core/gui/machine/GUI_RoundRobinator.java create mode 100644 src/Java/gtPlusPlus/core/inventories/Inventory_RoundRobinator.java create mode 100644 src/Java/gtPlusPlus/core/tileentities/machines/TileEntityRoundRobinator.java (limited to 'src/Java/gtPlusPlus/core/tileentities') diff --git a/src/Java/gtPlusPlus/core/block/ModBlocks.java b/src/Java/gtPlusPlus/core/block/ModBlocks.java index b59facf9e2..a448e313ac 100644 --- a/src/Java/gtPlusPlus/core/block/ModBlocks.java +++ b/src/Java/gtPlusPlus/core/block/ModBlocks.java @@ -21,6 +21,7 @@ import gtPlusPlus.core.block.machine.Machine_ModularityTable; import gtPlusPlus.core.block.machine.Machine_PestKiller; import gtPlusPlus.core.block.machine.Machine_PooCollector; import gtPlusPlus.core.block.machine.Machine_ProjectTable; +import gtPlusPlus.core.block.machine.Machine_RoundRobinator; import gtPlusPlus.core.block.machine.Machine_SuperJukebox; import gtPlusPlus.core.block.machine.Machine_TradeTable; import gtPlusPlus.core.block.machine.Machine_Workbench; @@ -34,6 +35,7 @@ import net.minecraftforge.fluids.Fluid; public final class ModBlocks { + public static Block blockRoundRobinator; public static Block blockCircuitProgrammer; public static Block blockFakeMiningPipe; public static Block blockFakeMiningHead; @@ -147,6 +149,8 @@ public final class ModBlocks { blockPooCollector = new Machine_PooCollector(); blockPestKiller = new Machine_PestKiller(); + + blockRoundRobinator = new Machine_RoundRobinator(); new BlockGenericRedstoneDetector(); new BlockGenericRedstoneTest(); diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_RoundRobinator.java b/src/Java/gtPlusPlus/core/block/machine/Machine_RoundRobinator.java new file mode 100644 index 0000000000..71814cb868 --- /dev/null +++ b/src/Java/gtPlusPlus/core/block/machine/Machine_RoundRobinator.java @@ -0,0 +1,162 @@ +package gtPlusPlus.core.block.machine; + +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.common.registry.LanguageRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.common.items.GT_MetaGenerated_Tool_01; +import net.minecraft.block.Block; +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.EnumCreatureType; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +import gtPlusPlus.GTplusplus; +import gtPlusPlus.api.interfaces.ITileTooltip; +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.handler.GuiHandler; +import gtPlusPlus.core.item.base.itemblock.ItemBlockBasicTile; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.tileentities.machines.TileEntityRoundRobinator; +import gtPlusPlus.core.util.minecraft.InventoryUtils; +import gtPlusPlus.core.util.minecraft.PlayerUtils; + +public class Machine_RoundRobinator extends BlockContainer implements ITileTooltip +{ + @SideOnly(Side.CLIENT) + private IIcon textureTop; + @SideOnly(Side.CLIENT) + private IIcon textureBottom; + @SideOnly(Side.CLIENT) + private IIcon textureFront; + + /** + * Determines which tooltip is displayed within the itemblock. + */ + private final int mTooltipID = 7; + + @Override + public int getTooltipID() { + return this.mTooltipID; + } + + @SuppressWarnings("deprecation") + public Machine_RoundRobinator(){ + super(Material.iron); + this.setHardness(1f); + this.setResistance(1f); + this.setBlockName("blockRoundRobinator"); + this.setCreativeTab(AddToCreativeTab.tabMachines); + GameRegistry.registerBlock(this, ItemBlockBasicTile.class, "blockRoundRobinator"); + LanguageRegistry.addName(this, "Round-Robinator"); + + } + + /** + * Gets the block's texture. Args: side, meta + */ + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(final int p_149691_1_, final int p_149691_2_) + { + return p_149691_1_ == 1 ? this.textureTop : (p_149691_1_ == 0 ? this.textureBottom : (this.textureFront)); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(final IIconRegister p_149651_1_) + { + this.blockIcon = p_149651_1_.registerIcon(CORE.MODID + ":" + "metro/" + "TEXTURE_TECH_PANEL_B"); + this.textureTop = p_149651_1_.registerIcon(CORE.MODID + ":" + "metro/" + "TEXTURE_TECH_PANEL_B"); + this.textureBottom = p_149651_1_.registerIcon(CORE.MODID + ":" + "metro/" + "TEXTURE_METAL_PANEL_G"); + this.textureFront = p_149651_1_.registerIcon(CORE.MODID + ":" + "metro/" + "TEXTURE_METAL_PANEL_I"); + } + + /** + * 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, final int side, final float lx, final float ly, final float lz) + { + if (world.isRemote) { + return true; + } + else { + + boolean mDidScrewDriver = false; + // Check For Screwdriver + try { + final ItemStack mHandStack = PlayerUtils.getItemStackInPlayersHand(world, player.getDisplayName()); + final Item mHandItem = mHandStack.getItem(); + if (((mHandItem instanceof GT_MetaGenerated_Tool_01) + && ((mHandItem.getDamage(mHandStack) == 22) || (mHandItem.getDamage(mHandStack) == 150)))) { + final TileEntityRoundRobinator tile = (TileEntityRoundRobinator) world.getTileEntity(x, y, z); + if (tile != null) { + mDidScrewDriver = tile.onScrewdriverRightClick((byte) side, player, x, y, z); + } + } + } + catch (final Throwable t) {} + + if (!mDidScrewDriver) { + final TileEntity te = world.getTileEntity(x, y, z); + if ((te != null) && (te instanceof TileEntityRoundRobinator)){ + player.openGui(GTplusplus.instance, GuiHandler.GUI16, world, x, y, z); + return true; + } + } + else { + return true; + } + + } + return false; + } + + @Override + public int getRenderBlockPass() { + return 1; + } + + @Override + public boolean isOpaqueCube() { + return false; + } + + @Override + public TileEntity createNewTileEntity(final World world, final int p_149915_2_) { + return new TileEntityRoundRobinator(); + } + + @Override + public void onBlockAdded(final World world, final int x, final int y, final int z) { + super.onBlockAdded(world, x, y, z); + } + + @Override + public void breakBlock(final World world, final int x, final int y, final int z, final Block block, final int number) { + InventoryUtils.dropInventoryItems(world, x, y, z, block); + super.breakBlock(world, x, y, z, block, number); + } + + @Override + public void onBlockPlacedBy(final World world, final int x, final int y, final int z, final EntityLivingBase entity, final ItemStack stack) { + if (stack.hasDisplayName()) { + ((TileEntityRoundRobinator) world.getTileEntity(x,y,z)).setCustomName(stack.getDisplayName()); + } + } + + @Override + public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, final int z) { + return false; + } + +} \ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/container/Container_RoundRobinator.java b/src/Java/gtPlusPlus/core/container/Container_RoundRobinator.java new file mode 100644 index 0000000000..ad2aef02f8 --- /dev/null +++ b/src/Java/gtPlusPlus/core/container/Container_RoundRobinator.java @@ -0,0 +1,190 @@ +package gtPlusPlus.core.container; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.block.ModBlocks; +import gtPlusPlus.core.inventories.Inventory_RoundRobinator; +import gtPlusPlus.core.slots.SlotIntegratedCircuit; +import gtPlusPlus.core.slots.SlotNoInput; +import gtPlusPlus.core.tileentities.machines.TileEntityRoundRobinator; + +public class Container_RoundRobinator extends Container { + + protected TileEntityRoundRobinator tile_entity; + public final Inventory_RoundRobinator inventoryChest; + + private final World worldObj; + private final int posX; + private final int posY; + private final int posZ; + + public static final int SLOT_OUTPUT = 25; + + public static int StorageSlotNumber = 26; // Number of slots in storage area + public static int InventorySlotNumber = 36; // Inventory Slots (Inventory + // and Hotbar) + public static int FullSlotNumber = InventorySlotNumber + StorageSlotNumber; // All + // slots + + public Container_RoundRobinator(final InventoryPlayer inventory, final TileEntityRoundRobinator te) { + this.tile_entity = te; + this.inventoryChest = te.getInventory(); + + int var6; + int var7; + this.worldObj = te.getWorldObj(); + this.posX = te.xCoord; + this.posY = te.yCoord; + this.posZ = te.zCoord; + Logger.INFO("1"); + + int o = 0; + + // Storage Side + /*for (var6 = 0; var6 < 3; var6++) { + for (var7 = 0; var7 < 5; var7++) { + this.addSlotToContainer(new SlotIntegratedCircuit(o, this.inventoryChest, o, 44 + (var7 * 18), 15 + (var6 * 18))); + o++; + } + }*/ + + + int xStart = 8; + int yStart = 5; + + try { + //0 + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart, yStart)); + //1-10 + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+18, yStart)); + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+36, yStart)); + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+54, yStart)); + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+72, yStart)); + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+90, yStart)); + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+108, yStart)); + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+18, yStart+18)); + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+36, yStart+18)); + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+54, yStart+18)); + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+72, yStart+18)); + //11-20 + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+90, yStart+18)); + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+108, yStart+18)); + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+18, yStart+36)); + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+36, yStart+36)); + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+54, yStart+36)); + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+72, yStart+36)); + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+90, yStart+36)); + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+108, yStart+36)); + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+18, yStart+54)); + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+36, yStart+54)); + //21-24 + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+54, yStart+54)); + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+72, yStart+54)); + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+90, yStart+54)); + this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+108, yStart+54)); + Logger.INFO("2"); + + //Add Output + this.addSlotToContainer(new SlotNoInput(this.inventoryChest, SLOT_OUTPUT, xStart+(8*18), yStart+54)); + o++; + Logger.INFO("3"); + + + + // Player Inventory + for (var6 = 0; var6 < 3; ++var6) { + for (var7 = 0; var7 < 9; ++var7) { + this.addSlotToContainer(new Slot(inventory, var7 + (var6 * 9) + 9, 8 + (var7 * 18), 84 + (var6 * 18))); + } + } + // Player Hotbar + for (var6 = 0; var6 < 9; ++var6) { + this.addSlotToContainer(new Slot(inventory, var6, 8 + (var6 * 18), 142)); + } + + + + Logger.INFO("4"); + } + catch (Throwable t) {} + + } + + @Override + public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold, + final EntityPlayer aPlayer) { + + if (!aPlayer.worldObj.isRemote) { + if ((aSlotIndex == 999) || (aSlotIndex == -999)) { + // Utils.LOG_WARNING("??? - "+aSlotIndex); + } + } + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + + @Override + public void onContainerClosed(final EntityPlayer par1EntityPlayer) { + super.onContainerClosed(par1EntityPlayer); + } + + @Override + public boolean canInteractWith(final EntityPlayer par1EntityPlayer) { + if (this.worldObj.getBlock(this.posX, this.posY, this.posZ) != ModBlocks.blockRoundRobinator) { + return false; + } + + return par1EntityPlayer.getDistanceSq(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D) <= 64D; + } + + @Override + public ItemStack transferStackInSlot(final EntityPlayer par1EntityPlayer, final int par2) { + ItemStack var3 = null; + final Slot var4 = (Slot) this.inventorySlots.get(par2); + + if ((var4 != null) && var4.getHasStack()) { + final ItemStack var5 = var4.getStack(); + var3 = var5.copy(); + + /* + * if (par2 == 0) { if (!this.mergeItemStack(var5, + * InOutputSlotNumber, FullSlotNumber, true)) { return null; } + * + * var4.onSlotChange(var5, var3); } else if (par2 >= + * InOutputSlotNumber && par2 < InventoryOutSlotNumber) { if + * (!this.mergeItemStack(var5, InventoryOutSlotNumber, + * FullSlotNumber, false)) { return null; } } else if (par2 >= + * InventoryOutSlotNumber && par2 < FullSlotNumber) { if + * (!this.mergeItemStack(var5, InOutputSlotNumber, + * InventoryOutSlotNumber, false)) { return null; } } else if + * (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, + * false)) { return null; } + */ + + if (var5.stackSize == 0) { + var4.putStack((ItemStack) null); + } else { + var4.onSlotChanged(); + } + + if (var5.stackSize == var3.stackSize) { + return null; + } + + var4.onPickupFromSlot(par1EntityPlayer, var5); + } + + return var3; + } + + // Can merge Slot + @Override + public boolean func_94530_a(final ItemStack p_94530_1_, final Slot p_94530_2_) { + return super.func_94530_a(p_94530_1_, p_94530_2_); + } + +} \ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_RoundRobinator.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_RoundRobinator.java new file mode 100644 index 0000000000..7a9417c806 --- /dev/null +++ b/src/Java/gtPlusPlus/core/gui/machine/GUI_RoundRobinator.java @@ -0,0 +1,44 @@ +package gtPlusPlus.core.gui.machine; + +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.ResourceLocation; +import gtPlusPlus.core.container.Container_RoundRobinator; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.tileentities.machines.TileEntityRoundRobinator; + +@SideOnly(Side.CLIENT) +public class GUI_RoundRobinator extends GuiContainer { + + private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation(CORE.MODID, "textures/gui/RoundRobinator.png"); + + public GUI_RoundRobinator(final InventoryPlayer player_inventory, final TileEntityRoundRobinator te){ + super(new Container_RoundRobinator(player_inventory, te)); + } + + @Override + protected void drawGuiContainerForegroundLayer(final int i, final int j){ + super.drawGuiContainerForegroundLayer(i, j); + } + + @Override + protected void drawGuiContainerBackgroundLayer(final float f, final int i, final int j){ + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + this.mc.renderEngine.bindTexture(craftingTableGuiTextures); + final int x = (this.width - this.xSize) / 2; + final int y = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); + } + + //This method is called when the Gui is first called! + @Override + public void initGui(){ + super.initGui(); + } + +} \ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/handler/GuiHandler.java b/src/Java/gtPlusPlus/core/handler/GuiHandler.java index 67493d7964..2141210650 100644 --- a/src/Java/gtPlusPlus/core/handler/GuiHandler.java +++ b/src/Java/gtPlusPlus/core/handler/GuiHandler.java @@ -54,6 +54,7 @@ public class GuiHandler implements IGuiHandler { public static final int GUI13 = 12; // Decayables Chest public static final int GUI14 = 13; // Super Jukebox public static final int GUI15 = 14; // Pest Killer + public static final int GUI16 = 15; // Round-Robinator public static void init() { @@ -102,6 +103,8 @@ public class GuiHandler implements IGuiHandler { return new Container_SuperJukebox(player.inventory, (TileEntitySuperJukebox) te); } else if (ID == GUI15) { return new Container_PestKiller(player.inventory, (TileEntityPestKiller) te); + } else if (ID == GUI16) { + return new Container_RoundRobinator(player.inventory, (TileEntityRoundRobinator) te); } } @@ -162,7 +165,9 @@ public class GuiHandler implements IGuiHandler { return new GUI_SuperJukebox(player.inventory, (TileEntitySuperJukebox) te); } else if (ID == GUI15) { return new GUI_PestKiller(player.inventory, (TileEntityPestKiller) te); - } + } else if (ID == GUI16) { + return new GUI_RoundRobinator(player.inventory, (TileEntityRoundRobinator) te); + } } if (ID == GUI9) { diff --git a/src/Java/gtPlusPlus/core/inventories/Inventory_RoundRobinator.java b/src/Java/gtPlusPlus/core/inventories/Inventory_RoundRobinator.java new file mode 100644 index 0000000000..58d60b595f --- /dev/null +++ b/src/Java/gtPlusPlus/core/inventories/Inventory_RoundRobinator.java @@ -0,0 +1,173 @@ +package gtPlusPlus.core.inventories; + +import gtPlusPlus.core.recipe.common.CI; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; + +public class Inventory_RoundRobinator implements IInventory{ + + private final String name = "Circuit Programmer"; + + /** Defining your inventory size this way is handy */ + public static final int INV_SIZE = 26; + + /** Inventory's size must be same as number of slots you add to the Container class */ + private ItemStack[] inventory = new ItemStack[INV_SIZE]; + + public void readFromNBT(final NBTTagCompound nbt){ + final NBTTagList list = nbt.getTagList("Items", 10); + this.inventory = new ItemStack[INV_SIZE]; + for(int i = 0;i= 0) && (slot < INV_SIZE)){ + //Utils.LOG_INFO("Trying to read NBT data from inventory."); + this.inventory[slot] = ItemStack.loadItemStackFromNBT(data); + } + } + } + + public void writeToNBT(final NBTTagCompound nbt){ + final NBTTagList list = new NBTTagList(); + for(int i = 0;i amount) + { + stack = stack.splitStack(amount); + // Don't forget this line or your inventory will not be saved! + this.markDirty(); + } + else + { + // this method also calls markDirty, so we don't need to call it again + this.setInventorySlotContents(slot, null); + } + } + return stack; + } + + @Override + public ItemStack getStackInSlotOnClosing(final int slot) + { + final ItemStack stack = this.getStackInSlot(slot); + this.setInventorySlotContents(slot, null); + return stack; + } + + @Override + public void setInventorySlotContents(final int slot, final ItemStack stack) + { + this.inventory[slot] = stack; + + if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit())) + { + stack.stackSize = this.getInventoryStackLimit(); + } + + // Don't forget this line or your inventory will not be saved! + this.markDirty(); + } + + // 1.7.2+ renamed to getInventoryName + @Override + public String getInventoryName() + { + return this.name; + } + + // 1.7.2+ renamed to hasCustomInventoryName + @Override + public boolean hasCustomInventoryName() + { + return this.name.length() > 0; + } + + @Override + public int getInventoryStackLimit() + { + return 64; + } + + /** + * This is the method that will handle saving the inventory contents, as it is called (or should be called!) + * anytime the inventory changes. Perfect. Much better than using onUpdate in an Item, as this will also + * let you change things in your inventory without ever opening a Gui, if you want. + */ + // 1.7.2+ renamed to markDirty + @Override + public void markDirty() + { + for (int i = 0; i < this.getSizeInventory(); ++i) + { + final ItemStack temp = this.getStackInSlot(i); + if (temp != null){ + //Utils.LOG_INFO("Slot "+i+" contains "+temp.getDisplayName()+" x"+temp.stackSize); + } + + if ((temp != null) && (temp.stackSize == 0)) { + this.inventory[i] = null; + } + } + } + + @Override + public boolean isUseableByPlayer(final EntityPlayer entityplayer) + { + return true; + } + + // 1.7.2+ renamed to openInventory(EntityPlayer player) + @Override + public void openInventory() {} + + // 1.7.2+ renamed to closeInventory(EntityPlayer player) + @Override + public void closeInventory() {} + + /** + * This method doesn't seem to do what it claims to do, as + * items can still be left-clicked and placed in the inventory + * even when this returns false + */ + @Override + public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) { + return (itemstack.getItem() == CI.getNumberedCircuit(0).getItem()); + } + +} \ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java index 21ea826eea..73d6bb0ca2 100644 --- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java +++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java @@ -44,6 +44,11 @@ public class ItemBlockBasicTile extends ItemBlock { list.add("Kills Forestry Butterflies, Bats and other pests"); list.add("Use either Formaldehyde or Hydrogen cyanide"); list.add("Be weary of your neighbours"); + } else if (this.mID == 7) { // Round-Robinator + list.add("Attempts to output items evenly on all for horizontal planes"); + list.add("Each tier operates at a factor of one operation every (20/tier)ticks"); + list.add("Top and bottom do not pull, so you must push item in"); + list.add("Sides can be disabled with a screwdriver"); } else { list.add("Bad Tooltip ID - " + mID); diff --git a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityRoundRobinator.java b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityRoundRobinator.java new file mode 100644 index 0000000000..13ba5ca44d --- /dev/null +++ b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityRoundRobinator.java @@ -0,0 +1,291 @@ +package gtPlusPlus.core.tileentities.machines; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.ISidedInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.tileentity.TileEntity; +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.core.inventories.Inventory_RoundRobinator; +import gtPlusPlus.core.recipe.common.CI; +import gtPlusPlus.core.util.minecraft.PlayerUtils; + +public class TileEntityRoundRobinator extends TileEntity implements ISidedInventory { + + private int tickCount = 0; + private final Inventory_RoundRobinator inventoryContents; + private String customName; + public int locationX; + public int locationY; + public int locationZ; + private int aCurrentMode = 0; + + public TileEntityRoundRobinator() { + this.inventoryContents = new Inventory_RoundRobinator(); + this.setTileLocation(); + } + + public boolean setTileLocation() { + if (this.hasWorldObj()) { + if (!this.getWorldObj().isRemote) { + this.locationX = this.xCoord; + this.locationY = this.yCoord; + this.locationZ = this.zCoord; + return true; + } + } + return false; + } + + //Rename to hasCircuitToConfigure + public final boolean hasCircuitToConfigure() { + for (ItemStack i : this.getInventory().getInventory()) { + if (i == null) { + continue; + } + else { + return true; + } + } + return false; + } + + public Inventory_RoundRobinator getInventory() { + return this.inventoryContents; + } + + public boolean addOutput() { + ItemStack[] aInputs = this.getInventory().getInventory().clone(); + //Check if there is output in slot. + Boolean hasOutput = false; + if (aInputs[25] != null) { + hasOutput = true; + } + AutoMap aValidSlots = new AutoMap(); + int aSlotCount = 0; + for (ItemStack i : aInputs) { + if (i != null) { + aValidSlots.put(aSlotCount); + } + aSlotCount++; + } + for (int e : aValidSlots) { + boolean doAdd = false; + ItemStack g = this.getStackInSlot(e); + int aSize = 0; + ItemStack aInputStack = null; + if (g != null) { + if (!hasOutput) { + aSize = g.stackSize; + doAdd = true; + } + else { + ItemStack f = this.getStackInSlot(25); + if (f != null) { + if (f.getItemDamage() == e) { + aSize = f.stackSize + g.stackSize; + if (aSize > 64) { + aInputStack = g.copy(); + aInputStack.stackSize = (aSize-64); + } + doAdd = true; + } + } + else { + doAdd = true; + aSize = g.stackSize; + } + } + if (doAdd) { + ItemStack aOutput = CI.getNumberedCircuit(e); + if (aOutput != null) { + aOutput.stackSize = aSize; + this.setInventorySlotContents(e, aInputStack); + this.setInventorySlotContents(25, aOutput); + return true; + } + } + } + continue; + } + return false; + } + + @Override + public void updateEntity() { + try{ + if (!this.worldObj.isRemote) { + if (tickCount % 10 == 0) { + if (hasCircuitToConfigure()) { + this.addOutput(); + this.markDirty(); + } + } + this.tickCount++; + } + } + catch (final Throwable t){} + } + + public boolean anyPlayerInRange() { + return this.worldObj.getClosestPlayer(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D, 32) != null; + } + + public NBTTagCompound getTag(final NBTTagCompound nbt, final String tag) { + if (!nbt.hasKey(tag)) { + nbt.setTag(tag, new NBTTagCompound()); + } + return nbt.getCompoundTag(tag); + } + + @Override + public void writeToNBT(final NBTTagCompound nbt) { + super.writeToNBT(nbt); + // Utils.LOG_WARNING("Trying to write NBT data to TE."); + final NBTTagCompound chestData = new NBTTagCompound(); + this.inventoryContents.writeToNBT(chestData); + nbt.setTag("ContentsChest", chestData); + if (this.hasCustomInventoryName()) { + nbt.setString("CustomName", this.getCustomName()); + } + nbt.setInteger("aCurrentMode", aCurrentMode); + } + + @Override + public void readFromNBT(final NBTTagCompound nbt) { + super.readFromNBT(nbt); + // Utils.LOG_WARNING("Trying to read NBT data from TE."); + this.inventoryContents.readFromNBT(nbt.getCompoundTag("ContentsChest")); + if (nbt.hasKey("CustomName", 8)) { + this.setCustomName(nbt.getString("CustomName")); + } + aCurrentMode = nbt.getInteger("aCurrentMode"); + } + + @Override + public int getSizeInventory() { + return this.getInventory().getSizeInventory(); + } + + @Override + public ItemStack getStackInSlot(final int slot) { + return this.getInventory().getStackInSlot(slot); + } + + @Override + public ItemStack decrStackSize(final int slot, final int count) { + return this.getInventory().decrStackSize(slot, count); + } + + @Override + public ItemStack getStackInSlotOnClosing(final int slot) { + return this.getInventory().getStackInSlotOnClosing(slot); + } + + @Override + public void setInventorySlotContents(final int slot, final ItemStack stack) { + this.getInventory().setInventorySlotContents(slot, stack); + } + + @Override + public int getInventoryStackLimit() { + return this.getInventory().getInventoryStackLimit(); + } + + @Override + public boolean isUseableByPlayer(final EntityPlayer entityplayer) { + return this.getInventory().isUseableByPlayer(entityplayer); + } + + @Override + public void openInventory() { + this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, 1); + this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); + this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord - 1, this.zCoord, this.getBlockType()); + this.getInventory().openInventory(); + } + + @Override + public void closeInventory() { + this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, 1); + this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); + this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord - 1, this.zCoord, this.getBlockType()); + this.getInventory().closeInventory(); + } + + @Override + public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) { + return this.getInventory().isItemValidForSlot(slot, itemstack); + } + + @Override + public int[] getAccessibleSlotsFromSide(final int p_94128_1_) { + final int[] accessibleSides = new int[this.getSizeInventory()]; + for (int r=0; r= 0 && p_102007_1_ <= 24; + } + + @Override + public boolean canExtractItem(final int p_102008_1_, final ItemStack p_102008_2_, final int p_102008_3_) { + return p_102008_1_ == 25; + } + + public String getCustomName() { + return this.customName; + } + + public void setCustomName(final String customName) { + this.customName = customName; + } + + @Override + public String getInventoryName() { + return this.hasCustomInventoryName() ? this.customName : "container.circuitprogrammer"; + } + + @Override + public boolean hasCustomInventoryName() { + return (this.customName != null) && !this.customName.equals(""); + } + + @Override + public Packet getDescriptionPacket() { + final NBTTagCompound tag = new NBTTagCompound(); + this.writeToNBT(tag); + return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, this.blockMetadata, tag); + } + + @Override + public void onDataPacket(final NetworkManager net, final S35PacketUpdateTileEntity pkt) { + final NBTTagCompound tag = pkt.func_148857_g(); + this.readFromNBT(tag); + } + + public boolean onScrewdriverRightClick(byte side, EntityPlayer player, int x, int y, int z) { + try { + if (aCurrentMode == 24) { + aCurrentMode = 0; + } + else { + aCurrentMode++; + } + PlayerUtils.messagePlayer(player, "Now configuring units for type "+aCurrentMode+"."); + return true; + } + catch (Throwable t) { + return false; + } + } + +} -- cgit From 9d467e9912c8dbe8567e2925c4a5c538c0be5630 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Fri, 11 Oct 2019 18:32:07 +0100 Subject: % Adjusted tooltip for RR. $ Fixed registration of RR. --- src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java | 2 +- src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src/Java/gtPlusPlus/core/tileentities') diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java index 73d6bb0ca2..c52eb0d222 100644 --- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java +++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java @@ -45,7 +45,7 @@ public class ItemBlockBasicTile extends ItemBlock { list.add("Use either Formaldehyde or Hydrogen cyanide"); list.add("Be weary of your neighbours"); } else if (this.mID == 7) { // Round-Robinator - list.add("Attempts to output items evenly on all for horizontal planes"); + list.add("Attempts to output items evenly on all four horizontal planes"); list.add("Each tier operates at a factor of one operation every (20/tier)ticks"); list.add("Top and bottom do not pull, so you must push item in"); list.add("Sides can be disabled with a screwdriver"); diff --git a/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java b/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java index ada0fd7b86..e7b7c46e7b 100644 --- a/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java +++ b/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java @@ -17,6 +17,7 @@ import gtPlusPlus.core.tileentities.machines.TileEntityModularityTable; import gtPlusPlus.core.tileentities.machines.TileEntityPestKiller; import gtPlusPlus.core.tileentities.machines.TileEntityPooCollector; import gtPlusPlus.core.tileentities.machines.TileEntityProjectTable; +import gtPlusPlus.core.tileentities.machines.TileEntityRoundRobinator; import gtPlusPlus.core.tileentities.machines.TileEntityTradeTable; import gtPlusPlus.core.tileentities.machines.TileEntityWorkbench; import gtPlusPlus.core.tileentities.machines.TileEntityWorkbenchAdvanced; @@ -44,6 +45,7 @@ public class ModTileEntities { GameRegistry.registerTileEntity(TileEntitySuperJukebox.class, "TileEntitySuperJukebox"); GameRegistry.registerTileEntity(TileEntitySuperLight.class, "TileEntitySuperLight"); GameRegistry.registerTileEntity(TileEntityPestKiller.class, "TileEntityPestKiller"); + GameRegistry.registerTileEntity(TileEntityRoundRobinator.class, "TileEntityRoundRobinator"); //Mod TEs -- cgit From 82f4a138efb59d8fdc4a492a190d3c8d7c53fbff Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Sun, 13 Oct 2019 21:54:43 +0100 Subject: + Added Round-Robinator recipes. % Adjusted Zirconium Carbide tier, and changed the materials used for LV tiered recipes. % Finished work on the Round-Robinator logic. $ Removed PSS log spam. $ Many minor bug fixes. --- src/Java/gtPlusPlus/api/objects/data/AutoMap.java | 7 +- .../gtPlusPlus/api/objects/minecraft/BlockPos.java | 2 +- .../api/objects/minecraft/FakeBlockPos.java | 2 +- src/Java/gtPlusPlus/api/objects/random/XSTR.java | 7 + .../core/block/machine/Machine_RoundRobinator.java | 78 ++- .../core/container/Container_RoundRobinator.java | 247 +++++--- .../core/gui/machine/GUI_RoundRobinator.java | 86 ++- src/Java/gtPlusPlus/core/handler/GuiHandler.java | 46 +- .../core/inventories/Inventory_RoundRobinator.java | 7 +- .../core/item/base/dusts/BaseItemDust.java | 3 +- .../core/item/base/dusts/BaseItemDustUnique.java | 2 +- .../item/base/itemblock/ItemBlockBasicTile.java | 6 +- .../base/itemblock/ItemBlockRoundRobinator.java | 111 ++++ .../core/item/bauble/FireProtectionBauble.java | 2 +- .../gtPlusPlus/core/recipe/RECIPES_Machines.java | 43 ++ src/Java/gtPlusPlus/core/recipe/common/CI.java | 6 +- .../machines/TileEntityRoundRobinator.java | 695 +++++++++++++++++---- .../gtPlusPlus/nei/DecayableRecipeHandler.java | 28 +- .../gtPlusPlus/nei/GT_NEI_MultiBlockHandler.java | 2 +- .../plugin/fixes/vanilla/VanillaBedHeightFix.java | 2 +- src/Java/gtPlusPlus/preloader/DevHelper.java | 2 +- ...chMetaTileEntity_PowerSubStationController.java | 5 +- src/resources/assets/miscutils/lang/en_US.lang | 11 +- .../RoundRobinator/RoundRobinator_Side_0.png | Bin 0 -> 1448 bytes .../RoundRobinator/RoundRobinator_Side_1.png | Bin 0 -> 1444 bytes .../RoundRobinator/RoundRobinator_Side_2.png | Bin 0 -> 1446 bytes .../RoundRobinator/RoundRobinator_Side_3.png | Bin 0 -> 1446 bytes .../RoundRobinator/RoundRobinator_Side_4.png | Bin 0 -> 1443 bytes .../RoundRobinator/RoundRobinator_Top_0.png | Bin 0 -> 1405 bytes .../RoundRobinator/RoundRobinator_Top_1.png | Bin 0 -> 1403 bytes .../RoundRobinator/RoundRobinator_Top_2.png | Bin 0 -> 1403 bytes .../RoundRobinator/RoundRobinator_Top_3.png | Bin 0 -> 1402 bytes .../RoundRobinator/RoundRobinator_Top_4.png | Bin 0 -> 1400 bytes .../miscutils/textures/gui/RoundRobinator.png | Bin 0 -> 1648 bytes 34 files changed, 1113 insertions(+), 287 deletions(-) create mode 100644 src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockRoundRobinator.java create mode 100644 src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Side_0.png create mode 100644 src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Side_1.png create mode 100644 src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Side_2.png create mode 100644 src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Side_3.png create mode 100644 src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Side_4.png create mode 100644 src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Top_0.png create mode 100644 src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Top_1.png create mode 100644 src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Top_2.png create mode 100644 src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Top_3.png create mode 100644 src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Top_4.png create mode 100644 src/resources/assets/miscutils/textures/gui/RoundRobinator.png (limited to 'src/Java/gtPlusPlus/core/tileentities') diff --git a/src/Java/gtPlusPlus/api/objects/data/AutoMap.java b/src/Java/gtPlusPlus/api/objects/data/AutoMap.java index 3583a04a74..9e7f702200 100644 --- a/src/Java/gtPlusPlus/api/objects/data/AutoMap.java +++ b/src/Java/gtPlusPlus/api/objects/data/AutoMap.java @@ -212,11 +212,12 @@ public class AutoMap implements Iterable, Cloneable, Serializable, Collect @Override public boolean retainAll(Collection c) { - AutoMap aTempAllocation = new AutoMap(); + AutoMap aTempAllocation = new AutoMap(); boolean aTrue = false; aTempAllocation = this; - aTempAllocation.removeAll(c); - aTrue = this.removeAll(aTempAllocation); + aTempAllocation.removeAll(c); + aTempAllocation.clear(); + aTrue = aTempAllocation.isEmpty(); aTempAllocation.clear(); return aTrue; } diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/BlockPos.java b/src/Java/gtPlusPlus/api/objects/minecraft/BlockPos.java index 7c11e7232b..ab359c3853 100644 --- a/src/Java/gtPlusPlus/api/objects/minecraft/BlockPos.java +++ b/src/Java/gtPlusPlus/api/objects/minecraft/BlockPos.java @@ -19,7 +19,7 @@ public class BlockPos implements Serializable{ public final int yPos; public final int zPos; public final int dim; - public final World world; + public final transient World world; public static BlockPos generateBlockPos(String sUUID) { String[] s2 = sUUID.split("@"); diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/FakeBlockPos.java b/src/Java/gtPlusPlus/api/objects/minecraft/FakeBlockPos.java index d0c1f3f040..d5db8081dc 100644 --- a/src/Java/gtPlusPlus/api/objects/minecraft/FakeBlockPos.java +++ b/src/Java/gtPlusPlus/api/objects/minecraft/FakeBlockPos.java @@ -12,7 +12,7 @@ import net.minecraftforge.common.DimensionManager; public class FakeBlockPos extends BlockPos { private static final long serialVersionUID = -6442245826092414593L; - private Block aBlockAtPos; + private transient Block aBlockAtPos; private int aBlockMetaAtPos = 0; public static FakeBlockPos generateBlockPos(String sUUID) { diff --git a/src/Java/gtPlusPlus/api/objects/random/XSTR.java b/src/Java/gtPlusPlus/api/objects/random/XSTR.java index 6357e9895c..6ce1cbeb6c 100644 --- a/src/Java/gtPlusPlus/api/objects/random/XSTR.java +++ b/src/Java/gtPlusPlus/api/objects/random/XSTR.java @@ -115,6 +115,13 @@ public class XSTR extends Random implements Cloneable { */ @Override public XSTR clone() { + try { + super.clone(); + } + catch (CloneNotSupportedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } return new XSTR(this.getSeed()); } diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_RoundRobinator.java b/src/Java/gtPlusPlus/core/block/machine/Machine_RoundRobinator.java index 71814cb868..8ba7c2533b 100644 --- a/src/Java/gtPlusPlus/core/block/machine/Machine_RoundRobinator.java +++ b/src/Java/gtPlusPlus/core/block/machine/Machine_RoundRobinator.java @@ -1,14 +1,25 @@ package gtPlusPlus.core.block.machine; +import java.util.List; + import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.common.items.GT_MetaGenerated_Tool_01; +import gtPlusPlus.api.interfaces.ITileTooltip; +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.item.base.itemblock.ItemBlockRoundRobinator; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.tileentities.machines.TileEntityRoundRobinator; +import gtPlusPlus.core.util.minecraft.InventoryUtils; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.minecraft.PlayerUtils; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EnumCreatureType; import net.minecraft.entity.player.EntityPlayer; @@ -19,24 +30,12 @@ import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import gtPlusPlus.GTplusplus; -import gtPlusPlus.api.interfaces.ITileTooltip; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.handler.GuiHandler; -import gtPlusPlus.core.item.base.itemblock.ItemBlockBasicTile; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.tileentities.machines.TileEntityRoundRobinator; -import gtPlusPlus.core.util.minecraft.InventoryUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; - public class Machine_RoundRobinator extends BlockContainer implements ITileTooltip { @SideOnly(Side.CLIENT) - private IIcon textureTop; - @SideOnly(Side.CLIENT) - private IIcon textureBottom; + private IIcon[] textureTop = new IIcon[5]; @SideOnly(Side.CLIENT) - private IIcon textureFront; + private IIcon[] textureFront = new IIcon[5]; /** * Determines which tooltip is displayed within the itemblock. @@ -55,8 +54,8 @@ public class Machine_RoundRobinator extends BlockContainer implements ITileToolt this.setResistance(1f); this.setBlockName("blockRoundRobinator"); this.setCreativeTab(AddToCreativeTab.tabMachines); - GameRegistry.registerBlock(this, ItemBlockBasicTile.class, "blockRoundRobinator"); - LanguageRegistry.addName(this, "Round-Robinator"); + GameRegistry.registerBlock(this, ItemBlockRoundRobinator.class, "blockRoundRobinator"); + //LanguageRegistry.addName(this, "Round-Robinator"); } @@ -65,19 +64,23 @@ public class Machine_RoundRobinator extends BlockContainer implements ITileToolt */ @Override @SideOnly(Side.CLIENT) - public IIcon getIcon(final int p_149691_1_, final int p_149691_2_) - { - return p_149691_1_ == 1 ? this.textureTop : (p_149691_1_ == 0 ? this.textureBottom : (this.textureFront)); + public IIcon getIcon(final int aSide, final int aMeta) { + if (aSide < 2) { + return this.textureTop[aMeta]; + } + else { + return this.textureFront[aMeta]; + } } @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(final IIconRegister p_149651_1_) - { - this.blockIcon = p_149651_1_.registerIcon(CORE.MODID + ":" + "metro/" + "TEXTURE_TECH_PANEL_B"); - this.textureTop = p_149651_1_.registerIcon(CORE.MODID + ":" + "metro/" + "TEXTURE_TECH_PANEL_B"); - this.textureBottom = p_149651_1_.registerIcon(CORE.MODID + ":" + "metro/" + "TEXTURE_METAL_PANEL_G"); - this.textureFront = p_149651_1_.registerIcon(CORE.MODID + ":" + "metro/" + "TEXTURE_METAL_PANEL_I"); + public void registerBlockIcons(final IIconRegister p_149651_1_){ + this.blockIcon = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "RoundRobinator_Side"); + for (int i=0;i<5;i++) { + this.textureTop[i] = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/RoundRobinator/" + "RoundRobinator_Top_"+i); + this.textureFront[i] = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/RoundRobinator/" + "RoundRobinator_Side_"+i); + } } /** @@ -109,16 +112,14 @@ public class Machine_RoundRobinator extends BlockContainer implements ITileToolt if (!mDidScrewDriver) { final TileEntity te = world.getTileEntity(x, y, z); if ((te != null) && (te instanceof TileEntityRoundRobinator)){ - player.openGui(GTplusplus.instance, GuiHandler.GUI16, world, x, y, z); - return true; + return ((TileEntityRoundRobinator) te).onRightClick((byte) side, player, x, y, z); } + return false; } else { return true; - } - + } } - return false; } @Override @@ -149,9 +150,7 @@ public class Machine_RoundRobinator extends BlockContainer implements ITileToolt @Override public void onBlockPlacedBy(final World world, final int x, final int y, final int z, final EntityLivingBase entity, final ItemStack stack) { - if (stack.hasDisplayName()) { - ((TileEntityRoundRobinator) world.getTileEntity(x,y,z)).setCustomName(stack.getDisplayName()); - } + super.onBlockPlacedBy(world, x, y, z, entity, stack); } @Override @@ -159,4 +158,17 @@ public class Machine_RoundRobinator extends BlockContainer implements ITileToolt return false; } + @Override + public void getSubBlocks(Item aItem, CreativeTabs p_149666_2_, List aList) { + //super.getSubBlocks(aItem, p_149666_2_, aList); + for (int i=0;i<5;i++) { + aList.add(ItemUtils.simpleMetaStack(aItem, i, 1)); + } + } + + @Override + public IIcon getIcon(IBlockAccess aBlockAccess, int x, int y, int z, int aSide) { + return super.getIcon(aBlockAccess, x, y, z, aSide); + } + } \ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/container/Container_RoundRobinator.java b/src/Java/gtPlusPlus/core/container/Container_RoundRobinator.java index ad2aef02f8..0da2933dfa 100644 --- a/src/Java/gtPlusPlus/core/container/Container_RoundRobinator.java +++ b/src/Java/gtPlusPlus/core/container/Container_RoundRobinator.java @@ -1,39 +1,52 @@ package gtPlusPlus.core.container; +import java.util.Iterator; + +import org.apache.commons.lang3.ArrayUtils; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.enums.GT_Values; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.block.ModBlocks; +import gtPlusPlus.core.inventories.Inventory_RoundRobinator; +import gtPlusPlus.core.slots.SlotNoInput; +import gtPlusPlus.core.tileentities.machines.TileEntityRoundRobinator; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; +import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.inventories.Inventory_RoundRobinator; -import gtPlusPlus.core.slots.SlotIntegratedCircuit; -import gtPlusPlus.core.slots.SlotNoInput; -import gtPlusPlus.core.tileentities.machines.TileEntityRoundRobinator; public class Container_RoundRobinator extends Container { - protected TileEntityRoundRobinator tile_entity; + public TileEntityRoundRobinator tile_entity; public final Inventory_RoundRobinator inventoryChest; private final World worldObj; private final int posX; private final int posY; private final int posZ; + + private final boolean[] mActiveData = new boolean[] {false, false, false, false}; - public static final int SLOT_OUTPUT = 25; - - public static int StorageSlotNumber = 26; // Number of slots in storage area - public static int InventorySlotNumber = 36; // Inventory Slots (Inventory + public static int mStorageSlotNumber = 4; // Number of slots in storage area + public static int mInventorySlotNumber = 36; // Inventory Slots (Inventory // and Hotbar) - public static int FullSlotNumber = InventorySlotNumber + StorageSlotNumber; // All + public static int mFullSlotNumber = mInventorySlotNumber + mStorageSlotNumber; // All // slots public Container_RoundRobinator(final InventoryPlayer inventory, final TileEntityRoundRobinator te) { this.tile_entity = te; this.inventoryChest = te.getInventory(); + boolean [] aTemp = te.getActiveSides(); + if (aTemp != null && aTemp.length == 4) { + for (int i=0;i<4;i++) { + mActiveData[i] = aTemp[i]; + } + } int var6; int var7; @@ -54,44 +67,20 @@ public class Container_RoundRobinator extends Container { }*/ - int xStart = 8; - int yStart = 5; + int xStart = 134; + int yStart = 32; try { //0 - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart, yStart)); - //1-10 - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+18, yStart)); - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+36, yStart)); - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+54, yStart)); - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+72, yStart)); - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+90, yStart)); - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+108, yStart)); - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+18, yStart+18)); - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+36, yStart+18)); - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+54, yStart+18)); - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+72, yStart+18)); - //11-20 - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+90, yStart+18)); - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+108, yStart+18)); - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+18, yStart+36)); - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+36, yStart+36)); - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+54, yStart+36)); - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+72, yStart+36)); - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+90, yStart+36)); - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+108, yStart+36)); - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+18, yStart+54)); - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+36, yStart+54)); - //21-24 - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+54, yStart+54)); - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+72, yStart+54)); - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+90, yStart+54)); - this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+108, yStart+54)); + this.addSlotToContainer(new SlotNoInput(this.inventoryChest, o++, xStart, yStart)); + this.addSlotToContainer(new SlotNoInput(this.inventoryChest, o++, xStart+18, yStart)); + this.addSlotToContainer(new SlotNoInput(this.inventoryChest, o++, xStart, yStart+17)); + this.addSlotToContainer(new SlotNoInput(this.inventoryChest, o++, xStart+18, yStart+17)); Logger.INFO("2"); //Add Output - this.addSlotToContainer(new SlotNoInput(this.inventoryChest, SLOT_OUTPUT, xStart+(8*18), yStart+54)); - o++; + //this.addSlotToContainer(new SlotNoInput(this.inventoryChest, SLOT_OUTPUT, xStart+(8*18), yStart+54)); + //o++; Logger.INFO("3"); @@ -112,6 +101,7 @@ public class Container_RoundRobinator extends Container { Logger.INFO("4"); } catch (Throwable t) {} + this.detectAndSendChanges(); } @@ -121,10 +111,14 @@ public class Container_RoundRobinator extends Container { if (!aPlayer.worldObj.isRemote) { if ((aSlotIndex == 999) || (aSlotIndex == -999)) { - // Utils.LOG_WARNING("??? - "+aSlotIndex); + } + else if (aSlotIndex < 4) { + this.tile_entity.toggleSide(aSlotIndex+2); + Logger.INFO("Toggling side: "+(aSlotIndex+2)+" | Active: "+this.tile_entity.getSideActive(aSlotIndex+2)+" | Data:"+this.tile_entity.getDataString()); } } - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + return GT_Values.NI; + //return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); } @Override @@ -140,51 +134,136 @@ public class Container_RoundRobinator extends Container { return par1EntityPlayer.getDistanceSq(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D) <= 64D; } + - @Override - public ItemStack transferStackInSlot(final EntityPlayer par1EntityPlayer, final int par2) { - ItemStack var3 = null; - final Slot var4 = (Slot) this.inventorySlots.get(par2); - - if ((var4 != null) && var4.getHasStack()) { - final ItemStack var5 = var4.getStack(); - var3 = var5.copy(); - - /* - * if (par2 == 0) { if (!this.mergeItemStack(var5, - * InOutputSlotNumber, FullSlotNumber, true)) { return null; } - * - * var4.onSlotChange(var5, var3); } else if (par2 >= - * InOutputSlotNumber && par2 < InventoryOutSlotNumber) { if - * (!this.mergeItemStack(var5, InventoryOutSlotNumber, - * FullSlotNumber, false)) { return null; } } else if (par2 >= - * InventoryOutSlotNumber && par2 < FullSlotNumber) { if - * (!this.mergeItemStack(var5, InOutputSlotNumber, - * InventoryOutSlotNumber, false)) { return null; } } else if - * (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, - * false)) { return null; } - */ - - if (var5.stackSize == 0) { - var4.putStack((ItemStack) null); - } else { - var4.onSlotChanged(); - } - if (var5.stackSize == var3.stackSize) { - return null; - } + public final void addCraftingToCrafters(ICrafting par1ICrafting) { + try { + super.addCraftingToCrafters(par1ICrafting); + } catch (Throwable var3) { + + } + } + + public final void removeCraftingFromCrafters(ICrafting par1ICrafting) { + try { + super.removeCraftingFromCrafters(par1ICrafting); + } catch (Throwable var3) { + } + } - var4.onPickupFromSlot(par1EntityPlayer, var5); + public final void detectAndSendChanges() { + try { + super.detectAndSendChanges(); + detectAndSendChangesEx(); + } catch (Throwable var2) { } + } - return var3; + public final void updateProgressBar(int par1, int par2) { + try { + super.updateProgressBar(par1, par2); + updateProgressBarEx(par1, par2); + } catch (Throwable var4) { + } } + + + public int mSide_1 = 0; + public int mSide_2 = 0; + public int mSide_3 = 0; + public int mSide_4 = 0; + public int mTier = 1; + public int mTickRate = 50; + + private int oSide_1 = 0; + private int oSide_2 = 0; + private int oSide_3 = 0; + private int oSide_4 = 0; + private int oTier = 1; + private int oTickRate = 50; + + private int mTimer = 0; + + + + public void detectAndSendChangesEx() { + super.detectAndSendChanges(); + if (!this.tile_entity.getWorldObj().isRemote) { + boolean [] aTemp = tile_entity.getActiveSides(); + for (int i=0;i<4;i++) { + mActiveData[i] = aTemp[i]; + } + this.mSide_1 = aTemp[0] ? 1 : 0; + this.mSide_2 = aTemp[1] ? 1 : 0; + this.mSide_3 = aTemp[2] ? 1 : 0; + this.mSide_4 = aTemp[3] ? 1 : 0; + this.mTier = this.tile_entity.getTier(); + this.mTickRate = this.tile_entity.getTickRate(); + + String InventoryContents = ArrayUtils.toString(aTemp, "null"); + //Logger.INFO("Test: "+InventoryContents); + ++this.mTimer; + Iterator var2 = this.crafters.iterator(); + + while (true) { + ICrafting var1; + do { + if (!var2.hasNext()) { + this.oSide_1 = this.mSide_1; + this.oSide_2 = this.mSide_2; + this.oSide_3 = this.mSide_3; + this.oSide_4 = this.mSide_4; + this.oTier = this.mTier; + this.oTickRate = this.mTickRate; + return; + } + var1 = (ICrafting) var2.next(); + if (this.mTimer % 500 == 10 || this.oSide_1 != this.mSide_1) { + var1.sendProgressBarUpdate(this, 2, this.mSide_1); + } + if (this.mTimer % 500 == 10 || this.oSide_2 != this.mSide_2) { + var1.sendProgressBarUpdate(this, 4, this.mSide_2); + } + if (this.mTimer % 500 == 10 || this.oSide_3 != this.mSide_3) { + var1.sendProgressBarUpdate(this, 6, this.mSide_3); + } + if (this.mTimer % 500 == 10 || this.oSide_4 != this.mSide_4) { + var1.sendProgressBarUpdate(this, 8, this.mSide_4); + } + if (this.mTimer % 500 == 10 || this.oTier != this.mTier) { + var1.sendProgressBarUpdate(this, 10, this.mTier); + } + if (this.mTimer % 500 == 10 || this.oTickRate != this.mTickRate) { + var1.sendProgressBarUpdate(this, 12, this.mTickRate); + } + } while (this.mTimer % 500 != 10); + + } + } + } + + @SideOnly(Side.CLIENT) + public void updateProgressBarEx(int par1, int par2) { + super.updateProgressBar(par1, par2); + switch (par1) { + case 2 : + this.mSide_1 = par2; + break; + case 4 : + this.mSide_2 = par2; + break; + case 6 : + this.mSide_3 = par2; + case 8 : + this.mSide_4 = par2; + case 10 : + this.mTier = par2; + case 12 : + this.mTickRate = par2; + break; + } - // Can merge Slot - @Override - public boolean func_94530_a(final ItemStack p_94530_1_, final Slot p_94530_2_) { - return super.func_94530_a(p_94530_1_, p_94530_2_); } } \ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_RoundRobinator.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_RoundRobinator.java index 7a9417c806..c5a8341d8a 100644 --- a/src/Java/gtPlusPlus/core/gui/machine/GUI_RoundRobinator.java +++ b/src/Java/gtPlusPlus/core/gui/machine/GUI_RoundRobinator.java @@ -1,29 +1,75 @@ package gtPlusPlus.core.gui.machine; +import java.lang.reflect.Field; +import java.lang.reflect.Method; + import org.lwjgl.opengl.GL11; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.ResourceLocation; import gtPlusPlus.core.container.Container_RoundRobinator; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.tileentities.machines.TileEntityRoundRobinator; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; @SideOnly(Side.CLIENT) public class GUI_RoundRobinator extends GuiContainer { private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation(CORE.MODID, "textures/gui/RoundRobinator.png"); + private TileEntityRoundRobinator mTile; + private Container_RoundRobinator mContainer; + private static final Method mDrawItemStack; + + static { + mDrawItemStack = ReflectionUtils.getMethod(GuiContainer.class, "drawItemStack", new Class[] {ItemStack.class, int.class, int.class, String.class}); + } public GUI_RoundRobinator(final InventoryPlayer player_inventory, final TileEntityRoundRobinator te){ - super(new Container_RoundRobinator(player_inventory, te)); + this(new Container_RoundRobinator(player_inventory, te)); + mTile = te; + } + + private GUI_RoundRobinator(final Container_RoundRobinator aContainer){ + super(aContainer); + mContainer = aContainer; } @Override protected void drawGuiContainerForegroundLayer(final int i, final int j){ - super.drawGuiContainerForegroundLayer(i, j); + super.drawGuiContainerForegroundLayer(i, j); + + int xStart = 134; + int yStart = 31; + mTile = this.mContainer.tile_entity; + + int tier = mContainer.mTier; + int aTickRate = mContainer.mTickRate; + + fontRendererObj.drawString("Round Robinator", 85, 4, Utils.rgbtoHexValue(50, 150, 50)); + fontRendererObj.drawString("Tier: "+tier, 85, 12, Utils.rgbtoHexValue(50, 150, 50)); + fontRendererObj.drawString("Rate: 1 Item/"+aTickRate+"t", 85, 20, Utils.rgbtoHexValue(50, 150, 50)); + + boolean[] aStates = new boolean[] {mContainer.mSide_1 == 0 ? false : true, mContainer.mSide_2 == 0 ? false : true, mContainer.mSide_3 == 0 ? false : true,mContainer.mSide_4 == 0 ? false : true}; + + fontRendererObj.drawString("West: "+(aStates[0] ? "Active" : "Disabled"), 5, 5, Utils.rgbtoHexValue(50, 50, 50)); + fontRendererObj.drawString("North: "+(aStates[1] ? "Active" : "Disabled"), 5, 15, Utils.rgbtoHexValue(50, 50, 50)); + fontRendererObj.drawString("South: "+(aStates[2] ? "Active" : "Disabled"), 5, 25, Utils.rgbtoHexValue(50, 50, 50)); + fontRendererObj.drawString("East: "+(aStates[3] ? "Active" : "Disabled"), 5, 35, Utils.rgbtoHexValue(50, 50, 50)); + fontRendererObj.drawString("Toggling South will visually", 5, 65, Utils.rgbtoHexValue(150, 50, 50)); + fontRendererObj.drawString("toggle East, This is a visual bug.", 5, 74, Utils.rgbtoHexValue(150, 50, 50)); + drawStatus(aStates[0], xStart, yStart); + drawStatus(aStates[1], xStart+18, yStart); + drawStatus(aStates[2], xStart, yStart+18); + drawStatus(aStates[3], xStart+18, yStart+18); + } @Override @@ -33,6 +79,34 @@ public class GUI_RoundRobinator extends GuiContainer { final int x = (this.width - this.xSize) / 2; final int y = (this.height - this.ySize) / 2; this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); + + + + } + + private static ItemStack aGreenGlass; + private static ItemStack aRedGlass; + + private void drawStatus(boolean aStateActive, int x, int y) { + if (aGreenGlass == null) { + Item pane = ItemUtils.getSimpleStack(Blocks.stained_glass_pane).getItem(); + aGreenGlass = ItemUtils.simpleMetaStack(pane, 5, 1); + } + if (aRedGlass == null) { + Item pane = ItemUtils.getSimpleStack(Blocks.stained_glass_pane).getItem(); + aRedGlass = ItemUtils.simpleMetaStack(pane, 14, 1); + } + if (mDrawItemStack != null) { + try { + if (aStateActive) { + mDrawItemStack.invoke(this, new Object[]{aGreenGlass, x, y, ""}); + } + else { + mDrawItemStack.invoke(this, new Object[]{aRedGlass, x, y, ""}); + } + } + catch (Throwable t) {} + } } //This method is called when the Gui is first called! diff --git a/src/Java/gtPlusPlus/core/handler/GuiHandler.java b/src/Java/gtPlusPlus/core/handler/GuiHandler.java index 2141210650..e44c9a8f20 100644 --- a/src/Java/gtPlusPlus/core/handler/GuiHandler.java +++ b/src/Java/gtPlusPlus/core/handler/GuiHandler.java @@ -2,16 +2,22 @@ package gtPlusPlus.core.handler; import cpw.mods.fml.common.network.IGuiHandler; import cpw.mods.fml.common.network.NetworkRegistry; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ChunkCoordinates; -import net.minecraft.world.World; - import gtPlusPlus.GTplusplus; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.machine.Machine_SuperJukebox.TileEntitySuperJukebox; -import gtPlusPlus.core.container.*; +import gtPlusPlus.core.container.Container_BackpackBase; +import gtPlusPlus.core.container.Container_CircuitProgrammer; +import gtPlusPlus.core.container.Container_DecayablesChest; +import gtPlusPlus.core.container.Container_FishTrap; +import gtPlusPlus.core.container.Container_Grindle; +import gtPlusPlus.core.container.Container_ModularityTable; +import gtPlusPlus.core.container.Container_PestKiller; +import gtPlusPlus.core.container.Container_ProjectTable; +import gtPlusPlus.core.container.Container_RoundRobinator; +import gtPlusPlus.core.container.Container_SuperJukebox; +import gtPlusPlus.core.container.Container_TradeTable; +import gtPlusPlus.core.container.Container_Workbench; +import gtPlusPlus.core.container.Container_WorkbenchAdvanced; import gtPlusPlus.core.container.box.LunchBoxContainer; import gtPlusPlus.core.container.box.MagicBagContainer; import gtPlusPlus.core.container.box.ToolBoxContainer; @@ -22,20 +28,38 @@ import gtPlusPlus.core.gui.item.GuiBaseGrindle; import gtPlusPlus.core.gui.item.box.LunchBoxGui; import gtPlusPlus.core.gui.item.box.MagicBagGui; import gtPlusPlus.core.gui.item.box.ToolBoxGui; -import gtPlusPlus.core.gui.machine.*; +import gtPlusPlus.core.gui.machine.GUI_CircuitProgrammer; +import gtPlusPlus.core.gui.machine.GUI_DecayablesChest; +import gtPlusPlus.core.gui.machine.GUI_FishTrap; +import gtPlusPlus.core.gui.machine.GUI_ModularityTable; +import gtPlusPlus.core.gui.machine.GUI_PestKiller; +import gtPlusPlus.core.gui.machine.GUI_ProjectTable; +import gtPlusPlus.core.gui.machine.GUI_RoundRobinator; +import gtPlusPlus.core.gui.machine.GUI_SuperJukebox; +import gtPlusPlus.core.gui.machine.GUI_TradeTable; +import gtPlusPlus.core.gui.machine.GUI_Workbench; +import gtPlusPlus.core.gui.machine.GUI_WorkbenchAdvanced; import gtPlusPlus.core.interfaces.IGuiManager; import gtPlusPlus.core.inventories.BaseInventoryBackpack; import gtPlusPlus.core.inventories.BaseInventoryGrindle; import gtPlusPlus.core.inventories.box.LunchBoxInventory; import gtPlusPlus.core.inventories.box.MagicBagInventory; import gtPlusPlus.core.inventories.box.ToolBoxInventory; -import gtPlusPlus.core.item.tool.misc.box.ContainerBoxBase; -import gtPlusPlus.core.item.tool.misc.box.CustomBoxInventory; import gtPlusPlus.core.tileentities.base.TileEntityBase; import gtPlusPlus.core.tileentities.general.TileEntityCircuitProgrammer; import gtPlusPlus.core.tileentities.general.TileEntityDecayablesChest; import gtPlusPlus.core.tileentities.general.TileEntityFishTrap; -import gtPlusPlus.core.tileentities.machines.*; +import gtPlusPlus.core.tileentities.machines.TileEntityModularityTable; +import gtPlusPlus.core.tileentities.machines.TileEntityPestKiller; +import gtPlusPlus.core.tileentities.machines.TileEntityProjectTable; +import gtPlusPlus.core.tileentities.machines.TileEntityRoundRobinator; +import gtPlusPlus.core.tileentities.machines.TileEntityTradeTable; +import gtPlusPlus.core.tileentities.machines.TileEntityWorkbench; +import gtPlusPlus.core.tileentities.machines.TileEntityWorkbenchAdvanced; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.world.World; public class GuiHandler implements IGuiHandler { diff --git a/src/Java/gtPlusPlus/core/inventories/Inventory_RoundRobinator.java b/src/Java/gtPlusPlus/core/inventories/Inventory_RoundRobinator.java index 58d60b595f..a47f250c39 100644 --- a/src/Java/gtPlusPlus/core/inventories/Inventory_RoundRobinator.java +++ b/src/Java/gtPlusPlus/core/inventories/Inventory_RoundRobinator.java @@ -1,6 +1,5 @@ package gtPlusPlus.core.inventories; -import gtPlusPlus.core.recipe.common.CI; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; @@ -9,10 +8,10 @@ import net.minecraft.nbt.NBTTagList; public class Inventory_RoundRobinator implements IInventory{ - private final String name = "Circuit Programmer"; + private final String name = "Round Robinator"; /** Defining your inventory size this way is handy */ - public static final int INV_SIZE = 26; + public static final int INV_SIZE = 4; /** Inventory's size must be same as number of slots you add to the Container class */ private ItemStack[] inventory = new ItemStack[INV_SIZE]; @@ -167,7 +166,7 @@ public class Inventory_RoundRobinator implements IInventory{ */ @Override public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) { - return (itemstack.getItem() == CI.getNumberedCircuit(0).getItem()); + return true; } } \ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java index 1b13d34495..9022f864cb 100644 --- a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java +++ b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java @@ -87,8 +87,7 @@ public class BaseItemDust extends BaseItemComponent { else if (amount == 10) { doesThings[0] = false; doesThings[1] = true; - doesThings[2] = false; - + doesThings[2] = false; } else if (amount == 100) { doesThings[0] = false; diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java index e1c3e179ee..e4fa06c58e 100644 --- a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java +++ b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java @@ -118,7 +118,7 @@ public class BaseItemDustUnique extends Item{ private String getCorrectTexture(final String pileSize){ if (!CORE.ConfigSwitches.useGregtechTextures){ - if ((pileSize == "dust") || (pileSize == "Dust")){ + if ((pileSize.equals("dust")) || (pileSize.equals("Dust"))){ this.setTextureName(CORE.MODID + ":" + "dust");} else{ this.setTextureName(CORE.MODID + ":" + "dust"+pileSize); diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java index c52eb0d222..42890ddfa6 100644 --- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java +++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java @@ -44,11 +44,7 @@ public class ItemBlockBasicTile extends ItemBlock { list.add("Kills Forestry Butterflies, Bats and other pests"); list.add("Use either Formaldehyde or Hydrogen cyanide"); list.add("Be weary of your neighbours"); - } else if (this.mID == 7) { // Round-Robinator - list.add("Attempts to output items evenly on all four horizontal planes"); - list.add("Each tier operates at a factor of one operation every (20/tier)ticks"); - list.add("Top and bottom do not pull, so you must push item in"); - list.add("Sides can be disabled with a screwdriver"); + } else if (this.mID == 7) { } else { list.add("Bad Tooltip ID - " + mID); diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockRoundRobinator.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockRoundRobinator.java new file mode 100644 index 0000000000..fa18d745fb --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockRoundRobinator.java @@ -0,0 +1,111 @@ +package gtPlusPlus.core.item.base.itemblock; +import java.util.List; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemBlockWithMetadata; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; + +public class ItemBlockRoundRobinator extends ItemBlockWithMetadata +{ + private final Block mBlock; + + public ItemBlockRoundRobinator(final Block aBlock){ + super(aBlock, aBlock); + this.mBlock = aBlock; + this.setMaxDamage(0); + this.setHasSubtypes(true); + } + + + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Override + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + list.add("Attempts to output items evenly on all four horizontal planes"); + if (stack.getItemDamage() == 0) { + list.add("1 Item per enabled side every 400 ticks"); + } + else if (stack.getItemDamage() == 1) { + list.add("1 Item per enabled side every 100 ticks"); + } + else if (stack.getItemDamage() == 2) { + list.add("1 Item per enabled side every 20 ticks"); + } + else if (stack.getItemDamage() == 3) { + list.add("1 Item per enabled side every 10 ticks"); + } + else if (stack.getItemDamage() == 4) { + list.add("1 Item per enabled side every 1 ticks"); + } + list.add("Top and bottom do not pull, so you must push item in"); + list.add("Sides can also be disabled with a screwdriver"); + super.addInformation(stack, aPlayer, list, bool); + } + + /** + * Gets an icon index based on an item's damage value + */ + @Override + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamage(final int p_77617_1_) + { + return this.mBlock.getIcon(2, p_77617_1_); + } + + /** + * Returns the metadata of the block which this Item (ItemBlock) can place + */ + @Override + public int getMetadata(final int p_77647_1_) + { + return p_77647_1_; + } + + @Override + public String getUnlocalizedName(final ItemStack stack) { + return this.getUnlocalizedName() + "." + stack.getItemDamage(); + } + + @Override + public boolean isDamageable() { + return false; + } + + @Override + public int getItemEnchantability() { + return 0; + } + + @Override + public boolean getIsRepairable(ItemStack p_82789_1_, ItemStack p_82789_2_) { + return false; + } + + @Override + public boolean isBookEnchantable(ItemStack stack, ItemStack book) { + return false; + } + + @Override + public int getDisplayDamage(ItemStack stack) { + return 0; + } + + @Override + public boolean showDurabilityBar(ItemStack stack) { + return false; + } + + @Override + public double getDurabilityForDisplay(ItemStack stack) { + return 0; + } + + @Override + public int getItemEnchantability(ItemStack stack) { + return 0; + } +} \ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/bauble/FireProtectionBauble.java b/src/Java/gtPlusPlus/core/item/bauble/FireProtectionBauble.java index 93a5a969f7..6a8751b682 100644 --- a/src/Java/gtPlusPlus/core/item/bauble/FireProtectionBauble.java +++ b/src/Java/gtPlusPlus/core/item/bauble/FireProtectionBauble.java @@ -29,7 +29,7 @@ public class FireProtectionBauble extends BaseBauble { private static Field isImmuneToFire; static { - isImmuneToFire = ReflectionUtils.getField(Entity.class, DevHelper.IsObfuscatedEnvironment() ? "func_70045_F" : "isImmuneToFire"); + isImmuneToFire = ReflectionUtils.getField(Entity.class, DevHelper.isObfuscatedEnvironment() ? "func_70045_F" : "isImmuneToFire"); } public static boolean fireImmune(Entity aEntity) { diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java index 0bd5c0cf76..bc1c7fc398 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java @@ -230,6 +230,7 @@ public class RECIPES_Machines { fakeMachineCasingCovers(); ztonesCoverRecipes(); superBuses(); + roundRobinators(); } private static void initModItems(){ @@ -2251,4 +2252,46 @@ public class RECIPES_Machines { } + private static void roundRobinators() { + + RecipeUtils.addShapedGregtechRecipe( + ItemUtils.getSimpleStack(Blocks.hopper), "circuitPrimitive", ItemUtils.getSimpleStack(Blocks.hopper), + CI.craftingToolWrench, CI.machineCasing_ULV, CI.craftingToolScrewdriver, + ItemUtils.getSimpleStack(Blocks.hopper), "circuitPrimitive", ItemUtils.getSimpleStack(Blocks.hopper), + ItemUtils.simpleMetaStack(ModBlocks.blockRoundRobinator, 0, 1)); + + ItemStack[] aRobinators = new ItemStack[] { + ItemUtils.simpleMetaStack(ModBlocks.blockRoundRobinator, 0, 1), + ItemUtils.simpleMetaStack(ModBlocks.blockRoundRobinator, 1, 1), + ItemUtils.simpleMetaStack(ModBlocks.blockRoundRobinator, 2, 1), + ItemUtils.simpleMetaStack(ModBlocks.blockRoundRobinator, 3, 1), + ItemUtils.simpleMetaStack(ModBlocks.blockRoundRobinator, 4, 1), + }; + + int aCostMultiplier = GTNH ? 2 : 1; + + for (int i = 0; i < 5; i++) { + if (i == 0) { + continue; + } + int aTier = i+1; + ItemStack[] aInputs = new ItemStack[] { + aRobinators[i-1], + CI.getTieredMachineHull(aTier, 1 * aCostMultiplier), + CI.getConveyor(aTier, 2 * aCostMultiplier), + CI.getElectricMotor(aTier, 2 * aCostMultiplier), + CI.getTieredComponent(OrePrefixes.plate, aTier, 4 * aCostMultiplier), + CI.getTieredComponent(OrePrefixes.circuit, i, 2 * aCostMultiplier), + }; + + CORE.RA.addSixSlotAssemblingRecipe( + aInputs, + CI.getAlternativeTieredFluid(aTier, (144 * 2 * i)), //Input Fluid + aRobinators[i], + 45 * 10 * 1 * (i+1), + MaterialUtils.getVoltageForTier(i)); + + } + } + } diff --git a/src/Java/gtPlusPlus/core/recipe/common/CI.java b/src/Java/gtPlusPlus/core/recipe/common/CI.java index 15589ada84..63477cda19 100644 --- a/src/Java/gtPlusPlus/core/recipe/common/CI.java +++ b/src/Java/gtPlusPlus/core/recipe/common/CI.java @@ -547,7 +547,7 @@ public class CI { private static final Material[] aMaterial_Main = new Material[] { ALLOY.POTIN, - ALLOY.ZIRCONIUM_CARBIDE, + ALLOY.TUMBAGA, ALLOY.EGLIN_STEEL, ALLOY.INCONEL_792, ALLOY.TUNGSTEN_TITANIUM_CARBIDE, @@ -561,7 +561,7 @@ public class CI { }; private static final Material[] aMaterial_Secondary = new Material[] { - ALLOY.TUMBAGA, + ALLOY.STEEL, ALLOY.SILICON_CARBIDE, ALLOY.TUNGSTEN_CARBIDE, ALLOY.INCONEL_690, @@ -576,7 +576,7 @@ public class CI { }; private static final Material[] aMaterial_Tertiary = new Material[] { - ALLOY.STEEL, + ELEMENT.getInstance().LEAD, ELEMENT.getInstance().ALUMINIUM, ALLOY.STAINLESS_STEEL, ELEMENT.getInstance().TUNGSTEN, diff --git a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityRoundRobinator.java b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityRoundRobinator.java index 13ba5ca44d..4950718f4a 100644 --- a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityRoundRobinator.java +++ b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityRoundRobinator.java @@ -1,19 +1,36 @@ package gtPlusPlus.core.tileentities.machines; +import java.util.List; + +import gtPlusPlus.GTplusplus; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.handler.GuiHandler; +import gtPlusPlus.core.inventories.Inventory_RoundRobinator; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.minecraft.PlayerUtils; +import gtPlusPlus.core.util.sys.KeyboardUtils; +import net.minecraft.block.Block; +import net.minecraft.block.BlockChest; +import net.minecraft.command.IEntitySelector; +import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.tileentity.IHopper; import net.minecraft.tileentity.TileEntity; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.inventories.Inventory_RoundRobinator; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.minecraft.PlayerUtils; +import net.minecraft.tileentity.TileEntityChest; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.Facing; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; -public class TileEntityRoundRobinator extends TileEntity implements ISidedInventory { +public class TileEntityRoundRobinator extends TileEntity implements ISidedInventory, IHopper { private int tickCount = 0; private final Inventory_RoundRobinator inventoryContents; @@ -21,7 +38,9 @@ public class TileEntityRoundRobinator extends TileEntity implements ISidedInvent public int locationX; public int locationY; public int locationZ; - private int aCurrentMode = 0; + private int aData = 1111; + private int aTier = 1; + private int aTickRate = 100; public TileEntityRoundRobinator() { this.inventoryContents = new Inventory_RoundRobinator(); @@ -34,6 +53,7 @@ public class TileEntityRoundRobinator extends TileEntity implements ISidedInvent this.locationX = this.xCoord; this.locationY = this.yCoord; this.locationZ = this.zCoord; + this.aTier = this.getWorldObj().getBlockMetadata(locationX, locationY, locationZ) + 1; return true; } } @@ -41,8 +61,8 @@ public class TileEntityRoundRobinator extends TileEntity implements ISidedInvent } //Rename to hasCircuitToConfigure - public final boolean hasCircuitToConfigure() { - for (ItemStack i : this.getInventory().getInventory()) { + public final boolean hasInventoryContents() { + for (ItemStack i : this.aHopperInventory) { if (i == null) { continue; } @@ -56,76 +76,54 @@ public class TileEntityRoundRobinator extends TileEntity implements ISidedInvent public Inventory_RoundRobinator getInventory() { return this.inventoryContents; } - - public boolean addOutput() { - ItemStack[] aInputs = this.getInventory().getInventory().clone(); - //Check if there is output in slot. - Boolean hasOutput = false; - if (aInputs[25] != null) { - hasOutput = true; - } - AutoMap aValidSlots = new AutoMap(); - int aSlotCount = 0; - for (ItemStack i : aInputs) { - if (i != null) { - aValidSlots.put(aSlotCount); - } - aSlotCount++; - } - for (int e : aValidSlots) { - boolean doAdd = false; - ItemStack g = this.getStackInSlot(e); - int aSize = 0; - ItemStack aInputStack = null; - if (g != null) { - if (!hasOutput) { - aSize = g.stackSize; - doAdd = true; - } - else { - ItemStack f = this.getStackInSlot(25); - if (f != null) { - if (f.getItemDamage() == e) { - aSize = f.stackSize + g.stackSize; - if (aSize > 64) { - aInputStack = g.copy(); - aInputStack.stackSize = (aSize-64); - } - doAdd = true; - } - } - else { - doAdd = true; - aSize = g.stackSize; - } - } - if (doAdd) { - ItemStack aOutput = CI.getNumberedCircuit(e); - if (aOutput != null) { - aOutput.stackSize = aSize; - this.setInventorySlotContents(e, aInputStack); - this.setInventorySlotContents(25, aOutput); - return true; - } - } - } - continue; - } - return false; + + public int getTier() { + return this.aTier; + } + + public int getTickRate() { + return this.aTickRate; } @Override public void updateEntity() { try{ - if (!this.worldObj.isRemote) { - if (tickCount % 10 == 0) { - if (hasCircuitToConfigure()) { - this.addOutput(); - this.markDirty(); + // TODO + if (this.worldObj != null && !this.worldObj.isRemote){ + setTileLocation(); + aTickRate = (60-(aTier*10)); + if (this.getTier() == 1) { + // 20 s + aTickRate = 400; + } + else if (this.getTier() == 2) { + // 5 + aTickRate = 100; + } + else if (this.getTier() == 3) { + // 1 + aTickRate = 20; + } + else if (this.getTier() == 4) { + // 1/5 + aTickRate = 10; + } + else if (this.getTier() == 5) { + // 1/20 + aTickRate = 1; + } + else { + aTickRate = 999999; + } + + if (tickCount % getTickRate() == 0) { + if (hasInventoryContents()) { + Logger.INFO("Trying to move items. "+aTickRate); + this.tryProcessItems(); } } - this.tickCount++; - } + this.tickCount++; + } } catch (final Throwable t){} } @@ -144,55 +142,26 @@ public class TileEntityRoundRobinator extends TileEntity implements ISidedInvent @Override public void writeToNBT(final NBTTagCompound nbt) { super.writeToNBT(nbt); - // Utils.LOG_WARNING("Trying to write NBT data to TE."); - final NBTTagCompound chestData = new NBTTagCompound(); - this.inventoryContents.writeToNBT(chestData); - nbt.setTag("ContentsChest", chestData); if (this.hasCustomInventoryName()) { nbt.setString("CustomName", this.getCustomName()); } - nbt.setInteger("aCurrentMode", aCurrentMode); + nbt.setInteger("aCurrentMode", aData); + this.writeToNBT2(nbt); } @Override public void readFromNBT(final NBTTagCompound nbt) { super.readFromNBT(nbt); - // Utils.LOG_WARNING("Trying to read NBT data from TE."); - this.inventoryContents.readFromNBT(nbt.getCompoundTag("ContentsChest")); if (nbt.hasKey("CustomName", 8)) { this.setCustomName(nbt.getString("CustomName")); } - aCurrentMode = nbt.getInteger("aCurrentMode"); - } - - @Override - public int getSizeInventory() { - return this.getInventory().getSizeInventory(); - } - - @Override - public ItemStack getStackInSlot(final int slot) { - return this.getInventory().getStackInSlot(slot); - } - - @Override - public ItemStack decrStackSize(final int slot, final int count) { - return this.getInventory().decrStackSize(slot, count); - } - - @Override - public ItemStack getStackInSlotOnClosing(final int slot) { - return this.getInventory().getStackInSlotOnClosing(slot); - } - - @Override - public void setInventorySlotContents(final int slot, final ItemStack stack) { - this.getInventory().setInventorySlotContents(slot, stack); + aData = nbt.getInteger("aCurrentMode"); + this.readFromNBT2(nbt); } @Override public int getInventoryStackLimit() { - return this.getInventory().getInventoryStackLimit(); + return 64; } @Override @@ -205,7 +174,7 @@ public class TileEntityRoundRobinator extends TileEntity implements ISidedInvent this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, 1); this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord - 1, this.zCoord, this.getBlockType()); - this.getInventory().openInventory(); + //this.getInventory().openInventory(); } @Override @@ -213,32 +182,27 @@ public class TileEntityRoundRobinator extends TileEntity implements ISidedInvent this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, 1); this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord - 1, this.zCoord, this.getBlockType()); - this.getInventory().closeInventory(); + //this.getInventory().closeInventory(); } @Override public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) { - return this.getInventory().isItemValidForSlot(slot, itemstack); + return true; } @Override - public int[] getAccessibleSlotsFromSide(final int p_94128_1_) { - final int[] accessibleSides = new int[this.getSizeInventory()]; - for (int r=0; r= 0 && p_102007_1_ <= 24; + public boolean canInsertItem(final int aSlot, final ItemStack aStack, final int aSide) { + return aSide < 2; } @Override - public boolean canExtractItem(final int p_102008_1_, final ItemStack p_102008_2_, final int p_102008_3_) { - return p_102008_1_ == 25; + public boolean canExtractItem(final int aSlot, final ItemStack aStack, final int aSide) { + return false; } public String getCustomName() { @@ -251,7 +215,7 @@ public class TileEntityRoundRobinator extends TileEntity implements ISidedInvent @Override public String getInventoryName() { - return this.hasCustomInventoryName() ? this.customName : "container.circuitprogrammer"; + return this.hasCustomInventoryName() ? this.customName : "container.roundrobinator"; } @Override @@ -272,15 +236,37 @@ public class TileEntityRoundRobinator extends TileEntity implements ISidedInvent this.readFromNBT(tag); } - public boolean onScrewdriverRightClick(byte side, EntityPlayer player, int x, int y, int z) { - try { - if (aCurrentMode == 24) { - aCurrentMode = 0; + + public boolean onRightClick(byte side, EntityPlayer player, int x, int y, int z) { + if (player != null && player.getHeldItem() == null) { + if (!player.isSneaking() && !KeyboardUtils.isShiftKeyDown()) { + player.openGui(GTplusplus.instance, GuiHandler.GUI16, player.getEntityWorld(), x, y, z); } else { - aCurrentMode++; + String InventoryContents = ItemUtils.getArrayStackNames(this.aHopperInventory); + PlayerUtils.messagePlayer(player, "Contents: "+InventoryContents+" | "+getDataString()); + } + return true; + } + else { + return false; + } + } + + public boolean onScrewdriverRightClick(byte side, EntityPlayer player, int x, int y, int z) { + try { + if (side < 2) { + // Top/Bottom } - PlayerUtils.messagePlayer(player, "Now configuring units for type "+aCurrentMode+"."); + else { + if (toggleSide(side)) { + PlayerUtils.messagePlayer(player, "Enabling side "+side+"."); + } + else { + PlayerUtils.messagePlayer(player, "Disabling side "+side+"."); + } + PlayerUtils.messagePlayer(player, "Mode String: "+aData+""); + } return true; } catch (Throwable t) { @@ -288,4 +274,461 @@ public class TileEntityRoundRobinator extends TileEntity implements ISidedInvent } } + public int getDataString() { + return aData; + } + + public boolean[] getActiveSides() { + this.markDirty(); + String s = String.valueOf(aData); + if (s == null || s.length() != 4) { + s = "1111"; + } + boolean[] aActiveSides = new boolean[4]; + for (int i=0;i<4;i++) { + char ch = s.charAt(i); + if (ch == '1') { + aActiveSides[i] = true; + } + else { + aActiveSides[i] = false; + } + } + return aActiveSides; + } + + /** + * Toggle active state of side + * @param aSide - Forge Direction / Side + * @return - True if the side is now Active, false if now disabled. + */ + public boolean toggleSide(int aSide) { + setSideActive(!getSideActive(aSide), aSide); + return getSideActive(aSide); + } + + + public void setSideActive(boolean aActive, int aSide) { + try { + if (aSide < 2) { + } + else { + if (aData < 1111) { + aData = 1111; + } + else if (aData > 2222) { + aData = 2222; + } + String s = String.valueOf(aData); + StringBuilder aDataString = new StringBuilder(s); + int aIndex = aSide - 2; + if (aActive) { + aDataString.setCharAt(aIndex, '1'); + } + else { + aDataString.setCharAt(aIndex, '2'); + } + aData = Integer.valueOf(aDataString.toString()); + this.markDirty(); + } + } + catch (Throwable t) { + } + } + + public boolean getSideActive(int aSide) { + this.markDirty(); + try { + if (aSide < 2) { + return false; + } + else { + if (aData < 1111) { + aData = 1111; + } + else if (aData > 2222) { + aData = 2222; + } + String s = String.valueOf(aData); + int aIndex = aSide - 2; + char ch = s.charAt(aIndex); + if (ch == '1') { + return true; + } + else { + return false; + } + + } + } + catch (Throwable t) { + return false; + } + } + + @Override + public double getXPos() { + return this.locationX; + } + + @Override + public double getYPos() { + return this.locationY; + } + + @Override + public double getZPos() { + return this.locationZ; + } + + + + + + + + + // TODO + + + + /* + * Hopper Code + */ + + + private ItemStack[] aHopperInventory = new ItemStack[5]; + + public int getSizeInventory() { + return this.aHopperInventory.length; + } + + public ItemStack getStackInSlot(int aSlot) { + return this.aHopperInventory[aSlot]; + } + + /** + * Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a + * new stack. + */ + public ItemStack decrStackSize(int aSlot, int aMinimumSizeOfExistingStack) + { + if (this.aHopperInventory[aSlot] != null) + { + ItemStack itemstack; + + if (this.aHopperInventory[aSlot].stackSize <= aMinimumSizeOfExistingStack) + { + itemstack = this.aHopperInventory[aSlot]; + this.aHopperInventory[aSlot] = null; + return itemstack; + } + else + { + itemstack = this.aHopperInventory[aSlot].splitStack(aMinimumSizeOfExistingStack); + + if (this.aHopperInventory[aSlot].stackSize == 0) + { + this.aHopperInventory[aSlot] = null; + } + + return itemstack; + } + } + else + { + return null; + } + } + + /** + * When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem - + * like when you close a workbench GUI. + */ + public ItemStack getStackInSlotOnClosing(int aSlot) + { + if (this.aHopperInventory[aSlot] != null) + { + ItemStack itemstack = this.aHopperInventory[aSlot]; + this.aHopperInventory[aSlot] = null; + return itemstack; + } + else + { + return null; + } + } + + /** + * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). + */ + public void setInventorySlotContents(int aSlot, ItemStack aStack) + { + this.aHopperInventory[aSlot] = aStack; + + if (aStack != null && aStack.stackSize > this.getInventoryStackLimit()) + { + aStack.stackSize = this.getInventoryStackLimit(); + } + } + + public boolean tryProcessItems() { + if (this.worldObj != null && !this.worldObj.isRemote) { + boolean didSomething = false; + if (!this.isEmpty()) { + Logger.INFO("Has Items, Trying to push to all active directions."); + didSomething = this.tryPushItemsIntoNeighbours(); + } + if (didSomething) { + this.markDirty(); + return true; + } + } + return false; + } + + /** + * Is Empty + * @return + */ + private boolean isEmpty() { + ItemStack[] aitemstack = this.aHopperInventory; + int i = aitemstack.length; + + for (int j = 0; j < i; ++j) { + ItemStack itemstack = aitemstack[j]; + + if (itemstack != null) { + return false; + } + } + + return true; + } + + private boolean tryPushItemsIntoNeighbours() { + + boolean aDidPush = false; + + for (int u = 2; u < 6; u++) { + if (!this.getSideActive(u)) { + Logger.INFO("Not pushing on side "+u); + continue; + } + + Logger.INFO("Pushing on side "+u); + IInventory iinventory = this.getInventoryFromFacing(u); + + if (iinventory == null) { + Logger.INFO("No inventory found."); + continue; + } + else { + + int i = Facing.oppositeSide[u]; + Logger.INFO("Using Opposite direction: "+i); + + if (this.isInventoryFull(iinventory, i)) { + Logger.INFO("Target is full, skipping."); + continue; + } + else { + Logger.INFO("Target has space, let's move a single item."); + for (int j = 0; j < this.getSizeInventory(); ++j) { + if (this.getStackInSlot(j) != null) { + ItemStack itemstack = this.getStackInSlot(j).copy(); + ItemStack itemstack1 = setStackInNeighbour(iinventory, this.decrStackSize(j, 1), i); + if (itemstack1 == null || itemstack1.stackSize == 0) { + iinventory.markDirty(); + aDidPush = true; + continue; + } + this.setInventorySlotContents(j, itemstack); + } + } + } + } + } + + return aDidPush; + } + + private boolean isInventoryFull(IInventory aInv, int aSide) { + if (aInv instanceof ISidedInventory && aSide > -1) { + ISidedInventory isidedinventory = (ISidedInventory)aInv; + int[] aint = isidedinventory.getAccessibleSlotsFromSide(aSide); + + for (int l = 0; l < aint.length; ++l) + { + ItemStack itemstack1 = isidedinventory.getStackInSlot(aint[l]); + + if (itemstack1 == null || itemstack1.stackSize != itemstack1.getMaxStackSize()) + { + return false; + } + } + } + else { + int j = aInv.getSizeInventory(); + + for (int k = 0; k < j; ++k) + { + ItemStack itemstack = aInv.getStackInSlot(k); + + if (itemstack == null || itemstack.stackSize != itemstack.getMaxStackSize()) + { + return false; + } + } + } + return true; + } + + public static ItemStack setStackInNeighbour(IInventory aNeighbour, ItemStack aStack, int aSide) { + if (aNeighbour instanceof ISidedInventory && aSide > -1) + { + ISidedInventory isidedinventory = (ISidedInventory)aNeighbour; + int[] aint = isidedinventory.getAccessibleSlotsFromSide(aSide); + + for (int l = 0; l < aint.length && aStack != null && aStack.stackSize > 0; ++l) + { + aStack = tryMoveStack(aNeighbour, aStack, aint[l], aSide); + } + } + else + { + int j = aNeighbour.getSizeInventory(); + + for (int k = 0; k < j && aStack != null && aStack.stackSize > 0; ++k) + { + aStack = tryMoveStack(aNeighbour, aStack, k, aSide); + } + } + + if (aStack != null && aStack.stackSize == 0) + { + aStack = null; + } + + return aStack; + } + + private static boolean canInsertItemIntoNeighbour(IInventory aNeighbour, ItemStack aStack, int aSlot, int aSide) { + return !aNeighbour.isItemValidForSlot(aSlot, aStack) ? false : !(aNeighbour instanceof ISidedInventory) || ((ISidedInventory)aNeighbour).canInsertItem(aSlot, aStack, aSide); + } + + private static ItemStack tryMoveStack(IInventory aNeighbour, ItemStack aStack, int aSlot, int aSide) { + ItemStack itemstack1 = aNeighbour.getStackInSlot(aSlot); + if (canInsertItemIntoNeighbour(aNeighbour, aStack, aSlot, aSide)) { + boolean aDidSomething = false; + if (itemstack1 == null) { + //Forge: BUGFIX: Again, make things respect max stack sizes. + int max = Math.min(aStack.getMaxStackSize(), aNeighbour.getInventoryStackLimit()); + if (max >= aStack.stackSize) { + aNeighbour.setInventorySlotContents(aSlot, aStack); + aStack = null; + } + else { + aNeighbour.setInventorySlotContents(aSlot, aStack.splitStack(max)); + } + aDidSomething = true; + } + else if (areItemStacksEqual(itemstack1, aStack)) { + //Forge: BUGFIX: Again, make things respect max stack sizes. + int max = Math.min(aStack.getMaxStackSize(), aNeighbour.getInventoryStackLimit()); + if (max > itemstack1.stackSize) { + int l = Math.min(aStack.stackSize, max - itemstack1.stackSize); + aStack.stackSize -= l; + itemstack1.stackSize += l; + aDidSomething = l > 0; + } + } + if (aDidSomething){ + aNeighbour.markDirty(); + } + } + return aStack; + } + + private IInventory getInventoryFromFacing(int aSide) + { + int i = aSide; + return tryFindInvetoryAtXYZ(this.getWorldObj(), (double)(this.xCoord + Facing.offsetsXForSide[i]), (double)(this.yCoord + Facing.offsetsYForSide[i]), (double)(this.zCoord + Facing.offsetsZForSide[i])); + } + + public static IInventory tryFindInvetoryAtXYZ(World aWorld, double aX, double aY, double aZ) + { + IInventory iinventory = null; + int sX = MathHelper.floor_double(aX); + int sY = MathHelper.floor_double(aY); + int sZ = MathHelper.floor_double(aZ); + TileEntity tileentity = aWorld.getTileEntity(sX, sY, sZ); + + if (tileentity != null && tileentity instanceof IInventory) + { + iinventory = (IInventory)tileentity; + + if (iinventory instanceof TileEntityChest) + { + Block block = aWorld.getBlock(sX, sY, sZ); + + if (block instanceof BlockChest) + { + iinventory = ((BlockChest)block).func_149951_m(aWorld, sX, sY, sZ); + } + } + } + + if (iinventory == null) + { + List list = aWorld.getEntitiesWithinAABBExcludingEntity((Entity)null, AxisAlignedBB.getBoundingBox(aX, aY, aZ, aX + 1.0D, aY + 1.0D, aZ + 1.0D), IEntitySelector.selectInventories); + + if (list != null && list.size() > 0) + { + iinventory = (IInventory)list.get(aWorld.rand.nextInt(list.size())); + } + } + + return iinventory; + } + + private static boolean areItemStacksEqual(ItemStack aStack, ItemStack aStack2) { + return aStack.getItem() != aStack2.getItem() ? false : (aStack.getItemDamage() != aStack2.getItemDamage() ? false : (aStack.stackSize > aStack.getMaxStackSize() ? false : ItemStack.areItemStackTagsEqual(aStack, aStack2))); + } + + public void readFromNBT2(NBTTagCompound p_145839_1_) { + super.readFromNBT(p_145839_1_); + NBTTagList nbttaglist = p_145839_1_.getTagList("Items", 10); + this.aHopperInventory = new ItemStack[this.getSizeInventory()]; + for (int i = 0; i < nbttaglist.tagCount(); ++i) { + NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); + byte b0 = nbttagcompound1.getByte("Slot"); + if (b0 >= 0 && b0 < this.aHopperInventory.length) { + this.aHopperInventory[b0] = ItemStack.loadItemStackFromNBT( + nbttagcompound1 + ); + } + } + } + + public void writeToNBT2(NBTTagCompound aNBT) { + super.writeToNBT(aNBT); + NBTTagList nbttaglist = new NBTTagList(); + for (int i = 0; i < this.aHopperInventory.length; ++i) { + if (this.aHopperInventory[i] != null) { + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + nbttagcompound1.setByte("Slot", (byte) i); + this.aHopperInventory[i].writeToNBT(nbttagcompound1); + nbttaglist.appendTag(nbttagcompound1); + } + } + aNBT.setTag("Items", nbttaglist); + } + + + + + + + } diff --git a/src/Java/gtPlusPlus/nei/DecayableRecipeHandler.java b/src/Java/gtPlusPlus/nei/DecayableRecipeHandler.java index b5f5fa7989..dae1a663d7 100644 --- a/src/Java/gtPlusPlus/nei/DecayableRecipeHandler.java +++ b/src/Java/gtPlusPlus/nei/DecayableRecipeHandler.java @@ -220,7 +220,8 @@ public class DecayableRecipeHandler extends TemplateRecipeHandler { @Override public int compareTo(CachedRecipe o) { - if (o instanceof DecayableRecipeNEI) { + boolean b = DecayableRecipeNEI.class.isInstance(o); + if (b) { DecayableRecipeNEI p = (DecayableRecipeNEI) o; if (p.time > this.time) { return 1; @@ -232,5 +233,30 @@ public class DecayableRecipeHandler extends TemplateRecipeHandler { } return 0; } + + @Override + public boolean equals(Object obj) { + if (obj != null) { + if (DecayableRecipeNEI.class.isInstance(obj)) { + DecayableRecipeNEI p = (DecayableRecipeNEI) obj; + if (p != null) { + // Time check first to keep it simple and not unbox the Recipes. + if (p.time == this.time) { + ItemStack aInput = p.input.item; + ItemStack aOutput = p.output.item; + if (GT_Utility.areStacksEqual(aInput, this.input.item, true)) { + if (GT_Utility.areStacksEqual(aOutput, this.output.item, true)) { + return true; + } + } + } + } + + } + } + return false; + } + + } } \ No newline at end of file diff --git a/src/Java/gtPlusPlus/nei/GT_NEI_MultiBlockHandler.java b/src/Java/gtPlusPlus/nei/GT_NEI_MultiBlockHandler.java index 6612ab703f..e3c980e6a4 100644 --- a/src/Java/gtPlusPlus/nei/GT_NEI_MultiBlockHandler.java +++ b/src/Java/gtPlusPlus/nei/GT_NEI_MultiBlockHandler.java @@ -928,7 +928,7 @@ extends TemplateRecipeHandler { } - public class recipeCompare implements Comparator { + public class RecipeCompare implements Comparator { public int compare(GT_Recipe a, GT_Recipe b) { if (a.mEUt != b.mEUt) { return a.mEUt - b.mEUt; diff --git a/src/Java/gtPlusPlus/plugin/fixes/vanilla/VanillaBedHeightFix.java b/src/Java/gtPlusPlus/plugin/fixes/vanilla/VanillaBedHeightFix.java index 5f3b1d8abd..f33cc71fc6 100644 --- a/src/Java/gtPlusPlus/plugin/fixes/vanilla/VanillaBedHeightFix.java +++ b/src/Java/gtPlusPlus/plugin/fixes/vanilla/VanillaBedHeightFix.java @@ -23,7 +23,7 @@ public class VanillaBedHeightFix implements IBugFix { mParent = minstance; if (DevHelper.isValidHelperObject()) { Method m; - if (DevHelper.IsObfuscatedEnvironment()) { + if (DevHelper.isObfuscatedEnvironment()) { m = ReflectionUtils.getMethod(EntityPlayer.class, "func_71018_a", int.class, int.class, int.class); } else { diff --git a/src/Java/gtPlusPlus/preloader/DevHelper.java b/src/Java/gtPlusPlus/preloader/DevHelper.java index d942de503a..81d36d591b 100644 --- a/src/Java/gtPlusPlus/preloader/DevHelper.java +++ b/src/Java/gtPlusPlus/preloader/DevHelper.java @@ -32,7 +32,7 @@ public class DevHelper { - public static boolean IsObfuscatedEnvironment() { + public static boolean isObfuscatedEnvironment() { // Are we in a 'decompiled' environment? boolean deobfuscatedEnvironment = false; byte[] bs; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java index dda1a6b0c0..7300b3507b 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java @@ -21,6 +21,7 @@ import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.PlayerUtils; +import gtPlusPlus.preloader.asm.AsmConfig; import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_PowerSubStation; import gtPlusPlus.xmod.gregtech.api.gui.GUI_PowerSubStation; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBattery; @@ -120,7 +121,9 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe checkMachineProblem(problem); } private void checkMachineProblem(String msg) { - Logger.INFO("Power Sub-Station problem: " + msg); + if (!AsmConfig.disableAllLogging) { + Logger.INFO("Power Sub-Station problem: " + msg); + } } public static int getCellTier(Block aBlock, int aMeta) { diff --git a/src/resources/assets/miscutils/lang/en_US.lang b/src/resources/assets/miscutils/lang/en_US.lang index 193df880f0..a66ac39435 100644 --- a/src/resources/assets/miscutils/lang/en_US.lang +++ b/src/resources/assets/miscutils/lang/en_US.lang @@ -3025,4 +3025,13 @@ item.dustImpureRareEarthIII.name=Impure Rare Earth (III) Dust item.dustPureRareEarthIII.name=Purified Rare Earth (III) Dust item.itemDustRareEarthIII.name=Rare Earth (III) Dust item.itemDustTinyRareEarthIII.name=Tiny Pile of Rare Earth (III) Dust -item.itemDustSmallRareEarthIII.name=Small Pile of Rare Earth (III) Dust \ No newline at end of file +item.itemDustSmallRareEarthIII.name=Small Pile of Rare Earth (III) Dust + + + +//Added 13/10/19 +tile.blockRoundRobinator.0.name=Round Robinator I +tile.blockRoundRobinator.1.name=Round Robinator II +tile.blockRoundRobinator.2.name=Round Robinator III +tile.blockRoundRobinator.3.name=Round Robinator IV +tile.blockRoundRobinator.4.name=Round Robinator V \ No newline at end of file diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Side_0.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Side_0.png new file mode 100644 index 0000000000..cbf604f2b3 Binary files /dev/null and b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Side_0.png differ diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Side_1.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Side_1.png new file mode 100644 index 0000000000..3b7ac3d50e Binary files /dev/null and b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Side_1.png differ diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Side_2.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Side_2.png new file mode 100644 index 0000000000..a5a5e2c559 Binary files /dev/null and b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Side_2.png differ diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Side_3.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Side_3.png new file mode 100644 index 0000000000..b68c900ddd Binary files /dev/null and b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Side_3.png differ diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Side_4.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Side_4.png new file mode 100644 index 0000000000..df182aeaa5 Binary files /dev/null and b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Side_4.png differ diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Top_0.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Top_0.png new file mode 100644 index 0000000000..85bc3f16cd Binary files /dev/null and b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Top_0.png differ diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Top_1.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Top_1.png new file mode 100644 index 0000000000..f82185ebdb Binary files /dev/null and b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Top_1.png differ diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Top_2.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Top_2.png new file mode 100644 index 0000000000..345476e03c Binary files /dev/null and b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Top_2.png differ diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Top_3.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Top_3.png new file mode 100644 index 0000000000..971164eb3e Binary files /dev/null and b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Top_3.png differ diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Top_4.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Top_4.png new file mode 100644 index 0000000000..5b5bac3ad2 Binary files /dev/null and b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/RoundRobinator_Top_4.png differ diff --git a/src/resources/assets/miscutils/textures/gui/RoundRobinator.png b/src/resources/assets/miscutils/textures/gui/RoundRobinator.png new file mode 100644 index 0000000000..54c06f22ae Binary files /dev/null and b/src/resources/assets/miscutils/textures/gui/RoundRobinator.png differ -- cgit From 0ba472ad9bc0f829302f41128df559fa852113ff Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Sun, 13 Oct 2019 22:22:06 +0100 Subject: % Tweaked recipes for Round-Robinators. % Tweaked composition of Ancient Granite, Black Metal, Rare Earth MID/HIGH. --- .../core/block/machine/Machine_RoundRobinator.java | 3 +- .../core/container/Container_RoundRobinator.java | 41 +++++----------------- .../core/gui/machine/GUI_RoundRobinator.java | 4 ++- .../base/itemblock/ItemBlockRoundRobinator.java | 9 ++--- src/Java/gtPlusPlus/core/material/ELEMENT.java | 27 ++++++++++++-- .../gtPlusPlus/core/material/MISC_MATERIALS.java | 4 +-- .../machines/TileEntityRoundRobinator.java | 23 +++++++----- 7 files changed, 59 insertions(+), 52 deletions(-) (limited to 'src/Java/gtPlusPlus/core/tileentities') diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_RoundRobinator.java b/src/Java/gtPlusPlus/core/block/machine/Machine_RoundRobinator.java index 8ba7c2533b..cd480dcffe 100644 --- a/src/Java/gtPlusPlus/core/block/machine/Machine_RoundRobinator.java +++ b/src/Java/gtPlusPlus/core/block/machine/Machine_RoundRobinator.java @@ -3,7 +3,6 @@ package gtPlusPlus.core.block.machine; import java.util.List; import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.common.registry.LanguageRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.common.items.GT_MetaGenerated_Tool_01; @@ -124,7 +123,7 @@ public class Machine_RoundRobinator extends BlockContainer implements ITileToolt @Override public int getRenderBlockPass() { - return 1; + return 0; } @Override diff --git a/src/Java/gtPlusPlus/core/container/Container_RoundRobinator.java b/src/Java/gtPlusPlus/core/container/Container_RoundRobinator.java index 0da2933dfa..cbd08c2cca 100644 --- a/src/Java/gtPlusPlus/core/container/Container_RoundRobinator.java +++ b/src/Java/gtPlusPlus/core/container/Container_RoundRobinator.java @@ -54,19 +54,8 @@ public class Container_RoundRobinator extends Container { this.posX = te.xCoord; this.posY = te.yCoord; this.posZ = te.zCoord; - Logger.INFO("1"); int o = 0; - - // Storage Side - /*for (var6 = 0; var6 < 3; var6++) { - for (var7 = 0; var7 < 5; var7++) { - this.addSlotToContainer(new SlotIntegratedCircuit(o, this.inventoryChest, o, 44 + (var7 * 18), 15 + (var6 * 18))); - o++; - } - }*/ - - int xStart = 134; int yStart = 32; @@ -76,14 +65,6 @@ public class Container_RoundRobinator extends Container { this.addSlotToContainer(new SlotNoInput(this.inventoryChest, o++, xStart+18, yStart)); this.addSlotToContainer(new SlotNoInput(this.inventoryChest, o++, xStart, yStart+17)); this.addSlotToContainer(new SlotNoInput(this.inventoryChest, o++, xStart+18, yStart+17)); - Logger.INFO("2"); - - //Add Output - //this.addSlotToContainer(new SlotNoInput(this.inventoryChest, SLOT_OUTPUT, xStart+(8*18), yStart+54)); - //o++; - Logger.INFO("3"); - - // Player Inventory for (var6 = 0; var6 < 3; ++var6) { @@ -95,12 +76,10 @@ public class Container_RoundRobinator extends Container { for (var6 = 0; var6 < 9; ++var6) { this.addSlotToContainer(new Slot(inventory, var6, 8 + (var6 * 18), 142)); } - - - - Logger.INFO("4"); } - catch (Throwable t) {} + catch (Throwable t) { + t.printStackTrace(); + } this.detectAndSendChanges(); } @@ -110,11 +89,9 @@ public class Container_RoundRobinator extends Container { final EntityPlayer aPlayer) { if (!aPlayer.worldObj.isRemote) { - if ((aSlotIndex == 999) || (aSlotIndex == -999)) { - } - else if (aSlotIndex < 4) { + if (aSlotIndex < 4) { this.tile_entity.toggleSide(aSlotIndex+2); - Logger.INFO("Toggling side: "+(aSlotIndex+2)+" | Active: "+this.tile_entity.getSideActive(aSlotIndex+2)+" | Data:"+this.tile_entity.getDataString()); + //Logger.INFO("Toggling side: "+(aSlotIndex+2)+" | Active: "+this.tile_entity.getSideActive(aSlotIndex+2)+" | Data:"+this.tile_entity.getDataString()); } } return GT_Values.NI; @@ -141,7 +118,7 @@ public class Container_RoundRobinator extends Container { try { super.addCraftingToCrafters(par1ICrafting); } catch (Throwable var3) { - + var3.printStackTrace(); } } @@ -149,6 +126,7 @@ public class Container_RoundRobinator extends Container { try { super.removeCraftingFromCrafters(par1ICrafting); } catch (Throwable var3) { + var3.printStackTrace(); } } @@ -157,6 +135,7 @@ public class Container_RoundRobinator extends Container { super.detectAndSendChanges(); detectAndSendChangesEx(); } catch (Throwable var2) { + var2.printStackTrace(); } } @@ -165,6 +144,7 @@ public class Container_RoundRobinator extends Container { super.updateProgressBar(par1, par2); updateProgressBarEx(par1, par2); } catch (Throwable var4) { + var4.printStackTrace(); } } @@ -200,9 +180,6 @@ public class Container_RoundRobinator extends Container { this.mSide_4 = aTemp[3] ? 1 : 0; this.mTier = this.tile_entity.getTier(); this.mTickRate = this.tile_entity.getTickRate(); - - String InventoryContents = ArrayUtils.toString(aTemp, "null"); - //Logger.INFO("Test: "+InventoryContents); ++this.mTimer; Iterator var2 = this.crafters.iterator(); diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_RoundRobinator.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_RoundRobinator.java index c5a8341d8a..edb53e8ec0 100644 --- a/src/Java/gtPlusPlus/core/gui/machine/GUI_RoundRobinator.java +++ b/src/Java/gtPlusPlus/core/gui/machine/GUI_RoundRobinator.java @@ -105,7 +105,9 @@ public class GUI_RoundRobinator extends GuiContainer { mDrawItemStack.invoke(this, new Object[]{aRedGlass, x, y, ""}); } } - catch (Throwable t) {} + catch (Throwable t) { + t.printStackTrace(); + } } } diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockRoundRobinator.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockRoundRobinator.java index fa18d745fb..f586695eb7 100644 --- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockRoundRobinator.java +++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockRoundRobinator.java @@ -16,7 +16,7 @@ public class ItemBlockRoundRobinator extends ItemBlockWithMetadata public ItemBlockRoundRobinator(final Block aBlock){ super(aBlock, aBlock); this.mBlock = aBlock; - this.setMaxDamage(0); + this.setMaxDamage(4); this.setHasSubtypes(true); } @@ -38,10 +38,11 @@ public class ItemBlockRoundRobinator extends ItemBlockWithMetadata list.add("1 Item per enabled side every 10 ticks"); } else if (stack.getItemDamage() == 4) { - list.add("1 Item per enabled side every 1 ticks"); + list.add("1 Item per enabled side every tick"); } list.add("Top and bottom do not pull, so you must push item in"); list.add("Sides can also be disabled with a screwdriver"); + list.add("Shift+RMB with empty hand to view inventory contents"); super.addInformation(stack, aPlayer, list, bool); } @@ -52,7 +53,7 @@ public class ItemBlockRoundRobinator extends ItemBlockWithMetadata @SideOnly(Side.CLIENT) public IIcon getIconFromDamage(final int p_77617_1_) { - return this.mBlock.getIcon(2, p_77617_1_); + return this.mBlock.getIcon(0, p_77617_1_); } /** @@ -61,7 +62,7 @@ public class ItemBlockRoundRobinator extends ItemBlockWithMetadata @Override public int getMetadata(final int p_77647_1_) { - return p_77647_1_; + return super.getMetadata(p_77647_1_); } @Override diff --git a/src/Java/gtPlusPlus/core/material/ELEMENT.java b/src/Java/gtPlusPlus/core/material/ELEMENT.java index 99586b37fe..ba2579aa97 100644 --- a/src/Java/gtPlusPlus/core/material/ELEMENT.java +++ b/src/Java/gtPlusPlus/core/material/ELEMENT.java @@ -217,9 +217,32 @@ public final class ELEMENT { //Runescape materials - public static final Material BLACK_METAL = new Material("Black Metal", MaterialState.SOLID, TextureSet.SET_METALLIC, new short[] {5, 5, 5}, 2350, 4650, 24, 17, false, "҈", 0, new MaterialStack[]{new MaterialStack(getInstance().LEAD, 15), new MaterialStack(getInstance().TUNGSTEN, 25), new MaterialStack(getInstance().CARBON, 60)});//Not a GT Inherited Material + public static final Material BLACK_METAL = new Material("Black Metal", MaterialState.SOLID, TextureSet.SET_METALLIC, new short[] {5, 5, 5}, 2350, 4650, 24, 17, false, "҈", 0, new MaterialStack[]{new MaterialStack(getInstance().LEAD, 15), new MaterialStack(getInstance().MANGANESE, 25), new MaterialStack(getInstance().CARBON, 60)});//Not a GT Inherited Material public static final Material WHITE_METAL = new Material("White Metal", MaterialState.SOLID, TextureSet.SET_METALLIC, new short[] {255, 255, 255}, 4560, 7580, 35, 41, false, "҉", 0, new MaterialStack[]{new MaterialStack(getInstance().COPPER, 5), new MaterialStack(getInstance().ANTIMONY, 10), new MaterialStack(getInstance().PLATINUM, 10), new MaterialStack(getInstance().TIN, 75)});//Not a GT Inherited Material - public static final Material GRANITE = new Material("Ancient Granite", MaterialState.SOLID, TextureSet.SET_SAND, new short[] {107, 107, 107}, 500, 2000, 16, 12, false, "«»", 0, false);//Not a GT Inherited Material + + public static final Material GRANITE = new Material( + "Ancient Granite", + MaterialState.SOLID, + TextureSet.SET_SAND, + new short[] {107, 107, 107}, + 500, + 2000, + 16, + 12, + false, + "«»", + 0, + false, + new MaterialStack[]{ + new MaterialStack(getInstance().OXYGEN, 30), + new MaterialStack(getInstance().IRON, 20), + new MaterialStack(getInstance().SILICON, 20), + new MaterialStack(getInstance().ALUMINIUM, 10), + new MaterialStack(getInstance().POTASSIUM, 10), + new MaterialStack(getInstance().CALCIUM, 5), + new MaterialStack(getInstance().SODIUM, 5) + });//Not a GT Inherited Material + public static final Material RUNITE = new Material("Runite", MaterialState.SOLID, TextureSet.SET_FINE, new short[] {60, 200, 190}, 6750, 11550, 73, 87, true, "§", 0);//Not a GT Inherited Material public static final Material DRAGON_METAL = new Material("Dragonblood", MaterialState.SOLID, TextureSet.SET_SHINY, new short[] {220, 40, 20, 2}, 10160, 17850, 96, 105, true, "۞", 0);//Not a GT Inherited Material diff --git a/src/Java/gtPlusPlus/core/material/MISC_MATERIALS.java b/src/Java/gtPlusPlus/core/material/MISC_MATERIALS.java index 0e661fd429..6e1e6ea5ad 100644 --- a/src/Java/gtPlusPlus/core/material/MISC_MATERIALS.java +++ b/src/Java/gtPlusPlus/core/material/MISC_MATERIALS.java @@ -142,7 +142,7 @@ public final class MISC_MATERIALS { new MaterialStack(MaterialUtils.generateMaterialFromGtENUM(Materials.Galena), 1), new MaterialStack(MaterialUtils.generateMaterialFromGtENUM(Materials.Chalcopyrite), 1), new MaterialStack(MaterialUtils.generateMaterialFromGtENUM(Materials.Cobaltite), 1), - new MaterialStack(ELEMENT.STANDALONE.BLACK_METAL, 1) + new MaterialStack(ELEMENT.STANDALONE.GRANITE, 1) }); public static final Material RARE_EARTH_MID = new Material( @@ -162,8 +162,8 @@ public final class MISC_MATERIALS { new MaterialStack(ORES.CROCROITE, 1), new MaterialStack(ORES.NICHROMITE, 1), new MaterialStack(ORES.ZIRCON, 1), + new MaterialStack(ELEMENT.STANDALONE.GRANITE, 1), new MaterialStack(ELEMENT.STANDALONE.BLACK_METAL, 1), - new MaterialStack(ELEMENT.STANDALONE.WHITE_METAL, 1), new MaterialStack(ELEMENT.STANDALONE.RUNITE, 1) }); diff --git a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityRoundRobinator.java b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityRoundRobinator.java index 4950718f4a..a220997c84 100644 --- a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityRoundRobinator.java +++ b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityRoundRobinator.java @@ -118,14 +118,16 @@ public class TileEntityRoundRobinator extends TileEntity implements ISidedInvent if (tickCount % getTickRate() == 0) { if (hasInventoryContents()) { - Logger.INFO("Trying to move items. "+aTickRate); + Logger.WARNING("Trying to move items. "+aTickRate); this.tryProcessItems(); } } this.tickCount++; } } - catch (final Throwable t){} + catch (final Throwable t){ + t.printStackTrace(); + } } public boolean anyPlayerInRange() { @@ -270,6 +272,7 @@ public class TileEntityRoundRobinator extends TileEntity implements ISidedInvent return true; } catch (Throwable t) { + t.printStackTrace(); return false; } } @@ -333,6 +336,7 @@ public class TileEntityRoundRobinator extends TileEntity implements ISidedInvent } } catch (Throwable t) { + t.printStackTrace(); } } @@ -362,6 +366,7 @@ public class TileEntityRoundRobinator extends TileEntity implements ISidedInvent } } catch (Throwable t) { + t.printStackTrace(); return false; } } @@ -476,7 +481,7 @@ public class TileEntityRoundRobinator extends TileEntity implements ISidedInvent if (this.worldObj != null && !this.worldObj.isRemote) { boolean didSomething = false; if (!this.isEmpty()) { - Logger.INFO("Has Items, Trying to push to all active directions."); + Logger.WARNING("Has Items, Trying to push to all active directions."); didSomething = this.tryPushItemsIntoNeighbours(); } if (didSomething) { @@ -512,28 +517,28 @@ public class TileEntityRoundRobinator extends TileEntity implements ISidedInvent for (int u = 2; u < 6; u++) { if (!this.getSideActive(u)) { - Logger.INFO("Not pushing on side "+u); + Logger.WARNING("Not pushing on side "+u); continue; } - Logger.INFO("Pushing on side "+u); + Logger.WARNING("Pushing on side "+u); IInventory iinventory = this.getInventoryFromFacing(u); if (iinventory == null) { - Logger.INFO("No inventory found."); + Logger.WARNING("No inventory found."); continue; } else { int i = Facing.oppositeSide[u]; - Logger.INFO("Using Opposite direction: "+i); + Logger.WARNING("Using Opposite direction: "+i); if (this.isInventoryFull(iinventory, i)) { - Logger.INFO("Target is full, skipping."); + Logger.WARNING("Target is full, skipping."); continue; } else { - Logger.INFO("Target has space, let's move a single item."); + Logger.WARNING("Target has space, let's move a single item."); for (int j = 0; j < this.getSizeInventory(); ++j) { if (this.getStackInSlot(j) != null) { ItemStack itemstack = this.getStackInSlot(j).copy(); -- cgit From 162a990fe4a1cb9cbc18e011e4d69fc4da0693b6 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Tue, 10 Dec 2019 11:18:44 +0000 Subject: + Added support for Bio Circuits to Circuit Slots and the Circuit Programmer. --- .../multi/NoOutputBonusMultiBehaviour.java | 2 +- .../inventories/InventoryCircuitProgrammer.java | 4 +- .../core/slots/SlotIntegratedCircuit.java | 49 +++++++++++++++++++--- .../general/TileEntityCircuitProgrammer.java | 33 ++++++++++----- .../base/GregtechMeta_MultiBlockBase.java | 1 - 5 files changed, 70 insertions(+), 19 deletions(-) (limited to 'src/Java/gtPlusPlus/core/tileentities') diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/multi/NoOutputBonusMultiBehaviour.java b/src/Java/gtPlusPlus/api/objects/minecraft/multi/NoOutputBonusMultiBehaviour.java index 0769d0a473..4dc032d01f 100644 --- a/src/Java/gtPlusPlus/api/objects/minecraft/multi/NoOutputBonusMultiBehaviour.java +++ b/src/Java/gtPlusPlus/api/objects/minecraft/multi/NoOutputBonusMultiBehaviour.java @@ -6,7 +6,7 @@ import net.minecraft.item.ItemStack; public class NoOutputBonusMultiBehaviour extends SpecialMultiBehaviour { public NoOutputBonusMultiBehaviour() { - + // Used by other mods which may wish to not obtain bonus outputs on their Sifting or Maceration recipes. } @Override diff --git a/src/Java/gtPlusPlus/core/inventories/InventoryCircuitProgrammer.java b/src/Java/gtPlusPlus/core/inventories/InventoryCircuitProgrammer.java index 4cdbb72c6e..da45b5a988 100644 --- a/src/Java/gtPlusPlus/core/inventories/InventoryCircuitProgrammer.java +++ b/src/Java/gtPlusPlus/core/inventories/InventoryCircuitProgrammer.java @@ -1,6 +1,6 @@ package gtPlusPlus.core.inventories; -import gtPlusPlus.core.recipe.common.CI; +import gtPlusPlus.core.slots.SlotIntegratedCircuit; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; @@ -167,7 +167,7 @@ public class InventoryCircuitProgrammer implements IInventory{ */ @Override public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) { - return (itemstack.getItem() == CI.getNumberedCircuit(0).getItem()); + return SlotIntegratedCircuit.isItemValidForSlot(itemstack); } } \ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/slots/SlotIntegratedCircuit.java b/src/Java/gtPlusPlus/core/slots/SlotIntegratedCircuit.java index c41a385c4b..48b050d678 100644 --- a/src/Java/gtPlusPlus/core/slots/SlotIntegratedCircuit.java +++ b/src/Java/gtPlusPlus/core/slots/SlotIntegratedCircuit.java @@ -10,12 +10,13 @@ import gtPlusPlus.core.recipe.common.CI; public class SlotIntegratedCircuit extends Slot { public static Item mCircuitItem; + public static Item mCircuitItem2; private final short mCircuitLock; public SlotIntegratedCircuit(final IInventory inventory, final int slot, final int x, final int y) { this(Short.MAX_VALUE+1, inventory, slot, x, y); } - + public SlotIntegratedCircuit(int mTypeLock, final IInventory inventory, final int slot, final int x, final int y) { super(inventory, slot, x, y); if (mTypeLock > Short.MAX_VALUE || mTypeLock < Short.MIN_VALUE) { @@ -28,18 +29,29 @@ public class SlotIntegratedCircuit extends Slot { @Override public synchronized boolean isItemValid(final ItemStack itemstack) { + return isItemValidForSlot(mCircuitLock, itemstack); + } + + public static synchronized boolean isItemValidForSlot(final ItemStack itemstack) { + return isItemValidForSlot(-1, itemstack); + } + + public static synchronized boolean isItemValidForSlot(int aLockedCircuitNumber, final ItemStack itemstack) { boolean isValid = false; if (mCircuitItem == null) { mCircuitItem = CI.getNumberedCircuit(0).getItem(); } - if (mCircuitItem != null) { + if (mCircuitItem2 == null) { + mCircuitItem2 = CI.getNumberedBioCircuit(0).getItem(); + } + if (mCircuitItem != null && mCircuitItem2 != null) { if (itemstack != null) { - if (itemstack.getItem() == mCircuitItem) { - if (mCircuitLock == -1) { + if (itemstack.getItem() == mCircuitItem || itemstack.getItem() == mCircuitItem2) { + if (aLockedCircuitNumber == -1) { isValid = true; } else { - if (itemstack.getItemDamage() == mCircuitLock) { + if (itemstack.getItemDamage() == aLockedCircuitNumber) { isValid = true; } } @@ -49,6 +61,33 @@ public class SlotIntegratedCircuit extends Slot { return isValid; } + /** + * Returns the circuit type. -1 is invalid, 0 is standard, 1 is GT++ bio. + * @param itemstack - the Circuit Stack. + * @return + */ + public static synchronized int isRegularProgrammableCircuit(final ItemStack itemstack) { + if (mCircuitItem == null) { + mCircuitItem = CI.getNumberedCircuit(0).getItem(); + } + if (mCircuitItem2 == null) { + mCircuitItem2 = CI.getNumberedBioCircuit(0).getItem(); + } + if (mCircuitItem != null && mCircuitItem2 != null) { + if (itemstack != null) { + if (itemstack.getItem() == mCircuitItem || itemstack.getItem() == mCircuitItem2) { + if (itemstack.getItem() == mCircuitItem) { + return 0; + } + else if (itemstack.getItem() == mCircuitItem2) { + return 1; + } + } + } + } + return -1; + } + @Override public int getSlotStackLimit() { return 64; diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityCircuitProgrammer.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityCircuitProgrammer.java index 0157384cd0..23ad2a3233 100644 --- a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityCircuitProgrammer.java +++ b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityCircuitProgrammer.java @@ -11,6 +11,7 @@ import net.minecraft.tileentity.TileEntity; import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.core.inventories.InventoryCircuitProgrammer; import gtPlusPlus.core.recipe.common.CI; +import gtPlusPlus.core.slots.SlotIntegratedCircuit; import gtPlusPlus.core.util.minecraft.PlayerUtils; public class TileEntityCircuitProgrammer extends TileEntity implements ISidedInventory { @@ -76,16 +77,21 @@ public class TileEntityCircuitProgrammer extends TileEntity implements ISidedInv boolean doAdd = false; ItemStack g = this.getStackInSlot(e); int aSize = 0; - ItemStack aInputStack = null; - if (g != null) { + ItemStack aInputStack = null; + int aTypeInSlot = SlotIntegratedCircuit.isRegularProgrammableCircuit(g); + if (aTypeInSlot >= 0 && g != null) { + // No Existing Output if (!hasOutput) { aSize = g.stackSize; doAdd = true; } + // Existing Output else { ItemStack f = this.getStackInSlot(25); - if (f != null) { - if (f.getItemDamage() == e) { + int aTypeInCheckedSlot = SlotIntegratedCircuit.isRegularProgrammableCircuit(f); + // Check that the Circuit in the Output slot is not null and the same type as the circuit input. + if (aTypeInCheckedSlot >= 0 && (aTypeInSlot == aTypeInCheckedSlot) && f != null) { + if (g.getItem() == f.getItem() && f.getItemDamage() == e) { aSize = f.stackSize + g.stackSize; if (aSize > 64) { aInputStack = g.copy(); @@ -93,14 +99,21 @@ public class TileEntityCircuitProgrammer extends TileEntity implements ISidedInv } doAdd = true; } - } - else { - doAdd = true; - aSize = g.stackSize; } } - if (doAdd) { - ItemStack aOutput = CI.getNumberedCircuit(e); + if (doAdd) { + // Check Circuit Type + ItemStack aOutput; + if (aTypeInSlot == 0) { + aOutput = CI.getNumberedCircuit(e); + } + else if (aTypeInSlot == 1) { + aOutput = CI.getNumberedBioCircuit(e); + } + else { + aOutput = null; + } + if (aOutput != null) { aOutput.stackSize = aSize; this.setInventorySlotContents(e, aInputStack); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java index 55378113d9..fe9e3ee9a0 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java @@ -49,7 +49,6 @@ import gtPlusPlus.api.objects.data.ConcurrentSet; import gtPlusPlus.api.objects.data.FlexiblePair; import gtPlusPlus.api.objects.data.Triplet; import gtPlusPlus.api.objects.minecraft.BlockPos; -import gtPlusPlus.api.objects.minecraft.multi.NoOutputBonusMultiBehaviour; import gtPlusPlus.api.objects.minecraft.multi.SpecialMultiBehaviour; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; -- cgit