Various states of things working, getting close now

This commit is contained in:
pahimar 2015-03-18 21:52:53 -04:00
parent 6f94c5a6f1
commit 48dbea7901
39 changed files with 1200 additions and 425 deletions

View file

@ -1,23 +1,17 @@
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 com.pahimar.ee3.tileentity.TileEntityTransmutationTablet;
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
public class TransmutationAlchemyArray extends AlchemyArray
{
private EnergyValue energyValue;
public TransmutationAlchemyArray()
{
super(Textures.AlchemyArray.TRANSMUTATION_ALCHEMY_ARRAY, Names.AlchemyArrays.TRANSMUTATION_ALCHEMY_ARRAY);
@ -33,7 +27,23 @@ public class TransmutationAlchemyArray extends AlchemyArray implements IInventor
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);
world.setBlock(arrayX - 1, arrayY - 1, arrayZ - 1, ModBlocks.ashInfusedStoneSlab, 1, 3);
world.setBlock(arrayX, arrayY - 1, arrayZ - 1, ModBlocks.ashInfusedStoneSlab, 2, 3);
world.setBlock(arrayX + 1, arrayY - 1, arrayZ - 1, ModBlocks.ashInfusedStoneSlab, 3, 3);
world.setBlock(arrayX - 1, arrayY - 1, arrayZ, ModBlocks.ashInfusedStoneSlab, 4, 3);
world.setBlock(arrayX, arrayY - 1, arrayZ, ModBlocks.transmutationTablet, 0, 3);
world.setBlock(arrayX + 1, arrayY - 1, arrayZ, ModBlocks.ashInfusedStoneSlab, 5, 3);
world.setBlock(arrayX - 1, arrayY - 1, arrayZ + 1, ModBlocks.ashInfusedStoneSlab, 6, 3);
world.setBlock(arrayX, arrayY - 1, arrayZ + 1, ModBlocks.ashInfusedStoneSlab, 7, 3);
world.setBlock(arrayX + 1, arrayY - 1, arrayZ + 1, ModBlocks.ashInfusedStoneSlab, 8, 3);
// TODO Set orientation on the tablet, make sound effects, and add particles
if (world.getTileEntity(arrayX, arrayY - 1, arrayZ) instanceof TileEntityTransmutationTablet)
{
((TileEntityTransmutationTablet) world.getTileEntity(arrayX, arrayY - 1, arrayZ)).setOrientation(tileEntityAlchemyArray.getOrientation());
}
}
}
}
@ -56,82 +66,4 @@ public class TransmutationAlchemyArray extends AlchemyArray implements IInventor
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

@ -0,0 +1,335 @@
package com.pahimar.ee3.block;
import com.pahimar.ee3.reference.Names;
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;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import java.util.List;
public class BlockAshInfusedStoneSlab extends BlockSlab
{
@SideOnly(Side.CLIENT)
protected IIcon blockIcon, sideVariant1, sideVariant2, topVariant1, topVariant2, topVariant3, topVariant4;
public BlockAshInfusedStoneSlab()
{
super(false, Material.rock);
this.setHardness(2.0f);
this.setBlockName(Names.Blocks.ASH_INFUSED_STONE_SLAB);
}
@Override
public void setBlockBoundsBasedOnState(IBlockAccess iBlockAccess, int x, int y, int z)
{
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
}
/**
* Adds all intersecting collision boxes to a list. (Be sure to only add boxes to the list if they intersect the
* mask.) Parameters: World, X, Y, Z, mask, list, colliding entity
*/
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB axisAlignedBB, List list, Entity entity)
{
if (isAssociatedWithValidTablet(world, x, y, z))
{
int metaData = world.getBlockMetadata(x, y, z);
if (metaData == 1)
{
this.setBlockBounds(0.5F, 0.0F, 0.5F, 1.0F, 0.625F, 1.0F);
super.addCollisionBoxesToList(world, x, y, z, axisAlignedBB, list, entity);
}
else if (metaData == 2)
{
this.setBlockBounds(0.0F, 0.0F, 0.5F, 1.0F, 0.625F, 1.0F);
super.addCollisionBoxesToList(world, x, y, z, axisAlignedBB, list, entity);
}
else if (metaData == 3)
{
this.setBlockBounds(0.0F, 0.0F, 1.0F, 0.5F, 0.625F, 0.5F);
super.addCollisionBoxesToList(world, x, y, z, axisAlignedBB, list, entity);
}
else if (metaData == 4)
{
this.setBlockBounds(0.5F, 0.0F, 0.0F, 1.0F, 0.625F, 1.0F);
super.addCollisionBoxesToList(world, x, y, z, axisAlignedBB, list, entity);
}
else if (metaData == 5)
{
this.setBlockBounds(0.0F, 0.0F, 0.0F, 0.5F, 0.625F, 1.0F);
super.addCollisionBoxesToList(world, x, y, z, axisAlignedBB, list, entity);
}
else if (metaData == 6)
{
this.setBlockBounds(0.5F, 0.0F, 0.0F, 1.0F, 0.625F, 0.5F);
super.addCollisionBoxesToList(world, x, y, z, axisAlignedBB, list, entity);
}
else if (metaData == 7)
{
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.625F, 0.5F);
super.addCollisionBoxesToList(world, x, y, z, axisAlignedBB, list, entity);
}
else if (metaData == 8)
{
this.setBlockBounds(0.0F, 0.0F, 0.0F, 0.5F, 0.625F, 0.5F);
super.addCollisionBoxesToList(world, x, y, z, axisAlignedBB, list, entity);
}
}
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
super.addCollisionBoxesToList(world, x, y, z, axisAlignedBB, list, entity);
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int sideHit, float hitX, float hitY, float hitZ)
{
int metaData = world.getBlockMetadata(x, y, z);
int shiftedX = x;
int shiftedZ = z;
if (metaData != 0)
{
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.getTileEntity(shiftedX, y, shiftedZ) instanceof TileEntityTransmutationTablet)
{
world.getBlock(shiftedX, y, shiftedZ).onBlockActivated(world, shiftedX, y, shiftedZ, entityPlayer, sideHit, hitX, hitY, hitZ);
return true;
}
}
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)
{
blockIcon = iconRegister.registerIcon(String.format("%s", getUnwrappedUnlocalizedName(this.getUnlocalizedName())));
sideVariant1 = iconRegister.registerIcon(String.format("%s", getUnwrappedUnlocalizedName(this.getUnlocalizedName()) + "_side1"));
sideVariant2 = iconRegister.registerIcon(String.format("%s", getUnwrappedUnlocalizedName(this.getUnlocalizedName()) + "_side2"));
topVariant1 = iconRegister.registerIcon(String.format("%s", getUnwrappedUnlocalizedName(this.getUnlocalizedName()) + "_top1"));
topVariant2 = iconRegister.registerIcon(String.format("%s", getUnwrappedUnlocalizedName(this.getUnlocalizedName()) + "_top2"));
topVariant3 = iconRegister.registerIcon(String.format("%s", getUnwrappedUnlocalizedName(this.getUnlocalizedName()) + "_top3"));
topVariant4 = iconRegister.registerIcon(String.format("%s", getUnwrappedUnlocalizedName(this.getUnlocalizedName()) + "_top4"));
}
@Override
public String getUnlocalizedName()
{
return String.format("tile.%s%s", Textures.RESOURCE_PREFIX, getUnwrappedUnlocalizedName(super.getUnlocalizedName()));
}
protected String getUnwrappedUnlocalizedName(String unlocalizedName)
{
return unlocalizedName.substring(unlocalizedName.indexOf(".") + 1);
}
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta)
{
ForgeDirection forgeDirection = ForgeDirection.getOrientation(side);
if (forgeDirection == ForgeDirection.SOUTH || forgeDirection == ForgeDirection.NORTH || forgeDirection == ForgeDirection.EAST || forgeDirection == ForgeDirection.WEST)
{
if (meta == 1 || meta == 3 || meta == 6 || meta == 8)
{
return this.sideVariant1;
}
else
{
return this.sideVariant2;
}
}
else if (forgeDirection == ForgeDirection.UP)
{
if (meta == 1)
{
return this.topVariant1;
}
else if (meta == 3)
{
return this.topVariant4;
}
else if (meta == 6)
{
return this.topVariant2;
}
else if (meta == 8)
{
return this.topVariant3;
}
}
return this.blockIcon;
}
@Override
public String func_150002_b(int meta)
{
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);
if (metaData != 0)
{
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.getTileEntity(shiftedX, y, shiftedZ) instanceof TileEntityTransmutationTablet)
{
return true;
}
}
return false;
}
}

