Jump to content

tattyseal

Forge Modder
  • Posts

    194
  • Joined

  • Last visited

Posts posted by tattyseal

  1. Oh i fixed so it worked but the texture only loads sometimes.

    It is something i can do to fix that?

     

    Non sarcasm initialized...

     

    1) Do you do anything different when it does not load.

    2) Post your updated code and eclipse texture structure

    3) In future, when you say "THIS DOESTN OWKR HLP ME" give us code and things to help us 'Help' you...

  2. If you're in eclipse and you see the name of a class, you can either right click on it and click open declaration, or control click on the name itself. Both will bring you to the class.

     

    To store your icons use an array of how many textures you want, so for example

     

     

     

    public IIcon[] icons = new IIcon[3]; For 3 Textures, e.g: Top, Bottom, and One for all sides

     

     

     

    To register your textures:

     

     

     

    @Override

    public void func_149651_a(IIconRegister i)

    {

    icons[0] = i.registerIcon("modid:block_top");

                    icons[1] = i.registerIcon("modid:block_bottom");

                    icons[2] = i.registerIcon("modid:block_sides");

    }

     

     

     

    And to declare them so it works ingame:

     

     

     

    @Override

    public IIcon func_149673_e(IBlockAccess block, int x, int y, int z, int side)

    {

            switch(side)

            {

                case 0 : return icons[0]; //Top

                case 1 : return icons[1]; //Bottom

                default : return icons[2]; //Sides

            }

    }

     

    //Switch switches depending on what case;

    //Case is basically saying if(side == 0);

    // If the case is 0 then return the top texture

    // If the case is 1 then return the bottom texture

    // Default basically says else{}

    // So if it is not 0 or 1, then return the side texture.

    // 0 is top, 1 is bottom, 2, 3, 4 and 5 are 4 of the sides, you can figure out what is what easily enoguh.

     

     

     

    :)

  3. YOU FIXED IT!!!!

     

    You are the man!!

    Man thank you so much, your awesome!!!

     

    I can not explain how happy I am, I have been having trouble with this for a couple of days then you come along and solve it.

     

    YES!!!

     

    Thank you so much!!

     

    No problem! ;)

  4. Oops....sorry I forgot to add that class.

     

    GuiHandler

     

    package Crystalorb;

     

    import net.minecraft.entity.player.EntityPlayer;

    import net.minecraft.tileentity.TileEntity;

    import net.minecraft.world.World;

    import cpw.mods.fml.common.network.IGuiHandler;

     

    public class GuiHandler implements IGuiHandler{

     

    @Override

    public Object getServerGuiElement(int ID, EntityPlayer player, World world,

    int x, int y, int z) {

    TileEntity tileentity = world.getBlockTileEntity(x, y, z);

     

    if(tileentity instanceof TileEntityEnergizer){

    return new GUIEnergizer(player.inventory, (TileEntityEnergizer) tileentity);

    }

     

    return null;

    }

     

    @Override

    public Object getClientGuiElement(int ID, EntityPlayer player, World world,

    int x, int y, int z) {

    TileEntity tileentity = world.getBlockTileEntity(x, y, z);

     

    if(tileentity instanceof TileEntityEnergizer){

    return new GUIEnergizer(player.inventory, (TileEntityEnergizer) tileentity);

    }

     

    return null;

    }

     

    }

     

     

     

    Also post your GUIEnergizer class please.

  5. Hello, so I want my TileEntity to consume items from the chest slots and convert them into the item or block in the top slot, but, when it consumes them it will say 92 or 88 or something random instead of 64 and make more items than it should, but if I right click on the block again the value goes to what it should be.

     

    TileEntity

     

     

    package org.tattyseal.exchange.tile;

     

    import modmuss50.mods.transcraft.TileEntitys.TileBase;

    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 org.tattyseal.exchange.common.ValueConfig;

     

    import cpw.mods.fml.common.network.PacketDispatcher;

     

    public class TileEnergyExchanger extends TileBase implements IInventory

    {

    public ItemStack[] items;

     

    public int eValue;

    public int targetEValue;

     

    public static final int firstSlot = 9;

    public static final int lastSlot = 62;

     

    public TileEnergyExchanger()

    {

    eValue = 0;

    targetEValue = 0;

    items = new ItemStack[9*7 + 1];

    }

     

    @Override

    public void updateEntity()

    {

    super.updateEntity();

    PacketDispatcher.sendPacketToAllInDimension(getDescriptionPacket(), worldObj.provider.dimensionId);

     

     

    if(getStackInSlot(lastSlot + 1) != null)

    {

    if(ValueConfig.eValues.containsKey(getStackInSlot(lastSlot + 1).itemID))

    {

    targetEValue = ValueConfig.eValues.get(getStackInSlot(lastSlot + 1).itemID);

    }

    else

    {

    targetEValue = 0;

    }

    }

    else

    {

    targetEValue = 0;

    }

     

    for(int slot = firstSlot; slot <= lastSlot - 1; slot++)

    {

    if(getStackInSlot(slot) != null)

    {

    if(ValueConfig.eValues.containsKey(getStackInSlot(slot).itemID))

    {

    ItemStack stack = getStackInSlot(slot);

     

    for(int i = 0; i < stack.stackSize; i = i + 1)

    {

    eValue += ValueConfig.eValues.get(stack.itemID);

    decrStackSize(slot, 1);

    }

    break;

    }

    else

    {

     

    }

    }

    }

     

    if(eValue >= targetEValue)

    {

    if(getStackInSlot(lastSlot + 1) != null)

    {

    if(getStackInSlot(lastSlot + 1).stackSize != 64)

    {

    eValue -= targetEValue;

    getStackInSlot(lastSlot + 1).stackSize += 1;

    }

    }

    }

    }

     

    @Override

    public int getSizeInventory()

    {

    return items.length;

    }

     

    @Override

    public ItemStack getStackInSlot(int i)

    {

    return items;

    }

     

    @Override

    public ItemStack decrStackSize(int slot, int count)

    {

    ItemStack item = getStackInSlot(slot);

     

    if(item != null)

    {

    if(item.stackSize <= count)

    {

    setInventorySlotContents(slot, null);

    }

    else

    {

    item = item.splitStack(count);

    onInventoryChanged();

    }

    }

     

    return item;

    }

     

    public ItemStack incrStackSize(int slot, int count)

    {

    ItemStack item = getStackInSlot(slot);

     

    if(item != null)

    {

    if(item.stackSize >= count)

    {

    setInventorySlotContents(slot, null);

    }

    else

    {

    item.stackSize++;

    onInventoryChanged();

    }

    }

     

    return item;

    }

     

    @Override

    public ItemStack getStackInSlotOnClosing(int i)

    {

    return null;

    }

     

    @Override

    public void setInventorySlotContents(int i, ItemStack itemstack)

    {

    items = itemstack;

     

    if(itemstack != null && itemstack.stackSize  > getInventoryStackLimit())

    {

    itemstack.stackSize = getInventoryStackLimit();

    }

     

    onInventoryChanged();

    }

     

    @Override

    public String getInvName()

    {

    return "exchange.exchanger";

    }

     

    @Override

    public boolean isInvNameLocalized()

    {

    return true;

    }

     

    @Override

    public int getInventoryStackLimit()

    {

    return 64;

    }

     

    @Override

    public boolean isUseableByPlayer(EntityPlayer entityplayer)

    {

    return true;

    }

     

    @Override

    public void openChest() {}

     

    @Override

    public void closeChest() {}

     

    @Override

    public boolean isItemValidForSlot(int i, ItemStack itemstack)

    {

    return true;

    }

     

    @Override

    public void writeToNBT(NBTTagCompound nbt)

    {

    super.writeToNBT(nbt);

    NBTTagList nbtItems = new NBTTagList();

     

    for(int i = 0; i < getSizeInventory(); i++)

    {

    ItemStack stack = getStackInSlot(i);

     

    if(stack != null)

    {

    NBTTagCompound item = new NBTTagCompound();

    item.setByte("Slot", (byte) i);

    stack.writeToNBT(item);

    nbtItems.appendTag(item);

    }

    }

     

    nbt.setTag("Items", nbtItems);

    }

     

    @Override

    public void readFromNBT(NBTTagCompound nbt)

    {

    super.readFromNBT(nbt);

     

    NBTTagList items = nbt.getTagList("Items");

     

    for(int i = 0; i < items.tagCount(); i++)

    {

    NBTTagCompound item = (NBTTagCompound) items.tagAt(i);

    int slot = item.getByte("Slot");

     

    if(slot >= 0 && slot < getSizeInventory())

    {

    setInventorySlotContents(slot, ItemStack.loadItemStackFromNBT(item));

    }

    }

    }

     

    @Override

    public void writeCustomNBT(NBTTagCompound cmp)

    {

    super.writeCustomNBT(cmp);

     

    cmp.setInteger("current", eValue);

    cmp.setInteger("target", targetEValue);

    }

     

    @Override

    public void readCustomNBT(NBTTagCompound cmp)

    {

    super.readCustomNBT(cmp);

    eValue = cmp.getInteger("current");

    targetEValue = cmp.getInteger("target");

    }

     

    }

     

     

     

     

    TileBase

     

     

    /**

    * This class is part of the mod Transcraft.

    *

    * Transcraft is Open Source but you cant use any code without permission!

    *

    */

     

    package modmuss50.mods.transcraft.TileEntitys;

     

    import net.minecraft.nbt.NBTTagCompound;

    import net.minecraft.network.INetworkManager;

    import net.minecraft.network.packet.Packet;

    import net.minecraft.network.packet.Packet132TileEntityData;

    import net.minecraft.tileentity.TileEntity;

     

    public class TileBase extends TileEntity {

     

    @Override

    public void writeToNBT(NBTTagCompound par1nbtTagCompound) {

    super.writeToNBT(par1nbtTagCompound);

     

    writeCustomNBT(par1nbtTagCompound);

    }

     

    @Override

    public void readFromNBT(NBTTagCompound par1nbtTagCompound) {

    super.readFromNBT(par1nbtTagCompound);

     

    readCustomNBT(par1nbtTagCompound);

    }

     

    public void writeCustomNBT(NBTTagCompound cmp) {

    // NO-OP

    }

     

    public void readCustomNBT(NBTTagCompound cmp) {

    // NO-OP

    }

     

    @Override

    public Packet getDescriptionPacket() {

    NBTTagCompound nbttagcompound = new NBTTagCompound();

    writeCustomNBT(nbttagcompound);

    return new Packet132TileEntityData(xCoord, yCoord, zCoord, -999, nbttagcompound);

    }

     

    @Override

    public void onDataPacket(INetworkManager manager, Packet132TileEntityData packet) {

    super.onDataPacket(manager, packet);

    readCustomNBT(packet.data);

    worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);

    }

    }

     

     

     

     

    GUI

     

     

    package org.tattyseal.exchange.gui;

     

    import org.tattyseal.exchange.tile.TileEnergyExchanger;

     

    import net.minecraft.client.gui.inventory.GuiContainer;

    import net.minecraft.entity.player.InventoryPlayer;

    import net.minecraft.tileentity.TileEntity;

    import net.minecraft.util.ResourceLocation;

     

    public class GuiExchanger extends GuiContainer

    {

    public TileEnergyExchanger tile;

    public InventoryPlayer inv;

     

    private static final ResourceLocation guiTex = new ResourceLocation("exchange", "textures/gui/energyExchanger.png");

     

    public GuiExchanger(InventoryPlayer inv, TileEntity tile)

    {

    super(new ContainerExchanger(inv, tile));

    xSize = 176;

    ySize = 238;

     

    this.tile = (TileEnergyExchanger) tile;

    this.inv = inv;

    }

     

    @Override

    protected void drawGuiContainerBackgroundLayer(float f, int x, int y)

    {

    mc.renderEngine.bindTexture(guiTex);

     

    drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);

     

    if(tile.targetEValue != 0 && tile.eValue != 0)

    {

    int width = tile.eValue / tile.targetEValue;

     

    drawTexturedModalRect(guiLeft + 28, guiTop + 10, 1, 239, 140 / width, 16);

    }

     

    drawString(mc.fontRenderer, "Target E Value: " + tile.targetEValue, guiLeft + 50, guiTop + 18, 0x000FFF);

    drawString(mc.fontRenderer, "Current E Value: : " + tile.eValue, guiLeft + 50, guiTop + 10, 0x000FFF);

    }

    }

     

     

     

     

    Container

     

     

    package org.tattyseal.exchange.gui;

     

    import net.minecraft.entity.player.EntityPlayer;

    import net.minecraft.entity.player.InventoryPlayer;

    import net.minecraft.inventory.Container;

    import net.minecraft.inventory.Slot;

    import net.minecraft.item.ItemStack;

    import net.minecraft.tileentity.TileEntity;

     

    import org.tattyseal.exchange.tile.TileEnergyExchanger;

     

    public class ContainerExchanger extends Container

    {

    public TileEnergyExchanger tile;

    public InventoryPlayer inv;

     

    public ContainerExchanger(InventoryPlayer inv, TileEntity tile)

    {

    super();

    this.inv = inv;

    this.tile = (TileEnergyExchanger) tile;

     

    for(int x = 0; x < 9; x++)

    {

    addSlotToContainer(new Slot(inv, x, 8 + 18 * x, 214));

    }

     

    for(int x = 0; x < 9; x++)

    {

    for(int y = 0; y < 3; y++)

    {

    addSlotToContainer(new Slot(inv, x + y * 9 + 9, /*X*/ 8 + 18 * x, 72 + y * 18 + 84));

    }

    }

     

    for(int x = 0; x < 9; x++)

    {

    for(int y = 0; y < 6; y++)

    {

    addSlotToContainer(new Slot(this.tile, x + y * 9 + 9, 8 + 18 * x, 34 + y * 18));

    }

    }

     

    addSlotToContainer(new Slot(this.tile, 9 * 7, 8, 10));

    }

     

    @Override

    public boolean canInteractWith(EntityPlayer entityplayer)

    {

    return true;

    }

     

    @Override

    public ItemStack transferStackInSlot(EntityPlayer p, int i)

    {

    return null;

    }

    }

     

     

     

     

    I cannot see anything wrong! Please Help! :)

  6. Hello,

     

    I am making a GUI for my item and when I render my text before my rectangle the whole rectangle is black, but on the other hand if I render it after my rect there is no text what so ever.

     

    GuiCreativeBucket.java

    package org.zaet.client.gui;
    
    import net.minecraft.client.gui.GuiScreen;
    import net.minecraft.client.renderer.Tessellator;
    import net.minecraft.util.ResourceLocation;
    
    public class GuiCreativeBucket extends GuiScreen
    {
    private ResourceLocation rectBG = new ResourceLocation("textures/gui/demo_background.png");
    public GuiCreativeBucket()
    {
    
    }
    
    public boolean doesGuiPauseGame()
    {
    	return true;
    }
    
    public void initGui()
    {
    	super.initGui();
    }
    
    public void updateScreen()
    {
    	super.updateScreen();
    }
    
    public void drawContainerGuiForegroundLayer()
    {
    
    }
    
    public void drawScreen(int k, int j, float l)
    {
    	this.drawString(mc.fontRenderer, "Testing", 300, 200, 0);
    	this.drawDefaultBackground();		
    	this.mc.renderEngine.bindTexture(rectBG);
    	this.drawTexturedQuadFit((width / 2) - 200, (height / 2) - 150, 400, 400, 1);
    	this.drawString(mc.fontRenderer, "Testing", 300, 200, 0);
    	super.drawScreen(k, j, l);
    }
    
    public static void drawTexturedQuadFit(double x, double y, double width, double height, double zLevel)
    {
    	Tessellator tessellator = Tessellator.instance;
            tessellator.startDrawingQuads();
            tessellator.addVertexWithUV(x + 0, y + height, zLevel, 0,1);
            tessellator.addVertexWithUV(x + width, y + height, zLevel, 1, 1);
            tessellator.addVertexWithUV(x + width, y + 0, zLevel, 1,0);
            tessellator.addVertexWithUV(x + 0, y + 0, zLevel, 0, 0);
            tessellator.draw();
    }
    }
    

    Please Help

  7. I notice that you opened 2 threads both called 'Help Needed!'

     

    Please do not double post, you could have posted this in your last thread, or at least opened this and the other one with names suiting to what they are.

     

    Back to topic.

     

    You would have to use a tick handler to detect if the player was invisible.

     

    Thats all I can tell you, as I have never looked into armor or item rendering. Someone else can continue on my start though ;)

  8. When I try to install FML 1.7.2 with gradlew setUpDevWorkspace or gradlew eclipse this happens:

     

     

     

    ****************************

    Powered By MCP:           

    http://mcp.ocean-labs.de/ 

    Searge, ProfMobius, Fesh0r,

    R4wk, ZeuX, IngisKahn     

    MCP Data version : unknown

    ****************************

    :extractUserDev

    :getAssetsIndex

    :getAssets

    :copyAssets

    :downloadClient SKIPPED

    :downloadServer SKIPPED

    :mergeJars SKIPPED

    :applyBinPatches SKIPPED

    :downloadMcpTools UP-TO-DATE

    :genSrgs UP-TO-DATE

    :deobfBinJar FAILED

     

    FAILURE: Build failed with an exception.

     

    * What went wrong:

    A problem was found with the configuration of task ':deobfBinJar'.

    > No value has been specified for property 'exceptorJson'.

     

    * Try:

    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

     

    BUILD FAILED

     

    Total time: 20.261 secs

     

     

     

    Please Help!

  9. I will just go full in and help you.

     

    @Override

    public boolean isOpaqueCube()

    {

        return false;

    }

     

    In the Ice, Leaves and Everything Draco has suggested has this in it with a description above it.

     

    Look about before posting, there must be a few threads with this question atleast.

     

    -tattyseal

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.