pici szar

This commit is contained in:
2026-03-09 11:27:09 +01:00
parent 26ab8e0576
commit 485b15082e
12 changed files with 126 additions and 15 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.8 mod_version=26.3.9
maven_group=dev.tggamesyt maven_group=dev.tggamesyt
archives_base_name=szar archives_base_name=szar
# Dependencies # Dependencies

View File

@@ -64,7 +64,7 @@ public class RouletteScreen extends HandledScreen<RouletteScreenHandler> {
this.handler = handler; this.handler = handler;
this.blockEntity = handler.blockEntity; this.blockEntity = handler.blockEntity;
this.backgroundWidth = 326; this.backgroundWidth = 326;
this.backgroundHeight = 194; this.backgroundHeight = 240;
this.inventory = inventory; this.inventory = inventory;
} }
@@ -217,17 +217,17 @@ public class RouletteScreen extends HandledScreen<RouletteScreenHandler> {
int guiLeft = (width - backgroundWidth) / 2; int guiLeft = (width - backgroundWidth) / 2;
int guiTop = (height - backgroundHeight) / 2; int guiTop = (height - backgroundHeight) / 2;
context.drawText(textRenderer, Text.literal(spinString), context.drawText(textRenderer, Text.literal(spinString),
guiLeft + 190, guiTop + 115, 0x373737, false); guiLeft + 190, guiTop + 115, 0x404040, false);
} }
protected void drawWheel(DrawContext context) { protected void drawWheel(DrawContext context) {
int cx = ((width - backgroundWidth) / 2) + 255; int cx = ((width - backgroundWidth) / 2) + 255;
int cy = ((height - backgroundHeight) / 2) + 155; int cy = ((height - backgroundHeight) / 2) + 180;
Identifier wheelTex = new Identifier(Szar.MOD_ID, "textures/gui/roulette_wheel.png"); Identifier wheelTex = new Identifier(Szar.MOD_ID, "textures/gui/roulette_wheel.png");
Identifier ballTex = new Identifier(Szar.MOD_ID, "textures/gui/roulette_ball.png"); Identifier ballTex = new Identifier(Szar.MOD_ID, "textures/gui/roulette_ball.png");
int imgWidth = 64; int imgWidth = 128;
int imgHeight = 64; int imgHeight = 128;
context.getMatrices().push(); context.getMatrices().push();
context.getMatrices().translate(cx, cy, 0); context.getMatrices().translate(cx, cy, 0);
@@ -263,6 +263,14 @@ public class RouletteScreen extends HandledScreen<RouletteScreenHandler> {
return super.mouseClicked(mouseX, mouseY, button); return super.mouseClicked(mouseX, mouseY, button);
} }
@Override
protected void drawForeground(DrawContext context, int mouseX, int mouseY) {
// Draw title (top left)
context.drawText(textRenderer, title, titleX, titleY, 0x404040, false);
// Draw "Inventory" label — move it down by changing the Y
context.drawText(textRenderer, playerInventoryTitle, playerInventoryTitleX, playerInventoryTitleY + 73, 0x404040, false);
}
@Override @Override
public void removed() { public void removed() {
super.removed(); super.removed();

View File

@@ -40,9 +40,9 @@ public class RouletteBlockEntity extends BlockEntity {
"red", "black", "red", "black", "red", // 1-5 "red", "black", "red", "black", "red", // 1-5
"black", "red", "black", "red", "black",// 6-10 "black", "red", "black", "red", "black",// 6-10
"black", "red", "black", "red", "black",// 11-15 "black", "red", "black", "red", "black",// 11-15
"red", "black", "red", "black", "black",// 16-20 "red", "black", "red", "red", "black",// 16-20
"red", "black", "red", "black", "red", // 21-25 "red", "black", "red", "black", "red", // 21-25
"black", "red", "red", "black", "red", // 26-30 "black", "red", "black", "black", "red", // 26-30
"black", "red", "black", "red", "black",// 31-35 "black", "red", "black", "red", "black",// 31-35
"red" // 36 "red" // 36
}; };

View File

@@ -13,8 +13,8 @@ public class RouletteScreenHandler extends ScreenHandler {
public final RouletteBlockEntity blockEntity; public final RouletteBlockEntity blockEntity;
public static final int SLOT_SIZE = 18; public static final int SLOT_SIZE = 18;
public static final int GRID_START_X = 60; public static final int GRID_START_X = 50;
public static final int GRID_START_Y = 8; public static final int GRID_START_Y = 7;
private static int gx(int col) { return GRID_START_X + (col - 1) * SLOT_SIZE; } private static int gx(int col) { return GRID_START_X + (col - 1) * SLOT_SIZE; }
private static int gy(int row) { return GRID_START_Y + (row - 1) * SLOT_SIZE; } private static int gy(int row) { return GRID_START_Y + (row - 1) * SLOT_SIZE; }
@@ -87,7 +87,7 @@ public class RouletteScreenHandler extends ScreenHandler {
this.addSlot(new BetSlot(inv.thirds, 2, gx(14), gy(3))); this.addSlot(new BetSlot(inv.thirds, 2, gx(14), gy(3)));
// === Player inventory === // === Player inventory ===
int playerInvY = GRID_START_Y + 5 * SLOT_SIZE + 14; int playerInvY = GRID_START_Y + 5 * SLOT_SIZE + 60;
for (int y = 0; y < 3; y++) for (int y = 0; y < 3; y++)
for (int x = 0; x < 9; x++) for (int x = 0; x < 9; x++)
this.addSlot(new Slot(playerInv, x + y * 9 + 9, 8 + x * 18, playerInvY + y * 18)); this.addSlot(new Slot(playerInv, x + y * 9 + 9, 8 + x * 18, playerInvY + y * 18));

View File

@@ -876,8 +876,8 @@ public class Szar implements ModInitializer {
Registries.BLOCK, Registries.BLOCK,
new Identifier(MOD_ID, "roulette"), new Identifier(MOD_ID, "roulette"),
new RouletteBlock( new RouletteBlock(
AbstractBlock.Settings FabricBlockSettings.create()
.copy(Blocks.IRON_BLOCK) .strength(2.0f, 3.0f)
) )
); );
public static final BlockEntityType<RouletteBlockEntity> ROULETTE_BLOCKENTITY = Registry.register( public static final BlockEntityType<RouletteBlockEntity> ROULETTE_BLOCKENTITY = Registry.register(
@@ -1001,8 +1001,8 @@ public class Szar implements ModInitializer {
Registries.BLOCK, Registries.BLOCK,
new Identifier(MOD_ID, "slot_machine"), new Identifier(MOD_ID, "slot_machine"),
new SlotMachineBlock( new SlotMachineBlock(
AbstractBlock.Settings FabricBlockSettings.create()
.copy(Blocks.IRON_BLOCK) .strength(2.0f, 3.0f)
) )
); );
public static final BlockEntityType<SlotMachineBlockEntity> SLOT_MACHINE_BLOCKENTITY = Registry.register( public static final BlockEntityType<SlotMachineBlockEntity> SLOT_MACHINE_BLOCKENTITY = Registry.register(

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

@@ -0,0 +1,6 @@
{
"values": [
"szar:roulette",
"szar:slot_machine"
]
}

View File

@@ -0,0 +1,14 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "szar:roulette"
}
]
}
]
}

View File

@@ -0,0 +1,14 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "szar:slot_machine"
}
]
}
]
}

View File

@@ -0,0 +1,29 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"BGR",
"WSW",
" W "
],
"key": {
"R": {
"item": "minecraft:red_wool"
},
"B": {
"item": "minecraft:black_wool"
},
"G": {
"item": "minecraft:lime_wool"
},
"S": {
"item": "minecraft:redstone_block"
},
"W": {
"tag": "minecraft:logs"
}
},
"result": {
"item": "szar:roulette",
"count": 1
}
}

View File

@@ -0,0 +1,26 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"WRW",
"SSL",
"WRW"
],
"key": {
"R": {
"item": "minecraft:redstone_block"
},
"L": {
"item": "minecraft:lever"
},
"S": {
"tag": "szar:lucky_items"
},
"W": {
"item": "minecraft:red_wool"
}
},
"result": {
"item": "szar:slot_machine",
"count": 1
}
}

View File

@@ -0,0 +1,14 @@
{
"values": [
"minecraft:deepslate_emerald_ore",
"minecraft:bell",
"minecraft:apple",
"minecraft:sweet_berries",
"minecraft:glow_berries",
"minecraft:melon_slice",
"minecraft:chorus_fruit",
"minecraft:golden_apple",
"minecraft:enchanted_golden_apple",
"minecraft:rabbit_foot"
]
}