Is there any way you can explain a bit more, like which code I'd have to remove... Also, why wouldn't creepers burn if that is the problem? Or maybe TechGuy can help a bit? BTW, I am using an already existing mob
The reason that you couldn't just change then to be like the creeper code is because creepers only spawn at night, but this is an example of the EntityNoSun file, you can compare it to EntityMob to see the difference:
package net.minecraft.src;
import java.util.Random;
public abstract class EntityMopirate extends EntityCreature implements IMob
{
/** How much damage this mob's attacks deal */
protected int attackStrength;
public EntityMopirate(World par1World)
{
super(par1World);
attackStrength = 2;
experienceValue = 5;
}
/**
* 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()
{
float f = getBrightness(1.0F);
if (f > 0.5F)
{
entityAge += 2;
}
super.onLivingUpdate();
}
/**
* Called to update the entity's position/logic.
*/
public void onUpdate()
{
super.onUpdate();
if (!worldObj.isRemote && worldObj.difficultySetting == 0)
{
setDead();
}
}
/**
* Finds the closest player within 16 blocks to attack, or null if this Entity isn't interested in attacking
* (Animals, Spiders at day, peaceful PigZombies).
*/
protected Entity findPlayerToAttack()
{
EntityPlayer entityplayer = worldObj.getClosestVulnerablePlayerToEntity(this, 32D);
if (entityplayer != null && canEntityBeSeen(entityplayer))
{
return entityplayer;
}
else
{
return null;
}
}
/**
* Called when the entity is attacked.
*/
public boolean attackEntityFrom(DamageSource par1DamageSource, int par2)
{
if (super.attackEntityFrom(par1DamageSource, par2))
{
Entity entity = par1DamageSource.getEntity();
if (riddenByEntity == entity || ridingEntity == entity)
{
return true;
}
if (entity != this)
{
entityToAttack = entity;
}
return true;
}
else
{
return false;
}
}
public boolean attackEntityAsMob(Entity par1Entity)
{
int i = attackStrength;
if (isPotionActive(Potion.damageBoost))
{
i += 3 << getActivePotionEffect(Potion.damageBoost).getAmplifier();
}
if (isPotionActive(Potion.weakness))
{
i -= 2 << getActivePotionEffect(Potion.weakness).getAmplifier();
}
return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), i);
}
/**
* Basic mob attack. Default to touch of death in EntityCreature. Overridden by each mob to define their attack.
*/
protected void attackEntity(Entity par1Entity, float par2)
{
if (attackTime <= 0 && par2 < 2.0F && par1Entity.boundingBox.maxY > boundingBox.minY && par1Entity.boundingBox.minY < boundingBox.maxY)
{
attackTime = 20;
attackEntityAsMob(par1Entity);
}
}
public void jump()
{
motionY = 0.51999998688697815D;
if (isPotionActive(Potion.jump))
{
motionY += (float)(getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1F;
}
if (isSprinting())
{
float f = rotationYaw * 0.01745329F;
motionX -= MathHelper.sin(f) * 0.2F;
motionZ += MathHelper.cos(f) * 0.2F;
}
isAirBorne = true;
}
public boolean isOnLadder()
{
int i = MathHelper.floor_double(posX);
int j = MathHelper.floor_double(boundingBox.minY);
int k = MathHelper.floor_double(posZ);
int l = worldObj.getBlockId(i, j, k);
return l == Block.ladder.blockID || l == Block.vine.blockID;
}
/**
* (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);
}
/**
* Checks if the entity's current position is a valid location to spawn this entity.
*/
public boolean getCanSpawnHere()
{
return true;
}
}
there is two things that I removed: a chunk that tells it to start on fire if it is in the sun, and the other is in the "CanSpawnHere" method,which I just have true, so that it doesn't check for light level when spawning a mob.
The reason that you couldn't just change then to be like the creeper code is because creepers only spawn at night, but this is an example of the EntityNoSun file, you can compare it to EntityMob to see the difference:
package net.minecraft.src;
import java.util.Random;
public abstract class EntityMopirate extends EntityCreature implements IMob
{
/** How much damage this mob's attacks deal */
protected int attackStrength;
public EntityMopirate(World par1World)
{
super(par1World);
attackStrength = 2;
experienceValue = 5;
}
/**
* 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()
{
float f = getBrightness(1.0F);
if (f > 0.5F)
{
entityAge += 2;
}
super.onLivingUpdate();
}
/**
* Called to update the entity's position/logic.
*/
public void onUpdate()
{
super.onUpdate();
if (!worldObj.isRemote && worldObj.difficultySetting == 0)
{
setDead();
}
}
/**
* Finds the closest player within 16 blocks to attack, or null if this Entity isn't interested in attacking
* (Animals, Spiders at day, peaceful PigZombies).
*/
protected Entity findPlayerToAttack()
{
EntityPlayer entityplayer = worldObj.getClosestVulnerablePlayerToEntity(this, 32D);
if (entityplayer != null && canEntityBeSeen(entityplayer))
{
return entityplayer;
}
else
{
return null;
}
}
/**
* Called when the entity is attacked.
*/
public boolean attackEntityFrom(DamageSource par1DamageSource, int par2)
{
if (super.attackEntityFrom(par1DamageSource, par2))
{
Entity entity = par1DamageSource.getEntity();
if (riddenByEntity == entity || ridingEntity == entity)
{
return true;
}
if (entity != this)
{
entityToAttack = entity;
}
return true;
}
else
{
return false;
}
}
public boolean attackEntityAsMob(Entity par1Entity)
{
int i = attackStrength;
if (isPotionActive(Potion.damageBoost))
{
i += 3 << getActivePotionEffect(Potion.damageBoost).getAmplifier();
}
if (isPotionActive(Potion.weakness))
{
i -= 2 << getActivePotionEffect(Potion.weakness).getAmplifier();
}
return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), i);
}
/**
* Basic mob attack. Default to touch of death in EntityCreature. Overridden by each mob to define their attack.
*/
protected void attackEntity(Entity par1Entity, float par2)
{
if (attackTime <= 0 && par2 < 2.0F && par1Entity.boundingBox.maxY > boundingBox.minY && par1Entity.boundingBox.minY < boundingBox.maxY)
{
attackTime = 20;
attackEntityAsMob(par1Entity);
}
}
public void jump()
{
motionY = 0.51999998688697815D;
if (isPotionActive(Potion.jump))
{
motionY += (float)(getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1F;
}
if (isSprinting())
{
float f = rotationYaw * 0.01745329F;
motionX -= MathHelper.sin(f) * 0.2F;
motionZ += MathHelper.cos(f) * 0.2F;
}
isAirBorne = true;
}
public boolean isOnLadder()
{
int i = MathHelper.floor_double(posX);
int j = MathHelper.floor_double(boundingBox.minY);
int k = MathHelper.floor_double(posZ);
int l = worldObj.getBlockId(i, j, k);
return l == Block.ladder.blockID || l == Block.vine.blockID;
}
/**
* (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);
}
/**
* Checks if the entity's current position is a valid location to spawn this entity.
*/
public boolean getCanSpawnHere()
{
return true;
}
}
there is two things that I removed: a chunk that tells it to start on fire if it is in the sun, and the other is in the "CanSpawnHere" method,which I just have true, so that it doesn't check for light level when spawning a mob.
Thank you! But Just ONE more question. I hope this is the last, but how do I raise their spawn rate?
Rollback Post to RevisionRollBack
My old signature was stupid and outdated. It's gone now.
Can you give me an example because I all ready tried, and couldn't figure it out.
ModLoader.AddShapelessRecipe(new ItemStack(Item.pickaxeDiamond), new Object[] { /*ingredients*/ Item.stick, Block.sand });
That is an example. Of course, you would replace Item.pickaxeDiamond with the thing you want to make, and the things in the ingredients section with what the actual ingredients are. You can have up to nine, each separated with commas.
ModLoader.AddShapelessRecipe(new ItemStack(Item.pickaxeDiamond), new Object[] { /*ingredients*/ Item.stick, Block.sand });
That is an example. Of course, you would replace Item.pickaxeDiamond with the thing you want to make, and the things in the ingredients section with what the actual ingredients are. You can have up to nine, each separated with commas.
I have never modded or scripted in my life until I found your tutorials. I have found them very helpful and detailed. Using eclipse and your tutorials, I made six mobs and three items, all of which are foods.The mod works, until it says that it can't find the images. I put them in all of the places you recommended and it still can't find the images. I can't understand the crash report. Thanks in advance.
Mods loaded: 2
ModLoader 1.2.5
mod_MoreMobs 1.2.5
Minecraft has crashed!
----------------------
Minecraft has stopped running because it encountered a problem.
--- BEGIN ERROR REPORT a50b6dea --------
Generated 4/20/12 8:46 PM
Minecraft: Minecraft 1.2.5
OS: Windows XP (x86) version 5.1
Java: 1.7.0_02, Oracle Corporation
VM: Java HotSpotâ„¢ Client VM (mixed mode), Oracle Corporation
LWJGL: 2.4.2
OpenGL: Intel 845G version 1.3.0 - Build 4.14.10.4342, Intel
java.lang.RuntimeException: java.lang.Exception: Image not found: /mods/RiceGrain.png
at net.minecraft.src.ModLoader.registerAllTextureOverrides(ModLoader.java:1451)
at net.minecraft.src.ModLoader.onTick(ModLoader.java:1104)
at net.minecraft.src.EntityRendererProxy.updateCameraAndRender(EntityRendererProxy.java:21)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:922)
at net.minecraft.client.Minecraft.run(Minecraft.java:801)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.Exception: Image not found: /mods/RiceGrain.png
at net.minecraft.src.ModLoader.loadImage(ModLoader.java:1024)
at net.minecraft.src.ModLoader.registerAllTextureOverrides(ModLoader.java:1443)
... 5 more
--- END ERROR REPORT e0cfa974 ----------
I have never modded or scripted in my life until I found your tutorials. I have found them very helpful and detailed. Using eclipse and your tutorials, I made six mobs and three items, all of which are foods.The mod works, until it says that it can't find the images. I put them in all of the places you recommended and it still can't find the images. I can't understand the crash report. Thanks in advance.
Mods loaded: 2
ModLoader 1.2.5
mod_MoreMobs 1.2.5
Minecraft has crashed!
----------------------
Minecraft has stopped running because it encountered a problem.
--- BEGIN ERROR REPORT a50b6dea --------
Generated 4/20/12 8:46 PM
Minecraft: Minecraft 1.2.5
OS: Windows XP (x86) version 5.1
Java: 1.7.0_02, Oracle Corporation
VM: Java HotSpotâ„¢ Client VM (mixed mode), Oracle Corporation
LWJGL: 2.4.2
OpenGL: Intel 845G version 1.3.0 - Build 4.14.10.4342, Intel
java.lang.RuntimeException: java.lang.Exception: Image not found: /mods/RiceGrain.png
at net.minecraft.src.ModLoader.registerAllTextureOverrides(ModLoader.java:1451)
at net.minecraft.src.ModLoader.onTick(ModLoader.java:1104)
at net.minecraft.src.EntityRendererProxy.updateCameraAndRender(EntityRendererProxy.java:21)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:922)
at net.minecraft.client.Minecraft.run(Minecraft.java:801)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.Exception: Image not found: /mods/RiceGrain.png
at net.minecraft.src.ModLoader.loadImage(ModLoader.java:1024)
at net.minecraft.src.ModLoader.registerAllTextureOverrides(ModLoader.java:1443)
... 5 more
--- END ERROR REPORT e0cfa974 ----------
The game can't find the textures, you need to put the exact path and names, case-sensitive.
How do I compile my .java files? the javadoc isn't recognising the javac command.
go into command line or whatever the equivalent is. Now put "cd " (notice the space) now drag the mcp folder into the window and press enter. Now you put "bash recompile.sh" and if there aren't any errors, move on. so now you type in "bash reobfuscate.sh" and it will place the modified classes in the reobf folder.
go into command line or whatever the equivalent is. Now put "cd " (notice the space) now drag the mcp folder into the window and press enter. Now you put "bash recompile.sh" and if there aren't any errors, move on. so now you type in "bash reobfuscate.sh" and it will place the modified classes in the reobf folder.
MCP?! who said I was using mcp? all it's done is get in the way. eclipse already compiled some of my files, so I know the coder pack can't be the only way.
MCP is what makes your .java files .class files :l It's what let's you look at all the Minecraft files, it's what neatly makes your crap work. It DOES NOT get in the way,..
Rollback Post to RevisionRollBack
My old signature was stupid and outdated. It's gone now.
To post a comment, please login or register a new account.
I do not believe it is possible.
In your minecraft.jar.
A better answer would be, is wherever you told the code to look for it. As in, the image pathway that you put into the files.
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumThe reason that you couldn't just change then to be like the creeper code is because creepers only spawn at night, but this is an example of the EntityNoSun file, you can compare it to EntityMob to see the difference:
package net.minecraft.src; import java.util.Random; public abstract class EntityMopirate extends EntityCreature implements IMob { /** How much damage this mob's attacks deal */ protected int attackStrength; public EntityMopirate(World par1World) { super(par1World); attackStrength = 2; experienceValue = 5; } /** * 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() { float f = getBrightness(1.0F); if (f > 0.5F) { entityAge += 2; } super.onLivingUpdate(); } /** * Called to update the entity's position/logic. */ public void onUpdate() { super.onUpdate(); if (!worldObj.isRemote && worldObj.difficultySetting == 0) { setDead(); } } /** * Finds the closest player within 16 blocks to attack, or null if this Entity isn't interested in attacking * (Animals, Spiders at day, peaceful PigZombies). */ protected Entity findPlayerToAttack() { EntityPlayer entityplayer = worldObj.getClosestVulnerablePlayerToEntity(this, 32D); if (entityplayer != null && canEntityBeSeen(entityplayer)) { return entityplayer; } else { return null; } } /** * Called when the entity is attacked. */ public boolean attackEntityFrom(DamageSource par1DamageSource, int par2) { if (super.attackEntityFrom(par1DamageSource, par2)) { Entity entity = par1DamageSource.getEntity(); if (riddenByEntity == entity || ridingEntity == entity) { return true; } if (entity != this) { entityToAttack = entity; } return true; } else { return false; } } public boolean attackEntityAsMob(Entity par1Entity) { int i = attackStrength; if (isPotionActive(Potion.damageBoost)) { i += 3 << getActivePotionEffect(Potion.damageBoost).getAmplifier(); } if (isPotionActive(Potion.weakness)) { i -= 2 << getActivePotionEffect(Potion.weakness).getAmplifier(); } return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), i); } /** * Basic mob attack. Default to touch of death in EntityCreature. Overridden by each mob to define their attack. */ protected void attackEntity(Entity par1Entity, float par2) { if (attackTime <= 0 && par2 < 2.0F && par1Entity.boundingBox.maxY > boundingBox.minY && par1Entity.boundingBox.minY < boundingBox.maxY) { attackTime = 20; attackEntityAsMob(par1Entity); } } public void jump() { motionY = 0.51999998688697815D; if (isPotionActive(Potion.jump)) { motionY += (float)(getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1F; } if (isSprinting()) { float f = rotationYaw * 0.01745329F; motionX -= MathHelper.sin(f) * 0.2F; motionZ += MathHelper.cos(f) * 0.2F; } isAirBorne = true; } public boolean isOnLadder() { int i = MathHelper.floor_double(posX); int j = MathHelper.floor_double(boundingBox.minY); int k = MathHelper.floor_double(posZ); int l = worldObj.getBlockId(i, j, k); return l == Block.ladder.blockID || l == Block.vine.blockID; } /** * (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); } /** * Checks if the entity's current position is a valid location to spawn this entity. */ public boolean getCanSpawnHere() { return true; } }Well, see if you somehow did merge it, then you'd have to take the time to look through THAT file. Also, no. there is no way to do that.
Thank you! But
Use the method ModLoader.addShapelessRecipe.
Can you give me an example because I all ready tried, and couldn't figure it out.
ModLoader.AddShapelessRecipe(new ItemStack(Item.pickaxeDiamond), new Object[] { /*ingredients*/ Item.stick, Block.sand });
That is an example. Of course, you would replace Item.pickaxeDiamond with the thing you want to make, and the things in the ingredients section with what the actual ingredients are. You can have up to nine, each separated with commas.
Ok, Thank you very much!!!
A reputation point would be nice please. :-)
I have never modded or scripted in my life until I found your tutorials. I have found them very helpful and detailed. Using eclipse and your tutorials, I made six mobs and three items, all of which are foods.The mod works, until it says that it can't find the images. I put them in all of the places you recommended and it still can't find the images. I can't understand the crash report. Thanks in advance.
Mods loaded: 2
ModLoader 1.2.5
mod_MoreMobs 1.2.5
Minecraft has crashed!
----------------------
Minecraft has stopped running because it encountered a problem.
--- BEGIN ERROR REPORT a50b6dea --------
Generated 4/20/12 8:46 PM
Minecraft: Minecraft 1.2.5
OS: Windows XP (x86) version 5.1
Java: 1.7.0_02, Oracle Corporation
VM: Java HotSpotâ„¢ Client VM (mixed mode), Oracle Corporation
LWJGL: 2.4.2
OpenGL: Intel 845G version 1.3.0 - Build 4.14.10.4342, Intel
java.lang.RuntimeException: java.lang.Exception: Image not found: /mods/RiceGrain.png
at net.minecraft.src.ModLoader.registerAllTextureOverrides(ModLoader.java:1451)
at net.minecraft.src.ModLoader.onTick(ModLoader.java:1104)
at net.minecraft.src.EntityRendererProxy.updateCameraAndRender(EntityRendererProxy.java:21)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:922)
at net.minecraft.client.Minecraft.run(Minecraft.java:801)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.Exception: Image not found: /mods/RiceGrain.png
at net.minecraft.src.ModLoader.loadImage(ModLoader.java:1024)
at net.minecraft.src.ModLoader.registerAllTextureOverrides(ModLoader.java:1443)
... 5 more
--- END ERROR REPORT e0cfa974 ----------
Soaring in Hoenn
The game can't find the textures, you need to put the exact path and names, case-sensitive.
go into command line or whatever the equivalent is. Now put "cd " (notice the space) now drag the mcp folder into the window and press enter. Now you put "bash recompile.sh" and if there aren't any errors, move on. so now you type in "bash reobfuscate.sh" and it will place the modified classes in the reobf folder.
I just made that kind of mod (not exactly)
k, i gave you some rep
MCP?! who said I was using mcp? all it's done is get in the way. eclipse already compiled some of my files, so I know the coder pack can't be the only way.
Soaring in Hoenn