2323import gregtech .api .unification .stack .ItemAndMetadata ;
2424import gregtech .api .util .function .impl .TimedProgressSupplier ;
2525
26+ import gregtech .common .ConfigHolder ;
27+
2628import net .minecraft .block .BlockRedstoneWire ;
2729import net .minecraft .block .BlockSnow ;
2830import net .minecraft .block .material .MapColor ;
@@ -1035,39 +1037,26 @@ public static int combineRGB(@Range(from = 0, to = 255) int a, @Range(from = 0,
10351037 return map .get (key .toWildcard ());
10361038 }
10371039
1038- /**
1039- * Check if an {@link ItemStack} is chargeable.
1040- *
1041- * @param stack the stack to check
1042- * @param tier if the item is a GT energy item, the minimum tier it has to be
1043- * @param checkCharge whether to check if it is fully charged or not
1044- * @return if the stack is electric and meets the supplied conditions
1045- */
1046- public static boolean isItemChargeable (@ NotNull ItemStack stack , int tier , boolean checkCharge ) {
1040+ public static boolean isItemChargableWithEU (@ NotNull ItemStack stack , int tier ) {
10471041 IElectricItem euItem = stack .getCapability (GregtechCapabilities .CAPABILITY_ELECTRIC_ITEM , null );
10481042 if (euItem != null ) {
10491043 return euItem .chargeable () && euItem .getCharge () < euItem .getMaxCharge () && euItem .getTier () <= tier ;
10501044 }
10511045
1052- IEnergyStorage rfItem = stack .getCapability (CapabilityEnergy .ENERGY , null );
1053- if (rfItem != null ) {
1054- return rfItem .canReceive () && rfItem .getEnergyStored () < rfItem .getMaxEnergyStored ();
1046+ if (ConfigHolder .compat .energy .nativeEUToFE ) {
1047+ IEnergyStorage rfItem = stack .getCapability (CapabilityEnergy .ENERGY , null );
1048+ if (rfItem != null ) {
1049+ return rfItem .canReceive () && rfItem .getEnergyStored () < rfItem .getMaxEnergyStored ();
1050+ }
10551051 }
10561052
10571053 return false ;
10581054 }
10591055
10601056 /**
1061- * See {@link #isItemChargeable(ItemStack, int, boolean)}
1062- */
1063- public static boolean isItemChargeable (@ NotNull ItemStack stack ) {
1064- return isItemChargeable (stack , GTValues .MAX_TRUE , true );
1065- }
1066-
1067- /**
1068- * Get the level of charge from 0 to 1 of an item
1057+ * Get the level of charge from 0 to 1 of an item.
10691058 *
1070- * @return 0 if the supplied item is not electric
1059+ * @return -1 if the supplied item is not electric
10711060 */
10721061 public static float itemChargeLevel (@ NotNull ItemStack stack ) {
10731062 if (stack .isEmpty ()) return 0.0f ;
@@ -1082,7 +1071,7 @@ public static float itemChargeLevel(@NotNull ItemStack stack) {
10821071 return (float ) rfItem .getEnergyStored () / rfItem .getMaxEnergyStored ();
10831072 }
10841073
1085- return 0 .0f ;
1074+ return - 1 .0f ;
10861075 }
10871076
10881077 /**
0 commit comments