Lots of stuff before going on the cruise - various states of things

This commit is contained in:
pahimar 2015-03-11 16:34:37 -04:00
parent 2ff0e1c74d
commit 6f94c5a6f1
38 changed files with 1180 additions and 526 deletions

View file

@ -16,6 +16,8 @@ public class AlchemyArray implements Comparable<AlchemyArray>
private ResourceLocation texture;
private String unLocalizedName;
private String className;
private int lightLevel;
private int chalkPerBlockCost;
private AlchemyArray()
{
@ -26,6 +28,8 @@ public class AlchemyArray implements Comparable<AlchemyArray>
{
this.texture = texture;
this.unLocalizedName = unLocalizedName;
this.chalkPerBlockCost = 1;
this.lightLevel = 0;
}
public ResourceLocation getTexture()
@ -53,16 +57,26 @@ public class AlchemyArray implements Comparable<AlchemyArray>
return StatCollector.translateToLocal(unLocalizedName);
}
public int getChalkCostPerBlock()
{
return chalkPerBlockCost;
}
public void setChalkPerBlockCost(int chalkPerBlockCost)
{
this.chalkPerBlockCost = Math.abs(chalkPerBlockCost);
}
public int getLightLevel()
{
return lightLevel;
}
public String getClassName()
{
return className;
}
public int getChalkCostPerBlock()
{
return 1;
}
public void readFromNBT(NBTTagCompound nbtTagCompound)
{
if (nbtTagCompound != null)
@ -93,12 +107,22 @@ public class AlchemyArray implements Comparable<AlchemyArray>
{
this.className = "";
}
if (nbtTagCompound.hasKey("lightLevel"))
{
this.lightLevel = nbtTagCompound.getInteger("lightLevel");
}
else
{
this.lightLevel = 0;
}
}
else
{
this.texture = new ResourceLocation("");
this.unLocalizedName = "";
this.className = "";
this.lightLevel = 0;
}
}
@ -108,6 +132,7 @@ public class AlchemyArray implements Comparable<AlchemyArray>
nbtTagCompound.setString("texturePath", texture.getResourcePath());
nbtTagCompound.setString("unLocalizedName", unLocalizedName);
nbtTagCompound.setString("className", this.getClass().getCanonicalName());
nbtTagCompound.setInteger("lightLevel", lightLevel);
}
public static AlchemyArray readArrayFromNBT(NBTTagCompound nbtTagCompound)

View file

@ -0,0 +1,12 @@
package com.pahimar.ee3.api;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
public interface ICustomAlchemyArrayRender
{
@SideOnly(Side.CLIENT)
public abstract void doCustomRendering(TileEntity tileEntity, double x, double y, double z, int arraySize, ForgeDirection orientation, ForgeDirection rotation, float tick);
}

View file

@ -1,62 +0,0 @@
package com.pahimar.ee3.array;
import com.pahimar.ee3.api.AlchemyArray;
import com.pahimar.ee3.reference.Names;
import com.pahimar.ee3.reference.Textures;
import com.pahimar.ee3.util.LogHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.Explosion;
import net.minecraft.world.World;
public class BasicAlchemyArray extends AlchemyArray
{
public BasicAlchemyArray()
{
super(Textures.AlchemyArray.BASIC_ALCHEMY_ARRAY, Names.AlchemyArrays.BASIC_ALCHEMY_ARRAY);
}
@Override
public void onArrayPlacedBy(World world, int eventX, int eventY, int eventZ, int arrayX, int arrayY, int arrayZ, EntityLivingBase entityLiving, ItemStack itemStack)
{
LogHelper.info("Array Placed");
}
@Override
public void onArrayActivated(World world, int eventX, int eventY, int eventZ, int arrayX, int arrayY, int arrayZ, EntityPlayer entityPlayer, int sideHit, float hitX, float hitY, float hitZ)
{
LogHelper.info("Array Activated");
}
@Override
public void onArrayClicked(World world, int eventX, int eventY, int eventZ, int arrayX, int arrayY, int arrayZ, EntityPlayer entityPlayer)
{
LogHelper.info("Array Clicked");
}
@Override
public void onArrayDestroyedByExplosion(World world, int eventX, int eventY, int eventZ, int arrayX, int arrayY, int arrayZ, Explosion explosion)
{
LogHelper.info("Array Destroyed By Explosion");
}
@Override
public void onArrayDestroyedByPlayer(World world, int eventX, int eventY, int eventZ, int arrayX, int arrayY, int arrayZ, int metaData)
{
LogHelper.info("Array Destroyed By Player");
}
@Override
public void onEntityCollidedWithArray(World world, int eventX, int eventY, int eventZ, int arrayX, int arrayY, int arrayZ, Entity entity)
{
LogHelper.info("Array Collided With");
}
@Override
public void onArrayFallenUpon(World world, int eventX, int eventY, int eventZ, int arrayX, int arrayY, int arrayZ, Entity entity, float fallDistance)
{
LogHelper.info("Array Fallen Upon");
}
}

View file

@ -0,0 +1,137 @@
package com.pahimar.ee3.array;
import com.pahimar.ee3.EquivalentExchange3;
import com.pahimar.ee3.api.AlchemyArray;
import com.pahimar.ee3.api.EnergyValue;
import com.pahimar.ee3.init.ModBlocks;
import com.pahimar.ee3.reference.GUIs;
import com.pahimar.ee3.reference.Names;
import com.pahimar.ee3.reference.Textures;
import com.pahimar.ee3.tileentity.TileEntityAlchemyArray;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class TransmutationAlchemyArray extends AlchemyArray implements IInventory
{
private EnergyValue energyValue;
public TransmutationAlchemyArray()
{
super(Textures.AlchemyArray.TRANSMUTATION_ALCHEMY_ARRAY, Names.AlchemyArrays.TRANSMUTATION_ALCHEMY_ARRAY);
}
@Override
public void onArrayActivated(World world, int eventX, int eventY, int eventZ, int arrayX, int arrayY, int arrayZ, EntityPlayer entityPlayer, int sideHit, float hitX, float hitY, float hitZ)
{
if (!world.isRemote)
{
if (world.getTileEntity(arrayX, arrayY, arrayZ) instanceof TileEntityAlchemyArray)
{
TileEntityAlchemyArray tileEntityAlchemyArray = (TileEntityAlchemyArray) world.getTileEntity(arrayX, arrayY, arrayZ);
if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.UP && tileEntityAlchemyArray.getSize() == 2 && areBlocksValidForTransmutationTablet(world, arrayX, arrayY, arrayZ))
{
entityPlayer.openGui(EquivalentExchange3.instance, GUIs.TRANSMUTATION_TABLET.ordinal(), world, arrayX, arrayY, arrayZ);
}
}
}
}
private boolean areBlocksValidForTransmutationTablet(World world, int arrayX, int arrayY, int arrayZ)
{
boolean areBlocksValid = true;
for (int i = -1; i <= 1; i++)
{
for (int j = -1; j <= 1; j++)
{
if (world.getBlock(arrayX + i, arrayY - 1, arrayZ + j) != ModBlocks.ashInfusedStone)
{
areBlocksValid = false;
}
}
}
return areBlocksValid;
}
@Override
public int getSizeInventory()
{
return 0;
}
@Override
public ItemStack getStackInSlot(int p_70301_1_)
{
return null;
}
@Override
public ItemStack decrStackSize(int p_70298_1_, int p_70298_2_)
{
return null;
}
@Override
public ItemStack getStackInSlotOnClosing(int p_70304_1_)
{
return null;
}
@Override
public void setInventorySlotContents(int p_70299_1_, ItemStack p_70299_2_)
{
}
@Override
public String getInventoryName()
{
return null;
}
@Override
public boolean hasCustomInventoryName()
{
return false;
}
@Override
public int getInventoryStackLimit()
{
return 0;
}
@Override
public void markDirty()
{
}
@Override
public boolean isUseableByPlayer(EntityPlayer p_70300_1_)
{
return false;
}
@Override
public void openInventory()
{
}
@Override
public void closeInventory()
{
}
@Override
public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_)
{
return false;
}
}

View file

@ -19,7 +19,6 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
@ -57,63 +56,70 @@ public class BlockAlchemyArray extends BlockEE implements ITileEntityProvider
return RenderIds.alchemyArray;
}
@Override
public int getLightValue(IBlockAccess world, int x, int y, int z)
{
if (world.getTileEntity(x, y, z) instanceof TileEntityAlchemyArray)
{
TileEntityAlchemyArray tileEntityAlchemyArray = (TileEntityAlchemyArray) world.getTileEntity(x, y, z);
return tileEntityAlchemyArray.getLightLevel();
}
return 0;
}
@Override
public Item getItemDropped(int par1, Random random, int par2)
{
return null;
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z)
{
return AxisAlignedBB.getBoundingBox((double) x + this.minX, (double) y + this.minY, (double) z + this.minZ, (double) x + this.maxX, (double) y + 0.5, (double) z + this.maxZ);
}
@Override
public MovingObjectPosition collisionRayTrace(World world, int x, int y, int z, Vec3 startVec, Vec3 endVec)
{
// if (world.getTileEntity(x, y, z) instanceof TileEntityAlchemyArray)
// {
// TileEntityAlchemyArray tileEntityAlchemyArray = (TileEntityAlchemyArray) world.getTileEntity(x, y, z);
//
// switch (tileEntityAlchemyArray.getOrientation())
// {
// case DOWN:
// {
// this.setBlockBounds(0f, 1f, 0f, 1f, 1 - 0.0625f, 1f);
// break;
// }
// case UP:
// {
// this.setBlockBounds(0f, 0f, 0f, 1f, 0.0625f, 1f);
// break;
// }
// case NORTH:
// {
// this.setBlockBounds(0f, 0f, 1 - 0.0625f, 1f, 1f, 1f);
// break;
// }
// case SOUTH:
// {
// this.setBlockBounds(0f, 0f, 0f, 1f, 1f, 0.0625f);
// break;
// }
// case EAST:
// {
// this.setBlockBounds(0f, 0f, 0f, 0.0625f, 1f, 1f);
// break;
// }
// case WEST:
// {
// this.setBlockBounds(1f, 0f, 0f, 1 - 0.0625f, 1f, 1f);
// break;
// }
// case UNKNOWN:
// {
// break;
// }
// }
// }
if (world.getTileEntity(x, y, z) instanceof TileEntityAlchemyArray)
{
TileEntityAlchemyArray tileEntityAlchemyArray = (TileEntityAlchemyArray) world.getTileEntity(x, y, z);
switch (tileEntityAlchemyArray.getOrientation())
{
case DOWN:
{
this.setBlockBounds(0f, 1f, 0f, 1f, 1 - 0.0625f, 1f);
break;
}
case UP:
{
this.setBlockBounds(0f, 0f, 0f, 1f, 0.0625f, 1f);
break;
}
case NORTH:
{
this.setBlockBounds(0f, 0f, 1 - 0.0625f, 1f, 1f, 1f);
break;
}
case SOUTH:
{
this.setBlockBounds(0f, 0f, 0f, 1f, 1f, 0.0625f);
break;
}
case EAST:
{
this.setBlockBounds(0f, 0f, 0f, 0.0625f, 1f, 1f);
break;
}
case WEST:
{
this.setBlockBounds(1f, 0f, 0f, 1 - 0.0625f, 1f, 1f);
break;
}
case UNKNOWN:
{
break;
}
}
}
return super.collisionRayTrace(world, x, y, z, startVec, endVec);
}

