@TECHGUY I think I know how to make your npc tutorials work for 1.3.2
This is the mod file
package net.minecraft.src;
import java.util.Random;
import java.util.Map;
import java.awt.Color;
public class mod_EntTut extends BaseMod
public void load()
{
ModLoader.registerEntityID(EntityYourEntity.class, "YourEntityNameHere", 126); //here we are registering his Id
//NOTE that the Id must be between 180 and -180
ModLoader.addSpawn("YourEntityNameHere", 1, 1, 1, EnumCreatureType.creature, new // here we are saying our guy will rarely spawn in groups of 1
BiomeGenBase[]{
BiomeGenBase.extremeHills,
BiomeGenBase.plains
}); //here we are saying that our guy will spawn only in Extreme Hills and Plains Biomes
}
public void addRenderer(Map map)
{
map.put(EntityYourEntity.class, new RenderBiped(new ModelBiped(), 0.5F)); //here we are rendering him
}
public String getVersion()
{
return "1.3.2";
}
}
this is the Entity File
package net.minecraft.src;
public class EntityYourEntity extends EntityAnimal
{
public EntityYourEntity(World par1World)
{
super(par1World);
this.texture = "/pathtotexture/YourEntity.png";
this.setSize(1.0F, 1.0F);
this.getNavigator().setAvoidsWater(true);
//here we add tasks for the entity to perform
this.tasks.addTask(0, new EntityAISwimming(this));
this.tasks.addTask(1, new EntityAIPanic(this, 0.38F));
this.tasks.addTask(2, new EntityAIMate(this, 0.2F));
this.tasks.addTask(3, new EntityAIFollowParent(this, 0.25F));
this.tasks.addTask(4, new EntityAIWander(this, 0.2F));
this.tasks.addTask(5, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
this.tasks.addTask(6, new EntityAILookIdle(this));
}
/**
* Returns true if the newer Entity AI code should be run
*/
public boolean isAIEnabled()
{
return true;
}
public int getMaxHealth()
{
return 10; //health obviously
}
/**
* Returns the sound this mob makes while it's alive.
*/
protected String getLivingSound()
{
return "mob.villager";
}
/**
* Returns the sound this mob makes when it is hurt.
*/
protected String getHurtSound()
{
return "mob.villagerhurt";
}
/**
* Returns the sound this mob makes on death.
*/
protected String getDeathSound()
{
return "mob.villagerhurt";
}
/**
* Returns the volume for the sounds this mob makes.
*/
protected float getSoundVolume()
{
return 0.4F;
}
/**
* Returns the item ID for the item the mob drops on death.
*/
protected int getDropItemId()
{
return Item.leather.shiftedIndex; //dropped item
}
/**
* Drop 0-2 items of this living's type
*/
protected void dropFewItems(boolean par1, int par2)
{
int var3 = this.rand.nextInt(3) + this.rand.nextInt(1 + par2);
int var4;
for (var4 = 0; var4 < var3; ++var4)
{
this.dropItem(Item.leather.shiftedIndex, 1);
}
var3 = this.rand.nextInt(3) + 1 + this.rand.nextInt(1 + par2);
for (var4 = 0; var4 < var3; ++var4)
{
if (this.isBurning())
{
this.dropItem(Item.beefCooked.shiftedIndex, 1);
}
else
{
this.dropItem(Item.beefRaw.shiftedIndex, 1);
}
}
}
@TECHGUY I think I know how to make your npc tutorials work for 1.3.2
This is the mod file
package net.minecraft.src;
import java.util.Random;
import java.util.Map;
import java.awt.Color;
public class mod_EntTut extends BaseMod
public void load()
{
ModLoader.registerEntityID(EntityYourEntity.class, "YourEntityNameHere", 126); //here we are registering his Id
//NOTE that the Id must be between 180 and -180
ModLoader.addSpawn("YourEntityNameHere", 1, 1, 1, EnumCreatureType.creature, new // here we are saying our guy will rarely spawn in groups of 1
BiomeGenBase[]{
BiomeGenBase.extremeHills,
BiomeGenBase.plains
}); //here we are saying that our guy will spawn only in Extreme Hills and Plains Biomes
}
public void addRenderer(Map map)
{
map.put(EntityYourEntity.class, new RenderBiped(new ModelBiped(), 0.5F)); //here we are rendering him
}
public String getVersion()
{
return "1.3.2";
}
}
this is the Entity File
package net.minecraft.src;
public class EntityYourEntity extends EntityAnimal
{
public EntityYourEntity(World par1World)
{
super(par1World);
this.texture = "/pathtotexture/YourEntity.png";
this.setSize(1.0F, 1.0F);
this.getNavigator().setAvoidsWater(true);
//here we add tasks for the entity to perform
this.tasks.addTask(0, new EntityAISwimming(this));
this.tasks.addTask(1, new EntityAIPanic(this, 0.38F));
this.tasks.addTask(2, new EntityAIMate(this, 0.2F));
this.tasks.addTask(3, new EntityAIFollowParent(this, 0.25F));
this.tasks.addTask(4, new EntityAIWander(this, 0.2F));
this.tasks.addTask(5, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
this.tasks.addTask(6, new EntityAILookIdle(this));
}
/**
* Returns true if the newer Entity AI code should be run
*/
public boolean isAIEnabled()
{
return true;
}
public int getMaxHealth()
{
return 10; //health obviously
}
/**
* Returns the sound this mob makes while it's alive.
*/
protected String getLivingSound()
{
return "mob.villager";
}
/**
* Returns the sound this mob makes when it is hurt.
*/
protected String getHurtSound()
{
return "mob.villagerhurt";
}
/**
* Returns the sound this mob makes on death.
*/
protected String getDeathSound()
{
return "mob.villagerhurt";
}
/**
* Returns the volume for the sounds this mob makes.
*/
protected float getSoundVolume()
{
return 0.4F;
}
/**
* Returns the item ID for the item the mob drops on death.
*/
protected int getDropItemId()
{
return Item.leather.shiftedIndex; //dropped item
}
/**
* Drop 0-2 items of this living's type
*/
protected void dropFewItems(boolean par1, int par2)
{
int var3 = this.rand.nextInt(3) + this.rand.nextInt(1 + par2);
int var4;
for (var4 = 0; var4 < var3; ++var4)
{
this.dropItem(Item.leather.shiftedIndex, 1);
}
var3 = this.rand.nextInt(3) + 1 + this.rand.nextInt(1 + par2);
for (var4 = 0; var4 < var3; ++var4)
{
if (this.isBurning())
{
this.dropItem(Item.beefCooked.shiftedIndex, 1);
}
else
{
this.dropItem(Item.beefRaw.shiftedIndex, 1);
}
}
}
Hope that works for you
Yeah, I know. The only real difference is using an actual integer ID for the entity instead of getUniqueEntityId(). Thanks for trying to help though.
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
@TECHGUY I think I know how to make your npc tutorials work for 1.3.2
ModLoader.registerEntityID(EntityYourEntity.class, "YourEntityNameHere", 126); //here we are registering his Id
//NOTE that the Id must be between 180 and -180
Are these tutorials going to change a lot when 1.4 cames out? How long it will take to update them (along with those that aren't updated yet...)? Thanks for reading this message!
Hi, i restarted all of the mod again but with the same prospect as before. Everything has been working fine, the block .png's work now, but the tools dont anymore :/
Are these tutorials going to change a lot when 1.4 cames out? How long it will take to update them (along with those that aren't updated yet...)? Thanks for reading this message!
Depends on the amount of code that changes. Could be a few minutes, could be a a few days.
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
Are these tutorials going to change a lot when 1.4 cames out? How long it will take to update them (along with those that aren't updated yet...)? Thanks for reading this message!
My understanding is that not too much is being changed in the means of structure. They're adding a mod API so it would seem that they would try to interfere as minimally as possibly.
Rollback Post to RevisionRollBack
When life gives you a potato, wonder why the heck life just gave you a potato. Why not something else? Like money? Or a combustable lemon? No, you get a potato. Nothing else.
I thought that Mojang delayed the Mod API release (again)...I hope that its released soon, but sadly not tomorrow :|
btw If I want to use a texture from terrain.png (not use a custom .png) for the block of the mod, the "0" from
in mod_Block must be ..e.g "1"?
If Im not using a custom texture and only use a texture from terrain.png what happens with "/image.png" here
If you're using a default texture from the game then just delete the entire ModLoader.addOverride line. But yes, change the 0 to the number of the texture in the terrain.png
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
If you make multiple mod_name files will the game crash when you put in in the real minecraft after recompiling and reobfuscating.
No. But remember to use one mod_ file per individual mod.
Rollback Post to RevisionRollBack
When life gives you a potato, wonder why the heck life just gave you a potato. Why not something else? Like money? Or a combustable lemon? No, you get a potato. Nothing else.
Thanks it works! That code should be included in the main post aswell, it will be usefull for other beginners.
Thanks for the feedback. I'll add it in later.
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
Right, now I've tried giving the item the ItemSword.java properties because I hold the item in my hand like a regular item and not like a sword (since it'll be a sword) without succeding:
public static final Item two = new ItemSword(700).setItemName("Sample");
I have tried to "Add a argument to match ItemSword(int, EnumToolMaterial)" like Eclipse sujected, and many other things. I have also tried using and editing the "ItemNameHere" template from main post but nothing.
You have to choose a tool material for your sword. If it should be as effective and durable as an iron sword, your code looks like this:
public static final Item yourSword = new ItemSword(700, EnumToolMaterial.IRON).setItemName("yourSword");
You can choose between WOOD, STONE, IRON, EMERALD and GOLD.
Right it works that too! However I tried that code before without succeding, maybe because I edited other line or a parameter from the code when I recompiled it...
This was easiest to find than the
.setIconCoord(1,1)
since Eclipse suggest it when it lacks the parameter, it would be cool to include this too. It is also possible to create new tool materials by editing the EnumToolMaterial, which isnt very recommended since people would have to include the edited EnumToolMaterial to their modpack for overwriting the original unedited ones...
All tutorials are updated to 1.4.2. Please let me know of any troubles you have.
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
This is the mod file
package net.minecraft.src; import java.util.Random; import java.util.Map; import java.awt.Color; public class mod_EntTut extends BaseMod public void load() { ModLoader.registerEntityID(EntityYourEntity.class, "YourEntityNameHere", 126); //here we are registering his Id //NOTE that the Id must be between 180 and -180 ModLoader.addSpawn("YourEntityNameHere", 1, 1, 1, EnumCreatureType.creature, new // here we are saying our guy will rarely spawn in groups of 1 BiomeGenBase[]{ BiomeGenBase.extremeHills, BiomeGenBase.plains }); //here we are saying that our guy will spawn only in Extreme Hills and Plains Biomes } public void addRenderer(Map map) { map.put(EntityYourEntity.class, new RenderBiped(new ModelBiped(), 0.5F)); //here we are rendering him } public String getVersion() { return "1.3.2"; } }this is the Entity File
package net.minecraft.src; public class EntityYourEntity extends EntityAnimal { public EntityYourEntity(World par1World) { super(par1World); this.texture = "/pathtotexture/YourEntity.png"; this.setSize(1.0F, 1.0F); this.getNavigator().setAvoidsWater(true); //here we add tasks for the entity to perform this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(1, new EntityAIPanic(this, 0.38F)); this.tasks.addTask(2, new EntityAIMate(this, 0.2F)); this.tasks.addTask(3, new EntityAIFollowParent(this, 0.25F)); this.tasks.addTask(4, new EntityAIWander(this, 0.2F)); this.tasks.addTask(5, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); this.tasks.addTask(6, new EntityAILookIdle(this)); } /** * Returns true if the newer Entity AI code should be run */ public boolean isAIEnabled() { return true; } public int getMaxHealth() { return 10; //health obviously } /** * Returns the sound this mob makes while it's alive. */ protected String getLivingSound() { return "mob.villager"; } /** * Returns the sound this mob makes when it is hurt. */ protected String getHurtSound() { return "mob.villagerhurt"; } /** * Returns the sound this mob makes on death. */ protected String getDeathSound() { return "mob.villagerhurt"; } /** * Returns the volume for the sounds this mob makes. */ protected float getSoundVolume() { return 0.4F; } /** * Returns the item ID for the item the mob drops on death. */ protected int getDropItemId() { return Item.leather.shiftedIndex; //dropped item } /** * Drop 0-2 items of this living's type */ protected void dropFewItems(boolean par1, int par2) { int var3 = this.rand.nextInt(3) + this.rand.nextInt(1 + par2); int var4; for (var4 = 0; var4 < var3; ++var4) { this.dropItem(Item.leather.shiftedIndex, 1); } var3 = this.rand.nextInt(3) + 1 + this.rand.nextInt(1 + par2); for (var4 = 0; var4 < var3; ++var4) { if (this.isBurning()) { this.dropItem(Item.beefCooked.shiftedIndex, 1); } else { this.dropItem(Item.beefRaw.shiftedIndex, 1); } } }Hope that works for you
I eat creepers for breakfast, lunch, dinner and I have it bacon style!
Check out TheInstitutions modding tutorials
I eat creepers for breakfast, lunch, dinner and I have it bacon style!
Yeah, I know. The only real difference is using an actual integer ID for the entity instead of getUniqueEntityId(). Thanks for trying to help though.
together they are powerful beyond imagination."
Actually it's -128 to 127 and I would read this as well http://www.minecraftforum.net/topic/1417041-mod-entity-problem/
Put /s before the names.
Depends on the amount of code that changes. Could be a few minutes, could be a a few days.
together they are powerful beyond imagination."
-
View User Profile
-
View Posts
-
Send Message
Retired StaffMy understanding is that not too much is being changed in the means of structure. They're adding a mod API so it would seem that they would try to interfere as minimally as possibly.
btw If I want to use a texture from terrain.png (not use a custom .png) for the block of the mod, the "0" from
in mod_Block must be ..e.g "1"?
If Im not using a custom texture and only use a texture from terrain.png what happens with "/image.png" here
If you're using a default texture from the game then just delete the entire ModLoader.addOverride line. But yes, change the 0 to the number of the texture in the terrain.png
together they are powerful beyond imagination."
-
View User Profile
-
View Posts
-
Send Message
Retired StaffNo. But remember to use one mod_ file per individual mod.
like when using a texture in a block, because "The constructor Item(int, int) is undefined" message appears on Eclipse. Am I wrong?
Thanks for the feedback. I'll add it in later.
together they are powerful beyond imagination."
I have tried to "Add a argument to match ItemSword(int, EnumToolMaterial)" like Eclipse sujected, and many other things. I have also tried using and editing the "ItemNameHere" template from main post but nothing.
Right it works that too! However I tried that code before without succeding, maybe because I edited other line or a parameter from the code when I recompiled it...
This was easiest to find than the since Eclipse suggest it when it lacks the parameter, it would be cool to include this too. It is also possible to create new tool materials by editing the EnumToolMaterial, which isnt very recommended since people would have to include the edited EnumToolMaterial to their modpack for overwriting the original unedited ones...
Thanks again
-Monkey
together they are powerful beyond imagination."