Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.7.10] [Solved] Textures missing.


Awesome_Spider
 Share

Recommended Posts

I know I recently helped a person on an errors like this, but this different. Forge says my textures are missing,

[16:02:50] [Client thread/ERROR] [TEXTURE ERRORS]:     The missing resources for domain usus are:
[16:02:50] [Client thread/ERROR] [TEXTURE ERRORS]:       textures/blocks/steamEngineWaterPort.png
[16:02:50] [Client thread/ERROR] [TEXTURE ERRORS]:       textures/blocks/steamEngineFrontActive.png
[16:02:50] [Client thread/ERROR] [TEXTURE ERRORS]:       textures/blocks/steamEngineFrontWater4.png
[16:02:50] [Client thread/ERROR] [TEXTURE ERRORS]:       textures/blocks/steamEngineFrontActiveWater4.png
[16:02:50] [Client thread/ERROR] [TEXTURE ERRORS]:       textures/blocks/steamEngineFrontWater2.png
[16:02:50] [Client thread/ERROR] [TEXTURE ERRORS]:       textures/blocks/steamEngineSide.png
[16:02:50] [Client thread/ERROR] [TEXTURE ERRORS]:       textures/blocks/steamEngineFront.png
[16:02:50] [Client thread/ERROR] [TEXTURE ERRORS]:       textures/blocks/steamEngineFrontActiveWater1.png
[16:02:50] [Client thread/ERROR] [TEXTURE ERRORS]:       textures/items/redstoneCrystalBattery.png
[16:02:50] [Client thread/ERROR] [TEXTURE ERRORS]:       textures/blocks/steamEngineFrontActiveWater2.png
[16:02:50] [Client thread/ERROR] [TEXTURE ERRORS]:       textures/blocks/steamEngineFrontWater3.png
[16:02:50] [Client thread/ERROR] [TEXTURE ERRORS]:       textures/blocks/steamEngineFrontActiveWater3.png
[16:02:50] [Client thread/ERROR] [TEXTURE ERRORS]:       textures/blocks/steamEngineFrontWater1.png
[16:02:50] [Client thread/ERROR] [TEXTURE ERRORS]: -------------------------
[16:02:50] [Client thread/ERROR] [TEXTURE ERRORS]:     No other errors exist for domain usus
[16:02:50] [Client thread/ERROR] [TEXTURE ERRORS]: ==================================================
[16:02:50] [Client thread/ERROR] [TEXTURE ERRORS]: +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=

but I know they are there:

FxoWUWe.png

I checked the necessary thing to diagnose the problem but to no avail.

- My modid is all lower case

- There are no typos in anything

- I have the idea { module { inheritOutputDirs = true } } line at the bottom of my build.gradle (I use IntelliJ)

- In my code there is no typos

 

Could there be anything else wrong?

 

Here's my code:

 

 

My block:

public class BlockSteamEngine extends BlockContainer {
    IIcon[] icons;

    public BlockSteamEngine(Material material) {
        super(material);

        setBlockName("steamEngine");
        setBlockTextureName(Usus.MODID + ":steamEngine");
        setHardness(5F);
        setHarvestLevel("pickaxe", 0);
        setStepSound(Block.soundTypeMetal);
        setResistance(30F);
    }

    @Override
    public TileEntity createNewTileEntity(World world, int par2) {
        return new TileEntitySteamEngine();
    }

    @Override
    public void registerBlockIcons(IIconRegister reg){
        icons = new IIcon[12];

        icons[0] = reg.registerIcon(getTextureName() + "Front");
        icons[1] = reg.registerIcon(getTextureName() + "FrontWater1");
        icons[2] = reg.registerIcon(getTextureName() + "FrontWater2");
        icons[3] = reg.registerIcon(getTextureName() + "FrontWater3");
        icons[4] = reg.registerIcon(getTextureName() + "FrontWater4");
        icons[5] = reg.registerIcon(getTextureName() + "FrontActive");
        icons[6] = reg.registerIcon(getTextureName() + "FrontActiveWater1");
        icons[7] = reg.registerIcon(getTextureName() + "FrontActiveWater2");
        icons[8] = reg.registerIcon(getTextureName() + "FrontActiveWater3");
        icons[9] = reg.registerIcon(getTextureName() + "FrontActiveWater4");
        icons[10] = reg.registerIcon(getTextureName() + "Side");
        icons[11] = reg.registerIcon(getTextureName() + "WaterPort");
    }