View file

@ -61,6 +61,7 @@ public class BlockEE extends Block
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack itemStack)
{
super.onBlockPlacedBy(world, x, y, z, entityLiving, itemStack);
if (world.getTileEntity(x, y, z) instanceof TileEntityEE)
{
int direction = 0;

View file

@ -1,13 +1,21 @@
package com.pahimar.ee3.block;
import com.pahimar.ee3.EquivalentExchange3;
import com.pahimar.ee3.init.ModBlocks;
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.World;
import java.util.Random;
public class BlockTransmutationTablet extends BlockEE implements ITileEntityProvider
{
public BlockTransmutationTablet()
@ -15,6 +23,49 @@ public class BlockTransmutationTablet extends BlockEE implements ITileEntityProv
super(Material.rock);
this.setHardness(2.0f);
this.setBlockName(Names.Blocks.TRANSMUTATION_TABLET);
this.setBlockBounds(0f, 0f, 0f, 1f, 0.625f, 1f);
}
@Override
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
{
return Item.getItemFromBlock(ModBlocks.ashInfusedStoneSlab);
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int sideHit, float hitX, float hitY, float hitZ)
{
if (entityPlayer.isSneaking())
{
return false;
}
else
{
if (!world.isRemote)
{
if (world.getTileEntity(x, y, z) instanceof TileEntityTransmutationTablet && isStructureValid(world, x, y, z))
{
entityPlayer.openGui(EquivalentExchange3.instance, GUIs.TRANSMUTATION_TABLET.ordinal(), world, x, y, z);
}
}
return true;
}
}
@Override
public int onBlockPlaced(World world, int x, int y, int z, int sideHit, float hitX, float hitY, float hitZ, int metaData)
{
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
@ -40,4 +91,16 @@ public class BlockTransmutationTablet extends BlockEE implements ITileEntityProv
{
return RenderIds.tabletSlab;
}
public boolean isStructureValid(World world, 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));
}
}

View file

@ -39,8 +39,8 @@ public class GuiAlchemicalTome extends GuiBase
this.drawTitle = false;
this.drawInventory = false;
prevPageButton = new ElementButton(this, 15, 177, "prev", 0, 0, 20, 0, 40, 0, 20, 10, 60, 10, "textures/gui/elements/arrowLeft.png");
nextPageButton = new ElementButton(this, 223, 177, "next", 0, 0, 22, 0, 44, 0, 22, 10, 66, 10, "textures/gui/elements/arrowRight.png");
prevPageButton = new ElementButton(this, 15, 177, "prev", 0, 0, 20, 0, 40, 0, 20, 10, 60, 10, Textures.Gui.Elements.ARROW_LEFT);
nextPageButton = new ElementButton(this, 223, 177, "next", 0, 0, 22, 0, 44, 0, 22, 10, 66, 10, Textures.Gui.Elements.ARROW_RIGHT);
searchTextField = new ElementTextField(this, 64, 205, "searchField", 128, 20)
{
@Override
@ -52,6 +52,7 @@ public class GuiAlchemicalTome extends GuiBase
}
}
};
searchTextField.setPadding(6, 3, 0, 3);
searchTextField.borderColor = new GuiColor(160, 160, 160).getColor();
searchTextField.backgroundColor = new GuiColor(0, 0, 0).getColor();
searchTextField.setFocused(true);
@ -73,8 +74,11 @@ public class GuiAlchemicalTome extends GuiBase
}
else
{
fontRendererObj.drawSplitString(StatCollector.translateToLocal(Messages.Gui.NO_KNOWN_TRANSMUTATIONS), 142, 20, 100, new GuiColor(50, 50, 50).getColor());
fontRendererObj.drawSplitString(StatCollector.translateToLocal(Messages.Gui.HOW_TO_LEARN_TRANSMUTATIONS), 142, 60, 100, new GuiColor(50, 50, 50).getColor());
if (((ContainerAlchemicalTome) this.inventorySlots).getInventorySize() == 0)
{
fontRendererObj.drawSplitString(StatCollector.translateToLocal(Messages.Gui.NO_KNOWN_TRANSMUTATIONS), 142, 20, 100, new GuiColor(50, 50, 50).getColor());
fontRendererObj.drawSplitString(StatCollector.translateToLocal(Messages.Gui.HOW_TO_LEARN_TRANSMUTATIONS), 142, 60, 100, new GuiColor(50, 50, 50).getColor());
}
}
if (this.inventorySlots.getSlot(40).getHasStack())

View file

