@@ -212,25 +212,24 @@ private ItemStack insertStartingAt(final IItemHandler handler, ItemStack stack,
212212 }
213213
214214 private Stream <IItemHandler > getItemStackHandlersInDirection (final Direction direction ) {
215- return getItemStackHandlersAt (Vec3 . atCenterOf ( entity .blockPosition ().relative (direction ) ), direction .getOpposite ());
215+ return getItemStackHandlersAt (entity .blockPosition ().relative (direction ), direction .getOpposite ());
216216 }
217217
218- private Stream <IItemHandler > getItemStackHandlersAt (final Vec3 position , final Direction side ) {
219- return Stream .concat (getEntityItemHandlersAt (position , side ), getBlockItemHandlersAt (position , side ));
218+ private Stream <IItemHandler > getItemStackHandlersAt (final BlockPos blockPos , final Direction side ) {
219+ return Stream .concat (getEntityItemHandlersAt (blockPos , side ), getBlockItemHandlersAt (blockPos , side ));
220220 }
221221
222- private Stream <IItemHandler > getEntityItemHandlersAt (final Vec3 position , final Direction side ) {
222+ private Stream <IItemHandler > getEntityItemHandlersAt (final BlockPos blockPos , final Direction side ) {
223+ var position = Vec3 .atCenterOf (blockPos );
223224 final AABB bounds = AABB .unitCubeFromLowerCorner (position .subtract (0.5 , 0.5 , 0.5 ));
224225 return entity .level ().getEntities (entity , bounds ).stream ()
225226 .map (e -> e .getCapability (Capabilities .itemHandler (), side ))
226227 .filter (LazyOptional ::isPresent )
227228 .map (c -> c .orElseThrow (AssertionError ::new ));
228229 }
229230
230- private Stream <IItemHandler > getBlockItemHandlersAt (final Vec3 position , final Direction side ) {
231- Vec3i posi = new Vec3i ((int ) position .x , (int ) position .y , (int ) position .z );
232- final BlockPos pos = new BlockPos (posi );
233- final BlockEntity blockEntity = entity .level ().getBlockEntity (pos );
231+ private Stream <IItemHandler > getBlockItemHandlersAt (final BlockPos blockPos , final Direction side ) {
232+ final BlockEntity blockEntity = entity .level ().getBlockEntity (blockPos );
234233 if (blockEntity == null ) {
235234 return Stream .empty ();
236235 }
0 commit comments