    @Override
    public IIcon getIcon(IBlockAccess world, int posX, int posY, int posZ, int side){
        ForgeDirection side2 = ForgeDirection.getOrientation(side);
        TileEntitySteamEngine te = (TileEntitySteamEngine) world.getTileEntity(posX, posY, posZ);
        int waterLevel = te.waterMb;
        boolean active = te.burningFuel;

        int texture = 0;

        if (waterLevel == 0 && !active){
            texture = 0;
        } else if (waterLevel == 1 && !active){
            texture = 1;
        } else if (waterLevel == 2 && !active){
            texture = 2;
        } else if (waterLevel == 3 && !active){
            texture = 3;
        } else if (waterLevel == 4 && !active){
            texture = 4;
        } else if (waterLevel == 1 && active){
            texture = 5;
        } else if (waterLevel == 2 && active){
            texture = 6;
        } else if (waterLevel == 3 && active){
            texture = 7;
        } else if (waterLevel == 4 && active){
            texture = 8;
        }

        if (side2 == te.facing){
            return icons[texture];
        } else {
            if (side2 == ForgeDirection.DOWN){
                return icons[10];
            } else if (side2 == ForgeDirection.UP){
                return icons[10];
            } else {
                return icons[9];
            }
        }
    }
}

 

My tile entity:

public class TileEntitySteamEngine extends TileEntity implements IEnergyProvider, IInventory {
    public ForgeDirection facing;

    int fuelSlot = 0;
    int ashSlot = 1;
    ItemStack[] slots = new ItemStack[2];

    public int waterMb = 0;
    int maxWaterMb = 2500;

    public boolean burningFuel = false;
    int burningCountdown = 0;
    int rfToGenerate = 0;

    IEnergyStorage energyStorage = new IEnergyStorage() {
        int stored = 0;
        int max = 250;

        @Override
        public int receiveEnergy(int maxReceive, boolean simulate) {
            int remainder = maxReceive;
            int accepted = 0;
            boolean energyTransferComplete = false;

            while (!energyTransferComplete){
                if (stored < max && remainder > 0){
                    remainder --;
                    if (!simulate) stored ++;
                    accepted ++;
                } else {
                    energyTransferComplete = true;
                }
            }

            return accepted;
        }

        @Override
        public int extractEnergy(int maxExtract, boolean simulate) {//TODO Clean this up for efficiency. Make a class named "TileEntityEnergyCreator" and have this code in there. Then extend that class in other tile entities and call supers.
            int remainder = maxExtract;
            int extracted = 0;
            boolean energyTransferComplete = false;

            while (!energyTransferComplete){
                if (stored > remainder && remainder > 0){
                    remainder --;
                    if (!simulate) stored --;
                    extracted ++;
                } else {
                    energyTransferComplete = true;
                }
            }

            return extracted;
        }

        @Override
        public int getEnergyStored() {
            return stored;
        }

        @Override
        public int getMaxEnergyStored() {
            return max;
        }
    };

    @Override
    public void updateEntity(){
        burningFuel = burningCountdown > 0;

        if (getStackInSlot(fuelSlot) != null)
            if (isFuel(getStackInSlot(fuelSlot)) && waterMb > 0) {
                burningCountdown = getFuelBurnTime(getStackInSlot(fuelSlot));
                rfToGenerate = getFuelRf(getStackInSlot(fuelSlot));
                decrStackSize(fuelSlot, 1);

                markDirty();
            }

        if (burningFuel){
            burningCountdown --;
            rfToGenerate -= energyStorage.receiveEnergy(1, false);
            waterMb --;

            markDirty();
        }
    }

    public boolean isFuel(ItemStack stack){
        return getFuelBurnTime(stack) > 0;
    }

    public boolean doesFuelMakeAsh(ItemStack stack){
        Item item = stack.getItem();
        return item instanceof ItemTool && ((ItemTool)item).getToolMaterialName().equals("WOOD") |
                item instanceof ItemSword && ((ItemSword)item).getToolMaterialName().equals("WOOD") |
                item instanceof ItemHoe && ((ItemHoe)item).getToolMaterialName().equals("WOOD") |
                item == Items.stick |
                item == Items.coal |
                item == Item.getItemFromBlock(Blocks.sapling);
    }