@ -1,8 +1,15 @@
package com.pahimar.ee3.client.gui.inventory;
import com.pahimar.ee3.inventory.ContainerTransmutationTablet;
import com.pahimar.ee3.network.PacketHandler;
import com.pahimar.ee3.network.message.MessageGuiElementTextFieldUpdate;
import com.pahimar.ee3.reference.Colors;
import com.pahimar.ee3.reference.Textures;
import com.pahimar.ee3.tileentity.TileEntityTransmutationTablet;
import com.pahimar.repackage.cofh.lib.gui.GuiBase;
import com.pahimar.repackage.cofh.lib.gui.GuiColor;
import com.pahimar.repackage.cofh.lib.gui.element.ElementSlider;
import com.pahimar.repackage.cofh.lib.gui.element.ElementTextField;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.player.InventoryPlayer;
@ -10,9 +17,15 @@ import net.minecraft.entity.player.InventoryPlayer;
@SideOnly(Side.CLIENT)
public class GuiTransmutationTablet extends GuiBase
{
public GuiTransmutationTablet(InventoryPlayer inventoryPlayer)
private TileEntityTransmutationTablet tileEntityTransmutationTablet;
private ElementTextField searchTextField;
private ElementSlider slider;
public GuiTransmutationTablet(InventoryPlayer inventoryPlayer, TileEntityTransmutationTablet tileEntityTransmutationTablet)
{
super(new ContainerTransmutationTablet(inventoryPlayer), Textures.Gui.TRANSMUTATION_TABLET);
super(new ContainerTransmutationTablet(inventoryPlayer, tileEntityTransmutationTablet), Textures.Gui.TRANSMUTATION_TABLET);
this.tileEntityTransmutationTablet = tileEntityTransmutationTablet;
xSize = 256;
ySize = 256;
}
@ -24,5 +37,58 @@ public class GuiTransmutationTablet extends GuiBase
this.drawTitle = false;
this.drawInventory = false;
searchTextField = new ElementTextField(this, 173, 145, "searchField", 78, 10)
{
@Override
protected void onCharacterEntered(boolean success)
{
if (success)
{
PacketHandler.INSTANCE.sendToServer(new MessageGuiElementTextFieldUpdate(this));
}
}
};
searchTextField.backgroundColor = new GuiColor(0, 0, 0, 0).getColor();
searchTextField.borderColor = new GuiColor(0, 0, 0, 0).getColor();
searchTextField.setFocused(true);
slider = new ElementSlider(this, 239, 163, 12, 74, 50, 0)
{
@Override
protected void dragSlider(int x, int y)
{
if (y > _value)
{
setValue(_value + 1);
}
else
{
setValue(_value - 1);
}
}
@Override
public int getSliderY()
{
return _value;
}
};
slider.backgroundColor = new GuiColor(0, 0, 0, 0).getColor();
slider.borderColor = new GuiColor(0, 0, 0, 0).getColor();
slider.setSliderSize(12, 15);
addElement(searchTextField);
addElement(slider);
}
@Override
protected void drawGuiContainerForegroundLayer(int x, int y)
{
super.drawGuiContainerForegroundLayer(x, y);
fontRendererObj.drawString("Energy Value:", 8, 140, Integer.parseInt(Colors.PURE_WHITE, 16));
// TODO Nicer text formatting of the value
fontRendererObj.drawString(String.format("%s", tileEntityTransmutationTablet.getEnergyValue().getEnergyValue()), 8, 150, Integer.parseInt(Colors.PURE_WHITE, 16));
}
}

View file

@ -2,250 +2,27 @@ 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 ModelRenderer transmutationPad;
public ModelRenderer base;
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);
this.textureWidth = 128;
this.textureHeight = 58;
this.transmutationPad = new ModelRenderer(this, 0, 24);
this.transmutationPad.setRotationPoint(0.0F, 0.0F, 0.0F);
this.transmutationPad.addBox(-16.0F, 14.0F, -16.0F, 32, 2, 32, 0.0F);
this.base = new ModelRenderer(this, 0, 0);
this.base.setRotationPoint(0.0F, 0.0F, 0.0F);
this.base.addBox(-8.0F, 6.0F, -8.0F, 16, 8, 16, 0.0F);
}
@Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
public void render(float scale)
{
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;
this.transmutationPad.render(scale);
this.base.render(scale);
}
}

View file

@ -1,6 +1,7 @@
package com.pahimar.ee3.client.renderer.tileentity;
import com.pahimar.ee3.client.renderer.model.ModelTransmutationTablet;
import com.pahimar.ee3.client.util.RenderUtils;
import com.pahimar.ee3.reference.Textures;
import com.pahimar.ee3.tileentity.TileEntityTransmutationTablet;
import cpw.mods.fml.relauncher.Side;
@ -21,49 +22,50 @@ public class TileEntityRendererTransmutationTablet extends TileEntitySpecialRend
{
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.glTranslatef((float) x, (float) y, (float) z);
GL11.glTranslatef(0.5F, -0.375F, 0.5F);
modelTransmutationTablet.render(0.0625f);
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
TileEntityTransmutationTablet tileEntityTransmutationTablet = (TileEntityTransmutationTablet) tileEntity;
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);
}
}
}

View file

@ -53,7 +53,8 @@ public class GuiHandler implements IGuiHandler
}
else if (id == GUIs.TRANSMUTATION_TABLET.ordinal())
{
return new ContainerTransmutationTablet(entityPlayer.inventory);
TileEntityTransmutationTablet tileEntityTransmutationTablet = (TileEntityTransmutationTablet) world.getTileEntity(x, y, z);
return new ContainerTransmutationTablet(entityPlayer.inventory, tileEntityTransmutationTablet);
}
else if (id == GUIs.SYMBOL_SELECTION.ordinal())
{
@ -106,7 +107,8 @@ public class GuiHandler implements IGuiHandler
}
else if (id == GUIs.TRANSMUTATION_TABLET.ordinal())
{
return new GuiTransmutationTablet(entityPlayer.inventory);
TileEntityTransmutationTablet tileEntityTransmutationTablet = (TileEntityTransmutationTablet) world.getTileEntity(x, y, z);
return new GuiTransmutationTablet(entityPlayer.inventory, tileEntityTransmutationTablet);
}
else if (id == GUIs.SYMBOL_SELECTION.ordinal())
{

View file

@ -2,6 +2,8 @@ package com.pahimar.ee3.init;
import com.pahimar.ee3.api.AbilityRegistryProxy;
import com.pahimar.ee3.exchange.OreStack;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
public class Abilities
@ -15,5 +17,7 @@ public class Abilities
AbilityRegistryProxy.setAsNotLearnable(new OreStack(oreName));
}
}
AbilityRegistryProxy.setAsNotLearnable(new ItemStack(Blocks.coal_ore));
}
}

View file

@ -6,6 +6,7 @@ import com.pahimar.ee3.item.ItemBlockAlchemicalFuel;
import com.pahimar.ee3.reference.Names;
import com.pahimar.ee3.reference.Reference;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.Block;
@GameRegistry.ObjectHolder(Reference.MOD_ID)
public class ModBlocks
@ -22,6 +23,7 @@ public class ModBlocks
public static final BlockEE alchemyArray = new BlockAlchemyArray();
public static final BlockEE dummyArray = new BlockDummyArray();
public static final BlockEE transmutationTablet = new BlockTransmutationTablet();
public static final Block ashInfusedStoneSlab = new BlockAshInfusedStoneSlab();
public static void init()
{
@ -37,5 +39,6 @@ public class ModBlocks
GameRegistry.registerBlock(alchemyArray, Names.Blocks.ALCHEMY_ARRAY);
GameRegistry.registerBlock(dummyArray, Names.Blocks.DUMMY_ARRAY);
GameRegistry.registerBlock(transmutationTablet, Names.Blocks.TRANSMUTATION_TABLET);
GameRegistry.registerBlock(ashInfusedStoneSlab, Names.Blocks.ASH_INFUSED_STONE_SLAB);
}
}

