Jump to content
  • Home
  • Files
  • Docs
  • Merch
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Observing Inventories
1.13 Update Notes for Mod Creators
Sign in to follow this  
Followers 1
simicats

Observing Inventories

By simicats, August 27 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

simicats    2

simicats

simicats    2

  • Tree Puncher
  • simicats
  • Members
  • 2
  • 13 posts
Posted August 27 (edited)

Hi there, 

I've been working on tickable TileEntities which operate on inventories of neighboring blocks.

To reduce the occupied tick-time it would be fantastic to have the observer only update whenever the inventory had been changed.

I've heard that filled Hoppers attached to large inventories with no remaining space can cause quite an impact, therefore I wondered if there was common practice in the world of Forge for listening to another TEs' IItemHandler efficiently.

 

Example: Some detector circuit similar to a Comparator emitting a signal when the contents of a chest next to it match a number of conditions. The conditions would only have to be checked whenever the contents changed.

 

Thanks for your time!

Edited August 27 by simicats
Grammar
  • Quote

Share this post


Link to post
Share on other sites

diesieben07    6671

diesieben07

diesieben07    6671

  • Reality Controller
  • diesieben07
  • Forum Team
  • 6671
  • 45597 posts
Posted August 27

onNeighborChange(BlockState, IWorldReader, BlockPos, BlockPos) (onNeighborChange(IBlockAccess, BlockPos, BlockPos) for 1.12.2) will be called on your Block when a neighboring tile entity changes (that includes inventories). You can then re-check the corresponding position.

  • Like 1
  • Quote

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 1
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Choonster
      [1.14.4] [Solved] Persisting player health on dimension change

      By Choonster · Posted 16 minutes ago

      Yes. The client loses the attribute (which may be a Vanilla bug, I'm not sure), but the server retains the correct value and re-syncs it to the client.
    • DragonITA
      [1.14.4] Why minecraft with mod dont want start?

      By DragonITA · Posted 19 minutes ago

      But who i make a misstake
    • DragonITA
      [1.14.4] Why minecraft with mod dont want start?

      By DragonITA · Posted 22 minutes ago

      Yes   No, but is similar
    • DavidM
      Unstable ModPack 1.12.2

      By DavidM · Posted 43 minutes ago

      1. Please don’t use that font. 2. BetweenOres’ problem. Remove it and report to its author.
    • DavidM
      [1.14-newer] deprecated method onBlockActivated

      By DavidM · Posted 53 minutes ago

      Please make your own thread.
  • Topics

    • FireController1847
      6
      [1.14.4] [Solved] Persisting player health on dimension change

      By FireController1847
      Started 4 hours ago

    • DragonITA
      6
      [1.14.4] Why minecraft with mod dont want start?

      By DragonITA
      Started 13 hours ago

    • fump
      1
      Unstable ModPack 1.12.2

      By fump
      Started 9 hours ago

    • matt1999rd
      17
      [1.14-newer] deprecated method onBlockActivated

      By matt1999rd
      Started November 1

    • saxon564
      6
      [1.14.4] [UNSOLVED] Server Thread Freezes After Entity Explodes

      By saxon564
      Started Yesterday at 05:11 AM

  • Who's Online (See full list)

    • FireController1847
    • plugsmustard
    • Lea9ue
    • loordgek
    • salvestrom
    • Choonster
    • Kxbib
    • DragonITA
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Observing Inventories
  • Theme
  • Contact Us
  • Discord

Copyright © 2019 ForgeDevelopment LLC · Ads by Curse Powered by Invision Community