    //Taken almost all from tile entity furnace class
    public int getFuelBurnTime(ItemStack stack){
        Item item = stack.getItem();

        if (item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.air) {
            Block block = Block.getBlockFromItem(item);

            if (block == Blocks.wooden_slab) {
                return 150;
            }

            if (block.getMaterial() == Material.wood) {
                return 300;
            }

            if (block == Blocks.coal_block) {
                return 16000;
            }
        }

        if (item instanceof ItemTool && ((ItemTool)item).getToolMaterialName().equals("WOOD")) return 200;
        if (item instanceof ItemSword && ((ItemSword)item).getToolMaterialName().equals("WOOD")) return 200;
        if (item instanceof ItemHoe && ((ItemHoe)item).getToolMaterialName().equals("WOOD")) return 200;
        if (item == Items.stick) return 100;
        if (item == Items.coal) return 1600;
        if (item == Items.lava_bucket) return 20000;
        if (item == Item.getItemFromBlock(Blocks.sapling)) return 100;
        if (item == Items.blaze_rod) return 2400;
        return GameRegistry.getFuelValue(stack);
    }

    public int getFuelRf(ItemStack stack){
        return getFuelBurnTime(stack) / 4;
    }

    public void addWaterBucketToTank(){
        int remainder = 1000;
        int added = 0;
        boolean waterTransferComplete = false;

        while (!waterTransferComplete){
            if (waterMb < maxWaterMb && remainder > 0){
                remainder --;
                waterMb --;
                added ++;
            } else {
                waterTransferComplete = true;
            }
        }
    }

    @Override
    public void readFromNBT(NBTTagCompound nbt) {
        super.readFromNBT(nbt);
        NBTTagList listOfItems = nbt.getTagList("Items", 10);
        slots = new ItemStack[getSizeInventory()];

        for (int i = 0; i < listOfItems.tagCount(); i++)
        {
            NBTTagCompound slotNbt = listOfItems.getCompoundTagAt(i);
            byte b0 = slotNbt.getByte("Slot");

            if (b0 >= 0 && b0 < slots.length)
            {
                slots[b0] = ItemStack.loadItemStackFromNBT(slotNbt);
            }
        }

        waterMb = nbt.getInteger("WaterMb");
        burningCountdown = nbt.getInteger("BurningTimer");
        rfToGenerate = nbt.getInteger("RfToGenerate");

        energyStorage.receiveEnergy(nbt.getInteger("RF"), false);

        facing = ForgeDirection.getOrientation(nbt.getInteger("Facing"));
    }

    @Override
    public void writeToNBT(NBTTagCompound nbt) {
        super.writeToNBT(nbt);

        NBTTagList listOfItems = new NBTTagList();

        for (int i = 0; i < slots.length; i++){
            if (slots[i] != null) {
                NBTTagCompound slotNbt = new NBTTagCompound();
                slotNbt.setByte("Slot", (byte) i);
                this.slots[i].writeToNBT(slotNbt);
                listOfItems.appendTag(slotNbt);
            }
        }

        nbt.setTag("Items", listOfItems);

        nbt.setInteger("WaterMb", waterMb);
        nbt.setInteger("BurningTimer", burningCountdown);
        nbt.setInteger("RfToGenerate", rfToGenerate);

        nbt.setInteger("RF", energyStorage.getEnergyStored());

        if (facing == ForgeDirection.NORTH) nbt.setInteger("Facing", 2);
        if (facing == ForgeDirection.EAST) nbt.setInteger("Facing", 5);
        if (facing == ForgeDirection.SOUTH) nbt.setInteger("Facing", 3);
        if (facing == ForgeDirection.WEST) nbt.setInteger("Facing", 4);
    }

