i have come to a desition that i would like to give my superhero mod to techGuy. I really think it is the best for the mod you are a better coder that me if you choose to take on the mod you must alwas mention my name on the paige just by simpile saying original creater of this mod kickassmike or somthing like that. Thats only if you choose to take it on
I've been using your tutorials, and they've helped so much. They're great, thanks for making them.
I've run into a little problem, though. I am making, well updating, a mod of mine called Boss Mobs: Yeti. It adds Bosses to Minecraft, this particular part of the series adding the Yeti.
Well, everything was fine before, aside from some bugs, which is which this update was for. In the original, everything seemed to be spawning in the desert instead of the snow biomes I designated them to, and there were more than I had planned spawned in one area. So with this new version, I fixed that by copying some code from the Ghast so that it checks the biome and makes sure there is only one.
Now that everything is changed, I ran it from Eclipse and everything was perfect. As soon as I reob and try in actual Minecraft, though, nothing spawns at all, nor can I spawn it with SPC, even in proper snow biomes.
Here is the code that I use.
mod_Yeti
package net.minecraft.src;
import java.util.Map;
public class mod_Yeti extends BaseMod
{
public void load()
{
ModLoader.registerEntityID(EntityYeti.class, "Yeti", ModLoader.getUniqueEntityId());
ModLoader.addSpawn(EntityYeti.class, 1, 1, 1, EnumCreatureType.creature);
ModLoader.registerEntityID(EntityHunter.class, "Hunter", ModLoader.getUniqueEntityId());
ModLoader.addSpawn(EntityHunter.class, 3, 3, 6, EnumCreatureType.creature);
}
public void addRenderer(Map map)
{
//Render and Model
map.put(EntityYeti.class, new RenderBiped(new ModelBiped(), 0.5F));
map.put(EntityHunter.class, new RenderBiped(new ModelBiped(), 0.5F));
//Spawning
ModLoader.addSpawn(EntityYeti.class, 2, 1, 4, EnumCreatureType.monster, new BiomeGenBase[]
{
BiomeGenBase.taiga,
BiomeGenBase.frozenOcean,
BiomeGenBase.frozenRiver,
BiomeGenBase.iceMountains,
BiomeGenBase.icePlains,
BiomeGenBase.taigaHills
});
ModLoader.addSpawn(EntityHunter.class, 2, 1, 4, EnumCreatureType.monster, new BiomeGenBase[]
{
BiomeGenBase.taiga,
BiomeGenBase.frozenOcean,
BiomeGenBase.frozenRiver,
BiomeGenBase.iceMountains,
BiomeGenBase.icePlains,
BiomeGenBase.taigaHills
});
}
public String getVersion()
{
return "1.2.5";
}
}
EntityYeti
package net.minecraft.src;
import java.util.Random;
public class EntityYeti extends EntityMob
{
public EntityYeti(World world)
{
super(world);
texture = "/yeti.png";
moveSpeed = 0.5F;
targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, net.minecraft.src.EntityPlayer.class, 16F, 0, true));
targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, net.minecraft.src.EntityHunter.class, 16F, 0, true));
attackStrength = 10; //take this line out if this class doesn't extend EntityMob.
}
public int getMaxHealth()
{
return 25;
}
protected String getLivingSound()
{
return "mob.zombie";
}
protected String getHurtSound()
{
return "mob.zombiehurt";
}
protected String getDeathSound()
{
return "mob.zombiedeath";
}
/**
* Returns the item ID for the item the mob drops on death.
*/
protected int getDropItemId()
{
return Block.ice.blockID;
}
/**
* 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(Block.ice.blockID, 1);
}
i = rand.nextInt(3) + 1 + rand.nextInt(1 + par2);
for (int k = 0; k < i; k++)
{
if (isBurning())
{
dropItem(Item.diamond.shiftedIndex, 1);
}
else
{
dropItem(Item.snowball.shiftedIndex, 4);
}
}
}
protected boolean canDespawn()
{
return false;
}
/**
* Checks if the entity's current position is a valid location to spawn this entity.
*/
public boolean getCanSpawnHere()
{
return rand.nextInt(20) == 0 && super.getCanSpawnHere() && worldObj.difficultySetting > 0;
}
/**
* Will return how many at most can spawn in a chunk at once.
*/
public int getMaxSpawnedInChunk()
{
return 1;
}
}
I also added a new mob to it, Hunters. They are supposed to attack the Yetis, and the Yetis are supposed to attack them. But they don't, not even in eclipse.
EntityHunter
package net.minecraft.src;
import java.util.Random;
public class EntityHunter extends EntityMob
{
public EntityHunter(World world)
{
super(world);
texture = "/hunter.png";
moveSpeed = 0.5F;
targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, net.minecraft.src.EntityYeti.class, 16F, 0, true));
attackStrength = 4; //take this line out if this class doesn't extend EntityMob.
}
public int getMaxHealth()
{
return 20;
}
protected String getLivingSound()
{
return "mob.villager.default";
}
protected String getHurtSound()
{
return "mob.villager.defaulthurt";
}
protected String getDeathSound()
{
return "mob.villager.defaultdeath";
}
protected int getDropItemId()
{
return Item.ingotGold.shiftedIndex;
}
protected boolean canDespawn()
{
return false;
}
public ItemStack getHeldItem()
{
return defaultHeldItem;
}
static
{
defaultHeldItem = new ItemStack(Item.swordStone, 1);
}
private static final ItemStack defaultHeldItem;
/**
* Checks if the entity's current position is a valid location to spawn this entity.
*/
public boolean getCanSpawnHere()
{
return rand.nextInt(20) == 0 && super.getCanSpawnHere() && worldObj.difficultySetting > 0;
}
}
Yes, this was directed to the creator of these tutorials, but if you know the problem and can respond before him (ASAP), please go ahead, this has been frustrating me for hours.
Thanks,
Jesuitical.
Are you playing on peaceful? If you are then neither mob will spawn because of this:
ok i have a problem that i need answered right away. i have the mod coded right but it keeps crashing because it cant load the image and i coded it like the code on the tutorial. here is my code.
package net.minecraft.src;
public class mod_ObsidianApple extends BaseMod
{
public static final Item obsidianapple = new ItemFood(124, 20, 60F, true).setItemName("Obsidian Apple");
public void load()
{
obsidianapple.iconIndex = ModLoader.addOverride("/gui/items.png", "/mcp/eclipse/Client/bin/obsidianapple.png");
ModLoader.addName(obsidianapple, "Obsidian Apple");
ModLoader.addRecipe(new ItemStack(obsidianapple, 1), new Object [] {"@@@", "@#@", "@@@", Character.valueOf('#'), Item.appleRed, Character.valueOf('@'), Block.obsidian});
}
public String getVersion()
{
return "1.2.5";
}
}
mcp/eclipse/Client/bin is the default folder for images, so you make a path from that location. If you have your image in that directory, then your code just needs to say:
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
Also, could you tell me why they won't attack each other and why sometime the mod bugs and they only spawn in deserts. If not, that's fine.
Does it attack the player successfully?
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, net.minecraft.src.EntityHunter.class, 16F, 0, true));
If they spawn in a group then there may be a bug with the game.
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
The Hunter mobs spawn in the snow areas like they are supposed to, but also a lot in the desert. Yeti flat out only spawns in the desert.
You have all of your biome specific spawning code in the addRenderer method. You need to move it into the load() method.
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
hello techguy, i have followed your tut on making an achievement but i want people to get the achievement when they collect redstone. just like when you mine diamond ore, pick up diamonds and get the achivement. How do i do that?
hello techguy, i have followed your tut on making an achievement but i want people to get the achievement when they collect redstone. just like when you mine diamond ore, pick up diamonds and get the achivement. How do i do that?
You can use ModLoader's onItemPickup method. I'm not sure how you can get it to identify what item it is though. I tried it once, but never got it working.
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
Are you playing on peaceful? If you are then neither mob will spawn because of this:
worldObj.difficultySetting > 0
mcp/eclipse/Client/bin is the default folder for images, so you make a path from that location. If you have your image in that directory, then your code just needs to say:
Minecraft has stopped running because it encountered a problem.
--- BEGIN ERROR REPORT bfeee903 --------
Generated 4/7/12 9:17 AM
Minecraft: Minecraft 1.2.5
OS: Windows 7 (amd64) version 6.1
Java: 1.7.0_03, Oracle Corporation
VM: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
LWJGL: 2.4.2
OpenGL: AMD Radeon HD 6310 Graphics version 4.1.10834 Compatibility Profile Context, ATI Technologies Inc.
java.lang.RuntimeException: java.lang.Exception: Image not found: /obsidianapple.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: /obsidianapple.png
at net.minecraft.src.ModLoader.loadImage(ModLoader.java:1024)
at net.minecraft.src.ModLoader.registerAllTextureOverrides(ModLoader.java:1443)
... 5 more
--- END ERROR REPORT d8860383 ----------
The second line is the one that has the error, Here is the code:
package net.minecraft.src;
import java.util.List;
import java.util.Random;
public class EntityArab extends EntityZombie
{
/** Above zero if this PigZombie is Angry. */
private int angerLevel;
/** A random delay until this PigZombie next makes a sound. */
private int randomSoundDelay;
/** The ItemStack that any PigZombie holds (a gold sword, in fact). */
private static final ItemStack defaultHeldItem;
public EntityArab(World par1World)
{
super(par1World);
angerLevel = 0;
randomSoundDelay = 0;
texture = "/Arabs/Arab.png";
moveSpeed = 0.5F;
attackStrength = 5;
isImmuneToFire = false;
}
/**
* Returns true if the newer Entity AI code should be run
*/
protected boolean isAIEnabled()
{
return false;
}
/**
* Called to update the entity's position/logic.
*/
public void onUpdate()
{
moveSpeed = entityToAttack == null ? 0.5F : 0.95F;
if (randomSoundDelay > 0 && --randomSoundDelay == 0)
{
worldObj.playSoundAtEntity(this, "mob.villager.defaulthurt", getSoundVolume() * 2.0F, ((rand.nextFloat() - rand.nextFloat()) * 0.2F + 1.0F) * 1.8F);
}
super.onUpdate();
}
/**
* Checks if the entity's current position is a valid location to spawn this entity.
*/
public boolean getCanSpawnHere()
{
return worldObj.difficultySetting > 0 && worldObj.checkIfAABBIsClear(boundingBox) && worldObj.getCollidingBoundingBoxes(this, boundingBox).size() == 0 && !worldObj.isAnyLiquid(boundingBox);
}
/**
* (abstract) Protected helper method to write subclass entity data to NBT.
*/
public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
{
super.writeEntityToNBT(par1NBTTagCompound);
par1NBTTagCompound.setShort("Anger", (short)angerLevel);
}
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
{
super.readEntityFromNBT(par1NBTTagCompound);
angerLevel = par1NBTTagCompound.getShort("Anger");
}
/**
* 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()
{
if (angerLevel == 0)
{
return null;
}
else
{
return super.findPlayerToAttack();
}
}
/**
* 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();
}
/**
* Called when the entity is attacked.
*/
public boolean attackEntityFrom(DamageSource par1DamageSource, int par2)
{
Entity entity = par1DamageSource.getEntity();
if (entity instanceof EntityPlayer)
{
List list = worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox.expand(32D, 32D, 32D));
for (int i = 0; i < list.size(); i++)
{
Entity entity1 = (Entity)list.get(i);
if (entity1 instanceof EntityPigZombie)
{
EntityPigZombie Entitypigzombie = (EntityPigZombie)entity1;
entitypigzombie.becomeAngryAt(entity);
}
}
becomeAngryAt(entity);
}
return super.attackEntityFrom(par1DamageSource, par2);
}
/**
* Causes this PigZombie to become angry at the supplied Entity (which will be a player).
*/
private void becomeAngryAt(Entity par1Entity)
{
entityToAttack = par1Entity;
angerLevel = 400 + rand.nextInt(400);
randomSoundDelay = rand.nextInt(40);
}
/**
* Returns the sound this mob makes while it's alive.
*/
protected String getLivingSound()
{
return "mob.villager.default";
}
/**
* Returns the sound this mob makes when it is hurt.
*/
protected String getHurtSound()
{
return "mob.mob.villager.defaulthurt";
}
/**
* Returns the sound this mob makes on death.
*/
protected String getDeathSound()
{
return "mob.villager.defaultdeath";
}
/**
* Returns the item ID for the item the mob drops on death.
*/
protected int getDropItemId()
{
return Item.swordSteel.shiftedIndex;
}
/**
* Returns the item that this EntityLiving is holding, if any.
*/
public ItemStack getHeldItem()
{
return defaultHeldItem;
}
static
{
defaultHeldItem = new ItemStack(Item.SwordSteel, 1);
}
}
how can I get a pig to drop their pork raw or cooked when burning AND drop my bacon items the same way, so basically, make them drop bacon and pork cooked or raw depending if they died burning? btw the bacon item was made with modloader
how can I get a pig to drop their pork raw or cooked when burning AND drop my bacon items the same way, so basically, make them drop bacon and pork cooked or raw depending if they died burning? btw the bacon item was made with modloader
If you look at this chunk of code:
protected int getDropItemId()
{
if (isBurning())
{
return Item.porkCooked.shiftedIndex;
}
else
{
return Item.porkRaw.shiftedIndex;
}
}
(That is from entity pig) you can see the "if (isBurning())" line followed by "return Item.porkCooked.shiftedIndex;" I think you can just put your bacon right under that... I think
Hey techguy, I have another problem ..
I tried your World Gen tutorial, And I couldn't seem to be able to make a 5x5 Wool house.. How do I Make one?
My code:
package net.minecraft.src;
import java.util.Random;
public class WorldGenArabHouse extends WorldGenerator
{
public WorldGenArabHouse()
{
}
public boolean generate(World world, Random desert, int i, int j, int k)
{
int cloth = Block.cloth.blockID;
world.setBlockWithNotify(i, j, k, cloth);
world.setBlockAndMetadataWithNotify(i, j + 1, k, cloth, 1);
int cloth1 = Block.cloth.blockID;
world.setBlockWithNotify(i, j, k, cloth);
world.setBlockAndMetadataWithNotify(i, j + 1, k, cloth, 2);
int cloth2 = Block.cloth.blockID;
world.setBlockWithNotify(i, j, k, cloth);
world.setBlockAndMetadataWithNotify(i, j + 1, k, cloth, 3);
int cloth3 = Block.cloth.blockID;
world.setBlockWithNotify(i, j, k, cloth);
world.setBlockAndMetadataWithNotify(i, j + 1, k, cloth, 4);
int cloth4 = Block.cloth.blockID;
world.setBlockWithNotify(i, j, k, cloth);
world.setBlockAndMetadataWithNotify(i, j + 1, k, cloth, 5);
return true;
}
}
Please help, I'm not sure how to make it.. and How do I make my mob spawn IN the house? (Or next to it)
just put in one "int =" and you don't need the: "world.setBlockWithNotify(i, j, k, cloth);" eather (just the ones with metadata), and you need to change the (i, j, k,)'s with some + or - as that is were the block will spawn. example of code:
package net.minecraft.src;
import java.util.Random;
public class WorldGenArabHouse extends WorldGenerator
{
public WorldGenArabHouse()
{
}
public boolean generate(World world, Random desert, int i, int j, int k)
{
int cloth = Block.cloth.blockID;
world.setBlockAndMetadataWithNotify(i, j, k, cloth, 1);
world.setBlockAndMetadataWithNotify(i, j, k +1, cloth, 1);
world.setBlockAndMetadataWithNotify(i, j, k +2, cloth, 3);
world.setBlockAndMetadataWithNotify(i, j, k +3, cloth, 4);
world.setBlockAndMetadataWithNotify(i, j, k +4, cloth, 5);
return true;
}
}
and that should give you a line of different colored wool
protected int getDropItemId()
{
if (isBurning())
{
return Item.porkCooked.shiftedIndex;
}
else
{
return Item.porkRaw.shiftedIndex;
}
}
(That is from entity pig) you can see the "if (isBurning())" line followed by "return Item.porkCooked.shiftedIndex;" I think you can just put your bacon right under that... I think
just put in one "int =" and you don't need the: "world.setBlockWithNotify(i, j, k, cloth);" eather (just the ones with metadata), and you need to change the (i, j, k,)'s with some + or - as that is were the block will spawn. example of code:
package net.minecraft.src;
import java.util.Random;
public class WorldGenArabHouse extends WorldGenerator
{
public WorldGenArabHouse()
{
}
public boolean generate(World world, Random desert, int i, int j, int k)
{
int cloth = Block.cloth.blockID;
world.setBlockAndMetadataWithNotify(i, j, k, cloth, 1);
world.setBlockAndMetadataWithNotify(i, j, k +1, cloth, 1);
world.setBlockAndMetadataWithNotify(i, j, k +2, cloth, 3);
world.setBlockAndMetadataWithNotify(i, j, k +3, cloth, 4);
world.setBlockAndMetadataWithNotify(i, j, k +4, cloth, 5);
return true;
}
}
and that should give you a line of different colored wool
Hey cool! Thanks !
But I have another problem.. I made my animal HUGE in techne, though it's Extremely tiny in-game..
Did you see what else I added in to the recipe I posted? I added what you needed to make that wool work.
Character.valueOf('#'), new ItemStack(Block.wool, 15)
I didn't actually. But "Block.wool" isn't the actual block name. It's "Block.cloth". I'm still having trouble with the dyes and stuff but I've kind of moved on.
I'm also on holiday right now, so my replies as you can see will be very late and my internet access is restricted. I'm still coding on a laptop though. It's just not as easy. But still, I managed to make another mod where you can craft compressed coal, then smelt it into diamond shards. Then craft 4 diamond shards to create 1 diamond or craft 9 diamond shards to create 3 diamonds. It works fine, and now I'm making an Iceland biome.
Are you playing on peaceful? If you are then neither mob will spawn because of this:
mcp/eclipse/Client/bin is the default folder for images, so you make a path from that location. If you have your image in that directory, then your code just needs to say:
together they are powerful beyond imagination."
I really hope that was the problem. Thank you
Also, could you tell me why they won't attack each other and why sometime the mod bugs and they only spawn in deserts. If not, that's fine.
EDIT: It was on peaceful, now I feel like an idiot Thank you!
Does it attack the player successfully?
together they are powerful beyond imagination."
They both attack the player, yes. The problem is that they won't attack each other.
Also, I tested it and they're still only spawning in huge groups in the desert.
If they spawn in a group then there may be a bug with the game.
together they are powerful beyond imagination."
Okay, I'll try.
The Hunter mobs spawn in the snow areas like they are supposed to, but also a lot in the desert. Yeti flat out only spawns in the desert.
You have all of your biome specific spawning code in the addRenderer method. You need to move it into the load() method.
together they are powerful beyond imagination."
Unless I misunderstood what you said, the problem still persists.
Your code looks like this:
but it needs to look like this:
Ignore the crappy indenting above ^^.
together they are powerful beyond imagination."
You can use ModLoader's onItemPickup method. I'm not sure how you can get it to identify what item it is though. I tried it once, but never got it working.
together they are powerful beyond imagination."
Mods loaded: 2
ModLoader 1.2.5
mod_ObsidianApple 1.2.5
Minecraft has crashed!
----------------------
Minecraft has stopped running because it encountered a problem.
--- BEGIN ERROR REPORT bfeee903 --------
Generated 4/7/12 9:17 AM
Minecraft: Minecraft 1.2.5
OS: Windows 7 (amd64) version 6.1
Java: 1.7.0_03, Oracle Corporation
VM: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
LWJGL: 2.4.2
OpenGL: AMD Radeon HD 6310 Graphics version 4.1.10834 Compatibility Profile Context, ATI Technologies Inc.
java.lang.RuntimeException: java.lang.Exception: Image not found: /obsidianapple.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: /obsidianapple.png
at net.minecraft.src.ModLoader.loadImage(ModLoader.java:1024)
at net.minecraft.src.ModLoader.registerAllTextureOverrides(ModLoader.java:1443)
... 5 more
--- END ERROR REPORT d8860383 ----------
The second line is the one that has the error, Here is the code:
Please help! :S
I tried your World Gen tutorial, And I couldn't seem to be able to make a 5x5 Wool house.. How do I Make one?
My code:
Please help, I'm not sure how to make it.. and How do I make my mob spawn IN the house? (Or next to it)
If you look at this chunk of code:
(That is from entity pig) you can see the "if (isBurning())" line followed by "return Item.porkCooked.shiftedIndex;" I think you can just put your bacon right under that... I think
just put in one "int =" and you don't need the: "world.setBlockWithNotify(i, j, k, cloth);" eather (just the ones with metadata), and you need to change the (i, j, k,)'s with some + or - as that is were the block will spawn. example of code:
Hey cool! Thanks !
But I have another problem.. I made my animal HUGE in techne, though it's Extremely tiny in-game..
How do I fix this?
RenderCamel:
mod_Camel:
Please help, If you need any thing else, tell me.
I didn't actually. But "Block.wool" isn't the actual block name. It's "Block.cloth". I'm still having trouble with the dyes and stuff but I've kind of moved on.
I'm also on holiday right now, so my replies as you can see will be very late and my internet access is restricted. I'm still coding on a laptop though. It's just not as easy. But still, I managed to make another mod where you can craft compressed coal, then smelt it into diamond shards. Then craft 4 diamond shards to create 1 diamond or craft 9 diamond shards to create 3 diamonds. It works fine, and now I'm making an Iceland biome.
But thanks for all you help. It's been great!