Fix crash when placing furnaces or brewing stands in 1.13 (#5225)
This commit is contained in:
parent
f1552ef20d
commit
b5264cacf0
3 changed files with 5 additions and 5 deletions
|
@ -66,7 +66,7 @@
|
||||||
+ if (facing != null && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
|
+ if (facing != null && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
|
||||||
+ if (facing == EnumFacing.UP)
|
+ if (facing == EnumFacing.UP)
|
||||||
+ return handlers[0].cast();
|
+ return handlers[0].cast();
|
||||||
+ else if (facing == EnumFacing.UP)
|
+ else if (facing == EnumFacing.DOWN)
|
||||||
+ return handlers[1].cast();
|
+ return handlers[1].cast();
|
||||||
+ else
|
+ else
|
||||||
+ return handlers[2].cast();
|
+ return handlers[2].cast();
|
||||||
|
|
|
@ -88,7 +88,7 @@
|
||||||
+ if (facing != null && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
|
+ if (facing != null && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
|
||||||
+ if (facing == EnumFacing.UP)
|
+ if (facing == EnumFacing.UP)
|
||||||
+ return handlers[0].cast();
|
+ return handlers[0].cast();
|
||||||
+ else if (facing == EnumFacing.UP)
|
+ else if (facing == EnumFacing.DOWN)
|
||||||
+ return handlers[1].cast();
|
+ return handlers[1].cast();
|
||||||
+ else
|
+ else
|
||||||
+ return handlers[2].cast();
|
+ return handlers[2].cast();
|
||||||
|
|
|
@ -34,11 +34,11 @@ public class SidedInvWrapper implements IItemHandlerModifiable
|
||||||
protected final EnumFacing side;
|
protected final EnumFacing side;
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static <T extends OptionalCapabilityInstance<IItemHandlerModifiable>> T[] create(ISidedInventory inv, EnumFacing... sides) {
|
public static OptionalCapabilityInstance<IItemHandlerModifiable>[] create(ISidedInventory inv, EnumFacing... sides) {
|
||||||
T[] ret = (T[])new Object[sides.length];
|
OptionalCapabilityInstance<IItemHandlerModifiable>[] ret = new OptionalCapabilityInstance[sides.length];
|
||||||
for (int x = 0; x < sides.length; x++) {
|
for (int x = 0; x < sides.length; x++) {
|
||||||
final EnumFacing side = sides[x];
|
final EnumFacing side = sides[x];
|
||||||
ret[x] = (T)OptionalCapabilityInstance.of(() -> (IItemHandlerModifiable)new SidedInvWrapper(inv, side));
|
ret[x] = OptionalCapabilityInstance.of(() -> new SidedInvWrapper(inv, side));
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue