From 9d52b3d41d6dfdfb2e61cd59510b3a1d61925a16 Mon Sep 17 00:00:00 2001 From: Alkalus Date: Mon, 20 Nov 2017 23:21:15 +1000 Subject: + Added the Upgraded Arcane Alembic.$ Fixed the Upgraded Alchemy Furnace GUI. % Tried to make the 'Upgraded' Alembic & Furnace work better with the vanilla TC versions. $ Fixed the Upgraded Alchemy Furnace causing the tesselator to throw issues. $ Fixes to the Upgraded Arcane Alembic. --- src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (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 6dd948bcd1..83d274473c 100644 --- a/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java +++ b/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java @@ -1,13 +1,18 @@ package gtPlusPlus.core.tileentities; import cpw.mods.fml.common.registry.GameRegistry; -import gtPlusPlus.core.tileentities.general.*; +import gtPlusPlus.core.tileentities.general.TileEntityFirepit; +import gtPlusPlus.core.tileentities.general.TileEntityFishTrap; +import gtPlusPlus.core.tileentities.general.TileEntityHeliumGenerator; +import gtPlusPlus.core.tileentities.general.TileEntityInfiniteFluid; import gtPlusPlus.core.tileentities.machines.TileEntityModularityTable; 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.core.util.Utils; +import gtPlusPlus.xmod.thaumcraft.common.tile.TileFastAlchemyFurnace; +import gtPlusPlus.xmod.thaumcraft.common.tile.TileFastArcaneAlembic; public class ModTileEntities { @@ -30,6 +35,8 @@ public class ModTileEntities { GameRegistry.registerTileEntity(TileEntityProjectTable.class, "TileProjectTable"); GameRegistry.registerTileEntity(TileEntityTradeTable.class, "TileTradeTable"); GameRegistry.registerTileEntity(TileEntityModularityTable.class, "TileEntityModularityTable"); + GameRegistry.registerTileEntity(TileFastAlchemyFurnace.class, "TileFastAlchemyFurnace"); + GameRegistry.registerTileEntity(TileFastArcaneAlembic.class, "TileFastArcaneAlembic"); } -- cgit From b86f9e013b478725a3772b98e67490a3f2a044f6 Mon Sep 17 00:00:00 2001 From: Alkalus Date: Thu, 23 Nov 2017 17:06:21 +1000 Subject: + Added Ink Sacs to Fish trap loot. + Added recycling recipes for all material components. + Added EnderIO alloys to the Alloy Blast Smelter. - Reduced rate of Sand from Fish Trap by 5%. - Removed some logging. $ Fixed Tooltip of Large Sifter stating it only required 9 Sieves, now says 18 as intended. $ Fixed Recipe Recycling not working as intended. --- .../tileentities/general/TileEntityFishTrap.java | 127 ++++++++++----------- 1 file changed, 61 insertions(+), 66 deletions(-) (limited to 'src/Java/gtPlusPlus/core/tileentities') diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java index bd2f8b727c..d73de219e4 100644 --- a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java +++ b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java @@ -9,7 +9,6 @@ import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.xmod.gregtech.api.objects.XSTR; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -101,24 +100,24 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory { int checkingSlot = 0; final ItemStack loot = this.generateLootForFishTrap().copy(); try { - //Utils.LOG_INFO("Trying to add "+loot.getDisplayName()+" | "+loot.getItemDamage()); + //Utils.LOG_WARNING("Trying to add "+loot.getDisplayName()+" | "+loot.getItemDamage()); for (final ItemStack contents : this.getInventory().getInventory()) { if (GT_Utility.areStacksEqual(loot, contents)){ if (contents.stackSize < contents.getMaxStackSize()) { - //Utils.LOG_INFO("3-Trying to add one more "+loot.getDisplayName()+"meta: "+loot.getItemDamage()+" to an existing stack of "+contents.getDisplayName()+" with a size of "+contents.stackSize); + //Utils.LOG_WARNING("3-Trying to add one more "+loot.getDisplayName()+"meta: "+loot.getItemDamage()+" to an existing stack of "+contents.getDisplayName()+" with a size of "+contents.stackSize); contents.stackSize++; this.markDirty(); - return true; + return true; } } checkingSlot++; } checkingSlot = 0; for (final ItemStack contents : this.getInventory().getInventory()) { - if (contents == null) { - //Utils.LOG_INFO("Adding Item To Empty Slot. "+(checkingSlot+1)); + if (contents == null) { + //Utils.LOG_WARNING("Adding Item To Empty Slot. "+(checkingSlot+1)); this.getInventory().setInventorySlotContents(checkingSlot, loot); this.markDirty(); return true; @@ -126,7 +125,7 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory { checkingSlot++; } } - catch (NullPointerException n) { + catch (final NullPointerException n) { } } this.markDirty(); @@ -142,9 +141,12 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory { else if (lootWeight <= 10) { loot = ItemUtils.getSimpleStack(Items.bone); } - else if (lootWeight <= 20) { + else if (lootWeight <= 15) { loot = ItemUtils.getSimpleStack(Blocks.sand); } + else if (lootWeight <= 20) { + loot = ItemUtils.simpleMetaStack(Items.dye, 0, 1); + } // Junk Loot else if (lootWeight <= 23) { if (LoadedMods.PamsHarvestcraft) { @@ -156,12 +158,12 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory { } // Pam Fish else if (lootWeight <= 99) { - Random xstr = new Random(); + final Random xstr = new Random(); loot = FishingHooks.getRandomFishable(xstr, 100); } else if (lootWeight == 100){ - int rareLoot = MathUtils.randInt(1, 10); + final int rareLoot = MathUtils.randInt(1, 10); if (rareLoot <= 4) { loot = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("nuggetIron", 1); if (loot == null){ @@ -173,7 +175,7 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory { if (loot == null){ loot = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("ingotGold", 1); } - } + } else if (rareLoot <= 9){ loot = ItemUtils.getSimpleStack(Items.emerald); } @@ -192,47 +194,47 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory { @Override public void updateEntity() { try{ - if (!this.worldObj.isRemote) { - this.tickCount++; - // Utils.LOG_WARNING("Ticking "+this.tickCount); - // Check if the Tile is within water once per second. - if ((this.tickCount % 20) == 0) { - this.isInWater = this.isSurroundedByWater(); - } - else { - - } + if (!this.worldObj.isRemote) { + this.tickCount++; + // Utils.LOG_WARNING("Ticking "+this.tickCount); + // Check if the Tile is within water once per second. + if ((this.tickCount % 20) == 0) { + this.isInWater = this.isSurroundedByWater(); + } + else { - if (this.isInWater) { - this.calculateTickrate(); - } + } - // Try add some loot once every 30 seconds. - if ((this.tickCount % this.baseTickRate) == 0) { if (this.isInWater) { - // Add loot - // Utils.LOG_WARNING("Adding Loot to the fishtrap at - // x["+this.locationX+"] y["+this.locationY+"] - // z["+this.locationZ+"] (Ticking for loot every - // "+this.baseTickRate+" ticks)"); - this.tryAddLoot(); - this.markDirty(); + this.calculateTickrate(); } - else { - Utils.LOG_INFO("This Trap does not have enough water around it."); - Utils.LOG_WARNING("Not adding Loot to the fishtrap at x[" + this.locationX + "] y[" + this.locationY - + "] z[" + this.locationZ + "] (Ticking for loot every " + this.baseTickRate + " ticks)"); - this.markDirty(); + + // Try add some loot once every 30 seconds. + if ((this.tickCount % this.baseTickRate) == 0) { + if (this.isInWater) { + // Add loot + // Utils.LOG_WARNING("Adding Loot to the fishtrap at + // x["+this.locationX+"] y["+this.locationY+"] + // z["+this.locationZ+"] (Ticking for loot every + // "+this.baseTickRate+" ticks)"); + this.tryAddLoot(); + this.markDirty(); + } + else { + Utils.LOG_WARNING("This Trap does not have enough water around it."); + Utils.LOG_WARNING("Not adding Loot to the fishtrap at x[" + this.locationX + "] y[" + this.locationY + + "] z[" + this.locationZ + "] (Ticking for loot every " + this.baseTickRate + " ticks)"); + this.markDirty(); + } + this.tickCount = 0; + } + if (this.tickCount > (this.baseTickRate + 500)) { + this.tickCount = 0; } - this.tickCount = 0; - } - if (this.tickCount > (this.baseTickRate + 500)) { - this.tickCount = 0; - } + } } - } - catch (Throwable t){} + catch (final Throwable t){} } public void calculateTickrate() { @@ -293,13 +295,6 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory { "Crayfish", "Eel", "Frog", "Grouper", "Herring", "Jellyfish", "Mudfish", "Octopus", "Perch", "Scallop", "Shrimp", "Snail", "Snapper", "Tilapia", "Trout", "Tuna", "Turtle", "Walleye" }; - private static final ItemStack[] minecraftFish = { - ItemUtils.simpleMetaStack(Items.fish, 0, 1).copy(), - ItemUtils.simpleMetaStack(Items.fish, 1, 1).copy(), - ItemUtils.simpleMetaStack(Items.fish, 2, 1).copy(), - ItemUtils.simpleMetaStack(Items.fish, 3, 1).copy() - }; - public static void pamsHarvestCraftCompat() { for (int i = 0; i < harvestcraftFish.length; i++) { @@ -312,22 +307,22 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory { } @Override - public ItemStack getStackInSlot(int slot) { + public ItemStack getStackInSlot(final int slot) { return this.getInventory().getStackInSlot(slot); } @Override - public ItemStack decrStackSize(int slot, int count) { + public ItemStack decrStackSize(final int slot, final int count) { return this.getInventory().decrStackSize(slot, count); } @Override - public ItemStack getStackInSlotOnClosing(int slot) { + public ItemStack getStackInSlotOnClosing(final int slot) { return this.getInventory().getStackInSlotOnClosing(slot); } @Override - public void setInventorySlotContents(int slot, ItemStack stack) { + public void setInventorySlotContents(final int slot, final ItemStack stack) { this.getInventory().setInventorySlotContents(slot, stack); } @@ -337,7 +332,7 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory { } @Override - public boolean isUseableByPlayer(EntityPlayer entityplayer) { + public boolean isUseableByPlayer(final EntityPlayer entityplayer) { return this.getInventory().isUseableByPlayer(entityplayer); } @@ -346,7 +341,7 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory { 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 @@ -354,17 +349,17 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory { 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(int slot, ItemStack itemstack) { + public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) { return this.getInventory().isItemValidForSlot(slot, itemstack); } @Override - public int[] getAccessibleSlotsFromSide(int p_94128_1_) { - int[] accessibleSides = new int[this.getSizeInventory()]; + public int[] getAccessibleSlotsFromSide(final int p_94128_1_) { + final int[] accessibleSides = new int[this.getSizeInventory()]; for (int r=0; r Date: Fri, 24 Nov 2017 13:41:48 +1000 Subject: + Added a simple block that can convert liquid xp to mob essence and back. + Added some Enchantment utilities. --- .../general/TileEntityXpConverter.java | 193 +++++++++++++++++++++ 1 file changed, 193 insertions(+) create mode 100644 src/Java/gtPlusPlus/core/tileentities/general/TileEntityXpConverter.java (limited to 'src/Java/gtPlusPlus/core/tileentities') diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityXpConverter.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityXpConverter.java new file mode 100644 index 0000000000..990304cf07 --- /dev/null +++ b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityXpConverter.java @@ -0,0 +1,193 @@ +package gtPlusPlus.core.tileentities.general; + +import gtPlusPlus.core.util.enchantment.EnchantmentUtils; +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.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; + +public class TileEntityXpConverter extends TileEntity implements IFluidHandler { + + public FluidTank tankEssence = new FluidTank((int) (64000*EnchantmentUtils.RATIO_MOB_ESSENCE_TO_LIQUID_XP)); + public FluidTank tankLiquidXp = new FluidTank(64000); + private boolean needsUpdate = false; + private int updateTimer = 0; + + public TileEntityXpConverter() { + } + + @Override + public int fill(final ForgeDirection from, final FluidStack resource, final boolean doFill) { + this.needsUpdate = true; + if (resource.isFluidEqual(EnchantmentUtils.getLiquidXP(1))){ + return this.tankLiquidXp.fill(resource, doFill); + } + else if (resource.isFluidEqual(EnchantmentUtils.getMobEssence(1))){ + return this.tankEssence.fill(resource, doFill); + } + else { + return 0; + } + } + + @Override + public FluidStack drain(final ForgeDirection from, final FluidStack resource, final boolean doDrain) { + this.needsUpdate = true; + if (resource.isFluidEqual(EnchantmentUtils.getLiquidXP(1))){ + return this.tankLiquidXp.drain(resource.amount, doDrain); + } + else if (resource.isFluidEqual(EnchantmentUtils.getMobEssence(1))){ + return this.tankEssence.drain(resource.amount, doDrain); + } + else { + return null; + } + + } + + @Override + public FluidStack drain(final ForgeDirection from, final int maxDrain, final boolean doDrain) { + this.needsUpdate = true; + final FluidStack fluid_Essence = this.tankEssence.getFluid(); + final FluidStack fluid_Xp = this.tankLiquidXp.getFluid(); + if ((fluid_Essence == null) && (fluid_Xp == null)) { + return null; + } + + FluidStack fluid; + FluidTank tank; + + if ((from == ForgeDirection.UP) || (from == ForgeDirection.DOWN)){ + fluid = fluid_Essence; + tank = this.tankEssence; + } + else { + fluid = fluid_Xp; + tank = this.tankLiquidXp; + } + + int drained = maxDrain; + if (fluid.amount < drained) { + drained = fluid.amount; + } + + final 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, tank, 0)); + } + } + return stack; + } + + @Override + public boolean canFill(final ForgeDirection from, final Fluid fluid) { + return true; + } + + @Override + public boolean canDrain(final ForgeDirection from, final Fluid fluid) { + return true; + } + + @Override + public FluidTankInfo[] getTankInfo(final ForgeDirection from) { + if ((from == ForgeDirection.UP) || (from == ForgeDirection.DOWN)){ + return new FluidTankInfo[] { this.tankEssence.getInfo() }; + } + else { + return new FluidTankInfo[] { this.tankLiquidXp.getInfo() }; + } + } + + public float getAdjustedVolume() { + this.needsUpdate = true; + final float amount = this.tankLiquidXp.getFluidAmount(); + final float capacity = this.tankLiquidXp.getCapacity(); + final float volume = (amount / capacity) * 0.8F; + return volume; + } + + @Override + public void updateEntity() { + + if (this.tankEssence.getFluid() != null){ + final FluidStack bigStorage = this.tankEssence.getFluid(); + bigStorage.amount = this.tankEssence.getCapacity(); + this.tankEssence.setFluid(bigStorage); + } + + if (this.tankLiquidXp.getFluid() != null){ + final FluidStack bigStorage = this.tankLiquidXp.getFluid(); + bigStorage.amount = this.tankLiquidXp.getCapacity(); + this.tankLiquidXp.setFluid(bigStorage); + } + + if (this.needsUpdate) { + + if (this.tankEssence.getFluid() != null){ + final FluidStack bigStorage = this.tankEssence.getFluid(); + bigStorage.amount = this.tankEssence.getCapacity(); + this.tankEssence.setFluid(bigStorage); + } + + if (this.tankLiquidXp.getFluid() != null){ + final FluidStack bigStorage = this.tankLiquidXp.getFluid(); + bigStorage.amount = this.tankLiquidXp.getCapacity(); + this.tankLiquidXp.setFluid(bigStorage); + } + + if (this.updateTimer == 0) { + this.updateTimer = 10; // every 10 ticks it will send an update + } else { + --this.updateTimer; + if (this.updateTimer == 0) { + this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); + this.needsUpdate = false; + } + } + } + } + + @Override + public void readFromNBT(final NBTTagCompound tag) { + this.tankEssence.readFromNBT(tag); + this.tankLiquidXp.readFromNBT(tag); + super.readFromNBT(tag); + } + + @Override + public void writeToNBT(final NBTTagCompound tag) { + this.tankEssence.writeToNBT(tag); + this.tankLiquidXp.writeToNBT(tag); + super.writeToNBT(tag); + } + + @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); + } + +} -- cgit From 27a3675ced121616092334e68b8ae2719a86abaf Mon Sep 17 00:00:00 2001 From: Alkalus Date: Fri, 24 Nov 2017 13:50:31 +1000 Subject: % Refactored a package and class name. --- .../core/tileentities/general/TileEntityXpConverter.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/Java/gtPlusPlus/core/tileentities') diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityXpConverter.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityXpConverter.java index 990304cf07..ca190802dc 100644 --- a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityXpConverter.java +++ b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityXpConverter.java @@ -1,6 +1,6 @@ package gtPlusPlus.core.tileentities.general; -import gtPlusPlus.core.util.enchantment.EnchantmentUtils; +import gtPlusPlus.core.util.enchanting.EnchantingUtils; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; @@ -16,7 +16,7 @@ import net.minecraftforge.fluids.IFluidHandler; public class TileEntityXpConverter extends TileEntity implements IFluidHandler { - public FluidTank tankEssence = new FluidTank((int) (64000*EnchantmentUtils.RATIO_MOB_ESSENCE_TO_LIQUID_XP)); + public FluidTank tankEssence = new FluidTank((int) (64000*EnchantingUtils.RATIO_MOB_ESSENCE_TO_LIQUID_XP)); public FluidTank tankLiquidXp = new FluidTank(64000); private boolean needsUpdate = false; private int updateTimer = 0; @@ -27,10 +27,10 @@ public class TileEntityXpConverter extends TileEntity implements IFluidHandler { @Override public int fill(final ForgeDirection from, final FluidStack resource, final boolean doFill) { this.needsUpdate = true; - if (resource.isFluidEqual(EnchantmentUtils.getLiquidXP(1))){ + if (resource.isFluidEqual(EnchantingUtils.getLiquidXP(1))){ return this.tankLiquidXp.fill(resource, doFill); } - else if (resource.isFluidEqual(EnchantmentUtils.getMobEssence(1))){ + else if (resource.isFluidEqual(EnchantingUtils.getMobEssence(1))){ return this.tankEssence.fill(resource, doFill); } else { @@ -41,10 +41,10 @@ public class TileEntityXpConverter extends TileEntity implements IFluidHandler { @Override public FluidStack drain(final ForgeDirection from, final FluidStack resource, final boolean doDrain) { this.needsUpdate = true; - if (resource.isFluidEqual(EnchantmentUtils.getLiquidXP(1))){ + if (resource.isFluidEqual(EnchantingUtils.getLiquidXP(1))){ return this.tankLiquidXp.drain(resource.amount, doDrain); } - else if (resource.isFluidEqual(EnchantmentUtils.getMobEssence(1))){ + else if (resource.isFluidEqual(EnchantingUtils.getMobEssence(1))){ return this.tankEssence.drain(resource.amount, doDrain); } else { -- cgit From b5fd7c514de976e5f0b550e751ae3a73001ac67e Mon Sep 17 00:00:00 2001 From: Alkalus Date: Fri, 24 Nov 2017 17:20:03 +1000 Subject: $ Fixed issue where all my blocks allowed mobs to spawn. % More Work on the Xp Converter. % Formatting. --- .../core/tileentities/ModTileEntities.java | 10 ++----- .../general/TileEntityXpConverter.java | 31 +++++++++++++++++----- 2 files changed, 26 insertions(+), 15 deletions(-) (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 83d274473c..87fb8ef76d 100644 --- a/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java +++ b/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java @@ -5,6 +5,7 @@ import gtPlusPlus.core.tileentities.general.TileEntityFirepit; import gtPlusPlus.core.tileentities.general.TileEntityFishTrap; import gtPlusPlus.core.tileentities.general.TileEntityHeliumGenerator; import gtPlusPlus.core.tileentities.general.TileEntityInfiniteFluid; +import gtPlusPlus.core.tileentities.general.TileEntityXpConverter; import gtPlusPlus.core.tileentities.machines.TileEntityModularityTable; import gtPlusPlus.core.tileentities.machines.TileEntityProjectTable; import gtPlusPlus.core.tileentities.machines.TileEntityTradeTable; @@ -18,14 +19,6 @@ public class ModTileEntities { public static void init() { Utils.LOG_INFO("Registering Tile Entities."); - // GameRegistry.registerTileEntity(TileEntityReverter.class, - // "TE_blockGriefSaver"); - // GameRegistry.registerTileEntity(TileEntityReverter.class, "Tower - // Reverter"); - // GameRegistry.registerTileEntity(TileEntityNHG.class, - // "NuclearFueledHeliumGenerator"); - // GameRegistry.registerTileEntity(TileEntityCharger.class, - // "TE_Charger"); GameRegistry.registerTileEntity(TileEntityHeliumGenerator.class, "HeliumGenerator"); GameRegistry.registerTileEntity(TileEntityWorkbench.class, "TileWorkbench"); GameRegistry.registerTileEntity(TileEntityWorkbenchAdvanced.class, "TileWorkbenchAdvanced"); @@ -37,6 +30,7 @@ public class ModTileEntities { GameRegistry.registerTileEntity(TileEntityModularityTable.class, "TileEntityModularityTable"); GameRegistry.registerTileEntity(TileFastAlchemyFurnace.class, "TileFastAlchemyFurnace"); GameRegistry.registerTileEntity(TileFastArcaneAlembic.class, "TileFastArcaneAlembic"); + GameRegistry.registerTileEntity(TileEntityXpConverter.class, "TileEntityXpConverter"); } diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityXpConverter.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityXpConverter.java index ca190802dc..09fea921a5 100644 --- a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityXpConverter.java +++ b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityXpConverter.java @@ -1,6 +1,8 @@ package gtPlusPlus.core.tileentities.general; import gtPlusPlus.core.util.enchanting.EnchantingUtils; +import gtPlusPlus.core.util.player.PlayerUtils; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; @@ -91,6 +93,14 @@ public class TileEntityXpConverter extends TileEntity implements IFluidHandler { this.yCoord, this.zCoord, tank, 0)); } } + + if ((from == ForgeDirection.UP) || (from == ForgeDirection.DOWN)){ + this.tankEssence = tank; + } + else { + this.tankLiquidXp = tank; + } + return stack; } @@ -125,7 +135,7 @@ public class TileEntityXpConverter extends TileEntity implements IFluidHandler { @Override public void updateEntity() { - if (this.tankEssence.getFluid() != null){ + /*if (this.tankEssence.getFluid() != null){ final FluidStack bigStorage = this.tankEssence.getFluid(); bigStorage.amount = this.tankEssence.getCapacity(); this.tankEssence.setFluid(bigStorage); @@ -135,20 +145,19 @@ public class TileEntityXpConverter extends TileEntity implements IFluidHandler { final FluidStack bigStorage = this.tankLiquidXp.getFluid(); bigStorage.amount = this.tankLiquidXp.getCapacity(); this.tankLiquidXp.setFluid(bigStorage); - } + }*/ if (this.needsUpdate) { - if (this.tankEssence.getFluid() != null){ + /*if (this.tankEssence.getFluid() != null){ final FluidStack bigStorage = this.tankEssence.getFluid(); bigStorage.amount = this.tankEssence.getCapacity(); this.tankEssence.setFluid(bigStorage); - } + }*/ if (this.tankLiquidXp.getFluid() != null){ - final FluidStack bigStorage = this.tankLiquidXp.getFluid(); - bigStorage.amount = this.tankLiquidXp.getCapacity(); - this.tankLiquidXp.setFluid(bigStorage); + final FluidStack bigStorage = EnchantingUtils.getEssenceFromLiquidXp(this.tankLiquidXp.getFluidAmount()); + this.tankEssence.setFluid(bigStorage); } if (this.updateTimer == 0) { @@ -190,4 +199,12 @@ public class TileEntityXpConverter extends TileEntity implements IFluidHandler { this.readFromNBT(tag); } + public void onScrewdriverRightClick(final byte aSide, final EntityPlayer aPlayer, final float aX, final float aY, final float aZ) { + PlayerUtils.messagePlayer(aPlayer, "Screwdriver Rightclick."); + } + + public void onRightClick(final byte aSide, final EntityPlayer aPlayer, final int aX, final int aY, final int aZ) { + PlayerUtils.messagePlayer(aPlayer, "Rightclick."); + } + } -- cgit From ecbe25305fedc7119d034abc68547ebfed8b6725 Mon Sep 17 00:00:00 2001 From: Alkalus Date: Sat, 25 Nov 2017 15:25:40 +1000 Subject: $ More Fixes to the Xp Converter. --- .../general/TileEntityXpConverter.java | 158 +++++++++++++++------ 1 file changed, 111 insertions(+), 47 deletions(-) (limited to 'src/Java/gtPlusPlus/core/tileentities') diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityXpConverter.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityXpConverter.java index 09fea921a5..e3650b5dca 100644 --- a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityXpConverter.java +++ b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityXpConverter.java @@ -1,5 +1,6 @@ package gtPlusPlus.core.tileentities.general; +import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.enchanting.EnchantingUtils; import gtPlusPlus.core.util.player.PlayerUtils; import net.minecraft.entity.player.EntityPlayer; @@ -22,6 +23,7 @@ public class TileEntityXpConverter extends TileEntity implements IFluidHandler { public FluidTank tankLiquidXp = new FluidTank(64000); private boolean needsUpdate = false; private int updateTimer = 0; + private boolean mConvertToEssence = true; public TileEntityXpConverter() { } @@ -29,35 +31,52 @@ public class TileEntityXpConverter extends TileEntity implements IFluidHandler { @Override public int fill(final ForgeDirection from, final FluidStack resource, final boolean doFill) { this.needsUpdate = true; - if (resource.isFluidEqual(EnchantingUtils.getLiquidXP(1))){ - return this.tankLiquidXp.fill(resource, doFill); - } - else if (resource.isFluidEqual(EnchantingUtils.getMobEssence(1))){ - return this.tankEssence.fill(resource, doFill); + Utils.LOG_INFO("Ticking. | mConvertToEssence: "+this.mConvertToEssence); + if (this.mConvertToEssence){ + if (resource.isFluidEqual(EnchantingUtils.getLiquidXP(1))){ + Utils.LOG_INFO("fill(tankLiquidXp)"); + return this.tankLiquidXp.fill(resource, doFill); + } + else { + Utils.LOG_INFO("Looking for Liquid Xp, Instead found "+resource.getLocalizedName()+"."); + } } else { - return 0; + if (resource.isFluidEqual(EnchantingUtils.getMobEssence(1))){ + Utils.LOG_INFO("fill(tankEssence)"); + return this.tankEssence.fill(resource, doFill); + } + else { + Utils.LOG_INFO("Looking for Essence, Instead found "+resource.getLocalizedName()+"."); + } } + Utils.LOG_INFO("fill(0)"); + return 0; } @Override public FluidStack drain(final ForgeDirection from, final FluidStack resource, final boolean doDrain) { this.needsUpdate = true; - if (resource.isFluidEqual(EnchantingUtils.getLiquidXP(1))){ - return this.tankLiquidXp.drain(resource.amount, doDrain); - } - else if (resource.isFluidEqual(EnchantingUtils.getMobEssence(1))){ - return this.tankEssence.drain(resource.amount, doDrain); + if (this.mConvertToEssence){ + if (resource.isFluidEqual(EnchantingUtils.getMobEssence(1))){ + Utils.LOG_INFO("drain(mConvertToEssence)"); + return this.tankEssence.drain(resource.amount, doDrain); + } } else { - return null; + if (resource.isFluidEqual(EnchantingUtils.getLiquidXP(1))){ + Utils.LOG_INFO("drain(tankLiquidXp)"); + return this.tankLiquidXp.drain(resource.amount, doDrain); + } } - + Utils.LOG_INFO("drain(null)"); + return null; } @Override public FluidStack drain(final ForgeDirection from, final int maxDrain, final boolean doDrain) { this.needsUpdate = true; + Utils.LOG_INFO("drain(Ex)"); final FluidStack fluid_Essence = this.tankEssence.getFluid(); final FluidStack fluid_Xp = this.tankLiquidXp.getFluid(); if ((fluid_Essence == null) && (fluid_Xp == null)) { @@ -67,7 +86,7 @@ public class TileEntityXpConverter extends TileEntity implements IFluidHandler { FluidStack fluid; FluidTank tank; - if ((from == ForgeDirection.UP) || (from == ForgeDirection.DOWN)){ + if (this.mConvertToEssence){ fluid = fluid_Essence; tank = this.tankEssence; } @@ -94,29 +113,55 @@ public class TileEntityXpConverter extends TileEntity implements IFluidHandler { } } - if ((from == ForgeDirection.UP) || (from == ForgeDirection.DOWN)){ + + if (this.mConvertToEssence){ this.tankEssence = tank; } else { this.tankLiquidXp = tank; } + Utils.LOG_INFO("drain(Ex2)"); return stack; } @Override public boolean canFill(final ForgeDirection from, final Fluid fluid) { - return true; + if (this.mConvertToEssence){ + if (this.tankEssence.getFluidAmount() < this.tankEssence.getCapacity()){ + Utils.LOG_INFO("canFill(mConvertToEssence)"); + return true; + } + } + else { + if (this.tankLiquidXp.getFluidAmount() < this.tankLiquidXp.getCapacity()){ + Utils.LOG_INFO("canFill(tankLiquidXp)"); + return true; + } + } + Utils.LOG_INFO("canFill(false)"); + return false; } @Override public boolean canDrain(final ForgeDirection from, final Fluid fluid) { - return true; + if (this.mConvertToEssence){ + if (this.tankEssence.getFluidAmount() > 0){ + return true; + } + } + else { + if (this.tankLiquidXp.getFluidAmount() > 0){ + return true; + } + } + Utils.LOG_INFO("canDrain(false)"); + return false; } @Override public FluidTankInfo[] getTankInfo(final ForgeDirection from) { - if ((from == ForgeDirection.UP) || (from == ForgeDirection.DOWN)){ + if (this.mConvertToEssence){ return new FluidTankInfo[] { this.tankEssence.getInfo() }; } else { @@ -125,6 +170,7 @@ public class TileEntityXpConverter extends TileEntity implements IFluidHandler { } public float getAdjustedVolume() { + Utils.LOG_INFO("AdjustedVolume()"); this.needsUpdate = true; final float amount = this.tankLiquidXp.getFluidAmount(); final float capacity = this.tankLiquidXp.getCapacity(); @@ -135,47 +181,52 @@ public class TileEntityXpConverter extends TileEntity implements IFluidHandler { @Override public void updateEntity() { - /*if (this.tankEssence.getFluid() != null){ - final FluidStack bigStorage = this.tankEssence.getFluid(); - bigStorage.amount = this.tankEssence.getCapacity(); - this.tankEssence.setFluid(bigStorage); - } + if (!this.getWorldObj().isRemote){ - if (this.tankLiquidXp.getFluid() != null){ - final FluidStack bigStorage = this.tankLiquidXp.getFluid(); - bigStorage.amount = this.tankLiquidXp.getCapacity(); - this.tankLiquidXp.setFluid(bigStorage); - }*/ + //Utils.LOG_INFO("Ticking. | mConvertToEssence: "+this.mConvertToEssence); - if (this.needsUpdate) { + if (this.needsUpdate) { - /*if (this.tankEssence.getFluid() != null){ - final FluidStack bigStorage = this.tankEssence.getFluid(); - bigStorage.amount = this.tankEssence.getCapacity(); - this.tankEssence.setFluid(bigStorage); - }*/ - - if (this.tankLiquidXp.getFluid() != null){ - final FluidStack bigStorage = EnchantingUtils.getEssenceFromLiquidXp(this.tankLiquidXp.getFluidAmount()); - this.tankEssence.setFluid(bigStorage); + if (this.updateTimer == 0) { + this.updateTimer = 10; // every 10 ticks it will send an update + } else { + --this.updateTimer; + if (this.updateTimer == 0) { + this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); + this.needsUpdate = false; + } + } } - if (this.updateTimer == 0) { - this.updateTimer = 10; // every 10 ticks it will send an update - } else { - --this.updateTimer; - if (this.updateTimer == 0) { - this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); - this.needsUpdate = false; + + if (this.mConvertToEssence){ + if ((this.tankLiquidXp.getFluid() != null) && (this.tankLiquidXp.getFluidAmount() >= 100) && (this.tankEssence.getFluidAmount() <= (this.tankEssence.getCapacity()-(100*EnchantingUtils.RATIO_MOB_ESSENCE_TO_LIQUID_XP)))){ + final FluidStack bigStorage = EnchantingUtils.getEssenceFromLiquidXp(100); + this.tankEssence.fill(bigStorage, true); + this.tankLiquidXp.drain(100, true); + this.needsUpdate = true; + Utils.LOG_INFO("B->A"); + } + } + else { + final double rm = EnchantingUtils.RATIO_MOB_ESSENCE_TO_LIQUID_XP; + if ((this.tankEssence.getFluid() != null) && (this.tankEssence.getFluidAmount() >= rm) && (this.tankLiquidXp.getFluidAmount() <= (this.tankLiquidXp.getCapacity()-rm))){ + final FluidStack bigStorage = EnchantingUtils.getLiquidXP(1); + this.tankLiquidXp.fill(bigStorage, true); + this.tankEssence.drain((int) rm, true); + this.needsUpdate = true; + Utils.LOG_INFO("A->B"); } } } + } @Override public void readFromNBT(final NBTTagCompound tag) { this.tankEssence.readFromNBT(tag); this.tankLiquidXp.readFromNBT(tag); + tag.setBoolean("mConvertToEssence", this.mConvertToEssence); super.readFromNBT(tag); } @@ -183,6 +234,7 @@ public class TileEntityXpConverter extends TileEntity implements IFluidHandler { public void writeToNBT(final NBTTagCompound tag) { this.tankEssence.writeToNBT(tag); this.tankLiquidXp.writeToNBT(tag); + this.mConvertToEssence = tag.getBoolean("mConvertToEssence"); super.writeToNBT(tag); } @@ -200,11 +252,23 @@ public class TileEntityXpConverter extends TileEntity implements IFluidHandler { } public void onScrewdriverRightClick(final byte aSide, final EntityPlayer aPlayer, final float aX, final float aY, final float aZ) { - PlayerUtils.messagePlayer(aPlayer, "Screwdriver Rightclick."); + + if (!this.getWorldObj().isRemote){ + + if (this.mConvertToEssence){ + PlayerUtils.messagePlayer(aPlayer, "Converting from Mob Essence to Liquid Xp."); + this.mConvertToEssence = false; + } + else { + PlayerUtils.messagePlayer(aPlayer, "Converting from Liquid Xp to Mob Essence."); + this.mConvertToEssence = true; + } + } + } public void onRightClick(final byte aSide, final EntityPlayer aPlayer, final int aX, final int aY, final int aZ) { - PlayerUtils.messagePlayer(aPlayer, "Rightclick."); + } } -- cgit From a8442c40315db01d24845faac17c52af11191036 Mon Sep 17 00:00:00 2001 From: Alkalus Date: Sun, 26 Nov 2017 17:19:56 +1000 Subject: $ Fixed the Xp Converter not retaining its mode. --- .../general/TileEntityXpConverter.java | 54 ++++++++++++++++++---- 1 file changed, 45 insertions(+), 9 deletions(-) (limited to 'src/Java/gtPlusPlus/core/tileentities') diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityXpConverter.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityXpConverter.java index e3650b5dca..8491cf8f6e 100644 --- a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityXpConverter.java +++ b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityXpConverter.java @@ -1,5 +1,7 @@ package gtPlusPlus.core.tileentities.general; +import org.lwjgl.input.Keyboard; + import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.enchanting.EnchantingUtils; import gtPlusPlus.core.util.player.PlayerUtils; @@ -28,6 +30,26 @@ public class TileEntityXpConverter extends TileEntity implements IFluidHandler { public TileEntityXpConverter() { } + private void changeMode(){ + if (this.mConvertToEssence){ + this.mConvertToEssence = false; + return; + } + else { + this.mConvertToEssence = true; + return; + } + } + + private boolean isServerSide(){ + if (this.getWorldObj().isRemote){ + return false; + } + else { + return true; + } + } + @Override public int fill(final ForgeDirection from, final FluidStack resource, final boolean doFill) { this.needsUpdate = true; @@ -181,7 +203,7 @@ public class TileEntityXpConverter extends TileEntity implements IFluidHandler { @Override public void updateEntity() { - if (!this.getWorldObj().isRemote){ + if (this.isServerSide()){ //Utils.LOG_INFO("Ticking. | mConvertToEssence: "+this.mConvertToEssence); @@ -226,7 +248,7 @@ public class TileEntityXpConverter extends TileEntity implements IFluidHandler { public void readFromNBT(final NBTTagCompound tag) { this.tankEssence.readFromNBT(tag); this.tankLiquidXp.readFromNBT(tag); - tag.setBoolean("mConvertToEssence", this.mConvertToEssence); + this.mConvertToEssence = tag.getBoolean("mConvertToEssence"); super.readFromNBT(tag); } @@ -234,7 +256,7 @@ public class TileEntityXpConverter extends TileEntity implements IFluidHandler { public void writeToNBT(final NBTTagCompound tag) { this.tankEssence.writeToNBT(tag); this.tankLiquidXp.writeToNBT(tag); - this.mConvertToEssence = tag.getBoolean("mConvertToEssence"); + tag.setBoolean("mConvertToEssence", this.mConvertToEssence); super.writeToNBT(tag); } @@ -252,23 +274,37 @@ public class TileEntityXpConverter extends TileEntity implements IFluidHandler { } public void onScrewdriverRightClick(final byte aSide, final EntityPlayer aPlayer, final float aX, final float aY, final float aZ) { - - if (!this.getWorldObj().isRemote){ - + if (this.isServerSide()){ if (this.mConvertToEssence){ PlayerUtils.messagePlayer(aPlayer, "Converting from Mob Essence to Liquid Xp."); - this.mConvertToEssence = false; } else { PlayerUtils.messagePlayer(aPlayer, "Converting from Liquid Xp to Mob Essence."); - this.mConvertToEssence = true; } + //Mode Change + this.changeMode(); } - } public void onRightClick(final byte aSide, final EntityPlayer aPlayer, final int aX, final int aY, final int aZ) { + if ((Keyboard.isKeyDown(42)) || (Keyboard.isKeyDown(54))) { + String mInput; + String mOutput; + + if (this.mConvertToEssence){ + mInput = "Liquid Xp"; + mOutput = "Mob Essence"; + } + else { + mInput = "Mob Essence"; + mOutput = "Liquid Xp"; + } + + PlayerUtils.messagePlayer(aPlayer, "Input: "+mInput+"."); + PlayerUtils.messagePlayer(aPlayer, "Output: "+mOutput+"."); + } + } } -- cgit From 2b28b0849d64b320e42a478f83af6a29c4f28ac1 Mon Sep 17 00:00:00 2001 From: Alkalus Date: Sun, 26 Nov 2017 17:54:25 +1000 Subject: $ Fixed Large Sifter, Tree Farm & Power Sub-Station not forming on SMP. $ Fixed issue where INFO_MACHINE_LOGGING would cause NPE's on SMP. - Removed logging from the Xp Converter. --- .../general/TileEntityXpConverter.java | 38 +++++++++++----------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'src/Java/gtPlusPlus/core/tileentities') diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityXpConverter.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityXpConverter.java index 8491cf8f6e..98da5a40fc 100644 --- a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityXpConverter.java +++ b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityXpConverter.java @@ -53,26 +53,26 @@ public class TileEntityXpConverter extends TileEntity implements IFluidHandler { @Override public int fill(final ForgeDirection from, final FluidStack resource, final boolean doFill) { this.needsUpdate = true; - Utils.LOG_INFO("Ticking. | mConvertToEssence: "+this.mConvertToEssence); + Utils.LOG_WARNING("Ticking. | mConvertToEssence: "+this.mConvertToEssence); if (this.mConvertToEssence){ if (resource.isFluidEqual(EnchantingUtils.getLiquidXP(1))){ - Utils.LOG_INFO("fill(tankLiquidXp)"); + Utils.LOG_WARNING("fill(tankLiquidXp)"); return this.tankLiquidXp.fill(resource, doFill); } else { - Utils.LOG_INFO("Looking for Liquid Xp, Instead found "+resource.getLocalizedName()+"."); + Utils.LOG_WARNING("Looking for Liquid Xp, Instead found "+resource.getLocalizedName()+"."); } } else { if (resource.isFluidEqual(EnchantingUtils.getMobEssence(1))){ - Utils.LOG_INFO("fill(tankEssence)"); + Utils.LOG_WARNING("fill(tankEssence)"); return this.tankEssence.fill(resource, doFill); } else { - Utils.LOG_INFO("Looking for Essence, Instead found "+resource.getLocalizedName()+"."); + Utils.LOG_WARNING("Looking for Essence, Instead found "+resource.getLocalizedName()+"."); } } - Utils.LOG_INFO("fill(0)"); + Utils.LOG_WARNING("fill(0)"); return 0; } @@ -81,24 +81,24 @@ public class TileEntityXpConverter extends TileEntity implements IFluidHandler { this.needsUpdate = true; if (this.mConvertToEssence){ if (resource.isFluidEqual(EnchantingUtils.getMobEssence(1))){ - Utils.LOG_INFO("drain(mConvertToEssence)"); + Utils.LOG_WARNING("drain(mConvertToEssence)"); return this.tankEssence.drain(resource.amount, doDrain); } } else { if (resource.isFluidEqual(EnchantingUtils.getLiquidXP(1))){ - Utils.LOG_INFO("drain(tankLiquidXp)"); + Utils.LOG_WARNING("drain(tankLiquidXp)"); return this.tankLiquidXp.drain(resource.amount, doDrain); } } - Utils.LOG_INFO("drain(null)"); + Utils.LOG_WARNING("drain(null)"); return null; } @Override public FluidStack drain(final ForgeDirection from, final int maxDrain, final boolean doDrain) { this.needsUpdate = true; - Utils.LOG_INFO("drain(Ex)"); + Utils.LOG_WARNING("drain(Ex)"); final FluidStack fluid_Essence = this.tankEssence.getFluid(); final FluidStack fluid_Xp = this.tankLiquidXp.getFluid(); if ((fluid_Essence == null) && (fluid_Xp == null)) { @@ -143,7 +143,7 @@ public class TileEntityXpConverter extends TileEntity implements IFluidHandler { this.tankLiquidXp = tank; } - Utils.LOG_INFO("drain(Ex2)"); + Utils.LOG_WARNING("drain(Ex2)"); return stack; } @@ -151,17 +151,17 @@ public class TileEntityXpConverter extends TileEntity implements IFluidHandler { public boolean canFill(final ForgeDirection from, final Fluid fluid) { if (this.mConvertToEssence){ if (this.tankEssence.getFluidAmount() < this.tankEssence.getCapacity()){ - Utils.LOG_INFO("canFill(mConvertToEssence)"); + Utils.LOG_WARNING("canFill(mConvertToEssence)"); return true; } } else { if (this.tankLiquidXp.getFluidAmount() < this.tankLiquidXp.getCapacity()){ - Utils.LOG_INFO("canFill(tankLiquidXp)"); + Utils.LOG_WARNING("canFill(tankLiquidXp)"); return true; } } - Utils.LOG_INFO("canFill(false)"); + Utils.LOG_WARNING("canFill(false)"); return false; } @@ -177,7 +177,7 @@ public class TileEntityXpConverter extends TileEntity implements IFluidHandler { return true; } } - Utils.LOG_INFO("canDrain(false)"); + Utils.LOG_WARNING("canDrain(false)"); return false; } @@ -192,7 +192,7 @@ public class TileEntityXpConverter extends TileEntity implements IFluidHandler { } public float getAdjustedVolume() { - Utils.LOG_INFO("AdjustedVolume()"); + Utils.LOG_WARNING("AdjustedVolume()"); this.needsUpdate = true; final float amount = this.tankLiquidXp.getFluidAmount(); final float capacity = this.tankLiquidXp.getCapacity(); @@ -205,7 +205,7 @@ public class TileEntityXpConverter extends TileEntity implements IFluidHandler { if (this.isServerSide()){ - //Utils.LOG_INFO("Ticking. | mConvertToEssence: "+this.mConvertToEssence); + //Utils.LOG_WARNING("Ticking. | mConvertToEssence: "+this.mConvertToEssence); if (this.needsUpdate) { @@ -227,7 +227,7 @@ public class TileEntityXpConverter extends TileEntity implements IFluidHandler { this.tankEssence.fill(bigStorage, true); this.tankLiquidXp.drain(100, true); this.needsUpdate = true; - Utils.LOG_INFO("B->A"); + Utils.LOG_WARNING("B->A"); } } else { @@ -237,7 +237,7 @@ public class TileEntityXpConverter extends TileEntity implements IFluidHandler { this.tankLiquidXp.fill(bigStorage, true); this.tankEssence.drain((int) rm, true); this.needsUpdate = true; - Utils.LOG_INFO("A->B"); + Utils.LOG_WARNING("A->B"); } } } -- cgit From f30d9f3ad55ae18cec5e86cc6a7b0124847b9a1f Mon Sep 17 00:00:00 2001 From: Alkalus Date: Sun, 26 Nov 2017 19:09:55 +1000 Subject: % Made the Xp Converter more colourful. --- .../core/tileentities/general/TileEntityXpConverter.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/Java/gtPlusPlus/core/tileentities') diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityXpConverter.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityXpConverter.java index 98da5a40fc..b886299afd 100644 --- a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityXpConverter.java +++ b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityXpConverter.java @@ -24,8 +24,9 @@ public class TileEntityXpConverter extends TileEntity implements IFluidHandler { public FluidTank tankEssence = new FluidTank((int) (64000*EnchantingUtils.RATIO_MOB_ESSENCE_TO_LIQUID_XP)); public FluidTank tankLiquidXp = new FluidTank(64000); private boolean needsUpdate = false; - private int updateTimer = 0; private boolean mConvertToEssence = true; + private int updateTimer = 0; + private long mTickTime = 0; public TileEntityXpConverter() { } @@ -204,11 +205,9 @@ public class TileEntityXpConverter extends TileEntity implements IFluidHandler { public void updateEntity() { if (this.isServerSide()){ - - //Utils.LOG_WARNING("Ticking. | mConvertToEssence: "+this.mConvertToEssence); + this.mTickTime++; if (this.needsUpdate) { - if (this.updateTimer == 0) { this.updateTimer = 10; // every 10 ticks it will send an update } else { @@ -241,6 +240,14 @@ public class TileEntityXpConverter extends TileEntity implements IFluidHandler { } } } + else { + } + this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); + this.markDirty(); + + if ((this.mTickTime % 20) == 0){ + + } } -- cgit