Posted August 29, 201312 yr //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
August 29, 201312 yr Author 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
August 29, 201312 yr Check how vanilla mob spawners work? If you guys dont get it.. then well ya.. try harder...
August 29, 201312 yr Two things: timer--; worldObj.spawnEntityInWorld(ent); Author of PneumaticCraft, MineChess, Minesweeper Mod and Sokoban Mod. Visit www.minemaarten.com to take a look at them.
August 29, 201312 yr Author Two things: timer--; worldObj.spawnEntityInWorld(ent); 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.
August 29, 201312 yr spawnEntityInWorld() works for sure! In Mobspawners this is also used, although I must say the Mobspawner code got more complicated after they added custom entity spawning. On line 140 of the MobspawnerBaseLogic class the obfuscated func_98265_a() gets a call. In there the entity gets spawned at line 217 with getSpawnerWorld().spawnEntityInWorld(par1Entity). Can you show your code which proved to you it didn't work? Author of PneumaticCraft, MineChess, Minesweeper Mod and Sokoban Mod. Visit www.minemaarten.com to take a look at them.
August 29, 201312 yr Author 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
August 29, 201312 yr The World and World.getWorldInfo should be helpful here If you guys dont get it.. then well ya.. try harder...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.