# Thornack

Members

624

2. ## Despawning a mob after an elapsed period of time?? How would you do it?

Would anyone know any functions built into the Forge API which control when a mob despawns in minecraft? (the function that causes night mobs to despawn during the day etc..) I have a bunch of custom mobs and am attempting to figure out how to have the mobs spawn for a specific amount of world time, where after the allotted world time has passed use some sort of if then statement to access a function which would cause the mobs to despawn from the world. Any ideas?
3. ## Probability affected by an external value java logic problem

Hi, I have a mob coded in and want to give it a stat called obedience. It would have a value that is affected by how you treat your mob (example give it an apple increases obedience by 1, hitting your mob decreases its obedience by its loss in health or whatever.) I want this stat to directly affect whether it will obey my command (im just trying the sit function that a wolf uses atm). So I wish to accomplish this by using a weighted probability and upon implementing the sit command activating the weighted probability which would return a value lets say 1% of the time that allows the sit function to be implemented (I know how to do this part mostly). But I want to affect the 1% chance of returning the desired value, directly using the value of the obedience stat. so the higher the stat would be the higher the chance of returning the desired value which would then allow for the mob to sit. Anyone have any ideas on how to do this logic wise in java.
4. ## How would I use a Tile Entity to spawn a mob on world tick?

I have figured it out and it was just me being stupid. The following worked public class TileEntitySpawn extends TileEntity { private int timer; public TileEntitySpawn(){ timer = 100; } @Override public void updateEntity() { if (timer == 0 && !worldObj.isRemote) { timespawner(worldObj, xCoord +1, yCoord +2, zCoord +1, null); timer = 100; } timer--; } public static void timespawner(World par1World, int i, int j, int k, Entity par5Entity) { EntityCustomMob CustomMob = new EntityCustomMob(par1World); CustomMob.setLocationAndAngles(i, j, k, 0.0F, 0.0F); par1World.spawnEntityInWorld(CustomMob); } } I do have another question though, which function would I use to synchronize my timer with the world time
5. ## How would I use a Tile Entity to spawn a mob on world tick?

I know about the timer--; part and I have gotten the timer to work properly and count down (if you use ++ it counts up) for example. My issue is using this to call up a method to spawn my mob. timer--; I have found that worldObj.spawnEntityInWorld(ent); doesnt seem to work, and Im not sure why. Ive been trying to figure out how vanilla spawner work with no success yet. I havent been able to find the function that defines which mob spawns or the function that actually spawns them. Ive found the functions that define the spawn delay and radius but im stuck on this one.
6. ## How would I use a Tile Entity to spawn a mob on world tick?

I have a bunch of mobs that spawn correctly using spawn eggs but I dont know how to use the tile entity in place of the spawn egg
7. ## How would I use a Tile Entity to spawn a mob on world tick?

//How would I use a Tile Entity to spawn one of my custom mobs after x amount of ticks? //I have a block class called spawn.java that extends BlockContainer and a tile entity functionality added to it. public class TileEntitySpawn extends TileEntity [ private int timer; public TileEntitySpawn(){ timer = 100; } @Override public void updateEntity() { if timer ==0 && !worldObj.isRemote){ } } } //I wish to use public void onEntityWalking(World par1World, int i, int j, int k, Entity par5Entity {} //I know you have to use EntityLiving ent = (EntityLiving)EntityList.createEntityByName("",par1World) ent.setLocationAndAngles(i, j+1, k, 0F, 0F); // but im not sure how to actually get it to spawn this is where I got stuck. Any help would be appreciated. I kind of want to make a custom mob spawner for 1.5.2 but with the walk on functionality added
×

• #### Activity

×
• Create New...