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.

Leaderboard

Popular Content

Showing content with the highest reputation on 05/22/21 in all areas

  1. Once per world when the world is loaded. The block can't store data about the decay process, because blocks are singletons. Your options are either (a) a tile entity or (b) world capability data (that knows about the positions and times). Use world.getCapability to get your capability and store/retrieve/update the data as needed. Your capability will still be a map of postions -> times. The World class is already a capability provider, you don't need to create your own unless you want to have a capability attached to an option that is not already a capability provider. Worlds, chunks, entities (including tile entities and players), and itemstacks are all capability providers. Pretty much. I don't think you need your DecayHandler class, as your capability class is your DecayHandler. It just needs to store a map of postion->time. Depending on how you want to track that time (every tick? only when the block gets an update tick?) might alter the implementation details a little, but in general it's just a list of positions and the decay value. Or possibly just a list of block positions if no actual time data is relevant (the block would just query the capability to see if it should decay or not, and if so, remove its position from the capability). I mean the scheduled tick system. world.scheduleBlockUpdate or something like that. You give it a position and a number of ticks to wait, and your block will have its updateTick method called at that time.
  2. Forge isn't currently compatible with Java 16 due to a change in reflection restrictions. Forge for 1.17 should be compatible with Java 16 when it comes out, as that is the Java version Mojang will be shipping with the game then.
  3. Try using a Java version lower than 16
  4. Thank you for that code, so that I could understand why you were returning values the way you were. The correct way to do this would be to return a boolean. for(DecayHandler decayHandler: decayHandlers){ if(decayHandler.OnTick()){ decayHandlersToBeRemoved.add(decayHandler); } } But as I said, this whole custom data structure is unnecessary. ...The heck? You don't need this entire block. Much less two loops and a temporary variable! decayHandlers.removeAll(decayHandlersToBeRemoved); Yes, but also no. Yes, in the sense that you do need to have a way to serialize your data, but in 99% of cases you should simply be providing a method to serialize and let the game decide when to call it, via the Capabilities system. The structure you have here is a world capability, assuming the existing systems didn't do what you needed them to sufficiently. Speaking of: You know there's more than one world, right? Even in single player you have the ClientWorld, the Overworld, the Nether, and the End. Hashtag I wonder how redstone repeaters work.

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.