View file

@ -14,7 +14,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.TreeSet;
public class ContainerAlchemicalTome extends ContainerEE
public class ContainerAlchemicalTome extends ContainerEE implements ITextFieldElementHandler
{
private final InventoryTransmutationKnowledge inventoryTransmutationKnowledge;
private int pageOffset, maxPageOffset;

View file

@ -92,9 +92,4 @@ public abstract class ContainerEE extends Container
{
// NOOP
}
public void handleElementTextFieldUpdate(String buttonName, String updatedText)
{
// NOOP
}
}

View file

@ -1,12 +1,61 @@
package com.pahimar.ee3.inventory;
import com.pahimar.ee3.api.EnergyValue;
import com.pahimar.ee3.item.ItemAlchemicalTome;
import com.pahimar.ee3.item.ItemMiniumStone;
import com.pahimar.ee3.item.ItemPhilosophersStone;
import com.pahimar.ee3.tileentity.TileEntityTransmutationTablet;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerTransmutationTablet extends ContainerEE
public class ContainerTransmutationTablet extends ContainerEE implements ITextFieldElementHandler
{
public ContainerTransmutationTablet(InventoryPlayer inventoryPlayer)
private TileEntityTransmutationTablet tileEntityTransmutationTablet;
private EnergyValue energyValue;
private String searchTerm;
public ContainerTransmutationTablet(InventoryPlayer inventoryPlayer, TileEntityTransmutationTablet tileEntityTransmutationTablet)
{
this.tileEntityTransmutationTablet = tileEntityTransmutationTablet;
this.addSlotToContainer(new SlotTabletInput(tileEntityTransmutationTablet, TileEntityTransmutationTablet.ITEM_INPUT_1, 120, 27));
this.addSlotToContainer(new SlotTabletInput(tileEntityTransmutationTablet, TileEntityTransmutationTablet.ITEM_INPUT_2, 93, 38));
this.addSlotToContainer(new SlotTabletInput(tileEntityTransmutationTablet, TileEntityTransmutationTablet.ITEM_INPUT_3, 84, 64));
this.addSlotToContainer(new SlotTabletInput(tileEntityTransmutationTablet, TileEntityTransmutationTablet.ITEM_INPUT_4, 93, 90));
this.addSlotToContainer(new SlotTabletInput(tileEntityTransmutationTablet, TileEntityTransmutationTablet.ITEM_INPUT_5, 120, 102));
this.addSlotToContainer(new SlotTabletInput(tileEntityTransmutationTablet, TileEntityTransmutationTablet.ITEM_INPUT_6, 147, 90));
this.addSlotToContainer(new SlotTabletInput(tileEntityTransmutationTablet, TileEntityTransmutationTablet.ITEM_INPUT_7, 156, 64));
this.addSlotToContainer(new SlotTabletInput(tileEntityTransmutationTablet, TileEntityTransmutationTablet.ITEM_INPUT_8, 147, 38));
this.addSlotToContainer(new Slot(tileEntityTransmutationTablet, TileEntityTransmutationTablet.STONE_INDEX, 120, 64)
{
@Override
public int getSlotStackLimit()
{
return 1;
}
@Override
public boolean isItemValid(ItemStack itemStack)
{
return itemStack.getItem() instanceof ItemMiniumStone || itemStack.getItem() instanceof ItemPhilosophersStone;
}
});
this.addSlotToContainer(new Slot(tileEntityTransmutationTablet, TileEntityTransmutationTablet.ALCHEMICAL_TOME_INDEX, 152, 142)
{
@Override
public int getSlotStackLimit()
{
return 1;
}
@Override
public boolean isItemValid(ItemStack itemStack)
{
return itemStack.getItem() instanceof ItemAlchemicalTome;
}
});
// Add the player's inventory slots to the container
for (int inventoryRowIndex = 0; inventoryRowIndex < PLAYER_INVENTORY_ROWS; ++inventoryRowIndex)
{
@ -22,4 +71,26 @@ public class ContainerTransmutationTablet extends ContainerEE
this.addSlotToContainer(new Slot(inventoryPlayer, actionBarSlotIndex, 8 + actionBarSlotIndex * 18, 221));
}
}
@Override
public void detectAndSendChanges()
{
super.detectAndSendChanges();
this.energyValue = this.tileEntityTransmutationTablet.getEnergyValue();
}
@Override
public void handleElementTextFieldUpdate(String buttonName, String updatedText)
{
if (buttonName.equalsIgnoreCase("searchField"))
{
this.searchTerm = updatedText;
updateInventory();
}
}
private void updateInventory()
{
}
}

View file

@ -0,0 +1,6 @@
package com.pahimar.ee3.inventory;
public interface ITextFieldElementHandler
{
public abstract void handleElementTextFieldUpdate(String buttonName, String updatedText);
}

View file

@ -0,0 +1,21 @@
package com.pahimar.ee3.inventory;
import com.pahimar.ee3.exchange.EnergyValueRegistry;
import com.pahimar.ee3.knowledge.AbilityRegistry;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class SlotTabletInput extends Slot
{
public SlotTabletInput(IInventory iInventory, int slotIndex, int x, int y)
{
super(iInventory, slotIndex, x, y);
}
@Override
public boolean isItemValid(ItemStack itemStack)
{
return EnergyValueRegistry.getInstance().hasEnergyValue(itemStack) && AbilityRegistry.getInstance().isRecoverable(itemStack);
}
}

View file

@ -25,5 +25,6 @@ public class PacketHandler
INSTANCE.registerMessage(MessageChalkSettings.class, MessageChalkSettings.class, 10, Side.CLIENT);
INSTANCE.registerMessage(MessageTileEntityDummy.class, MessageTileEntityDummy.class, 11, Side.CLIENT);
INSTANCE.registerMessage(MessageTileEntityAlchemyArray.class, MessageTileEntityAlchemyArray.class, 12, Side.CLIENT);
INSTANCE.registerMessage(MessageTileEntityTransmutationTablet.class, MessageTileEntityTransmutationTablet.class, 13, Side.CLIENT);
}
}

View file

