Jump to content

[1.7.10] [Solved] Textures missing.


Recommended Posts

Posted

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.

 

 

Posted

Woops. That's an error on my part. Thanks for noticing.

Posted

I changed them to lower case and they still aren't working.

Posted

Nope, I  added xxxxxxxxxx at the end of each name and then changed them back and it's still not working.

Posted

Try naming them something like SteamEngineWaterPortChanged, then back to steamEngineWaterPort

 

I had this before, where I had SiliconOre, so I renamed it to siliconOre. Didn't fix the problem. Put it back to SiliconOre, then added something onto it. Then reverted it back to normal.

Posted

try using lowercase only.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Posted

Nope. I changed one from steamEngineFront.png to steam_engine_front.png and changed the instance to be that and it still doesn't work.

Posted

ya, that was the first thing I did when I extracted forge.

Posted

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.

Posted

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.

Posted

...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.

Posted

I've been doing some tinkering and now the furnace part is on the bottom.

1HBc9OG.png

That isn't a problem, I can fix that, my problem is the block that appears in my inventory is purple and black. How do I fix that?

Posted

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();
    }
}

 

 

Posted

I could override the one with meta and side, but I need access to my tileEntity. My code won't work without it. I would have to return null in the one with meta and side.

Posted

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.

Posted

Ok, that makes sense. I'll try experimenting a little more.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • When I first heard about Bitcoin back in 2018, I was skeptical. The idea of a decentralized, digital currency seemed too good to be true. But I was intrigued as I learned more about the technology behind it and its potential. I started small, investing just a few hundred dollars, dipping my toes into the cryptocurrency waters. At first, it was exhilarating to watch the value of my investment grow exponentially. I felt like I was part of the future, an early adopter of this revolutionary new asset. But that euphoria was short-lived. One day, I logged into my digital wallet only to find it empty - my Bitcoin had vanished without a trace. It turned out that the online exchange I had trusted had been hacked, and my funds were stolen. I was devastated, both financially and emotionally. All the potential I had seen in Bitcoin was tainted by the harsh reality that with decentralization came a lack of regulation and oversight. My hard-earned money was gone, lost to the ether of the digital world. This experience taught me a painful lesson about the price of trust in the uncharted territory of cryptocurrency. While the technology holds incredible promise, the risks can be catastrophic if you don't approach it with extreme caution. My Bitcoin investment gamble had failed, and I was left to pick up the pieces, wiser but poorer for having placed my faith in the wrong hands. My sincere appreciation goes to MUYERN TRUST HACKER. You are my hero in recovering my lost funds. Send a direct m a i l ( muyerntrusted ( @ ) mail-me ( . )c o m ) or message on whats app : + 1 ( 4-4-0 ) ( 3 -3 -5 ) ( 0-2-0-5 )
    • You could try posting a log (if there is no log at all, it may be the launcher you are using, the FAQ may have info on how to enable the log) as described in the FAQ, however this will probably need to be reported to/remedied by the mod author.
    • So me and a couple of friends are playing with a shitpost mod pack and one of the mods in the pack is corail tombstone and for some reason there is a problem with it, where on death to fire the player will get kicked out of the server and the tombstone will not spawn basically deleting an entire inventory, it doesn't matter what type of fire it is, whether it's from vanilla fire/lava, or from modded fire like ice&fire/lycanites and it's common enough to where everyone on the server has experienced at least once or twice and it doesn't give any crash log. a solution to this would be much appreciated thank you!
    • It is 1.12.2 - I have no idea if there is a 1.12 pack
  • Topics

×
×
  • Create New...

Important Information

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