Managed to get a few things done today

This commit is contained in:
pahimar 2014-04-29 21:46:59 -04:00
parent 5794037f51
commit ac207393fe
37 changed files with 1075 additions and 321 deletions

View file

@ -4,10 +4,10 @@ import com.pahimar.ee3.EquivalentExchange3;
import com.pahimar.ee3.reference.GuiIds; import com.pahimar.ee3.reference.GuiIds;
import com.pahimar.ee3.reference.Names; import com.pahimar.ee3.reference.Names;
import com.pahimar.ee3.reference.RenderIds; import com.pahimar.ee3.reference.RenderIds;
import com.pahimar.ee3.tileentity.TileAlchemicalChest; import com.pahimar.ee3.tileentity.TileEntityAlchemicalChest;
import com.pahimar.ee3.tileentity.TileAlchemicalChestLarge; import com.pahimar.ee3.tileentity.TileEntityAlchemicalChestLarge;
import com.pahimar.ee3.tileentity.TileAlchemicalChestMedium; import com.pahimar.ee3.tileentity.TileEntityAlchemicalChestMedium;
import com.pahimar.ee3.tileentity.TileAlchemicalChestSmall; import com.pahimar.ee3.tileentity.TileEntityAlchemicalChestSmall;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.ITileEntityProvider;
@ -37,15 +37,15 @@ public class BlockAlchemicalChest extends BlockEE implements ITileEntityProvider
{ {
if (metaData == 0) if (metaData == 0)
{ {
return new TileAlchemicalChestSmall(); return new TileEntityAlchemicalChestSmall();
} }
else if (metaData == 1) else if (metaData == 1)
{ {
return new TileAlchemicalChestMedium(); return new TileEntityAlchemicalChestMedium();
} }
else if (metaData == 2) else if (metaData == 2)
{ {
return new TileAlchemicalChestLarge(); return new TileEntityAlchemicalChestLarge();
} }
return null; return null;
@ -84,7 +84,7 @@ public class BlockAlchemicalChest extends BlockEE implements ITileEntityProvider
} }
else else
{ {
if (!world.isRemote && world.getTileEntity(x, y, z) instanceof TileAlchemicalChest) if (!world.isRemote && world.getTileEntity(x, y, z) instanceof TileEntityAlchemicalChest)
{ {
player.openGui(EquivalentExchange3.instance, GuiIds.ALCHEMICAL_CHEST, world, x, y, z); player.openGui(EquivalentExchange3.instance, GuiIds.ALCHEMICAL_CHEST, world, x, y, z);
} }

View file

@ -2,7 +2,7 @@ package com.pahimar.ee3.block;
import com.pahimar.ee3.reference.Names; import com.pahimar.ee3.reference.Names;
import com.pahimar.ee3.reference.RenderIds; import com.pahimar.ee3.reference.RenderIds;
import com.pahimar.ee3.tileentity.TileAludel; import com.pahimar.ee3.tileentity.TileEntityAludel;
import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
@ -21,7 +21,7 @@ public class BlockAludel extends BlockEE implements ITileEntityProvider
@Override @Override
public TileEntity createNewTileEntity(World world, int metaData) public TileEntity createNewTileEntity(World world, int metaData)
{ {
return new TileAludel(); return new TileEntityAludel();
} }
@Override @Override

View file

@ -5,7 +5,7 @@ import com.pahimar.ee3.reference.GuiIds;
import com.pahimar.ee3.reference.Names; import com.pahimar.ee3.reference.Names;
import com.pahimar.ee3.reference.Particles; import com.pahimar.ee3.reference.Particles;
import com.pahimar.ee3.reference.RenderIds; import com.pahimar.ee3.reference.RenderIds;
import com.pahimar.ee3.tileentity.TileCalcinator; import com.pahimar.ee3.tileentity.TileEntityCalcinator;
import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@ -28,7 +28,7 @@ public class BlockCalcinator extends BlockEE implements ITileEntityProvider
@Override @Override
public TileEntity createNewTileEntity(World world, int metaData) public TileEntity createNewTileEntity(World world, int metaData)
{ {
return new TileCalcinator(); return new TileEntityCalcinator();
} }
@Override @Override
@ -52,7 +52,7 @@ public class BlockCalcinator extends BlockEE implements ITileEntityProvider
@Override @Override
public int getLightValue(IBlockAccess world, int x, int y, int z) public int getLightValue(IBlockAccess world, int x, int y, int z)
{ {
if ((world.getTileEntity(x, y, z) instanceof TileCalcinator) && (((TileCalcinator) world.getTileEntity(x, y, z)).getState() == 1)) if ((world.getTileEntity(x, y, z) instanceof TileEntityCalcinator) && (((TileEntityCalcinator) world.getTileEntity(x, y, z)).getState() == 1))
{ {
return 15; return 15;
} }
@ -79,7 +79,7 @@ public class BlockCalcinator extends BlockEE implements ITileEntityProvider
{ {
if (!world.isRemote) if (!world.isRemote)
{ {
if (world.getTileEntity(x, y, z) instanceof TileCalcinator) if (world.getTileEntity(x, y, z) instanceof TileEntityCalcinator)
{ {
player.openGui(EquivalentExchange3.instance, GuiIds.CALCINATOR, world, x, y, z); player.openGui(EquivalentExchange3.instance, GuiIds.CALCINATOR, world, x, y, z);
} }
@ -92,9 +92,9 @@ public class BlockCalcinator extends BlockEE implements ITileEntityProvider
@Override @Override
public void randomDisplayTick(World world, int x, int y, int z, Random random) public void randomDisplayTick(World world, int x, int y, int z, Random random)
{ {
if (world.getTileEntity(x, y, z) instanceof TileCalcinator) if (world.getTileEntity(x, y, z) instanceof TileEntityCalcinator)
{ {
if (((TileCalcinator) world.getTileEntity(x, y, z)).getState() == 1) if (((TileEntityCalcinator) world.getTileEntity(x, y, z)).getState() == 1)
{ {
// Fire pot particles // Fire pot particles
world.spawnParticle(Particles.NORMAL_SMOKE, (double) x + 0.5F, (double) y + 0.4F, (double) ((z + 0.5F) + (random.nextFloat() * 0.5F - 0.3F)), 0.0D, 0.0D, 0.0D); world.spawnParticle(Particles.NORMAL_SMOKE, (double) x + 0.5F, (double) y + 0.4F, (double) ((z + 0.5F) + (random.nextFloat() * 0.5F - 0.3F)), 0.0D, 0.0D, 0.0D);

View file

@ -1,12 +1,23 @@
package com.pahimar.ee3.block; package com.pahimar.ee3.block;
import com.pahimar.ee3.EquivalentExchange3;
import com.pahimar.ee3.reference.GuiIds;
import com.pahimar.ee3.reference.Names; import com.pahimar.ee3.reference.Names;
import com.pahimar.ee3.reference.RenderIds; import com.pahimar.ee3.reference.RenderIds;
import com.pahimar.ee3.tileentity.TileGlassBell; import com.pahimar.ee3.tileentity.TileEntityAludel;
import com.pahimar.ee3.tileentity.TileEntityEE;
import com.pahimar.ee3.tileentity.TileEntityGlassBell;
import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class BlockGlassBell extends BlockEE implements ITileEntityProvider public class BlockGlassBell extends BlockEE implements ITileEntityProvider
{ {
@ -20,7 +31,7 @@ public class BlockGlassBell extends BlockEE implements ITileEntityProvider
@Override @Override
public TileEntity createNewTileEntity(World world, int metaData) public TileEntity createNewTileEntity(World world, int metaData)
{ {
return new TileGlassBell(); return new TileEntityGlassBell();
} }
@Override @Override
@ -40,4 +51,124 @@ public class BlockGlassBell extends BlockEE implements ITileEntityProvider
{ {
return RenderIds.glassBell; return RenderIds.glassBell;
} }
@Override
public int getLightValue(IBlockAccess world, int x, int y, int z)
{
if (world.getTileEntity(x, y, z) instanceof TileEntityGlassBell)
{
TileEntityGlassBell tileEntityGlassBell = (TileEntityGlassBell) world.getTileEntity(x, y, z);
return tileEntityGlassBell.getState();
}
return 0;
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
{
if (player.isSneaking())
{
return false;
}
else
{
if (!world.isRemote)
{
if (world.getTileEntity(x, y, z) instanceof TileEntityGlassBell)
{
if (world.getTileEntity(x, y - 1, z) instanceof TileEntityAludel)
{
player.openGui(EquivalentExchange3.instance, GuiIds.ALUDEL, world, x, y - 1, z);
}
else
{
player.openGui(EquivalentExchange3.instance, GuiIds.GLASS_BELL, world, x, y, z);
}
}
}
return true;
}
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack itemStack)
{
if (itemStack.hasDisplayName())
{
((TileEntityEE) world.getTileEntity(x, y, z)).setCustomName(itemStack.getDisplayName());
}
if (world.getTileEntity(x, y - 1, z) != null && world.getTileEntity(x, y - 1, z) instanceof TileEntityAludel)
{
((TileEntityEE) world.getTileEntity(x, y, z)).setOrientation(ForgeDirection.UP);
}
else
{
((TileEntityEE) world.getTileEntity(x, y, z)).setOrientation(world.getBlockMetadata(x, y, z));
}
world.setBlockMetadataWithNotify(x, y, z, 0, 3);
}
@Override
public int onBlockPlaced(World world, int x, int y, int z, int sideHit, float hitX, float hitY, float hitZ, int metaData)
{
return sideHit;
}
/**
* Ray traces through the blocks collision from start vector to end vector returning a ray trace hit. Args: world,
* x, y, z, startVec, endVec
*/
@Override
public MovingObjectPosition collisionRayTrace(World world, int x, int y, int z, Vec3 startVec, Vec3 endVec)
{
if (world.getTileEntity(x, y, z) instanceof TileEntityGlassBell)
{
TileEntityGlassBell tileGlassBell = (TileEntityGlassBell) world.getTileEntity(x, y, z);
switch (tileGlassBell.getOrientation())
{
case DOWN:
{
this.setBlockBounds(0.125F, 0.33F, 0.125F, 0.875F, 1.0F, 0.875F);
break;
}
case UP:
{
this.setBlockBounds(0.125F, 0.0F, 0.125F, 0.875F, 0.66F, 0.875F);
break;
}
case NORTH:
{
this.setBlockBounds(0.125F, 0.125F, 0.33F, 0.875F, 0.875F, 1.0F);
break;
}
case SOUTH:
{
this.setBlockBounds(0.125F, 0.125F, 0.0F, 0.875F, 0.875F, 0.66F);
break;
}
case EAST:
{
this.setBlockBounds(0.0F, 0.125F, 0.125F, 0.66F, 0.875F, 0.875F);
break;
}
case WEST:
{
this.setBlockBounds(0.33F, 0.125F, 0.125F, 1.0F, 0.875F, 0.875F);
break;
}
case UNKNOWN:
{
break;
}
}
}
return super.collisionRayTrace(world, x, y, z, startVec, endVec);
}
} }

View file

@ -2,7 +2,7 @@ package com.pahimar.ee3.block;
import com.pahimar.ee3.reference.Names; import com.pahimar.ee3.reference.Names;
import com.pahimar.ee3.reference.RenderIds; import com.pahimar.ee3.reference.RenderIds;
import com.pahimar.ee3.tileentity.TileResearchStation; import com.pahimar.ee3.tileentity.TileEntityResearchStation;
import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
@ -20,7 +20,7 @@ public class BlockResearchStation extends BlockEE implements ITileEntityProvider
@Override @Override
public TileEntity createNewTileEntity(World world, int metaData) public TileEntity createNewTileEntity(World world, int metaData)
{ {
return new TileResearchStation(); return new TileEntityResearchStation();
} }
@Override @Override

View file

@ -3,7 +3,7 @@ package com.pahimar.ee3.client.gui.inventory;
import com.pahimar.ee3.inventory.ContainerAlchemicalChest; import com.pahimar.ee3.inventory.ContainerAlchemicalChest;
import com.pahimar.ee3.reference.Names; import com.pahimar.ee3.reference.Names;
import com.pahimar.ee3.reference.Textures; import com.pahimar.ee3.reference.Textures;
import com.pahimar.ee3.tileentity.TileAlchemicalChest; import com.pahimar.ee3.tileentity.TileEntityAlchemicalChest;
import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.StatCollector; import net.minecraft.util.StatCollector;
@ -11,24 +11,24 @@ import org.lwjgl.opengl.GL11;
public class GuiAlchemicalChest extends GuiContainer public class GuiAlchemicalChest extends GuiContainer
{ {
private TileAlchemicalChest tileAlchemicalChest; private TileEntityAlchemicalChest tileEntityAlchemicalChest;
public GuiAlchemicalChest(InventoryPlayer inventoryPlayer, TileAlchemicalChest alchemicalChest) public GuiAlchemicalChest(InventoryPlayer inventoryPlayer, TileEntityAlchemicalChest alchemicalChest)
{ {
super(new ContainerAlchemicalChest(inventoryPlayer, alchemicalChest)); super(new ContainerAlchemicalChest(inventoryPlayer, alchemicalChest));
tileAlchemicalChest = alchemicalChest; tileEntityAlchemicalChest = alchemicalChest;
if (this.tileAlchemicalChest.getState() == 0) if (this.tileEntityAlchemicalChest.getState() == 0)
{ {
xSize = 230; xSize = 230;
ySize = 186; ySize = 186;
} }
else if (this.tileAlchemicalChest.getState() == 1) else if (this.tileEntityAlchemicalChest.getState() == 1)
{ {
xSize = 230; xSize = 230;
ySize = 240; ySize = 240;
} }
else if (this.tileAlchemicalChest.getState() == 2) else if (this.tileEntityAlchemicalChest.getState() == 2)
{ {
xSize = 248; xSize = 248;
ySize = 256; ySize = 256;
@ -38,9 +38,9 @@ public class GuiAlchemicalChest extends GuiContainer
@Override @Override
protected void drawGuiContainerForegroundLayer(int x, int y) protected void drawGuiContainerForegroundLayer(int x, int y)
{ {
if (tileAlchemicalChest.getState() == 0 || tileAlchemicalChest.getState() == 1) if (tileEntityAlchemicalChest.getState() == 0 || tileEntityAlchemicalChest.getState() == 1)
{ {
fontRendererObj.drawString(tileAlchemicalChest.hasCustomInventoryName() ? tileAlchemicalChest.getInventoryName() : StatCollector.translateToLocal(tileAlchemicalChest.getInventoryName()), 8, 6, 4210752); fontRendererObj.drawString(StatCollector.translateToLocal(tileEntityAlchemicalChest.getInventoryName()), 8, 6, 4210752);
fontRendererObj.drawString(StatCollector.translateToLocal(Names.Containers.VANILLA_INVENTORY), 35, ySize - 95 + 2, 4210752); fontRendererObj.drawString(StatCollector.translateToLocal(Names.Containers.VANILLA_INVENTORY), 35, ySize - 95 + 2, 4210752);
} }
} }
@ -50,15 +50,15 @@ public class GuiAlchemicalChest extends GuiContainer
{ {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
if (tileAlchemicalChest.getState() == 0) if (tileEntityAlchemicalChest.getState() == 0)
{ {
this.mc.getTextureManager().bindTexture(Textures.GUI_ALCHEMICAL_CHEST_SMALL); this.mc.getTextureManager().bindTexture(Textures.GUI_ALCHEMICAL_CHEST_SMALL);
} }
else if (tileAlchemicalChest.getState() == 1) else if (tileEntityAlchemicalChest.getState() == 1)
{ {
this.mc.getTextureManager().bindTexture(Textures.GUI_ALCHEMICAL_CHEST_MEDIUM); this.mc.getTextureManager().bindTexture(Textures.GUI_ALCHEMICAL_CHEST_MEDIUM);
} }
else if (tileAlchemicalChest.getState() == 2) else if (tileEntityAlchemicalChest.getState() == 2)
{ {
this.mc.getTextureManager().bindTexture(Textures.GUI_ALCHEMICAL_CHEST_LARGE); this.mc.getTextureManager().bindTexture(Textures.GUI_ALCHEMICAL_CHEST_LARGE);
} }

View file

@ -0,0 +1,45 @@
package com.pahimar.ee3.client.gui.inventory;
import com.pahimar.ee3.inventory.ContainerGlassBell;
import com.pahimar.ee3.reference.Names;
import com.pahimar.ee3.reference.Textures;
import com.pahimar.ee3.tileentity.TileEntityGlassBell;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
@SideOnly(Side.CLIENT)
public class GuiGlassBell extends GuiContainer
{
private TileEntityGlassBell tileEntityGlassBell;
public GuiGlassBell(InventoryPlayer inventoryPlayer, TileEntityGlassBell tileEntityGlassBell)
{
super(new ContainerGlassBell(inventoryPlayer, tileEntityGlassBell));
this.tileEntityGlassBell = tileEntityGlassBell;
xSize = 176;
ySize = 140;
}
@Override
protected void drawGuiContainerForegroundLayer(int x, int y)
{
String containerName = StatCollector.translateToLocal(tileEntityGlassBell.getInventoryName());
fontRendererObj.drawString(containerName, xSize / 2 - fontRendererObj.getStringWidth(containerName) / 2, 6, 4210752);
fontRendererObj.drawString(StatCollector.translateToLocal(Names.Containers.VANILLA_INVENTORY), 8, ySize - 93, 4210752);
}
@Override
protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3)
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(Textures.GUI_GLASS_BELL);
int xStart = (width - xSize) / 2;
int yStart = (height - ySize) / 2;
this.drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize);
}
}

View file

@ -1,7 +1,7 @@
package com.pahimar.ee3.client.renderer.tileentity; package com.pahimar.ee3.client.renderer.tileentity;
import com.pahimar.ee3.reference.Textures; import com.pahimar.ee3.reference.Textures;
import com.pahimar.ee3.tileentity.TileAlchemicalChest; import com.pahimar.ee3.tileentity.TileEntityAlchemicalChest;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.model.ModelChest; import net.minecraft.client.model.ModelChest;
@ -19,25 +19,25 @@ public class TileEntityAlchemicalChestRenderer extends TileEntitySpecialRenderer
@Override @Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick)
{ {
if (tileEntity instanceof TileAlchemicalChest) if (tileEntity instanceof TileEntityAlchemicalChest)
{ {
TileAlchemicalChest tileAlchemicalChest = (TileAlchemicalChest) tileEntity; TileEntityAlchemicalChest tileEntityAlchemicalChest = (TileEntityAlchemicalChest) tileEntity;
ForgeDirection direction = null; ForgeDirection direction = null;
if (tileAlchemicalChest.getWorldObj() != null) if (tileEntityAlchemicalChest.getWorldObj() != null)
{ {
direction = tileAlchemicalChest.getOrientation(); direction = tileEntityAlchemicalChest.getOrientation();
} }
if (tileAlchemicalChest.getState() == 0) if (tileEntityAlchemicalChest.getState() == 0)
{ {
this.bindTexture(Textures.MODEL_ALCHEMICAL_CHEST_SMALL); this.bindTexture(Textures.MODEL_ALCHEMICAL_CHEST_SMALL);
} }
else if (tileAlchemicalChest.getState() == 1) else if (tileEntityAlchemicalChest.getState() == 1)
{ {
this.bindTexture(Textures.MODEL_ALCHEMICAL_CHEST_MEDIUM); this.bindTexture(Textures.MODEL_ALCHEMICAL_CHEST_MEDIUM);
} }
else if (tileAlchemicalChest.getState() == 2) else if (tileEntityAlchemicalChest.getState() == 2)
{ {
this.bindTexture(Textures.MODEL_ALCHEMICAL_CHEST_LARGE); this.bindTexture(Textures.MODEL_ALCHEMICAL_CHEST_LARGE);
} }
@ -72,7 +72,7 @@ public class TileEntityAlchemicalChestRenderer extends TileEntitySpecialRenderer
GL11.glRotatef(angle, 0.0F, 1.0F, 0.0F); GL11.glRotatef(angle, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(-0.5F, -0.5F, -0.5F); GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
float adjustedLidAngle = tileAlchemicalChest.prevLidAngle + (tileAlchemicalChest.lidAngle - tileAlchemicalChest.prevLidAngle) * tick; float adjustedLidAngle = tileEntityAlchemicalChest.prevLidAngle + (tileEntityAlchemicalChest.lidAngle - tileEntityAlchemicalChest.prevLidAngle) * tick;
adjustedLidAngle = 1.0F - adjustedLidAngle; adjustedLidAngle = 1.0F - adjustedLidAngle;
adjustedLidAngle = 1.0F - adjustedLidAngle * adjustedLidAngle * adjustedLidAngle; adjustedLidAngle = 1.0F - adjustedLidAngle * adjustedLidAngle * adjustedLidAngle;
modelChest.chestLid.rotateAngleX = -(adjustedLidAngle * (float) Math.PI / 2.0F); modelChest.chestLid.rotateAngleX = -(adjustedLidAngle * (float) Math.PI / 2.0F);

View file

@ -2,8 +2,9 @@ package com.pahimar.ee3.client.renderer.tileentity;
import com.pahimar.ee3.client.renderer.model.ModelAludel; import com.pahimar.ee3.client.renderer.model.ModelAludel;
import com.pahimar.ee3.reference.Textures; import com.pahimar.ee3.reference.Textures;
import com.pahimar.ee3.tileentity.TileAludel; import com.pahimar.ee3.tileentity.TileEntityAludel;
import com.pahimar.ee3.tileentity.TileGlassBell; import com.pahimar.ee3.tileentity.TileEntityGlassBell;
import com.pahimar.ee3.util.LogHelper;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.entity.RenderItem;
@ -39,15 +40,15 @@ public class TileEntityAludelRenderer extends TileEntitySpecialRenderer
@Override @Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick)
{ {
if (tileEntity instanceof TileAludel) if (tileEntity instanceof TileEntityAludel)
{ {
TileAludel tileAludel = (TileAludel) tileEntity; TileEntityAludel tileEntityAludel = (TileEntityAludel) tileEntity;
GL11.glPushMatrix(); GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_LIGHTING);
// Scale, Translate, Rotate // Scale, Translate, Rotate
scaleTranslateRotate(x, y, z, tileAludel.getOrientation()); scaleTranslateRotate(x, y, z, tileEntityAludel.getOrientation());
// Bind texture // Bind texture
this.bindTexture(Textures.MODEL_ALUDEL); this.bindTexture(Textures.MODEL_ALUDEL);
@ -62,18 +63,18 @@ public class TileEntityAludelRenderer extends TileEntitySpecialRenderer
*/ */
GL11.glPushMatrix(); GL11.glPushMatrix();
TileEntity tileGlassBell = tileAludel.getWorldObj().getTileEntity(tileAludel.xCoord, tileAludel.yCoord + 1, tileAludel.zCoord); TileEntity tileGlassBell = tileEntityAludel.getWorldObj().getTileEntity(tileEntityAludel.xCoord, tileEntityAludel.yCoord + 1, tileEntityAludel.zCoord);
if (tileGlassBell instanceof TileGlassBell) if (tileGlassBell instanceof TileEntityGlassBell)
{ {
if (tileAludel.outputItemStack != null) if (tileEntityAludel.outputItemStack != null)
{ {
float scaleFactor = getGhostItemScaleFactor(tileAludel.outputItemStack); float scaleFactor = getGhostItemScaleFactor(tileEntityAludel.outputItemStack);
float rotationAngle = (float) (720.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL); float rotationAngle = (float) (720.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL);
EntityItem ghostEntityItem = new EntityItem(tileAludel.getWorldObj()); EntityItem ghostEntityItem = new EntityItem(tileEntityAludel.getWorldObj());
ghostEntityItem.hoverStart = 0.0F; ghostEntityItem.hoverStart = 0.0F;
ghostEntityItem.setEntityItemStack(tileAludel.outputItemStack); ghostEntityItem.setEntityItemStack(tileEntityAludel.outputItemStack);
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.25F, (float) z + 0.5F); GL11.glTranslatef((float) x + 0.5F, (float) y + 1.25F, (float) z + 0.5F);
GL11.glScalef(scaleFactor, scaleFactor, scaleFactor); GL11.glScalef(scaleFactor, scaleFactor, scaleFactor);
@ -91,6 +92,7 @@ public class TileEntityAludelRenderer extends TileEntitySpecialRenderer
private void scaleTranslateRotate(double x, double y, double z, ForgeDirection orientation) private void scaleTranslateRotate(double x, double y, double z, ForgeDirection orientation)
{ {
LogHelper.info(orientation);
if (orientation == ForgeDirection.NORTH) if (orientation == ForgeDirection.NORTH)
{ {
GL11.glTranslated(x + 1, y, z); GL11.glTranslated(x + 1, y, z);

View file

@ -4,7 +4,7 @@ import com.pahimar.ee3.client.renderer.model.ModelCalcinator;
import com.pahimar.ee3.client.util.ColorUtils; import com.pahimar.ee3.client.util.ColorUtils;
import com.pahimar.ee3.reference.Colors; import com.pahimar.ee3.reference.Colors;
import com.pahimar.ee3.reference.Textures; import com.pahimar.ee3.reference.Textures;
import com.pahimar.ee3.tileentity.TileCalcinator; import com.pahimar.ee3.tileentity.TileEntityCalcinator;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
@ -50,9 +50,9 @@ public class TileEntityCalcinatorRenderer extends TileEntitySpecialRenderer
@Override @Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick)
{ {
if (tileEntity instanceof TileCalcinator) if (tileEntity instanceof TileEntityCalcinator)
{ {
TileCalcinator tileCalcinator = (TileCalcinator) tileEntity; TileEntityCalcinator tileEntityCalcinator = (TileEntityCalcinator) tileEntity;
GL11.glPushMatrix(); GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_LIGHTING);
@ -64,7 +64,7 @@ public class TileEntityCalcinatorRenderer extends TileEntitySpecialRenderer
GL11.glRotatef(-90F, 1F, 0F, 0F); GL11.glRotatef(-90F, 1F, 0F, 0F);
// Bind texture // Bind texture
if (tileCalcinator.getState() == 1) if (tileEntityCalcinator.getState() == 1)
{ {
this.bindTexture(Textures.MODEL_CALCINATOR_ACTIVE); this.bindTexture(Textures.MODEL_CALCINATOR_ACTIVE);
} }
@ -76,7 +76,7 @@ public class TileEntityCalcinatorRenderer extends TileEntitySpecialRenderer
// Render // Render
modelCalcinator.renderPart("Calcinator"); modelCalcinator.renderPart("Calcinator");
int dustStackSize = tileCalcinator.leftStackSize + tileCalcinator.rightStackSize; int dustStackSize = tileEntityCalcinator.leftStackSize + tileEntityCalcinator.rightStackSize;
if (dustStackSize > 0) if (dustStackSize > 0)
{ {
@ -86,7 +86,7 @@ public class TileEntityCalcinatorRenderer extends TileEntitySpecialRenderer
GL11.glRotatef(90F, 1F, 0F, 0F); GL11.glRotatef(90F, 1F, 0F, 0F);
GL11.glRotatef(-45F, 0F, 1F, 0F); GL11.glRotatef(-45F, 0F, 1F, 0F);
float[] dustColour = getBlendedDustColour(tileCalcinator.leftStackSize, tileCalcinator.leftStackMeta, tileCalcinator.rightStackSize, tileCalcinator.rightStackMeta); float[] dustColour = getBlendedDustColour(tileEntityCalcinator.leftStackSize, tileEntityCalcinator.leftStackMeta, tileEntityCalcinator.rightStackSize, tileEntityCalcinator.rightStackMeta);
GL11.glColor4f(dustColour[0], dustColour[1], dustColour[2], 1F); GL11.glColor4f(dustColour[0], dustColour[1], dustColour[2], 1F);

View file

@ -2,7 +2,7 @@ package com.pahimar.ee3.client.renderer.tileentity;
import com.pahimar.ee3.client.renderer.model.ModelGlassBell; import com.pahimar.ee3.client.renderer.model.ModelGlassBell;
import com.pahimar.ee3.reference.Textures; import com.pahimar.ee3.reference.Textures;
import com.pahimar.ee3.tileentity.TileGlassBell; import com.pahimar.ee3.tileentity.TileEntityGlassBell;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.entity.RenderItem;
@ -39,9 +39,9 @@ public class TileEntityGlassBellRenderer extends TileEntitySpecialRenderer
@Override @Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick)
{ {
if (tileEntity instanceof TileGlassBell) if (tileEntity instanceof TileEntityGlassBell)
{ {
TileGlassBell tileGlassBell = (TileGlassBell) tileEntity; TileEntityGlassBell tileEntityGlassBell = (TileEntityGlassBell) tileEntity;
GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_CULL_FACE);
@ -52,7 +52,7 @@ public class TileEntityGlassBellRenderer extends TileEntitySpecialRenderer
GL11.glPushMatrix(); GL11.glPushMatrix();
// Scale, Translate, Rotate // Scale, Translate, Rotate
renderGlassBellByOrientation(x, y, z, tileGlassBell.getOrientation()); renderGlassBellByOrientation(x, y, z, tileEntityGlassBell.getOrientation());
// Bind texture // Bind texture
this.bindTexture(Textures.MODEL_GLASS_BELL); this.bindTexture(Textures.MODEL_GLASS_BELL);
@ -66,16 +66,17 @@ public class TileEntityGlassBellRenderer extends TileEntitySpecialRenderer
*/ */
GL11.glPushMatrix(); GL11.glPushMatrix();
if (tileGlassBell.outputItemStack != null) if (tileEntityGlassBell.outputItemStack != null)
{ {
float scaleFactor = getGhostItemScaleFactor(tileGlassBell.outputItemStack); // TODO Stop the ghost item rendering in the event that the client's game is paused
float scaleFactor = getGhostItemScaleFactor(tileEntityGlassBell.outputItemStack);
float rotationAngle = (float) (720.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL); float rotationAngle = (float) (720.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL);
EntityItem ghostEntityItem = new EntityItem(tileGlassBell.getWorldObj()); EntityItem ghostEntityItem = new EntityItem(tileEntityGlassBell.getWorldObj());
ghostEntityItem.hoverStart = 0.0F; ghostEntityItem.hoverStart = 0.0F;
ghostEntityItem.setEntityItemStack(tileGlassBell.outputItemStack); ghostEntityItem.setEntityItemStack(tileEntityGlassBell.outputItemStack);
translateGhostItemByOrientation(ghostEntityItem.getEntityItem(), x, y, z, tileGlassBell.getOrientation()); translateGhostItemByOrientation(ghostEntityItem.getEntityItem(), x, y, z, tileEntityGlassBell.getOrientation());
GL11.glScalef(scaleFactor, scaleFactor, scaleFactor); GL11.glScalef(scaleFactor, scaleFactor, scaleFactor);
GL11.glRotatef(rotationAngle, 0.0F, 1.0F, 0.0F); GL11.glRotatef(rotationAngle, 0.0F, 1.0F, 0.0F);

View file

@ -2,7 +2,7 @@ package com.pahimar.ee3.client.renderer.tileentity;
import com.pahimar.ee3.client.renderer.model.ModelResearchStation; import com.pahimar.ee3.client.renderer.model.ModelResearchStation;
import com.pahimar.ee3.reference.Textures; import com.pahimar.ee3.reference.Textures;
import com.pahimar.ee3.tileentity.TileResearchStation; import com.pahimar.ee3.tileentity.TileEntityResearchStation;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
@ -17,7 +17,7 @@ public class TileEntityResearchStationRenderer extends TileEntitySpecialRenderer
@Override @Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick)
{ {
if (tileEntity instanceof TileResearchStation) if (tileEntity instanceof TileEntityResearchStation)
{ {
GL11.glPushMatrix(); GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_LIGHTING);

View file

@ -1,9 +1,12 @@
package com.pahimar.ee3.handler; package com.pahimar.ee3.handler;
import com.pahimar.ee3.client.gui.inventory.GuiAlchemicalChest; import com.pahimar.ee3.client.gui.inventory.GuiAlchemicalChest;
import com.pahimar.ee3.client.gui.inventory.GuiGlassBell;
import com.pahimar.ee3.inventory.ContainerAlchemicalChest; import com.pahimar.ee3.inventory.ContainerAlchemicalChest;
import com.pahimar.ee3.inventory.ContainerGlassBell;
import com.pahimar.ee3.reference.GuiIds; import com.pahimar.ee3.reference.GuiIds;
import com.pahimar.ee3.tileentity.TileAlchemicalChest; import com.pahimar.ee3.tileentity.TileEntityAlchemicalChest;
import com.pahimar.ee3.tileentity.TileEntityGlassBell;
import cpw.mods.fml.common.network.IGuiHandler; import cpw.mods.fml.common.network.IGuiHandler;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -15,8 +18,13 @@ public class GuiHandler implements IGuiHandler
{ {
if (id == GuiIds.ALCHEMICAL_CHEST) if (id == GuiIds.ALCHEMICAL_CHEST)
{ {
TileAlchemicalChest tileAlchemicalChest = (TileAlchemicalChest) world.getTileEntity(x, y, z); TileEntityAlchemicalChest tileEntityAlchemicalChest = (TileEntityAlchemicalChest) world.getTileEntity(x, y, z);
return new ContainerAlchemicalChest(player.inventory, tileAlchemicalChest); return new ContainerAlchemicalChest(player.inventory, tileEntityAlchemicalChest);
}
else if (id == GuiIds.GLASS_BELL)
{
TileEntityGlassBell tileEntityGlassBell = (TileEntityGlassBell) world.getTileEntity(x, y, z);
return new ContainerGlassBell(player.inventory, tileEntityGlassBell);
} }
return null; return null;
@ -27,8 +35,13 @@ public class GuiHandler implements IGuiHandler
{ {
if (id == GuiIds.ALCHEMICAL_CHEST) if (id == GuiIds.ALCHEMICAL_CHEST)
{ {
TileAlchemicalChest tileAlchemicalChest = (TileAlchemicalChest) world.getTileEntity(x, y, z); TileEntityAlchemicalChest tileEntityAlchemicalChest = (TileEntityAlchemicalChest) world.getTileEntity(x, y, z);
return new GuiAlchemicalChest(player.inventory, tileAlchemicalChest); return new GuiAlchemicalChest(player.inventory, tileEntityAlchemicalChest);
}
else if (id == GuiIds.GLASS_BELL)
{
TileEntityGlassBell tileEntityGlassBell = (TileEntityGlassBell) world.getTileEntity(x, y, z);
return new GuiGlassBell(player.inventory, tileEntityGlassBell);
} }
return null; return null;

View file

@ -1,6 +1,6 @@
package com.pahimar.ee3.inventory; package com.pahimar.ee3.inventory;
import com.pahimar.ee3.tileentity.TileAlchemicalChest; import com.pahimar.ee3.tileentity.TileEntityAlchemicalChest;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container; import net.minecraft.inventory.Container;
@ -24,26 +24,26 @@ public class ContainerAlchemicalChest extends Container
// Player Inventory // Player Inventory
private final int PLAYER_INVENTORY_ROWS = 3; private final int PLAYER_INVENTORY_ROWS = 3;
private final int PLAYER_INVENTORY_COLUMNS = 9; private final int PLAYER_INVENTORY_COLUMNS = 9;
private TileAlchemicalChest tileAlchemicalChest; private TileEntityAlchemicalChest tileEntityAlchemicalChest;
private int chestInventoryRows; private int chestInventoryRows;
private int chestInventoryColumns; private int chestInventoryColumns;
public ContainerAlchemicalChest(InventoryPlayer inventoryPlayer, TileAlchemicalChest tileAlchemicalChest) public ContainerAlchemicalChest(InventoryPlayer inventoryPlayer, TileEntityAlchemicalChest tileEntityAlchemicalChest)
{ {
this.tileAlchemicalChest = tileAlchemicalChest; this.tileEntityAlchemicalChest = tileEntityAlchemicalChest;
tileAlchemicalChest.openInventory(); tileEntityAlchemicalChest.openInventory();
if (this.tileAlchemicalChest.getState() == 0) if (this.tileEntityAlchemicalChest.getState() == 0)
{ {
chestInventoryRows = SMALL_CHEST_INVENTORY_ROWS; chestInventoryRows = SMALL_CHEST_INVENTORY_ROWS;
chestInventoryColumns = SMALL_CHEST_INVENTORY_COLUMNS; chestInventoryColumns = SMALL_CHEST_INVENTORY_COLUMNS;
} }
else if (this.tileAlchemicalChest.getState() == 1) else if (this.tileEntityAlchemicalChest.getState() == 1)
{ {
chestInventoryRows = MEDIUM_CHEST_INVENTORY_ROWS; chestInventoryRows = MEDIUM_CHEST_INVENTORY_ROWS;
chestInventoryColumns = MEDIUM_CHEST_INVENTORY_COLUMNS; chestInventoryColumns = MEDIUM_CHEST_INVENTORY_COLUMNS;
} }
else if (this.tileAlchemicalChest.getState() == 2) else if (this.tileEntityAlchemicalChest.getState() == 2)
{ {
chestInventoryRows = LARGE_CHEST_INVENTORY_ROWS; chestInventoryRows = LARGE_CHEST_INVENTORY_ROWS;
chestInventoryColumns = LARGE_CHEST_INVENTORY_COLUMNS; chestInventoryColumns = LARGE_CHEST_INVENTORY_COLUMNS;
@ -54,17 +54,17 @@ public class ContainerAlchemicalChest extends Container
{ {
for (int chestColumnIndex = 0; chestColumnIndex < chestInventoryColumns; ++chestColumnIndex) for (int chestColumnIndex = 0; chestColumnIndex < chestInventoryColumns; ++chestColumnIndex)
{ {
if (this.tileAlchemicalChest.getState() == 0) if (this.tileEntityAlchemicalChest.getState() == 0)
{ {
this.addSlotToContainer(new Slot(tileAlchemicalChest, chestColumnIndex + chestRowIndex * chestInventoryColumns, 8 + chestColumnIndex * 18, 18 + chestRowIndex * 18)); this.addSlotToContainer(new Slot(tileEntityAlchemicalChest, chestColumnIndex + chestRowIndex * chestInventoryColumns, 8 + chestColumnIndex * 18, 18 + chestRowIndex * 18));
} }
else if (this.tileAlchemicalChest.getState() == 1) else if (this.tileEntityAlchemicalChest.getState() == 1)
{ {
this.addSlotToContainer(new Slot(tileAlchemicalChest, chestColumnIndex + chestRowIndex * chestInventoryColumns, 8 + chestColumnIndex * 18, 18 + chestRowIndex * 18)); this.addSlotToContainer(new Slot(tileEntityAlchemicalChest, chestColumnIndex + chestRowIndex * chestInventoryColumns, 8 + chestColumnIndex * 18, 18 + chestRowIndex * 18));
} }
else if (this.tileAlchemicalChest.getState() == 2) else if (this.tileEntityAlchemicalChest.getState() == 2)
{ {
this.addSlotToContainer(new Slot(tileAlchemicalChest, chestColumnIndex + chestRowIndex * chestInventoryColumns, 8 + chestColumnIndex * 18, 8 + chestRowIndex * 18)); this.addSlotToContainer(new Slot(tileEntityAlchemicalChest, chestColumnIndex + chestRowIndex * chestInventoryColumns, 8 + chestColumnIndex * 18, 8 + chestRowIndex * 18));
} }
} }
} }
@ -74,15 +74,15 @@ public class ContainerAlchemicalChest extends Container
{ {
for (int inventoryColumnIndex = 0; inventoryColumnIndex < PLAYER_INVENTORY_COLUMNS; ++inventoryColumnIndex) for (int inventoryColumnIndex = 0; inventoryColumnIndex < PLAYER_INVENTORY_COLUMNS; ++inventoryColumnIndex)
{ {
if (this.tileAlchemicalChest.getState() == 0) if (this.tileEntityAlchemicalChest.getState() == 0)
{ {
this.addSlotToContainer(new Slot(inventoryPlayer, inventoryColumnIndex + inventoryRowIndex * 9 + 9, 35 + inventoryColumnIndex * 18, 104 + inventoryRowIndex * 18)); this.addSlotToContainer(new Slot(inventoryPlayer, inventoryColumnIndex + inventoryRowIndex * 9 + 9, 35 + inventoryColumnIndex * 18, 104 + inventoryRowIndex * 18));
} }
else if (this.tileAlchemicalChest.getState() == 1) else if (this.tileEntityAlchemicalChest.getState() == 1)
{ {
this.addSlotToContainer(new Slot(inventoryPlayer, inventoryColumnIndex + inventoryRowIndex * 9 + 9, 35 + inventoryColumnIndex * 18, 158 + inventoryRowIndex * 18)); this.addSlotToContainer(new Slot(inventoryPlayer, inventoryColumnIndex + inventoryRowIndex * 9 + 9, 35 + inventoryColumnIndex * 18, 158 + inventoryRowIndex * 18));
} }
else if (this.tileAlchemicalChest.getState() == 2) else if (this.tileEntityAlchemicalChest.getState() == 2)
{ {
this.addSlotToContainer(new Slot(inventoryPlayer, inventoryColumnIndex + inventoryRowIndex * 9 + 9, 44 + inventoryColumnIndex * 18, 174 + inventoryRowIndex * 18)); this.addSlotToContainer(new Slot(inventoryPlayer, inventoryColumnIndex + inventoryRowIndex * 9 + 9, 44 + inventoryColumnIndex * 18, 174 + inventoryRowIndex * 18));
} }
@ -92,15 +92,15 @@ public class ContainerAlchemicalChest extends Container
// Add the player's action bar slots to the container // Add the player's action bar slots to the container
for (int actionBarSlotIndex = 0; actionBarSlotIndex < PLAYER_INVENTORY_COLUMNS; ++actionBarSlotIndex) for (int actionBarSlotIndex = 0; actionBarSlotIndex < PLAYER_INVENTORY_COLUMNS; ++actionBarSlotIndex)
{ {
if (this.tileAlchemicalChest.getState() == 0) if (this.tileEntityAlchemicalChest.getState() == 0)
{ {
this.addSlotToContainer(new Slot(inventoryPlayer, actionBarSlotIndex, 35 + actionBarSlotIndex * 18, 162)); this.addSlotToContainer(new Slot(inventoryPlayer, actionBarSlotIndex, 35 + actionBarSlotIndex * 18, 162));
} }
else if (this.tileAlchemicalChest.getState() == 1) else if (this.tileEntityAlchemicalChest.getState() == 1)
{ {
this.addSlotToContainer(new Slot(inventoryPlayer, actionBarSlotIndex, 35 + actionBarSlotIndex * 18, 216)); this.addSlotToContainer(new Slot(inventoryPlayer, actionBarSlotIndex, 35 + actionBarSlotIndex * 18, 216));
} }
else if (this.tileAlchemicalChest.getState() == 2) else if (this.tileEntityAlchemicalChest.getState() == 2)
{ {
this.addSlotToContainer(new Slot(inventoryPlayer, actionBarSlotIndex, 44 + actionBarSlotIndex * 18, 232)); this.addSlotToContainer(new Slot(inventoryPlayer, actionBarSlotIndex, 44 + actionBarSlotIndex * 18, 232));
} }
@ -120,7 +120,7 @@ public class ContainerAlchemicalChest extends Container
public void onContainerClosed(EntityPlayer entityPlayer) public void onContainerClosed(EntityPlayer entityPlayer)
{ {
super.onContainerClosed(entityPlayer); super.onContainerClosed(entityPlayer);
tileAlchemicalChest.closeInventory(); tileEntityAlchemicalChest.closeInventory();
} }
@Override @Override

View file

@ -0,0 +1,80 @@
package com.pahimar.ee3.inventory;
import com.pahimar.ee3.tileentity.TileEntityGlassBell;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerGlassBell extends Container
{
private final int PLAYER_INVENTORY_ROWS = 3;
private final int PLAYER_INVENTORY_COLUMNS = 9;
public ContainerGlassBell(InventoryPlayer inventoryPlayer, TileEntityGlassBell tileGlassBell)
{
this.addSlotToContainer(new Slot(tileGlassBell, TileEntityGlassBell.DISPLAY_SLOT_INVENTORY_INDEX, 80, 22));
// Add the player's inventory slots to the container
for (int inventoryRowIndex = 0; inventoryRowIndex < PLAYER_INVENTORY_ROWS; ++inventoryRowIndex)
{
for (int inventoryColumnIndex = 0; inventoryColumnIndex < PLAYER_INVENTORY_COLUMNS; ++inventoryColumnIndex)
{
this.addSlotToContainer(new Slot(inventoryPlayer, inventoryColumnIndex + inventoryRowIndex * 9 + 9, 8 + inventoryColumnIndex * 18, 58 + inventoryRowIndex * 18));
}
}
// Add the player's action bar slots to the container
for (int actionBarSlotIndex = 0; actionBarSlotIndex < PLAYER_INVENTORY_COLUMNS; ++actionBarSlotIndex)
{
this.addSlotToContainer(new Slot(inventoryPlayer, actionBarSlotIndex, 8 + actionBarSlotIndex * 18, 116));
}
}
@Override
public boolean canInteractWith(EntityPlayer entityPlayer)
{
return true;
}
@Override
public ItemStack transferStackInSlot(EntityPlayer entityPlayer, int slotIndex)
{
ItemStack itemStack = null;
Slot slot = (Slot) inventorySlots.get(slotIndex);
if (slot != null && slot.getHasStack())
{
ItemStack slotItemStack = slot.getStack();
itemStack = slotItemStack.copy();
if (slotIndex < TileEntityGlassBell.INVENTORY_SIZE)
{
if (!this.mergeItemStack(slotItemStack, 1, inventorySlots.size(), true))
{
return null;
}
}
else
{
if (!this.mergeItemStack(slotItemStack, 0, TileEntityGlassBell.INVENTORY_SIZE, false))
{
return null;
}
}
if (slotItemStack.stackSize == 0)
{
slot.putStack(null);
}
else
{
slot.onSlotChanged();
}
}
return itemStack;
}
}

View file

@ -1,16 +1,13 @@
package com.pahimar.ee3.network; package com.pahimar.ee3.network;
import com.pahimar.ee3.network.message.MessageTileEntity; import com.pahimar.ee3.network.message.MessageTileCalcinator;
import com.pahimar.ee3.network.message.MessageTileEntityAludel;
import com.pahimar.ee3.network.message.MessageTileEntityEE;
import com.pahimar.ee3.network.message.MessageTileEntityGlassBell;
import com.pahimar.ee3.reference.Reference; import com.pahimar.ee3.reference.Reference;
import com.pahimar.ee3.tileentity.TileEntityEE;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import net.minecraft.tileentity.TileEntity;
public class PacketHandler public class PacketHandler
{ {
@ -18,23 +15,9 @@ public class PacketHandler
public static void init() public static void init()
{ {
INSTANCE.registerMessage(TileEntityUpdateHandler.class, MessageTileEntity.class, 0, Side.CLIENT); INSTANCE.registerMessage(MessageTileEntityEE.class, MessageTileEntityEE.class, 0, Side.CLIENT);
} INSTANCE.registerMessage(MessageTileCalcinator.class, MessageTileCalcinator.class, 1, Side.CLIENT);
INSTANCE.registerMessage(MessageTileEntityAludel.class, MessageTileEntityAludel.class, 2, Side.CLIENT);
public class TileEntityUpdateHandler implements IMessageHandler<MessageTileEntity, IMessage> INSTANCE.registerMessage(MessageTileEntityGlassBell.class, MessageTileEntityGlassBell.class, 3, Side.CLIENT);
{
@Override
public IMessage onMessage(MessageTileEntity message, MessageContext ctx)
{
TileEntity tileEntity = FMLClientHandler.instance().getClient().theWorld.getTileEntity(message.x, message.y, message.z);
if (tileEntity instanceof TileEntityEE)
{
((TileEntityEE) tileEntity).setOrientation(message.orientation);
((TileEntityEE) tileEntity).setState(message.state);
}
return null;
}
} }
} }

View file

@ -1,5 +1,99 @@
package com.pahimar.ee3.network.message; package com.pahimar.ee3.network.message;
public class MessageTileCalcinator import com.pahimar.ee3.tileentity.TileEntityCalcinator;
import com.pahimar.ee3.tileentity.TileEntityEE;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import io.netty.buffer.ByteBuf;
import net.minecraft.tileentity.TileEntity;
public class MessageTileCalcinator implements IMessage, IMessageHandler<MessageTileCalcinator, IMessage>
{ {
public int x, y, z;
public byte orientation, state;
public String customName, owner;
public byte leftStackSize, leftStackMeta, rightStackSize, rightStackMeta;
public MessageTileCalcinator()
{
}
public MessageTileCalcinator(TileEntityCalcinator tileEntityCalcinator)
{
this.x = tileEntityCalcinator.xCoord;
this.y = tileEntityCalcinator.yCoord;
this.z = tileEntityCalcinator.zCoord;
this.orientation = (byte) tileEntityCalcinator.getOrientation().ordinal();
this.state = (byte) tileEntityCalcinator.getState();
this.customName = tileEntityCalcinator.getCustomName();
this.owner = tileEntityCalcinator.getOwner();
this.leftStackSize = tileEntityCalcinator.leftStackSize;
this.leftStackMeta = tileEntityCalcinator.leftStackMeta;
this.rightStackSize = tileEntityCalcinator.rightStackSize;
this.rightStackMeta = tileEntityCalcinator.rightStackMeta;
}
@Override
public void fromBytes(ByteBuf buf)
{
this.x = buf.readInt();
this.y = buf.readInt();
this.z = buf.readInt();
this.orientation = buf.readByte();
this.state = buf.readByte();
int customNameLength = buf.readInt();
this.customName = new String(buf.readBytes(customNameLength).array());
int ownerLength = buf.readInt();
this.owner = new String(buf.readBytes(ownerLength).array());
this.leftStackSize = buf.readByte();
this.leftStackMeta = buf.readByte();
this.rightStackSize = buf.readByte();
this.rightStackMeta = buf.readByte();
}
@Override
public void toBytes(ByteBuf buf)
{
buf.writeInt(x);
buf.writeInt(y);
buf.writeInt(z);
buf.writeByte(orientation);
buf.writeByte(state);
buf.writeInt(customName.length());
buf.writeBytes(customName.getBytes());
buf.writeInt(owner.length());
buf.writeBytes(owner.getBytes());
buf.writeByte(leftStackSize);
buf.writeByte(leftStackMeta);
buf.writeByte(rightStackSize);
buf.writeByte(rightStackMeta);
}
@Override
public IMessage onMessage(MessageTileCalcinator message, MessageContext ctx)
{
TileEntity tileEntity = FMLClientHandler.instance().getClient().theWorld.getTileEntity(message.x, message.y, message.z);
if (tileEntity instanceof TileEntityCalcinator)
{
((TileEntityEE) tileEntity).setOrientation(message.orientation);
((TileEntityEE) tileEntity).setState(message.state);
((TileEntityEE) tileEntity).setCustomName(message.customName);
((TileEntityEE) tileEntity).setOwner(message.owner);
((TileEntityCalcinator) tileEntity).leftStackSize = message.leftStackSize;
((TileEntityCalcinator) tileEntity).leftStackMeta = message.leftStackMeta;
((TileEntityCalcinator) tileEntity).rightStackSize = message.rightStackSize;
((TileEntityCalcinator) tileEntity).rightStackMeta = message.rightStackMeta;
}
return null;
}
@Override
public String toString()
{
return String.format("MessageTileEntityCalcinator - x:%s, y:%s, z:%s, orientation:%s, state:%s, customName:%s, owner:%s, leftStackSize: %s, leftStackMeta: %s, rightStackSize: %s, rightStackMeta: %s", x, y, z, orientation, state, customName, owner, leftStackSize, leftStackMeta, rightStackSize, rightStackMeta);
}
} }

View file

@ -1,45 +0,0 @@
package com.pahimar.ee3.network.message;
import com.pahimar.ee3.tileentity.TileEntityEE;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import io.netty.buffer.ByteBuf;
public class MessageTileEntity implements IMessage
{
public int x, y, z;
public byte orientation, state;
public String customName, owner;
public MessageTileEntity()
{
}
public MessageTileEntity(TileEntityEE tileEntityEE)
{
this.x = tileEntityEE.xCoord;
this.y = tileEntityEE.yCoord;
this.z = tileEntityEE.zCoord;
this.orientation = (byte) tileEntityEE.getOrientation().ordinal();
this.state = (byte) tileEntityEE.getState();
}
@Override
public void fromBytes(ByteBuf buf)
{
this.x = buf.readInt();
this.y = buf.readInt();
this.z = buf.readInt();
this.orientation = buf.readByte();
this.state = buf.readByte();
}
@Override
public void toBytes(ByteBuf buf)
{
buf.writeInt(x);
buf.writeInt(y);
buf.writeInt(z);
buf.writeByte(orientation);
buf.writeByte(state);
}
}

View file

@ -0,0 +1,126 @@
package com.pahimar.ee3.network.message;
import com.pahimar.ee3.reference.Colors;
import com.pahimar.ee3.tileentity.TileEntityAludel;
import com.pahimar.ee3.util.ColorHelper;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import io.netty.buffer.ByteBuf;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
public class MessageTileEntityAludel implements IMessage, IMessageHandler<MessageTileEntityAludel, IMessage>
{
public int x, y, z;
public byte orientation;
public byte state;
public String customName, owner;
public int itemId, metaData, stackSize, itemColor;
public MessageTileEntityAludel()
{
}
public MessageTileEntityAludel(TileEntityAludel tileEntityAludel, ItemStack outputItemStack)
{
this.x = tileEntityAludel.xCoord;
this.y = tileEntityAludel.yCoord;
this.z = tileEntityAludel.zCoord;
this.orientation = (byte) tileEntityAludel.getOrientation().ordinal();
this.state = (byte) tileEntityAludel.getState();
this.customName = tileEntityAludel.getCustomName();
this.owner = tileEntityAludel.getOwner();
if (outputItemStack != null)
{
this.itemId = Item.getIdFromItem(outputItemStack.getItem());
this.metaData = outputItemStack.getItemDamage();
this.stackSize = outputItemStack.stackSize;
this.itemColor = ColorHelper.getColor(outputItemStack);
}
else
{
this.itemId = -1;
this.metaData = 0;
this.stackSize = 0;
this.itemColor = 0;
}
}
@Override
public void fromBytes(ByteBuf buf)
{
this.x = buf.readInt();
this.y = buf.readInt();
this.z = buf.readInt();
this.orientation = buf.readByte();
this.state = buf.readByte();
int customNameLength = buf.readInt();
this.customName = new String(buf.readBytes(customNameLength).array());
int ownerLength = buf.readInt();
this.owner = new String(buf.readBytes(ownerLength).array());
this.itemId = buf.readInt();
this.metaData = buf.readInt();
this.stackSize = buf.readInt();
this.itemColor = buf.readInt();
}
@Override
public void toBytes(ByteBuf buf)
{
buf.writeInt(x);
buf.writeInt(y);
buf.writeInt(z);
buf.writeByte(orientation);
buf.writeByte(state);
buf.writeInt(customName.length());
buf.writeBytes(customName.getBytes());
buf.writeInt(owner.length());
buf.writeBytes(owner.getBytes());
buf.writeInt(itemId);
buf.writeInt(metaData);
buf.writeInt(stackSize);
buf.writeInt(itemColor);
}
@Override
public IMessage onMessage(MessageTileEntityAludel message, MessageContext ctx)
{
TileEntity tileEntity = FMLClientHandler.instance().getClient().theWorld.getTileEntity(message.x, message.y, message.z);
if (tileEntity instanceof TileEntityAludel)
{
((TileEntityAludel) tileEntity).setOrientation(message.orientation);
((TileEntityAludel) tileEntity).setState(message.state);
((TileEntityAludel) tileEntity).setCustomName(message.customName);
((TileEntityAludel) tileEntity).setOwner(message.owner);
ItemStack outputItemStack = null;
if (message.itemId != -1)
{
outputItemStack = new ItemStack(Item.getItemById(message.itemId), message.stackSize, message.metaData);
if (message.itemColor != Integer.parseInt(Colors.PURE_WHITE, 16))
{
ColorHelper.setColor(outputItemStack, itemColor);
}
}
((TileEntityAludel) tileEntity).outputItemStack = outputItemStack;
//NAME UPDATE
FMLClientHandler.instance().getClient().theWorld.func_147451_t(message.x, message.y, message.z);
}
return null;
}
@Override
public String toString()
{
return String.format("MessageTileEntityAludel - x:%s, y:%s, z:%s, orientation:%s, state:%s, customName:%s, owner:%s, itemId: %s, metaData: %s, stackSize: %s, itemColor: %s", x, y, z, orientation, state, customName, owner, itemId, metaData, stackSize, itemColor);
}
}

View file

@ -0,0 +1,81 @@
package com.pahimar.ee3.network.message;
import com.pahimar.ee3.tileentity.TileEntityEE;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import io.netty.buffer.ByteBuf;
import net.minecraft.tileentity.TileEntity;
public class MessageTileEntityEE implements IMessage, IMessageHandler<MessageTileEntityEE, IMessage>
{
public int x, y, z;
public byte orientation, state;
public String customName, owner;
public MessageTileEntityEE()
{
}
public MessageTileEntityEE(TileEntityEE tileEntityEE)
{
this.x = tileEntityEE.xCoord;
this.y = tileEntityEE.yCoord;
this.z = tileEntityEE.zCoord;
this.orientation = (byte) tileEntityEE.getOrientation().ordinal();
this.state = (byte) tileEntityEE.getState();
this.customName = tileEntityEE.getCustomName();
this.owner = tileEntityEE.getOwner();
}
@Override
public void fromBytes(ByteBuf buf)
{
this.x = buf.readInt();
this.y = buf.readInt();
this.z = buf.readInt();
this.orientation = buf.readByte();
this.state = buf.readByte();
int customNameLength = buf.readInt();
this.customName = new String(buf.readBytes(customNameLength).array());
int ownerLength = buf.readInt();
this.owner = new String(buf.readBytes(ownerLength).array());
}
@Override
public void toBytes(ByteBuf buf)
{
buf.writeInt(x);
buf.writeInt(y);
buf.writeInt(z);
buf.writeByte(orientation);
buf.writeByte(state);
buf.writeInt(customName.length());
buf.writeBytes(customName.getBytes());
buf.writeInt(owner.length());
buf.writeBytes(owner.getBytes());
}
@Override
public IMessage onMessage(MessageTileEntityEE message, MessageContext ctx)
{
TileEntity tileEntity = FMLClientHandler.instance().getClient().theWorld.getTileEntity(message.x, message.y, message.z);
if (tileEntity instanceof TileEntityEE)
{
((TileEntityEE) tileEntity).setOrientation(message.orientation);
((TileEntityEE) tileEntity).setState(message.state);
((TileEntityEE) tileEntity).setCustomName(message.customName);
((TileEntityEE) tileEntity).setOwner(message.owner);
}
return null;
}
@Override
public String toString()
{
return String.format("MessageTileEntityEE - x:%s, y:%s, z:%s, orientation:%s, state:%s, customName:%s, owner:%s", x, y, z, orientation, state, customName, owner);
}
}

View file

@ -0,0 +1,126 @@
package com.pahimar.ee3.network.message;
import com.pahimar.ee3.reference.Colors;
import com.pahimar.ee3.tileentity.TileEntityGlassBell;
import com.pahimar.ee3.util.ColorHelper;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import io.netty.buffer.ByteBuf;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
public class MessageTileEntityGlassBell implements IMessage, IMessageHandler<MessageTileEntityGlassBell, IMessage>
{
public int x, y, z;
public byte orientation;
public byte state;
public String customName, owner;
public int itemId, metaData, stackSize, itemColor;
public MessageTileEntityGlassBell()
{
}
public MessageTileEntityGlassBell(TileEntityGlassBell tileEntityGlassBell, ItemStack outputItemStack)
{
this.x = tileEntityGlassBell.xCoord;
this.y = tileEntityGlassBell.yCoord;
this.z = tileEntityGlassBell.zCoord;
this.orientation = (byte) tileEntityGlassBell.getOrientation().ordinal();
this.state = (byte) tileEntityGlassBell.getState();
this.customName = tileEntityGlassBell.getCustomName();
this.owner = tileEntityGlassBell.getOwner();
if (outputItemStack != null)
{
this.itemId = Item.getIdFromItem(outputItemStack.getItem());
this.metaData = outputItemStack.getItemDamage();
this.stackSize = outputItemStack.stackSize;
this.itemColor = ColorHelper.getColor(outputItemStack);
}
else
{
this.itemId = -1;
this.metaData = 0;
this.stackSize = 0;
this.itemColor = 0;
}
}
@Override
public void fromBytes(ByteBuf buf)
{
this.x = buf.readInt();
this.y = buf.readInt();
this.z = buf.readInt();
this.orientation = buf.readByte();
this.state = buf.readByte();
int customNameLength = buf.readInt();
this.customName = new String(buf.readBytes(customNameLength).array());
int ownerLength = buf.readInt();
this.owner = new String(buf.readBytes(ownerLength).array());
this.itemId = buf.readInt();
this.metaData = buf.readInt();
this.stackSize = buf.readInt();
this.itemColor = buf.readInt();
}
@Override
public void toBytes(ByteBuf buf)
{
buf.writeInt(x);
buf.writeInt(y);
buf.writeInt(z);
buf.writeByte(orientation);
buf.writeByte(state);
buf.writeInt(customName.length());
buf.writeBytes(customName.getBytes());
buf.writeInt(owner.length());
buf.writeBytes(owner.getBytes());
buf.writeInt(itemId);
buf.writeInt(metaData);
buf.writeInt(stackSize);
buf.writeInt(itemColor);
}
@Override
public IMessage onMessage(MessageTileEntityGlassBell message, MessageContext ctx)
{
TileEntity tileEntity = FMLClientHandler.instance().getClient().theWorld.getTileEntity(message.x, message.y, message.z);
if (tileEntity instanceof TileEntityGlassBell)
{
((TileEntityGlassBell) tileEntity).setOrientation(message.orientation);
((TileEntityGlassBell) tileEntity).setState(message.state);
((TileEntityGlassBell) tileEntity).setCustomName(message.customName);
((TileEntityGlassBell) tileEntity).setOwner(message.owner);
ItemStack outputItemStack = null;
if (message.itemId != -1)
{
outputItemStack = new ItemStack(Item.getItemById(message.itemId), message.stackSize, message.metaData);
if (message.itemColor != Integer.parseInt(Colors.PURE_WHITE, 16))
{
ColorHelper.setColor(outputItemStack, itemColor);
}
}
((TileEntityGlassBell) tileEntity).outputItemStack = outputItemStack;
//NAME UPDATE
FMLClientHandler.instance().getClient().theWorld.func_147451_t(message.x, message.y, message.z);
}
return null;
}
@Override
public String toString()
{
return String.format("MessageTileEntityGlassBell - x:%s, y:%s, z:%s, orientation:%s, state:%s, customName:%s, owner:%s, itemId: %s, metaData: %s, stackSize: %s, itemColor: %s", x, y, z, orientation, state, customName, owner, itemId, metaData, stackSize, itemColor);
}
}

View file

@ -27,10 +27,10 @@ public class ClientProxy extends CommonProxy
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.glassBell), new ItemGlassBellRenderer()); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.glassBell), new ItemGlassBellRenderer());
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.researchStation), new ItemResearchStationRenderer()); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.researchStation), new ItemResearchStationRenderer());
ClientRegistry.bindTileEntitySpecialRenderer(TileAlchemicalChest.class, new TileEntityAlchemicalChestRenderer()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAlchemicalChest.class, new TileEntityAlchemicalChestRenderer());
ClientRegistry.bindTileEntitySpecialRenderer(TileCalcinator.class, new TileEntityCalcinatorRenderer()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCalcinator.class, new TileEntityCalcinatorRenderer());
ClientRegistry.bindTileEntitySpecialRenderer(TileAludel.class, new TileEntityAludelRenderer()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAludel.class, new TileEntityAludelRenderer());
ClientRegistry.bindTileEntitySpecialRenderer(TileGlassBell.class, new TileEntityGlassBellRenderer()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityGlassBell.class, new TileEntityGlassBellRenderer());
ClientRegistry.bindTileEntitySpecialRenderer(TileResearchStation.class, new TileEntityResearchStationRenderer()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityResearchStation.class, new TileEntityResearchStationRenderer());
} }
} }

View file

@ -1,19 +1,19 @@
package com.pahimar.ee3.proxy; package com.pahimar.ee3.proxy;
import com.pahimar.ee3.reference.Names; import com.pahimar.ee3.reference.Names;
import com.pahimar.ee3.tileentity.TileAlchemicalChest; import com.pahimar.ee3.tileentity.*;
import com.pahimar.ee3.tileentity.TileAlchemicalChestLarge;
import com.pahimar.ee3.tileentity.TileAlchemicalChestMedium;
import com.pahimar.ee3.tileentity.TileAlchemicalChestSmall;
import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry;
public abstract class CommonProxy implements IProxy public abstract class CommonProxy implements IProxy
{ {
public void registerTileEntities() public void registerTileEntities()
{ {
GameRegistry.registerTileEntity(TileAlchemicalChest.class, "tile." + Names.Blocks.ALCHEMICAL_CHEST); GameRegistry.registerTileEntity(TileEntityAlchemicalChest.class, "tile." + Names.Blocks.ALCHEMICAL_CHEST);
GameRegistry.registerTileEntity(TileAlchemicalChestSmall.class, "tile." + Names.Blocks.ALCHEMICAL_CHEST + "Small"); GameRegistry.registerTileEntity(TileEntityAlchemicalChestSmall.class, "tile." + Names.Blocks.ALCHEMICAL_CHEST + "Small");
GameRegistry.registerTileEntity(TileAlchemicalChestMedium.class, "tile." + Names.Blocks.ALCHEMICAL_CHEST + "Medium"); GameRegistry.registerTileEntity(TileEntityAlchemicalChestMedium.class, "tile." + Names.Blocks.ALCHEMICAL_CHEST + "Medium");
GameRegistry.registerTileEntity(TileAlchemicalChestLarge.class, "tile." + Names.Blocks.ALCHEMICAL_CHEST + "Large"); GameRegistry.registerTileEntity(TileEntityAlchemicalChestLarge.class, "tile." + Names.Blocks.ALCHEMICAL_CHEST + "Large");
GameRegistry.registerTileEntity(TileEntityAludel.class, "tile." + Names.Blocks.ALUDEL);
GameRegistry.registerTileEntity(TileEntityCalcinator.class, "tile." + Names.Blocks.CALCINATOR);
GameRegistry.registerTileEntity(TileEntityGlassBell.class, "tile." + Names.Blocks.GLASS_BELL);
} }
} }

View file

@ -1,9 +0,0 @@
package com.pahimar.ee3.tileentity;
public class TileAlchemicalChestLarge extends TileAlchemicalChest
{
public TileAlchemicalChestLarge()
{
super(2);
}
}

View file

@ -1,9 +0,0 @@
package com.pahimar.ee3.tileentity;
public class TileAlchemicalChestMedium extends TileAlchemicalChest
{
public TileAlchemicalChestMedium()
{
super(1);
}
}

View file

@ -1,9 +0,0 @@
package com.pahimar.ee3.tileentity;
public class TileAlchemicalChestSmall extends TileAlchemicalChest
{
public TileAlchemicalChestSmall()
{
super(0);
}
}

View file

@ -10,7 +10,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagList;
public class TileAlchemicalChest extends TileEntityEE implements IInventory public class TileEntityAlchemicalChest extends TileEntityEE implements IInventory
{ {
/** /**
* The current angle of the chest lid (between 0 and 1) * The current angle of the chest lid (between 0 and 1)
@ -37,7 +37,7 @@ public class TileAlchemicalChest extends TileEntityEE implements IInventory
*/ */
private ItemStack[] inventory; private ItemStack[] inventory;
public TileAlchemicalChest(int metaData) public TileEntityAlchemicalChest(int metaData)
{ {
super(); super();
this.state = (byte) metaData; this.state = (byte) metaData;
@ -116,6 +116,7 @@ public class TileAlchemicalChest extends TileEntityEE implements IInventory
itemStack.stackSize = this.getInventoryStackLimit(); itemStack.stackSize = this.getInventoryStackLimit();
} }
this.markDirty(); this.markDirty();
} }

View file

@ -0,0 +1,9 @@
package com.pahimar.ee3.tileentity;
public class TileEntityAlchemicalChestLarge extends TileEntityAlchemicalChest
{
public TileEntityAlchemicalChestLarge()
{
super(2);
}
}

View file

@ -0,0 +1,9 @@
package com.pahimar.ee3.tileentity;
public class TileEntityAlchemicalChestMedium extends TileEntityAlchemicalChest
{
public TileEntityAlchemicalChestMedium()
{
super(1);
}
}

View file

@ -0,0 +1,9 @@
package com.pahimar.ee3.tileentity;
public class TileEntityAlchemicalChestSmall extends TileEntityAlchemicalChest
{
public TileEntityAlchemicalChestSmall()
{
super(0);
}
}

View file

@ -1,10 +1,13 @@
package com.pahimar.ee3.tileentity; package com.pahimar.ee3.tileentity;
import com.pahimar.ee3.network.PacketHandler;
import com.pahimar.ee3.network.message.MessageTileEntityAludel;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ISidedInventory; import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.network.Packet;
public class TileAludel extends TileEntityEE implements ISidedInventory public class TileEntityAludel extends TileEntityEE implements ISidedInventory
{ {
public static final int INVENTORY_SIZE = 4; public static final int INVENTORY_SIZE = 4;
public static final int FUEL_INVENTORY_INDEX = 0; public static final int FUEL_INVENTORY_INDEX = 0;
@ -21,7 +24,7 @@ public class TileAludel extends TileEntityEE implements ISidedInventory
*/ */
private ItemStack[] inventory; private ItemStack[] inventory;
public TileAludel() public TileEntityAludel()
{ {
inventory = new ItemStack[INVENTORY_SIZE]; inventory = new ItemStack[INVENTORY_SIZE];
} }
@ -115,4 +118,10 @@ public class TileAludel extends TileEntityEE implements ISidedInventory
{ {
return false; return false;
} }
@Override
public Packet getDescriptionPacket()
{
return PacketHandler.INSTANCE.getPacketFrom(new MessageTileEntityAludel(this, null));
}
} }

View file

@ -1,12 +1,15 @@
package com.pahimar.ee3.tileentity; package com.pahimar.ee3.tileentity;
import com.pahimar.ee3.network.PacketHandler;
import com.pahimar.ee3.network.message.MessageTileCalcinator;
import com.pahimar.ee3.reference.Names; import com.pahimar.ee3.reference.Names;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ISidedInventory; import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.network.Packet;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
public class TileCalcinator extends TileEntityEE implements ISidedInventory public class TileEntityCalcinator extends TileEntityEE implements ISidedInventory
{ {
public static final int INVENTORY_SIZE = 4; public static final int INVENTORY_SIZE = 4;
public static final int FUEL_INVENTORY_INDEX = 0; public static final int FUEL_INVENTORY_INDEX = 0;
@ -26,7 +29,7 @@ public class TileCalcinator extends TileEntityEE implements ISidedInventory
*/ */
private ItemStack[] inventory; private ItemStack[] inventory;
public TileCalcinator() public TileEntityCalcinator()
{ {
inventory = new ItemStack[INVENTORY_SIZE]; inventory = new ItemStack[INVENTORY_SIZE];
} }
@ -184,4 +187,10 @@ public class TileCalcinator extends TileEntityEE implements ISidedInventory
return super.receiveClientEvent(eventId, eventData); return super.receiveClientEvent(eventId, eventData);
} }
} }
@Override
public Packet getDescriptionPacket()
{
return PacketHandler.INSTANCE.getPacketFrom(new MessageTileCalcinator(this));
}
} }

View file

@ -1,7 +1,7 @@
package com.pahimar.ee3.tileentity; package com.pahimar.ee3.tileentity;
import com.pahimar.ee3.network.PacketHandler; import com.pahimar.ee3.network.PacketHandler;
import com.pahimar.ee3.network.message.MessageTileEntity; import com.pahimar.ee3.network.message.MessageTileEntityEE;
import com.pahimar.ee3.reference.Names; import com.pahimar.ee3.reference.Names;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.Packet; import net.minecraft.network.Packet;
@ -28,16 +28,16 @@ public class TileEntityEE extends TileEntity
return orientation; return orientation;
} }
public void setOrientation(int orientation)
{
this.orientation = ForgeDirection.getOrientation(orientation);
}
public void setOrientation(ForgeDirection orientation) public void setOrientation(ForgeDirection orientation)
{ {
this.orientation = orientation; this.orientation = orientation;
} }
public void setOrientation(int orientation)
{
this.orientation = ForgeDirection.getOrientation(orientation);
}
public short getState() public short getState()
{ {
return state; return state;
@ -126,6 +126,6 @@ public class TileEntityEE extends TileEntity
@Override @Override
public Packet getDescriptionPacket() public Packet getDescriptionPacket()
{ {
return PacketHandler.INSTANCE.getPacketFrom(new MessageTileEntity(this)); return PacketHandler.INSTANCE.getPacketFrom(new MessageTileEntityEE(this));
} }
} }

View file

@ -0,0 +1,195 @@
package com.pahimar.ee3.tileentity;
import com.pahimar.ee3.network.PacketHandler;
import com.pahimar.ee3.network.message.MessageTileEntityGlassBell;
import com.pahimar.ee3.reference.Names;
import cpw.mods.fml.common.network.NetworkRegistry;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.Packet;
public class TileEntityGlassBell extends TileEntityEE implements IInventory
{
public static final int INVENTORY_SIZE = 1;
public static final int DISPLAY_SLOT_INVENTORY_INDEX = 0;
public ItemStack outputItemStack;
/**
* The ItemStacks that hold the items currently being used in the Glass Bell
*/
private ItemStack[] inventory;
public TileEntityGlassBell()
{
inventory = new ItemStack[INVENTORY_SIZE];
}
@Override
public int getSizeInventory()
{
return inventory.length;
}
@Override
public ItemStack getStackInSlot(int slotIndex)
{
return inventory[slotIndex];
}
@Override
public ItemStack decrStackSize(int slotIndex, int decrementAmount)
{
ItemStack itemStack = getStackInSlot(slotIndex);
if (itemStack != null)
{
if (itemStack.stackSize <= decrementAmount)
{
setInventorySlotContents(slotIndex, null);
}
else
{
itemStack = itemStack.splitStack(decrementAmount);
if (itemStack.stackSize == 0)
{
setInventorySlotContents(slotIndex, null);
}
}
}
return itemStack;
}
@Override
public ItemStack getStackInSlotOnClosing(int slotIndex)
{
ItemStack itemStack = getStackInSlot(slotIndex);
if (itemStack != null)
{
setInventorySlotContents(slotIndex, null);
}
return itemStack;
}
@Override
public void setInventorySlotContents(int slotIndex, ItemStack itemStack)
{
inventory[slotIndex] = itemStack;
if (itemStack != null && itemStack.stackSize > getInventoryStackLimit())
{
itemStack.stackSize = getInventoryStackLimit();
}
if (!this.worldObj.isRemote)
{
ItemStack displayStack = this.inventory[DISPLAY_SLOT_INVENTORY_INDEX];
if (displayStack != null)
{
this.state = (byte) Block.getBlockFromItem(displayStack.getItem()).getLightValue();
}
else
{
this.state = 0;
}
PacketHandler.INSTANCE.sendToAllAround(new MessageTileEntityGlassBell(this, displayStack), new NetworkRegistry.TargetPoint(this.worldObj.provider.dimensionId, this.xCoord, this.yCoord, this.zCoord, 128d));
}
this.markDirty();
}
@Override
public String getInventoryName()
{
return this.hasCustomName() ? this.getCustomName() : Names.Containers.GLASS_BELL;
}
@Override
public boolean hasCustomInventoryName()
{
return false;
}
@Override
public int getInventoryStackLimit()
{
return 64;
}
@Override
public boolean isUseableByPlayer(EntityPlayer entityPlayer)
{
return true;
}
@Override
public void openInventory()
{
}
@Override
public void closeInventory()
{
}
@Override
public boolean isItemValidForSlot(int slotIndex, ItemStack itemStack)
{
return true;
}
@Override
public void readFromNBT(NBTTagCompound nbtTagCompound)
{
super.readFromNBT(nbtTagCompound);
// Read in the ItemStacks in the inventory from NBT
NBTTagList tagList = nbtTagCompound.getTagList("Items", 10);
inventory = new ItemStack[this.getSizeInventory()];
for (int i = 0; i < tagList.tagCount(); ++i)
{
NBTTagCompound tagCompound = tagList.getCompoundTagAt(i);
byte slotIndex = tagCompound.getByte("Slot");
if (slotIndex >= 0 && slotIndex < inventory.length)
{
inventory[slotIndex] = ItemStack.loadItemStackFromNBT(tagCompound);
}
}
}
@Override
public void writeToNBT(NBTTagCompound nbtTagCompound)
{
super.writeToNBT(nbtTagCompound);
// Write the ItemStacks in the inventory to NBT
NBTTagList tagList = new NBTTagList();
for (int currentIndex = 0; currentIndex < inventory.length; ++currentIndex)
{
if (inventory[currentIndex] != null)
{
NBTTagCompound tagCompound = new NBTTagCompound();
tagCompound.setByte("Slot", (byte) currentIndex);
inventory[currentIndex].writeToNBT(tagCompound);
tagList.appendTag(tagCompound);
}
}
nbtTagCompound.setTag("Items", tagList);
}
@Override
public Packet getDescriptionPacket()
{
if (getStackInSlot(DISPLAY_SLOT_INVENTORY_INDEX) != null && getStackInSlot(DISPLAY_SLOT_INVENTORY_INDEX).stackSize > 0)
{
return PacketHandler.INSTANCE.getPacketFrom(new MessageTileEntityGlassBell(this, getStackInSlot(DISPLAY_SLOT_INVENTORY_INDEX)));
}
return PacketHandler.INSTANCE.getPacketFrom(new MessageTileEntityGlassBell(this, null));
}
}

View file

@ -0,0 +1,5 @@
package com.pahimar.ee3.tileentity;
public class TileEntityResearchStation extends TileEntityEE
{
}

View file

@ -1,97 +0,0 @@
package com.pahimar.ee3.tileentity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
public class TileGlassBell extends TileEntityEE implements IInventory
{
public static final int INVENTORY_SIZE = 1;
public static final int DISPLAY_SLOT_INVENTORY_INDEX = 0;
public ItemStack outputItemStack;
/**
* Server sync counter (once per 20 ticks)
*/
private int ticksSinceSync;
/**
* The ItemStacks that hold the items currently being used in the Glass Bell
*/
private ItemStack[] inventory;
public TileGlassBell()
{
inventory = new ItemStack[INVENTORY_SIZE];
}
@Override
public int getSizeInventory()
{
return 0;
}
@Override
public ItemStack getStackInSlot(int var1)
{
return null;
}
@Override
public ItemStack decrStackSize(int var1, int var2)
{
return null;
}
@Override
public ItemStack getStackInSlotOnClosing(int var1)
{
return null;
}
@Override
public void setInventorySlotContents(int var1, ItemStack var2)
{
}
@Override
public String getInventoryName()
{
return null;
}
@Override
public boolean hasCustomInventoryName()
{
return false;
}
@Override
public int getInventoryStackLimit()
{
return 0;
}
@Override
public boolean isUseableByPlayer(EntityPlayer var1)
{
return false;
}
@Override
public void openInventory()
{
}
@Override
public void closeInventory()
{
}
@Override
public boolean isItemValidForSlot(int var1, ItemStack var2)
{
return false;
}
}

View file

@ -1,5 +0,0 @@
package com.pahimar.ee3.tileentity;
public class TileResearchStation extends TileEntityEE
{
}