View file

@ -50,6 +50,19 @@ public class BlockDummyArray extends BlockEE implements ITileEntityProvider
return RenderIds.dummyArray;
}
@Override
public int getLightValue(IBlockAccess world, int x, int y, int z)
{
if (world.getTileEntity(x, y, z) instanceof TileEntityDummyArray)
{
TileEntityDummyArray tileEntityDummyArray = (TileEntityDummyArray) world.getTileEntity(x, y, z);
return tileEntityDummyArray.getLightLevel();
}
return 0;
}
@Override
public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side)
{
@ -102,14 +115,13 @@ public class BlockDummyArray extends BlockEE implements ITileEntityProvider
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int sideHit, float hitX, float hitY, float hitZ)
{
if (!world.isRemote && world.getTileEntity(x, y, z) instanceof TileEntityDummyArray)
if (world.getTileEntity(x, y, z) instanceof TileEntityDummyArray)
{
TileEntityDummyArray tileEntityDummyArray = (TileEntityDummyArray) world.getTileEntity(x, y, z);
TileEntityAlchemyArray tileEntityAlchemyArray = ((TileEntityDummyArray) world.getTileEntity(x, y, z)).getAssociatedTileEntity();
if (tileEntityAlchemyArray != null)
{
tileEntityAlchemyArray.onBlockActivated(world, x, y, z, tileEntityDummyArray.xCoord, tileEntityDummyArray.yCoord, tileEntityDummyArray.xCoord, entityPlayer, sideHit, hitX, hitY, hitZ);
tileEntityAlchemyArray.onBlockActivated(world, x, y, z, tileEntityAlchemyArray.xCoord, tileEntityAlchemyArray.yCoord, tileEntityAlchemyArray.zCoord, entityPlayer, sideHit, hitX, hitY, hitZ);
}
}
@ -119,14 +131,13 @@ public class BlockDummyArray extends BlockEE implements ITileEntityProvider
@Override
public void onBlockClicked(World world, int x, int y, int z, EntityPlayer entityPlayer)
{
if (!world.isRemote && world.getTileEntity(x, y, z) instanceof TileEntityDummyArray)
if (world.getTileEntity(x, y, z) instanceof TileEntityDummyArray)
{
TileEntityDummyArray tileEntityDummyArray = (TileEntityDummyArray) world.getTileEntity(x, y, z);
TileEntityAlchemyArray tileEntityAlchemyArray = ((TileEntityDummyArray) world.getTileEntity(x, y, z)).getAssociatedTileEntity();
if (tileEntityAlchemyArray != null)
{
tileEntityAlchemyArray.onBlockClicked(world, x, y, z, tileEntityDummyArray.xCoord, tileEntityDummyArray.yCoord, tileEntityDummyArray.xCoord, entityPlayer);
tileEntityAlchemyArray.onBlockClicked(world, x, y, z, tileEntityAlchemyArray.xCoord, tileEntityAlchemyArray.yCoord, tileEntityAlchemyArray.zCoord, entityPlayer);
}
}
}
@ -134,14 +145,13 @@ public class BlockDummyArray extends BlockEE implements ITileEntityProvider
@Override
public void onBlockDestroyedByExplosion(World world, int x, int y, int z, Explosion explosion)
{
if (!world.isRemote && world.getTileEntity(x, y, z) instanceof TileEntityDummyArray)
if (world.getTileEntity(x, y, z) instanceof TileEntityDummyArray)
{
TileEntityDummyArray tileEntityDummyArray = (TileEntityDummyArray) world.getTileEntity(x, y, z);
TileEntityAlchemyArray tileEntityAlchemyArray = ((TileEntityDummyArray) world.getTileEntity(x, y, z)).getAssociatedTileEntity();
if (tileEntityAlchemyArray != null)
{
tileEntityAlchemyArray.onBlockDestroyedByExplosion(world, x, y, z, tileEntityDummyArray.xCoord, tileEntityDummyArray.yCoord, tileEntityDummyArray.xCoord, explosion);
tileEntityAlchemyArray.onBlockDestroyedByExplosion(world, x, y, z, tileEntityAlchemyArray.xCoord, tileEntityAlchemyArray.yCoord, tileEntityAlchemyArray.zCoord, explosion);
}
}
}
@ -149,14 +159,13 @@ public class BlockDummyArray extends BlockEE implements ITileEntityProvider
@Override
public void onBlockDestroyedByPlayer(World world, int x, int y, int z, int metaData)
{
if (!world.isRemote && world.getTileEntity(x, y, z) instanceof TileEntityDummyArray)
if (world.getTileEntity(x, y, z) instanceof TileEntityDummyArray)
{
TileEntityDummyArray tileEntityDummyArray = (TileEntityDummyArray) world.getTileEntity(x, y, z);
TileEntityAlchemyArray tileEntityAlchemyArray = ((TileEntityDummyArray) world.getTileEntity(x, y, z)).getAssociatedTileEntity();
if (tileEntityAlchemyArray != null)
{
tileEntityAlchemyArray.onBlockDestroyedByPlayer(world, x, y, z, tileEntityDummyArray.xCoord, tileEntityDummyArray.yCoord, tileEntityDummyArray.xCoord, metaData);
tileEntityAlchemyArray.onBlockDestroyedByPlayer(world, x, y, z, tileEntityAlchemyArray.xCoord, tileEntityAlchemyArray.yCoord, tileEntityAlchemyArray.zCoord, metaData);
}
}
}
@ -164,14 +173,13 @@ public class BlockDummyArray extends BlockEE implements ITileEntityProvider
@Override
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity)
{
if (!world.isRemote && world.getTileEntity(x, y, z) instanceof TileEntityDummyArray)
if (world.getTileEntity(x, y, z) instanceof TileEntityDummyArray)
{
TileEntityDummyArray tileEntityDummyArray = (TileEntityDummyArray) world.getTileEntity(x, y, z);
TileEntityAlchemyArray tileEntityAlchemyArray = ((TileEntityDummyArray) world.getTileEntity(x, y, z)).getAssociatedTileEntity();
if (tileEntityAlchemyArray != null)
{
tileEntityAlchemyArray.onEntityCollidedWithBlock(world, x, y, z, tileEntityDummyArray.xCoord, tileEntityDummyArray.yCoord, tileEntityDummyArray.xCoord, entity);
tileEntityAlchemyArray.onEntityCollidedWithBlock(world, x, y, z, tileEntityAlchemyArray.xCoord, tileEntityAlchemyArray.yCoord, tileEntityAlchemyArray.zCoord, entity);
}
}
}
@ -179,14 +187,13 @@ public class BlockDummyArray extends BlockEE implements ITileEntityProvider
@Override
public void onFallenUpon(World world, int x, int y, int z, Entity entity, float fallDistance)
{
if (!world.isRemote && world.getTileEntity(x, y, z) instanceof TileEntityDummyArray)
if (world.getTileEntity(x, y, z) instanceof TileEntityDummyArray)
{
TileEntityDummyArray tileEntityDummyArray = (TileEntityDummyArray) world.getTileEntity(x, y, z);
TileEntityAlchemyArray tileEntityAlchemyArray = ((TileEntityDummyArray) world.getTileEntity(x, y, z)).getAssociatedTileEntity();
if (tileEntityAlchemyArray != null)
{
tileEntityAlchemyArray.onFallenUpon(world, x, y, z, tileEntityDummyArray.xCoord, tileEntityDummyArray.yCoord, tileEntityDummyArray.xCoord, entity, fallDistance);
tileEntityAlchemyArray.onFallenUpon(world, x, y, z, tileEntityAlchemyArray.xCoord, tileEntityAlchemyArray.yCoord, tileEntityAlchemyArray.zCoord, entity, fallDistance);
}
}
}

View file

@ -17,7 +17,7 @@ public class BlockResearchStation extends BlockEE implements ITileEntityProvider
{
super(Material.rock);
this.setHardness(2.0f);
this.setBlockName(Names.Blocks.RESEARCH_STATION);
this.setBlockName(Names.Blocks.TRANSMUTATION_TABLET);
}
@Override

View file

