File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed
src/main/java/gregtech/api/capability/impl Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -35,20 +35,20 @@ public ItemHandlerList() {
3535 this (Collections .emptyList ());
3636 }
3737
38- public ItemHandlerList (ItemHandlerList parent , IItemHandler ... additional ) {
39- this (parent );
40- Collections .addAll (this , additional );
38+ public static ItemHandlerList of (IItemHandler ... handlers ) {
39+ ItemHandlerList list = new ItemHandlerList ();
40+ if (handlers != null && handlers .length > 0 ) {
41+ Collections .addAll (list , handlers );
42+ }
43+ return list .toImmutable ();
4144 }
4245
4346 /**
4447 * @param handler the handler to get the slot offset of
45- * @return the slot offset
46- * @throws IllegalArgumentException if the handler is not in this list
48+ * @return the slot offset, or {@code -1} if the handler does not exist
4749 */
4850 public int getIndexOffset (IItemHandler handler ) {
49- int offset = baseIndexOffset .get (handler );
50- if (offset == -1 ) throw new IllegalArgumentException ();
51- return offset ;
51+ return baseIndexOffset .get (handler );
5252 }
5353
5454 @ NotNull
You can’t perform that action at this time.
0 commit comments