Some GUI and Packet Fixes

This commit is contained in:
Kam committed 2026-03-10 04:50:28 -04:00
1 parent 270cb26460
commit d1d4155c88
4 files changed
+50 -33

No files matched your search

@@ -14,6 +14,7 @@ import kamkeel.npcs.util.ByteBufUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import noppes.npcs.constants.EnumCategoryType;
import noppes.npcs.controllers.CategoryManager;
import java.io.IOException;
@@ -63,6 +64,11 @@ public final class AbilityCategoryMovePacket extends AbstractPacket {
String itemName = ByteBufUtils.readString(in);
int cat = in.readInt();
// Validate target category exists (0 = Uncategorized is always valid)
CategoryManager cm = CategorySavePacket.getManager(type);
if (cm == null) return;
if (cat != CategoryManager.UNCATEGORIZED_ID && cm.getCategory(cat) == null) return;
switch (type) {
case EnumCategoryType.ABILITY:
AbilityController.Instance.moveCustomAbilityToCategory(itemName, cat);
@@ -14,6 +14,7 @@ import net.minecraft.entity.player.EntityPlayerMP;
import kamkeel.npcs.controllers.AbilityController;
import noppes.npcs.constants.EnumCategoryType;
import noppes.npcs.controllers.AnimationController;
import noppes.npcs.controllers.CategoryManager;
import noppes.npcs.controllers.CustomEffectController;
import noppes.npcs.controllers.LinkedItemController;
@@ -65,6 +66,11 @@ public final class CategoryMoveItemPacket extends AbstractPacket {
int item = in.readInt();
int cat = in.readInt();
// Validate target category exists (0 = Uncategorized is always valid)
CategoryManager cm = CategorySavePacket.getManager(type);
if (cm == null) return;
if (cat != CategoryManager.UNCATEGORIZED_ID && cm.getCategory(cat) == null) return;
switch (type) {
case EnumCategoryType.EFFECT: CustomEffectController.getInstance().moveItemToCategory(item, cat); break;
case EnumCategoryType.ANIMATION: AnimationController.getInstance().moveItemToCategory(item, cat); break;