From e57da5ad4e8f48ff3ea349ca7d25cc2ea88277e9 Mon Sep 17 00:00:00 2001 From: mDiyo Date: Sat, 21 Sep 2013 00:50:54 -0700 Subject: [PATCH 1/8] Fix empty smeltery trying to drain --- .../blocks/logic/SmelteryLogic.java | 58 +++++++++++-------- 1 file changed, 34 insertions(+), 24 deletions(-) diff --git a/src/tconstruct/blocks/logic/SmelteryLogic.java b/src/tconstruct/blocks/logic/SmelteryLogic.java index d01d6559..1c086953 100644 --- a/src/tconstruct/blocks/logic/SmelteryLogic.java +++ b/src/tconstruct/blocks/logic/SmelteryLogic.java @@ -349,14 +349,16 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci } } - private void handleItemEntity(EntityItem item) + private void handleItemEntity (EntityItem item) { // Clients like to play merry hell with this and cause breakage (we update their inv on syncs) - if (worldObj.isRemote) return; + if (worldObj.isRemote) + return; item.age = 0; ItemStack istack = item.getEntityItem(); - if (istack.stackSize <= 0) return; + if (istack.stackSize <= 0) + return; int maxSlot = this.getSizeInventory(); boolean itemDestroyed = false; @@ -381,7 +383,8 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci if (!itemDestroyed) item.setEntityItemStack(istack); - if (itemAdded) { + if (itemAdded) + { this.needsUpdate = true; PacketDispatcher.sendPacketToAllInDimension(getDescriptionPacket(), worldObj.provider.dimensionId); } @@ -928,29 +931,36 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci return null; FluidStack liquid = moltenMetal.get(0); - if (liquid.amount - maxDrain <= 0) + if (liquid != null) { - FluidStack liq = liquid.copy(); - if (doDrain) + if (liquid.amount - maxDrain <= 0) { - //liquid = null; - moltenMetal.remove(liquid); - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - currentLiquid = 0; - needsUpdate = true; + FluidStack liq = liquid.copy(); + if (doDrain) + { + //liquid = null; + moltenMetal.remove(liquid); + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + currentLiquid = 0; + needsUpdate = true; + } + return liq; + } + else + { + if (doDrain) + { + liquid.amount -= maxDrain; + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + currentLiquid -= maxDrain; + needsUpdate = true; + } + return new FluidStack(liquid.fluidID, maxDrain, liquid.tag); } - return liq; } else { - if (doDrain) - { - liquid.amount -= maxDrain; - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - currentLiquid -= maxDrain; - needsUpdate = true; - } - return new FluidStack(liquid.fluidID, maxDrain, liquid.tag); + return new FluidStack(0, 0); } } @@ -962,7 +972,7 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci if (resource.amount + currentLiquid > maxLiquid) resource.amount = maxLiquid - currentLiquid; int amount = resource.amount; - + if (doFill) { if (addMoltenMetal(resource, false)) @@ -1002,8 +1012,8 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci { return new FluidTankInfo(this); } - - public FluidTankInfo[] getMultiTankInfo() + + public FluidTankInfo[] getMultiTankInfo () { FluidTankInfo[] info = new FluidTankInfo[moltenMetal.size() + 1]; for (int i = 0; i < moltenMetal.size(); i++) From 2c946308ca6587dd41a6dc20b77a873f7d855c36 Mon Sep 17 00:00:00 2001 From: Arthur Uzulin Date: Sat, 21 Sep 2013 19:55:57 +1000 Subject: [PATCH 2/8] Update Sounds for 1.6.4 The old method would still have worked --- src/tconstruct/client/TClientEvents.java | 31 +++++++++--------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/src/tconstruct/client/TClientEvents.java b/src/tconstruct/client/TClientEvents.java index 7cb499f7..dd2215c3 100644 --- a/src/tconstruct/client/TClientEvents.java +++ b/src/tconstruct/client/TClientEvents.java @@ -1,36 +1,27 @@ package tconstruct.client; +import cpw.mods.fml.relauncher.*; import java.util.Random; - import net.minecraft.block.Block; import net.minecraft.client.Minecraft; -import net.minecraft.client.audio.SoundPool; +import net.minecraft.client.audio.SoundManager; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.entity.EntityLiving; -import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.*; import net.minecraft.entity.ai.attributes.AttributeInstance; -import net.minecraft.potion.Potion; -import net.minecraft.potion.PotionEffect; -import net.minecraft.util.MathHelper; -import net.minecraft.util.ResourceLocation; +import net.minecraft.potion.*; +import net.minecraft.util.*; import net.minecraftforge.client.GuiIngameForge; -import net.minecraftforge.client.event.RenderGameOverlayEvent; +import net.minecraftforge.client.event.*; import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; -import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.client.event.sound.SoundLoadEvent; import net.minecraftforge.event.ForgeSubscribe; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.*; import tconstruct.TConstruct; -import tconstruct.blocks.LiquidMetalFinite; -import tconstruct.blocks.slime.SlimeFluid; import tconstruct.client.armor.WingModel; import tconstruct.common.TContent; import tconstruct.util.player.TPlayerStats; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class TClientEvents @@ -49,10 +40,10 @@ public class TClientEvents initSounds = true; try { - SoundPool soundpool = event.manager.soundPoolSounds; - soundpool.addSound("tinker:frypan_hit.ogg"); - soundpool.addSound("tinker:little_saw.ogg"); - soundpool.addSound("tinker:launcher_clank.ogg"); + SoundManager soundmanager = event.manager; + soundmanager.addSound("tinker:frypan_hit.ogg"); + soundmanager.addSound("tinker:little_saw.ogg"); + soundmanager.addSound("tinker:launcher_clank.ogg"); System.out.println("[TConstruct] Successfully loaded sounds."); } catch (Exception e) From 86c19cf596e48d5748f29d63aa3be2410543ee7f Mon Sep 17 00:00:00 2001 From: Arthur Uzulin Date: Sat, 21 Sep 2013 21:01:57 +1000 Subject: [PATCH 3/8] Slight changes to glass pane top/bottom textures --- src/tconstruct/blocks/GlassPaneConnected.java | 14 +++++++------- .../client/block/PaneConnectedRender.java | 5 +++++ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/tconstruct/blocks/GlassPaneConnected.java b/src/tconstruct/blocks/GlassPaneConnected.java index 4f85329c..76e691a3 100644 --- a/src/tconstruct/blocks/GlassPaneConnected.java +++ b/src/tconstruct/blocks/GlassPaneConnected.java @@ -32,7 +32,7 @@ public class GlassPaneConnected extends GlassBlockConnected { @Override public Icon getBlockTexture(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) { if (par5 == 0 || par5 == 1) { - return getSideTextureIndex(); + return par1IBlockAccess.getBlockId(par2, par3 - 1, par4) == this.blockID && par5 == 0 ? icons[15] : par1IBlockAccess.getBlockId(par2, par3 + 1, par4) == this.blockID && par5 == 1 ? icons[15] : getSideTextureIndex(); } else { return super.getBlockTexture(par1IBlockAccess, par2, par3, par4, par5); } @@ -444,11 +444,11 @@ public class GlassPaneConnected extends GlassBlockConnected { @Override public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) { - if(par5 == 0 || par5 == 1){ - return par1IBlockAccess.getBlockId(par2, par3, par4) != this.blockID; - }else{ - return true; - } -// return true; +// if(par5 == 0 || par5 == 1){ +// return par1IBlockAccess.getBlockId(par2, par3, par4) != this.blockID; +// }else{ +// return true; +// } + return true; } } diff --git a/src/tconstruct/client/block/PaneConnectedRender.java b/src/tconstruct/client/block/PaneConnectedRender.java index 21769f8e..a143db4f 100644 --- a/src/tconstruct/client/block/PaneConnectedRender.java +++ b/src/tconstruct/client/block/PaneConnectedRender.java @@ -25,6 +25,9 @@ public class PaneConnectedRender implements ISimpleBlockRenderingHandler { @Override public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { + boolean temp = renderer.renderAllFaces; + renderer.renderAllFaces = true; + GlassPaneConnected pane = (GlassPaneConnected)block; boolean flag = pane.canPaneConnectTo(world, x, y, z, EAST); @@ -69,6 +72,8 @@ public class PaneConnectedRender implements ISimpleBlockRenderingHandler { renderer.clearOverrideBlockTexture(); + + renderer.renderAllFaces = false; return true; } From e07bd5312f0349ba807762d967f658babf2c2efd Mon Sep 17 00:00:00 2001 From: mDiyo Date: Sat, 21 Sep 2013 04:32:46 -0700 Subject: [PATCH 4/8] Fix Smeltery eating invalid items, only attack mobs if fluid is inside Smeltery --- src/tconstruct/blocks/logic/SmelteryLogic.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tconstruct/blocks/logic/SmelteryLogic.java b/src/tconstruct/blocks/logic/SmelteryLogic.java index 1c086953..2ccab44f 100644 --- a/src/tconstruct/blocks/logic/SmelteryLogic.java +++ b/src/tconstruct/blocks/logic/SmelteryLogic.java @@ -357,7 +357,7 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci item.age = 0; ItemStack istack = item.getEntityItem(); - if (istack.stackSize <= 0) + if (istack == null || istack.stackSize <= 0) return; int maxSlot = this.getSizeInventory(); @@ -369,8 +369,8 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci ItemStack stack = this.getStackInSlot(i); if (stack == null && istack.stackSize > 0) { - this.setInventorySlotContents(i, new ItemStack(istack.getItem(), 1)); - istack.stackSize -= 1; + ItemStack copy = istack.splitStack(1); + this.setInventorySlotContents(i, copy); itemAdded = true; if (istack.stackSize <= 0) { From d6162a14a5cf4fd3b145e14626e93cc95adce756 Mon Sep 17 00:00:00 2001 From: mDiyo Date: Sat, 21 Sep 2013 04:34:08 -0700 Subject: [PATCH 5/8] Really make smeltery only attack entities if it contains fluid --- src/tconstruct/blocks/logic/SmelteryLogic.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/tconstruct/blocks/logic/SmelteryLogic.java b/src/tconstruct/blocks/logic/SmelteryLogic.java index 2ccab44f..4f5cd8c2 100644 --- a/src/tconstruct/blocks/logic/SmelteryLogic.java +++ b/src/tconstruct/blocks/logic/SmelteryLogic.java @@ -302,6 +302,9 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci void detectEntities () { + if (moltenMetal.size() < 1) + return; + AxisAlignedBB box = AxisAlignedBB.getAABBPool().getAABB(centerPos.x, centerPos.y, centerPos.z, centerPos.x + 1.0D, centerPos.y + 1.0D, centerPos.z + 1.0D).expand(1.0D, 0.0D, 1.0D); List list = worldObj.getEntitiesWithinAABB(Entity.class, box); From a27c2a552a3505b28071e601d7be6eb034b28101 Mon Sep 17 00:00:00 2001 From: mDiyo Date: Sat, 21 Sep 2013 04:36:35 -0700 Subject: [PATCH 6/8] Comments! --- src/tconstruct/blocks/logic/SmelteryLogic.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tconstruct/blocks/logic/SmelteryLogic.java b/src/tconstruct/blocks/logic/SmelteryLogic.java index 4f5cd8c2..7151a4a6 100644 --- a/src/tconstruct/blocks/logic/SmelteryLogic.java +++ b/src/tconstruct/blocks/logic/SmelteryLogic.java @@ -360,7 +360,7 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci item.age = 0; ItemStack istack = item.getEntityItem(); - if (istack == null || istack.stackSize <= 0) + if (istack == null || istack.stackSize <= 0) //Probably most definitely not necessary return; int maxSlot = this.getSizeInventory(); From 7595cbfc0e3a5b4bf1e303c845d01328238c6fdd Mon Sep 17 00:00:00 2001 From: mDiyo Date: Sat, 21 Sep 2013 05:10:55 -0700 Subject: [PATCH 7/8] Items always omnomnom --- .../blocks/logic/SmelteryLogic.java | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/src/tconstruct/blocks/logic/SmelteryLogic.java b/src/tconstruct/blocks/logic/SmelteryLogic.java index 7151a4a6..6cd75696 100644 --- a/src/tconstruct/blocks/logic/SmelteryLogic.java +++ b/src/tconstruct/blocks/logic/SmelteryLogic.java @@ -302,47 +302,47 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci void detectEntities () { - if (moltenMetal.size() < 1) - return; - AxisAlignedBB box = AxisAlignedBB.getAABBPool().getAABB(centerPos.x, centerPos.y, centerPos.z, centerPos.x + 1.0D, centerPos.y + 1.0D, centerPos.z + 1.0D).expand(1.0D, 0.0D, 1.0D); List list = worldObj.getEntitiesWithinAABB(Entity.class, box); for (Object o : list) { - if (o instanceof EntityVillager) + if (moltenMetal.size() >= 1) { - EntityVillager villager = (EntityVillager) o; - if (villager.attackEntityFrom(new SmelteryDamageSource(), 1)) + if (o instanceof EntityVillager) { - if (currentLiquid + 8 < maxLiquid) + EntityVillager villager = (EntityVillager) o; + if (villager.attackEntityFrom(new SmelteryDamageSource(), 1)) { - int amount = villager.isChild() ? 1 : 8; - this.addMoltenMetal(new FluidStack(TContent.moltenEmeraldFluid, amount), false); + if (currentLiquid + 8 < maxLiquid) + { + int amount = villager.isChild() ? 1 : 8; + this.addMoltenMetal(new FluidStack(TContent.moltenEmeraldFluid, amount), false); + } } } - } - else if (o instanceof EntityEnderman) - { - EntityEnderman villager = (EntityEnderman) o; - if (villager.attackEntityFrom(new SmelteryDamageSource(), 1)) + else if (o instanceof EntityEnderman) { - if (currentLiquid + 25 < maxLiquid) + EntityEnderman villager = (EntityEnderman) o; + if (villager.attackEntityFrom(new SmelteryDamageSource(), 1)) { - this.addMoltenMetal(new FluidStack(TContent.moltenEnderFluid, 25), false); + if (currentLiquid + 25 < maxLiquid) + { + this.addMoltenMetal(new FluidStack(TContent.moltenEnderFluid, 25), false); + } } } - } - else if (o instanceof EntityLiving) - { - EntityLiving living = (EntityLiving) o; - if (living.attackEntityFrom(new SmelteryDamageSource(), 1)) + else if (o instanceof EntityLiving) { - /*if (currentLiquid + 8 < maxLiquid) + EntityLiving living = (EntityLiving) o; + if (living.attackEntityFrom(new SmelteryDamageSource(), 1)) { - int amount = living.isChild() ? 2 : 8; - this.addMoltenMetal(new FluidStack(TContent.liquidMetalStill.blockID, amount, 16), false); - }*/ + /*if (currentLiquid + 8 < maxLiquid) + { + int amount = living.isChild() ? 2 : 8; + this.addMoltenMetal(new FluidStack(TContent.liquidMetalStill.blockID, amount, 16), false); + }*/ + } } } else if (PHConstruct.throwableSmeltery && o instanceof EntityItem) From 10f04a6534cde5808a6683276809f7dc34965c8d Mon Sep 17 00:00:00 2001 From: mDiyo Date: Sat, 21 Sep 2013 06:14:11 -0700 Subject: [PATCH 8/8] Update Smeltery Blood to new fluid system --- src/tconstruct/blocks/logic/SmelteryLogic.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tconstruct/blocks/logic/SmelteryLogic.java b/src/tconstruct/blocks/logic/SmelteryLogic.java index 6cd75696..1b2f0d29 100644 --- a/src/tconstruct/blocks/logic/SmelteryLogic.java +++ b/src/tconstruct/blocks/logic/SmelteryLogic.java @@ -339,8 +339,8 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci { /*if (currentLiquid + 8 < maxLiquid) { - int amount = living.isChild() ? 2 : 8; - this.addMoltenMetal(new FluidStack(TContent.liquidMetalStill.blockID, amount, 16), false); + int amount = living.isChild() ? 1 : 8; + this.addMoltenMetal(new FluidStack(TContent.bloodFluid, amount), false); }*/ } }