From fd15ae499c11112c282a93c6cf342bc88698e8ac Mon Sep 17 00:00:00 2001 From: Alkalus Date: Mon, 20 Nov 2017 16:48:02 +1000 Subject: + Added a faster TC Alchemical Furnace. + Added a Wither-Proof block. % Tweaked Grindle GUI. --- .../common/tile/TileFastAlchemyFurnace.java | 426 +++++++++++++++++++++ 1 file changed, 426 insertions(+) create mode 100644 src/Java/gtPlusPlus/xmod/thaumcraft/common/tile/TileFastAlchemyFurnace.java (limited to 'src/Java/gtPlusPlus/xmod/thaumcraft/common/tile') diff --git a/src/Java/gtPlusPlus/xmod/thaumcraft/common/tile/TileFastAlchemyFurnace.java b/src/Java/gtPlusPlus/xmod/thaumcraft/common/tile/TileFastAlchemyFurnace.java new file mode 100644 index 0000000000..226c7cf393 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/thaumcraft/common/tile/TileFastAlchemyFurnace.java @@ -0,0 +1,426 @@ +package gtPlusPlus.xmod.thaumcraft.common.tile; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityFurnace; +import net.minecraft.world.EnumSkyBlock; +import net.minecraftforge.common.util.ForgeDirection; +import thaumcraft.api.aspects.Aspect; +import thaumcraft.api.aspects.AspectList; +import thaumcraft.common.config.ConfigItems; +import thaumcraft.common.lib.crafting.ThaumcraftCraftingManager; +import thaumcraft.common.tiles.TileAlchemyFurnace; +import thaumcraft.common.tiles.TileAlembic; +import thaumcraft.common.tiles.TileBellows; + +public class TileFastAlchemyFurnace extends TileAlchemyFurnace { + private static final int[] slots_bottom = {1}; + private static final int[] slots_top = new int[0]; + private static final int[] slots_sides = {0}; + public AspectList aspects; + public int vis; + private int maxVis; + public int smeltTime; + int bellows; + boolean speedBoost; + private ItemStack[] furnaceItemStacks; + public int furnaceBurnTime; + public int currentItemBurnTime; + public int furnaceCookTime; + private String customName; + int count; + + public TileFastAlchemyFurnace() { + this.aspects = new AspectList(); + + this.maxVis = 100; + this.smeltTime = 25; + this.bellows = -1; + this.speedBoost = false; + + this.furnaceItemStacks = new ItemStack[2]; + + this.count = 0; + } + + public int func_70302_i_() { + return this.furnaceItemStacks.length; + } + + public ItemStack func_70301_a(int par1) { + return this.furnaceItemStacks[par1]; + } + + public ItemStack func_70298_a(int par1, int par2) { + if (this.furnaceItemStacks[par1] != null) { + if (this.furnaceItemStacks[par1].stackSize <= par2) { + ItemStack itemstack = this.furnaceItemStacks[par1]; + this.furnaceItemStacks[par1] = null; + return itemstack; + } + + ItemStack itemstack = this.furnaceItemStacks[par1].splitStack(par2); + + if (this.furnaceItemStacks[par1].stackSize == 0) { + this.furnaceItemStacks[par1] = null; + } + + return itemstack; + } + + return null; + } + + public ItemStack func_70304_b(int par1) { + if (this.furnaceItemStacks[par1] != null) { + ItemStack itemstack = this.furnaceItemStacks[par1]; + this.furnaceItemStacks[par1] = null; + return itemstack; + } + + return null; + } + + public void func_70299_a(int par1, ItemStack par2ItemStack) { + this.furnaceItemStacks[par1] = par2ItemStack; + + if ((par2ItemStack == null) || (par2ItemStack.stackSize <= func_70297_j_())) + return; + par2ItemStack.stackSize = func_70297_j_(); + } + + public String func_145825_b() { + return ((func_145818_k_()) ? this.customName : "container.alchemyfurnace"); + } + + public boolean func_145818_k_() { + return ((this.customName != null) && (this.customName.length() > 0)); + } + + public void setGuiDisplayName(String par1Str) { + this.customName = par1Str; + } + + public void readCustomNBT(NBTTagCompound nbttagcompound) { + this.furnaceBurnTime = nbttagcompound.getShort("BurnTime"); + this.vis = nbttagcompound.getShort("Vis"); + } + + public void writeCustomNBT(NBTTagCompound nbttagcompound) { + nbttagcompound.setShort("BurnTime", (short) this.furnaceBurnTime); + nbttagcompound.setShort("Vis", (short) this.vis); + } + + public void func_145839_a(NBTTagCompound nbtCompound) { + super.func_145839_a(nbtCompound); + NBTTagList nbttaglist = nbtCompound.getTagList("Items", 10); + this.furnaceItemStacks = new ItemStack[func_70302_i_()]; + + for (int i = 0; i < nbttaglist.tagCount(); ++i) { + NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); + byte b0 = nbttagcompound1.getByte("Slot"); + + if ((b0 < 0) || (b0 >= this.furnaceItemStacks.length)) + continue; + this.furnaceItemStacks[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1); + } + + this.speedBoost = nbtCompound.getBoolean("speedBoost"); + this.furnaceCookTime = nbtCompound.getShort("CookTime"); + this.currentItemBurnTime = TileEntityFurnace.getItemBurnTime(this.furnaceItemStacks[1]); + + if (nbtCompound.hasKey("CustomName")) { + this.customName = nbtCompound.getString("CustomName"); + } + + this.aspects.readFromNBT(nbtCompound); + this.vis = this.aspects.visSize(); + } + + public void func_145841_b(NBTTagCompound nbtCompound) { + super.func_145841_b(nbtCompound); + nbtCompound.setBoolean("speedBoost", this.speedBoost); + nbtCompound.setShort("CookTime", (short) this.furnaceCookTime); + NBTTagList nbttaglist = new NBTTagList(); + + for (int i = 0; i < this.furnaceItemStacks.length; ++i) { + if (this.furnaceItemStacks[i] == null) + continue; + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + nbttagcompound1.setByte("Slot", (byte) i); + this.furnaceItemStacks[i].writeToNBT(nbttagcompound1); + nbttaglist.appendTag(nbttagcompound1); + } + + nbtCompound.setTag("Items", nbttaglist); + + if (func_145818_k_()) { + nbtCompound.setString("CustomName", this.customName); + } + + this.aspects.writeToNBT(nbtCompound); + } + + public int func_70297_j_() { + return 64; + } + + @SideOnly(Side.CLIENT) + public int getCookProgressScaled(int par1) { + if (this.smeltTime <= 0) + this.smeltTime = 1; + return (this.furnaceCookTime * par1 / this.smeltTime); + } + + @SideOnly(Side.CLIENT) + public int getContentsScaled(int par1) { + return (this.vis * par1 / this.maxVis); + } + + @SideOnly(Side.CLIENT) + public int getBurnTimeRemainingScaled(int par1) { + if (this.currentItemBurnTime == 0) { + this.currentItemBurnTime = 200; + } + + return (this.furnaceBurnTime * par1 / this.currentItemBurnTime); + } + + public boolean isBurning() { + return (this.furnaceBurnTime > 0); + } + + public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { + super.onDataPacket(net, pkt); + if (this.worldObj != null) + this.worldObj.updateLightByType(EnumSkyBlock.Block, this.xCoord, this.yCoord, + this.zCoord); + } + + public boolean canUpdate() { + return true; + } + + public void func_145845_h() { + boolean flag = this.furnaceBurnTime > 0; + boolean flag1 = false; + this.count += 1; + if (this.furnaceBurnTime > 0) { + this.furnaceBurnTime -= 1; + } + + if (!(this.worldObj.isRemote)) { + if (this.bellows < 0) + getBellows(); + + if ((this.count % ((this.speedBoost) ? 20 : 40) == 0) && (this.aspects.size() > 0)) { + AspectList exlude = new AspectList(); + int deep = 0; + TileEntity tile = null; + while (deep < 5) { + ++deep; + tile = this.worldObj.getTileEntity(this.xCoord, this.yCoord + deep, + this.zCoord); + if (!(tile instanceof TileAlembic)) + break; + TileAlembic alembic = (TileAlembic) tile; + if ((alembic.aspect != null) && (alembic.amount < alembic.maxAmount) + && (this.aspects.getAmount(alembic.aspect) > 0)) { + takeFromContainer(alembic.aspect, 1); + alembic.addToContainer(alembic.aspect, 1); + exlude.merge(alembic.aspect, 1); + this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, + this.zCoord); + this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord + deep, + this.zCoord); + } + tile = null; + } + + deep = 0; + while (deep < 5) { + ++deep; + tile = this.worldObj.getTileEntity(this.xCoord, this.yCoord + deep, + this.zCoord); + if (!(tile instanceof TileAlembic)) + break; + TileAlembic alembic = (TileAlembic) tile; + if ((alembic.aspect == null) || (alembic.amount == 0)) + ; + Aspect as = null; + if (alembic.aspectFilter == null) { + as = takeRandomAspect(exlude); + } else if (takeFromContainer(alembic.aspectFilter, 1)) { + as = alembic.aspectFilter; + } + + if (as != null) { + alembic.addToContainer(as, 1); + this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, + this.zCoord); + this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord + deep, + this.zCoord); + break; + } + + } + + } + + if ((this.furnaceBurnTime == 0) && (canSmelt())) { + this.currentItemBurnTime = (this.furnaceBurnTime = TileEntityFurnace + .getItemBurnTime(this.furnaceItemStacks[1])); + + if (this.furnaceBurnTime > 0) { + flag1 = true; + this.speedBoost = false; + + if (this.furnaceItemStacks[1] != null) { + if (this.furnaceItemStacks[1].isItemEqual(new ItemStack(ConfigItems.itemResource, 1, 0))) { + this.speedBoost = true; + } + this.furnaceItemStacks[1].stackSize -= 1; + + if (this.furnaceItemStacks[1].stackSize == 0) { + this.furnaceItemStacks[1] = this.furnaceItemStacks[1].getItem() + .getContainerItem(this.furnaceItemStacks[1]); + } + } + } + } + + if ((isBurning()) && (canSmelt())) { + this.furnaceCookTime += 1; + + if (this.furnaceCookTime >= this.smeltTime) { + this.furnaceCookTime = 0; + smeltItem(); + flag1 = true; + } + } else { + this.furnaceCookTime = 0; + } + + if (flag != this.furnaceBurnTime > 0) { + flag1 = true; + this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); + } + } + + if (!(flag1)) + return; + markDirty(); + } + + private boolean canSmelt() { + if (this.furnaceItemStacks[0] == null) { + return false; + } + + AspectList al = ThaumcraftCraftingManager.getObjectTags(this.furnaceItemStacks[0]); + al = ThaumcraftCraftingManager.getBonusTags(this.furnaceItemStacks[0], al); + + if ((al == null) || (al.size() == 0)) + return false; + int vs = al.visSize(); + if (vs > this.maxVis - this.vis) + return false; + this.smeltTime = (int) (vs * 10 * (1.0F - (0.125F * this.bellows))); + return true; + } + + public void getBellows() { + this.bellows = TileBellows.getBellows(this.worldObj, this.xCoord, this.yCoord, + this.zCoord, ForgeDirection.VALID_DIRECTIONS); + } + + public void smeltItem() { + if (!(canSmelt())) { + return; + } + AspectList al = ThaumcraftCraftingManager.getObjectTags(this.furnaceItemStacks[0]); + al = ThaumcraftCraftingManager.getBonusTags(this.furnaceItemStacks[0], al); + + for (Aspect a : al.getAspects()) { + this.aspects.add(a, al.getAmount(a)); + } + + this.vis = this.aspects.visSize(); + + this.furnaceItemStacks[0].stackSize -= 1; + + if (this.furnaceItemStacks[0].stackSize > 0) + return; + this.furnaceItemStacks[0] = null; + } + + public static boolean isItemFuel(ItemStack par0ItemStack) { + return (TileEntityFurnace.getItemBurnTime(par0ItemStack) > 0); + } + + public boolean func_70300_a(EntityPlayer par1EntityPlayer) { + return (this.worldObj.getTileEntity(this.xCoord, this.yCoord, + this.zCoord) == this); + } + + public void func_70295_k_() { + } + + public void func_70305_f() { + } + + public boolean func_94041_b(int par1, ItemStack par2ItemStack) { + if (par1 == 0) { + AspectList al = ThaumcraftCraftingManager.getObjectTags(par2ItemStack); + al = ThaumcraftCraftingManager.getBonusTags(par2ItemStack, al); + if ((al != null) && (al.size() > 0)) + return true; + } + return ((par1 == 1) ? isItemFuel(par2ItemStack) : false); + } + + public int[] func_94128_d(int par1) { + return ((par1 == 1) ? slots_top : (par1 == 0) ? slots_bottom : slots_sides); + } + + public boolean func_102007_a(int par1, ItemStack par2ItemStack, int par3) { + return ((par3 == 1) ? false : func_94041_b(par1, par2ItemStack)); + } + + public boolean func_102008_b(int par1, ItemStack par2ItemStack, int par3) { + return ((par3 != 0) || (par1 != 1) || (par2ItemStack.getItem() == Items.bucket)); + } + + public Aspect takeRandomAspect(AspectList exlude) { + if (this.aspects.size() > 0) { + AspectList temp = this.aspects.copy(); + if (exlude.size() > 0) + for (Aspect a : exlude.getAspects()) + temp.remove(a); + if (temp.size() > 0) { + Aspect tag = temp.getAspects()[this.worldObj.rand.nextInt(temp.getAspects().length)]; + this.aspects.remove(tag, 1); + this.vis -= 1; + return tag; + } + } + return null; + } + + public boolean takeFromContainer(Aspect tag, int amount) { + if ((this.aspects != null) && (this.aspects.getAmount(tag) >= amount)) { + this.aspects.remove(tag, amount); + this.vis -= amount; + return true; + } + return false; + } +} \ No newline at end of file -- cgit From e480daed410bd80d5eda9abbd37f7bd96021e911 Mon Sep 17 00:00:00 2001 From: Alkalus Date: Mon, 20 Nov 2017 20:19:10 +1000 Subject: $ Fixed the Upgraded Alchemical Furnace being built from heavily obfuscated code. % Adjusted Wither Guard recipe to now output 32x per craft, at the added cost of a Netherstar per craft. % Small formatting changes. --- .../common/tile/TileFastAlchemyFurnace.java | 388 +++++++++++---------- 1 file changed, 197 insertions(+), 191 deletions(-) (limited to 'src/Java/gtPlusPlus/xmod/thaumcraft/common/tile') diff --git a/src/Java/gtPlusPlus/xmod/thaumcraft/common/tile/TileFastAlchemyFurnace.java b/src/Java/gtPlusPlus/xmod/thaumcraft/common/tile/TileFastAlchemyFurnace.java index 226c7cf393..ec39e7f4af 100644 --- a/src/Java/gtPlusPlus/xmod/thaumcraft/common/tile/TileFastAlchemyFurnace.java +++ b/src/Java/gtPlusPlus/xmod/thaumcraft/common/tile/TileFastAlchemyFurnace.java @@ -22,12 +22,12 @@ import thaumcraft.common.tiles.TileAlembic; import thaumcraft.common.tiles.TileBellows; public class TileFastAlchemyFurnace extends TileAlchemyFurnace { - private static final int[] slots_bottom = {1}; - private static final int[] slots_top = new int[0]; - private static final int[] slots_sides = {0}; + private static final int[] slots_bottom; + private static final int[] slots_top; + private static final int[] slots_sides; public AspectList aspects; public int vis; - private int maxVis; + private final int maxVis; public int smeltTime; int bellows; boolean speedBoost; @@ -40,255 +40,247 @@ public class TileFastAlchemyFurnace extends TileAlchemyFurnace { public TileFastAlchemyFurnace() { this.aspects = new AspectList(); - - this.maxVis = 100; - this.smeltTime = 25; + this.maxVis = 150; + this.smeltTime = 100; this.bellows = -1; - this.speedBoost = false; - + this.speedBoost = true; this.furnaceItemStacks = new ItemStack[2]; - this.count = 0; } - public int func_70302_i_() { + @Override + public int getSizeInventory() { return this.furnaceItemStacks.length; } - public ItemStack func_70301_a(int par1) { + @Override + public ItemStack getStackInSlot(final int par1) { return this.furnaceItemStacks[par1]; } - public ItemStack func_70298_a(int par1, int par2) { - if (this.furnaceItemStacks[par1] != null) { - if (this.furnaceItemStacks[par1].stackSize <= par2) { - ItemStack itemstack = this.furnaceItemStacks[par1]; - this.furnaceItemStacks[par1] = null; - return itemstack; - } - - ItemStack itemstack = this.furnaceItemStacks[par1].splitStack(par2); - - if (this.furnaceItemStacks[par1].stackSize == 0) { - this.furnaceItemStacks[par1] = null; - } - + @Override + public ItemStack decrStackSize(final int par1, final int par2) { + if (this.furnaceItemStacks[par1] == null) { + return null; + } + if (this.furnaceItemStacks[par1].stackSize <= par2) { + final ItemStack itemstack = this.furnaceItemStacks[par1]; + this.furnaceItemStacks[par1] = null; return itemstack; } - - return null; + final ItemStack itemstack = this.furnaceItemStacks[par1].splitStack(par2); + if (this.furnaceItemStacks[par1].stackSize == 0) { + this.furnaceItemStacks[par1] = null; + } + return itemstack; } - public ItemStack func_70304_b(int par1) { + @Override + public ItemStack getStackInSlotOnClosing(final int par1) { if (this.furnaceItemStacks[par1] != null) { - ItemStack itemstack = this.furnaceItemStacks[par1]; + final ItemStack itemstack = this.furnaceItemStacks[par1]; this.furnaceItemStacks[par1] = null; return itemstack; } - return null; } - public void func_70299_a(int par1, ItemStack par2ItemStack) { + @Override + public void setInventorySlotContents(final int par1, final ItemStack par2ItemStack) { this.furnaceItemStacks[par1] = par2ItemStack; - - if ((par2ItemStack == null) || (par2ItemStack.stackSize <= func_70297_j_())) - return; - par2ItemStack.stackSize = func_70297_j_(); + if ((par2ItemStack != null) && (par2ItemStack.stackSize > this.getInventoryStackLimit())) { + par2ItemStack.stackSize = this.getInventoryStackLimit(); + } } - public String func_145825_b() { - return ((func_145818_k_()) ? this.customName : "container.alchemyfurnace"); + @Override + public String getInventoryName() { + return this.hasCustomInventoryName() ? this.customName : "container.alchemyfurnace"; } - public boolean func_145818_k_() { - return ((this.customName != null) && (this.customName.length() > 0)); + @Override + public boolean hasCustomInventoryName() { + return (this.customName != null) && (this.customName.length() > 0); } - public void setGuiDisplayName(String par1Str) { + @Override + public void setGuiDisplayName(final String par1Str) { this.customName = par1Str; } - public void readCustomNBT(NBTTagCompound nbttagcompound) { + @Override + public void readCustomNBT(final NBTTagCompound nbttagcompound) { this.furnaceBurnTime = nbttagcompound.getShort("BurnTime"); this.vis = nbttagcompound.getShort("Vis"); } - public void writeCustomNBT(NBTTagCompound nbttagcompound) { + @Override + public void writeCustomNBT(final NBTTagCompound nbttagcompound) { nbttagcompound.setShort("BurnTime", (short) this.furnaceBurnTime); nbttagcompound.setShort("Vis", (short) this.vis); } - public void func_145839_a(NBTTagCompound nbtCompound) { - super.func_145839_a(nbtCompound); - NBTTagList nbttaglist = nbtCompound.getTagList("Items", 10); - this.furnaceItemStacks = new ItemStack[func_70302_i_()]; - + @Override + public void readFromNBT(final NBTTagCompound nbtCompound) { + super.readFromNBT(nbtCompound); + final NBTTagList nbttaglist = nbtCompound.getTagList("Items", 10); + this.furnaceItemStacks = 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.furnaceItemStacks.length)) - continue; - this.furnaceItemStacks[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1); + final NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); + final byte b0 = nbttagcompound1.getByte("Slot"); + if ((b0 >= 0) && (b0 < this.furnaceItemStacks.length)) { + this.furnaceItemStacks[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1); + } } - this.speedBoost = nbtCompound.getBoolean("speedBoost"); this.furnaceCookTime = nbtCompound.getShort("CookTime"); this.currentItemBurnTime = TileEntityFurnace.getItemBurnTime(this.furnaceItemStacks[1]); - if (nbtCompound.hasKey("CustomName")) { this.customName = nbtCompound.getString("CustomName"); } - this.aspects.readFromNBT(nbtCompound); this.vis = this.aspects.visSize(); } - public void func_145841_b(NBTTagCompound nbtCompound) { - super.func_145841_b(nbtCompound); + @Override + public void writeToNBT(final NBTTagCompound nbtCompound) { + super.writeToNBT(nbtCompound); nbtCompound.setBoolean("speedBoost", this.speedBoost); nbtCompound.setShort("CookTime", (short) this.furnaceCookTime); - NBTTagList nbttaglist = new NBTTagList(); - + final NBTTagList nbttaglist = new NBTTagList(); for (int i = 0; i < this.furnaceItemStacks.length; ++i) { - if (this.furnaceItemStacks[i] == null) - continue; - NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - nbttagcompound1.setByte("Slot", (byte) i); - this.furnaceItemStacks[i].writeToNBT(nbttagcompound1); - nbttaglist.appendTag(nbttagcompound1); + if (this.furnaceItemStacks[i] != null) { + final NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + nbttagcompound1.setByte("Slot", (byte) i); + this.furnaceItemStacks[i].writeToNBT(nbttagcompound1); + nbttaglist.appendTag(nbttagcompound1); + } } - nbtCompound.setTag("Items", nbttaglist); - - if (func_145818_k_()) { + if (this.hasCustomInventoryName()) { nbtCompound.setString("CustomName", this.customName); } - this.aspects.writeToNBT(nbtCompound); } - public int func_70297_j_() { + @Override + public int getInventoryStackLimit() { return 64; } + @Override @SideOnly(Side.CLIENT) - public int getCookProgressScaled(int par1) { - if (this.smeltTime <= 0) + public int getCookProgressScaled(final int par1) { + if (this.smeltTime <= 0) { this.smeltTime = 1; - return (this.furnaceCookTime * par1 / this.smeltTime); + } + return (this.furnaceCookTime * par1) / this.smeltTime; } + @Override @SideOnly(Side.CLIENT) - public int getContentsScaled(int par1) { - return (this.vis * par1 / this.maxVis); + public int getContentsScaled(final int par1) { + return (this.vis * par1) / this.maxVis; } + @Override @SideOnly(Side.CLIENT) - public int getBurnTimeRemainingScaled(int par1) { + public int getBurnTimeRemainingScaled(final int par1) { if (this.currentItemBurnTime == 0) { this.currentItemBurnTime = 200; } - - return (this.furnaceBurnTime * par1 / this.currentItemBurnTime); + return (this.furnaceBurnTime * par1) / this.currentItemBurnTime; } + @Override public boolean isBurning() { - return (this.furnaceBurnTime > 0); + return this.furnaceBurnTime > 0; } - public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { + @Override + public void onDataPacket(final NetworkManager net, final S35PacketUpdateTileEntity pkt) { super.onDataPacket(net, pkt); - if (this.worldObj != null) - this.worldObj.updateLightByType(EnumSkyBlock.Block, this.xCoord, this.yCoord, - this.zCoord); + if (this.worldObj != null) { + this.worldObj.updateLightByType(EnumSkyBlock.Block, this.xCoord, this.yCoord, this.zCoord); + } } + @Override public boolean canUpdate() { return true; } - public void func_145845_h() { - boolean flag = this.furnaceBurnTime > 0; - boolean flag1 = false; - this.count += 1; + @Override + public void updateEntity() { + final boolean flag = this.furnaceBurnTime > 0; + boolean flag2 = false; + ++this.count; if (this.furnaceBurnTime > 0) { - this.furnaceBurnTime -= 1; + --this.furnaceBurnTime; } - - if (!(this.worldObj.isRemote)) { - if (this.bellows < 0) - getBellows(); - - if ((this.count % ((this.speedBoost) ? 20 : 40) == 0) && (this.aspects.size() > 0)) { - AspectList exlude = new AspectList(); + if (!this.worldObj.isRemote) { + if (this.bellows < 0) { + this.getBellows(); + } + if (((this.count % (this.speedBoost ? 10 : 20)) == 0) && (this.aspects.size() > 0)) { + final AspectList exlude = new AspectList(); int deep = 0; TileEntity tile = null; while (deep < 5) { ++deep; - tile = this.worldObj.getTileEntity(this.xCoord, this.yCoord + deep, - this.zCoord); - if (!(tile instanceof TileAlembic)) + tile = this.worldObj.getTileEntity(this.xCoord, this.yCoord + deep, this.zCoord); + if (!(tile instanceof TileAlembic)) { break; - TileAlembic alembic = (TileAlembic) tile; + } + final TileAlembic alembic = (TileAlembic) tile; if ((alembic.aspect != null) && (alembic.amount < alembic.maxAmount) && (this.aspects.getAmount(alembic.aspect) > 0)) { - takeFromContainer(alembic.aspect, 1); + this.takeFromContainer(alembic.aspect, 1); alembic.addToContainer(alembic.aspect, 1); exlude.merge(alembic.aspect, 1); - this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, - this.zCoord); - this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord + deep, - this.zCoord); + this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); + this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord + deep, this.zCoord); } tile = null; } - deep = 0; while (deep < 5) { ++deep; - tile = this.worldObj.getTileEntity(this.xCoord, this.yCoord + deep, - this.zCoord); - if (!(tile instanceof TileAlembic)) + tile = this.worldObj.getTileEntity(this.xCoord, this.yCoord + deep, this.zCoord); + if (!(tile instanceof TileAlembic)) { break; - TileAlembic alembic = (TileAlembic) tile; - if ((alembic.aspect == null) || (alembic.amount == 0)) - ; + } + final TileAlembic alembic = (TileAlembic) tile; + if ((alembic.aspect != null) && (alembic.amount != 0)) { + continue; + } Aspect as = null; if (alembic.aspectFilter == null) { - as = takeRandomAspect(exlude); - } else if (takeFromContainer(alembic.aspectFilter, 1)) { + as = this.takeRandomAspect(exlude); + } else if (this.takeFromContainer(alembic.aspectFilter, 1)) { as = alembic.aspectFilter; } - if (as != null) { alembic.addToContainer(as, 1); - this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, - this.zCoord); - this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord + deep, - this.zCoord); + this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); + this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord + deep, this.zCoord); break; } - } - } - - if ((this.furnaceBurnTime == 0) && (canSmelt())) { - this.currentItemBurnTime = (this.furnaceBurnTime = TileEntityFurnace - .getItemBurnTime(this.furnaceItemStacks[1])); - + if ((this.furnaceBurnTime == 0) && this.canSmelt()) { + final int itemBurnTime = TileEntityFurnace.getItemBurnTime(this.furnaceItemStacks[1]); + this.furnaceBurnTime = itemBurnTime; + this.currentItemBurnTime = itemBurnTime; if (this.furnaceBurnTime > 0) { - flag1 = true; + flag2 = true; this.speedBoost = false; - if (this.furnaceItemStacks[1] != null) { if (this.furnaceItemStacks[1].isItemEqual(new ItemStack(ConfigItems.itemResource, 1, 0))) { this.speedBoost = true; } - this.furnaceItemStacks[1].stackSize -= 1; - + final ItemStack itemStack = this.furnaceItemStacks[1]; + --itemStack.stackSize; if (this.furnaceItemStacks[1].stackSize == 0) { this.furnaceItemStacks[1] = this.furnaceItemStacks[1].getItem() .getContainerItem(this.furnaceItemStacks[1]); @@ -296,126 +288,134 @@ public class TileFastAlchemyFurnace extends TileAlchemyFurnace { } } } - - if ((isBurning()) && (canSmelt())) { - this.furnaceCookTime += 1; - + if (this.isBurning() && this.canSmelt()) { + ++this.furnaceCookTime; if (this.furnaceCookTime >= this.smeltTime) { this.furnaceCookTime = 0; - smeltItem(); - flag1 = true; + this.smeltItem(); + flag2 = true; } } else { this.furnaceCookTime = 0; } - - if (flag != this.furnaceBurnTime > 0) { - flag1 = true; + if (flag != (this.furnaceBurnTime > 0)) { + flag2 = true; this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); } } - - if (!(flag1)) - return; - markDirty(); + if (flag2) { + this.markDirty(); + } } private boolean canSmelt() { if (this.furnaceItemStacks[0] == null) { return false; } - AspectList al = ThaumcraftCraftingManager.getObjectTags(this.furnaceItemStacks[0]); al = ThaumcraftCraftingManager.getBonusTags(this.furnaceItemStacks[0], al); - - if ((al == null) || (al.size() == 0)) + if ((al == null) || (al.size() == 0)) { return false; - int vs = al.visSize(); - if (vs > this.maxVis - this.vis) + } + final int vs = al.visSize(); + if (vs > (this.maxVis - this.vis)) { return false; - this.smeltTime = (int) (vs * 10 * (1.0F - (0.125F * this.bellows))); + } + this.smeltTime = (int) (vs * 10 * (1.0f - (0.125f * this.bellows))); return true; } + @Override public void getBellows() { - this.bellows = TileBellows.getBellows(this.worldObj, this.xCoord, this.yCoord, - this.zCoord, ForgeDirection.VALID_DIRECTIONS); + this.bellows = TileBellows.getBellows(this.worldObj, this.xCoord, this.yCoord, this.zCoord, + ForgeDirection.VALID_DIRECTIONS); } + @Override public void smeltItem() { - if (!(canSmelt())) { - return; - } - AspectList al = ThaumcraftCraftingManager.getObjectTags(this.furnaceItemStacks[0]); - al = ThaumcraftCraftingManager.getBonusTags(this.furnaceItemStacks[0], al); - - for (Aspect a : al.getAspects()) { - this.aspects.add(a, al.getAmount(a)); + if (this.canSmelt()) { + AspectList al = ThaumcraftCraftingManager.getObjectTags(this.furnaceItemStacks[0]); + al = ThaumcraftCraftingManager.getBonusTags(this.furnaceItemStacks[0], al); + for (final Aspect a : al.getAspects()) { + this.aspects.add(a, al.getAmount(a)); + } + this.vis = this.aspects.visSize(); + final ItemStack itemStack = this.furnaceItemStacks[0]; + --itemStack.stackSize; + if (this.furnaceItemStacks[0].stackSize <= 0) { + this.furnaceItemStacks[0] = null; + } } - - this.vis = this.aspects.visSize(); - - this.furnaceItemStacks[0].stackSize -= 1; - - if (this.furnaceItemStacks[0].stackSize > 0) - return; - this.furnaceItemStacks[0] = null; } - public static boolean isItemFuel(ItemStack par0ItemStack) { - return (TileEntityFurnace.getItemBurnTime(par0ItemStack) > 0); + public static boolean isItemFuel(final ItemStack par0ItemStack) { + return TileEntityFurnace.getItemBurnTime(par0ItemStack) > 0; } - public boolean func_70300_a(EntityPlayer par1EntityPlayer) { - return (this.worldObj.getTileEntity(this.xCoord, this.yCoord, - this.zCoord) == this); + @Override + public boolean isUseableByPlayer(final EntityPlayer par1EntityPlayer) { + return (this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) == this) + && (par1EntityPlayer.getDistanceSq(this.xCoord + 0.5, this.yCoord + 0.5, this.zCoord + 0.5) <= 64.0); } - public void func_70295_k_() { + @Override + public void openInventory() { } - public void func_70305_f() { + @Override + public void closeInventory() { } - public boolean func_94041_b(int par1, ItemStack par2ItemStack) { + @Override + public boolean isItemValidForSlot(final int par1, final ItemStack par2ItemStack) { if (par1 == 0) { AspectList al = ThaumcraftCraftingManager.getObjectTags(par2ItemStack); al = ThaumcraftCraftingManager.getBonusTags(par2ItemStack, al); - if ((al != null) && (al.size() > 0)) + if ((al != null) && (al.size() > 0)) { return true; + } } - return ((par1 == 1) ? isItemFuel(par2ItemStack) : false); + return (par1 == 1) && isItemFuel(par2ItemStack); } - public int[] func_94128_d(int par1) { - return ((par1 == 1) ? slots_top : (par1 == 0) ? slots_bottom : slots_sides); + @Override + public int[] getAccessibleSlotsFromSide(final int par1) { + return (par1 == 0) + ? TileFastAlchemyFurnace.slots_bottom + : ((par1 == 1) ? TileFastAlchemyFurnace.slots_top : TileFastAlchemyFurnace.slots_sides); } - public boolean func_102007_a(int par1, ItemStack par2ItemStack, int par3) { - return ((par3 == 1) ? false : func_94041_b(par1, par2ItemStack)); + @Override + public boolean canInsertItem(final int par1, final ItemStack par2ItemStack, final int par3) { + return (par3 != 1) && this.isItemValidForSlot(par1, par2ItemStack); } - public boolean func_102008_b(int par1, ItemStack par2ItemStack, int par3) { - return ((par3 != 0) || (par1 != 1) || (par2ItemStack.getItem() == Items.bucket)); + @Override + public boolean canExtractItem(final int par1, final ItemStack par2ItemStack, final int par3) { + return (par3 != 0) || (par1 != 1) || (par2ItemStack.getItem() == Items.bucket); } - public Aspect takeRandomAspect(AspectList exlude) { + @Override + public Aspect takeRandomAspect(final AspectList exlude) { if (this.aspects.size() > 0) { - AspectList temp = this.aspects.copy(); - if (exlude.size() > 0) - for (Aspect a : exlude.getAspects()) + final AspectList temp = this.aspects.copy(); + if (exlude.size() > 0) { + for (final Aspect a : exlude.getAspects()) { temp.remove(a); + } + } if (temp.size() > 0) { - Aspect tag = temp.getAspects()[this.worldObj.rand.nextInt(temp.getAspects().length)]; + final Aspect tag = temp.getAspects()[this.worldObj.rand.nextInt(temp.getAspects().length)]; this.aspects.remove(tag, 1); - this.vis -= 1; + --this.vis; return tag; } } return null; } - public boolean takeFromContainer(Aspect tag, int amount) { + @Override + public boolean takeFromContainer(final Aspect tag, final int amount) { if ((this.aspects != null) && (this.aspects.getAmount(tag) >= amount)) { this.aspects.remove(tag, amount); this.vis -= amount; @@ -423,4 +423,10 @@ public class TileFastAlchemyFurnace extends TileAlchemyFurnace { } return false; } + + static { + slots_bottom = new int[]{1}; + slots_top = new int[0]; + slots_sides = new int[]{0}; + } } \ No newline at end of file -- cgit 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. --- .../common/tile/TileFastAlchemyFurnace.java | 17 +- .../common/tile/TileFastArcaneAlembic.java | 258 +++++++++++++++++++++ 2 files changed, 263 insertions(+), 12 deletions(-) create mode 100644 src/Java/gtPlusPlus/xmod/thaumcraft/common/tile/TileFastArcaneAlembic.java (limited to 'src/Java/gtPlusPlus/xmod/thaumcraft/common/tile') diff --git a/src/Java/gtPlusPlus/xmod/thaumcraft/common/tile/TileFastAlchemyFurnace.java b/src/Java/gtPlusPlus/xmod/thaumcraft/common/tile/TileFastAlchemyFurnace.java index ec39e7f4af..756578a536 100644 --- a/src/Java/gtPlusPlus/xmod/thaumcraft/common/tile/TileFastAlchemyFurnace.java +++ b/src/Java/gtPlusPlus/xmod/thaumcraft/common/tile/TileFastAlchemyFurnace.java @@ -4,6 +4,7 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; +import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; @@ -13,15 +14,15 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityFurnace; import net.minecraft.world.EnumSkyBlock; import net.minecraftforge.common.util.ForgeDirection; +import thaumcraft.api.TileThaumcraft; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; import thaumcraft.common.config.ConfigItems; import thaumcraft.common.lib.crafting.ThaumcraftCraftingManager; -import thaumcraft.common.tiles.TileAlchemyFurnace; import thaumcraft.common.tiles.TileAlembic; import thaumcraft.common.tiles.TileBellows; -public class TileFastAlchemyFurnace extends TileAlchemyFurnace { +public class TileFastAlchemyFurnace extends TileThaumcraft implements ISidedInventory { private static final int[] slots_bottom; private static final int[] slots_top; private static final int[] slots_sides; @@ -103,7 +104,6 @@ public class TileFastAlchemyFurnace extends TileAlchemyFurnace { return (this.customName != null) && (this.customName.length() > 0); } - @Override public void setGuiDisplayName(final String par1Str) { this.customName = par1Str; } @@ -168,7 +168,6 @@ public class TileFastAlchemyFurnace extends TileAlchemyFurnace { return 64; } - @Override @SideOnly(Side.CLIENT) public int getCookProgressScaled(final int par1) { if (this.smeltTime <= 0) { @@ -177,13 +176,11 @@ public class TileFastAlchemyFurnace extends TileAlchemyFurnace { return (this.furnaceCookTime * par1) / this.smeltTime; } - @Override @SideOnly(Side.CLIENT) public int getContentsScaled(final int par1) { return (this.vis * par1) / this.maxVis; } - @Override @SideOnly(Side.CLIENT) public int getBurnTimeRemainingScaled(final int par1) { if (this.currentItemBurnTime == 0) { @@ -192,7 +189,6 @@ public class TileFastAlchemyFurnace extends TileAlchemyFurnace { return (this.furnaceBurnTime * par1) / this.currentItemBurnTime; } - @Override public boolean isBurning() { return this.furnaceBurnTime > 0; } @@ -229,9 +225,10 @@ public class TileFastAlchemyFurnace extends TileAlchemyFurnace { while (deep < 5) { ++deep; tile = this.worldObj.getTileEntity(this.xCoord, this.yCoord + deep, this.zCoord); - if (!(tile instanceof TileAlembic)) { + if (!(tile instanceof TileAlembic) || !(tile instanceof TileFastArcaneAlembic)) { break; } + final TileAlembic alembic = (TileAlembic) tile; if ((alembic.aspect != null) && (alembic.amount < alembic.maxAmount) && (this.aspects.getAmount(alembic.aspect) > 0)) { @@ -325,13 +322,11 @@ public class TileFastAlchemyFurnace extends TileAlchemyFurnace { return true; } - @Override public void getBellows() { this.bellows = TileBellows.getBellows(this.worldObj, this.xCoord, this.yCoord, this.zCoord, ForgeDirection.VALID_DIRECTIONS); } - @Override public void smeltItem() { if (this.canSmelt()) { AspectList al = ThaumcraftCraftingManager.getObjectTags(this.furnaceItemStacks[0]); @@ -395,7 +390,6 @@ public class TileFastAlchemyFurnace extends TileAlchemyFurnace { return (par3 != 0) || (par1 != 1) || (par2ItemStack.getItem() == Items.bucket); } - @Override public Aspect takeRandomAspect(final AspectList exlude) { if (this.aspects.size() > 0) { final AspectList temp = this.aspects.copy(); @@ -414,7 +408,6 @@ public class TileFastAlchemyFurnace extends TileAlchemyFurnace { return null; } - @Override public boolean takeFromContainer(final Aspect tag, final int amount) { if ((this.aspects != null) && (this.aspects.getAmount(tag) >= amount)) { this.aspects.remove(tag, amount); diff --git a/src/Java/gtPlusPlus/xmod/thaumcraft/common/tile/TileFastArcaneAlembic.java b/src/Java/gtPlusPlus/xmod/thaumcraft/common/tile/TileFastArcaneAlembic.java new file mode 100644 index 0000000000..b89f9a4229 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/thaumcraft/common/tile/TileFastArcaneAlembic.java @@ -0,0 +1,258 @@ +package gtPlusPlus.xmod.thaumcraft.common.tile; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.xmod.thaumcraft.common.block.TC_BlockHandler; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import thaumcraft.api.aspects.Aspect; +import thaumcraft.api.aspects.AspectList; +import thaumcraft.common.config.ConfigBlocks; +import thaumcraft.common.tiles.TileAlembic; + +public class TileFastArcaneAlembic extends TileAlembic { + public Aspect aspect; + public Aspect aspectFilter; + public int amount; + public int maxAmount; + public int facing; + public boolean aboveAlembic; + public boolean aboveFurnace; + ForgeDirection fd; + + public TileFastArcaneAlembic() { + this.aspectFilter = null; + this.amount = 0; + this.maxAmount = 64; + this.facing = 2; + this.aboveAlembic = false; + this.aboveFurnace = false; + this.fd = null; + } + + @Override + public AspectList getAspects() { + return (this.aspect != null) ? new AspectList().add(this.aspect, this.amount) : new AspectList(); + } + + @Override + public void setAspects(final AspectList aspects) { + } + + @Override + @SideOnly(Side.CLIENT) + public AxisAlignedBB getRenderBoundingBox() { + return AxisAlignedBB.getBoundingBox(this.xCoord - 1, this.yCoord, + this.zCoord - 1, this.xCoord + 2, this.yCoord + 1, + this.zCoord + 2); + } + + @Override + public void readCustomNBT(final NBTTagCompound nbttagcompound) { + this.facing = nbttagcompound.getByte("facing"); + this.aspectFilter = Aspect.getAspect(nbttagcompound.getString("AspectFilter")); + final String tag = nbttagcompound.getString("aspect"); + if (tag != null) { + this.aspect = Aspect.getAspect(tag); + } + this.amount = nbttagcompound.getShort("amount"); + this.fd = ForgeDirection.getOrientation(this.facing); + } + + @Override + public void writeCustomNBT(final NBTTagCompound nbttagcompound) { + if (this.aspect != null) { + nbttagcompound.setString("aspect", this.aspect.getTag()); + } + if (this.aspectFilter != null) { + nbttagcompound.setString("AspectFilter", this.aspectFilter.getTag()); + } + nbttagcompound.setShort("amount", (short) this.amount); + nbttagcompound.setByte("facing", (byte) this.facing); + } + + @Override + public boolean canUpdate() { + return false; + } + + @Override + public int addToContainer(final Aspect tt, int am) { + if (((this.amount < this.maxAmount) && (tt == this.aspect)) || (this.amount == 0)) { + this.aspect = tt; + final int added = Math.min(am, this.maxAmount - this.amount); + this.amount += added; + am -= added; + } + this.markDirty(); + this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); + return am; + } + + @Override + public boolean takeFromContainer(final Aspect tt, final int am) { + if ((this.amount == 0) || (this.aspect == null)) { + this.aspect = null; + this.amount = 0; + } + if ((this.aspect != null) && (this.amount >= am) && (tt == this.aspect)) { + this.amount -= am; + if (this.amount <= 0) { + this.aspect = null; + this.amount = 0; + } + this.markDirty(); + this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); + return true; + } + return false; + } + + @Override + public boolean doesContainerContain(final AspectList ot) { + return (this.amount > 0) && (this.aspect != null) && (ot.getAmount(this.aspect) > 0); + } + + @Override + public boolean doesContainerContainAmount(final Aspect tt, final int am) { + return (this.amount >= am) && (tt == this.aspect); + } + + @Override + public int containerContains(final Aspect tt) { + return (tt == this.aspect) ? this.amount : 0; + } + + @Override + public boolean doesContainerAccept(final Aspect tag) { + return true; + } + + @Override + public boolean takeFromContainer(final AspectList ot) { + return false; + } + + @Override + public void getAppearance() { + this.aboveAlembic = false; + this.aboveFurnace = false; + if ((this.worldObj.getBlock(this.xCoord, this.yCoord - 1, this.zCoord) == ConfigBlocks.blockStoneDevice) + && (this.worldObj.getBlockMetadata(this.xCoord, this.yCoord - 1, this.zCoord) == 0)) { + this.aboveFurnace = true; + } + else if ((this.worldObj.getBlock(this.xCoord, this.yCoord - 1, this.zCoord) == TC_BlockHandler.blockFastAlchemyFurnace) + && (this.worldObj.getBlockMetadata(this.xCoord, this.yCoord - 1, this.zCoord) == 0)) { + this.aboveFurnace = true; + } + + if ((this.worldObj.getBlock(this.xCoord, this.yCoord - 1, this.zCoord) == ConfigBlocks.blockMetalDevice) + && (this.worldObj.getBlockMetadata(this.xCoord, this.yCoord - 1, this.zCoord) == this + .getBlockMetadata())) { + this.aboveAlembic = true; + } + else if ((this.worldObj.getBlock(this.xCoord, this.yCoord - 1, this.zCoord) == TC_BlockHandler.blockFastArcaneAlembic) + && (this.worldObj.getBlockMetadata(this.xCoord, this.yCoord - 1, this.zCoord) == 1)) { + this.aboveAlembic = true; + } + } + + @Override + public void onDataPacket(final NetworkManager net, final S35PacketUpdateTileEntity pkt) { + super.onDataPacket(net, pkt); + this.getAppearance(); + } + + @Override + public int onWandRightClick(final World world, final ItemStack wandstack, final EntityPlayer player, final int x, + final int y, final int z, final int side, final int md) { + if (side <= 1) { + return 0; + } + this.facing = side; + this.fd = ForgeDirection.getOrientation(this.facing); + this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); + player.swingItem(); + this.markDirty(); + return 0; + } + + @Override + public ItemStack onWandRightClick(final World world, final ItemStack wandstack, final EntityPlayer player) { + return null; + } + + @Override + public void onUsingWandTick(final ItemStack wandstack, final EntityPlayer player, final int count) { + } + + @Override + public void onWandStoppedUsing(final ItemStack wandstack, final World world, final EntityPlayer player, + final int count) { + } + + @Override + public boolean isConnectable(final ForgeDirection face) { + return (face != ForgeDirection.getOrientation(this.facing)) && (face != ForgeDirection.DOWN); + } + + @Override + public boolean canInputFrom(final ForgeDirection face) { + return false; + } + + @Override + public boolean canOutputTo(final ForgeDirection face) { + return (face != ForgeDirection.getOrientation(this.facing)) && (face != ForgeDirection.DOWN); + } + + @Override + public void setSuction(final Aspect aspect, final int amount) { + } + + @Override + public Aspect getSuctionType(final ForgeDirection loc) { + return null; + } + + @Override + public int getSuctionAmount(final ForgeDirection loc) { + return 0; + } + + @Override + public Aspect getEssentiaType(final ForgeDirection loc) { + return this.aspect; + } + + @Override + public int getEssentiaAmount(final ForgeDirection loc) { + return this.amount; + } + + @Override + public int takeEssentia(final Aspect aspect, final int amount, final ForgeDirection face) { + return (this.canOutputTo(face) && this.takeFromContainer(aspect, amount)) ? amount : 0; + } + + @Override + public int addEssentia(final Aspect aspect, final int amount, final ForgeDirection loc) { + return 0; + } + + @Override + public int getMinimumSuction() { + return 0; + } + + @Override + public boolean renderExtendedTube() { + return true; + } +} \ No newline at end of file -- cgit