@ -0,0 +1,43 @@
package com.pahimar.ee3.block;
import com.pahimar.ee3.reference.Names;
import com.pahimar.ee3.reference.RenderIds;
import com.pahimar.ee3.tileentity.TileEntityTransmutationTablet;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class BlockTransmutationTablet extends BlockEE implements ITileEntityProvider
{
public BlockTransmutationTablet()
{
super(Material.rock);
this.setHardness(2.0f);
this.setBlockName(Names.Blocks.TRANSMUTATION_TABLET);
}
@Override
public TileEntity createNewTileEntity(World world, int metaData)
{
return new TileEntityTransmutationTablet();
}
@Override
public boolean renderAsNormalBlock()
{
return false;
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
public int getRenderType()
{
return RenderIds.tabletSlab;
}
}

View file

@ -1,84 +0,0 @@
package com.pahimar.ee3.client.gui.inventory;
import com.pahimar.ee3.util.ResourceLocationHelper;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.inventory.Container;
import net.minecraft.util.ResourceLocation;
/**
* Borrowing from CoFHLib's idea of a generic Gui class to build off of because otherwise this is a crapshoot
*/
public class GuiEE extends GuiContainer
{
protected ResourceLocation guiTexture;
public GuiEE(Container container)
{
super(container);
}
public GuiEE(Container container, String texture)
{
this(container, ResourceLocationHelper.getResourceLocation(texture));
}
public GuiEE(Container container, ResourceLocation guiTexture)
{
super(container);
this.guiTexture = guiTexture;
}
@Override
public void initGui()
{
super.initGui();
}
@Override
public void drawScreen(int x, int y, float partialTick)
{
super.drawScreen(x, y, partialTick);
}
@Override
protected void drawGuiContainerForegroundLayer(int x, int y)
{
super.drawGuiContainerForegroundLayer(x, y);
}
@Override
protected void drawGuiContainerBackgroundLayer(float partialTick, int x, int y)
{
}
@Override
protected void keyTyped(char characterTyped, int keyPressed)
{
}
@Override
public void handleMouseInput()
{
}
@Override
protected void mouseClicked(int mX, int mY, int mouseButton)
{
}
@Override
protected void mouseMovedOrUp(int mX, int mY, int mouseButton)
{
}
@Override
protected void mouseClickMove(int mX, int mY, int lastClick, long timeSinceClick)
{
}
}

View file

@ -0,0 +1,28 @@
package com.pahimar.ee3.client.gui.inventory;
import com.pahimar.ee3.inventory.ContainerTransmutationTablet;
import com.pahimar.ee3.reference.Textures;
import com.pahimar.repackage.cofh.lib.gui.GuiBase;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.player.InventoryPlayer;
@SideOnly(Side.CLIENT)
public class GuiTransmutationTablet extends GuiBase
{
public GuiTransmutationTablet(InventoryPlayer inventoryPlayer)
{
super(new ContainerTransmutationTablet(inventoryPlayer), Textures.Gui.TRANSMUTATION_TABLET);
xSize = 256;
ySize = 256;
}
@Override
public void initGui()
{
super.initGui();
this.drawTitle = false;
this.drawInventory = false;
}
}

View file

@ -19,10 +19,12 @@ import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderGlobal;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.client.event.DrawBlockHighlightEvent;
import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
@ -59,6 +61,7 @@ public class DrawBlockHighlightEventHandler
}
else if (event.currentItem.getItem() instanceof ItemChalk)
{
// if should draw
drawAlchemyArrayOverlay(event);
}
}
@ -231,113 +234,198 @@ public class DrawBlockHighlightEventHandler
}
}
switch (sideHit)
if (!canPlaceAlchemyArray(event.currentItem, event.player.worldObj, event.target.blockX, event.target.blockY, event.target.blockZ, event.target.sideHit))
{
case UP:
{
xScale = zScale = chargeLevel;
yShift = 0.001f;
xRotate = -1;
rotationAngle = (-90 * (rotation + 2)) % 360;
facingCorrectionAngle = (-90 * (playerFacing + 2)) % 360;
if (tileEntity instanceof TileEntityAlchemyArray)
{
y -= 1;
}
if (tileEntity instanceof TileEntityDummyArray)
{
x = ((TileEntityDummyArray) tileEntity).getTrueXCoord() + 0.5f;
y = ((TileEntityDummyArray) tileEntity).getTrueYCoord() + 0.5f - 1;
z = ((TileEntityDummyArray) tileEntity).getTrueXCoord() + 0.5f;
}
break;
}
case DOWN:
{
xScale = zScale = chargeLevel;
yShift = -0.001f;
xRotate = 1;
rotationAngle = (-90 * (rotation + 2)) % 360;
facingCorrectionAngle = (-90 * (playerFacing + 2)) % 360;
if (tileEntity instanceof TileEntityAlchemyArray)
{
y += 1;
}
break;
}
case NORTH:
{
xScale = yScale = chargeLevel;
zCorrection = -1;
zShift = -0.001f;
zRotate = 1;
rotationAngle = (-90 * (rotation + 1)) % 360;
if (tileEntity instanceof TileEntityAlchemyArray)
{
z += 1;
}
break;
}
case SOUTH:
{
xScale = yScale = chargeLevel;
zShift = 0.001f;
zRotate = -1;
rotationAngle = (-90 * (rotation + 1)) % 360;
if (tileEntity instanceof TileEntityAlchemyArray)
{
z -= 1;
}
break;
}
case EAST:
{
yScale = zScale = chargeLevel;
xShift = 0.001f;
yRotate = 1;
rotationAngle = (-90 * (rotation + 2)) % 360;
if (tileEntity instanceof TileEntityAlchemyArray)
{
x -= 1;
}
break;
}
case WEST:
{
yScale = zScale = chargeLevel;
xShift = -0.001f;
yRotate = -1;
rotationAngle = (-90 * (rotation + 2)) % 360;
if (tileEntity instanceof TileEntityAlchemyArray)
{
x += 1;
}
break;
}
default:
break;
shouldRender = false;
}
if (shouldRender)
{
GL11.glDepthMask(false);
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glPushMatrix();
GL11.glTranslated(-iPX + x + xShift, -iPY + y + yShift, -iPZ + z + zShift);
GL11.glScalef(1F * xScale, 1F * yScale, 1F * zScale);
GL11.glRotatef(rotationAngle, sideHit.offsetX, sideHit.offsetY, sideHit.offsetZ);
GL11.glRotatef(facingCorrectionAngle, sideHit.offsetX, sideHit.offsetY, sideHit.offsetZ);
GL11.glRotatef(90, xRotate, yRotate, zRotate);
GL11.glTranslated(0, 0, 0.5f * zCorrection);
GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
RenderUtils.renderPulsingQuad(texture, 1f);
GL11.glPopMatrix();
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glDepthMask(true);
switch (sideHit)
{
case UP:
{
xScale = zScale = chargeLevel;
yShift = 0.001f;
xRotate = -1;
rotationAngle = (-90 * (rotation + 2)) % 360;
facingCorrectionAngle = (-90 * (playerFacing + 2)) % 360;
if (tileEntity instanceof TileEntityAlchemyArray)
{
y -= 1;
}
if (tileEntity instanceof TileEntityDummyArray)
{
x = ((TileEntityDummyArray) tileEntity).getTrueXCoord() + 0.5f;
y = ((TileEntityDummyArray) tileEntity).getTrueYCoord() + 0.5f - 1;
z = ((TileEntityDummyArray) tileEntity).getTrueXCoord() + 0.5f;
}
break;
}
case DOWN:
{
xScale = zScale = chargeLevel;
yShift = -0.001f;
xRotate = 1;
rotationAngle = (-90 * (rotation + 2)) % 360;
facingCorrectionAngle = (-90 * (playerFacing + 2)) % 360;
if (tileEntity instanceof TileEntityAlchemyArray)
{
y += 1;
}
break;
}
case NORTH:
{
xScale = yScale = chargeLevel;
zCorrection = -1;
zShift = -0.001f;
zRotate = 1;
rotationAngle = (-90 * (rotation + 1)) % 360;
if (tileEntity instanceof TileEntityAlchemyArray)
{
z += 1;
}
break;
}
case SOUTH:
{
xScale = yScale = chargeLevel;
zShift = 0.001f;
zRotate = -1;
rotationAngle = (-90 * (rotation + 1)) % 360;
if (tileEntity instanceof TileEntityAlchemyArray)
{
z -= 1;
}
break;
}
case EAST:
{
yScale = zScale = chargeLevel;
xShift = 0.001f;
yRotate = 1;
rotationAngle = (-90 * (rotation + 2)) % 360;
if (tileEntity instanceof TileEntityAlchemyArray)
{
x -= 1;
}
break;
}
case WEST:
{
yScale = zScale = chargeLevel;
xShift = -0.001f;
yRotate = -1;
rotationAngle = (-90 * (rotation + 2)) % 360;
if (tileEntity instanceof TileEntityAlchemyArray)
{
x += 1;
}
break;
}
default:
break;
}
if (shouldRender)
{
GL11.glDepthMask(false);
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glPushMatrix();
GL11.glTranslated(-iPX + x + xShift, -iPY + y + yShift, -iPZ + z + zShift);
GL11.glScalef(1F * xScale, 1F * yScale, 1F * zScale);
GL11.glRotatef(rotationAngle, sideHit.offsetX, sideHit.offsetY, sideHit.offsetZ);
GL11.glRotatef(facingCorrectionAngle, sideHit.offsetX, sideHit.offsetY, sideHit.offsetZ);
GL11.glRotatef(90, xRotate, yRotate, zRotate);
GL11.glTranslated(0, 0, 0.5f * zCorrection);
GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
RenderUtils.renderPulsingQuad(texture, 1f);
GL11.glPopMatrix();
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glDepthMask(true);
}
}
}
private boolean canPlaceAlchemyArray(ItemStack itemStack, World world, int x, int y, int z, int side)
{
ChalkSettings chalkSettings = EquivalentExchange3.proxy.getClientProxy().chalkSettings;
int coordOffset = chalkSettings.getSize() - 1;
ForgeDirection orientation = ForgeDirection.getOrientation(side);
AlchemyArray alchemyArray = AlchemyArrayRegistry.getInstance().getAlchemyArray(chalkSettings.getIndex());
boolean canPlaceAlchemyArray = isValidForArray(world, x, y, z, side);
int chargeLevel = ((chalkSettings.getSize() - 1) * 2) + 1;
if (itemStack.getItemDamage() == itemStack.getMaxDamage() && (chargeLevel * chargeLevel) * alchemyArray.getChalkCostPerBlock() == 1)
{
canPlaceAlchemyArray = true;
}
else if (itemStack.getMaxDamage() - itemStack.getItemDamage() + 1 < (chargeLevel * chargeLevel) * alchemyArray.getChalkCostPerBlock())
{
canPlaceAlchemyArray = false;
}
if (canPlaceAlchemyArray)
{
if (orientation == ForgeDirection.UP || orientation == ForgeDirection.DOWN)
{
for (int i = x - coordOffset; i <= x + coordOffset; i++)
{
for (int j = z - coordOffset; j <= z + coordOffset; j++)
{
if ((i != x || j != z) && (!isValidForArray(world, i, y, j, side)))
{
canPlaceAlchemyArray = false;
}
}
}
}
else if (orientation == ForgeDirection.NORTH || orientation == ForgeDirection.SOUTH)
{
for (int i = x - coordOffset; i <= x + coordOffset; i++)
{
for (int j = y - coordOffset; j <= y + coordOffset; j++)
{
if ((i != x || j != y) && (!isValidForArray(world, i, j, z, side)))
{
canPlaceAlchemyArray = false;
}
}
}
}
else if (orientation == ForgeDirection.EAST || orientation == ForgeDirection.WEST)
{
for (int i = y - coordOffset; i <= y + coordOffset; i++)
{
for (int j = z - coordOffset; j <= z + coordOffset; j++)
{
if ((i != y || j != z) && (!isValidForArray(world, x, i, j, side)))
{
canPlaceAlchemyArray = false;
}
}
}
}
}
return canPlaceAlchemyArray;
}
private boolean isValidForArray(World world, int x, int y, int z, int sideHit)
{
ForgeDirection side = ForgeDirection.getOrientation(sideHit);
return world.isSideSolid(x, y, z, side) && ((side == ForgeDirection.DOWN && world.getBlock(x, y - 1, z).isReplaceable(world, x, y, z)) ||
(side == ForgeDirection.UP && world.getBlock(x, y + 1, z).isReplaceable(world, x, y, z)) ||
(side == ForgeDirection.NORTH && world.getBlock(x, y, z - 1).isReplaceable(world, x, y, z)) ||
(side == ForgeDirection.SOUTH && world.getBlock(x, y, z + 1).isReplaceable(world, x, y, z)) ||
(side == ForgeDirection.WEST && world.getBlock(x - 1, y, z).isReplaceable(world, x, y, z)) ||
(side == ForgeDirection.EAST && world.getBlock(x + 1, y, z).isReplaceable(world, x, y, z)));
}
private void drawSelectionBox(RenderGlobal context, EntityPlayer entityPlayer, MovingObjectPosition rayTrace, int i, float partialTicks)
{
if (i == 0 && rayTrace.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)

View file

@ -0,0 +1,251 @@
package com.pahimar.ee3.client.renderer.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import org.lwjgl.opengl.GL11;
public class ModelTransmutationTablet extends ModelBase
{
public ModelRenderer wick_LF;
public ModelRenderer CirclePad;
public ModelRenderer Candle_LB;
public ModelRenderer wick_RB;
public ModelRenderer wick_RF;
public ModelRenderer wick_LB;
public ModelRenderer pedRB3;
public ModelRenderer pedRB1;
public ModelRenderer pedRB4;
public ModelRenderer pedRB2;
public ModelRenderer pedLB1;
public ModelRenderer pedLB2;
public ModelRenderer pedLB3;
public ModelRenderer pedLB4;
public ModelRenderer pedRF1;
public ModelRenderer pedRF2;
public ModelRenderer pedRF3;
public ModelRenderer pedRF4;
public ModelRenderer pedLF1;
public ModelRenderer pedLF2;
public ModelRenderer pedLF3;
public ModelRenderer pedLF4;
public ModelRenderer Base;
public ModelRenderer Candle_LB_1;
public ModelRenderer Candle_LB_2;
public ModelRenderer Candle_LB_3;
public ModelRenderer Candle_LB_4;
public ModelRenderer Candle_LF;
public ModelRenderer Candle_drib2;
public ModelRenderer Candle_drib3;
public ModelRenderer Candle_drib1;
public ModelRenderer Candle_drib4;
public ModelRenderer Candle_RF;
public ModelRenderer Candle_drib5;
public ModelRenderer Candle_drib6;
public ModelRenderer Candle_drib7;
public ModelRenderer Candle_drib8;
public ModelRenderer Candle_drib9;
public ModelRenderer Candle_drib10;
public ModelTransmutationTablet()
{
this.textureWidth = 256;
this.textureHeight = 128;
this.wick_RF = new ModelRenderer(this, 64, 69);
this.wick_RF.setRotationPoint(0.0F, 0.0F, 0.0F);
this.wick_RF.addBox(30.3F, -2.0F, -31.3F, 1, 2, 1, 0.0F);
this.Candle_drib9 = new ModelRenderer(this, 48, 59);
this.Candle_drib9.setRotationPoint(0.0F, 0.0F, 0.0F);
this.Candle_drib9.addBox(20.0F, 2.0F, -19.0F, 1, 4, 1, 0.0F);
this.Candle_LB_4 = new ModelRenderer(this, 48, 59);
this.Candle_LB_4.setRotationPoint(0.0F, 0.0F, 0.0F);
this.Candle_LB_4.addBox(-19.0F, 4.0F, 20.0F, 1, 2, 1, 0.0F);
this.Candle_drib5 = new ModelRenderer(this, 48, 59);
this.Candle_drib5.setRotationPoint(0.0F, 0.0F, 0.0F);
this.Candle_drib5.addBox(16.0F, 3.0F, -19.0F, 1, 3, 1, 0.0F);
this.pedLB4 = new ModelRenderer(this, 64, 58);
this.pedLB4.setRotationPoint(0.0F, 0.0F, 0.0F);
this.pedLB4.addBox(16.0F, 14.0F, 16.0F, 5, 2, 5, 0.0F);
this.CirclePad = new ModelRenderer(this, 80, 38);
this.CirclePad.setRotationPoint(0.0F, 0.0F, 0.0F);
this.CirclePad.addBox(-16.0F, 14.0F, -16.0F, 32, 2, 32, 0.0F);
this.Candle_LB_2 = new ModelRenderer(this, 48, 59);
this.Candle_LB_2.setRotationPoint(0.0F, 0.0F, 0.0F);
this.Candle_LB_2.addBox(-21.0F, 3.0F, 18.0F, 1, 3, 1, 0.0F);
this.pedLB2 = new ModelRenderer(this, 64, 58);
this.pedLB2.setRotationPoint(0.0F, 0.0F, 0.0F);
this.pedLB2.addBox(16.0F, 8.0F, 16.0F, 5, 2, 5, 0.0F);
this.Candle_drib8 = new ModelRenderer(this, 48, 59);
this.Candle_drib8.setRotationPoint(0.0F, 0.0F, 0.0F);
this.Candle_drib8.addBox(18.0F, 5.0F, 20.0F, 1, 1, 1, 0.0F);
this.pedLF3 = new ModelRenderer(this, 84, 58);
this.pedLF3.setRotationPoint(0.0F, 0.0F, 0.0F);
this.pedLF3.addBox(-20.0F, 10.0F, 17.0F, 3, 4, 3, 0.0F);
this.Candle_RF = new ModelRenderer(this, 48, 59);
this.Candle_RF.setRotationPoint(0.0F, 0.0F, 0.0F);
this.Candle_RF.addBox(17.0F, 0.0F, -20.0F, 3, 6, 3, 0.0F);
this.Candle_drib4 = new ModelRenderer(this, 48, 59);
this.Candle_drib4.setRotationPoint(0.0F, 0.0F, 0.0F);
this.Candle_drib4.addBox(18.0F, 4.0F, -21.0F, 1, 2, 1, 0.0F);
this.wick_RB = new ModelRenderer(this, 64, 69);
this.wick_RB.setRotationPoint(0.0F, 0.0F, 0.0F);
this.wick_RB.addBox(30.3F, -2.0F, 30.3F, 1, 2, 1, 0.0F);
this.Candle_LB = new ModelRenderer(this, 48, 59);
this.Candle_LB.setRotationPoint(0.0F, 0.0F, 0.0F);
this.Candle_LB.addBox(-19.0F, 5.0F, 16.0F, 1, 1, 1, 0.0F);
this.pedRF2 = new ModelRenderer(this, 64, 58);
this.pedRF2.setRotationPoint(0.0F, 0.0F, 0.0F);
this.pedRF2.addBox(-21.0F, 8.0F, -21.0F, 5, 2, 5, 0.0F);
this.pedLF2 = new ModelRenderer(this, 64, 58);
this.pedLF2.setRotationPoint(0.0F, 0.0F, 0.0F);
this.pedLF2.addBox(-21.0F, 8.0F, 16.0F, 5, 2, 5, 0.0F);
this.pedRB3 = new ModelRenderer(this, 84, 58);
this.pedRB3.setRotationPoint(0.0F, 0.0F, 0.0F);
this.pedRB3.addBox(17.0F, 10.0F, -20.0F, 3, 4, 3, 0.0F);
this.pedRB4 = new ModelRenderer(this, 64, 58);
this.pedRB4.setRotationPoint(0.0F, 0.0F, 0.0F);
this.pedRB4.addBox(16.0F, 14.0F, -21.0F, 5, 2, 5, 0.0F);
this.pedRF4 = new ModelRenderer(this, 64, 58);
this.pedRF4.setRotationPoint(0.0F, 0.0F, 0.0F);
this.pedRF4.addBox(-21.0F, 14.0F, -21.0F, 5, 2, 5, 0.0F);
this.Candle_drib3 = new ModelRenderer(this, 48, 59);
this.Candle_drib3.setRotationPoint(0.0F, 0.0F, 0.0F);
this.Candle_drib3.addBox(-17.0F, 4.0F, -19.0F, 1, 2, 1, 0.0F);
this.pedRB2 = new ModelRenderer(this, 64, 58);
this.pedRB2.setRotationPoint(0.0F, 0.0F, 0.0F);
this.pedRB2.addBox(16.0F, 8.0F, -21.0F, 5, 2, 5, 0.0F);
this.wick_LF = new ModelRenderer(this, 64, 69);
this.wick_LF.setRotationPoint(0.0F, 0.0F, 0.0F);
this.wick_LF.addBox(-31.3F, -2.0F, -31.3F, 1, 2, 1, 0.0F);
this.wick_LB = new ModelRenderer(this, 64, 69);
this.wick_LB.setRotationPoint(0.0F, 0.0F, 0.0F);
this.wick_LB.addBox(-31.3F, -2.0F, 30.3F, 1, 2, 1, 0.0F);
this.pedLF1 = new ModelRenderer(this, 64, 50);
this.pedLF1.setRotationPoint(0.0F, 0.0F, 0.0F);
this.pedLF1.addBox(-21.5F, 6.0F, 15.5F, 6, 2, 6, 0.0F);
this.pedRF3 = new ModelRenderer(this, 84, 58);
this.pedRF3.setRotationPoint(0.0F, 0.0F, 0.0F);
this.pedRF3.addBox(-20.0F, 10.0F, -20.0F, 3, 4, 3, 0.0F);
this.pedLB1 = new ModelRenderer(this, 64, 50);
this.pedLB1.setRotationPoint(0.0F, 0.0F, 0.0F);
this.pedLB1.addBox(15.5F, 6.0F, 15.5F, 6, 2, 6, 0.0F);
this.Candle_drib7 = new ModelRenderer(this, 48, 59);
this.Candle_drib7.setRotationPoint(0.0F, 0.0F, 0.0F);
this.Candle_drib7.addBox(17.0F, 0.0F, 17.0F, 3, 6, 3, 0.0F);
this.pedRB1 = new ModelRenderer(this, 64, 50);
this.pedRB1.setRotationPoint(0.0F, 0.0F, 0.0F);
this.pedRB1.addBox(15.5F, 6.0F, -21.5F, 6, 2, 6, 0.0F);
this.pedLF4 = new ModelRenderer(this, 64, 58);
this.pedLF4.setRotationPoint(0.0F, 0.0F, 0.0F);
this.pedLF4.addBox(-21.0F, 14.0F, 16.0F, 5, 2, 5, 0.0F);
this.Candle_drib6 = new ModelRenderer(this, 48, 59);
this.Candle_drib6.setRotationPoint(0.0F, 0.0F, 0.0F);
this.Candle_drib6.addBox(20.0F, 4.0F, 17.9F, 1, 2, 1, 0.0F);
this.Candle_LB_3 = new ModelRenderer(this, 48, 59);
this.Candle_LB_3.setRotationPoint(0.0F, 0.0F, 0.0F);
this.Candle_LB_3.addBox(-17.0F, 3.0F, 18.0F, 1, 3, 1, 0.0F);
this.Candle_drib10 = new ModelRenderer(this, 48, 59);
this.Candle_drib10.setRotationPoint(0.0F, 0.0F, 0.0F);
this.Candle_drib10.addBox(18.0F, 3.0F, 16.0F, 1, 3, 1, 0.0F);
this.Candle_drib1 = new ModelRenderer(this, 48, 59);
this.Candle_drib1.setRotationPoint(0.0F, 0.0F, 0.0F);
this.Candle_drib1.addBox(-19.0F, 2.0F, -21.0F, 1, 4, 1, 0.0F);
this.Candle_drib2 = new ModelRenderer(this, 48, 59);
this.Candle_drib2.setRotationPoint(0.0F, 0.0F, 0.0F);
this.Candle_drib2.addBox(-21.0F, 5.0F, -19.0F, 1, 1, 1, 0.0F);
this.Candle_LB_1 = new ModelRenderer(this, 48, 59);
this.Candle_LB_1.setRotationPoint(0.0F, 0.0F, 0.0F);
this.Candle_LB_1.addBox(-20.0F, 0.0F, 17.0F, 3, 6, 3, 0.0F);
this.pedLB3 = new ModelRenderer(this, 84, 58);
this.pedLB3.setRotationPoint(0.0F, 0.0F, 0.0F);
this.pedLB3.addBox(17.0F, 10.0F, 17.0F, 3, 4, 3, 0.0F);
this.pedRF1 = new ModelRenderer(this, 64, 50);
this.pedRF1.setRotationPoint(0.0F, 0.0F, 0.0F);
this.pedRF1.addBox(-21.5F, 6.0F, -21.5F, 6, 2, 6, 0.0F);
this.Base = new ModelRenderer(this, 0, 72);
this.Base.setRotationPoint(0.0F, 0.0F, 0.0F);
this.Base.addBox(-24.0F, 16.0F, -24.0F, 48, 8, 48, 0.0F);
this.Candle_LF = new ModelRenderer(this, 48, 59);
this.Candle_LF.setRotationPoint(0.0F, 0.0F, 0.0F);
this.Candle_LF.addBox(-20.0F, 0.0F, -20.0F, 3, 6, 3, 0.0F);
}
@Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
{
GL11.glPushMatrix();
GL11.glTranslatef(this.wick_RF.offsetX, this.wick_RF.offsetY, this.wick_RF.offsetZ);
GL11.glTranslatef(this.wick_RF.rotationPointX * f5, this.wick_RF.rotationPointY * f5, this.wick_RF.rotationPointZ * f5);
GL11.glScaled(0.6D, 1.0D, 0.6D);
GL11.glTranslatef(-this.wick_RF.offsetX, -this.wick_RF.offsetY, -this.wick_RF.offsetZ);
GL11.glTranslatef(-this.wick_RF.rotationPointX * f5, -this.wick_RF.rotationPointY * f5, -this.wick_RF.rotationPointZ * f5);
this.wick_RF.render(f5);
GL11.glPopMatrix();
this.Candle_drib9.render(f5);
this.Candle_LB_4.render(f5);
this.Candle_drib5.render(f5);
this.pedLB4.render(f5);
this.CirclePad.render(f5);
this.Candle_LB_2.render(f5);
this.pedLB2.render(f5);
this.Candle_drib8.render(f5);
this.pedLF3.render(f5);
this.Candle_RF.render(f5);
this.Candle_drib4.render(f5);
GL11.glPushMatrix();
GL11.glTranslatef(this.wick_RB.offsetX, this.wick_RB.offsetY, this.wick_RB.offsetZ);
GL11.glTranslatef(this.wick_RB.rotationPointX * f5, this.wick_RB.rotationPointY * f5, this.wick_RB.rotationPointZ * f5);
GL11.glScaled(0.6D, 1.0D, 0.6D);
GL11.glTranslatef(-this.wick_RB.offsetX, -this.wick_RB.offsetY, -this.wick_RB.offsetZ);
GL11.glTranslatef(-this.wick_RB.rotationPointX * f5, -this.wick_RB.rotationPointY * f5, -this.wick_RB.rotationPointZ * f5);
this.wick_RB.render(f5);
GL11.glPopMatrix();
this.Candle_LB.render(f5);
this.pedRF2.render(f5);
this.pedLF2.render(f5);
this.pedRB3.render(f5);
this.pedRB4.render(f5);
this.pedRF4.render(f5);
this.Candle_drib3.render(f5);
this.pedRB2.render(f5);
GL11.glPushMatrix();
GL11.glTranslatef(this.wick_LF.offsetX, this.wick_LF.offsetY, this.wick_LF.offsetZ);
GL11.glTranslatef(this.wick_LF.rotationPointX * f5, this.wick_LF.rotationPointY * f5, this.wick_LF.rotationPointZ * f5);
GL11.glScaled(0.6D, 1.0D, 0.6D);
GL11.glTranslatef(-this.wick_LF.offsetX, -this.wick_LF.offsetY, -this.wick_LF.offsetZ);
GL11.glTranslatef(-this.wick_LF.rotationPointX * f5, -this.wick_LF.rotationPointY * f5, -this.wick_LF.rotationPointZ * f5);
this.wick_LF.render(f5);
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslatef(this.wick_LB.offsetX, this.wick_LB.offsetY, this.wick_LB.offsetZ);
GL11.glTranslatef(this.wick_LB.rotationPointX * f5, this.wick_LB.rotationPointY * f5, this.wick_LB.rotationPointZ * f5);
GL11.glScaled(0.6D, 1.0D, 0.6D);
GL11.glTranslatef(-this.wick_LB.offsetX, -this.wick_LB.offsetY, -this.wick_LB.offsetZ);
GL11.glTranslatef(-this.wick_LB.rotationPointX * f5, -this.wick_LB.rotationPointY * f5, -this.wick_LB.rotationPointZ * f5);
this.wick_LB.render(f5);
GL11.glPopMatrix();
this.pedLF1.render(f5);
this.pedRF3.render(f5);
this.pedLB1.render(f5);
this.Candle_drib7.render(f5);
this.pedRB1.render(f5);
this.pedLF4.render(f5);
this.Candle_drib6.render(f5);
this.Candle_LB_3.render(f5);
this.Candle_drib10.render(f5);
this.Candle_drib1.render(f5);
this.Candle_drib2.render(f5);
this.Candle_LB_1.render(f5);
this.pedLB3.render(f5);
this.pedRF1.render(f5);
this.Base.render(f5);
this.Candle_LF.render(f5);
}
public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z)
{
modelRenderer.rotateAngleX = x;
modelRenderer.rotateAngleY = y;
modelRenderer.rotateAngleZ = z;
}
}

