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
  • 45590 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

    • plugsmustard
      on/off button for custom furnace

      By plugsmustard · Posted 13 minutes ago

      you said get the pos from the packet buffer. how exactly do i do that?
    • loordgek
      on/off button for custom furnace

      By loordgek · Posted 14 minutes ago

      what part do you not understand?
    • plugsmustard
      on/off button for custom furnace

      By plugsmustard · Posted 35 minutes ago

      okay, i think i know what you mean. could you give me a little more descriptions if possible?
    • LorenzoPapi
      Double-part block breaking problem

      By LorenzoPapi · Posted 36 minutes ago

      I've got my "block_afp" block. It's formed by two parts, "TOP" and "DOWN". The block can be placed both on walls, on the floor and under the roof and it works perfectly but, when I break a part of the block, there's a problem. If the block isn't on the floor, the other part gets detroyed too. If the block IS on the floor, I don't know how to check for the other part to get destroyed. Here is a working and updated repo of my mod, with my test worlds too: https://github.com/LorenzoPapi/Test-1.12.2
    • loordgek
      on/off button for custom furnace

      By loordgek · Posted 54 minutes ago

      https://github.com/drmdgg/marijuanacraft1.14.4/blob/master/src/main/java/drmdgg/marijuanacraft/network/PacketButtonClicked.java#L29 you need to get the pos from the packetbuffer   the ide will tell whats wrong
  • Topics

    • plugsmustard
      35
      on/off button for custom furnace

      By plugsmustard
      Started Wednesday at 03:11 PM

    • LorenzoPapi
      0
      Double-part block breaking problem

      By LorenzoPapi
      Started 37 minutes ago

    • solitone
      5
      Distinguish singleplayer vs. multiplayer

      By solitone
      Started 19 hours ago

    • mlaticka_007
      4
      Forge 1.12.2 crash on launch unknown error

      By mlaticka_007
      Started September 23

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

      By saxon564
      Started 10 hours ago

  • Who's Online (See full list)

    • Dodo_Report
    • plugsmustard
    • vaartis
    • Simon_kungen
    • Pfidget
    • loordgek
  • 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