Custom Form Syncs

This commit is contained in:
Kam committed 2024-04-15 15:04:41 -04:00
1 parent f2388539b7
commit bb0d90f754
3 files changed
+25

No files matched your search

+10
View File
@@ -1,8 +1,10 @@
package kamkeel.addon;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.controllers.data.PlayerData;
import noppes.npcs.entity.EntityNPCInterface;
@@ -35,4 +37,12 @@ public class DBCAddon {
public void writeToNBT(PlayerData playerData, NBTTagCompound nbtTagCompound){}
public void readFromNBT(PlayerData playerData, NBTTagCompound nbtTagCompound){}
public void syncPlayer(EntityPlayerMP playerMP){}
public void clientSync(NBTTagCompound compound, boolean syncEnd){}
public void syncUpdate(NBTTagCompound compound, ByteBuf buffer){}
public void syncRemove(int id){}
}
@@ -7,4 +7,7 @@ public class SyncType {
public static final int DIALOG = 4;
public static final int DIALOG_CATEGORY = 5;
public static final int PLAYER_DATA = 6;
// DBC ADDON
public static final int CUSTOM_FORM = 7;
}
@@ -1,6 +1,7 @@
package noppes.npcs.controllers;
import io.netty.buffer.ByteBuf;
import kamkeel.addon.DBCAddon;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
@@ -84,6 +85,8 @@ public class SyncController {
Server.sendData(player, EnumPacketClient.SYNC_END, SyncType.DIALOG_CATEGORY, new NBTTagCompound());
////////////////////////////////////////////////////////////////////////////////
DBCAddon.instance.syncPlayer(player);
PlayerData data = PlayerData.get(player);
if(data != null){
NoppesUtilServer.sendPlayerDataCompound(player, data.getSyncNBTFull(), false);
@@ -250,6 +253,9 @@ public class SyncController {
DialogController.Instance.categoriesSync = new HashMap<Integer, DialogCategory>();
}
}
else if(synctype == SyncType.CUSTOM_FORM){
DBCAddon.instance.clientSync(compound, syncEnd);
}
}
public static void clientSyncUpdate(int synctype, NBTTagCompound compound, ByteBuf buffer) {
@@ -308,6 +314,9 @@ public class SyncController {
}
QuestController.Instance.categories.put(category.id, category);
}
else if(synctype == SyncType.CUSTOM_FORM){
DBCAddon.instance.syncUpdate(compound, buffer);
}
}
public static void clientSyncRemove(int synctype, int id) {
@@ -338,6 +347,9 @@ public class SyncController {
QuestController.Instance.quests.keySet().removeAll(category.quests.keySet());
}
}
else if(synctype == SyncType.CUSTOM_FORM){
DBCAddon.instance.syncRemove(id);
}
}
}