diff --git a/.gitignore b/.gitignore index 8965a94e..94b16076 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,4 @@ forge*changelog.txt /.vscode/ /old.7z /.architectury-transformer/ +.DS_Store diff --git a/build.gradle b/build.gradle index e034732d..01f162db 100644 --- a/build.gradle +++ b/build.gradle @@ -20,7 +20,7 @@ subprojects { minecraft "com.mojang:minecraft:$mc_version" mappings loom.officialMojangMappings() - modApi "earth.terrarium:botarium-$name-1.20:$botarium_version" + modApi "earth.terrarium.botarium:botarium-$name-1.20.1:$botarium_version" } } diff --git a/common/src/main/java/com/teamresourceful/resourcefulbees/client/component/SelectableFluidWidget.java b/common/src/main/java/com/teamresourceful/resourcefulbees/client/component/SelectableFluidWidget.java index 5420e365..60099a9e 100644 --- a/common/src/main/java/com/teamresourceful/resourcefulbees/client/component/SelectableFluidWidget.java +++ b/common/src/main/java/com/teamresourceful/resourcefulbees/client/component/SelectableFluidWidget.java @@ -8,9 +8,9 @@ import com.teamresourceful.resourcefulbees.common.util.containers.SelectableFluidContainer; import com.teamresourceful.resourcefullib.client.utils.ScreenUtils; import com.teamresourceful.resourcefullib.common.collections.SelectableList; +import earth.terrarium.botarium.common.fluid.FluidConstants; import earth.terrarium.botarium.common.fluid.base.FluidHolder; import earth.terrarium.botarium.common.fluid.utils.ClientFluidHooks; -import earth.terrarium.botarium.common.fluid.utils.FluidHooks; import net.minecraft.ChatFormatting; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.AbstractWidget; @@ -70,7 +70,7 @@ public void renderToolTip() { line = Component.literal(" ○ ").withStyle(ChatFormatting.DARK_GRAY); } line = line.append(Component.empty().withStyle(ChatFormatting.RESET).append(ClientFluidHooks.getDisplayName(tankFluid))); - line = line.append(Component.literal(" " + FluidHooks.toMillibuckets(tankFluid.getFluidAmount()) + "mb").withStyle(ChatFormatting.RESET)); + line = line.append(Component.literal(" " + FluidConstants.toMillibuckets(tankFluid.getFluidAmount()) + "mb").withStyle(ChatFormatting.RESET)); tooltip.add(line); } } diff --git a/common/src/main/java/com/teamresourceful/resourcefulbees/client/screen/EnderBeeconScreen.java b/common/src/main/java/com/teamresourceful/resourcefulbees/client/screen/EnderBeeconScreen.java index 62356850..d8e9b89e 100644 --- a/common/src/main/java/com/teamresourceful/resourcefulbees/client/screen/EnderBeeconScreen.java +++ b/common/src/main/java/com/teamresourceful/resourcefulbees/client/screen/EnderBeeconScreen.java @@ -9,9 +9,9 @@ import com.teamresourceful.resourcefulbees.common.menus.EnderBeeconMenu; import com.teamresourceful.resourcefulbees.common.networking.NetworkHandler; import com.teamresourceful.resourcefulbees.common.networking.packets.client.BeeconChangePacket; +import earth.terrarium.botarium.common.fluid.FluidConstants; import earth.terrarium.botarium.common.fluid.base.FluidHolder; import earth.terrarium.botarium.common.fluid.utils.ClientFluidHooks; -import earth.terrarium.botarium.common.fluid.utils.FluidHooks; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.AbstractSliderButton; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; @@ -105,7 +105,7 @@ protected void renderLabels(@NotNull GuiGraphics graphics, int mouseX, int mouse graphics.drawString(font, BeeconTranslations.FLUID_LABEL, 110, 56, 14737632); graphics.drawString(font, holder.isEmpty() ? BeeconTranslations.NO_FLUID_LABEL : ClientFluidHooks.getDisplayName(holder), 137, 56, 16751628); graphics.drawString(font, BeeconTranslations.FLUID_AMOUNT_LABEL, 110, 68, 14737632); - graphics.drawString(font, FluidHooks.toMillibuckets(holder.getFluidAmount()) +"mB", 148, 68, 47104); + graphics.drawString(font, FluidConstants.toMillibuckets(holder.getFluidAmount()) +"mB", 148, 68, 47104); } @Override diff --git a/common/src/main/java/com/teamresourceful/resourcefulbees/client/screen/HoneyGeneratorScreen.java b/common/src/main/java/com/teamresourceful/resourcefulbees/client/screen/HoneyGeneratorScreen.java index 5de537c6..32450bc1 100644 --- a/common/src/main/java/com/teamresourceful/resourcefulbees/client/screen/HoneyGeneratorScreen.java +++ b/common/src/main/java/com/teamresourceful/resourcefulbees/client/screen/HoneyGeneratorScreen.java @@ -8,9 +8,9 @@ import com.teamresourceful.resourcefulbees.common.util.MathUtils; import com.teamresourceful.resourcefullib.client.CloseablePoseStack; import earth.terrarium.botarium.common.energy.base.EnergyContainer; +import earth.terrarium.botarium.common.fluid.FluidConstants; import earth.terrarium.botarium.common.fluid.base.FluidHolder; import earth.terrarium.botarium.common.fluid.utils.ClientFluidHooks; -import earth.terrarium.botarium.common.fluid.utils.FluidHooks; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.screens.Screen; @@ -51,7 +51,7 @@ protected void renderBg(@NotNull GuiGraphics graphics, float partialTicks, int m graphics.drawString(this.font, "Fluid: ", 57, 22, 0xffffff); graphics.drawString(this.font, holder.isEmpty() ? GuiTranslations.NO_FLUID : ClientFluidHooks.getDisplayName(holder), 61, 32, 0xffffff); graphics.drawString(this.font, "Amount: ", 57, 42, 0xffffff); - graphics.drawString(this.font, FluidHooks.toMillibuckets(holder.getFluidAmount()) + "mB", 61, 52, 0xffffff); + graphics.drawString(this.font, FluidConstants.toMillibuckets(holder.getFluidAmount()) + "mB", 61, 52, 0xffffff); } } } @@ -84,9 +84,9 @@ public void renderFluidTooltip(int mouseX, int mouseY) { if (MathUtils.inRangeInclusive(mouseX, this.leftPos + 28, this.leftPos + 40) && MathUtils.inRangeInclusive(mouseY, this.topPos + 16, this.topPos + 70)) { FluidHolder holder = this.menu.getEntity().getFluid(); if (Screen.hasShiftDown() || holder.getFluidAmount() < 500) { - setTooltipForNextRenderPass(Component.literal(FluidHooks.toMillibuckets(holder.getFluidAmount()) + " MB")); + setTooltipForNextRenderPass(Component.literal(FluidConstants.toMillibuckets(holder.getFluidAmount()) + " MB")); } else { - setTooltipForNextRenderPass(Component.literal(TextUtils.NUMBER_FORMAT.format((double) holder.getFluidAmount() / FluidHooks.getBucketAmount()) + " Buckets")); + setTooltipForNextRenderPass(Component.literal(TextUtils.NUMBER_FORMAT.format((double) holder.getFluidAmount() / FluidConstants.getBucketAmount()) + " Buckets")); } } } diff --git a/common/src/main/java/com/teamresourceful/resourcefulbees/client/screen/HoneyPotScreen.java b/common/src/main/java/com/teamresourceful/resourcefulbees/client/screen/HoneyPotScreen.java index e96a00ee..b9184c92 100644 --- a/common/src/main/java/com/teamresourceful/resourcefulbees/client/screen/HoneyPotScreen.java +++ b/common/src/main/java/com/teamresourceful/resourcefulbees/client/screen/HoneyPotScreen.java @@ -5,9 +5,9 @@ import com.teamresourceful.resourcefulbees.common.lib.constants.translations.GuiTranslations; import com.teamresourceful.resourcefulbees.common.menus.HoneyPotMenu; import com.teamresourceful.resourcefulbees.common.util.MathUtils; +import earth.terrarium.botarium.common.fluid.FluidConstants; import earth.terrarium.botarium.common.fluid.base.FluidHolder; import earth.terrarium.botarium.common.fluid.utils.ClientFluidHooks; -import earth.terrarium.botarium.common.fluid.utils.FluidHooks; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; @@ -36,9 +36,9 @@ protected void renderBg(@NotNull GuiGraphics graphics, float partialTicks, int x graphics.drawString(this.font, "Fluid: ",this.leftPos + 36, this.topPos + 17, 0xffffff); graphics.drawString(this.font, holder.isEmpty() ? GuiTranslations.NO_FLUID : ClientFluidHooks.getDisplayName(holder), this.leftPos + 40, this.topPos + 27, 0xffffff); graphics.drawString(this.font, "Amount: ",this.leftPos + 36, this.topPos + 37, 0xffffff); - graphics.drawString(this.font, FluidHooks.toMillibuckets(holder.getFluidAmount())+"mB",this.leftPos + 40, this.topPos + 47, 0xffffff); + graphics.drawString(this.font, FluidConstants.toMillibuckets(holder.getFluidAmount())+"mB",this.leftPos + 40, this.topPos + 47, 0xffffff); - int height = (int) ((holder.getFluidAmount() / FluidHooks.buckets(64)) * 54); + int height = (int) ((holder.getFluidAmount() / FluidConstants.fromMillibuckets(64000)) * 54); ClientRenderUtils.drawFluid(graphics, height, 12, holder, this.leftPos+129, this.topPos+16); } @@ -64,10 +64,10 @@ public void render(@NotNull GuiGraphics graphics, int mouseX, int mouseY, float private Component getMillibuckets(long fluidAmount) { - return Component.literal(FluidHooks.toMillibuckets(fluidAmount) + "mB"); + return Component.literal(FluidConstants.toMillibuckets(fluidAmount) + "mB"); } private Component getBuckets(long fluidAmount) { - return Component.literal(((double) fluidAmount / FluidHooks.getBucketAmount()) + "B"); + return Component.literal(((double) fluidAmount / FluidConstants.getBucketAmount()) + "B"); } } diff --git a/common/src/main/java/com/teamresourceful/resourcefulbees/client/screen/SolidificationChamberScreen.java b/common/src/main/java/com/teamresourceful/resourcefulbees/client/screen/SolidificationChamberScreen.java index c614b22f..2d71115f 100644 --- a/common/src/main/java/com/teamresourceful/resourcefulbees/client/screen/SolidificationChamberScreen.java +++ b/common/src/main/java/com/teamresourceful/resourcefulbees/client/screen/SolidificationChamberScreen.java @@ -5,8 +5,8 @@ import com.teamresourceful.resourcefulbees.common.lib.constants.ModConstants; import com.teamresourceful.resourcefulbees.common.menus.SolidificationChamberMenu; import com.teamresourceful.resourcefulbees.common.util.MathUtils; +import earth.terrarium.botarium.common.fluid.FluidConstants; import earth.terrarium.botarium.common.fluid.base.FluidHolder; -import earth.terrarium.botarium.common.fluid.utils.FluidHooks; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; @@ -33,7 +33,7 @@ protected void renderBg(@NotNull GuiGraphics graphics, float partialTicks, int m int j = this.topPos; graphics.blit(texture, i, j, 0, 0, this.imageWidth, this.imageHeight); FluidHolder holder = tileEntity.getFluid(); - int height = (int) ((holder.getFluidAmount() / FluidHooks.buckets(16)) * 62); + int height = (int) ((holder.getFluidAmount() / FluidConstants.fromMillibuckets(16000)) * 62); ClientRenderUtils.drawFluid(graphics, height, 14, holder, i + 67, j + 12+(62-height)); } } @@ -60,10 +60,10 @@ public void render(@NotNull GuiGraphics graphics, int mouseX, int mouseY, float } private Component getMillibuckets(long fluidAmount) { - return Component.literal(FluidHooks.toMillibuckets(fluidAmount) + "mB"); + return Component.literal(FluidConstants.toMillibuckets(fluidAmount) + "mB"); } private Component getBuckets(long fluidAmount) { - return Component.literal(((double) fluidAmount / FluidHooks.getBucketAmount()) + "B"); + return Component.literal(((double) fluidAmount / FluidConstants.getBucketAmount()) + "B"); } } diff --git a/common/src/main/java/com/teamresourceful/resourcefulbees/common/blockentities/CreativeGenBlockEntity.java b/common/src/main/java/com/teamresourceful/resourcefulbees/common/blockentities/CreativeGenBlockEntity.java index d05ccbeb..c54f433b 100644 --- a/common/src/main/java/com/teamresourceful/resourcefulbees/common/blockentities/CreativeGenBlockEntity.java +++ b/common/src/main/java/com/teamresourceful/resourcefulbees/common/blockentities/CreativeGenBlockEntity.java @@ -2,10 +2,10 @@ import com.teamresourceful.resourcefulbees.common.blocks.base.InstanceBlockEntityTicker; import com.teamresourceful.resourcefulbees.common.registries.minecraft.ModBlockEntityTypes; +import earth.terrarium.botarium.common.energy.EnergyApi; import earth.terrarium.botarium.common.energy.base.BotariumEnergyBlock; import earth.terrarium.botarium.common.energy.impl.ExtractOnlyEnergyContainer; import earth.terrarium.botarium.common.energy.impl.WrappedBlockEnergyContainer; -import earth.terrarium.botarium.common.energy.util.EnergyHooks; import net.minecraft.core.BlockPos; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; @@ -28,14 +28,14 @@ public Side getSide() { public void serverTick(Level level, BlockPos pos, BlockState state) { if (level != null) { this.energy.setEnergy(Integer.MAX_VALUE); - EnergyHooks.distributeEnergyNearby(this); + EnergyApi.distributeEnergyNearby(this, Integer.MAX_VALUE); } } @Override public WrappedBlockEnergyContainer getEnergyStorage() { if (energy == null) { - energy = new WrappedBlockEnergyContainer(this, new ExtractOnlyEnergyContainer(Integer.MAX_VALUE)); + energy = new WrappedBlockEnergyContainer(this, new ExtractOnlyEnergyContainer(Integer.MAX_VALUE, Integer.MAX_VALUE)); } return null; } diff --git a/common/src/main/java/com/teamresourceful/resourcefulbees/common/blockentities/EnderBeeconBlockEntity.java b/common/src/main/java/com/teamresourceful/resourcefulbees/common/blockentities/EnderBeeconBlockEntity.java index cd200049..2d118e02 100644 --- a/common/src/main/java/com/teamresourceful/resourcefulbees/common/blockentities/EnderBeeconBlockEntity.java +++ b/common/src/main/java/com/teamresourceful/resourcefulbees/common/blockentities/EnderBeeconBlockEntity.java @@ -15,11 +15,12 @@ import com.teamresourceful.resourcefulbees.common.registries.minecraft.ModBlockEntityTypes; import com.teamresourceful.resourcefulbees.common.registries.minecraft.ModEffects; import com.teamresourceful.resourcefullib.common.menu.ContentMenuProvider; +import earth.terrarium.botarium.common.fluid.FluidConstants; import earth.terrarium.botarium.common.fluid.base.BotariumFluidBlock; +import earth.terrarium.botarium.common.fluid.base.FluidContainer; import earth.terrarium.botarium.common.fluid.base.FluidHolder; import earth.terrarium.botarium.common.fluid.impl.InsertOnlyFluidContainer; import earth.terrarium.botarium.common.fluid.impl.WrappedBlockFluidContainer; -import earth.terrarium.botarium.common.fluid.utils.FluidHooks; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.registries.BuiltInRegistries; @@ -40,7 +41,6 @@ import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.AABB; import org.jetbrains.annotations.NotNull; @@ -173,20 +173,18 @@ private void startUpCheck(@NotNull Level level, BlockPos pos, BlockState state) private void pullFluidFromBelow(@NotNull Level level, BlockPos pos) { if (this.getFluid().getFluidAmount() >= this.tank.getTankCapacity(0)) return; - BlockEntity tileEntity = level.getBlockEntity(pos.below()); - if (tileEntity == null) return; - - FluidHooks.safeGetBlockFluidManager(tileEntity, Direction.UP).ifPresent(manager -> { - for (FluidHolder fluidTank : manager.getFluidTanks()) { - if (fluidTank.isEmpty()) continue; - FluidHolder holder = fluidTank.copyWithAmount(Math.min(fluidTank.getFluidAmount(), EnderBeeconConfig.beeconPullAmount)); - FluidHolder extracted = manager.extractFluid(holder, true); - if (!extracted.isEmpty() && this.tank.internalInsert(extracted, true) > 0) { - manager.extractFluid(extracted, false); - this.tank.internalInsert(extracted, false); - } + FluidContainer container = FluidContainer.of(level, pos.below(), Direction.UP); + if (container == null) return; + + for (FluidHolder fluidTank : container.getFluids()) { + if (fluidTank.isEmpty()) continue; + FluidHolder holder = fluidTank.copyWithAmount(Math.min(fluidTank.getFluidAmount(), EnderBeeconConfig.beeconPullAmount)); + FluidHolder extracted = container.extractFluid(holder, true); + if (!extracted.isEmpty() && this.tank.internalInsert(extracted, true) > 0) { + container.extractFluid(extracted, false); + this.tank.internalInsert(extracted, false); } - }); + } } public FluidHolder getFluid() { @@ -297,7 +295,7 @@ public void setChanged() { @Override public WrappedBlockFluidContainer getFluidContainer() { if (tank == null) { - tank = new WrappedBlockFluidContainer(this, new InsertOnlyFluidContainer(i -> FluidHooks.buckets(16), 1, (amount, fluid) -> fluid.is(ModFluidTags.HONEY))); + tank = new WrappedBlockFluidContainer(this, new InsertOnlyFluidContainer(i -> FluidConstants.fromMillibuckets(16000), 1, (amount, fluid) -> fluid.is(ModFluidTags.HONEY))); } return this.tank; } diff --git a/common/src/main/java/com/teamresourceful/resourcefulbees/common/blockentities/HoneyGeneratorBlockEntity.java b/common/src/main/java/com/teamresourceful/resourcefulbees/common/blockentities/HoneyGeneratorBlockEntity.java index c22c4a9c..8c91370b 100644 --- a/common/src/main/java/com/teamresourceful/resourcefulbees/common/blockentities/HoneyGeneratorBlockEntity.java +++ b/common/src/main/java/com/teamresourceful/resourcefulbees/common/blockentities/HoneyGeneratorBlockEntity.java @@ -16,10 +16,10 @@ import com.teamresourceful.resourcefulbees.common.recipes.HoneyGenRecipe; import com.teamresourceful.resourcefulbees.common.registries.minecraft.ModBlockEntityTypes; import com.teamresourceful.resourcefulbees.common.util.containers.AutomationSensitiveContainer; +import earth.terrarium.botarium.common.energy.EnergyApi; import earth.terrarium.botarium.common.energy.base.BotariumEnergyBlock; import earth.terrarium.botarium.common.energy.impl.ExtractOnlyEnergyContainer; import earth.terrarium.botarium.common.energy.impl.WrappedBlockEnergyContainer; -import earth.terrarium.botarium.common.energy.util.EnergyHooks; import earth.terrarium.botarium.common.fluid.base.BotariumFluidBlock; import earth.terrarium.botarium.common.fluid.base.FluidHolder; import earth.terrarium.botarium.common.fluid.impl.InsertOnlyFluidContainer; @@ -82,7 +82,7 @@ public void serverTick(Level level, BlockPos pos, BlockState state) { else this.processCompleted(level); } if (hasEnergy()) { - EnergyHooks.distributeEnergyNearby(this, ENERGY_TRANSFER_AMOUNT); + EnergyApi.distributeEnergyNearby(this, ENERGY_TRANSFER_AMOUNT); } } diff --git a/common/src/main/java/com/teamresourceful/resourcefulbees/common/blockentities/HoneyPotBlockEntity.java b/common/src/main/java/com/teamresourceful/resourcefulbees/common/blockentities/HoneyPotBlockEntity.java index e6949340..638ea6ec 100644 --- a/common/src/main/java/com/teamresourceful/resourcefulbees/common/blockentities/HoneyPotBlockEntity.java +++ b/common/src/main/java/com/teamresourceful/resourcefulbees/common/blockentities/HoneyPotBlockEntity.java @@ -8,11 +8,11 @@ import com.teamresourceful.resourcefulbees.common.menus.content.PositionContent; import com.teamresourceful.resourcefulbees.common.registries.minecraft.ModBlockEntityTypes; import com.teamresourceful.resourcefullib.common.menu.ContentMenuProvider; +import earth.terrarium.botarium.common.fluid.FluidConstants; import earth.terrarium.botarium.common.fluid.base.BotariumFluidBlock; import earth.terrarium.botarium.common.fluid.base.FluidHolder; import earth.terrarium.botarium.common.fluid.impl.SimpleFluidContainer; import earth.terrarium.botarium.common.fluid.impl.WrappedBlockFluidContainer; -import earth.terrarium.botarium.common.fluid.utils.FluidHooks; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; @@ -80,7 +80,7 @@ public PositionContent createContent() { private static class HoneyFluidContainer extends SimpleFluidContainer { public HoneyFluidContainer() { - super(i -> FluidHooks.buckets(64), 1, (i, holder) -> holder.is(ModFluidTags.HONEY)); + super(i -> FluidConstants.fromMillibuckets(64000), 1, (i, holder) -> holder.is(ModFluidTags.HONEY)); } @Override diff --git a/common/src/main/java/com/teamresourceful/resourcefulbees/common/blockentities/SolidificationChamberBlockEntity.java b/common/src/main/java/com/teamresourceful/resourcefulbees/common/blockentities/SolidificationChamberBlockEntity.java index b23dc855..237948a9 100644 --- a/common/src/main/java/com/teamresourceful/resourcefulbees/common/blockentities/SolidificationChamberBlockEntity.java +++ b/common/src/main/java/com/teamresourceful/resourcefulbees/common/blockentities/SolidificationChamberBlockEntity.java @@ -11,11 +11,11 @@ import com.teamresourceful.resourcefulbees.common.recipes.SolidificationRecipe; import com.teamresourceful.resourcefulbees.common.registries.minecraft.ModBlockEntityTypes; import com.teamresourceful.resourcefulbees.common.util.containers.AutomationSensitiveContainer; +import earth.terrarium.botarium.common.fluid.FluidConstants; import earth.terrarium.botarium.common.fluid.base.BotariumFluidBlock; import earth.terrarium.botarium.common.fluid.base.FluidHolder; import earth.terrarium.botarium.common.fluid.impl.InsertOnlyFluidContainer; import earth.terrarium.botarium.common.fluid.impl.WrappedBlockFluidContainer; -import earth.terrarium.botarium.common.fluid.utils.FluidHooks; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; @@ -141,7 +141,7 @@ public void setChanged() { @Override public WrappedBlockFluidContainer getFluidContainer() { if (tank == null) { - tank = new WrappedBlockFluidContainer(this, new InsertOnlyFluidContainer(i -> FluidHooks.buckets(16), 1, (amount, fluid) -> this.level != null && SolidificationRecipe.matches(level.getRecipeManager(), fluid.getFluid(), fluid.getCompound()))); + tank = new WrappedBlockFluidContainer(this, new InsertOnlyFluidContainer(i -> FluidConstants.fromMillibuckets(16000), 1, (amount, fluid) -> this.level != null && SolidificationRecipe.matches(level.getRecipeManager(), fluid.getFluid(), fluid.getCompound()))); } return this.tank; } diff --git a/common/src/main/java/com/teamresourceful/resourcefulbees/common/blocks/HoneyPotBlock.java b/common/src/main/java/com/teamresourceful/resourcefulbees/common/blocks/HoneyPotBlock.java index abd30f23..57c8b6fb 100644 --- a/common/src/main/java/com/teamresourceful/resourcefulbees/common/blocks/HoneyPotBlock.java +++ b/common/src/main/java/com/teamresourceful/resourcefulbees/common/blocks/HoneyPotBlock.java @@ -5,7 +5,7 @@ import com.teamresourceful.resourcefulbees.common.lib.enums.HoneyPotState; import com.teamresourceful.resourcefulbees.common.registries.minecraft.ModBlocks; import com.teamresourceful.resourcefulbees.common.util.FluidUtils; -import earth.terrarium.botarium.common.fluid.utils.FluidHooks; +import earth.terrarium.botarium.common.fluid.base.FluidContainer; import net.minecraft.Util; import net.minecraft.core.BlockPos; import net.minecraft.world.InteractionHand; @@ -74,7 +74,7 @@ public void neighborChanged(@NotNull BlockState state, @NotNull Level level, @No if (level.getBlockState(pos.above()).getBlock().equals(ModBlocks.ENDER_BEECON.get())) { potState = HoneyPotState.BEECON; - } else if (blockEntityAbove != null && FluidHooks.safeGetBlockFluidManager(blockEntityAbove, null).isPresent()) { + } else if (blockEntityAbove != null && FluidContainer.holdsFluid(blockEntityAbove, null)) { potState = HoneyPotState.OPEN; } diff --git a/common/src/main/java/com/teamresourceful/resourcefulbees/common/recipes/base/RecipeFluid.java b/common/src/main/java/com/teamresourceful/resourcefulbees/common/recipes/base/RecipeFluid.java index 2459c119..1a36750e 100644 --- a/common/src/main/java/com/teamresourceful/resourcefulbees/common/recipes/base/RecipeFluid.java +++ b/common/src/main/java/com/teamresourceful/resourcefulbees/common/recipes/base/RecipeFluid.java @@ -4,7 +4,6 @@ import com.mojang.serialization.codecs.RecordCodecBuilder; import com.teamresourceful.resourcefullib.common.codecs.CodecExtras; import earth.terrarium.botarium.common.fluid.base.FluidHolder; -import earth.terrarium.botarium.common.fluid.utils.FluidHooks; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.nbt.CompoundTag; import net.minecraft.util.ExtraCodecs; @@ -67,6 +66,6 @@ public boolean isEmpty() { } public FluidHolder toHolder() { - return FluidHooks.newFluidHolder(fluid, amount, tag); + return FluidHolder.of(fluid, amount, tag); } } diff --git a/common/src/main/java/com/teamresourceful/resourcefulbees/common/util/FluidUtils.java b/common/src/main/java/com/teamresourceful/resourcefulbees/common/util/FluidUtils.java index 16cb99b1..6291b3ec 100644 --- a/common/src/main/java/com/teamresourceful/resourcefulbees/common/util/FluidUtils.java +++ b/common/src/main/java/com/teamresourceful/resourcefulbees/common/util/FluidUtils.java @@ -8,9 +8,9 @@ import com.teamresourceful.resourcefulbees.common.lib.tags.ModFluidTags; import com.teamresourceful.resourcefulbees.common.registries.minecraft.ModFluids; import com.teamresourceful.resourcefullib.common.menu.ContentMenuProvider; +import earth.terrarium.botarium.common.fluid.FluidConstants; import earth.terrarium.botarium.common.fluid.base.FluidContainer; import earth.terrarium.botarium.common.fluid.base.FluidHolder; -import earth.terrarium.botarium.common.fluid.utils.FluidHooks; import net.minecraft.core.BlockPos; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.network.FriendlyByteBuf; @@ -33,7 +33,7 @@ public static FluidHolder exactExtract(FluidContainer container, FluidHolder hol if (simulated.getFluidAmount() == holder.getFluidAmount()) { return container.internalExtract(holder, false); } - return FluidHooks.emptyFluid(); + return FluidHolder.empty(); } public static long exactInsert(FluidContainer container, FluidHolder holder) { @@ -50,11 +50,11 @@ public static void fillBottle(FluidContainer tank, Player player, InteractionHan FluidHolder holder = tank.getFluids().get(0); ItemStack itemStack = new ItemStack(getHoneyBottleFromFluid(holder.getFluid()), 1); - if (holder.getFluidAmount() < FluidHooks.getBottleAmount()) return; + if (holder.getFluidAmount() < FluidConstants.getBottleAmount()) return; if (holder.isEmpty()) return; if (itemStack.isEmpty()) return; - FluidHolder extracted = exactExtract(tank, holder.copyWithAmount(FluidHooks.getBottleAmount())); + FluidHolder extracted = exactExtract(tank, holder.copyWithAmount(FluidConstants.getBottleAmount())); if (extracted.isEmpty()) return; bottleAction(itemStack, SoundEvents.BOTTLE_FILL, player, hand); @@ -130,7 +130,7 @@ public static void writeToBuffer(FluidHolder holder, FriendlyByteBuf buffer) { } public static FluidHolder readFromBuffer(FriendlyByteBuf buffer) { - if (!buffer.readBoolean()) return FluidHooks.emptyFluid(); + if (!buffer.readBoolean()) return FluidHolder.empty(); Fluid fluid = BuiltInRegistries.FLUID.byId(buffer.readVarInt()); long amount = buffer.readVarLong(); return FluidHolder.of(fluid, amount, buffer.readNbt()); diff --git a/common/src/main/java/com/teamresourceful/resourcefulbees/common/util/containers/SelectableFluidContainer.java b/common/src/main/java/com/teamresourceful/resourcefulbees/common/util/containers/SelectableFluidContainer.java index 7dc3b00f..a43cbae0 100644 --- a/common/src/main/java/com/teamresourceful/resourcefulbees/common/util/containers/SelectableFluidContainer.java +++ b/common/src/main/java/com/teamresourceful/resourcefulbees/common/util/containers/SelectableFluidContainer.java @@ -7,7 +7,6 @@ import earth.terrarium.botarium.common.fluid.base.FluidSnapshot; import earth.terrarium.botarium.common.fluid.impl.SimpleFluidContainer; import earth.terrarium.botarium.common.fluid.impl.SimpleFluidSnapshot; -import earth.terrarium.botarium.common.fluid.utils.FluidHooks; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.nbt.Tag; @@ -19,7 +18,7 @@ public class SelectableFluidContainer implements FluidContainer { - public SelectableList storedFluid = SelectableList.of(FluidHooks.emptyFluid()); + public SelectableList storedFluid = SelectableList.of(FluidHolder.empty()); public final long maxAmount; public final Predicate fluidFilter; @@ -79,18 +78,18 @@ public FluidHolder extractFluid(FluidHolder fluid, boolean simulate) { if (fluidFilter.test(fluid)) { FluidHolder toExtract = fluid.copyHolder(); if (storedFluid.isEmpty()) { - return FluidHooks.emptyFluid(); + return FluidHolder.empty(); } else if (storedFluid.get(i).matches(fluid)) { long extractedAmount = (long) Mth.clamp(fluid.getFluidAmount(), 0, storedFluid.get(i).getFluidAmount()); toExtract.setAmount(extractedAmount); if (simulate) return toExtract; this.storedFluid.get(i).setAmount(storedFluid.get(i).getFluidAmount() - extractedAmount); - if (storedFluid.get(i).getFluidAmount() == 0) storedFluid.set(i, FluidHooks.emptyFluid()); + if (storedFluid.get(i).getFluidAmount() == 0) storedFluid.set(i, FluidHolder.empty()); return toExtract; } } } - return FluidHooks.emptyFluid(); + return FluidHolder.empty(); } @Override @@ -165,7 +164,7 @@ public long getTankCapacity(int tankSlot) { @Override public void fromContainer(FluidContainer container) { - this.storedFluid = SelectableList.of(FluidHooks.emptyFluid()); + this.storedFluid = SelectableList.of(FluidHolder.empty()); for (FluidHolder fluidHolder : container.getFluids()) { this.storedFluid.add(fluidHolder.copyHolder()); } @@ -177,10 +176,10 @@ public void deserialize(CompoundTag nbt) { CompoundTag tag = nbt.getCompound(Botarium.BOTARIUM_DATA); CompoundTag fluidTag = tag.getCompound("FluidData"); ListTag fluids = fluidTag.getList(SimpleFluidContainer.FLUID_KEY, Tag.TAG_COMPOUND); - this.storedFluid = SelectableList.of(FluidHooks.emptyFluid()); + this.storedFluid = SelectableList.of(FluidHolder.empty()); for (int i = 0; i < fluids.size(); i++) { CompoundTag fluid = fluids.getCompound(i); - this.storedFluid.add(FluidHooks.fluidFromCompound(fluid)); + this.storedFluid.add(FluidHolder.fromCompound(fluid)); } this.storedFluid.setSelectedIndex(fluidTag.getInt("Index")); } @@ -204,7 +203,7 @@ public CompoundTag serialize(CompoundTag nbt) { @Override public void clearContent() { - this.storedFluid = SelectableList.of(FluidHooks.emptyFluid()); + this.storedFluid = SelectableList.of(FluidHolder.empty()); } public long getFluidAmount() { diff --git a/gradle.properties b/gradle.properties index 5c7a5277..0e3c7285 100644 --- a/gradle.properties +++ b/gradle.properties @@ -16,7 +16,7 @@ geckolib_version=4.2 rlib_version=2.1.20 rconfig_version=2.0.0 phos_version=0.7.0-alpha-pre.2 -botarium_version=2.1.1 +botarium_version=2.3.1 ## Optional Deps top_version=1.20.0-9.0.0-1