Jump to content

Textures work in eclipse, but not the real game?


CJCutrone9

Recommended Posts

So, I was all excited that my mod finally got to a place where it looked "visually pleasing" at least to me. And then I recompile, reobfuscate, etc. I stick it all in a file, stick that in my mods folder and run the game. Game loads, so far so good. Open the world, and the textures are there. I then go to "test" some of my connected textures and it seems that 4 of them return a missing texture. I go to check if that happens in eclipse, and it doesn't. I removed all the other mods I used, and tried it alone, still the same problem, 4-5 textures just refuse to show up. Works perfect in eclipse though. Anyone know how to fix this bug?

 

Here is my block's code that is messing up:

 

 

package net.CJCutrone.LegendofZelda.blocks;

 

import static net.minecraftforge.common.ForgeDirection.UP;

 

import java.util.Random;

 

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

import net.CJCutrone.LegendofZelda.common.LegendofZelda;

import net.minecraft.block.Block;

import net.minecraft.block.BlockFlower;

import net.minecraft.block.BlockGrass;

import net.minecraft.block.BlockSapling;

import net.minecraft.block.material.Material;

import net.minecraft.client.renderer.texture.IconRegister;

import net.minecraft.util.Icon;

import net.minecraft.world.IBlockAccess;

import net.minecraft.world.World;

import net.minecraftforge.common.EnumPlantType;

import net.minecraftforge.common.ForgeDirection;

import net.minecraftforge.common.IPlantable;

 

public class LoZGrass extends Block {

 

@SideOnly(Side.CLIENT)

private Icon iconGrassTop;

 

@SideOnly(Side.CLIENT)

private Icon iconGrassBottom;

 

@SideOnly(Side.CLIENT)

private static Icon iconGrassSideOverlay;

 

public static Icon[] textures = new Icon[47];

public static int[] textureRefByID = { 0, 0, 6, 6, 0, 0, 6, 6, 3, 3, 19, 15, 3, 3,

19, 15, 1, 1, 18, 18, 1, 1, 13, 13, 2, 2, 23, 31, 2, 2, 27, 14, 0, 0, 6, 6, 0,

0, 6, 6, 3, 3, 19, 15, 3, 3, 19, 15, 1, 1, 18, 18, 1, 1, 13, 13, 2, 2, 23, 31,

2, 2, 27, 14, 4, 4, 5, 5, 4, 4, 5, 5, 17, 17, 22, 26, 17, 17, 22, 26, 16, 16,

20, 20, 16, 16, 28, 28, 21, 21, 46, 42, 21, 21, 43, 38, 4, 4, 5, 5, 4, 4, 5, 5,

9, 9, 30, 12, 9, 9, 30, 12, 16, 16, 20, 20, 16, 16, 28, 28, 25, 25, 45, 37, 25,

25, 40, 32, 0, 0, 6, 6, 0, 0, 6, 6, 3, 3, 19, 15, 3, 3, 19, 15, 1, 1, 18, 18, 1,

1, 13, 13, 2, 2, 23, 31, 2, 2, 27, 14, 0, 0, 6, 6, 0, 0, 6, 6, 3, 3, 19, 15, 3,

3, 19, 15, 1, 1, 18, 18, 1, 1, 13, 13, 2, 2, 23, 31, 2, 2, 27, 14, 4, 4, 5, 5, 4,

4, 5, 5, 17, 17, 22, 26, 17, 17, 22, 26, 7, 7, 24, 24, 7, 7, 10, 10, 29, 29, 44,

41, 29, 29, 39, 33, 4, 4, 5, 5, 4, 4, 5, 5, 9, 9, 30, 12, 9, 9, 30, 12, 7, 7, 24,

24, 7, 7, 10, 10, 8, 8, 36, 35, 8, 8, 34, 11 };

 

public LoZGrass(int par1, Material par2Material) {

super(par1, par2Material);

setHardness(1F);

setResistance(.05F);

setTickRandomly(true);

}

public void registerIcons(IconRegister par1IconRegister){

 

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

textures = par1IconRegister.registerIcon("LegendofZelda:LoZ Grass_" + (i+1));

this.blockIcon = par1IconRegister.registerIcon("LegendofZelda:LoZ Dirt_2");

 

this.iconGrassBottom = par1IconRegister.registerIcon("LegendofZelda:LoZ Dirt_1");

this.iconGrassSideOverlay = par1IconRegister.registerIcon("Tutorial:grassSide");

}

 

 

public Icon getIcon(int par1, int meta){

 

 

return par1 == 1 ? textures[0] : (par1 == 0 ? this.iconGrassBottom : this.blockIcon);

}

 

public Icon getBlockTexture(IBlockAccess world, int x, int y, int z, int side){

boolean[] bitMatrix = new boolean[8];               

if (side == 0){

return this.iconGrassBottom;

}

if (side == 1){               

bitMatrix[0] = world.getBlockId(x-1, y, z-1) == this.blockID; 

bitMatrix[1] = world.getBlockId(x, y, z-1) == this.blockID; 

bitMatrix[2] = world.getBlockId(x+1, y, z-1) == this.blockID;

bitMatrix[3] = world.getBlockId(x-1, y, z) == this.blockID; 

bitMatrix[4] = world.getBlockId(x+1, y, z) == this.blockID; 

bitMatrix[5] = world.getBlockId(x-1, y, z+1) == this.blockID;

bitMatrix[6] = world.getBlockId(x, y, z+1) == this.blockID; 

bitMatrix[7] = world.getBlockId(x+1, y, z+1) == this.blockID;

 

}else{

return this.blockIcon;

}

int idBuilder = 0;       

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

idBuilder = idBuilder + (bitMatrix?(i==0?1:(i==1?2:(i==2?4:(i==3?8:(i==4?16:(i==5?32:(i==6?64:128))))))):0);

return idBuilder>255||idBuilder<0?textures[0]:textures[textureRefByID[idBuilder]];

 

 

 

 

 

}

 

public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)

    {

        if (!par1World.isRemote)

        {

            if (par1World.getBlockLightValue(par2, par3 + 1, par4) < 4 && par1World.getBlockLightOpacity(par2, par3 + 1, par4) > 2)

            {

                par1World.setBlock(par2, par3, par4, LegendofZelda.LoZDirt.blockID);

            }

            else if (par1World.getBlockLightValue(par2, par3 + 1, par4) >= 9)

            {

                for (int l = 0; l < 4; ++l)

                {

                    int i1 = par2 + par5Random.nextInt(3) - 1;

                    int j1 = par3 + par5Random.nextInt(5) - 3;

                    int k1 = par4 + par5Random.nextInt(3) - 1;

                    int l1 = par1World.getBlockId(i1, j1 + 1, k1);

 

                    if (par1World.getBlockId(i1, j1, k1) == LegendofZelda.LoZDirt.blockID && par1World.getBlockLightValue(i1, j1 + 1, k1) >= 4 && par1World.getBlockLightOpacity(i1, j1 + 1, k1) <= 2)

                    {

                        par1World.setBlock(i1, j1, k1, this.blockID);

                    }

                }

            }

        }

    }

 

public boolean canSustainPlant(World world, int x, int y, int z, ForgeDirection direction, IPlantable plant)

    {

 

        return true;

    }

}

 

 

 

 

 

If other code is needed, just let me know.

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.

Announcements



×
×
  • Create New...

Important Information

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