That's because you havn't been reading the thread, it was brought to my attention that small (semi-easy to fix glitch, I'll update the code in a sec, it's only one more line in the constructor.
And, I had sort of skimmed through the debate going on. However, I saw no mention by you (until now) that you believed there was actually a problem. Just that you were sure that your code was working as-is (at the time, before this code update).
Regardless, this new code change still does NOT work.
First off, like was said previously in this thread, the "Super Constructor" HAS TO BE CALLED FIRST. You have it listed second. But, if you nullify the value in the blocks-list after calling the super constructor, your block(s) disappear.
Plus, I can't see how initializing the blocks-list with a null value for it would have made a difference in the first place anyhow.
So, I am also at the point now where I also have to see a working example with source code provided etc.
strange, there is physically no way you will still get an error of same id used, because all that is is a check to see if the item is not equal to null. If it's not is Throws a new exception. If you set that id to null before calling the constructor there is 100% no chance of getting that error. Just saying that it doesn't work does not help, post error codes or no one will ever be able to help you.
The constructor does not need to be called first. You can find many examples (not in the minecraft source, but look around) that the superclass is called at the end or middle of the constructor, and it works, people have made programs like that.
If you can't get it to work with putting the nullification, then you can do it in between the declarations.
public static final BlockTester wetStone = new BlockTester( 111, 50 ).setBlockType( 0 );
Block.blocksList[111]=null;
public static final BlockTester deadGrass = new BlockTester( 111, 51 ).setBlockType( 1 );
when I get the demo working you can look at the source and see everything I'm talking about. I may just not be explaining it good enough, so feel free to ask for more clarification.
As seeing the actual block objects are stored in your class, just the actual class of BlockTester is stored in the blocksList we can set it to null to allow us to define another block with the same id, getting the block from the blocksList will return the main instance, which then you set to it's subtype you want.
== MCP v4.4 ==
> Recompiling client...
"C:\Program Files\Java\jdk1.6.0_26\bin\javac.exe" -g -source 1.6 -target 1.6 -cl
asspath "lib/;lib/*;jars/bin/minecraft.jar;jars/bin/jinput.jar;jars/bin/lwjgl.ja
r;jars/bin/lwjgl_util.jar" -sourcepath src/minecraft -d bin/minecraft src/minecr
aft\net\minecraft\client\*.java src/minecraft\net\minecraft\isom\*.java src/mine
craft\net\minecraft\src\*.java conf/patches/*.java failed.
Return code : 1
== ERRORS FOUND ==
src\minecraft\net\minecraft\src\mod_bottle.java:7: cannot find symbol
symbol : method setItemType(int)
location: class net.minecraft.src.Itemtest
public static final Itemtest bottle = new Itemtest(3042).setItemType(0);
^
src\minecraft\net\minecraft\src\mod_bottle.java:8: cannot find symbol
symbol : method setItemType(int)
location: class net.minecraft.src.Itemtest
public static final Itemtest stratus = new Itemtest(3042).setItemType(1);
^
src\minecraft\net\minecraft\src\mod_bottle.java:9: cannot find symbol
symbol : method setItemType(int)
location: class net.minecraft.src.Itemtest
public static final Itemtest cumulus = new Itemtest(3042).setItemType(2);
^
src\minecraft\net\minecraft\src\mod_bottle.java:10: cannot find symbol
symbol : method setItemType(int)
location: class net.minecraft.src.Itemtest
public static final Itemtest cumulonimbus = new Itemtest(3042).setItemType(3);
^
4 errors
==================
> Done in 9.35 seconds
> Recompiling server...
!! Can not find server sources !!
Press any key to continue . . .
code:
package net.minecraft.src;
import java.util.Random;
public class mod_bottle extends BaseMod
{
public static final Itemtest bottle = new Itemtest(3042).setItemType(0);
public static final Itemtest stratus = new Itemtest(3042).setItemType(1);
public static final Itemtest cumulus = new Itemtest(3042).setItemType(2);
public static final Itemtest cumulonimbus = new Itemtest(3042).setItemType(3);
public mod_bottle()
{
stratus.iconIndex = ModLoader.addOverride("/gui/items.png", "/stratusbottle.png");
bottle.iconIndex = ModLoader.addOverride("/gui/items.png", "/bottle.png");
ModLoader.AddRecipe(new ItemStack(bottle, 2), new Object[]{
"XX", Character.valueOf('X'), Block.dirt
});
ModLoader.AddRecipe(new ItemStack(stratus, 2), new Object[]{
"X", Character.valueOf('X'), Block.dirt
});
ModLoader.AddName(bottle, "Bottle");
ModLoader.AddName(stratus, "Stratus cloud in a bottle");
}
public String Version()
{
return "test";
}
}
== MCP v4.4 ==
> Recompiling client...
"C:\Program Files\Java\jdk1.6.0_26\bin\javac.exe" -g -source 1.6 -target 1.6 -cl
asspath "lib/;lib/*;jars/bin/minecraft.jar;jars/bin/jinput.jar;jars/bin/lwjgl.ja
r;jars/bin/lwjgl_util.jar" -sourcepath src/minecraft -d bin/minecraft src/minecr
aft\net\minecraft\client\*.java src/minecraft\net\minecraft\isom\*.java src/mine
craft\net\minecraft\src\*.java conf/patches/*.java failed.
Return code : 1
== ERRORS FOUND ==
src\minecraft\net\minecraft\src\mod_bottle.java:7: cannot find symbol
symbol : method setItemType(int)
location: class net.minecraft.src.Itemtest
public static final Itemtest bottle = new Itemtest(3042).setItemType(0);
^
src\minecraft\net\minecraft\src\mod_bottle.java:8: cannot find symbol
symbol : method setItemType(int)
location: class net.minecraft.src.Itemtest
public static final Itemtest stratus = new Itemtest(3042).setItemType(1);
^
src\minecraft\net\minecraft\src\mod_bottle.java:9: cannot find symbol
symbol : method setItemType(int)
location: class net.minecraft.src.Itemtest
public static final Itemtest cumulus = new Itemtest(3042).setItemType(2);
^
src\minecraft\net\minecraft\src\mod_bottle.java:10: cannot find symbol
symbol : method setItemType(int)
location: class net.minecraft.src.Itemtest
public static final Itemtest cumulonimbus = new Itemtest(3042).setItemType(3);
^
4 errors
==================
> Done in 9.35 seconds
> Recompiling server...
!! Can not find server sources !!
Press any key to continue . . .
code:
package net.minecraft.src;
import java.util.Random;
public class mod_bottle extends BaseMod
{
public static final Itemtest bottle = new Itemtest(3042).setItemType(0);
public static final Itemtest stratus = new Itemtest(3042).setItemType(1);
public static final Itemtest cumulus = new Itemtest(3042).setItemType(2);
public static final Itemtest cumulonimbus = new Itemtest(3042).setItemType(3);
public mod_bottle()
{
stratus.iconIndex = ModLoader.addOverride("/gui/items.png", "/stratusbottle.png");
bottle.iconIndex = ModLoader.addOverride("/gui/items.png", "/bottle.png");
ModLoader.AddRecipe(new ItemStack(bottle, 2), new Object[]{
"XX", Character.valueOf('X'), Block.dirt
});
ModLoader.AddRecipe(new ItemStack(stratus, 2), new Object[]{
"X", Character.valueOf('X'), Block.dirt
});
ModLoader.AddName(bottle, "Bottle");
ModLoader.AddName(stratus, "Stratus cloud in a bottle");
}
public String Version()
{
return "test";
}
}
Did you by any chance change the name of the method to set the type? Supply the Itemtest code as well.
How would this work with generation of blocks, such as ores? Would I still be able to adjust the generation of certain ores and what is dropped when it is mined?
omg dude. You don't even let me comment to my own thread, I come on and there is yet another flaming. You have you're own thread that works, if you don't believe this one does then stop posting on it.
you know what, you're right, I studied the difference between 1.4 and 1.8 for how the blocks are stored and there are a few differences, one feature that was taken out was a Map object in the World class that stored the block instance based on an integer[] that contained xyz. Without that, which the most recent place I saw it was 1.6, no this will not work, buy sorry for trying to help if all I get is constant flaming and complaints by one person.
Moderators, please delete this thread, I am sick of this ****.
He answers, because you are still fooling people with this thread.
No changes to the way blocks are stored have been made since 1.3 and the only thing that was changed in that patch was to use the MCRegion format.
Ercinee seems to be one of the few persons that actually understand why this approach doesn't work. He is not the one saying "I have a working example up and running in a few seconds" and then having to admit that his solution didn't work in the first place.
First off I said I would try to recreate the code I had before, I didn't say anything about a time limit at all, in fact that tutorial took me a while to write (3 days of constant, save, load, edit, save, load, edit, save, load, edit) It happens that someone asked the question on the day I ended up finishing it. While doing that I realized a few differences between the version I did it before and the current one. I am not fooling anyone, I am asking for this thread to be closed or deleted because I have seen the difference and I don't want people reading this anymore if it does not work. So if this does not work stop posting a million posts on it and just bumping it up to top spot constantly.
If I find a way to update this tutorial I will post a new one.
You mean this line? ...
And, I had sort of skimmed through the debate going on. However, I saw no mention by you (until now) that you believed there was actually a problem. Just that you were sure that your code was working as-is (at the time, before this code update).
Regardless, this new code change still does NOT work.
First off, like was said previously in this thread, the "Super Constructor" HAS TO BE CALLED FIRST. You have it listed second. But, if you nullify the value in the blocks-list after calling the super constructor, your block(s) disappear.
Plus, I can't see how initializing the blocks-list with a null value for it would have made a difference in the first place anyhow.
So, I am also at the point now where I also have to see a working example with source code provided etc.
~ iiiHuman ~
The constructor does not need to be called first. You can find many examples (not in the minecraft source, but look around) that the superclass is called at the end or middle of the constructor, and it works, people have made programs like that.
If you can't get it to work with putting the nullification, then you can do it in between the declarations.
when I get the demo working you can look at the source and see everything I'm talking about. I may just not be explaining it good enough, so feel free to ask for more clarification.
As seeing the actual block objects are stored in your class, just the actual class of BlockTester is stored in the blocksList we can set it to null to allow us to define another block with the same id, getting the block from the blocksList will return the main instance, which then you set to it's subtype you want.
code:
Did you by any chance change the name of the method to set the type? Supply the Itemtest code as well.
Check out my Minecraft Modding Tutorials!
What?
So many people are commenting on it, and there are already like 2 tutorials like this :tongue.gif:
Check out my Minecraft Modding Tutorials!
Is there a limit to how many blocks on an id?
you know what, you're right, I studied the difference between 1.4 and 1.8 for how the blocks are stored and there are a few differences, one feature that was taken out was a Map object in the World class that stored the block instance based on an integer[] that contained xyz. Without that, which the most recent place I saw it was 1.6, no this will not work, buy sorry for trying to help if all I get is constant flaming and complaints by one person.
Moderators, please delete this thread, I am sick of this ****.
haha, dude. it's ok. he's being a retard. don't let it get to you.
Thanks heaps for the information. It's still valuable, even if it isn't up to date with minecraft. java is java is coding is java.
I think loading the block types from a file would be a good idea. then servers could define custom blocks for themselves.
First off I said I would try to recreate the code I had before, I didn't say anything about a time limit at all, in fact that tutorial took me a while to write (3 days of constant, save, load, edit, save, load, edit, save, load, edit) It happens that someone asked the question on the day I ended up finishing it. While doing that I realized a few differences between the version I did it before and the current one. I am not fooling anyone, I am asking for this thread to be closed or deleted because I have seen the difference and I don't want people reading this anymore if it does not work. So if this does not work stop posting a million posts on it and just bumping it up to top spot constantly.
If I find a way to update this tutorial I will post a new one.