Jump to content

Tupaç

Members
  • Posts

    18
  • Joined

  • Last visited

Posts posted by Tupaç

  1. 1 minute ago, ChampionAsh5357 said:

    But why not save the data on the player regardless? A singleplayer world still has as associated integrated server that others can join.

    Sorry I may be explaining this incorrectly, the idea is that any player with the mod can join a server that doesn't have the mod, so I can't ask the server to save my data because of this, witch I solve saving the data on a json in the profile folder.

  2. Hi!  i want to save a json file in the world save folder, how can i locate that folder client side? i know that getWorldName() exists, but Minecrafts allows to have multiple worlds with the same name but with different folders.

    An alternative could be creating a custom folder and delete it when the world gets deleted, is there any way to know when the world get deleted?

    For servers I am planning to use a custom folder.

     

    Cheers! ?

  3. I have a TE that stores a List, i'm using a ListNBT with CompoundNBT to store the block position and the list beloging to the TE, it works perfectly on client, but it does not load/save on server.

     

    This are probably the useful errors:

    Client

    Quote

        [Render thread/ERROR] [ne.mi.fm.ne.si.IndexedMessageCodec/SIMPLENET]: Received empty payload on channel fml:handshake
        [Netty Client IO #0/ERROR] [minecraft/ArgumentTypes]: Could not deserialize minecraft:
        [Netty Client IO #0/ERROR] [minecraft/ArgumentTypes]: Could not deserialize minecraft:

    Server:

    Quote

        [Netty Server IO #1/ERROR] [minecraft/ArgumentTypes]: Could not serialize net.minecraftforge.server.command.ModIdArgument@37225730 (class net.minecraftforge.server.command.ModIdArgument) - will not be sent to client!
        [Netty Server IO #1/ERROR] [minecraft/ArgumentTypes]: Could not serialize net.minecraftforge.server.command.EnumArgument@1d34fe74 (class net.minecraftforge.server.command.EnumArgument) - will not be sent to client!

     

     

    And this is the write/read functions:

    Quote
    
    	@Nonnull
        @Override
        public CompoundNBT write(CompoundNBT compound) {
            ListNBT mList = new ListNBT();
            Map<BlockPos, Set<ResourceLocation>> mPos = SMBlock.getMap();
            if (mPos != null) {
                mPos.forEach((pos, rec) -> {
                    if (rec.size() > 0) {
                        CompoundNBT map = new CompoundNBT();
                        map.putString(pos.toString(), rec.toString());
                        mList.add(map);
                    }
                });
            }
            compound.put("mComp", mList);
            return super.write(compound);
        }
    
        @Override
        public void read(CompoundNBT compound) {
            Set<ResourceLocation> mPos = new HashSet<>();
            ListNBT mList = compound.getList("mComp", 10);
            for (int i = 0; i < mList.size(); i++) {
                CompoundNBT mCompound = mList.getCompound(i);
                BlockPos position = getPosition(mCompound.keySet().toString());
                String sArray = mCompound.getString(position.toString());
                if (SMBlock.getPositions().contains(position)) return;
                SMBlock.setPosition(position);
                if (!sArray.equals("")) {
                    for (String s : sArray.split(", ")) {
                        sList.add(new ResourceLocation(s.replaceAll("]\\[", "")));
                    }
                }
                SMBlock.setMap(position, rec);
                sArray.clear();
            }
            super.read(compound);
        }

    Obviously i am missing something, can anyone help me?

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.