Skip to content

Commit

Permalink
Reflect changes in FluidStackHooks
Browse files Browse the repository at this point in the history
Signed-off-by: shedaniel <[email protected]>
  • Loading branch information
shedaniel committed Mar 3, 2024
1 parent 8d0fdbd commit efa34d3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
16 changes: 8 additions & 8 deletions common/src/main/java/dev/architectury/fluid/FluidStack.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
import dev.architectury.hooks.fluid.FluidStackHooks;
import dev.architectury.injectables.annotations.ExpectPlatform;
import net.minecraft.core.Holder;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.component.*;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.nbt.Tag;
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.network.chat.Component;
import net.minecraft.network.codec.StreamCodec;
Expand Down Expand Up @@ -303,20 +303,20 @@ public boolean isComponentEqual(FluidStack other) {
return Objects.equals(patch, otherPatch);
}

public static FluidStack read(FriendlyByteBuf buf) {
public static FluidStack read(RegistryFriendlyByteBuf buf) {
return FluidStackHooks.read(buf);
}

public static FluidStack read(CompoundTag tag) {
return FluidStackHooks.read(tag);
public static Optional<FluidStack> read(HolderLookup.Provider provider, Tag tag) {
return FluidStackHooks.read(provider, tag);
}

public void write(FriendlyByteBuf buf) {
public void write(RegistryFriendlyByteBuf buf) {
FluidStackHooks.write(this, buf);
}

public CompoundTag write(CompoundTag tag) {
return FluidStackHooks.write(this, tag);
public Tag write(HolderLookup.Provider provider, Tag tag) {
return FluidStackHooks.write(provider, this, tag);
}

public FluidStack copyWithAmount(long amount) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,19 @@
import net.fabricmc.api.Environment;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.core.BlockPos;
import net.minecraft.core.HolderLookup;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.nbt.Tag;
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.network.chat.Component;
import net.minecraft.world.level.BlockAndTintGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.level.material.FluidState;
import org.jetbrains.annotations.Nullable;

import java.util.Optional;

public class FluidStackHooks {
private FluidStackHooks() {
}
Expand All @@ -52,31 +56,39 @@ public static String getTranslationKey(FluidStack stack) {
* Platform-specific FluidStack read.
*/
@ExpectPlatform
public static FluidStack read(FriendlyByteBuf buf) {
public static FluidStack read(RegistryFriendlyByteBuf buf) {
throw new AssertionError();
}

/**
* Platform-specific FluidStack write.
*/
@ExpectPlatform
public static void write(FluidStack stack, FriendlyByteBuf buf) {
public static void write(FluidStack stack, RegistryFriendlyByteBuf buf) {
throw new AssertionError();
}

/**
* Platform-specific FluidStack read.
*/
@ExpectPlatform
public static Optional<FluidStack> read(HolderLookup.Provider provider, Tag tag) {
throw new AssertionError();
}

/**
* Platform-specific FluidStack read.
*/
@ExpectPlatform
public static FluidStack read(CompoundTag tag) {
public static FluidStack readOptional(HolderLookup.Provider provider, CompoundTag tag) {
throw new AssertionError();
}

/**
* Platform-specific FluidStack write.
*/
@ExpectPlatform
public static CompoundTag write(FluidStack stack, CompoundTag tag) {
public static Tag write(HolderLookup.Provider provider, FluidStack stack, Tag tag) {
throw new AssertionError();
}

Expand Down

0 comments on commit efa34d3

Please sign in to comment.