TileEntityMobSpawner tileentitymobspawner = (TileEntityMobSpawner)
World.getBlockTileEntity (i +3, j, k +2);
if (tileentitymobspawner != null)
{
tileentitymobspawner.setMobID("Pirate");
}
else
{
System.err.println((new StringBuilder()).append("Failed to fetch mob spawner
entity at (").append(i).append(", ").append(j).append(", ").append(k).append
(")").toString());
}
needs to be in a block class. Are you trying to make a mob spawn in the world like that on a certain block or something?
Ummm, I took all that out of the WorldGenDungeons file, well... sort of, than I changed things around so that it looked like it would work, but it didn't. I take it that I am going in the totally wrong direction with this, O-well, I will try something else...
hey when I'm making a block where should i put the path for the image while I'm testing the mod?
also what is the code you type in to add milk bucket into a crafting recipe (like block.stone is stone)
I usually make a folder in the minecraft.jar file (named Koadmod) and put all of my pictures into it and then I just have to make the "path to you file" the name of my folder E.G.
To find to name of and item in the code just open up the Item.java file and right at the beginning you will find some 'public static Item' lines and the name after that is what the item is in code E.G.
"public static Item bucketMilk;" means that a bucket full of milk is 'bucketMilk' in the code.
hey when I'm making a block where should i put the path for the image while I'm testing the mod?
also what is the code you type in to add milk bucket into a crafting recipe (like block.stone is stone)
It's really up to you, but for the finished mod, I would make it that your mod has its own folder and all the textures go in that. Have a look at Koadmaster's reply too.
Ummm, I took all that out of the WorldGenDungeons file, well... sort of, than I changed things around so that it looked like it would work, but it didn't. I take it that I am going in the totally wrong direction with this, O-well, I will try something else...
I'll have a bit of a think about how you can do it, and get back to you. Are you trying to make a mob spawning block? Then make it generate?
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
Well out of all the tutorials that Techguy is planing do do:
Crop
Generating ores
Tool with own Enum(no base class editing(like all my tuts))
Throwable Item
Potion
Armour
Bow
Damage Value Blocks
Trees
Door, Fence, Lever type block
I don't really need the: "Generating ores, Armour, Damage Value Blocks, or the Door, Fence, Lever type block" ones, but all the other ones I want, and please don't take this wrong but: We (and yes, that includes me) should be grateful for the ones that he has done so far, because he isn't getting anything for all the time he spends helping us, so please don't complain about the ones that he hasn't done yet.
-Thank You-
Please help, I made an account just so I could figure out an error.
I have start programming about a day ago, and I am trying to making something similar to the ender pearl (hardly any changes) for a test, can you please make a throwable item guide because mine isn't working
Apperently the Ender Pearl needs this line: public ItemTp2(World par1World) //ItemTp2 is the item I am working on, it is designed to function just like the Ender Pearl But the mod loader wants me to make it a int, for instance public ItemTp2 (int i ) I tried putting those into 1 script but I am a noob at this and I dont understand why I can only choose from int to World
I am having problems with my code. The code I have is
package net.minecraft.src;
import java.util.Map;
public class mod_Henchman extends BaseMod
{
public void load()
{
ModLoader.registerEntityID(Henchman.class, "A Henchman", ModLoader.getUniqueEntityId());
ModLoader.addSpawn(Henchman.class, 12, 3, 3, EnumCreatureType.monster);
}
public void addRenderer(Map map)
{
map.put(Henchman.class, new RenderBiped(new ModelBiped(), 0.5F));
}
public String getVersion()
{
return "1.2.4";
}
}
And I'm getting a "Henchman cannot be resolved to a type." Please help. I know there was someone who posted this error before, but that was for a block, and I don't know how to call the class. Help?
P.S. I'm looking forward to the "Throwable Items" tutorial.
Hello! I have a question about mobs. Could you put an if statement for when it dies to generate a custom Worldgen file? If you know the elemental creepers mod i mean like how the earth creeper blows up and makes this dirt wall. The only difference is that you kiill the mob to get the worldgen.
If you find out how to do this please tell me. If you need any info about what i'm talking about then ask.
Thanks!
No, I am not trying to make a new block, but if I must then I will.
Are you trying to make a structure generate and then have a mod spawn in it. Like villagers in villages. If not, please provide me with a a simple and clear explanation of what you're trying to do, because this is my last guess.
Hi I've got a little problem. Based on your tutorials I tried to create a food item for myself, which (should) refill(s) 1 hunger unit and 3 or 4 hearts. (Like a instant heal potion). I haven't yet found out how to make it refill hearts at the same time, but here's the code that I've got already..
package net.minecraft.src;
public class mod_CraftablePotions extends BaseMod
{
private boolean alwaysEdible;
private final int healAmount;
private final boolean isWolfsFavoriteMeat;
private final float saturationModifier;
public static final Item HealPotion = new ItemFood (5521, 2, 1F, false).setItemName("HealPotion");
public void load()
{
HealPotion.iconIndex = ModLoader.addOverride ("/gui/items.png", "/mods/CraftablePotions/HealPotion.png");
ModLoader.addName(HealPotion, "Heal Potion");
//ModLoader.addRecipe(new ItemStack (HealPotion, 1), new Object [] {" # ", " @ ", Character.valueOf('@'), Item.glassBottle, Character.valueOf('#'), Item.appleRed});
ModLoader.addRecipe(new ItemStack (HealPotion, 1), new Object [] {" # ", Character.valueOf('#'), Block.dirt,});
}
public mod_CraftablePotions(int par1, int par2, float par3, boolean par4)
{
super(par1);//[color=#ff0000]This comment is not actually in the original mod files. I get problems with this line, that has something to do with constructors. Atm it says "The constructor Basemod(int) is undefined"[/color]
healAmount = par2;
isWolfsFavoriteMeat = par4;
saturationModifier = par3;
}
public int getMaxItemUseDuration(ItemStack par1ItemStack)
{
return 6;
}
public EnumAction getItemUseAction(ItemStack par1ItemStack)
{
return EnumAction.drink;
}
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
if (par3EntityPlayer.canEat(alwaysEdible))
{
par3EntityPlayer.setItemInUse(par1ItemStack, getMaxItemUseDuration(par1ItemStack));
}
return par1ItemStack;
}
public int getHealAmount()
{
return healAmount;
}
public float getSaturationModifier()
{
return saturationModifier;
}
public boolean isWolfsFavoriteMeat()
{
return isWolfsFavoriteMeat;
}
public String getVersion()
{
return "1.2.4";
}
}
As you can see under the "Public void load()" section, I've commented on a line of text that I'm having problems with. Can you help me solve it out? (I took these parts from ItemFood.java, so that's why it's like that.
Your main problem is that all of this:
private boolean alwaysEdible;
private final int healAmount;
private final boolean isWolfsFavoriteMeat;
private final float saturationModifier;
{
super(par1);
healAmount = par2;
isWolfsFavoriteMeat = par4;
saturationModifier = par3;
}
public int getMaxItemUseDuration(ItemStack par1ItemStack)
{
return 6;
}
public EnumAction getItemUseAction(ItemStack par1ItemStack)
{
return EnumAction.drink;
}
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
if (par3EntityPlayer.canEat(alwaysEdible))
{
par3EntityPlayer.setItemInUse(par1ItemStack, getMaxItemUseDuration(par1ItemStack));
}
return par1ItemStack;
}
public int getHealAmount()
{
return healAmount;
}
public float getSaturationModifier()
{
return saturationModifier;
}
public boolean isWolfsFavoriteMeat()
{
return isWolfsFavoriteMeat;
}
needs to go in a separate version of your own ItemFood. Then you make your food a "new ItemNamehereFood".
Please help, I made an account just so I could figure out an error.
I have start programming about a day ago, and I am trying to making something similar to the ender pearl (hardly any changes) for a test, can you please make a throwable item guide because mine isn't working
Apperently the Ender Pearl needs this line: public ItemTp2(World par1World) //ItemTp2 is the item I am working on, it is designed to function just like the Ender Pearl But the mod loader wants me to make it a int, for instance public ItemTp2 (int i ) I tried putting those into 1 script but I am a noob at this and I dont understand why I can only choose from int to World
Please reply!!
If you only started programming a few days ago, you really shouldn't be attempting something like that. You should start off with blocks, then items, tools, armour, advanced blocks and then entities. I can't help you fix this problem though unless you post the whole class.
I am having problems with my code. The code I have is
package net.minecraft.src;
import java.util.Map;
public class mod_Henchman extends BaseMod
{
public void load()
{
ModLoader.registerEntityID(Henchman.class, "A Henchman", ModLoader.getUniqueEntityId());
ModLoader.addSpawn(Henchman.class, 12, 3, 3, EnumCreatureType.monster);
}
public void addRenderer(Map map)
{
map.put(Henchman.class, new RenderBiped(new ModelBiped(), 0.5F));
}
public String getVersion()
{
return "1.2.4";
}
}
And I'm getting a "Henchman cannot be resolved to a type." Please help. I know there was someone who posted this error before, but that was for a block, and I don't know how to call the class. Help?
P.S. I'm looking forward to the "Throwable Items" tutorial.
I've got this working. There isn't much control over how the block spawns in this. You might be able to modify it with a few if statements or something. This is the only thing that I have got working. There is a way to generate things in certain biomes with the generateSurface method but I'm not sure how to do it.
public void decorate(World par1World, Random random, int i, int j)
{
super.decorate(par1World, random, i, j);
for(int k = 0; k < 10; k++)
{
int randPosX = i + random.nextInt(5);
int randPosY = random.nextInt(128);
int randPosZ = j + random.nextInt(5);
WorldGenMinable worldgenminable = new WorldGenMinable(mod_Namehere.blockNameHere.blockID, 50);
worldgenminable.generate(par1World, random, randPosX, randPosY, randPosZ);
}
}
The 50 is the same as it would be in the WorldGenMinable line when making an ore generate.
Hello! I have a question about mobs. Could you put an if statement for when it dies to generate a custom Worldgen file? If you know the elemental creepers mod i mean like how the earth creeper blows up and makes this dirt wall. The only difference is that you kiill the mob to get the worldgen.
If you find out how to do this please tell me. If you need any info about what i'm talking about then ask.
Thanks!
There is a method called onEntityDeath.
public void onEntityDeath()
{
}
You might be able to figure out something with that, but I'm not sure. I had a bit of a play around with it but couldn't get anything working.
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
Yet for some reason this won't actually trigger the achievement when I mine the copper ore block. This used to work, however I think that MC 1.1 messed it up.
Yet for some reason this won't actually trigger the achievement when I mine the copper ore block. This used to work, however I think that MC 1.1 messed it up.
Any help is appreciated
As that is a ModLoader method, it changed to follow the proper camel-casing format in 1.2.3. It should be:
onItemPickup
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
Ah I see it wasn't throwing any errors like that though, odd. But thankyou
EDIT: After changing that, the achievements still aren't triggering
EDIT 2: Nevermind, it appears to be a problem with the Time to Mine! achievement needing to be completed first (I had it set that way). I made it require null and it works. Thanks
I've got this working. There isn't much control over how the block spawns in this. You might be able to modify it with a few if statements or something. This is the only thing that I have got working. There is a way to generate things in certain biomes with the generateSurface method but I'm not sure how to do it.
public void decorate(World par1World, Random random, int i, int j)
{
super.decorate(par1World, random, i, j);
for(int k = 0; k < 10; k++)
{
int randPosX = i + random.nextInt(5);
int randPosY = random.nextInt(128);
int randPosZ = j + random.nextInt(5);
WorldGenMinable worldgenminable = new WorldGenMinable(mod_Namehere.blockNameHere.blockID, 50);
worldgenminable.generate(par1World, random, randPosX, randPosY, randPosZ);
}
}
The 50 is the same as it would be in the WorldGenMinable line when making an ore generate.
Do I put that in my mod_Whatever file or my BiomeGenWhatever file?
Do I put that in my mod_Whatever file or my BiomeGenWhatever file?
Sorry, I forgot to mention that before, It goes in your BiomeGenWhatever class.
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
I am not completly new to programming, only Java while I am familiar with Lua and C++, but I just started using eclipse 2 days.
Anyways, I kinda figured out how I think it should look like, but I manged to even to be able to start the game from eclipse. However the tool wont get thrown:
publicvoid onItemRightClick(EntityEnderPearl g) //<<<<<<<<<<<------------ I think I need to do something with RightClick, also I'm not sure what the void class does either but eclipse told me to make it a void.
{
class EntityEnderPearl extends EntityThrowable //<<<<<<-------- I dont know what this does but it seems important
{
public EntityEnderPearl(World par1World)
{
super(par1World);
}
public EntityEnderPearl(World par1World, EntityLiving par2EntityLiving)
{
super(par1World, par2EntityLiving);
}
public EntityEnderPearl(World par1World, double par2, double par4, double par6)
{
super(par1World, par2, par4, par6);
}
/**
* Called when the throwable hits a block or entity.
I think it should look something like this but I think I need to put all the other scipts like EntityThrowable into this one, making it 1 big pile of script.
Are you trying to make a structure generate and then have a mod spawn in it. Like villagers in villages. If not, please provide me with a a simple and clear explanation of what you're trying to do, because this is my last guess.
I am trying to make my boat generate with a mob spawner block on it, and have that block spawn my pirate mob. Just like the mob spawners that generate in the dungeons. If I can't do this then I will try other things, but that is what I am currently trying to do. also: sorry to confuse you with all this, but thanks for helping
I got my spawner to stop having errors! Now it will just spawn pigs My currant code:
package net.minecraft.src;
import java.util.Random;
public class WorldGenBoat extends WorldGenerator
{
public WorldGenBoat()
{
}
public boolean generate(World world, Random random, int i, int j, int k)
{
if(world.getBlockId(i, j -1, k) == Block.waterStill.blockID && world.getBlockId(i, j, k) ==
0)
{
int wood = Block.planks.blockID;
//Body railing
world.setBlockWithNotify(i, j, k, wood);
world.setBlockWithNotify(i, j, k +1, wood);
world.setBlockWithNotify(i, j, k +2, wood);
world.setBlockWithNotify(i, j, k +3, wood);
world.setBlockWithNotify(i, j, k +4, wood);
world.setBlockWithNotify(i, j, k +5, wood);
world.setBlockWithNotify(i, j, k +6, wood);
world.setBlockWithNotify(i, j, k +7, wood);
world.setBlockWithNotify(i, j, k -1, wood);
world.setBlockWithNotify(i, j, k -2, wood);
//test
world.setBlockWithNotify(i +3, j, k -1, Block.mobSpawner.blockID);
TileEntityMobSpawner tileentitymobspawner = (TileEntityMobSpawner)
world.getBlockTileEntity(i, j, k);
if (tileentitymobspawner != null)
{
tileentitymobspawner.setMobID(pickMobSpawner(random));
}
else
{
System.err.println((new StringBuilder()).append("Failed to fetch mob spawner
entity at (").append(i).append(", ").append(j).append(", ").append(k).append
(")").toString());
}
//end of test
return true;
}
return false;
}
//test
private String pickMobSpawner(Random random)
{
int i = random.nextInt(4);
if (i == 0)
{
return "Skeleton";
}
if (i == 1)
{
return "Zombie";
}
if (i == 2)
{
return "Zombie";
}
if (i == 3)
{
return "Spider";
}
else
{
return "";
}
}
//end
}
The problem is (I think) that the mob spawner is null, because it gives me the "Failed to fetch mob spawner entity at (i, j, k)" thing, like the code tells it to if the mob spawner is null.
Edit; actually, I don't think that it even spawns the pigs it just has a pig spinning inside of it.
also what is the code you type in to add milk bucket into a crafting recipe (like block.stone is stone)
Ummm, I took all that out of the WorldGenDungeons file, well... sort of, than I changed things around so that it looked like it would work, but it didn't. I take it that I am going in the totally wrong direction with this, O-well, I will try something else...
I usually make a folder in the minecraft.jar file (named Koadmod) and put all of my pictures into it and then I just have to make the "path to you file" the name of my folder E.G.
To find to name of and item in the code just open up the Item.java file and right at the beginning you will find some 'public static Item' lines and the name after that is what the item is in code E.G.
"public static Item bucketMilk;" means that a bucket full of milk is 'bucketMilk' in the code.
It's really up to you, but for the finished mod, I would make it that your mod has its own folder and all the textures go in that. Have a look at Koadmaster's reply too.
A bucket of milk is referred to as
I'll have a bit of a think about how you can do it, and get back to you. Are you trying to make a mob spawning block? Then make it generate?
together they are powerful beyond imagination."
No, I am not trying to make a new block, but if I must then I will.
Well out of all the tutorials that Techguy is planing do do:
-Thank You-
I have start programming about a day ago, and I am trying to making something similar to the ender pearl (hardly any changes) for a test, can you please make a throwable item guide because mine isn't working
Apperently the Ender Pearl needs this line:
public ItemTp2(World par1World) //ItemTp2 is the item I am working on, it is designed to function just like the Ender Pearl
But the mod loader wants me to make it a int, for instance
public ItemTp2 (int i ) I tried putting those into 1 script but I am a noob at this and I dont understand why I can only choose from int to World
Please reply!!
And I'm getting a "Henchman cannot be resolved to a type." Please help. I know there was someone who posted this error before, but that was for a block, and I don't know how to call the class. Help?
P.S. I'm looking forward to the "Throwable Items" tutorial.
How's it coming?
If you find out how to do this please tell me. If you need any info about what i'm talking about then ask.
Thanks!
I'm trying to make a dr who mod (sonic screwdriver)
Are you trying to make a structure generate and then have a mod spawn in it. Like villagers in villages. If not, please provide me with a a simple and clear explanation of what you're trying to do, because this is my last guess.
Your main problem is that all of this:
needs to go in a separate version of your own ItemFood. Then you make your food a "new ItemNamehereFood".
If you only started programming a few days ago, you really shouldn't be attempting something like that. You should start off with blocks, then items, tools, armour, advanced blocks and then entities. I can't help you fix this problem though unless you post the whole class.
Could you post your other class too please.
I've got this working. There isn't much control over how the block spawns in this. You might be able to modify it with a few if statements or something. This is the only thing that I have got working. There is a way to generate things in certain biomes with the generateSurface method but I'm not sure how to do it.
The 50 is the same as it would be in the WorldGenMinable line when making an ore generate.
There is a method called onEntityDeath.
You might be able to figure out something with that, but I'm not sure. I had a bit of a play around with it but couldn't get anything working.
together they are powerful beyond imagination."
Yet for some reason this won't actually trigger the achievement when I mine the copper ore block. This used to work, however I think that MC 1.1 messed it up.
Any help is appreciated
As that is a ModLoader method, it changed to follow the proper camel-casing format in 1.2.3. It should be:
together they are powerful beyond imagination."
EDIT: After changing that, the achievements still aren't triggering
EDIT 2: Nevermind, it appears to be a problem with the Time to Mine! achievement needing to be completed first (I had it set that way). I made it require null and it works. Thanks
Do I put that in my mod_Whatever file or my BiomeGenWhatever file?
Sorry, I forgot to mention that before, It goes in your BiomeGenWhatever class.
together they are powerful beyond imagination."
Anyways, I kinda figured out how I think it should look like, but I manged to even to be able to start the game from eclipse. However the tool wont get thrown:
I think it should look something like this but I think I need to put all the other scipts like EntityThrowable into this one, making it 1 big pile of script.
I am trying to make my boat generate with a mob spawner block on it, and have that block spawn my pirate mob. Just like the mob spawners that generate in the dungeons. If I can't do this then I will try other things, but that is what I am currently trying to do. also: sorry to confuse you with all this, but thanks for helping
Edit; actually, I don't think that it even spawns the pigs it just has a pig spinning inside of it.