Skip to content

Commit

Permalink
Fix "dummy" recipes for the bottling machine (such as filling buckets…
Browse files Browse the repository at this point in the history
…) not being synched to the client properly
  • Loading branch information
BluSunrize committed Mar 30, 2024
1 parent 8755938 commit f699f56
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ public BottlingProcess(
this.tank = state.tank;
this.allowPartialFill = () -> state.allowPartialFill;
this.isFilling = nbt.getBoolean("isFilling");
this.filledContainer = List.of();
if(nbt.contains("filledContainer"))
this.filledContainer = Arrays.asList(ItemStack.of(nbt.getCompound("filledContainer")));
else
this.filledContainer = List.of();
}

public BottlingProcess(BottlingMachineRecipe recipe, NonNullList<ItemStack> inputItem, State state)
Expand All @@ -81,7 +84,11 @@ public BottlingProcess(ItemStack inputItem, ItemStack currentContainer, State st

public static InWorldProcessLoader<BottlingMachineRecipe> loader(State state)
{
return (getRecipe, tag) -> new BottlingProcess(getRecipe, tag, state);
return (getRecipe, tag) -> {
if(tag.getBoolean("isFilling"))
return new BottlingProcess((level, resourceLocation) -> DUMMY_RECIPE, tag, state);
return new BottlingProcess(getRecipe, tag, state);
};
}

@Override
Expand Down Expand Up @@ -134,5 +141,7 @@ public void writeExtraDataToNBT(CompoundTag nbt)
{
super.writeExtraDataToNBT(nbt);
nbt.putBoolean("isFilling", isFilling);
if(isFilling&&!filledContainer.isEmpty())
nbt.put("filledContainer", filledContainer.get(0).serializeNBT());
}
}

0 comments on commit f699f56

Please sign in to comment.