Edit 4/8:: Until future notice, all issues coding this mod will be in my last reply to this topic!
----------------------------------
So here is what the mob is supposed to look like:
...here is what it looks like (brace yourself for sorrow):
ahahha... if that's not the visual representation of saddness, I don't know what is!
Here's my code, which has been ever-so painstakingly trimmed and pieced together from the ocelot and wolf classes:
Edit:: Added the suggested line in the main class and changed some more wolf stuff to eevee stuff in the entity class. Still having the exact same problem, however.
Note: I couldn't get it to spawn with the modloader code, so I had to add a line to the BiomeGenBase. Additionally, so far I've only found them in/around forests, which I'm guessing has something to do with all the code I copypasted from the wolves...
First I must say that I love the potential here. Eevee lovers unite!
I'm not entirely sure why I have this stuff here, but my creatures seem to work so far so I think it might help you, too.
public class EeveeRender extends EntityLiving
{ //add from here...
private EeveeModel paramEeveeModel;
public EeveeRender(ModelBase par1modelbase, float par2)
{
super(par1modelbase, par2);
paramEeveeModel = (EeveeModel)super.mainModel;
setRenderPassModel(par1modelbase);
}
//...to here at the top of the Render class
public void... etc etc
Of course, what I've done here is try to fit your names into my code section, so there may be issues.
I also do not use (read: have at all) the func_25006_b, preRenderCallBack, doRenderLiving, or doRender in my code, and the monsters seem to look normal. Try removing them as well (commenting them out so you can add them back in just in case) and see if that helps.
I copied your code and played around with everything I could, trying to fix the problem. I must warn you that while I may have fixed it (on my end) I really don't know what all the functions in MineCraft do, so I hope there's nothing too important missing.
On to the hopefully working code:
RenderEevee.class
package net.minecraft.src;
import org.lwjgl.opengl.GL11;
public class RenderEevee extends RenderLiving
{
private ModelEevee modelEeveeMain;
public RenderEevee(ModelEevee modeleevee, float f)
{
super(modeleevee, f);
modelEeveeMain = (ModelEevee)super.mainModel;
setRenderPassModel(modeleevee);
}
}
I think the main thing that threw me for a loop was that nothing I did seemed to work, until at one point I left MC in a small window and saw tons of errors happening. It turns out there's no Muzzle box to render. Leave the Muzzle render section commented out to test, fix it up top where you detail Head and Body. etc.
Ah, I actually got the model working fine at this point! Unfortunately it's scooted backwards a bit, and when I tried to move it forward... well, crap hit the fan. >_>; So I'm leaving it as it is for now.
The main problem I'm having right now is that I can't figure out for the life of me how to get the mob to move faster. For some reason, moveSpeed seems to do nothing, whether I try to set it low to slow it down or really high to make it ridiculously fast.
I'm not sure I know what you're talking about when you say the model is shifted back, but I'll take your word for it.
My testing shows that you need to modify the line "tasks.addTask(5, new EntityAIWander(this, 0.2F));". 0.2 is the normal speed, and 0.8 is FAST. I guess the Wander AI script overrides moveSpeed.
Oh my goodness, I NEVER would have figured it out if you hadn't said something, thank you so much for that!
And, actually-- I don't think mobs use moveSpeed at all, because of functions like AIPanic, the Ocelot's sneaking and sprinting, stuff like that.
And what I mean by the model being shifted back is that it's basically out of line with the hitbox. It's not a problem with a code directly, it's something I did mistakenly in Techne. If you look at the image, the Eevee is not centered, but the back legs are almost touching the edge of the cube while the front legs are a good distance away from the cube.
Alright, well, I already have this topic going, so I suppose I'll ask here.
How do I make an entity check for an item on the ground around it, and then locate and go to that position? I don't even have the first clue what this code would be.
I use something like this, replacing EntityItem with the entity of my choice, to see if there's a certain number of monsters within the bounds. This code was originally taken from the Mob Spawner code, modified to look within a 32 block radius, so you should be able to look there for more inspiration if required.
Perhaps use it something like this:
List list = worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBoxFromPool(posX, posY, posZ, posX + 1.0D, posY + 1.0D, posZ + 1.0D).expand(32D, 4D, 32D));
if (!list.isEmpty())
{
Entity randomitem = (Entity)list.get(worldObj.rand.nextInt(list.size()));
int a = (int)randomitem.posX;
int b = (int)randomitem.posY;
int c = (int)randomitem.posZ;
if (randomitem.entityId == whateveryou'relookingfor)
//add pathfinding to the (a,b,c) found above
}
Do this often enough using random and you'll be bound to find the item ID that you're looking for. Or, instead of using a random item in the List, I'm sure there's some code that'll let us find the exact item ID we're looking for and use that.
I might spend some time looking into the pathfinding section as well, but for now I hope this helps.
Hmm... I think adding a function like that would really complicate things, and since this is a simple practice mod, I will refrain from doing so for now. ^^
Hmmm... having a bit of trouble getting the eevee to sit down while you have the taming item in your hand. I'd prefer it if it doesn't get up from sitting, but will still come to you even if you have tamed it already.
The code in EntityWolf seems to be filled with gibberish, but if you look hard enough and make some guesses you can see at least part of what goes on in there.
public boolean interact(EntityPlayer par1EntityPlayer)
{
ItemStack var2 = par1EntityPlayer.inventory.getCurrentItem();//get the item you're holding in your hand.
if (!this.func_48139_F_())//this probably says, if "tamed" is false
{
if (var2 != null && var2.itemID == Item.bone.shiftedIndex && !this.isAngry())
{
--var2.stackSize;
if (var2.stackSize <= 0)
{
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack)null);
}
if (!this.worldObj.isRemote)
{
if (this.rand.nextInt(3) == 0)//with a 1 in 3 chance, tame them.
{
this.func_48138_b(true);//not sure. Maybe it sets tamed?
this.setPathToEntity((PathEntity)null);//stop moving
this.func_48092_c((EntityLiving)null);//stop being angry
this.field_48146_a.func_48407_a(true);//eclipse tells me this is called in AISit, so this tells the wolf to sit when tamed
this.setEntityHealth(20);
this.func_48143_a(par1EntityPlayer.username);//the player to follow
this.func_48142_a(true);//the code that creates hearts
this.worldObj.setEntityState(this, (byte)7);
}
else
{
this.func_48142_a(false);
this.worldObj.setEntityState(this, (byte)6);
}
}
return true;
}
}
else
{
if (var2 != null && Item.itemsList[var2.itemID] instanceof ItemFood)
{
ItemFood var3 = (ItemFood)Item.itemsList[var2.itemID];
if (var3.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectInt(18) < 20)
{
--var2.stackSize;
this.heal(var3.getHealAmount());
if (var2.stackSize <= 0)
{
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack)null);
}
return true;
}
}//this whole if was about healing, simple enough
if (par1EntityPlayer.username.equalsIgnoreCase(this.func_48145_ag()) && !this.worldObj.isRemote && !this.isWheat(var2))
{//this most likely tells the wolf to change sitting state, then go to you.
this.field_48146_a.func_48407_a(!this.func_48141_af());
this.isJumping = false;
this.setPathToEntity((PathEntity)null);
}
}
return super.interact(par1EntityPlayer);
}
I added comments to the code explaining what I think each section means. Since you want to start simply, use as much as you can that you know works. For example, the wolf code.
Your last sentence confuses me. If the Eevee isn't supposed to stand up, how is it supposed to come to you?
Yeah, I've been staring at that particular section of the code all morning, trying to figure out how it prevents the wolf from coming to you when it's sitting..
And, eek, sorry, bad choice of words. I meant that if it was already standing, then it would come to you if you hold the apple. I believe cats do exactly this-- they won't come if they're sitting, but if they're standing and you have fish in your hands, regardless of whether it's a wild ocelot or a tamed cat, it will still come to you.
The Ocelot code that deals with fish and coming towards you is not actually in the Ocelot code, it's in AITempt (I think). There's a line in the Ocelot code at the top: this.tasks.addTask(3, this.field_48149_b = new EntityAITempt(this, 0.18F, Item.fishRaw.shiftedIndex, true));
If you are using AI for everything else you can probably put this in there somewhere (changing the 3 near the beginning to be whatever # task it is now), and remember to change the Item.fishRaw to Item.apple or whatever you want to tempt the Eevees with.
Unless the 3 is the order it should be looked at? AI code is all so new.
The code I showed doesn't actually do anything about the temptation of fish or bones. That will only deal with when you click the entity, taming it, healing it, or making it sit/get up. Pre-1.2 I would have tried to use updateEntityActionState to deal with temptation, but the AI stuff should do the trick now.
----------------------------------
So here is what the mob is supposed to look like:
...here is what it looks like (brace yourself for sorrow):
ahahha... if that's not the visual representation of saddness, I don't know what is!
Here's my code, which has been ever-so painstakingly trimmed and pieced together from the ocelot and wolf classes:
Edit:: Added the suggested line in the main class and changed some more wolf stuff to eevee stuff in the entity class. Still having the exact same problem, however.
Note: I couldn't get it to spawn with the modloader code, so I had to add a line to the BiomeGenBase. Additionally, so far I've only found them in/around forests, which I'm guessing has something to do with all the code I copypasted from the wolves...
Want a place to advertise your Minecraft server? try MyMCStatus.net now!
I'm not entirely sure why I have this stuff here, but my creatures seem to work so far so I think it might help you, too.
Of course, what I've done here is try to fit your names into my code section, so there may be issues.
I also do not use (read: have at all) the func_25006_b, preRenderCallBack, doRenderLiving, or doRender in my code, and the monsters seem to look normal. Try removing them as well (commenting them out so you can add them back in just in case) and see if that helps.
On to the hopefully working code:
RenderEevee.class
ModelEevee.class
I think the main thing that threw me for a loop was that nothing I did seemed to work, until at one point I left MC in a small window and saw tons of errors happening. It turns out there's no Muzzle box to render. Leave the Muzzle render section commented out to test, fix it up top where you detail Head and Body. etc.
The main problem I'm having right now is that I can't figure out for the life of me how to get the mob to move faster. For some reason, moveSpeed seems to do nothing, whether I try to set it low to slow it down or really high to make it ridiculously fast.
I'm not sure I know what you're talking about when you say the model is shifted back, but I'll take your word for it.
My testing shows that you need to modify the line "tasks.addTask(5, new EntityAIWander(this, 0.2F));". 0.2 is the normal speed, and 0.8 is FAST. I guess the Wander AI script overrides moveSpeed.
And, actually-- I don't think mobs use moveSpeed at all, because of functions like AIPanic, the Ocelot's sneaking and sprinting, stuff like that.
And what I mean by the model being shifted back is that it's basically out of line with the hitbox. It's not a problem with a code directly, it's something I did mistakenly in Techne. If you look at the image, the Eevee is not centered, but the back legs are almost touching the edge of the cube while the front legs are a good distance away from the cube.
How do I make an entity check for an item on the ground around it, and then locate and go to that position? I don't even have the first clue what this code would be.
I use something like this, replacing EntityItem with the entity of my choice, to see if there's a certain number of monsters within the bounds. This code was originally taken from the Mob Spawner code, modified to look within a 32 block radius, so you should be able to look there for more inspiration if required.
Perhaps use it something like this:
Do this often enough using random and you'll be bound to find the item ID that you're looking for. Or, instead of using a random item in the List, I'm sure there's some code that'll let us find the exact item ID we're looking for and use that.
I might spend some time looking into the pathfinding section as well, but for now I hope this helps.
Hmmm... having a bit of trouble getting the eevee to sit down while you have the taming item in your hand. I'd prefer it if it doesn't get up from sitting, but will still come to you even if you have tamed it already.
The code in EntityWolf seems to be filled with gibberish, but if you look hard enough and make some guesses you can see at least part of what goes on in there.
I added comments to the code explaining what I think each section means. Since you want to start simply, use as much as you can that you know works. For example, the wolf code.
Your last sentence confuses me. If the Eevee isn't supposed to stand up, how is it supposed to come to you?
And, eek, sorry, bad choice of words. I meant that if it was already standing, then it would come to you if you hold the apple. I believe cats do exactly this-- they won't come if they're sitting, but if they're standing and you have fish in your hands, regardless of whether it's a wild ocelot or a tamed cat, it will still come to you.
If you are using AI for everything else you can probably put this in there somewhere (changing the 3 near the beginning to be whatever # task it is now), and remember to change the Item.fishRaw to Item.apple or whatever you want to tempt the Eevees with.
Unless the 3 is the order it should be looked at? AI code is all so new.
The code I showed doesn't actually do anything about the temptation of fish or bones. That will only deal with when you click the entity, taming it, healing it, or making it sit/get up. Pre-1.2 I would have tried to use updateEntityActionState to deal with temptation, but the AI stuff should do the trick now.