-
Recently Browsing
- No registered users viewing this page.
-
Posts
-
IP: magicvalor.live Version: 1.19.4 Discord Website Server Trailer (Youtube) Spells, Magic, abilities, custom mobs, bosses, Wands, Quests... Welcome to Magic Valor, a Minecraft server unlike any other! Our server is focused on providing a unique and immersive experience for players who love spells, magic, and all things supernatural. Explore a vast and mysterious world, where enchanted abilities and custom mobs roam free. You will encounter powerful bosses that will put your courage and skill to the test, as you embark on quests and learn spells to help you on your journey. But the world of Valor is not just about individual play - it also provides opportunities for collaborative gameplay. Players can team up to build towns and establish nations from scratch. The world of Valor is constantly evolving with new content and features being added regularly. So grab your wand and let the journey begin! IP: magicvalor.live
-
By andreybadrey · Posted
It`s working stability used to enjoy -
By AwesomeDomi · Posted
Yes, I'm aware of it, I just don't know how to use it exactly -
By andreybadrey · Posted
I saw that the forum was also interested in this topic, so I will prescribe the package template import com.bodryak.gmod.variables.client.PDC; import com.google.common.collect.Maps; import net.minecraft.network.FriendlyByteBuf; import net.minecraftforge.network.NetworkEvent; import java.util.Map; import java.util.function.Supplier; public class PDSyncS2CPacket { private final Map<String, Long> toSync ; public PDSyncS2CPacket(Map<String, Long> map) { this.toSync = map; } public PDSyncS2CPacket(FriendlyByteBuf buf) { this.toSync = buf.readMap(Maps::newHashMapWithExpectedSize,FriendlyByteBuf::readUtf, FriendlyByteBuf::readLong); } public void toBytes(FriendlyByteBuf buf) { buf.writeMap(this.toSync, FriendlyByteBuf::writeUtf, FriendlyByteBuf::writeLong); } public boolean handle(Supplier<NetworkEvent.Context> supplier) { NetworkEvent.Context context = supplier.get(); context.enqueueWork(() -> { // HERE WE ARE ON THE CLIENT! if (this.toSync.get("lvl") != null){ PDC.setLvl(this.toSync.get("lvl")); System.out.println("Server send lvl " + this.toSync.get("lvl")); } if (this.toSync.get("exp") != null){ PDC.setExp(this.toSync.get("exp")); System.out.println("server send exp " + this.toSync.get("exp")); } if (this.toSync.get("nlv") != null){ PDC.setNlv(this.toSync.get("nlv")); System.out.println("server send exp to next lvl " + this.toSync.get("nlv")); } }); return true; } } Please, I beg you, if all this is not written correctly, give feedback -
By andreybadrey · Posted
It seems that I won one part, but still not completely public void toBytes(Map<String, Long> map,FriendlyByteBuf buf) { buf.writeMap(map, (friendlyByteBuf, s) -> {}, (friendlyByteBuf, aLong) -> {}); } But it's still not right, is it? and how to arrange {....} ? following the logic, I wrote this public void toBytes(Map<String, Long> map,FriendlyByteBuf buf) { buf.writeMap(map, FriendlyByteBuf::writeUtf, FriendlyByteBuf::writeLong); } in short, I won
-
-
Topics
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now