View file

@ -1,6 +1,7 @@
package com.pahimar.ee3.client.renderer.tileentity;
import com.pahimar.ee3.api.AlchemyArray;
import com.pahimar.ee3.api.ICustomAlchemyArrayRender;
import com.pahimar.ee3.client.util.RenderUtils;
import com.pahimar.ee3.tileentity.TileEntityAlchemyArray;
import cpw.mods.fml.client.FMLClientHandler;
@ -21,181 +22,188 @@ public class TileEntityRendererAlchemyArray extends TileEntitySpecialRenderer
{
TileEntityAlchemyArray tileEntityAlchemyArray = (TileEntityAlchemyArray) FMLClientHandler.instance().getClient().theWorld.getTileEntity(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
int scale = 1;
double xShift = 0.5d, yShift = 0.5d, zShift = 0.5d;
float xRotate = 0, yRotate = 0, zRotate = 0;
int rotationAngle = 0;
AlchemyArray alchemyArray = tileEntityAlchemyArray.getAlchemyArray();
if (tileEntityAlchemyArray.getSize() == 1)
{
scale = 1;
}
else if (tileEntityAlchemyArray.getSize() == 2)
{
scale = 3;
}
else if (tileEntityAlchemyArray.getSize() == 3)
{
scale = 5;
}
if (alchemyArray != null)
{
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glPushMatrix();
GL11.glDepthMask(false);
GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.UP)
if (alchemyArray instanceof ICustomAlchemyArrayRender)
{
if (tileEntityAlchemyArray.getRotation() == ForgeDirection.NORTH)
{
rotationAngle = 0;
}
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.EAST)
{
rotationAngle = -90;
}
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.SOUTH)
{
rotationAngle = 180;
}
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.WEST)
{
rotationAngle = 90;
}
yShift = 0.001d;
xRotate = -1;
((ICustomAlchemyArrayRender) alchemyArray).doCustomRendering(tileEntity, x, y, z, tileEntityAlchemyArray.getSize(), tileEntityAlchemyArray.getOrientation(), tileEntityAlchemyArray.getRotation(), tick);
}
else if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.DOWN)
else
{
if (tileEntityAlchemyArray.getRotation() == ForgeDirection.NORTH)
int scale = 1;
double xShift = 0.5d, yShift = 0.5d, zShift = 0.5d;
float xRotate = 0, yRotate = 0, zRotate = 0;
int rotationAngle = 0;
if (tileEntityAlchemyArray.getSize() == 1)
{
rotationAngle = 0;
scale = 1;
}
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.EAST)
else if (tileEntityAlchemyArray.getSize() == 2)
{
rotationAngle = -90;
scale = 3;
}
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.SOUTH)
else if (tileEntityAlchemyArray.getSize() == 3)
{
rotationAngle = 180;
}
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.WEST)
{
rotationAngle = 90;
scale = 5;
}
yShift = 0.999d;
xRotate = 1;
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glPushMatrix();
GL11.glDepthMask(false);
GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.UP)
{
if (tileEntityAlchemyArray.getRotation() == ForgeDirection.NORTH)
{
rotationAngle = 0;
}
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.EAST)
{
rotationAngle = -90;
}
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.SOUTH)
{
rotationAngle = 180;
}
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.WEST)
{
rotationAngle = 90;
}
yShift = 0.001d;
xRotate = -1;
}
else if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.DOWN)
{
if (tileEntityAlchemyArray.getRotation() == ForgeDirection.NORTH)
{
rotationAngle = 0;
}
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.EAST)
{
rotationAngle = -90;
}
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.SOUTH)
{
rotationAngle = 180;
}
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.WEST)
{
rotationAngle = 90;
}
yShift = 0.999d;
xRotate = 1;
}
else if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.NORTH)
{
if (tileEntityAlchemyArray.getRotation() == ForgeDirection.UP)
{
rotationAngle = -90;
}
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.EAST)
{
rotationAngle = -180;
}
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.DOWN)
{
rotationAngle = 90;
}
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.WEST)
{
rotationAngle = 0;
}
zRotate = 1;
zShift = 0.999d;
}
else if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.SOUTH)
{
if (tileEntityAlchemyArray.getRotation() == ForgeDirection.UP)
{
rotationAngle = -90;
}
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.EAST)
{
rotationAngle = 0;
}
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.DOWN)
{
rotationAngle = 90;
}
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.WEST)
{
rotationAngle = -180;
}
zRotate = -1;
zShift = 0.001d;
}
else if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.EAST)
{
if (tileEntityAlchemyArray.getRotation() == ForgeDirection.UP)
{
rotationAngle = 180;
}
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.DOWN)
{
rotationAngle = 0;
}
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.NORTH)
{
rotationAngle = -90;
}
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.SOUTH)
{
rotationAngle = 90;
}
yRotate = 1;
xShift = 0.001d;
}
else if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.WEST)
{
if (tileEntityAlchemyArray.getRotation() == ForgeDirection.UP)
{
rotationAngle = 180;
}
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.DOWN)
{
rotationAngle = 0;
}
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.NORTH)
{
rotationAngle = 90;
}
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.SOUTH)
{
rotationAngle = -90;
}
yRotate = -1;
xShift = 0.999d;
}
GL11.glPushMatrix();
GL11.glTranslated(x + xShift, y + yShift, z + zShift);
GL11.glScalef(1f * scale, 1f * scale, 1f * scale);
GL11.glRotatef(rotationAngle, tileEntityAlchemyArray.getOrientation().offsetX, tileEntityAlchemyArray.getOrientation().offsetY, tileEntityAlchemyArray.getOrientation().offsetZ);
GL11.glRotatef(90, xRotate, yRotate, zRotate);
RenderUtils.renderQuad(alchemyArray.getTexture());
GL11.glPopMatrix();
GL11.glDepthMask(true);
GL11.glPopMatrix();
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_CULL_FACE);
}
else if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.NORTH)
{
if (tileEntityAlchemyArray.getRotation() == ForgeDirection.UP)
{
rotationAngle = -90;
}
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.EAST)
{
rotationAngle = -180;
}
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.DOWN)
{
rotationAngle = 90;
}
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.WEST)
{
rotationAngle = 0;
}
zRotate = 1;
zShift = 0.999d;
}
else if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.SOUTH)
{
if (tileEntityAlchemyArray.getRotation() == ForgeDirection.UP)
{
rotationAngle = -90;
}
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.EAST)
{
rotationAngle = 0;
}
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.DOWN)
{
rotationAngle = 90;
}
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.WEST)
{
rotationAngle = -180;
}
zRotate = -1;
zShift = 0.001d;
}
else if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.EAST)
{
if (tileEntityAlchemyArray.getRotation() == ForgeDirection.UP)
{
rotationAngle = 180;
}
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.DOWN)
{
rotationAngle = 0;
}
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.NORTH)
{
rotationAngle = -90;
}
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.SOUTH)
{
rotationAngle = 90;
}
yRotate = 1;
xShift = 0.001d;
}
else if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.WEST)
{
if (tileEntityAlchemyArray.getRotation() == ForgeDirection.UP)
{
rotationAngle = 180;
}
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.DOWN)
{
rotationAngle = 0;
}
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.NORTH)
{
rotationAngle = 90;
}
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.SOUTH)
{
rotationAngle = -90;
}
yRotate = -1;
xShift = 0.999d;
}
GL11.glPushMatrix();
GL11.glTranslated(x + xShift, y + yShift, z + zShift);
GL11.glScalef(1f * scale, 1f * scale, 1f * scale);
GL11.glRotatef(rotationAngle, tileEntityAlchemyArray.getOrientation().offsetX, tileEntityAlchemyArray.getOrientation().offsetY, tileEntityAlchemyArray.getOrientation().offsetZ);
GL11.glRotatef(90, xRotate, yRotate, zRotate);
RenderUtils.renderQuad(alchemyArray.getTexture());
GL11.glPopMatrix();
GL11.glDepthMask(true);
GL11.glPopMatrix();
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_CULL_FACE);
}
}
}

