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.

Viola_Siemens

Members
  • Joined

  • Last visited

  1. Viola_Siemens changed their profile photo
  2. I will use Forge 47.1.0 for Minecraft 1.20.1 as the example (offical mappings channel). In MinecraftServer$createLevels, vanilla use the following code to add spawners for overworld: List<CustomSpawner> list = ImmutableList.of(new PhantomSpawner(), new PatrolSpawner(), new CatSpawner(), new VillageSiege(), new WanderingTraderSpawner(serverleveldata)); I think it useful to post an event here to add spawners for overworld, and other dimensions. For example: List<CustomSpawner> list = ImmutableList.of(new PhantomSpawner(), new PatrolSpawner(), new CatSpawner(), new VillageSiege(), new WanderingTraderSpawner(serverleveldata)); //change begin AddCustomSpawnersEvent event = new AddCustomSpawnersEvent(ImmutableList.<CustomSpawner>builder().addAll(list), LevelStem.OVERWORLD); MinecraftForge.EVENT_BUS.post(event); LevelStem levelstem = registry.get(LevelStem.OVERWORLD); ServerLevel serverlevel = new ServerLevel(this, this.executor, this.storageSource, serverleveldata, Level.OVERWORLD, levelstem, p_129816_, flag, j, event.getCustomSpawnerBuilder().build(), true, (RandomSequences)null); //change end //... for(Map.Entry<ResourceKey<LevelStem>, LevelStem> entry : registry.entrySet()) { ResourceKey<LevelStem> resourcekey = entry.getKey(); if (resourcekey != LevelStem.OVERWORLD) { ResourceKey<Level> resourcekey1 = ResourceKey.create(Registries.DIMENSION, resourcekey.location()); DerivedLevelData derivedleveldata = new DerivedLevelData(this.worldData, serverleveldata); //change begin AddCustomSpawnersEvent event = new AddCustomSpawnersEvent(ImmutableList.<CustomSpawner>builder(), resourcekey); MinecraftForge.EVENT_BUS.post(event); ServerLevel serverlevel1 = new ServerLevel(this, this.executor, this.storageSource, derivedleveldata, resourcekey1, entry.getValue(), p_129816_, flag, j, event.getCustomSpawnerBuilder().build(), false, randomsequences); //change end worldborder.addListener(new BorderChangeListener.DelegateBorderChangeListener(serverlevel1.getWorldBorder())); this.levels.put(resourcekey1, serverlevel1); net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.level.LevelEvent.Load(levels.get(resourcekey))); } } Now the only way I can add custom spawners is to inject constructor of ServerLevel and modify final member customSpawners.

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.