diff options
author | Alkalus <draknyte1@hotmail.com> | 2017-11-20 16:48:02 +1000 |
---|---|---|
committer | Alkalus <draknyte1@hotmail.com> | 2017-11-20 16:48:02 +1000 |
commit | fd15ae499c11112c282a93c6cf342bc88698e8ac (patch) | |
tree | c93ac973d4923f8359dc97ca4d777f8712524329 /src/Java/gtPlusPlus | |
parent | 04344136279524749cc07dc979c18baee6a72e4d (diff) | |
download | GT5-Unofficial-fd15ae499c11112c282a93c6cf342bc88698e8ac.tar.gz GT5-Unofficial-fd15ae499c11112c282a93c6cf342bc88698e8ac.tar.bz2 GT5-Unofficial-fd15ae499c11112c282a93c6cf342bc88698e8ac.zip |
+ Added a faster TC Alchemical Furnace.
+ Added a Wither-Proof block.
% Tweaked Grindle GUI.
Diffstat (limited to 'src/Java/gtPlusPlus')
8 files changed, 675 insertions, 4 deletions
diff --git a/src/Java/gtPlusPlus/core/block/ModBlocks.java b/src/Java/gtPlusPlus/core/block/ModBlocks.java index a469acfc49..6ebb21bb9c 100644 --- a/src/Java/gtPlusPlus/core/block/ModBlocks.java +++ b/src/Java/gtPlusPlus/core/block/ModBlocks.java @@ -4,6 +4,7 @@ import cpw.mods.fml.common.registry.GameRegistry; import gtPlusPlus.core.block.base.BasicBlock.BlockTypes; import gtPlusPlus.core.block.base.BlockBaseOre; import gtPlusPlus.core.block.general.*; +import gtPlusPlus.core.block.general.antigrief.BlockWitherProof; import gtPlusPlus.core.block.machine.*; import gtPlusPlus.core.fluids.FluidRegistryHandler; import gtPlusPlus.core.lib.CORE; @@ -45,6 +46,8 @@ public final class ModBlocks { public static Block blockProjectTable; public static Block blockTradeTable; public static Block blockModularTable; + + public static Block blockWitherGuard; public static void init() { Utils.LOG_INFO("Initializing Blocks."); @@ -74,6 +77,7 @@ public final class ModBlocks { blockProjectTable = new Machine_ProjectTable(); blockTradeTable = new Machine_TradeTable(); blockModularTable = new Machine_ModularityTable(); + blockWitherGuard = new BlockWitherProof(); } diff --git a/src/Java/gtPlusPlus/core/block/general/antigrief/BlockWitherProof.java b/src/Java/gtPlusPlus/core/block/general/antigrief/BlockWitherProof.java new file mode 100644 index 0000000000..297bcb3061 --- /dev/null +++ b/src/Java/gtPlusPlus/core/block/general/antigrief/BlockWitherProof.java @@ -0,0 +1,104 @@ +package gtPlusPlus.core.block.general.antigrief; + +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.core.lib.CORE; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.math.MathUtils; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.Entity; +import net.minecraft.entity.boss.EntityDragon; +import net.minecraft.entity.boss.EntityWither; +import net.minecraft.entity.boss.IBossDisplayData; +import net.minecraft.world.Explosion; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockWitherProof extends Block{ + + public BlockWitherProof(){ + super(Material.redstoneLight); + this.setBlockName(Utils.sanitizeString("blockBlackGate")); + this.setBlockTextureName(CORE.MODID + ":" + "blockFrameGt"); + this.setCreativeTab(AddToCreativeTab.tabBlock); + this.setHardness(-1F); + this.setResistance(5000.0F); + this.setHarvestLevel("pickaxe", 3); + this.setStepSound(soundTypeMetal); + LanguageRegistry.addName(this, "Wither Cage"); + GameRegistry.registerBlock(this, Utils.sanitizeString("blockBlackGate")); + + } + + public String GetProperName(){ + return "Wither Cage"; + } + + @Override + @SideOnly(Side.CLIENT) + public int getRenderBlockPass(){ + return 1; + } + + @Override + public boolean isOpaqueCube(){ + return false; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(final IIconRegister iIcon){ + this.blockIcon = iIcon.registerIcon(CORE.MODID + ":" + "blockFrameGt"); + } + + public void onBlockExploded(World world, int x, int y, int z, Explosion explosion){ + //prevent from being destroyed by wither and nukes. + } + + @Override + public void onBlockDestroyedByExplosion(World p_149723_1_, int p_149723_2_, + int p_149723_3_, int p_149723_4_, Explosion p_149723_5_) { + + } + + @Override + public boolean canDropFromExplosion(Explosion p_149659_1_) { + return false; + } + + @Override + public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, + Entity entity) { + if (entity == null || !entity.isEntityAlive()){ + return false; + } + if (entity instanceof EntityWither || entity instanceof EntityDragon || entity instanceof IBossDisplayData){ + return false; + } + else { + return super.canEntityDestroy(world, x, y, z, entity); + } + } + + + //Colour Handling + private static final int mWitherColour = Utils.rgbtoHexValue(32, 32, 32); + + @Override + public int colorMultiplier(final IBlockAccess par1IBlockAccess, final int par2, final int par3, final int par4){ + return mWitherColour; + } + + @Override + public int getRenderColor(final int aMeta) { + return mWitherColour; + } + + + +} diff --git a/src/Java/gtPlusPlus/core/gui/item/GuiBaseGrindle.java b/src/Java/gtPlusPlus/core/gui/item/GuiBaseGrindle.java index 798b74b48f..c7c14e9103 100644 --- a/src/Java/gtPlusPlus/core/gui/item/GuiBaseGrindle.java +++ b/src/Java/gtPlusPlus/core/gui/item/GuiBaseGrindle.java @@ -59,9 +59,9 @@ public class GuiBaseGrindle extends GuiContainer { if (this.inventory.getStackInSlot(0) != null){ this.fontRendererObj.drawString(I18n.format(""+NBTUtils.getBookTitle(this.inventory.getStackInSlot(0)), new Object[0]), 10, 8, Utils.rgbtoHexValue(125, 255, 125)); - if (!NBTUtils.tryIterateNBTData(this.inventory.getStackInSlot(0))){ - this.fontRendererObj.drawString(I18n.format("Very Bad prospection data.", new Object[0]), 10, 38, Utils.rgbtoHexValue(255, 125, 125)); - } + //if (!NBTUtils.tryIterateNBTData(this.inventory.getStackInSlot(0))){ + // this.fontRendererObj.drawString(I18n.format("Very Bad prospection data.", new Object[0]), 10, 38, Utils.rgbtoHexValue(255, 125, 125)); + //} NBTTagCompound tNBT = ItemNBT.getNBT(this.inventory.getStackInSlot(0)); byte tTier = tNBT.getByte("prospection_tier"); @@ -94,7 +94,6 @@ public class GuiBaseGrindle extends GuiContainer { this.fontRendererObj.drawString(I18n.format(mOreTypes[i], new Object[0]), 10, 68+((i-6)*8), Utils.rgbtoHexValue(125, 255, 125)); } } - Utils.LOG_INFO("test - "+tOres); tNBTList.appendTag(new NBTTagString("Prospection Data From: X" + tDataArray[0] + " Z:" + tDataArray[2] + " Dim:" + tDataArray[3] + " Produces " + tDataArray[4] + "L " + tDataArray[5] + " " + tOres)); tNBT.setTag("pages", tNBTList); diff --git a/src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java b/src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java index fe46e2befa..1bf729cdc6 100644 --- a/src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java +++ b/src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java @@ -7,6 +7,7 @@ import gtPlusPlus.xmod.gregtech.HANDLER_GT; import gtPlusPlus.xmod.growthcraft.HANDLER_GC; import gtPlusPlus.xmod.ic2.HANDLER_IC2; import gtPlusPlus.xmod.mekanism.HANDLER_Mekanism; +import gtPlusPlus.xmod.thaumcraft.common.HANDLER_Thaumcraft; import gtPlusPlus.xmod.thermalfoundation.HANDLER_TF; public class COMPAT_IntermodStaging { @@ -20,6 +21,7 @@ public class COMPAT_IntermodStaging { HANDLER_Computronics.preInit(); HANDLER_BiomesOPlenty.preInit(); HANDLER_Mekanism.preInit(); + HANDLER_Thaumcraft.preInit(); } @@ -32,6 +34,7 @@ public class COMPAT_IntermodStaging { HANDLER_Computronics.init(); HANDLER_BiomesOPlenty.init(); HANDLER_Mekanism.init(); + HANDLER_Thaumcraft.init(); } public static void postInit(){ @@ -43,6 +46,7 @@ public class COMPAT_IntermodStaging { HANDLER_Computronics.postInit(); HANDLER_BiomesOPlenty.postInit(); HANDLER_Mekanism.postInit(); + HANDLER_Thaumcraft.postInit(); } 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/block/BlockFastAlchemyFurnace.java b/src/Java/gtPlusPlus/xmod/thaumcraft/common/block/BlockFastAlchemyFurnace.java new file mode 100644 index 0000000000..3d570dfe7e --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/thaumcraft/common/block/BlockFastAlchemyFurnace.java @@ -0,0 +1,94 @@ +package gtPlusPlus.xmod.thaumcraft.common.block; + +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.tile.TileFastAlchemyFurnace; +import net.minecraft.block.Block; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import thaumcraft.common.blocks.BlockAlchemyFurnace; + +public class BlockFastAlchemyFurnace extends BlockAlchemyFurnace { + + public BlockFastAlchemyFurnace() { + this.setCreativeTab(AddToCreativeTab.tabMachines); + this.setBlockName("blockFastAlchemyFurnace"); + GameRegistry.registerBlock(this, "blockFastAlchemyFurnace"); + LanguageRegistry.addName(this, "Upgraded Alchemical Furnace"); + } + + public int func_149692_a(int metadata) { + if ((metadata == 1) || (metadata == 4)) + return 3; + if (metadata == 3) + return 9; + if (metadata == 2) + return 1; + return 0; + } + + public TileEntity createTileEntity(World world, int metadata) { + if (metadata == 0){ + return new TileFastAlchemyFurnace(); + } + return null; + } + + public int getLightValue(IBlockAccess world, int x, int y, int z){ + Block block = world.getBlock(x, y, z); + if (block != this) + { + return block.getLightValue(world, x, y, z); + } + return getLightValue(); + } + + /*public int func_149736_g(World world, int x, int y, int z, int rs) { + + }*/ + + public TileEntity func_149915_a(World var1, int md) { + return null; + } + + /* public void func_149749_a(World world, int x, int y, int z, Block bl, int md) { + + }*/ + + @SideOnly(Side.CLIENT) + public void func_149734_b(final World world, final int x, final int y, final int z, final Random rand) { + /*final int meta = world.func_72805_g(x, y, z); + if (meta == 0) { + final TileAlchemyFurnaceAdvanced tile = (TileAlchemyFurnaceAdvanced) world.func_147438_o(x, y, z); + if (tile != null && tile.vis > 0) { + final FXSlimyBubble ef = new FXSlimyBubble(world, (double) (x + rand.nextFloat()), (double) (y + 1), + (double) (z + rand.nextFloat()), 0.06f + rand.nextFloat() * 0.06f); + ef.func_82338_g(0.8f); + ef.func_70538_b(0.6f - rand.nextFloat() * 0.2f, 0.0f, 0.6f + rand.nextFloat() * 0.2f); + ParticleEngine.instance.addEffect(world, (EntityFX) ef); + if (rand.nextInt(50) == 0) { + final double var21 = x + rand.nextFloat(); + final double var22 = y + this.field_149756_F; + final double var23 = z + rand.nextFloat(); + world.func_72980_b(var21, var22, var23, "liquid.lavapop", 0.1f + rand.nextFloat() * 0.1f, + 0.9f + rand.nextFloat() * 0.15f, false); + } + final int q = rand.nextInt(2); + final int w = rand.nextInt(2); + final FXSlimyBubble ef2 = new FXSlimyBubble(world, x - 0.6 + rand.nextFloat() * 0.2 + q * 2, + (double) (y + 2), z - 0.6 + rand.nextFloat() * 0.2 + w * 2, 0.06f + rand.nextFloat() * 0.06f); + ef2.func_82338_g(0.8f); + ef2.func_70538_b(0.6f - rand.nextFloat() * 0.2f, 0.0f, 0.6f + rand.nextFloat() * 0.2f); + ParticleEngine.instance.addEffect(world, (EntityFX) ef2); + } + } + super.func_149734_b(world, x, y, z, rand);*/ + } + +}
\ 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..fade8601f0 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/thaumcraft/common/block/TC_BlockHandler.java @@ -0,0 +1,13 @@ +package gtPlusPlus.xmod.thaumcraft.common.block; + +import net.minecraft.block.Block; + +public class TC_BlockHandler { + + static Block blockFurnace; + + public static void run(){ + blockFurnace = new BlockFastAlchemyFurnace(); + } + +} 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 |