View file

@ -0,0 +1,69 @@
package com.pahimar.ee3.client.renderer.tileentity;
import com.pahimar.ee3.client.renderer.model.ModelTransmutationTablet;
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.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
@SideOnly(Side.CLIENT)
public class TileEntityRendererTransmutationTablet extends TileEntitySpecialRenderer
{
private final ModelTransmutationTablet modelTransmutationTablet = new ModelTransmutationTablet();
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick)
{
if (tileEntity instanceof TileEntityTransmutationTablet)
{
TileEntityTransmutationTablet tileEntityTransmutationTablet = (TileEntityTransmutationTablet) tileEntity;
ForgeDirection direction = null;
if (tileEntityTransmutationTablet.getWorldObj() != null)
{
direction = tileEntityTransmutationTablet.getOrientation();
}
this.bindTexture(Textures.Model.TRANSMUTATION_TABLET);
GL11.glPushMatrix();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glTranslatef((float) x, (float) y + 1.0F, (float) z + 1.0F);
GL11.glScalef(1.0F, -1.0F, -1.0F);
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
short angle = 0;
if (direction != null)
{
if (direction == ForgeDirection.NORTH)
{
angle = 180;
}
else if (direction == ForgeDirection.SOUTH)
{
angle = 0;
}
else if (direction == ForgeDirection.WEST)
{
angle = 90;
}
else if (direction == ForgeDirection.EAST)
{
angle = -90;
}
}
GL11.glRotatef(angle, 0.0F, 1.0F, 0.0F);
// GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
modelTransmutationTablet.render(null, 0.0625f, 0.0625f, 0.0625f, 0.0625f, 0.0625f, 0.0625f);
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
}
}

