I finally got steps working perfectly and even have them draw from the same textures as the block its made from, however I seem to be having a small problem.
The steps seem to work fine, I get the right step with the right recipe, even shows the right texture in my inventory...however, when I place the block it uses the default textures I assigned the block.
Picture
As you can see, looks perfectly fine in my inventory but when I place it, it looks like the original slab does. Would anyone mind looking at my code and telling me what's wrong?
However, it doesn't really explain how it works and each step requires 3 textures as far as I can tell, plus it won't allow me to add more than a single step to the game. Any idea how i can fix this so it draws from teh same texture as the block its made form? (like cobble slabs?)
Just look at how a step works. Perhaps make your normal custom block just extend BlockStep instead of Block.
Mostly figured out my last problem and my new steps work almost perfectly...however I am seeming to have problems. Updated the original post so I didn't have to make a new thread.
I swear I've told you how to do this in two different threads already. Are you honestly still wondering how to do it? o_O
Rollback Post to RevisionRollBack
I had a mod back in Beta 1.8.1, but I quit for a while so it hasn't been updated since then. WTF <-- If you'd like to try and update it, let me know. (It won't be an easy task, I'm sure)
I swear I've told you how to do this in two different threads already. Are you honestly still wondering how to do it? o_O
You did tell me, I improved my code and it works almost perfectly, however I must of messed up somewhere but I can't seem to figure out what i did wrong...which is why I'm asking people to look at the revised version?
You did tell me, I improved my code and it works almost perfectly, however I must of messed up somewhere but I can't seem to figure out what i did wrong...which is why I'm asking people to look at the revised version?
It appears to not be getting the metadata from the item. There should be a method to return the damage/metadata.
Like this
public int getPlacedBlockMetadata(int i)
{
return i;
}
Rollback Post to RevisionRollBack
I had a mod back in Beta 1.8.1, but I quit for a while so it hasn't been updated since then. WTF <-- If you'd like to try and update it, let me know. (It won't be an easy task, I'm sure)
how do I connect the block and the item? I have the metadata method in my Item class, but I don't know how to make my block use my Item class
That should be connected automatically by Minecraft, but I think I found your problem.
public int getBlockTextureFromSideAndMetadata(int i, int j)
{
switch(j)
{
case 0://first metadata
return mod_Block.blockBaseTexture;
case 1://second metadata
return mod_Block.blockBlank1Texture;
case 2:
return mod_Block.blockBlank2Texture;
default://any other metadata
return mod_Block.blockBaseTexture;
}
}
you need a 'break;' statement for each case.
Example:
switch(i)
{
case 1:
statement;
break;
default:
statement;
break;
}
The break statement stops the program from continuing through the switch and assigning the rest of the values (right now all of your steps are getting their value from your default case).
Edit: Also, I apologize for implying that you had ignored my previous help. I realize now that you were making a completely different mistake, and I recommend that you learn some basic Java to help stop simple errors like this from throwing off your mod. :] I usually recommend TheNewBoston.
I had a mod back in Beta 1.8.1, but I quit for a while so it hasn't been updated since then. WTF <-- If you'd like to try and update it, let me know. (It won't be an easy task, I'm sure)
Hmm, When originally had break; in my code, eclipse told me there was an error. "Unreachable code" i think it said.
I think that was before i added the item class, though. Could that of been the problem?
That's strange... I'm not sure what caused that, but you definitely need breaks if you want the switch to work normally.
Rollback Post to RevisionRollBack
I had a mod back in Beta 1.8.1, but I quit for a while so it hasn't been updated since then. WTF <-- If you'd like to try and update it, let me know. (It won't be an easy task, I'm sure)
That's strange... I'm not sure what caused that, but you definitely need breaks if you want the switch to work normally.
Hmm, i'll play around with my code and see if I can get it to work. Would you mind telling me how to make a proper item and how to link it to the step? I think that's where I may of messed up.
Hmm, i'll play around with my code and see if I can get it to work. Would you mind telling me how to make a proper item and how to link it to the step? I think that's where I may of messed up.
Try the break statements for now. If that doesn't work, quote me here and I'll look through your code again. But if that happens, I'll need your ItemYourSlab (or whatever you called it) class file to look through as well.
Rollback Post to RevisionRollBack
I had a mod back in Beta 1.8.1, but I quit for a while so it hasn't been updated since then. WTF <-- If you'd like to try and update it, let me know. (It won't be an easy task, I'm sure)
That's strange... I'm not sure what caused that, but you definitely need breaks if you want the switch to work normally.
It's because he's using return syntax. Break syntax ends the statement (Switch in this case), however return syntax ends the whole method, that's why. Also, the blocks render properly in the inventory and when we set the metadata through worldedit, so it's not that.
Our problem is that we need the block to use our custom item class with getPlacedBlockMetadata, and we don't know how to do this.
It's because he's using return syntax. Break syntax ends the statement (Switch in this case), however return syntax ends the whole method, that's why. Also, the blocks render properly in the inventory and when we set the metadata through worldedit, so it's not that.
Our problem is that we need the block to use our custom item class with getPlacedBlockMetadata, and we don't know how to do this.
ModLoader.AddRecipe(new ItemBlank(Block.cobblestone, 2), new Object[] {
"t", Character.valueOf('t'), new ItemStack(template, 1, 0)
});
P.S. I'm the coder(I've been coding for a while) that is helping Tyken make his mod.
You just need to make an item like this:
Item.itemsList[testCloth.blockID] = (new ItemTestCloth(testCloth.blockID - 256)).setItemName("TestCloth");
This is code from my testCloth block and item, so replace that with whatever your block and item are.
Rollback Post to RevisionRollBack
I had a mod back in Beta 1.8.1, but I quit for a while so it hasn't been updated since then. WTF <-- If you'd like to try and update it, let me know. (It won't be an easy task, I'm sure)
Edit: forgot to say, its a weird problem. I'm obviously getting a different step(or atleast one that -looks- different) but it acts like the same block. I can stack the Blank and the 1 steps ontop of each other in my inventory, and stack them both on the ground.
Edit: forgot to say, its a weird problem. I'm obviously getting a different step(or atleast one that -looks- different) but it acts like the same block. I can stack the Blank and the 1 steps ontop of each other in my inventory, and stack them both on the ground.
I had this problem for a while too... It took me a while to figure it out.
I think your block needs code like this:
protected int damageDropped(int i)
{
return i;
}
I'm not sure if that's it, but it seems to be the only thing you're missing. :/
I had a mod back in Beta 1.8.1, but I quit for a while so it hasn't been updated since then. WTF <-- If you'd like to try and update it, let me know. (It won't be an easy task, I'm sure)
I don't think this will help your problem (it might but I'm too lazy to check), but you will need this method in your step class for it to work properly:
The steps seem to work fine, I get the right step with the right recipe, even shows the right texture in my inventory...however, when I place the block it uses the default textures I assigned the block.
Picture
As you can see, looks perfectly fine in my inventory but when I place it, it looks like the original slab does. Would anyone mind looking at my code and telling me what's wrong?
Mod_Block Class
http://pastebin.com/Pshqzh3n
Step Class
http://pastebin.com/gdKvDSCD
Double Step Class
http://pastebin.com/6vjV9jNy
Channel
https://www.youtube.com/user/Tyken132
My Blog/Forums
http://tyken132.com/
Just look at how a step works. Perhaps make your normal custom block just extend BlockStep instead of Block.
Channel
https://www.youtube.com/user/Tyken132
My Blog/Forums
http://tyken132.com/
Channel
https://www.youtube.com/user/Tyken132
My Blog/Forums
http://tyken132.com/
I swear I've told you how to do this in two different threads already. Are you honestly still wondering how to do it? o_O
I had a mod back in Beta 1.8.1, but I quit for a while so it hasn't been updated since then.
WTF <-- If you'd like to try and update it, let me know. (It won't be an easy task, I'm sure)
You did tell me, I improved my code and it works almost perfectly, however I must of messed up somewhere but I can't seem to figure out what i did wrong...which is why I'm asking people to look at the revised version?
Channel
https://www.youtube.com/user/Tyken132
My Blog/Forums
http://tyken132.com/
It appears to not be getting the metadata from the item. There should be a method to return the damage/metadata.
Like this
I had a mod back in Beta 1.8.1, but I quit for a while so it hasn't been updated since then.
WTF <-- If you'd like to try and update it, let me know. (It won't be an easy task, I'm sure)
how do I connect the block and the item? I have the metadata method in my Item class, but I don't know how to make my block use my Item class
Channel
https://www.youtube.com/user/Tyken132
My Blog/Forums
http://tyken132.com/
That should be connected automatically by Minecraft, but I think I found your problem.
you need a 'break;' statement for each case.
Example:
The break statement stops the program from continuing through the switch and assigning the rest of the values (right now all of your steps are getting their value from your default case).
Edit: Also, I apologize for implying that you had ignored my previous help. I realize now that you were making a completely different mistake, and I recommend that you learn some basic Java to help stop simple errors like this from throwing off your mod. :] I usually recommend TheNewBoston.
I had a mod back in Beta 1.8.1, but I quit for a while so it hasn't been updated since then.
WTF <-- If you'd like to try and update it, let me know. (It won't be an easy task, I'm sure)
I think that was before i added the item class, though. Could that of been the problem?
Channel
https://www.youtube.com/user/Tyken132
My Blog/Forums
http://tyken132.com/
That's strange... I'm not sure what caused that, but you definitely need breaks if you want the switch to work normally.
I had a mod back in Beta 1.8.1, but I quit for a while so it hasn't been updated since then.
WTF <-- If you'd like to try and update it, let me know. (It won't be an easy task, I'm sure)
Hmm, i'll play around with my code and see if I can get it to work. Would you mind telling me how to make a proper item and how to link it to the step? I think that's where I may of messed up.
Channel
https://www.youtube.com/user/Tyken132
My Blog/Forums
http://tyken132.com/
Try the break statements for now. If that doesn't work, quote me here and I'll look through your code again. But if that happens, I'll need your ItemYourSlab (or whatever you called it) class file to look through as well.
I had a mod back in Beta 1.8.1, but I quit for a while so it hasn't been updated since then.
WTF <-- If you'd like to try and update it, let me know. (It won't be an easy task, I'm sure)
It's because he's using return syntax. Break syntax ends the statement (Switch in this case), however return syntax ends the whole method, that's why. Also, the blocks render properly in the inventory and when we set the metadata through worldedit, so it's not that.
Our problem is that we need the block to use our custom item class with getPlacedBlockMetadata, and we don't know how to do this.
We've tried this so far, but to no avail:
P.S. I'm the coder(I've been coding for a while) that is helping Tyken make his mod.
You just need to make an item like this:
This is code from my testCloth block and item, so replace that with whatever your block and item are.
I had a mod back in Beta 1.8.1, but I quit for a while so it hasn't been updated since then.
WTF <-- If you'd like to try and update it, let me know. (It won't be an easy task, I'm sure)
Item Code
http://pastebin.com/7003Jjzf
Mod code
http://pastebin.com/X2a2yaM7
Step code
http://pastebin.com/Djd8fqvy
Double Step Code
http://pastebin.com/gfG493SB
Edit: forgot to say, its a weird problem. I'm obviously getting a different step(or atleast one that -looks- different) but it acts like the same block. I can stack the Blank and the 1 steps ontop of each other in my inventory, and stack them both on the ground.
Channel
https://www.youtube.com/user/Tyken132
My Blog/Forums
http://tyken132.com/
Still doesn't work =(
I had this problem for a while too... It took me a while to figure it out.
I think your block needs code like this:
I'm not sure if that's it, but it seems to be the only thing you're missing. :/
Edit: Let me show you my files, I'll post here in a minute.
Edit2:
ItemTestCloth
mod_TestCloth
BlockTestCloth
I had a mod back in Beta 1.8.1, but I quit for a while so it hasn't been updated since then.
WTF <-- If you'd like to try and update it, let me know. (It won't be an easy task, I'm sure)
edit: beaten badly