    @Override
    public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate) {
        if (from != ForgeDirection.UP){
            return energyStorage.extractEnergy(maxExtract, simulate);
        } else {
            return 0;
        }
    }

    @Override
    public int getEnergyStored(ForgeDirection from) {
        return energyStorage.getEnergyStored();
    }

    @Override
    public int getMaxEnergyStored(ForgeDirection from) {
        return energyStorage.getMaxEnergyStored();
    }

    @Override
    public boolean canConnectEnergy(ForgeDirection from) {
        return from != ForgeDirection.UP;
    }

    @Override
    public int getSizeInventory() {
        return 2;
    }

    @Override
    public ItemStack getStackInSlot(int slot) {
        return slots[slot];
    }

    @Override
    public ItemStack decrStackSize(int slot, int amount) {
        if (slots[slot].stackSize - amount > 0) {
            slots[slot].stackSize -= amount;
        } else {
            slots[slot] = null;
        }

        return slots[slot];
    }

    @Override
    public ItemStack getStackInSlotOnClosing(int slot) {
        return slots[slot];
    }

    @Override
    public void setInventorySlotContents(int slot, ItemStack stack) {
        slots[slot] = stack;
    }

    @Override
    public String getInventoryName() {
        return "inv.steamEngine.name"; //TODO Confirm that I'm doing this right. Also, if I am, add this to the lang file.
    }

    @Override
    public boolean hasCustomInventoryName() {
        return true;
    }

    @Override
    public int getInventoryStackLimit() {
        return 64;
    }

    @Override
    public boolean isUseableByPlayer(EntityPlayer player) {
        return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this &&
                player.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64;
    }

    @Override
    public void openInventory() {}

    @Override
    public void closeInventory() {}

    @Override
    public boolean isItemValidForSlot(int slot, ItemStack stack) {
        if (slot == fuelSlot){
            return isFuel(stack);
        } else {
            return true;
        }
    }
}

 

If you need more code ask.

 

 

Link to comment
Share on other sites

Upon doing more searching around I found that IntelliJ had a folder named "assets.usus" instead of two folders named "assets" and "usus". I fixed that and now it's doing this:

TCvP5ER.png

It's a start. I guess I try using this guide by TheGreyGhost to troubleshoot since this current error is in there. Wish me luck.

Link to comment
Share on other sites

You also need to hava item.json for this block that will point at parent model.json of this block.

Then you need to register it in init() (that thingy with "inventory" at end xD ).

If your block has many variants - you also need to register them all.

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

...but right now I haven't slept fort too long and it's 7AM alredy...

...

Cya, gl m8!

 

I wrote this like 10min ago...(other thread) Ernio Off! *falls on bed*

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

Here's my updated code:

 

 

Tile Entity:

public class TileEntitySteamEngine extends TileEntity implements IEnergyProvider, IInventory {
    public ForgeDirection facing;
    public boolean facingWarning = false;

    int fuelSlot = 0;
    int ashSlot = 1;
    ItemStack[] slots = new ItemStack[2];

    public int waterMb = 0;
    int maxWaterMb = 2500;

    public boolean burningFuel = false;
    public ItemStack currentBurningFuel = null;
    int progress = 0;
    int burningCountdown = 0;
    int rfToGenerate = 0;

    IEnergyStorage energyStorage = new IEnergyStorage() {
        int stored = 0;
        int max = 250;

        @Override
        public int receiveEnergy(int maxReceive, boolean simulate) {
            int remainder = maxReceive;
            int accepted = 0;
            boolean energyTransferComplete = false;

            while (!energyTransferComplete){
                if (stored < max && remainder > 0){
                    remainder --;
                    if (!simulate) stored ++;
                    accepted ++;
                } else {
                    energyTransferComplete = true;
                }
            }

            return accepted;
        }

        @Override
        public int extractEnergy(int maxExtract, boolean simulate) {//TODO Clean this up for efficiency. Make a class named "TileEntityEnergyCreator" and have this code in there. Then extend that class in other tile entities and call supers.
            int remainder = maxExtract;
            int extracted = 0;
            boolean energyTransferComplete = false;

            while (!energyTransferComplete){
                if (stored > remainder && remainder > 0){
                    remainder --;
                    if (!simulate) stored --;
                    extracted ++;
                } else {
                    energyTransferComplete = true;
                }
            }

            return extracted;
        }

        @Override
        public int getEnergyStored() {
            return stored;
        }

        @Override
        public int getMaxEnergyStored() {
            return max;
        }
    };

