mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-08 06:26:43 +01:00
Adjust slot placement and fixed trinket slots not hiding when switching tabs
This commit is contained in:
parent
ccad91087c
commit
d47433a463
2 changed files with 19 additions and 29 deletions
|
@ -100,7 +100,7 @@ public class SpellbookScreenHandler extends ScreenHandler {
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
final EquipmentSlot eq = EquipmentSlot.values()[5 - i];
|
final EquipmentSlot eq = EquipmentSlot.values()[5 - i];
|
||||||
addSlot(new InventorySlot(this, inventory, PlayerInventory.OFF_HAND_SLOT - i - 1, 340, 50 + (i * 20)) {
|
addSlot(new InventorySlot(this, inventory, PlayerInventory.OFF_HAND_SLOT - i - 1, 335, 50 + (i * 20)) {
|
||||||
@Override
|
@Override
|
||||||
public int getMaxItemCount() {
|
public int getMaxItemCount() {
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -127,12 +127,12 @@ public class SpellbookScreenHandler extends ScreenHandler {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
TrinketsDelegate.getInstance().createSlot(this, inv.player, TrinketsDelegate.FACE, 0, 340 + 20, 60).ifPresent(this::addSlot);
|
TrinketsDelegate.getInstance().createSlot(this, inv.player, TrinketsDelegate.FACE, 0, 336 + 20, 60).ifPresent(this::addSlot);
|
||||||
TrinketsDelegate.getInstance().createSlot(this, inv.player, TrinketsDelegate.NECKLACE, 0, 340 + 20, 60 + 20).ifPresent(this::addSlot);
|
TrinketsDelegate.getInstance().createSlot(this, inv.player, TrinketsDelegate.NECKLACE, 0, 336 + 20, 60 + 20).ifPresent(this::addSlot);
|
||||||
TrinketsDelegate.getInstance().createSlot(this, inv.player, TrinketsDelegate.MAINHAND, 0, 350 - 20, 170).ifPresent(this::addSlot);
|
TrinketsDelegate.getInstance().createSlot(this, inv.player, TrinketsDelegate.MAINHAND, 0, 336 - 10, 155).ifPresent(this::addSlot);
|
||||||
TrinketsDelegate.getInstance().createSlot(this, inv.player, TrinketsDelegate.OFFHAND, 0, 330 + 20, 170).ifPresent(this::addSlot);
|
TrinketsDelegate.getInstance().createSlot(this, inv.player, TrinketsDelegate.OFFHAND, 0, 336 + 20, 155).ifPresent(this::addSlot);
|
||||||
|
|
||||||
addSlot(new InventorySlot(this, inventory, PlayerInventory.OFF_HAND_SLOT, 340, 150) {
|
addSlot(new InventorySlot(this, inventory, PlayerInventory.OFF_HAND_SLOT, 342, 140) {
|
||||||
@Override
|
@Override
|
||||||
public Pair<Identifier, Identifier> getBackgroundSprite() {
|
public Pair<Identifier, Identifier> getBackgroundSprite() {
|
||||||
return Pair.of(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, PlayerScreenHandler.EMPTY_OFFHAND_ARMOR_SLOT);
|
return Pair.of(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, PlayerScreenHandler.EMPTY_OFFHAND_ARMOR_SLOT);
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
package com.minelittlepony.unicopia.trinkets;
|
package com.minelittlepony.unicopia.trinkets;
|
||||||
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
import com.minelittlepony.unicopia.container.SpellbookScreenHandler;
|
import com.minelittlepony.unicopia.container.SpellbookScreenHandler;
|
||||||
import com.minelittlepony.unicopia.container.inventory.InventorySlot;
|
import com.minelittlepony.unicopia.container.inventory.InventorySlot;
|
||||||
import com.mojang.datafixers.util.Pair;
|
|
||||||
|
|
||||||
import dev.emi.trinkets.SurvivalTrinketSlot;
|
import dev.emi.trinkets.SurvivalTrinketSlot;
|
||||||
import dev.emi.trinkets.api.SlotGroup;
|
import dev.emi.trinkets.api.SlotGroup;
|
||||||
import dev.emi.trinkets.api.TrinketInventory;
|
import dev.emi.trinkets.api.TrinketInventory;
|
||||||
|
@ -18,73 +14,67 @@ class SpellbookTrinketSlot extends InventorySlot implements TrinketsDelegate.Slo
|
||||||
|
|
||||||
public SpellbookTrinketSlot(SpellbookScreenHandler handler, TrinketInventory inventory, int index, int x, int y, SlotGroup group) {
|
public SpellbookTrinketSlot(SpellbookScreenHandler handler, TrinketInventory inventory, int index, int x, int y, SlotGroup group) {
|
||||||
super(handler, inventory, index, x, y);
|
super(handler, inventory, index, x, y);
|
||||||
this.slot = new SurvivalTrinketSlot(inventory, index, x, y, group, inventory.getSlotType(), 0, true);
|
slot = new SurvivalTrinketSlot(inventory, index, x, y, group, inventory.getSlotType(), 0, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTakeItem(PlayerEntity player, ItemStack stack) {
|
public void onTakeItem(PlayerEntity player, ItemStack stack) {
|
||||||
this.slot.onTakeItem(player, stack);
|
slot.onTakeItem(player, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInsert(ItemStack stack) {
|
public boolean canInsert(ItemStack stack) {
|
||||||
return this.slot.canInsert(stack);
|
return slot.canInsert(stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getStack() {
|
public ItemStack getStack() {
|
||||||
return this.slot.getStack();
|
return slot.getStack();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasStack() {
|
public boolean hasStack() {
|
||||||
return this.slot.hasStack();
|
return slot.hasStack();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setStack(ItemStack stack) {
|
public void setStack(ItemStack stack) {
|
||||||
this.slot.setStack(stack);
|
slot.setStack(stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setStackNoCallbacks(ItemStack stack) {
|
public void setStackNoCallbacks(ItemStack stack) {
|
||||||
this.slot.setStackNoCallbacks(stack);
|
slot.setStackNoCallbacks(stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void markDirty() {
|
public void markDirty() {
|
||||||
this.slot.markDirty();
|
slot.markDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxItemCount() {
|
public int getMaxItemCount() {
|
||||||
return this.slot.getMaxItemCount();
|
return slot.getMaxItemCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxItemCount(ItemStack stack) {
|
public int getMaxItemCount(ItemStack stack) {
|
||||||
return this.slot.getMaxItemCount(stack);
|
return slot.getMaxItemCount(stack);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Nullable
|
|
||||||
public Pair<Identifier, Identifier> getBackgroundSprite() {
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack takeStack(int amount) {
|
public ItemStack takeStack(int amount) {
|
||||||
return this.slot.takeStack(amount);
|
return slot.takeStack(amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isEnabled() {
|
public boolean isEnabled() {
|
||||||
return this.slot.isEnabled();
|
return super.isEnabled() && slot.isEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canTakeItems(PlayerEntity playerEntity) {
|
public boolean canTakeItems(PlayerEntity playerEntity) {
|
||||||
return this.slot.canTakeItems(playerEntity);
|
return slot.canTakeItems(playerEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue