22
33import com .refinedmods .refinedstorage .RSBlockEntities ;
44import com .refinedmods .refinedstorage .blockentity .NetworkNodeBlockEntity ;
5- import com .refinedmods .refinedstorage .blockentity .data .BlockEntitySynchronizationSpec ;
65import com .zengyj .exposer .Exposer ;
76import com .zengyj .exposer .Registry ;
87import com .zengyj .exposer .node .NetworkNodeExposer ;
1110import net .minecraft .world .level .Level ;
1211import net .minecraft .world .level .block .state .BlockState ;
1312import net .minecraftforge .common .capabilities .Capability ;
14- import net .minecraftforge .common .capabilities .ForgeCapabilities ;
1513import net .minecraftforge .common .util .LazyOptional ;
1614import net .minecraftforge .common .util .NonNullSupplier ;
15+ import net .minecraftforge .fluids .capability .CapabilityFluidHandler ;
1716import net .minecraftforge .fluids .capability .IFluidHandler ;
17+ import net .minecraftforge .items .CapabilityItemHandler ;
1818import net .minecraftforge .items .IItemHandler ;
1919import org .checkerframework .checker .nullness .qual .NonNull ;
2020import org .checkerframework .checker .nullness .qual .Nullable ;
@@ -25,42 +25,35 @@ public class TileExposer extends NetworkNodeBlockEntity<NetworkNodeExposer> {
2525 private NonNullSupplier <IItemHandler > itemSupplier ;
2626 private NonNullSupplier <IFluidHandler > fluidSupplier ;
2727
28- public static BlockEntitySynchronizationSpec SPEC ;
29-
3028 public TileExposer (BlockPos pos , BlockState state ) {
31- super (Registry .EXPOSER_TYPE .get (), pos , state , SPEC );
32- // Exposer.LOGGER.info("Creating TileExposer");
29+ super (Registry .EXPOSER_TYPE .get (), pos , state );
3330 }
3431
3532
3633 @ NonNull
3734 @ Override
3835 public <T > LazyOptional <T > getCapability (@ NonNull Capability <T > cap , @ Nullable Direction direction ) {
39- if (cap == ForgeCapabilities .ITEM_HANDLER ){
40- // Exposer.LOGGER.info("Start expose item handler");
36+ if (cap == CapabilityItemHandler .ITEM_HANDLER_CAPABILITY ){
4137 if (itemSupplier != null ){
42- // Exposer.LOGGER.info("expose exist item handler");
4338 return (LazyOptional <T >) LazyOptional .of (itemSupplier );
4439 }
4540
4641 if (getNode ().getItemHandler () == null ){
47- // Exposer.LOGGER.info("return empty item handler");
4842 return LazyOptional .empty ();
4943 }
5044
5145 itemSupplier = new NonNullSupplier <>() {
5246 @ NonNull
5347 @ Override
5448 public IItemHandler get () {
55- // Exposer.LOGGER.info("get expose item handler");
5649 return getNode ().getItemHandler ();
5750 }
5851 };
5952
6053 return (LazyOptional <T >) LazyOptional .of (itemSupplier );
6154 }
6255
63- if (cap == ForgeCapabilities . FLUID_HANDLER ){
56+ if (cap == CapabilityFluidHandler . FLUID_HANDLER_CAPABILITY ){
6457 if (fluidSupplier != null ){
6558 return (LazyOptional <T >) LazyOptional .of (fluidSupplier );
6659 }
@@ -87,8 +80,4 @@ public IFluidHandler get() {
8780 public NetworkNodeExposer createNode (Level level , BlockPos blockPos ) {
8881 return new NetworkNodeExposer (level ,blockPos );
8982 }
90-
91- static {
92- SPEC = BlockEntitySynchronizationSpec .builder ().build ();
93- }
9483}
0 commit comments