MarkData to NPCs [1.12 Backport]

This commit is contained in:
Kam committed 2024-02-21 03:02:39 -05:00
1 parent 7f2a375323
commit 8ec795c98a
22 files changed
+473 -17

No files matched your search

@@ -8,6 +8,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.achievement.GuiAchievement;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
@@ -35,6 +36,7 @@ import noppes.npcs.constants.EnumPacketServer;
import noppes.npcs.controllers.RecipeController;
import noppes.npcs.controllers.data.Animation;
import noppes.npcs.controllers.data.AnimationData;
import noppes.npcs.controllers.data.MarkData;
import noppes.npcs.controllers.data.RecipeCarpentry;
import noppes.npcs.entity.EntityDialogNpc;
import noppes.npcs.entity.EntityNPCInterface;
@@ -103,6 +105,13 @@ public class PacketHandlerClient extends PacketHandlerServer{
RecipeController.Instance.anvilRecipes = RecipeController.syncRecipes;
RecipeController.syncRecipes = new HashMap<Integer, RecipeCarpentry>();
}
else if(type == EnumPacketClient.MARK_DATA){
Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(buffer.readInt());
if(!(entity instanceof EntityNPCInterface))
return;
MarkData data = MarkData.get((EntityNPCInterface) entity);
data.setNBT(Server.readNBT(buffer));
}
else if(type == EnumPacketClient.DIALOG){
Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(buffer.readInt());
if(entity == null || !(entity instanceof EntityNPCInterface))