mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-28 00:55:38 +00:00
Merge remote-tracking branch 'refs/remotes/origin/packet' into animation-events-2
# Conflicts: # src/api # src/main/java/noppes/npcs/CommonProxy.java # src/main/java/noppes/npcs/ServerEventsHandler.java # src/main/java/noppes/npcs/client/PacketHandlerClient.java # src/main/java/noppes/npcs/client/gui/global/GuiNPCManageAnimations.java # src/main/java/noppes/npcs/controllers/data/AnimationData.java
This commit is contained in:
commit
00af353e65
602 files changed
+29702
-6562
No files matched your search
@@ -1,24 +0,0 @@
|
||||
package noppes.npcs.client;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class Client {
|
||||
|
||||
public static void sendData(final EnumPacketServer enu, final Object... obs) {
|
||||
ByteBuf buffer = Unpooled.buffer();
|
||||
try {
|
||||
if(!Server.fillBuffer(buffer, enu, obs))
|
||||
return;
|
||||
CustomNpcs.Channel.sendToServer(new FMLProxyPacket(buffer, "CustomNPCs"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.ObfuscationReflectionHelper;
|
||||
import kamkeel.addon.client.DBCClient;
|
||||
import kamkeel.npcs.addon.client.DBCClient;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
@@ -32,6 +32,7 @@ import noppes.npcs.*;
|
||||
import noppes.npcs.api.IWorld;
|
||||
import noppes.npcs.blocks.tiles.*;
|
||||
import noppes.npcs.client.controllers.*;
|
||||
import noppes.npcs.client.fx.EntityBigSmokeFX;
|
||||
import noppes.npcs.client.fx.EntityElementalStaffFX;
|
||||
import noppes.npcs.client.fx.EntityEnderFX;
|
||||
import noppes.npcs.client.fx.EntityRainbowFX;
|
||||
@@ -76,7 +77,7 @@ import java.util.Random;
|
||||
|
||||
public class ClientProxy extends CommonProxy {
|
||||
public static KeyBinding NPCButton;
|
||||
|
||||
public static final Random RAND = new Random();
|
||||
public static FontContainer Font;
|
||||
|
||||
public void load() {
|
||||
@@ -84,8 +85,6 @@ public class ClientProxy extends CommonProxy {
|
||||
|
||||
Font = new FontContainer(ConfigClient.FontType, ConfigClient.FontSize);
|
||||
createFolders();
|
||||
CustomNpcs.Channel.register(new PacketHandlerClient());
|
||||
CustomNpcs.ChannelPlayer.register(new PacketHandlerPlayer());
|
||||
new MusicController();
|
||||
new ScriptSoundController();
|
||||
|
||||
@@ -246,7 +245,8 @@ public class ClientProxy extends CommonProxy {
|
||||
return new GuiNpcPather(npc);
|
||||
|
||||
else if (gui == EnumGuiType.ManageFactions)
|
||||
return new GuiNPCManageFactions(npc);
|
||||
return new GuiNPCManageMagic(npc);
|
||||
// return new GuiNPCManageFactions(npc);
|
||||
|
||||
else if (gui == EnumGuiType.ManageCustomForms)
|
||||
return DBCClient.Instance.manageCustomForms(npc);
|
||||
@@ -274,7 +274,7 @@ public class ClientProxy extends CommonProxy {
|
||||
return new GuiNPCManageAnimations(animNpc, save);
|
||||
}
|
||||
else if (gui == EnumGuiType.ManageLinked)
|
||||
return new GuiNPCManageLinkedNpc(npc);
|
||||
return new GuiNPCManageLinked(npc);
|
||||
|
||||
else if (gui == EnumGuiType.ManageTransport)
|
||||
return new GuiNPCManageTransporters(npc);
|
||||
@@ -291,6 +291,9 @@ public class ClientProxy extends CommonProxy {
|
||||
else if (gui == EnumGuiType.ManageBanks)
|
||||
return new GuiNPCManageBanks(npc, (ContainerManageBanks) container);
|
||||
|
||||
else if (gui == EnumGuiType.ManageEffects)
|
||||
return new GuiNPCManageEffects(npc);
|
||||
|
||||
else if (gui == EnumGuiType.MainMenuGlobal)
|
||||
return new GuiNPCGlobalMainMenu(npc);
|
||||
|
||||
@@ -318,9 +321,12 @@ public class ClientProxy extends CommonProxy {
|
||||
else if (gui == EnumGuiType.ScriptItem)
|
||||
return new GuiScriptItem();
|
||||
|
||||
else if (gui == EnumGuiType.PlayerAnvil)
|
||||
else if (gui == EnumGuiType.PlayerCarpentryBench)
|
||||
return new GuiNpcCarpentryBench((ContainerCarpentryBench) container);
|
||||
|
||||
else if (gui == EnumGuiType.PlayerAnvil)
|
||||
return new GuiNpcAnvil((ContainerAnvilRepair) container);
|
||||
|
||||
else if (gui == EnumGuiType.SetupFollower)
|
||||
return new GuiNpcFollowerSetup(npc, (ContainerNPCFollowerSetup) container);
|
||||
|
||||
@@ -366,7 +372,7 @@ public class ClientProxy extends CommonProxy {
|
||||
else if (gui == EnumGuiType.RedstoneBlock)
|
||||
return new GuiNpcRedstoneBlock(x, y, z);
|
||||
|
||||
else if(gui == EnumGuiType.MobSpawner)
|
||||
else if(gui == EnumGuiType.Cloner)
|
||||
return new GuiNpcMobSpawner(x, y, z);
|
||||
|
||||
else if(gui == EnumGuiType.MobSpawnerMounter)
|
||||
@@ -543,6 +549,17 @@ public class ClientProxy extends CommonProxy {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateBigSmokeParticles(World world, int x, int y, int z, boolean signalFire)
|
||||
{
|
||||
if (RAND.nextFloat() < 0.11F)
|
||||
{
|
||||
float[] colours = new float[0];
|
||||
for (int i = 0; i < RAND.nextInt(2) + 1; ++i)
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(new EntityBigSmokeFX(world, x, y, z, signalFire, colours));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAchievementDesc(Achievement achievement) {
|
||||
return achievement.getDescription();
|
||||
|
||||
@@ -5,11 +5,12 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.InputEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
|
||||
import kamkeel.addon.DBCAddon;
|
||||
import kamkeel.addon.client.DBCClient;
|
||||
import kamkeel.npcs.addon.client.DBCClient;
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.player.CheckPlayerValue;
|
||||
import kamkeel.npcs.network.packets.player.InputDevicePacket;
|
||||
import kamkeel.npcs.network.packets.player.ScreenSizePacket;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.SoundHandler;
|
||||
import net.minecraft.client.audio.SoundManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.inventory.ContainerPlayer;
|
||||
import net.minecraft.world.World;
|
||||
@@ -49,7 +50,7 @@ public class ClientTickHandler{
|
||||
}
|
||||
if(mc.thePlayer != null && mc.thePlayer.openContainer instanceof ContainerPlayer){
|
||||
if(otherContainer){
|
||||
NoppesUtilPlayer.sendData(EnumPlayerPacket.CheckQuestCompletion);
|
||||
PacketClient.sendClient(new CheckPlayerValue(CheckPlayerValue.Type.CheckQuestCompletion));
|
||||
otherContainer = false;
|
||||
}
|
||||
}
|
||||
@@ -74,7 +75,7 @@ public class ClientTickHandler{
|
||||
if(Minecraft.getMinecraft().thePlayer!=null && (prevWidth!=mc.displayWidth || prevHeight!=mc.displayHeight)){
|
||||
prevWidth = mc.displayWidth;
|
||||
prevHeight = mc.displayHeight;
|
||||
NoppesUtilPlayer.sendData(EnumPlayerPacket.ScreenSize,mc.displayWidth,mc.displayHeight);
|
||||
PacketClient.sendClient(new ScreenSizePacket(mc.displayWidth,mc.displayHeight));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,22 +84,7 @@ public class ClientTickHandler{
|
||||
if(Mouse.getEventButton() == -1 && Mouse.getEventDWheel() == 0)
|
||||
return;
|
||||
|
||||
boolean isCtrlPressed = Keyboard.isKeyDown(157) || Keyboard.isKeyDown(29);
|
||||
boolean isShiftPressed = Keyboard.isKeyDown(54) || Keyboard.isKeyDown(42);
|
||||
boolean isAltPressed = Keyboard.isKeyDown(184) || Keyboard.isKeyDown(56);
|
||||
boolean isMetaPressed = Keyboard.isKeyDown(220) || Keyboard.isKeyDown(219);
|
||||
|
||||
StringBuilder keysDownString = new StringBuilder();
|
||||
for (int i = 0; i < Keyboard.getKeyCount(); i++) {//Creates a comma separated string of the integer IDs of held keys
|
||||
if (Keyboard.isKeyDown(i)) {
|
||||
keysDownString.append(Integer.valueOf(i)).append(",");
|
||||
}
|
||||
}
|
||||
if (keysDownString.length() > 0) {//Removes last comma for later parsing
|
||||
keysDownString.deleteCharAt(keysDownString.length() - 1);
|
||||
}
|
||||
|
||||
NoppesUtilPlayer.sendData(EnumPlayerPacket.MouseClicked, Mouse.getEventButton(),Mouse.getEventDWheel(),Mouse.isButtonDown(Mouse.getEventButton()), isCtrlPressed, isShiftPressed, isAltPressed, isMetaPressed, keysDownString.toString());
|
||||
InputDevicePacket.sendMouse(Mouse.getEventButton(),Mouse.getEventDWheel(),Mouse.isButtonDown(Mouse.getEventButton()));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@@ -130,23 +116,9 @@ public class ClientTickHandler{
|
||||
|
||||
if(!Keyboard.isRepeatEvent()) {
|
||||
int key = Keyboard.getEventKey();
|
||||
boolean isCtrlPressed = Keyboard.isKeyDown(157) || Keyboard.isKeyDown(29);
|
||||
boolean isShiftPressed = Keyboard.isKeyDown(54) || Keyboard.isKeyDown(42);
|
||||
boolean isAltPressed = Keyboard.isKeyDown(184) || Keyboard.isKeyDown(56);
|
||||
boolean isMetaPressed = Keyboard.isKeyDown(220) || Keyboard.isKeyDown(219);
|
||||
boolean keyDown = Keyboard.isKeyDown(key);
|
||||
|
||||
StringBuilder keysDownString = new StringBuilder();
|
||||
for (int i = 0; i < Keyboard.getKeyCount(); i++) {//Creates a comma separated string of the integer IDs of held keys
|
||||
if (Keyboard.isKeyDown(i)) {
|
||||
keysDownString.append(Integer.valueOf(i)).append(",");
|
||||
}
|
||||
}
|
||||
if (keysDownString.length() > 0) {//Removes last comma for later parsing
|
||||
keysDownString.deleteCharAt(keysDownString.length() - 1);
|
||||
}
|
||||
|
||||
NoppesUtilPlayer.sendData(EnumPlayerPacket.KeyPressed, key, isCtrlPressed, isShiftPressed, isAltPressed, isMetaPressed, keyDown, keysDownString.toString());
|
||||
InputDevicePacket.sendKeyboard(key, keyDown);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package noppes.npcs.client;
|
||||
|
||||
import kamkeel.addon.DBCAddon;
|
||||
import kamkeel.addon.GeckoAddon;
|
||||
import kamkeel.npcs.addon.DBCAddon;
|
||||
import kamkeel.npcs.addon.GeckoAddon;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.boss.EntityDragon;
|
||||
import net.minecraft.entity.passive.EntityChicken;
|
||||
|
||||
@@ -1,22 +1,20 @@
|
||||
package noppes.npcs.client;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.GuiRequestPacket;
|
||||
import kamkeel.npcs.network.packets.request.IsGuiOpenInform;
|
||||
import kamkeel.npcs.util.ByteBufUtils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTSizeTracker;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.client.fx.CustomFX;
|
||||
import noppes.npcs.client.gui.player.GuiDialogInteract;
|
||||
import noppes.npcs.client.gui.player.GuiQuestCompletion;
|
||||
import noppes.npcs.client.gui.util.GuiContainerNPCInterface;
|
||||
@@ -24,20 +22,16 @@ import noppes.npcs.client.gui.util.GuiNPCInterface;
|
||||
import noppes.npcs.client.gui.util.IScrollData;
|
||||
import noppes.npcs.client.gui.util.IScrollGroup;
|
||||
import noppes.npcs.constants.EnumGuiType;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
import noppes.npcs.controllers.data.Dialog;
|
||||
import noppes.npcs.controllers.data.Quest;
|
||||
import noppes.npcs.controllers.data.SkinOverlay;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.scripted.ScriptParticle;
|
||||
import org.lwjgl.Sys;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.util.HashMap;
|
||||
import java.util.Random;
|
||||
import java.util.Vector;
|
||||
|
||||
public class NoppesUtil {
|
||||
@@ -47,31 +41,10 @@ public class NoppesUtil {
|
||||
}
|
||||
|
||||
public static void requestOpenGUI(EnumGuiType gui, int i, int j, int k) {
|
||||
Client.sendData(EnumPacketServer.Gui, gui.ordinal(), i, j, k);
|
||||
PacketClient.sendClient(new GuiRequestPacket(gui.ordinal(), i, j, k));
|
||||
}
|
||||
|
||||
public static void spawnParticle(ByteBuf buffer) throws IOException{
|
||||
double posX = buffer.readDouble();
|
||||
double posY = buffer.readDouble();
|
||||
double posZ = buffer.readDouble();
|
||||
float height = buffer.readFloat();
|
||||
float width = buffer.readFloat();
|
||||
float yOffset = buffer.readFloat();
|
||||
|
||||
String particle = Server.readString(buffer);
|
||||
World worldObj = Minecraft.getMinecraft().theWorld;
|
||||
|
||||
Random rand = worldObj.rand;
|
||||
if(particle.equals("heal")){
|
||||
for (int k = 0; k < 6; k++)
|
||||
{
|
||||
worldObj.spawnParticle("instantSpell", posX + (rand.nextDouble() - 0.5D) * (double)width, (posY + rand.nextDouble() * (double)height) - (double)yOffset, posZ + (rand.nextDouble() - 0.5D) * (double)width, 0, 0, 0);
|
||||
worldObj.spawnParticle("spell", posX + (rand.nextDouble() - 0.5D) * (double)width, (posY + rand.nextDouble() * (double)height) - (double)yOffset, posZ + (rand.nextDouble() - 0.5D) * (double)width, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateSkinOverlayData(EntityPlayer player, NBTTagCompound compound) {
|
||||
public static void updateSkinOverlayData(EntityPlayer player, NBTTagCompound compound) {
|
||||
HashMap<Integer, SkinOverlay> skinOverlays = new HashMap<>();
|
||||
HashMap<Integer, SkinOverlay> oldOverlays = new HashMap<>();
|
||||
NBTTagList skinOverlayList = compound.getTagList("SkinOverlayData",10);
|
||||
@@ -90,39 +63,7 @@ public class NoppesUtil {
|
||||
ClientCacheHandler.skinOverlays.put(player.getUniqueID(), skinOverlays);
|
||||
}
|
||||
|
||||
public static void spawnScriptedParticle(EntityPlayer player, ByteBuf buffer){
|
||||
Minecraft minecraft = Minecraft.getMinecraft();
|
||||
|
||||
NBTTagCompound compound;
|
||||
ScriptParticle particle;
|
||||
try {
|
||||
compound = Server.readNBT(buffer);
|
||||
particle = ScriptParticle.fromNBT(compound);
|
||||
} catch (IOException ignored) {
|
||||
return;
|
||||
}
|
||||
|
||||
World worldObj = player.worldObj;
|
||||
if (worldObj == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Entity entity = null;
|
||||
if (compound.hasKey("EntityID")) {
|
||||
entity = worldObj.getEntityByID(compound.getInteger("EntityID"));
|
||||
if (entity != null)
|
||||
worldObj = entity.worldObj;
|
||||
else return;
|
||||
}
|
||||
|
||||
CustomFX fx = CustomFX.fromScriptedParticle(particle, worldObj, entity);
|
||||
|
||||
for(int i = 0; i < particle.amount; i++){
|
||||
minecraft.effectRenderer.addEffect(fx);
|
||||
}
|
||||
}
|
||||
|
||||
public static void clickSound() {
|
||||
public static void clickSound() {
|
||||
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
}
|
||||
|
||||
@@ -202,7 +143,7 @@ public class NoppesUtil {
|
||||
try {
|
||||
int size = buffer.readInt();
|
||||
for(int i = 0; i < size; i++){
|
||||
data.add(Server.readString(buffer));
|
||||
data.add(ByteBufUtils.readString(buffer));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -219,7 +160,7 @@ public class NoppesUtil {
|
||||
int size = buffer.readInt();
|
||||
for(int i = 0; i < size; i++){
|
||||
int id = buffer.readInt();
|
||||
String name = Server.readString(buffer);
|
||||
String name = ByteBufUtils.readString(buffer);
|
||||
group.put(name, id);
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
@@ -234,7 +175,7 @@ public class NoppesUtil {
|
||||
int size = buffer.readInt();
|
||||
for(int i = 0; i < size; i++){
|
||||
int id = buffer.readInt();
|
||||
String name = Server.readString(buffer);
|
||||
String name = ByteBufUtils.readString(buffer);
|
||||
group.put(name, id);
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
@@ -250,18 +191,6 @@ public class NoppesUtil {
|
||||
group = new HashMap<String,Integer>();
|
||||
}
|
||||
|
||||
public static void addScrollData(ByteBuf buffer) {
|
||||
try {
|
||||
int size = buffer.readInt();
|
||||
for(int i = 0; i < size; i++){
|
||||
int id = buffer.readInt();
|
||||
String name = Server.readString(buffer);
|
||||
data.put(name, id);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
public static void setScrollData(ByteBuf buffer) {
|
||||
GuiScreen gui = Minecraft.getMinecraft().currentScreen;
|
||||
if(gui == null)
|
||||
@@ -270,7 +199,7 @@ public class NoppesUtil {
|
||||
int size = buffer.readInt();
|
||||
for(int i = 0; i < size; i++){
|
||||
int id = buffer.readInt();
|
||||
String name = Server.readString(buffer);
|
||||
String name = ByteBufUtils.readString(buffer);
|
||||
data.put(name, id);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@@ -327,53 +256,6 @@ public class NoppesUtil {
|
||||
}
|
||||
|
||||
public static void isGUIOpen(boolean isGUIOpen) {
|
||||
Client.sendData(EnumPacketServer.IsGuiOpen, isGUIOpen);
|
||||
PacketClient.sendClient(new IsGuiOpenInform(isGUIOpen));
|
||||
}
|
||||
|
||||
|
||||
private static byte[] accumulatedData = new byte[0];
|
||||
public static void handleLargeData(byte[] chunk) {
|
||||
// Append the chunk to the accumulated data
|
||||
accumulatedData = concatByteArrays(accumulatedData, chunk);
|
||||
}
|
||||
|
||||
public static void handlePlayerDataEnd(boolean sync) {
|
||||
NBTTagCompound compound;
|
||||
try {
|
||||
compound = CompressedStreamTools.func_152457_a(accumulatedData, new NBTSizeTracker(2097152L));
|
||||
if(sync){
|
||||
ClientCacheHandler.playerData.setSyncNBT(compound);
|
||||
}
|
||||
else {
|
||||
ClientCacheHandler.playerData.setSyncNBTFull(compound);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
} finally {
|
||||
// Reset the accumulated data after processing
|
||||
accumulatedData = new byte[0];
|
||||
}
|
||||
}
|
||||
|
||||
public static void handleFormEnd() {
|
||||
NBTTagCompound compound;
|
||||
try {
|
||||
compound = CompressedStreamTools.func_152457_a(accumulatedData, new NBTSizeTracker(2097152L));
|
||||
ClientCacheHandler.playerData.setDBCSync(compound);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
} finally {
|
||||
accumulatedData = new byte[0];
|
||||
}
|
||||
}
|
||||
|
||||
// Utility method to concatenate two byte arrays
|
||||
private static byte[] concatByteArrays(byte[] a, byte[] b) {
|
||||
byte[] result = new byte[a.length + b.length];
|
||||
System.arraycopy(a, 0, result, 0, a.length);
|
||||
System.arraycopy(b, 0, result, a.length, b.length);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -1,448 +0,0 @@
|
||||
package noppes.npcs.client;
|
||||
|
||||
import cpw.mods.fml.common.ObfuscationReflectionHelper;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.network.FMLNetworkEvent.ClientCustomPacketEvent;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
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.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.stats.Achievement;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.village.MerchantRecipeList;
|
||||
import noppes.npcs.*;
|
||||
import noppes.npcs.client.ClientProxy.FontContainer;
|
||||
import noppes.npcs.client.controllers.MusicController;
|
||||
import noppes.npcs.client.controllers.ScriptClientSound;
|
||||
import noppes.npcs.client.controllers.ScriptSoundController;
|
||||
import noppes.npcs.client.gui.GuiNpcMobSpawnerAdd;
|
||||
import noppes.npcs.client.gui.OverlayQuestTracking;
|
||||
import noppes.npcs.client.gui.customoverlay.OverlayCustom;
|
||||
import noppes.npcs.client.gui.player.GuiBook;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.config.ConfigClient;
|
||||
import noppes.npcs.constants.EnumGuiType;
|
||||
import noppes.npcs.constants.EnumPacketClient;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
import noppes.npcs.controllers.RecipeController;
|
||||
import noppes.npcs.controllers.SyncController;
|
||||
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;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class PacketHandlerClient extends PacketHandlerServer{
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPacketData(ClientCustomPacketEvent event) {
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
ByteBuf buffer = event.packet.payload();
|
||||
try {
|
||||
client(buffer,(EntityPlayer) player,EnumPacketClient.values()[buffer.readInt()]);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void client(ByteBuf buffer, final EntityPlayer player, EnumPacketClient type) throws IOException{
|
||||
if(type == EnumPacketClient.CHATBUBBLE){
|
||||
Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(buffer.readInt());
|
||||
if(entity == null || !(entity instanceof EntityNPCInterface))
|
||||
return;
|
||||
EntityNPCInterface npc = (EntityNPCInterface) entity;
|
||||
if(npc.messages == null)
|
||||
npc.messages = new RenderChatMessages();
|
||||
String text = NoppesStringUtils.formatText(Server.readString(buffer), player, npc);
|
||||
npc.messages.addMessage(text, npc);
|
||||
|
||||
if(buffer.readBoolean())
|
||||
player.addChatMessage(new ChatComponentTranslation(npc.getCommandSenderName() + ": " + text));
|
||||
}
|
||||
else if(type == EnumPacketClient.CHAT){
|
||||
if(!ConfigClient.ChatAlerts)
|
||||
return;
|
||||
|
||||
String message = "";
|
||||
String str;
|
||||
while((str = Server.readString(buffer)) != null && !str.isEmpty())
|
||||
message += StatCollector.translateToLocal(str);
|
||||
|
||||
player.addChatMessage(new ChatComponentTranslation(message));
|
||||
}
|
||||
else if(type == EnumPacketClient.MESSAGE || type == EnumPacketClient.PARTY_MESSAGE){
|
||||
if(!ConfigClient.BannerAlerts)
|
||||
return;
|
||||
|
||||
String description = StatCollector.translateToLocal(Server.readString(buffer));
|
||||
String message = Server.readString(buffer);
|
||||
Achievement ach = type == EnumPacketClient.MESSAGE ? new MessageAchievement(message, description) : new MessageAchievement(CustomItems.bag == null ? Items.paper : CustomItems.bag, message, description);
|
||||
Minecraft.getMinecraft().guiAchievement.func_146256_a(ach);
|
||||
ObfuscationReflectionHelper.setPrivateValue(GuiAchievement.class, Minecraft.getMinecraft().guiAchievement, ach.getDescription(), 4);
|
||||
}
|
||||
else if(type == EnumPacketClient.SYNCRECIPES_ADD){
|
||||
NBTTagList list = Server.readNBT(buffer).getTagList("recipes", 10);
|
||||
if(list == null)
|
||||
return;
|
||||
for(int i = 0; i < list.tagCount(); i++)
|
||||
{
|
||||
RecipeCarpentry recipe = RecipeCarpentry.read(list.getCompoundTagAt(i));
|
||||
RecipeController.syncRecipes.put(recipe.id,recipe);
|
||||
}
|
||||
|
||||
}
|
||||
else if(type == EnumPacketClient.SYNCRECIPES_WORKBENCH){
|
||||
RecipeController.reloadGlobalRecipes(RecipeController.syncRecipes);
|
||||
RecipeController.syncRecipes = new HashMap<Integer, RecipeCarpentry>();
|
||||
}
|
||||
else if(type == EnumPacketClient.SYNCRECIPES_CARPENTRYBENCH){
|
||||
RecipeController.Instance.anvilRecipes = RecipeController.syncRecipes;
|
||||
RecipeController.syncRecipes = new HashMap<Integer, RecipeCarpentry>();
|
||||
}
|
||||
else if(type == EnumPacketClient.LARGE_NBT_PART){
|
||||
byte[] chunk = new byte[buffer.readShort()];
|
||||
buffer.readBytes(chunk);
|
||||
NoppesUtil.handleLargeData(chunk);
|
||||
}
|
||||
else if(type == EnumPacketClient.SYNC_PLAYER){
|
||||
boolean sync = buffer.readBoolean();
|
||||
NoppesUtil.handlePlayerDataEnd(sync);
|
||||
}
|
||||
else if(type == EnumPacketClient.SYNC_ADD || type == EnumPacketClient.SYNC_END){
|
||||
int synctype = buffer.readInt();
|
||||
NBTTagCompound compound = Server.readNBT(buffer);
|
||||
SyncController.clientSync(synctype, compound, type == EnumPacketClient.SYNC_END);
|
||||
}
|
||||
else if(type == EnumPacketClient.SYNC_UPDATE){
|
||||
int synctype = buffer.readInt();
|
||||
NBTTagCompound compound = Server.readNBT(buffer);
|
||||
SyncController.clientSyncUpdate(synctype, compound, buffer);
|
||||
}
|
||||
else if(type == EnumPacketClient.SYNC_REMOVE){
|
||||
int synctype = buffer.readInt();
|
||||
int id = buffer.readInt();
|
||||
|
||||
SyncController.clientSyncRemove(synctype, id);
|
||||
}
|
||||
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))
|
||||
return;
|
||||
NoppesUtil.openDialog(Server.readNBT(buffer), (EntityNPCInterface) entity, player);
|
||||
}
|
||||
else if(type == EnumPacketClient.DIALOG_DUMMY){
|
||||
EntityDialogNpc npc = new EntityDialogNpc(player.worldObj);
|
||||
npc.display.name = Server.readString(buffer);
|
||||
EntityUtil.Copy(player, npc);
|
||||
NoppesUtil.openDialog(Server.readNBT(buffer), npc, player);
|
||||
}
|
||||
else if(type == EnumPacketClient.QUEST_COMPLETION){
|
||||
NoppesUtil.guiQuestCompletion(player, Server.readNBT(buffer));
|
||||
}
|
||||
else if(type == EnumPacketClient.EDIT_NPC){
|
||||
Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(buffer.readInt());
|
||||
if(entity == null || !(entity instanceof EntityNPCInterface))
|
||||
return;
|
||||
NoppesUtil.setLastNpc((EntityNPCInterface) entity);
|
||||
}
|
||||
else if(type == EnumPacketClient.PLAY_MUSIC){
|
||||
MusicController.Instance.playMusicBackground(Server.readString(buffer), player, Integer.MAX_VALUE);
|
||||
}
|
||||
else if(type == EnumPacketClient.PLAY_SOUND){
|
||||
MusicController.Instance.playSound(Server.readString(buffer),buffer.readFloat(),buffer.readFloat(),buffer.readFloat());
|
||||
}
|
||||
else if(type == EnumPacketClient.UPDATE_NPC){
|
||||
NBTTagCompound compound = Server.readNBT(buffer);
|
||||
Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(compound.getInteger("EntityId"));
|
||||
if(entity == null || !(entity instanceof EntityNPCInterface))
|
||||
return;
|
||||
((EntityNPCInterface)entity).readSpawnData(compound);
|
||||
}
|
||||
else if(type == EnumPacketClient.ROLE){
|
||||
NBTTagCompound compound = Server.readNBT(buffer);
|
||||
Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(compound.getInteger("EntityId"));
|
||||
if(entity == null || !(entity instanceof EntityNPCInterface))
|
||||
return;
|
||||
((EntityNPCInterface)entity).advanced.setRole(compound.getInteger("Role"));
|
||||
((EntityNPCInterface)entity).roleInterface.readFromNBT(compound);
|
||||
NoppesUtil.setLastNpc((EntityNPCInterface) entity);
|
||||
}
|
||||
else if(type == EnumPacketClient.GUI){
|
||||
EnumGuiType gui = EnumGuiType.values()[buffer.readInt()];
|
||||
CustomNpcs.proxy.openGui(NoppesUtil.getLastNpc(), gui, buffer.readInt(), buffer.readInt(), buffer.readInt());
|
||||
}
|
||||
else if(type == EnumPacketClient.SCRIPTED_PARTICLE){
|
||||
NoppesUtil.spawnScriptedParticle(player, buffer);
|
||||
}
|
||||
else if(type == EnumPacketClient.PARTICLE){
|
||||
NoppesUtil.spawnParticle(buffer);
|
||||
}
|
||||
else if(type == EnumPacketClient.DELETE_NPC){
|
||||
Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(buffer.readInt());
|
||||
if(entity == null || !(entity instanceof EntityNPCInterface))
|
||||
return;
|
||||
((EntityNPCInterface)entity).delete();
|
||||
}
|
||||
else if(type == EnumPacketClient.SCROLL_LIST){
|
||||
NoppesUtil.setScrollList(buffer);
|
||||
}
|
||||
else if(type == EnumPacketClient.SCROLL_DATA){
|
||||
NoppesUtil.setScrollData(buffer);
|
||||
}
|
||||
else if(type == EnumPacketClient.SCROLL_DATA_PART){
|
||||
NoppesUtil.addScrollData(buffer);
|
||||
}
|
||||
else if(type == EnumPacketClient.SCROLL_GROUP){
|
||||
NoppesUtil.setScrollGroup(buffer);
|
||||
}
|
||||
else if(type == EnumPacketClient.SCROLL_GROUP_PART){
|
||||
NoppesUtil.addScrollGroup(buffer);
|
||||
}
|
||||
else if(type == EnumPacketClient.SCROLL_SELECTED){
|
||||
GuiScreen gui = Minecraft.getMinecraft().currentScreen;
|
||||
if(gui == null || !(gui instanceof IScrollData))
|
||||
return;
|
||||
String selected = Server.readString(buffer);
|
||||
|
||||
((IScrollData)gui).setSelected(selected);
|
||||
}
|
||||
else if(type == EnumPacketClient.GUI_REDSTONE){
|
||||
NoppesUtil.saveRedstoneBlock(player, Server.readNBT(buffer));
|
||||
}
|
||||
else if(type == EnumPacketClient.GUI_WAYPOINT){
|
||||
NoppesUtil.saveWayPointBlock(player, Server.readNBT(buffer));
|
||||
}
|
||||
else if(type == EnumPacketClient.CLONE){
|
||||
NBTTagCompound compound = Server.readNBT(buffer);
|
||||
NoppesUtil.openGUI(player, new GuiNpcMobSpawnerAdd(compound));
|
||||
}
|
||||
else if(type == EnumPacketClient.CLONER){
|
||||
int x = buffer.readInt();
|
||||
int y = buffer.readInt();
|
||||
int z = buffer.readInt();
|
||||
CustomNpcs.proxy.openGui(x, y, z, EnumGuiType.MobSpawner, player);
|
||||
}
|
||||
else if(type == EnumPacketClient.TELEPORTER){
|
||||
CustomNpcs.proxy.openGui((EntityNPCInterface)null,EnumGuiType.NpcDimensions);
|
||||
}
|
||||
else if(type == EnumPacketClient.GUI_DATA){
|
||||
GuiScreen gui = Minecraft.getMinecraft().currentScreen;
|
||||
if(gui == null)
|
||||
return;
|
||||
|
||||
if(gui instanceof GuiNPCInterface && ((GuiNPCInterface)gui).hasSubGui()){
|
||||
gui = (GuiScreen) ((GuiNPCInterface)gui).getSubGui();
|
||||
}
|
||||
else if(gui instanceof GuiContainerNPCInterface && ((GuiContainerNPCInterface)gui).hasSubGui()){
|
||||
gui = (GuiScreen) ((GuiContainerNPCInterface)gui).getSubGui();
|
||||
}
|
||||
if(gui instanceof IGuiData)
|
||||
((IGuiData)gui).setGuiData(Server.readNBT(buffer));
|
||||
}
|
||||
else if(type == EnumPacketClient.GUI_ERROR){
|
||||
GuiScreen gui = Minecraft.getMinecraft().currentScreen;
|
||||
if(gui == null || !(gui instanceof IGuiError))
|
||||
return;
|
||||
|
||||
int i = buffer.readInt();
|
||||
NBTTagCompound compound = Server.readNBT(buffer);
|
||||
|
||||
((IGuiError)gui).setError(i, compound);
|
||||
}
|
||||
else if(type == EnumPacketClient.GUI_CLOSE){
|
||||
GuiScreen gui = Minecraft.getMinecraft().currentScreen;
|
||||
if(gui == null)
|
||||
return;
|
||||
|
||||
if(gui instanceof IGuiClose){
|
||||
int i = buffer.readInt();
|
||||
NBTTagCompound compound = Server.readNBT(buffer);
|
||||
((IGuiClose)gui).setClose(i, compound);
|
||||
}
|
||||
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
mc.displayGuiScreen(null);
|
||||
mc.setIngameFocus();
|
||||
}
|
||||
else if(type == EnumPacketClient.VILLAGER_LIST){
|
||||
MerchantRecipeList merchantrecipelist = MerchantRecipeList.func_151390_b(new PacketBuffer(buffer));
|
||||
ServerEventsHandler.Merchant.setRecipes(merchantrecipelist);
|
||||
}
|
||||
else if(type == EnumPacketClient.OPEN_BOOK){
|
||||
int x = buffer.readInt(), y = buffer.readInt(), z = buffer.readInt();
|
||||
|
||||
NoppesUtil.openGUI(player, new GuiBook(player, ItemStack.loadItemStackFromNBT(Server.readNBT(buffer)), x, y, z));
|
||||
}
|
||||
else if(type == EnumPacketClient.CONFIG){
|
||||
int config = buffer.readInt();
|
||||
if(config == 0){//Font
|
||||
String font = Server.readString(buffer);
|
||||
int size = buffer.readInt();
|
||||
if(!font.isEmpty()){
|
||||
ConfigClient.FontType = font;
|
||||
ConfigClient.FontSize = size;
|
||||
ClientProxy.Font = new FontContainer(ConfigClient.FontType, ConfigClient.FontSize);
|
||||
|
||||
ConfigClient.FontTypeProperty.set(ConfigClient.FontType);
|
||||
ConfigClient.FontSizeProperty.set(ConfigClient.FontSize);
|
||||
if(ConfigClient.config.hasChanged()){
|
||||
ConfigClient.config.save();
|
||||
}
|
||||
|
||||
player.addChatMessage(new ChatComponentTranslation("Font set to %s", ClientProxy.Font.getName()));
|
||||
}
|
||||
else
|
||||
player.addChatMessage(new ChatComponentTranslation("Current font is %s", ClientProxy.Font.getName()));
|
||||
}
|
||||
}
|
||||
else if(type == EnumPacketClient.ISGUIOPEN){
|
||||
boolean isGUIOpen = Minecraft.getMinecraft().currentScreen != null;
|
||||
|
||||
NoppesUtil.isGUIOpen(isGUIOpen);
|
||||
}
|
||||
else if(type == EnumPacketClient.SCRIPT_OVERLAY_DATA){
|
||||
OverlayCustom overlayCustom = new OverlayCustom(Minecraft.getMinecraft());
|
||||
overlayCustom.setOverlayData(Server.readNBT(buffer));
|
||||
|
||||
ClientCacheHandler.customOverlays.put(overlayCustom.overlay.getID(),overlayCustom);
|
||||
}
|
||||
else if(type == EnumPacketClient.SCRIPT_OVERLAY_CLOSE){
|
||||
int id = buffer.readInt();
|
||||
ClientCacheHandler.customOverlays.remove(id);
|
||||
}
|
||||
else if(type == EnumPacketClient.OVERLAY_QUEST_TRACKING){
|
||||
try {
|
||||
NBTTagCompound compound = Server.readNBT(buffer);
|
||||
ClientCacheHandler.questTrackingOverlay = new OverlayQuestTracking(Minecraft.getMinecraft());
|
||||
ClientCacheHandler.questTrackingOverlay.setOverlayData(compound);
|
||||
} catch (IOException e) {
|
||||
ClientCacheHandler.questTrackingOverlay = null;
|
||||
}
|
||||
}
|
||||
else if(type == EnumPacketClient.SWING_PLAYER_ARM){
|
||||
Minecraft.getMinecraft().thePlayer.swingItem();
|
||||
}
|
||||
else if(type == EnumPacketClient.PLAYER_UPDATE_SKIN_OVERLAYS) {
|
||||
EntityPlayer sendingPlayer = Minecraft.getMinecraft().theWorld.getPlayerEntityByName(Server.readString(buffer));
|
||||
NBTTagCompound compound = Server.readNBT(buffer);
|
||||
if (sendingPlayer != null) {
|
||||
NoppesUtil.updateSkinOverlayData(sendingPlayer, compound);
|
||||
}
|
||||
}
|
||||
else if(type == EnumPacketClient.UPDATE_ANIMATIONS) {
|
||||
NBTTagCompound compound = Server.readNBT(buffer);
|
||||
AnimationData animationData = null;
|
||||
if (compound.hasKey("EntityId")) {
|
||||
Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(compound.getInteger("EntityId"));
|
||||
if (entity instanceof EntityNPCInterface) {
|
||||
animationData = ((EntityNPCInterface) entity).display.animationData;
|
||||
}
|
||||
} else {
|
||||
EntityPlayer sendingPlayer = Minecraft.getMinecraft().theWorld.getPlayerEntityByName(Server.readString(buffer));
|
||||
if (sendingPlayer != null) {
|
||||
if (!ClientCacheHandler.playerAnimations.containsKey(sendingPlayer.getUniqueID())) {
|
||||
ClientCacheHandler.playerAnimations.put(sendingPlayer.getUniqueID(), new AnimationData(sendingPlayer));
|
||||
}
|
||||
animationData = ClientCacheHandler.playerAnimations.get(sendingPlayer.getUniqueID());
|
||||
animationData.parent = sendingPlayer;
|
||||
}
|
||||
}
|
||||
|
||||
if (animationData != null) {
|
||||
if (compound.hasKey("Animation")) {
|
||||
Animation animation = new Animation();
|
||||
animation.readFromNBT(compound.getCompoundTag("Animation"));
|
||||
animationData.setAnimation(animation);
|
||||
} else {
|
||||
animationData.setAnimation(null);
|
||||
}
|
||||
animationData.readFromNBT(compound);
|
||||
}
|
||||
}
|
||||
else if(type == EnumPacketClient.DISABLE_MOUSE_INPUT) {
|
||||
long length = buffer.readLong();
|
||||
try {
|
||||
String parsedButtons = Server.readString(buffer);
|
||||
if (parsedButtons == null || parsedButtons.isEmpty()) {
|
||||
ClientEventHandler.disabledButtonTimes.put(-1, length);
|
||||
return;
|
||||
}
|
||||
|
||||
String[] splitIds = parsedButtons.split(";");
|
||||
for (String s : splitIds) {
|
||||
ClientEventHandler.disabledButtonTimes.put(Integer.parseInt(s), length);
|
||||
}
|
||||
} catch (Exception ignored) {}
|
||||
}
|
||||
else if(type == EnumPacketClient.PLAY_SOUND_TO) {
|
||||
int id = buffer.readInt();
|
||||
NBTTagCompound compound = Server.readNBT(buffer);
|
||||
ScriptClientSound sound = ScriptClientSound.fromScriptSound(compound, player.worldObj);
|
||||
|
||||
ScriptSoundController.Instance.playSound(id,sound);
|
||||
}
|
||||
else if(type == EnumPacketClient.PLAY_SOUND_TO_NO_ID) {
|
||||
NBTTagCompound compound = Server.readNBT(buffer);
|
||||
ScriptClientSound sound = ScriptClientSound.fromScriptSound(compound, player.worldObj);
|
||||
ScriptSoundController.Instance.playSound(sound);
|
||||
}
|
||||
else if(type == EnumPacketClient.STOP_SOUND_FOR) {
|
||||
int id = buffer.readInt();
|
||||
ScriptSoundController.Instance.stopSound(id);
|
||||
}
|
||||
else if(type == EnumPacketClient.PAUSE_SOUNDS) {
|
||||
ScriptSoundController.Instance.pauseAllSounds();
|
||||
}
|
||||
else if(type == EnumPacketClient.CONTINUE_SOUNDS) {
|
||||
ScriptSoundController.Instance.continueAllSounds();
|
||||
}
|
||||
else if(type == EnumPacketClient.STOP_SOUNDS) {
|
||||
ScriptSoundController.Instance.stopAllSounds();
|
||||
}
|
||||
else if(type == EnumPacketClient.SYNC_WEAPON) {
|
||||
Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(buffer.readInt());
|
||||
if(!(entity instanceof EntityNPCInterface))
|
||||
return;
|
||||
EntityNPCInterface npc = (EntityNPCInterface) entity;
|
||||
int weaponSlotIndex = buffer.readInt();
|
||||
ItemStack stack = ItemStack.loadItemStackFromNBT(Server.readNBT(buffer));
|
||||
npc.inventory.weapons.put(weaponSlotIndex,stack);
|
||||
}
|
||||
else if(type == EnumPacketClient.PARTY_DATA){
|
||||
GuiScreen gui = Minecraft.getMinecraft().currentScreen;
|
||||
if(gui == null)
|
||||
return;
|
||||
|
||||
if(gui instanceof GuiNPCInterface && ((GuiNPCInterface)gui).hasSubGui()){
|
||||
gui = (GuiScreen) ((GuiNPCInterface)gui).getSubGui();
|
||||
}
|
||||
else if(gui instanceof GuiContainerNPCInterface && ((GuiContainerNPCInterface)gui).hasSubGui()){
|
||||
gui = (GuiScreen) ((GuiContainerNPCInterface)gui).getSubGui();
|
||||
}
|
||||
if(gui instanceof IPartyData)
|
||||
((IPartyData)gui).setPartyData(Server.readNBT(buffer));
|
||||
}
|
||||
else if(type == EnumPacketClient.DBC_FORM){
|
||||
NoppesUtil.handleFormEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@ public class TranslateUtil {
|
||||
private static final String AudioUrl = "http://translate.google.com/translate_tts?q=%s&tl=%s";
|
||||
|
||||
public static String Translate(String text){
|
||||
|
||||
|
||||
try {
|
||||
String urlStr = String.format(TranslateUrl, URLEncoder.encode(text,"utf8"), "auto", "nl");
|
||||
URL url = new URL(urlStr);
|
||||
@@ -45,10 +45,10 @@ public class TranslateUtil {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
|
||||
// public static void PlayAudio(String text){
|
||||
// try {
|
||||
// String urlStr = String.format(AudioUrl, URLEncoder.encode(text,"utf8"), "en");
|
||||
@@ -59,12 +59,12 @@ public class TranslateUtil {
|
||||
// //connection.setDoOutput(true);
|
||||
// connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13 (.NET CLR 3.5.30729)");
|
||||
// connection.setRequestProperty("X-HTTP-Method-Override", "GET");
|
||||
//
|
||||
//
|
||||
// InputStream audioSrc = new BufferedInputStream(connection.getInputStream());
|
||||
// //DataInputStream read = new DataInputStream(audioSrc);
|
||||
// AudioInputStream audioIn = AudioSystem.getAudioInputStream(audioSrc);
|
||||
// Clip clip = AudioSystem.getClip();
|
||||
//
|
||||
//
|
||||
// } catch (UnsupportedEncodingException e) {
|
||||
// e.printStackTrace();
|
||||
// } catch (MalformedURLException e) {
|
||||
@@ -72,10 +72,10 @@ public class TranslateUtil {
|
||||
// } catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
// } catch (UnsupportedAudioFileException e) {
|
||||
// // TODO Auto-generated catch block
|
||||
//
|
||||
// e.printStackTrace();
|
||||
// } catch (LineUnavailableException e) {
|
||||
// // TODO Auto-generated catch block
|
||||
//
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -0,0 +1,218 @@
|
||||
package noppes.npcs.client.fx;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.particle.EntityFX;
|
||||
import net.minecraft.client.renderer.ActiveRenderInfo;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.EntityEvent.EntityConstructing;
|
||||
|
||||
public class EntityBigSmokeFX extends EntityFX
|
||||
{
|
||||
|
||||
/** there are 12 smoke textures. */
|
||||
public static final int TEXTURE_COUNT = 12;
|
||||
public static final ResourceLocation[] TEXTURES = new ResourceLocation[TEXTURE_COUNT];
|
||||
static
|
||||
{
|
||||
for (int i = 0; i < TEXTURE_COUNT; i++)
|
||||
TEXTURES[i] = new ResourceLocation("customnpcs" + ":" + "textures/particle/big_smoke_" + i + ".png");
|
||||
}
|
||||
|
||||
protected final int texIndex;
|
||||
protected boolean alphaFading = false;
|
||||
protected float alphaFadePerTick = -0.015F;
|
||||
protected boolean localizedCombustion = true;
|
||||
protected boolean isColored = false;
|
||||
|
||||
/**
|
||||
* Posts a {@link EntityBigSmokeFXConstructingEvent}.
|
||||
*/
|
||||
public EntityBigSmokeFX(World world, int x, int y, int z, boolean signalFire, float[] colours) {
|
||||
super(world, x, y, z);
|
||||
|
||||
// Position: Centered above the spawn point with slight randomness
|
||||
this.setPosition(
|
||||
x + 0.5 + (rand.nextDouble() / 10.0 * (rand.nextBoolean() ? 1 : -1)), // Small horizontal offset
|
||||
y + 0.1 + (rand.nextDouble() * 0.1), // Start slightly above y
|
||||
z + 0.5 + (rand.nextDouble() / 10.0 * (rand.nextBoolean() ? 1 : -1))
|
||||
);
|
||||
|
||||
// Scale: Smoke size
|
||||
this.particleScale = 4.0F * (rand.nextFloat() * 0.5F + 0.5F); // Smaller size
|
||||
this.setSize(0.25F, 0.25F);
|
||||
|
||||
// Gravity: Slows upward motion gradually
|
||||
this.particleGravity = 0.005F;
|
||||
|
||||
// Upward motion: Slow, with slight randomness
|
||||
this.motionX = 0; // No horizontal motion
|
||||
this.motionY = 0.02F + rand.nextFloat() * 0.01F;
|
||||
this.motionZ = 0; // No horizontal motion
|
||||
|
||||
this.particleMaxAge = rand.nextInt(50) + 100; // Shorter lifetime for normal smoke
|
||||
this.particleAlpha = 0.8F;
|
||||
|
||||
if (colours.length == 3) {
|
||||
this.setRBGColorF(colours[0], colours[1], colours[2]);
|
||||
}
|
||||
|
||||
// Smoke appearance
|
||||
this.texIndex = rand.nextInt(TEXTURE_COUNT);
|
||||
this.isColored = this.particleRed != 1.0F || this.particleGreen != 1.0F || this.particleBlue != 1.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderParticle(Tessellator tess, float partialTicks, float rotX, float rotXZ, float rotZ, float rotYZ, float rotXY)
|
||||
{
|
||||
rotX = ActiveRenderInfo.rotationX;
|
||||
rotXZ = ActiveRenderInfo.rotationXZ;
|
||||
rotZ = ActiveRenderInfo.rotationZ;
|
||||
rotYZ = ActiveRenderInfo.rotationYZ;
|
||||
rotXY = ActiveRenderInfo.rotationXY;
|
||||
|
||||
EntityLivingBase view = Minecraft.getMinecraft().renderViewEntity;
|
||||
double interpX = view.lastTickPosX + (view.posX - view.lastTickPosX) * partialTicks;
|
||||
double interpY = view.lastTickPosY + (view.posY - view.lastTickPosY) * partialTicks;
|
||||
double interpZ = view.lastTickPosZ + (view.posZ - view.lastTickPosZ) * partialTicks;
|
||||
|
||||
float partialPosX = (float) (prevPosX + (posX - prevPosX) * partialTicks - interpX);
|
||||
float partialPosY = (float) (prevPosY + (posY - prevPosY) * partialTicks - interpY);
|
||||
float partialPosZ = (float) (prevPosZ + (posZ - prevPosZ) * partialTicks - interpZ);
|
||||
|
||||
float scale = 0.1F * particleScale;
|
||||
|
||||
double minU = this.particleTextureIndexX * 0.25;
|
||||
double maxU = minU + 0.25;
|
||||
double minV = this.particleTextureIndexY * 0.125;
|
||||
double maxV = minV + 0.125;
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F);
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TEXTURES[this.texIndex % TEXTURES.length]);
|
||||
|
||||
tess.startDrawingQuads();
|
||||
|
||||
tess.setColorRGBA_F(particleRed, particleGreen, particleBlue, particleAlpha);
|
||||
tess.setBrightness(15 << 20 | 14 << 4); // slightly less than MiscUtil.MAX_LIGHT_BRIGHTNESS so that smoke doesn't glow super bright with shaders
|
||||
|
||||
tess.addVertexWithUV(partialPosX - rotX * scale - rotYZ * scale, partialPosY - rotXZ * scale, partialPosZ - rotZ * scale - rotXY * scale, 1, 1);
|
||||
tess.addVertexWithUV(partialPosX - rotX * scale + rotYZ * scale, partialPosY + rotXZ * scale, partialPosZ - rotZ * scale + rotXY * scale, 1, 0);
|
||||
tess.addVertexWithUV(partialPosX + rotX * scale + rotYZ * scale, partialPosY + rotXZ * scale, partialPosZ + rotZ * scale + rotXY * scale, 0, 0);
|
||||
tess.addVertexWithUV(partialPosX + rotX * scale - rotYZ * scale, partialPosY - rotXZ * scale, partialPosZ + rotZ * scale - rotXY * scale, 0, 1);
|
||||
|
||||
tess.draw();
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glDepthMask(false);
|
||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFXLayer()
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
this.prevPosX = this.posX;
|
||||
this.prevPosY = this.posY;
|
||||
this.prevPosZ = this.posZ;
|
||||
|
||||
// Age-based behavior: Fade out near the end of lifetime
|
||||
if (this.particleAge++ >= this.particleMaxAge - 40) {
|
||||
this.alphaFading = true;
|
||||
}
|
||||
|
||||
if (this.particleAge < this.particleMaxAge && this.particleAlpha > 0.0F) {
|
||||
// Minimal horizontal drift for slight randomness
|
||||
float horizontalMotionScale = 0.001F; // Very small horizontal movement
|
||||
this.motionX += this.rand.nextFloat() * horizontalMotionScale * (this.rand.nextBoolean() ? 1 : -1);
|
||||
this.motionZ += this.rand.nextFloat() * horizontalMotionScale * (this.rand.nextBoolean() ? 1 : -1);
|
||||
|
||||
// Move the particle
|
||||
this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
||||
|
||||
// Fade out alpha if needed
|
||||
if (this.alphaFading) {
|
||||
this.particleAlpha = MathHelper.clamp_float(this.particleAlpha + this.alphaFadePerTick, 0.0F, 1.0F);
|
||||
}
|
||||
} else {
|
||||
// Kill the particle if it has faded out or reached max age
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Allows you to change various aspects of campfire smoke particles:<br>
|
||||
* - {@link #particleRed}, {@link #particleGreen}, and {@link #particleBlue} are the float r, g, b values of the smoke. <br>
|
||||
* - {@link #motionX}, {@link #motionY}, and {@link #motionZ} are the x, y, z motion of the smoke.<br>
|
||||
* - {@link #particleGravity} is the amount the smoke's y motion changes per tick. <br>
|
||||
* - {@link #particleAlpha} is the smoke's initial alpha. <br>
|
||||
* - {@link #alphaFading} is whether the smoke's alpha should currently be changing (fading in or out). <br>
|
||||
* - {@link #alphaFadePerTick} is the amount the smoke's alpha changes per tick if {@link #alphaFading} is true. Negative values make it fade out, positive values make it fade
|
||||
* back in. <br>
|
||||
* - {@link #particleMaxAge} is the maximum number of ticks the particle will live for. <br>
|
||||
* <br>
|
||||
* You're also given {@link #campfirePosition}, which is the x, y, z position of the campfire tile entity where the smoke was created. <br>
|
||||
* <br>
|
||||
* Also, {@link EntityBigSmokeFX} are only created on the client side, so you should mark your subscribe event with {@link Side#CLIENT}. <br>
|
||||
* <br>
|
||||
* This event is posted from {@link EntityBigSmokeFX#EntityBigSmokeFX} on the {@link MinecraftForge#EVENT_BUS}.<br>
|
||||
* This event is {@link Cancelable}. If canceled, the entity will be removed.<br>
|
||||
*/
|
||||
@Cancelable
|
||||
public static class EntityBigSmokeFXConstructingEvent extends EntityConstructing
|
||||
{
|
||||
public final int[] campfirePosition;
|
||||
|
||||
public float particleRed;
|
||||
public float particleGreen;
|
||||
public float particleBlue;
|
||||
public double motionX;
|
||||
public double motionY;
|
||||
public double motionZ;
|
||||
public float particleGravity;
|
||||
public float particleAlpha;
|
||||
public boolean alphaFading;
|
||||
public float alphaFadePerTick;
|
||||
public int particleMaxAge;
|
||||
|
||||
public EntityBigSmokeFXConstructingEvent(EntityBigSmokeFX entity, int x, int y, int z)
|
||||
{
|
||||
super(entity);
|
||||
|
||||
campfirePosition = new int[] { x, y, z };
|
||||
|
||||
particleRed = entity.particleRed;
|
||||
particleGreen = entity.particleGreen;
|
||||
particleBlue = entity.particleBlue;
|
||||
motionX = entity.motionX;
|
||||
motionY = entity.motionY;
|
||||
motionZ = entity.motionZ;
|
||||
particleGravity = entity.particleGravity;
|
||||
particleAlpha = entity.particleAlpha;
|
||||
alphaFading = entity.alphaFading;
|
||||
alphaFadePerTick = entity.alphaFadePerTick;
|
||||
particleMaxAge = entity.particleMaxAge;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,36 +1,38 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.TileEntityGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.TileEntitySavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.blocks.tiles.TileBorder;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
public class GuiBorderBlock extends GuiNPCInterface implements IGuiData{
|
||||
|
||||
private TileBorder tile;
|
||||
|
||||
|
||||
public GuiBorderBlock(int x, int y, int z) {
|
||||
super();
|
||||
tile = (TileBorder) player.worldObj.getTileEntity(x, y, z);
|
||||
|
||||
Client.sendData(EnumPacketServer.GetTileEntity, x, y, z);
|
||||
|
||||
PacketClient.sendClient(new TileEntityGetPacket(x, y, z));
|
||||
}
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
|
||||
this.addButton(new GuiNpcButton(4, guiLeft + 40, guiTop + 40, 120, 20, "Availability Options"));
|
||||
|
||||
addLabel(new GuiNpcLabel(0,"Height", guiLeft+ 1, guiTop + 76, 0xffffff));
|
||||
|
||||
addLabel(new GuiNpcLabel(0,"Height", guiLeft+ 1, guiTop + 76, 0xffffff));
|
||||
addTextField(new GuiNpcTextField(0, this, fontRendererObj, guiLeft+ 60, guiTop + 71,40,20, tile.height + ""));
|
||||
getTextField(0).integersOnly = true;
|
||||
getTextField(0).setMinMaxDefault(0, 500, 6);
|
||||
getTextField(0).setMinMaxDefault(0, 500, 6);
|
||||
|
||||
addLabel(new GuiNpcLabel(1,"Message", guiLeft+ 1, guiTop + 100, 0xffffff));
|
||||
addLabel(new GuiNpcLabel(1,"Message", guiLeft+ 1, guiTop + 100, 0xffffff));
|
||||
addTextField(new GuiNpcTextField(1, this, fontRendererObj, guiLeft+ 60, guiTop + 95,200,20, tile.message));
|
||||
|
||||
|
||||
addButton(new GuiNpcButton(0, guiLeft + 40, guiTop + 190,120,20, "Done"));
|
||||
}
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
@@ -48,10 +50,10 @@ public class GuiBorderBlock extends GuiNPCInterface implements IGuiData{
|
||||
return;
|
||||
tile.height = getTextField(0).getInteger();
|
||||
tile.message = getTextField(1).getText();
|
||||
|
||||
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
tile.writeToNBT(compound);
|
||||
Client.sendData(EnumPacketServer.SaveTileEntity, compound);
|
||||
PacketClient.sendClient(new TileEntitySavePacket(compound));
|
||||
}
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import noppes.npcs.client.gui.util.GuiDiagram;
|
||||
import noppes.npcs.client.gui.util.GuiNPCInterface;
|
||||
import noppes.npcs.controllers.MagicController;
|
||||
import noppes.npcs.controllers.data.Magic;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class GuiMagicMap extends GuiDiagram {
|
||||
|
||||
private List<Magic> magics;
|
||||
|
||||
// Single RenderItem instance for efficiency.
|
||||
private RenderItem renderItem = new RenderItem();
|
||||
|
||||
public GuiMagicMap(GuiNPCInterface parent, int x, int y, int width, int height) {
|
||||
super(parent, x, y, width, height);
|
||||
magics = new ArrayList<>();
|
||||
|
||||
// Cache all magics from the MagicController.
|
||||
for (Magic magic : MagicController.getInstance().magics.values()) {
|
||||
magics.add(magic);
|
||||
}
|
||||
setLayout(DiagramLayout.CHART);
|
||||
this.setCurvedArrows(true);
|
||||
this.setCurveAngle(-20);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<DiagramIcon> createIcons() {
|
||||
List<DiagramIcon> icons = new ArrayList<>();
|
||||
for (Magic magic : magics) {
|
||||
MagicIcon icon = new MagicIcon(magic);
|
||||
// Set your desired flags (for example, enabled and pressable).
|
||||
icon.enabled = true;
|
||||
icon.pressable = true;
|
||||
icons.add(icon);
|
||||
}
|
||||
return icons;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<DiagramConnection> createConnections() {
|
||||
List<DiagramConnection> conns = new ArrayList<>();
|
||||
// For each Magic, generate connections from each weakness (attacker) to this magic.
|
||||
for (Magic magic : magics) {
|
||||
if (magic.weaknesses == null)
|
||||
continue;
|
||||
for (Map.Entry<Integer, Float> entry : magic.weaknesses.entrySet()) {
|
||||
int attackerId = entry.getKey();
|
||||
float percent = entry.getValue();
|
||||
String hover = "+" + (int) (percent * 100) + "%";
|
||||
conns.add(new DiagramConnection(attackerId, magic.id, percent, hover));
|
||||
}
|
||||
}
|
||||
return conns;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderIcon(DiagramIcon icon, int posX, int posY, IconRenderState state) {
|
||||
Magic magic = ((MagicIcon) icon).magic;
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
FontRenderer fontRenderer = mc.fontRenderer;
|
||||
int size = this.iconSize;
|
||||
int iconX = posX - size / 2;
|
||||
int iconY = posY - size / 2;
|
||||
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
|
||||
if (magic.iconItem != null) {
|
||||
renderItem.renderItemAndEffectIntoGUI(fontRenderer, mc.getTextureManager(), magic.iconItem, iconX, iconY);
|
||||
} else if (magic.iconTexture != null && !magic.iconTexture.isEmpty()) {
|
||||
mc.getTextureManager().bindTexture(new ResourceLocation(magic.iconTexture));
|
||||
this.drawTexturedModalRect(iconX, iconY, 0, 0, size, size);
|
||||
} else {
|
||||
ItemStack sword = new ItemStack(Items.iron_sword);
|
||||
renderItem.renderItemAndEffectIntoGUI(fontRenderer, mc.getTextureManager(), sword, iconX, iconY);
|
||||
}
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
|
||||
// If the icon is not highlighted, draw a translucent overlay.
|
||||
if (state == IconRenderState.NOT_HIGHLIGHTED) {
|
||||
drawRect(iconX, iconY, iconX + size, iconY + size, 0x80202020);
|
||||
}
|
||||
|
||||
// Reset color.
|
||||
GL11.glColor4f(1f, 1f, 1f, 1f);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> getIconTooltip(DiagramIcon icon) {
|
||||
Magic magic = ((MagicIcon) icon).magic;
|
||||
List<String> tooltip = new ArrayList<>();
|
||||
tooltip.add(magic.getName());
|
||||
return tooltip;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawHoveringText(List<String> text, int mouseX, int mouseY, FontRenderer fontRenderer) {
|
||||
parent.renderHoveringText(text, mouseX, mouseY, fontRenderer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Override getIconName so that connection tooltips can show Magic names.
|
||||
*/
|
||||
@Override
|
||||
protected String getIconName(DiagramIcon icon) {
|
||||
Magic magic = ((MagicIcon) icon).magic;
|
||||
return magic.getName();
|
||||
}
|
||||
|
||||
// Wrap a Magic object as a DiagramIcon.
|
||||
private class MagicIcon extends DiagramIcon {
|
||||
public Magic magic;
|
||||
public MagicIcon(Magic magic) {
|
||||
super(magic.id, magic.index, magic.priority);
|
||||
this.magic = magic;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,8 @@ import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.MerchantUpdatePacket;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
@@ -16,10 +18,10 @@ import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.village.MerchantRecipe;
|
||||
import net.minecraft.village.MerchantRecipeList;
|
||||
import noppes.npcs.ServerEventsHandler;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.CustomNpcResourceListener;
|
||||
import noppes.npcs.client.gui.util.GuiNpcButton;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.containers.ContainerMerchantAdd;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
@@ -109,7 +111,7 @@ public class GuiMerchantAdd extends GuiContainer
|
||||
merchantrecipelist.remove(currentRecipeIndex);
|
||||
if(currentRecipeIndex > 0)
|
||||
currentRecipeIndex--;
|
||||
Client.sendData(EnumPacketServer.MerchantUpdate, ServerEventsHandler.Merchant.getEntityId(), merchantrecipelist);
|
||||
PacketClient.sendClient(new MerchantUpdatePacket(ServerEventsHandler.Merchant.getEntityId(), merchantrecipelist));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,7 +134,7 @@ public class GuiMerchantAdd extends GuiContainer
|
||||
|
||||
MerchantRecipeList merchantrecipelist = this.theIMerchant.getRecipes(mc.thePlayer);
|
||||
merchantrecipelist.add(recipe);
|
||||
Client.sendData(EnumPacketServer.MerchantUpdate, ServerEventsHandler.Merchant.getEntityId(), merchantrecipelist);
|
||||
PacketClient.sendClient(new MerchantUpdatePacket(ServerEventsHandler.Merchant.getEntityId(), merchantrecipelist));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.faction.FactionsGetPacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.controllers.data.Quest;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
@@ -28,7 +30,7 @@ public class GuiNPCFactionSelection extends GuiNPCInterface implements IScrollDa
|
||||
this.parent = parent;
|
||||
this.factionId = dialog;
|
||||
|
||||
Client.sendData(EnumPacketServer.FactionsGet);
|
||||
PacketClient.sendClient(new FactionsGetPacket());
|
||||
|
||||
if(parent instanceof GuiSelectionListener){
|
||||
listener = (GuiSelectionListener) parent;
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.mainmenu.MainmenuAdvancedGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.mainmenu.MainmenuAdvancedSavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.gui.select.GuiSoundSelection;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.controllers.data.Line;
|
||||
import noppes.npcs.controllers.data.Lines;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
@@ -22,7 +25,8 @@ public class GuiNPCLinesEdit extends GuiNPCInterface2 implements IGuiData, ISubG
|
||||
{
|
||||
super(npc);
|
||||
this.lines = lines;
|
||||
Client.sendData(EnumPacketServer.MainmenuAdvancedGet);
|
||||
|
||||
PacketClient.sendClient(new MainmenuAdvancedGetPacket());
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
@@ -73,7 +77,8 @@ public class GuiNPCLinesEdit extends GuiNPCInterface2 implements IGuiData, ISubG
|
||||
|
||||
public void save() {
|
||||
saveLines();
|
||||
Client.sendData(EnumPacketServer.MainmenuAdvancedSave, npc.advanced.writeToNBT(new NBTTagCompound()));
|
||||
|
||||
PacketClient.sendClient(new MainmenuAdvancedSavePacket(npc.advanced.writeToNBT(new NBTTagCompound())));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.transport.TransportCategoriesGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.transport.TransportCategorySavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.util.GuiNPCInterface;
|
||||
import noppes.npcs.client.gui.util.GuiNpcButton;
|
||||
import noppes.npcs.client.gui.util.GuiNpcLabel;
|
||||
import noppes.npcs.client.gui.util.GuiNpcTextField;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
public class GuiNPCTransportCategoryEdit extends GuiNPCInterface
|
||||
@@ -30,7 +33,7 @@ public class GuiNPCTransportCategoryEdit extends GuiNPCInterface
|
||||
super.initGui();
|
||||
this.addTextField(new GuiNpcTextField(1, this, this.fontRendererObj, width / 2 - 40, 100, 140, 20, name));
|
||||
addLabel(new GuiNpcLabel(1,"Title:", width / 2 - 100+4, 105, 0xffffff));
|
||||
|
||||
|
||||
this.addButton(new GuiNpcButton(2, width / 2 - 100, 210,98, 20, "gui.back"));
|
||||
this.addButton(new GuiNpcButton(3, width / 2 +2, 210,98, 20, "Save"));
|
||||
}
|
||||
@@ -47,25 +50,20 @@ public class GuiNPCTransportCategoryEdit extends GuiNPCInterface
|
||||
if(id == 2)
|
||||
{
|
||||
NoppesUtil.openGUI(player, parent);
|
||||
Client.sendData(EnumPacketServer.TransportCategoriesGet);
|
||||
PacketClient.sendClient(new TransportCategoriesGetPacket());
|
||||
}
|
||||
if(id == 3)
|
||||
{
|
||||
save();
|
||||
NoppesUtil.openGUI(player, parent);
|
||||
Client.sendData(EnumPacketServer.TransportCategoriesGet);
|
||||
PacketClient.sendClient(new TransportCategoriesGetPacket());
|
||||
}
|
||||
}
|
||||
public void save() {
|
||||
String name = getTextField(1).getText();
|
||||
if(name.trim().isEmpty())
|
||||
return;
|
||||
Client.sendData(EnumPacketServer.TransportCategorySave,name,id);
|
||||
}
|
||||
// @Override
|
||||
// public void drawDefaultBackground()
|
||||
// {
|
||||
// drawBackground(0);
|
||||
// }
|
||||
|
||||
PacketClient.sendClient(new TransportCategorySavePacket(name, id));
|
||||
}
|
||||
}
|
||||
@@ -1,24 +1,28 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.DimensionsGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.feather.DimensionTeleportPacket;
|
||||
import kamkeel.npcs.network.packets.request.npc.RemoteDeletePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Vector;
|
||||
|
||||
public class GuiNpcDimension extends GuiNPCInterface implements IScrollData{
|
||||
|
||||
|
||||
private GuiCustomScroll scroll;
|
||||
private HashMap<String, Integer> data = new HashMap<String, Integer>();
|
||||
public GuiNpcDimension() {
|
||||
super();
|
||||
xSize = 256;
|
||||
setBackground("menubg.png");
|
||||
Client.sendData(EnumPacketServer.DimensionsGet);
|
||||
PacketClient.sendClient(new DimensionsGetPacket());
|
||||
}
|
||||
public void initGui()
|
||||
{
|
||||
@@ -30,10 +34,10 @@ public class GuiNpcDimension extends GuiNPCInterface implements IScrollData{
|
||||
scroll.guiLeft = guiLeft + 4;
|
||||
scroll.guiTop = guiTop + 4;
|
||||
addScroll(scroll);
|
||||
|
||||
|
||||
String title = StatCollector.translateToLocal("Dimensions");
|
||||
int x = (xSize - this.fontRendererObj.getStringWidth(title)) / 2;
|
||||
|
||||
|
||||
this.addLabel(new GuiNpcLabel(0, title, guiLeft + x, guiTop - 8));
|
||||
|
||||
this.addButton(new GuiNpcButton(4, guiLeft + 170, guiTop + 72,82,20, "remote.tp"));
|
||||
@@ -43,23 +47,23 @@ public class GuiNpcDimension extends GuiNPCInterface implements IScrollData{
|
||||
public void confirmClicked(boolean flag, int i)
|
||||
{
|
||||
if(flag){
|
||||
Client.sendData(EnumPacketServer.RemoteDelete,data.get(scroll.getSelected()));
|
||||
PacketClient.sendClient(new RemoteDeletePacket(data.get(scroll.getSelected())));
|
||||
}
|
||||
NoppesUtil.openGUI(player, this);
|
||||
}
|
||||
protected void actionPerformed(GuiButton guibutton)
|
||||
{
|
||||
int id = guibutton.id;
|
||||
|
||||
|
||||
if(!data.containsKey(scroll.getSelected()))
|
||||
return;
|
||||
|
||||
|
||||
if(id == 4){
|
||||
Client.sendData(EnumPacketServer.DimensionTeleport, data.get(scroll.getSelected()));
|
||||
PacketClient.sendClient(new DimensionTeleportPacket(data.get(scroll.getSelected())));
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int i, int j, int k)
|
||||
{
|
||||
@@ -76,8 +80,8 @@ public class GuiNpcDimension extends GuiNPCInterface implements IScrollData{
|
||||
}
|
||||
@Override
|
||||
public void save() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
|
||||
}
|
||||
@Override
|
||||
public void setData(Vector<String> list, HashMap<String, Integer> data) {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.clone.*;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -9,11 +11,11 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.controllers.ClientCloneController;
|
||||
import noppes.npcs.client.controllers.ClientTagMapController;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.controllers.data.Tag;
|
||||
import noppes.npcs.controllers.data.TagMap;
|
||||
|
||||
@@ -62,7 +64,7 @@ public class GuiNpcMobSpawner extends GuiNPCInterface implements IGuiData {
|
||||
this.closeOnEsc = true;
|
||||
|
||||
setBackground("menubg.png");
|
||||
Client.sendData(EnumPacketServer.CloneAllTags, activeTab);
|
||||
PacketClient.sendClient(new CloneAllTagsPacket());
|
||||
}
|
||||
public void initGui()
|
||||
{
|
||||
@@ -187,8 +189,8 @@ public class GuiNpcMobSpawner extends GuiNPCInterface implements IGuiData {
|
||||
}
|
||||
private void showClones() {
|
||||
if(showingClones == 2){
|
||||
Client.sendData(EnumPacketServer.CloneTagList, activeTab);
|
||||
Client.sendData(EnumPacketServer.CloneList, activeTab);
|
||||
PacketClient.sendClient(new CloneTagListPacket(activeTab));
|
||||
PacketClient.sendClient(new CloneListPacket(activeTab));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -377,14 +379,14 @@ public class GuiNpcMobSpawner extends GuiNPCInterface implements IGuiData {
|
||||
String sel = scroll.getSelected();
|
||||
if(sel == null)
|
||||
return;
|
||||
Client.sendData(EnumPacketServer.SpawnMob, true, posX, posY, posZ, sel, activeTab);
|
||||
SpawnMobPacket.Server(posX, posY, posZ, sel, activeTab);
|
||||
close();
|
||||
}
|
||||
else{
|
||||
NBTTagCompound compound = getCompound();
|
||||
if(compound == null)
|
||||
return;
|
||||
Client.sendData(EnumPacketServer.SpawnMob, false, posX, posY, posZ, compound);
|
||||
SpawnMobPacket.Client(posX, posY, posZ, compound);
|
||||
close();
|
||||
}
|
||||
}
|
||||
@@ -393,14 +395,14 @@ public class GuiNpcMobSpawner extends GuiNPCInterface implements IGuiData {
|
||||
String sel = scroll.getSelected();
|
||||
if(sel == null)
|
||||
return;
|
||||
Client.sendData(EnumPacketServer.MobSpawner, true, posX, posY, posZ, sel, activeTab);
|
||||
MobSpawnerPacket.Server(posX, posY, posZ, sel, activeTab);
|
||||
close();
|
||||
}
|
||||
else{
|
||||
NBTTagCompound compound = getCompound();
|
||||
if(compound == null)
|
||||
return;
|
||||
Client.sendData(EnumPacketServer.MobSpawner, false, posX, posY, posZ, compound);
|
||||
MobSpawnerPacket.Client(posX, posY, posZ, compound);
|
||||
close();
|
||||
|
||||
}
|
||||
@@ -427,7 +429,7 @@ public class GuiNpcMobSpawner extends GuiNPCInterface implements IGuiData {
|
||||
if(id == 6){
|
||||
if(scroll.getSelected() != null){
|
||||
if(showingClones == 2){
|
||||
Client.sendData(EnumPacketServer.CloneRemove, activeTab, scroll.getSelected());
|
||||
PacketClient.sendClient(new CloneRemovePacket(activeTab, scroll.getSelected()));
|
||||
return;
|
||||
}
|
||||
ClientCloneController.Instance.removeClone(scroll.getSelected(), activeTab);
|
||||
@@ -464,7 +466,7 @@ public class GuiNpcMobSpawner extends GuiNPCInterface implements IGuiData {
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -534,4 +536,4 @@ public class GuiNpcMobSpawner extends GuiNPCInterface implements IGuiData {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,10 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.packets.request.clone.CloneAllTagsShortPacket;
|
||||
import kamkeel.npcs.network.packets.request.clone.ClonePreSavePacket;
|
||||
import kamkeel.npcs.network.packets.request.clone.CloneSavePacket;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiYesNo;
|
||||
@@ -9,10 +14,10 @@ import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.nbt.NBTTagString;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.controllers.ClientCloneController;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.controllers.TagController;
|
||||
import noppes.npcs.controllers.data.Tag;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
@@ -58,7 +63,7 @@ public class GuiNpcMobSpawnerAdd extends GuiNPCInterface implements GuiYesNoCall
|
||||
addTagUUIDs = new HashSet<>();
|
||||
}
|
||||
if(isNPC){
|
||||
Client.sendData(EnumPacketServer.CloneAllTagsShort);
|
||||
PacketClient.sendClient(new CloneAllTagsShortPacket());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +107,7 @@ public class GuiNpcMobSpawnerAdd extends GuiNPCInterface implements GuiYesNoCall
|
||||
confirmClicked(true, 0);
|
||||
}
|
||||
else
|
||||
Client.sendData(EnumPacketServer.ClonePreSave, name, tab);
|
||||
PacketClient.sendClient(new ClonePreSavePacket(name, tab));
|
||||
}
|
||||
if(id == 1){
|
||||
close();
|
||||
@@ -145,7 +150,7 @@ public class GuiNpcMobSpawnerAdd extends GuiNPCInterface implements GuiYesNoCall
|
||||
if(isNPC){
|
||||
compounder.setTag("TagUUIDs", tagsCompound);
|
||||
}
|
||||
Client.sendData(EnumPacketServer.CloneSave, name, tab, extraTags, compounder);
|
||||
PacketClient.sendClient(new CloneSavePacket(name, tab, extraTags, compounder));
|
||||
}
|
||||
|
||||
close();
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.MountPacket;
|
||||
import kamkeel.npcs.network.packets.request.clone.CloneListPacket;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -9,10 +12,10 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagDouble;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.controllers.ClientCloneController;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.ArrayList;
|
||||
@@ -20,19 +23,19 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class GuiNpcMobSpawnerMounter extends GuiNPCInterface implements IGuiData{
|
||||
|
||||
|
||||
private GuiCustomScroll scroll;
|
||||
|
||||
|
||||
private int posX,posY,posZ;
|
||||
|
||||
|
||||
private List<String> list;
|
||||
|
||||
|
||||
private static int showingClones = 0;
|
||||
|
||||
private static String search = "";
|
||||
|
||||
|
||||
private int activeTab = 1;
|
||||
|
||||
|
||||
public GuiNpcMobSpawnerMounter(int i, int j, int k) {
|
||||
super();
|
||||
xSize = 256;
|
||||
@@ -40,16 +43,16 @@ public class GuiNpcMobSpawnerMounter extends GuiNPCInterface implements IGuiData
|
||||
posX = i;
|
||||
posY = j;
|
||||
posZ = k;
|
||||
|
||||
|
||||
this.closeOnEsc = true;
|
||||
|
||||
|
||||
setBackground("menubg.png");
|
||||
}
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
guiTop += 10;
|
||||
|
||||
|
||||
if(scroll == null){
|
||||
scroll = new GuiCustomScroll(this,0);
|
||||
scroll.setSize(165, 188);
|
||||
@@ -59,7 +62,7 @@ public class GuiNpcMobSpawnerMounter extends GuiNPCInterface implements IGuiData
|
||||
scroll.guiLeft = guiLeft + 4;
|
||||
scroll.guiTop = guiTop + 26;
|
||||
addScroll(scroll);
|
||||
|
||||
|
||||
addTextField(new GuiNpcTextField(1, this, fontRendererObj, guiLeft + 4, guiTop + 4, 165, 20, search));
|
||||
|
||||
GuiMenuTopButton button;
|
||||
@@ -90,7 +93,7 @@ public class GuiNpcMobSpawnerMounter extends GuiNPCInterface implements IGuiData
|
||||
addSideButton(new GuiMenuSideButton(33,guiLeft - 90, this.guiTop + 170, 45,22, "13"));
|
||||
addSideButton(new GuiMenuSideButton(34,guiLeft - 45, this.guiTop + 191, 45,22, "14"));
|
||||
addSideButton(new GuiMenuSideButton(35,guiLeft - 90, this.guiTop + 191, 45,22, "15"));
|
||||
|
||||
|
||||
getSideButton(20 + activeTab).active = true;
|
||||
showClones();
|
||||
}
|
||||
@@ -109,17 +112,17 @@ public class GuiNpcMobSpawnerMounter extends GuiNPCInterface implements IGuiData
|
||||
e.printStackTrace();
|
||||
} catch (NoSuchMethodException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
this.list = list;
|
||||
scroll.setList(getSearchList());
|
||||
}
|
||||
private void showClones() {
|
||||
|
||||
if(showingClones == 2){
|
||||
Client.sendData(EnumPacketServer.CloneList, activeTab);
|
||||
PacketClient.sendClient(new CloneListPacket(activeTab));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ArrayList<String> list = new ArrayList<String>();
|
||||
this.list = ClientCloneController.Instance.getClones(activeTab);
|
||||
scroll.setList(getSearchList());
|
||||
@@ -127,7 +130,7 @@ public class GuiNpcMobSpawnerMounter extends GuiNPCInterface implements IGuiData
|
||||
public void keyTyped(char c, int i)
|
||||
{
|
||||
super.keyTyped(c, i);
|
||||
|
||||
|
||||
if(search.equals(getTextField(1).getText()))
|
||||
return;
|
||||
search = getTextField(1).getText().toLowerCase();
|
||||
@@ -147,7 +150,7 @@ public class GuiNpcMobSpawnerMounter extends GuiNPCInterface implements IGuiData
|
||||
String sel = scroll.getSelected();
|
||||
if(sel == null)
|
||||
return null;
|
||||
|
||||
|
||||
if(showingClones == 0){
|
||||
return ClientCloneController.Instance.getCloneData(player, sel, activeTab);
|
||||
}
|
||||
@@ -159,9 +162,9 @@ public class GuiNpcMobSpawnerMounter extends GuiNPCInterface implements IGuiData
|
||||
entity.writeToNBTOptional(compound);
|
||||
return compound;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected void actionPerformed(GuiButton guibutton)
|
||||
{
|
||||
int id = guibutton.id;
|
||||
@@ -172,12 +175,12 @@ public class GuiNpcMobSpawnerMounter extends GuiNPCInterface implements IGuiData
|
||||
NBTTagCompound compound = getCompound();
|
||||
if(compound != null){
|
||||
compound.setTag("Pos", this.newDoubleNBTList(new double[] {this.posX + 0.5, this.posY + 1, this.posZ + 0.5}));
|
||||
Client.sendData(EnumPacketServer.SpawnRider, compound);
|
||||
MountPacket.Spawn(compound);
|
||||
close();
|
||||
}
|
||||
}
|
||||
if(id == 2){
|
||||
Client.sendData(EnumPacketServer.PlayerRider);
|
||||
MountPacket.Player();
|
||||
close();
|
||||
}
|
||||
if(id == 3){
|
||||
@@ -211,11 +214,11 @@ public class GuiNpcMobSpawnerMounter extends GuiNPCInterface implements IGuiData
|
||||
|
||||
return nbttaglist;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
|
||||
}
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
|
||||
@@ -1,36 +1,38 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.clone.CloneListPacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagDouble;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.controllers.ClientCloneController;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class GuiNpcMobSpawnerSelector extends SubGuiInterface implements IGuiData{
|
||||
|
||||
|
||||
private GuiCustomScroll scroll;
|
||||
private List<String> list;
|
||||
|
||||
|
||||
private static String search = "";
|
||||
public int activeTab = 1;
|
||||
public boolean isServer = false;
|
||||
|
||||
|
||||
public GuiNpcMobSpawnerSelector() {
|
||||
super();
|
||||
xSize = 256;
|
||||
this.closeOnEsc = true;
|
||||
setBackground("menubg.png");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void initGui(){
|
||||
super.initGui();
|
||||
super.initGui();
|
||||
if(scroll == null){
|
||||
scroll = new GuiCustomScroll(this,0);
|
||||
scroll.setSize(165, 188);
|
||||
@@ -40,7 +42,7 @@ public class GuiNpcMobSpawnerSelector extends SubGuiInterface implements IGuiDat
|
||||
scroll.guiLeft = guiLeft + 4;
|
||||
scroll.guiTop = guiTop + 26;
|
||||
addScroll(scroll);
|
||||
|
||||
|
||||
addTextField(new GuiNpcTextField(1, this, fontRendererObj, guiLeft + 4, guiTop + 4, 165, 20, search));
|
||||
|
||||
addButton(new GuiNpcButton(0, guiLeft + 171, guiTop + 80, 80, 20, "gui.done"));
|
||||
@@ -61,30 +63,30 @@ public class GuiNpcMobSpawnerSelector extends SubGuiInterface implements IGuiDat
|
||||
addSideButton(new GuiMenuSideButton(33,guiLeft - 90, this.guiTop + 170, 45,22, "13"));
|
||||
addSideButton(new GuiMenuSideButton(34,guiLeft - 45, this.guiTop + 191, 45,22, "14"));
|
||||
addSideButton(new GuiMenuSideButton(35,guiLeft - 90, this.guiTop + 191, 45,22, "15"));
|
||||
|
||||
|
||||
getSideButton(20 + activeTab).active = true;
|
||||
showClones();
|
||||
}
|
||||
|
||||
|
||||
public String getSelected(){
|
||||
return scroll.getSelected();
|
||||
}
|
||||
private void showClones() {
|
||||
|
||||
if(isServer){
|
||||
Client.sendData(EnumPacketServer.CloneList, activeTab);
|
||||
PacketClient.sendClient(new CloneListPacket(activeTab));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ArrayList<String> list = new ArrayList<String>();
|
||||
|
||||
|
||||
this.list = new ArrayList<String>(ClientCloneController.Instance.getClones(activeTab));
|
||||
scroll.setList(getSearchList());
|
||||
}
|
||||
public void keyTyped(char c, int i)
|
||||
{
|
||||
super.keyTyped(c, i);
|
||||
|
||||
|
||||
if(search.equals(getTextField(1).getText()))
|
||||
return;
|
||||
search = getTextField(1).getText().toLowerCase();
|
||||
@@ -109,7 +111,7 @@ public class GuiNpcMobSpawnerSelector extends SubGuiInterface implements IGuiDat
|
||||
compound.setString("ClonedName", sel);
|
||||
return compound;
|
||||
}
|
||||
|
||||
|
||||
public void buttonEvent(GuiButton guibutton)
|
||||
{
|
||||
int id = guibutton.id;
|
||||
@@ -139,11 +141,11 @@ public class GuiNpcMobSpawnerSelector extends SubGuiInterface implements IGuiDat
|
||||
|
||||
return nbttaglist;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.pather.MovingPathGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.pather.MovingPathSavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.DataAI;
|
||||
import noppes.npcs.NBTTags;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.gui.util.GuiCustomScroll;
|
||||
import noppes.npcs.client.gui.util.GuiNPCInterface;
|
||||
import noppes.npcs.client.gui.util.GuiNpcButton;
|
||||
import noppes.npcs.client.gui.util.IGuiData;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -17,19 +20,19 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class GuiNpcPather extends GuiNPCInterface implements IGuiData{
|
||||
|
||||
|
||||
private GuiCustomScroll scroll;
|
||||
private HashMap<String, Integer> data = new HashMap<String, Integer>();
|
||||
private DataAI ai;
|
||||
|
||||
|
||||
public GuiNpcPather(EntityNPCInterface npc) {
|
||||
super();
|
||||
drawDefaultBackground = false;
|
||||
xSize = 176;
|
||||
title = "Npc Pather";
|
||||
setBackground("smallbg.png");
|
||||
ai = npc.ai;
|
||||
Client.sendData(EnumPacketServer.MovingPathGet);
|
||||
ai = npc.ais;
|
||||
PacketClient.sendClient(new MovingPathGetPacket());
|
||||
}
|
||||
@Override
|
||||
public void initGui()
|
||||
@@ -44,7 +47,7 @@ public class GuiNpcPather extends GuiNPCInterface implements IGuiData{
|
||||
scroll.setUnsortedList(list);
|
||||
scroll.guiLeft = guiLeft + 7;
|
||||
scroll.guiTop = guiTop + 12;
|
||||
|
||||
|
||||
addScroll(scroll);
|
||||
this.addButton(new GuiNpcButton(0, guiLeft + 6, guiTop + 178,52,20, "gui.down"));
|
||||
this.addButton(new GuiNpcButton(1, guiLeft + 62, guiTop + 178,52,20, "gui.up"));
|
||||
@@ -55,7 +58,7 @@ public class GuiNpcPather extends GuiNPCInterface implements IGuiData{
|
||||
{
|
||||
if(scroll.selected < 0)
|
||||
return;
|
||||
|
||||
|
||||
int id = guibutton.id;
|
||||
if(id == 0){
|
||||
List<int[]> list = ai.getMovingPath();
|
||||
@@ -109,12 +112,12 @@ public class GuiNpcPather extends GuiNPCInterface implements IGuiData{
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setTag("MovingPathNew", NBTTags.nbtIntegerArraySet(ai.getMovingPath()));
|
||||
Client.sendData(EnumPacketServer.MovingPathSave, compound);
|
||||
PacketClient.sendClient(new MovingPathSavePacket(compound));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,71 +1,73 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.TileEntitySavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.blocks.tiles.TileRedstoneBlock;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.gui.util.GuiNPCInterface;
|
||||
import noppes.npcs.client.gui.util.GuiNpcButton;
|
||||
import noppes.npcs.client.gui.util.GuiNpcLabel;
|
||||
import noppes.npcs.client.gui.util.GuiNpcTextField;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
|
||||
public class GuiNpcRedstoneBlock extends GuiNPCInterface{
|
||||
|
||||
private TileRedstoneBlock tile;
|
||||
|
||||
|
||||
public GuiNpcRedstoneBlock(int x, int y, int z) {
|
||||
super();
|
||||
tile = (TileRedstoneBlock) player.worldObj.getTileEntity(x, y, z);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void initGui(){
|
||||
super.initGui();
|
||||
|
||||
this.addButton(new GuiNpcButton(4, guiLeft + 40, guiTop + 20, 120, 20, "availability.options"));
|
||||
|
||||
addLabel(new GuiNpcLabel(11,"gui.detailed", guiLeft+ 40, guiTop + 47, 0xffffff));
|
||||
addLabel(new GuiNpcLabel(11,"gui.detailed", guiLeft+ 40, guiTop + 47, 0xffffff));
|
||||
this.addButton(new GuiNpcButton(1, guiLeft + 110, guiTop + 42, 50, 20, new String[]{"gui.no", "gui.yes"},tile.isDetailed?1:0));
|
||||
|
||||
|
||||
if(tile.isDetailed){
|
||||
addLabel(new GuiNpcLabel(0,StatCollector.translateToLocal("bard.ondistance") + " X:", guiLeft+ 1, guiTop + 76, 0xffffff));
|
||||
addLabel(new GuiNpcLabel(0,StatCollector.translateToLocal("bard.ondistance") + " X:", guiLeft+ 1, guiTop + 76, 0xffffff));
|
||||
addTextField(new GuiNpcTextField(0, this, fontRendererObj, guiLeft+ 80, guiTop + 71,30,20, tile.onRangeX + ""));
|
||||
getTextField(0).integersOnly = true;
|
||||
getTextField(0).setMinMaxDefault(0, 50, 6);
|
||||
addLabel(new GuiNpcLabel(1,"Y:", guiLeft+ 113, guiTop + 76, 0xffffff));
|
||||
getTextField(0).setMinMaxDefault(0, 50, 6);
|
||||
addLabel(new GuiNpcLabel(1,"Y:", guiLeft+ 113, guiTop + 76, 0xffffff));
|
||||
addTextField(new GuiNpcTextField(1, this, fontRendererObj, guiLeft+ 122, guiTop + 71,30,20, tile.onRangeY + ""));
|
||||
getTextField(1).integersOnly = true;
|
||||
getTextField(1).setMinMaxDefault(0, 50, 6);
|
||||
addLabel(new GuiNpcLabel(2,"Z:", guiLeft+ 155, guiTop + 76, 0xffffff));
|
||||
getTextField(1).setMinMaxDefault(0, 50, 6);
|
||||
addLabel(new GuiNpcLabel(2,"Z:", guiLeft+ 155, guiTop + 76, 0xffffff));
|
||||
addTextField(new GuiNpcTextField(2, this, fontRendererObj, guiLeft+ 164, guiTop + 71,30,20, tile.onRangeZ + ""));
|
||||
getTextField(2).integersOnly = true;
|
||||
getTextField(2).setMinMaxDefault(0, 50, 6);
|
||||
|
||||
addLabel(new GuiNpcLabel(3,StatCollector.translateToLocal("bard.offdistance") + " X:", guiLeft - 3, guiTop + 99, 0xffffff));
|
||||
|
||||
addLabel(new GuiNpcLabel(3,StatCollector.translateToLocal("bard.offdistance") + " X:", guiLeft - 3, guiTop + 99, 0xffffff));
|
||||
addTextField(new GuiNpcTextField(3, this, fontRendererObj, guiLeft+ 80, guiTop + 94,30,20, tile.offRangeX + ""));
|
||||
getTextField(3).integersOnly = true;
|
||||
getTextField(3).setMinMaxDefault(0, 50, 10);
|
||||
addLabel(new GuiNpcLabel(4,"Y:", guiLeft+ 113, guiTop + 99, 0xffffff));
|
||||
getTextField(3).setMinMaxDefault(0, 50, 10);
|
||||
addLabel(new GuiNpcLabel(4,"Y:", guiLeft+ 113, guiTop + 99, 0xffffff));
|
||||
addTextField(new GuiNpcTextField(4, this, fontRendererObj, guiLeft+ 122, guiTop + 94,30,20, tile.offRangeY + ""));
|
||||
getTextField(4).integersOnly = true;
|
||||
getTextField(4).setMinMaxDefault(0, 50, 10);
|
||||
addLabel(new GuiNpcLabel(5,"Z:", guiLeft+ 155, guiTop + 99, 0xffffff));
|
||||
getTextField(4).setMinMaxDefault(0, 50, 10);
|
||||
addLabel(new GuiNpcLabel(5,"Z:", guiLeft+ 155, guiTop + 99, 0xffffff));
|
||||
addTextField(new GuiNpcTextField(5, this, fontRendererObj, guiLeft+ 164, guiTop + 94,30,20, tile.offRangeZ + ""));
|
||||
getTextField(5).integersOnly = true;
|
||||
getTextField(5).setMinMaxDefault(0, 50, 10);
|
||||
}
|
||||
else{
|
||||
addLabel(new GuiNpcLabel(0,"bard.ondistance", guiLeft+ 1, guiTop + 76, 0xffffff));
|
||||
addLabel(new GuiNpcLabel(0,"bard.ondistance", guiLeft+ 1, guiTop + 76, 0xffffff));
|
||||
addTextField(new GuiNpcTextField(0, this, fontRendererObj, guiLeft+ 80, guiTop + 71,30,20, tile.onRange + ""));
|
||||
getTextField(0).integersOnly = true;
|
||||
getTextField(0).setMinMaxDefault(0, 50, 6);
|
||||
|
||||
addLabel(new GuiNpcLabel(3,"bard.offdistance", guiLeft - 3, guiTop + 99, 0xffffff));
|
||||
getTextField(0).setMinMaxDefault(0, 50, 6);
|
||||
|
||||
addLabel(new GuiNpcLabel(3,"bard.offdistance", guiLeft - 3, guiTop + 99, 0xffffff));
|
||||
addTextField(new GuiNpcTextField(3, this, fontRendererObj, guiLeft+ 80, guiTop + 94,30,20, tile.offRange + ""));
|
||||
getTextField(3).integersOnly = true;
|
||||
getTextField(3).setMinMaxDefault(0, 50, 10);
|
||||
getTextField(3).setMinMaxDefault(0, 50, 10);
|
||||
}
|
||||
addButton(new GuiNpcButton(0, guiLeft + 40, guiTop + 190,120,20, "Done"));
|
||||
}
|
||||
@@ -96,7 +98,7 @@ public class GuiNpcRedstoneBlock extends GuiNPCInterface{
|
||||
tile.offRangeX = getTextField(3).getInteger();
|
||||
tile.offRangeY = getTextField(4).getInteger();
|
||||
tile.offRangeZ = getTextField(5).getInteger();
|
||||
|
||||
|
||||
if(tile.onRangeX > tile.offRangeX)
|
||||
tile.offRangeX = tile.onRangeX;
|
||||
if(tile.onRangeY > tile.offRangeY)
|
||||
@@ -111,10 +113,10 @@ public class GuiNpcRedstoneBlock extends GuiNPCInterface{
|
||||
tile.offRange = tile.onRange;
|
||||
}
|
||||
tile.isActivated = false;
|
||||
|
||||
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
tile.writeToNBT(compound);
|
||||
Client.sendData(EnumPacketServer.SaveTileEntity, compound);
|
||||
PacketClient.sendClient(new TileEntitySavePacket(compound));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,36 +1,42 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.npc.*;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiYesNo;
|
||||
import net.minecraft.client.gui.GuiYesNoCallback;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
public class GuiNpcRemoteEditor extends GuiNPCInterface implements IScrollData, GuiYesNoCallback{
|
||||
|
||||
private GuiCustomScroll scroll;
|
||||
private HashMap<String, Integer> data = new HashMap<String, Integer>();
|
||||
private String search = "";
|
||||
|
||||
public GuiNpcRemoteEditor() {
|
||||
super();
|
||||
xSize = 256;
|
||||
setBackground("menubg.png");
|
||||
Client.sendData(EnumPacketServer.RemoteNpcsGet);
|
||||
Client.sendData(EnumPacketServer.RemoteFreezeGet);
|
||||
PacketClient.sendClient(new RemoteNpcsGetPacket());
|
||||
PacketClient.sendClient(new RemoteFreezeGetPacket());
|
||||
}
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
if(scroll == null){
|
||||
scroll = new GuiCustomScroll(this,0, 0);
|
||||
scroll.setSize(165, 208);
|
||||
scroll.setSize(165, 188);
|
||||
}
|
||||
scroll.guiLeft = guiLeft + 4;
|
||||
scroll.guiTop = guiTop + 4;
|
||||
@@ -39,6 +45,8 @@ public class GuiNpcRemoteEditor extends GuiNPCInterface implements IScrollData,
|
||||
String title = StatCollector.translateToLocal("remote.title");
|
||||
int x = (xSize - this.fontRendererObj.getStringWidth(title)) / 2;
|
||||
|
||||
addTextField(new GuiNpcTextField(66, this, fontRendererObj, guiLeft + 4, guiTop + 5 + scroll.ySize, scroll.xSize, 20, search));
|
||||
|
||||
this.addLabel(new GuiNpcLabel(0, title, guiLeft + x, guiTop - 8));
|
||||
|
||||
this.addButton(new GuiNpcButton(0, guiLeft + 170, guiTop + 6,82,20, "selectServer.edit"));
|
||||
@@ -53,7 +61,7 @@ public class GuiNpcRemoteEditor extends GuiNPCInterface implements IScrollData,
|
||||
@Override
|
||||
public void confirmClicked(boolean flag, int i){
|
||||
if(flag){
|
||||
Client.sendData(EnumPacketServer.RemoteDelete,data.get(scroll.getSelected()));
|
||||
PacketClient.sendClient(new RemoteDeletePacket(data.get(scroll.getSelected())));
|
||||
}
|
||||
NoppesUtil.openGUI(player, this);
|
||||
}
|
||||
@@ -61,11 +69,11 @@ public class GuiNpcRemoteEditor extends GuiNPCInterface implements IScrollData,
|
||||
{
|
||||
int id = guibutton.id;
|
||||
if(id == 3){
|
||||
Client.sendData(EnumPacketServer.RemoteFreeze);
|
||||
PacketClient.sendClient(new RemoteFreezePacket());
|
||||
}
|
||||
if(id == 5){
|
||||
for(int ids : data.values()){
|
||||
Client.sendData(EnumPacketServer.RemoteReset, ids);
|
||||
PacketClient.sendClient(new RemoteResetPacket(ids));
|
||||
Entity entity = player.worldObj.getEntityByID(ids);
|
||||
if(entity != null && entity instanceof EntityNPCInterface)
|
||||
((EntityNPCInterface)entity).reset();
|
||||
@@ -73,27 +81,28 @@ public class GuiNpcRemoteEditor extends GuiNPCInterface implements IScrollData,
|
||||
}
|
||||
if(id == 6){
|
||||
NoppesUtil.setLastNpc(null);
|
||||
Client.sendData(EnumPacketServer.RemoteGlobalMenu);
|
||||
PacketClient.sendClient(new RemoteGlobalMenuPacket());
|
||||
}
|
||||
|
||||
if(!data.containsKey(scroll.getSelected()))
|
||||
return;
|
||||
|
||||
if(id == 0){
|
||||
Client.sendData(EnumPacketServer.RemoteMainMenu,data.get(scroll.getSelected()));
|
||||
PacketClient.sendClient(new RemoteMainMenuPacket(data.get(scroll.getSelected())));
|
||||
}
|
||||
if(id == 1){
|
||||
GuiYesNo guiyesno = new GuiYesNo(this, "Confirm", StatCollector.translateToLocal("gui.delete"), 0);
|
||||
displayGuiScreen(guiyesno);
|
||||
}
|
||||
if(id == 2){
|
||||
Client.sendData(EnumPacketServer.RemoteReset,data.get(scroll.getSelected()));
|
||||
Entity entity = player.worldObj.getEntityByID(data.get(scroll.getSelected()));
|
||||
int selected = data.get(scroll.getSelected());
|
||||
PacketClient.sendClient(new RemoteResetPacket(selected));
|
||||
Entity entity = player.worldObj.getEntityByID(selected);
|
||||
if(entity != null && entity instanceof EntityNPCInterface)
|
||||
((EntityNPCInterface)entity).reset();
|
||||
}
|
||||
if(id == 4){
|
||||
Client.sendData(EnumPacketServer.RemoteTpToNpc,data.get(scroll.getSelected()));
|
||||
PacketClient.sendClient(new RemoteTpToNpcPacket(data.get(scroll.getSelected())));
|
||||
close();
|
||||
}
|
||||
}
|
||||
@@ -107,20 +116,47 @@ public class GuiNpcRemoteEditor extends GuiNPCInterface implements IScrollData,
|
||||
@Override
|
||||
public void keyTyped(char c, int i)
|
||||
{
|
||||
if (i == 1 || isInventoryKey(i))
|
||||
super.keyTyped(c, i);
|
||||
if(getTextField(66) != null){
|
||||
if(getTextField(66).isFocused()){
|
||||
if (i == 1)
|
||||
{
|
||||
close();
|
||||
return;
|
||||
}
|
||||
if(search.equals(getTextField(66).getText()))
|
||||
return;
|
||||
search = getTextField(66).getText().toLowerCase();
|
||||
scroll.resetScroll();
|
||||
scroll.setList(getNPCSearch());
|
||||
}
|
||||
}
|
||||
if (i == 1)
|
||||
{
|
||||
close();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void save() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
private List<String> getNPCSearch(){
|
||||
if(search.isEmpty()){
|
||||
return new ArrayList<String>(this.data.keySet());
|
||||
}
|
||||
List<String> list = new ArrayList<String>();
|
||||
for(String name : this.data.keySet()){
|
||||
if(name.toLowerCase().contains(search))
|
||||
list.add(name);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {}
|
||||
|
||||
@Override
|
||||
public void setData(Vector<String> list, HashMap<String, Integer> data) {
|
||||
scroll.setList(list);
|
||||
this.data = data;
|
||||
this.data = data;
|
||||
scroll.resetScroll();
|
||||
scroll.setList(getNPCSearch());
|
||||
}
|
||||
@Override
|
||||
public void setSelected(String selected) {
|
||||
|
||||
@@ -1,19 +1,21 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.TileEntitySavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.blocks.tiles.TileWaypoint;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.gui.util.GuiNPCInterface;
|
||||
import noppes.npcs.client.gui.util.GuiNpcButton;
|
||||
import noppes.npcs.client.gui.util.GuiNpcLabel;
|
||||
import noppes.npcs.client.gui.util.GuiNpcTextField;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
|
||||
public class GuiNpcWaypoint extends GuiNPCInterface{
|
||||
|
||||
private TileWaypoint tile;
|
||||
|
||||
|
||||
public GuiNpcWaypoint(int x, int y, int z) {
|
||||
super();
|
||||
tile = (TileWaypoint) player.worldObj.getTileEntity(x, y, z);
|
||||
@@ -23,11 +25,11 @@ public class GuiNpcWaypoint extends GuiNPCInterface{
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
|
||||
addLabel(new GuiNpcLabel(0,"gui.name", guiLeft+ 1, guiTop + 76, 0xffffff));
|
||||
|
||||
addLabel(new GuiNpcLabel(0,"gui.name", guiLeft+ 1, guiTop + 76, 0xffffff));
|
||||
addTextField(new GuiNpcTextField(0, this, fontRendererObj, guiLeft+ 60, guiTop + 71,200,20, tile.name));
|
||||
|
||||
addLabel(new GuiNpcLabel(1,"gui.range", guiLeft+ 1, guiTop + 97, 0xffffff));
|
||||
|
||||
addLabel(new GuiNpcLabel(1,"gui.range", guiLeft+ 1, guiTop + 97, 0xffffff));
|
||||
addTextField(new GuiNpcTextField(1, this, fontRendererObj, guiLeft+ 60, guiTop + 92,200,20, tile.range + ""));
|
||||
getTextField(1).integersOnly = true;
|
||||
getTextField(1).setMinMaxDefault(2, 60, 10);
|
||||
@@ -43,10 +45,10 @@ public class GuiNpcWaypoint extends GuiNPCInterface{
|
||||
public void save() {
|
||||
tile.name = getTextField(0).getText();
|
||||
tile.range = getTextField(1).getInteger();
|
||||
|
||||
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
tile.writeToNBT(compound);
|
||||
Client.sendData(EnumPacketServer.SaveTileEntity, compound);
|
||||
PacketClient.sendClient(new TileEntitySavePacket(compound));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import kamkeel.npcs.network.packets.request.script.NPCScriptPacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiConfirmOpenLink;
|
||||
import net.minecraft.client.gui.GuiYesNo;
|
||||
@@ -9,11 +10,11 @@ import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.NoppesStringUtils;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.script.GuiNPCEventScripts;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.controllers.ScriptContainer;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.controllers.data.DataScript;
|
||||
@@ -38,7 +39,7 @@ public class GuiScript extends GuiNPCInterface implements IGuiData, GuiYesNoCall
|
||||
xSize = 420;
|
||||
|
||||
setBackground("menubg.png");
|
||||
Client.sendData(EnumPacketServer.ScriptDataGet);
|
||||
NPCScriptPacket.Get();
|
||||
}
|
||||
|
||||
public void initGui() {
|
||||
@@ -267,7 +268,7 @@ public class GuiScript extends GuiNPCInterface implements IGuiData, GuiYesNoCall
|
||||
@Override
|
||||
public void save() {
|
||||
setScript();
|
||||
Client.sendData(EnumPacketServer.ScriptDataSave, script.writeToNBT(new NBTTagCompound()));
|
||||
NPCScriptPacket.Save(script.writeToNBT(new NBTTagCompound()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.tags.TagsGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.tags.TagsNpcGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.tags.TagSetPacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.nbt.NBTTagString;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.client.Client;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
import noppes.npcs.controllers.TagController;
|
||||
import noppes.npcs.controllers.data.Tag;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -31,8 +30,8 @@ public class SubGuiClonerNPCTags extends SubGuiInterface implements IGuiData,ISc
|
||||
{
|
||||
this.parent = guiNpcMobSpawnerAdd;
|
||||
this.mobSpawnerAdd = guiNpcMobSpawnerAdd;
|
||||
Client.sendData(EnumPacketServer.TagsGet);
|
||||
Client.sendData(EnumPacketServer.NpcTagsGet);
|
||||
PacketClient.sendClient(new TagsGetPacket());
|
||||
PacketClient.sendClient(new TagsNpcGetPacket());
|
||||
setBackground("menubg.png");
|
||||
xSize = 305;
|
||||
ySize = 220;
|
||||
@@ -146,7 +145,7 @@ public class SubGuiClonerNPCTags extends SubGuiInterface implements IGuiData,ISc
|
||||
|
||||
GuiNpcMobSpawnerAdd.tagsCompound = UUIDTagList;
|
||||
tagCompound.setTag("TagNames",tagList);
|
||||
Client.sendData(EnumPacketServer.TagSet, tagCompound);
|
||||
PacketClient.sendClient(new TagSetPacket(tagCompound));
|
||||
}
|
||||
|
||||
public void keyTyped(char c, int i)
|
||||
|
||||
@@ -0,0 +1,255 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.effects.EffectSavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.client.ClientCacheHandler;
|
||||
import noppes.npcs.client.gui.global.GuiNPCManageEffects;
|
||||
import noppes.npcs.client.gui.script.GuiScriptEffect;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.client.renderer.ImageData;
|
||||
import noppes.npcs.controllers.data.CustomEffect;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SubGuiEffectGeneral extends SubGuiInterface implements ITextfieldListener {
|
||||
private final GuiNPCManageEffects parent;
|
||||
public CustomEffect effect;
|
||||
private final String originalName;
|
||||
|
||||
private List<GuiMenuTopButton> topButtons = new ArrayList<>();
|
||||
|
||||
public SubGuiEffectGeneral(GuiNPCManageEffects parent, CustomEffect effect) {
|
||||
this.effect = effect;
|
||||
this.parent = parent;
|
||||
this.originalName = effect.name;
|
||||
this.closeOnEsc = true;
|
||||
|
||||
setBackground("menubg.png");
|
||||
xSize = 360;
|
||||
ySize = 216;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
GuiMenuTopButton close = new GuiMenuTopButton(-5, guiLeft + xSize - 22, guiTop - 10, "X");
|
||||
|
||||
GuiMenuTopButton general = new GuiMenuTopButton(-1, guiLeft + 4, guiTop - 10, "display.general");
|
||||
GuiMenuTopButton scripts = new GuiMenuTopButton(-2, general.xPosition + general.getWidth(), guiTop - 10, "script.scripts");
|
||||
|
||||
close.active = false;
|
||||
general.active = true;
|
||||
scripts.active = false;
|
||||
|
||||
addTopButton(close);
|
||||
addTopButton(general);
|
||||
addTopButton(scripts);
|
||||
|
||||
guiTop += 7;
|
||||
int y = guiTop + 7;
|
||||
int x = guiLeft + 4 + 4;
|
||||
addTextField(new GuiNpcTextField(1, this, this.fontRendererObj, x + 36, y, 280, 20, effect.name));
|
||||
getTextField(1).setMaxStringLength(40);
|
||||
addLabel(new GuiNpcLabel(1, "gui.name", x, y + 5));
|
||||
|
||||
addLabel(new GuiNpcLabel(-1, "ID", x + 320, y + 1));
|
||||
addLabel(new GuiNpcLabel(-2, effect.id + "", x + 320, y + 11));
|
||||
|
||||
y += 23;
|
||||
|
||||
addTextField(new GuiNpcTextField(2, this, x + 70, y, 246, 20, effect.menuName.replaceAll("§", "&")));
|
||||
getTextField(2).setMaxStringLength(40);
|
||||
addLabel(new GuiNpcLabel(2, "general.menuName", x, y + 5));
|
||||
|
||||
y += 23;
|
||||
|
||||
addTextField(setIntegerOnly(
|
||||
new GuiNpcTextField(3, this, x + 70, y, 83, 20, ""+effect.everyXTick),
|
||||
10,
|
||||
1200,
|
||||
effect.everyXTick
|
||||
));
|
||||
getTextField(3).setMaxStringLength(6);
|
||||
getTextField(3).integersOnly = true;
|
||||
addLabel(new GuiNpcLabel(3, "effect.editor.runsEveryX", x, y + 5));
|
||||
|
||||
int oldX = x;
|
||||
int xEnd = guiLeft+xSize-10;
|
||||
x = getTextField(3).xPosition + getTextField(3).width;
|
||||
addButton(new GuiNpcButtonYesNo(10, (x+xEnd - 83) / 2, y + 23, 83, 20, effect.lossOnDeath));
|
||||
GuiNpcLabel label = new GuiNpcLabel(10, "effect.editor.lossOnDeath", x, y + 5);
|
||||
label.x = (x+xEnd - fontRendererObj.getStringWidth(label.label))/2;
|
||||
addLabel(label);
|
||||
x = oldX;
|
||||
y += 23;
|
||||
|
||||
addTextField(setIntegerOnly(
|
||||
new GuiNpcTextField(4, this, x + 70, y, 83, 20, ""+effect.length),
|
||||
-100,
|
||||
86400,
|
||||
effect.length
|
||||
));
|
||||
|
||||
addLabel(new GuiNpcLabel(4, "effect.editor.defaultLength", x, y + 5));
|
||||
|
||||
x = oldX - 4;
|
||||
y += 23;
|
||||
GuiScrollWindow scrollWindow = new GuiScrollWindow(this, x + 5, y, xSize - 20, ySize - 10 - (y - guiTop), 0) {
|
||||
@Override
|
||||
public void drawComponents(int mouseX, int mouseY, float partialTicks) {
|
||||
super.drawComponents(mouseX, mouseY, partialTicks);
|
||||
|
||||
int iconRenderSize = 96;
|
||||
|
||||
int x = 10, y = (clipHeight - 96) / 2;
|
||||
|
||||
TextureManager textureManager = mc.getTextureManager();
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
ImageData data = ClientCacheHandler.getImageData(effect.icon);
|
||||
if (data.imageLoaded()) {
|
||||
data.bindTexture();
|
||||
int iconX = effect.iconX;
|
||||
int iconY = effect.iconY;
|
||||
int iconWidth = effect.getWidth();
|
||||
int iconHeight = effect.getHeight();
|
||||
int width = data.getTotalWidth();
|
||||
int height = data.getTotalWidth();
|
||||
|
||||
|
||||
func_152125_a(x, y, iconX, iconY, iconWidth, iconHeight, iconRenderSize, iconRenderSize, width, height);
|
||||
|
||||
} else {
|
||||
textureManager.bindTexture(new ResourceLocation("customnpcs", "textures/marks/question.png"));
|
||||
func_152125_a(x, y, 0, 0, 1, 1, iconRenderSize, iconRenderSize, 1, 1);
|
||||
}
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
|
||||
// TODO: FIX TEXTURE
|
||||
// textureManager.bindTexture(new ResourceLocation(CustomNpcPlusDBC.ID + ":textures/gui/icons.png"));
|
||||
func_152125_a(x, y, 0, 240, 16, 16, iconRenderSize, iconRenderSize, 256, 256);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
}
|
||||
};
|
||||
addScrollableGui(0, scrollWindow);
|
||||
|
||||
y = (scrollWindow.clipHeight - 96) / 2 + 5;
|
||||
x = 116;
|
||||
scrollWindow.addLabel(new GuiNpcLabel(5, "display.texture", x, y, 0xFFFFFF));
|
||||
y += 12;
|
||||
scrollWindow.addTextField(new GuiNpcTextField(5, this, x, y, scrollWindow.clipWidth-x-10, 20, effect.icon));
|
||||
scrollWindow.getTextField(5).setMaxStringLength(100);
|
||||
|
||||
y += 25;
|
||||
|
||||
scrollWindow.addLabel(new GuiNpcLabel(6, "effect.editor.xPos", x, y + 6, 0xFFFFFF));
|
||||
scrollWindow.addTextField(setIntegerOnly(
|
||||
new GuiNpcTextField(6, this, x + 43, y, 60, 20, ""+effect.iconX),
|
||||
0,
|
||||
10240,
|
||||
effect.iconX
|
||||
));
|
||||
scrollWindow.addTextField(setIntegerOnly(
|
||||
new GuiNpcTextField(7, this, scrollWindow.clipWidth - 60 - 10, y, 60, 20, ""+effect.iconY),
|
||||
0,
|
||||
10240,
|
||||
effect.iconY
|
||||
));
|
||||
scrollWindow.addLabel(new GuiNpcLabel(7, "effect.editor.yPos", scrollWindow.getTextField(7).xPosition - 43, y + 6, 0xFFFFFF));
|
||||
y += 23;
|
||||
|
||||
scrollWindow.addLabel(new GuiNpcLabel(8, "effect.editor.width", x, y + 6, 0xFFFFFF));
|
||||
scrollWindow.addTextField(setIntegerOnly(
|
||||
new GuiNpcTextField(8, this, x + 43, y, 60, 20, ""+effect.width),
|
||||
0,
|
||||
10240,
|
||||
effect.width
|
||||
));
|
||||
scrollWindow.addTextField(setIntegerOnly(
|
||||
new GuiNpcTextField(9, this, scrollWindow.clipWidth - 60 - 10, y, 60, 20, ""+effect.height),
|
||||
0,
|
||||
10240,
|
||||
effect.height
|
||||
));
|
||||
scrollWindow.addLabel(new GuiNpcLabel(9, "effect.editor.height", scrollWindow.getTextField(9).xPosition - 43, y + 6, 0xFFFFFF));
|
||||
|
||||
}
|
||||
|
||||
private GuiNpcTextField setIntegerOnly(GuiNpcTextField field, int min, int max, int def) {
|
||||
field.integersOnly = true;
|
||||
field.setMinMaxDefault(min, max, def);
|
||||
field.setMaxStringLength(6);
|
||||
return field;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
int id = guibutton.id;
|
||||
|
||||
if (id == -5) {
|
||||
close();
|
||||
return;
|
||||
}
|
||||
if (id == -2) {
|
||||
PacketClient.sendClient(new EffectSavePacket(effect.writeToNBT(false), originalName));
|
||||
GuiScriptEffect scriptGUI = new GuiScriptEffect(parent, effect);
|
||||
scriptGUI.setWorldAndResolution(mc, width, height);
|
||||
scriptGUI.initGui();
|
||||
mc.currentScreen = scriptGUI;
|
||||
}
|
||||
if (id == 10) {
|
||||
GuiNpcButtonYesNo button = (GuiNpcButtonYesNo) guibutton;
|
||||
effect.lossOnDeath = button.getBoolean();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unFocused(GuiNpcTextField guiNpcTextField) {
|
||||
int id = guiNpcTextField.id;
|
||||
|
||||
switch (id) {
|
||||
case 1:
|
||||
effect.setName(guiNpcTextField.getText());
|
||||
break;
|
||||
case 2:
|
||||
effect.setMenuName(guiNpcTextField.getText());
|
||||
break;
|
||||
case 3:
|
||||
effect.setEveryXTick(guiNpcTextField.getInteger());
|
||||
guiNpcTextField.setText(effect.everyXTick+"");
|
||||
break;
|
||||
case 4:
|
||||
int length = guiNpcTextField.getInteger();
|
||||
if (length < 0)
|
||||
length = -100;
|
||||
guiNpcTextField.setText(length+"");
|
||||
effect.length = length;
|
||||
break;
|
||||
case 5:
|
||||
effect.icon = guiNpcTextField.getText();
|
||||
break;
|
||||
case 6:
|
||||
effect.iconX = guiNpcTextField.getInteger();
|
||||
break;
|
||||
case 7:
|
||||
effect.iconY = guiNpcTextField.getInteger();
|
||||
break;
|
||||
case 8:
|
||||
effect.width = guiNpcTextField.getInteger();
|
||||
break;
|
||||
case 9:
|
||||
effect.height = guiNpcTextField.getInteger();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
super.close();
|
||||
PacketClient.sendClient(new EffectSavePacket(effect.writeToNBT(false), originalName));
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,15 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.MailOpenSetupPacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.gui.player.GuiMailmanWrite;
|
||||
import noppes.npcs.client.gui.select.GuiQuestSelection;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.containers.ContainerMail;
|
||||
import noppes.npcs.controllers.data.PlayerMail;
|
||||
|
||||
@@ -63,7 +65,7 @@ public class SubGuiMailmanSendSetup extends SubGuiInterface implements ITextfiel
|
||||
GuiMailmanWrite.parent = getParent();
|
||||
GuiMailmanWrite.mail = mail;
|
||||
|
||||
Client.sendData(EnumPacketServer.MailOpenSetup, mail.writeNBT());
|
||||
PacketClient.sendClient(new MailOpenSetupPacket(mail.writeNBT()));
|
||||
}
|
||||
if(id == 3){
|
||||
setSubGui(new GuiQuestSelection(mail.questId));
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import kamkeel.npcs.network.packets.request.faction.FactionGetPacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumAvailabilityFactionType;
|
||||
import noppes.npcs.constants.EnumDayTime;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.controllers.data.Availability;
|
||||
import noppes.npcs.controllers.data.Faction;
|
||||
|
||||
public class SubGuiNpcAvailability extends SubGuiInterface implements ITextfieldListener, GuiSelectionListener, IGuiData
|
||||
public class SubGuiNpcAvailability extends SubGuiInterface implements ITextfieldListener, GuiSelectionListener, IGuiData
|
||||
{
|
||||
private Availability availabitily;
|
||||
private int slot = 0;
|
||||
|
||||
|
||||
public SubGuiNpcAvailability(Availability availabitily)
|
||||
{
|
||||
this.availabitily = availabitily;
|
||||
@@ -34,14 +35,14 @@ public class SubGuiNpcAvailability extends SubGuiInterface implements ITextfield
|
||||
this.addButton(new GuiNpcButton(0, guiLeft + 34, guiTop + 12, 180, 20, "availability.selectdialog"));
|
||||
this.addButton(new GuiNpcButton(1, guiLeft + 34, guiTop + 35, 180, 20, "availability.selectquest"));
|
||||
|
||||
|
||||
|
||||
this.addButton(new GuiNpcButton(20, guiLeft + 4, guiTop + 104, 50, 20, new String[]{"availability.always","availability.is","availability.isnot"},availabitily.factionAvailable.ordinal()));
|
||||
this.addButton(new GuiNpcButton(22, guiLeft + 56, guiTop + 104, 60, 20, new String[]{"faction.friendly","faction.neutral","faction.unfriendly"},availabitily.factionStance.ordinal()));
|
||||
this.addButton(new GuiNpcButton(21, guiLeft + 118, guiTop + 104, 110, 20, "availability.selectfaction"));
|
||||
getButton(21).setEnabled(availabitily.factionAvailable != EnumAvailabilityFactionType.Always);
|
||||
getButton(22).setEnabled(availabitily.factionAvailable != EnumAvailabilityFactionType.Always);
|
||||
this.addButton(new GuiNpcButton(23, guiLeft + 230, guiTop + 104,20, 20, "X"));
|
||||
|
||||
|
||||
this.addButton(new GuiNpcButton(24, guiLeft + 4, guiTop + 126, 50, 20, new String[]{"availability.always","availability.is","availability.isnot"},availabitily.faction2Available.ordinal()));
|
||||
this.addButton(new GuiNpcButton(27, guiLeft + 56, guiTop + 126, 60, 20, new String[]{"faction.friendly","faction.neutral","faction.unfriendly"},availabitily.faction2Stance.ordinal()));
|
||||
this.addButton(new GuiNpcButton(25, guiLeft + 118, guiTop + 126, 110, 20, "availability.selectfaction"));
|
||||
@@ -56,19 +57,19 @@ public class SubGuiNpcAvailability extends SubGuiInterface implements ITextfield
|
||||
this.addTextField(new GuiNpcTextField(51, this, fontRendererObj, guiLeft + 50, guiTop + 170,90, 20, availabitily.minPlayerLevel + ""));
|
||||
this.getTextField(51).integersOnly = true;
|
||||
this.getTextField(51).setMinMaxDefault(0, Integer.MAX_VALUE, 0);
|
||||
|
||||
|
||||
this.addButton(new GuiNpcButton(66, guiLeft + 82, guiTop + 192,98, 20, "gui.done"));
|
||||
|
||||
|
||||
updateGuiButtons();
|
||||
}
|
||||
|
||||
|
||||
private void updateGuiButtons() {
|
||||
if(availabitily.factionId >= 0){
|
||||
Client.sendData(EnumPacketServer.FactionGet, availabitily.factionId);
|
||||
FactionGetPacket.getFaction(availabitily.factionId);
|
||||
}
|
||||
if(availabitily.faction2Id >= 0){
|
||||
Client.sendData(EnumPacketServer.FactionGet, availabitily.faction2Id);
|
||||
FactionGetPacket.getFaction(availabitily.faction2Id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import kamkeel.npcs.network.packets.request.dialog.DialogGetPacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.gui.select.GuiDialogSelection;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumAvailabilityDialog;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.controllers.data.Availability;
|
||||
import noppes.npcs.controllers.data.Dialog;
|
||||
|
||||
@@ -66,16 +67,16 @@ public class SubGuiNpcAvailabilityDialog extends SubGuiInterface implements GuiS
|
||||
getButton(13).setDisplayText("availability.selectdialog");
|
||||
|
||||
if(availabitily.dialogId >= 0){
|
||||
Client.sendData(EnumPacketServer.DialogGet, availabitily.dialogId);
|
||||
DialogGetPacket.getDialog(availabitily.dialogId);
|
||||
}
|
||||
if(availabitily.dialog2Id >= 0){
|
||||
Client.sendData(EnumPacketServer.DialogGet, availabitily.dialog2Id);
|
||||
DialogGetPacket.getDialog(availabitily.dialog2Id);
|
||||
}
|
||||
if(availabitily.dialog3Id >= 0){
|
||||
Client.sendData(EnumPacketServer.DialogGet, availabitily.dialog3Id);
|
||||
DialogGetPacket.getDialog(availabitily.dialog3Id);
|
||||
}
|
||||
if(availabitily.dialog4Id >= 0){
|
||||
Client.sendData(EnumPacketServer.DialogGet, availabitily.dialog4Id);
|
||||
DialogGetPacket.getDialog(availabitily.dialog4Id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import kamkeel.npcs.network.packets.request.quest.QuestGetPacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.gui.select.GuiQuestSelection;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumAvailabilityQuest;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.controllers.data.Availability;
|
||||
import noppes.npcs.controllers.data.Quest;
|
||||
|
||||
@@ -66,16 +67,16 @@ public class SubGuiNpcAvailabilityQuest extends SubGuiInterface implements GuiSe
|
||||
getButton(13).setDisplayText("availability.selectquest");
|
||||
|
||||
if(availabitily.questId >= 0){
|
||||
Client.sendData(EnumPacketServer.QuestGet, availabitily.questId);
|
||||
QuestGetPacket.getQuest(availabitily.questId);
|
||||
}
|
||||
if(availabitily.quest2Id >= 0){
|
||||
Client.sendData(EnumPacketServer.QuestGet, availabitily.quest2Id);
|
||||
QuestGetPacket.getQuest(availabitily.quest2Id);
|
||||
}
|
||||
if(availabitily.quest3Id >= 0){
|
||||
Client.sendData(EnumPacketServer.QuestGet, availabitily.quest3Id);
|
||||
QuestGetPacket.getQuest(availabitily.quest3Id);
|
||||
}
|
||||
if(availabitily.quest4Id >= 0){
|
||||
Client.sendData(EnumPacketServer.QuestGet, availabitily.quest4Id);
|
||||
QuestGetPacket.getQuest(availabitily.quest4Id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.dialog.DialogSavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.EntityUtil;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.global.GuiNPCManageDialogs;
|
||||
@@ -10,7 +12,7 @@ import noppes.npcs.client.gui.player.GuiDialogInteract;
|
||||
import noppes.npcs.client.gui.select.GuiQuestSelection;
|
||||
import noppes.npcs.client.gui.select.GuiSoundSelection;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.controllers.data.Dialog;
|
||||
import noppes.npcs.controllers.data.PlayerMail;
|
||||
import noppes.npcs.entity.EntityDialogNpc;
|
||||
@@ -196,10 +198,10 @@ public class SubGuiNpcDialog extends SubGuiInterface implements ISubGuiListener,
|
||||
dialog.quest = ob;
|
||||
parent.dialogQuestName = name;
|
||||
initGui();
|
||||
Client.sendData(EnumPacketServer.DialogSave, this.dialogCategoryID, dialog.writeToNBT(new NBTTagCompound()));
|
||||
PacketClient.sendClient(new DialogSavePacket(this.dialogCategoryID, dialog.writeToNBT(new NBTTagCompound()), false));
|
||||
}
|
||||
|
||||
public void save(){
|
||||
Client.sendData(EnumPacketServer.DialogSave, this.dialogCategoryID, dialog.writeToNBT(new NBTTagCompound()));
|
||||
PacketClient.sendClient(new DialogSavePacket(this.dialogCategoryID, dialog.writeToNBT(new NBTTagCompound()), false));
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,13 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import kamkeel.npcs.network.packets.request.dialog.DialogGetPacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.gui.select.GuiDialogSelection;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumOptionType;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.controllers.data.Dialog;
|
||||
import noppes.npcs.controllers.data.DialogOption;
|
||||
|
||||
@@ -44,7 +45,7 @@ public class SubGuiNpcDialogOption extends SubGuiInterface implements IGuiData,
|
||||
if(option.optionType == EnumOptionType.DialogOption){
|
||||
this.addButton(new GuiNpcButton(3, guiLeft + 4, guiTop + 84, "availability.selectdialog"));
|
||||
if(option.dialogId >= 0)
|
||||
Client.sendData(EnumPacketServer.DialogGet, option.dialogId);
|
||||
DialogGetPacket.getDialog(option.dialogId);
|
||||
}
|
||||
if(option.optionType == EnumOptionType.CommandBlock){
|
||||
this.addTextField(new GuiNpcTextField(4, this, this.fontRendererObj, guiLeft + 4, guiTop + 84, 248, 20, option.command));
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.dialog.DialogSavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.config.ConfigMain;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.controllers.data.Dialog;
|
||||
import noppes.npcs.controllers.data.DialogImage;
|
||||
|
||||
@@ -419,7 +421,7 @@ public class SubGuiNpcDialogVisual extends SubGuiInterface implements ISubGuiLis
|
||||
public void save() {
|
||||
GuiNpcTextField.unfocus();
|
||||
if(dialog.id >= 0)
|
||||
Client.sendData(EnumPacketServer.DialogSave, ((SubGuiNpcDialog)parent).dialogCategoryID, dialog.writeToNBT(new NBTTagCompound()));
|
||||
PacketClient.sendClient(new DialogSavePacket(((SubGuiNpcDialog)parent).dialogCategoryID, dialog.writeToNBT(new NBTTagCompound()), false));
|
||||
}
|
||||
|
||||
private DialogImage getSelectedImage() {
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.DimensionsGetPacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.controllers.data.SpawnData;
|
||||
|
||||
import java.util.*;
|
||||
@@ -14,14 +16,14 @@ public class SubGuiNpcDimensions extends SubGuiInterface implements IScrollData
|
||||
private GuiCustomScroll allDimensions;
|
||||
private HashMap<String, Integer> dimensionMap = new HashMap<>();
|
||||
private GuiCustomScroll dataDimensions;
|
||||
|
||||
|
||||
public SubGuiNpcDimensions(SpawnData data){
|
||||
this.data = data;
|
||||
setBackground("menubg.png");
|
||||
xSize = 346;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
Client.sendData(EnumPacketServer.DimensionsGet);
|
||||
PacketClient.sendClient(new DimensionsGetPacket());
|
||||
}
|
||||
|
||||
public void initGui(){
|
||||
@@ -34,7 +36,7 @@ public class SubGuiNpcDimensions extends SubGuiInterface implements IScrollData
|
||||
allDimensions.guiTop = guiTop + 14;
|
||||
this.addScroll(allDimensions);
|
||||
addLabel(new GuiNpcLabel(1, "spawning.availableDimensions", guiLeft + 4, guiTop + 4));
|
||||
|
||||
|
||||
if(dataDimensions == null){
|
||||
dataDimensions = new GuiCustomScroll(this,1);
|
||||
dataDimensions.setSize(140, 180);
|
||||
@@ -58,8 +60,8 @@ public class SubGuiNpcDimensions extends SubGuiInterface implements IScrollData
|
||||
|
||||
addButton(new GuiNpcButton(3, guiLeft + 145, guiTop + 90, 55, 20, ">>"));
|
||||
addButton(new GuiNpcButton(4, guiLeft + 145, guiTop + 112, 55, 20, "<<"));
|
||||
|
||||
|
||||
|
||||
|
||||
addButton(new GuiNpcButton(66, guiLeft + 260, guiTop + 194, 60, 20, "gui.done"));
|
||||
}
|
||||
|
||||
@@ -70,14 +72,14 @@ public class SubGuiNpcDimensions extends SubGuiInterface implements IScrollData
|
||||
data.dimensions.add(dimensionMap.get(allDimensions.getSelected()));
|
||||
allDimensions.selected = -1;
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(button.id == 2){
|
||||
if(dataDimensions.hasSelected()){
|
||||
data.dimensions.remove(dimensionMap.get(dataDimensions.getSelected()));
|
||||
dataDimensions.selected = -1;
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(button.id == 3){
|
||||
data.dimensions.clear();
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.faction.FactionsGetPacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.controllers.data.FactionOptions;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -15,9 +17,9 @@ public class SubGuiNpcFactionOptions extends SubGuiInterface implements IScrollD
|
||||
private FactionOptions options;
|
||||
private HashMap<String,Integer> data = new HashMap<String,Integer>();
|
||||
private GuiCustomScroll scrollFactions;
|
||||
|
||||
|
||||
private int selected = -1;
|
||||
|
||||
|
||||
public SubGuiNpcFactionOptions(FactionOptions options)
|
||||
{
|
||||
this.options = options;
|
||||
@@ -25,7 +27,7 @@ public class SubGuiNpcFactionOptions extends SubGuiInterface implements IScrollD
|
||||
xSize = 256;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
Client.sendData(EnumPacketServer.FactionsGet);
|
||||
PacketClient.sendClient(new FactionsGetPacket());
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
@@ -42,7 +44,7 @@ public class SubGuiNpcFactionOptions extends SubGuiInterface implements IScrollD
|
||||
addLabel(new GuiNpcLabel(0, "1: ", guiLeft + 4, guiTop + 12));
|
||||
if(data.containsValue(options.factionId)){
|
||||
addLabel(new GuiNpcLabel(1, getFactionName(options.factionId), guiLeft + 12, guiTop + 8));
|
||||
|
||||
|
||||
String label = "";
|
||||
if(options.decreaseFactionPoints)
|
||||
label += StatCollector.translateToLocal("gui.decrease");
|
||||
@@ -69,14 +71,14 @@ public class SubGuiNpcFactionOptions extends SubGuiInterface implements IScrollD
|
||||
addButton(new GuiNpcButton(1, guiLeft + 110, guiTop + 35, 20, 20, "X"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(selected >= 0 && (!data.containsValue(options.faction2Id) || !data.containsValue(options.factionId)) && !options.hasFaction(selected)){
|
||||
addButton(new GuiNpcButton(2, guiLeft + 4, guiTop + 60, 90, 20, new String[]{"gui.increase","gui.decrease"},0));
|
||||
|
||||
|
||||
addTextField(new GuiNpcTextField(1, this, fontRendererObj, guiLeft + 4, guiTop + 82, 110, 20, "10"));
|
||||
getTextField(1).integersOnly = true;
|
||||
getTextField(1).setMinMaxDefault(1, 100000, 10);
|
||||
|
||||
|
||||
addButton(new GuiNpcButton(3, guiLeft + 4, guiTop + 104, 60, 20, "gui.add"));
|
||||
}
|
||||
|
||||
@@ -88,7 +90,7 @@ public class SubGuiNpcFactionOptions extends SubGuiInterface implements IScrollD
|
||||
return s;
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
protected void actionPerformed(GuiButton guibutton)
|
||||
{
|
||||
int id = guibutton.id;
|
||||
@@ -135,16 +137,16 @@ public class SubGuiNpcFactionOptions extends SubGuiInterface implements IScrollD
|
||||
String name = scroll.getSelected();
|
||||
this.data = data;
|
||||
scroll.setList(list);
|
||||
|
||||
|
||||
if(name != null)
|
||||
scroll.setSelected(name);
|
||||
|
||||
|
||||
initGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(String selected) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,8 +1,11 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.quest.QuestOpenGuiPacket;
|
||||
import kamkeel.npcs.network.packets.request.quest.QuestSavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.gui.global.GuiNPCManageQuest;
|
||||
import noppes.npcs.client.gui.questtypes.GuiNpcQuestTypeDialog;
|
||||
import noppes.npcs.client.gui.questtypes.GuiNpcQuestTypeKill;
|
||||
@@ -101,7 +104,7 @@ public class SubGuiNpcQuest extends SubGuiInterface implements ISubGuiListener,
|
||||
setSubGui(new SubGuiNpcTextArea(quest.logText));
|
||||
}
|
||||
if(button.id == 5 && quest.id >= 0){
|
||||
Client.sendData(EnumPacketServer.QuestOpenGui, EnumGuiType.QuestReward, quest.writeToNBT(new NBTTagCompound()));
|
||||
PacketClient.sendClient(new QuestOpenGuiPacket(EnumGuiType.QuestReward, quest.writeToNBT(new NBTTagCompound())));
|
||||
}
|
||||
if(button.id == 6 && quest.id >= 0){
|
||||
quest.setType(EnumQuestType.values()[button.getValue()]);
|
||||
@@ -109,7 +112,7 @@ public class SubGuiNpcQuest extends SubGuiInterface implements ISubGuiListener,
|
||||
if(button.id == 7)
|
||||
{
|
||||
if(quest.type == EnumQuestType.Item)
|
||||
Client.sendData(EnumPacketServer.QuestOpenGui, EnumGuiType.QuestItem, quest.writeToNBT(new NBTTagCompound()));
|
||||
PacketClient.sendClient(new QuestOpenGuiPacket(EnumGuiType.QuestItem, quest.writeToNBT(new NBTTagCompound())));
|
||||
|
||||
if(quest.type == EnumQuestType.Dialog)
|
||||
setSubGui(new GuiNpcQuestTypeDialog(npc, quest, this));
|
||||
@@ -218,10 +221,10 @@ public class SubGuiNpcQuest extends SubGuiInterface implements ISubGuiListener,
|
||||
quest.nextQuestTitle = name;
|
||||
parent.nextQuestName = name;
|
||||
initGui();
|
||||
Client.sendData(EnumPacketServer.QuestSave, this.questCategoryID, quest.writeToNBT(new NBTTagCompound()));
|
||||
PacketClient.sendClient(new QuestSavePacket(this.questCategoryID, quest.writeToNBT(new NBTTagCompound()), false));
|
||||
}
|
||||
|
||||
public void save(){
|
||||
Client.sendData(EnumPacketServer.QuestSave, this.questCategoryID, quest.writeToNBT(new NBTTagCompound()));
|
||||
PacketClient.sendClient(new QuestSavePacket(this.questCategoryID, quest.writeToNBT(new NBTTagCompound()), false));
|
||||
}
|
||||
}
|
||||
@@ -60,7 +60,7 @@ public class SubGuiNpcResistanceProperties extends SubGuiInterface implements IS
|
||||
|
||||
@Override
|
||||
public void mousePressed(GuiNpcSlider slider) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package noppes.npcs.client.gui.advanced;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.linked.LinkedGetAllPacket;
|
||||
import kamkeel.npcs.network.packets.request.linked.LinkedSetPacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -15,21 +18,21 @@ import java.util.Vector;
|
||||
public class GuiNPCAdvancedLinkedNpc extends GuiNPCInterface2 implements IScrollData, ICustomScrollListener{
|
||||
private GuiCustomScroll scroll;
|
||||
private List<String> data = new ArrayList<String>();
|
||||
|
||||
|
||||
public static GuiScreen Instance;
|
||||
|
||||
|
||||
public GuiNPCAdvancedLinkedNpc(EntityNPCInterface npc){
|
||||
super(npc);
|
||||
Instance = this;
|
||||
Client.sendData(EnumPacketServer.LinkedGetAll);
|
||||
PacketClient.sendClient(new LinkedGetAllPacket());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui(){
|
||||
super.initGui();
|
||||
|
||||
|
||||
this.addButton(new GuiNpcButton(1,guiLeft + 358, guiTop + 38, 58, 20, "gui.clear"));
|
||||
|
||||
|
||||
if(scroll == null){
|
||||
scroll = new GuiCustomScroll(this,0);
|
||||
scroll.setSize(143, 208);
|
||||
@@ -44,9 +47,9 @@ public class GuiNPCAdvancedLinkedNpc extends GuiNPCInterface2 implements IScroll
|
||||
@Override
|
||||
public void buttonEvent(GuiButton button){
|
||||
if(button.id == 1){
|
||||
Client.sendData(EnumPacketServer.LinkedSet, "");
|
||||
PacketClient.sendClient(new LinkedSetPacket(""));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -62,13 +65,13 @@ public class GuiNPCAdvancedLinkedNpc extends GuiNPCInterface2 implements IScroll
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void customScrollClicked(int i, int j, int k,
|
||||
GuiCustomScroll guiCustomScroll) {
|
||||
Client.sendData(EnumPacketServer.LinkedSet, guiCustomScroll.getSelected());
|
||||
PacketClient.sendClient(new LinkedSetPacket(guiCustomScroll.getSelected()));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,12 +1,16 @@
|
||||
package noppes.npcs.client.gui.advanced;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.dialog.DialogNpcGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.dialog.DialogNpcRemovePacket;
|
||||
import kamkeel.npcs.network.packets.request.dialog.DialogNpcSetPacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.gui.select.GuiDialogSelection;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.controllers.data.DialogOption;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
@@ -21,7 +25,7 @@ public class GuiNPCDialogNpcOptions extends GuiNPCInterface2 implements GuiSelec
|
||||
super(npc);
|
||||
this.parent = parent;
|
||||
this.drawDefaultBackground = true;
|
||||
Client.sendData(EnumPacketServer.DialogNpcGet);
|
||||
PacketClient.sendClient(new DialogNpcGetPacket());
|
||||
}
|
||||
|
||||
public void initGui() {
|
||||
@@ -55,7 +59,7 @@ public class GuiNPCDialogNpcOptions extends GuiNPCInterface2 implements GuiSelec
|
||||
if (id >= 20 && id < 40) {
|
||||
int slot = id - 20;
|
||||
data.remove(slot);
|
||||
Client.sendData(EnumPacketServer.DialogNpcRemove,slot);
|
||||
PacketClient.sendClient(new DialogNpcRemovePacket(slot));
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
@@ -66,7 +70,7 @@ public class GuiNPCDialogNpcOptions extends GuiNPCInterface2 implements GuiSelec
|
||||
|
||||
@Override
|
||||
public void selected(int id, String name) {
|
||||
Client.sendData(EnumPacketServer.DialogNpcSet, selectedSlot, id);
|
||||
PacketClient.sendClient(new DialogNpcSetPacket(selectedSlot, id));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
package noppes.npcs.client.gui.advanced;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.faction.FactionSetPacket;
|
||||
import kamkeel.npcs.network.packets.request.faction.FactionsGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.mainmenu.MainmenuAdvancedSavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.gui.SubGuiNpcFactionOptions;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -15,11 +19,11 @@ public class GuiNPCFactionSetup extends GuiNPCInterface2 implements IScrollData,
|
||||
{
|
||||
private GuiCustomScroll scrollFactions;
|
||||
private HashMap<String,Integer> data = new HashMap<String,Integer>();
|
||||
|
||||
|
||||
public GuiNPCFactionSetup(EntityNPCInterface npc)
|
||||
{
|
||||
super(npc);
|
||||
Client.sendData(EnumPacketServer.FactionsGet);
|
||||
PacketClient.sendClient(new FactionsGetPacket());
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
@@ -34,7 +38,7 @@ public class GuiNPCFactionSetup extends GuiNPCInterface2 implements IScrollData,
|
||||
|
||||
this.addLabel(new GuiNpcLabel(12, "faction.ondeath", guiLeft + 4, guiTop + 69));
|
||||
addButton(new GuiNpcButton(12, guiLeft + 90, guiTop + 64, 80, 20, "faction.points"));
|
||||
|
||||
|
||||
if(scrollFactions == null){
|
||||
scrollFactions = new GuiCustomScroll(this,0,0);
|
||||
scrollFactions.setSize(180, 200);
|
||||
@@ -59,41 +63,41 @@ public class GuiNPCFactionSetup extends GuiNPCInterface2 implements IScrollData,
|
||||
if(button.id == 12)
|
||||
setSubGui(new SubGuiNpcFactionOptions(npc.advanced.factions));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setData(Vector<String> list, HashMap<String, Integer> data)
|
||||
public void setData(Vector<String> list, HashMap<String, Integer> data)
|
||||
{
|
||||
String name = npc.getFaction().name;
|
||||
this.data = data;
|
||||
scrollFactions.setList(list);
|
||||
|
||||
|
||||
if(name != null)
|
||||
setSelected(name);
|
||||
}
|
||||
|
||||
|
||||
public void mouseClicked(int i, int j, int k)
|
||||
{
|
||||
super.mouseClicked(i, j, k);
|
||||
if(k == 0 && scrollFactions != null)
|
||||
scrollFactions.mouseClicked(i, j, k);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setSelected(String selected) {
|
||||
scrollFactions.setSelected(selected);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void customScrollClicked(int i, int j, int k, GuiCustomScroll guiCustomScroll) {
|
||||
if(guiCustomScroll.id == 0)
|
||||
{
|
||||
Client.sendData(EnumPacketServer.FactionSet, data.get(scrollFactions.getSelected()));
|
||||
PacketClient.sendClient(new FactionSetPacket(data.get(scrollFactions.getSelected())));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void save() {
|
||||
Client.sendData(EnumPacketServer.MainmenuAdvancedSave, npc.advanced.writeToNBT(new NBTTagCompound()));
|
||||
}
|
||||
PacketClient.sendClient(new MainmenuAdvancedSavePacket(npc.advanced.writeToNBT(new NBTTagCompound())));
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,21 @@
|
||||
package noppes.npcs.client.gui.advanced;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.mainmenu.MainmenuAdvancedSavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.GuiNPCLinesEdit;
|
||||
import noppes.npcs.client.gui.util.GuiNPCInterface2;
|
||||
import noppes.npcs.client.gui.util.GuiNpcButton;
|
||||
import noppes.npcs.client.gui.util.GuiNpcButtonYesNo;
|
||||
import noppes.npcs.client.gui.util.GuiNpcLabel;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
public class GuiNPCLinesMenu extends GuiNPCInterface2 {
|
||||
|
||||
|
||||
public GuiNPCLinesMenu(EntityNPCInterface npc) {
|
||||
super(npc);
|
||||
}
|
||||
@@ -54,10 +56,10 @@ public class GuiNPCLinesMenu extends GuiNPCInterface2 {
|
||||
npc.advanced.orderedLines = !((GuiNpcButtonYesNo)guibutton).getBoolean();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
Client.sendData(EnumPacketServer.MainmenuAdvancedSave, npc.advanced.writeToNBT(new NBTTagCompound()));
|
||||
PacketClient.sendClient(new MainmenuAdvancedSavePacket(npc.advanced.writeToNBT(new NBTTagCompound())));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package noppes.npcs.client.gui.advanced;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.mainmenu.MainmenuAdvancedGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.mainmenu.MainmenuAdvancedMarkDataPacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.gui.SubGuiColorSelector;
|
||||
import noppes.npcs.client.gui.SubGuiNpcAvailability;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.constants.MarkType;
|
||||
import noppes.npcs.controllers.data.MarkData;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
@@ -78,7 +81,7 @@ public class GuiNPCMarks extends GuiNPCInterface2 implements ISubGuiListener {
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
Client.sendData(EnumPacketServer.MainmenuAdvancedMarkData, data.getNBT());
|
||||
PacketClient.sendClient(new MainmenuAdvancedMarkDataPacket(data.getNBT()));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,25 +1,29 @@
|
||||
package noppes.npcs.client.gui.advanced;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.transform.TransformGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.transform.TransformLoadPacket;
|
||||
import kamkeel.npcs.network.packets.request.transform.TransformSavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.gui.util.GuiNPCInterface2;
|
||||
import noppes.npcs.client.gui.util.GuiNpcButton;
|
||||
import noppes.npcs.client.gui.util.GuiNpcLabel;
|
||||
import noppes.npcs.client.gui.util.IGuiData;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.controllers.data.DataTransform;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
public class GuiNPCNightSetup extends GuiNPCInterface2 implements IGuiData
|
||||
{
|
||||
private DataTransform data;
|
||||
|
||||
|
||||
public GuiNPCNightSetup(EntityNPCInterface npc)
|
||||
{
|
||||
super(npc);
|
||||
data = npc.transform;
|
||||
Client.sendData(EnumPacketServer.TransformGet);
|
||||
PacketClient.sendClient(new TransformGetPacket());
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
@@ -40,16 +44,16 @@ public class GuiNPCNightSetup extends GuiNPCInterface2 implements IGuiData
|
||||
|
||||
this.addLabel(new GuiNpcLabel(4, "menu.advanced", guiLeft + 4, guiTop + 113));
|
||||
this.addButton(new GuiNpcButton(4, guiLeft + 104, guiTop + 108, 50, 20, new String[]{"gui.no","gui.yes"}, data.hasAdvanced?1:0));
|
||||
|
||||
|
||||
this.addLabel(new GuiNpcLabel(5, "role.name", guiLeft + 4, guiTop + 135));
|
||||
this.addButton(new GuiNpcButton(5, guiLeft + 104, guiTop + 130, 50, 20, new String[]{"gui.no","gui.yes"}, data.hasRole?1:0));
|
||||
|
||||
|
||||
this.addLabel(new GuiNpcLabel(6, "job.name", guiLeft + 4, guiTop + 157));
|
||||
this.addButton(new GuiNpcButton(6, guiLeft + 104, guiTop + 152, 50, 20, new String[]{"gui.no","gui.yes"}, data.hasJob?1:0));
|
||||
|
||||
|
||||
this.addLabel(new GuiNpcLabel(10, "advanced.editingmode", guiLeft + 170, guiTop + 9));
|
||||
this.addButton(new GuiNpcButton(10, guiLeft + 244, guiTop + 4, 50, 20, new String[]{"gui.no","gui.yes"}, data.editingModus?1:0));
|
||||
|
||||
|
||||
if(data.editingModus){
|
||||
this.addButton(new GuiNpcButton(11, guiLeft + 170, guiTop + 34, "advanced.loadday"));
|
||||
this.addButton(new GuiNpcButton(12, guiLeft + 170, guiTop + 56, "advanced.loadnight"));
|
||||
@@ -80,16 +84,16 @@ public class GuiNPCNightSetup extends GuiNPCInterface2 implements IGuiData
|
||||
initGui();
|
||||
}
|
||||
if(button.id == 11){
|
||||
Client.sendData(EnumPacketServer.TransformLoad, false);
|
||||
PacketClient.sendClient(new TransformLoadPacket(false));
|
||||
}
|
||||
if(button.id == 12){
|
||||
Client.sendData(EnumPacketServer.TransformLoad, true);
|
||||
PacketClient.sendClient(new TransformLoadPacket(true));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void save() {
|
||||
Client.sendData(EnumPacketServer.TransformSave, data.writeOptions(new NBTTagCompound()));
|
||||
PacketClient.sendClient(new TransformSavePacket(data.writeOptions(new NBTTagCompound())));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package noppes.npcs.client.gui.advanced;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.mainmenu.MainmenuAdvancedSavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.gui.select.GuiSoundSelection;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
public class GuiNPCSoundsMenu extends GuiNPCInterface2 implements ITextfieldListener, ISubGuiListener
|
||||
@@ -77,7 +79,7 @@ public class GuiNPCSoundsMenu extends GuiNPCInterface2 implements ITextfieldLis
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
Client.sendData(EnumPacketServer.MainmenuAdvancedSave, npc.advanced.writeToNBT(new NBTTagCompound()));
|
||||
PacketClient.sendClient(new MainmenuAdvancedSavePacket(npc.advanced.writeToNBT(new NBTTagCompound())));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,13 +1,15 @@
|
||||
package noppes.npcs.client.gui.advanced;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.tags.TagsGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.tags.TagsNpcGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.tags.TagSetPacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.nbt.NBTTagString;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.client.Client;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -26,8 +28,8 @@ public class GuiNPCTagSetup extends GuiNPCInterface2 implements IScrollData,ICus
|
||||
public GuiNPCTagSetup(EntityNPCInterface npc)
|
||||
{
|
||||
super(npc);
|
||||
Client.sendData(EnumPacketServer.TagsGet);
|
||||
Client.sendData(EnumPacketServer.NpcTagsGet);
|
||||
PacketClient.sendClient(new TagsGetPacket());
|
||||
PacketClient.sendClient(new TagsNpcGetPacket());
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
@@ -120,7 +122,7 @@ public class GuiNPCTagSetup extends GuiNPCInterface2 implements IScrollData,ICus
|
||||
tagList.appendTag(new NBTTagString(string));
|
||||
}
|
||||
tagCompound.setTag("TagNames",tagList);
|
||||
Client.sendData(EnumPacketServer.TagSet, tagCompound);
|
||||
PacketClient.sendClient(new TagSetPacket(tagCompound));
|
||||
}
|
||||
|
||||
public void keyTyped(char c, int i)
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
package noppes.npcs.client.gui.custom;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.customgui.CustomGuiButtonPacket;
|
||||
import kamkeel.npcs.network.packets.request.customgui.CustomGuiClosePacket;
|
||||
import kamkeel.npcs.network.packets.request.customgui.CustomGuiUnfocusedPacket;
|
||||
import kamkeel.npcs.network.packets.request.customgui.CustomScrollClickPacket;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
@@ -20,7 +25,7 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.api.gui.ICustomGuiComponent;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.gui.custom.components.*;
|
||||
import noppes.npcs.client.gui.custom.interfaces.IClickListener;
|
||||
import noppes.npcs.client.gui.custom.interfaces.IDataHolder;
|
||||
@@ -28,7 +33,7 @@ import noppes.npcs.client.gui.custom.interfaces.IGuiComponent;
|
||||
import noppes.npcs.client.gui.util.GuiCustomScroll;
|
||||
import noppes.npcs.client.gui.util.ICustomScrollListener;
|
||||
import noppes.npcs.client.gui.util.IGuiData;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.containers.ContainerCustomGui;
|
||||
import noppes.npcs.scripted.gui.*;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
@@ -449,25 +454,25 @@ public class GuiCustom extends GuiScreen implements ICustomScrollListener, IGuiD
|
||||
|
||||
protected void actionPerformed(GuiButton button) {
|
||||
super.actionPerformed(button);
|
||||
Client.sendData(EnumPacketServer.CustomGuiButton, new Object[]{this.updateGui().toNBT(), button.id});
|
||||
PacketClient.sendClient(new CustomGuiButtonPacket(button.id, this.updateGui().toNBT()));
|
||||
}
|
||||
|
||||
public void buttonClick(CustomGuiButton button) {
|
||||
Client.sendData(EnumPacketServer.CustomGuiButton, new Object[]{this.updateGui().toNBT(), button.id});
|
||||
PacketClient.sendClient(new CustomGuiButtonPacket(button.id, this.updateGui().toNBT()));
|
||||
}
|
||||
|
||||
public String prevScrollClicked = null;
|
||||
public void customScrollClicked(int i, int j, int k, GuiCustomScroll scroll) {
|
||||
Client.sendData(EnumPacketServer.CustomGuiScrollClick, new Object[]{this.updateGui().toNBT(), scroll.id, scroll.selected, this.getScrollSelection((CustomGuiScrollComponent)scroll), false});
|
||||
PacketClient.sendClient(new CustomScrollClickPacket(this.updateGui().toNBT(), scroll.id, scroll.selected, this.getScrollSelection((CustomGuiScrollComponent)scroll), false));
|
||||
if(Integer.toString(scroll.selected).equals(prevScrollClicked)){
|
||||
Client.sendData(EnumPacketServer.CustomGuiScrollClick, new Object[]{this.updateGui().toNBT(), scroll.id, scroll.selected, this.getScrollSelection((CustomGuiScrollComponent)scroll), true});
|
||||
PacketClient.sendClient(new CustomScrollClickPacket(this.updateGui().toNBT(), scroll.id, scroll.selected, this.getScrollSelection((CustomGuiScrollComponent)scroll), true));
|
||||
}
|
||||
prevScrollClicked = Integer.toString(scroll.selected);
|
||||
}
|
||||
|
||||
public void onGuiClosed() {
|
||||
if (this.gui != null) {
|
||||
Client.sendData(EnumPacketServer.CustomGuiClose, new Object[]{this.updateGui().toNBT()});
|
||||
PacketClient.sendClient(new CustomGuiClosePacket(this.updateGui().toNBT()));
|
||||
}
|
||||
|
||||
if (this.mc.thePlayer != null)
|
||||
@@ -477,10 +482,10 @@ public class GuiCustom extends GuiScreen implements ICustomScrollListener, IGuiD
|
||||
}
|
||||
|
||||
public void onTextFieldUnfocused(CustomGuiTextField textField){
|
||||
Client.sendData(EnumPacketServer.CustomGuiUnfocused, new Object[]{this.updateGui().toNBT(), textField.getID()});
|
||||
PacketClient.sendClient(new CustomGuiUnfocusedPacket(textField.getID(), this.updateGui().toNBT()));
|
||||
}
|
||||
|
||||
ScriptGui updateGui() {
|
||||
public ScriptGui updateGui() {
|
||||
Iterator var1 = this.dataHolders.iterator();
|
||||
|
||||
while(var1.hasNext()) {
|
||||
@@ -491,7 +496,7 @@ public class GuiCustom extends GuiScreen implements ICustomScrollListener, IGuiD
|
||||
return this.gui;
|
||||
}
|
||||
|
||||
NBTTagCompound getScrollSelection(CustomGuiScrollComponent scroll) {
|
||||
public NBTTagCompound getScrollSelection(CustomGuiScrollComponent scroll) {
|
||||
NBTTagList list = new NBTTagList();
|
||||
if (scroll.multiSelect) {
|
||||
Iterator var3 = scroll.getSelectedList().iterator();
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
package noppes.npcs.client.gui.global;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.animation.AnimationSavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.gui.SubGuiAnimationFrame;
|
||||
import noppes.npcs.client.gui.SubGuiAnimationOptions;
|
||||
import noppes.npcs.client.gui.SubGuiColorSelector;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumAnimationPart;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.controllers.data.Animation;
|
||||
import noppes.npcs.controllers.data.AnimationData;
|
||||
import noppes.npcs.controllers.data.Frame;
|
||||
@@ -591,7 +593,7 @@ public class GuiNPCEditAnimation extends GuiModelInterface implements ITextfield
|
||||
public void close() {
|
||||
if (!this.hasSubGui()) {
|
||||
if (animation != null) {
|
||||
Client.sendData(EnumPacketServer.AnimationSave, animation.writeToNBT());
|
||||
PacketClient.sendClient(new AnimationSavePacket(animation.writeToNBT()));
|
||||
}
|
||||
displayGuiScreen(parent);
|
||||
} else {
|
||||
|
||||
@@ -1,14 +1,19 @@
|
||||
package noppes.npcs.client.gui.global;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.animation.AnimationGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.animation.AnimationRemovePacket;
|
||||
import kamkeel.npcs.network.packets.request.animation.AnimationSavePacket;
|
||||
import kamkeel.npcs.network.packets.request.animation.AnimationsGetPacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiYesNo;
|
||||
import net.minecraft.client.gui.GuiYesNoCallback;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.controllers.data.*;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
@@ -33,7 +38,7 @@ public class GuiNPCManageAnimations extends GuiModelInterface2 implements IScrol
|
||||
this.setSave(save);
|
||||
this.xOffset = -148 + 70;
|
||||
this.yOffset = -170 + 137;
|
||||
Client.sendData(EnumPacketServer.AnimationsGet);
|
||||
PacketClient.sendClient(new AnimationsGetPacket());
|
||||
|
||||
AnimationData data = npc.display.animationData;
|
||||
data.setEnabled(true);
|
||||
@@ -155,12 +160,12 @@ public class GuiNPCManageAnimations extends GuiModelInterface2 implements IScrol
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
|
||||
if(button.id == 0){
|
||||
save();
|
||||
String name = "New";
|
||||
while(data.containsKey(name))
|
||||
name += "_";
|
||||
Animation animation = new Animation(-1, name);
|
||||
Client.sendData(EnumPacketServer.AnimationSave, animation.writeToNBT());
|
||||
save();
|
||||
String name = "New";
|
||||
while(data.containsKey(name))
|
||||
name += "_";
|
||||
Animation animation = new Animation(-1, name);
|
||||
PacketClient.sendClient(new AnimationSavePacket(animation.writeToNBT()));
|
||||
}
|
||||
if(button.id == 1){
|
||||
if(data.containsKey(scrollAnimations.getSelected())) {
|
||||
@@ -225,20 +230,20 @@ public class GuiNPCManageAnimations extends GuiModelInterface2 implements IScrol
|
||||
scrollAnimations.setSelected(selected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void customScrollClicked(int i, int j, int k, GuiCustomScroll guiCustomScroll) {
|
||||
if(guiCustomScroll.id == 0)
|
||||
{
|
||||
selected = scrollAnimations.getSelected();
|
||||
Client.sendData(EnumPacketServer.AnimationGet, data.get(selected));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void customScrollClicked(int i, int j, int k, GuiCustomScroll guiCustomScroll) {
|
||||
if(guiCustomScroll.id == 0)
|
||||
{
|
||||
selected = scrollAnimations.getSelected();
|
||||
PacketClient.sendClient(new AnimationGetPacket(data.get(selected)));
|
||||
}
|
||||
}
|
||||
|
||||
public void save() {
|
||||
if(selected != null && data.containsKey(selected) && animation != null){
|
||||
Client.sendData(EnumPacketServer.AnimationSave, animation.writeToNBT());
|
||||
}
|
||||
}
|
||||
public void save() {
|
||||
if(selected != null && data.containsKey(selected) && animation != null){
|
||||
PacketClient.sendClient(new AnimationSavePacket(animation.writeToNBT()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unFocused(GuiNpcTextField guiNpcTextField) {
|
||||
@@ -268,7 +273,7 @@ public class GuiNPCManageAnimations extends GuiModelInterface2 implements IScrol
|
||||
return;
|
||||
if(id == 1) {
|
||||
if(data.containsKey(scrollAnimations.getSelected())) {
|
||||
Client.sendData(EnumPacketServer.AnimationRemove, data.get(selected));
|
||||
PacketClient.sendClient(new AnimationRemovePacket(data.get(selected)));
|
||||
scrollAnimations.clear();
|
||||
animation = new Animation();
|
||||
initGui();
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
package noppes.npcs.client.gui.global;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.bank.BankGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.bank.BankRemovePacket;
|
||||
import kamkeel.npcs.network.packets.request.bank.BankSavePacket;
|
||||
import kamkeel.npcs.network.packets.request.bank.BanksGetPacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.CustomNpcResourceListener;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.containers.ContainerManageBanks;
|
||||
import noppes.npcs.controllers.data.Bank;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
@@ -23,13 +28,13 @@ public class GuiNPCManageBanks extends GuiContainerNPCInterface2 implements IScr
|
||||
private Bank bank = new Bank();
|
||||
private String selected = null;
|
||||
private String search = "";
|
||||
|
||||
|
||||
public GuiNPCManageBanks(EntityNPCInterface npc,ContainerManageBanks container)
|
||||
{
|
||||
super(npc,container);
|
||||
this.container = container;
|
||||
drawDefaultBackground = false;
|
||||
Client.sendData(EnumPacketServer.BanksGet);
|
||||
PacketClient.sendClient(new BanksGetPacket());
|
||||
setBackground("npcbanksetup.png");
|
||||
ySize = 200;
|
||||
}
|
||||
@@ -37,7 +42,7 @@ public class GuiNPCManageBanks extends GuiContainerNPCInterface2 implements IScr
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
|
||||
this.addButton(new GuiNpcButton(6,guiLeft + 340, guiTop + 10, 45, 20, "gui.add"));
|
||||
this.addButton(new GuiNpcButton(7,guiLeft + 340, guiTop + 32, 45, 20, "gui.remove"));
|
||||
if(scroll == null)
|
||||
@@ -46,21 +51,21 @@ public class GuiNPCManageBanks extends GuiContainerNPCInterface2 implements IScr
|
||||
scroll.guiLeft = guiLeft + 174;
|
||||
scroll.guiTop = guiTop + 8;
|
||||
addScroll(scroll);
|
||||
|
||||
|
||||
for(int i = 0; i < 6; i++){
|
||||
int x = guiLeft + 6;
|
||||
int y = (guiTop + 36) + (i * 22);
|
||||
addButton(new GuiNpcButton(i, x + 50, y,80, 20, new String[]{"Can Upgrade","Can't Upgrade","Upgraded"},0));
|
||||
getButton(i).setEnabled(false);
|
||||
}
|
||||
|
||||
|
||||
addTextField(new GuiNpcTextField(0,this, this.fontRendererObj, guiLeft+8, guiTop + 8, 160, 16, ""));
|
||||
getTextField(0).setMaxStringLength(20);
|
||||
|
||||
|
||||
addTextField(new GuiNpcTextField(1,this, this.fontRendererObj, guiLeft+10, guiTop + 80, 16, 16, ""));
|
||||
getTextField(1).integersOnly = true;
|
||||
getTextField(1).setMaxStringLength(1);
|
||||
|
||||
|
||||
addTextField(new GuiNpcTextField(2,this, this.fontRendererObj, guiLeft+10, guiTop + 110, 16, 16, ""));
|
||||
getTextField(2).integersOnly = true;
|
||||
getTextField(2).setMaxStringLength(1);
|
||||
@@ -85,15 +90,15 @@ public class GuiNPCManageBanks extends GuiContainerNPCInterface2 implements IScr
|
||||
name += "_";
|
||||
Bank bank = new Bank();
|
||||
bank.name = name;
|
||||
|
||||
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
bank.writeEntityToNBT(compound);
|
||||
Client.sendData(EnumPacketServer.BankSave, compound);
|
||||
PacketClient.sendClient(new BankSavePacket(compound));
|
||||
}
|
||||
else if(button.id == 7)
|
||||
{
|
||||
if(data.containsKey(scroll.getSelected()))
|
||||
Client.sendData(EnumPacketServer.BankRemove, data.get(selected));
|
||||
PacketClient.sendClient(new BankRemovePacket(data.get(selected)));
|
||||
}
|
||||
else if(button.id >= 0 && button.id < 6)
|
||||
{
|
||||
@@ -103,7 +108,7 @@ public class GuiNPCManageBanks extends GuiContainerNPCInterface2 implements IScr
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2)
|
||||
{
|
||||
{
|
||||
fontRendererObj.drawString("Tab Cost", 23, 28, CustomNpcResourceListener.DefaultTextColor);
|
||||
fontRendererObj.drawString("Upg. Cost", 123, 28, CustomNpcResourceListener.DefaultTextColor);
|
||||
fontRendererObj.drawString("Start", 6, 70, CustomNpcResourceListener.DefaultTextColor);
|
||||
@@ -115,28 +120,28 @@ public class GuiNPCManageBanks extends GuiContainerNPCInterface2 implements IScr
|
||||
Bank bank = new Bank();
|
||||
bank.readEntityFromNBT(compound);
|
||||
this.bank = bank;
|
||||
|
||||
|
||||
if (bank.id == -1) {
|
||||
getTextField(0).setText("");
|
||||
getTextField(1).setText("");
|
||||
getTextField(2).setText("");
|
||||
|
||||
getTextField(2).setText("");
|
||||
|
||||
for(int i = 0; i < 6; i++)
|
||||
{
|
||||
getButton(i).setDisplay(0);
|
||||
getButton(i).setDisplay(0);
|
||||
getButton(i).setEnabled(false);
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
getTextField(0).setText(bank.name);
|
||||
getTextField(1).setText(Integer.toString(bank.startSlots));
|
||||
getTextField(2).setText(Integer.toString(bank.maxSlots));
|
||||
|
||||
getTextField(2).setText(Integer.toString(bank.maxSlots));
|
||||
|
||||
for(int i = 0; i < 6; i++)
|
||||
{
|
||||
int type = 0;
|
||||
if(bank.slotTypes.containsKey(i))
|
||||
type = bank.slotTypes.get(i);
|
||||
getButton(i).setDisplay(type);
|
||||
getButton(i).setDisplay(type);
|
||||
getButton(i).setEnabled(true);
|
||||
}
|
||||
}
|
||||
@@ -173,27 +178,27 @@ public class GuiNPCManageBanks extends GuiContainerNPCInterface2 implements IScr
|
||||
String name = scroll.getSelected();
|
||||
this.data = data;
|
||||
scroll.setList(getSearchList());
|
||||
|
||||
|
||||
if(name != null)
|
||||
scroll.setSelected(name);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setSelected(String selected) {
|
||||
this.selected = selected;
|
||||
scroll.setSelected(selected);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void customScrollClicked(int i, int j, int k, GuiCustomScroll guiCustomScroll) {
|
||||
if(guiCustomScroll.id == 0)
|
||||
{
|
||||
save();
|
||||
selected = scroll.getSelected();
|
||||
Client.sendData(EnumPacketServer.BankGet, data.get(selected));
|
||||
PacketClient.sendClient(new BankGetPacket(data.get(selected)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
if(selected != null && data.containsKey(selected) && bank != null){
|
||||
@@ -201,7 +206,7 @@ public class GuiNPCManageBanks extends GuiContainerNPCInterface2 implements IScr
|
||||
bank.currencyInventory = container.bank.currencyInventory;
|
||||
bank.upgradeInventory = container.bank.upgradeInventory;
|
||||
bank.writeEntityToNBT(compound);
|
||||
Client.sendData(EnumPacketServer.BankSave, compound);
|
||||
PacketClient.sendClient(new BankSavePacket(compound));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,27 +225,27 @@ public class GuiNPCManageBanks extends GuiContainerNPCInterface2 implements IScr
|
||||
}
|
||||
} else if(guiNpcTextField.id == 1 || guiNpcTextField.id == 2) {
|
||||
int num = 1;
|
||||
|
||||
|
||||
if(!guiNpcTextField.isEmpty())
|
||||
num = guiNpcTextField.getInteger();
|
||||
|
||||
|
||||
if(num > 6)
|
||||
num = 6;
|
||||
|
||||
|
||||
if(num < 0)
|
||||
num = 0;
|
||||
|
||||
|
||||
if(guiNpcTextField.id == 1) {
|
||||
bank.startSlots = num;
|
||||
} else if(guiNpcTextField.id == 2) {
|
||||
bank.maxSlots = num;
|
||||
}
|
||||
|
||||
|
||||
if(bank.startSlots > bank.maxSlots)
|
||||
bank.maxSlots = bank.startSlots;
|
||||
|
||||
|
||||
guiNpcTextField.setText(Integer.toString(num));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
package noppes.npcs.client.gui.global;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.dialog.*;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiYesNo;
|
||||
import net.minecraft.client.gui.GuiYesNoCallback;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.SubGuiEditText;
|
||||
import noppes.npcs.client.gui.SubGuiNpcDialog;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.controllers.data.Dialog;
|
||||
import noppes.npcs.controllers.data.DialogCategory;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
@@ -38,42 +40,61 @@ public class GuiNPCManageDialogs extends GuiNPCInterface2 implements IScrollGrou
|
||||
private String catSearch = "";
|
||||
private String diagSearch = "";
|
||||
|
||||
private boolean isResizing = false;
|
||||
private int initialDragX = 0;
|
||||
private int dividerOffset = 143;
|
||||
|
||||
private final int dividerWidth = 5;
|
||||
private final int minScrollWidth = 50;
|
||||
|
||||
private int dividerLineHeight = 20;
|
||||
private int dividerLineYOffset = 0;
|
||||
|
||||
public GuiNPCManageDialogs(EntityNPCInterface npc)
|
||||
{
|
||||
super(npc);
|
||||
Client.sendData(EnumPacketServer.DialogCategoriesGet);
|
||||
PacketClient.sendClient(new DialogCategoriesGetPacket());
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
if(catScroll == null){
|
||||
catScroll = new GuiCustomScroll(this,0, 0);
|
||||
catScroll.setSize(143, 185);
|
||||
}
|
||||
catScroll.guiLeft = guiLeft + 64;
|
||||
catScroll.guiTop = guiTop + 4;
|
||||
this.addScroll(catScroll);
|
||||
// Define overall horizontal region.
|
||||
int regionLeft = guiLeft + 64;
|
||||
int regionRight = guiLeft + 355;
|
||||
|
||||
if(dialogScroll == null){
|
||||
dialogScroll = new GuiCustomScroll(this,1, 0);
|
||||
dialogScroll.setSize(143, 185);
|
||||
}
|
||||
dialogScroll.guiLeft = guiLeft + 212;
|
||||
dialogScroll.guiTop = guiTop + 4;
|
||||
this.addScroll(dialogScroll);
|
||||
// Recalculate dividerX using the stored offset:
|
||||
int dividerX = regionLeft + dividerOffset;
|
||||
|
||||
addTextField(new GuiNpcTextField(55, this, fontRendererObj, guiLeft + 64, guiTop + 4 + 3 + 185, 143, 20, catSearch));
|
||||
// Left scroll (catScroll)
|
||||
if (catScroll == null) {
|
||||
catScroll = new GuiCustomScroll(this, 0, 0);
|
||||
}
|
||||
catScroll.guiLeft = regionLeft;
|
||||
catScroll.guiTop = guiTop + 4;
|
||||
catScroll.setSize(dividerX - regionLeft, 185);
|
||||
this.addScroll(catScroll);
|
||||
|
||||
this.addButton(new GuiNpcButton(44,guiLeft + 3, guiTop + 8, 58, 20, "gui.categories"));
|
||||
// Right scroll (dialogScroll)
|
||||
if (dialogScroll == null) {
|
||||
dialogScroll = new GuiCustomScroll(this, 1, 0);
|
||||
}
|
||||
dialogScroll.guiLeft = dividerX + dividerWidth;
|
||||
dialogScroll.guiTop = guiTop + 4;
|
||||
dialogScroll.setSize(regionRight - (dividerX + dividerWidth), 185);
|
||||
this.addScroll(dialogScroll);
|
||||
|
||||
// Adjust text fields:
|
||||
addTextField(new GuiNpcTextField(55, this, fontRendererObj, regionLeft, guiTop + 4 + 3 + 185, dividerX - regionLeft, 20, catSearch));
|
||||
addTextField(new GuiNpcTextField(66, this, fontRendererObj, dividerX + dividerWidth, guiTop + 4 + 3 + 185, regionRight - (dividerX + dividerWidth), 20, diagSearch));
|
||||
|
||||
this.addButton(new GuiNpcButton(44,guiLeft + 3, guiTop + 8, 58, 20, "gui.categories"));
|
||||
getButton(44).setEnabled(false);
|
||||
this.addButton(new GuiNpcButton(4,guiLeft + 3, guiTop + 38, 58, 20, "gui.add"));
|
||||
this.addButton(new GuiNpcButton(5,guiLeft + 3, guiTop + 61, 58, 20, "gui.remove"));
|
||||
this.addButton(new GuiNpcButton(6,guiLeft + 3, guiTop + 94, 58, 20, "gui.edit"));
|
||||
|
||||
addTextField(new GuiNpcTextField(66, this, fontRendererObj, guiLeft + 212, guiTop + 4 + 3 + 185, 143, 20, diagSearch));
|
||||
|
||||
this.addButton(new GuiNpcButton(33,guiLeft + 358, guiTop + 8, 58, 20, "dialog.dialogs"));
|
||||
getButton(33).setEnabled(false);
|
||||
this.addButton(new GuiNpcButton(0,guiLeft + 358, guiTop + 94, 58, 20, "gui.edit"));
|
||||
@@ -91,6 +112,86 @@ public class GuiNPCManageDialogs extends GuiNPCInterface2 implements IScrollGrou
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
if(!hasSubGui()){
|
||||
int regionLeft = guiLeft + 64;
|
||||
int dividerX = regionLeft + dividerOffset; // dividerOffset remains your left-scroll width
|
||||
int regionTop = guiTop + 4;
|
||||
int regionHeight = 185;
|
||||
// Calculate the vertical position for the handle (centered by default)
|
||||
int handleTop = regionTop + (regionHeight - dividerLineHeight) / 2 + dividerLineYOffset;
|
||||
drawRect(dividerX + 1, handleTop, dividerX + dividerWidth - 1, handleTop + dividerLineHeight, 0xFF707070);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int mouseX, int mouseY, int mouseButton) {
|
||||
if(!hasSubGui()){
|
||||
int regionLeft = guiLeft + 64;
|
||||
int dividerX = regionLeft + dividerOffset;
|
||||
int regionTop = guiTop + 4;
|
||||
int regionHeight = 185;
|
||||
int handleTop = regionTop + (regionHeight - dividerLineHeight) / 2 + dividerLineYOffset;
|
||||
int handleBottom = handleTop + dividerLineHeight;
|
||||
if (mouseX >= dividerX && mouseX <= dividerX + dividerWidth &&
|
||||
mouseY >= handleTop && mouseY <= handleBottom) {
|
||||
isResizing = true;
|
||||
resizingActive = true;
|
||||
initialDragX = mouseX;
|
||||
return;
|
||||
}
|
||||
}
|
||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) {
|
||||
if (isResizing) {
|
||||
int dx = mouseX - initialDragX;
|
||||
initialDragX = mouseX;
|
||||
dividerOffset += dx;
|
||||
int regionLeft = guiLeft + 64;
|
||||
int regionRight = guiLeft + 355;
|
||||
// Clamp dividerOffset so each scroll remains at least minScrollWidth:
|
||||
int minOffset = minScrollWidth;
|
||||
int maxOffset = (regionRight - regionLeft) - dividerWidth - minScrollWidth;
|
||||
if (dividerOffset < minOffset) {
|
||||
dividerOffset = minOffset;
|
||||
}
|
||||
if (dividerOffset > maxOffset) {
|
||||
dividerOffset = maxOffset;
|
||||
}
|
||||
int dividerX = regionLeft + dividerOffset;
|
||||
// Update left scroll:
|
||||
catScroll.setSize(dividerX - regionLeft, 185);
|
||||
// Update right scroll:
|
||||
dialogScroll.guiLeft = dividerX + dividerWidth;
|
||||
dialogScroll.setSize(regionRight - (dividerX + dividerWidth), 185);
|
||||
// Update text fields:
|
||||
if (getTextField(55) != null) {
|
||||
getTextField(55).width = dividerX - regionLeft;
|
||||
}
|
||||
if (getTextField(66) != null) {
|
||||
getTextField(66).width = regionRight - (dividerX + dividerWidth);
|
||||
getTextField(66).xPosition = dividerX + dividerWidth;
|
||||
}
|
||||
return;
|
||||
}
|
||||
super.mouseClickMove(mouseX, mouseY, clickedMouseButton, timeSinceLastClick);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseMovedOrUp(int mouseX, int mouseY, int state) {
|
||||
if (isResizing) {
|
||||
isResizing = false;
|
||||
resizingActive = false;
|
||||
return;
|
||||
}
|
||||
super.mouseMovedOrUp(mouseX, mouseY, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyTyped(char c, int i)
|
||||
{
|
||||
@@ -181,7 +282,7 @@ public class GuiNPCManageDialogs extends GuiNPCInterface2 implements IScrollGrou
|
||||
}
|
||||
DialogCategory category = new DialogCategory();
|
||||
category.title = name;
|
||||
Client.sendData(EnumPacketServer.DialogCategorySave, category.writeNBT(new NBTTagCompound()));
|
||||
PacketClient.sendClient(new DialogCategorySavePacket(category.writeNBT(new NBTTagCompound())));
|
||||
}
|
||||
// Remove Cat
|
||||
if(id == 5){
|
||||
@@ -202,7 +303,7 @@ public class GuiNPCManageDialogs extends GuiNPCInterface2 implements IScrollGrou
|
||||
}
|
||||
Dialog dialog = new Dialog();
|
||||
dialog.title = name;
|
||||
Client.sendData(EnumPacketServer.DialogSave, category.id, dialog.writeToNBT(new NBTTagCompound()), true);
|
||||
PacketClient.sendClient(new DialogSavePacket(category.id, dialog.writeToNBT(new NBTTagCompound()), true));
|
||||
}
|
||||
// Remove Dialog
|
||||
if(id == 2) {
|
||||
@@ -231,7 +332,7 @@ public class GuiNPCManageDialogs extends GuiNPCInterface2 implements IScrollGrou
|
||||
Dialog dialog = new Dialog();
|
||||
dialog.readNBTPartial(this.dialog.writeToNBT(new NBTTagCompound()));
|
||||
dialog.title = name;
|
||||
Client.sendData(EnumPacketServer.DialogSave, category.id, dialog.writeToNBT(new NBTTagCompound()), true);
|
||||
PacketClient.sendClient(new DialogSavePacket(category.id, dialog.writeToNBT(new NBTTagCompound()), true));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -276,7 +377,7 @@ public class GuiNPCManageDialogs extends GuiNPCInterface2 implements IScrollGrou
|
||||
else {
|
||||
category.readNBT(compound);
|
||||
setPrevCatName(category.title);
|
||||
Client.sendData(EnumPacketServer.DialogsGet, category.id, true);
|
||||
PacketClient.sendClient(new DialogsGetPacket(category.id, true));
|
||||
resetDiagList();
|
||||
}
|
||||
initGui();
|
||||
@@ -341,7 +442,7 @@ public class GuiNPCManageDialogs extends GuiNPCInterface2 implements IScrollGrou
|
||||
dialog = null;
|
||||
getTextField(66).setText("");
|
||||
|
||||
Client.sendData(EnumPacketServer.DialogCategoryGet, catData.get(selected));
|
||||
PacketClient.sendClient(new DialogCategoryGetPacket(catData.get(selected)));
|
||||
setPrevCatName(selected);
|
||||
}
|
||||
}
|
||||
@@ -352,7 +453,7 @@ public class GuiNPCManageDialogs extends GuiNPCInterface2 implements IScrollGrou
|
||||
String selected = dialogScroll.getSelected();
|
||||
if(!selected.equals(prevDialogName) || override){
|
||||
dialog = new Dialog();
|
||||
Client.sendData(EnumPacketServer.DialogGet, dialogData.get(selected));
|
||||
DialogGetPacket.getDialog(dialogData.get(selected));
|
||||
setPrevDialogName(selected);
|
||||
}
|
||||
}
|
||||
@@ -371,13 +472,13 @@ public class GuiNPCManageDialogs extends GuiNPCInterface2 implements IScrollGrou
|
||||
if(saveDiag){
|
||||
if(dialogScroll.selected != -1 && dialog.id >= 0){
|
||||
if(catScroll.selected != -1 && category.id >= 0){
|
||||
Client.sendData(EnumPacketServer.DialogSave, category.id, dialog.writeToNBT(new NBTTagCompound()), true);
|
||||
PacketClient.sendClient(new DialogSavePacket(category.id, dialog.writeToNBT(new NBTTagCompound()), true));
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(catScroll.selected != -1 && category.id >= 0)
|
||||
Client.sendData(EnumPacketServer.DialogCategorySave, category.writeNBT(new NBTTagCompound()));
|
||||
PacketClient.sendClient(new DialogCategorySavePacket(category.writeNBT(new NBTTagCompound())));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -426,13 +527,13 @@ public class GuiNPCManageDialogs extends GuiNPCInterface2 implements IScrollGrou
|
||||
return;
|
||||
if(id == 5) {
|
||||
if(catData.containsKey(catScroll.getSelected())) {
|
||||
Client.sendData(EnumPacketServer.DialogCategoryRemove, category.id);
|
||||
PacketClient.sendClient(new DialogCategoryRemovePacket(category.id));
|
||||
clearCategory();
|
||||
}
|
||||
}
|
||||
if(id == 2) {
|
||||
if (dialogData.containsKey(dialogScroll.getSelected())) {
|
||||
Client.sendData(EnumPacketServer.DialogRemove, dialog.id, true);
|
||||
PacketClient.sendClient(new DialogRemovePacket(dialog.id, true));
|
||||
dialog = new Dialog();
|
||||
dialogData.clear();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,302 @@
|
||||
package noppes.npcs.client.gui.global;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.effects.EffectGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.effects.EffectRemovePacket;
|
||||
import kamkeel.npcs.network.packets.request.effects.EffectSavePacket;
|
||||
import kamkeel.npcs.network.packets.request.effects.EffectsGetPacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiYesNo;
|
||||
import net.minecraft.client.gui.GuiYesNoCallback;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.client.ClientCacheHandler;
|
||||
import noppes.npcs.client.CustomNpcResourceListener;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.SubGuiEffectGeneral;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.client.renderer.ImageData;
|
||||
import noppes.npcs.controllers.CustomEffectController;
|
||||
import noppes.npcs.controllers.data.CustomEffect;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
public class GuiNPCManageEffects extends GuiNPCInterface2 implements ICustomScrollListener, IScrollData, IGuiData, ISubGuiListener, GuiYesNoCallback {
|
||||
public GuiCustomScroll scrollEffects;
|
||||
public HashMap<String, Integer> data = new HashMap<>();
|
||||
public CustomEffect effect = new CustomEffect();
|
||||
public String selected = null;
|
||||
public String search = "";
|
||||
public String originalName = "";
|
||||
boolean setNormalSound = true;
|
||||
|
||||
public GuiNPCManageEffects(EntityNPCInterface npc) {
|
||||
super(npc);
|
||||
|
||||
PacketClient.sendClient(new EffectsGetPacket(-1));
|
||||
}
|
||||
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
addButton(new GuiNpcButton(0, guiLeft + 368, guiTop + 8, 45, 20, "gui.add"));
|
||||
|
||||
addButton(new GuiNpcButton(1, guiLeft + 368, guiTop + 32, 45, 20, "gui.remove"));
|
||||
getButton(1).enabled = effect != null && effect.id != -1;
|
||||
|
||||
addButton(new GuiNpcButton(2, guiLeft + 368, guiTop + 56, 45, 20, "gui.clone"));
|
||||
getButton(2).enabled = effect != null && effect.id != -1;
|
||||
|
||||
addButton(new GuiNpcButton(3, guiLeft + 368, guiTop + 80, 45, 20, "gui.edit"));
|
||||
getButton(3).enabled = effect != null && effect.id != -1;
|
||||
|
||||
if (scrollEffects == null) {
|
||||
scrollEffects = new GuiCustomScroll(this, 0, 0);
|
||||
scrollEffects.setSize(143, 185);
|
||||
}
|
||||
scrollEffects.guiLeft = guiLeft + 220;
|
||||
scrollEffects.guiTop = guiTop + 4;
|
||||
addScroll(scrollEffects);
|
||||
scrollEffects.setList(getSearchList());
|
||||
|
||||
addTextField(new GuiNpcTextField(55, this, fontRendererObj, guiLeft + 220, guiTop + 4 + 3 + 185, 143, 20, search));
|
||||
if (effect != null && effect.id != -1) {
|
||||
addLabel(new GuiNpcLabel(10, "ID", guiLeft + 368, guiTop + 4 + 3 + 185));
|
||||
addLabel(new GuiNpcLabel(11, effect.id + "", guiLeft + 368, guiTop + 4 + 3 + 195));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
if (button.id == 0) {
|
||||
save();
|
||||
String name = "New";
|
||||
while (data.containsKey(name))
|
||||
name += "_";
|
||||
CustomEffect effect = new CustomEffect(-1, name);
|
||||
PacketClient.sendClient(new EffectSavePacket(effect.writeToNBT(false), ""));
|
||||
} else if (button.id == 1) {
|
||||
if (data.containsKey(scrollEffects.getSelected())) {
|
||||
GuiYesNo guiyesno = new GuiYesNo(this, scrollEffects.getSelected(), StatCollector.translateToLocal("gui.delete"), 1);
|
||||
displayGuiScreen(guiyesno);
|
||||
}
|
||||
} else if (button.id == 2) {
|
||||
CustomEffect effect = this.effect.cloneEffect();
|
||||
while (data.containsKey(effect.name))
|
||||
effect.name += "_";
|
||||
PacketClient.sendClient(new EffectSavePacket(effect.writeToNBT(false), ""));
|
||||
}
|
||||
|
||||
if (effect == null)
|
||||
return;
|
||||
|
||||
if (button.id == 3) {
|
||||
if (data.containsKey(scrollEffects.getSelected()) && effect != null && effect.id >= 0) {
|
||||
setSubGui(new SubGuiEffectGeneral(this, effect));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
this.effect = new CustomEffect();
|
||||
effect.readFromNBT(compound);
|
||||
setSelected(effect.name);
|
||||
if (effect.id != -1) {
|
||||
CustomEffectController.getInstance().customEffects.replace(effect.id, effect);
|
||||
}
|
||||
initGui();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void drawScreen(int i, int j, float f) {
|
||||
super.drawScreen(i, j, f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBackground() {
|
||||
super.drawBackground();
|
||||
renderScreen();
|
||||
}
|
||||
|
||||
private void renderScreen() {
|
||||
drawGradientRect(guiLeft + 5, guiTop + 4, guiLeft + 218, guiTop + 24, 0xC0101010, 0xC0101010);
|
||||
drawHorizontalLine(guiLeft + 5, guiLeft + 218, guiTop + 25, 0xFF000000 + CustomNpcResourceListener.DefaultTextColor);
|
||||
drawGradientRect(guiLeft + 5, guiTop + 27, guiLeft + 218, guiTop + ySize + 9, 0xA0101010, 0xA0101010);
|
||||
|
||||
|
||||
if (effect == null)
|
||||
return;
|
||||
if (effect.id == -1)
|
||||
return;
|
||||
|
||||
String drawString = effect.getMenuName();
|
||||
int textWidth = getStringWidthWithoutColor(drawString);
|
||||
int centerX = guiLeft + 5 + ((218 - 10 - textWidth) / 2); // Adjusted centerX calculation
|
||||
fontRendererObj.drawString(drawString, centerX, guiTop + 10, CustomNpcResourceListener.DefaultTextColor, true);
|
||||
int y = guiTop + 33;
|
||||
int x = guiLeft + 12;
|
||||
|
||||
int iconRenderSize = 48;
|
||||
|
||||
TextureManager textureManager = mc.getTextureManager();
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
ImageData data = ClientCacheHandler.getImageData(effect.icon);
|
||||
if (data.imageLoaded()) {
|
||||
data.bindTexture();
|
||||
int iconX = effect.iconX;
|
||||
int iconY = effect.iconY;
|
||||
int iconWidth = effect.getWidth();
|
||||
int iconHeight = effect.getHeight();
|
||||
int width = data.getTotalWidth();
|
||||
int height = data.getTotalWidth();
|
||||
|
||||
|
||||
func_152125_a(x, y, iconX, iconY, iconWidth, iconHeight, iconRenderSize, iconRenderSize, width, height);
|
||||
|
||||
} else {
|
||||
textureManager.bindTexture(new ResourceLocation("customnpcs", "textures/marks/question.png"));
|
||||
func_152125_a(x, y, 0, 0, 1, 1, iconRenderSize, iconRenderSize, 1, 1);
|
||||
}
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
|
||||
// TODO: Fix ICONS
|
||||
// textureManager.bindTexture(new ResourceLocation(CustomNpcPlusDBC.ID + ":textures/gui/icons.png"));
|
||||
func_152125_a(x, y, 0, 240, 16, 16, iconRenderSize, iconRenderSize, 256, 256);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
|
||||
x += iconRenderSize + 3;
|
||||
y += 2;
|
||||
|
||||
String translated = StatCollector.translateToLocal("gui.name") + ": " + effect.name;
|
||||
fontRendererObj.drawString(translated, x, y, 0xFFFFFF, false);
|
||||
int transLength = getStringWidthWithoutColor(translated);
|
||||
fontRendererObj.drawString(" (ID: "+ effect.id+ ")", x + transLength, y, 0xB5B5B5, false);
|
||||
y += 12;
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("general.menuName") + ": " + effect.menuName, x, y, 0xFFFFFF, false);
|
||||
y += 12;
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("effect.runsEveryX") + ": " + effect.everyXTick + "t", x, y, 0xB5B5B5, false);
|
||||
y += 12;
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("effect.defaultLength") + ": " + effect.length + "s", x, y, 0xB5B5B5, false);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void keyTyped(char c, int i) {
|
||||
super.keyTyped(c, i);
|
||||
|
||||
if (getTextField(55) != null) {
|
||||
if (getTextField(55).isFocused()) {
|
||||
if (search.equals(getTextField(55).getText()))
|
||||
return;
|
||||
search = getTextField(55).getText().toLowerCase();
|
||||
scrollEffects.resetScroll();
|
||||
scrollEffects.setList(getSearchList());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<String> getSearchList() {
|
||||
if (search.isEmpty()) {
|
||||
return new ArrayList<String>(this.data.keySet());
|
||||
}
|
||||
List<String> list = new ArrayList<String>();
|
||||
for (String name : this.data.keySet()) {
|
||||
if (name.toLowerCase().contains(search))
|
||||
list.add(name);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(Vector<String> list, HashMap<String, Integer> data) {
|
||||
String name = scrollEffects.getSelected();
|
||||
this.data = data;
|
||||
scrollEffects.setList(getSearchList());
|
||||
|
||||
if (name != null)
|
||||
scrollEffects.setSelected(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(String selected) {
|
||||
this.selected = selected;
|
||||
scrollEffects.setSelected(selected);
|
||||
originalName = scrollEffects.getSelected();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void customScrollClicked(int i, int j, int k, GuiCustomScroll guiCustomScroll) {
|
||||
if (guiCustomScroll.id == 0) {
|
||||
save();
|
||||
effect = null;
|
||||
selected = scrollEffects.getSelected();
|
||||
originalName = scrollEffects.getSelected();
|
||||
if (selected != null && !selected.isEmpty()) {
|
||||
PacketClient.sendClient(new EffectGetPacket(data.get(selected)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void customScrollDoubleClicked(String selection, GuiCustomScroll scroll) {
|
||||
// ICustomScrollListener.super.customScrollDoubleClicked(selection, scroll);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
if (this.selected != null && this.data.containsKey(this.selected) && this.effect != null) {
|
||||
PacketClient.sendClient(new EffectSavePacket(effect.writeToNBT(false), originalName));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void subGuiClosed(SubGuiInterface subgui) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void confirmClicked(boolean result, int id) {
|
||||
NoppesUtil.openGUI(player, this);
|
||||
if (!result)
|
||||
return;
|
||||
if (id == 1) {
|
||||
if (data.containsKey(scrollEffects.getSelected())) {
|
||||
PacketClient.sendClient(new EffectRemovePacket(data.get(scrollEffects.getSelected())));
|
||||
scrollEffects.clear();
|
||||
effect = new CustomEffect();
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getStringWidthWithoutColor(String text) {
|
||||
int width = 0;
|
||||
for (int i = 0; i < text.length(); i++) {
|
||||
char c = text.charAt(i);
|
||||
|
||||
if (c == '§') {
|
||||
if (i < text.length() - 1) {
|
||||
i += 1;
|
||||
}
|
||||
} else {
|
||||
// If not a color code, calculate the width
|
||||
width += fontRendererObj.getCharWidth(c);
|
||||
}
|
||||
}
|
||||
return width;
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,21 @@
|
||||
package noppes.npcs.client.gui.global;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.faction.FactionGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.faction.FactionRemovePacket;
|
||||
import kamkeel.npcs.network.packets.request.faction.FactionSavePacket;
|
||||
import kamkeel.npcs.network.packets.request.faction.FactionsGetPacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiYesNo;
|
||||
import net.minecraft.client.gui.GuiYesNoCallback;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.SubGuiColorSelector;
|
||||
import noppes.npcs.client.gui.SubGuiNpcFactionPoints;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.controllers.data.Faction;
|
||||
import noppes.npcs.controllers.data.Quest;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
@@ -28,7 +33,7 @@ public class GuiNPCManageFactions extends GuiNPCInterface2 implements IScrollDat
|
||||
public GuiNPCManageFactions(EntityNPCInterface npc)
|
||||
{
|
||||
super(npc);
|
||||
Client.sendData(EnumPacketServer.FactionsGet);
|
||||
PacketClient.sendClient(new FactionsGetPacket());
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
@@ -106,7 +111,7 @@ public class GuiNPCManageFactions extends GuiNPCInterface2 implements IScrollDat
|
||||
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
faction.writeNBT(compound);
|
||||
Client.sendData(EnumPacketServer.FactionSave, compound);
|
||||
PacketClient.sendClient(new FactionSavePacket(compound));
|
||||
}
|
||||
if(button.id == 1){
|
||||
if(data.containsKey(scrollFactions.getSelected())) {
|
||||
@@ -186,7 +191,7 @@ public class GuiNPCManageFactions extends GuiNPCInterface2 implements IScrollDat
|
||||
{
|
||||
save();
|
||||
selected = scrollFactions.getSelected();
|
||||
Client.sendData(EnumPacketServer.FactionGet, data.get(selected));
|
||||
FactionGetPacket.getFaction(data.get(selected));
|
||||
}
|
||||
else if(guiCustomScroll.id == 1)
|
||||
{
|
||||
@@ -205,7 +210,7 @@ public class GuiNPCManageFactions extends GuiNPCInterface2 implements IScrollDat
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
faction.writeNBT(compound);
|
||||
|
||||
Client.sendData(EnumPacketServer.FactionSave, compound);
|
||||
PacketClient.sendClient(new FactionSavePacket(compound));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,7 +258,7 @@ public class GuiNPCManageFactions extends GuiNPCInterface2 implements IScrollDat
|
||||
return;
|
||||
if(id == 1) {
|
||||
if(data.containsKey(scrollFactions.getSelected())) {
|
||||
Client.sendData(EnumPacketServer.FactionRemove, data.get(selected));
|
||||
PacketClient.sendClient(new FactionRemovePacket(data.get(selected)));
|
||||
scrollFactions.clear();
|
||||
faction = new Faction();
|
||||
initGui();
|
||||
|
||||
+11
-7
@@ -1,11 +1,15 @@
|
||||
package noppes.npcs.client.gui.global;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.linked.LinkedAddPacket;
|
||||
import kamkeel.npcs.network.packets.request.linked.LinkedGetAllPacket;
|
||||
import kamkeel.npcs.network.packets.request.linked.LinkedRemovePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.gui.SubGuiEditText;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -13,17 +17,17 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
public class GuiNPCManageLinkedNpc extends GuiNPCInterface2 implements IScrollData, ISubGuiListener{
|
||||
public class GuiNPCManageLinked extends GuiNPCInterface2 implements IScrollData, ISubGuiListener{
|
||||
private GuiCustomScroll scroll;
|
||||
private List<String> data = new ArrayList<String>();
|
||||
private String search = "";
|
||||
|
||||
public static GuiScreen Instance;
|
||||
|
||||
public GuiNPCManageLinkedNpc(EntityNPCInterface npc){
|
||||
public GuiNPCManageLinked(EntityNPCInterface npc){
|
||||
super(npc);
|
||||
Instance = this;
|
||||
Client.sendData(EnumPacketServer.LinkedGetAll);
|
||||
PacketClient.sendClient(new LinkedGetAllPacket());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -79,7 +83,7 @@ public class GuiNPCManageLinkedNpc extends GuiNPCInterface2 implements IScrollDa
|
||||
}
|
||||
if(button.id == 2){
|
||||
if(scroll.hasSelected())
|
||||
Client.sendData(EnumPacketServer.LinkedRemove, scroll.getSelected());
|
||||
PacketClient.sendClient(new LinkedRemovePacket(scroll.getSelected()));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -87,7 +91,7 @@ public class GuiNPCManageLinkedNpc extends GuiNPCInterface2 implements IScrollDa
|
||||
@Override
|
||||
public void subGuiClosed(SubGuiInterface subgui) {
|
||||
if(!((SubGuiEditText)subgui).cancelled){
|
||||
Client.sendData(EnumPacketServer.LinkedAdd, ((SubGuiEditText)subgui).text);
|
||||
PacketClient.sendClient(new LinkedAddPacket(((SubGuiEditText)subgui).text));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package noppes.npcs.client.gui.global;
|
||||
|
||||
import noppes.npcs.client.gui.GuiMagicMap;
|
||||
import noppes.npcs.client.gui.util.GuiNPCInterface2;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
public class GuiNPCManageMagic extends GuiNPCInterface2 {
|
||||
|
||||
private GuiMagicMap magicMap;
|
||||
|
||||
public GuiNPCManageMagic(EntityNPCInterface npc) {
|
||||
super(npc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
// Position the map in a designated area (e.g., right panel)
|
||||
int mapX = guiLeft + xSize - 230 + 10;
|
||||
int mapY = guiTop + 10;
|
||||
int mapWidth = 210;
|
||||
int mapHeight = 200;
|
||||
|
||||
magicMap = new GuiMagicMap(this, mapX, mapY, mapWidth, mapHeight);
|
||||
addDiagram(0, magicMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) {
|
||||
if (magicMap != null) {
|
||||
magicMap.mouseClickMove(mouseX, mouseY, clickedMouseButton, timeSinceLastClick);
|
||||
}
|
||||
super.mouseClickMove(mouseX, mouseY, clickedMouseButton, timeSinceLastClick);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseMovedOrUp(int mouseX, int mouseY, int state) {
|
||||
if (magicMap != null) {
|
||||
magicMap.mouseReleased(mouseX, mouseY, state);
|
||||
}
|
||||
super.mouseMovedOrUp(mouseX, mouseY, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(net.minecraft.client.gui.GuiButton button) {
|
||||
// your existing action handling
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
// your save logic
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,19 @@
|
||||
package noppes.npcs.client.gui.global;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.quest.*;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.GuiYesNo;
|
||||
import net.minecraft.client.gui.GuiYesNoCallback;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.SubGuiEditText;
|
||||
import noppes.npcs.client.gui.SubGuiNpcQuest;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
import noppes.npcs.controllers.data.Dialog;
|
||||
|
||||
import noppes.npcs.controllers.data.Quest;
|
||||
import noppes.npcs.controllers.data.QuestCategory;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
@@ -22,421 +23,492 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
public class GuiNPCManageQuest extends GuiNPCInterface2 implements IScrollGroup, IScrollData, ISubGuiListener, ICustomScrollListener, IGuiData, GuiYesNoCallback
|
||||
{
|
||||
private GuiCustomScroll catScroll;
|
||||
public GuiCustomScroll questScroll;
|
||||
public class GuiNPCManageQuest extends GuiNPCInterface2 implements IScrollGroup, IScrollData, ISubGuiListener, ICustomScrollListener, IGuiData, GuiYesNoCallback {
|
||||
|
||||
private String prevCatName = "";
|
||||
private String prevQuestName = "";
|
||||
private GuiCustomScroll catScroll;
|
||||
public GuiCustomScroll questScroll;
|
||||
|
||||
public QuestCategory category = new QuestCategory();
|
||||
public static Quest quest = new Quest();
|
||||
public String nextQuestName = "";
|
||||
private String prevCatName = "";
|
||||
private String prevQuestName = "";
|
||||
|
||||
private HashMap<String,Integer> catData = new HashMap<String,Integer>();
|
||||
public HashMap<String,Integer> questData = new HashMap<String,Integer>();
|
||||
public QuestCategory category = new QuestCategory();
|
||||
public static Quest quest = new Quest();
|
||||
public String nextQuestName = "";
|
||||
|
||||
private String catSearch = "";
|
||||
private String questSearch = "";
|
||||
private HashMap<String, Integer> catData = new HashMap<String, Integer>();
|
||||
public HashMap<String, Integer> questData = new HashMap<String, Integer>();
|
||||
|
||||
public static GuiScreen Instance;
|
||||
private String catSearch = "";
|
||||
private String questSearch = "";
|
||||
|
||||
public GuiNPCManageQuest(EntityNPCInterface npc)
|
||||
{
|
||||
super(npc);
|
||||
Instance = this;
|
||||
quest = new Quest();
|
||||
Client.sendData(EnumPacketServer.QuestCategoriesGet);
|
||||
}
|
||||
public static GuiScreen Instance;
|
||||
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
// Divider variables
|
||||
private boolean isResizing = false;
|
||||
private int initialDragX = 0;
|
||||
private int dividerOffset = 143;
|
||||
private final int dividerWidth = 5;
|
||||
private final int minScrollWidth = 50;
|
||||
private int dividerLineHeight = 20;
|
||||
private int dividerLineYOffset = 0;
|
||||
|
||||
if(questScroll == null){
|
||||
questScroll = new GuiCustomScroll(this,1, 0);
|
||||
questScroll.setSize(143, 185);
|
||||
}
|
||||
questScroll.guiLeft = guiLeft + 212;
|
||||
questScroll.guiTop = guiTop + 4;
|
||||
this.addScroll(questScroll);
|
||||
public GuiNPCManageQuest(EntityNPCInterface npc) {
|
||||
super(npc);
|
||||
Instance = this;
|
||||
quest = new Quest();
|
||||
PacketClient.sendClient(new QuestCategoriesGetPacket());
|
||||
}
|
||||
|
||||
if(catScroll == null){
|
||||
catScroll = new GuiCustomScroll(this,0, 0);
|
||||
catScroll.setSize(143, 185);
|
||||
}
|
||||
catScroll.guiLeft = guiLeft + 64;
|
||||
catScroll.guiTop = guiTop + 4;
|
||||
this.addScroll(catScroll);
|
||||
addTextField(new GuiNpcTextField(55, this, fontRendererObj, guiLeft + 64, guiTop + 4 + 3 + 185, 143, 20, catSearch));
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
this.addButton(new GuiNpcButton(44,guiLeft + 3, guiTop + 8, 58, 20, "gui.categories"));
|
||||
getButton(44).setEnabled(false);
|
||||
this.addButton(new GuiNpcButton(4,guiLeft + 3, guiTop + 38, 58, 20, "gui.add"));
|
||||
this.addButton(new GuiNpcButton(5,guiLeft + 3, guiTop + 61, 58, 20, "gui.remove"));
|
||||
this.addButton(new GuiNpcButton(6,guiLeft + 3, guiTop + 94, 58, 20, "gui.edit"));
|
||||
// Define overall horizontal region.
|
||||
int regionLeft = guiLeft + 64;
|
||||
int regionRight = guiLeft + 355;
|
||||
int dividerX = regionLeft + dividerOffset;
|
||||
|
||||
addTextField(new GuiNpcTextField(66, this, fontRendererObj, guiLeft + 212, guiTop + 4 + 3 + 185, 143, 20, questSearch));
|
||||
// Left scroll (catScroll)
|
||||
if (catScroll == null) {
|
||||
catScroll = new GuiCustomScroll(this, 0, 0);
|
||||
}
|
||||
catScroll.guiLeft = regionLeft;
|
||||
catScroll.guiTop = guiTop + 4;
|
||||
catScroll.setSize(dividerX - regionLeft, 185);
|
||||
this.addScroll(catScroll);
|
||||
|
||||
this.addButton(new GuiNpcButton(33,guiLeft + 358, guiTop + 8, 58, 20, "quest.quests"));
|
||||
getButton(33).setEnabled(false);
|
||||
this.addButton(new GuiNpcButton(0,guiLeft + 358, guiTop + 94, 58, 20, "gui.edit"));
|
||||
this.addButton(new GuiNpcButton(1,guiLeft + 358, guiTop + 38, 58, 20, "gui.add"));
|
||||
this.addButton(new GuiNpcButton(2,guiLeft + 358, guiTop + 61, 58, 20, "gui.remove"));
|
||||
this.addButton(new GuiNpcButton(3,guiLeft + 358, guiTop + 117, 58, 20, "gui.copy"));
|
||||
// Right scroll (questScroll)
|
||||
if (questScroll == null) {
|
||||
questScroll = new GuiCustomScroll(this, 1, 0);
|
||||
}
|
||||
questScroll.guiLeft = dividerX + dividerWidth;
|
||||
questScroll.guiTop = guiTop + 4;
|
||||
questScroll.setSize(regionRight - (dividerX + dividerWidth), 185);
|
||||
this.addScroll(questScroll);
|
||||
|
||||
if(quest != null) {
|
||||
if(quest.id != -1){
|
||||
addLabel(new GuiNpcLabel(0, "ID", guiLeft + 358, guiTop + 4 + 3 + 185));
|
||||
addLabel(new GuiNpcLabel(1, quest.id + "", guiLeft + 358, guiTop + 4 + 3 + 195));
|
||||
}
|
||||
}
|
||||
// Adjust text fields:
|
||||
addTextField(new GuiNpcTextField(55, this, fontRendererObj, regionLeft, guiTop + 4 + 3 + 185, dividerX - regionLeft, 20, catSearch));
|
||||
addTextField(new GuiNpcTextField(66, this, fontRendererObj, dividerX + dividerWidth, guiTop + 4 + 3 + 185, regionRight - (dividerX + dividerWidth), 20, questSearch));
|
||||
|
||||
updateButtons();
|
||||
}
|
||||
this.addButton(new GuiNpcButton(44, guiLeft + 3, guiTop + 8, 58, 20, "gui.categories"));
|
||||
getButton(44).setEnabled(false);
|
||||
this.addButton(new GuiNpcButton(4, guiLeft + 3, guiTop + 38, 58, 20, "gui.add"));
|
||||
this.addButton(new GuiNpcButton(5, guiLeft + 3, guiTop + 61, 58, 20, "gui.remove"));
|
||||
this.addButton(new GuiNpcButton(6, guiLeft + 3, guiTop + 94, 58, 20, "gui.edit"));
|
||||
|
||||
@Override
|
||||
public void keyTyped(char c, int i)
|
||||
{
|
||||
super.keyTyped(c, i);
|
||||
if(getTextField(55) != null){
|
||||
if(getTextField(55).isFocused()){
|
||||
if(catSearch.equals(getTextField(55).getText()))
|
||||
return;
|
||||
catSearch = getTextField(55).getText().toLowerCase();
|
||||
this.addButton(new GuiNpcButton(33, guiLeft + 358, guiTop + 8, 58, 20, "quest.quests"));
|
||||
getButton(33).setEnabled(false);
|
||||
this.addButton(new GuiNpcButton(0, guiLeft + 358, guiTop + 94, 58, 20, "gui.edit"));
|
||||
this.addButton(new GuiNpcButton(1, guiLeft + 358, guiTop + 38, 58, 20, "gui.add"));
|
||||
this.addButton(new GuiNpcButton(2, guiLeft + 358, guiTop + 61, 58, 20, "gui.remove"));
|
||||
this.addButton(new GuiNpcButton(3, guiLeft + 358, guiTop + 117, 58, 20, "gui.copy"));
|
||||
|
||||
if (quest != null) {
|
||||
if (quest.id != -1) {
|
||||
addLabel(new GuiNpcLabel(0, "ID", guiLeft + 358, guiTop + 4 + 3 + 185));
|
||||
addLabel(new GuiNpcLabel(1, quest.id + "", guiLeft + 358, guiTop + 4 + 3 + 195));
|
||||
}
|
||||
}
|
||||
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
if (!hasSubGui()) {
|
||||
int regionLeft = guiLeft + 64;
|
||||
int dividerX = regionLeft + dividerOffset;
|
||||
int regionTop = guiTop + 4;
|
||||
int regionHeight = 185;
|
||||
int handleTop = regionTop + (regionHeight - dividerLineHeight) / 2 + dividerLineYOffset;
|
||||
drawRect(dividerX + 1, handleTop, dividerX + dividerWidth - 1, handleTop + dividerLineHeight, 0xFF707070);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int mouseX, int mouseY, int mouseButton) {
|
||||
if (!hasSubGui()) {
|
||||
int regionLeft = guiLeft + 64;
|
||||
int dividerX = regionLeft + dividerOffset;
|
||||
int regionTop = guiTop + 4;
|
||||
int regionHeight = 185;
|
||||
int handleTop = regionTop + (regionHeight - dividerLineHeight) / 2 + dividerLineYOffset;
|
||||
int handleBottom = handleTop + dividerLineHeight;
|
||||
if (mouseX >= dividerX && mouseX <= dividerX + dividerWidth &&
|
||||
mouseY >= handleTop && mouseY <= handleBottom) {
|
||||
isResizing = true;
|
||||
resizingActive = true;
|
||||
initialDragX = mouseX;
|
||||
return;
|
||||
}
|
||||
}
|
||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) {
|
||||
if (isResizing) {
|
||||
int dx = mouseX - initialDragX;
|
||||
initialDragX = mouseX;
|
||||
dividerOffset += dx;
|
||||
int regionLeft = guiLeft + 64;
|
||||
int regionRight = guiLeft + 355;
|
||||
int minOffset = minScrollWidth;
|
||||
int maxOffset = (regionRight - regionLeft) - dividerWidth - minScrollWidth;
|
||||
if (dividerOffset < minOffset) {
|
||||
dividerOffset = minOffset;
|
||||
}
|
||||
if (dividerOffset > maxOffset) {
|
||||
dividerOffset = maxOffset;
|
||||
}
|
||||
int dividerX = regionLeft + dividerOffset;
|
||||
catScroll.setSize(dividerX - regionLeft, 185);
|
||||
questScroll.guiLeft = dividerX + dividerWidth;
|
||||
questScroll.setSize(regionRight - (dividerX + dividerWidth), 185);
|
||||
if (getTextField(55) != null) {
|
||||
getTextField(55).width = dividerX - regionLeft;
|
||||
}
|
||||
if (getTextField(66) != null) {
|
||||
getTextField(66).width = regionRight - (dividerX + dividerWidth);
|
||||
getTextField(66).xPosition = dividerX + dividerWidth;
|
||||
}
|
||||
return;
|
||||
}
|
||||
super.mouseClickMove(mouseX, mouseY, clickedMouseButton, timeSinceLastClick);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseMovedOrUp(int mouseX, int mouseY, int state) {
|
||||
if (isResizing) {
|
||||
isResizing = false;
|
||||
resizingActive = false;
|
||||
return;
|
||||
}
|
||||
super.mouseMovedOrUp(mouseX, mouseY, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyTyped(char c, int i) {
|
||||
super.keyTyped(c, i);
|
||||
if (getTextField(55) != null) {
|
||||
if (getTextField(55).isFocused()) {
|
||||
if (catSearch.equals(getTextField(55).getText()))
|
||||
return;
|
||||
catSearch = getTextField(55).getText().toLowerCase();
|
||||
catScroll.resetScroll();
|
||||
catScroll.setList(getCatSearch());
|
||||
}
|
||||
}
|
||||
if(getTextField(66) != null){
|
||||
if(getTextField(66).isFocused()){
|
||||
if(questSearch.equals(getTextField(66).getText()))
|
||||
return;
|
||||
questSearch = getTextField(66).getText().toLowerCase();
|
||||
catScroll.setList(getCatSearch());
|
||||
}
|
||||
}
|
||||
if (getTextField(66) != null) {
|
||||
if (getTextField(66).isFocused()) {
|
||||
if (questSearch.equals(getTextField(66).getText()))
|
||||
return;
|
||||
questSearch = getTextField(66).getText().toLowerCase();
|
||||
questScroll.resetScroll();
|
||||
questScroll.setList(getQuestSearch());
|
||||
}
|
||||
}
|
||||
}
|
||||
questScroll.setList(getQuestSearch());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void resetQuestList(){
|
||||
if(questScroll != null){
|
||||
questSearch = "";
|
||||
if(getTextField(66) != null){
|
||||
getTextField(66).setText("");
|
||||
}
|
||||
questScroll.setList(getQuestSearch());
|
||||
}
|
||||
}
|
||||
public void resetQuestList() {
|
||||
if (questScroll != null) {
|
||||
questSearch = "";
|
||||
if (getTextField(66) != null) {
|
||||
getTextField(66).setText("");
|
||||
}
|
||||
questScroll.setList(getQuestSearch());
|
||||
}
|
||||
}
|
||||
|
||||
private List<String> getCatSearch(){
|
||||
if(catSearch.isEmpty()){
|
||||
return new ArrayList<String>(this.catData.keySet());
|
||||
}
|
||||
List<String> list = new ArrayList<String>();
|
||||
for(String name : this.catData.keySet()){
|
||||
if(name.toLowerCase().contains(catSearch))
|
||||
list.add(name);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
private List<String> getCatSearch() {
|
||||
if (catSearch.isEmpty()) {
|
||||
return new ArrayList<String>(this.catData.keySet());
|
||||
}
|
||||
List<String> list = new ArrayList<String>();
|
||||
for (String name : this.catData.keySet()) {
|
||||
if (name.toLowerCase().contains(catSearch))
|
||||
list.add(name);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private List<String> getQuestSearch(){
|
||||
if(category != null){
|
||||
if(category.id < 0){
|
||||
return new ArrayList<String>();
|
||||
}
|
||||
}
|
||||
else {
|
||||
return new ArrayList<String>();
|
||||
}
|
||||
private List<String> getQuestSearch() {
|
||||
if (category != null) {
|
||||
if (category.id < 0) {
|
||||
return new ArrayList<String>();
|
||||
}
|
||||
} else {
|
||||
return new ArrayList<String>();
|
||||
}
|
||||
if (questSearch.isEmpty()) {
|
||||
return new ArrayList<String>(this.questData.keySet());
|
||||
}
|
||||
List<String> list = new ArrayList<String>();
|
||||
for (String name : this.questData.keySet()) {
|
||||
if (name.toLowerCase().contains(questSearch))
|
||||
list.add(name);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
if(questSearch.isEmpty()){
|
||||
return new ArrayList<String>(this.questData.keySet());
|
||||
}
|
||||
List<String> list = new ArrayList<String>();
|
||||
for(String name : this.questData.keySet()){
|
||||
if(name.toLowerCase().contains(questSearch))
|
||||
list.add(name);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public void buttonEvent(GuiButton guibutton)
|
||||
{
|
||||
int id = guibutton.id;
|
||||
// Edit Cat
|
||||
if(id == 6){
|
||||
if(category != null && category.id > -1){
|
||||
setSubGui(new SubGuiEditText(category.title));
|
||||
}
|
||||
else {
|
||||
getCategory(false);
|
||||
}
|
||||
}
|
||||
// Add Cat
|
||||
if(id == 4){
|
||||
String name = "New";
|
||||
while(catData.containsKey(name))
|
||||
name += "_";
|
||||
|
||||
if(catScroll != null){
|
||||
setPrevCatName(name);
|
||||
}
|
||||
QuestCategory category = new QuestCategory();
|
||||
category.title = name;
|
||||
Client.sendData(EnumPacketServer.QuestCategorySave, category.writeNBT(new NBTTagCompound()));
|
||||
}
|
||||
// Remove Cat
|
||||
if(id == 5){
|
||||
if(catData.containsKey(catScroll.getSelected())) {
|
||||
public void buttonEvent(GuiButton guibutton) {
|
||||
int id = guibutton.id;
|
||||
// Edit Category
|
||||
if (id == 6) {
|
||||
if (category != null && category.id > -1) {
|
||||
setSubGui(new SubGuiEditText(category.title));
|
||||
} else {
|
||||
getCategory(false);
|
||||
}
|
||||
}
|
||||
// Add Category
|
||||
if (id == 4) {
|
||||
String name = "New";
|
||||
while (catData.containsKey(name))
|
||||
name += "_";
|
||||
if (catScroll != null) {
|
||||
setPrevCatName(name);
|
||||
}
|
||||
QuestCategory category = new QuestCategory();
|
||||
category.title = name;
|
||||
PacketClient.sendClient(new QuestCategorySavePacket(category.writeNBT(new NBTTagCompound())));
|
||||
}
|
||||
// Remove Category
|
||||
if (id == 5) {
|
||||
if (catData.containsKey(catScroll.getSelected())) {
|
||||
GuiYesNo guiyesno = new GuiYesNo(this, catScroll.getSelected(), StatCollector.translateToLocal("gui.delete"), 5);
|
||||
displayGuiScreen(guiyesno);
|
||||
}
|
||||
}
|
||||
if(category != null && category.id >= 0){
|
||||
// Add Quest
|
||||
if(id == 1){
|
||||
String name = "New";
|
||||
while(questData.containsKey(name))
|
||||
name += "_";
|
||||
|
||||
if(questScroll != null){
|
||||
setPrevQuestName(name);
|
||||
}
|
||||
Quest quest = new Quest();
|
||||
quest.title = name;
|
||||
Client.sendData(EnumPacketServer.QuestSave, category.id, quest.writeToNBT(new NBTTagCompound()), true);
|
||||
}
|
||||
// Remove Quest
|
||||
if(id == 2) {
|
||||
if (questData.containsKey(questScroll.getSelected())) {
|
||||
}
|
||||
}
|
||||
if (category != null && category.id >= 0) {
|
||||
// Add Quest
|
||||
if (id == 1) {
|
||||
String name = "New";
|
||||
while (questData.containsKey(name))
|
||||
name += "_";
|
||||
if (questScroll != null) {
|
||||
setPrevQuestName(name);
|
||||
}
|
||||
Quest quest = new Quest();
|
||||
quest.title = name;
|
||||
PacketClient.sendClient(new QuestSavePacket(category.id, quest.writeToNBT(new NBTTagCompound()), true));
|
||||
}
|
||||
// Remove Quest
|
||||
if (id == 2) {
|
||||
if (questData.containsKey(questScroll.getSelected())) {
|
||||
GuiYesNo guiyesno = new GuiYesNo(this, questScroll.getSelected(), StatCollector.translateToLocal("gui.delete"), 2);
|
||||
displayGuiScreen(guiyesno);
|
||||
}
|
||||
}
|
||||
// Edit Quest
|
||||
if(id == 0) {
|
||||
if (questData.containsKey(questScroll.getSelected()) && quest != null && quest.id >= 0) {
|
||||
setSubGui(new SubGuiNpcQuest(this, quest, category.id));
|
||||
}
|
||||
}
|
||||
// Clone Quest
|
||||
if(id == 3) {
|
||||
if (questData.containsKey(questScroll.getSelected()) && quest != null && quest.id >= 0) {
|
||||
String name = quest.title;
|
||||
while(questData.containsKey(name))
|
||||
name += "_";
|
||||
}
|
||||
}
|
||||
// Edit Quest
|
||||
if (id == 0) {
|
||||
if (questData.containsKey(questScroll.getSelected()) && quest != null && quest.id >= 0) {
|
||||
setSubGui(new SubGuiNpcQuest(this, quest, category.id));
|
||||
}
|
||||
}
|
||||
// Clone Quest
|
||||
if (id == 3) {
|
||||
if (questData.containsKey(questScroll.getSelected()) && quest != null && quest.id >= 0) {
|
||||
String name = quest.title;
|
||||
while (questData.containsKey(name))
|
||||
name += "_";
|
||||
if (questScroll != null) {
|
||||
setPrevQuestName(name);
|
||||
}
|
||||
Quest quest = new Quest();
|
||||
quest.readNBTPartial(this.quest.writeToNBT(new NBTTagCompound()));
|
||||
quest.title = name;
|
||||
PacketClient.sendClient(new QuestSavePacket(category.id, quest.writeToNBT(new NBTTagCompound()), true));
|
||||
}
|
||||
}
|
||||
}
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
if(questScroll != null){
|
||||
setPrevQuestName(name);
|
||||
}
|
||||
public void updateButtons() {
|
||||
boolean enabled = category != null;
|
||||
if (enabled) {
|
||||
if (!(category.id >= 0)) {
|
||||
enabled = false;
|
||||
}
|
||||
}
|
||||
boolean questEnabled = questData != null;
|
||||
if (questEnabled) {
|
||||
if (quest == null || !(quest.id >= 0)) {
|
||||
questEnabled = false;
|
||||
}
|
||||
}
|
||||
getButton(6).setEnabled(enabled);
|
||||
getButton(1).setEnabled(enabled);
|
||||
getButton(2).setEnabled(enabled);
|
||||
getButton(0).setEnabled(enabled && questEnabled);
|
||||
getButton(3).setEnabled(enabled && questEnabled);
|
||||
}
|
||||
|
||||
Quest quest = new Quest();
|
||||
quest.readNBTPartial(this.quest.writeToNBT(new NBTTagCompound()));
|
||||
quest.title = name;
|
||||
Client.sendData(EnumPacketServer.QuestSave, category.id, quest.writeToNBT(new NBTTagCompound()), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
updateButtons();
|
||||
}
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
if (compound.hasKey("NextQuestId")) {
|
||||
quest.readNBT(compound);
|
||||
setPrevQuestName(quest.title);
|
||||
if (compound.hasKey("NextQuestTitle")) {
|
||||
nextQuestName = compound.getString("NextQuestTitle");
|
||||
} else {
|
||||
nextQuestName = "";
|
||||
}
|
||||
} else {
|
||||
category.readNBT(compound);
|
||||
setPrevCatName(category.title);
|
||||
PacketClient.sendClient(new QuestsGetPacket(category.id, true));
|
||||
resetQuestList();
|
||||
}
|
||||
initGui();
|
||||
}
|
||||
|
||||
public void updateButtons(){
|
||||
boolean enabled = category != null;
|
||||
if(enabled){
|
||||
if(!(category.id >= 0)){
|
||||
enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
boolean questEnabled = questData != null;
|
||||
if(questEnabled){
|
||||
if(quest == null || !(quest.id >= 0)){
|
||||
questEnabled = false;
|
||||
}
|
||||
}
|
||||
getButton(6).setEnabled(enabled);
|
||||
|
||||
getButton(1).setEnabled(enabled);
|
||||
getButton(2).setEnabled(enabled);
|
||||
|
||||
getButton(0).setEnabled(enabled && questEnabled);
|
||||
getButton(3).setEnabled(enabled && questEnabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
if(compound.hasKey("NextQuestId")){
|
||||
quest.readNBT(compound);
|
||||
setPrevQuestName(quest.title);
|
||||
if(compound.hasKey("NextQuestTitle")){
|
||||
nextQuestName = compound.getString("NextQuestTitle");
|
||||
}
|
||||
else {
|
||||
nextQuestName = "";
|
||||
}
|
||||
}
|
||||
else {
|
||||
category.readNBT(compound);
|
||||
setPrevCatName(category.title);
|
||||
Client.sendData(EnumPacketServer.QuestsGet, category.id, true);
|
||||
resetQuestList();
|
||||
}
|
||||
initGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void subGuiClosed(SubGuiInterface subgui){
|
||||
if(subgui instanceof SubGuiEditText){
|
||||
if(!((SubGuiEditText)subgui).cancelled){
|
||||
if(category != null && category.id > -1){
|
||||
String name = ((SubGuiEditText)subgui).text;
|
||||
if(name != null && !name.equalsIgnoreCase(category.title)){
|
||||
if(!(name.isEmpty() || catData.containsKey(name))){
|
||||
String old = category.title;
|
||||
catData.remove(category.title);
|
||||
category.title = name;
|
||||
catData.put(category.title, category.id);
|
||||
catScroll.replace(old,category.title);
|
||||
}
|
||||
@Override
|
||||
public void subGuiClosed(SubGuiInterface subgui) {
|
||||
if (subgui instanceof SubGuiEditText) {
|
||||
if (!((SubGuiEditText) subgui).cancelled) {
|
||||
if (category != null && category.id > -1) {
|
||||
String name = ((SubGuiEditText) subgui).text;
|
||||
if (name != null && !name.equalsIgnoreCase(category.title)) {
|
||||
if (!(name.isEmpty() || catData.containsKey(name))) {
|
||||
String old = category.title;
|
||||
catData.remove(category.title);
|
||||
category.title = name;
|
||||
catData.put(category.title, category.id);
|
||||
catScroll.replace(old, category.title);
|
||||
}
|
||||
saveType(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
clearCategory();
|
||||
}
|
||||
if(subgui instanceof SubGuiNpcQuest){
|
||||
saveType(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clearCategory();
|
||||
}
|
||||
if (subgui instanceof SubGuiNpcQuest) {
|
||||
saveType(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void setPrevCatName(String selectedCat){
|
||||
prevCatName = selectedCat;
|
||||
this.catScroll.setSelected(prevCatName);
|
||||
}
|
||||
public void setPrevCatName(String selectedCat) {
|
||||
prevCatName = selectedCat;
|
||||
this.catScroll.setSelected(prevCatName);
|
||||
}
|
||||
|
||||
public void setPrevQuestName(String selectedCat){
|
||||
prevQuestName = selectedCat;
|
||||
this.questScroll.setSelected(prevQuestName);
|
||||
}
|
||||
public void setPrevQuestName(String selectedQuest) {
|
||||
prevQuestName = selectedQuest;
|
||||
this.questScroll.setSelected(prevQuestName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void customScrollClicked(int i, int j, int k, GuiCustomScroll guiCustomScroll) {
|
||||
if(guiCustomScroll.id == 0)
|
||||
{
|
||||
getCategory(false);
|
||||
}
|
||||
if(guiCustomScroll.id == 1)
|
||||
{
|
||||
getQuest(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void getCategory(boolean override){
|
||||
if(catScroll.selected != -1){
|
||||
String selected = catScroll.getSelected();
|
||||
if(!selected.equals(prevCatName) || override){
|
||||
category = new QuestCategory();
|
||||
@Override
|
||||
public void customScrollClicked(int i, int j, int k, GuiCustomScroll guiCustomScroll) {
|
||||
if (guiCustomScroll.id == 0) {
|
||||
getCategory(false);
|
||||
}
|
||||
if (guiCustomScroll.id == 1) {
|
||||
getQuest(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void getCategory(boolean override) {
|
||||
if (catScroll.selected != -1) {
|
||||
String selected = catScroll.getSelected();
|
||||
if (!selected.equals(prevCatName) || override) {
|
||||
category = new QuestCategory();
|
||||
questScroll.selected = -1;
|
||||
questScroll.resetScroll();
|
||||
questSearch = "";
|
||||
quest = null;
|
||||
getTextField(66).setText("");
|
||||
PacketClient.sendClient(new QuestCategoryGetPacket(catData.get(selected)));
|
||||
setPrevCatName(selected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Client.sendData(EnumPacketServer.QuestCategoryGet, catData.get(selected));
|
||||
setPrevCatName(selected);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void getQuest(boolean override) {
|
||||
if (questScroll.selected != -1) {
|
||||
String selected = questScroll.getSelected();
|
||||
if (!selected.equals(prevQuestName) || override) {
|
||||
quest = new Quest();
|
||||
QuestGetPacket.getQuest(questData.get(selected));
|
||||
setPrevQuestName(selected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void getQuest(boolean override){
|
||||
if(questScroll.selected != -1){
|
||||
String selected = questScroll.getSelected();
|
||||
if(!selected.equals(prevQuestName) || override){
|
||||
quest = new Quest();
|
||||
Client.sendData(EnumPacketServer.QuestGet, questData.get(selected));
|
||||
setPrevQuestName(selected);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void clearCategory() {
|
||||
catScroll.setList(getCatSearch());
|
||||
catScroll.selected = -1;
|
||||
prevCatName = "";
|
||||
category = new QuestCategory();
|
||||
this.questData.clear();
|
||||
resetQuestList();
|
||||
}
|
||||
|
||||
public void clearCategory(){
|
||||
catScroll.setList(getCatSearch());
|
||||
catScroll.selected = -1;
|
||||
prevCatName = "";
|
||||
category = new QuestCategory();
|
||||
this.questData.clear();
|
||||
resetQuestList();
|
||||
}
|
||||
public void saveType(boolean saveQuest) {
|
||||
if (saveQuest) {
|
||||
if (questScroll.selected != -1 && quest.id >= 0) {
|
||||
if (catScroll.selected != -1 && category.id >= 0) {
|
||||
PacketClient.sendClient(new QuestSavePacket(category.id, quest.writeToNBT(new NBTTagCompound()), true));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (catScroll.selected != -1 && category.id >= 0)
|
||||
PacketClient.sendClient(new QuestCategorySavePacket(category.writeNBT(new NBTTagCompound())));
|
||||
}
|
||||
}
|
||||
|
||||
public void saveType(boolean saveQuest){
|
||||
if(saveQuest){
|
||||
if(questScroll.selected != -1 && quest.id >= 0){
|
||||
if(catScroll.selected != -1 && category.id >= 0){
|
||||
Client.sendData(EnumPacketServer.QuestSave, category.id, quest.writeToNBT(new NBTTagCompound()), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(catScroll.selected != -1 && category.id >= 0)
|
||||
Client.sendData(EnumPacketServer.QuestCategorySave, category.writeNBT(new NBTTagCompound()));
|
||||
}
|
||||
}
|
||||
public void save() {}
|
||||
|
||||
public void save() {}
|
||||
@Override
|
||||
public void setData(Vector<String> list, HashMap<String, Integer> data) {
|
||||
String name = catScroll.getSelected();
|
||||
this.catData = data;
|
||||
catScroll.setList(getCatSearch());
|
||||
if (name != null) {
|
||||
catScroll.setSelected(name);
|
||||
getCategory(false);
|
||||
} else {
|
||||
catScroll.setSelected(prevCatName);
|
||||
getCategory(true);
|
||||
}
|
||||
initGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(Vector<String> list, HashMap<String, Integer> data) {
|
||||
String name = catScroll.getSelected();
|
||||
this.catData = data;
|
||||
catScroll.setList(getCatSearch());
|
||||
if(name != null){
|
||||
catScroll.setSelected(name);
|
||||
getCategory(false);
|
||||
} else {
|
||||
catScroll.setSelected(prevCatName);
|
||||
getCategory(true);
|
||||
}
|
||||
initGui();
|
||||
}
|
||||
@Override
|
||||
public void setSelected(String selected) {}
|
||||
|
||||
@Override
|
||||
public void setSelected(String selected) {}
|
||||
@Override
|
||||
public void setScrollGroup(Vector<String> list, HashMap<String, Integer> data) {
|
||||
String name = questScroll.getSelected();
|
||||
this.questData = data;
|
||||
questScroll.setList(getQuestSearch());
|
||||
if (name != null) {
|
||||
questScroll.setSelected(name);
|
||||
getQuest(false);
|
||||
} else {
|
||||
questScroll.setSelected(prevQuestName);
|
||||
getQuest(true);
|
||||
}
|
||||
initGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setScrollGroup(Vector<String> list, HashMap<String, Integer> data) {
|
||||
String name = questScroll.getSelected();
|
||||
this.questData = data;
|
||||
questScroll.setList(getQuestSearch());
|
||||
if(name != null){
|
||||
questScroll.setSelected(name);
|
||||
getQuest(false);
|
||||
} else {
|
||||
questScroll.setSelected(prevQuestName);
|
||||
getQuest(true);
|
||||
}
|
||||
initGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelectedGroup(String selected) {}
|
||||
@Override
|
||||
public void setSelectedGroup(String selected) {}
|
||||
|
||||
@Override
|
||||
public void confirmClicked(boolean result, int id) {
|
||||
NoppesUtil.openGUI(player, this);
|
||||
if(!result)
|
||||
if (!result)
|
||||
return;
|
||||
if(id == 5) {
|
||||
if(catData.containsKey(catScroll.getSelected())) {
|
||||
Client.sendData(EnumPacketServer.QuestCategoryRemove, category.id);
|
||||
if (id == 5) {
|
||||
if (catData.containsKey(catScroll.getSelected())) {
|
||||
PacketClient.sendClient(new QuestCategoryRemovePacket(category.id));
|
||||
clearCategory();
|
||||
}
|
||||
}
|
||||
if(id == 2) {
|
||||
Client.sendData(EnumPacketServer.QuestRemove, quest.id, true);
|
||||
if (id == 2) {
|
||||
PacketClient.sendClient(new QuestRemovePacket(quest.id, true));
|
||||
quest = new Quest();
|
||||
questData.clear();
|
||||
}
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
package noppes.npcs.client.gui.global;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.tags.TagGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.tags.TagsGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.tags.TagRemovePacket;
|
||||
import kamkeel.npcs.network.packets.request.tags.TagSavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.gui.SubGuiColorSelector;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.controllers.data.Tag;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
@@ -25,7 +30,7 @@ public class GuiNPCManageTags extends GuiNPCInterface2 implements IScrollData,IC
|
||||
public GuiNPCManageTags(EntityNPCInterface npc)
|
||||
{
|
||||
super(npc);
|
||||
Client.sendData(EnumPacketServer.TagsGet);
|
||||
PacketClient.sendClient(new TagsGetPacket());
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
@@ -104,11 +109,11 @@ public class GuiNPCManageTags extends GuiNPCInterface2 implements IScrollData,IC
|
||||
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
tag.writeNBT(compound);
|
||||
Client.sendData(EnumPacketServer.TagSave, compound);
|
||||
PacketClient.sendClient(new TagSavePacket(compound));
|
||||
}
|
||||
if(button.id == 1){
|
||||
if(data.containsKey(scrollTags.getSelected())) {
|
||||
Client.sendData(EnumPacketServer.TagRemove, data.get(selected));
|
||||
PacketClient.sendClient(new TagRemovePacket(data.get(selected)));
|
||||
scrollTags.clear();
|
||||
tag = new Tag();
|
||||
initGui();
|
||||
@@ -154,7 +159,7 @@ public class GuiNPCManageTags extends GuiNPCInterface2 implements IScrollData,IC
|
||||
{
|
||||
save();
|
||||
selected = scrollTags.getSelected();
|
||||
Client.sendData(EnumPacketServer.TagGet, data.get(selected));
|
||||
PacketClient.sendClient(new TagGetPacket(data.get(selected)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,7 +168,7 @@ public class GuiNPCManageTags extends GuiNPCInterface2 implements IScrollData,IC
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
tag.writeNBT(compound);
|
||||
|
||||
Client.sendData(EnumPacketServer.TagSave, compound);
|
||||
PacketClient.sendClient(new TagSavePacket(compound));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
package noppes.npcs.client.gui.global;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.transport.TransportCategoriesGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.transport.TransportCategoryRemovePacket;
|
||||
import kamkeel.npcs.network.packets.request.transport.TransportRemovePacket;
|
||||
import kamkeel.npcs.network.packets.request.transport.TransportsGetPacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.GuiNPCTransportCategoryEdit;
|
||||
import noppes.npcs.client.gui.mainmenu.GuiNPCGlobalMainMenu;
|
||||
@@ -9,7 +14,7 @@ import noppes.npcs.client.gui.util.GuiNPCInterface;
|
||||
import noppes.npcs.client.gui.util.GuiNPCStringSlot;
|
||||
import noppes.npcs.client.gui.util.GuiNpcButton;
|
||||
import noppes.npcs.client.gui.util.IScrollData;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -24,7 +29,7 @@ public class GuiNPCManageTransporters extends GuiNPCInterface implements IScroll
|
||||
public GuiNPCManageTransporters(EntityNPCInterface npc)
|
||||
{
|
||||
super(npc);
|
||||
Client.sendData(EnumPacketServer.TransportCategoriesGet);
|
||||
PacketClient.sendClient(new TransportCategoriesGetPacket());
|
||||
drawDefaultBackground = false;
|
||||
title = "Transport Categories";
|
||||
data = new HashMap<String, Integer>();
|
||||
@@ -36,7 +41,7 @@ public class GuiNPCManageTransporters extends GuiNPCInterface implements IScroll
|
||||
Vector<String> list = new Vector<String>();
|
||||
slot = new GuiNPCStringSlot(list,this,false,18);
|
||||
slot.registerScrollButtons(4, 5);
|
||||
|
||||
|
||||
|
||||
this.addButton(new GuiNpcButton(0,width / 2 - 100, height - 52, 65, 20, "gui.add"));
|
||||
this.addButton(new GuiNpcButton(1,width / 2 - 33 , height - 52, 65, 20, "selectServer.edit"));
|
||||
@@ -63,7 +68,7 @@ public class GuiNPCManageTransporters extends GuiNPCInterface implements IScroll
|
||||
if(selectCategory){
|
||||
NoppesUtil.openGUI(player, new GuiNPCTransportCategoryEdit(npc, this, "", -1));
|
||||
}else{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
if(id == 1)
|
||||
@@ -73,7 +78,7 @@ public class GuiNPCManageTransporters extends GuiNPCInterface implements IScroll
|
||||
if(selectCategory){
|
||||
NoppesUtil.openGUI(player, new GuiNPCTransportCategoryEdit(npc, this,slot.selected, data.get(slot.selected)));
|
||||
}else{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
if(id == 4)
|
||||
@@ -84,7 +89,7 @@ public class GuiNPCManageTransporters extends GuiNPCInterface implements IScroll
|
||||
}else{
|
||||
title = "Transport Categories";
|
||||
selectCategory = true;
|
||||
Client.sendData(EnumPacketServer.TransportCategoriesGet);
|
||||
PacketClient.sendClient(new TransportCategoriesGetPacket());
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
@@ -94,10 +99,10 @@ public class GuiNPCManageTransporters extends GuiNPCInterface implements IScroll
|
||||
return;
|
||||
save();
|
||||
if(selectCategory){
|
||||
Client.sendData(EnumPacketServer.TransportCategoryRemove,data.get(slot.selected));
|
||||
PacketClient.sendClient(new TransportCategoryRemovePacket(data.get(slot.selected)));
|
||||
}
|
||||
else{
|
||||
Client.sendData(EnumPacketServer.TransportRemove,data.get(slot.selected));
|
||||
PacketClient.sendClient(new TransportRemovePacket(data.get(slot.selected)));
|
||||
}
|
||||
initGui();
|
||||
}
|
||||
@@ -112,10 +117,10 @@ public class GuiNPCManageTransporters extends GuiNPCInterface implements IScroll
|
||||
if(selectCategory){
|
||||
selectCategory = false;
|
||||
title = "TransportLocations";
|
||||
Client.sendData(EnumPacketServer.TransportsGet,data.get(slot.selected));
|
||||
PacketClient.sendClient(new TransportsGetPacket(data.get(slot.selected)));
|
||||
initGui();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
public void save() {
|
||||
}
|
||||
@@ -128,8 +133,8 @@ public class GuiNPCManageTransporters extends GuiNPCInterface implements IScroll
|
||||
|
||||
@Override
|
||||
public void setSelected(String selected) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
package noppes.npcs.client.gui.global;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.playerdata.PlayerDataGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.playerdata.PlayerDataMapRegenPacket;
|
||||
import kamkeel.npcs.network.packets.request.playerdata.PlayerDataRemovePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiYesNo;
|
||||
import net.minecraft.client.gui.GuiYesNoCallback;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.constants.EnumPlayerData;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
@@ -26,7 +30,7 @@ public class GuiNpcManagePlayerData extends GuiNPCInterface2 implements IScrollD
|
||||
public GuiNpcManagePlayerData(EntityNPCInterface npc)
|
||||
{
|
||||
super(npc);
|
||||
Client.sendData(EnumPacketServer.PlayerDataGet,selection);
|
||||
PacketClient.sendClient(new PlayerDataGetPacket(selection, ""));
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
@@ -115,9 +119,9 @@ public class GuiNpcManagePlayerData extends GuiNPCInterface2 implements IScrollD
|
||||
{
|
||||
if(selected != null){
|
||||
if(selection == EnumPlayerData.Players)
|
||||
Client.sendData(EnumPacketServer.PlayerDataRemove, selection,selectedPlayer,selected);
|
||||
PacketClient.sendClient(new PlayerDataRemovePacket(selection, selectedPlayer, selected));
|
||||
else
|
||||
Client.sendData(EnumPacketServer.PlayerDataRemove, selection,selectedPlayer,data.get(selected));
|
||||
PacketClient.sendClient(new PlayerDataRemovePacket(selection, selectedPlayer, data.get(selected)));
|
||||
data.clear();
|
||||
}
|
||||
selected = null;
|
||||
@@ -130,8 +134,9 @@ public class GuiNpcManagePlayerData extends GuiNPCInterface2 implements IScrollD
|
||||
initButtons();
|
||||
scroll.clear();
|
||||
data.clear();
|
||||
Client.sendData(EnumPacketServer.PlayerDataGet, selection, selectedPlayer);
|
||||
selected = null;
|
||||
|
||||
PacketClient.sendClient(new PlayerDataGetPacket(selection, selectedPlayer));
|
||||
selected = null;
|
||||
}
|
||||
}
|
||||
if(id == 7){
|
||||
@@ -169,7 +174,7 @@ public class GuiNpcManagePlayerData extends GuiNPCInterface2 implements IScrollD
|
||||
@Override
|
||||
public void confirmClicked(boolean confirm, int id){
|
||||
if(confirm){
|
||||
Client.sendData(EnumPacketServer.PlayerDataMapRegen);
|
||||
PacketClient.sendClient(new PlayerDataMapRegenPacket());
|
||||
close();
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,14 +1,23 @@
|
||||
package noppes.npcs.client.gui.global;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.recipe.RecipeGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.recipe.RecipeRemovePacket;
|
||||
import kamkeel.npcs.network.packets.request.recipe.RecipeSavePacket;
|
||||
import kamkeel.npcs.network.packets.request.recipe.RecipesGetPacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.client.CustomNpcResourceListener;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.SubGuiNpcAvailability;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumGuiType;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.containers.ContainerManageRecipes;
|
||||
import noppes.npcs.controllers.data.RecipeAnvil;
|
||||
import noppes.npcs.controllers.data.RecipeCarpentry;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -18,9 +27,10 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
public class GuiNpcManageRecipes extends GuiContainerNPCInterface2 implements IScrollData, IGuiData, ICustomScrollListener,ITextfieldListener{
|
||||
private GuiCustomScroll scroll;
|
||||
private HashMap<String,Integer> data = new HashMap<String,Integer>();
|
||||
public class GuiNpcManageRecipes extends GuiContainerNPCInterface2 implements IScrollData, IGuiData, ICustomScrollListener, ITextfieldListener, ISubGuiListener {
|
||||
public static int tab = 1;
|
||||
public GuiCustomScroll scroll;
|
||||
public HashMap<String,Integer> data = new HashMap<String,Integer>();
|
||||
private ContainerManageRecipes container;
|
||||
private String selected = null;
|
||||
private ResourceLocation slot;
|
||||
@@ -30,10 +40,18 @@ public class GuiNpcManageRecipes extends GuiContainerNPCInterface2 implements IS
|
||||
super(npc,container);
|
||||
this.container = container;
|
||||
drawDefaultBackground = false;
|
||||
Client.sendData(EnumPacketServer.RecipesGet,container.width);
|
||||
PacketClient.sendClient(new RecipesGetPacket(container.width));
|
||||
setBackground("inventorymenu.png");
|
||||
slot = getResource("slot.png");
|
||||
ySize = 200;
|
||||
|
||||
if(container.width == 1){
|
||||
tab = 2;
|
||||
} else if (container.width == 3){
|
||||
tab = 0;
|
||||
} else {
|
||||
tab = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -42,49 +60,100 @@ public class GuiNpcManageRecipes extends GuiContainerNPCInterface2 implements IS
|
||||
|
||||
if(scroll == null)
|
||||
scroll = new GuiCustomScroll(this,0,0);
|
||||
scroll.setSize(130, 180);
|
||||
scroll.guiLeft = guiLeft + 172;
|
||||
scroll.guiTop = guiTop + 8;
|
||||
scroll.setSize(130, 150);
|
||||
scroll.guiLeft = guiLeft + 280;
|
||||
scroll.guiTop = guiTop + 38;
|
||||
addScroll(scroll);
|
||||
|
||||
this.addButton(new GuiNpcButton(0,guiLeft + 306, guiTop + 10, 84, 20, "menu.global"));
|
||||
this.addButton(new GuiNpcButton(1,guiLeft + 306, guiTop + 32, 84, 20, "tile.npcCarpentyBench.name"));
|
||||
this.getButton(0).setEnabled(container.width == 4);
|
||||
this.getButton(1).setEnabled(container.width == 3);
|
||||
int y = guiTop + 10;
|
||||
|
||||
this.addButton(new GuiNpcButton(3,guiLeft + 306, guiTop + 60, 84, 20, "gui.add"));
|
||||
this.addButton(new GuiNpcButton(4,guiLeft + 306, guiTop + 82, 84, 20, "gui.remove"));
|
||||
this.addButton(new GuiButtonBiDirectional(0,guiLeft + 280, y, 130, 20, new String[]{"menu.global", "tile.npcCarpentyBench.name", "tile.anvil.name"}, tab));
|
||||
|
||||
this.addLabel(new GuiNpcLabel(0, "gui.ignoreDamage", guiLeft + 86, guiTop + 32));
|
||||
this.addButton(new GuiNpcButtonYesNo(5,guiLeft + 114, guiTop + 40, 50, 20, container.recipe.ignoreDamage));
|
||||
y+= 106;
|
||||
|
||||
this.addLabel(new GuiNpcLabel(1, "gui.ignoreNBT", guiLeft + 86, guiTop + 82));
|
||||
this.addButton(new GuiNpcButtonYesNo(6,guiLeft + 114, guiTop + 90, 50, 20, container.recipe.ignoreNBT));
|
||||
this.addButton(new GuiNpcButton(3,guiLeft + 226, y += 22, 50, 20, "gui.add"));
|
||||
this.addButton(new GuiNpcButton(4,guiLeft + 226, y += 22, 50, 20, "gui.remove"));
|
||||
this.addButton(new GuiNpcButton(10,guiLeft + 226, y += 30, 50, 20, "gui.copy"));
|
||||
|
||||
this.addTextField(new GuiNpcTextField(0, this, fontRendererObj, guiLeft + 8, guiTop + 8, 160, 20, container.recipe.name));
|
||||
this.getTextField(0).enabled = false;
|
||||
this.getButton(5).setEnabled(false);
|
||||
this.getButton(6).setEnabled(false);
|
||||
if (container.width != 1) {
|
||||
int buttonPos = guiTop + 72;
|
||||
this.addLabel(new GuiNpcLabel(0, "gui.ignoreDamage", guiLeft + 131, buttonPos));
|
||||
this.addButton(new GuiNpcButtonYesNo(5, guiLeft + 235, buttonPos - 5, 40, 20, container.recipe.ignoreDamage));
|
||||
this.addLabel(new GuiNpcLabel(1, "gui.ignoreNBT", guiLeft + 131, buttonPos += 22));
|
||||
this.addButton(new GuiNpcButtonYesNo(6, guiLeft + 235, buttonPos - 5, 40, 20, container.recipe.ignoreNBT));
|
||||
|
||||
this.addTextField(new GuiNpcTextField(55, this, fontRendererObj, guiLeft + 172, guiTop + 8 + 3 + 180, 130, 20, search));
|
||||
buttonPos += 22;
|
||||
this.addButton(new GuiNpcButton(15, guiLeft + 172, buttonPos - 5, 103, 20, "availability.options"));
|
||||
|
||||
this.getButton(5).setEnabled(false);
|
||||
this.getButton(6).setEnabled(false);
|
||||
this.getButton(15).setEnabled(false);
|
||||
|
||||
this.addTextField(new GuiNpcTextField(0, this, fontRendererObj, guiLeft + 8, guiTop + 8, 160, 20, container.recipe.name));
|
||||
this.getTextField(0).enabled = false;
|
||||
} else {
|
||||
int buttonPos = guiTop + 50;
|
||||
this.addLabel(new GuiNpcLabel(0, "gui.ignoreMatDamage", guiLeft + 131, buttonPos));
|
||||
this.addButton(new GuiNpcButtonYesNo(7, guiLeft + 235, buttonPos - 5, 40, 20, container.recipeAnvil.ignoreRepairMaterialDamage));
|
||||
|
||||
|
||||
this.addLabel(new GuiNpcLabel(1, "gui.ignoreMatNBT", guiLeft + 131, buttonPos += 22));
|
||||
this.addButton(new GuiNpcButtonYesNo(8, guiLeft + 235, buttonPos - 5, 40, 20, container.recipeAnvil.ignoreRepairMaterialNBT));
|
||||
|
||||
this.addLabel(new GuiNpcLabel(11, "gui.repairPercent", guiLeft + 8, buttonPos));
|
||||
this.addTextField(new GuiNpcTextField(1, this, fontRendererObj, guiLeft + 90, buttonPos - 5, 35, 20, container.recipeAnvil.getRepairPercentage() + ""));
|
||||
this.getTextField(1).floatsOnly = true;
|
||||
this.getTextField(1).setMinMaxDefaultFloat(1, 100, container.recipeAnvil.getRepairPercentage());
|
||||
this.getTextField(1).enabled = false;
|
||||
|
||||
this.addLabel(new GuiNpcLabel(2, "gui.ignoreItemNBT", guiLeft + 131, buttonPos += 22));
|
||||
this.addButton(new GuiNpcButtonYesNo(9, guiLeft + 235, buttonPos - 5, 40, 20, container.recipeAnvil.ignoreRepairItemNBT));
|
||||
|
||||
this.addLabel(new GuiNpcLabel(12, "gui.xpCost", guiLeft + 8, buttonPos));
|
||||
this.addTextField(new GuiNpcTextField(2, this, fontRendererObj, guiLeft + 70, buttonPos - 5, 55, 20, container.recipeAnvil.getXpCost() + ""));
|
||||
this.getTextField(2).integersOnly = true;
|
||||
this.getTextField(2).setMinMaxDefault(0, Integer.MAX_VALUE, container.recipeAnvil.getXpCost());
|
||||
this.getTextField(2).enabled = false;
|
||||
|
||||
buttonPos += 22;
|
||||
this.addButton(new GuiNpcButton(15, guiLeft + 172, buttonPos - 5, 103, 20, "availability.options"));
|
||||
|
||||
this.getButton(7).setEnabled(false);
|
||||
this.getButton(8).setEnabled(false);
|
||||
this.getButton(9).setEnabled(false);
|
||||
this.getButton(15).setEnabled(false);
|
||||
|
||||
this.addTextField(new GuiNpcTextField(0, this, fontRendererObj, guiLeft + 8, guiTop + 8, 160, 20, container.recipeAnvil.name));
|
||||
this.getTextField(0).enabled = false;
|
||||
}
|
||||
this.addTextField(new GuiNpcTextField(55, this, fontRendererObj, guiLeft + 280, guiTop + 8 + 3 + 180, 130, 20, search));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton){
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
if(button.id == 0){
|
||||
getTextField(55).setText("");
|
||||
search = "";
|
||||
scroll.clear();
|
||||
save();
|
||||
NoppesUtil.requestOpenGUI(EnumGuiType.ManageRecipes,3,0,0);
|
||||
}
|
||||
if(button.id == 1){
|
||||
getTextField(55).setText("");
|
||||
search = "";
|
||||
scroll.clear();
|
||||
save();
|
||||
NoppesUtil.requestOpenGUI(EnumGuiType.ManageRecipes,4,0,0);
|
||||
GuiButtonBiDirectional buttonBiDirectional = (GuiButtonBiDirectional) button;
|
||||
tab = buttonBiDirectional.getValue();
|
||||
if(tab == 0){
|
||||
getTextField(55).setText("");
|
||||
search = "";
|
||||
scroll.clear();
|
||||
save();
|
||||
NoppesUtil.requestOpenGUI(EnumGuiType.ManageRecipes,3,0,0);
|
||||
} else if (tab == 1){
|
||||
getTextField(55).setText("");
|
||||
search = "";
|
||||
scroll.clear();
|
||||
save();
|
||||
NoppesUtil.requestOpenGUI(EnumGuiType.ManageRecipes,4,0,0);
|
||||
} else {
|
||||
getTextField(55).setText("");
|
||||
search = "";
|
||||
scroll.clear();
|
||||
save();
|
||||
NoppesUtil.requestOpenGUI(EnumGuiType.ManageRecipes,1,0,0);
|
||||
}
|
||||
}
|
||||
if(button.id == 3){
|
||||
save();
|
||||
@@ -92,13 +161,21 @@ public class GuiNpcManageRecipes extends GuiContainerNPCInterface2 implements IS
|
||||
String name = "New";
|
||||
while(data.containsKey(name))
|
||||
name += "_";
|
||||
RecipeCarpentry recipe = new RecipeCarpentry(name);
|
||||
recipe.isGlobal = container.width == 3;
|
||||
Client.sendData(EnumPacketServer.RecipeSave,recipe.writeNBT());
|
||||
|
||||
if(container.width == 1){
|
||||
RecipeAnvil recipe = new RecipeAnvil();
|
||||
recipe.name = name;
|
||||
PacketClient.sendClient(new RecipeSavePacket(recipe.writeNBT()));
|
||||
}
|
||||
else {
|
||||
RecipeCarpentry recipe = new RecipeCarpentry(name);
|
||||
recipe.isGlobal = container.width == 3;
|
||||
PacketClient.sendClient(new RecipeSavePacket(recipe.writeNBT()));
|
||||
}
|
||||
}
|
||||
if(button.id == 4){
|
||||
if(data.containsKey(scroll.getSelected())){
|
||||
Client.sendData(EnumPacketServer.RecipeRemove, data.get(scroll.getSelected()));
|
||||
PacketClient.sendClient(new RecipeRemovePacket(data.get(scroll.getSelected()), container.width == 1));
|
||||
scroll.clear();
|
||||
}
|
||||
}
|
||||
@@ -108,6 +185,23 @@ public class GuiNpcManageRecipes extends GuiContainerNPCInterface2 implements IS
|
||||
if(button.id == 6){
|
||||
container.recipe.ignoreNBT = button.getValue() == 1;
|
||||
}
|
||||
if (button.id == 7) {
|
||||
container.recipeAnvil.ignoreRepairMaterialDamage = button.getValue() == 1;
|
||||
}
|
||||
if (button.id == 8) {
|
||||
container.recipeAnvil.ignoreRepairMaterialNBT = button.getValue() == 1;
|
||||
}
|
||||
if (button.id == 9) {
|
||||
container.recipeAnvil.ignoreRepairItemNBT = button.getValue() == 1;
|
||||
}
|
||||
if(button.id == 15){
|
||||
save();
|
||||
if(container.width == 1){
|
||||
setSubGui(new SubGuiNpcAvailability(container.recipeAnvil.availability));
|
||||
} else {
|
||||
setSubGui(new SubGuiNpcAvailability(container.recipe.availability));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -137,18 +231,68 @@ public class GuiNpcManageRecipes extends GuiContainerNPCInterface2 implements IS
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
RecipeCarpentry recipe = RecipeCarpentry.read(compound);
|
||||
getTextField(0).setText(recipe.name);
|
||||
container.setRecipe(recipe);
|
||||
this.getTextField(0).enabled = true;
|
||||
this.getButton(5).setEnabled(true);
|
||||
this.getButton(5).setDisplay(recipe.ignoreDamage?1:0);
|
||||
this.getButton(6).setEnabled(true);
|
||||
this.getButton(6).setDisplay(recipe.ignoreNBT?1:0);
|
||||
setSelected(recipe.name);
|
||||
}
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
if (compound.hasKey("IsAnvil")) {
|
||||
RecipeAnvil recipe = RecipeAnvil.read(compound);
|
||||
container.setRecipe(recipe);
|
||||
container.width = 1;
|
||||
tab = 2;
|
||||
fixButtons();
|
||||
} else {
|
||||
RecipeCarpentry recipe = RecipeCarpentry.read(compound);
|
||||
container.setRecipe(recipe);
|
||||
fixButtons();
|
||||
}
|
||||
}
|
||||
|
||||
private void fixButtons(){
|
||||
if(tab == 2){
|
||||
getTextField(0).setText(container.recipeAnvil.name);
|
||||
getTextField(1).setText(container.recipeAnvil.getRepairPercentage() + "");
|
||||
getTextField(2).setText(container.recipeAnvil.getXpCost() + "");
|
||||
|
||||
setSelected(container.recipeAnvil.name);
|
||||
getTextField(0).enabled = true;
|
||||
getTextField(1).enabled = true;
|
||||
getTextField(2).enabled = true;
|
||||
|
||||
GuiNpcButtonYesNo btnMatDamage = (GuiNpcButtonYesNo)this.getButton(7);
|
||||
GuiNpcButtonYesNo btnMatNBT = (GuiNpcButtonYesNo)this.getButton(8);
|
||||
GuiNpcButtonYesNo btnItemNBT = (GuiNpcButtonYesNo)this.getButton(9);
|
||||
if (btnMatDamage != null) {
|
||||
btnMatDamage.setDisplay(container.recipeAnvil.ignoreRepairMaterialDamage ? 1 : 0);
|
||||
btnMatDamage.setEnabled(true);
|
||||
}
|
||||
if (btnMatNBT != null) {
|
||||
btnMatNBT.setDisplay(container.recipeAnvil.ignoreRepairMaterialNBT ? 1 : 0);
|
||||
btnMatNBT.setEnabled(true);
|
||||
}
|
||||
if (btnItemNBT != null) {
|
||||
btnItemNBT.setDisplay(container.recipeAnvil.ignoreRepairItemNBT ? 1 : 0);
|
||||
btnItemNBT.setEnabled(true);
|
||||
}
|
||||
|
||||
GuiNpcButton avail = this.getButton(15);
|
||||
if(avail != null)
|
||||
avail.setEnabled(true);
|
||||
} else {
|
||||
getTextField(0).setText(container.recipe.name);
|
||||
|
||||
this.getTextField(0).enabled = true;
|
||||
this.getButton(5).setEnabled(true);
|
||||
this.getButton(5).setDisplay(container.recipe.ignoreDamage ? 1 : 0);
|
||||
this.getButton(6).setEnabled(true);
|
||||
this.getButton(6).setDisplay(container.recipe.ignoreNBT ? 1 : 0);
|
||||
setSelected(container.recipe.name);
|
||||
|
||||
if(!container.recipe.isGlobal){
|
||||
GuiNpcButton avail = this.getButton(15);
|
||||
if(avail != null)
|
||||
avail.setEnabled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int x, int y){
|
||||
@@ -161,16 +305,29 @@ public class GuiNpcManageRecipes extends GuiContainerNPCInterface2 implements IS
|
||||
drawTexturedModalRect(guiLeft + i*18 + 7, guiTop + j*18 + 34, 0, 0, 18, 18);
|
||||
}
|
||||
}
|
||||
drawTexturedModalRect(guiLeft + 86, guiTop + 60, 0, 0, 18, 18);
|
||||
|
||||
if(container.width == 1){
|
||||
drawTexturedModalRect(guiLeft + 101, guiTop + 34, 0, 0, 18, 18);
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("gui.material"), guiLeft + 28, guiTop + 38, CustomNpcResourceListener.DefaultTextColor);
|
||||
} else {
|
||||
drawTexturedModalRect(guiLeft + 86, guiTop + 60, 0, 0, 18, 18);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void setData(Vector<String> list, HashMap<String, Integer> data) {
|
||||
String name = scroll.getSelected();
|
||||
this.data = data;
|
||||
scroll.setList(getSearchList());
|
||||
this.getTextField(0).enabled = name != null;
|
||||
|
||||
this.getTextField(0).enabled = name != null;
|
||||
this.getButton(5).setEnabled(name != null);
|
||||
if(container.width == 1){
|
||||
this.getButton(7).setEnabled(name != null);
|
||||
this.getButton(8).setEnabled(name != null);
|
||||
this.getButton(9).setEnabled(name != null);
|
||||
} else {
|
||||
this.getButton(5).setEnabled(name != null);
|
||||
this.getButton(6).setEnabled(name != null);
|
||||
}
|
||||
|
||||
if(name != null)
|
||||
scroll.setSelected(name);
|
||||
@@ -186,7 +343,11 @@ public class GuiNpcManageRecipes extends GuiContainerNPCInterface2 implements IS
|
||||
public void customScrollClicked(int i, int j, int k, GuiCustomScroll guiCustomScroll) {
|
||||
save();
|
||||
selected = scroll.getSelected();
|
||||
Client.sendData(EnumPacketServer.RecipeGet, data.get(selected));
|
||||
if(container.width == 1){
|
||||
PacketClient.sendClient(new RecipeGetPacket(data.get(selected), true));
|
||||
} else {
|
||||
PacketClient.sendClient(new RecipeGetPacket(data.get(selected), false));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -194,7 +355,11 @@ public class GuiNpcManageRecipes extends GuiContainerNPCInterface2 implements IS
|
||||
GuiNpcTextField.unfocus();
|
||||
if(selected != null && data.containsKey(selected)){
|
||||
container.saveRecipe();
|
||||
Client.sendData(EnumPacketServer.RecipeSave, container.recipe.writeNBT());
|
||||
if(container.width == 1){
|
||||
PacketClient.sendClient(new RecipeSavePacket(container.recipeAnvil.writeNBT()));
|
||||
} else {
|
||||
PacketClient.sendClient(new RecipeSavePacket(container.recipe.writeNBT()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,13 +368,40 @@ public class GuiNpcManageRecipes extends GuiContainerNPCInterface2 implements IS
|
||||
if(guiNpcTextField.id == 0){
|
||||
String name = guiNpcTextField.getText();
|
||||
if(!name.isEmpty() && !data.containsKey(name)){
|
||||
String old = container.recipe.name;
|
||||
data.remove(container.recipe.name);
|
||||
container.recipe.name = name;
|
||||
data.put(container.recipe.name, container.recipe.id);
|
||||
selected = name;
|
||||
scroll.replace(old,container.recipe.name);
|
||||
if(container.width == 1){
|
||||
String old = container.recipeAnvil.name;
|
||||
data.remove(container.recipeAnvil.name);
|
||||
container.recipeAnvil.name = name;
|
||||
data.put(container.recipeAnvil.name, container.recipeAnvil.id);
|
||||
selected = name;
|
||||
scroll.replace(old,container.recipeAnvil.name);
|
||||
} else {
|
||||
String old = container.recipe.name;
|
||||
data.remove(container.recipe.name);
|
||||
container.recipe.name = name;
|
||||
data.put(container.recipe.name, container.recipe.id);
|
||||
selected = name;
|
||||
scroll.replace(old,container.recipe.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(guiNpcTextField.id == 1){
|
||||
float percent = guiNpcTextField.getFloat();
|
||||
if(container.width == 1){
|
||||
container.recipeAnvil.repairPercentage = percent;
|
||||
}
|
||||
}
|
||||
if(guiNpcTextField.id == 2){
|
||||
int xpCost = guiNpcTextField.getInteger();
|
||||
if(container.width == 1){
|
||||
container.recipeAnvil.xpCost = xpCost;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void subGuiClosed(SubGuiInterface subgui){
|
||||
if(subgui instanceof SubGuiNpcAvailability)
|
||||
fixButtons();
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,20 @@
|
||||
package noppes.npcs.client.gui.global;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.naturalspawns.NaturalSpawnGetAllPacket;
|
||||
import kamkeel.npcs.network.packets.request.naturalspawns.NaturalSpawnGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.naturalspawns.NaturalSpawnRemovePacket;
|
||||
import kamkeel.npcs.network.packets.request.naturalspawns.NaturalSpawnSavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.gui.GuiNpcMobSpawnerSelector;
|
||||
import noppes.npcs.client.gui.SubGuiNpcBiomes;
|
||||
import noppes.npcs.client.gui.SubGuiNpcDimensions;
|
||||
import noppes.npcs.client.gui.SubGuiSpawningOptions;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.controllers.data.SpawnData;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
@@ -25,7 +30,7 @@ public class GuiNpcNaturalSpawns extends GuiNPCInterface2 implements IGuiData, I
|
||||
|
||||
public GuiNpcNaturalSpawns(EntityNPCInterface npc) {
|
||||
super(npc);
|
||||
Client.sendData(EnumPacketServer.NaturalSpawnGetAll);
|
||||
PacketClient.sendClient(new NaturalSpawnGetAllPacket());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -129,12 +134,12 @@ public class GuiNpcNaturalSpawns extends GuiNPCInterface2 implements IGuiData, I
|
||||
|
||||
SpawnData spawn = new SpawnData();
|
||||
spawn.name = name;
|
||||
Client.sendData(EnumPacketServer.NaturalSpawnSave, spawn.writeNBT(new NBTTagCompound()));
|
||||
PacketClient.sendClient(new NaturalSpawnSavePacket(spawn.writeNBT(new NBTTagCompound())));
|
||||
this.spawnEntryScroll.selected = -1;
|
||||
}
|
||||
if(id == 2){
|
||||
if(data.containsKey(scrollNaturalSpawns.getSelected())) {
|
||||
Client.sendData(EnumPacketServer.NaturalSpawnRemove, spawn.id);
|
||||
PacketClient.sendClient(new NaturalSpawnRemovePacket(spawn.id));
|
||||
spawn = new SpawnData();
|
||||
scrollNaturalSpawns.clear();
|
||||
this.spawnEntryScroll.selected = -1;
|
||||
@@ -224,7 +229,7 @@ public class GuiNpcNaturalSpawns extends GuiNPCInterface2 implements IGuiData, I
|
||||
save();
|
||||
String selected = scrollNaturalSpawns.getSelected();
|
||||
spawn = new SpawnData();
|
||||
Client.sendData(EnumPacketServer.NaturalSpawnGet, data.get(selected));
|
||||
PacketClient.sendClient(new NaturalSpawnGetPacket(data.get(selected)));
|
||||
}
|
||||
if (guiCustomScroll.id == 20) {
|
||||
initGui();
|
||||
@@ -235,7 +240,7 @@ public class GuiNpcNaturalSpawns extends GuiNPCInterface2 implements IGuiData, I
|
||||
public void save() {
|
||||
GuiNpcTextField.unfocus();
|
||||
if(spawn.id >= 0)
|
||||
Client.sendData(EnumPacketServer.NaturalSpawnSave, spawn.writeNBT(new NBTTagCompound()));
|
||||
PacketClient.sendClient(new NaturalSpawnSavePacket(spawn.writeNBT(new NBTTagCompound())));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,83 +1,237 @@
|
||||
package noppes.npcs.client.gui.mainmenu;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import noppes.npcs.NoppesStringUtils;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.global.GuiNpcManagePlayerData;
|
||||
import noppes.npcs.client.gui.global.GuiNpcNaturalSpawns;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.client.gui.util.GuiNPCInterface2;
|
||||
import noppes.npcs.client.gui.util.GuiNpcButton;
|
||||
import noppes.npcs.client.gui.util.GuiNpcSquareButton;
|
||||
import noppes.npcs.constants.EnumGuiType;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class GuiNPCGlobalMainMenu extends GuiNPCInterface2{
|
||||
public GuiNPCGlobalMainMenu(EntityNPCInterface npc){
|
||||
super(npc,5);
|
||||
import static noppes.npcs.client.gui.player.inventory.GuiCNPCInventory.specialIcons;
|
||||
|
||||
public class GuiNPCGlobalMainMenu extends GuiNPCInterface2 {
|
||||
|
||||
// Store all composite buttons keyed by their IDs.
|
||||
private Map<Integer, GuiNpcSquareButton> buttonMap = new HashMap<>();
|
||||
|
||||
private GuiNpcSquareButton bankButton;
|
||||
private GuiNpcSquareButton factionButton;
|
||||
private GuiNpcSquareButton dialogButton;
|
||||
private GuiNpcSquareButton questButton;
|
||||
private GuiNpcSquareButton transportButton;
|
||||
private GuiNpcSquareButton playerdataButton;
|
||||
private GuiNpcSquareButton recipeButton;
|
||||
private GuiNpcSquareButton spawnButton;
|
||||
private GuiNpcSquareButton linkedButton;
|
||||
private GuiNpcSquareButton animationButton;
|
||||
private GuiNpcSquareButton tagButton;
|
||||
private GuiNpcSquareButton effectsButton;
|
||||
|
||||
public GuiNPCGlobalMainMenu(EntityNPCInterface npc) {
|
||||
super(npc, 5);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a new composite button.
|
||||
*/
|
||||
public void registerButton(GuiNpcSquareButton button) {
|
||||
buttonMap.put(button.id, button);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui(){
|
||||
super.initGui();
|
||||
int y = guiTop + 10;
|
||||
this.addButton(new GuiNpcButton(2, guiLeft + 5, y, "global.banks"));
|
||||
this.addButton(new GuiNpcButton(3, guiLeft + 5, y += 22, "menu.factions"));
|
||||
this.addButton(new GuiNpcButton(4, guiLeft + 5, y += 22, "dialog.dialogs"));
|
||||
this.addButton(new GuiNpcButton(11, guiLeft + 5, y += 22, "quest.quests"));
|
||||
this.addButton(new GuiNpcButton(12, guiLeft + 5, y += 22, "global.transport"));
|
||||
this.addButton(new GuiNpcButton(13, guiLeft + 5, y += 22, "global.playerdata"));
|
||||
this.addButton(new GuiNpcButton(14, guiLeft + 5, y += 22, "global.recipes"));
|
||||
this.addButton(new GuiNpcButton(15, guiLeft + 5, y += 22, NoppesStringUtils.translate("global.naturalspawn")));
|
||||
this.addButton(new GuiNpcButton(16, guiLeft + 5, y += 22, "global.linked"));
|
||||
y = guiTop + 10;
|
||||
this.addButton(new GuiNpcButton(18, guiLeft + 210, y, "menu.animations"));
|
||||
this.addButton(new GuiNpcButton(17, guiLeft + 210, y += 22, "menu.tags"));
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
// Create and register composite buttons.
|
||||
registerButton(bankButton = new GuiNpcSquareButton(2, 0, 0, 20, "global.banks", 0xFF333333));
|
||||
bankButton.setIconPos(24, 24, 72, 32).setIconTexture(specialIcons);
|
||||
|
||||
registerButton(factionButton = new GuiNpcSquareButton(3, 0, 0, 20, "menu.factions", 0xFF333333));
|
||||
factionButton.setIconPos(24, 24, 0, 32).setIconTexture(specialIcons);
|
||||
|
||||
registerButton(dialogButton = new GuiNpcSquareButton(4, 0, 0, 20, "dialog.dialogs", 0xFF333333));
|
||||
dialogButton.setIconPos(24, 24, 24, 32).setIconTexture(specialIcons);
|
||||
|
||||
registerButton(questButton = new GuiNpcSquareButton(11, 0, 0, 20, "quest.quests", 0xFF333333));
|
||||
questButton.setIconPos(24, 24, 0, 56).setIconTexture(specialIcons);
|
||||
|
||||
registerButton(transportButton = new GuiNpcSquareButton(12, 0, 0, 20, "global.transport", 0xFF333333));
|
||||
transportButton.setIconPos(24, 24, 96, 32).setIconTexture(specialIcons);
|
||||
|
||||
registerButton(playerdataButton = new GuiNpcSquareButton(13, 0, 0, 20, "global.playerdata", 0xFF333333));
|
||||
playerdataButton.setIconPos(24, 24, 216, 32).setIconTexture(specialIcons);
|
||||
|
||||
registerButton(recipeButton = new GuiNpcSquareButton(14, 0, 0, 20, "global.recipes", 0xFF333333));
|
||||
recipeButton.setIconPos(24, 24, 48, 32).setIconTexture(specialIcons);
|
||||
|
||||
registerButton(spawnButton = new GuiNpcSquareButton(15, 0, 0, 20, NoppesStringUtils.translate("global.naturalspawn"), 0xFF333333));
|
||||
spawnButton.setIconPos(24, 24, 144, 32).setIconTexture(specialIcons);
|
||||
|
||||
registerButton(linkedButton = new GuiNpcSquareButton(16, 0, 0, 20, "global.linked", 0xFF333333));
|
||||
linkedButton.setIconPos(24, 24, 168, 32).setIconTexture(specialIcons);
|
||||
|
||||
registerButton(animationButton = new GuiNpcSquareButton(18, 0, 0, 20, "menu.animations", 0xFF333333));
|
||||
animationButton.setIconPos(24, 24, 120, 32).setIconTexture(specialIcons);
|
||||
|
||||
registerButton(tagButton = new GuiNpcSquareButton(17, 0, 0, 20, "menu.tags", 0xFF333333));
|
||||
tagButton.setIconPos(24, 24, 192, 32).setIconTexture(specialIcons);
|
||||
|
||||
registerButton(effectsButton = new GuiNpcSquareButton(19, 0, 0, 20, "global.customeffects", 0xFF333333));
|
||||
effectsButton.setIconPos(24, 24, 192, 32).setIconTexture(specialIcons);
|
||||
|
||||
// Layout composite buttons optimally.
|
||||
layoutButtons();
|
||||
// Add all composite buttons to the GUI.
|
||||
for (GuiNpcButton btn : buttonMap.values()) {
|
||||
this.addButton(btn);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute the optimal layout by iterating over candidate row counts from 1 to total.
|
||||
* For each candidate:
|
||||
* - Let c = ceil(total / r)
|
||||
* - candidateHoriz = (availWidth - (c+1)*padding) / c
|
||||
* - candidateVert = (availHeight - (r+1)*padding) / r
|
||||
* - candidate = min(candidateHoriz, candidateVert)
|
||||
* - usedWidth = candidate * c + (c+1)*padding
|
||||
* - usedHeight = candidate * r + (r+1)*padding
|
||||
* - ratio = (usedWidth * usedHeight) / (availWidth * availHeight)
|
||||
*
|
||||
* We choose the candidate (r, candidate) that maximizes this ratio.
|
||||
*
|
||||
* @param total Total number of buttons.
|
||||
* @param padding Padding in pixels.
|
||||
* @return An array {optimalRows, candidateSize}.
|
||||
*/
|
||||
private int[] computeOptimalLayout(int total, int padding) {
|
||||
int availWidth = xSize - 2 * padding;
|
||||
int availHeight = ySize - 2 * padding;
|
||||
double bestRatio = -1;
|
||||
int bestRows = 1;
|
||||
int bestCandidate = 0;
|
||||
for (int r = 1; r <= total; r++) {
|
||||
int cols = (int) Math.ceil(total / (double) r);
|
||||
int candidateHoriz = (availWidth - (cols + 1) * padding) / cols;
|
||||
int candidateVert = (availHeight - (r + 1) * padding) / r;
|
||||
int candidate = Math.min(candidateHoriz, candidateVert);
|
||||
if (candidate <= 0)
|
||||
continue;
|
||||
int usedWidth = candidate * cols + (cols + 1) * padding;
|
||||
int usedHeight = candidate * r + (r + 1) * padding;
|
||||
double ratio = (double)(usedWidth * usedHeight) / (availWidth * availHeight);
|
||||
if (ratio > bestRatio || (Math.abs(ratio - bestRatio) < 0.0001 && candidate > bestCandidate)) {
|
||||
bestRatio = ratio;
|
||||
bestCandidate = candidate;
|
||||
bestRows = r;
|
||||
}
|
||||
}
|
||||
if (bestCandidate <= 0) {
|
||||
bestCandidate = availHeight - 2 * padding;
|
||||
bestRows = 1;
|
||||
}
|
||||
return new int[]{bestRows, bestCandidate};
|
||||
}
|
||||
|
||||
/**
|
||||
* Layout composite buttons using the optimal configuration.
|
||||
*/
|
||||
private void layoutButtons() {
|
||||
List<GuiNpcSquareButton> buttons = new ArrayList<>(buttonMap.values());
|
||||
Collections.sort(buttons, new Comparator<GuiNpcSquareButton>() {
|
||||
@Override
|
||||
public int compare(GuiNpcSquareButton b1, GuiNpcSquareButton b2) {
|
||||
return Integer.compare(b1.id, b2.id);
|
||||
}
|
||||
});
|
||||
int total = buttons.size();
|
||||
if (total == 0)
|
||||
return;
|
||||
int padding = 2;
|
||||
int[] optimal = computeOptimalLayout(total, padding);
|
||||
int rows = optimal[0];
|
||||
int buttonSize = optimal[1]; // composite button is square with side "buttonSize"
|
||||
|
||||
// Distribute buttons evenly among the rows.
|
||||
int base = total / rows;
|
||||
int extra = total % rows;
|
||||
int[] rowCounts = new int[rows];
|
||||
for (int i = 0; i < rows; i++) {
|
||||
rowCounts[i] = base + (i < extra ? 1 : 0);
|
||||
}
|
||||
int totalHeight = rows * buttonSize + (rows + 1) * padding;
|
||||
int startY = guiTop + (ySize - totalHeight) / 2;
|
||||
int index = 0;
|
||||
for (int row = 0; row < rows; row++) {
|
||||
int count = rowCounts[row];
|
||||
int rowWidth = count * buttonSize + (count + 1) * padding;
|
||||
int rowStartX = guiLeft + (xSize - rowWidth) / 2;
|
||||
int yPos = startY + padding + row * (buttonSize + padding);
|
||||
for (int col = 0; col < count; col++) {
|
||||
if (index >= total)
|
||||
break;
|
||||
GuiNpcSquareButton btn = buttons.get(index);
|
||||
btn.updatePositionAndSize(rowStartX + padding + col * (buttonSize + padding), yPos, buttonSize);
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
int id = guibutton.id;
|
||||
if (id == 11) {
|
||||
NoppesUtil.requestOpenGUI(EnumGuiType.ManageQuests);
|
||||
}
|
||||
if (id == 2) {
|
||||
NoppesUtil.requestOpenGUI(EnumGuiType.ManageBanks);
|
||||
}
|
||||
if (id == 3) {
|
||||
NoppesUtil.requestOpenGUI(EnumGuiType.ManageFactions);
|
||||
}
|
||||
if (id == 17) {
|
||||
NoppesUtil.requestOpenGUI(EnumGuiType.ManageTags);
|
||||
}
|
||||
if (id == 18) {
|
||||
NoppesUtil.requestOpenGUI(EnumGuiType.ManageAnimations);
|
||||
}
|
||||
if (id == 4) {
|
||||
NoppesUtil.requestOpenGUI(EnumGuiType.ManageDialogs);
|
||||
}
|
||||
if (id == 12) {
|
||||
NoppesUtil.requestOpenGUI(EnumGuiType.ManageTransport);
|
||||
}
|
||||
if (id == 13) {
|
||||
NoppesUtil.openGUI(player, new GuiNpcManagePlayerData(npc));
|
||||
}
|
||||
if (id == 14) {
|
||||
NoppesUtil.requestOpenGUI(EnumGuiType.ManageRecipes, 4, 0, 0);
|
||||
}
|
||||
if (id == 15) {
|
||||
NoppesUtil.openGUI(player, new GuiNpcNaturalSpawns(npc));
|
||||
}
|
||||
if (id == 16) {
|
||||
NoppesUtil.requestOpenGUI(EnumGuiType.ManageLinked);
|
||||
}
|
||||
if (id == 19) {
|
||||
NoppesUtil.requestOpenGUI(EnumGuiType.ManageEffects);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
int id = guibutton.id;
|
||||
if (id == 11) {
|
||||
NoppesUtil.requestOpenGUI(EnumGuiType.ManageQuests);
|
||||
}
|
||||
if (id == 2) {
|
||||
NoppesUtil.requestOpenGUI(EnumGuiType.ManageBanks);
|
||||
}
|
||||
if (id == 3) {
|
||||
NoppesUtil.requestOpenGUI(EnumGuiType.ManageFactions);
|
||||
}
|
||||
if (id == 17) {
|
||||
NoppesUtil.requestOpenGUI(EnumGuiType.ManageTags);
|
||||
}
|
||||
if (id == 18) {
|
||||
NoppesUtil.requestOpenGUI(EnumGuiType.ManageAnimations);
|
||||
}
|
||||
if (id == 4) {
|
||||
NoppesUtil.requestOpenGUI(EnumGuiType.ManageDialogs);
|
||||
}
|
||||
if (id == 12) {
|
||||
NoppesUtil.requestOpenGUI(EnumGuiType.ManageTransport);
|
||||
}
|
||||
if (id == 13) {
|
||||
NoppesUtil.openGUI(player, new GuiNpcManagePlayerData(npc));
|
||||
}
|
||||
if (id == 14) {
|
||||
NoppesUtil.requestOpenGUI(EnumGuiType.ManageRecipes, 4, 0, 0);
|
||||
}
|
||||
if (id == 15) {
|
||||
NoppesUtil.openGUI(player, new GuiNpcNaturalSpawns(npc));
|
||||
}
|
||||
if (id == 16) {
|
||||
NoppesUtil.requestOpenGUI(EnumGuiType.ManageLinked);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@Override
|
||||
public void save() {
|
||||
}
|
||||
|
||||
|
||||
public void save() {
|
||||
// No saving logic needed.
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
package noppes.npcs.client.gui.mainmenu;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.mainmenu.MainmenuInvGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.mainmenu.MainmenuInvSavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
@@ -7,9 +10,9 @@ import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.containers.ContainerNPCInv;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -30,7 +33,7 @@ public class GuiNPCInv extends GuiContainerNPCInterface2 implements IGuiData, IT
|
||||
this.container = container;
|
||||
ySize = 200;
|
||||
slot = getResource("slot.png");
|
||||
Client.sendData(EnumPacketServer.MainmenuInvGet);
|
||||
PacketClient.sendClient(new MainmenuInvGetPacket());
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
@@ -178,8 +181,8 @@ public class GuiNPCInv extends GuiContainerNPCInterface2 implements IGuiData, IT
|
||||
npc.inventory.dropchance = chances;
|
||||
npc.inventory.minExp = getTextField(0).getInteger();
|
||||
npc.inventory.maxExp = getTextField(1).getInteger();
|
||||
Client.sendData(EnumPacketServer.MainmenuInvSave, npc.inventory.writeEntityToNBT(new NBTTagCompound()));
|
||||
}
|
||||
PacketClient.sendClient(new MainmenuInvSavePacket(npc.inventory.writeEntityToNBT(new NBTTagCompound())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
|
||||
@@ -1,46 +1,49 @@
|
||||
package noppes.npcs.client.gui.mainmenu;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.mainmenu.MainmenuAIGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.mainmenu.MainmenuAISavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.DataAI;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.gui.SubGuiNpcMovement;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumCombatPolicy;
|
||||
import noppes.npcs.constants.EnumNavType;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
public class GuiNpcAI extends GuiNPCInterface2 implements ITextfieldListener, IGuiData{
|
||||
private DataAI ai;
|
||||
public GuiNpcAI(EntityNPCInterface npc) {
|
||||
super(npc,6);
|
||||
ai = npc.ai;
|
||||
Client.sendData(EnumPacketServer.MainmenuAIGet);
|
||||
ai = npc.ais;
|
||||
PacketClient.sendClient(new MainmenuAIGetPacket());
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
addLabel(new GuiNpcLabel(0,"ai.enemyresponse", guiLeft + 5, guiTop + 17));
|
||||
addButton(new GuiNpcButton(0,guiLeft + 86, guiTop + 10, 60, 20, new String[]{"gui.retaliate","gui.panic","gui.retreat","gui.nothing"} ,npc.ai.onAttack));
|
||||
addButton(new GuiNpcButton(0,guiLeft + 86, guiTop + 10, 60, 20, new String[]{"gui.retaliate","gui.panic","gui.retreat","gui.nothing"} ,npc.ais.onAttack));
|
||||
addLabel(new GuiNpcLabel(1,"ai.door", guiLeft + 5, guiTop + 40));
|
||||
addButton(new GuiNpcButton(1,guiLeft + 86, guiTop + 35, 60, 20, new String[]{"gui.break","gui.open","gui.disabled"} ,npc.ai.doorInteract));
|
||||
addButton(new GuiNpcButton(1,guiLeft + 86, guiTop + 35, 60, 20, new String[]{"gui.break","gui.open","gui.disabled"} ,npc.ais.doorInteract));
|
||||
addLabel(new GuiNpcLabel(12,"ai.swim", guiLeft + 5, guiTop + 65));
|
||||
addButton(new GuiNpcButton(7,guiLeft + 86, guiTop + 60, 60, 20, new String[]{"gui.no", "gui.yes"} ,npc.ai.canSwim ? 1:0));
|
||||
addButton(new GuiNpcButton(7,guiLeft + 86, guiTop + 60, 60, 20, new String[]{"gui.no", "gui.yes"} ,npc.ais.canSwim ? 1:0));
|
||||
addLabel(new GuiNpcLabel(13,"ai.shelter", guiLeft + 5, guiTop + 90));
|
||||
addButton(new GuiNpcButton(9,guiLeft + 86, guiTop + 85, 60, 20, new String[]{"gui.darkness","gui.sunlight","gui.disabled"} ,npc.ai.findShelter));
|
||||
addButton(new GuiNpcButton(9,guiLeft + 86, guiTop + 85, 60, 20, new String[]{"gui.darkness","gui.sunlight","gui.disabled"} ,npc.ais.findShelter));
|
||||
addLabel(new GuiNpcLabel(14,"ai.clearlos", guiLeft + 5, guiTop + 115));
|
||||
addButton(new GuiNpcButton(10,guiLeft + 86, guiTop + 110, 60, 20, new String[]{"gui.no", "gui.yes"} ,npc.ai.directLOS ? 1:0));
|
||||
addButton(new GuiNpcButton(10,guiLeft + 86, guiTop + 110, 60, 20, new String[]{"gui.no", "gui.yes"} ,npc.ais.directLOS ? 1:0));
|
||||
addLabel(new GuiNpcLabel(18,"ai.sprint", guiLeft + 5, guiTop + 140));
|
||||
addButton(new GuiNpcButton(16,guiLeft + 86, guiTop + 135, 60, 20, new String[]{"gui.no", "gui.yes"} ,npc.ai.canSprint ? 1:0));
|
||||
addButton(new GuiNpcButton(16,guiLeft + 86, guiTop + 135, 60, 20, new String[]{"gui.no", "gui.yes"} ,npc.ais.canSprint ? 1:0));
|
||||
|
||||
addLabel(new GuiNpcLabel(10,"ai.avoidwater", guiLeft + 150, guiTop + 17));
|
||||
addButton(new GuiNpcButton(5, guiLeft + 230, guiTop + 10, 60, 20, new String[]{"gui.no","gui.yes"} ,npc.ai.avoidsWater ? 1:0));
|
||||
addButton(new GuiNpcButton(5, guiLeft + 230, guiTop + 10, 60, 20, new String[]{"gui.no","gui.yes"} ,npc.ais.avoidsWater ? 1:0));
|
||||
addLabel(new GuiNpcLabel(11,"ai.return", guiLeft + 150, guiTop + 40));
|
||||
addButton(new GuiNpcButton(6, guiLeft + 230, guiTop + 35, 60, 20, new String[]{"gui.no","gui.yes"} ,npc.ai.returnToStart ? 1:0));
|
||||
addButton(new GuiNpcButton(6, guiLeft + 230, guiTop + 35, 60, 20, new String[]{"gui.no","gui.yes"} ,npc.ais.returnToStart ? 1:0));
|
||||
addLabel(new GuiNpcLabel(17,"ai.leapattarget", guiLeft + 150, guiTop + 65));
|
||||
addButton(new GuiNpcButton(15,guiLeft + 230, guiTop + 60, 60, 20, new String[]{"gui.no", "ai.jump", "ai.pounce"} ,npc.ai.leapType));
|
||||
addButton(new GuiNpcButton(15,guiLeft + 230, guiTop + 60, 60, 20, new String[]{"gui.no", "ai.jump", "ai.pounce"} ,npc.ais.leapType));
|
||||
addLabel(new GuiNpcLabel(15, "ai.indirect", guiLeft + 150, guiTop + 90));
|
||||
addButton(new GuiNpcButton(13, guiLeft + 230, guiTop + 85, 60, 20, new String[]{"gui.no", "gui.whendistant", "gui.whenhidden"}, ai.canFireIndirect));
|
||||
addLabel(new GuiNpcLabel(16, "ai.rangemelee", guiLeft + 150, guiTop + 115));
|
||||
@@ -82,7 +85,7 @@ public class GuiNpcAI extends GuiNPCInterface2 implements ITextfieldListener, IG
|
||||
}
|
||||
else if (ai.combatPolicy == EnumCombatPolicy.Tactical)
|
||||
{
|
||||
addButton(new GuiNpcButton(40, guiLeft + 295, guiTop + 160, 60, 20, new String[]{"stats.normal","stats.reverse"}, npc.ai.tacticalChance > 50 ? 1:0));
|
||||
addButton(new GuiNpcButton(40, guiLeft + 295, guiTop + 160, 60, 20, new String[]{"stats.normal","stats.reverse"}, npc.ais.tacticalChance > 50 ? 1:0));
|
||||
}
|
||||
|
||||
getButton(17).setEnabled(this.ai.onAttack == 0);
|
||||
@@ -173,7 +176,7 @@ public class GuiNpcAI extends GuiNPCInterface2 implements ITextfieldListener, IG
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
Client.sendData(EnumPacketServer.MainmenuAISave, ai.writeToNBT(new NBTTagCompound()));
|
||||
PacketClient.sendClient(new MainmenuAISavePacket(ai.writeToNBT(new NBTTagCompound())));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
package noppes.npcs.client.gui.mainmenu;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.jobs.JobGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.mainmenu.MainmenuAdvancedGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.mainmenu.MainmenuAdvancedSavePacket;
|
||||
import kamkeel.npcs.network.packets.request.role.RoleGetPacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.NoppesStringUtils;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.advanced.*;
|
||||
import noppes.npcs.client.gui.roles.*;
|
||||
@@ -12,7 +17,7 @@ import noppes.npcs.client.gui.util.GuiNpcButton;
|
||||
import noppes.npcs.client.gui.util.IGuiData;
|
||||
import noppes.npcs.constants.EnumGuiType;
|
||||
import noppes.npcs.constants.EnumJobType;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.constants.EnumRoleType;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
@@ -22,8 +27,9 @@ public class GuiNpcAdvanced extends GuiNPCInterface2 implements IGuiData
|
||||
public GuiNpcAdvanced(EntityNPCInterface npc)
|
||||
{
|
||||
super(npc, 4);
|
||||
Client.sendData(EnumPacketServer.MainmenuAdvancedGet);
|
||||
PacketClient.sendClient(new MainmenuAdvancedGetPacket());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui(){
|
||||
super.initGui();
|
||||
@@ -55,7 +61,7 @@ public class GuiNpcAdvanced extends GuiNPCInterface2 implements IGuiData
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
if (button.id == 3) {
|
||||
save();
|
||||
Client.sendData(EnumPacketServer.RoleGet);
|
||||
PacketClient.sendClient(new RoleGetPacket());
|
||||
}
|
||||
if(button.id == 8){
|
||||
hasChanges = true;
|
||||
@@ -65,7 +71,7 @@ public class GuiNpcAdvanced extends GuiNPCInterface2 implements IGuiData
|
||||
}
|
||||
if(button.id == 4){
|
||||
save();
|
||||
Client.sendData(EnumPacketServer.JobGet);
|
||||
PacketClient.sendClient(new JobGetPacket());
|
||||
}
|
||||
if(button.id == 5){
|
||||
hasChanges = true;
|
||||
@@ -152,7 +158,7 @@ public class GuiNpcAdvanced extends GuiNPCInterface2 implements IGuiData
|
||||
@Override
|
||||
public void save() {
|
||||
if(hasChanges){
|
||||
Client.sendData(EnumPacketServer.MainmenuAdvancedSave, npc.advanced.writeToNBT(new NBTTagCompound()));
|
||||
PacketClient.sendClient(new MainmenuAdvancedSavePacket(npc.advanced.writeToNBT(new NBTTagCompound())));
|
||||
hasChanges = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,22 @@
|
||||
package noppes.npcs.client.gui.mainmenu;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import kamkeel.addon.client.GeckoAddonClient;
|
||||
import kamkeel.npcs.addon.client.GeckoAddonClient;
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.mainmenu.MainmenuDisplayGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.mainmenu.MainmenuDisplaySavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.DataDisplay;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.*;
|
||||
import noppes.npcs.client.gui.model.GuiCreationScreen;
|
||||
import noppes.npcs.client.gui.select.GuiTextureSelection;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.config.ConfigMain;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.controllers.data.SkinOverlay;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
@@ -25,7 +29,7 @@ public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListene
|
||||
public GuiNpcDisplay(EntityNPCInterface npc) {
|
||||
super(npc,1);
|
||||
display = npc.display;
|
||||
Client.sendData(EnumPacketServer.MainmenuDisplayGet);
|
||||
PacketClient.sendClient(new MainmenuDisplayGetPacket());
|
||||
}
|
||||
|
||||
public void initGui(){
|
||||
@@ -38,6 +42,8 @@ public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListene
|
||||
this.addButton(new GuiNpcButton(0, guiLeft + 253+52, y , 110, 20, new String[]{"display.show","display.hide","display.showAttacking"} ,display.showName));
|
||||
|
||||
this.addButton(new GuiNpcButton(14, guiLeft + 259, y , 20, 20, Character.toString('\u21bb')));
|
||||
getButton(14).setIconTexture(new ResourceLocation("customnpcs", "textures/gui/slot.png"));
|
||||
|
||||
this.addButton(new GuiNpcButton(15, guiLeft + 259 + 22, y , 20, 20, Character.toString('\u22EE')));
|
||||
|
||||
y+=23;
|
||||
@@ -209,11 +215,11 @@ public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListene
|
||||
public void save() {
|
||||
if(display.skinType == 1)
|
||||
display.loadProfile();
|
||||
|
||||
npc.textureLocation = null;
|
||||
mc.renderGlobal.onEntityDestroy(npc);
|
||||
mc.renderGlobal.onEntityCreate(npc);
|
||||
Client.sendData(EnumPacketServer.MainmenuDisplaySave, display.writeToNBT(new NBTTagCompound()));
|
||||
|
||||
PacketClient.sendClient(new MainmenuDisplaySavePacket(display.writeToNBT(new NBTTagCompound())));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
package noppes.npcs.client.gui.mainmenu;
|
||||
|
||||
import kamkeel.addon.DBCAddon;
|
||||
import kamkeel.addon.client.DBCClient;
|
||||
import kamkeel.npcs.addon.client.DBCClient;
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.mainmenu.MainmenuStatsGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.mainmenu.MainmenuStatsSavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.EnumCreatureAttribute;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.DataStats;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.gui.*;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
public class GuiNpcStats extends GuiNPCInterface2 implements ITextfieldListener, IGuiData{
|
||||
@@ -17,7 +19,8 @@ public class GuiNpcStats extends GuiNPCInterface2 implements ITextfieldListener,
|
||||
public GuiNpcStats(EntityNPCInterface npc) {
|
||||
super(npc,2);
|
||||
stats = npc.stats;
|
||||
Client.sendData(EnumPacketServer.MainmenuStatsGet);
|
||||
|
||||
PacketClient.sendClient(new MainmenuStatsGetPacket());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -151,7 +154,7 @@ public class GuiNpcStats extends GuiNPCInterface2 implements ITextfieldListener,
|
||||
}
|
||||
@Override
|
||||
public void save() {
|
||||
Client.sendData(EnumPacketServer.MainmenuStatsSave, stats.writeToNBT(new NBTTagCompound()));
|
||||
PacketClient.sendClient(new MainmenuStatsSavePacket(stats.writeToNBT(new NBTTagCompound())));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package noppes.npcs.client.gui.model;
|
||||
|
||||
import kamkeel.addon.client.GeckoAddonClient;
|
||||
import kamkeel.npcs.addon.client.GeckoAddonClient;
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.npc.ModelDataSavePacket;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
@@ -14,10 +16,10 @@ import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagByte;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.compat.PixelmonHelper;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.entity.*;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
@@ -380,7 +382,7 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol
|
||||
|
||||
@Override
|
||||
public void close(){
|
||||
Client.sendData(EnumPacketServer.ModelDataSave, playerdata.writeToNBT());
|
||||
PacketClient.sendClient(new ModelDataSavePacket(playerdata.writeToNBT()));
|
||||
displayGuiScreen(parent);
|
||||
}
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ public class GuiEntitySelection extends GuiNPCInterface
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ public class GuiPresetSave extends GuiNPCInterface{
|
||||
}
|
||||
@Override
|
||||
public void save() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -155,7 +155,7 @@ public class GuiPresetSelection extends GuiNPCInterface
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,344 @@
|
||||
package noppes.npcs.client.gui.player;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.client.CustomNpcResourceListener;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.controllers.RecipeController;
|
||||
import noppes.npcs.controllers.data.RecipeAnvil;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.util.ValueUtil;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiAnvilRecipes extends GuiNPCInterface {
|
||||
|
||||
private static final ResourceLocation SLOT_TEXTURE = new ResourceLocation("customnpcs", "textures/gui/slot.png");
|
||||
|
||||
private int page = 0;
|
||||
private GuiNpcLabel lblPage;
|
||||
private GuiNpcButton btnLeft, btnRight;
|
||||
private List<RecipeAnvil> recipes = new ArrayList<RecipeAnvil>();
|
||||
private String search = "";
|
||||
|
||||
public GuiAnvilRecipes() {
|
||||
this.xSize = 256;
|
||||
this.ySize = 182;
|
||||
setBackground("recipesAnvil.png");
|
||||
this.closeOnEsc = true;
|
||||
|
||||
recipes.addAll(RecipeController.Instance.anvilRecipes.values());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
guiTop += 10;
|
||||
// Add search text field (ID 3) at top.
|
||||
addTextField(new GuiNpcTextField(3, this, fontRendererObj, guiLeft + 2, guiTop - 25, 250, 20, search));
|
||||
|
||||
addLabel(new GuiNpcLabel(0, "Anvil Recipe List", guiLeft + 5, guiTop + 5));
|
||||
addLabel(lblPage = new GuiNpcLabel(1, "", guiLeft + 5, guiTop + 168));
|
||||
|
||||
addButton(this.btnLeft = new GuiButtonNextPage(1, guiLeft + 150, guiTop + 164, true));
|
||||
addButton(this.btnRight = new GuiButtonNextPage(2, guiLeft + 80, guiTop + 164, false));
|
||||
|
||||
updateButton();
|
||||
}
|
||||
|
||||
private void updateButton() {
|
||||
// We want 8 recipes per page.
|
||||
int maxPages = MathHelper.ceiling_float_int(recipes.size() / 8.0F);
|
||||
btnRight.visible = btnRight.enabled = page > 0;
|
||||
btnLeft.visible = btnLeft.enabled = page < maxPages - 1;
|
||||
lblPage.label = (page + 1) + "/" + maxPages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyTyped(char c, int i) {
|
||||
super.keyTyped(c, i);
|
||||
if(search.equals(getTextField(3).getText()))
|
||||
return;
|
||||
search = getTextField(3).getText().toLowerCase();
|
||||
recipes = getSearchList();
|
||||
page = 0;
|
||||
updateButton();
|
||||
}
|
||||
|
||||
private List<RecipeAnvil> getSearchList() {
|
||||
if(search.isEmpty()) {
|
||||
return new ArrayList<RecipeAnvil>(RecipeController.Instance.anvilRecipes.values());
|
||||
}
|
||||
List<RecipeAnvil> list = new ArrayList<RecipeAnvil>();
|
||||
for(RecipeAnvil recipe : RecipeController.Instance.anvilRecipes.values()) {
|
||||
ItemStack repairItem = recipe.itemToRepair;
|
||||
if(repairItem == null)
|
||||
continue;
|
||||
if(repairItem.getDisplayName() == null)
|
||||
continue;
|
||||
if(repairItem.getDisplayName().trim().isEmpty())
|
||||
continue;
|
||||
if(repairItem.getDisplayName().toLowerCase().contains(search))
|
||||
list.add(recipe);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton button) {
|
||||
if(!button.enabled)
|
||||
return;
|
||||
if(button == btnRight) {
|
||||
if(page > 0)
|
||||
page--;
|
||||
}
|
||||
if(button == btnLeft) {
|
||||
int maxPages = MathHelper.ceiling_float_int(recipes.size() / 8.0F);
|
||||
if(page < maxPages - 1)
|
||||
page++;
|
||||
}
|
||||
updateButton();
|
||||
}
|
||||
|
||||
private static class ItemOverlayData {
|
||||
public final int x, y;
|
||||
public final ItemStack item;
|
||||
public ItemOverlayData(int x, int y, ItemStack item) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.item = item;
|
||||
}
|
||||
}
|
||||
|
||||
private static class TextOverlayData {
|
||||
public final int x, y, width, height;
|
||||
public final List<String> textLines;
|
||||
|
||||
public TextOverlayData(int x, int y, int width, int height, String text) {
|
||||
this(x, y, width, height, Arrays.asList(text));
|
||||
}
|
||||
|
||||
public TextOverlayData(int x, int y, int width, int height, List<String> textLines) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.textLines = textLines;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
|
||||
// Update page label.
|
||||
lblPage.label = (page + 1) + "/" + MathHelper.ceiling_float_int(recipes.size() / 8.0F);
|
||||
lblPage.x = guiLeft + (xSize - Minecraft.getMinecraft().fontRenderer.getStringWidth(lblPage.label)) / 2;
|
||||
|
||||
int recipesPerPage = 8;
|
||||
int startIndex = page * recipesPerPage;
|
||||
int endIndex = Math.min(recipes.size(), startIndex + recipesPerPage);
|
||||
|
||||
// Base positions relative to guiLeft and guiTop.
|
||||
int baseX = guiLeft + 4;
|
||||
int baseY = guiTop + 28; // first row = guiTop + 28
|
||||
int colSpacing = 124; // horizontal spacing between columns
|
||||
int rowSpacing = 35; // vertical spacing so row1 = guiTop + 28 + 35
|
||||
|
||||
// Create lists to collect overlay data.
|
||||
List<ItemOverlayData> itemOverlays = new ArrayList<ItemOverlayData>();
|
||||
List<TextOverlayData> textOverlays = new ArrayList<TextOverlayData>();
|
||||
|
||||
for (int i = startIndex; i < endIndex; i++) {
|
||||
RecipeAnvil recipe = recipes.get(i);
|
||||
if(!recipe.isValid())
|
||||
continue;
|
||||
|
||||
int localIndex = i - startIndex; // 0 to 7
|
||||
int col = localIndex / 4; // 0 for left column, 1 for right column
|
||||
int row = localIndex % 4; // rows 0..3
|
||||
|
||||
int slotX = baseX + col * colSpacing;
|
||||
int slotY = baseY + row * rowSpacing;
|
||||
|
||||
// Draw slot backgrounds for two input slots.
|
||||
mc.renderEngine.bindTexture(SLOT_TEXTURE);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
// Left slot (item to repair)
|
||||
drawTexturedModalRect(slotX, slotY, 0, 0, 18, 18);
|
||||
// Middle slot (repair material)
|
||||
drawTexturedModalRect(slotX + 22, slotY, 0, 0, 18, 18);
|
||||
|
||||
// Draw the item-to-repair at 50% durability.
|
||||
ItemStack toRepair = recipe.itemToRepair;
|
||||
ItemStack halfItem = null;
|
||||
if (toRepair != null) {
|
||||
halfItem = toRepair.copy();
|
||||
if (halfItem.isItemStackDamageable()) {
|
||||
int halfDamage = halfItem.getMaxDamage() / 2;
|
||||
halfItem.setItemDamage(halfDamage);
|
||||
}
|
||||
drawItem(halfItem, slotX + 1, slotY + 1, mouseX, mouseY);
|
||||
// Instead of drawing overlay immediately, add to list.
|
||||
if (func_146978_c((slotX+1) - guiLeft, (slotY+1) - guiTop, 16, 16, mouseX, mouseY)) {
|
||||
itemOverlays.add(new ItemOverlayData(slotX+1, slotY+1, halfItem));
|
||||
}
|
||||
}
|
||||
|
||||
// Draw the repair material.
|
||||
ItemStack material = recipe.repairMaterial;
|
||||
if (material != null) {
|
||||
drawItem(material, slotX + 23, slotY + 1, mouseX, mouseY);
|
||||
if (func_146978_c((slotX+23) - guiLeft, (slotY+1) - guiTop, 16, 16, mouseX, mouseY)) {
|
||||
itemOverlays.add(new ItemOverlayData(slotX+23, slotY+1, material));
|
||||
}
|
||||
}
|
||||
|
||||
// Draw the output item fully repaired (damage = 0).
|
||||
int outputX = (col == 0) ? (guiLeft + 103) : (guiLeft + 229);
|
||||
ItemStack fullOutput = null;
|
||||
if (recipe.itemToRepair != null) {
|
||||
fullOutput = recipe.itemToRepair.copy();
|
||||
if (fullOutput.isItemStackDamageable()) {
|
||||
fullOutput.setItemDamage(0);
|
||||
}
|
||||
drawItem(fullOutput, outputX, slotY, mouseX, mouseY);
|
||||
if (func_146978_c(outputX - guiLeft, slotY - guiTop, 16, 16, mouseX, mouseY)) {
|
||||
itemOverlays.add(new ItemOverlayData(outputX, slotY, fullOutput));
|
||||
}
|
||||
}
|
||||
|
||||
// Draw the percentage text.
|
||||
int percentCenterX = (col == 0) ? (guiLeft + 57) : (guiLeft + 57 + colSpacing);
|
||||
String percentText = Math.round(recipe.getRepairPercentage()) + "%";
|
||||
int percentWidth = fontRendererObj.getStringWidth(percentText);
|
||||
int percentTextX = percentCenterX - (percentWidth / 2);
|
||||
int percentTextY = slotY + 4 + row;
|
||||
fontRendererObj.drawString(percentText, percentTextX, percentTextY, CustomNpcResourceListener.DefaultTextColor);
|
||||
// Add text overlay for percentage with the full unrounded value.
|
||||
if (func_146978_c(percentTextX - guiLeft, percentTextY - guiTop, percentWidth, fontRendererObj.FONT_HEIGHT, mouseX, mouseY)) {
|
||||
textOverlays.add(new TextOverlayData(percentTextX, percentTextY, percentWidth, fontRendererObj.FONT_HEIGHT, String.valueOf(recipe.getRepairPercentage())));
|
||||
}
|
||||
|
||||
if(!recipe.availability.isDefault()){
|
||||
if(!recipe.availability.isAvailable(this.player)){
|
||||
String helpChar = "?";
|
||||
float scale = 1F; // Adjust for a very small size
|
||||
int questionWidth = (int)(fontRendererObj.getStringWidth(helpChar) * scale);
|
||||
int questionHeight = (int)(fontRendererObj.FONT_HEIGHT * scale);
|
||||
// Center the "?" under the percentage text.
|
||||
int questionX = percentCenterX - (questionWidth / 2) - 1 - row;
|
||||
int questionY = percentTextY + fontRendererObj.FONT_HEIGHT; // You can tweak the vertical offset if needed
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(questionX, questionY, 0);
|
||||
GL11.glScalef(scale, scale, 1.0F);
|
||||
|
||||
fontRendererObj.drawString(helpChar, 0, 0, 0xbd3e35);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
if (func_146978_c(questionX - guiLeft, questionY - guiTop, questionWidth, questionHeight, mouseX, mouseY)) {
|
||||
List<String> availableText = recipe.availability.isAvailableText(this.player);
|
||||
textOverlays.add(new TextOverlayData(questionX, questionY, questionWidth, questionHeight, availableText));
|
||||
}
|
||||
} else {
|
||||
// Draw a very small "?" under the percentage text.
|
||||
String helpChar = "!";
|
||||
float scale = 1F; // Adjust for a very small size
|
||||
int questionWidth = (int)(fontRendererObj.getStringWidth(helpChar) * scale);
|
||||
int questionHeight = (int)(fontRendererObj.FONT_HEIGHT * scale);
|
||||
// Center the "?" under the percentage text.
|
||||
int questionX = percentCenterX - (questionWidth / 2) - 1 - row;
|
||||
int questionY = percentTextY + fontRendererObj.FONT_HEIGHT; // You can tweak the vertical offset if needed
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(questionX, questionY, 0);
|
||||
GL11.glScalef(scale, scale, 1.0F);
|
||||
|
||||
fontRendererObj.drawString(helpChar, 0, 0, CustomNpcResourceListener.DefaultTextColor);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
// When the "!" is hovered, add its tooltip overlay.
|
||||
if (func_146978_c(questionX - guiLeft, questionY - guiTop, questionWidth, questionHeight, mouseX, mouseY)) {
|
||||
textOverlays.add(new TextOverlayData(questionX, questionY, questionWidth, questionHeight, StatCollector.translateToLocal("gui.available")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Draw XP cost with scaling.
|
||||
String xpCostStr = formatXpCost(recipe.getXpCost());
|
||||
int digitCount = xpCostStr.length();
|
||||
float xpScale = 1.0F - 0.1F * (digitCount - 1);
|
||||
int rawTextWidth = fontRendererObj.getStringWidth(xpCostStr);
|
||||
int scaledTextWidth = (int)(rawTextWidth * xpScale);
|
||||
int xpCenterX = (col == 0) ? (guiLeft + 76) : (guiLeft + 76 + colSpacing);
|
||||
int xpTextX = xpCenterX - (scaledTextWidth / 2) + col;
|
||||
int xpTextY = slotY - 4 + row;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(xpTextX, xpTextY, 0);
|
||||
GL11.glScalef(xpScale, xpScale, 1.0F);
|
||||
fontRendererObj.drawString(xpCostStr, 0, 0, 0x4ac26a);
|
||||
GL11.glPopMatrix();
|
||||
// Add text overlay for XP cost with the full (unformatted) number.
|
||||
int xpBoxWidth = scaledTextWidth;
|
||||
int xpBoxHeight = fontRendererObj.FONT_HEIGHT;
|
||||
if (func_146978_c(xpTextX - guiLeft, xpTextY - guiTop, xpBoxWidth, xpBoxHeight, mouseX, mouseY)) {
|
||||
textOverlays.add(new TextOverlayData(xpTextX, xpTextY, xpBoxWidth, xpBoxHeight, String.valueOf(recipe.getXpCost())));
|
||||
}
|
||||
}
|
||||
|
||||
for (ItemOverlayData iod : itemOverlays) {
|
||||
this.renderToolTip(iod.item, mouseX, mouseY);
|
||||
}
|
||||
|
||||
for (TextOverlayData tod : textOverlays) {
|
||||
this.drawHoveringText(tod.textLines, mouseX, mouseY, this.fontRendererObj);
|
||||
}
|
||||
}
|
||||
protected boolean func_146978_c(int p_146978_1_, int p_146978_2_, int p_146978_3_, int p_146978_4_, int p_146978_5_, int p_146978_6_) {
|
||||
int k1 = this.guiLeft;
|
||||
int l1 = this.guiTop;
|
||||
p_146978_5_ -= k1;
|
||||
p_146978_6_ -= l1;
|
||||
return p_146978_5_ >= p_146978_1_ - 1 && p_146978_5_ < p_146978_1_ + p_146978_3_ + 1 && p_146978_6_ >= p_146978_2_ - 1 && p_146978_6_ < p_146978_2_ + p_146978_4_ + 1;
|
||||
}
|
||||
|
||||
private String formatXpCost(int xp) {
|
||||
if (xp < 1000) {
|
||||
return String.valueOf(xp);
|
||||
}
|
||||
double xpK = xp / 1000.0;
|
||||
if (xpK == (int)xpK) {
|
||||
return ((int)xpK) + "K";
|
||||
} else {
|
||||
return String.format("%.1fK", xpK);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawItem(ItemStack item, int x, int y, int mouseX, int mouseY) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
itemRender.zLevel = 100.0F;
|
||||
itemRender.renderItemAndEffectIntoGUI(fontRendererObj, mc.renderEngine, item, x, y);
|
||||
itemRender.renderItemOverlayIntoGUI(fontRendererObj, mc.renderEngine, item, x, y);
|
||||
itemRender.zLevel = 0.0F;
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package noppes.npcs.client.gui.player;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.player.SaveSignPacket;
|
||||
import noppes.npcs.NoppesUtilPlayer;
|
||||
import noppes.npcs.blocks.tiles.TileBigSign;
|
||||
import noppes.npcs.client.gui.SubGuiNpcTextArea;
|
||||
@@ -16,6 +18,6 @@ public class GuiBigSign extends SubGuiNpcTextArea{
|
||||
@Override
|
||||
public void close(){
|
||||
super.close();
|
||||
NoppesUtilPlayer.sendData(EnumPlayerPacket.SignSave, tile.xCoord, tile.yCoord, tile.zCoord, text);
|
||||
PacketClient.sendClient(new SaveSignPacket(tile.xCoord, tile.yCoord, tile.zCoord, text));
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,8 @@ package noppes.npcs.client.gui.player;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.player.SaveBookPacket;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
@@ -178,7 +180,7 @@ public class GuiBook extends GuiScreen
|
||||
this.bookObj.func_150996_a(Items.written_book);
|
||||
}
|
||||
|
||||
NoppesUtilPlayer.sendData(EnumPlayerPacket.SaveBook, x, y, z, sign, bookObj.writeToNBT(new NBTTagCompound()));
|
||||
PacketClient.sendClient(new SaveBookPacket(x, y, z, sign, bookObj.writeToNBT(new NBTTagCompound())));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package noppes.npcs.client.gui.player;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.player.CheckPlayerValue;
|
||||
import kamkeel.npcs.network.packets.player.DialogSelectPacket;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
@@ -12,7 +15,6 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.NoppesStringUtils;
|
||||
import noppes.npcs.NoppesUtilPlayer;
|
||||
import noppes.npcs.api.handler.data.IDialogImage;
|
||||
import noppes.npcs.client.ClientProxy;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
@@ -22,7 +24,6 @@ import noppes.npcs.client.gui.util.GuiNPCInterface;
|
||||
import noppes.npcs.client.gui.util.IGuiClose;
|
||||
import noppes.npcs.config.ConfigClient;
|
||||
import noppes.npcs.constants.EnumOptionType;
|
||||
import noppes.npcs.constants.EnumPlayerPacket;
|
||||
import noppes.npcs.controllers.data.Dialog;
|
||||
import noppes.npcs.controllers.data.DialogImage;
|
||||
import noppes.npcs.controllers.data.DialogOption;
|
||||
@@ -134,8 +135,8 @@ public class GuiDialogInteract extends GuiNPCInterface implements IGuiClose
|
||||
float f7 = npc.rotationYawHead;
|
||||
float f5 = (float)(l) - i;
|
||||
float f6 = (float)(i1 - 50) - j;
|
||||
int rotation = npc.ai.orientation;
|
||||
npc.ai.orientation = 0;
|
||||
int rotation = npc.ais.orientation;
|
||||
npc.ais.orientation = 0;
|
||||
GL11.glRotatef(135F, 0.0F, 1.0F, 0.0F);
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
GL11.glRotatef(-135F, 0.0F, 1.0F, 0.0F);
|
||||
@@ -152,7 +153,7 @@ public class GuiDialogInteract extends GuiNPCInterface implements IGuiClose
|
||||
RenderManager.instance.renderEntityWithPosYaw(npc, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F);
|
||||
} catch(Exception ignored){}
|
||||
|
||||
npc.ai.orientation = rotation;
|
||||
npc.ais.orientation = rotation;
|
||||
npc.renderYawOffset = f2;
|
||||
npc.rotationYaw = f3;
|
||||
npc.rotationPitch = f4;
|
||||
@@ -593,7 +594,7 @@ public class GuiDialogInteract extends GuiNPCInterface implements IGuiClose
|
||||
handleDialogSelection();
|
||||
}
|
||||
if (closeOnEsc && (i == 1 || isInventoryKey(i))){
|
||||
NoppesUtilPlayer.sendData(EnumPlayerPacket.Dialog, dialog.id, -1);
|
||||
PacketClient.sendClient(new DialogSelectPacket(dialog.id, -1));
|
||||
closed();
|
||||
close();
|
||||
}
|
||||
@@ -613,7 +614,7 @@ public class GuiDialogInteract extends GuiNPCInterface implements IGuiClose
|
||||
optionId = selected;
|
||||
else if(!options.isEmpty())
|
||||
optionId = options.get(selected);
|
||||
NoppesUtilPlayer.sendData(EnumPlayerPacket.Dialog, dialog.id, optionId);
|
||||
PacketClient.sendClient(new DialogSelectPacket(dialog.id, optionId));
|
||||
if(dialog == null || !dialog.hasOtherOptions() || options.isEmpty()){
|
||||
closed();
|
||||
close();
|
||||
@@ -644,7 +645,7 @@ public class GuiDialogInteract extends GuiNPCInterface implements IGuiClose
|
||||
}
|
||||
private void closed(){
|
||||
grabMouse(false);
|
||||
NoppesUtilPlayer.sendData(EnumPlayerPacket.CheckQuestCompletion);
|
||||
PacketClient.sendClient(new CheckPlayerValue(CheckPlayerValue.Type.CheckQuestCompletion));
|
||||
}
|
||||
|
||||
public void save() {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package noppes.npcs.client.gui.player;
|
||||
|
||||
import kamkeel.npcs.network.packets.player.MailActionPacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiYesNo;
|
||||
import net.minecraft.client.gui.GuiYesNoCallback;
|
||||
@@ -18,16 +19,16 @@ import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
public class GuiMailbox extends GuiNPCInterface implements IGuiData, ICustomScrollListener, GuiYesNoCallback{
|
||||
|
||||
|
||||
private GuiCustomScroll scroll;
|
||||
private PlayerMailData data;
|
||||
private PlayerMail selected;
|
||||
|
||||
|
||||
public GuiMailbox() {
|
||||
super();
|
||||
xSize = 256;
|
||||
setBackground("menubg.png");
|
||||
NoppesUtilPlayer.sendData(EnumPlayerPacket.MailGet);
|
||||
MailActionPacket.RequestMailData();
|
||||
}
|
||||
public void initGui()
|
||||
{
|
||||
@@ -39,7 +40,7 @@ public class GuiMailbox extends GuiNPCInterface implements IGuiData, ICustomScro
|
||||
scroll.guiLeft = guiLeft + 4;
|
||||
scroll.guiTop = guiTop + 4;
|
||||
addScroll(scroll);
|
||||
|
||||
|
||||
String title = StatCollector.translateToLocal("mailbox.name");
|
||||
int x = (xSize - this.fontRendererObj.getStringWidth(title)) / 2;
|
||||
|
||||
@@ -81,7 +82,7 @@ public class GuiMailbox extends GuiNPCInterface implements IGuiData, ICustomScro
|
||||
public void confirmClicked(boolean flag, int i)
|
||||
{
|
||||
if(flag && selected != null){
|
||||
NoppesUtilPlayer.sendData(EnumPlayerPacket.MailDelete, selected.time, selected.sender);
|
||||
MailActionPacket.DeleteMail(selected.time, selected.sender);
|
||||
selected = null;
|
||||
}
|
||||
NoppesUtil.openGUI(player, this);
|
||||
@@ -94,7 +95,7 @@ public class GuiMailbox extends GuiNPCInterface implements IGuiData, ICustomScro
|
||||
if(id == 0){
|
||||
GuiMailmanWrite.parent = this;
|
||||
GuiMailmanWrite.mail = selected;
|
||||
NoppesUtilPlayer.sendData(EnumPlayerPacket.MailboxOpenMail, selected.time, selected.sender);
|
||||
MailActionPacket.OpenMail(selected.time, selected.sender);
|
||||
selected = null;
|
||||
scroll.selected = -1;
|
||||
}
|
||||
@@ -103,7 +104,7 @@ public class GuiMailbox extends GuiNPCInterface implements IGuiData, ICustomScro
|
||||
displayGuiScreen(guiyesno);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int i, int j, int k)
|
||||
{
|
||||
@@ -120,14 +121,14 @@ public class GuiMailbox extends GuiNPCInterface implements IGuiData, ICustomScro
|
||||
}
|
||||
@Override
|
||||
public void save() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
|
||||
}
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
PlayerMailData data = new PlayerMailData();
|
||||
data.loadNBTData(compound);
|
||||
|
||||
|
||||
List<String> list = new ArrayList<String>();
|
||||
Collections.sort(data.playermail, new Comparator<PlayerMail>(){
|
||||
public int compare(PlayerMail o1, PlayerMail o2){
|
||||
@@ -150,10 +151,10 @@ public class GuiMailbox extends GuiNPCInterface implements IGuiData, ICustomScro
|
||||
GuiCustomScroll guiCustomScroll) {
|
||||
selected = data.playermail.get(guiCustomScroll.selected);
|
||||
initGui();
|
||||
|
||||
|
||||
if(selected != null && !selected.beenRead){
|
||||
selected.beenRead = true;
|
||||
NoppesUtilPlayer.sendData(EnumPlayerPacket.MailRead, selected.time, selected.sender);
|
||||
MailActionPacket.ReadMail(selected.time, selected.sender);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package noppes.npcs.client.gui.player;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import kamkeel.npcs.network.packets.player.MailActionPacket;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
@@ -38,15 +39,15 @@ public class GuiMailmanWrite extends GuiContainerNPCInterface implements ITextfi
|
||||
private NBTTagList bookPages;
|
||||
private GuiButtonNextPage buttonNextPage;
|
||||
private GuiButtonNextPage buttonPreviousPage;
|
||||
|
||||
|
||||
private boolean canEdit;
|
||||
private boolean canSend;
|
||||
|
||||
/** The GuiButton to sign this book. */
|
||||
|
||||
|
||||
public static GuiScreen parent;
|
||||
public static PlayerMail mail = new PlayerMail();
|
||||
|
||||
|
||||
private Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
private String username = "";
|
||||
@@ -105,7 +106,7 @@ public class GuiMailmanWrite extends GuiContainerNPCInterface implements ITextfi
|
||||
addLabel(new GuiNpcLabel(0, "mailbox.sender", guiLeft + 170, guiTop + 32, 0));
|
||||
else
|
||||
addLabel(new GuiNpcLabel(0, "mailbox.username", guiLeft + 170, guiTop + 32, 0));
|
||||
|
||||
|
||||
if(canEdit && !canSend)
|
||||
addTextField(new GuiNpcTextField(2, this, fontRendererObj, guiLeft + 170, guiTop + 42, 114, 20, mail.sender));
|
||||
else if(canEdit)
|
||||
@@ -124,7 +125,7 @@ public class GuiMailmanWrite extends GuiContainerNPCInterface implements ITextfi
|
||||
addButton(new GuiNpcButton(0, this.guiLeft + 200, guiTop + 171, 60, 20, "gui.done"));
|
||||
else if(canEdit)
|
||||
addButton(new GuiNpcButton(0, this.guiLeft + 200, guiTop + 171, 60, 20, "mailbox.send"));
|
||||
|
||||
|
||||
if(!canEdit && !canSend)
|
||||
addButton(new GuiNpcButton(4, this.guiLeft + 200, guiTop + 171, 60, 20, "selectWorld.deleteButton"));
|
||||
if(!canEdit || canSend)
|
||||
@@ -148,12 +149,12 @@ public class GuiMailmanWrite extends GuiContainerNPCInterface implements ITextfi
|
||||
this.buttonNextPage.setVisible(this.currPage < this.bookTotalPages - 1 || this.canEdit);
|
||||
this.buttonPreviousPage.setVisible(this.currPage > 0);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void confirmClicked(boolean flag, int i)
|
||||
{
|
||||
if(flag){
|
||||
NoppesUtilPlayer.sendData(EnumPlayerPacket.MailDelete, mail.time, mail.sender);
|
||||
MailActionPacket.DeleteMail(mail.time, mail.sender);
|
||||
close();
|
||||
}
|
||||
else
|
||||
@@ -172,7 +173,7 @@ public class GuiMailmanWrite extends GuiContainerNPCInterface implements ITextfi
|
||||
if(id == 0){
|
||||
mail.message.setTag("pages", bookPages);
|
||||
if(canSend)
|
||||
NoppesUtilPlayer.sendData(EnumPlayerPacket.MailSend, this.username, mail.writeNBT());
|
||||
MailActionPacket.SendMail(this.username, mail.writeNBT());
|
||||
else
|
||||
close();
|
||||
}
|
||||
@@ -327,7 +328,7 @@ public class GuiMailmanWrite extends GuiContainerNPCInterface implements ITextfi
|
||||
{
|
||||
s1 = this.bookPages.getStringTagAt(this.currPage);
|
||||
}
|
||||
|
||||
|
||||
if(canEdit){
|
||||
if (mc.fontRenderer.getBidiFlag())
|
||||
{
|
||||
@@ -349,14 +350,14 @@ public class GuiMailmanWrite extends GuiContainerNPCInterface implements ITextfi
|
||||
|
||||
this.drawGradientRect(guiLeft + 175, guiTop + 136, guiLeft + 269, guiTop + 154, -1072689136, -804253680);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
|
||||
|
||||
this.mc.getTextureManager().bindTexture(bookWidgets);
|
||||
for(int i = 0; i < 4; i++)
|
||||
this.drawTexturedModalRect(guiLeft + 175 + i * 24, guiTop + 134, 0, 22, 24, 24);
|
||||
|
||||
|
||||
super.drawScreen(par1, par2, par3);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void close(){
|
||||
@@ -390,6 +391,6 @@ public class GuiMailmanWrite extends GuiContainerNPCInterface implements ITextfi
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,17 @@
|
||||
package noppes.npcs.client.gui.player;
|
||||
|
||||
import kamkeel.npcs.network.packets.player.BankActionPacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.NoppesUtilPlayer;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.client.CustomNpcResourceListener;
|
||||
import noppes.npcs.client.gui.util.GuiContainerNPCInterface;
|
||||
import noppes.npcs.client.gui.util.GuiNpcButton;
|
||||
import noppes.npcs.client.gui.util.IGuiData;
|
||||
import noppes.npcs.constants.EnumPlayerPacket;
|
||||
import noppes.npcs.containers.ContainerNPCBankInterface;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -26,7 +25,7 @@ public class GuiNPCBankChest extends GuiContainerNPCInterface implements IGuiDat
|
||||
private int maxSlots = 1;
|
||||
private int unlockedSlots = 1;
|
||||
private ItemStack currency;
|
||||
|
||||
|
||||
public GuiNPCBankChest(EntityNPCInterface npc,ContainerNPCBankInterface container)
|
||||
{
|
||||
super(npc,container);
|
||||
@@ -35,7 +34,7 @@ public class GuiNPCBankChest extends GuiContainerNPCInterface implements IGuiDat
|
||||
allowUserInput = false; //allowUserInput
|
||||
ySize = 235;
|
||||
closeOnEsc = true;
|
||||
|
||||
|
||||
}
|
||||
@Override
|
||||
public void initGui(){
|
||||
@@ -70,18 +69,18 @@ public class GuiNPCBankChest extends GuiContainerNPCInterface implements IGuiDat
|
||||
int id = guibutton.id;
|
||||
if(id < 6){
|
||||
close();
|
||||
NoppesUtilPlayer.sendData(EnumPlayerPacket.BankSlotOpen, id, container.bankid);
|
||||
BankActionPacket.Open(container.bankid, id);
|
||||
}
|
||||
if(id == 8){
|
||||
NoppesUtilPlayer.sendData(EnumPlayerPacket.BankUnlock);
|
||||
BankActionPacket.Unlock();
|
||||
}
|
||||
if(id == 9){
|
||||
NoppesUtilPlayer.sendData(EnumPlayerPacket.BankUpgrade);
|
||||
BankActionPacket.Upgrade();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j)
|
||||
{
|
||||
@@ -91,8 +90,8 @@ public class GuiNPCBankChest extends GuiContainerNPCInterface implements IGuiDat
|
||||
int i1 = (height - ySize) / 2;
|
||||
drawTexturedModalRect(l, i1, 0, 0, xSize, 6);
|
||||
if(!container.isAvailable()){
|
||||
drawTexturedModalRect(l, i1 + 6, 0, 6, xSize, 64);
|
||||
drawTexturedModalRect(l, i1 + 70, 0, 124, xSize, 222-124);
|
||||
drawTexturedModalRect(l, i1 + 6, 0, 6, xSize, 64);
|
||||
drawTexturedModalRect(l, i1 + 70, 0, 124, xSize, 222-124);
|
||||
int x = guiLeft + 30;
|
||||
int y = guiTop + 8;
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("bank.unlockCosts")+":", x , y + 4 , CustomNpcResourceListener.DefaultTextColor);
|
||||
@@ -100,7 +99,7 @@ public class GuiNPCBankChest extends GuiContainerNPCInterface implements IGuiDat
|
||||
}
|
||||
else if(container.isUpgraded()){
|
||||
drawTexturedModalRect(l, i1 + 60, 0, 60, xSize, 162);
|
||||
drawTexturedModalRect(l, i1 + 6, 0, 60, xSize, 64);
|
||||
drawTexturedModalRect(l, i1 + 6, 0, 60, xSize, 64);
|
||||
}
|
||||
else if(container.canBeUpgraded()){
|
||||
drawTexturedModalRect(l, i1 + 6, 0, 6, xSize, 216);
|
||||
@@ -136,7 +135,7 @@ public class GuiNPCBankChest extends GuiContainerNPCInterface implements IGuiDat
|
||||
{
|
||||
this.renderToolTip(item, mouseX, mouseY);
|
||||
}
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
}
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
package noppes.npcs.client.gui.player;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.client.CustomNpcResourceListener;
|
||||
import noppes.npcs.client.gui.util.GuiContainerNPCInterface;
|
||||
import noppes.npcs.client.gui.util.GuiNpcButton;
|
||||
import noppes.npcs.containers.ContainerAnvilRepair;
|
||||
import noppes.npcs.controllers.RecipeController;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class GuiNpcAnvil extends GuiContainerNPCInterface {
|
||||
|
||||
private final ResourceLocation resource = new ResourceLocation("customnpcs", "textures/gui/anvil.png");
|
||||
private ContainerAnvilRepair container;
|
||||
private GuiNpcButton button;
|
||||
|
||||
public GuiNpcAnvil(ContainerAnvilRepair container) {
|
||||
super(null, container);
|
||||
this.container = container;
|
||||
this.title = "";
|
||||
allowUserInput = false;
|
||||
closeOnEsc = true;
|
||||
ySize = 180;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
addButton(button = new GuiNpcButton(0, guiLeft + 158, guiTop + 4, 12, 20, "..."));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buttonEvent(GuiButton guibutton) {
|
||||
displayGuiScreen(new GuiAnvilRecipes());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
|
||||
// Enable the button if there are any anvil recipes.
|
||||
button.enabled = RecipeController.Instance != null && !RecipeController.Instance.getAnvilList().isEmpty();
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
mc.renderEngine.bindTexture(resource);
|
||||
int l = (width - xSize) / 2;
|
||||
int i1 = (height - ySize) / 2;
|
||||
drawTexturedModalRect(l, i1, 0, 0, xSize, ySize);
|
||||
super.drawGuiContainerBackgroundLayer(partialTicks, mouseX, mouseY);
|
||||
|
||||
// Draw title and player's inventory label.
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("tile.anvil.name"), guiLeft + 4, guiTop + 4, CustomNpcResourceListener.DefaultTextColor);
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), guiLeft + 4, guiTop + 87, CustomNpcResourceListener.DefaultTextColor);
|
||||
|
||||
// Compute the repair status message based on container.repairCost and player's XP.
|
||||
String status = "";
|
||||
if (container.repairCost > 0) {
|
||||
if (container.repairCost > mc.thePlayer.experienceTotal) {
|
||||
status = "Repair cost: " + container.repairCost + " XP";
|
||||
} else {
|
||||
status = "Repair cost: " + container.repairCost + " XP";
|
||||
}
|
||||
} else {
|
||||
// If there is a damaged item that is fully repaired.
|
||||
if (container.anvilMatrix.getStackInRowAndColumn(0, 0) != null &&
|
||||
container.anvilMatrix.getStackInRowAndColumn(0, 0).isItemStackDamageable() &&
|
||||
container.anvilMatrix.getStackInRowAndColumn(0, 0).getItemDamage() <= 0) {
|
||||
status = "Item is already fully repaired";
|
||||
}
|
||||
}
|
||||
int textColor = CustomNpcResourceListener.DefaultTextColor;
|
||||
if (container.repairCost > mc.thePlayer.experienceTotal) {
|
||||
textColor = 0xFF0000; // red when not enough XP
|
||||
}
|
||||
fontRendererObj.drawString(status, guiLeft + 5, guiTop + 75, textColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
// Nothing to save.
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ public class GuiNpcCarpentryBench extends GuiContainerNPCInterface
|
||||
private final ResourceLocation resource = new ResourceLocation("customnpcs","textures/gui/carpentry.png");
|
||||
private ContainerCarpentryBench container;
|
||||
private GuiNpcButton button;
|
||||
|
||||
|
||||
public GuiNpcCarpentryBench(ContainerCarpentryBench container)
|
||||
{
|
||||
super(null,container);
|
||||
@@ -38,7 +38,7 @@ public class GuiNpcCarpentryBench extends GuiContainerNPCInterface
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j)
|
||||
{
|
||||
button.enabled = RecipeController.Instance != null && !RecipeController.Instance.anvilRecipes.isEmpty();
|
||||
button.enabled = RecipeController.Instance != null && !RecipeController.Instance.carpentryRecipes.isEmpty();
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
mc.renderEngine.bindTexture(resource);
|
||||
int l = (width - xSize) / 2;
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package noppes.npcs.client.gui.player;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.player.FollowerPacket;
|
||||
import kamkeel.npcs.network.packets.player.GetNPCRole;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -22,14 +25,14 @@ public class GuiNpcFollower extends GuiContainerNPCInterface implements IGuiDat
|
||||
private final ResourceLocation resource = new ResourceLocation("customnpcs","textures/gui/follower.png");
|
||||
private EntityNPCInterface npc;
|
||||
private RoleFollower role;
|
||||
|
||||
|
||||
public GuiNpcFollower(EntityNPCInterface npc,ContainerNPCFollower container){
|
||||
super(npc, container);
|
||||
this.npc = npc;
|
||||
role = (RoleFollower) npc.roleInterface;
|
||||
closeOnEsc = true;
|
||||
|
||||
NoppesUtilPlayer.sendData(EnumPlayerPacket.RoleGet);
|
||||
|
||||
PacketClient.sendClient(new GetNPCRole());
|
||||
}
|
||||
@Override
|
||||
public void initGui(){
|
||||
@@ -44,10 +47,10 @@ public class GuiNpcFollower extends GuiContainerNPCInterface implements IGuiDat
|
||||
super.actionPerformed(guibutton);
|
||||
int id = guibutton.id;
|
||||
if(id == 4){
|
||||
NoppesUtilPlayer.sendData(EnumPlayerPacket.FollowerState);
|
||||
PacketClient.sendClient(new FollowerPacket(FollowerPacket.Action.State));
|
||||
}
|
||||
if(id == 5){
|
||||
NoppesUtilPlayer.sendData(EnumPlayerPacket.FollowerExtend);
|
||||
PacketClient.sendClient(new FollowerPacket(FollowerPacket.Action.Extend));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +61,7 @@ public class GuiNpcFollower extends GuiContainerNPCInterface implements IGuiDat
|
||||
if(role.getDaysLeft() <= 1)
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("follower.daysleft")+": " + StatCollector.translateToLocal("follower.lastday"), 62, 94, CustomNpcResourceListener.DefaultTextColor);
|
||||
else
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("follower.daysleft") + ": " + (role.getDaysLeft()-1), 62, 94, CustomNpcResourceListener.DefaultTextColor);
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("follower.daysleft") + ": " + (role.getDaysLeft()-1), 62, 94, CustomNpcResourceListener.DefaultTextColor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,9 +81,9 @@ public class GuiNpcFollower extends GuiContainerNPCInterface implements IGuiDat
|
||||
int days = 1;
|
||||
if(role.rates.containsKey(id))
|
||||
days = role.rates.get(id);
|
||||
|
||||
|
||||
int yOffset = index * 20;
|
||||
|
||||
|
||||
int x = guiLeft + 68;
|
||||
int y = guiTop + yOffset + 4;
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
@@ -89,22 +92,22 @@ public class GuiNpcFollower extends GuiContainerNPCInterface implements IGuiDat
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
itemRender.renderItemIntoGUI(fontRendererObj, mc.renderEngine, itemstack, x + 11,y);
|
||||
itemRender.renderItemOverlayIntoGUI(fontRendererObj, mc.renderEngine, itemstack, x+11,y);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(32826 /*GL_RESCALE_NORMAL_EXT*/);
|
||||
|
||||
|
||||
String daysS = days + " " + ((days == 1)?StatCollector.translateToLocal("follower.day"):StatCollector.translateToLocal("follower.days"));
|
||||
fontRendererObj.drawString(" = "+daysS, x + 27, y + 4, CustomNpcResourceListener.DefaultTextColor);
|
||||
//fontRenderer.drawString(quantity, x + 0 + (12-fontRenderer.getStringWidth(quantity))/2, y + 4, 0x404040);
|
||||
|
||||
|
||||
index++;
|
||||
}
|
||||
}
|
||||
this.drawNpc(33, 131);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
|
||||
|
||||
}
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package noppes.npcs.client.gui.player;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.player.FollowerPacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -41,7 +43,7 @@ public class GuiNpcFollowerHire extends GuiContainerNPCInterface
|
||||
super.actionPerformed(guibutton);
|
||||
if(guibutton.id == 5)
|
||||
{
|
||||
NoppesUtilPlayer.sendData(EnumPlayerPacket.FollowerHire);
|
||||
PacketClient.sendClient(new FollowerPacket(FollowerPacket.Action.Hire));
|
||||
close();
|
||||
}
|
||||
}
|
||||
@@ -68,10 +70,10 @@ public class GuiNpcFollowerHire extends GuiContainerNPCInterface
|
||||
int days = 1;
|
||||
if(role.rates.containsKey(id))
|
||||
days = role.rates.get(id);
|
||||
|
||||
|
||||
|
||||
|
||||
int yOffset = index * 26;
|
||||
|
||||
|
||||
int x = guiLeft + 78;
|
||||
int y = guiTop + yOffset + 10;
|
||||
GL11.glEnable(32826 /*GL_RESCALE_NORMAL_EXT*/);
|
||||
@@ -79,7 +81,7 @@ public class GuiNpcFollowerHire extends GuiContainerNPCInterface
|
||||
itemRender.renderItemIntoGUI(fontRendererObj, mc.renderEngine, itemstack, x + 11,y);
|
||||
itemRender.renderItemOverlayIntoGUI(fontRendererObj, mc.renderEngine, itemstack, x+11,y);
|
||||
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(32826 /*GL_RESCALE_NORMAL_EXT*/);
|
||||
|
||||
String daysS = days + " " + ((days == 1)?StatCollector.translateToLocal("follower.day"):StatCollector.translateToLocal("follower.days"));
|
||||
@@ -92,7 +94,7 @@ public class GuiNpcFollowerHire extends GuiContainerNPCInterface
|
||||
}
|
||||
index++;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@Override
|
||||
public void save() {
|
||||
|
||||
@@ -9,6 +9,8 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.client.CustomNpcResourceListener;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.controllers.RecipeController;
|
||||
import noppes.npcs.controllers.data.RecipeCarpentry;
|
||||
@@ -16,6 +18,7 @@ import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -33,7 +36,7 @@ public class GuiRecipes extends GuiNPCInterface
|
||||
this.xSize = 256;
|
||||
setBackground("recipes.png");
|
||||
this.closeOnEsc = true;
|
||||
recipes.addAll(RecipeController.Instance.anvilRecipes.values());
|
||||
recipes.addAll(RecipeController.Instance.carpentryRecipes.values());
|
||||
}
|
||||
@Override
|
||||
public void initGui(){
|
||||
@@ -47,7 +50,7 @@ public class GuiRecipes extends GuiNPCInterface
|
||||
|
||||
addButton(this.left = new GuiButtonNextPage(1, guiLeft + 150, guiTop + 164, true));
|
||||
addButton(this.right = new GuiButtonNextPage(2, guiLeft + 80, guiTop + 164, false));
|
||||
|
||||
|
||||
updateButton();
|
||||
}
|
||||
private void updateButton(){
|
||||
@@ -67,10 +70,10 @@ public class GuiRecipes extends GuiNPCInterface
|
||||
|
||||
private List<IRecipe> getSearchList(){
|
||||
if(search.isEmpty()){
|
||||
return new ArrayList<IRecipe>(RecipeController.Instance.anvilRecipes.values());
|
||||
return new ArrayList<IRecipe>(RecipeController.Instance.carpentryRecipes.values());
|
||||
}
|
||||
List<IRecipe> list = new ArrayList<IRecipe>();
|
||||
for(IRecipe recipe : RecipeController.Instance.anvilRecipes.values()){
|
||||
for(IRecipe recipe : RecipeController.Instance.carpentryRecipes.values()){
|
||||
if(recipe.getRecipeOutput() == null)
|
||||
continue;
|
||||
|
||||
@@ -96,65 +99,130 @@ public class GuiRecipes extends GuiNPCInterface
|
||||
page++;
|
||||
updateButton();
|
||||
}
|
||||
|
||||
|
||||
private static class ItemOverlayData {
|
||||
public final int x, y;
|
||||
public final ItemStack item;
|
||||
public ItemOverlayData(int x, int y, ItemStack item) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.item = item;
|
||||
}
|
||||
}
|
||||
|
||||
private static class TextOverlayData {
|
||||
public final int x, y, width, height;
|
||||
public final List<String> textLines;
|
||||
|
||||
public TextOverlayData(int x, int y, int width, int height, String text) {
|
||||
this(x, y, width, height, Arrays.asList(text));
|
||||
}
|
||||
|
||||
public TextOverlayData(int x, int y, int width, int height, List<String> textLines) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.textLines = textLines;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int xMouse, int yMouse, float f){
|
||||
super.drawScreen(xMouse, yMouse, f);
|
||||
mc.renderEngine.bindTexture(resource);
|
||||
|
||||
|
||||
label.label = page + 1 + "/" + MathHelper.ceiling_float_int(recipes.size() / 4f);
|
||||
label.x = guiLeft + (256 - Minecraft.getMinecraft().fontRenderer.getStringWidth(label.label)) / 2;
|
||||
for(int i = 0; i < 4; i++){
|
||||
int index = i + page * 4;
|
||||
if(index >= recipes.size())
|
||||
break;
|
||||
IRecipe irecipe = recipes.get(index);
|
||||
if(irecipe.getRecipeOutput() == null)
|
||||
continue;
|
||||
int x = guiLeft + 5 + i / 2 * 126;
|
||||
int y = guiTop + 15 + i % 2 * 76;
|
||||
drawItem(irecipe.getRecipeOutput(), x + 98, y + 28, xMouse, yMouse);
|
||||
if(irecipe instanceof RecipeCarpentry){
|
||||
RecipeCarpentry recipe = (RecipeCarpentry) irecipe;
|
||||
x += (72 - recipe.recipeWidth * 18) / 2;
|
||||
y += (72 - recipe.recipeHeight * 18) / 2;
|
||||
for(int j = 0; j < recipe.recipeWidth; j++){
|
||||
for(int k = 0; k < recipe.recipeHeight; k++){
|
||||
mc.renderEngine.bindTexture(resource);
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
drawTexturedModalRect(x + j * 18, y + k * 18, 0, 0, 18, 18);
|
||||
ItemStack item = recipe.getCraftingItem(j + k * recipe.recipeWidth);
|
||||
if(item == null)
|
||||
continue;
|
||||
drawItem(item, x + j * 18 + 1, y + k * 18 + 1, xMouse, yMouse);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for(int i = 0; i < 4; i++){
|
||||
int index = i + page * 4;
|
||||
if(index >= recipes.size())
|
||||
break;
|
||||
IRecipe irecipe = recipes.get(index);
|
||||
if(irecipe instanceof RecipeCarpentry){
|
||||
RecipeCarpentry recipe = (RecipeCarpentry) irecipe;
|
||||
if(recipe.getRecipeOutput() == null)
|
||||
continue;
|
||||
int x = guiLeft + 5 + i / 2 * 126;
|
||||
int y = guiTop + 15 + i % 2 * 76;
|
||||
drawOverlay(recipe.getRecipeOutput(), x + 98, y + 22, xMouse, yMouse);
|
||||
x += (72 - recipe.recipeWidth * 18) / 2;
|
||||
y += (72 - recipe.recipeHeight * 18) / 2;
|
||||
for(int j = 0; j < recipe.recipeWidth; j++){
|
||||
for(int k = 0; k < recipe.recipeHeight; k++){
|
||||
ItemStack item = recipe.getCraftingItem(j + k * recipe.recipeWidth);
|
||||
if(item == null)
|
||||
continue;
|
||||
drawOverlay(item, x + j * 18 + 1, y + k * 18 + 1, xMouse, yMouse);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<ItemOverlayData> itemOverlays = new ArrayList<ItemOverlayData>();
|
||||
List<TextOverlayData> textOverlays = new ArrayList<TextOverlayData>();
|
||||
|
||||
// Loop through recipes.
|
||||
for (int i = 0; i < 4; i++) {
|
||||
int index = i + page * 4;
|
||||
if (index >= recipes.size())
|
||||
break;
|
||||
IRecipe irecipe = recipes.get(index);
|
||||
if (irecipe.getRecipeOutput() == null)
|
||||
continue;
|
||||
int x = guiLeft + 5 + (i / 2) * 126;
|
||||
int y = guiTop + 15 + (i % 2) * 76;
|
||||
|
||||
drawItem(irecipe.getRecipeOutput(), x + 98, y + 28, xMouse, yMouse);
|
||||
if (func_146978_c((x+98) - guiLeft, (y+28) - guiTop, 16, 16, xMouse, yMouse)) {
|
||||
itemOverlays.add(new ItemOverlayData(x+98, y+28, irecipe.getRecipeOutput()));
|
||||
}
|
||||
|
||||
if (irecipe instanceof RecipeCarpentry) {
|
||||
RecipeCarpentry recipe = (RecipeCarpentry) irecipe;
|
||||
if (!recipe.isGlobal && recipe.availability != null && !recipe.availability.isDefault()) {
|
||||
int outputX = x + 98;
|
||||
int outputY = y + 38;
|
||||
float scale = 1.0F;
|
||||
String iconStr;
|
||||
int iconColor;
|
||||
if (!recipe.availability.isAvailable(mc.thePlayer)) {
|
||||
iconStr = "?";
|
||||
iconColor = 0xbd3e35;
|
||||
} else {
|
||||
iconStr = "!";
|
||||
iconColor = CustomNpcResourceListener.DefaultTextColor;
|
||||
}
|
||||
int iconWidth = (int)(fontRendererObj.getStringWidth(iconStr) * scale);
|
||||
int iconHeight = (int)(fontRendererObj.FONT_HEIGHT * scale);
|
||||
// Center the icon below the output slot (16x16 slot).
|
||||
int iconX = outputX + (16 - iconWidth) / 2;
|
||||
int iconY = outputY + 16;
|
||||
|
||||
// Render the icon.
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(iconX, iconY, 0);
|
||||
GL11.glScalef(scale, scale, 1.0F);
|
||||
fontRendererObj.drawString(iconStr, 0, 0, iconColor);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
// Instead of rendering the tooltip immediately, add it as a text overlay.
|
||||
if (func_146978_c(iconX - guiLeft, iconY - guiTop, iconWidth, iconHeight, xMouse, yMouse)) {
|
||||
List<String> tooltipLines = recipe.availability.isAvailableText(mc.thePlayer);
|
||||
if (tooltipLines.isEmpty()) {
|
||||
tooltipLines.add(StatCollector.translateToLocal("gui.available"));
|
||||
}
|
||||
textOverlays.add(new TextOverlayData(iconX, iconY, iconWidth, iconHeight, tooltipLines));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Draw the recipe grid (for RecipeCarpentry recipes).
|
||||
if (irecipe instanceof RecipeCarpentry) {
|
||||
RecipeCarpentry recipe = (RecipeCarpentry) irecipe;
|
||||
int gridX = x + (72 - recipe.recipeWidth * 18) / 2;
|
||||
int gridY = y + (72 - recipe.recipeHeight * 18) / 2;
|
||||
for (int j = 0; j < recipe.recipeWidth; j++) {
|
||||
for (int k = 0; k < recipe.recipeHeight; k++) {
|
||||
mc.renderEngine.bindTexture(resource);
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
drawTexturedModalRect(gridX + j * 18, gridY + k * 18, 0, 0, 18, 18);
|
||||
ItemStack item = recipe.getCraftingItem(j + k * recipe.recipeWidth);
|
||||
if (item == null)
|
||||
continue;
|
||||
drawItem(item, gridX + j * 18 + 1, gridY + k * 18 + 1, xMouse, yMouse);
|
||||
if (func_146978_c((gridX+j*18+1)-guiLeft, (gridY+k*18+1)-guiTop, 16, 16, xMouse, yMouse)) {
|
||||
itemOverlays.add(new ItemOverlayData(gridX+j*18+1, gridY+k*18+1, item));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Render any item tooltips.
|
||||
for (ItemOverlayData iod : itemOverlays) {
|
||||
this.renderToolTip(iod.item, xMouse, yMouse);
|
||||
}
|
||||
// Render all text overlays (each line from the availability tooltip will be on its own line).
|
||||
for (TextOverlayData tod : textOverlays) {
|
||||
this.drawHoveringText(tod.textLines, xMouse, yMouse, this.fontRendererObj);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawItem(ItemStack item, int x, int y, int xMouse, int yMouse){
|
||||
@@ -165,11 +233,11 @@ public class GuiRecipes extends GuiNPCInterface
|
||||
itemRender.renderItemAndEffectIntoGUI(fontRendererObj, mc.renderEngine, item, x, y);
|
||||
itemRender.renderItemOverlayIntoGUI(fontRendererObj, mc.renderEngine, item, x, y);
|
||||
itemRender.zLevel = 0.0F;
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
private void drawOverlay(ItemStack item, int x, int y, int xMouse, int yMouse){
|
||||
if (this.func_146978_c(x - guiLeft, y - guiTop, 16, 16, xMouse, yMouse)){
|
||||
this.renderToolTip(item, xMouse, yMouse);
|
||||
@@ -187,4 +255,4 @@ public class GuiRecipes extends GuiNPCInterface
|
||||
@Override
|
||||
public void save() {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package noppes.npcs.client.gui.player;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.player.TransportPacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
@@ -18,9 +20,9 @@ public class GuiTransportSelection extends GuiNPCInterface implements ITopButton
|
||||
protected int xSize;
|
||||
protected int guiLeft;
|
||||
protected int guiTop;
|
||||
|
||||
|
||||
private GuiCustomScroll scroll;
|
||||
|
||||
|
||||
public GuiTransportSelection(EntityNPCInterface npc) {
|
||||
super(npc);
|
||||
xSize = 176;
|
||||
@@ -43,7 +45,7 @@ public class GuiTransportSelection extends GuiNPCInterface implements ITopButton
|
||||
scroll.guiTop = guiTop + 20;
|
||||
addScroll(scroll);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void drawScreen(int i, int j, float f)
|
||||
{
|
||||
@@ -61,7 +63,7 @@ public class GuiTransportSelection extends GuiNPCInterface implements ITopButton
|
||||
String sel = scroll.getSelected();
|
||||
if(button.id == 0 && sel != null){
|
||||
close();
|
||||
NoppesUtilPlayer.sendData(EnumPlayerPacket.Transport,sel);
|
||||
PacketClient.sendClient(new TransportPacket(sel));
|
||||
}
|
||||
}
|
||||
// @Override
|
||||
@@ -82,7 +84,7 @@ public class GuiTransportSelection extends GuiNPCInterface implements ITopButton
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
}
|
||||
@@ -92,8 +94,8 @@ public class GuiTransportSelection extends GuiNPCInterface implements ITopButton
|
||||
}
|
||||
@Override
|
||||
public void setSelected(String selected) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
package noppes.npcs.client.gui.player.companion;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.player.CompanionActionPacket;
|
||||
import kamkeel.npcs.network.packets.player.GetNPCRole;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -28,7 +31,7 @@ public class GuiNpcCompanionStats extends GuiNPCInterface implements IGuiData {
|
||||
setBackground("companion.png");
|
||||
xSize = 171;
|
||||
ySize = 166;
|
||||
NoppesUtilPlayer.sendData(EnumPlayerPacket.RoleGet);
|
||||
PacketClient.sendClient(new GetNPCRole());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -41,11 +44,11 @@ public class GuiNpcCompanionStats extends GuiNPCInterface implements IGuiData {
|
||||
addLabel(new GuiNpcLabel(3, NoppesStringUtils.translate("companion.strength", ": ", npc.stats.getAttackStrength()), guiLeft + 4, y+=12));
|
||||
addLabel(new GuiNpcLabel(4, NoppesStringUtils.translate("companion.level", ": ", role.getTotalLevel()), guiLeft + 4, y+=12));
|
||||
addLabel(new GuiNpcLabel(5, NoppesStringUtils.translate("job.name", ": ", "gui.none"), guiLeft + 4, y+=12));
|
||||
|
||||
|
||||
addTopMenu(role, this, 1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void addTopMenu(RoleCompanion role, GuiScreen screen, int active){
|
||||
if(screen instanceof GuiNPCInterface){
|
||||
GuiNPCInterface gui = (GuiNPCInterface) screen;
|
||||
@@ -79,7 +82,7 @@ public class GuiNpcCompanionStats extends GuiNPCInterface implements IGuiData {
|
||||
CustomNpcs.proxy.openGui(npc, EnumGuiType.CompanionTalent);
|
||||
}
|
||||
if(id == 3){
|
||||
NoppesUtilPlayer.sendData(EnumPlayerPacket.CompanionOpenInv);
|
||||
CompanionActionPacket.OpenInventory();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,14 +90,14 @@ public class GuiNpcCompanionStats extends GuiNPCInterface implements IGuiData {
|
||||
public void drawScreen(int i, int j, float f) {
|
||||
super.drawScreen(i, j, f);
|
||||
if(isEating && !role.isEating()){
|
||||
NoppesUtilPlayer.sendData(EnumPlayerPacket.RoleGet);
|
||||
PacketClient.sendClient(new GetNPCRole());
|
||||
}
|
||||
|
||||
|
||||
isEating = role.isEating();
|
||||
super.drawNpc(34, 150);
|
||||
int y = drawHealth(guiTop + 88);
|
||||
}
|
||||
|
||||
|
||||
private int drawHealth(int y){
|
||||
this.mc.getTextureManager().bindTexture(icons);
|
||||
|
||||
@@ -102,23 +105,23 @@ public class GuiNpcCompanionStats extends GuiNPCInterface implements IGuiData {
|
||||
if(role.talents.containsKey(EnumCompanionTalent.ARMOR) || max > 0){
|
||||
for (int i = 0; i < 10; ++i){
|
||||
int x = guiLeft + 66 + i * 10;
|
||||
|
||||
|
||||
if (i * 2 + 1 < max){
|
||||
this.drawTexturedModalRect(x, y, 34, 9, 9, 9);
|
||||
}
|
||||
|
||||
|
||||
if (i * 2 + 1 == max){
|
||||
this.drawTexturedModalRect(x, y, 25, 9, 9, 9);
|
||||
}
|
||||
|
||||
|
||||
if (i * 2 + 1 > max){
|
||||
this.drawTexturedModalRect(x, y, 16, 9, 9, 9);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
y += 10;
|
||||
}
|
||||
|
||||
|
||||
max = MathHelper.ceiling_float_int(npc.getMaxHealth());
|
||||
int k = (int)npc.getHealth();
|
||||
float scale = 1;
|
||||
@@ -134,12 +137,12 @@ public class GuiNpcCompanionStats extends GuiNPCInterface implements IGuiData {
|
||||
if(k > i)
|
||||
this.drawTexturedModalRect(x, y + offset, 52 + i % 2 * 5, 0, i % 2 == 1?4:5, 9);
|
||||
}
|
||||
|
||||
|
||||
k = role.foodstats.getFoodLevel();
|
||||
y += 10;
|
||||
if(max > 20)
|
||||
y += 10;
|
||||
|
||||
|
||||
for(int i = 0; i < 20; i++){
|
||||
int x = guiLeft + 66 + i % 20 * 5;
|
||||
this.drawTexturedModalRect(x, y, 16 + i % 2 * 5, 27, i % 2 == 1?4:5, 9);
|
||||
@@ -151,7 +154,7 @@ public class GuiNpcCompanionStats extends GuiNPCInterface implements IGuiData {
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package noppes.npcs.client.gui.player.companion;
|
||||
|
||||
import kamkeel.npcs.network.packets.player.CompanionActionPacket;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
@@ -29,7 +30,7 @@ import java.util.Map;
|
||||
|
||||
public class GuiNpcCompanionTalents extends GuiNPCInterface{
|
||||
private RoleCompanion role;
|
||||
private Map<Integer,GuiTalent> talents = new HashMap<Integer,GuiTalent>();
|
||||
private Map<Integer,GuiTalent> talents = new HashMap<Integer,GuiTalent>();
|
||||
private GuiNpcButton selected;
|
||||
|
||||
public GuiNpcCompanionTalents(EntityNPCInterface npc) {
|
||||
@@ -46,7 +47,7 @@ public class GuiNpcCompanionTalents extends GuiNPCInterface{
|
||||
super.initGui();
|
||||
talents.clear();
|
||||
int y = guiTop + 12;
|
||||
|
||||
|
||||
addLabel(new GuiNpcLabel(0, NoppesStringUtils.translate("quest.exp", ": "), guiLeft + 4, guiTop + 10));
|
||||
|
||||
GuiNpcCompanionStats.addTopMenu(role, this, 2);
|
||||
@@ -55,7 +56,7 @@ public class GuiNpcCompanionTalents extends GuiNPCInterface{
|
||||
addTalent(i++, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void addTalent(int i, EnumCompanionTalent talent){
|
||||
int y = guiTop + 28 + i/2 * 26;
|
||||
int x = guiLeft + 4 + i % 2 * 84;
|
||||
@@ -75,7 +76,7 @@ public class GuiNpcCompanionTalents extends GuiNPCInterface{
|
||||
CustomNpcs.proxy.openGui(npc, EnumGuiType.Companion);
|
||||
}
|
||||
if(id == 3){
|
||||
NoppesUtilPlayer.sendData(EnumPlayerPacket.CompanionOpenInv);
|
||||
CompanionActionPacket.OpenInventory();
|
||||
}
|
||||
if(id >= 10){
|
||||
selected = (GuiNpcButton) guibutton;
|
||||
@@ -83,19 +84,19 @@ public class GuiNpcCompanionTalents extends GuiNPCInterface{
|
||||
addExperience(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void addExperience(int exp){
|
||||
EnumCompanionTalent talent = talents.get(selected.id - 10).talent;
|
||||
if(!role.canAddExp(-exp) && role.currentExp <= 0)
|
||||
return;
|
||||
if(exp > role.currentExp)
|
||||
exp = role.currentExp;
|
||||
NoppesUtilPlayer.sendData(EnumPlayerPacket.CompanionTalentExp, talent.ordinal(), exp);
|
||||
CompanionActionPacket.TalentExp(talent, exp);
|
||||
role.talents.put(talent, role.talents.get(talent) + exp);
|
||||
role.addExp(-exp);
|
||||
getLabel(selected.id - 10).label = role.talents.get(talent) + "/" + role.getNextLevel(talent);
|
||||
}
|
||||
|
||||
|
||||
private long lastPressedTime = 0;
|
||||
private long startPressedTime = 0;
|
||||
@Override
|
||||
@@ -122,7 +123,7 @@ public class GuiNpcCompanionTalents extends GuiNPCInterface{
|
||||
selected = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
mc.getTextureManager().bindTexture(Gui.icons);
|
||||
this.drawTexturedModalRect(guiLeft + 4, guiTop + 20, 10, 64, 162, 5);
|
||||
|
||||
@@ -142,9 +143,9 @@ public class GuiNpcCompanionTalents extends GuiNPCInterface{
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static class GuiTalent extends GuiScreen{
|
||||
private EnumCompanionTalent talent;
|
||||
private int x, y;
|
||||
@@ -156,12 +157,12 @@ public class GuiNpcCompanionTalents extends GuiNPCInterface{
|
||||
this.y = y;
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void drawScreen(int i, int j, float f) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
mc.getTextureManager().bindTexture(resource);
|
||||
|
||||
|
||||
ItemStack item = talent.item;
|
||||
if(item.getItem() == null)
|
||||
item = new ItemStack(Blocks.dirt);
|
||||
@@ -177,7 +178,7 @@ public class GuiNpcCompanionTalents extends GuiNPCInterface{
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
itemRender.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.getTextureManager(), item, x + 4, y + 4);
|
||||
itemRender.renderItemOverlayIntoGUI(mc.fontRenderer, mc.getTextureManager(), item, x + 4, y + 4);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glTranslatef(0, 0, 200);
|
||||
this.drawCenteredString(mc.fontRenderer, role.getTalentLevel(talent) + "", x + 20, y + 16, 0xFFFFFF);
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
package noppes.npcs.client.gui.player.inventory;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import kamkeel.addon.client.DBCClient;
|
||||
import kamkeel.npcs.addon.client.DBCClient;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
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;
|
||||
@@ -99,6 +110,10 @@ public class GuiCNPCInventory extends GuiNPCInterface {
|
||||
activeTab = 4;
|
||||
mc.displayGuiScreen(DBCClient.Instance.inventoryGUI());
|
||||
}
|
||||
if (guibutton.id == 105 && activeTab != 5) {
|
||||
activeTab = 5;
|
||||
mc.displayGuiScreen(new GuiProfiles());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package noppes.npcs.client.gui.player.inventory;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.player.CheckPlayerValue;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
@@ -35,7 +37,7 @@ public class GuiFaction extends GuiCNPCInventory implements IGuiData {
|
||||
ySize = 180;
|
||||
this.drawDefaultBackground = false;
|
||||
title = "";
|
||||
NoppesUtilPlayer.sendData(EnumPlayerPacket.FactionsGet);
|
||||
PacketClient.sendClient(new CheckPlayerValue(CheckPlayerValue.Type.Faction));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
package noppes.npcs.client.gui.player.inventory;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.data.large.PartyDataPacket;
|
||||
import kamkeel.npcs.network.packets.player.CheckPlayerValue;
|
||||
import kamkeel.npcs.network.packets.request.party.*;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiYesNo;
|
||||
import net.minecraft.client.gui.GuiYesNoCallback;
|
||||
@@ -10,11 +14,11 @@ import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.NoppesUtilPlayer;
|
||||
import noppes.npcs.QuestLogData;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.ClientCacheHandler;
|
||||
import noppes.npcs.client.CustomNpcResourceListener;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.constants.EnumPlayerPacket;
|
||||
import noppes.npcs.controllers.data.Party;
|
||||
import noppes.npcs.controllers.data.Quest;
|
||||
@@ -51,8 +55,8 @@ public class GuiParty extends GuiCNPCInventory implements ITextfieldListener,ICu
|
||||
xSize = 280;
|
||||
ySize = 180;
|
||||
drawDefaultBackground = false;
|
||||
NoppesUtilPlayer.sendData(EnumPlayerPacket.TrackedQuest);
|
||||
Client.sendData(EnumPacketServer.GetPartyData);
|
||||
PacketClient.sendClient(new CheckPlayerValue(CheckPlayerValue.Type.TrackedQuest));
|
||||
PacketClient.sendClient(new PartyInfoPacket());
|
||||
}
|
||||
|
||||
public void initGui(){
|
||||
@@ -191,23 +195,23 @@ public class GuiParty extends GuiCNPCInventory implements ITextfieldListener,ICu
|
||||
switch (i) {
|
||||
case 0:
|
||||
// Leader New Player
|
||||
Client.sendData(EnumPacketServer.SetPartyLeader, this.selectedPlayer);
|
||||
PacketClient.sendClient(new PartySetLeaderPacket(this.selectedPlayer));
|
||||
break;
|
||||
case 1:
|
||||
// Kick Other Player
|
||||
Client.sendData(EnumPacketServer.KickPlayer, this.selectedPlayer);
|
||||
PacketClient.sendClient(new PartyKickPacket(this.selectedPlayer));
|
||||
break;
|
||||
case 2:
|
||||
// Disband Party
|
||||
Client.sendData(EnumPacketServer.DisbandParty);
|
||||
PacketClient.sendClient(new PartyDisbandPacket());
|
||||
break;
|
||||
case 3:
|
||||
// Leave Party
|
||||
Client.sendData(EnumPacketServer.LeavePlayer, this.player.getCommandSenderName());
|
||||
PacketClient.sendClient(new PartyLeavePacket(this.player.getCommandSenderName()));
|
||||
break;
|
||||
case 4:
|
||||
// Drop Party Quest
|
||||
Client.sendData(EnumPacketServer.SetPartyQuest, -1);
|
||||
PacketClient.sendClient(new PartySetQuestPacket(-1));
|
||||
break;
|
||||
}
|
||||
receivedData = false;
|
||||
@@ -229,19 +233,19 @@ public class GuiParty extends GuiCNPCInventory implements ITextfieldListener,ICu
|
||||
|
||||
switch (guibutton.id) {
|
||||
case 200:
|
||||
Client.sendData(EnumPacketServer.CreateParty);
|
||||
PacketClient.sendClient(new PartyInfoPacket(true));
|
||||
receivedData = false;
|
||||
break;
|
||||
case 215:
|
||||
if (this.selectedInvite != null && !this.selectedInvite.isEmpty()) {
|
||||
Client.sendData(EnumPacketServer.AcceptInvite, this.selectedInvite);
|
||||
PacketClient.sendClient(new PartyAcceptInvitePacket(this.selectedInvite));
|
||||
receivedData = false;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case 220:
|
||||
if (this.selectedInvite != null && !this.selectedInvite.isEmpty()) {
|
||||
Client.sendData(EnumPacketServer.IgnoreInvite, this.selectedInvite);
|
||||
PacketClient.sendClient(new PartyIgnoreInvitePacket(this.selectedInvite));
|
||||
receivedData = false;
|
||||
return;
|
||||
}
|
||||
@@ -267,7 +271,7 @@ public class GuiParty extends GuiCNPCInventory implements ITextfieldListener,ICu
|
||||
case 330:
|
||||
String inviteName = this.getTextField(325).getText();
|
||||
if (!inviteName.isEmpty() && !party.getPlayerNames(true).contains(inviteName.toLowerCase())) {
|
||||
Client.sendData(EnumPacketServer.PartyInvite, inviteName);
|
||||
PacketClient.sendClient(new PartyInvitePacket(inviteName));
|
||||
this.getTextField(325).setText("");
|
||||
}
|
||||
break;
|
||||
@@ -455,10 +459,10 @@ public class GuiParty extends GuiCNPCInventory implements ITextfieldListener,ICu
|
||||
public void save() {
|
||||
if (this.partyChanged) {
|
||||
if(ClientCacheHandler.party != null)
|
||||
Client.sendData(EnumPacketServer.SavePartyData, ClientCacheHandler.party.writeClientNBT());
|
||||
PacketClient.sendClient(new PartySavePacket(ClientCacheHandler.party.writeClientNBT()));
|
||||
}
|
||||
if (!Objects.equals(this.originalTracked, data.trackedQuestKey)) {
|
||||
Client.sendData(EnumPacketServer.PartyLogToServer, this.data.trackedQuestKey);
|
||||
PacketClient.sendClient(new PartyLogToServerPacket(this.data.trackedQuestKey));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,199 @@
|
||||
package noppes.npcs.client.gui.player.inventory;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.player.CheckPlayerValue;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.NoppesUtilPlayer;
|
||||
import noppes.npcs.client.CustomNpcResourceListener;
|
||||
import noppes.npcs.client.gui.util.GuiButtonNextPage;
|
||||
import noppes.npcs.client.gui.util.IGuiData;
|
||||
import noppes.npcs.constants.EnumPlayerPacket;
|
||||
import noppes.npcs.controllers.data.Faction;
|
||||
import noppes.npcs.controllers.data.PlayerFactionData;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import tconstruct.client.tabs.AbstractTab;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class GuiProfiles extends GuiCNPCInventory implements IGuiData {
|
||||
|
||||
private final ResourceLocation resource = new ResourceLocation("customnpcs","textures/gui/standardbg.png");
|
||||
|
||||
private ArrayList<Faction> playerFactions = new ArrayList<Faction>();
|
||||
|
||||
private int page = 0;
|
||||
private int pages = 1;
|
||||
|
||||
private GuiButtonNextPage buttonNextPage;
|
||||
private GuiButtonNextPage buttonPreviousPage;
|
||||
|
||||
public GuiProfiles() {
|
||||
super();
|
||||
xSize = 280;
|
||||
ySize = 180;
|
||||
this.drawDefaultBackground = false;
|
||||
title = "";
|
||||
PacketClient.sendClient(new CheckPlayerValue(CheckPlayerValue.Type.Faction));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
this.buttonList.add(buttonNextPage = new GuiButtonNextPage(1, (guiLeft + (xSize + 35) / 2) + 25, guiTop + 170, true));
|
||||
this.buttonList.add(buttonPreviousPage = new GuiButtonNextPage(2, (guiLeft + (xSize + 35) / 2) - 40, guiTop + 170, false));
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int i, int j, float f)
|
||||
{
|
||||
drawDefaultBackground();
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
mc.renderEngine.bindTexture(resource);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, 252, 195);
|
||||
drawTexturedModalRect(guiLeft + 252, guiTop, 188, 0, 67, 195);
|
||||
|
||||
if(playerFactions.isEmpty()){
|
||||
String noFaction = StatCollector.translateToLocal("faction.nostanding");
|
||||
fontRendererObj.drawString(noFaction,guiLeft + (xSize - fontRendererObj.getStringWidth(noFaction)) / 2,guiTop + 80, CustomNpcResourceListener.DefaultTextColor);
|
||||
}
|
||||
else
|
||||
renderScreen();
|
||||
|
||||
super.drawScreen(i, j, f);
|
||||
|
||||
}
|
||||
|
||||
private void renderScreen(){
|
||||
int size = 10;
|
||||
if(playerFactions.size() % 10 != 0 && page == pages)
|
||||
size = playerFactions.size() % 10;
|
||||
|
||||
int hLine = 5;
|
||||
if(size < 5){
|
||||
hLine = size;
|
||||
}
|
||||
|
||||
int count = -1;
|
||||
for(int id = 0 ; id < size; id++){
|
||||
count++;
|
||||
|
||||
Faction faction = playerFactions.get((page - 1) * 10 + id);
|
||||
String name = faction.name;
|
||||
String points = " : " + faction.defaultPoints;
|
||||
|
||||
String standing = StatCollector.translateToLocal("faction.friendly");
|
||||
int color = 0x00FF00;
|
||||
if(faction.defaultPoints < faction.neutralPoints){
|
||||
standing = StatCollector.translateToLocal("faction.unfriendly");
|
||||
color = 0xFF0000;
|
||||
points += "/" + faction.neutralPoints;
|
||||
}
|
||||
else if(faction.defaultPoints < faction.friendlyPoints){
|
||||
standing = StatCollector.translateToLocal("faction.neutral");
|
||||
color = 0xF2FF00;
|
||||
points += "/" + faction.friendlyPoints;
|
||||
}
|
||||
else{
|
||||
points += "/-";
|
||||
}
|
||||
|
||||
drawVerticalLine(guiLeft + (xSize + 45) / 2, (guiTop + ySize - 15), guiTop + 13, 0xFF000000 + CustomNpcResourceListener.DefaultTextColor);
|
||||
if(count < 5){
|
||||
drawHorizontalLine(guiLeft + 2, guiLeft + xSize + 35, guiTop + 14 + count * 30, 0xFF000000 + CustomNpcResourceListener.DefaultTextColor);
|
||||
fontRendererObj.drawString(name, guiLeft + (xSize + 45 - fontRendererObj.getStringWidth(name)) / 4, guiTop + 19 + count * 30, faction.color);
|
||||
|
||||
fontRendererObj.drawString(standing, (guiLeft + (xSize + 45) / 4) - fontRendererObj.getStringWidth(standing), guiTop + 33 + count * 30, color);
|
||||
fontRendererObj.drawString(points, (guiLeft + (xSize + 45) / 4), guiTop + 33 + count * 30, CustomNpcResourceListener.DefaultTextColor);
|
||||
}
|
||||
else {
|
||||
fontRendererObj.drawString(name, guiLeft + 3*(xSize + 45 - fontRendererObj.getStringWidth(name)) / 4, guiTop + 19 + (count - 5) * 30, faction.color);
|
||||
|
||||
fontRendererObj.drawString(standing, (guiLeft + 3*(xSize + 45) / 4) - fontRendererObj.getStringWidth(standing) - 10, guiTop + 33 + (count - 5) * 30, color);
|
||||
fontRendererObj.drawString(points, (guiLeft + 3*(xSize + 45) / 4) - 10, guiTop + 33 + (count - 5) * 30, CustomNpcResourceListener.DefaultTextColor);
|
||||
}
|
||||
|
||||
drawHorizontalLine(guiLeft + 2, guiLeft + xSize + 35, guiTop + 14 + hLine * 30, 0xFF000000 + CustomNpcResourceListener.DefaultTextColor);
|
||||
}
|
||||
|
||||
if(pages > 1){
|
||||
String s = page +"/" + pages;
|
||||
fontRendererObj.drawString(s, guiLeft + (xSize + 45 - fontRendererObj.getStringWidth(s)) / 2, guiTop + 175, CustomNpcResourceListener.DefaultTextColor);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton){
|
||||
if(guibutton instanceof AbstractTab)
|
||||
return;
|
||||
|
||||
if (guibutton.id >= 100 && guibutton.id <= 105) {
|
||||
super.actionPerformed(guibutton);
|
||||
return;
|
||||
}
|
||||
if(!(guibutton instanceof GuiButtonNextPage))
|
||||
return;
|
||||
int id = guibutton.id;
|
||||
if(id == 1){
|
||||
page++;
|
||||
}
|
||||
if(id == 2){
|
||||
page--;
|
||||
}
|
||||
updateButtons();
|
||||
}
|
||||
private void updateButtons(){
|
||||
buttonNextPage.setVisible(page < pages);
|
||||
buttonPreviousPage.setVisible(page > 1);
|
||||
}
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyTyped(char c, int i)
|
||||
{
|
||||
if (i == 1 || isInventoryKey(i))
|
||||
{
|
||||
close();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void save() {
|
||||
}
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
playerFactions = new ArrayList<Faction>();
|
||||
|
||||
NBTTagList list = compound.getTagList("FactionList", 10);
|
||||
for(int i = 0; i < list.tagCount(); i++){
|
||||
Faction faction = new Faction();
|
||||
faction.readNBT(list.getCompoundTagAt(i));
|
||||
playerFactions.add(faction);
|
||||
}
|
||||
PlayerFactionData data = new PlayerFactionData();
|
||||
data.loadNBTData(compound);
|
||||
for(int id : data.factionData.keySet()){
|
||||
int points = data.factionData.get(id);
|
||||
for(Faction faction : playerFactions){
|
||||
if(faction.id == id)
|
||||
faction.defaultPoints = points;
|
||||
}
|
||||
}
|
||||
|
||||
pages = (playerFactions.size() - 1) / 10 ;
|
||||
pages++;
|
||||
|
||||
page = 1;
|
||||
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,10 @@
|
||||
package noppes.npcs.client.gui.player.inventory;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.player.CheckPlayerValue;
|
||||
import kamkeel.npcs.network.packets.request.party.PartyLogToServerPacket;
|
||||
import kamkeel.npcs.network.packets.request.party.PartySetQuestPacket;
|
||||
import kamkeel.npcs.network.packets.request.quest.QuestLogToServerPacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiYesNo;
|
||||
import net.minecraft.client.gui.GuiYesNoCallback;
|
||||
@@ -12,7 +17,7 @@ import noppes.npcs.NoppesUtilPlayer;
|
||||
import noppes.npcs.QuestLogData;
|
||||
import noppes.npcs.client.*;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.constants.EnumPlayerPacket;
|
||||
import noppes.npcs.controllers.data.Party;
|
||||
import noppes.npcs.util.ValueUtil;
|
||||
@@ -47,7 +52,7 @@ public class GuiQuestLog extends GuiCNPCInventory implements ICustomScrollListen
|
||||
xSize = 280;
|
||||
ySize = 180;
|
||||
drawDefaultBackground = false;
|
||||
NoppesUtilPlayer.sendData(EnumPlayerPacket.QuestLog);
|
||||
PacketClient.sendClient(new CheckPlayerValue(CheckPlayerValue.Type.QuestLog));
|
||||
}
|
||||
public void initGui(){
|
||||
super.initGui();
|
||||
@@ -153,7 +158,7 @@ public class GuiQuestLog extends GuiCNPCInventory implements ICustomScrollListen
|
||||
String key = data.selectedCategory + ":" + data.selectedQuest;
|
||||
if(data.partyQuests.containsKey(key)){
|
||||
int questID = data.partyQuests.get(key);
|
||||
Client.sendData(EnumPacketServer.SetPartyQuest, questID);
|
||||
PacketClient.sendClient(new PartySetQuestPacket(questID));
|
||||
}
|
||||
}
|
||||
initGui();
|
||||
@@ -192,7 +197,7 @@ public class GuiQuestLog extends GuiCNPCInventory implements ICustomScrollListen
|
||||
if (guibutton.id == 3)
|
||||
{
|
||||
if (Objects.equals(ClientCacheHandler.party.getCurrentQuestName(), data.selectedQuest)) {
|
||||
Client.sendData(EnumPacketServer.SetPartyQuest, -1);
|
||||
PacketClient.sendClient(new PartySetQuestPacket(-1));
|
||||
} else {
|
||||
GuiYesNo yesnoDisband = new GuiYesNo(this, "Confirm", StatCollector.translateToLocal("party.setQuestConfirm"), 0);
|
||||
displayGuiScreen(yesnoDisband);
|
||||
@@ -405,7 +410,7 @@ public class GuiQuestLog extends GuiCNPCInventory implements ICustomScrollListen
|
||||
!Objects.equals(this.trackedQuestKeyOnOpen, data.trackedQuestKey))) {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setTag("Alerts", NBTTags.nbtStringStringMap(data.questAlerts));
|
||||
Client.sendData(EnumPacketServer.QuestLogToServer, compound, this.data.trackedQuestKey);
|
||||
PacketClient.sendClient(new QuestLogToServerPacket(compound, this.data.trackedQuestKey));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,18 +1,21 @@
|
||||
package noppes.npcs.client.gui.player.inventory;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.packets.request.quest.QuestUntrackPacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiYesNo;
|
||||
import net.minecraft.client.gui.GuiYesNoCallback;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.ClientCacheHandler;
|
||||
import noppes.npcs.client.gui.util.GuiNpcButton;
|
||||
import noppes.npcs.client.gui.util.GuiNpcLabel;
|
||||
import noppes.npcs.client.gui.util.GuiNpcTextField;
|
||||
import noppes.npcs.client.gui.util.ITextfieldListener;
|
||||
import noppes.npcs.config.ConfigClient;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import tconstruct.client.tabs.AbstractTab;
|
||||
|
||||
@@ -102,7 +105,7 @@ public class GuiSettings extends GuiCNPCInventory implements ITextfieldListener,
|
||||
switch (i) {
|
||||
case 0:
|
||||
// Untrack Quest
|
||||
Client.sendData(EnumPacketServer.UntrackQuest);
|
||||
PacketClient.sendClient(new QuestUntrackPacket());
|
||||
break;
|
||||
case 1:
|
||||
// Clear Skin Cache
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
package noppes.npcs.client.gui.questtypes;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.quest.QuestDialogGetTitlePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.gui.select.GuiDialogSelection;
|
||||
import noppes.npcs.client.gui.util.GuiNpcButton;
|
||||
import noppes.npcs.client.gui.util.GuiSelectionListener;
|
||||
import noppes.npcs.client.gui.util.IGuiData;
|
||||
import noppes.npcs.client.gui.util.SubGuiInterface;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.controllers.data.Quest;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.quests.QuestDialog;
|
||||
@@ -34,10 +36,12 @@ public class GuiNpcQuestTypeDialog extends SubGuiInterface implements GuiSelecti
|
||||
xSize = 256;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
Client.sendData(EnumPacketServer.QuestDialogGetTitle,
|
||||
quest.dialogs.containsKey(0)?quest.dialogs.get(0):-1,
|
||||
quest.dialogs.containsKey(1)?quest.dialogs.get(1):-1,
|
||||
quest.dialogs.containsKey(2)?quest.dialogs.get(2):-1);
|
||||
|
||||
PacketClient.sendClient(new QuestDialogGetTitlePacket(
|
||||
quest.dialogs.getOrDefault(0, -1),
|
||||
quest.dialogs.getOrDefault(1, -1),
|
||||
quest.dialogs.getOrDefault(2, -1))
|
||||
);
|
||||
}
|
||||
|
||||
public void initGui() {
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
package noppes.npcs.client.gui.roles;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.bank.BankGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.bank.BanksGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.role.RoleSavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.gui.util.GuiCustomScroll;
|
||||
import noppes.npcs.client.gui.util.GuiNPCInterface2;
|
||||
import noppes.npcs.client.gui.util.ICustomScrollListener;
|
||||
import noppes.npcs.client.gui.util.IScrollData;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.controllers.data.Bank;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.roles.RoleBank;
|
||||
@@ -25,7 +29,7 @@ public class GuiNpcBankSetup extends GuiNPCInterface2 implements IScrollData,ICu
|
||||
public GuiNpcBankSetup(EntityNPCInterface npc)
|
||||
{
|
||||
super(npc);
|
||||
Client.sendData(EnumPacketServer.BanksGet);
|
||||
PacketClient.sendClient(new BanksGetPacket());
|
||||
role = (RoleBank) npc.roleInterface;
|
||||
}
|
||||
|
||||
@@ -43,9 +47,9 @@ public class GuiNpcBankSetup extends GuiNPCInterface2 implements IScrollData,ICu
|
||||
protected void actionPerformed(GuiButton guibutton)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setData(Vector<String> list, HashMap<String, Integer> data)
|
||||
public void setData(Vector<String> list, HashMap<String, Integer> data)
|
||||
{
|
||||
String name = null;
|
||||
Bank bank = role.getBank();
|
||||
@@ -53,23 +57,23 @@ public class GuiNpcBankSetup extends GuiNPCInterface2 implements IScrollData,ICu
|
||||
name = bank.name;
|
||||
this.data = data;
|
||||
scroll.setList(list);
|
||||
|
||||
|
||||
if(name != null)
|
||||
setSelected(name);
|
||||
}
|
||||
|
||||
|
||||
public void mouseClicked(int i, int j, int k)
|
||||
{
|
||||
super.mouseClicked(i, j, k);
|
||||
if(k == 0 && scroll != null)
|
||||
scroll.mouseClicked(i, j, k);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setSelected(String selected) {
|
||||
scroll.setSelected(selected);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void customScrollClicked(int i, int j, int k, GuiCustomScroll guiCustomScroll) {
|
||||
if(guiCustomScroll.id == 0)
|
||||
@@ -78,8 +82,8 @@ public class GuiNpcBankSetup extends GuiNPCInterface2 implements IScrollData,ICu
|
||||
save();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void save() {
|
||||
Client.sendData(EnumPacketServer.RoleSave, role.writeToNBT(new NBTTagCompound()));
|
||||
PacketClient.sendClient(new RoleSavePacket(role.writeToNBT(new NBTTagCompound())));
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,14 @@
|
||||
package noppes.npcs.client.gui.roles;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.jobs.JobSavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.controllers.MusicController;
|
||||
import noppes.npcs.client.gui.select.GuiSoundSelection;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.roles.JobBard;
|
||||
|
||||
@@ -90,7 +92,7 @@ public class GuiNpcBard extends GuiNPCInterface2 implements ISubGuiListener
|
||||
job.maxRange = job.minRange;
|
||||
|
||||
MusicController.Instance.stopAllSounds();
|
||||
Client.sendData(EnumPacketServer.JobSave, job.writeToNBT(new NBTTagCompound()));
|
||||
JobSavePacket.saveJob(job);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,24 +1,27 @@
|
||||
package noppes.npcs.client.gui.roles;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.role.RoleCompanionUpdatePacket;
|
||||
import kamkeel.npcs.network.packets.request.role.RoleSavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.gui.player.companion.GuiNpcCompanionTalents.GuiTalent;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumCompanionStage;
|
||||
import noppes.npcs.constants.EnumCompanionTalent;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.roles.RoleCompanion;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class GuiNpcCompanion extends GuiNPCInterface2 implements ITextfieldListener, ISliderListener{
|
||||
public class GuiNpcCompanion extends GuiNPCInterface2 implements ITextfieldListener, ISliderListener{
|
||||
private RoleCompanion role;
|
||||
private List<GuiTalent> talents = new ArrayList<GuiTalent>();
|
||||
public GuiNpcCompanion(EntityNPCInterface npc){
|
||||
super(npc);
|
||||
super(npc);
|
||||
role = (RoleCompanion) npc.roleInterface;
|
||||
}
|
||||
|
||||
@@ -27,11 +30,11 @@ public class GuiNpcCompanion extends GuiNPCInterface2 implements ITextfieldListe
|
||||
super.initGui();
|
||||
talents.clear();
|
||||
int y = guiTop + 4;
|
||||
|
||||
|
||||
addButton(new GuiNpcButton(0, guiLeft + 70, y, 90, 20, new String[]{EnumCompanionStage.BABY.name, EnumCompanionStage.CHILD.name, EnumCompanionStage.TEEN.name, EnumCompanionStage.ADULT.name, EnumCompanionStage.FULLGROWN.name}, role.stage.ordinal()));
|
||||
addLabel(new GuiNpcLabel(0, "companion.stage", guiLeft + 4, y + 5));
|
||||
addButton(new GuiNpcButton(1, guiLeft + 162, y, 90, 20, "gui.update"));
|
||||
|
||||
|
||||
addButton(new GuiNpcButton(2, guiLeft + 70, y += 22, 90, 20, new String[]{"gui.no", "gui.yes"}, role.canAge?1:0));
|
||||
addLabel(new GuiNpcLabel(2, "companion.age", guiLeft + 4, y + 5));
|
||||
if(role.canAge){
|
||||
@@ -42,13 +45,13 @@ public class GuiNpcCompanion extends GuiNPCInterface2 implements ITextfieldListe
|
||||
|
||||
talents.add(new GuiTalent(role, EnumCompanionTalent.INVENTORY, guiLeft + 4, y+=26));
|
||||
addSlider(new GuiNpcSlider(this, 10, guiLeft + 30, y + 2, 100, 20, role.getExp(EnumCompanionTalent.INVENTORY)/5000f));
|
||||
|
||||
|
||||
talents.add(new GuiTalent(role, EnumCompanionTalent.ARMOR, guiLeft + 4, y+=26));
|
||||
addSlider(new GuiNpcSlider(this, 11, guiLeft + 30, y + 2, 100, 20, role.getExp(EnumCompanionTalent.ARMOR)/5000f));
|
||||
|
||||
|
||||
talents.add(new GuiTalent(role, EnumCompanionTalent.SWORD, guiLeft + 4, y+=26));
|
||||
addSlider(new GuiNpcSlider(this, 12, guiLeft + 30, y + 2, 100, 20, role.getExp(EnumCompanionTalent.SWORD)/5000f));
|
||||
|
||||
|
||||
// talents.add(new GuiTalent(role, EnumCompanionTalent.RANGED, guiLeft + 4, y+=26));
|
||||
// addSlider(new GuiNpcSlider(this, 13, guiLeft + 30, y + 2, 100, 20, role.getExp(EnumCompanionTalent.RANGED)/5000f));
|
||||
}
|
||||
@@ -63,7 +66,7 @@ public class GuiNpcCompanion extends GuiNPCInterface2 implements ITextfieldListe
|
||||
initGui();
|
||||
}
|
||||
if(guibutton.id == 1){
|
||||
Client.sendData(EnumPacketServer.RoleCompanionUpdate, role.stage.ordinal());
|
||||
PacketClient.sendClient(new RoleCompanionUpdatePacket(role.stage));
|
||||
}
|
||||
if(guibutton.id == 2){
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
@@ -85,16 +88,16 @@ public class GuiNpcCompanion extends GuiNPCInterface2 implements ITextfieldListe
|
||||
talent.drawScreen(i, j, f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void elementClicked(){
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
Client.sendData(EnumPacketServer.RoleSave, role.writeToNBT(new NBTTagCompound()));
|
||||
PacketClient.sendClient(new RoleSavePacket(role.writeToNBT(new NBTTagCompound())));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -111,14 +114,14 @@ public class GuiNpcCompanion extends GuiNPCInterface2 implements ITextfieldListe
|
||||
|
||||
@Override
|
||||
public void mousePressed(GuiNpcSlider slider) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(GuiNpcSlider slider) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package noppes.npcs.client.gui.roles;
|
||||
|
||||
import kamkeel.npcs.network.packets.request.jobs.JobSavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.gui.SubGuiNpcAvailability;
|
||||
import noppes.npcs.client.gui.select.GuiQuestSelection;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.roles.JobConversation;
|
||||
import noppes.npcs.roles.JobConversation.ConversationLine;
|
||||
@@ -109,7 +110,7 @@ public class GuiNpcConversation extends GuiNPCInterface2 implements ITextfieldLi
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
Client.sendData(EnumPacketServer.JobSave, job.writeToNBT(new NBTTagCompound()));
|
||||
JobSavePacket.saveJob(job);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package noppes.npcs.client.gui.roles;
|
||||
|
||||
import kamkeel.npcs.network.packets.request.jobs.JobSavePacket;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.roles.JobFollower;
|
||||
|
||||
@@ -11,12 +12,12 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class GuiNpcFollowerJob extends GuiNPCInterface2 implements ICustomScrollListener
|
||||
{
|
||||
{
|
||||
private JobFollower job;
|
||||
private GuiCustomScroll scroll;
|
||||
public GuiNpcFollowerJob(EntityNPCInterface npc)
|
||||
{
|
||||
super(npc);
|
||||
super(npc);
|
||||
job = (JobFollower) npc.jobInterface;
|
||||
}
|
||||
|
||||
@@ -32,7 +33,7 @@ public class GuiNpcFollowerJob extends GuiNPCInterface2 implements ICustomScroll
|
||||
scroll.guiLeft = guiLeft + 268;
|
||||
scroll.guiTop = guiTop + 4;
|
||||
this.addScroll(scroll);
|
||||
|
||||
|
||||
List<String> names = new ArrayList<String>();
|
||||
List<EntityNPCInterface> list = npc.worldObj.getEntitiesWithinAABB(EntityNPCInterface.class, npc.boundingBox.expand(40, 40, 40));
|
||||
for(EntityNPCInterface npc : list){
|
||||
@@ -46,7 +47,7 @@ public class GuiNpcFollowerJob extends GuiNPCInterface2 implements ICustomScroll
|
||||
@Override
|
||||
public void save() {
|
||||
job.name = getTextField(1).getText();
|
||||
Client.sendData(EnumPacketServer.JobSave, job.writeToNBT(new NBTTagCompound()));
|
||||
JobSavePacket.saveJob(job);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
package noppes.npcs.client.gui.roles;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.role.RoleSavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.containers.ContainerNPCFollowerSetup;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.roles.RoleFollower;
|
||||
@@ -47,13 +49,13 @@ public class GuiNpcFollowerSetup extends GuiContainerNPCInterface2
|
||||
|
||||
addLabel(new GuiNpcLabel(7, "follower.infiniteDays", guiLeft + 180, guiTop + 80));
|
||||
addButton(new GuiNpcButtonYesNo(7, guiLeft + 260, guiTop + 75, role.infiniteDays));
|
||||
|
||||
|
||||
addLabel(new GuiNpcLabel(8, "follower.guiDisabled", guiLeft + 180, guiTop + 104));
|
||||
addButton(new GuiNpcButtonYesNo(8, guiLeft + 260, guiTop + 99, role.disableGui));
|
||||
|
||||
|
||||
addLabel(new GuiNpcLabel(9, "follower.allowSoulstone", guiLeft + 180, guiTop + 128));
|
||||
addButton(new GuiNpcButtonYesNo(9, guiLeft + 260, guiTop + 123, !role.refuseSoulStone));
|
||||
|
||||
|
||||
|
||||
addButton(new GuiNpcButton(10, guiLeft + 195, guiTop + 147, 100, 20, "remote.reset"));
|
||||
}
|
||||
@@ -77,7 +79,7 @@ public class GuiNpcFollowerSetup extends GuiContainerNPCInterface2
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
@Override
|
||||
public void save() {
|
||||
@@ -91,13 +93,13 @@ public class GuiNpcFollowerSetup extends GuiContainerNPCInterface2
|
||||
days = getTextField(i).getInteger();
|
||||
if(days <= 0)
|
||||
days = 1;
|
||||
|
||||
|
||||
map.put(i,days);
|
||||
}
|
||||
}
|
||||
role.rates = map;
|
||||
role.dialogHire = getTextField(3).getText();
|
||||
role.dialogFarewell = getTextField(4).getText();
|
||||
Client.sendData(EnumPacketServer.RoleSave, role.writeToNBT(new NBTTagCompound()));
|
||||
PacketClient.sendClient(new RoleSavePacket(role.writeToNBT(new NBTTagCompound())));
|
||||
}
|
||||
}
|
||||
@@ -1,28 +1,29 @@
|
||||
package noppes.npcs.client.gui.roles;
|
||||
|
||||
import kamkeel.npcs.network.packets.request.jobs.JobSavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.gui.util.GuiCustomScroll;
|
||||
import noppes.npcs.client.gui.util.GuiNPCInterface2;
|
||||
import noppes.npcs.client.gui.util.GuiNpcButton;
|
||||
import noppes.npcs.client.gui.util.GuiNpcLabel;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.roles.JobGuard;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class GuiNpcGuard extends GuiNPCInterface2{
|
||||
public class GuiNpcGuard extends GuiNPCInterface2{
|
||||
private JobGuard role;
|
||||
private GuiCustomScroll scroll1;
|
||||
private GuiCustomScroll scroll2;
|
||||
|
||||
|
||||
public GuiNpcGuard(EntityNPCInterface npc){
|
||||
super(npc);
|
||||
super(npc);
|
||||
role = (JobGuard) npc.jobInterface;
|
||||
}
|
||||
|
||||
@@ -37,10 +38,10 @@ public class GuiNpcGuard extends GuiNPCInterface2{
|
||||
this.addLabel(new GuiNpcLabel(2, "guard.creepers", guiLeft + 275, guiTop + 9));
|
||||
this.addButton(new GuiNpcButton(2, guiLeft + 360, guiTop + 4, 50, 20, new String[]{"gui.no", "gui.yes"},role.attackCreepers?1:0));
|
||||
getButton(2).enabled = role.attackHostileMobs;
|
||||
|
||||
|
||||
this.addLabel(new GuiNpcLabel(3, "guard.specifictargets", guiLeft + 10, guiTop + 31));
|
||||
this.addButton(new GuiNpcButton(3, guiLeft + 85, guiTop + 26, 50, 20, new String[]{"gui.no", "gui.yes"},role.specific?1:0));
|
||||
|
||||
this.addButton(new GuiNpcButton(3, guiLeft + 85, guiTop + 26, 50, 20, new String[]{"gui.no", "gui.yes"},role.specific?1:0));
|
||||
|
||||
if(role.specific){
|
||||
if(scroll1 == null){
|
||||
scroll1 = new GuiCustomScroll(this,0);
|
||||
@@ -50,7 +51,7 @@ public class GuiNpcGuard extends GuiNPCInterface2{
|
||||
scroll1.guiTop = guiTop + 58;
|
||||
this.addScroll(scroll1);
|
||||
addLabel(new GuiNpcLabel(11, "guard.availableTargets", guiLeft + 4, guiTop + 48));
|
||||
|
||||
|
||||
if(scroll2 == null){
|
||||
scroll2 = new GuiCustomScroll(this,1);
|
||||
scroll2.setSize(175, 154);
|
||||
@@ -59,7 +60,7 @@ public class GuiNpcGuard extends GuiNPCInterface2{
|
||||
scroll2.guiTop = guiTop + 58;
|
||||
this.addScroll(scroll2);
|
||||
addLabel(new GuiNpcLabel(12, "guard.currentTargets", guiLeft + 235, guiTop + 48));
|
||||
|
||||
|
||||
List<String> all = new ArrayList<String>();
|
||||
for(Object entity : EntityList.stringToClassMapping.keySet()){
|
||||
String name = "entity." + entity + ".name";
|
||||
@@ -71,11 +72,11 @@ public class GuiNpcGuard extends GuiNPCInterface2{
|
||||
}
|
||||
scroll1.setList(all);
|
||||
scroll2.setList(role.targets);
|
||||
|
||||
|
||||
|
||||
|
||||
addButton(new GuiNpcButton(11, guiLeft + 180, guiTop + 80, 55, 20, ">"));
|
||||
addButton(new GuiNpcButton(12, guiLeft + 180, guiTop + 102, 55, 20, "<"));
|
||||
|
||||
|
||||
addButton(new GuiNpcButton(13, guiLeft + 180, guiTop + 130, 55, 20, ">>"));
|
||||
addButton(new GuiNpcButton(14, guiLeft + 180, guiTop + 152, 55, 20, "<<"));
|
||||
}
|
||||
@@ -92,11 +93,11 @@ public class GuiNpcGuard extends GuiNPCInterface2{
|
||||
}
|
||||
if(button.id == 2){
|
||||
role.attackCreepers = button.getValue()==1;
|
||||
}
|
||||
}
|
||||
if(button.id == 3){
|
||||
role.specific = button.getValue()==1;
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
|
||||
if(button.id == 11){
|
||||
if(scroll1.hasSelected()){
|
||||
@@ -104,14 +105,14 @@ public class GuiNpcGuard extends GuiNPCInterface2{
|
||||
scroll1.selected = -1;
|
||||
scroll1.selected = -1;
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(button.id == 12){
|
||||
if(scroll2.hasSelected()){
|
||||
role.targets.remove(scroll2.getSelected());
|
||||
scroll2.selected = -1;
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(button.id == 13){
|
||||
role.targets.clear();
|
||||
@@ -136,7 +137,7 @@ public class GuiNpcGuard extends GuiNPCInterface2{
|
||||
}
|
||||
|
||||
public void save() {
|
||||
Client.sendData(EnumPacketServer.JobSave, role.writeToNBT(new NBTTagCompound()));
|
||||
JobSavePacket.saveJob(role);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,20 +1,21 @@
|
||||
package noppes.npcs.client.gui.roles;
|
||||
|
||||
import kamkeel.npcs.network.packets.request.jobs.JobSavePacket;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
|
||||
import noppes.npcs.client.gui.util.GuiNPCInterface2;
|
||||
import noppes.npcs.client.gui.util.GuiNpcLabel;
|
||||
import noppes.npcs.client.gui.util.GuiNpcTextField;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.roles.JobHealer;
|
||||
|
||||
public class GuiNpcHealer extends GuiNPCInterface2
|
||||
{
|
||||
{
|
||||
private JobHealer job;
|
||||
public GuiNpcHealer(EntityNPCInterface npc)
|
||||
{
|
||||
super(npc);
|
||||
super(npc);
|
||||
job = (JobHealer) npc.jobInterface;
|
||||
}
|
||||
|
||||
@@ -26,16 +27,16 @@ public class GuiNpcHealer extends GuiNPCInterface2
|
||||
addTextField(new GuiNpcTextField(1,this, this.fontRendererObj, guiLeft+130, guiTop + 105, 40, 20, job.speed + ""));
|
||||
getTextField(1).integersOnly = true;
|
||||
getTextField(1).setMinMaxDefault(1, Integer.MAX_VALUE, 8);
|
||||
|
||||
|
||||
addLabel(new GuiNpcLabel(2,"Range:", guiLeft + 60, guiTop + 133));
|
||||
addTextField(new GuiNpcTextField(2,this, this.fontRendererObj, guiLeft+130, guiTop + 128, 40, 20, job.range + ""));
|
||||
getTextField(2).integersOnly = true;
|
||||
getTextField(2).setMinMaxDefault(2, Integer.MAX_VALUE, 5);
|
||||
|
||||
|
||||
}
|
||||
@Override
|
||||
public void elementClicked(){
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +45,7 @@ public class GuiNpcHealer extends GuiNPCInterface2
|
||||
job.speed = getTextField(1).getInteger();
|
||||
job.range = getTextField(2).getInteger();
|
||||
|
||||
Client.sendData(EnumPacketServer.JobSave, job.writeToNBT(new NBTTagCompound()));
|
||||
JobSavePacket.saveJob(job);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loaded 100 of 602 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user