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/blocks/logic/SmelteryLogic.java b/src/tconstruct/blocks/logic/SmelteryLogic.java index d01d6559..1b2f0d29 100644 --- a/src/tconstruct/blocks/logic/SmelteryLogic.java +++ b/src/tconstruct/blocks/logic/SmelteryLogic.java @@ -307,39 +307,42 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci 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() ? 1 : 8; + this.addMoltenMetal(new FluidStack(TContent.bloodFluid, amount), false); + }*/ + } } } else if (PHConstruct.throwableSmeltery && o instanceof EntityItem) @@ -349,14 +352,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 == null || istack.stackSize <= 0) //Probably most definitely not necessary + return; int maxSlot = this.getSizeInventory(); boolean itemDestroyed = false; @@ -367,8 +372,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) { @@ -381,7 +386,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 +934,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 +975,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 +1015,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++) 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) 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; }