This commit is contained in:
2026-03-04 15:07:03 +01:00
parent fef55c6d68
commit c17629478e
3 changed files with 5 additions and 7 deletions

View File

@@ -6,7 +6,7 @@ minecraft_version=1.20.1
yarn_mappings=1.20.1+build.10 yarn_mappings=1.20.1+build.10
loader_version=0.18.3 loader_version=0.18.3
# Mod Properties # Mod Properties
mod_version=26.3.3 mod_version=26.3.4
maven_group=dev.tggamesyt maven_group=dev.tggamesyt
archives_base_name=szar archives_base_name=szar
# Dependencies # Dependencies

View File

@@ -32,6 +32,7 @@ public class SlotMachineBlockEntity extends BlockEntity {
private final Random random = new Random(); private final Random random = new Random();
final SimpleInventory betInventory = new SimpleInventory(1);
public final int[] currentSymbol = new int[3]; public final int[] currentSymbol = new int[3];
public final int[] finalSymbol = new int[3]; public final int[] finalSymbol = new int[3];
public static final int TOTAL_SYMBOLS = 7; public static final int TOTAL_SYMBOLS = 7;
@@ -209,7 +210,7 @@ public class SlotMachineBlockEntity extends BlockEntity {
} }
} }
public boolean onButtonClicked(PlayerEntity player, SlotMachineBlockEntity blockEntity, SimpleInventory betInventory) { public boolean onButtonClicked(PlayerEntity player, SlotMachineBlockEntity blockEntity) {
blockEntity.setHandleClicked(true, player); blockEntity.setHandleClicked(true, player);
ItemStack bet = betInventory.getStack(0); ItemStack bet = betInventory.getStack(0);
if (bet.isEmpty()) return false; if (bet.isEmpty()) return false;

View File

@@ -19,9 +19,6 @@ public class SlotMachineScreenHandler extends ScreenHandler {
public final SlotMachineBlockEntity blockEntity; public final SlotMachineBlockEntity blockEntity;
private final SimpleInventory betInventory = new SimpleInventory(1);
private final Random random = new Random();
public SlotMachineScreenHandler(int syncId, PlayerInventory playerInv, SlotMachineBlockEntity blockEntity) { public SlotMachineScreenHandler(int syncId, PlayerInventory playerInv, SlotMachineBlockEntity blockEntity) {
super(Szar.SLOT_MACHINE_SCREEN_HANDLER_TYPE, syncId); super(Szar.SLOT_MACHINE_SCREEN_HANDLER_TYPE, syncId);
@@ -31,7 +28,7 @@ public class SlotMachineScreenHandler extends ScreenHandler {
this.addProperties(blockEntity.propertyDelegate); this.addProperties(blockEntity.propertyDelegate);
// Bet slot // Bet slot
this.addSlot(new Slot(betInventory, 0, 44, 35)); this.addSlot(new Slot(blockEntity.betInventory, 0, 44, 35));
// Player inventory slots // Player inventory slots
for (int y = 0; y < 3; y++) for (int y = 0; y < 3; y++)
@@ -44,7 +41,7 @@ public class SlotMachineScreenHandler extends ScreenHandler {
@Override @Override
public boolean onButtonClick(PlayerEntity player, int id) { public boolean onButtonClick(PlayerEntity player, int id) {
if (id != 0 || blockEntity.getSpinning()) return false; if (id != 0 || blockEntity.getSpinning()) return false;
return blockEntity.onButtonClicked(player, blockEntity, betInventory); return blockEntity.onButtonClicked(player, blockEntity);
} }
/* /*
@Override @Override