Skip to content

Commit

Permalink
Forgot to remove deprecated code
Browse files Browse the repository at this point in the history
Signed-off-by: Type-32 <[email protected]>
  • Loading branch information
Type-32 committed Jun 6, 2024
1 parent 33881b5 commit 0227a79
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,11 @@ public boolean stillValid(Player player) {

@ClientSide
public void startRecipeProcess(int selectedIndex) {
Main.LOGGER.debug("Decomponentalizing Selected Recipe is null? {}", blockEntity.getSelectedRecipe() == null);
// Main.LOGGER.debug("Decomponentalizing Selected Recipe is null? {}", blockEntity.getCurrentRecipe() == null);
if (!isCrafting()) {
// These Logics are handled on server side; many thanks to @xjqsh for helping me fix this

PacketHandler.sendToServer(new C2SSetDecomponentalizerCurrentRecipePacket(blockEntity.getBlockPos(), (byte) selectedIndex));
PacketHandler.sendToServer(new C2SSetDecomponentalizerCurrentRecipePacket(blockEntity.getBlockPos(), (short) selectedIndex));

Main.LOGGER.debug("Starting Decomponentalizing Process");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,14 @@ public void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float
DecomponentalizingRecipe recipe = recipes.get(i);
Main.LOGGER.info("Recipe: {}, {}", recipe.toString(), Arrays.stream(recipe.getIngredient().getItems()).toArray()[0].toString());

if(containerMenu.getBlockEntity().getSelectedRecipeIndex() == i)
selectedIndex = i;

renderRecipeEntry(guiGraphics, recipe, getX() + 1, y, listWidth, entryHeight, i == selectedIndex, false);
} else if (y >= getY() && y + entryHeight > getY() + listHeight && (y + entryHeight) - (getY() + listHeight) <= entryHeight) {
DecomponentalizingRecipe recipe = recipes.get(i);

if(containerMenu.getBlockEntity().getSelectedRecipeIndex() == i)
selectedIndex = i;
renderRecipeEntry(guiGraphics, recipe, getX() + 1, y, listWidth, entryHeight - ((y + entryHeight) - (getY() + listHeight)), i == selectedIndex, false);
} else if (y < getY() && y + entryHeight > getY() && (y + entryHeight) - (getY()) <= entryHeight) {
DecomponentalizingRecipe recipe = recipes.get(i);

if(containerMenu.getBlockEntity().getSelectedRecipeIndex() == i)
selectedIndex = i;
renderRecipeEntry(guiGraphics, recipe, getX() + 1, y, listWidth, (getY() - y), i == selectedIndex, true);
}
y += entryHeight + 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@

public class C2SSetDecomponentalizerCurrentRecipePacket {
private final BlockPos position;
private final byte recipeIndex;
private final short recipeIndex;

public C2SSetDecomponentalizerCurrentRecipePacket(BlockPos position, byte recipeIndex) {
public C2SSetDecomponentalizerCurrentRecipePacket(BlockPos position, short recipeIndex) {
this.position = position;
this.recipeIndex = recipeIndex;
}

public C2SSetDecomponentalizerCurrentRecipePacket(FriendlyByteBuf buf) {
this(buf.readBlockPos(), buf.readByte());
this(buf.readBlockPos(), buf.readShort());
Main.LOGGER.debug("C2SSetDecomponentalizerCurrentRecipePacket received, receiving Byte Buffer instead of manual creation");
}

public void encode(FriendlyByteBuf buf) {
buf.writeBlockPos(position);
buf.writeByte(recipeIndex);
buf.writeShort(recipeIndex);
}

public static void handle(C2SSetDecomponentalizerCurrentRecipePacket msg, Supplier<NetworkEvent.Context> ctx) {
Expand Down

0 comments on commit 0227a79

Please sign in to comment.