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

Hi guys, I know you don't like handholding people, but I've been working on a mod for a long time that features more dynamic AI "factions" and seeks to increase the difficulty of the game. One of the simplest methods it does so is by dramatically increasing the aggro range of mobs, which is tons of fun when it comes to zombies but may create frustration when it comes to skeletons due to their firerate and knockback.

 

I attempted to reduce their knockback and firing rate to no avail whatsoever, unable to find code that lets me do so. After this, I attempted to reduce their spawnrate but couldn't find an "official" way to do that either, so I made my own makeshift event handler function to do something similar:

 

	 @SubscribeEvent
 public void onEntitySpawn(EntityJoinWorldEvent event)
 {


  if (event.entity instanceof EntityZombie) updateZombieAI((EntityZombie) event.entity, event);
  if (event.entity instanceof EntityGhast) updateGhastAI((EntityGhast) event.entity, event);
  if (event.entity instanceof EntitySkeleton){
		 Random rand = new Random();
		 int  n = rand.nextInt(4) + 1;
	  World world = DimensionManager.getWorld(0);
	  if (n != 1  && (world.getClosestPlayer((double)event.entity.posX + 0.5D, (double)event.entity.posY + 0.5D, (double)event.entity.posZ + 0.5D, 60) == null)){
		 	event.setResult(Result.DENY);
		}
	  else {
	  updateSkeleAI((EntitySkeleton) event.entity, event);
	  }
  }

 

Unfortunately, while this bootleg works perfectly on clientside and singleplayer testing, I discovered that it causes players to crash when they join a dedicated server. This is the error received in the client console.

 

This segment:

 

java.lang.NullPointerException: Ticking screen
    at ladyremilia.arcl.EventHandlerCommon.onEntitySpawn(EventHandlerCommon.java:140)

 

Refers to this particular line of code in my eventhandler:

 

		  if (n != 1  && (world.getClosestPlayer((double)event.entity.posX + 0.5D, (double)event.entity.posY + 0.5D, (double)event.entity.posZ + 0.5D, 60) == null)){

 

Is there any way I can fix this, or better yet, override BiomeGenBase's vanilla entity spawn rates?

 

I apologise if this is a question with a stupidly easy answer.

 

Edit: Forgot to mention. The server doesn't really report anything, just that the connection was "forcibly closed by the remote host".

Guest
This topic is now closed to further replies.

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.