11package org .cyclops .integratedtunnels ;
22
33import net .minecraft .resources .ResourceLocation ;
4- import net .neoforged .neoforge .energy .IEnergyStorage ;
5- import net .neoforged .neoforge .fluids .capability .IFluidHandler ;
6- import net .neoforged .neoforge .items .IItemHandler ;
4+ import net .neoforged .neoforge .transfer .ResourceHandler ;
5+ import net .neoforged .neoforge .transfer .energy .EnergyHandler ;
6+ import net .neoforged .neoforge .transfer .fluid .FluidResource ;
7+ import net .neoforged .neoforge .transfer .item .ItemResource ;
78import org .cyclops .commoncapabilities .IngredientComponents ;
89import org .cyclops .commoncapabilities .api .capability .itemhandler .ISlotlessItemHandler ;
9- import org .cyclops .commoncapabilities .ingredient .storage . IngredientComponentStorageWrapperHandlerEnergyStorage ;
10- import org .cyclops .commoncapabilities .ingredient .storage .IngredientComponentStorageWrapperHandlerFluidStack ;
10+ import org .cyclops .commoncapabilities .api . ingredient .IngredientComponent ;
11+ import org .cyclops .commoncapabilities .ingredient .storage .IngredientComponentStorageWrapperHandlerEnergyHandler ;
1112import org .cyclops .commoncapabilities .ingredient .storage .IngredientComponentStorageWrapperHandlerItemStack ;
1213import org .cyclops .commoncapabilities .ingredient .storage .IngredientComponentStorageWrapperHandlerItemStackSlotless ;
14+ import org .cyclops .commoncapabilities .ingredient .storage .IngredientComponentStorageWrapperHandlerResourceHandler ;
1315import org .cyclops .integrateddynamics .api .network .NetworkCapability ;
1416import org .cyclops .integrateddynamics .api .part .PartCapability ;
1517import org .cyclops .integrateddynamics .core .part .event .RegisterPartCapabilitiesEvent ;
@@ -24,33 +26,33 @@ public class Capabilities {
2426 public static final class ItemNetwork {
2527 public static final NetworkCapability <IItemNetwork > NETWORK = NetworkCapability .create (ResourceLocation .fromNamespaceAndPath (Reference .MOD_ID , "item_network" ), IItemNetwork .class );
2628 }
27- public static final class ItemHandler {
28- public static final NetworkCapability <IItemHandler > NETWORK = NetworkCapability .create (ResourceLocation .fromNamespaceAndPath (Reference .MOD_ID , "item_handler" ), IItemHandler . class );
29- public static final PartCapability <IItemHandler > PART = PartCapability .create (ResourceLocation .fromNamespaceAndPath (Reference .MOD_ID , "item_handler" ), IItemHandler . class );
29+ public static final class Item {
30+ public static final NetworkCapability <ResourceHandler < ItemResource >> NETWORK = NetworkCapability .create (ResourceLocation .fromNamespaceAndPath (Reference .MOD_ID , "item_handler" ), ResourceHandler . asClass () );
31+ public static final PartCapability <ResourceHandler < ItemResource >> PART = PartCapability .create (ResourceLocation .fromNamespaceAndPath (Reference .MOD_ID , "item_handler" ), ResourceHandler . asClass () );
3032 }
3133 public static final class SlotlessItemHandler {
3234 public static final PartCapability <ISlotlessItemHandler > PART = PartCapability .create (ResourceLocation .fromNamespaceAndPath (Reference .MOD_ID , "slotless_item_handler" ), ISlotlessItemHandler .class );
3335 }
3436 public static final class FluidNetwork {
3537 public static final NetworkCapability <IFluidNetwork > NETWORK = NetworkCapability .create (ResourceLocation .fromNamespaceAndPath (Reference .MOD_ID , "fluid_network" ), IFluidNetwork .class );
3638 }
37- public static final class FluidHandler {
38- public static final NetworkCapability <IFluidHandler > NETWORK = NetworkCapability .create (ResourceLocation .fromNamespaceAndPath (Reference .MOD_ID , "fluid_handler" ), IFluidHandler . class );
39- public static final PartCapability <IFluidHandler > PART = PartCapability .create (ResourceLocation .fromNamespaceAndPath (Reference .MOD_ID , "fluid_handler" ), IFluidHandler . class );
39+ public static final class Fluid {
40+ public static final NetworkCapability <ResourceHandler < FluidResource >> NETWORK = NetworkCapability .create (ResourceLocation .fromNamespaceAndPath (Reference .MOD_ID , "fluid_handler" ), ResourceHandler . asClass () );
41+ public static final PartCapability <ResourceHandler < FluidResource >> PART = PartCapability .create (ResourceLocation .fromNamespaceAndPath (Reference .MOD_ID , "fluid_handler" ), ResourceHandler . asClass () );
4042 }
41- public static final class EnergyStorage {
42- public static final PartCapability <IEnergyStorage > PART = PartCapability .create (ResourceLocation .fromNamespaceAndPath (Reference .MOD_ID , "energy_storage" ), IEnergyStorage .class );
43+ public static final class Energy {
44+ public static final PartCapability <EnergyHandler > PART = PartCapability .create (ResourceLocation .fromNamespaceAndPath (Reference .MOD_ID , "energy_storage" ), EnergyHandler .class );
4345 }
4446
4547 public static void registerPartCapabilities (RegisterPartCapabilitiesEvent event ) {
46- event .register (net .neoforged .neoforge .capabilities .Capabilities .ItemHandler .BLOCK , ItemHandler .PART );
48+ event .register (net .neoforged .neoforge .capabilities .Capabilities .Item .BLOCK , Item .PART );
4749 event .register (org .cyclops .commoncapabilities .api .capability .Capabilities .SlotlessItemHandler .BLOCK , SlotlessItemHandler .PART );
48- event .register (net .neoforged .neoforge .capabilities .Capabilities .FluidHandler .BLOCK , FluidHandler .PART );
49- event .register (net .neoforged .neoforge .capabilities .Capabilities .EnergyStorage .BLOCK , EnergyStorage .PART );
50+ event .register (net .neoforged .neoforge .capabilities .Capabilities .Fluid .BLOCK , Fluid .PART );
51+ event .register (net .neoforged .neoforge .capabilities .Capabilities .Energy .BLOCK , Energy .PART );
5052
51- IngredientComponents .ENERGY .setStorageWrapperHandler (EnergyStorage .PART , new IngredientComponentStorageWrapperHandlerEnergyStorage <>(IngredientComponents .ENERGY , EnergyStorage .PART ));
52- IngredientComponents .ITEMSTACK .setStorageWrapperHandler (ItemHandler .PART , new IngredientComponentStorageWrapperHandlerItemStack <>(IngredientComponents .ITEMSTACK , ItemHandler .PART , SlotlessItemHandler .PART ));
53+ IngredientComponents .ENERGY .setStorageWrapperHandler (Energy .PART , new IngredientComponentStorageWrapperHandlerEnergyHandler <>(IngredientComponents .ENERGY , Energy .PART ));
54+ IngredientComponents .ITEMSTACK .setStorageWrapperHandler (Item .PART , new IngredientComponentStorageWrapperHandlerItemStack <>(IngredientComponents .ITEMSTACK , Item .PART , SlotlessItemHandler .PART ));
5355 IngredientComponents .ITEMSTACK .setStorageWrapperHandler (SlotlessItemHandler .PART , new IngredientComponentStorageWrapperHandlerItemStackSlotless <>(IngredientComponents .ITEMSTACK , SlotlessItemHandler .PART ));
54- IngredientComponents .FLUIDSTACK .setStorageWrapperHandler (FluidHandler .PART , new IngredientComponentStorageWrapperHandlerFluidStack <>(IngredientComponents .FLUIDSTACK , FluidHandler .PART ));
56+ IngredientComponents .FLUIDSTACK .setStorageWrapperHandler (Fluid .PART , new IngredientComponentStorageWrapperHandlerResourceHandler <>(IngredientComponents .FLUIDSTACK , Fluid .PART , IngredientComponent . FLUIDSTACK_CONVERTER ));
5557 }
5658}
0 commit comments