aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/thaumcraft/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/thaumcraft/common')
-rw-r--r--src/Java/gtPlusPlus/xmod/thaumcraft/common/HANDLER_Thaumcraft.java27
-rw-r--r--src/Java/gtPlusPlus/xmod/thaumcraft/common/ItemBlockThaumcraft.java34
-rw-r--r--src/Java/gtPlusPlus/xmod/thaumcraft/common/block/BlockFastAlchemyFurnace.java250
-rw-r--r--src/Java/gtPlusPlus/xmod/thaumcraft/common/block/BlockFastArcaneAlembic.java373
-rw-r--r--src/Java/gtPlusPlus/xmod/thaumcraft/common/block/TC_BlockHandler.java15
-rw-r--r--src/Java/gtPlusPlus/xmod/thaumcraft/common/tile/TileFastAlchemyFurnace.java425
-rw-r--r--src/Java/gtPlusPlus/xmod/thaumcraft/common/tile/TileFastArcaneAlembic.java258
7 files changed, 1382 insertions, 0 deletions
diff --git a/src/Java/gtPlusPlus/xmod/thaumcraft/common/HANDLER_Thaumcraft.java b/src/Java/gtPlusPlus/xmod/thaumcraft/common/HANDLER_Thaumcraft.java
new file mode 100644
index 0000000000..7c5d2407cd
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/thaumcraft/common/HANDLER_Thaumcraft.java
@@ -0,0 +1,27 @@
+package gtPlusPlus.xmod.thaumcraft.common;
+
+import gtPlusPlus.core.lib.LoadedMods;
+import gtPlusPlus.xmod.thaumcraft.common.block.TC_BlockHandler;
+
+public class HANDLER_Thaumcraft {
+
+ public static void preInit(){
+ if (LoadedMods.Thaumcraft){
+ TC_BlockHandler.run();
+ }
+ }
+
+ public static void init(){
+ if (LoadedMods.Thaumcraft){
+
+ }
+ }
+
+ public static void postInit(){
+ if (LoadedMods.Thaumcraft){
+
+ }
+ }
+
+
+}
diff --git a/src/Java/gtPlusPlus/xmod/thaumcraft/common/ItemBlockThaumcraft.java b/src/Java/gtPlusPlus/xmod/thaumcraft/common/ItemBlockThaumcraft.java
new file mode 100644
index 0000000000..465f443906
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/thaumcraft/common/ItemBlockThaumcraft.java
@@ -0,0 +1,34 @@
+package gtPlusPlus.xmod.thaumcraft.common;
+
+import gtPlusPlus.core.item.base.itemblock.ItemBlockEntityBase;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+
+public class ItemBlockThaumcraft extends ItemBlockEntityBase{
+
+ public ItemBlockThaumcraft(final Block block) {
+ super(block);
+ }
+
+ @Override
+ public int getMetadata(final int par1) {
+ return par1;
+ }
+
+ @Override
+ public String getUnlocalizedName(final ItemStack par1ItemStack) {
+ return super.getUnlocalizedName() + "." + par1ItemStack.getItemDamage();
+ }
+
+ public boolean placeBlockAt(final ItemStack stack, final EntityPlayer player, final World world, final int x,
+ final int y, final int z, final int side, final float hitX, final float hitY, final float hitZ,
+ final int metadata) {
+ final boolean ret = super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, metadata);
+ return ret;
+ }
+
+
+
+}
diff --git a/src/Java/gtPlusPlus/xmod/thaumcraft/common/block/BlockFastAlchemyFurnace.java b/src/Java/gtPlusPlus/xmod/thaumcraft/common/block/BlockFastAlchemyFurnace.java
new file mode 100644
index 0000000000..bf4a61cfc9
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/thaumcraft/common/block/BlockFastAlchemyFurnace.java
@@ -0,0 +1,250 @@
+package gtPlusPlus.xmod.thaumcraft.common.block;
+
+import java.util.List;
+import java.util.Random;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import cpw.mods.fml.common.registry.LanguageRegistry;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gtPlusPlus.GTplusplus;
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.handler.GuiHandler;
+import gtPlusPlus.xmod.thaumcraft.common.ItemBlockThaumcraft;
+import gtPlusPlus.xmod.thaumcraft.common.tile.TileFastAlchemyFurnace;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockContainer;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+import net.minecraftforge.common.util.ForgeDirection;
+import thaumcraft.common.lib.utils.InventoryUtils;
+
+public class BlockFastAlchemyFurnace extends BlockContainer {
+
+ public IIcon[] iconFurnace;
+ public IIcon[] iconPedestal;
+
+ public BlockFastAlchemyFurnace() {
+ super(Material.iron);
+ this.iconFurnace = new IIcon[5];
+ this.iconPedestal = new IIcon[2];
+ this.setCreativeTab(AddToCreativeTab.tabMachines);
+ this.setBlockName("blockFastAlchemyFurnace");
+ this.setHardness(3.0f);
+ this.setResistance(25.0f);
+ this.setStepSound(Block.soundTypeStone);
+ this.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
+ GameRegistry.registerBlock(this, ItemBlockThaumcraft.class, "blockFastAlchemyFurnace");
+ LanguageRegistry.addName(this, "Upgraded Alchemical Furnace");
+ }
+
+ @Override
+ public int getLightValue(final IBlockAccess world, final int x, final int y, final int z) {
+ final Block block = world.getBlock(x, y, z);
+ if (block != this)
+ {
+ return block.getLightValue(world, x, y, z);
+ }
+ /**
+ * Gets the light value of the specified block coords. Args: x, y, z
+ */
+ return this.getLightValue();
+ }
+
+ @Override
+ public int damageDropped(final int metadata) {
+ return 0;
+ }
+
+ @Override
+ public TileEntity createTileEntity(final World world, final int metadata) {
+ if (metadata == 0){
+ return new TileFastAlchemyFurnace();
+ }
+ return null;
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(final World var1, final int md) {
+ return null;
+ }
+
+ @Override
+ public int getComparatorInputOverride(final World world, final int x, final int y, final int z, final int rs) {
+ final TileEntity te = world.getTileEntity(x, y, z);
+ if ((te != null) && (te instanceof TileFastAlchemyFurnace)) {
+ return Container.calcRedstoneFromInventory((IInventory) te);
+ }
+ return 0;
+ }
+
+ @Override
+ public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player,
+ final int side, final float par7, final float par8, final float par9) {
+
+ if (world.isRemote) {
+ return true;
+ }
+
+ final int metadata = world.getBlockMetadata(x, y, z);
+ final TileEntity tileEntity = world.getTileEntity(x, y, z);
+
+ if ((metadata == 0) && (tileEntity instanceof TileFastAlchemyFurnace) && !player.isSneaking()) {
+ player.openGui(GTplusplus.instance, GuiHandler.GUI8, world, x, y, z);
+ return true;
+ }
+ return false;
+ }
+
+
+ @Override
+ public void addCollisionBoxesToList(final World world, final int i, final int j, final int k,
+ final AxisAlignedBB axisalignedbb, final List arraylist, final Entity par7Entity) {
+ this.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
+ super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
+ }
+
+ @Override
+ public void setBlockBoundsBasedOnState(final IBlockAccess world, final int i, final int j, final int k) {
+ this.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
+ super.setBlockBoundsBasedOnState(world, i, j, k);
+ }
+
+ @Override
+ public boolean onBlockEventReceived(final World par1World, final int par2, final int par3, final int par4,
+ final int par5, final int par6) {
+ /*if (par5 == 1) {
+ if (par1World.isRemote) {
+ Thaumcraft.proxy.blockSparkle(par1World, par2, par3, par4, 11960575, 2);
+ par1World.playAuxSFX(2001, par2, par3, par4, Block.getIdFromBlock(Blocks.stonebrick) + 0);
+ }
+ return true;
+ }*/
+ return super.onBlockEventReceived(par1World, par2, par3, par4, par5, par6);
+ }
+
+ @Override
+ public boolean isSideSolid(final IBlockAccess world, final int x, final int y, final int z,
+ final ForgeDirection side) {
+ return super.isSideSolid(world, x, y, z, side);
+ }
+
+ @Override
+ public boolean hasComparatorInputOverride() {
+ return true;
+ }
+
+ @Override
+ public void breakBlock(final World par1World, final int par2, final int par3, final int par4, final Block par5,
+ final int par6) {
+ InventoryUtils.dropItems(par1World, par2, par3, par4);
+ super.breakBlock(par1World, par2, par3, par4, par5, par6);
+ }
+
+ @Override
+ public void onNeighborBlockChange(final World world, final int x, final int y, final int z, final Block par5) {
+ final TileEntity te = world.getTileEntity(x, y, z);
+ if ((te != null) && (te instanceof TileFastAlchemyFurnace)) {
+ ((TileFastAlchemyFurnace) te).getBellows();
+ }
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void randomDisplayTick(final World w, final int i, final int j, final int k, final Random r) {
+ final TileEntity te = w.getTileEntity(i, j, k);
+ if ((te != null) && (te instanceof TileFastAlchemyFurnace) && ((TileFastAlchemyFurnace) te).isBurning()) {
+ final float f = i + 0.5f;
+ final float f2 = j + 0.2f + ((r.nextFloat() * 5.0f) / 16.0f);
+ final float f3 = k + 0.5f;
+ final float f4 = 0.52f;
+ final float f5 = (r.nextFloat() * 0.5f) - 0.25f;
+ w.spawnParticle("smoke", f - f4, f2, f3 + f5, 0.0, 0.0, 0.0);
+ w.spawnParticle("flame", f - f4, f2, f3 + f5, 0.0, 0.0, 0.0);
+ w.spawnParticle("smoke", f + f4, f2, f3 + f5, 0.0, 0.0, 0.0);
+ w.spawnParticle("flame", f + f4, f2, f3 + f5, 0.0, 0.0, 0.0);
+ w.spawnParticle("smoke", f + f5, f2, f3 - f4, 0.0, 0.0, 0.0);
+ w.spawnParticle("flame", f + f5, f2, f3 - f4, 0.0, 0.0, 0.0);
+ w.spawnParticle("smoke", f + f5, f2, f3 + f4, 0.0, 0.0, 0.0);
+ w.spawnParticle("flame", f + f5, f2, f3 + f4, 0.0, 0.0, 0.0);
+ }
+ }
+
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(final IIconRegister ir) {
+ this.iconPedestal[0] = ir.registerIcon("thaumcraft:pedestal_side");
+ this.iconPedestal[1] = ir.registerIcon("thaumcraft:pedestal_top");
+ this.iconFurnace[0] = ir.registerIcon("thaumcraft:al_furnace_side");
+ this.iconFurnace[1] = ir.registerIcon("thaumcraft:al_furnace_top");
+ this.iconFurnace[2] = ir.registerIcon("thaumcraft:al_furnace_front_off");
+ this.iconFurnace[3] = ir.registerIcon("thaumcraft:al_furnace_front_on");
+ this.iconFurnace[4] = ir.registerIcon("thaumcraft:al_furnace_top_filled");
+ }
+
+ /*@Override
+ public int getRenderType() {
+ return ConfigBlocks.blockStoneDeviceRI;
+ }*/
+
+ @Override
+ public boolean isOpaqueCube() {
+ return false;
+ }
+
+ @Override
+ public boolean renderAsNormalBlock() {
+ return false;
+ }
+
+ @Override
+ public IIcon getIcon(final int side, final int md) {
+ if (md == 0) {
+ if (side == 1) {
+ return this.iconFurnace[1];
+ }
+ if (side > 1) {
+ return this.iconFurnace[2];
+ }
+ } else if (md == 1) {
+ if (side <= 1) {
+ return this.iconPedestal[1];
+ }
+ if (side > 1) {
+ return this.iconPedestal[0];
+ }
+ }
+ return this.iconPedestal[1];
+ }
+
+ @Override
+ public IIcon getIcon(final IBlockAccess iblockaccess, final int i, final int j, final int k, final int side) {
+ final int metadata = iblockaccess.getBlockMetadata(i, j, k);
+ if (metadata == 0) {
+ final TileEntity te = iblockaccess.getTileEntity(i, j, k);
+ if (side == 1) {
+ if ((te != null) && (te instanceof TileFastAlchemyFurnace) && (((TileFastAlchemyFurnace) te).vis > 0)) {
+ return this.iconFurnace[4];
+ }
+ return this.iconFurnace[1];
+ } else if (side > 1) {
+ if ((te != null) && (te instanceof TileFastAlchemyFurnace) && ((TileFastAlchemyFurnace) te).isBurning()) {
+ return this.iconFurnace[3];
+ }
+ return this.iconFurnace[2];
+ }
+ }
+ return this.iconFurnace[0];
+ }
+
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/xmod/thaumcraft/common/block/BlockFastArcaneAlembic.java b/src/Java/gtPlusPlus/xmod/thaumcraft/common/block/BlockFastArcaneAlembic.java
new file mode 100644
index 0000000000..04c0673b49
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/thaumcraft/common/block/BlockFastArcaneAlembic.java
@@ -0,0 +1,373 @@
+package gtPlusPlus.xmod.thaumcraft.common.block;
+
+import java.util.List;
+import java.util.Random;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import cpw.mods.fml.common.registry.LanguageRegistry;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.xmod.thaumcraft.common.ItemBlockThaumcraft;
+import gtPlusPlus.xmod.thaumcraft.common.tile.TileFastArcaneAlembic;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockContainer;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.util.ChatComponentTranslation;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.MathHelper;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+import net.minecraftforge.common.util.ForgeDirection;
+import thaumcraft.api.aspects.AspectList;
+import thaumcraft.api.aspects.IEssentiaContainerItem;
+import thaumcraft.common.blocks.ItemJarFilled;
+import thaumcraft.common.config.ConfigBlocks;
+import thaumcraft.common.config.ConfigItems;
+import thaumcraft.common.lib.utils.InventoryUtils;
+
+public class BlockFastArcaneAlembic extends BlockContainer {
+ public IIcon[] icon;
+ public IIcon iconGlow;
+ private final int delay;
+
+ public BlockFastArcaneAlembic() {
+ super(Material.iron);
+ this.icon = new IIcon[23];
+ this.delay = 0;
+ this.setStepSound(Block.soundTypeMetal);
+ this.setCreativeTab(AddToCreativeTab.tabMachines);
+ this.setBlockName("blockFastArcaneAlembic");
+ this.setHardness(3.0f);
+ this.setResistance(25.0f);
+ this.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
+ GameRegistry.registerBlock(this, ItemBlockThaumcraft.class, "blockFastArcaneAlembic");
+ LanguageRegistry.addName(this, "Upgraded Arcane Alembic");
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(final IIconRegister ir) {
+ this.icon[0] = ir.registerIcon("thaumcraft:metalbase");
+ for (int a = 1; a <= 6; ++a) {
+ this.icon[a] = ir.registerIcon("thaumcraft:crucible" + a);
+ }
+ this.icon[7] = ir.registerIcon("thaumcraft:goldbase");
+ this.iconGlow = ir.registerIcon("thaumcraft:animatedglow");
+ }
+
+ @Override
+ public IIcon getIcon(final int i, final int md) {
+ return ((md == 0) || (md == 1) || (md == 5) || (md == 6)) ? this.icon[0] : this.icon[7];
+ }
+
+ @Override
+ public IIcon getIcon(final IBlockAccess iblockaccess, final int i, final int j, final int k, final int side) {
+ if (side == 1) {
+ return this.icon[1];
+ }
+ if (side == 0) {
+ return this.icon[2];
+ }
+ return this.icon[3];
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void getSubBlocks(final Item par1, final CreativeTabs par2CreativeTabs, final List par3List) {
+ par3List.add(new ItemStack(par1, 1, 1));
+ }
+
+ @Override
+ public boolean isOpaqueCube() {
+ return false;
+ }
+
+ @Override
+ public boolean renderAsNormalBlock() {
+ return false;
+ }
+
+ @Override
+ public void onEntityCollidedWithBlock(final World world, final int i, final int j, final int k,
+ final Entity entity) {
+ if (!world.isRemote) {
+
+ }
+ }
+
+ @Override
+ public void addCollisionBoxesToList(final World world, final int i, final int j, final int k,
+ final AxisAlignedBB axisalignedbb, final List arraylist, final Entity par7Entity) {
+ this.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
+ super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void randomDisplayTick(final World w, final int i, final int j, final int k, final Random r) {
+
+ }
+
+ @Override
+ public int damageDropped(final int metadata) {
+ return metadata;
+ }
+
+ @Override
+ public TileEntity createTileEntity(final World world, final int metadata) {
+
+ if (metadata == 1) {
+ return new TileFastArcaneAlembic();
+ }
+ return super.createTileEntity(world, metadata);
+ }
+
+ @Override
+ public boolean hasComparatorInputOverride() {
+ return true;
+ }
+
+ @Override
+ public int getComparatorInputOverride(final World world, final int x, final int y, final int z, final int rs) {
+ final TileEntity te = world.getTileEntity(x, y, z);
+ if ((te != null) && (te instanceof TileFastArcaneAlembic)) {
+ final float r = ((TileFastArcaneAlembic) te).amount / ((TileFastArcaneAlembic) te).maxAmount;
+ return MathHelper.floor_float(r * 14.0f) + ((((TileFastArcaneAlembic) te).amount > 0) ? 1 : 0);
+ }
+ return 0;
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(final World var1, final int md) {
+ return null;
+ }
+
+ @Override
+ public void onNeighborBlockChange(final World world, final int x, final int y, final int z, final Block nbid) {
+ final TileEntity te = world.getTileEntity(x, y, z);
+ if (!world.isRemote) {
+ if ((te != null) && (te instanceof TileFastArcaneAlembic)) {
+ world.markBlockForUpdate(x, y, z);
+ }
+ }
+ super.onNeighborBlockChange(world, x, y, z, nbid);
+ }
+
+ @Override
+ public void breakBlock(final World par1World, final int par2, final int par3, final int par4, final Block par5,
+ final int par6) {
+ InventoryUtils.dropItems(par1World, par2, par3, par4);
+ final TileEntity te = par1World.getTileEntity(par2, par3, par4);
+ if ((te != null) && (te instanceof TileFastArcaneAlembic) && (((TileFastArcaneAlembic) te).aspectFilter != null)) {
+ par1World.spawnEntityInWorld(new EntityItem(par1World, par2 + 0.5f,
+ par3 + 0.5f, par4 + 0.5f, new ItemStack(ConfigItems.itemResource, 1, 13)));
+ }
+ super.breakBlock(par1World, par2, par3, par4, par5, par6);
+ }
+
+ @Override
+ public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player,
+ final int side, final float par7, final float par8, final float par9) {
+ final int metadata = world.getBlockMetadata(x, y, z);
+
+ if ((metadata == 1) && !world.isRemote && !player.isSneaking() && (player.getHeldItem() == null)) {
+ final TileEntity te2 = world.getTileEntity(x, y, z);
+ if ((te2 != null) && (te2 instanceof TileFastArcaneAlembic)) {
+ final TileFastArcaneAlembic tile2 = (TileFastArcaneAlembic) te2;
+ String msg = "";
+ if ((tile2.aspect == null) || (tile2.amount == 0)) {
+ msg = StatCollector.translateToLocal("tile.alembic.msg.1");
+ } else if (tile2.amount < (tile2.maxAmount * 0.4)) {
+ msg = StatCollector.translateToLocal("tile.alembic.msg.2");
+ } else if (tile2.amount < (tile2.maxAmount * 0.8)) {
+ msg = StatCollector.translateToLocal("tile.alembic.msg.3");
+ } else if (tile2.amount < tile2.maxAmount) {
+ msg = StatCollector.translateToLocal("tile.alembic.msg.4");
+ } else if (tile2.amount == tile2.maxAmount) {
+ msg = StatCollector.translateToLocal("tile.alembic.msg.5");
+ }
+ player.addChatMessage(new ChatComponentTranslation("ยง3" + msg, new Object[0]));
+ world.playSoundEffect(x, y, z, "thaumcraft:alembicknock", 0.2f, 1.0f);
+ }
+ }
+ if (metadata == 1) {
+ final TileEntity te2 = world.getTileEntity(x, y, z);
+ if ((te2 != null) && (te2 instanceof TileFastArcaneAlembic)) {
+ if (player.isSneaking() && (((TileFastArcaneAlembic) te2).aspectFilter != null)) {
+ ((TileFastArcaneAlembic) te2).aspectFilter = null;
+ world.markBlockForUpdate(x, y, z);
+ te2.markDirty();
+ if (world.isRemote) {
+ world.playSound(x + 0.5f, y + 0.5f, z + 0.5f,
+ "thaumcraft:page", 1.0f, 1.1f, false);
+ } else {
+ final ForgeDirection fd = ForgeDirection.getOrientation(side);
+ world.spawnEntityInWorld(new EntityItem(world, x + 0.5f + (fd.offsetX / 3.0f),
+ y + 0.5f, z + 0.5f + (fd.offsetZ / 3.0f),
+ new ItemStack(ConfigItems.itemResource, 1, 13)));
+ }
+ return true;
+ }
+ if (player.isSneaking() && (player.getHeldItem() == null)) {
+ ((TileFastArcaneAlembic) te2).amount = 0;
+ ((TileFastArcaneAlembic) te2).aspect = null;
+ if (world.isRemote) {
+ world.playSound(x + 0.5f, y + 0.5f, z + 0.5f,
+ "thaumcraft:alembicknock", 0.2f, 1.0f, false);
+ world.playSound(x + 0.5f, y + 0.5f, z + 0.5f,
+ "game.neutral.swim", 0.5f,
+ 1.0f + ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.3f), false);
+ }
+ } else if ((player.getHeldItem() != null) && (((TileFastArcaneAlembic) te2).aspectFilter == null)
+ && (player.getHeldItem().getItem() == ConfigItems.itemResource)
+ && (player.getHeldItem().getItemDamage() == 13)) {
+ if ((((TileFastArcaneAlembic) te2).amount == 0) && (((IEssentiaContainerItem) player.getHeldItem().getItem())
+ .getAspects(player.getHeldItem()) == null)) {
+ return true;
+ }
+ if ((((TileFastArcaneAlembic) te2).amount == 0) && (((IEssentiaContainerItem) player.getHeldItem().getItem())
+ .getAspects(player.getHeldItem()) != null)) {
+ ((TileFastArcaneAlembic) te2).aspect = ((IEssentiaContainerItem) player.getHeldItem().getItem())
+ .getAspects(player.getHeldItem()).getAspects()[0];
+ }
+ final ItemStack heldItem = player.getHeldItem();
+ --heldItem.stackSize;
+ ((TileFastArcaneAlembic) te2).aspectFilter = ((TileFastArcaneAlembic) te2).aspect;
+ world.markBlockForUpdate(x, y, z);
+ te2.markDirty();
+ if (world.isRemote) {
+ world.playSound(x + 0.5f, y + 0.5f, z + 0.5f,
+ "thaumcraft:page", 1.0f, 0.9f, false);
+ }
+ return true;
+ } else if ((player.getHeldItem() != null) && (((TileFastArcaneAlembic) te2).amount > 0)
+ && ((player.getHeldItem().getItem() == ConfigItems.itemJarFilled)
+ || player.getHeldItem().isItemEqual(new ItemStack(ConfigBlocks.blockJar, 1, 0))
+ || player.getHeldItem().isItemEqual(new ItemStack(ConfigBlocks.blockJar, 1, 3)))) {
+ boolean doit = false;
+ ItemStack drop = null;
+ if (player.getHeldItem().isItemEqual(new ItemStack(ConfigBlocks.blockJar, 1, 0))
+ || player.getHeldItem().isItemEqual(new ItemStack(ConfigBlocks.blockJar, 1, 3))) {
+ drop = new ItemStack(ConfigItems.itemJarFilled, 1, player.getHeldItem().getItemDamage());
+ doit = true;
+ ((ItemJarFilled) drop.getItem()).setAspects(drop,
+ new AspectList().add(((TileFastArcaneAlembic) te2).aspect, ((TileFastArcaneAlembic) te2).amount));
+ ((TileFastArcaneAlembic) te2).amount = 0;
+ ((TileFastArcaneAlembic) te2).aspect = null;
+ final ItemStack heldItem2 = player.getHeldItem();
+ --heldItem2.stackSize;
+ if (!player.inventory.addItemStackToInventory(drop) && !world.isRemote) {
+ world.spawnEntityInWorld(
+ new EntityItem(world, player.posX, player.posY, player.posZ, drop));
+ }
+ } else {
+ drop = player.getHeldItem();
+ if (((((ItemJarFilled) drop.getItem()).getAspects(drop) == null)
+ || (((ItemJarFilled) drop.getItem()).getAspects(drop).visSize() == 0)
+ || (((ItemJarFilled) drop.getItem()).getAspects(drop)
+ .getAmount(((TileFastArcaneAlembic) te2).aspect) > 0))
+ && ((((ItemJarFilled) drop.getItem()).getFilter(drop) == null)
+ || (((ItemJarFilled) drop.getItem())
+ .getFilter(drop) == ((TileFastArcaneAlembic) te2).aspect))) {
+ int amount = Math.min(
+ (((ItemJarFilled) drop.getItem()).getAspects(drop) == null)
+ ? 64
+ : (64 - ((ItemJarFilled) drop.getItem()).getAspects(drop).visSize()),
+ ((TileFastArcaneAlembic) te2).amount);
+ if (drop.getItemDamage() == 3) {
+ amount = ((TileFastArcaneAlembic) te2).amount;
+ }
+ if (amount > 0) {
+ final TileFastArcaneAlembic TileFastArcaneAlembic = (TileFastArcaneAlembic) te2;
+ TileFastArcaneAlembic.amount -= amount;
+ AspectList as = ((ItemJarFilled) drop.getItem()).getAspects(drop);
+ if (as == null) {
+ as = new AspectList();
+ }
+ as.add(((TileFastArcaneAlembic) te2).aspect, amount);
+ if (as.getAmount(((TileFastArcaneAlembic) te2).aspect) > 64) {
+ final int q = as.getAmount(((TileFastArcaneAlembic) te2).aspect) - 64;
+ as.reduce(((TileFastArcaneAlembic) te2).aspect, q);
+ }
+ ((ItemJarFilled) drop.getItem()).setAspects(drop, as);
+ if (((TileFastArcaneAlembic) te2).amount <= 0) {
+ ((TileFastArcaneAlembic) te2).aspect = null;
+ }
+ doit = true;
+ player.setCurrentItemOrArmor(0, drop);
+ }
+ }
+ }
+ if (doit) {
+ te2.markDirty();
+ world.markBlockForUpdate(x, y, z);
+ if (world.isRemote) {
+ world.playSound(x + 0.5f, y + 0.5f, z + 0.5f,
+ "game.neutral.swim", 0.5f,
+ 1.0f + ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.3f), false);
+ }
+ }
+ return true;
+ }
+ }
+ }
+
+ if (world.isRemote) {
+ return true;
+ }
+
+ return super.onBlockActivated(world, x, y, z, player, side, par7, par8, par9);
+ }
+
+ public void onPoweredBlockChange(final World par1World, final int par2, final int par3, final int par4,
+ final boolean flag) {
+ final int l = par1World.getBlockMetadata(par2, par3, par4);
+ if ((l == 5) && flag) {
+ par1World.setBlockMetadataWithNotify(par2, par3, par4, 6, 2);
+ par1World.playAuxSFXAtEntity((EntityPlayer) null, 1003, par2, par3, par4, 0);
+ } else if ((l == 6) && !flag) {
+ par1World.setBlockMetadataWithNotify(par2, par3, par4, 5, 2);
+ par1World.playAuxSFXAtEntity((EntityPlayer) null, 1003, par2, par3, par4, 0);
+ }
+ }
+
+ @Override
+ public void onBlockPlacedBy(final World world, final int par2, final int par3, final int par4,
+ final EntityLivingBase ent, final ItemStack stack) {
+ final int l = MathHelper.floor_double(((ent.rotationYaw * 4.0f) / 360.0f) + 0.5) & 0x3;
+ if (stack.getItemDamage() == 1) {
+ final TileEntity tile = world.getTileEntity(par2, par3, par4);
+ if (tile instanceof TileFastArcaneAlembic) {
+ if (l == 0) {
+ ((TileFastArcaneAlembic) tile).facing = 2;
+ }
+ if (l == 1) {
+ ((TileFastArcaneAlembic) tile).facing = 5;
+ }
+ if (l == 2) {
+ ((TileFastArcaneAlembic) tile).facing = 3;
+ }
+ if (l == 3) {
+ ((TileFastArcaneAlembic) tile).facing = 4;
+ }
+ }
+ }
+ }
+
+ @Override
+ public int getLightValue(final IBlockAccess world, final int x, final int y, final int z) {
+ return super.getLightValue(world, x, y, z);
+ }
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/xmod/thaumcraft/common/block/TC_BlockHandler.java b/src/Java/gtPlusPlus/xmod/thaumcraft/common/block/TC_BlockHandler.java
new file mode 100644
index 0000000000..0b8d18f7d2
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/thaumcraft/common/block/TC_BlockHandler.java
@@ -0,0 +1,15 @@
+package gtPlusPlus.xmod.thaumcraft.common.block;
+
+import net.minecraft.block.Block;
+
+public class TC_BlockHandler {
+
+ public static Block blockFastAlchemyFurnace;
+ public static Block blockFastArcaneAlembic;
+
+ public static void run(){
+ blockFastAlchemyFurnace = new BlockFastAlchemyFurnace();
+ blockFastArcaneAlembic = new BlockFastArcaneAlembic();
+ }
+
+}
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..756578a536
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/thaumcraft/common/tile/TileFastAlchemyFurnace.java
@@ -0,0 +1,425 @@
+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.inventory.ISidedInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraft.network.NetworkManager;
+import net.minecraft.network.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.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.TileAlembic;
+import thaumcraft.common.tiles.TileBellows;
+
+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;
+ public AspectList aspects;
+ public int vis;
+ private final 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 = 150;
+ this.smeltTime = 100;
+ this.bellows = -1;
+ this.speedBoost = true;
+ this.furnaceItemStacks = new ItemStack[2];
+ this.count = 0;
+ }
+
+ @Override
+ public int getSizeInventory() {
+ return this.furnaceItemStacks.length;
+ }
+
+ @Override
+ public ItemStack getStackInSlot(final int par1) {
+ return this.furnaceItemStacks[par1];
+ }
+
+ @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;
+ }
+ final ItemStack itemstack = this.furnaceItemStacks[par1].splitStack(par2);
+ if (this.furnaceItemStacks[par1].stackSize == 0) {
+ this.furnaceItemStacks[par1] = null;
+ }
+ return itemstack;
+ }
+
+ @Override
+ public ItemStack getStackInSlotOnClosing(final int par1) {
+ if (this.furnaceItemStacks[par1] != null) {
+ final ItemStack itemstack = this.furnaceItemStacks[par1];
+ this.furnaceItemStacks[par1] = null;
+ return itemstack;
+ }
+ return null;
+ }
+
+ @Override
+ public void setInventorySlotContents(final int par1, final ItemStack par2ItemStack) {
+ this.furnaceItemStacks[par1] = par2ItemStack;
+ if ((par2ItemStack != null) && (par2ItemStack.stackSize > this.getInventoryStackLimit())) {
+ par2ItemStack.stackSize = this.getInventoryStackLimit();
+ }
+ }
+
+ @Override
+ public String getInventoryName() {
+ return this.hasCustomInventoryName() ? this.customName : "container.alchemyfurnace";
+ }
+
+ @Override
+ public boolean hasCustomInventoryName() {
+ return (this.customName != null) && (this.customName.length() > 0);
+ }
+
+ public void setGuiDisplayName(final String par1Str) {
+ this.customName = par1Str;
+ }
+
+ @Override
+ public void readCustomNBT(final NBTTagCompound nbttagcompound) {
+ this.furnaceBurnTime = nbttagcompound.getShort("BurnTime");
+ this.vis = nbttagcompound.getShort("Vis");
+ }
+
+ @Override
+ public void writeCustomNBT(final NBTTagCompound nbttagcompound) {
+ nbttagcompound.setShort("BurnTime", (short) this.furnaceBurnTime);
+ nbttagcompound.setShort("Vis", (short) this.vis);
+ }
+
+ @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) {
+ 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();
+ }
+
+ @Override
+ public void writeToNBT(final NBTTagCompound nbtCompound) {
+ super.writeToNBT(nbtCompound);
+ nbtCompound.setBoolean("speedBoost", this.speedBoost);
+ nbtCompound.setShort("CookTime", (short) this.furnaceCookTime);
+ final NBTTagList nbttaglist = new NBTTagList();
+ for (int i = 0; i < this.furnaceItemStacks.length; ++i) {
+ 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 (this.hasCustomInventoryName()) {
+ nbtCompound.setString("CustomName", this.customName);
+ }
+ this.aspects.writeToNBT(nbtCompound);
+ }
+
+ @Override
+ public int getInventoryStackLimit() {
+ return 64;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public int getCookProgressScaled(final int par1) {
+ if (this.smeltTime <= 0) {
+ this.smeltTime = 1;
+ }
+ return (this.furnaceCookTime * par1) / this.smeltTime;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public int getContentsScaled(final int par1) {
+ return (this.vis * par1) / this.maxVis;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public int getBurnTimeRemainingScaled(final int par1) {
+ if (this.currentItemBurnTime == 0) {
+ this.currentItemBurnTime = 200;
+ }
+ return (this.furnaceBurnTime * par1) / this.currentItemBurnTime;
+ }
+
+ public boolean isBurning() {
+ return this.furnaceBurnTime > 0;
+ }
+
+ @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);
+ }
+ }
+
+ @Override
+ public boolean canUpdate() {
+ return true;
+ }
+
+ @Override
+ public void updateEntity() {
+ final boolean flag = this.furnaceBurnTime > 0;
+ boolean flag2 = false;
+ ++this.count;
+ if (this.furnaceBurnTime > 0) {
+ --this.furnaceBurnTime;
+ }
+ 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 instanceof TileFastArcaneAlembic)) {
+ break;
+ }
+
+ final TileAlembic alembic = (TileAlembic) tile;
+ if ((alembic.aspect != null) && (alembic.amount < alembic.maxAmount)
+ && (this.aspects.getAmount(alembic.aspect) > 0)) {
+ 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);
+ }
+ tile = null;
+ }
+ deep = 0;
+ while (deep < 5) {
+ ++deep;
+ tile = this.worldObj.getTileEntity(this.xCoord, this.yCoord + deep, this.zCoord);
+ if (!(tile instanceof TileAlembic)) {
+ break;
+ }
+ final TileAlembic alembic = (TileAlembic) tile;
+ if ((alembic.aspect != null) && (alembic.amount != 0)) {
+ continue;
+ }
+ Aspect as = null;
+ if (alembic.aspectFilter == null) {
+ 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);
+ break;
+ }
+ }
+ }
+ if ((this.furnaceBurnTime == 0) && this.canSmelt()) {
+ final int itemBurnTime = TileEntityFurnace.getItemBurnTime(this.furnaceItemStacks[1]);
+ this.furnaceBurnTime = itemBurnTime;
+ this.currentItemBurnTime = itemBurnTime;
+ if (this.furnaceBurnTime > 0) {
+ flag2 = true;
+ this.speedBoost = false;
+ if (this.furnaceItemStacks[1] != null) {
+ if (this.furnaceItemStacks[1].isItemEqual(new ItemStack(ConfigItems.itemResource, 1, 0))) {
+ this.speedBoost = true;
+ }
+ 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]);
+ }
+ }
+ }
+ }
+ if (this.isBurning() && this.canSmelt()) {
+ ++this.furnaceCookTime;
+ if (this.furnaceCookTime >= this.smeltTime) {
+ this.furnaceCookTime = 0;
+ this.smeltItem();
+ flag2 = true;
+ }
+ } else {
+ this.furnaceCookTime = 0;
+ }
+ if (flag != (this.furnaceBurnTime > 0)) {
+ flag2 = true;
+ this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
+ }
+ }
+ 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)) {
+ return false;
+ }
+ final 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 (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;
+ }
+ }
+ }
+
+ public static boolean isItemFuel(final ItemStack par0ItemStack) {
+ return TileEntityFurnace.getItemBurnTime(par0ItemStack) > 0;
+ }
+
+ @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);
+ }
+
+ @Override
+ public void openInventory() {
+ }
+
+ @Override
+ public void closeInventory() {
+ }
+
+ @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)) {
+ return true;
+ }
+ }
+ return (par1 == 1) && isItemFuel(par2ItemStack);
+ }
+
+ @Override
+ public int[] getAccessibleSlotsFromSide(final int par1) {
+ return (par1 == 0)
+ ? TileFastAlchemyFurnace.slots_bottom
+ : ((par1 == 1) ? TileFastAlchemyFurnace.slots_top : TileFastAlchemyFurnace.slots_sides);
+ }
+
+ @Override
+ public boolean canInsertItem(final int par1, final ItemStack par2ItemStack, final int par3) {
+ return (par3 != 1) && this.isItemValidForSlot(par1, par2ItemStack);
+ }
+
+ @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(final AspectList exlude) {
+ if (this.aspects.size() > 0) {
+ final AspectList temp = this.aspects.copy();
+ if (exlude.size() > 0) {
+ for (final Aspect a : exlude.getAspects()) {
+ temp.remove(a);
+ }
+ }
+ if (temp.size() > 0) {
+ final Aspect tag = temp.getAspects()[this.worldObj.rand.nextInt(temp.getAspects().length)];
+ this.aspects.remove(tag, 1);
+ --this.vis;
+ return tag;
+ }
+ }
+ return null;
+ }
+
+ 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;
+ return true;
+ }
+ return false;
+ }
+
+ static {
+ slots_bottom = new int[]{1};
+ slots_top = new int[0];
+ slots_sides = new int[]{0};
+ }
+} \ No newline at end of file
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