Skip to content

Commit

Permalink
fixed recipe tags not getting synced from server to client
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinsdar committed Jan 31, 2025
1 parent 45081ab commit ff01b75
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import tesseract.TesseractGraphWrappers;

import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -194,6 +195,13 @@ public T fromNetwork(ResourceLocation recipeId, FriendlyByteBuf buffer) {
inputChances[i] = buffer.readInt();
}
}
size = buffer.readInt();
Set<String> tags = new HashSet<>(size);
if (size > 0) {
for (int i = 0; i < size; i++) {
tags.add(buffer.readUtf());
}
}
long power = buffer.readLong();
int dur = buffer.readInt();
int special = buffer.readInt();
Expand All @@ -216,6 +224,9 @@ public T fromNetwork(ResourceLocation recipeId, FriendlyByteBuf buffer) {
if (inputChances.length > 0){
r.addInputChances(inputChances);
}
if (!tags.isEmpty()){
r.addTags(tags);
}
r.setIds(recipeId, mapId);
r.setHidden(hidden);
r.setFake(fake);
Expand Down Expand Up @@ -249,6 +260,10 @@ public void toNetwork(FriendlyByteBuf buffer, T recipe) {
if (recipe.hasInputChances()) {
Arrays.stream(recipe.getInputChances()).forEach(buffer::writeInt);
}
buffer.writeInt(recipe.getTags().size());
if (!recipe.getTags().isEmpty()){
recipe.getTags().forEach(buffer::writeUtf);
}
buffer.writeLong(recipe.getPower());
buffer.writeInt(recipe.getDuration());
buffer.writeInt(recipe.getSpecialValue());
Expand Down

0 comments on commit ff01b75

Please sign in to comment.