Arggg >.<, I got everything working besides making it spawn but it doesnt spawn, so now i do this and i got errors....again, Help please...
It keeps referring to WorldObj and Class Minecraft...
Recompile Log
== ERRORS FOUND ==
src\minecraft\net\minecraft\src\mod_Anibus.java:31: cannot find symbol
symbol : class Minecraft
location: class net.minecraft.src.mod_Anibus
public boolean OnTickInGame(Minecraft mc)
^
src\minecraft\net\minecraft\src\mod_Anibus.java:33: cannot find symbol
symbol : variable worldObj
location: class net.minecraft.src.mod_Anibus
worldObj = mc.theWorld;
^
src\minecraft\net\minecraft\src\mod_Anibus.java:38: cannot find symbol
symbol : variable worldObj
location: class net.minecraft.src.mod_Anibus
EntityLiving entityliving = (EntityLiving)EntityList.createEntityInWorld("Anibus
", worldObj);
^
src\minecraft\net\minecraft\src\mod_Anibus.java:40: cannot find symbol
symbol : variable worldObj
location: class net.minecraft.src.mod_Anibus
worldObj.entityJoinedWorld(entityliving);
^
4 errors
Main mod file
package net.minecraft.src;
import java.util.Map;
public class mod_Anibus extends BaseMod
{
public mod_Anibus()
{
ModLoader.RegisterEntityID(JWorld_AnibusEntity.class, "Anibus",
ModLoader.getUniqueEntityId());
ModLoader.SetInGameHook(this, true, false);
ModLoader.AddSpawn(JWorld_AnibusEntity.class, 100, EnumCreatureType.creature);
}
public void AddRenderer(Map map)
{
map.put(JWorld_AnibusEntity.class, new JWorld_AnibusRender(new JWorld_AnibusModel(), 0.5F));
}
public String Version()
{
return"Anibus V1.1 MC v1.7.3";
}
private boolean didspawn = false;
public boolean OnTickInGame(Minecraft mc)
{
worldObj = mc.theWorld;
EntityPlayer theplayer = mc.thePlayer;
if(theplayer != null && !didspawn) //wait for the player to be made, and then spawn near him
{
//spawn a char near the player
EntityLiving entityliving = (EntityLiving)EntityList.createEntityInWorld("Anibus", worldObj);
entityliving.setLocationAndAngles(theplayer.posX + 0, theplayer.posY + 1, theplayer.posZ - 4, 0F, 0F); //x, y, z, yaw, pitch
worldObj.entityJoinedWorld(entityliving);
didspawn = !didspawn;
}
}
}
Are you sure your reading the error log right? Its referring to something else >.<
Here, try making OnTickInGame look like this:
public boolean OnTickInGame(Minecraft mc)
{
World worldObj;
worldObj = mc.theWorld;
EntityPlayer theplayer = mc.thePlayer;
if(theplayer != null && !didspawn) //wait for the player to be made, and then spawn near him
{
//spawn a char near the player
EntityLiving entityliving = (EntityLiving)EntityList.createEntityInWorld("Anibus", worldObj);
entityliving.setLocationAndAngles(theplayer.posX + 0, theplayer.posY + 1, theplayer.posZ - 4, 0F, 0F); //x, y, z, yaw, pitch
worldObj.entityJoinedWorld(entityliving);
didspawn = !didspawn;
}
return true;
}
I didn't see that worldObj wasn't initialized before, so now there is a line added to create the variable worldObj and as the last line you need the return statement (I should've seen that before, sorry). Since OnTickInGame is supposed to return a boolean, just have it return true or false since it doesn't matter in this case, we just want it to do all the other code before returning.
One last thing, add:
import net.minecraft.client.Minecraft;
At the top of the file with the other imports, the reason for this is that you mod_Anibus file has no idea where to find the Minecraft references in the OnTickInGame procedure without being pointed in the right direction so to speak (because the Minecraft class lies in a separate directory). I hope this fixes everything.
1
Here, try making OnTickInGame look like this:
I didn't see that worldObj wasn't initialized before, so now there is a line added to create the variable worldObj and as the last line you need the return statement (I should've seen that before, sorry). Since OnTickInGame is supposed to return a boolean, just have it return true or false since it doesn't matter in this case, we just want it to do all the other code before returning.
One last thing, add:
At the top of the file with the other imports, the reason for this is that you mod_Anibus file has no idea where to find the Minecraft references in the OnTickInGame procedure without being pointed in the right direction so to speak (because the Minecraft class lies in a separate directory). I hope this fixes everything.
One last question, are you using Eclipse?