aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/tileentities
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/core/tileentities')
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java19
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java127
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/general/TileEntityXpConverter.java317
3 files changed, 388 insertions, 75 deletions
diff --git a/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java b/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java
index 6dd948bcd1..87fb8ef76d 100644
--- a/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java
+++ b/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java
@@ -1,26 +1,24 @@
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.general.TileEntityXpConverter;
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 {
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");
@@ -30,6 +28,9 @@ 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");
+ GameRegistry.registerTileEntity(TileEntityXpConverter.class, "TileEntityXpConverter");
}
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<this.getInventory().getSizeInventory(); r++){
accessibleSides[r]=r;
}
@@ -373,12 +368,12 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory {
}
@Override
- public boolean canInsertItem(int p_102007_1_, ItemStack p_102007_2_, int p_102007_3_) {
+ public boolean canInsertItem(final int p_102007_1_, final ItemStack p_102007_2_, final int p_102007_3_) {
return false;
}
@Override
- public boolean canExtractItem(int p_102008_1_, ItemStack p_102008_2_, int p_102008_3_) {
+ public boolean canExtractItem(final int p_102008_1_, final ItemStack p_102008_2_, final int p_102008_3_) {
return true;
}
@@ -386,7 +381,7 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory {
return this.customName;
}
- public void setCustomName(String customName) {
+ public void setCustomName(final String customName) {
this.customName = customName;
}
@@ -397,7 +392,7 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory {
@Override
public boolean hasCustomInventoryName() {
- return this.customName != null && !this.customName.equals("");
+ return (this.customName != null) && !this.customName.equals("");
}
}
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..b886299afd
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityXpConverter.java
@@ -0,0 +1,317 @@
+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;
+import net.minecraft.entity.player.EntityPlayer;
+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*EnchantingUtils.RATIO_MOB_ESSENCE_TO_LIQUID_XP));
+ public FluidTank tankLiquidXp = new FluidTank(64000);
+ private boolean needsUpdate = false;
+ private boolean mConvertToEssence = true;
+ private int updateTimer = 0;
+ private long mTickTime = 0;
+
+ 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;
+ Utils.LOG_WARNING("Ticking. | mConvertToEssence: "+this.mConvertToEssence);
+ if (this.mConvertToEssence){
+ if (resource.isFluidEqual(EnchantingUtils.getLiquidXP(1))){
+ Utils.LOG_WARNING("fill(tankLiquidXp)");
+ return this.tankLiquidXp.fill(resource, doFill);
+ }
+ else {
+ Utils.LOG_WARNING("Looking for Liquid Xp, Instead found "+resource.getLocalizedName()+".");
+ }
+ }
+ else {
+ if (resource.isFluidEqual(EnchantingUtils.getMobEssence(1))){
+ Utils.LOG_WARNING("fill(tankEssence)");
+ return this.tankEssence.fill(resource, doFill);
+ }
+ else {
+ Utils.LOG_WARNING("Looking for Essence, Instead found "+resource.getLocalizedName()+".");
+ }
+ }
+ Utils.LOG_WARNING("fill(0)");
+ return 0;
+ }
+
+ @Override
+ public FluidStack drain(final ForgeDirection from, final FluidStack resource, final boolean doDrain) {
+ this.needsUpdate = true;
+ if (this.mConvertToEssence){
+ if (resource.isFluidEqual(EnchantingUtils.getMobEssence(1))){
+ Utils.LOG_WARNING("drain(mConvertToEssence)");
+ return this.tankEssence.drain(resource.amount, doDrain);
+ }
+ }
+ else {
+ if (resource.isFluidEqual(EnchantingUtils.getLiquidXP(1))){
+ Utils.LOG_WARNING("drain(tankLiquidXp)");
+ return this.tankLiquidXp.drain(resource.amount, doDrain);
+ }
+ }
+ 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_WARNING("drain(Ex)");
+ 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 (this.mConvertToEssence){
+ 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));
+ }
+ }
+
+
+ if (this.mConvertToEssence){
+ this.tankEssence = tank;
+ }
+ else {
+ this.tankLiquidXp = tank;
+ }
+
+ Utils.LOG_WARNING("drain(Ex2)");
+ return stack;
+ }
+
+ @Override
+ public boolean canFill(final ForgeDirection from, final Fluid fluid) {
+ if (this.mConvertToEssence){
+ if (this.tankEssence.getFluidAmount() < this.tankEssence.getCapacity()){
+ Utils.LOG_WARNING("canFill(mConvertToEssence)");
+ return true;
+ }
+ }
+ else {
+ if (this.tankLiquidXp.getFluidAmount() < this.tankLiquidXp.getCapacity()){
+ Utils.LOG_WARNING("canFill(tankLiquidXp)");
+ return true;
+ }
+ }
+ Utils.LOG_WARNING("canFill(false)");
+ return false;
+ }
+
+ @Override
+ public boolean canDrain(final ForgeDirection from, final Fluid fluid) {
+ if (this.mConvertToEssence){
+ if (this.tankEssence.getFluidAmount() > 0){
+ return true;
+ }
+ }
+ else {
+ if (this.tankLiquidXp.getFluidAmount() > 0){
+ return true;
+ }
+ }
+ Utils.LOG_WARNING("canDrain(false)");
+ return false;
+ }
+
+ @Override
+ public FluidTankInfo[] getTankInfo(final ForgeDirection from) {
+ if (this.mConvertToEssence){
+ return new FluidTankInfo[] { this.tankEssence.getInfo() };
+ }
+ else {
+ return new FluidTankInfo[] { this.tankLiquidXp.getInfo() };
+ }
+ }
+
+ public float getAdjustedVolume() {
+ Utils.LOG_WARNING("AdjustedVolume()");
+ 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.isServerSide()){
+ this.mTickTime++;
+
+ if (this.needsUpdate) {
+ 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_WARNING("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_WARNING("A->B");
+ }
+ }
+ }
+ else {
+ }
+ this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
+ this.markDirty();
+
+ if ((this.mTickTime % 20) == 0){
+
+ }
+
+ }
+
+ @Override
+ public void readFromNBT(final NBTTagCompound tag) {
+ this.tankEssence.readFromNBT(tag);
+ this.tankLiquidXp.readFromNBT(tag);
+ this.mConvertToEssence = tag.getBoolean("mConvertToEssence");
+ super.readFromNBT(tag);
+ }
+
+ @Override
+ public void writeToNBT(final NBTTagCompound tag) {
+ this.tankEssence.writeToNBT(tag);
+ this.tankLiquidXp.writeToNBT(tag);
+ tag.setBoolean("mConvertToEssence", this.mConvertToEssence);
+ 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);
+ }
+
+ public void onScrewdriverRightClick(final byte aSide, final EntityPlayer aPlayer, final float aX, final float aY, final float aZ) {
+ if (this.isServerSide()){
+ if (this.mConvertToEssence){
+ PlayerUtils.messagePlayer(aPlayer, "Converting from Mob Essence to Liquid Xp.");
+ }
+ else {
+ PlayerUtils.messagePlayer(aPlayer, "Converting from Liquid Xp to Mob Essence.");
+ }
+ //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+".");
+ }
+
+ }
+
+}