HalestormXV Posted August 29, 2015 Posted August 29, 2015 Alright so I have seen the pure power of the listeners and decided to try and dive into them. I created two listeners and I already know they are TERRIBLY inefficient. I am watching my log and am seeing that the server is running way far behind. I know it is my own fault and I expect and that is why I am posting here. Perhaps someone can guide me in the right direction/ help me optimize this. As it stands now these listerners seem to actually work which I was quite shocked by since it was the first time I attempted to work with a listener. Here are the two listeners: Dimension Listener - This listener is meant to inflict damage on a player every 4 seconds if they are no wearing the correct set of armor http://pastebin.com/FwxrBGMk Vanilla Spawn Disable - This listener is mean to cancel the spawning of all vanilla mobs and leave room only for my custom mobs/animals public class SpawnListener { @SubscribeEvent public void onEntitySpawn(EntityJoinWorldEvent event) { if (event.entity.dimension == DimensionIDs.LIGHTFORESTDIMENSION) { if(event.entity instanceof EntitySkeleton || event.entity instanceof EntityZombie || event.entity instanceof EntitySpider || event.entity instanceof EntitySheep || event.entity instanceof EntityChicken || event.entity instanceof EntitySquid || event.entity instanceof EntityCow || event.entity instanceof EntityPig || event.entity instanceof EntityEnderman) { event.setCanceled(true); } } } } They are registered in my main mod file here: @EventHandler public static void Load(FMLInitializationEvent event) { GameRegistry.registerFuelHandler(new FuelHandler()); GameRegistry.registerTileEntity(TileEntityCelestialFurnace.class, "Celestial Furnace"); NetworkRegistry.INSTANCE.registerGuiHandler(modInstance, new CCGuiHandler()); MinecraftForge.EVENT_BUS.register(new SpawnListener()); MinecraftForge.EVENT_BUS.register(new CelestialDimListener()); //#################ENTITY HANDELRS#########################\\ EntityHandler.registerMonster(EntityCyclops.class, "Cyclops"); EntityHandler.registerMonster(EntityLunarSpirit.class, "LunarSpirit"); EntityHandler.registerMonster(EntityCultist.class, "CC_Cultist"); EntityHandler.registerMonster(EntityFallenAngel.class, "FallenAngel"); EntityHandler.registerSummon(EntityAries.class, "Aries"); EntityHandler.registerItemEntity(EntityGrenade.class, "dimGrenade"); Any words of advise on how to change these or better yet get rid of them in favor of something more efficient and better? Thanks in advanced. Quote
Failender Posted August 29, 2015 Posted August 29, 2015 why are you using listener if it is ur own dimension? If u dont want entities to spawn there remove them from the spawn list? Quote
HalestormXV Posted August 29, 2015 Author Posted August 29, 2015 why are you using listener if it is ur own dimension? If u dont want entities to spawn there remove them from the spawn list? Well to be quite honest I am a noob and litereally just learning how to work with dimensions and listeners and didn't realize that I could remove them from my dimension or know how to do it lol. Because I thought if I removed them from the spawn list that it would remove my custom entities also. (Since they too spawn in the overworld biome types like .forest and .desert, etc. etc.) Tips on how to accomplish it? Is it done in the custom biome code? Quote
Recommended Posts
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.