View file

@ -8,7 +8,6 @@ import com.pahimar.ee3.knowledge.AbilityRegistry;
import com.pahimar.ee3.recipe.RecipeRegistry;
import com.pahimar.ee3.reference.Files;
import com.pahimar.ee3.reference.Reference;
import com.pahimar.ee3.reference.Settings;
import com.pahimar.ee3.util.*;
import cpw.mods.fml.common.FMLCommonHandler;
import net.minecraft.item.Item;
@ -737,21 +736,23 @@ public class EnergyValueRegistry implements INBTTaggable, JsonSerializer<EnergyV
NBTTagCompound nbtTagCompound = null;
if (Settings.DynamicEnergyValueGeneration.regenerateEnergyValuesWhen.equalsIgnoreCase("Never"))
{
if (staticEnergyValuesFile.exists())
{
LogHelper.info("Attempting to load energy values from file: " + staticEnergyValuesFile.getAbsolutePath());
nbtTagCompound = SerializationHelper.readNBTFromFile(staticEnergyValuesFile);
}
else if (md5EnergyValuesFile.exists())
{
LogHelper.info("Attempting to load energy values from file: " + md5EnergyValuesFile.getAbsolutePath());
nbtTagCompound = SerializationHelper.readNBTFromFile(md5EnergyValuesFile);
}
}
else if (md5EnergyValuesFile.exists())
// TODO Re-enable this once the NPE related to mod changes in the serialized value file bug is resolved
// if (Settings.DynamicEnergyValueGeneration.regenerateEnergyValuesWhen.equalsIgnoreCase("Never"))
// {
// if (staticEnergyValuesFile.exists())
// {
// LogHelper.info("Attempting to load energy values from file: " + staticEnergyValuesFile.getAbsolutePath());
// nbtTagCompound = SerializationHelper.readNBTFromFile(staticEnergyValuesFile);
// }
// else if (md5EnergyValuesFile.exists())
// {
// LogHelper.info("Attempting to load energy values from file: " + md5EnergyValuesFile.getAbsolutePath());
// nbtTagCompound = SerializationHelper.readNBTFromFile(md5EnergyValuesFile);
// }
//
// }
// else if (md5EnergyValuesFile.exists())
if (md5EnergyValuesFile.exists())
{
LogHelper.info("Attempting to load energy values from file: " + md5EnergyValuesFile.getAbsolutePath());
nbtTagCompound = SerializationHelper.readNBTFromFile(md5EnergyValuesFile);

View file

@ -51,6 +51,10 @@ public class GuiHandler implements IGuiHandler
TileEntityAugmentationTable tileEntityAugmentationTable = (TileEntityAugmentationTable) world.getTileEntity(x, y, z);
return new ContainerAugmentationTable(entityPlayer.inventory, tileEntityAugmentationTable);
}
else if (id == GUIs.TRANSMUTATION_TABLET.ordinal())
{
return new ContainerTransmutationTablet(entityPlayer.inventory);
}
else if (id == GUIs.SYMBOL_SELECTION.ordinal())
{
return new ContainerSymbolSelection();
@ -100,6 +104,10 @@ public class GuiHandler implements IGuiHandler
TileEntityAugmentationTable tileEntityAugmentationTable = (TileEntityAugmentationTable) world.getTileEntity(x, y, z);
return new GuiAugmentationTable(entityPlayer.inventory, tileEntityAugmentationTable);
}
else if (id == GUIs.TRANSMUTATION_TABLET.ordinal())
{
return new GuiTransmutationTablet(entityPlayer.inventory);
}
else if (id == GUIs.SYMBOL_SELECTION.ordinal())
{
return new GuiSymbolSelection();

View file

@ -2,14 +2,14 @@ package com.pahimar.ee3.init;
import com.pahimar.ee3.api.AlchemyArray;
import com.pahimar.ee3.api.AlchemyArrayRegistryProxy;
import com.pahimar.ee3.array.BasicAlchemyArray;
import com.pahimar.ee3.array.TransmutationAlchemyArray;
public class AlchemyArrays
{
public static final AlchemyArray basicAlchemyArray = new BasicAlchemyArray();
public static final AlchemyArray transmutationAlchemyArray = new TransmutationAlchemyArray();
public static void registerAlchemyArrays()
{
AlchemyArrayRegistryProxy.registerAlchemyArray(basicAlchemyArray);
AlchemyArrayRegistryProxy.registerAlchemyArray(transmutationAlchemyArray);
}
}

View file

@ -21,6 +21,7 @@ public class ModBlocks
public static final BlockEE ashInfusedStone = new BlockAshInfusedStone();
public static final BlockEE alchemyArray = new BlockAlchemyArray();
public static final BlockEE dummyArray = new BlockDummyArray();
public static final BlockEE transmutationTablet = new BlockTransmutationTablet();
public static void init()
{
@ -35,5 +36,6 @@ public class ModBlocks
GameRegistry.registerBlock(ashInfusedStone, Names.Blocks.ASH_INFUSED_STONE);
GameRegistry.registerBlock(alchemyArray, Names.Blocks.ALCHEMY_ARRAY);
GameRegistry.registerBlock(dummyArray, Names.Blocks.DUMMY_ARRAY);
GameRegistry.registerBlock(transmutationTablet, Names.Blocks.TRANSMUTATION_TABLET);
}
}