@ -1,6 +1,6 @@
package com.pahimar.ee3.network.message;
import com.pahimar.ee3.inventory.ContainerEE;
import com.pahimar.ee3.inventory.ITextFieldElementHandler;
import com.pahimar.repackage.cofh.lib.gui.element.ElementTextField;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
@ -54,9 +54,9 @@ public class MessageGuiElementTextFieldUpdate implements IMessage, IMessageHandl
if (entityPlayer != null)
{
if (entityPlayer.openContainer instanceof ContainerEE)
if (entityPlayer.openContainer instanceof ITextFieldElementHandler)
{
((ContainerEE) entityPlayer.openContainer).handleElementTextFieldUpdate(message.elementName, message.elementText);
((ITextFieldElementHandler) entityPlayer.openContainer).handleElementTextFieldUpdate(message.elementName, message.elementText);
}
}

View file

@ -0,0 +1,104 @@
package com.pahimar.ee3.network.message;
import com.pahimar.ee3.tileentity.TileEntityAlchemyArray;
import com.pahimar.ee3.tileentity.TileEntityTransmutationTablet;
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.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import java.io.ByteArrayInputStream;
import java.io.IOException;
public class MessageTileEntityTransmutationTablet implements IMessage, IMessageHandler<MessageTileEntityTransmutationTablet, IMessage>
{
public NBTTagCompound tileEntityTransmutationTabletNBT;
public MessageTileEntityTransmutationTablet()
{
}
public MessageTileEntityTransmutationTablet(TileEntityTransmutationTablet tileEntityTransmutationTablet)
{
tileEntityTransmutationTabletNBT = new NBTTagCompound();
tileEntityTransmutationTablet.writeToNBT(tileEntityTransmutationTabletNBT);
}
@Override
public void fromBytes(ByteBuf buf)
{
byte[] compressedNBT = null;
int readableBytes = buf.readInt();
if (readableBytes > 0)
{
compressedNBT = buf.readBytes(readableBytes).array();
}
if (compressedNBT != null)
{
try
{
this.tileEntityTransmutationTabletNBT = CompressedStreamTools.readCompressed(new ByteArrayInputStream(compressedNBT));
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
@Override
public void toBytes(ByteBuf buf)
{
byte[] compressedNBT = null;
try
{
if (tileEntityTransmutationTabletNBT != null)
{
compressedNBT = CompressedStreamTools.compress(tileEntityTransmutationTabletNBT);
}
}
catch (IOException e)
{
e.printStackTrace();
}
if (compressedNBT != null)
{
buf.writeInt(compressedNBT.length);
buf.writeBytes(compressedNBT);
}
else
{
buf.writeInt(0);
}
}
@Override
public IMessage onMessage(MessageTileEntityTransmutationTablet message, MessageContext ctx)
{
if (message.tileEntityTransmutationTabletNBT != null)
{
TileEntityAlchemyArray tileEntityAlchemyArray = new TileEntityAlchemyArray();
tileEntityAlchemyArray.readFromNBT(message.tileEntityTransmutationTabletNBT);
TileEntity tileEntity = FMLClientHandler.instance().getClient().theWorld.getTileEntity(tileEntityAlchemyArray.xCoord, tileEntityAlchemyArray.yCoord, tileEntityAlchemyArray.zCoord);
if (tileEntity instanceof TileEntityTransmutationTablet)
{
tileEntity.readFromNBT(message.tileEntityTransmutationTabletNBT);
//NAME UPDATE
FMLClientHandler.instance().getClient().theWorld.func_147451_t(tileEntityAlchemyArray.xCoord, tileEntityAlchemyArray.yCoord, tileEntityAlchemyArray.zCoord);
}
}
return null;
}
}

View file

@ -14,6 +14,7 @@ public class Names
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 ASH_INFUSED_STONE_SLAB = "ashInfusedStoneSlab";
public static final String ALCHEMY_ARRAY = "alchemyArray";
public static final String DUMMY_ARRAY = "dummyArray";
}
@ -121,6 +122,7 @@ public class Names
public static final String GLASS_BELL = "container.ee3:" + Blocks.GLASS_BELL;
public static final String AUGMENTATION_TABLE = "container.ee3:" + Blocks.AUGMENTATION_TABLE;
public static final String ALCHEMICAL_TOME = "container.ee3:" + Items.ALCHEMICAL_TOME;
public static final String TRANSMUTATION_TABLET = "container.ee3:" + Blocks.TRANSMUTATION_TABLET;
}
public static final class Keys

View file

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

View file

@ -29,23 +29,35 @@ public final class Textures
public static final class Gui
{
private static final String GUI_SHEET_LOCATION = "textures/gui/";
public static final ResourceLocation CALCINATOR = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "calcinator.png");
public static final ResourceLocation ALUDEL = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "aludel.png");
public static final ResourceLocation ALCHEMICAL_BAG_SMALL = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "alchemicalBag_small.png");
public static final ResourceLocation ALCHEMICAL_BAG_MEDIUM = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "alchemicalBag_medium.png");
public static final ResourceLocation ALCHEMICAL_BAG_LARGE = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "alchemicalBag_large.png");
public static final ResourceLocation ALCHEMICAL_CHEST_SMALL = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "alchemicalChest_small.png");
public static final ResourceLocation ALCHEMICAL_CHEST_MEDIUM = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "alchemicalChest_medium.png");
public static final ResourceLocation ALCHEMICAL_CHEST_LARGE = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "alchemicalChest_large.png");
public static final ResourceLocation GLASS_BELL = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "glassBell.png");
public static final ResourceLocation RESEARCH_STATION = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "researchStation.png");
public static final ResourceLocation RESEARCH_STATION_GYLPH_1 = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "researchStation_Glyph1.png");
public static final ResourceLocation RESEARCH_STATION_GYLPH_2 = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "researchStation_Glyph2.png");
public static final ResourceLocation AUGMENTATION_TABLE = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "augmentationTable.png");
protected static final String GUI_TEXTURE_LOCATION = "textures/gui/";
public static final ResourceLocation CALCINATOR = ResourceLocationHelper.getResourceLocation(GUI_TEXTURE_LOCATION + "calcinator.png");
public static final ResourceLocation ALUDEL = ResourceLocationHelper.getResourceLocation(GUI_TEXTURE_LOCATION + "aludel.png");
public static final ResourceLocation ALCHEMICAL_BAG_SMALL = ResourceLocationHelper.getResourceLocation(GUI_TEXTURE_LOCATION + "alchemicalBag_small.png");
public static final ResourceLocation ALCHEMICAL_BAG_MEDIUM = ResourceLocationHelper.getResourceLocation(GUI_TEXTURE_LOCATION + "alchemicalBag_medium.png");
public static final ResourceLocation ALCHEMICAL_BAG_LARGE = ResourceLocationHelper.getResourceLocation(GUI_TEXTURE_LOCATION + "alchemicalBag_large.png");
public static final ResourceLocation ALCHEMICAL_CHEST_SMALL = ResourceLocationHelper.getResourceLocation(GUI_TEXTURE_LOCATION + "alchemicalChest_small.png");
public static final ResourceLocation ALCHEMICAL_CHEST_MEDIUM = ResourceLocationHelper.getResourceLocation(GUI_TEXTURE_LOCATION + "alchemicalChest_medium.png");
public static final ResourceLocation ALCHEMICAL_CHEST_LARGE = ResourceLocationHelper.getResourceLocation(GUI_TEXTURE_LOCATION + "alchemicalChest_large.png");
public static final ResourceLocation GLASS_BELL = ResourceLocationHelper.getResourceLocation(GUI_TEXTURE_LOCATION + "glassBell.png");
public static final ResourceLocation RESEARCH_STATION = ResourceLocationHelper.getResourceLocation(GUI_TEXTURE_LOCATION + "researchStation.png");
public static final ResourceLocation RESEARCH_STATION_GYLPH_1 = ResourceLocationHelper.getResourceLocation(GUI_TEXTURE_LOCATION + "researchStation_Glyph1.png");
public static final ResourceLocation RESEARCH_STATION_GYLPH_2 = ResourceLocationHelper.getResourceLocation(GUI_TEXTURE_LOCATION + "researchStation_Glyph2.png");
public static final ResourceLocation AUGMENTATION_TABLE = ResourceLocationHelper.getResourceLocation(GUI_TEXTURE_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_TABLET = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "transmutationTablet.png");
public static final ResourceLocation ALCHEMICAL_TOME = ResourceLocationHelper.getResourceLocation(GUI_TEXTURE_LOCATION + "alchemicalTome.png");
public static final ResourceLocation TRANSMUTATION_TABLET = ResourceLocationHelper.getResourceLocation(GUI_TEXTURE_LOCATION + "transmutationTablet.png");
public static final class Elements
{
protected static final String ELEMENT_TEXTURE_LOCATION = GUI_TEXTURE_LOCATION + "elements/";
public static final ResourceLocation ARROW_LEFT = ResourceLocationHelper.getResourceLocation(ELEMENT_TEXTURE_LOCATION + "arrowLeft.png");
public static final ResourceLocation ARROW_RIGHT = ResourceLocationHelper.getResourceLocation(ELEMENT_TEXTURE_LOCATION + "arrowRight.png");
public static final ResourceLocation SLIDER_VERTICAL_ENABLED = ResourceLocationHelper.getResourceLocation(ELEMENT_TEXTURE_LOCATION + "sliderVerticalEnabled.png");
public static final ResourceLocation SLIDER_VERTICAL_DISABLED = ResourceLocationHelper.getResourceLocation(ELEMENT_TEXTURE_LOCATION + "sliderVerticalDisabled.png");
public static final ResourceLocation BUTTON_ENABLED = ResourceLocationHelper.getResourceLocation(ELEMENT_TEXTURE_LOCATION + "buttonEnabled.png");
public static final ResourceLocation BUTTON_DISABLED = ResourceLocationHelper.getResourceLocation(ELEMENT_TEXTURE_LOCATION + "buttonDisabled.png");
public static final ResourceLocation BUTTON_HOVER = ResourceLocationHelper.getResourceLocation(ELEMENT_TEXTURE_LOCATION + "buttonHover.png");
}
}
public static final class Effect