    @Override
    public void updateEntity(){
        if (!facingWarning){
            if (facing.equals(ForgeDirection.UNKNOWN)) Usus.logger.warn("A steam engine tile entity (" + toString() + ") has an invalid facing field. This is a bug.");
            facingWarning = true;
        }

        burningFuel = burningCountdown > 0;

        if (getStackInSlot(fuelSlot) != null)
            if (isFuel(getStackInSlot(fuelSlot)) && waterMb > 0) {
                burningCountdown = getFuelBurnTime(getStackInSlot(fuelSlot));
                rfToGenerate = getFuelRf(getStackInSlot(fuelSlot));
                currentBurningFuel = getStackInSlot(fuelSlot);
                decrStackSize(fuelSlot, 1);

                markDirty();
            }

        if (burningFuel){
            burningCountdown --;
            rfToGenerate -= energyStorage.receiveEnergy(1, false);
            waterMb --;

            markDirty();

            if (burningCountdown == 0){
                if (currentBurningFuel != null) {
                    if (doesFuelMakeAsh(currentBurningFuel)) {
                        if (getStackInSlot(ashSlot).getItem() == Usus.ash) {
                            int quantity = getStackInSlot(ashSlot).stackSize;

                            setInventorySlotContents(ashSlot, new ItemStack(Usus.ash, quantity + 1));
                        }
                    }

                    currentBurningFuel = null;
                }
            }
        }
    }

    public boolean isFuel(ItemStack stack){
        return getFuelBurnTime(stack) > 0;
    }

    public boolean doesFuelMakeAsh(ItemStack stack){
        Item item = stack.getItem();
        return item instanceof ItemTool && ((ItemTool)item).getToolMaterialName().equals("WOOD") |
                item instanceof ItemSword && ((ItemSword)item).getToolMaterialName().equals("WOOD") |
                item instanceof ItemHoe && ((ItemHoe)item).getToolMaterialName().equals("WOOD") |
                item == Items.stick |
                item == Items.coal |
                item == Item.getItemFromBlock(Blocks.sapling);
    }

    //Taken almost all from tile entity furnace class
    public int getFuelBurnTime(ItemStack stack){
        Item item = stack.getItem();

        if (item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.air) {
            Block block = Block.getBlockFromItem(item);

            if (block == Blocks.wooden_slab) {
                return 150;
            }

            if (block.getMaterial() == Material.wood) {
                return 300;
            }

            if (block == Blocks.coal_block) {
                return 16000;
            }
        }

        if (item instanceof ItemTool && ((ItemTool)item).getToolMaterialName().equals("WOOD")) return 200;
        if (item instanceof ItemSword && ((ItemSword)item).getToolMaterialName().equals("WOOD")) return 200;
        if (item instanceof ItemHoe && ((ItemHoe)item).getToolMaterialName().equals("WOOD")) return 200;
        if (item == Items.stick) return 100;
        if (item == Items.coal) return 1600;
        if (item == Items.lava_bucket) return 20000;
        if (item == Item.getItemFromBlock(Blocks.sapling)) return 100;
        if (item == Items.blaze_rod) return 2400;
        return GameRegistry.getFuelValue(stack);
    }

    public int getFuelRf(ItemStack stack){
        return getFuelBurnTime(stack) / 4;
    }

    public void addWaterBucketToTank(){
        int remainder = 1000;
        int added = 0;
        boolean waterTransferComplete = false;

        while (!waterTransferComplete){
            if (waterMb < maxWaterMb && remainder > 0){
                remainder --;
                waterMb --;
                added ++;
            } else {
                waterTransferComplete = true;
            }
        }
    }

    public int scaleRfForDisplay(int maxNumber){
        return energyStorage.getEnergyStored() * maxNumber / energyStorage.getMaxEnergyStored();
    }

    public int scaleWaterForDisplay(int maxNumber){
        return waterMb * maxNumber / maxWaterMb;
    }

    @SideOnly(Side.CLIENT)
    public int getCookProgressScaled(int maxNumber) {
        return progress * maxNumber / 200;
    }

    @SideOnly(Side.CLIENT)
    public int getBurnTimeRemainingScaled(int maxNumber) {
        if (this.burningCountdown == 0) {
            this.burningCountdown = 200;
        }

        return this.progress * maxNumber / this.burningCountdown;
    }

    @Override
    public void readFromNBT(NBTTagCompound nbt) {
        super.readFromNBT(nbt);
        NBTTagList listOfItems = nbt.getTagList("Items", 10);
        slots = new ItemStack[getSizeInventory()];

        for (int i = 0; i < listOfItems.tagCount(); i++)
        {
            NBTTagCompound slotNbt = listOfItems.getCompoundTagAt(i);
            byte b0 = slotNbt.getByte("Slot");

            if (b0 >= 0 && b0 < slots.length)
            {
                slots[b0] = ItemStack.loadItemStackFromNBT(slotNbt);
            }
        }

        waterMb = nbt.getInteger("WaterMb");
        progress = nbt.getInteger("BurnProgress");
        burningCountdown = nbt.getInteger("BurningTimer");
        currentBurningFuel = ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("CurrentBurningFuel")); //TODO Confirm that this works.
        rfToGenerate = nbt.getInteger("RfToGenerate");