View file

@ -19,5 +19,6 @@ public class TileEntities
GameRegistry.registerTileEntity(TileEntityAugmentationTable.class, Names.Blocks.AUGMENTATION_TABLE);
GameRegistry.registerTileEntity(TileEntityAlchemyArray.class, Names.Blocks.ALCHEMY_ARRAY);
GameRegistry.registerTileEntity(TileEntityDummyArray.class, Names.Blocks.DUMMY_ARRAY);
GameRegistry.registerTileEntity(TileEntityTransmutationTablet.class, Names.Blocks.TRANSMUTATION_TABLET);
}
}

View file

@ -0,0 +1,25 @@
package com.pahimar.ee3.inventory;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
public class ContainerTransmutationTablet extends ContainerEE
{
public ContainerTransmutationTablet(InventoryPlayer inventoryPlayer)
{
// 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, 163 + 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, 221));
}
}
}

View file

@ -1,5 +1,7 @@
package com.pahimar.ee3.item;
import com.pahimar.ee3.api.AlchemyArray;
import com.pahimar.ee3.array.AlchemyArrayRegistry;
import com.pahimar.ee3.init.ModBlocks;
import com.pahimar.ee3.network.PacketHandler;
import com.pahimar.ee3.network.message.MessageChalkSettings;
@ -23,7 +25,7 @@ public class ItemChalk extends ItemEE implements IKeyBound
{
super();
this.setUnlocalizedName(Names.Items.CHALK);
this.setMaxDamage(50);
this.setMaxDamage(49);
this.canRepair = true;
}
@ -78,11 +80,19 @@ public class ItemChalk extends ItemEE implements IKeyBound
NBTTagCompound playerCustomData = EntityHelper.getCustomEntityData(entityPlayer);
ChalkSettings chalkSettings = new ChalkSettings();
chalkSettings.readFromNBT(playerCustomData);
AlchemyArray alchemyArray = AlchemyArrayRegistry.getInstance().getAlchemyArray(chalkSettings.getIndex());
int coordOffset = chalkSettings.getSize() - 1;
ForgeDirection orientation = ForgeDirection.getOrientation(side);
boolean canPlaceAlchemyArray = ModBlocks.alchemyArray.canPlaceBlockOnSide(world, x, y, z, side);
if (itemStack.getMaxDamage() - itemStack.getItemDamage() < (2 * coordOffset) + 1)
int chargeLevel = ((chalkSettings.getSize() - 1) * 2) + 1;
if (itemStack.getItemDamage() == itemStack.getMaxDamage() && (chargeLevel * chargeLevel) * alchemyArray.getChalkCostPerBlock() == 1)
{
canPlaceAlchemyArray = true;
}
else if (itemStack.getMaxDamage() - itemStack.getItemDamage() + 1 < (chargeLevel * chargeLevel) * alchemyArray.getChalkCostPerBlock())
{
canPlaceAlchemyArray = false;
}
@ -221,9 +231,17 @@ public class ItemChalk extends ItemEE implements IKeyBound
if (world.getBlock(x, y, z) == block)
{
itemStack.damageItem(1, entityPlayer);
block.onBlockPlacedBy(world, x, y, z, entityPlayer, itemStack);
block.onPostBlockPlaced(world, x, y, z, metadata);
NBTTagCompound playerCustomData = EntityHelper.getCustomEntityData(entityPlayer);
ChalkSettings chalkSettings = new ChalkSettings();
chalkSettings.readFromNBT(playerCustomData);
AlchemyArray alchemyArray = AlchemyArrayRegistry.getInstance().getAlchemyArray(chalkSettings.getIndex());
if (alchemyArray != null)
{
itemStack.damageItem(alchemyArray.getChalkCostPerBlock(), entityPlayer);
block.onBlockPlacedBy(world, x, y, z, entityPlayer, itemStack);
block.onPostBlockPlaced(world, x, y, z, metadata);
}
}
}

View file

@ -110,6 +110,8 @@ public class MessageTileEntityAlchemyArray implements IMessage, IMessageHandler<
if (tileEntity instanceof TileEntityAlchemyArray)
{
tileEntity.readFromNBT(message.tileEntityAlchemyArrayNBT);
//NAME UPDATE
FMLClientHandler.instance().getClient().theWorld.func_147451_t(tileEntityAlchemyArray.xCoord, tileEntityAlchemyArray.yCoord, tileEntityAlchemyArray.zCoord);
}
}

View file

@ -65,6 +65,7 @@ public class ClientProxy extends CommonProxy
RenderIds.augmentationTable = RenderingRegistry.getNextAvailableRenderId();
RenderIds.alchemyArray = RenderingRegistry.getNextAvailableRenderId();
RenderIds.dummyArray = RenderingRegistry.getNextAvailableRenderId();
RenderIds.tabletSlab = RenderingRegistry.getNextAvailableRenderId();
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.alchemicalChest), new ItemRendererAlchemicalChest());
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.aludel), new ItemRendererAludel());
@ -80,5 +81,6 @@ public class ClientProxy extends CommonProxy
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityResearchStation.class, new TileEntityRendererResearchStation());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAugmentationTable.class, new TileEntityRendererAugmentationTable());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAlchemyArray.class, new TileEntityRendererAlchemyArray());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTransmutationTablet.class, new TileEntityRendererTransmutationTablet());
}
}

View file

@ -11,6 +11,6 @@ public enum GUIs
RESEARCH_STATION,
AUGMENTATION_TABLE,
ALCHEMICAL_TOME,
TRANSMUTATION_SQUARE,
TRANSMUTATION_TABLET,
SYMBOL_SELECTION
}

View file

@ -13,6 +13,7 @@ public class Names
public static final String RESEARCH_STATION = "researchStation";
public static final String AUGMENTATION_TABLE = "augmentationTable";
public static final String ASH_INFUSED_STONE = "ashInfusedStone";
public static final String TRANSMUTATION_TABLET = "transmutationTablet";
public static final String ALCHEMY_ARRAY = "alchemyArray";
public static final String DUMMY_ARRAY = "dummyArray";
}

View file

@ -10,4 +10,5 @@ public class RenderIds
public static int augmentationTable;
public static int alchemyArray;
public static int dummyArray;
public static int tabletSlab;
}

View file

@ -24,6 +24,7 @@ public final class Textures
public static final ResourceLocation GLASS_BELL = ResourceLocationHelper.getResourceLocation(MODEL_TEXTURE_LOCATION + "aludel.png");
public static final ResourceLocation RESEARCH_STATION = ResourceLocationHelper.getResourceLocation(MODEL_TEXTURE_LOCATION + "researchStation.png");
public static final ResourceLocation AUGMENTATION_TABLE = ResourceLocationHelper.getResourceLocation(MODEL_TEXTURE_LOCATION + "augmentationTable.png");
public static final ResourceLocation TRANSMUTATION_TABLET = ResourceLocationHelper.getResourceLocation(MODEL_TEXTURE_LOCATION + "transmutationTablet.png");
}
public static final class Gui
@ -44,7 +45,7 @@ public final class Textures
public static final ResourceLocation AUGMENTATION_TABLE = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "augmentationTable.png");
public static final ResourceLocation PORTABLE_CRAFTING = new ResourceLocation("textures/gui/container/crafting_table.png");
public static final ResourceLocation ALCHEMICAL_TOME = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "alchemicalTome.png");
public static final ResourceLocation TRANSMUTATION_SQUARE = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "transmutationSquare.png");
public static final ResourceLocation TRANSMUTATION_TABLET = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "transmutationTablet.png");
}
public static final class Effect

View file

