diff --git a/settings.gradle b/settings.gradle index 50204cea..07224afd 100644 --- a/settings.gradle +++ b/settings.gradle @@ -36,8 +36,8 @@ dependencyResolutionManagement { def vineFlowerVersion = "1.+" def macheteVersion = "1.+" def configurationVersion = "2.2.0" - def gtCeuVersion = "1.4.4" - def ldLibVersion = "1.0.29.a" + def gtCeuVersion = "1.4.7-SNAPSHOT" + def ldLibVersion = "1.0.30.a" def mixinExtrasVersion = "0.2.0" def mixinVersion = "0.8.6-SNAPSHOT" diff --git a/src/main/java/argent_matter/gcyr/GCYRGTAddon.java b/src/main/java/argent_matter/gcyr/GCYRGTAddon.java index cfa1a19c..c9b2b276 100644 --- a/src/main/java/argent_matter/gcyr/GCYRGTAddon.java +++ b/src/main/java/argent_matter/gcyr/GCYRGTAddon.java @@ -10,13 +10,20 @@ import com.gregtechceu.gtceu.api.addon.GTAddon; import com.gregtechceu.gtceu.api.addon.IGTAddon; import com.gregtechceu.gtceu.api.addon.events.MaterialCasingCollectionEvent; +import com.gregtechceu.gtceu.api.data.chemical.material.event.PostMaterialEvent; +import com.gregtechceu.gtceu.api.data.chemical.material.properties.FluidProperty; +import com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey; import com.gregtechceu.gtceu.api.data.tag.TagPrefix; +import com.gregtechceu.gtceu.api.fluids.FluidBuilder; +import com.gregtechceu.gtceu.api.fluids.store.FluidStorageKeys; import com.gregtechceu.gtceu.api.registry.registrate.GTRegistrate; +import com.gregtechceu.gtceu.common.data.GTMaterials; import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.tags.BlockTags; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.material.MapColor; +import net.minecraftforge.eventbus.api.SubscribeEvent; import java.util.function.Consumer; diff --git a/src/main/java/argent_matter/gcyr/api/block/IFuelTankProperties.java b/src/main/java/argent_matter/gcyr/api/block/IFuelTankProperties.java index e921e285..d8fd8c26 100644 --- a/src/main/java/argent_matter/gcyr/api/block/IFuelTankProperties.java +++ b/src/main/java/argent_matter/gcyr/api/block/IFuelTankProperties.java @@ -16,5 +16,5 @@ public interface IFuelTankProperties extends StringRepresentable { /** * @return how much fuel this tank can store at maximum. */ - long getFuelStorage(); + int getFuelStorage(); } diff --git a/src/main/java/argent_matter/gcyr/api/block/impl/SimpleFuelTankProperties.java b/src/main/java/argent_matter/gcyr/api/block/impl/SimpleFuelTankProperties.java index 02205caa..206f4588 100644 --- a/src/main/java/argent_matter/gcyr/api/block/impl/SimpleFuelTankProperties.java +++ b/src/main/java/argent_matter/gcyr/api/block/impl/SimpleFuelTankProperties.java @@ -10,9 +10,9 @@ public class SimpleFuelTankProperties implements IFuelTankProperties { @Getter private final int tier; @Getter - private final long fuelStorage; + private final int fuelStorage; - public SimpleFuelTankProperties(String name, int tier, long fuelStorage) { + public SimpleFuelTankProperties(String name, int tier, int fuelStorage) { this.tier = tier; this.fuelStorage = fuelStorage; this.serializedName = name; diff --git a/src/main/java/argent_matter/gcyr/common/block/FuelTankBlock.java b/src/main/java/argent_matter/gcyr/common/block/FuelTankBlock.java index bad0a784..01941bdc 100644 --- a/src/main/java/argent_matter/gcyr/common/block/FuelTankBlock.java +++ b/src/main/java/argent_matter/gcyr/common/block/FuelTankBlock.java @@ -2,9 +2,9 @@ import argent_matter.gcyr.api.block.IFuelTankProperties; import argent_matter.gcyr.api.block.IRocketPart; -import com.lowdragmc.lowdraglib.side.fluid.FluidHelper; import lombok.Getter; import net.minecraft.world.level.block.RotatedPillarBlock; +import net.minecraftforge.fluids.FluidType; public class FuelTankBlock extends RotatedPillarBlock implements IRocketPart { @@ -22,9 +22,9 @@ public int getTier() { } public enum FuelTankProperties implements IFuelTankProperties { - BASIC("basic", 1, 5 * FluidHelper.getBucket()), - ADVANCED("advanced", 2, 7 * FluidHelper.getBucket()), - ELITE("elite", 3, 12 * FluidHelper.getBucket()), + BASIC("basic", 1, 5 * FluidType.BUCKET_VOLUME), + ADVANCED("advanced", 2, 7 * FluidType.BUCKET_VOLUME), + ELITE("elite", 3, 12 * FluidType.BUCKET_VOLUME), ; @Getter @@ -32,9 +32,9 @@ public enum FuelTankProperties implements IFuelTankProperties { @Getter private final int tier; @Getter - private final long fuelStorage; + private final int fuelStorage; - FuelTankProperties(String serializedName, int tier, long fuelStorage) { + FuelTankProperties(String serializedName, int tier, int fuelStorage) { this.tier = tier; this.fuelStorage = fuelStorage; this.serializedName = serializedName; diff --git a/src/main/java/argent_matter/gcyr/common/data/GCYRMachines.java b/src/main/java/argent_matter/gcyr/common/data/GCYRMachines.java index 4d339260..d5cf9ffd 100644 --- a/src/main/java/argent_matter/gcyr/common/data/GCYRMachines.java +++ b/src/main/java/argent_matter/gcyr/common/data/GCYRMachines.java @@ -28,13 +28,14 @@ import com.gregtechceu.gtceu.common.data.GTRecipeModifiers; import com.gregtechceu.gtceu.common.data.GTRecipeTypes; import com.gregtechceu.gtceu.config.ConfigHolder; -import com.lowdragmc.lowdraglib.side.fluid.FluidHelper; +import it.unimi.dsi.fastutil.ints.Int2IntFunction; import it.unimi.dsi.fastutil.ints.Int2LongFunction; import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.DoorBlock; import net.minecraft.world.level.block.state.properties.DoubleBlockHalf; +import net.minecraftforge.fluids.FluidType; import java.util.ArrayList; import java.util.List; @@ -44,7 +45,7 @@ import static argent_matter.gcyr.common.data.GCYRBlocks.*; import static com.gregtechceu.gtceu.api.GTValues.*; import static com.gregtechceu.gtceu.api.pattern.Predicates.*; -import static com.gregtechceu.gtceu.common.data.GCyMBlocks.CASING_ATOMIC; +import static com.gregtechceu.gtceu.common.data.GCYMBlocks.CASING_ATOMIC; import static com.gregtechceu.gtceu.common.data.GTBlocks.*; import static com.gregtechceu.gtceu.common.data.GTMachines.POWER_TRANSFORMER; import static com.gregtechceu.gtceu.utils.FormattingUtil.toEnglishName; @@ -54,7 +55,7 @@ public class GCYRMachines { public final static int[] ELECTRIC_TIERS = GTValues.tiersBetween(LV, GTCEuAPI.isHighTier() ? OpV : UV); public final static int[] LOW_TIERS = GTValues.tiersBetween(LV, EV); public final static int[] HIGH_TIERS = GTValues.tiersBetween(IV, GTCEuAPI.isHighTier() ? OpV : UHV); - public static final Int2LongFunction defaultTankSizeFunction = tier -> (tier <= GTValues.LV ? 8 : tier == GTValues.MV ? 12 : tier == GTValues.HV ? 16 : tier == GTValues.EV ? 32 : 64) * FluidHelper.getBucket(); + public static final Int2IntFunction defaultTankSizeFunction = tier -> (tier <= GTValues.LV ? 8 : tier == GTValues.MV ? 12 : tier == GTValues.HV ? 16 : tier == GTValues.EV ? 32 : 64) * FluidType.BUCKET_VOLUME; public final static MachineDefinition[] OXYGEN_SPREADER = registerTieredMachines("oxygen_spreader", OxygenSpreaderMachine::new, @@ -164,7 +165,7 @@ public class GCYRMachines { public static final MultiblockMachineDefinition DYSON_SYSTEM_CONTROLLER = REGISTRATE.multiblock("dyson_system_controller", DysonSystemControllerMachine::new) .rotationState(RotationState.NON_Y_AXIS) - .appearanceBlock(() -> CASING_ATOMIC.get()) // You MUST do it like this, so that the GTBlocks/GCyMBlocks class isn't loaded too early. Because that causes a crash. + .appearanceBlock(() -> CASING_ATOMIC.get()) // You MUST do it like this, so that the GTBlocks/GCYMBlocks class isn't loaded too early. Because that causes a crash. .recipeType(GCYRRecipeTypes.DYSON_ENERGY_RECIPES) .tier(GTValues.UV) .pattern(definition -> FactoryBlockPattern.start() @@ -253,7 +254,7 @@ public class GCYRMachines { public static MachineDefinition[] registerSimpleMachines(String name, GTRecipeType recipeType, - Int2LongFunction tankScalingFunction, + Int2IntFunction tankScalingFunction, int... tiers) { return registerTieredMachines(name, (holder, tier) -> new SimpleTieredMachine(holder, tier, tankScalingFunction), (tier, builder) -> builder .langValue("%s %s %s".formatted(VLVH[tier], toEnglishName(name), VLVT[tier])) @@ -267,7 +268,7 @@ public static MachineDefinition[] registerSimpleMachines(String name, .register(), tiers); } - public static MachineDefinition[] registerSimpleMachines(String name, GTRecipeType recipeType, Int2LongFunction tankScalingFunction) { + public static MachineDefinition[] registerSimpleMachines(String name, GTRecipeType recipeType, Int2IntFunction tankScalingFunction) { return registerSimpleMachines(name, recipeType, tankScalingFunction, ELECTRIC_TIERS); } diff --git a/src/main/java/argent_matter/gcyr/common/data/GCYRMaterials.java b/src/main/java/argent_matter/gcyr/common/data/GCYRMaterials.java index 039a6b2f..08a6bdf7 100644 --- a/src/main/java/argent_matter/gcyr/common/data/GCYRMaterials.java +++ b/src/main/java/argent_matter/gcyr/common/data/GCYRMaterials.java @@ -9,6 +9,7 @@ import com.gregtechceu.gtceu.api.fluids.FluidBuilder; import com.gregtechceu.gtceu.api.fluids.attribute.FluidAttributes; import com.gregtechceu.gtceu.api.fluids.store.FluidStorageKeys; +import com.gregtechceu.gtceu.common.data.GTMaterials; import static com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialFlags.*; import static com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialFlags.GENERATE_PLATE; @@ -27,6 +28,8 @@ public static void modifyMaterials() { IronMagnetic.addFlags(GENERATE_FOIL); TitaniumTungstenCarbide.addFlags(GENERATE_ROD); Titanium.setProperty(PropertyKey.ORE, new OreProperty()); + + GTMaterials.Hydrogen.getProperty(PropertyKey.FLUID).enqueueRegistration(FluidStorageKeys.PLASMA, new FluidBuilder()); } //region first degree mats diff --git a/src/main/java/argent_matter/gcyr/common/entity/RocketEntity.java b/src/main/java/argent_matter/gcyr/common/entity/RocketEntity.java index e0e8795e..3d462142 100644 --- a/src/main/java/argent_matter/gcyr/common/entity/RocketEntity.java +++ b/src/main/java/argent_matter/gcyr/common/entity/RocketEntity.java @@ -28,10 +28,12 @@ import com.gregtechceu.gtceu.api.capability.recipe.FluidRecipeCapability; import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.api.gui.UITemplate; +import com.gregtechceu.gtceu.api.gui.widget.TankWidget; import com.gregtechceu.gtceu.api.item.ComponentItem; import com.gregtechceu.gtceu.api.item.component.IItemComponent; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.RecipeHelper; +import com.gregtechceu.gtceu.api.transfer.fluid.CustomFluidTank; import com.lowdragmc.lowdraglib.gui.modular.IUIHolder; import com.lowdragmc.lowdraglib.gui.modular.ModularUI; import com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup; @@ -40,10 +42,7 @@ import com.lowdragmc.lowdraglib.gui.widget.ButtonWidget; import com.lowdragmc.lowdraglib.gui.widget.LabelWidget; import com.lowdragmc.lowdraglib.gui.widget.SlotWidget; -import com.lowdragmc.lowdraglib.gui.widget.TankWidget; -import com.lowdragmc.lowdraglib.misc.FluidStorage; import com.lowdragmc.lowdraglib.misc.ItemStackTransfer; -import com.lowdragmc.lowdraglib.side.fluid.FluidStack; import com.mojang.datafixers.util.Pair; import it.unimi.dsi.fastutil.objects.Object2BooleanMap; import it.unimi.dsi.fastutil.objects.Object2BooleanOpenHashMap; @@ -90,6 +89,8 @@ import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.Vec3; import net.minecraftforge.entity.IEntityAdditionalSpawnData; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.network.NetworkHooks; import javax.annotation.Nullable; @@ -104,8 +105,8 @@ public class RocketEntity extends Entity implements HasCustomInventoryScreen, IU // protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(RocketEntity.class); public static final EntityDataAccessor ROCKET_STARTED = SynchedEntityData.defineId(RocketEntity.class, EntityDataSerializers.BOOLEAN); - public static final EntityDataAccessor FUEL_CAPACITY = SynchedEntityData.defineId(RocketEntity.class, GCYREntityDataSerializers.LONG); - public static final EntityDataAccessor FUEL_AMOUNT = SynchedEntityData.defineId(RocketEntity.class, GCYREntityDataSerializers.LONG); + public static final EntityDataAccessor FUEL_CAPACITY = SynchedEntityData.defineId(RocketEntity.class, EntityDataSerializers.INT); + public static final EntityDataAccessor FUEL_AMOUNT = SynchedEntityData.defineId(RocketEntity.class, EntityDataSerializers.INT); public static final EntityDataAccessor THRUSTER_COUNT = SynchedEntityData.defineId(RocketEntity.class, EntityDataSerializers.INT); public static final EntityDataAccessor WEIGHT = SynchedEntityData.defineId(RocketEntity.class, EntityDataSerializers.INT); public static final EntityDataAccessor RECIPE_DURATION = SynchedEntityData.defineId(RocketEntity.class, EntityDataSerializers.INT); @@ -118,7 +119,7 @@ public class RocketEntity extends Entity implements HasCustomInventoryScreen, IU // @Getter // private final FieldManagedStorage syncStorage = new FieldManagedStorage(this); - private final FluidStorage fuelTank; + private final CustomFluidTank fuelTank; private final ItemStackTransfer configSlot, satelliteSlot; private boolean destinationIsSpaceStation; private final Object2IntMap partCounts = new Object2IntOpenHashMap<>(); @@ -140,9 +141,10 @@ public RocketEntity(EntityType entityType, Level level) { this.satelliteSlot = new ItemStackTransfer(1); this.satelliteSlot.setFilter(stack -> GCYRItems.SPACE_STATION_PACKAGE.isIn(stack) || stack.is(GCYRTags.SATELLITES)); - this.fuelTank = new FluidStorage(0, fluid -> FUEL_CACHE.computeIfAbsent(fluid.getFluid(), f -> { + this.fuelTank = new CustomFluidTank(0, fluid -> FUEL_CACHE.computeIfAbsent(fluid.getFluid(), f-> { return this.getServer().getRecipeManager().getAllRecipesFor(GCYRRecipeTypes.ROCKET_FUEL_RECIPES).stream().anyMatch(recipe -> { - if (RecipeHelper.getInputEUt(recipe) > motorTier) return false; // don't allow > motor tier fuels to be used. + if (RecipeHelper.getInputEUt(recipe) > motorTier) + return false; // don't allow > motor tier fuels to be used. var list = recipe.inputs.getOrDefault(FluidRecipeCapability.CAP, Collections.emptyList()); if (!list.isEmpty()) { @@ -383,10 +385,10 @@ public void rotateRocket() { } } - public long computeRequiredFuelAmountForDestination(@Nullable Planet destination) { + public int computeRequiredFuelAmountForDestination(@Nullable Planet destination) { Planet current = PlanetData.getPlanetFromLevelOrOrbit(this.level().dimension()).orElse(null); if (current == null || destination == null) { - return (long) (this.getFuelCapacity() * 0.85); + return (int)(this.getFuelCapacity() * 0.85); } else if (destination.parentWorld() == current.level() || current.parentWorld() == destination.level() || current == destination) { return GCYRConfig.INSTANCE.rocket.moonFuelAmount; } else if (current.solarSystem().equals(destination.solarSystem())) { @@ -549,7 +551,7 @@ private boolean consumeFuel() { } var drain = (getThrusterCount() + destinationRocketTier) / (recipeDuration / 20.0 + 1) * 2; - var ldrain = (long)drain; + var ldrain = (int)drain; // estimate fuel consumption client side; client needs to know if // it should run the flight tick and if it should slow down in fall(), @@ -559,8 +561,8 @@ private boolean consumeFuel() { return (fuelAmount - ldrain) > 0; } - if (!this.fuelTank.drain(ldrain, true).isEmpty()) { - return !this.fuelTank.drain(ldrain, false).isEmpty(); + if (!this.fuelTank.drain(ldrain, IFluidHandler.FluidAction.SIMULATE).isEmpty()) { + return !this.fuelTank.drain(ldrain, IFluidHandler.FluidAction.EXECUTE).isEmpty(); } return false; } @@ -596,7 +598,7 @@ private void goToDestination() { ResourceKey destinationDim = this.destinationIsSpaceStation ? getDestination().orbitWorld() : getDestination().level(); // Go to a random valid planet if rocket doesn't have enough fuel to get to actual destination somehow. - if (this.fuelTank.drain(computeRequiredFuelAmountForDestination(this.getDestination()) / 3, true).isEmpty()) { + if (this.fuelTank.drain(computeRequiredFuelAmountForDestination(this.getDestination()) / 3, IFluidHandler.FluidAction.SIMULATE).isEmpty()) { List validPlanets = new ArrayList<>(); for (Planet planet : PlanetData.planets().values()) { if (planet.solarSystem().equals(this.getDestination().solarSystem())) { @@ -794,11 +796,11 @@ public boolean canBeCollidedWith() { return true; } - public long getFuelCapacity() { + public int getFuelCapacity() { return this.entityData.get(FUEL_CAPACITY); } - public void setFuelCapacity(long fuelCapacity) { + public void setFuelCapacity(int fuelCapacity) { this.entityData.set(FUEL_CAPACITY, fuelCapacity); this.reinitializeFluidStorage(); } @@ -945,12 +947,12 @@ public double getRocketSpeed() { @Override protected void defineSynchedData() { this.entityData.define(ROCKET_STARTED, false); - this.entityData.define(FUEL_CAPACITY, 0L); + this.entityData.define(FUEL_CAPACITY, 0); this.entityData.define(THRUSTER_COUNT, 0); this.entityData.define(WEIGHT, 0); this.entityData.define(RECIPE_DURATION, 0); this.entityData.define(START_TIMER, 0); - this.entityData.define(FUEL_AMOUNT, 0L); + this.entityData.define(FUEL_AMOUNT, 0); this.entityData.define(POSITIONED_STATES, new ArrayList<>()); this.entityData.define(SEAT_POSITIONS, new ArrayList<>()); this.entityData.define(SIZE, BlockPos.ZERO); @@ -965,8 +967,8 @@ protected void readAdditionalSaveData(CompoundTag compound) { this.addBlock(PosWithState.readFromTag(blocks.getCompound(i))); } - this.setFuelCapacity(compound.getLong("fuelCapacity")); - this.fuelTank.setFluid(FluidStack.loadFromTag(compound.getCompound("fuel"))); + this.setFuelCapacity(compound.getInt("fuelCapacity")); + this.fuelTank.setFluid(FluidStack.loadFluidStackFromNBT(compound.getCompound("fuel"))); this.configSlot.deserializeNBT(compound.getCompound("config")); this.returnToStart = compound.getBoolean("returnToStart"); if (compound.contains("satelliteToLaunch")) { @@ -995,7 +997,7 @@ protected void addAdditionalSaveData(CompoundTag compound) { compound.putLong("fuelCapacity", this.getFuelCapacity()); CompoundTag fuel = new CompoundTag(); - fuelTank.getFluid().saveToTag(fuel); + fuelTank.getFluid().writeToNBT(fuel); compound.put("fuel", fuel); compound.put("config", this.configSlot.serializeNBT()); compound.putBoolean("returnToStart", this.returnToStart); diff --git a/src/main/java/argent_matter/gcyr/common/item/armor/SpaceSuitArmorItem.java b/src/main/java/argent_matter/gcyr/common/item/armor/SpaceSuitArmorItem.java index 1555cc6e..99208d2b 100644 --- a/src/main/java/argent_matter/gcyr/common/item/armor/SpaceSuitArmorItem.java +++ b/src/main/java/argent_matter/gcyr/common/item/armor/SpaceSuitArmorItem.java @@ -4,10 +4,6 @@ import argent_matter.gcyr.data.recipe.GCYRTags; import com.google.common.primitives.Ints; import com.lowdragmc.lowdraglib.misc.ItemStackTransfer; -import com.lowdragmc.lowdraglib.side.fluid.FluidHelper; -import com.lowdragmc.lowdraglib.side.fluid.FluidStack; -import com.lowdragmc.lowdraglib.side.fluid.FluidTransferHelper; -import com.lowdragmc.lowdraglib.side.fluid.IFluidTransfer; import net.minecraft.network.chat.Component; import net.minecraft.util.valueproviders.UniformInt; import net.minecraft.world.entity.EquipmentSlot; @@ -20,6 +16,9 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.util.LazyOptional; +import net.minecraftforge.fluids.FluidType; +import net.minecraftforge.fluids.FluidUtil; +import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.templates.FluidHandlerItemStack; import org.jetbrains.annotations.Nullable; @@ -27,7 +26,7 @@ import java.util.List; public class SpaceSuitArmorItem extends ArmorItem { - public static final long CAPACITY = 16 * FluidHelper.getBucket(); + public static final long CAPACITY = 16 * FluidType.BUCKET_VOLUME; public SpaceSuitArmorItem(ArmorItem.Type type, Properties properties) { super(GCYRArmorMaterials.SPACE, type, properties); @@ -59,10 +58,7 @@ public int getBarColor(ItemStack stack) { public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltip, TooltipFlag isAdvanced) { tooltip.add(Component.translatable("tooltip.gcyr.spacesuit")); if (stack.is(Tags.Items.ARMORS_CHESTPLATES)) { - IFluidTransfer transfer = FluidTransferHelper.getFluidTransfer(new ItemStackTransfer(stack), 0); - if (transfer != null) { - tooltip.add(Component.translatable("tooltip.gcyr.spacesuit.stored", transfer.getFluidInTank(0).getAmount(), transfer.getTankCapacity(0))); - } + FluidUtil.getFluidHandler(stack).ifPresent(h -> tooltip.add(Component.translatable("tooltip.gcyr.spacesuit.stored", h.getFluidInTank(0).getAmount(), h.getTankCapacity(0)))); } } @@ -95,11 +91,7 @@ public static long oxygenAmount(LivingEntity entity) { public static long oxygenAmount(ItemStack stack) { if (stack.getItem() instanceof SpaceSuitArmorItem || stack.hasTag() && stack.getTag().getBoolean(SmithingSpaceSuitRecipe.SPACE_SUIT_ARMOR_KEY)) { - var storage = new ItemStackTransfer(stack); - var fluid = FluidTransferHelper.getFluidTransfer(storage, 0); - if (fluid != null) { - return fluid.getFluidInTank(0).getAmount(); - } + return FluidUtil.getFluidHandler(stack).map(h -> h.getFluidInTank(0).getAmount()).orElse(0); } return 0; } @@ -111,10 +103,7 @@ public static long oxygenMax(LivingEntity entity) { public static long oxygenMax(ItemStack stack) { if (stack.getItem() instanceof SpaceSuitArmorItem || stack.hasTag() && stack.getTag().getBoolean(SmithingSpaceSuitRecipe.SPACE_SUIT_ARMOR_KEY)) { - var fluid = FluidTransferHelper.getFluidTransfer(new ItemStackTransfer(stack), 0); - if (fluid != null) { - return fluid.getTankCapacity(0); - } + return FluidUtil.getFluidHandler(stack).map(h -> h.getTankCapacity(0)).orElse(0); } return 0; } @@ -123,8 +112,8 @@ public static void consumeSpaceSuitOxygen(LivingEntity entity, int amount) { ItemStack chest = entity.getItemBySlot(EquipmentSlot.CHEST); if (chest.getItem() instanceof SpaceSuitArmorItem || chest.hasTag() && chest.getTag().getBoolean(SmithingSpaceSuitRecipe.SPACE_SUIT_ARMOR_KEY)) { var storage = new ItemStackTransfer(chest); - var fluid = FluidTransferHelper.getFluidTransfer(storage, 0); - fluid.drain(FluidStack.create(fluid.getFluidInTank(0), amount), false, true); + FluidUtil.getFluidHandler(storage.getStackInSlot(0)) + .ifPresent(h -> h.drain(amount, IFluidHandler.FluidAction.EXECUTE)); } } diff --git a/src/main/java/argent_matter/gcyr/common/machine/electric/OxygenSpreaderMachine.java b/src/main/java/argent_matter/gcyr/common/machine/electric/OxygenSpreaderMachine.java index 95e74ed4..cf7f4c2c 100644 --- a/src/main/java/argent_matter/gcyr/common/machine/electric/OxygenSpreaderMachine.java +++ b/src/main/java/argent_matter/gcyr/common/machine/electric/OxygenSpreaderMachine.java @@ -6,17 +6,17 @@ import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.api.machine.SimpleTieredMachine; import com.gregtechceu.gtceu.api.recipe.ingredient.FluidIngredient; -import com.lowdragmc.lowdraglib.side.fluid.FluidHelper; import net.minecraft.core.BlockPos; import net.minecraft.core.particles.DustParticleOptions; +import net.minecraftforge.fluids.FluidType; import org.joml.Vector3f; import java.util.Set; public class OxygenSpreaderMachine extends SimpleTieredMachine { - public static long tankScalingFunction(int tier) { - return tier * 4 * FluidHelper.getBucket(); + public static int tankScalingFunction(int tier) { + return tier * 4 * FluidType.BUCKET_VOLUME; } public OxygenSpreaderMachine(IMachineBlockEntity holder, int tier, Object... args) { @@ -30,7 +30,7 @@ public void afterWorking() { } public boolean canDistribute(int oxygenBlocks) { - return ((FluidIngredient)recipeLogic.getLastRecipe().getInputContents(FluidRecipeCapability.CAP).get(0).content).getAmount() / FluidHelper.getBucket() >= oxygenBlocks; + return ((FluidIngredient)recipeLogic.getLastRecipe().getInputContents(FluidRecipeCapability.CAP).get(0).content).getAmount() / FluidType.BUCKET_VOLUME >= oxygenBlocks; } public void runAlgorithm() { diff --git a/src/main/java/argent_matter/gcyr/config/GCYRConfig.java b/src/main/java/argent_matter/gcyr/config/GCYRConfig.java index 0996e660..748e0d00 100644 --- a/src/main/java/argent_matter/gcyr/config/GCYRConfig.java +++ b/src/main/java/argent_matter/gcyr/config/GCYRConfig.java @@ -1,11 +1,11 @@ package argent_matter.gcyr.config; import argent_matter.gcyr.GCYR; -import com.lowdragmc.lowdraglib.side.fluid.FluidHelper; import dev.toma.configuration.Configuration; import dev.toma.configuration.config.Config; import dev.toma.configuration.config.Configurable; import dev.toma.configuration.config.format.ConfigFormats; +import net.minecraftforge.fluids.FluidType; @Config(id = GCYR.MOD_ID) public class GCYRConfig { @@ -71,16 +71,16 @@ public static class MachineConfigs { public static class RocketConfigs { @Configurable @Configurable.Comment({"How much fuel is required to travel to a moon or back?", "Default: 8 buckets."}) - public long moonFuelAmount = 8 * FluidHelper.getBucket(); + public int moonFuelAmount = 8 * FluidType.BUCKET_VOLUME; @Configurable @Configurable.Comment({"How much fuel is required to travel to a planet in the same solar system?", "Default: 14 buckets."}) - public long solarSystemFuelAmount = 14 * FluidHelper.getBucket(); + public int solarSystemFuelAmount = 14 * FluidType.BUCKET_VOLUME; @Configurable @Configurable.Comment({"How much fuel is required to travel to a planet in the same galaxy?", "Default: 26 buckets."}) - public long galaxyFuelAmount = 26 * FluidHelper.getBucket(); + public int galaxyFuelAmount = 26 * FluidType.BUCKET_VOLUME; @Configurable @Configurable.Comment({"How much fuel is required to travel to a planet anywhere?", "Default: 48 buckets."}) - public long anywhereFuelAmount = 48 * FluidHelper.getBucket(); + public int anywhereFuelAmount = 48 * FluidType.BUCKET_VOLUME; @Configurable @Configurable.Comment({"Do rockets explode if landing is executed improperly?", "Default: true."}) public boolean doCrashLandingExplosion = true; diff --git a/src/main/java/argent_matter/gcyr/data/recipe/MiscRecipes.java b/src/main/java/argent_matter/gcyr/data/recipe/MiscRecipes.java index b15432d1..11e1aed4 100644 --- a/src/main/java/argent_matter/gcyr/data/recipe/MiscRecipes.java +++ b/src/main/java/argent_matter/gcyr/data/recipe/MiscRecipes.java @@ -29,7 +29,7 @@ public class MiscRecipes { public static void init(Consumer provider) { VanillaRecipeHelper.addShapedRecipe(provider, true, GCYR.id("casing_atomic"), - GCyMBlocks.CASING_ATOMIC.asStack(2), + GCYMBlocks.CASING_ATOMIC.asStack(2), "PhP", "PFP", "PwP", 'P', new UnificationEntry(TagPrefix.plateDouble, GCYRMaterials.Trinaquadalloy), 'F', new UnificationEntry(TagPrefix.frameGt, GTMaterials.NaquadahAlloy)); @@ -38,7 +38,7 @@ public static void init(Consumer provider) { .inputItems(TagPrefix.plateDouble, GCYRMaterials.Trinaquadalloy, 6) .inputItems(TagPrefix.frameGt, GTMaterials.NaquadahAlloy) .circuitMeta(6) - .outputItems(GCyMBlocks.CASING_ATOMIC.asStack(2)) + .outputItems(GCYMBlocks.CASING_ATOMIC.asStack(2)) .duration(50).EUt(16).save(provider); VanillaRecipeHelper.addShapelessRecipe(provider, GCYR.id("id_chip"), GCYRItems.ID_CHIP.asStack(), @@ -123,7 +123,7 @@ public static void init(Consumer provider) { MetaTileEntityLoader.registerMachineRecipe(provider, GCYRMachines.OXYGEN_SPREADER, "PCP", "FHF", "PCP", 'H', HULL, 'P', PUMP, 'F', GTItems.FLUID_FILTER, 'C', CIRCUIT); VanillaRecipeHelper.addShapedRecipe(provider, GCYR.id("rocket_scanner"), GCYRMachines.ROCKET_SCANNER.asStack(), "PCP", "CHC", "SCS", 'H', GTMachines.HULL[EV].asStack(), 'P', GCYRBlocks.LAUNCH_PAD.asStack(), 'C', CustomTags.EV_CIRCUITS, 'S', new UnificationEntry(plate, Titanium)); VanillaRecipeHelper.addShapedRecipe(provider, GCYR.id("space_station_packager"), GCYRMachines.SPACE_STATION_PACKAGER.asStack(), "PCP", "FHF", "PCP", 'H', GTMachines.HULL[LuV].asStack(), 'P', new UnificationEntry(frameGt, StainlessSteel), 'C', CustomTags.LuV_CIRCUITS, 'F', GTBlocks.PLASTCRETE.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, GCYR.id("dyson_system_controller"), GCYRMachines.DYSON_SYSTEM_CONTROLLER.asStack(), "PCP", "FHF", "PCP", 'H', GTMachines.HULL[UHV].asStack(), 'P', new UnificationEntry(plate, Darmstadtium), 'C', CustomTags.UHV_CIRCUITS, 'F', GCyMBlocks.CASING_ATOMIC.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, GCYR.id("dyson_system_controller"), GCYRMachines.DYSON_SYSTEM_CONTROLLER.asStack(), "PCP", "FHF", "PCP", 'H', GTMachines.HULL[UHV].asStack(), 'P', new UnificationEntry(plate, Darmstadtium), 'C', CustomTags.UHV_CIRCUITS, 'F', GCYMBlocks.CASING_ATOMIC.asStack()); VanillaRecipeHelper.addShapedRecipe(provider, GCYR.id("space_elevator"), GCYRMachines.SPACE_ELEVATOR.asStack(), "FFF", "PHP", "PCP", 'H', GTCEuAPI.isHighTier() ? GTMachines.HULL[UEV].asStack() : GTMachines.HULL[UHV].asStack(), 'F', new UnificationEntry(plateDense, Trinaquadalloy), 'C', CustomTags.UHV_CIRCUITS, 'P', GTBlocks.CASING_TUNGSTENSTEEL_ROBUST.asStack()); //endregion diff --git a/src/main/java/argent_matter/gcyr/integration/kjs/builders/FuelTankBlockBuilder.java b/src/main/java/argent_matter/gcyr/integration/kjs/builders/FuelTankBlockBuilder.java index 1a45bea0..fe8717a6 100644 --- a/src/main/java/argent_matter/gcyr/integration/kjs/builders/FuelTankBlockBuilder.java +++ b/src/main/java/argent_matter/gcyr/integration/kjs/builders/FuelTankBlockBuilder.java @@ -14,7 +14,7 @@ public class FuelTankBlockBuilder extends BlockBuilder { @Setter public transient int tier; @Setter - public transient long fuelStorage; + public transient int fuelStorage; @Setter public transient String typeId = ""; diff --git a/src/main/java/argent_matter/gcyr/integration/kjs/builders/RocketMotorBlockBuilder.java b/src/main/java/argent_matter/gcyr/integration/kjs/builders/RocketMotorBlockBuilder.java index 0c6971de..0ad881fa 100644 --- a/src/main/java/argent_matter/gcyr/integration/kjs/builders/RocketMotorBlockBuilder.java +++ b/src/main/java/argent_matter/gcyr/integration/kjs/builders/RocketMotorBlockBuilder.java @@ -14,7 +14,7 @@ public class RocketMotorBlockBuilder extends BlockBuilder { @Setter public transient int tier = 0; @Setter - public transient long fuelStorage = 0; + public transient int fuelStorage = 0; @Setter public transient String typeId = "";