mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 16:37:45 +00:00
Profile Tab + Config Sync
This commit is contained in:
1 parent
c7c981f4a7
commit
62482c307c
5 files changed
+33
No files matched your search
@@ -136,6 +136,10 @@ public class PacketHandlerClient extends PacketHandlerServer{
|
||||
|
||||
SyncController.clientSyncRemove(synctype, id);
|
||||
}
|
||||
else if(type == EnumPacketClient.SYNC_CONFIG){
|
||||
NBTTagCompound configNBT = Server.readNBT(buffer);
|
||||
SyncController.receiveConfigs(configNBT);
|
||||
}
|
||||
else if(type == EnumPacketClient.MARK_DATA){
|
||||
Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(buffer.readInt());
|
||||
if(!(entity instanceof EntityNPCInterface))
|
||||
|
||||
@@ -8,6 +8,7 @@ import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.client.gui.util.GuiMenuSideButton;
|
||||
import noppes.npcs.client.gui.util.GuiNPCInterface;
|
||||
import noppes.npcs.config.ConfigClient;
|
||||
import noppes.npcs.config.ConfigMain;
|
||||
import tconstruct.client.tabs.InventoryTabCustomNpc;
|
||||
import tconstruct.client.tabs.TabRegistry;
|
||||
|
||||
@@ -67,6 +68,16 @@ public class GuiCNPCInventory extends GuiNPCInterface {
|
||||
addButton(dbcButton);
|
||||
}
|
||||
|
||||
if(ConfigMain.EnableProfiles){
|
||||
y += 21;
|
||||
GuiMenuSideButton profileButton = new GuiMenuSideButton(105, guiLeft + xSize + 37, this.guiTop + y, 22, 22, "");
|
||||
profileButton.rightSided = true;
|
||||
profileButton.active = activeTab == 5;
|
||||
profileButton.renderIconPosX = 80;
|
||||
profileButton.renderResource = specialIcons;
|
||||
addButton(profileButton);
|
||||
}
|
||||
|
||||
y += 21;
|
||||
GuiMenuSideButton clientButton = new GuiMenuSideButton(103, guiLeft + xSize + 37, this.guiTop + y, 22, 22, "");
|
||||
clientButton.rightSided = true;
|
||||
|
||||
@@ -17,6 +17,7 @@ public class ConfigMain
|
||||
public final static String NPC = "NPC";
|
||||
public final static String UPDATE = "Update";
|
||||
public final static String PARTY = "PARTY";
|
||||
public final static String PROFILES = "Profile";
|
||||
|
||||
/**
|
||||
* General Main Properties
|
||||
@@ -79,6 +80,8 @@ public class ConfigMain
|
||||
public static Property DefaultMaxPartySizeProperty;
|
||||
public static int DefaultMaxPartySize = 4;
|
||||
|
||||
public static boolean EnableProfiles = true;
|
||||
|
||||
/**
|
||||
* General NPC Properties
|
||||
**/
|
||||
@@ -216,6 +219,9 @@ public class ConfigMain
|
||||
TrackedQuestUpdateFrequencyProperty = config.get(UPDATE, "Tracked Quest Update Frequency", 5, "How often in seconds to update a players tracked quest. [Only applies to Item Quest currently]");
|
||||
TrackedQuestUpdateFrequency = TrackedQuestUpdateFrequencyProperty.getInt(5);
|
||||
|
||||
// PROFILES
|
||||
EnableProfiles = config.get(PROFILES, "Enable Profiles", true, "Allow the use of character Profiles").getBoolean(true);
|
||||
|
||||
// Convert to Legacy
|
||||
if(CustomNpcs.legacyExist){
|
||||
EnableUpdateChecker = LegacyConfig.EnableUpdateChecker;
|
||||
|
||||
@@ -56,6 +56,7 @@ public enum EnumPacketClient {
|
||||
SYNC_WEAPON,
|
||||
MARK_DATA,
|
||||
SYNC_ADD, SYNC_END, SYNC_UPDATE, SYNC_REMOVE, SYNC_PLAYER,
|
||||
SYNC_CONFIG,
|
||||
DBC_FORM,
|
||||
LARGE_NBT_PART, LARGE_NBT_END,
|
||||
PARTY_DATA
|
||||
|
||||
@@ -7,6 +7,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.config.ConfigMain;
|
||||
import noppes.npcs.constants.EnumPacketClient;
|
||||
import noppes.npcs.constants.SyncType;
|
||||
import noppes.npcs.controllers.data.*;
|
||||
@@ -15,6 +16,16 @@ import java.util.HashMap;
|
||||
|
||||
public class SyncController {
|
||||
|
||||
public static void syncConfigs(EntityPlayerMP player){
|
||||
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
||||
nbtTagCompound.setBoolean("Profiles", true);
|
||||
Server.sendData(player, EnumPacketClient.SYNC_CONFIG, nbtTagCompound);
|
||||
}
|
||||
|
||||
public static void receiveConfigs(NBTTagCompound compound){
|
||||
ConfigMain.EnableProfiles = compound.getBoolean("Profiles");
|
||||
}
|
||||
|
||||
public static void syncPlayer(EntityPlayerMP player){
|
||||
NBTTagList list = new NBTTagList();
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
|
||||
Reference in new issue
Block a user