Skip to content

Commit

Permalink
change arcane table gui
Browse files Browse the repository at this point in the history
  • Loading branch information
reoseah committed Oct 27, 2024
1 parent b479c03 commit 3f74a4b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/main/java/io/github/reoseah/magisterium/Magisterium.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public Text getDisplayName() {

if (stack.isOf(Items.LAPIS_LAZULI)) {
if (tryPlaceGlyph(player, world, hand, hitResult, stack)) {
if (!player.getAbilities().creativeMode) {
if (!world.isClient && !player.getAbilities().creativeMode) {
stack.decrement(1);
}
return ActionResult.SUCCESS;
Expand All @@ -194,7 +194,7 @@ private static boolean tryPlaceGlyph(PlayerEntity player, World world, Hand hand
return false;
}
if (!world.isClient) {
if (!MagisteriumPlaygrounds.trySetBlockState((ServerWorld) world, placementPos, placementState, player)) {
if (!MagisteriumPlaygrounds.trySetBlockState(world, placementPos, placementState, player)) {
player.sendMessage(Text.translatable("magisterium.gui.no_success"), true);
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,11 @@ public class ArcaneTableScreen extends HandledScreen<ArcaneTableScreenHandler> {

public ArcaneTableScreen(ArcaneTableScreenHandler handler, PlayerInventory inventory, Text title) {
super(handler, inventory, title);
this.backgroundWidth = 212;
this.backgroundWidth = 204;
this.backgroundHeight = 192;
this.playerInventoryTitleX = 16;
this.playerInventoryTitleX = 22;
this.playerInventoryTitleY = this.backgroundHeight - 93;
}

@Override
protected void init() {
super.init();
this.titleX = 122 - this.textRenderer.getWidth(this.title) / 2;
}

@Override
protected void drawForeground(DrawContext context, int mouseX, int mouseY) {
super.drawForeground(context, mouseX, mouseY);
context.drawText(this.textRenderer, this.title, this.titleX, this.titleY, 0xf6b734, false);
this.titleX = Integer.MIN_VALUE;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ protected ArcaneTableScreenHandler(int syncId, PlayerInventory playerInventory,
this.bookInventory = bookInventory;
this.bookContentsInventory = bookContentsInventory;

this.addSlot(new Slot(this.bookInventory, 0, 12, 36) {
this.addSlot(new Slot(this.bookInventory, 0, 22, 36) {
@Override
public Pair<Identifier, Identifier> getBackgroundSprite() {
return Pair.of(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, EMPTY_BOOK_SLOT_TEXTURE);
Expand All @@ -48,7 +48,7 @@ public boolean canInsert(ItemStack stack) {

for (int row = 0; row < 3; row++) {
for (int column = 0; column < 6; column++) {
this.addSlot(new Slot(this.bookContentsInventory, column + row * 6, 70 + column * 18, 18 + row * 18) {
this.addSlot(new Slot(this.bookContentsInventory, column + row * 6, 81 + column * 18, 18 + row * 18) {
@Override
public boolean canTakeItems(PlayerEntity playerEntity) {
return bookInventory.getStack(0).contains(SpellBookItem.PAGES);
Expand All @@ -65,12 +65,12 @@ public boolean canInsert(ItemStack stack) {

for (int row = 0; row < 3; row++) {
for (int column = 0; column < 9; column++) {
this.addSlot(new Slot(playerInventory, column + row * 9 + 9, 16 + column * 18, 111 + row * 18));
this.addSlot(new Slot(playerInventory, column + row * 9 + 9, 22 + column * 18, 111 + row * 18));
}
}

for (int column = 0; column < 9; column++) {
this.addSlot(new Slot(playerInventory, column, 16 + column * 18, 169));
this.addSlot(new Slot(playerInventory, column, 22 + column * 18, 169));
}
}

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 3f74a4b

Please sign in to comment.