@ -1,7 +1,6 @@
package com.pahimar.ee3.tileentity;
import com.pahimar.ee3.api.AlchemyArray;
import com.pahimar.ee3.init.AlchemyArrays;
import com.pahimar.ee3.network.PacketHandler;
import com.pahimar.ee3.network.message.MessageTileEntityAlchemyArray;
import cpw.mods.fml.relauncher.Side;
@ -30,7 +29,7 @@ public class TileEntityAlchemyArray extends TileEntityEE implements IInventory
super();
rotation = ForgeDirection.UNKNOWN;
size = 0;
alchemyArray = AlchemyArrays.basicAlchemyArray;
alchemyArray = null;
}
public AlchemyArray getAlchemyArray()
@ -229,6 +228,16 @@ public class TileEntityAlchemyArray extends TileEntityEE implements IInventory
}
}
public int getLightLevel()
{
if (alchemyArray != null)
{
return alchemyArray.getLightLevel();
}
return 0;
}
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack itemStack)
{
onBlockPlacedBy(world, x, y, z, this.xCoord, this.yCoord, this.zCoord, entityLiving, itemStack);
@ -236,7 +245,10 @@ public class TileEntityAlchemyArray extends TileEntityEE implements IInventory
public void onBlockPlacedBy(World world, int eventX, int eventY, int eventZ, int arrayX, int arrayY, int arrayZ, EntityLivingBase entityLiving, ItemStack itemStack)
{
alchemyArray.onArrayPlacedBy(world, eventX, eventY, eventZ, arrayX, arrayY, arrayZ, entityLiving, itemStack);
if (alchemyArray != null)
{
alchemyArray.onArrayPlacedBy(world, eventX, eventY, eventZ, arrayX, arrayY, arrayZ, entityLiving, itemStack);
}
}
public void onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int sideHit, float hitX, float hitY, float hitZ)
@ -246,7 +258,10 @@ public class TileEntityAlchemyArray extends TileEntityEE implements IInventory
public void onBlockActivated(World world, int eventX, int eventY, int eventZ, int arrayX, int arrayY, int arrayZ, EntityPlayer entityPlayer, int sideHit, float hitX, float hitY, float hitZ)
{
alchemyArray.onArrayActivated(world, eventX, eventY, eventZ, arrayX, arrayY, arrayZ, entityPlayer, sideHit, hitX, hitY, hitZ);
if (alchemyArray != null)
{
alchemyArray.onArrayActivated(world, eventX, eventY, eventZ, arrayX, arrayY, arrayZ, entityPlayer, sideHit, hitX, hitY, hitZ);
}
}
public void onBlockClicked(World world, int x, int y, int z, EntityPlayer entityPlayer)
@ -256,7 +271,10 @@ public class TileEntityAlchemyArray extends TileEntityEE implements IInventory
public void onBlockClicked(World world, int eventX, int eventY, int eventZ, int arrayX, int arrayY, int arrayZ, EntityPlayer entityPlayer)
{
alchemyArray.onArrayClicked(world, eventX, eventY, eventZ, arrayX, arrayY, arrayZ, entityPlayer);
if (alchemyArray != null)
{
alchemyArray.onArrayClicked(world, eventX, eventY, eventZ, arrayX, arrayY, arrayZ, entityPlayer);
}
}
public void onBlockDestroyedByExplosion(World world, int x, int y, int z, Explosion explosion)
@ -266,7 +284,10 @@ public class TileEntityAlchemyArray extends TileEntityEE implements IInventory
public void onBlockDestroyedByExplosion(World world, int eventX, int eventY, int eventZ, int arrayX, int arrayY, int arrayZ, Explosion explosion)
{
alchemyArray.onArrayDestroyedByExplosion(world, eventX, eventY, eventZ, arrayX, arrayY, arrayZ, explosion);
if (alchemyArray != null)
{
alchemyArray.onArrayDestroyedByExplosion(world, eventX, eventY, eventZ, arrayX, arrayY, arrayZ, explosion);
}
}
public void onBlockDestroyedByPlayer(World world, int x, int y, int z, int metaData)
@ -276,7 +297,10 @@ public class TileEntityAlchemyArray extends TileEntityEE implements IInventory
public void onBlockDestroyedByPlayer(World world, int eventX, int eventY, int eventZ, int arrayX, int arrayY, int arrayZ, int metaData)
{
alchemyArray.onArrayDestroyedByPlayer(world, eventX, eventY, eventZ, arrayX, arrayY, arrayZ, metaData);
if (alchemyArray != null)
{
alchemyArray.onArrayDestroyedByPlayer(world, eventX, eventY, eventZ, arrayX, arrayY, arrayZ, metaData);
}
}
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity)
@ -286,7 +310,10 @@ public class TileEntityAlchemyArray extends TileEntityEE implements IInventory
public void onEntityCollidedWithBlock(World world, int eventX, int eventY, int eventZ, int arrayX, int arrayY, int arrayZ, Entity entity)
{
alchemyArray.onEntityCollidedWithArray(world, eventX, eventY, eventZ, arrayX, arrayY, arrayZ, entity);
if (alchemyArray != null)
{
alchemyArray.onEntityCollidedWithArray(world, eventX, eventY, eventZ, arrayX, arrayY, arrayZ, entity);
}
}
public void onFallenUpon(World world, int x, int y, int z, Entity entity, float fallDistance)
@ -296,12 +323,18 @@ public class TileEntityAlchemyArray extends TileEntityEE implements IInventory
public void onFallenUpon(World world, int eventX, int eventY, int eventZ, int arrayX, int arrayY, int arrayZ, Entity entity, float fallDistance)
{
alchemyArray.onArrayFallenUpon(world, eventX, eventY, eventZ, arrayX, arrayY, arrayZ, entity, fallDistance);
if (alchemyArray != null)
{
alchemyArray.onArrayFallenUpon(world, eventX, eventY, eventZ, arrayX, arrayY, arrayZ, entity, fallDistance);
}
}
public void onUpdate(World world, int x, int y, int z)
{
alchemyArray.onUpdate(world, x, y, z);
if (alchemyArray != null)
{
alchemyArray.onUpdate(world, x, y, z);
}
}
@Override
@ -317,16 +350,27 @@ public class TileEntityAlchemyArray extends TileEntityEE implements IInventory
rotation = ForgeDirection.getOrientation(nbtTagCompound.getInteger("rotation"));
size = nbtTagCompound.getInteger("size");
NBTTagCompound alchemyArrayTagCompound = nbtTagCompound.getCompoundTag("alchemyArray");
alchemyArray = AlchemyArray.readArrayFromNBT(alchemyArrayTagCompound);
try
if (!alchemyArrayTagCompound.hasNoTags())
{
Class clazz = Class.forName(alchemyArray.getClassName());
alchemyArray = (AlchemyArray) clazz.getConstructor().newInstance();
alchemyArray = AlchemyArray.readArrayFromNBT(alchemyArrayTagCompound);
try
{
Class clazz = Class.forName(alchemyArray.getClassName());
alchemyArray = (AlchemyArray) clazz.getConstructor().newInstance();
}
catch (Exception e)
{
this.invalidate();
if (worldObj != null)
{
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
}
}
}
catch (Exception e)
else
{
this.invalidate();
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
}
}
@ -337,7 +381,10 @@ public class TileEntityAlchemyArray extends TileEntityEE implements IInventory
nbtTagCompound.setInteger("rotation", rotation.ordinal());
nbtTagCompound.setInteger("size", size);
NBTTagCompound alchemyArrayTagCompound = new NBTTagCompound();
alchemyArray.writeToNBT(alchemyArrayTagCompound);
if (alchemyArray != null)
{
alchemyArray.writeToNBT(alchemyArrayTagCompound);
}
nbtTagCompound.setTag("alchemyArray", alchemyArrayTagCompound);
}

View file

@ -47,6 +47,18 @@ public class TileEntityDummyArray extends TileEntityEE
return null;
}
public int getLightLevel()
{
TileEntityAlchemyArray tileEntityAlchemyArray = getAssociatedTileEntity();
if (tileEntityAlchemyArray != null)
{
return tileEntityAlchemyArray.getLightLevel();
}
return 0;
}
@Override
public void updateEntity()
{
@ -54,10 +66,11 @@ public class TileEntityDummyArray extends TileEntityEE
if (++ticksSinceSync % 10 == 0)
{
if (!worldObj.isRemote && !(worldObj.getTileEntity(trueXCoord, trueYCoord, trueZCoord) instanceof TileEntityEE))
if (!worldObj.isRemote && !(worldObj.getTileEntity(trueXCoord, trueYCoord, trueZCoord) instanceof TileEntityAlchemyArray))
{
this.invalidate();
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
}
}

View file

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

View file

@ -64,7 +64,7 @@ public class WailaDataProvider implements IWailaDataProvider
TileEntityDummyArray tileEntityDummyArray = (TileEntityDummyArray) accessor.getTileEntity();
TileEntityAlchemyArray tileEntityAlchemyArray = (TileEntityAlchemyArray) accessor.getWorld().getTileEntity(tileEntityDummyArray.getTrueXCoord(), tileEntityDummyArray.getTrueYCoord(), tileEntityDummyArray.getTrueZCoord());
if (tileEntityAlchemyArray.getAlchemyArray() != null)
if (tileEntityAlchemyArray != null && tileEntityAlchemyArray.getAlchemyArray() != null && tileEntityAlchemyArray.getAlchemyArray().getDisplayName() != null)
{
currentTip.set(0, SpecialChars.WHITE + tileEntityAlchemyArray.getAlchemyArray().getDisplayName());
}

View file

@ -365,7 +365,7 @@ public abstract class GuiBase extends GuiContainer
if (foreground)
{
return; // TODO:
return;
}
int yPosRight = 4;
int yPosLeft = 4;
@ -378,7 +378,6 @@ public abstract class GuiBase extends GuiContainer
{
continue;
}
// TODO: convert these over to foreground/background (maybe logic for top/bottom tabs?)
if (tab.side == TabBase.LEFT)
{
tab.draw(0, yPosLeft);

View file

@ -90,7 +90,7 @@ tile.ee3:dummyArray.name=Alchemy Array
# Alchemy Arrays
arrays.ee3:basicAlchemyArray=Basic Alchemy Array [WIP]
arrays.ee3:transmutationAlchemyArray=Transmutation Alchemy Array [WIP]
arrays.ee3:transmutation=Transmutation Alchemy Array [WIP]
# GUIs
container.ee3:alchemicalBag=Alchemical Bag

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB