21
21
import com .simibubi .create .content .contraptions .render .ContraptionMatrices ;
22
22
import com .simibubi .create .content .contraptions .render .ContraptionRenderDispatcher ;
23
23
import com .simibubi .create .content .kinetics .deployer .DeployerBlockEntity .Mode ;
24
- import com .simibubi .create .content .logistics .filter .FilterItem ;
24
+ import com .simibubi .create .content .logistics .filter .FilterItemStack ;
25
25
import com .simibubi .create .content .schematics .SchematicInstances ;
26
26
import com .simibubi .create .content .schematics .SchematicWorld ;
27
27
import com .simibubi .create .content .schematics .requirement .ItemRequirement ;
@@ -80,9 +80,9 @@ public void visitNewPosition(MovementContext context, BlockPos pos) {
80
80
public void activate (MovementContext context , BlockPos pos , DeployerFakePlayer player , Mode mode ) {
81
81
Level world = context .world ;
82
82
83
- ItemStack filter = getFilter ( context );
84
- if (AllItems .SCHEMATIC .isIn (filter ))
85
- activateAsSchematicPrinter (context , pos , player , world , filter );
83
+ FilterItemStack filter = context . getFilterFromBE ( );
84
+ if (AllItems .SCHEMATIC .isIn (filter . item () ))
85
+ activateAsSchematicPrinter (context , pos , player , world , filter . item () );
86
86
87
87
Vec3 facingVec = Vec3 .atLowerCornerOf (context .state .getValue (DeployerBlock .FACING )
88
88
.getNormal ());
@@ -222,11 +222,11 @@ private void tryGrabbingItem(MovementContext context) {
222
222
return ;
223
223
if (player .getMainHandItem ()
224
224
.isEmpty ()) {
225
- ItemStack filter = getFilter ( context );
226
- if (AllItems .SCHEMATIC .isIn (filter ))
225
+ FilterItemStack filter = context . getFilterFromBE ( );
226
+ if (AllItems .SCHEMATIC .isIn (filter . item () ))
227
227
return ;
228
228
ItemStack held = ItemHelper .extract (context .contraption .getSharedInventory (),
229
- stack -> FilterItem .test (context .world , stack , filter ), 1 , false );
229
+ stack -> filter .test (context .world , stack ), 1 , false );
230
230
player .setItemInHand (InteractionHand .MAIN_HAND , held );
231
231
}
232
232
}
@@ -236,15 +236,15 @@ private void tryDisposeOfExcess(MovementContext context) {
236
236
if (player == null )
237
237
return ;
238
238
Inventory inv = player .getInventory ();
239
- ItemStack filter = getFilter ( context );
239
+ FilterItemStack filter = context . getFilterFromBE ( );
240
240
241
241
for (List <ItemStack > list : Arrays .asList (inv .armor , inv .offhand , inv .items )) {
242
242
for (int i = 0 ; i < list .size (); ++i ) {
243
243
ItemStack itemstack = list .get (i );
244
244
if (itemstack .isEmpty ())
245
245
continue ;
246
246
247
- if (list == inv .items && i == inv .selected && FilterItem .test (context .world , itemstack , filter ))
247
+ if (list == inv .items && i == inv .selected && filter .test (context .world , itemstack ))
248
248
continue ;
249
249
250
250
dropItem (context , itemstack );
@@ -278,10 +278,6 @@ private DeployerFakePlayer getPlayer(MovementContext context) {
278
278
return (DeployerFakePlayer ) context .temporaryData ;
279
279
}
280
280
281
- private ItemStack getFilter (MovementContext context ) {
282
- return ItemStack .of (context .blockEntityData .getCompound ("Filter" ));
283
- }
284
-
285
281
private Mode getMode (MovementContext context ) {
286
282
return NBTHelper .readEnum (context .blockEntityData , "Mode" , Mode .class );
287
283
}
0 commit comments