        energyStorage.receiveEnergy(nbt.getInteger("RF"), false);

        facing = ForgeDirection.valueOf(nbt.getString("Facing"));
    }

    @Override
    public void writeToNBT(NBTTagCompound nbt) {
        super.writeToNBT(nbt);

        NBTTagList listOfItems = new NBTTagList();

        for (int i = 0; i < slots.length; i++){
            if (slots[i] != null) {
                NBTTagCompound slotNbt = new NBTTagCompound();
                slotNbt.setByte("Slot", (byte) i);
                this.slots[i].writeToNBT(slotNbt);
                listOfItems.appendTag(slotNbt);
            }
        }

        nbt.setTag("Items", listOfItems);

        nbt.setInteger("WaterMb", waterMb);
        nbt.setInteger("BurnProgress", progress);
        nbt.setInteger("BurningTimer", burningCountdown);
        NBTTagCompound currentBurningFuelTag = new NBTTagCompound();
        currentBurningFuel.writeToNBT(currentBurningFuelTag);
        nbt.setTag("CurrentBurningFuel", currentBurningFuelTag);
        nbt.setInteger("RfToGenerate", rfToGenerate);

        nbt.setInteger("RF", energyStorage.getEnergyStored());

        if (facing == ForgeDirection.NORTH){
            nbt.setString("Facing", ForgeDirection.NORTH.toString());
        } else if (facing == ForgeDirection.EAST){
            nbt.setString("Facing", ForgeDirection.EAST.toString());
        } else if (facing == ForgeDirection.SOUTH){
            nbt.setString("Facing", ForgeDirection.SOUTH.toString());
        } else if (facing == ForgeDirection.WEST){
            nbt.setString("Facing", ForgeDirection.WEST.toString());
        } else {
            nbt.setString("Facing", ForgeDirection.UNKNOWN.toString());
        }
    }

    @Override
    public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate) {
        if (from != ForgeDirection.UP){
            return energyStorage.extractEnergy(maxExtract, simulate);
        } else {
            return 0;
        }
    }

    @Override
    public int getEnergyStored(ForgeDirection from) {
        return energyStorage.getEnergyStored();
    }

    @Override
    public int getMaxEnergyStored(ForgeDirection from) {
        return energyStorage.getMaxEnergyStored();
    }

    @Override
    public boolean canConnectEnergy(ForgeDirection from) {
        return from != ForgeDirection.UP;
    }

    @Override
    public int getSizeInventory() {
        return 2;
    }

    @Override
    public ItemStack getStackInSlot(int slot) {
        return slots[slot];
    }

    @Override
    public ItemStack decrStackSize(int slot, int amount) {
        if (slots[slot].stackSize - amount > 0) {
            slots[slot].stackSize -= amount;
        } else {
            slots[slot] = null;
        }

        return slots[slot];
    }

    @Override
    public ItemStack getStackInSlotOnClosing(int slot) {
        return slots[slot];
    }

    @Override
    public void setInventorySlotContents(int slot, ItemStack stack) {
        slots[slot] = stack;
    }

    @Override
    public String getInventoryName() {
        return "inv.steamEngine.name"; //TODO Confirm that I'm doing this right. Also, if I am, add this to the lang file.
    }

    @Override
    public boolean hasCustomInventoryName() {
        return true;
    }

    @Override
    public int getInventoryStackLimit() {
        return 64;
    }

    @Override
    public boolean isUseableByPlayer(EntityPlayer player) {
        return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this &&
                player.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64;
    }

    @Override
    public void openInventory() {}

    @Override
    public void closeInventory() {}

    @Override
    public boolean isItemValidForSlot(int slot, ItemStack stack) {
        if (slot == fuelSlot){
            return isFuel(stack);
        } else if (slot == ashSlot){
           return stack.getItem() == Usus.ash;
        } else {
            return true;
        }
    }
}

 

Block:

public class BlockSteamEngine extends BlockContainer {
    IIcon[] icons;

