Capability сломалась на ровном месте.

Версия Minecraft
1.12.2
5,018
47
783
В общем:

Имеется мировая капа. Капа работает нормально. Какие то проблемы с сохранением, хотя полгода назад этот же самый код работал нормально(клянусь!)
Сетаю 6 месяц, командой. После чего данный код ниже, выдает результат:
Java:
  @Override
    public NBTBase writeNBT(Capability<IDate> capability, IDate instance, EnumFacing side)
    {
        System.out.println("data storage " + instance.getDay());
        NBTTagCompound compound = new NBTTagCompound();
        compound.setByte("day", instance.getDay());
        compound.setByte("week", instance.getWeek());
        compound.setByte("month", instance.getMonth());
        compound.setShort("year", instance.getYear());
        compound.setBoolean("isSnow", instance.getEnableSnow());
        return compound;
    }

    @Override
    public void readNBT(Capability<IDate> capability, IDate instance, EnumFacing side, NBTBase nbt)
    {
        NBTTagCompound compound = (NBTTagCompound) nbt;
        instance.setDay(compound.getByte("day"));
        instance.setWeek(compound.getByte("week"));
        instance.setMonth(compound.getByte("month"));
        instance.setYear(compound.getShort("year"));
        instance.setEnableSnow(compound.getBoolean("isSnow"));
    }
Сетается тут:

Java:
case 3:

            IDate cap = world.getCapability(DateProvider.DATE, null);
            String set = args[0];
            String amount = args[1];
            switch (set) {
            case "set": {
                String value = args[2];
                if (amount.equals("day")) {
                    cap.setDay(Byte.parseByte(value));
                    player.sendMessage(new TextComponentString("Set the day: " + Byte.parseByte(value)));
                 
                }
                if (amount.equals("month")) {
                    cap.setMonth(Byte.parseByte(value));
                 
                    player.sendMessage(new TextComponentString("Set the month: " + Byte.parseByte(value)));
                    player.sendMessage(new TextComponentString("Сurrent month: " + cap.getMonth()));
                    NetworkHandler.network.sendTo(new MonthSyncMessage(cap.getMonth()),(EntityPlayerMP)player);
                }
                if (amount.equals("year")) {
                    cap.setYear(Byte.parseByte(value));
                    player.sendMessage(new TextComponentString("Set the year: " + Byte.parseByte(value)));
                }
                break;
            }

            }
            break;
Код:
[21:09:26] [Server thread/INFO] [STDOUT]: [ru.legendgamer.Realism.Capability.WorldCAP.DateStorage:writeNBT:17]: data storage 0
[21:09:26] [Server thread/INFO] [STDOUT]: [ru.legendgamer.Realism.Capability.WorldCAP.DateStorage:writeNBT:17]: data storage 0
[21:09:26] [Server thread/INFO] [STDOUT]: [ru.legendgamer.Realism.Capability.WorldCAP.DateStorage:writeNBT:17]: data storage 0
Т.е что то происходит все таки. Собственно, месяц не сетается, что прекрасно показывается выводом цифр на клиенте. Пакеты с сервера отсылается на клиент, при сете нового значения. И короче, в итоге, мне непонятно, почему не сохраняется в нбт.
Все необходимые регистрации на месте, проверено.

И почему оно три раза выводится?:unsure:
 
Последнее редактирование:
Сверху