Jump to content

How do I prevent hoppers/droppers/item pipes from interacting with a machine?


superminerJG

Recommended Posts

https://github.com/JGgithub2018/Simple-Batteries/blob/master/src/main/java/jgcodes/sb/forgecaps/ReadOnlyItemHandler.java#L23

A read-only stack handler should not allow a set. You want to set, keep a reference to the internal stack handler externally and set it there.

 

9 hours ago, loordgek said:

Extending ItemStackHandler is perfectly fine, especially when you don't want to deal with some of the implementations (such as read/write to NBT), as its more work than simply nullifying the behavior you don't want (such as preventing insertion and extraction).

Edited by Draco18s

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

51 minutes ago, Draco18s said:

Extending ItemStackHandler is perfectly fine, especially when you don't want to deal with some of the implementations (such as read/write to NBT), as its more work than simply nullifying the behavior you don't want (such as preventing insertion and extraction).

look at what he is doing

he is using a ItemStackHandler  to wrap a ItemStackHandler

Link to comment
Share on other sites

1 hour ago, loordgek said:

look at what he is doing

he is using a ItemStackHandler  to wrap a ItemStackHandler

So? I did too:

https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/src/main/java/com/draco18s/hardlib/api/internal/inventory/OutputItemStackHandler.java

There's a very legitimate reason to do this. My OutputSlotHandler is exposed via GetCapability (so that machines can extract from the slot, but not insert) while the internalSlot is accessed directly by the machine in order to produce output.

 

Creating a "read only" slot (one that can be queried for its contents, but not have the item extracted, nor allow an item insertion) would work the same way. The internal slot (the one that is being wrapped) can still be accessed normally in a private manner while the read only wrapper is exposed externally.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

On 6/5/2019 at 12:35 AM, Draco18s said:

A little offtopic (sorry), but is there a particular reason you're calling markDirty() in getCapability()?  Bearing in mind that markDirty() calls World#updateComparatorOutputLevel() which can do a potentially non-trivial amount of work (calling Block#onNeighborChange() on all your block's neighbors, and possibly even some of their neighbors too).

Link to comment
Share on other sites

47 minutes ago, desht said:

A little offtopic (sorry), but is there a particular reason you're calling markDirty() in getCapability()?  Bearing in mind that markDirty() calls World#updateComparatorOutputLevel() which can do a potentially non-trivial amount of work (calling Block#onNeighborChange() on all your block's neighbors, and possibly even some of their neighbors too).

Probably left over from an issue where something wasn't saving. Its been like 2 years.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.