Jump to content

Recommended Posts

Posted

I have created some ores as well as a few types of trees that i have spawning in the overworld, and in the nether. I would like the textures of the ores to be rendered differently for the player depending what dimension they are in. Ex. The wood in the trees changes red in the nether. I'd assume i need to check for the dimension the player is in on a world load event, but i'm not sure about how to make the textures change. I'm pretty new to minecraft modding(Although i have a pretty decent understanding of java), especially forge, so please forgive me if this is really easy to do.

Posted

I have created some ores as well as a few types of trees that i have spawning in the overworld, and in the nether. I would like the textures of the ores to be rendered differently for the player depending what dimension they are in. Ex. The wood in the trees changes red in the nether. I'd assume i need to check for the dimension the player is in on a world load event, but i'm not sure about how to make the textures change. I'm pretty new to minecraft modding(Although i have a pretty decent understanding of java), especially forge, so please forgive me if this is really easy to do.

 

I am using something like world.provider.instance==0 to check the dimension. Forgive me it ist not 100% correct, i am posting this with my Smartphone.

Here could be your advertisement!

Posted

I have created some ores as well as a few types of trees that i have spawning in the overworld, and in the nether. I would like the textures of the ores to be rendered differently for the player depending what dimension they are in. Ex. The wood in the trees changes red in the nether. I'd assume i need to check for the dimension the player is in on a world load event, but i'm not sure about how to make the textures change. I'm pretty new to minecraft modding(Although i have a pretty decent understanding of java), especially forge, so please forgive me if this is really easy to do.

 

I am using something like world.provider.instance==0 to check the dimension. Forgive me it ist not 100% correct, i am posting this with my Smartphone.

 

How/Where/When are you actually changing it?

Posted

I have created some ores as well as a few types of trees that i have spawning in the overworld, and in the nether. I would like the textures of the ores to be rendered differently for the player depending what dimension they are in. Ex. The wood in the trees changes red in the nether. I'd assume i need to check for the dimension the player is in on a world load event, but i'm not sure about how to make the textures change. I'm pretty new to minecraft modding(Although i have a pretty decent understanding of java), especially forge, so please forgive me if this is really easy to do.

 

I am using something like world.provider.instance==0 to check the dimension. Forgive me it ist not 100% correct, i am posting this with my Smartphone.

 

How/Where/When are you actually changing it?

 

 

I am using this to tekeport players...

The real problem i see here is that you most likepy have to force the.client to rerender-wait, mayve the client automatically rerenders when you change your dimension. I will try.something.out once i get to my pc.

Here could be your advertisement!

Posted

I used separate blocks for different dimentions but now that i think about it it would make sense to just use one block and re texture it depending on dimension.

 

So I played around with my ore and unfortunately i wasn't able to figure out how to get the dimention id when getting the icon BUT i was able to figure out how to set the texture depending on the biome.

 

 
public IIcon iconEnd;
public IIcon iconNether;

@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(final IIconRegister iconRegister) {
iconEnd = iconRegister.registerIcon(References.RESOURCESPREFIX + "/draconiumOreEnd");
iconNether = iconRegister.registerIcon(References.RESOURCESPREFIX + "/draconiumOreNether");
}

@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(IBlockAccess block, int x, int y, int z, int side) {
String biome = block.getBiomeGenForCoords(x, y).biomeName;

if (biome.equals("Sky"))
	return iconEnd;
else
	return iconNether;
}

@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta) {
return iconEnd;
}

 

 

so with your ore you could just set it up so that if biome == "Hell" it uses the nether texture else it uses the overworld texture.

 

Keep in mind this method isnt ideal because if another mod e.g. Natura adds new biomes to the nether you will get the overworld texture in those biomes.

 

Edit: and before you ask it is still necessary to use getIcon(int side, int meta) because

getIcon(IBlockAccess block, int x, int y, int z, int side) adds the texture to the block in world but it cant add a texture to the item (the block in your inventory).

I am the author of Draconic Evolution

Posted

I used separate blocks for different dimentions but now that i think about it it would make sense to just use one block and re texture it depending on dimension.

 

So I played around with my ore and unfortunately i wasn't able to figure out how to get the dimention id when getting the icon BUT i was able to figure out how to set the texture depending on the biome.

 

 
public IIcon iconEnd;
public IIcon iconNether;

@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(final IIconRegister iconRegister) {
iconEnd = iconRegister.registerIcon(References.RESOURCESPREFIX + "/draconiumOreEnd");
iconNether = iconRegister.registerIcon(References.RESOURCESPREFIX + "/draconiumOreNether");
}

@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(IBlockAccess block, int x, int y, int z, int side) {
String biome = block.getBiomeGenForCoords(x, y).biomeName;

if (biome.equals("Sky"))
	return iconEnd;
else
	return iconNether;
}

@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta) {
return iconEnd;
}

 

 

so with your ore you could just set it up so that if biome == "Hell" it uses the nether texture else it uses the overworld texture.

 

Keep in mind this method isnt ideal because if another mod e.g. Natura adds new biomes to the nether you will get the overworld texture in those biomes.

 

Edit: and before you ask it is still necessary to use getIcon(int side, int meta) because

getIcon(IBlockAccess block, int x, int y, int z, int side) adds the texture to the block in world but it cant add a texture to the item (the block in your inventory).

Hey, thanks for the help, but i need some clarification on your code. I haven't ever used IIcons, probably because i'm pretty new to forge. I understand the rest of your code, just don't really understand the difference between Icons and using a simple setBlockTextureName();

Posted

IIcons is how you register textures in 1.7.2 (there may be other ways)

 

you first need to register your icons (textures) using registerBlockIcons() to register an icon use

 

icon = iconRegister.registerIcon("modid:/texture name"); // this will look for "texture name" in modid:/textures/blocks

 

then you override getIcon(int side, int meta) to add the icon to the block

 

this allows you to do things like set different textures for different sides or meta data.

 

in this case i am also using getIcon(IBlockAccess block, int x, int y, int z, int side)

 

this is basically the same thing except it gives more data to work with but it cant texture a block item

 

 

Note: some of this info may not be correct/compleat because i am only just learning to modd myself.

 

 

Edit: Thank you diesieben07! there is still so much i have to learn

 

ok so you dont need getIcon(IBlockAccess block, int x, int y, int z, int side) you can just use

 
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta) {
int dim = Minecraft.getMinecraft().theWorld.provider.dimensionId;

if (dim == -1)
	return iconNether;
else if (dim == 0)
	return iconOverworld;
}

let me know if you still need help.

I am the author of Draconic Evolution

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.