Another push before I go to bed!
This commit is contained in:
parent
b1448e29eb
commit
ad045755f6
|
@ -5,7 +5,6 @@ import com.pahimar.ee3.reference.Textures;
|
|||
import com.pahimar.ee3.tileentity.TileEntityTransmutationTablet;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockSlab;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
@ -149,15 +148,6 @@ public class BlockAshInfusedStoneSlab extends BlockSlab
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block)
|
||||
{
|
||||
if (!hasValidNeighbours(world, x, y, z))
|
||||
{
|
||||
super.breakBlock(world, x, y, z, block, world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
|
@ -226,58 +216,6 @@ public class BlockAshInfusedStoneSlab extends BlockSlab
|
|||
return getUnlocalizedName();
|
||||
}
|
||||
|
||||
private boolean hasValidNeighbours(World world, int x, int y, int z)
|
||||
{
|
||||
int metaData = world.getBlockMetadata(x, y, z);
|
||||
|
||||
int shiftedX = x;
|
||||
int shiftedZ = z;
|
||||
|
||||
if (metaData == 1)
|
||||
{
|
||||
shiftedX++;
|
||||
shiftedZ++;
|
||||
}
|
||||
else if (metaData == 2)
|
||||
{
|
||||
shiftedZ++;
|
||||
}
|
||||
else if (metaData == 3)
|
||||
{
|
||||
shiftedX--;
|
||||
shiftedZ++;
|
||||
}
|
||||
else if (metaData == 4)
|
||||
{
|
||||
shiftedX++;
|
||||
}
|
||||
else if (metaData == 5)
|
||||
{
|
||||
shiftedZ--;
|
||||
}
|
||||
else if (metaData == 6)
|
||||
{
|
||||
shiftedX++;
|
||||
shiftedZ--;
|
||||
}
|
||||
else if (metaData == 7)
|
||||
{
|
||||
shiftedZ--;
|
||||
}
|
||||
else if (metaData == 8)
|
||||
{
|
||||
shiftedX--;
|
||||
shiftedZ--;
|
||||
}
|
||||
|
||||
if (world.getBlock(shiftedX, y, shiftedZ) instanceof BlockTransmutationTablet)
|
||||
{
|
||||
return ((BlockTransmutationTablet) world.getBlock(shiftedX, y, shiftedZ)).isStructureValid(world, shiftedX, y, shiftedZ);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isAssociatedWithValidTablet(World world, int x, int y, int z)
|
||||
{
|
||||
int metaData = world.getBlockMetadata(x, y, z);
|
||||
|
|
|
@ -6,12 +6,12 @@ import com.pahimar.ee3.reference.GUIs;
|
|||
import com.pahimar.ee3.reference.Names;
|
||||
import com.pahimar.ee3.reference.RenderIds;
|
||||
import com.pahimar.ee3.tileentity.TileEntityTransmutationTablet;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Random;
|
||||
|
@ -27,6 +27,19 @@ public class BlockTransmutationTablet extends BlockEE implements ITileEntityProv
|
|||
this.setBlockBounds(0f, 0f, 0f, 1f, 0.625f, 1f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess iBlockAccess, int x, int y, int z)
|
||||
{
|
||||
if (isStructureValid(iBlockAccess, x, y, z))
|
||||
{
|
||||
this.setBlockBounds(0f, 0f, 0f, 1f, 0.625f, 1f);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.setBlockBounds(0f, 0f, 0f, 1f, 0.5f, 1f);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
|
||||
{
|
||||
|
@ -60,15 +73,6 @@ public class BlockTransmutationTablet extends BlockEE implements ITileEntityProv
|
|||
return metaData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block)
|
||||
{
|
||||
if (!isStructureValid(world, x, y, z))
|
||||
{
|
||||
super.breakBlock(world, x, y, z, block, world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int metaData)
|
||||
{
|
||||
|
@ -93,15 +97,15 @@ public class BlockTransmutationTablet extends BlockEE implements ITileEntityProv
|
|||
return RenderIds.tabletSlab;
|
||||
}
|
||||
|
||||
public boolean isStructureValid(World world, int xCoord, int yCoord, int zCoord)
|
||||
private boolean isStructureValid(IBlockAccess iBlockAcces, int xCoord, int yCoord, int zCoord)
|
||||
{
|
||||
return ((world.getBlock(xCoord - 1, yCoord, zCoord - 1) instanceof BlockAshInfusedStoneSlab && world.getBlockMetadata(xCoord - 1, yCoord, zCoord - 1) == 1) &&
|
||||
(world.getBlock(xCoord, yCoord, zCoord - 1) instanceof BlockAshInfusedStoneSlab && world.getBlockMetadata(xCoord, yCoord, zCoord - 1) == 2) &&
|
||||
(world.getBlock(xCoord + 1, yCoord, zCoord - 1) instanceof BlockAshInfusedStoneSlab && world.getBlockMetadata(xCoord + 1, yCoord, zCoord - 1) == 3) &&
|
||||
(world.getBlock(xCoord - 1, yCoord, zCoord) instanceof BlockAshInfusedStoneSlab && world.getBlockMetadata(xCoord - 1, yCoord, zCoord) == 4) &&
|
||||
(world.getBlock(xCoord + 1, yCoord, zCoord) instanceof BlockAshInfusedStoneSlab && world.getBlockMetadata(xCoord + 1, yCoord, zCoord) == 5) &&
|
||||
(world.getBlock(xCoord - 1, yCoord, zCoord + 1) instanceof BlockAshInfusedStoneSlab && world.getBlockMetadata(xCoord - 1, yCoord, zCoord + 1) == 6) &&
|
||||
(world.getBlock(xCoord, yCoord, zCoord + 1) instanceof BlockAshInfusedStoneSlab && world.getBlockMetadata(xCoord, yCoord, zCoord + 1) == 7) &&
|
||||
(world.getBlock(xCoord + 1, yCoord, zCoord + 1) instanceof BlockAshInfusedStoneSlab && world.getBlockMetadata(xCoord + 1, yCoord, zCoord + 1) == 8));
|
||||
return ((iBlockAcces.getBlock(xCoord - 1, yCoord, zCoord - 1) instanceof BlockAshInfusedStoneSlab && iBlockAcces.getBlockMetadata(xCoord - 1, yCoord, zCoord - 1) == 1) &&
|
||||
(iBlockAcces.getBlock(xCoord, yCoord, zCoord - 1) instanceof BlockAshInfusedStoneSlab && iBlockAcces.getBlockMetadata(xCoord, yCoord, zCoord - 1) == 2) &&
|
||||
(iBlockAcces.getBlock(xCoord + 1, yCoord, zCoord - 1) instanceof BlockAshInfusedStoneSlab && iBlockAcces.getBlockMetadata(xCoord + 1, yCoord, zCoord - 1) == 3) &&
|
||||
(iBlockAcces.getBlock(xCoord - 1, yCoord, zCoord) instanceof BlockAshInfusedStoneSlab && iBlockAcces.getBlockMetadata(xCoord - 1, yCoord, zCoord) == 4) &&
|
||||
(iBlockAcces.getBlock(xCoord + 1, yCoord, zCoord) instanceof BlockAshInfusedStoneSlab && iBlockAcces.getBlockMetadata(xCoord + 1, yCoord, zCoord) == 5) &&
|
||||
(iBlockAcces.getBlock(xCoord - 1, yCoord, zCoord + 1) instanceof BlockAshInfusedStoneSlab && iBlockAcces.getBlockMetadata(xCoord - 1, yCoord, zCoord + 1) == 6) &&
|
||||
(iBlockAcces.getBlock(xCoord, yCoord, zCoord + 1) instanceof BlockAshInfusedStoneSlab && iBlockAcces.getBlockMetadata(xCoord, yCoord, zCoord + 1) == 7) &&
|
||||
(iBlockAcces.getBlock(xCoord + 1, yCoord, zCoord + 1) instanceof BlockAshInfusedStoneSlab && iBlockAcces.getBlockMetadata(xCoord + 1, yCoord, zCoord + 1) == 8));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,9 +20,13 @@ public class ModelTransmutationTablet extends ModelBase
|
|||
this.base.addBox(-8.0F, 6.0F, -8.0F, 16, 8, 16, 0.0F);
|
||||
}
|
||||
|
||||
public void render(float scale)
|
||||
public void renderTransmutationPad(float scale)
|
||||
{
|
||||
this.transmutationPad.render(scale);
|
||||
}
|
||||
|
||||
public void renderBase(float scale)
|
||||
{
|
||||
this.base.render(scale);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,50 +22,58 @@ public class TileEntityRendererTransmutationTablet extends TileEntitySpecialRend
|
|||
{
|
||||
if (tileEntity instanceof TileEntityTransmutationTablet)
|
||||
{
|
||||
TileEntityTransmutationTablet tileEntityTransmutationTablet = (TileEntityTransmutationTablet) tileEntity;
|
||||
|
||||
this.bindTexture(Textures.Model.TRANSMUTATION_TABLET);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glTranslatef((float) x, (float) y, (float) z);
|
||||
GL11.glTranslatef(0.5F, -0.375F, 0.5F);
|
||||
modelTransmutationTablet.render(0.0625f);
|
||||
modelTransmutationTablet.renderBase(0.0625f);
|
||||
if (tileEntityTransmutationTablet.isStructureValid())
|
||||
{
|
||||
modelTransmutationTablet.renderTransmutationPad(0.0625f);
|
||||
}
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
TileEntityTransmutationTablet tileEntityTransmutationTablet = (TileEntityTransmutationTablet) tileEntity;
|
||||
int rotationAngle = 0;
|
||||
if (tileEntityTransmutationTablet.getRotation() == ForgeDirection.NORTH)
|
||||
if (tileEntityTransmutationTablet.isStructureValid())
|
||||
{
|
||||
rotationAngle = 0;
|
||||
}
|
||||
else if (tileEntityTransmutationTablet.getRotation() == ForgeDirection.EAST)
|
||||
{
|
||||
rotationAngle = -90;
|
||||
}
|
||||
else if (tileEntityTransmutationTablet.getRotation() == ForgeDirection.SOUTH)
|
||||
{
|
||||
rotationAngle = 180;
|
||||
}
|
||||
else if (tileEntityTransmutationTablet.getRotation() == ForgeDirection.WEST)
|
||||
{
|
||||
rotationAngle = 90;
|
||||
}
|
||||
int rotationAngle = 0;
|
||||
if (tileEntityTransmutationTablet.getRotation() == ForgeDirection.NORTH)
|
||||
{
|
||||
rotationAngle = 0;
|
||||
}
|
||||
else if (tileEntityTransmutationTablet.getRotation() == ForgeDirection.EAST)
|
||||
{
|
||||
rotationAngle = -90;
|
||||
}
|
||||
else if (tileEntityTransmutationTablet.getRotation() == ForgeDirection.SOUTH)
|
||||
{
|
||||
rotationAngle = 180;
|
||||
}
|
||||
else if (tileEntityTransmutationTablet.getRotation() == ForgeDirection.WEST)
|
||||
{
|
||||
rotationAngle = 90;
|
||||
}
|
||||
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glDepthMask(false);
|
||||
GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5d, y + 0.63d, z + 0.5d);
|
||||
GL11.glScalef(2f, 2f, 2f);
|
||||
GL11.glRotatef(rotationAngle, tileEntityTransmutationTablet.getOrientation().offsetX, tileEntityTransmutationTablet.getOrientation().offsetY, tileEntityTransmutationTablet.getOrientation().offsetZ);
|
||||
GL11.glRotatef(90, -1, 0, 0);
|
||||
RenderUtils.renderQuad(Textures.AlchemyArray.TRANSMUTATION_ALCHEMY_ARRAY);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glDepthMask(false);
|
||||
GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5d, y + 0.63d, z + 0.5d);
|
||||
GL11.glScalef(2f, 2f, 2f);
|
||||
GL11.glRotatef(rotationAngle, tileEntityTransmutationTablet.getOrientation().offsetX, tileEntityTransmutationTablet.getOrientation().offsetY, tileEntityTransmutationTablet.getOrientation().offsetZ);
|
||||
GL11.glRotatef(90, -1, 0, 0);
|
||||
RenderUtils.renderQuad(Textures.AlchemyArray.TRANSMUTATION_ALCHEMY_ARRAY);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.pahimar.ee3.tileentity;
|
||||
|
||||
import com.pahimar.ee3.api.EnergyValue;
|
||||
import com.pahimar.ee3.block.BlockAshInfusedStoneSlab;
|
||||
import com.pahimar.ee3.exchange.EnergyValueRegistry;
|
||||
import com.pahimar.ee3.item.ItemAlchemicalTome;
|
||||
import com.pahimar.ee3.item.ItemMiniumStone;
|
||||
|
@ -73,6 +74,18 @@ public class TileEntityTransmutationTablet extends TileEntityEE implements IInve
|
|||
return AxisAlignedBB.getBoundingBox(xCoord - 1.5d, yCoord - 1, zCoord - 1.5d, xCoord + 1.5d, yCoord + 1, zCoord + 1.5d);
|
||||
}
|
||||
|
||||
public boolean isStructureValid()
|
||||
{
|
||||
return ((worldObj.getBlock(xCoord - 1, yCoord, zCoord - 1) instanceof BlockAshInfusedStoneSlab && worldObj.getBlockMetadata(xCoord - 1, yCoord, zCoord - 1) == 1) &&
|
||||
(worldObj.getBlock(xCoord, yCoord, zCoord - 1) instanceof BlockAshInfusedStoneSlab && worldObj.getBlockMetadata(xCoord, yCoord, zCoord - 1) == 2) &&
|
||||
(worldObj.getBlock(xCoord + 1, yCoord, zCoord - 1) instanceof BlockAshInfusedStoneSlab && worldObj.getBlockMetadata(xCoord + 1, yCoord, zCoord - 1) == 3) &&
|
||||
(worldObj.getBlock(xCoord - 1, yCoord, zCoord) instanceof BlockAshInfusedStoneSlab && worldObj.getBlockMetadata(xCoord - 1, yCoord, zCoord) == 4) &&
|
||||
(worldObj.getBlock(xCoord + 1, yCoord, zCoord) instanceof BlockAshInfusedStoneSlab && worldObj.getBlockMetadata(xCoord + 1, yCoord, zCoord) == 5) &&
|
||||
(worldObj.getBlock(xCoord - 1, yCoord, zCoord + 1) instanceof BlockAshInfusedStoneSlab && worldObj.getBlockMetadata(xCoord - 1, yCoord, zCoord + 1) == 6) &&
|
||||
(worldObj.getBlock(xCoord, yCoord, zCoord + 1) instanceof BlockAshInfusedStoneSlab && worldObj.getBlockMetadata(xCoord, yCoord, zCoord + 1) == 7) &&
|
||||
(worldObj.getBlock(xCoord + 1, yCoord, zCoord + 1) instanceof BlockAshInfusedStoneSlab && worldObj.getBlockMetadata(xCoord + 1, yCoord, zCoord + 1) == 8));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
|
@ -199,7 +212,7 @@ public class TileEntityTransmutationTablet extends TileEntityEE implements IInve
|
|||
}
|
||||
|
||||
float newEnergyValue = 0f;
|
||||
for (int i = 0; i < STONE_INDEX; i++)
|
||||
for (int i = 0; i <= STONE_INDEX; i++)
|
||||
{
|
||||
if (inventory[i] != null && EnergyValueRegistry.getInstance().hasEnergyValue(inventory[i]))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue