Well I learned modding with looking at tutorials first.Then I studied the Java files then I learned basic Java. It is strange. Dont make the same mistake I did. Learn very basic Java first THEN watch tutorials. I promise you that is the way to do it. To learn very basic Java, go check this guy out: youtube.com/thenewboston He has some great beginner Java tuts not related to Minecraft
Well I learned modding with looking at tutorials first.Then I studied the Java files then I learned basic Java. It is strange. Dont make the same mistake I did. Learn very basic Java first THEN watch tutorials. I promise you that is the way to do it. To learn very basic Java, go check this guy out: youtube.com/thenewboston He has some great beginner Java tuts not related to Minecraft
Oddly enough I'm doing it the same way you did, though I seem be doing fairly well at it. I guess part of it is just because I've always had an innate ability to understand how things work and interconnect thoughts and ideas...too bad I can't say that without sounding full of myself.
Although as far as things go, the masses should learn from MY mistake too...
... if you're likely going to have to use Forge API at some point during the development of a mod, start using it from the start so that you don't reach a point where "Everything works but, CRAP I'm out of free sprite slots...!", at which point Forge will break a bunch of things you had working 100% until you can rewrite them the way Forge wants them written...
So as far as that file I decided to try and write I managed to decide how I want it to check the world for blocks. Originally I was going to use a single number to specify a cubed area around the center point in which to check the blocks, but then I realized a simple number like 32 would result in 262,144 blocks being checked 20 times a second per instance of the mob...
...thus I chose to go a more precise route that requires specifying a specific range of coordinates -- more functional, more realistic, and it makes it possible to have some control over how resource intensive the processing for the mob will be.
Currently it looks a bit like this:
Constructor
public EntityAIAttractedToBlock(boolean flag1, int xToCheckMin, int yToCheckMin, int zToCheckMin, int xToCheckMax, int yToCheckMax, int zToCheckMax, int j, int blockID)
{
flag1 = isAttractedToBlock;
xToCheckMin = viewRangeXMin;
yToCheckMin = viewRangeYMin;
zToCheckMin = viewRangeZMin;
xToCheckMax = viewRangeXMax;
yToCheckMax = viewRangeYMax;
zToCheckMax = viewRangeZMax;
j = howCloseToStay;
blockID = blockAttractedTo;
setMutexBits(1);
}
Eventually I'm going to make the block ID use an array of blocks to be checked so that multiple blocks can be specified in one line, but for now the next step I have to work out is exactly how to get it to check all of the blocks within the given range.
Do you know how to make a condition to place a block, be the Height it is at?
For example, look at my code:
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{
int i = par1World.getHeightValue(par3, par3); /* par3 because it is Y which is the worldheight */
int k = par1World.getBlockId(par2, par3, par4);
if (k == blockID)
{
return true;
}
if (k != Block.whiteStone.blockID)
{
return false;
}
return i >= 50; /*the WorldHeight must be equal or higher than 50 */
}
I tried this, but didnt work =\
Can you correct this code?
-
Nevermind! I did it after 1 hour trying!
And it was pretty simple.
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{/* X Y Z */
int i = par1World.getHeightValue(par3, par3);
if (par3 >= 50)
{return true;}
else
{return false;}
}
@Bladecraft. Ya, I think I can manage that. Although I have never done it, making the code should not be to difficult. Although it will probably add an API to the mix because doing this without one would edit SO MANY base classes
Error
at net.minecraft.src.ModelDrabase.<init>(ModelDrabase.java:30)
at net.minecraft.src.mod_elDra.addRenderer(mod_elDra.java:141)
at net.minecraft.src.ModLoader.addAllRenderers(ModLoader.java:160)
at net.minecraft.src.RenderManager.<init>(RenderManager.java:85)
at net.minecraft.src.RenderManager.<clinit>(RenderManager.java:12)
... 3 more
My code:
public void addRenderer(Map map)
{
map.put(EntityDrabase.class, new RenderDrabase(new ModelDrabase(), 0.5F));
}
I have put the java util import map
But I get this error, when I launch the client I get a blank screen.
Nevermind just fixed it, looks like sometimes Techne duplicates the line
"###.mirror = true;"
Gotta Be Honest! This Helped me out alot. But some of the tuts dont actually seem to work for me "personally". The reason for this is i seem to get an warnings in some of my ".class" files when i decompile it into eclipse i dont seem to be doing anything wrong! But for instance in the tuts on how to make a NPC, it dosent work because it wont let me do the "public void addRenderer(Map map)" <------ Or somin like that! Because apparently (This is what error/warning i get (It underlines it in yellow)) "map is a raw type. References to generic type Map<K,V> should be parameterized" and i get a warning (underlined in yellow) on this "map.put(EntityRedCow.class, new RenderRedCow(new ModelRedCow(), 0.5F));" because apparently "is references to Map which is a raw type" Again!!!! Why does it do this? Anyone know? Rather annoying after i have done some pretty cool **** but it wont work because it comes up with stupid warnings like this which stop the mod from working!!!!!!
Also i have lots of my ".class and .java" fuels working but there are loads of files with the warning sign on, is this whats meant to happen or should they all work? IF they should how can i get them to work they seem to always be like this and i dont do anything wrong when i decompile and open in ecliipse!!!!
Warnings aren't the same as errors. In the majority of cases a warning should only mean you're doing something that isn't necessarily "recommended." You'll encounter that same warning in several places within the game. Errors, however, are actual compiler errors that Eclipse is forewarning you of that need to be fixed for the code to compile.
Error
at net.minecraft.src.ModelDrabase.<init>(ModelDrabase.java:30)
at net.minecraft.src.mod_elDra.addRenderer(mod_elDra.java:141)
at net.minecraft.src.ModLoader.addAllRenderers(ModLoader.java:160)
at net.minecraft.src.RenderManager.<init>(RenderManager.java:85)
at net.minecraft.src.RenderManager.<clinit>(RenderManager.java:12)
... 3 more
My code:
public void addRenderer(Map map)
{
map.put(EntityDrabase.class, new RenderDrabase(new ModelDrabase(), 0.5F));
}
I have put the java util import map
But I get this error, when I launch the client I get a blank screen.
Nevermind just fixed it, looks like sometimes Techne duplicates the line
"###.mirror = true;"
Try adding arguments to your addRenderer. That is probably the problem. To do this, hover your cursor over the error and select add/remove arguments to match (...).
Gotta Be Honest! This Helped me out alot. But some of the tuts dont actually seem to work for me "personally". The reason for this is i seem to get an warnings in some of my ".class" files when i decompile it into eclipse i dont seem to be doing anything wrong! But for instance in the tuts on how to make a NPC, it dosent work because it wont let me do the "public void addRenderer(Map map)" <------ Or somin like that! Because apparently (This is what error/warning i get (It underlines it in yellow)) "map is a raw type. References to generic type Map<K,V> should be parameterized" and i get a warning (underlined in yellow) on this "map.put(EntityRedCow.class, new RenderRedCow(new ModelRedCow(), 0.5F));" because apparently "is references to Map which is a raw type" Again!!!! Why does it do this? Anyone know? Rather annoying after i have done some pretty cool **** but it wont work because it comes up with stupid warnings like this which stop the mod from working!!!!!!
Also i have lots of my ".class and .java" fuels working but there are loads of files with the warning sign on, is this whats meant to happen or should they all work? IF they should how can i get them to work they seem to always be like this and i dont do anything wrong when i decompile and open in ecliipse!!!!
Can you please make a tutorial/tell me on:
- How to make a growing plant like wheat.
- How to add more then 1 potion effects on a food item.
- How to have a sack with fries, and when you eat it you are left with the sack. (it returns)
- How to temporarily change your skin for after you eat something. (about 2 minutes)
And one thing I really can't figure out: (the animalnames are just random)
I want to put a cat and a dog in the crafting grid. I want the dog to disappear and a tiger to appear, which is easy, but I also want the cat to still be there, with 1 charge less. (like on a tool it has about 30 charges and 1 charge is gone after 1 use)
Thanks a lot, even if you answer only 1 of these questions!
Sure, these are some great ideas. I will finish the tuts that I am working on now and I will start looking at stuff like that.
I was wondering if i could get some help.
I have made a new block in my world, but now i'm just wondering why is doesn't want to spawn.
This snippet of code is for that part, but if you want the whole thing i'd be happy to add it here.
mod_tut.java
public void GenerateSurface(World world, Random rand, int baseX, int baseZ )
{
for (int x=0; x&--#60;15; x++)
{
int Xcoord = baseX + rand.nextInt(10);
int Ycoord = rand.nextInt(100);
int Zcoord = baseZ + rand.nextInt(10);
(new WorldGenMinable(Tut.blockID,15)).generate(world ,rand,Xcoord,Ycoord,Zcoord);
}
for (int x=0; x&--#60;15; x++)
{
int Xcoord = baseX + rand.nextInt(10);
int Ycoord = 60; //rand.nextInt(30);
int Zcoord = baseZ + rand.nextInt(10);
(new WorldGenMinable(Crafted.blockID,12)).generate(world, rand, Xcoord, Ycoord, Zcoord);
}
}
wow, never mind, i just saw what my problem is.
Darn you lowercase g!
The Meaning of Life, the Universe, and Everything.
Join Date:
12/28/2011
Posts:
49
Member Details
Sorry to talk about this again but I got another problem with your flower tutorial. You were right, we have to change GenerateSurface to generateSurface, but the flower is replacing the block when spawned (and not on top of it). I think it's because we use the worldgenminable. It would be very nice if you help me and sorry again.
Sorry to talk about this again but I got another problem with your flower tutorial. You were right, we have to change GenerateSurface to generateSurface, but the flower is replacing the block when spawned (and not on top of it). I think it's because we use the worldgenminable. It would be very nice if you help me and sorry again.
Do you have code to look at? That would aid us greatly.
Did you learn modding by trying and studying the minecraft files first, or you studied java first?
Im still based in Ctrl C . Ctrl V and I wanna give my next step on modding.
Oddly enough I'm doing it the same way you did, though I seem be doing fairly well at it. I guess part of it is just because I've always had an innate ability to understand how things work and interconnect thoughts and ideas...too bad I can't say that without sounding full of myself.
Although as far as things go, the masses should learn from MY mistake too...
... if you're likely going to have to use Forge API at some point during the development of a mod, start using it from the start so that you don't reach a point where "Everything works but, CRAP I'm out of free sprite slots...!", at which point Forge will break a bunch of things you had working 100% until you can rewrite them the way Forge wants them written...
I'm looking at you arrow firing function.
So as far as that file I decided to try and write I managed to decide how I want it to check the world for blocks. Originally I was going to use a single number to specify a cubed area around the center point in which to check the blocks, but then I realized a simple number like 32 would result in 262,144 blocks being checked 20 times a second per instance of the mob...
...thus I chose to go a more precise route that requires specifying a specific range of coordinates -- more functional, more realistic, and it makes it possible to have some control over how resource intensive the processing for the mob will be.
Currently it looks a bit like this:
Constructor
Example line from a mob's entity file
Eventually I'm going to make the block ID use an array of blocks to be checked so that multiple blocks can be specified in one line, but for now the next step I have to work out is exactly how to get it to check all of the blocks within the given range.
For example, look at my code:
Can you correct this code?
-
Nevermind! I did it after 1 hour trying!
And it was pretty simple.
lol
Making custom vehicles is on a level where you should actually LEARN something before you do it...
That actually looks pretty cool with the lava under the water. What do you call this new biome?
at net.minecraft.src.ModelDrabase.<init>(ModelDrabase.java:30)
at net.minecraft.src.mod_elDra.addRenderer(mod_elDra.java:141)
at net.minecraft.src.ModLoader.addAllRenderers(ModLoader.java:160)
at net.minecraft.src.RenderManager.<init>(RenderManager.java:85)
at net.minecraft.src.RenderManager.<clinit>(RenderManager.java:12)
... 3 more
My code:
public void addRenderer(Map map)
{
map.put(EntityDrabase.class, new RenderDrabase(new ModelDrabase(), 0.5F));
}
I have put the java util import map
But I get this error, when I launch the client I get a blank screen.
Nevermind just fixed it, looks like sometimes Techne duplicates the line
"###.mirror = true;"
Warnings aren't the same as errors. In the majority of cases a warning should only mean you're doing something that isn't necessarily "recommended." You'll encounter that same warning in several places within the game. Errors, however, are actual compiler errors that Eclipse is forewarning you of that need to be fixed for the code to compile.
Try adding arguments to your addRenderer. That is probably the problem. To do this, hover your cursor over the error and select add/remove arguments to match (...).
import java.util.Map;
Sure, these are some great ideas. I will finish the tuts that I am working on now and I will start looking at stuff like that.
I have made a new block in my world, but now i'm just wondering why is doesn't want to spawn.
This snippet of code is for that part, but if you want the whole thing i'd be happy to add it here.
mod_tut.java
wow, never mind, i just saw what my problem is.
Darn you lowercase g!
Do you have code to look at? That would aid us greatly.