View file

@ -1,5 +1,266 @@
package com.pahimar.ee3.tileentity;
public class TileEntityTransmutationTablet extends TileEntityEE
import com.pahimar.ee3.api.EnergyValue;
import com.pahimar.ee3.exchange.EnergyValueRegistry;
import com.pahimar.ee3.item.ItemAlchemicalTome;
import com.pahimar.ee3.item.ItemMiniumStone;
import com.pahimar.ee3.item.ItemPhilosophersStone;
import com.pahimar.ee3.knowledge.AbilityRegistry;
import com.pahimar.ee3.network.PacketHandler;
import com.pahimar.ee3.network.message.MessageTileEntityTransmutationTablet;
import com.pahimar.ee3.reference.Names;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
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;
import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityTransmutationTablet extends TileEntityEE implements IInventory
{
private static final int INVENTORY_SIZE = 10;
public static final int ITEM_INPUT_1 = 0;
public static final int ITEM_INPUT_2 = 1;
public static final int ITEM_INPUT_3 = 2;
public static final int ITEM_INPUT_4 = 3;
public static final int ITEM_INPUT_5 = 4;
public static final int ITEM_INPUT_6 = 5;
public static final int ITEM_INPUT_7 = 6;
public static final int ITEM_INPUT_8 = 7;
public static final int STONE_INDEX = 8;
public static final int ALCHEMICAL_TOME_INDEX = 9;
private EnergyValue energyValue;
private ForgeDirection rotation;
private ItemStack[] inventory;
public TileEntityTransmutationTablet()
{
super();
rotation = ForgeDirection.UNKNOWN;
energyValue = new EnergyValue(0);
inventory = new ItemStack[INVENTORY_SIZE];
}
public EnergyValue getEnergyValue()
{
return energyValue;
}
public void setEnergyValue(EnergyValue energyValue)
{
this.energyValue = energyValue;
}
public ForgeDirection getRotation()
{
return rotation;
}
public void setRotation(ForgeDirection rotation)
{
this.rotation = rotation;
}
@Override
@SideOnly(Side.CLIENT)
public AxisAlignedBB getRenderBoundingBox()
{
return AxisAlignedBB.getBoundingBox(xCoord - 1.5d, yCoord - 1, zCoord - 1.5d, xCoord + 1.5d, yCoord + 1, zCoord + 1.5d);
}
@Override
public void updateEntity()
{
super.updateEntity();
}
@Override
public Packet getDescriptionPacket()
{
return PacketHandler.INSTANCE.getPacketFrom(new MessageTileEntityTransmutationTablet(this));
}
@Override
public void readFromNBT(NBTTagCompound nbtTagCompound)
{
super.readFromNBT(nbtTagCompound);
rotation = ForgeDirection.getOrientation(nbtTagCompound.getInteger("rotation"));
// Read in the ItemStacks in the inventory from NBT
NBTTagList tagList = nbtTagCompound.getTagList(Names.NBT.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);
}
}
NBTTagCompound energyValueTagCompound = nbtTagCompound.getCompoundTag("energyValue");
if (!energyValueTagCompound.hasNoTags())
{
energyValue = EnergyValue.loadEnergyValueFromNBT(energyValueTagCompound);
}
else
{
energyValue = new EnergyValue(0);
}
}
@Override
public void writeToNBT(NBTTagCompound nbtTagCompound)
{
super.writeToNBT(nbtTagCompound);
nbtTagCompound.setInteger("rotation", rotation.ordinal());
// 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(Names.NBT.ITEMS, tagList);
NBTTagCompound energyValueTagCompound = new NBTTagCompound();
if (energyValue != null)
{
energyValue.writeToNBT(energyValueTagCompound);
}
nbtTagCompound.setTag("energyValue", energyValueTagCompound);
}
@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();
}
float newEnergyValue = 0f;
for (int i = 0; i < STONE_INDEX; i++)
{
if (inventory[i] != null && EnergyValueRegistry.getInstance().hasEnergyValue(inventory[i]))
{
newEnergyValue += EnergyValueRegistry.getInstance().getEnergyValue(inventory[i]).getEnergyValue() * inventory[i].stackSize;
}
}
this.energyValue = new EnergyValue(newEnergyValue);
}
@Override
public String getInventoryName()
{
return this.hasCustomName() ? this.getCustomName() : Names.Containers.TRANSMUTATION_TABLET;
}
@Override
public boolean hasCustomInventoryName()
{
return this.hasCustomName();
}
@Override
public int getInventoryStackLimit()
{
return 64;
}
@Override
public boolean isUseableByPlayer(EntityPlayer entityPlayer)
{
return true;
}
@Override
public void openInventory()
{
// NOOP
}
@Override
public void closeInventory()
{
// NOOP
}
@Override
public boolean isItemValidForSlot(int slotIndex, ItemStack itemStack)
{
if (slotIndex < STONE_INDEX && EnergyValueRegistry.getInstance().hasEnergyValue(itemStack) && AbilityRegistry.getInstance().isRecoverable(itemStack))
{
return true;
}
else if (slotIndex == STONE_INDEX && (itemStack.getItem() instanceof ItemMiniumStone || itemStack.getItem() instanceof ItemPhilosophersStone))
{
return true;
}
else if (slotIndex == ALCHEMICAL_TOME_INDEX && itemStack.getItem() instanceof ItemAlchemicalTome)
{
return true;
}
return false;
}
}

