Странное поведение предметов в собственном меню

Версия Minecraft
1.16.5
API
Forge
47
2
2
Всех приветствую!
Я решил создать один блок с GUI.
Сделал TileEntity, Screen, Block и Container для этого.
Но у меня возник один баг, который не понятно как решить. Он записан в видео...

Вот код:
Java:
public abstract class AbstractBlockChest extends Block {

public AbstractBlockChest() {
super(AbstractBlock.Properties.of(Material.STONE, MaterialColor.COLOR_BROWN)
.harvestTool(ToolType.AXE).strength(1.5F, 6.0F));
    }

@Override
    public boolean hasTileEntity(BlockState state) {
return true;
    }

public abstract TileEntity createTileEntityInternal();
public abstract boolean isValidTileEntityForThisBlock(TileEntity te);

@Override
    public TileEntity createTileEntity(BlockState state, IBlockReader world) {
return createTileEntityInternal();
    }

@Override
    @SuppressWarnings("deprecation")
public @Nonnull ActionResultType use(@Nonnull BlockState blockState, @Nonnull World world,
@Nonnull BlockPos position, @Nonnull PlayerEntity player,
@Nonnull Hand hand, @Nonnull BlockRayTraceResult brtr) {
        TileEntity te = world.getBlockEntity(position);
if (!player.isCrouching() && isValidTileEntityForThisBlock(te)) {
if (!world.isClientSide) {
assert te != null;
NetworkHooks.openGui((ServerPlayerEntity) player, (INamedContainerProvider) te, te.getBlockPos());
            }
        }

return ActionResultType.SUCCESS;
    }

public static class MathBlockChest extends AbstractBlockChest {
@Override
        public TileEntity createTileEntityInternal() {
return TileEntityRegistry.MATH_CHEST.get().create();
        }

@Override
        public boolean isValidTileEntityForThisBlock(TileEntity te) {
return te instanceof MathChestTileEntity;
        }
    }
}
Java:
public abstract class AbstractCodingChest <T extends CodingChestTileEntity> extends Container implements IInventory {

protected final T tile;
protected final PlayerInventory playerInventory;

protected AbstractCodingChest(@Nullable ContainerType<?> containerType, int windowID,
PlayerInventory playerInventory, T tile) {
super(containerType, windowID);

this.tile = tile;
this.playerInventory = playerInventory;
    }

public abstract @Nonnull ChestTypes type();

public abstract @Nonnull OffsetManager getOffsetManager();

@Override
    public int getContainerSize() {
return tile.getContainerSize();
    }

@Override
    public boolean isEmpty() {
return tile.isEmpty();
    }

@Override
    @Nonnull
    public ItemStack getItem(int i) {
return tile.getItem(i);
    }

@Override
    @Nonnull
    public ItemStack removeItem(int i, int i1) {
return tile.removeItem(i, i1);
    }

@Override
    @Nonnull
    public ItemStack removeItemNoUpdate(int i) {
return tile.removeItemNoUpdate(i);
    }

@Override
    public void setChanged() {
tile.setChanged();
    }

@Override
    public void clearContent() {
tile.clearContent();
    }

public void addInventorySlots() {
        OffsetManager manager = getOffsetManager();
for (int y = 0; y < 4; y++) {
for (int x = 0; x < 9; x++) {
int i = CoordinatesHelper.unpackInventoryIDFromCoordinates(y, x);
if (y == 0) {
addSlot(new Slot(playerInventory, i,
manager.getInventoryXOffset() + OffsetManager.SLOT_SIZE*x + manager.getInventorySlotXOffset()*(x-1),
manager.getInventoryYOffset() + OffsetManager.SLOT_SIZE*3 + manager.getInventorySlotYOffset()*2 + manager.getInventoryHotBarYOffset()
                            ));
} else {
addSlot(new Slot(playerInventory, i,
manager.getInventoryXOffset() + OffsetManager.SLOT_SIZE*x + manager.getInventorySlotXOffset()*(x-1),
manager.getInventoryYOffset() + OffsetManager.SLOT_SIZE*(y-1) + manager.getInventorySlotYOffset()*(y-1)));
                }
            }
        }
    }

@Override
    public boolean stillValid(@Nonnull PlayerEntity player) {
        return true;
    }
}
Java:
public class MathCodingChestContainer extends AbstractCodingChest<MathChestTileEntity> {

public static final int X_NODE_OFFSET = 97;
public static final int Y_NODE_OFFSET = 32;

public static final int X_NODE_START = -2;
public static final int Y_NODE_START = 7;

private final RangedArrayList<OperationNode> nodes = new RangedArrayList<>(4);

public MathCodingChestContainer(final int windowId, final PlayerInventory playerInv, final PacketBuffer data) {
this(windowId, playerInv, TileEntityReader.getTileEntity(playerInv, data, MathChestTileEntity.class));
    }

public MathCodingChestContainer(int windowID, final PlayerInventory playerInv, final MathChestTileEntity te) {
super(ContainerTypesRegistry.MATH_CHEST.get(), windowID, playerInv, te);
        addInventorySlots();

for (int i = 0; i < 4; i++) {
RangedArrayList<Integer> list = new RangedArrayList<>(3);
for (int b = 0; b < 3; b++) {
list.add(i*3 + b);
            }

switch (i) {
case 0: // Left - up
                    nodes.add(new OperationNode(list, this, X_NODE_START, Y_NODE_START));
break;
case 1: // Right - up
                    nodes.add(new OperationNode(list, this, X_NODE_START + X_NODE_OFFSET, Y_NODE_START));
break;
case 2: // Left - down
                    nodes.add(new OperationNode(list, this, X_NODE_START, Y_NODE_START + Y_NODE_OFFSET));
break;
case 3: // Right - down
                    nodes.add(new OperationNode(list, this, X_NODE_START + X_NODE_OFFSET, Y_NODE_START + Y_NODE_OFFSET));
break;
            }
        }
    }

@Nonnull
    @Override
    public ChestTypes type() {
return ChestTypes.MATH_MENU;
    }

@Nonnull
    @Override
    public OffsetManager getOffsetManager() {
return MathCodingBlockMenu.OFFSET_MANAGER;
    }

public static class OperationNode {

public static final int SLOT1_SLOT2_OFFSET = 22;
public static final int SLOT2_SLOT3_OFFSET = 13;

public OperationNode(RangedArrayList<Integer> listOfIDWith3Elements, MathCodingChestContainer container,
int xStartPos, int yStartPos) {
if (listOfIDWith3Elements.getMaxCapacity() != 3) {
throw new IllegalStateException("Max capacity of slot-list might be 3, expected " + listOfIDWith3Elements.getMaxCapacity());
            }
if (listOfIDWith3Elements.size() != 3) {
throw new IllegalStateException("List might contains 3 elements. Expected " + listOfIDWith3Elements.size());
            }

container.addSlot(new Slot(container, listOfIDWith3Elements.get(0), xStartPos, yStartPos));
container.addSlot(new Slot(container, listOfIDWith3Elements.get(1),
xStartPos + OffsetManager.SLOT_SIZE + SLOT1_SLOT2_OFFSET, yStartPos));
container.addSlot(new Slot(container, listOfIDWith3Elements.get(2),
xStartPos + OffsetManager.SLOT_SIZE*2 + SLOT1_SLOT2_OFFSET + SLOT2_SLOT3_OFFSET, yStartPos));
        }
    }
}
Java:
public abstract class CreativeCodingMenu<T extends AbstractCodingChest<? extends TileEntity>> extends ContainerScreen<T> {

protected final TextureManager textureManager = Minecraft.getInstance().getTextureManager();

protected int titleLabelColor = 4210752;
protected int inventoryLabelColor = 4210752;

public CreativeCodingMenu(T container, PlayerInventory inventory, ITextComponent name, OffsetManager manager) {
super(container, inventory, name);
titleLabelX = manager.getTitleLabelX();
titleLabelY = manager.getTitleLabelY();
inventoryLabelX = manager.getInventoryLabelX();
inventoryLabelY = manager.getInventoryLabelY();
    }

@Override
    protected void renderLabels(@Nonnull MatrixStack matrixStack, int x, int y) {
this.font.draw(matrixStack, this.title, (float)this.titleLabelX, (float) this.titleLabelY, titleLabelColor);
this.font.draw(matrixStack, this.inventory.getDisplayName(), (float) this.inventoryLabelX,
(float) this.inventoryLabelY, inventoryLabelColor);
    }

@Override
    public void render(@Nonnull MatrixStack matrixStack, int x, int y, float partialTicks) {
super.render(matrixStack, x, y, partialTicks);
        renderTooltip(matrixStack, x, y);
    }

protected void renderMenuTexture(OffsetManager offsetManager, ResourceLocation texture, MatrixStack matrixStack) {
textureManager.bind(texture);
Vector2i pos = offsetManager.getTexturePosition(width, height);
        blit(matrixStack, pos.getX(), pos.getY(),
                offsetManager.getTextureX(), offsetManager.getTextureY(),
                offsetManager.getTextureMaxX(), offsetManager.getTextureMaxY());
    }
}
Java:
public class MathCodingBlockMenu extends CreativeCodingMenu<MathCodingChestContainer> {

public static final ResourceLocation BACKGROUND = new ResourceLocation(CreativeRebornClient.MOD_ID, "textures/gui/chests/math/ui.png");

public static final OffsetManager OFFSET_MANAGER = OffsetManager.builder()
.setInventoryXOffset(11).setInventoryYOffset(103)
.setTextureMaxX(210).setTextureMaxY(205)
.setTitleLabelX(-3).setTitleLabelY(-10)
.setInventoryLabelX(7).setInventoryLabelY(90)
            .build();

public MathCodingBlockMenu(MathCodingChestContainer container, PlayerInventory inventory, ITextComponent name) {
super(container, inventory, name, OFFSET_MANAGER);
titleLabelColor = ColorHelper.PackedColor.color(255, 255, 255, 255);
    }

@Override
    protected void renderBg(@Nonnull MatrixStack matrixStack, float v, int i, int i1) {
super.renderMenuTexture(OFFSET_MANAGER, BACKGROUND, matrixStack);
    }
}
Java:
public abstract class CodingChestTileEntity extends LockableLootTileEntity {

protected final InventoryArrayList items;
protected final int containerSize;
protected final ITextComponent name;

protected CodingChestTileEntity(TileEntityType<?> p_i48284_1_, int containerSize, ITextComponent name) {
super(p_i48284_1_);
this.items = new InventoryArrayList(containerSize);
this.containerSize = containerSize;
this.name = name;
    }

@Override
    protected @Nonnull NonNullList<ItemStack> getItems() {
return items.toNonNullList();
    }

@Override
    protected void setItems(@Nonnull NonNullList<ItemStack> nonNullList) {
for (int x = 0; x < containerSize; x++) {
this.items.set(x, nonNullList.get(x));
        }
    }

@Override
    protected @Nonnull ITextComponent getDefaultName() {
return name;
    }

@Override
    public int getContainerSize() {
return containerSize;
    }
}
Java:
public class MathChestTileEntity extends CodingChestTileEntity {

public MathChestTileEntity() {
super(TileEntityRegistry.MATH_CHEST.get(), 12, new TranslationTextComponent("chests.math"));
    }

@Override
    protected @Nonnull Container createMenu(int i, @Nonnull PlayerInventory playerInventory) {
return new MathCodingChestContainer(i, playerInventory, this);
    }
}
Как это исправить?
 
Сверху