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.

SirSmuggler

Members
  • Joined

  • Last visited

  1. Ok, so I went ahead and did it any way! Bad Smuggler! https://github.com/MinecraftForge/FML/pull/281
  2. I'm currently working on a mod that will add villagers. How ever, I want to have custom conditions that needs to be fulfilled before a certain villager type can be selected when a new willager is spawned. I have not found a way to do this currently, but then again I'm compleatley new to minecraft moding so I might be missing something. If so I'd greatley apreciate being pointed in the right direction If how ever there currently is no method, I have done the following modification to VillagerRegistry to allow it. Added the following: private Map<Integer, IVillageSpawnCondition> spawnConditionHandlers = Maps.newHashMap(); /** * Allow access to the random profession selection for new villagers. * */ public interface IVillageSpawnCondition { /** * Called to allow profession to be excluded from the random selection when a new villager is created. * * @param villager */ boolean typeIsValidForVillager( EntityVillager villager, Random random ); } /** * Register a new villager spawn condition for the specified villager type * * @param villagerId * @param handler */ public void registerVillageSpawnCondition(int villagerId, IVillageSpawnCondition handler) { spawnConditionHandlers.put(villagerId, handler); } Modified ApplyRandomTrade as follows: public static void applyRandomTrade(EntityVillager villager, Random rand) { // Select only the villager id's that fulfills their validation for spawning at this time. // If no spawn condition is set for an id we assume it is valid. List<Integer> validVillagerIds = Lists.newArrayList(); for ( int i = 0; i < instance().newVillagerIds.size(); i++ ) { if ( instance().spawnConditionHandlers.get( instance().newVillagerIds.get( i ) ) == null ) validVillagerIds.add( instance().newVillagerIds.get( i ) ); else if ( instance().spawnConditionHandlers.get( instance().newVillagerIds.get( i ) ).typeIsValidForVillager( villager, rand ) ) validVillagerIds.add( instance().newVillagerIds.get( i ) ); } // Randomize from the list of validated types instead of the entire list. int extra = validVillagerIds.size(); int trade = rand.nextInt(5 + extra); villager.setProfession(trade < 5 ? trade : validVillagerIds.get(trade - 5)); } This was based on how the villager trade registering is set up. Any feedback is welcome, as I'm so new to this I don't think a dare post a pull request before I have had some feedback

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.