View file

@ -1,5 +1,6 @@
package com.pahimar.ee3.waila;
import com.pahimar.ee3.block.BlockAshInfusedStoneSlab;
import com.pahimar.ee3.reference.Messages;
import com.pahimar.ee3.reference.Names;
import com.pahimar.ee3.tileentity.*;
@ -73,6 +74,60 @@ public class WailaDataProvider implements IWailaDataProvider
currentTip.set(0, SpecialChars.WHITE + StatCollector.translateToLocal(Names.Blocks.DUMMY_ARRAY));
}
}
else if (accessor.getBlock() instanceof BlockAshInfusedStoneSlab)
{
int metaData = accessor.getMetadata();
int x = accessor.getPosition().blockX;
int y = accessor.getPosition().blockY;
int z = accessor.getPosition().blockZ;
String unLocalizedBlockName = accessor.getWorld().getBlock(x, y, z).getUnlocalizedName() + ".name";
if (metaData == 1)
{
x++;
z++;
}
else if (metaData == 2)
{
z++;
}
else if (metaData == 3)
{
x--;
z++;
}
else if (metaData == 4)
{
x++;
}
else if (metaData == 5)
{
x--;
}
else if (metaData == 6)
{
x++;
z--;
}
else if (metaData == 7)
{
z--;
}
else if (metaData == 8)
{
x--;
z--;
}
if (metaData != 0 && accessor.getWorld().getTileEntity(x, y, z) instanceof TileEntityTransmutationTablet)
{
currentTip.set(0, SpecialChars.WHITE + StatCollector.translateToLocal(accessor.getWorld().getBlock(x, y, z).getUnlocalizedName() + ".name"));
}
else
{
currentTip.set(0, SpecialChars.WHITE + StatCollector.translateToLocal(unLocalizedBlockName));
}
}
return currentTip;
}
@ -98,5 +153,6 @@ public class WailaDataProvider implements IWailaDataProvider
registrar.registerHeadProvider(new WailaDataProvider(), TileEntityAlchemicalChestLarge.class);
registrar.registerHeadProvider(new WailaDataProvider(), TileEntityAlchemyArray.class);
registrar.registerHeadProvider(new WailaDataProvider(), TileEntityDummyArray.class);
registrar.registerHeadProvider(new WailaDataProvider(), BlockAshInfusedStoneSlab.class);
}
}

View file

