You're welcome
A good site I use is http://wuppy29.blogs...08/wuppy29.html If you look in the Tutorial section in these forums you will find others but Wuppy does a great job. If you are having trouble with something, try to look at Forge's and cpw's packages. For example. Registering blocks, keys, entities are in the cpw.mods.fml.client.registry package.
The main part I don't understand is the proxy system, i previously modded with modloader which didn't have that so do you know any sites where i can read up on that?
@SidedProxy(clientSide = "shadowmage.catapult.ClientProxy", serverSide = "shadowmage.catapult.CommonProxy")
public static CommonProxy proxy; //This object will be populated with the class that you choose for the environment
Forge will initiate the proxy field depending on what side it is. Make sure your strings that refer to the sides match the class location or you will get an error. Look at my example forge project to see the proxies being used. http://www.mediafire.com/?0tjvclys1bcewad
Rollback Post to RevisionRollBack
Same ****, different day - Modification Development Section
Ok, so this is what I have now and my zombies body is still coming out invisible only the head shows up and the texture is all bunched up on the head
package Zombie.common;
import net.minecraft.src.EntityEggInfo;
import net.minecraft.src.EntityGirlZombie;
import net.minecraft.src.EntityList;
import net.minecraft.src.EnumCreatureType;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.EntityRegistry;
@Mod(modid = "Alex_zombiecraft", name = "zombiecraft", version = "1.0")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class zombiecraft
{
@Init
public void load(FMLInitializationEvent event)
{
//girl zombie
int red = (255 << 16);
int orange = (255 << 16)+ (200 << 8);
int modEntityId = 300;
EntityRegistry.registerModEntity(EntityGirlZombie.class, "GirlZombie", modEntityId, this, 80, 3, true);
EntityRegistry.addSpawn(EntityGirlZombie.class, 100, 5, 18, EnumCreatureType.creature);
int id = 300; // has to be unique
EntityList.IDtoClassMapping.put(300, EntityGirlZombie.class);
EntityList.entityEggs.put(300, new EntityEggInfo(300, red,orange ));
}
}
EntityGirlZombie.java if that helps
package net.minecraft.src;
public class EntityGirlZombie extends EntityMob
{
public EntityGirlZombie(World par1World)
{
super(par1World);
this.texture = "/mob/zombie.png";
this.moveSpeed = 0.23F;
this.getNavigator().setBreakDoors(true);
this.tasks.addTask(0, new EntityAISwimming(this));
this.tasks.addTask(1, new EntityAIBreakDoor(this));
this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, this.moveSpeed, false));
this.tasks.addTask(3, new EntityAIAttackOnCollide(this, EntityVillager.class, this.moveSpeed, true));
this.tasks.addTask(4, new EntityAIMoveTwardsRestriction(this, this.moveSpeed));
this.tasks.addTask(5, new EntityAIMoveThroughVillage(this, this.moveSpeed, false));
this.tasks.addTask(6, new EntityAIWander(this, this.moveSpeed));
this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
this.tasks.addTask(7, new EntityAILookIdle(this));
this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));
this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 16.0F, 0, true));
this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityVillager.class, 16.0F, 0, false));
}
public int getMaxHealth()
{
return 20;
}
/**
* Returns the current armor value as determined by a call to InventoryPlayer.getTotalArmorValue
*/
public int getTotalArmorValue()
{
return 2;
}
/**
* Returns true if the newer Entity AI code should be run
*/
protected boolean isAIEnabled()
{
return true;
}
/**
* Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons
* use this to react to sunlight and start to burn.
*/
public void onLivingUpdate()
{
if (this.worldObj.isDaytime() && !this.worldObj.isRemote)
{
float var1 = this.getBrightness(1.0F);
if (var1 > 0.5F && this.worldObj.canBlockSeeTheSky(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)) && this.rand.nextFloat() * 30.0F < (var1 - 0.4F) * 2.0F)
{
this.setFire(0);
}
}
super.onLivingUpdate();
}
/**
* Returns the sound this mob makes while it's alive.
*/
protected String getLivingSound()
{
return "mob.zombie";
}
/**
* Returns the sound this mob makes when it is hurt.
*/
protected String getHurtSound()
{
return "mob.zombiehurt";
}
/**
* Returns the sound this mob makes on death.
*/
protected String getDeathSound()
{
return "mob.zombiedeath";
}
/**
* Returns the item ID for the item the mob drops on death.
*/
protected int getDropItemId()
{
return Item.rottenFlesh.shiftedIndex;
}
/**
* Get this Entity's EnumCreatureAttribute
*/
public EnumCreatureAttribute getCreatureAttribute()
{
return EnumCreatureAttribute.UNDEAD;
}
protected void dropRareDrop(int par1)
{
switch (this.rand.nextInt(4))
{
case 0:
this.dropItem(Item.swordSteel.shiftedIndex, 1);
break;
case 1:
this.dropItem(Item.helmetSteel.shiftedIndex, 1);
break;
case 2:
this.dropItem(Item.ingotIron.shiftedIndex, 1);
break;
case 3:
this.dropItem(Item.shovelSteel.shiftedIndex, 1);
}
}
}
Is there a reason why you have the modEntityId as 300? It's a good practice to start at 1 and increment from there.
int id = 300; // has to be unique
EntityList.IDtoClassMapping.put(300, EntityGirlZombie.class);
EntityList.entityEggs.put(300, new EntityEggInfo(300, red,orange ));
Look at that code, notice how id is never used.
Now onto proxies! You need two proxies, CommonProxy and ClientProxy. ClientProxy will extend CommonProxy.
Create the following files
In you common package make the CommonProxy
package package alogo.mods.zombie.common;
public class CommonProxy {
public void init() {
}
}
create the following package
package alogo.mods.zombie.client
Now make the ClientProxy which extends the CommonProxy
package alogo.mods.zombie.client;
import alogo.mods.zombie.common.CommonProxy;
import cpw.mods.fml.client.registry.RenderingRegistry;
// import your EntityGirlZombie and RenderGirlZombie classes
public class ClientProxy extends CommonProxy {
@Override
public void init() {
// register rendering
RenderingRegistry.registerEntityRenderingHandler(EntityGirlZombie.class, new RenderGirlZombie()); // your render class
}
}
After that just add the SidedProxy annotation.
package alogo.mods.zombie.common;
// imports
import cpw.mods.fml.common.SidedProxy;
import alogo.mods.zombie.client.ClientProxy;
@Mod(modid ="Alex_zombiecraft", name ="zombiecraft", version ="1.0")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class Zombiecraft {
@SidedProxy(clientSide = "alogo.mods.zombie.client.ClientProxy",
serverSide = "alogo.mods.zombie.common.CommonProxy")
public static CommonProxy commonProxy;
@Init
public void load(FMLInitializationEvent event) {
// code ....
commonProxy.init();
}
}
how do I set textures for entities and what folders should I put the textures in?
Put them in your source folders. So lets say the texture is called girlzombie.png. Put that texture in the package alogo.mods.zombie. In your CommonProxy class add the following string
public class CommonProxy {
public static final String TEXTURE_GIRLZOMBIE = "/alogo/mods/zombie/girlzombie.png";
public void init() {
}
}
Now in your ClientProxy pre-load the texture.
// imports
import net.minecraftforge.client.MinecraftForgeClient;
public class ClientProxy extends CommonProxy {
@Override
public void init() {
// pre-load textures
MinecraftForgeClient.preloadTexture(TEXTURE_GIRLZOMBIE);
// register rendering
RenderingRegistry.registerEntityRenderingHandler(EntityGirlZombie.class, new RenderGirlZombie()); // your render class
}
}
Anything, just make sure you change the id for each entity. This Id won't conflict with any other mods installed and doesn't have a range; besides the range of an integer :P.
So start at one, then increment from there. e.g.,
EntityRegistry.registerModEntity(EntityThing1.class, "Thing1", 1, this, 80, 3, true);
EntityRegistry.registerModEntity(EntityThing2.class, "Thing2", 2, this, 80, 3, true);
EntityRegistry.registerModEntity(EntityThing3.class, "Thing3", 3, this, 80, 3, true);
// you get the point
Rollback Post to RevisionRollBack
Same ****, different day - Modification Development Section
I have the model code all done, i am just unsure with regards how to implement it. The texture is all fine and working however the model is displaying as a human.
So i have a Model<Blablabla>.class, i am just wondering how to call it
package AOTCFS;
import java.util.Random;
import AOTCFS.Common.CommonProxyAOTCFS;
import net.minecraft.src.EntityAIAvoidEntity;
import net.minecraft.src.EntityAIFollowParent;
import net.minecraft.src.EntityAILookIdle;
import net.minecraft.src.EntityAIMate;
import net.minecraft.src.EntityAIMoveTwardsRestriction;
import net.minecraft.src.EntityAIPanic;
import net.minecraft.src.EntityAISwimming;
import net.minecraft.src.EntityAITempt;
import net.minecraft.src.EntityAIWander;
import net.minecraft.src.EntityAIWatchClosest;
import net.minecraft.src.EntityAnimal;
import net.minecraft.src.EntityCreature;
import net.minecraft.src.Item;
import net.minecraft.src.NBTTagCompound;
import net.minecraft.src.World;
public class EntityHen extends EntityAnimal
{
public boolean field_753_a;
public float field_752_b;
public float destPos;
public float field_757_d;
public float field_756_e;
public float field_755_h;
/** The time until the next egg is spawned. */
public int timeUntilNextEgg;
public EntityHen(World par1World)
{
super(par1World);
field_753_a = false;
field_752_b = 0.0F;
destPos = 0.0F;
field_755_h = 1.0F;
texture = CommonProxyAOTCFS.TEXTURE_HEN;
setSize(0.3F, 0.7F);
timeUntilNextEgg = rand.nextInt(6000) + 6000;
float f = 0.25F;
tasks.addTask(0, new EntityAISwimming(this));
tasks.addTask(1, new EntityAIPanic(this, 0.38F));
tasks.addTask(2, new EntityAIMate(this, f));
tasks.addTask(5, new EntityAIMoveTwardsRestriction(this, 0.3F));
tasks.addTask(4, new EntityAIFollowParent(this, 0.28F));
tasks.addTask(5, new EntityAIWander(this, f));
tasks.addTask(6, new EntityAIWatchClosest(this, net.minecraft.src.EntityPlayer.class, 6F));
tasks.addTask(7, new EntityAILookIdle(this));
}
/**
* Returns true if the newer Entity AI code should be run
*/
public boolean isAIEnabled()
{
return true;
}
public int getMaxHealth()
{
return 6;
}
/**
* Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons
* use this to react to sunlight and start to burn.
*/
public void onLivingUpdate()
{
super.onLivingUpdate();
field_756_e = field_752_b;
field_757_d = destPos;
destPos += (double)(onGround ? -1 : 4) * 0.3D;
if (destPos < 0.0F)
{
destPos = 0.0F;
}
if (destPos > 1.0F)
{
destPos = 1.0F;
}
if (!onGround && field_755_h < 1.0F)
{
field_755_h = 1.0F;
}
field_755_h *= 0.9D;
if (!onGround && motionY < 0.0D)
{
motionY *= 0.6D;
}
field_752_b += field_755_h * 2.0F;
if (!isChild() && !worldObj.isRemote && --timeUntilNextEgg <= 0)
{
worldObj.playSoundAtEntity(this, "mob.chickenplop", 1.0F, (rand.nextFloat() - rand.nextFloat()) * 0.2F + 1.0F);
dropItem(mod_AOTCFS.LargeEgg.shiftedIndex, 1);
timeUntilNextEgg = rand.nextInt(6000) + 6000;
}
}
/**
* Called when the mob is falling. Calculates and applies fall damage.
*/
protected void fall(float f)
{
}
/**
* (abstract) Protected helper method to write subclass entity data to NBT.
*/
public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
{
super.writeEntityToNBT(par1NBTTagCompound);
}
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
{
super.readEntityFromNBT(par1NBTTagCompound);
}
/**
* Returns the sound this mob makes while it's alive.
*/
protected String getLivingSound()
{
return "mob.chicken";
}
/**
* Returns the sound this mob makes when it is hurt.
*/
protected String getHurtSound()
{
return "mob.chickenhurt";
}
/**
* Returns the sound this mob makes on death.
*/
protected String getDeathSound()
{
return "mob.chickenhurt";
}
/**
* Returns the item ID for the item the mob drops on death.
*/
protected int getDropItemId()
{
return Item.feather.shiftedIndex;
}
/**
* Drop 0-2 items of this living's type
*/
protected void dropFewItems(boolean par1, int par2)
{
int i = rand.nextInt(3) + rand.nextInt(1 + par2);
for (int j = 0; j < i; j++)
{
dropItem(Item.feather.shiftedIndex, 1);
}
if (isBurning())
{
dropItem(Item.chickenCooked.shiftedIndex, 1);
}
else
{
dropItem(Item.chickenRaw.shiftedIndex, 1);
}
}
/**
* [This function is used when two same-species animals in 'love mode' breed to generate the new baby animal.]
*/
public EntityAnimal spawnBabyAnimal(EntityAnimal par1EntityAnimal)
{
return new EntityHen(worldObj);
}
}
package AOTCFS.Client;
import AOTCFS.EntityHen;
import AOTCFS.RenderHen;
import AOTCFS.Common.CommonProxyAOTCFS;
import net.minecraftforge.client.MinecraftForgeClient;
import cpw.mods.fml.client.registry.RenderingRegistry;
public class ClientProxyAOTCFS extends CommonProxyAOTCFS
{
@Override
public void init() {
// register rendering
MinecraftForgeClient.preloadTexture(TEXTURE_HEN);
RenderingRegistry.registerEntityRenderingHandler(EntityHen.class, new RenderHen(null, 0));
}
public void registerRenderAOTCFS()
{
MinecraftForgeClient.preloadTexture("/AOTCFSTextures/Items.png");
}
}
CommonProxy
package AOTCFS.Common;
public class CommonProxyAOTCFS
{
public static final String TEXTURE_HEN = "/AOTCFSTextures/Hen.png";
public void registerRenderAOTCFS() {}
public void init() { }
}
I have the model code all done, i am just unsure with regards how to implement it. The texture is all fine and working however the model is displaying as a human.
So i have a Model<Blablabla>.class, i am just wondering how to call it
package AOTCFS;
import java.util.Random;
import AOTCFS.Common.CommonProxyAOTCFS;
import net.minecraft.src.EntityAIAvoidEntity;
import net.minecraft.src.EntityAIFollowParent;
import net.minecraft.src.EntityAILookIdle;
import net.minecraft.src.EntityAIMate;
import net.minecraft.src.EntityAIMoveTwardsRestriction;
import net.minecraft.src.EntityAIPanic;
import net.minecraft.src.EntityAISwimming;
import net.minecraft.src.EntityAITempt;
import net.minecraft.src.EntityAIWander;
import net.minecraft.src.EntityAIWatchClosest;
import net.minecraft.src.EntityAnimal;
import net.minecraft.src.EntityCreature;
import net.minecraft.src.Item;
import net.minecraft.src.NBTTagCompound;
import net.minecraft.src.World;
public class EntityHen extends EntityAnimal
{
public boolean field_753_a;
public float field_752_b;
public float destPos;
public float field_757_d;
public float field_756_e;
public float field_755_h;
/** The time until the next egg is spawned. */
public int timeUntilNextEgg;
public EntityHen(World par1World)
{
super(par1World);
field_753_a = false;
field_752_b = 0.0F;
destPos = 0.0F;
field_755_h = 1.0F;
texture = CommonProxyAOTCFS.TEXTURE_HEN;
setSize(0.3F, 0.7F);
timeUntilNextEgg = rand.nextInt(6000) + 6000;
float f = 0.25F;
tasks.addTask(0, new EntityAISwimming(this));
tasks.addTask(1, new EntityAIPanic(this, 0.38F));
tasks.addTask(2, new EntityAIMate(this, f));
tasks.addTask(5, new EntityAIMoveTwardsRestriction(this, 0.3F));
tasks.addTask(4, new EntityAIFollowParent(this, 0.28F));
tasks.addTask(5, new EntityAIWander(this, f));
tasks.addTask(6, new EntityAIWatchClosest(this, net.minecraft.src.EntityPlayer.class, 6F));
tasks.addTask(7, new EntityAILookIdle(this));
}
/**
* Returns true if the newer Entity AI code should be run
*/
public boolean isAIEnabled()
{
return true;
}
public int getMaxHealth()
{
return 6;
}
/**
* Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons
* use this to react to sunlight and start to burn.
*/
public void onLivingUpdate()
{
super.onLivingUpdate();
field_756_e = field_752_b;
field_757_d = destPos;
destPos += (double)(onGround ? -1 : 4) * 0.3D;
if (destPos < 0.0F)
{
destPos = 0.0F;
}
if (destPos > 1.0F)
{
destPos = 1.0F;
}
if (!onGround && field_755_h < 1.0F)
{
field_755_h = 1.0F;
}
field_755_h *= 0.9D;
if (!onGround && motionY < 0.0D)
{
motionY *= 0.6D;
}
field_752_b += field_755_h * 2.0F;
if (!isChild() && !worldObj.isRemote && --timeUntilNextEgg <= 0)
{
worldObj.playSoundAtEntity(this, "mob.chickenplop", 1.0F, (rand.nextFloat() - rand.nextFloat()) * 0.2F + 1.0F);
dropItem(mod_AOTCFS.LargeEgg.shiftedIndex, 1);
timeUntilNextEgg = rand.nextInt(6000) + 6000;
}
}
/**
* Called when the mob is falling. Calculates and applies fall damage.
*/
protected void fall(float f)
{
}
/**
* (abstract) Protected helper method to write subclass entity data to NBT.
*/
public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
{
super.writeEntityToNBT(par1NBTTagCompound);
}
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
{
super.readEntityFromNBT(par1NBTTagCompound);
}
/**
* Returns the sound this mob makes while it's alive.
*/
protected String getLivingSound()
{
return "mob.chicken";
}
/**
* Returns the sound this mob makes when it is hurt.
*/
protected String getHurtSound()
{
return "mob.chickenhurt";
}
/**
* Returns the sound this mob makes on death.
*/
protected String getDeathSound()
{
return "mob.chickenhurt";
}
/**
* Returns the item ID for the item the mob drops on death.
*/
protected int getDropItemId()
{
return Item.feather.shiftedIndex;
}
/**
* Drop 0-2 items of this living's type
*/
protected void dropFewItems(boolean par1, int par2)
{
int i = rand.nextInt(3) + rand.nextInt(1 + par2);
for (int j = 0; j < i; j++)
{
dropItem(Item.feather.shiftedIndex, 1);
}
if (isBurning())
{
dropItem(Item.chickenCooked.shiftedIndex, 1);
}
else
{
dropItem(Item.chickenRaw.shiftedIndex, 1);
}
}
/**
* [This function is used when two same-species animals in 'love mode' breed to generate the new baby animal.]
*/
public EntityAnimal spawnBabyAnimal(EntityAnimal par1EntityAnimal)
{
return new EntityHen(worldObj);
}
}
package AOTCFS.Client;
import AOTCFS.EntityHen;
import AOTCFS.RenderHen;
import AOTCFS.Common.CommonProxyAOTCFS;
import net.minecraftforge.client.MinecraftForgeClient;
import cpw.mods.fml.client.registry.RenderingRegistry;
public class ClientProxyAOTCFS extends CommonProxyAOTCFS
{
@Override
public void init() {
// register rendering
MinecraftForgeClient.preloadTexture(TEXTURE_HEN);
RenderingRegistry.registerEntityRenderingHandler(EntityHen.class, new RenderHen(null, 0));
}
public void registerRenderAOTCFS()
{
MinecraftForgeClient.preloadTexture("/AOTCFSTextures/Items.png");
}
}
CommonProxy
package AOTCFS.Common;
public class CommonProxyAOTCFS
{
public static final String TEXTURE_HEN = "/AOTCFSTextures/Hen.png";
public void registerRenderAOTCFS() {}
public void init() { }
}
I am using forge and on 1.4.2
Uploaded with ImageShack.us
Here is my code
Anyone know what im doing wrong?
You need to call this method in your ClientProxy. Read up on proxies here http://www.minecraft...he_proxy_system
Don't use any of the ModLoader methods, use Forge's(cpw)
modEntityId is a mod specific Id, so there are no conflicts. Start out with 1, 2, and so on.
Adding eggs
I was also wondering if you had any good tutorials that could teach me the basics of forge and how the coding system works
A good site I use is http://wuppy29.blogs...08/wuppy29.html If you look in the Tutorial section in these forums you will find others but Wuppy does a great job. If you are having trouble with something, try to look at Forge's and cpw's packages. For example. Registering blocks, keys, entities are in the cpw.mods.fml.client.registry package.
Forge will initiate the proxy field depending on what side it is. Make sure your strings that refer to the sides match the class location or you will get an error. Look at my example forge project to see the proxies being used.
http://www.mediafire.com/?0tjvclys1bcewad
EntityGirlZombie.java if that helps
packages are supposed to be all lower case. Since this is your mod, I would change it up like this
of course you can change it to what you like
All classes are upper case and follow Camel Case format. Change it to
or ZombieCraft if it's two words.
Is there a reason why you have the modEntityId as 300? It's a good practice to start at 1 and increment from there.
Look at that code, notice how id is never used.
Now onto proxies! You need two proxies, CommonProxy and ClientProxy. ClientProxy will extend CommonProxy.
Create the following files
In you common package make the CommonProxy
create the following package
Now make the ClientProxy which extends the CommonProxy
After that just add the SidedProxy annotation.
Put them in your source folders. So lets say the texture is called girlzombie.png. Put that texture in the package alogo.mods.zombie. In your CommonProxy class add the following string
Now in your ClientProxy pre-load the texture.
After that, just set the texture in your entity.
Nice! Looks like you got it now.
Anything, just make sure you change the id for each entity. This Id won't conflict with any other mods installed and doesn't have a range; besides the range of an integer :P.
So start at one, then increment from there. e.g.,
If you mean by registering it, you do
Make sure to put that in your ClientProxy.
So i have a Model<Blablabla>.class, i am just wondering how to call it
(Hopefully that makes sense)
Model File
Entity
Render
Client Proxy
CommonProxy
So there are the files incase those are needed
What i want to know is how to get the custom chicken model (the one in my previous reply) to be used instead of the human model
Did it a while ago