net.minecraft.inventory.SidedInventory Java Examples
The following examples show how to use
net.minecraft.inventory.SidedInventory.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MixinBlock.java From Sandbox with GNU Lesser General Public License v3.0 | 6 votes |
public <X> Mono<X> sbx$getComponent(WorldReader reader, Position position, BlockState state, Component<X> component, Mono<Direction> side) { if (component == Components.INVENTORY_COMPONENT) { if (this instanceof InventoryProvider) { SidedInventory inventory = ((InventoryProvider) this).getInventory((net.minecraft.block.BlockState) state, (IWorld) reader, (BlockPos) position); if (side.isPresent()) return Mono.of(new SidedRespective(inventory, side.get())).cast(); return Mono.of(new V2SInventory(inventory)).cast(); } net.minecraft.block.entity.BlockEntity entity = ((BlockView) reader).getBlockEntity((BlockPos) position); if (entity instanceof Inventory) { if (side.isPresent() && entity instanceof SidedInventory) return Mono.of(new SidedRespective((SidedInventory) entity, side.get())).cast(); return Mono.of(new V2SInventory((Inventory) entity)).cast(); } } if (component == Components.FLUID_COMPONENT) { if (this instanceof Waterloggable) { FluidLoggingContainer container = new FluidLoggingContainer((FluidLoggable) this, reader, position, state, side); return Mono.of(container).cast(); } } return Mono.empty(); }
Example #2
Source File: HopperMinecartEntity_transferItemsOutFeatureMixin.java From carpet-extra with GNU Lesser General Public License v3.0 | 4 votes |
private static IntStream getAvailableSlots(Inventory inventory_1, Direction direction_1) { return inventory_1 instanceof SidedInventory ? IntStream.of(((SidedInventory)inventory_1).getInvAvailableSlots(direction_1)) : IntStream.range(0, inventory_1.getInvSize()); }
Example #3
Source File: SidedRespective.java From Sandbox with GNU Lesser General Public License v3.0 | 4 votes |
public SidedRespective(SidedInventory inventory, Direction direction) { super(inventory); this.direction = direction; this.inventory = inventory; }