@ -15,21 +15,18 @@ public abstract class ElementButtonManaged extends ElementBase
public ElementButtonManaged(GuiBase containerScreen, int posX, int posY, int sizeX, int sizeY, String text)
{
super(containerScreen, posX, posY, sizeX, sizeY);
_text = text;
}
public void setText(String text)
{
_text = text;
}
@Override
public void drawBackground(int mouseX, int mouseY, float gameTicks)
{
if (!isEnabled())
{
gui.bindTexture(DISABLED);
@ -52,14 +49,12 @@ public abstract class ElementButtonManaged extends ElementBase
@Override
public void drawForeground(int mouseX, int mouseY)
{
String text = getFontRenderer().trimStringToWidth(_text, sizeX - 4);
drawCenteredString(getFontRenderer(), text, posX + sizeX / 2, posY + (sizeY - 8) / 2, getTextColor(mouseX, mouseY));
}
protected int getTextColor(int mouseX, int mouseY)
{
if (!isEnabled())
{
return -6250336;
@ -77,7 +72,6 @@ public abstract class ElementButtonManaged extends ElementBase
@Override
public boolean onMousePressed(int mouseX, int mouseY, int mouseButton)
{
GuiBase.playSound("random.click", 1.0F, 1.0F);
if (mouseButton == 0)
{

View file

@ -1,12 +1,13 @@
package com.pahimar.repackage.cofh.lib.gui.element;
import com.pahimar.ee3.reference.Textures;
import com.pahimar.repackage.cofh.lib.gui.GuiBase;
import com.pahimar.repackage.cofh.lib.gui.GuiColor;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
public abstract class ElementSlider extends ElementBase
{
protected int _value;
protected int _valueMin;
protected int _valueMax;
@ -18,15 +19,17 @@ public abstract class ElementSlider extends ElementBase
public int borderColor = new GuiColor(120, 120, 120, 255).getColor();
public int backgroundColor = new GuiColor(0, 0, 0, 255).getColor();
protected ResourceLocation enabledTexture = Textures.Gui.Elements.BUTTON_ENABLED;
protected ResourceLocation hoverTexture = Textures.Gui.Elements.BUTTON_HOVER;
protected ResourceLocation disabledTexture = Textures.Gui.Elements.BUTTON_DISABLED;
protected ElementSlider(GuiBase containerScreen, int x, int y, int width, int height, int maxValue)
{
this(containerScreen, x, y, width, height, maxValue, 0);
}
protected ElementSlider(GuiBase containerScreen, int x, int y, int width, int height, int maxValue, int minValue)
{
super(containerScreen, x, y, width, height);
_valueMax = maxValue;
_valueMin = minValue;
@ -34,7 +37,6 @@ public abstract class ElementSlider extends ElementBase
public ElementSlider setColor(int backgroundColor, int borderColor)
{
this.borderColor = borderColor;
this.backgroundColor = backgroundColor;
return this;
@ -42,7 +44,6 @@ public abstract class ElementSlider extends ElementBase
public ElementSlider setSliderSize(int width, int height)
{
_sliderWidth = width;
_sliderHeight = height;
return this;
@ -50,7 +51,6 @@ public abstract class ElementSlider extends ElementBase
public ElementSlider setValue(int value)
{
value = Math.max(_valueMin, Math.min(_valueMax, value));
if (value != _value)
{
@ -63,7 +63,6 @@ public abstract class ElementSlider extends ElementBase
@Override
public void drawBackground(int mouseX, int mouseY, float gameTicks)
{
drawModalRect(posX - 1, posY - 1, posX + sizeX + 1, posY + sizeY + 1, borderColor);
drawModalRect(posX, posY, posX + sizeX, posY + sizeY, backgroundColor);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
@ -71,7 +70,6 @@ public abstract class ElementSlider extends ElementBase
protected void drawSlider(int mouseX, int mouseY, int sliderX, int sliderY)
{
int sliderMidX = _sliderWidth / 2;
int sliderMidY = _sliderHeight / 2;
int sliderEndX = _sliderWidth - sliderMidX;
@ -79,15 +77,15 @@ public abstract class ElementSlider extends ElementBase
if (!isEnabled())
{
gui.bindTexture(ElementButtonManaged.DISABLED);
gui.bindTexture(disabledTexture);
}
else if (isHovering(mouseX, mouseY))
{
gui.bindTexture(ElementButtonManaged.HOVER);
gui.bindTexture(hoverTexture);
}
else
{
gui.bindTexture(ElementButtonManaged.ENABLED);
gui.bindTexture(enabledTexture);
}
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
drawTexturedModalRect(sliderX, sliderY, 0, 0, sliderMidX, sliderMidY);
@ -99,7 +97,6 @@ public abstract class ElementSlider extends ElementBase
@Override
public void drawForeground(int mouseX, int mouseY)
{
int sliderX = posX + getSliderX();
int sliderY = posY + getSliderY();
@ -109,26 +106,22 @@ public abstract class ElementSlider extends ElementBase
protected boolean isHovering(int x, int y)
{
return intersectsWith(x, y);
}
public int getSliderX()
{
return 0;
}
public int getSliderY()
{
return 0;
}
@Override
public boolean onMousePressed(int mouseX, int mouseY, int mouseButton)
{
_isDragging = mouseButton == 0;
update(mouseX, mouseY);
return true;
@ -137,7 +130,6 @@ public abstract class ElementSlider extends ElementBase
@Override
public void onMouseReleased(int mouseX, int mouseY)
{
if (_isDragging)
{
onStopDragging();
@ -148,7 +140,6 @@ public abstract class ElementSlider extends ElementBase
@Override
public void update(int mouseX, int mouseY)
{
if (_isDragging)
{
dragSlider(mouseX - posX, mouseY - posY);
@ -160,7 +151,6 @@ public abstract class ElementSlider extends ElementBase
@Override
public boolean onMouseWheel(int mouseX, int mouseY, int movement)
{
if (movement > 0)
{
setValue(_value - 1);
@ -174,13 +164,26 @@ public abstract class ElementSlider extends ElementBase
public void onValueChanged(int value)
{
return;
}
public void onStopDragging()
{
return;
}
public void setEnabledTexture(ResourceLocation enabledTexture)
{
this.enabledTexture = enabledTexture;
}
public void setDisabledTexture(ResourceLocation disabledTexture)
{
this.disabledTexture = disabledTexture;
}
public void setHoverTexture(ResourceLocation hoverTexture)
{
this.hoverTexture = hoverTexture;
}
}

View file

@ -27,6 +27,8 @@ public class ElementTextField extends ElementBase
protected int selectionStart, selectionEnd;
protected int renderStart, caret;
private int paddingLeft, paddingRight, paddingTop, paddingBottom;
private boolean isFocused;
private boolean canFocusChange = true;
@ -47,6 +49,7 @@ public class ElementTextField extends ElementBase
public ElementTextField(GuiBase gui, int posX, int posY, int width, int height, short limit)
{
super(gui, posX, posY, width, height);
setPadding(1, 1, 1, 1);
setMaxLength(limit);
}
@ -59,6 +62,7 @@ public class ElementTextField extends ElementBase
{
super(gui, posX, posY, width, height);
setName(name);
setPadding(1, 1, 1, 1);
setMaxLength(limit);
}
@ -75,6 +79,39 @@ public class ElementTextField extends ElementBase
return this;
}
public ElementTextField setPaddingLeft(int paddingLeft)
{
this.paddingLeft = paddingLeft;
return this;
}
public ElementTextField setPaddingRight(int paddingRight)
{
this.paddingRight = paddingRight;
return this;
}
public ElementTextField setPaddingTop(int paddingTop)
{
this.paddingTop = paddingTop;
return this;
}
public ElementTextField setPaddingBottom(int paddingBottom)
{
this.paddingBottom = paddingBottom;
return this;
}
public ElementTextField setPadding(int paddingTop, int paddingRight, int paddingBottom, int paddingLeft)
{
this.paddingTop = paddingTop;
this.paddingRight = paddingRight;
this.paddingBottom = paddingBottom;
this.paddingLeft = paddingLeft;
return this;
}
public ElementTextField setSelectionColor(Number selectedLineColor, Number defaultCaretColor)
{
if (selectedLineColor != null)
@ -168,6 +205,26 @@ public class ElementTextField extends ElementBase
return width;
}
public int getPaddingLeft()
{
return paddingLeft;
}
public int getPaddingRight()
{
return paddingRight;
}
public int getPaddingTop()
{
return paddingTop;
}
public int getPaddingBottom()
{
return paddingBottom;
}
public int getVisibleWidth()
{
FontRenderer font = getFontRenderer();
@ -659,7 +716,7 @@ public class ElementTextField extends ElementBase
FontRenderer font = getFontRenderer();
char[] text = this.text;
int startX = posX + 3, endX = sizeX - 3, startY = posY + 6, endY = startY + font.FONT_HEIGHT;
int startX = posX + paddingLeft, endX = sizeX - paddingRight, startY = posY + paddingTop, endY = startY + font.FONT_HEIGHT + paddingBottom;
for (int i = renderStart, width = 0; i <= textLength; ++i)
{
boolean end = i == textLength;

View file

@ -85,8 +85,10 @@ tile.ee3:researchStation.name=Research Station
tile.ee3:augmentationTable.name=Augmentation Table [WIP]
tile.ee3:transmutationSquare.name=Transmutation Square [WIP]
tile.ee3:ashInfusedStone.name=Ash Infused Stone
tile.ee3:ashInfusedStoneSlab.name=Ash Infused Stone Slab
tile.ee3:alchemyArray.name=Alchemy Array
tile.ee3:dummyArray.name=Alchemy Array
tile.ee3:transmutationTablet.name=Transmutation Tablet
# Alchemy Arrays
arrays.ee3:basicAlchemyArray=Basic Alchemy Array [WIP]

Binary file not shown.

After

Width:  |  Height:  |  Size: 605 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 616 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 594 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 618 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 613 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB