Jump to content

[1.7.10] [Solved] Textures missing.


Awesome_Spider

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Minecraft java and forge seem to have it out for me, any ideas? I have had issues with exit code 1 while loading forge -fabric was having the same issues, but I seemed to fix it in these repairs? (tried different versions upwards from 1.19 to 1.20.2 for forge, nothing worked and I'm confident older versions wouldn't either) -The launcher itself loads fine, it will load the game within the launcher, and then crash the moment it tries to load outside of the launcher. I have tried the default launcher, legacy launcher, and the curse forge launcher, none have worked! (all have had the same problem) I think this started when I took a break and upgraded to windows 11 and wonder if that changed anything? I have tried the following: uninstalled & reinstalled java, (I have having issues where I download jdk 17 but only 8 would show up (would not show up anywhere but the control panel, not even the official uninstaller, I *think* I got that fixed) tried jarfix uninstalled & reinstalled minecraft tried alternate launchers -forge & legacy, & repaired them too. tried without mods updated game drivers uninstalled and reinstalled forge -including completely wiping it from my system changed java excutable path followed everything in the error code 1 post completely reset my pc I tried to change the launch path but couldn't seem to get it to work -the default launcher wont let me even see properties as an option, i have yet to try with the other two (i did try on legacy but it was being weird) I want to include my debug log; but its over the max size? sorry my brains gone numb from trying to fix this for the past 2 days
    • I personally create registries using DataPackRegistryEvent.NewRegistry. It's pretty powerful as long as you know how to make codecs. In some class, make a registry key like so: public static final ResourceKey<Registry<MyDataType>> MY_REGISTRY = ResourceKey.createRegistryKey(new ResourceLocation(MyMod.MOD_ID, "registry_name")); This will make a registry that holds objects of type "MyDataType". JSON files stored in data/<datapack_namespace>/modid/registryname/ will be parsed and put into this registry. Note that the directory structure has a folder named after your mod inside your datapack directory, so the actual path would look like: data/my_mod/my_mod/registry_name (or if another mod uses your registry: data/their_mod/my_mod/registry_name. To register this registry, subscribe to the DataPackRegistryEvent.NewRegistry event on the MOD event bus and call event.dataPackRegistry() for every registry you have. An example of what I'm doing for my mod (this is in the constructor for the main mod file): IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus(); bus.addListener((DataPackRegistryEvent.NewRegistry event) -> { event.dataPackRegistry(ModRegistries.INSULATOR_DATA, InsulatorData.CODEC); }); CODEC is a public static field inside the class for the custom data type I am registering. It holds a Codec<InsulatorData> that tells Minecraft how to serialize/deserialize the data. Most of my data so far can be represented by records, so I use RecordCodecBuilder.create() to do this: public static final Codec<InsulatorData> CODEC = RecordCodecBuilder.create(instance -> instance.group( // Yadda yadda ).apply(instance, InsulatorData::new)); What exactly to put here depends on what you're trying to do, so that's up to you. But basically you're just defining a list of codecs that correspond to the parameters of the record (data type). Most primitive data types have records in the Codec class (ex. Codec.INT) that you can use, and other classes like ResourceLocation have their own codecs as a static field (ex. ResourceLocation.CODEC). Hopefully this is what you're looking for, and that this helps.
    • Good days  I finnaly manage to fix and get a working gui from BlockItem and from BlockEntity the next issues i have to fix is this the block Entity model for some reason is moved to the south west  this briefcase model must be centered but is moved to a side, i have nothing weird in the code but this is happening // ########## ########## ########## ########## @Override public RenderShape getRenderShape(BlockState blkstate) {     return RenderShape.MODEL; } the block model is out of place However The hitBox of the block is right in place   ########################################################################################################### This next issue  Mi gui also adds the 5 slots from the player equipment the thing is theres no filter to determine whats can be put in an armor slot and what not      i have this method that draws the slots for the armor, the part i dont get i slike wheres the code that responds when you set an item in a item slot to do checks and allow the item to be set or not  //########## ########## ########## //Draw Player Armor private void addPlayerArmorSlots(Inventory playerInventory) { // 36 this.addSlot(new Slot(playerInventory, 39, 8, 8)); this.addSlot(new Slot(playerInventory, 38, 8, 26)); this.addSlot(new Slot(playerInventory, 37, 8, 44)); this.addSlot(new Slot(playerInventory, 36, 8, 62)); this.addSlot(new Slot(playerInventory, 40, 26, 53)); }   theres must be a method that triggers when you set a itemstack inside an slot and allows to do a check if its a valid item for that slot                                             
    • No like how do I use my new PreperableReloadListener, I know how to set it up now and register it, I just need to know how to use it in other classes.
    • Completely out of the blue my forge loader is lagging, although at 120 fps. Like when I turn it lags, or hit mobs it lags, or run sometimes although staying at 120 fps. I found another person having a similar problem:  But there was no solution I dont think. I tried everything from: 1. Updating my computer 2. Updating/reinstalling forge 3. Testing if allocated memory was problem (if it was low or high or mid nothing changed) 4. Adding various performance mods 5. Deleting most of my profiles if storage was a problem.   Really not sure what to do next or if forge is just broken for ever for me now.  
  • Topics

×
×
  • Create New...

Important Information

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