    public BlockSteamEngine(Material material) {
        super(material);

        setBlockName("steamEngine");
        setBlockTextureName(Usus.MODID + ":steamEngine");
        setHardness(5F);
        setHarvestLevel("pickaxe", 0);
        setStepSound(Block.soundTypeMetal);
        setResistance(30F);
    }

    @Override
    public TileEntity createNewTileEntity(World world, int par2) {
        return new TileEntitySteamEngine();
    }

    @Override
    public void registerBlockIcons(IIconRegister reg){
        icons = new IIcon[12];

        icons[0] = reg.registerIcon(getTextureName() + "Front");
        icons[1] = reg.registerIcon(getTextureName() + "FrontWater1");
        icons[2] = reg.registerIcon(getTextureName() + "FrontWater2");
        icons[3] = reg.registerIcon(getTextureName() + "FrontWater3");
        icons[4] = reg.registerIcon(getTextureName() + "FrontWater4");
        icons[5] = reg.registerIcon(getTextureName() + "FrontActive");
        icons[6] = reg.registerIcon(getTextureName() + "FrontActiveWater1");
        icons[7] = reg.registerIcon(getTextureName() + "FrontActiveWater2");
        icons[8] = reg.registerIcon(getTextureName() + "FrontActiveWater3");
        icons[9] = reg.registerIcon(getTextureName() + "FrontActiveWater4");
        icons[10] = reg.registerIcon(getTextureName() + "Side");
        icons[11] = reg.registerIcon(getTextureName() + "WaterPort");
    }

    @Override
    public IIcon getIcon(IBlockAccess world, int posX, int posY, int posZ, int side){
        ForgeDirection side2 = ForgeDirection.getOrientation(side);
        TileEntitySteamEngine te = (TileEntitySteamEngine) world.getTileEntity(posX, posY, posZ);
        int waterLevel = te.waterMb;
        boolean active = te.burningFuel;

        int waterLevelScaled = te.scaleWaterForDisplay(4);


        if (te.facing.equals(side2)) {
            if (waterLevelScaled == 0 && !active) {
                return icons[0];
            } else if (waterLevelScaled == 1 && !active) {
                return icons[1];
            } else if (waterLevelScaled == 2 && !active) {
                return icons[3];
            } else if (waterLevelScaled == 3 && !active) {
                return icons[4];
            } else if (waterLevelScaled == 4 && !active) {
                return icons[5];
            } else if (waterLevelScaled == 0 && active) {
                return icons[5];
            } else if (waterLevelScaled == 1 && active) {
                return icons[6];
            } else if (waterLevelScaled == 2 && active) {
                return icons[7];
            } else if (waterLevelScaled == 3 && active) {
                return icons[8];
            } else if (waterLevelScaled == 4 && active) {
                return icons[9];
            }
        } else if (side2.equals(ForgeDirection.NORTH)){
            return icons[10];
        } else if (side2.equals(ForgeDirection.SOUTH)){
            return icons[10];
        } else if (side2.equals(ForgeDirection.EAST)){
            return icons[10];
        } else if (side2.equals(ForgeDirection.WEST)){
            return icons[10];
        } else if (side2.equals(ForgeDirection.UP)){
            return icons[11];
        } else if (side2.equals(ForgeDirection.DOWN)){
            return icons[11];
        }

        return null;
    }

    @Override
    public void onBlockPlacedBy(World world, int posX, int posY, int posZ, EntityLivingBase entity, ItemStack stack) {
        int lookDirection = MathHelper.floor_double((double) (entity.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;

        ForgeDirection lookDirectionSimplified = ForgeDirection.getOrientation(lookDirection);

        TileEntitySteamEngine te = (TileEntitySteamEngine) world.getTileEntity(posX, posY, posZ);
        te.facing = lookDirectionSimplified.getOpposite();
    }
}

 

 

Link to comment
Share on other sites

Um no, the way it works is in your inventory the getIcon(IBlockAccess, int, int, int) doesn't exist, because there is no TileEntity for it. So it will use getIcon() (Which would be this.blockIcon which you never set, so if all sides will be the same that would work just setting the blockIcon value) or it will use getIcon(side, meta) which is also used for blocks placed in the world if the IBlockAccess, int, int, int one isn't used first. So it should simply work by overriding the side meta one as well and returning the correct icon.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.