Remove json, implement mutual exclusives, adjustments & fix bugs
This commit is contained in:
@@ -9,7 +9,6 @@ import net.fretux.skillengine.client.SkilltreeClientState;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class ClientboundNodeUnlockedPacket {
|
||||
|
||||
private final ResourceLocation id;
|
||||
private final int newSkillPoints;
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ public class PacketHandler {
|
||||
|
||||
private static final String PROTOCOL = "1";
|
||||
public static final SimpleChannel CHANNEL = NetworkRegistry.ChannelBuilder
|
||||
.named(new ResourceLocation(SkillEngine.MODID, "network"))
|
||||
.named(ResourceLocation.fromNamespaceAndPath(SkillEngine.MODID, "network"))
|
||||
.clientAcceptedVersions(PROTOCOL::equals)
|
||||
.serverAcceptedVersions(PROTOCOL::equals)
|
||||
.networkProtocolVersion(() -> PROTOCOL)
|
||||
|
||||
@@ -2,7 +2,6 @@ package net.fretux.skillengine.network;
|
||||
|
||||
import net.fretux.skillengine.capability.SkillEngineCapabilities;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.fretux.skillengine.network.PacketHandler;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.network.NetworkEvent;
|
||||
@@ -36,7 +35,6 @@ public class ServerboundBindAbilityPacket {
|
||||
player.getCapability(SkillEngineCapabilities.PLAYER_SKILLS).ifPresent(data ->
|
||||
data.bindAbility(msg.slot, msg.abilityId)
|
||||
);
|
||||
// Sync back to client so UI reflects updated bindings
|
||||
PacketHandler.syncSkillsTo(player);
|
||||
});
|
||||
ctx.get().setPacketHandled(true);
|
||||
|
||||
@@ -12,17 +12,14 @@ import net.minecraftforge.network.PacketDistributor;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class ServerboundUnlockNodePacket {
|
||||
|
||||
private final ResourceLocation nodeId;
|
||||
|
||||
public ServerboundUnlockNodePacket(ResourceLocation nodeId) {
|
||||
this.nodeId = nodeId;
|
||||
}
|
||||
|
||||
public static void encode(ServerboundUnlockNodePacket msg, FriendlyByteBuf buf) {
|
||||
buf.writeResourceLocation(msg.nodeId);
|
||||
}
|
||||
|
||||
|
||||
public static ServerboundUnlockNodePacket decode(FriendlyByteBuf buf) {
|
||||
return new ServerboundUnlockNodePacket(buf.readResourceLocation());
|
||||
}
|
||||
@@ -73,7 +70,6 @@ public class ServerboundUnlockNodePacket {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
ctx.get().setPacketHandled(true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user