Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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.

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?

  • Author

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?

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.