mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-28 11:16:02 +00:00
Proper Reformating
This commit is contained in:
1 parent
ce75880aba
commit
180d257024
1179 files changed
+59847
-61583
No files matched your search
@@ -8,47 +8,46 @@ import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.UUID;
|
||||
|
||||
public class AnalyticsTracking{
|
||||
public class AnalyticsTracking {
|
||||
|
||||
public static void sendData(final EntityPlayer player, final String event, final String data){
|
||||
Runnable r = new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
UUID uuid = player.getUniqueID();
|
||||
|
||||
String analyticsPostData = "v=1" +
|
||||
"&tid=UA-29079943-5" +
|
||||
"&cid=" + uuid.toString() +
|
||||
"&t=event" +
|
||||
"&ec=customnpcs_1.7d" +
|
||||
"&ea=" + event +
|
||||
"&el=" + data +
|
||||
"&ev=300";
|
||||
public static void sendData(final EntityPlayer player, final String event, final String data) {
|
||||
Runnable r = new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
UUID uuid = player.getUniqueID();
|
||||
|
||||
String analyticsPostData = "v=1" +
|
||||
"&tid=UA-29079943-5" +
|
||||
"&cid=" + uuid.toString() +
|
||||
"&t=event" +
|
||||
"&ec=customnpcs_1.7d" +
|
||||
"&ea=" + event +
|
||||
"&el=" + data +
|
||||
"&ev=300";
|
||||
|
||||
URL url = new URL("http://www.google-analytics.com/collect");
|
||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||
connection.setConnectTimeout(10000);
|
||||
connection.setReadTimeout(10000);
|
||||
connection.setDoOutput(true);
|
||||
connection.setUseCaches(false);
|
||||
connection.setRequestMethod("POST");
|
||||
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
||||
connection.setRequestProperty("Content-Length", Integer.toString(analyticsPostData.getBytes().length));
|
||||
OutputStream dataOutput = connection.getOutputStream();
|
||||
dataOutput.write(analyticsPostData.getBytes());
|
||||
dataOutput.close();
|
||||
connection.getInputStream().close();
|
||||
} catch (IOException e) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
Thread t = new Thread(r);
|
||||
t.start();
|
||||
}
|
||||
|
||||
URL url = new URL("http://www.google-analytics.com/collect");
|
||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||
connection.setConnectTimeout(10000);
|
||||
connection.setReadTimeout(10000);
|
||||
connection.setDoOutput(true);
|
||||
connection.setUseCaches(false);
|
||||
connection.setRequestMethod("POST");
|
||||
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
||||
connection.setRequestProperty("Content-Length", Integer.toString(analyticsPostData.getBytes().length));
|
||||
OutputStream dataOutput = connection.getOutputStream();
|
||||
dataOutput.write(analyticsPostData.getBytes());
|
||||
dataOutput.close();
|
||||
connection.getInputStream().close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
Thread t = new Thread(r);
|
||||
t.start();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,59 +16,61 @@ import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
public class AssetsBrowser {
|
||||
public boolean isRoot;
|
||||
private int depth;
|
||||
private String folder;
|
||||
public HashSet<String> folders = new HashSet<String>();
|
||||
public HashSet<String> files = new HashSet<String>();
|
||||
private String[] extensions;
|
||||
public boolean isRoot;
|
||||
private int depth;
|
||||
private String folder;
|
||||
public HashSet<String> folders = new HashSet<String>();
|
||||
public HashSet<String> files = new HashSet<String>();
|
||||
private String[] extensions;
|
||||
|
||||
public AssetsBrowser(String folder, String[] extensions){
|
||||
this.extensions = extensions;
|
||||
this.setFolder(folder);
|
||||
}
|
||||
public void setFolder(String folder){
|
||||
if(!folder.endsWith("/"))
|
||||
folder += "/";
|
||||
isRoot = folder.length() <= 1;
|
||||
this.folder = "/assets" + folder;
|
||||
depth = StringUtils.countMatches(this.folder, "/");
|
||||
getFiles();
|
||||
}
|
||||
public AssetsBrowser(String[] extensions){
|
||||
this.extensions = extensions;
|
||||
}
|
||||
public AssetsBrowser(String folder, String[] extensions) {
|
||||
this.extensions = extensions;
|
||||
this.setFolder(folder);
|
||||
}
|
||||
|
||||
private void getFiles() {
|
||||
folders.clear();
|
||||
files.clear();
|
||||
public void setFolder(String folder) {
|
||||
if (!folder.endsWith("/"))
|
||||
folder += "/";
|
||||
isRoot = folder.length() <= 1;
|
||||
this.folder = "/assets" + folder;
|
||||
depth = StringUtils.countMatches(this.folder, "/");
|
||||
getFiles();
|
||||
}
|
||||
|
||||
ResourcePackRepository repos = Minecraft.getMinecraft().getResourcePackRepository();
|
||||
public AssetsBrowser(String[] extensions) {
|
||||
this.extensions = extensions;
|
||||
}
|
||||
|
||||
private void getFiles() {
|
||||
folders.clear();
|
||||
files.clear();
|
||||
|
||||
ResourcePackRepository repos = Minecraft.getMinecraft().getResourcePackRepository();
|
||||
SimpleReloadableResourceManager simplemanager = (SimpleReloadableResourceManager) Minecraft.getMinecraft().getResourceManager();
|
||||
|
||||
Map<String, IResourceManager> map = ObfuscationReflectionHelper.getPrivateValue(SimpleReloadableResourceManager.class, simplemanager, 2);
|
||||
HashSet<String> set = new HashSet<String>();
|
||||
for(String name: map.keySet()){
|
||||
if(!(map.get(name) instanceof FallbackResourceManager))
|
||||
continue;
|
||||
FallbackResourceManager manager = (FallbackResourceManager) map.get(name);
|
||||
List<IResourcePack> list = ObfuscationReflectionHelper.getPrivateValue(FallbackResourceManager.class, manager, 0);
|
||||
for(IResourcePack pack : list){
|
||||
if(pack instanceof AbstractResourcePack){
|
||||
AbstractResourcePack p = (AbstractResourcePack) pack;
|
||||
File file = NPCResourceHelper.getPackFile(p);
|
||||
if(file != null)
|
||||
set.add(file.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
for (String name : map.keySet()) {
|
||||
if (!(map.get(name) instanceof FallbackResourceManager))
|
||||
continue;
|
||||
FallbackResourceManager manager = (FallbackResourceManager) map.get(name);
|
||||
List<IResourcePack> list = ObfuscationReflectionHelper.getPrivateValue(FallbackResourceManager.class, manager, 0);
|
||||
for (IResourcePack pack : list) {
|
||||
if (pack instanceof AbstractResourcePack) {
|
||||
AbstractResourcePack p = (AbstractResourcePack) pack;
|
||||
File file = NPCResourceHelper.getPackFile(p);
|
||||
if (file != null)
|
||||
set.add(file.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(String file : set){
|
||||
progressFile(new File(file));
|
||||
for (String file : set) {
|
||||
progressFile(new File(file));
|
||||
}
|
||||
for (ModContainer mod : Loader.instance().getModList()) {
|
||||
if(mod.getSource().exists())
|
||||
progressFile(mod.getSource());
|
||||
if (mod.getSource().exists())
|
||||
progressFile(mod.getSource());
|
||||
}
|
||||
// List<ResourcePackRepository.Entry> list = repos.getRepositoryEntries();
|
||||
// System.out.println(repos.rprDefaultResourcePack);
|
||||
@@ -85,101 +87,98 @@ public class AssetsBrowser {
|
||||
// progressFile(file);
|
||||
// }
|
||||
// checkFolder(new File(CustomNpcs.Dir,"assets"),CustomNpcs.Dir.getAbsolutePath().length());
|
||||
//TODO fix
|
||||
}
|
||||
private void progressFile(File file){
|
||||
try {
|
||||
if (!file.isDirectory() && (file.getName().endsWith(".jar") || file.getName().endsWith(".zip")))
|
||||
{
|
||||
ZipFile zip = new ZipFile(file);
|
||||
Enumeration<? extends ZipEntry> entries = zip.entries();
|
||||
while(entries.hasMoreElements()){
|
||||
ZipEntry zipentry = entries.nextElement();
|
||||
String entryName = zipentry.getName();
|
||||
checkFile(entryName);
|
||||
//TODO fix
|
||||
}
|
||||
|
||||
}
|
||||
zip.close();
|
||||
}
|
||||
else if(file.isDirectory()){
|
||||
int length = file.getAbsolutePath().length();
|
||||
checkFolder(file,length);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
private void progressFile(File file) {
|
||||
try {
|
||||
if (!file.isDirectory() && (file.getName().endsWith(".jar") || file.getName().endsWith(".zip"))) {
|
||||
ZipFile zip = new ZipFile(file);
|
||||
Enumeration<? extends ZipEntry> entries = zip.entries();
|
||||
while (entries.hasMoreElements()) {
|
||||
ZipEntry zipentry = entries.nextElement();
|
||||
String entryName = zipentry.getName();
|
||||
checkFile(entryName);
|
||||
|
||||
private void checkFolder(File file, int length){
|
||||
File[] files = file.listFiles();
|
||||
if(files == null){
|
||||
return;
|
||||
}
|
||||
for(File f : files){
|
||||
String name = f.getAbsolutePath().substring(length);
|
||||
name = name.replace("\\", "/");
|
||||
if(!name.startsWith("/"))
|
||||
name = "/" + name;
|
||||
if(f.isDirectory() && (folder.startsWith(name) || name.startsWith(folder))){
|
||||
checkFile(name + "/");
|
||||
checkFolder(f, length);
|
||||
}
|
||||
else
|
||||
checkFile(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
zip.close();
|
||||
} else if (file.isDirectory()) {
|
||||
int length = file.getAbsolutePath().length();
|
||||
checkFolder(file, length);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void checkFile(String name){
|
||||
if(!name.startsWith("/"))
|
||||
name = "/" + name;
|
||||
if(!name.startsWith(this.folder)){
|
||||
return;
|
||||
private void checkFolder(File file, int length) {
|
||||
File[] files = file.listFiles();
|
||||
if (files == null) {
|
||||
return;
|
||||
}
|
||||
for (File f : files) {
|
||||
String name = f.getAbsolutePath().substring(length);
|
||||
name = name.replace("\\", "/");
|
||||
if (!name.startsWith("/"))
|
||||
name = "/" + name;
|
||||
if (f.isDirectory() && (folder.startsWith(name) || name.startsWith(folder))) {
|
||||
checkFile(name + "/");
|
||||
checkFolder(f, length);
|
||||
} else
|
||||
checkFile(name);
|
||||
}
|
||||
}
|
||||
|
||||
private void checkFile(String name) {
|
||||
if (!name.startsWith("/"))
|
||||
name = "/" + name;
|
||||
if (!name.startsWith(this.folder)) {
|
||||
return;
|
||||
}
|
||||
String[] split = name.split("/");
|
||||
int count = split.length;
|
||||
if(count == depth + 1){
|
||||
if(validExtension(name))
|
||||
files.add(split[depth]);
|
||||
if (count == depth + 1) {
|
||||
if (validExtension(name))
|
||||
files.add(split[depth]);
|
||||
} else if (depth + 1 < count) {
|
||||
folders.add(split[depth]);
|
||||
}
|
||||
else if(depth + 1 < count){
|
||||
folders.add(split[depth]);
|
||||
}
|
||||
|
||||
private boolean validExtension(String entryName) {
|
||||
int index = entryName.indexOf(".");
|
||||
if (index < 0)
|
||||
return false;
|
||||
String extension = entryName.substring(index + 1);
|
||||
for (String ex : extensions) {
|
||||
if (ex.equalsIgnoreCase(extension))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean validExtension(String entryName) {
|
||||
int index = entryName.indexOf(".");
|
||||
if(index < 0)
|
||||
return false;
|
||||
String extension = entryName.substring(index + 1);
|
||||
for(String ex : extensions){
|
||||
if(ex.equalsIgnoreCase(extension))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public String getAsset(String asset) {
|
||||
String[] split = folder.split("/");
|
||||
if (split.length < 3)
|
||||
return null;
|
||||
String texture = split[2] + ":";
|
||||
texture += folder.substring(texture.length() + 8) + asset;
|
||||
return texture;
|
||||
}
|
||||
|
||||
public String getAsset(String asset) {
|
||||
String[] split = folder.split("/");
|
||||
if(split.length < 3)
|
||||
return null;
|
||||
String texture = split[2] + ":";
|
||||
texture += folder.substring(texture.length() + 8) + asset;
|
||||
return texture;
|
||||
}
|
||||
|
||||
public static String getRoot(String asset) {
|
||||
String mod = "minecraft";
|
||||
int index = asset.indexOf(":");
|
||||
if(index > 0){
|
||||
mod = asset.substring(0,index);
|
||||
asset = asset.substring(index + 1);
|
||||
}
|
||||
if(asset.startsWith("/"))
|
||||
asset = asset.substring(1);
|
||||
String location = "/" + mod + "/" + asset;
|
||||
index = location.lastIndexOf("/");
|
||||
if(index > 0)
|
||||
location = location.substring(0,index);
|
||||
return location;
|
||||
}
|
||||
public static String getRoot(String asset) {
|
||||
String mod = "minecraft";
|
||||
int index = asset.indexOf(":");
|
||||
if (index > 0) {
|
||||
mod = asset.substring(0, index);
|
||||
asset = asset.substring(index + 1);
|
||||
}
|
||||
if (asset.startsWith("/"))
|
||||
asset = asset.substring(1);
|
||||
String location = "/" + mod + "/" + asset;
|
||||
index = location.lastIndexOf("/");
|
||||
if (index > 0)
|
||||
location = location.substring(0, index);
|
||||
return location;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package noppes.npcs.client;
|
||||
|
||||
import kamkeel.npcs.util.ByteBufUtils;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.client.controllers.MusicController;
|
||||
@@ -18,7 +17,6 @@ import noppes.npcs.controllers.data.PlayerData;
|
||||
import noppes.npcs.controllers.data.SkinOverlay;
|
||||
import noppes.npcs.util.CacheHashMap;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -74,7 +72,7 @@ public class ClientCacheHandler {
|
||||
|
||||
// Clear Quest Tracker
|
||||
HudComponent component = ClientHudManager.getInstance().getHudComponents().get(EnumHudComponent.QuestTracker);
|
||||
if(component != null){
|
||||
if (component != null) {
|
||||
component.loadData(new NBTTagCompound());
|
||||
component.hasData = false;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ import java.util.*;
|
||||
public class ClientEventHandler {
|
||||
public static final RenderCNPCPlayer renderCNPCSelf = new RenderCNPCPlayer();
|
||||
public static final RenderCNPCPlayer renderCNPCPlayer = new RenderCNPCPlayer();
|
||||
public static HashMap<Integer,Long> disabledButtonTimes = new HashMap<>();
|
||||
public static HashMap<Integer, Long> disabledButtonTimes = new HashMap<>();
|
||||
public static float partialHandTicks;
|
||||
public static boolean firstPersonAnimation;
|
||||
public static ModelBiped firstPersonModel;
|
||||
@@ -48,11 +48,11 @@ public class ClientEventHandler {
|
||||
|
||||
public static EntityNPCInterface renderingNpc;
|
||||
public static EntityPlayer renderingPlayer;
|
||||
public static HashMap<EnumAnimationPart,String[]> partNames = new HashMap<>();
|
||||
public static HashMap<Class<?>,Field[]> declaredFieldCache = new HashMap<>();
|
||||
public static HashMap<EnumAnimationPart, String[]> partNames = new HashMap<>();
|
||||
public static HashMap<Class<?>, Field[]> declaredFieldCache = new HashMap<>();
|
||||
|
||||
private static final HashSet<Render> processedPlayerRenderers = new HashSet<>();
|
||||
public static final HashMap<ModelRenderer,FramePart> originalValues = new HashMap<>();
|
||||
public static final HashMap<ModelRenderer, FramePart> originalValues = new HashMap<>();
|
||||
public static ModelBase playerModel;
|
||||
|
||||
private Class<?> renderPlayerJBRA;
|
||||
@@ -71,7 +71,7 @@ public class ClientEventHandler {
|
||||
return;
|
||||
|
||||
ArrayList<Integer> removeList = new ArrayList<>();
|
||||
for (Map.Entry<Integer,Long> entry : disabledButtonTimes.entrySet()) {
|
||||
for (Map.Entry<Integer, Long> entry : disabledButtonTimes.entrySet()) {
|
||||
if (entry.getValue() > 0) {
|
||||
if (entry.getKey() == event.button || entry.getKey() == -1) {
|
||||
event.setCanceled(true);
|
||||
@@ -88,13 +88,13 @@ public class ClientEventHandler {
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onOverlayRender(RenderGameOverlayEvent.Post event){
|
||||
if(event.type == RenderGameOverlayEvent.ElementType.ALL) {
|
||||
public void onOverlayRender(RenderGameOverlayEvent.Post event) {
|
||||
if (event.type == RenderGameOverlayEvent.ElementType.ALL) {
|
||||
for (OverlayCustom overlayCustom : ClientCacheHandler.customOverlays.values()) {
|
||||
overlayCustom.renderGameOverlay(event.partialTicks);
|
||||
}
|
||||
|
||||
if(ClientHudManager.getInstance().getHudComponents().isEmpty()){
|
||||
if (ClientHudManager.getInstance().getHudComponents().isEmpty()) {
|
||||
ClientHudManager.getInstance().registerHud(EnumHudComponent.QuestTracker, new QuestTrackingComponent(Minecraft.getMinecraft()));
|
||||
ClientHudManager.getInstance().registerHud(EnumHudComponent.QuestCompass, new CompassHudComponent(Minecraft.getMinecraft()));
|
||||
}
|
||||
@@ -142,16 +142,16 @@ public class ClientEventHandler {
|
||||
if (event.entity instanceof EntityNPCInterface) {
|
||||
MarkData markData = MarkData.get((EntityNPCInterface) event.entity);
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
if(PlayerData.get(player) != null){
|
||||
for(MarkData.Mark m : markData.marks){
|
||||
if(m.getType() != MarkType.NONE && m.availability.isAvailable(player)){
|
||||
if (PlayerData.get(player) != null) {
|
||||
for (MarkData.Mark m : markData.marks) {
|
||||
if (m.getType() != MarkType.NONE && m.availability.isAvailable(player)) {
|
||||
MarkRenderer.render(event.entity, event.x, event.y, event.z, m);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (event.entity instanceof EntityPlayer) {
|
||||
for (Map.Entry<ModelRenderer,FramePart> entry : ClientEventHandler.originalValues.entrySet()) {
|
||||
for (Map.Entry<ModelRenderer, FramePart> entry : ClientEventHandler.originalValues.entrySet()) {
|
||||
ModelRenderer renderer = entry.getKey();
|
||||
FramePart part = entry.getValue();
|
||||
renderer.rotateAngleX = part.rotation[0];
|
||||
@@ -173,9 +173,9 @@ public class ClientEventHandler {
|
||||
ClientEventHandler.renderingPlayer = event.entityPlayer;
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority= EventPriority.LOWEST)
|
||||
public void pre(RenderPlayerEvent.Pre event){
|
||||
if(!(event.entity instanceof AbstractClientPlayer))
|
||||
@SubscribeEvent(priority = EventPriority.LOWEST)
|
||||
public void pre(RenderPlayerEvent.Pre event) {
|
||||
if (!(event.entity instanceof AbstractClientPlayer))
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ public class ClientEventHandler {
|
||||
ClientEventHandler.renderingPlayer = null;
|
||||
|
||||
if (renderPlayerJBRA != null && hasOverlays(player)) {
|
||||
if(renderPlayerJBRA.isInstance(event.renderer))
|
||||
if (renderPlayerJBRA.isInstance(event.renderer))
|
||||
return;
|
||||
|
||||
if (!(event.renderer instanceof RenderCNPCPlayer)) {
|
||||
@@ -330,7 +330,7 @@ public class ClientEventHandler {
|
||||
try {
|
||||
Class<?> ModelBipedBody = Class.forName("JinRyuu.JRMCore.entity.ModelBipedBody");
|
||||
Object model = renderer.baseModel;
|
||||
if(!(model instanceof ModelBiped))
|
||||
if (!(model instanceof ModelBiped))
|
||||
return null;
|
||||
|
||||
Field[] declared;
|
||||
@@ -338,7 +338,7 @@ public class ClientEventHandler {
|
||||
declared = ClientEventHandler.declaredFieldCache.get(ModelBipedBody);
|
||||
} else {
|
||||
declared = ModelBipedBody.getDeclaredFields();
|
||||
ClientEventHandler.declaredFieldCache.put(ModelBipedBody,declared);
|
||||
ClientEventHandler.declaredFieldCache.put(ModelBipedBody, declared);
|
||||
}
|
||||
Set<Map.Entry<EnumAnimationPart, String[]>> entrySet = ClientEventHandler.partNames.entrySet();
|
||||
for (Field f : declared) {
|
||||
@@ -350,11 +350,13 @@ public class ClientEventHandler {
|
||||
if (partName.equals(f.getName()) && renderer == f.get(model)) {
|
||||
return entry.getKey();
|
||||
}
|
||||
} catch (IllegalAccessException ignored) {}
|
||||
} catch (IllegalAccessException ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ignored) {}
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -84,58 +84,58 @@ import java.io.IOException;
|
||||
import java.util.Random;
|
||||
|
||||
public class ClientProxy extends CommonProxy {
|
||||
public static KeyBinding NPCButton;
|
||||
public static KeyBinding NPCButton;
|
||||
public static final Random RAND = new Random();
|
||||
public static FontContainer Font;
|
||||
public static FontContainer Font;
|
||||
|
||||
public void load() {
|
||||
Font = new FontContainer(ConfigClient.FontType, ConfigClient.FontSize);
|
||||
createFolders();
|
||||
new MusicController();
|
||||
new ScriptSoundController();
|
||||
public void load() {
|
||||
Font = new FontContainer(ConfigClient.FontType, ConfigClient.FontSize);
|
||||
createFolders();
|
||||
new MusicController();
|
||||
new ScriptSoundController();
|
||||
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityNpcPony.class, new RenderNPCPony());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityNpcCrystal.class, new RenderNpcCrystal(new ModelNpcCrystal(0.5F)));
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityNpcDragon.class, new RenderNpcDragon(new ModelNpcDragon(0.0F), 0.5F));
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityNpcSlime.class, new RenderNpcSlime(new ModelNpcSlime(16), new ModelNpcSlime(0), 0.25F));
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityProjectile.class, new RenderProjectile());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityNpcPony.class, new RenderNPCPony());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityNpcCrystal.class, new RenderNpcCrystal(new ModelNpcCrystal(0.5F)));
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityNpcDragon.class, new RenderNpcDragon(new ModelNpcDragon(0.0F), 0.5F));
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityNpcSlime.class, new RenderNpcSlime(new ModelNpcSlime(16), new ModelNpcSlime(0), 0.25F));
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityProjectile.class, new RenderProjectile());
|
||||
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityCustomNpc.class, new RenderCustomNpc());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityCustomNpc.class, new RenderCustomNpc());
|
||||
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityNPCGolem.class, new RenderNPCHumanMale(
|
||||
new ModelNPCGolem(0), new ModelNPCGolem(1F), new ModelNPCGolem(0.5F)));
|
||||
FMLCommonHandler.instance().bus().register(new ClientTickHandler());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityNPCGolem.class, new RenderNPCHumanMale(
|
||||
new ModelNPCGolem(0), new ModelNPCGolem(1F), new ModelNPCGolem(0.5F)));
|
||||
FMLCommonHandler.instance().bus().register(new ClientTickHandler());
|
||||
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileBlockAnvil.class, new BlockCarpentryBenchRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileMailbox.class, new BlockMailboxRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileBlockAnvil.class, new BlockCarpentryBenchRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileMailbox.class, new BlockMailboxRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileScripted.class, new BlockScriptedRenderer());
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(CustomItems.scripted), new ScriptedBlockItemRenderer());
|
||||
RenderingRegistry.registerBlockHandler(new BlockBorderRenderer());
|
||||
|
||||
if(!ConfigItem.DisableExtraBlock){
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileBanner.class, new BlockBannerRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileWallBanner.class, new BlockWallBannerRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileTallLamp.class, new BlockTallLampRenderer());
|
||||
if (!ConfigItem.DisableExtraBlock) {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileBanner.class, new BlockBannerRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileWallBanner.class, new BlockWallBannerRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileTallLamp.class, new BlockTallLampRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileShortLamp.class, new BlockShortLampRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileChair.class, new BlockChairRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileWeaponRack.class, new BlockWeaponRackRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileCrate.class, new BlockCrateRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileCouchWool.class, new BlockCouchWoolRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileCouchWood.class, new BlockCouchWoodRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileTable.class, new BlockTableRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileCandle.class, new BlockCandleRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileLamp.class, new BlockLanternRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileStool.class, new BlockStoolRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileBigSign.class, new BlockBigSignRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileBarrel.class, new BlockBarrelRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileCampfire.class, new BlockCampfireRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileTombstone.class, new BlockTombstoneRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileShelf.class, new BlockShelfRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileSign.class, new BlockSignRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileBeam.class, new BlockBeamRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileBook.class, new BlockBookRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TilePedestal.class, new BlockPedestalRenderer());
|
||||
RenderingRegistry.registerBlockHandler(new BlockBloodRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileChair.class, new BlockChairRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileWeaponRack.class, new BlockWeaponRackRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileCrate.class, new BlockCrateRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileCouchWool.class, new BlockCouchWoolRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileCouchWood.class, new BlockCouchWoodRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileTable.class, new BlockTableRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileCandle.class, new BlockCandleRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileLamp.class, new BlockLanternRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileStool.class, new BlockStoolRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileBigSign.class, new BlockBigSignRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileBarrel.class, new BlockBarrelRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileCampfire.class, new BlockCampfireRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileTombstone.class, new BlockTombstoneRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileShelf.class, new BlockShelfRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileSign.class, new BlockSignRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileBeam.class, new BlockBeamRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileBook.class, new BlockBookRenderer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TilePedestal.class, new BlockPedestalRenderer());
|
||||
RenderingRegistry.registerBlockHandler(new BlockBloodRenderer());
|
||||
|
||||
// Tile Item Renderers
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(CustomItems.couchWool), new ItemCouchWoolRenderer());
|
||||
@@ -143,83 +143,83 @@ public class ClientProxy extends CommonProxy {
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(CustomItems.wallBanner), new ItemBannerWallRenderer());
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(CustomItems.shortLamp), new ItemShortLampRenderer());
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(CustomItems.tallLamp), new ItemTallLampRenderer());
|
||||
}
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
}
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
NPCButton = new KeyBinding("NPC Inventory", Keyboard.KEY_N, "key.categories.customnpc");
|
||||
NPCButton = new KeyBinding("NPC Inventory", Keyboard.KEY_N, "key.categories.customnpc");
|
||||
|
||||
ClientRegistry.registerKeyBinding(NPCButton);
|
||||
mc.gameSettings.loadOptions();
|
||||
ClientRegistry.registerKeyBinding(NPCButton);
|
||||
mc.gameSettings.loadOptions();
|
||||
|
||||
new PresetController(CustomNpcs.Dir);
|
||||
new PresetController(CustomNpcs.Dir);
|
||||
|
||||
if(ConfigMain.EnableUpdateChecker){
|
||||
VersionChecker checker = new VersionChecker();
|
||||
checker.start();
|
||||
}
|
||||
if (ConfigMain.EnableUpdateChecker) {
|
||||
VersionChecker checker = new VersionChecker();
|
||||
checker.start();
|
||||
}
|
||||
|
||||
ClientCloneController.Instance = new ClientCloneController();
|
||||
ClientTagMapController.Instance = new ClientTagMapController();
|
||||
ClientCloneController.Instance = new ClientCloneController();
|
||||
ClientTagMapController.Instance = new ClientTagMapController();
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(new ClientEventHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new ClientEventHandler());
|
||||
|
||||
if(ConfigClient.InventoryGuiEnabled){
|
||||
MinecraftForge.EVENT_BUS.register(new TabRegistry());
|
||||
if (TabRegistry.getTabList().isEmpty()){
|
||||
TabRegistry.registerTab(new InventoryTabVanilla());
|
||||
}
|
||||
TabRegistry.registerTab(new InventoryTabCustomNpc());
|
||||
}
|
||||
}
|
||||
if (ConfigClient.InventoryGuiEnabled) {
|
||||
MinecraftForge.EVENT_BUS.register(new TabRegistry());
|
||||
if (TabRegistry.getTabList().isEmpty()) {
|
||||
TabRegistry.registerTab(new InventoryTabVanilla());
|
||||
}
|
||||
TabRegistry.registerTab(new InventoryTabCustomNpc());
|
||||
}
|
||||
}
|
||||
|
||||
public FakePlayer getCommandPlayer(IWorld world) {
|
||||
return (FakePlayer)(new EntityCustomNpc(world.getMCWorld())).getFakePlayer();
|
||||
}
|
||||
public FakePlayer getCommandPlayer(IWorld world) {
|
||||
return (FakePlayer) (new EntityCustomNpc(world.getMCWorld())).getFakePlayer();
|
||||
}
|
||||
|
||||
private void createFolders() {
|
||||
File file = new File(CustomNpcs.Dir,"assets/customnpcs");
|
||||
if(!file.exists())
|
||||
file.mkdirs();
|
||||
private void createFolders() {
|
||||
File file = new File(CustomNpcs.Dir, "assets/customnpcs");
|
||||
if (!file.exists())
|
||||
file.mkdirs();
|
||||
|
||||
File check = new File(file,"sounds");
|
||||
if(!check.exists())
|
||||
check.mkdir();
|
||||
File check = new File(file, "sounds");
|
||||
if (!check.exists())
|
||||
check.mkdir();
|
||||
|
||||
File json = new File(file, "sounds.json");
|
||||
if(!json.exists()){
|
||||
try {
|
||||
json.createNewFile();
|
||||
BufferedWriter writer = new BufferedWriter(new FileWriter(json));
|
||||
writer.write("{\n\n}");
|
||||
writer.close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
File json = new File(file, "sounds.json");
|
||||
if (!json.exists()) {
|
||||
try {
|
||||
json.createNewFile();
|
||||
BufferedWriter writer = new BufferedWriter(new FileWriter(json));
|
||||
writer.write("{\n\n}");
|
||||
writer.close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
|
||||
check = new File(file,"textures");
|
||||
if(!check.exists())
|
||||
check.mkdir();
|
||||
check = new File(file, "textures");
|
||||
if (!check.exists())
|
||||
check.mkdir();
|
||||
|
||||
File cache = new File(check,"cache");
|
||||
if(!cache.exists())
|
||||
cache.mkdir();
|
||||
((IReloadableResourceManager)Minecraft.getMinecraft().getResourceManager()).registerReloadListener(new CustomNpcResourceListener());
|
||||
}
|
||||
File cache = new File(check, "cache");
|
||||
if (!cache.exists())
|
||||
cache.mkdir();
|
||||
((IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()).registerReloadListener(new CustomNpcResourceListener());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PlayerData getPlayerData(EntityPlayer player) {
|
||||
if (player.getUniqueID() == Minecraft.getMinecraft().thePlayer.getUniqueID()) {
|
||||
if(ClientCacheHandler.playerData != null){
|
||||
@Override
|
||||
public PlayerData getPlayerData(EntityPlayer player) {
|
||||
if (player.getUniqueID() == Minecraft.getMinecraft().thePlayer.getUniqueID()) {
|
||||
if (ClientCacheHandler.playerData != null) {
|
||||
if (ClientCacheHandler.playerData.player != player) {
|
||||
ClientCacheHandler.playerData.player = player;
|
||||
}
|
||||
|
||||
return ClientCacheHandler.playerData;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public AnimationData getClientAnimationData(Entity entity) {
|
||||
if (entity instanceof EntityPlayer) {
|
||||
@@ -230,44 +230,43 @@ public class ClientProxy extends CommonProxy {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
@Override
|
||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
|
||||
if (ID > EnumGuiType.values().length)
|
||||
return null;
|
||||
EnumGuiType gui = EnumGuiType.values()[ID];
|
||||
EntityNPCInterface npc = NoppesUtil.getLastNpc();
|
||||
Container container = this.getContainer(gui, player, x, y, z, npc);
|
||||
return getGui(npc, gui, container, x, y, z);
|
||||
}
|
||||
if (ID > EnumGuiType.values().length)
|
||||
return null;
|
||||
EnumGuiType gui = EnumGuiType.values()[ID];
|
||||
EntityNPCInterface npc = NoppesUtil.getLastNpc();
|
||||
Container container = this.getContainer(gui, player, x, y, z, npc);
|
||||
return getGui(npc, gui, container, x, y, z);
|
||||
}
|
||||
|
||||
|
||||
private GuiScreen getGui(EntityNPCInterface npc, EnumGuiType gui, Container container, int x, int y, int z) {
|
||||
if (gui == EnumGuiType.MainMenuDisplay) {
|
||||
if (npc != null)
|
||||
return new GuiNpcDisplay(npc);
|
||||
else
|
||||
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("Unable to find npc"));
|
||||
} else if (gui == EnumGuiType.MainMenuStats)
|
||||
return new GuiNpcStats(npc);
|
||||
|
||||
private GuiScreen getGui(EntityNPCInterface npc, EnumGuiType gui, Container container, int x, int y, int z) {
|
||||
if (gui == EnumGuiType.MainMenuDisplay) {
|
||||
if (npc != null)
|
||||
return new GuiNpcDisplay(npc);
|
||||
else
|
||||
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("Unable to find npc"));
|
||||
} else if (gui == EnumGuiType.MainMenuStats)
|
||||
return new GuiNpcStats(npc);
|
||||
else if (gui == EnumGuiType.MainMenuInv)
|
||||
return new GuiNPCInv(npc, (ContainerNPCInv) container);
|
||||
|
||||
else if (gui == EnumGuiType.MainMenuInv)
|
||||
return new GuiNPCInv(npc, (ContainerNPCInv) container);
|
||||
else if (gui == EnumGuiType.MainMenuAdvanced)
|
||||
return new GuiNpcAdvanced(npc);
|
||||
|
||||
else if (gui == EnumGuiType.MainMenuAdvanced)
|
||||
return new GuiNpcAdvanced(npc);
|
||||
else if (gui == EnumGuiType.QuestReward)
|
||||
return new GuiNpcQuestReward(npc, (ContainerNpcQuestReward) container);
|
||||
|
||||
else if (gui == EnumGuiType.QuestReward)
|
||||
return new GuiNpcQuestReward(npc, (ContainerNpcQuestReward) container);
|
||||
else if (gui == EnumGuiType.QuestItem)
|
||||
return new GuiNpcQuestTypeItem(npc, (ContainerNpcQuestTypeItem) container);
|
||||
|
||||
else if (gui == EnumGuiType.QuestItem)
|
||||
return new GuiNpcQuestTypeItem(npc, (ContainerNpcQuestTypeItem) container);
|
||||
else if (gui == EnumGuiType.MovingPath)
|
||||
return new GuiNpcPather(npc);
|
||||
|
||||
else if (gui == EnumGuiType.MovingPath)
|
||||
return new GuiNpcPather(npc);
|
||||
|
||||
else if (gui == EnumGuiType.ManageFactions)
|
||||
else if (gui == EnumGuiType.ManageFactions)
|
||||
return new GuiNPCManageFactions(npc);
|
||||
|
||||
else if (gui == EnumGuiType.ManageCustomForms)
|
||||
@@ -276,150 +275,149 @@ public class ClientProxy extends CommonProxy {
|
||||
else if (gui == EnumGuiType.ManageCustomAuras)
|
||||
return DBCClient.Instance.manageCustomAuras(npc);
|
||||
|
||||
else if (gui == EnumGuiType.ManageTags)
|
||||
return new GuiNPCManageTags(npc);
|
||||
else if (gui == EnumGuiType.ManageTags)
|
||||
return new GuiNPCManageTags(npc);
|
||||
|
||||
else if (gui == EnumGuiType.ManageAnimations) {
|
||||
EntityCustomNpc animNpc;
|
||||
boolean save;
|
||||
if (npc != null) {
|
||||
animNpc = new EntityCustomNpc(npc.worldObj);
|
||||
animNpc.copyDataFrom(npc, true);
|
||||
animNpc.display.showName = 1;
|
||||
animNpc.display.showBossBar = 0;
|
||||
save = true;
|
||||
} else {
|
||||
animNpc = new EntityCustomNpc(Minecraft.getMinecraft().theWorld);
|
||||
animNpc.display.texture = "customnpcs:textures/entity/humanmale/AnimationBody.png";
|
||||
save = false;
|
||||
}
|
||||
return new GuiNPCManageAnimations(animNpc, save);
|
||||
}
|
||||
else if (gui == EnumGuiType.ManageLinked)
|
||||
return new GuiNPCManageLinked(npc);
|
||||
else if (gui == EnumGuiType.ManageAnimations) {
|
||||
EntityCustomNpc animNpc;
|
||||
boolean save;
|
||||
if (npc != null) {
|
||||
animNpc = new EntityCustomNpc(npc.worldObj);
|
||||
animNpc.copyDataFrom(npc, true);
|
||||
animNpc.display.showName = 1;
|
||||
animNpc.display.showBossBar = 0;
|
||||
save = true;
|
||||
} else {
|
||||
animNpc = new EntityCustomNpc(Minecraft.getMinecraft().theWorld);
|
||||
animNpc.display.texture = "customnpcs:textures/entity/humanmale/AnimationBody.png";
|
||||
save = false;
|
||||
}
|
||||
return new GuiNPCManageAnimations(animNpc, save);
|
||||
} else if (gui == EnumGuiType.ManageLinked)
|
||||
return new GuiNPCManageLinked(npc);
|
||||
|
||||
else if (gui == EnumGuiType.ManageMagic)
|
||||
return new GuiNpcManageMagic(npc);
|
||||
|
||||
else if (gui == EnumGuiType.ManageTransport)
|
||||
return new GuiNPCManageTransporters(npc);
|
||||
else if (gui == EnumGuiType.ManageTransport)
|
||||
return new GuiNPCManageTransporters(npc);
|
||||
|
||||
else if (gui == EnumGuiType.ManageRecipes)
|
||||
return new GuiNpcManageRecipes(npc, (ContainerManageRecipes) container);
|
||||
else if (gui == EnumGuiType.ManageRecipes)
|
||||
return new GuiNpcManageRecipes(npc, (ContainerManageRecipes) container);
|
||||
|
||||
else if (gui == EnumGuiType.ManageDialogs)
|
||||
return new GuiNPCManageDialogs(npc);
|
||||
else if (gui == EnumGuiType.ManageDialogs)
|
||||
return new GuiNPCManageDialogs(npc);
|
||||
|
||||
else if (gui == EnumGuiType.ManageQuests)
|
||||
return new GuiNPCManageQuest(npc);
|
||||
else if (gui == EnumGuiType.ManageQuests)
|
||||
return new GuiNPCManageQuest(npc);
|
||||
|
||||
else if (gui == EnumGuiType.ManageBanks)
|
||||
return new GuiNPCManageBanks(npc, (ContainerManageBanks) container);
|
||||
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);
|
||||
else if (gui == EnumGuiType.MainMenuGlobal)
|
||||
return new GuiNPCGlobalMainMenu(npc);
|
||||
|
||||
else if (gui == EnumGuiType.MainMenuAI)
|
||||
return new GuiNpcAI(npc);
|
||||
else if (gui == EnumGuiType.MainMenuAI)
|
||||
return new GuiNpcAI(npc);
|
||||
|
||||
else if (gui == EnumGuiType.PlayerFollowerHire)
|
||||
return new GuiNpcFollowerHire(npc, (ContainerNPCFollowerHire) container);
|
||||
else if (gui == EnumGuiType.PlayerFollowerHire)
|
||||
return new GuiNpcFollowerHire(npc, (ContainerNPCFollowerHire) container);
|
||||
|
||||
else if (gui == EnumGuiType.PlayerFollower)
|
||||
return new GuiNpcFollower(npc, (ContainerNPCFollower) container);
|
||||
else if (gui == EnumGuiType.PlayerFollower)
|
||||
return new GuiNpcFollower(npc, (ContainerNPCFollower) container);
|
||||
|
||||
else if (gui == EnumGuiType.PlayerTrader)
|
||||
return new GuiNPCTrader(npc, (ContainerNPCTrader) container);
|
||||
else if (gui == EnumGuiType.PlayerTrader)
|
||||
return new GuiNPCTrader(npc, (ContainerNPCTrader) container);
|
||||
|
||||
else if (gui == EnumGuiType.PlayerBankSmall || gui == EnumGuiType.PlayerBankUnlock || gui == EnumGuiType.PlayerBankUprade || gui == EnumGuiType.PlayerBankLarge)
|
||||
return new GuiNPCBankChest(npc, (ContainerNPCBankInterface) container);
|
||||
else if (gui == EnumGuiType.PlayerBankSmall || gui == EnumGuiType.PlayerBankUnlock || gui == EnumGuiType.PlayerBankUprade || gui == EnumGuiType.PlayerBankLarge)
|
||||
return new GuiNPCBankChest(npc, (ContainerNPCBankInterface) container);
|
||||
|
||||
else if (gui == EnumGuiType.PlayerTransporter)
|
||||
return new GuiTransportSelection(npc);
|
||||
else if (gui == EnumGuiType.PlayerTransporter)
|
||||
return new GuiTransportSelection(npc);
|
||||
|
||||
else if (gui == EnumGuiType.Script)
|
||||
return new GuiScript(npc);
|
||||
else if (gui == EnumGuiType.Script)
|
||||
return new GuiScript(npc);
|
||||
|
||||
else if (gui == EnumGuiType.ScriptItem)
|
||||
return new GuiScriptItem();
|
||||
else if (gui == EnumGuiType.ScriptItem)
|
||||
return new GuiScriptItem();
|
||||
|
||||
else if (gui == EnumGuiType.PlayerCarpentryBench)
|
||||
return new GuiNpcCarpentryBench((ContainerCarpentryBench) container);
|
||||
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);
|
||||
else if (gui == EnumGuiType.SetupFollower)
|
||||
return new GuiNpcFollowerSetup(npc, (ContainerNPCFollowerSetup) container);
|
||||
|
||||
else if (gui == EnumGuiType.SetupItemGiver)
|
||||
return new GuiNpcItemGiver(npc, (ContainerNpcItemGiver) container);
|
||||
else if (gui == EnumGuiType.SetupItemGiver)
|
||||
return new GuiNpcItemGiver(npc, (ContainerNpcItemGiver) container);
|
||||
|
||||
else if (gui == EnumGuiType.SetupTrader)
|
||||
return new GuiNpcTraderSetup(npc, (ContainerNPCTraderSetup) container);
|
||||
else if (gui == EnumGuiType.SetupTrader)
|
||||
return new GuiNpcTraderSetup(npc, (ContainerNPCTraderSetup) container);
|
||||
|
||||
else if (gui == EnumGuiType.SetupTransporter)
|
||||
return new GuiNpcTransporter(npc);
|
||||
else if (gui == EnumGuiType.SetupTransporter)
|
||||
return new GuiNpcTransporter(npc);
|
||||
|
||||
else if (gui == EnumGuiType.SetupBank)
|
||||
return new GuiNpcBankSetup(npc);
|
||||
else if (gui == EnumGuiType.SetupBank)
|
||||
return new GuiNpcBankSetup(npc);
|
||||
|
||||
else if (gui == EnumGuiType.NpcRemote && Minecraft.getMinecraft().currentScreen == null)
|
||||
return new GuiNpcRemoteEditor();
|
||||
else if (gui == EnumGuiType.NpcRemote && Minecraft.getMinecraft().currentScreen == null)
|
||||
return new GuiNpcRemoteEditor();
|
||||
|
||||
else if (gui == EnumGuiType.ScriptEvent && Minecraft.getMinecraft().currentScreen == null)
|
||||
return new GuiScriptGlobal();
|
||||
else if (gui == EnumGuiType.ScriptEvent && Minecraft.getMinecraft().currentScreen == null)
|
||||
return new GuiScriptGlobal();
|
||||
|
||||
else if (gui == EnumGuiType.PlayerMailman)
|
||||
return new GuiMailmanWrite((ContainerMail) container, x == 1, y == 1);
|
||||
else if (gui == EnumGuiType.PlayerMailman)
|
||||
return new GuiMailmanWrite((ContainerMail) container, x == 1, y == 1);
|
||||
|
||||
else if (gui == EnumGuiType.PlayerMailbox)
|
||||
return new GuiMailbox();
|
||||
else if (gui == EnumGuiType.PlayerMailbox)
|
||||
return new GuiMailbox();
|
||||
|
||||
else if (gui == EnumGuiType.MerchantAdd)
|
||||
return new GuiMerchantAdd();
|
||||
else if (gui == EnumGuiType.MerchantAdd)
|
||||
return new GuiMerchantAdd();
|
||||
|
||||
else if (gui == EnumGuiType.Crate)
|
||||
return new GuiCrate((ContainerCrate) container);
|
||||
else if (gui == EnumGuiType.Crate)
|
||||
return new GuiCrate((ContainerCrate) container);
|
||||
|
||||
else if(gui == EnumGuiType.NpcDimensions)
|
||||
return new GuiNpcDimension();
|
||||
else if (gui == EnumGuiType.NpcDimensions)
|
||||
return new GuiNpcDimension();
|
||||
|
||||
else if(gui == EnumGuiType.Border)
|
||||
return new GuiBorderBlock(x, y, z);
|
||||
else if (gui == EnumGuiType.Border)
|
||||
return new GuiBorderBlock(x, y, z);
|
||||
|
||||
else if(gui == EnumGuiType.BigSign)
|
||||
return new GuiBigSign(x, y, z);
|
||||
else if (gui == EnumGuiType.BigSign)
|
||||
return new GuiBigSign(x, y, z);
|
||||
|
||||
else if (gui == EnumGuiType.RedstoneBlock)
|
||||
return new GuiNpcRedstoneBlock(x, y, z);
|
||||
else if (gui == EnumGuiType.RedstoneBlock)
|
||||
return new GuiNpcRedstoneBlock(x, y, z);
|
||||
|
||||
else if(gui == EnumGuiType.Cloner)
|
||||
return new GuiNpcMobSpawner(x, y, z);
|
||||
else if (gui == EnumGuiType.Cloner)
|
||||
return new GuiNpcMobSpawner(x, y, z);
|
||||
|
||||
else if(gui == EnumGuiType.MobSpawnerMounter)
|
||||
return new GuiNpcMobSpawnerMounter(x, y, z);
|
||||
else if (gui == EnumGuiType.MobSpawnerMounter)
|
||||
return new GuiNpcMobSpawnerMounter(x, y, z);
|
||||
|
||||
else if (gui == EnumGuiType.Waypoint)
|
||||
return new GuiNpcWaypoint(x, y, z);
|
||||
else if (gui == EnumGuiType.Waypoint)
|
||||
return new GuiNpcWaypoint(x, y, z);
|
||||
|
||||
else if (gui == EnumGuiType.Companion)
|
||||
return new GuiNpcCompanionStats(npc);
|
||||
else if (gui == EnumGuiType.Companion)
|
||||
return new GuiNpcCompanionStats(npc);
|
||||
|
||||
else if (gui == EnumGuiType.CompanionTalent)
|
||||
return new GuiNpcCompanionTalents(npc);
|
||||
else if (gui == EnumGuiType.CompanionTalent)
|
||||
return new GuiNpcCompanionTalents(npc);
|
||||
|
||||
else if (gui == EnumGuiType.CompanionInv)
|
||||
return new GuiNpcCompanionInv(npc, (ContainerNPCCompanion) container);
|
||||
else if (gui == EnumGuiType.CompanionInv)
|
||||
return new GuiNpcCompanionInv(npc, (ContainerNPCCompanion) container);
|
||||
|
||||
else if (gui == EnumGuiType.CustomGui)
|
||||
return new GuiCustom((ContainerCustomGui)container);
|
||||
else if (gui == EnumGuiType.CustomGui)
|
||||
return new GuiCustom((ContainerCustomGui) container);
|
||||
|
||||
else if (gui == EnumGuiType.ScriptBlock)
|
||||
return new GuiScriptBlock(x,y,z);
|
||||
else if (gui == EnumGuiType.ScriptBlock)
|
||||
return new GuiScriptBlock(x, y, z);
|
||||
|
||||
else if (gui == EnumGuiType.Paintbrush)
|
||||
return new GuiNpcPaintbrush();
|
||||
@@ -427,234 +425,227 @@ public class ClientProxy extends CommonProxy {
|
||||
else if (gui == EnumGuiType.GlobalRemote)
|
||||
return new GuiNPCGlobalMainMenu(null);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openGui(int i, int j, int k, EnumGuiType gui, EntityPlayer player) {
|
||||
Minecraft minecraft = Minecraft.getMinecraft();
|
||||
if(minecraft.thePlayer != player)
|
||||
return;
|
||||
|
||||
GuiScreen guiscreen = getGui(null, gui, null, i, j, k);
|
||||
|
||||
|
||||
if (guiscreen != null) {
|
||||
minecraft.displayGuiScreen(guiscreen);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openGui(EntityNPCInterface npc, EnumGuiType gui) {
|
||||
openGui(npc, gui, 0, 0, 0);
|
||||
}
|
||||
|
||||
public void openGui(EntityNPCInterface npc, EnumGuiType gui, int x, int y, int z) {
|
||||
Minecraft minecraft = Minecraft.getMinecraft();
|
||||
|
||||
Container container = this.getContainer(gui, minecraft.thePlayer, x, y, z, npc);
|
||||
GuiScreen guiscreen = getGui(npc, gui,container, x, y, z);
|
||||
|
||||
if (guiscreen != null) {
|
||||
minecraft.displayGuiScreen(guiscreen);
|
||||
}
|
||||
}
|
||||
|
||||
public void openGui(EntityPlayer player, Object guiscreen) {
|
||||
Minecraft minecraft = Minecraft.getMinecraft();
|
||||
if(!player.worldObj.isRemote || !(guiscreen instanceof GuiScreen))
|
||||
return;
|
||||
|
||||
if (guiscreen != null) {
|
||||
minecraft.displayGuiScreen((GuiScreen)guiscreen);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spawnParticle(EntityLivingBase player, String string, Object... ob) {
|
||||
if(string.equals("Spell")){
|
||||
int color = (Integer) ob[0];
|
||||
int number = (Integer) ob[1];
|
||||
for(int i = 0; i < number; i++){
|
||||
Random rand = player.worldObj.rand;
|
||||
double x = (rand.nextDouble() - 0.5D) * (double)player.width;
|
||||
double y = player.getEyeHeight();
|
||||
double z = (rand.nextDouble() - 0.5D) * (double)player.width;
|
||||
|
||||
double f = (rand.nextDouble() - 0.5D) * 2D;
|
||||
double f1 = -rand.nextDouble();
|
||||
double f2 = (rand.nextDouble() - 0.5D) * 2D;
|
||||
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(new EntityElementalStaffFX(player, x, y, z, f, f1, f2, color));
|
||||
}
|
||||
}
|
||||
else if(string.equals("ModelData")){
|
||||
ModelData data = (ModelData) ob[0];
|
||||
ModelPartData particles = (ModelPartData) ob[1];
|
||||
EntityCustomNpc npc = (EntityCustomNpc) player;
|
||||
Minecraft minecraft = Minecraft.getMinecraft();
|
||||
double height = npc.getYOffset() + data.getBodyY();
|
||||
Random rand = npc.getRNG();
|
||||
if(particles.type == 0){
|
||||
for(int i = 0; i< 2; i++){
|
||||
EntityEnderFX fx = new EntityEnderFX(npc, (rand.nextDouble() - 0.5D) * (double)player.width, (rand.nextDouble() * (double)player.height) - height - 0.25D, (rand.nextDouble() - 0.5D) * (double)player.width, (rand.nextDouble() - 0.5D) * 2D, -rand.nextDouble(), (rand.nextDouble() - 0.5D) * 2D, particles);
|
||||
minecraft.effectRenderer.addEffect(fx);
|
||||
}
|
||||
|
||||
}
|
||||
else if(particles.type == 1){
|
||||
for(int i = 0; i < 2; i++){
|
||||
double x = player.posX + (rand.nextDouble() - 0.5D) * 0.9;
|
||||
double y = (player.posY + rand.nextDouble() * 1.9) - 0.25D - height;
|
||||
double z = player.posZ + (rand.nextDouble() - 0.5D) * 0.9;
|
||||
|
||||
|
||||
double f = (rand.nextDouble() - 0.5D) * 2D;
|
||||
double f1 = -rand.nextDouble();
|
||||
double f2 = (rand.nextDouble() - 0.5D) * 2D;
|
||||
|
||||
minecraft.effectRenderer.addEffect(new EntityRainbowFX(player.worldObj, x, y, z, f, f1, f2));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private ModelSkirtArmor model = new ModelSkirtArmor();
|
||||
|
||||
public ModelBiped getSkirtModel() {
|
||||
return model;
|
||||
}
|
||||
|
||||
public boolean hasClient() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public EntityPlayer getPlayer() {
|
||||
return Minecraft.getMinecraft().thePlayer;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void registerItem(Item item) {
|
||||
if (item instanceof ItemScripted || item instanceof ItemLinked) {
|
||||
MinecraftForgeClient.registerItemRenderer(item, new ItemCustomRenderer());
|
||||
} else if (item instanceof ItemNpcTool) {
|
||||
MinecraftForgeClient.registerItemRenderer(item, new ItemToolRenderer());
|
||||
}else {
|
||||
MinecraftForgeClient.registerItemRenderer(item, new NpcItemRenderer());
|
||||
}
|
||||
}
|
||||
|
||||
public static void bindTexture(ResourceLocation location) {
|
||||
try{
|
||||
if(location == null)
|
||||
return;
|
||||
TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
|
||||
if(location != null)
|
||||
texturemanager.bindTexture((ResourceLocation) location);
|
||||
}
|
||||
catch(NullPointerException ex){
|
||||
|
||||
}
|
||||
catch(ReportedException ex){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spawnParticle(String particle, double x, double y, double z,
|
||||
double motionX, double motionY, double motionZ, float scale) {
|
||||
|
||||
RenderGlobal render = Minecraft.getMinecraft().renderGlobal;
|
||||
|
||||
EntityFX fx = render.doSpawnParticle(particle, x, y, z, motionX, motionY, motionZ);
|
||||
if(fx == null)
|
||||
return;
|
||||
|
||||
if (particle.equals("flame")){
|
||||
ObfuscationReflectionHelper.setPrivateValue(EntityFlameFX.class, (EntityFlameFX)fx, scale, 0);
|
||||
}
|
||||
else if (particle.equals("smoke")){
|
||||
ObfuscationReflectionHelper.setPrivateValue(EntitySmokeFX.class, (EntitySmokeFX)fx, scale, 0);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateBigSmokeParticles(World world, int x, int y, int z, boolean signalFire)
|
||||
{
|
||||
if (RAND.nextFloat() < 0.11F)
|
||||
{
|
||||
public void openGui(int i, int j, int k, EnumGuiType gui, EntityPlayer player) {
|
||||
Minecraft minecraft = Minecraft.getMinecraft();
|
||||
if (minecraft.thePlayer != player)
|
||||
return;
|
||||
|
||||
GuiScreen guiscreen = getGui(null, gui, null, i, j, k);
|
||||
|
||||
|
||||
if (guiscreen != null) {
|
||||
minecraft.displayGuiScreen(guiscreen);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openGui(EntityNPCInterface npc, EnumGuiType gui) {
|
||||
openGui(npc, gui, 0, 0, 0);
|
||||
}
|
||||
|
||||
public void openGui(EntityNPCInterface npc, EnumGuiType gui, int x, int y, int z) {
|
||||
Minecraft minecraft = Minecraft.getMinecraft();
|
||||
|
||||
Container container = this.getContainer(gui, minecraft.thePlayer, x, y, z, npc);
|
||||
GuiScreen guiscreen = getGui(npc, gui, container, x, y, z);
|
||||
|
||||
if (guiscreen != null) {
|
||||
minecraft.displayGuiScreen(guiscreen);
|
||||
}
|
||||
}
|
||||
|
||||
public void openGui(EntityPlayer player, Object guiscreen) {
|
||||
Minecraft minecraft = Minecraft.getMinecraft();
|
||||
if (!player.worldObj.isRemote || !(guiscreen instanceof GuiScreen))
|
||||
return;
|
||||
|
||||
if (guiscreen != null) {
|
||||
minecraft.displayGuiScreen((GuiScreen) guiscreen);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spawnParticle(EntityLivingBase player, String string, Object... ob) {
|
||||
if (string.equals("Spell")) {
|
||||
int color = (Integer) ob[0];
|
||||
int number = (Integer) ob[1];
|
||||
for (int i = 0; i < number; i++) {
|
||||
Random rand = player.worldObj.rand;
|
||||
double x = (rand.nextDouble() - 0.5D) * (double) player.width;
|
||||
double y = player.getEyeHeight();
|
||||
double z = (rand.nextDouble() - 0.5D) * (double) player.width;
|
||||
|
||||
double f = (rand.nextDouble() - 0.5D) * 2D;
|
||||
double f1 = -rand.nextDouble();
|
||||
double f2 = (rand.nextDouble() - 0.5D) * 2D;
|
||||
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(new EntityElementalStaffFX(player, x, y, z, f, f1, f2, color));
|
||||
}
|
||||
} else if (string.equals("ModelData")) {
|
||||
ModelData data = (ModelData) ob[0];
|
||||
ModelPartData particles = (ModelPartData) ob[1];
|
||||
EntityCustomNpc npc = (EntityCustomNpc) player;
|
||||
Minecraft minecraft = Minecraft.getMinecraft();
|
||||
double height = npc.getYOffset() + data.getBodyY();
|
||||
Random rand = npc.getRNG();
|
||||
if (particles.type == 0) {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
EntityEnderFX fx = new EntityEnderFX(npc, (rand.nextDouble() - 0.5D) * (double) player.width, (rand.nextDouble() * (double) player.height) - height - 0.25D, (rand.nextDouble() - 0.5D) * (double) player.width, (rand.nextDouble() - 0.5D) * 2D, -rand.nextDouble(), (rand.nextDouble() - 0.5D) * 2D, particles);
|
||||
minecraft.effectRenderer.addEffect(fx);
|
||||
}
|
||||
|
||||
} else if (particles.type == 1) {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
double x = player.posX + (rand.nextDouble() - 0.5D) * 0.9;
|
||||
double y = (player.posY + rand.nextDouble() * 1.9) - 0.25D - height;
|
||||
double z = player.posZ + (rand.nextDouble() - 0.5D) * 0.9;
|
||||
|
||||
|
||||
double f = (rand.nextDouble() - 0.5D) * 2D;
|
||||
double f1 = -rand.nextDouble();
|
||||
double f2 = (rand.nextDouble() - 0.5D) * 2D;
|
||||
|
||||
minecraft.effectRenderer.addEffect(new EntityRainbowFX(player.worldObj, x, y, z, f, f1, f2));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ModelSkirtArmor model = new ModelSkirtArmor();
|
||||
|
||||
public ModelBiped getSkirtModel() {
|
||||
return model;
|
||||
}
|
||||
|
||||
public boolean hasClient() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public EntityPlayer getPlayer() {
|
||||
return Minecraft.getMinecraft().thePlayer;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void registerItem(Item item) {
|
||||
if (item instanceof ItemScripted || item instanceof ItemLinked) {
|
||||
MinecraftForgeClient.registerItemRenderer(item, new ItemCustomRenderer());
|
||||
} else if (item instanceof ItemNpcTool) {
|
||||
MinecraftForgeClient.registerItemRenderer(item, new ItemToolRenderer());
|
||||
} else {
|
||||
MinecraftForgeClient.registerItemRenderer(item, new NpcItemRenderer());
|
||||
}
|
||||
}
|
||||
|
||||
public static void bindTexture(ResourceLocation location) {
|
||||
try {
|
||||
if (location == null)
|
||||
return;
|
||||
TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
|
||||
if (location != null)
|
||||
texturemanager.bindTexture((ResourceLocation) location);
|
||||
} catch (NullPointerException ex) {
|
||||
|
||||
} catch (ReportedException ex) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spawnParticle(String particle, double x, double y, double z,
|
||||
double motionX, double motionY, double motionZ, float scale) {
|
||||
|
||||
RenderGlobal render = Minecraft.getMinecraft().renderGlobal;
|
||||
|
||||
EntityFX fx = render.doSpawnParticle(particle, x, y, z, motionX, motionY, motionZ);
|
||||
if (fx == null)
|
||||
return;
|
||||
|
||||
if (particle.equals("flame")) {
|
||||
ObfuscationReflectionHelper.setPrivateValue(EntityFlameFX.class, (EntityFlameFX) fx, scale, 0);
|
||||
} else if (particle.equals("smoke")) {
|
||||
ObfuscationReflectionHelper.setPrivateValue(EntitySmokeFX.class, (EntitySmokeFX) fx, scale, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@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();
|
||||
}
|
||||
@Override
|
||||
public String getAchievementDesc(Achievement achievement) {
|
||||
return achievement.getDescription();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGUIOpen(){
|
||||
return Minecraft.getMinecraft().currentScreen != null;
|
||||
}
|
||||
@Override
|
||||
public boolean isGUIOpen() {
|
||||
return Minecraft.getMinecraft().currentScreen != null;
|
||||
}
|
||||
|
||||
public static class FontContainer {
|
||||
public StringCache textFont = null;
|
||||
public boolean useCustomFont = true;
|
||||
public static class FontContainer {
|
||||
public StringCache textFont = null;
|
||||
public boolean useCustomFont = true;
|
||||
|
||||
private FontContainer(){
|
||||
private FontContainer() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public FontContainer(String fontType, int fontSize) {
|
||||
textFont = new StringCache();
|
||||
textFont.setDefaultFont("Arial", fontSize, true);
|
||||
useCustomFont = !fontType.equalsIgnoreCase("minecraft");
|
||||
try {
|
||||
if(!useCustomFont || fontType.isEmpty() || fontType.equalsIgnoreCase("default"))
|
||||
textFont.setCustomFont(new ResourceLocation("customnpcs","OpenSans.ttf"), fontSize, true);
|
||||
else
|
||||
textFont.setDefaultFont(fontType, fontSize, true);
|
||||
} catch (Exception e) {
|
||||
LogWriter.info("Failed loading font so using Arial");
|
||||
}
|
||||
}
|
||||
public FontContainer(String fontType, int fontSize) {
|
||||
textFont = new StringCache();
|
||||
textFont.setDefaultFont("Arial", fontSize, true);
|
||||
useCustomFont = !fontType.equalsIgnoreCase("minecraft");
|
||||
try {
|
||||
if (!useCustomFont || fontType.isEmpty() || fontType.equalsIgnoreCase("default"))
|
||||
textFont.setCustomFont(new ResourceLocation("customnpcs", "OpenSans.ttf"), fontSize, true);
|
||||
else
|
||||
textFont.setDefaultFont(fontType, fontSize, true);
|
||||
} catch (Exception e) {
|
||||
LogWriter.info("Failed loading font so using Arial");
|
||||
}
|
||||
}
|
||||
|
||||
public int height(){
|
||||
if(useCustomFont)
|
||||
return textFont.fontHeight;
|
||||
return Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT;
|
||||
}
|
||||
public int height() {
|
||||
if (useCustomFont)
|
||||
return textFont.fontHeight;
|
||||
return Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT;
|
||||
}
|
||||
|
||||
public int width(String text){
|
||||
if(useCustomFont)
|
||||
return textFont.getStringWidth(text);
|
||||
return Minecraft.getMinecraft().fontRenderer.getStringWidth(text);
|
||||
}
|
||||
public int width(String text) {
|
||||
if (useCustomFont)
|
||||
return textFont.getStringWidth(text);
|
||||
return Minecraft.getMinecraft().fontRenderer.getStringWidth(text);
|
||||
}
|
||||
|
||||
public FontContainer copy() {
|
||||
FontContainer font = new FontContainer();
|
||||
font.textFont = textFont;
|
||||
font.useCustomFont = useCustomFont;
|
||||
return font;
|
||||
}
|
||||
public FontContainer copy() {
|
||||
FontContainer font = new FontContainer();
|
||||
font.textFont = textFont;
|
||||
font.useCustomFont = useCustomFont;
|
||||
return font;
|
||||
}
|
||||
|
||||
public void drawString(String text, int x, int y, int color) {
|
||||
if(useCustomFont){
|
||||
textFont.renderString(text, x, y, color, true);
|
||||
textFont.renderString(text, x, y, color, false);
|
||||
}
|
||||
else{
|
||||
Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(text, x, y, color);
|
||||
}
|
||||
}
|
||||
public void drawString(String text, int x, int y, int color) {
|
||||
if (useCustomFont) {
|
||||
textFont.renderString(text, x, y, color, true);
|
||||
textFont.renderString(text, x, y, color, false);
|
||||
} else {
|
||||
Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(text, x, y, color);
|
||||
}
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
if(!useCustomFont)
|
||||
return "Minecraft";
|
||||
return textFont.usedFont().getFontName();
|
||||
}
|
||||
}
|
||||
public String getName() {
|
||||
if (!useCustomFont)
|
||||
return "Minecraft";
|
||||
return textFont.usedFont().getFontName();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,40 +34,39 @@ import java.util.ArrayList;
|
||||
|
||||
import static noppes.npcs.client.ClientEventHandler.renderCNPCPlayer;
|
||||
|
||||
public class ClientTickHandler{
|
||||
private World prevWorld;
|
||||
private int prevWidth = 0;
|
||||
private int prevHeight = 0;
|
||||
private boolean otherContainer = false;
|
||||
private int buttonPressed = -1;
|
||||
private long buttonTime = 0L;
|
||||
private final int[] ignoreKeys = new int[]{157, 29, 54, 42, 184, 56, 220, 219};
|
||||
public class ClientTickHandler {
|
||||
private World prevWorld;
|
||||
private int prevWidth = 0;
|
||||
private int prevHeight = 0;
|
||||
private boolean otherContainer = false;
|
||||
private int buttonPressed = -1;
|
||||
private long buttonTime = 0L;
|
||||
private final int[] ignoreKeys = new int[]{157, 29, 54, 42, 184, 56, 220, 219};
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.LOWEST)
|
||||
public void onClientTick(TickEvent.ClientTickEvent event){
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
if ((this.prevWorld == null || mc.theWorld == null) && this.prevWorld != mc.theWorld) {
|
||||
@SubscribeEvent(priority = EventPriority.LOWEST)
|
||||
public void onClientTick(TickEvent.ClientTickEvent event) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
if ((this.prevWorld == null || mc.theWorld == null) && this.prevWorld != mc.theWorld) {
|
||||
if (mc.theWorld == null) {
|
||||
ClientCacheHandler.clearCache();
|
||||
}
|
||||
this.prevWorld = mc.theWorld;
|
||||
}
|
||||
if(event.phase == Phase.END) {
|
||||
if (mc.thePlayer != null && mc.theWorld != null && !mc.isGamePaused() && ClientEventHandler.hasOverlays(mc.thePlayer)) {
|
||||
renderCNPCPlayer.itemRenderer.updateEquippedItem();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(mc.thePlayer != null && mc.thePlayer.openContainer instanceof ContainerPlayer){
|
||||
if(otherContainer){
|
||||
this.prevWorld = mc.theWorld;
|
||||
}
|
||||
if (event.phase == Phase.END) {
|
||||
if (mc.thePlayer != null && mc.theWorld != null && !mc.isGamePaused() && ClientEventHandler.hasOverlays(mc.thePlayer)) {
|
||||
renderCNPCPlayer.itemRenderer.updateEquippedItem();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (mc.thePlayer != null && mc.thePlayer.openContainer instanceof ContainerPlayer) {
|
||||
if (otherContainer) {
|
||||
PacketClient.sendClient(new CheckPlayerValue(CheckPlayerValue.Type.CheckQuestCompletion));
|
||||
otherContainer = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
otherContainer = true;
|
||||
CustomNpcs.ticks++;
|
||||
RenderNPCInterface.LastTextureTick++;
|
||||
otherContainer = false;
|
||||
}
|
||||
} else
|
||||
otherContainer = true;
|
||||
CustomNpcs.ticks++;
|
||||
RenderNPCInterface.LastTextureTick++;
|
||||
|
||||
if (MusicController.Instance.isPlaying() && MusicController.Instance.getEntity() != null) {
|
||||
Entity entity = MusicController.Instance.getEntity();
|
||||
@@ -80,101 +79,101 @@ public class ClientTickHandler{
|
||||
}
|
||||
|
||||
MusicController.Instance.onUpdate();
|
||||
ScriptSoundController.Instance.onUpdate();
|
||||
if(Minecraft.getMinecraft().thePlayer!=null && (prevWidth!=mc.displayWidth || prevHeight!=mc.displayHeight)){
|
||||
prevWidth = mc.displayWidth;
|
||||
prevHeight = mc.displayHeight;
|
||||
PacketClient.sendClient(new ScreenSizePacket(mc.displayWidth,mc.displayHeight));
|
||||
}
|
||||
ScriptSoundController.Instance.onUpdate();
|
||||
if (Minecraft.getMinecraft().thePlayer != null && (prevWidth != mc.displayWidth || prevHeight != mc.displayHeight)) {
|
||||
prevWidth = mc.displayWidth;
|
||||
prevHeight = mc.displayHeight;
|
||||
PacketClient.sendClient(new ScreenSizePacket(mc.displayWidth, mc.displayHeight));
|
||||
}
|
||||
|
||||
if(mc.theWorld == null)
|
||||
if (mc.theWorld == null)
|
||||
return;
|
||||
|
||||
if(mc.theWorld.getTotalWorldTime() % 20 == 0) { // Update every second
|
||||
if (mc.theWorld.getTotalWorldTime() % 20 == 0) { // Update every second
|
||||
updateCompassMarks();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onMouse(InputEvent.MouseInputEvent event){
|
||||
if(Mouse.getEventButton() == -1 && Mouse.getEventDWheel() == 0)
|
||||
return;
|
||||
@SubscribeEvent
|
||||
public void onMouse(InputEvent.MouseInputEvent event) {
|
||||
if (Mouse.getEventButton() == -1 && Mouse.getEventDWheel() == 0)
|
||||
return;
|
||||
|
||||
InputDevicePacket.sendMouse(Mouse.getEventButton(),Mouse.getEventDWheel(),Mouse.isButtonDown(Mouse.getEventButton()));
|
||||
}
|
||||
InputDevicePacket.sendMouse(Mouse.getEventButton(), Mouse.getEventDWheel(), Mouse.isButtonDown(Mouse.getEventButton()));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onKey(InputEvent.KeyInputEvent event){
|
||||
if(ClientProxy.NPCButton.isPressed()){
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
if(mc.currentScreen == null){
|
||||
@SubscribeEvent
|
||||
public void onKey(InputEvent.KeyInputEvent event) {
|
||||
if (ClientProxy.NPCButton.isPressed()) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
if (mc.currentScreen == null) {
|
||||
InventoryTabCustomNpc.tabHelper();
|
||||
}
|
||||
else if(mc.currentScreen instanceof GuiCNPCInventory)
|
||||
mc.setIngameFocus();
|
||||
}
|
||||
} else if (mc.currentScreen instanceof GuiCNPCInventory)
|
||||
mc.setIngameFocus();
|
||||
}
|
||||
|
||||
if(!Keyboard.isRepeatEvent()) {
|
||||
int key = Keyboard.getEventKey();
|
||||
boolean keyDown = Keyboard.isKeyDown(key);
|
||||
if (!Keyboard.isRepeatEvent()) {
|
||||
int key = Keyboard.getEventKey();
|
||||
boolean keyDown = Keyboard.isKeyDown(key);
|
||||
|
||||
InputDevicePacket.sendKeyboard(key, keyDown);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isIgnoredKey(int key) {
|
||||
int[] var2 = this.ignoreKeys;
|
||||
int var3 = var2.length;
|
||||
private boolean isIgnoredKey(int key) {
|
||||
int[] var2 = this.ignoreKeys;
|
||||
int var3 = var2.length;
|
||||
|
||||
for(int var4 = 0; var4 < var3; ++var4) {
|
||||
int i = var2[var4];
|
||||
if(i == key) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
for (int var4 = 0; var4 < var3; ++var4) {
|
||||
int i = var2[var4];
|
||||
if (i == key) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private final int SCAN_RANGE = 128;
|
||||
|
||||
private void updateCompassMarks() {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
EntityPlayer player = mc.thePlayer;
|
||||
|
||||
if(player == null || mc.theWorld == null)
|
||||
if (player == null || mc.theWorld == null)
|
||||
return;
|
||||
|
||||
if(ClientHudManager.getInstance() == null || ClientHudManager.getInstance().getHudComponents() == null)
|
||||
if (ClientHudManager.getInstance() == null || ClientHudManager.getInstance().getHudComponents() == null)
|
||||
return;
|
||||
|
||||
// Update compass
|
||||
HudComponent compass = ClientHudManager.getInstance()
|
||||
.getHudComponents().get(EnumHudComponent.QuestCompass);
|
||||
|
||||
if(!(compass instanceof CompassHudComponent))
|
||||
if (!(compass instanceof CompassHudComponent))
|
||||
return;
|
||||
|
||||
if(!compass.enabled)
|
||||
if (!compass.enabled)
|
||||
return;
|
||||
|
||||
ArrayList<CompassHudComponent.MarkTargetEntry> marks = new ArrayList<>();
|
||||
|
||||
// Scan entities in loaded chunks
|
||||
for(Object entity : mc.theWorld.loadedEntityList) {
|
||||
if(entity instanceof EntityNPCInterface) {
|
||||
for (Object entity : mc.theWorld.loadedEntityList) {
|
||||
if (entity instanceof EntityNPCInterface) {
|
||||
EntityNPCInterface npc = (EntityNPCInterface) entity;
|
||||
|
||||
if(npc.dimension != player.dimension)
|
||||
if (npc.dimension != player.dimension)
|
||||
continue;
|
||||
|
||||
// Check distance
|
||||
if(player.getDistanceToEntity(npc) > SCAN_RANGE)
|
||||
if (player.getDistanceToEntity(npc) > SCAN_RANGE)
|
||||
continue;
|
||||
|
||||
// Get marks
|
||||
MarkData markData = MarkData.get(npc);
|
||||
for(MarkData.Mark mark : markData.marks) {
|
||||
if(mark.getType() != MarkType.NONE &&
|
||||
for (MarkData.Mark mark : markData.marks) {
|
||||
if (mark.getType() != MarkType.NONE &&
|
||||
mark.availability.isAvailable(player)) {
|
||||
marks.add(new CompassHudComponent.MarkTargetEntry(
|
||||
npc.posX,
|
||||
|
||||
@@ -16,68 +16,67 @@ import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
|
||||
public class CustomNpcResourceListener implements
|
||||
IResourceManagerReloadListener {
|
||||
IResourceManagerReloadListener {
|
||||
|
||||
public static int DefaultTextColor = 0x404040;
|
||||
@Override
|
||||
public void onResourceManagerReload(IResourceManager var1) {
|
||||
if(var1 instanceof SimpleReloadableResourceManager){
|
||||
createTextureCache(new File(CustomNpcs.Dir,"assets/customnpcs/textures/cache"));
|
||||
|
||||
SimpleReloadableResourceManager simplemanager = (SimpleReloadableResourceManager)var1;
|
||||
|
||||
FolderResourcePack pack = new FolderResourcePack(CustomNpcs.Dir);
|
||||
simplemanager.reloadResourcePack(pack);
|
||||
|
||||
try{
|
||||
DefaultTextColor = Integer.parseInt(StatCollector.translateToLocal("customnpcs.defaultTextColor"),16);
|
||||
}
|
||||
catch(NumberFormatException e){
|
||||
DefaultTextColor = 0x404040;
|
||||
}
|
||||
}
|
||||
}
|
||||
public static int DefaultTextColor = 0x404040;
|
||||
|
||||
|
||||
private void createTextureCache(File dir){
|
||||
if(dir == null)
|
||||
return;
|
||||
enlargeTexture("planks_oak", dir);
|
||||
enlargeTexture("planks_big_oak", dir);
|
||||
enlargeTexture("planks_birch", dir);
|
||||
enlargeTexture("planks_jungle", dir);
|
||||
enlargeTexture("planks_spruce", dir);
|
||||
enlargeTexture("planks_acacia", dir);
|
||||
enlargeTexture("iron_block", dir);
|
||||
enlargeTexture("diamond_block", dir);
|
||||
enlargeTexture("stone", dir);
|
||||
enlargeTexture("gold_block", dir);
|
||||
enlargeTexture("wool_colored_white", dir);
|
||||
}
|
||||
|
||||
private void enlargeTexture(String texture, File dir){
|
||||
try{
|
||||
IResourceManager manager = Minecraft.getMinecraft().getResourceManager();
|
||||
ResourceLocation location = new ResourceLocation("textures/blocks/" + texture +".png");
|
||||
BufferedImage bufferedimage = ImageIO.read(manager.getResource(location).getInputStream());
|
||||
int i = bufferedimage.getWidth();
|
||||
int j = bufferedimage.getHeight();
|
||||
|
||||
BufferedImage image = new BufferedImage(i * 4, j * 2, BufferedImage.TYPE_INT_RGB);
|
||||
Graphics g = image.getGraphics();
|
||||
g.drawImage(bufferedimage, 0, 0, null);
|
||||
g.drawImage(bufferedimage, i, 0, null);
|
||||
g.drawImage(bufferedimage, i * 2, 0, null);
|
||||
g.drawImage(bufferedimage, i * 3, 0, null);
|
||||
g.drawImage(bufferedimage, 0, i, null);
|
||||
g.drawImage(bufferedimage, i, j, null);
|
||||
g.drawImage(bufferedimage, i * 2, j, null);
|
||||
g.drawImage(bufferedimage, i * 3, j, null);
|
||||
ImageIO.write(image, "png", new File(dir,texture + ".png"));
|
||||
}
|
||||
catch(Exception e){
|
||||
LogWriter.error("Failed caching texture: " + texture, e);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onResourceManagerReload(IResourceManager var1) {
|
||||
if (var1 instanceof SimpleReloadableResourceManager) {
|
||||
createTextureCache(new File(CustomNpcs.Dir, "assets/customnpcs/textures/cache"));
|
||||
|
||||
SimpleReloadableResourceManager simplemanager = (SimpleReloadableResourceManager) var1;
|
||||
|
||||
FolderResourcePack pack = new FolderResourcePack(CustomNpcs.Dir);
|
||||
simplemanager.reloadResourcePack(pack);
|
||||
|
||||
try {
|
||||
DefaultTextColor = Integer.parseInt(StatCollector.translateToLocal("customnpcs.defaultTextColor"), 16);
|
||||
} catch (NumberFormatException e) {
|
||||
DefaultTextColor = 0x404040;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void createTextureCache(File dir) {
|
||||
if (dir == null)
|
||||
return;
|
||||
enlargeTexture("planks_oak", dir);
|
||||
enlargeTexture("planks_big_oak", dir);
|
||||
enlargeTexture("planks_birch", dir);
|
||||
enlargeTexture("planks_jungle", dir);
|
||||
enlargeTexture("planks_spruce", dir);
|
||||
enlargeTexture("planks_acacia", dir);
|
||||
enlargeTexture("iron_block", dir);
|
||||
enlargeTexture("diamond_block", dir);
|
||||
enlargeTexture("stone", dir);
|
||||
enlargeTexture("gold_block", dir);
|
||||
enlargeTexture("wool_colored_white", dir);
|
||||
}
|
||||
|
||||
private void enlargeTexture(String texture, File dir) {
|
||||
try {
|
||||
IResourceManager manager = Minecraft.getMinecraft().getResourceManager();
|
||||
ResourceLocation location = new ResourceLocation("textures/blocks/" + texture + ".png");
|
||||
BufferedImage bufferedimage = ImageIO.read(manager.getResource(location).getInputStream());
|
||||
int i = bufferedimage.getWidth();
|
||||
int j = bufferedimage.getHeight();
|
||||
|
||||
BufferedImage image = new BufferedImage(i * 4, j * 2, BufferedImage.TYPE_INT_RGB);
|
||||
Graphics g = image.getGraphics();
|
||||
g.drawImage(bufferedimage, 0, 0, null);
|
||||
g.drawImage(bufferedimage, i, 0, null);
|
||||
g.drawImage(bufferedimage, i * 2, 0, null);
|
||||
g.drawImage(bufferedimage, i * 3, 0, null);
|
||||
g.drawImage(bufferedimage, 0, i, null);
|
||||
g.drawImage(bufferedimage, i, j, null);
|
||||
g.drawImage(bufferedimage, i * 2, j, null);
|
||||
g.drawImage(bufferedimage, i * 3, j, null);
|
||||
ImageIO.write(image, "png", new File(dir, texture + ".png"));
|
||||
} catch (Exception e) {
|
||||
LogWriter.error("Failed caching texture: " + texture, e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,96 +10,96 @@ import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
public class EntityUtil {
|
||||
|
||||
public static void Copy(EntityLivingBase copied, EntityLivingBase entity){
|
||||
entity.worldObj = copied.worldObj;
|
||||
public static void Copy(EntityLivingBase copied, EntityLivingBase entity) {
|
||||
entity.worldObj = copied.worldObj;
|
||||
|
||||
entity.deathTime = copied.deathTime;
|
||||
entity.distanceWalkedModified = copied.distanceWalkedModified;
|
||||
entity.prevDistanceWalkedModified = copied.distanceWalkedModified;
|
||||
entity.onGround = copied.onGround;
|
||||
entity.distanceWalkedOnStepModified = copied.distanceWalkedOnStepModified;
|
||||
entity.deathTime = copied.deathTime;
|
||||
entity.distanceWalkedModified = copied.distanceWalkedModified;
|
||||
entity.prevDistanceWalkedModified = copied.distanceWalkedModified;
|
||||
entity.onGround = copied.onGround;
|
||||
entity.distanceWalkedOnStepModified = copied.distanceWalkedOnStepModified;
|
||||
|
||||
entity.moveForward = copied.moveForward;
|
||||
entity.moveStrafing = copied.moveStrafing;
|
||||
entity.moveForward = copied.moveForward;
|
||||
entity.moveStrafing = copied.moveStrafing;
|
||||
|
||||
entity.setPosition(copied.posX, copied.posY, copied.posZ);
|
||||
entity.boundingBox.setBB(copied.boundingBox);
|
||||
entity.setPosition(copied.posX, copied.posY, copied.posZ);
|
||||
entity.boundingBox.setBB(copied.boundingBox);
|
||||
|
||||
entity.prevPosX = copied.prevPosX;
|
||||
entity.prevPosY = copied.prevPosY;
|
||||
entity.prevPosZ = copied.prevPosZ;
|
||||
entity.prevPosX = copied.prevPosX;
|
||||
entity.prevPosY = copied.prevPosY;
|
||||
entity.prevPosZ = copied.prevPosZ;
|
||||
|
||||
entity.motionX = copied.motionX;
|
||||
entity.motionY = copied.motionY;
|
||||
entity.motionZ = copied.motionZ;
|
||||
entity.motionX = copied.motionX;
|
||||
entity.motionY = copied.motionY;
|
||||
entity.motionZ = copied.motionZ;
|
||||
|
||||
entity.rotationYaw = copied.rotationYaw;
|
||||
entity.rotationPitch = copied.rotationPitch;
|
||||
entity.prevRotationYaw = copied.prevRotationYaw;
|
||||
entity.prevRotationPitch = copied.prevRotationPitch;
|
||||
entity.rotationYawHead = copied.rotationYawHead;
|
||||
entity.prevRotationYawHead = copied.prevRotationYawHead;
|
||||
entity.prevRenderYawOffset = copied.prevRenderYawOffset;
|
||||
entity.cameraPitch = copied.cameraPitch;
|
||||
entity.prevCameraPitch = copied.prevCameraPitch;
|
||||
entity.rotationYaw = copied.rotationYaw;
|
||||
entity.rotationPitch = copied.rotationPitch;
|
||||
entity.prevRotationYaw = copied.prevRotationYaw;
|
||||
entity.prevRotationPitch = copied.prevRotationPitch;
|
||||
entity.rotationYawHead = copied.rotationYawHead;
|
||||
entity.prevRotationYawHead = copied.prevRotationYawHead;
|
||||
entity.prevRenderYawOffset = copied.prevRenderYawOffset;
|
||||
entity.cameraPitch = copied.cameraPitch;
|
||||
entity.prevCameraPitch = copied.prevCameraPitch;
|
||||
|
||||
entity.renderYawOffset = copied.renderYawOffset;
|
||||
entity.renderYawOffset = copied.renderYawOffset;
|
||||
|
||||
entity.lastTickPosX = copied.lastTickPosX;
|
||||
entity.lastTickPosY = copied.lastTickPosY;
|
||||
entity.lastTickPosZ = copied.lastTickPosZ;
|
||||
entity.lastTickPosX = copied.lastTickPosX;
|
||||
entity.lastTickPosY = copied.lastTickPosY;
|
||||
entity.lastTickPosZ = copied.lastTickPosZ;
|
||||
|
||||
entity.limbSwingAmount = copied.limbSwingAmount;
|
||||
entity.prevLimbSwingAmount = copied.prevLimbSwingAmount;
|
||||
entity.limbSwing = copied.limbSwing;
|
||||
entity.limbSwingAmount = copied.limbSwingAmount;
|
||||
entity.prevLimbSwingAmount = copied.prevLimbSwingAmount;
|
||||
entity.limbSwing = copied.limbSwing;
|
||||
|
||||
entity.swingProgress = copied.swingProgress;
|
||||
entity.prevSwingProgress = copied.prevSwingProgress;
|
||||
entity.isSwingInProgress = copied.isSwingInProgress;
|
||||
entity.swingProgressInt = copied.swingProgressInt;
|
||||
entity.swingProgress = copied.swingProgress;
|
||||
entity.prevSwingProgress = copied.prevSwingProgress;
|
||||
entity.isSwingInProgress = copied.isSwingInProgress;
|
||||
entity.swingProgressInt = copied.swingProgressInt;
|
||||
|
||||
entity.ticksExisted = copied.ticksExisted;
|
||||
entity.ticksExisted = copied.ticksExisted;
|
||||
|
||||
if(entity instanceof EntityPlayer && copied instanceof EntityPlayer){
|
||||
EntityPlayer ePlayer = (EntityPlayer) entity;
|
||||
EntityPlayer cPlayer = (EntityPlayer) copied;
|
||||
if (entity instanceof EntityPlayer && copied instanceof EntityPlayer) {
|
||||
EntityPlayer ePlayer = (EntityPlayer) entity;
|
||||
EntityPlayer cPlayer = (EntityPlayer) copied;
|
||||
|
||||
ePlayer.cameraYaw = cPlayer.cameraYaw;
|
||||
ePlayer.prevCameraYaw = cPlayer.prevCameraYaw;
|
||||
ePlayer.cameraYaw = cPlayer.cameraYaw;
|
||||
ePlayer.prevCameraYaw = cPlayer.prevCameraYaw;
|
||||
|
||||
ePlayer.field_71091_bM = cPlayer.field_71091_bM;
|
||||
ePlayer.field_71096_bN = cPlayer.field_71096_bN;
|
||||
ePlayer.field_71097_bO = cPlayer.field_71097_bO;
|
||||
ePlayer.field_71094_bP = cPlayer.field_71094_bP;
|
||||
ePlayer.field_71095_bQ = cPlayer.field_71095_bQ;
|
||||
ePlayer.field_71085_bR = cPlayer.field_71085_bR;
|
||||
}
|
||||
ePlayer.field_71091_bM = cPlayer.field_71091_bM;
|
||||
ePlayer.field_71096_bN = cPlayer.field_71096_bN;
|
||||
ePlayer.field_71097_bO = cPlayer.field_71097_bO;
|
||||
ePlayer.field_71094_bP = cPlayer.field_71094_bP;
|
||||
ePlayer.field_71095_bQ = cPlayer.field_71095_bQ;
|
||||
ePlayer.field_71085_bR = cPlayer.field_71085_bR;
|
||||
}
|
||||
|
||||
if(entity instanceof EntityDragon){
|
||||
entity.rotationYaw += 180;
|
||||
}
|
||||
if(entity instanceof EntityChicken){
|
||||
((EntityChicken)entity).destPos = copied.onGround?0:1;
|
||||
}
|
||||
if (entity instanceof EntityDragon) {
|
||||
entity.rotationYaw += 180;
|
||||
}
|
||||
if (entity instanceof EntityChicken) {
|
||||
((EntityChicken) entity).destPos = copied.onGround ? 0 : 1;
|
||||
}
|
||||
|
||||
for(int i = 0; i < 5; i++){
|
||||
entity.setCurrentItemOrArmor(i, copied.getEquipmentInSlot(i));
|
||||
}
|
||||
for (int i = 0; i < 5; i++) {
|
||||
entity.setCurrentItemOrArmor(i, copied.getEquipmentInSlot(i));
|
||||
}
|
||||
|
||||
GeckoAddon.instance.geckoCopyData(copied, entity);
|
||||
GeckoAddon.instance.geckoCopyData(copied, entity);
|
||||
DBCAddon.instance.dbcCopyData(copied, entity);
|
||||
|
||||
if(copied instanceof EntityNPCInterface && entity instanceof EntityNPCInterface){
|
||||
EntityNPCInterface npc = (EntityNPCInterface) copied;
|
||||
EntityNPCInterface target = (EntityNPCInterface) entity;
|
||||
if (copied instanceof EntityNPCInterface && entity instanceof EntityNPCInterface) {
|
||||
EntityNPCInterface npc = (EntityNPCInterface) copied;
|
||||
EntityNPCInterface target = (EntityNPCInterface) entity;
|
||||
|
||||
target.textureLocation = npc.textureLocation;
|
||||
target.display = npc.display;
|
||||
target.inventory = npc.inventory;
|
||||
target.textureLocation = npc.textureLocation;
|
||||
target.display = npc.display;
|
||||
target.inventory = npc.inventory;
|
||||
|
||||
target.currentAnimation = npc.currentAnimation;
|
||||
target.currentAnimation = npc.currentAnimation;
|
||||
|
||||
target.setDataWatcher(npc.getDataWatcher());
|
||||
}
|
||||
}
|
||||
target.setDataWatcher(npc.getDataWatcher());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,8 +22,7 @@ import java.net.URL;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ImageDownloadAlt extends SimpleTexture
|
||||
{
|
||||
public class ImageDownloadAlt extends SimpleTexture {
|
||||
private static final Logger logger = LogManager.getLogger();
|
||||
private static final AtomicInteger threadDownloadCounter = new AtomicInteger(0);
|
||||
private final File cacheFile;
|
||||
@@ -33,22 +32,17 @@ public class ImageDownloadAlt extends SimpleTexture
|
||||
private Thread imageThread;
|
||||
private boolean textureUploaded;
|
||||
|
||||
public ImageDownloadAlt(File file, String url, ResourceLocation resource, IImageBuffer buffer)
|
||||
{
|
||||
public ImageDownloadAlt(File file, String url, ResourceLocation resource, IImageBuffer buffer) {
|
||||
super(resource);
|
||||
this.cacheFile = file;
|
||||
this.imageUrl = url;
|
||||
this.imageBuffer = buffer;
|
||||
}
|
||||
|
||||
private void checkTextureUploaded()
|
||||
{
|
||||
if (!this.textureUploaded)
|
||||
{
|
||||
if (this.bufferedImage != null)
|
||||
{
|
||||
if (this.textureLocation != null)
|
||||
{
|
||||
private void checkTextureUploaded() {
|
||||
if (!this.textureUploaded) {
|
||||
if (this.bufferedImage != null) {
|
||||
if (this.textureLocation != null) {
|
||||
this.deleteGlTexture();
|
||||
}
|
||||
|
||||
@@ -58,74 +52,57 @@ public class ImageDownloadAlt extends SimpleTexture
|
||||
}
|
||||
}
|
||||
|
||||
public int getGlTextureId()
|
||||
{
|
||||
public int getGlTextureId() {
|
||||
this.checkTextureUploaded();
|
||||
return super.getGlTextureId();
|
||||
}
|
||||
|
||||
public void setBufferedImage(BufferedImage p_147641_1_)
|
||||
{
|
||||
public void setBufferedImage(BufferedImage p_147641_1_) {
|
||||
this.bufferedImage = p_147641_1_;
|
||||
|
||||
if (this.imageBuffer != null)
|
||||
{
|
||||
if (this.imageBuffer != null) {
|
||||
this.imageBuffer.func_152634_a();
|
||||
}
|
||||
}
|
||||
|
||||
public BufferedImage getBufferedImage(){
|
||||
public BufferedImage getBufferedImage() {
|
||||
return this.bufferedImage;
|
||||
}
|
||||
|
||||
public void loadTexture(IResourceManager resourceManager) throws IOException
|
||||
{
|
||||
if (this.bufferedImage == null && this.textureLocation != null)
|
||||
{
|
||||
public void loadTexture(IResourceManager resourceManager) throws IOException {
|
||||
if (this.bufferedImage == null && this.textureLocation != null) {
|
||||
super.loadTexture(resourceManager);
|
||||
}
|
||||
|
||||
if (this.imageThread == null)
|
||||
{
|
||||
if (this.cacheFile != null && this.cacheFile.isFile())
|
||||
{
|
||||
logger.debug("Loading http texture from local cache ({})", new Object[] {this.cacheFile});
|
||||
if (this.imageThread == null) {
|
||||
if (this.cacheFile != null && this.cacheFile.isFile()) {
|
||||
logger.debug("Loading http texture from local cache ({})", new Object[]{this.cacheFile});
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
this.bufferedImage = ImageIO.read(this.cacheFile);
|
||||
|
||||
if (this.imageBuffer != null)
|
||||
{
|
||||
if (this.imageBuffer != null) {
|
||||
this.setBufferedImage(this.imageBuffer.parseUserSkin(this.bufferedImage));
|
||||
}
|
||||
}
|
||||
catch (IOException ioexception)
|
||||
{
|
||||
} catch (IOException ioexception) {
|
||||
logger.error("Couldn\'t load skin " + this.cacheFile, ioexception);
|
||||
this.loadTextureFromServer();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.loadTextureFromServer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void loadTextureFromServer()
|
||||
{
|
||||
this.imageThread = new Thread("Texture Downloader #" + threadDownloadCounter.incrementAndGet())
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
protected void loadTextureFromServer() {
|
||||
this.imageThread = new Thread("Texture Downloader #" + threadDownloadCounter.incrementAndGet()) {
|
||||
public void run() {
|
||||
HttpURLConnection connection = null;
|
||||
ImageDownloadAlt.logger.debug("Downloading http texture from {} to {}", new Object[] {ImageDownloadAlt.this.imageUrl, ImageDownloadAlt.this.cacheFile});
|
||||
ImageDownloadAlt.logger.debug("Downloading http texture from {} to {}", new Object[]{ImageDownloadAlt.this.imageUrl, ImageDownloadAlt.this.cacheFile});
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
URL url = new URL(ImageDownloadAlt.this.imageUrl);
|
||||
connection = (HttpURLConnection)(url).openConnection(Minecraft.getMinecraft().getProxy());
|
||||
connection = (HttpURLConnection) (url).openConnection(Minecraft.getMinecraft().getProxy());
|
||||
connection.setDoInput(true);
|
||||
connection.setDoOutput(false);
|
||||
connection.setRequestProperty("Content-Type", "image/png");
|
||||
@@ -140,40 +117,29 @@ public class ImageDownloadAlt extends SimpleTexture
|
||||
|
||||
connection.connect();
|
||||
|
||||
if (connection.getResponseCode() / 100 != 2)
|
||||
{
|
||||
if (connection.getResponseCode() / 100 != 2) {
|
||||
return;
|
||||
}
|
||||
|
||||
BufferedImage bufferedimage;
|
||||
|
||||
if (ImageDownloadAlt.this.cacheFile != null)
|
||||
{
|
||||
if (ImageDownloadAlt.this.cacheFile != null) {
|
||||
FileUtils.copyInputStreamToFile(connection.getInputStream(), ImageDownloadAlt.this.cacheFile);
|
||||
bufferedimage = ImageIO.read(ImageDownloadAlt.this.cacheFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
bufferedimage = ImageIO.read(connection.getInputStream());
|
||||
}
|
||||
|
||||
if (ImageDownloadAlt.this.imageBuffer != null)
|
||||
{
|
||||
if (ImageDownloadAlt.this.imageBuffer != null) {
|
||||
bufferedimage = ImageDownloadAlt.this.imageBuffer.parseUserSkin(bufferedimage);
|
||||
}
|
||||
|
||||
ImageDownloadAlt.this.setBufferedImage(bufferedimage);
|
||||
}
|
||||
catch (MalformedURLException ignored) {
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
} catch (MalformedURLException ignored) {
|
||||
} catch (Exception exception) {
|
||||
ImageDownloadAlt.logger.error("Couldn\'t download http texture", exception);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (connection != null)
|
||||
{
|
||||
} finally {
|
||||
if (connection != null) {
|
||||
connection.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,28 +7,27 @@ import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import noppes.npcs.CustomItems;
|
||||
|
||||
public class MessageAchievement extends Achievement{
|
||||
public class MessageAchievement extends Achievement {
|
||||
|
||||
private String description;
|
||||
private String message;
|
||||
private String description;
|
||||
private String message;
|
||||
|
||||
public MessageAchievement(Item item, String message, String description) {
|
||||
super("",message, 0, 0, item, null);
|
||||
this.description = description;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public MessageAchievement(String message, String description) {
|
||||
this(CustomItems.letter==null ? Items.paper : CustomItems.letter, message, description);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IChatComponent func_150951_e()
|
||||
{
|
||||
return new ChatComponentText(message);
|
||||
public MessageAchievement(Item item, String message, String description) {
|
||||
super("", message, 0, 0, item, null);
|
||||
this.description = description;
|
||||
this.message = message;
|
||||
}
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
|
||||
public MessageAchievement(String message, String description) {
|
||||
this(CustomItems.letter == null ? Items.paper : CustomItems.letter, message, description);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IChatComponent func_150951_e() {
|
||||
return new ChatComponentText(message);
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,10 @@ import net.minecraft.util.Util;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.client.gui.player.GuiDialogInteract;
|
||||
import noppes.npcs.client.gui.player.GuiQuestCompletion;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.client.gui.util.GuiContainerNPCInterface;
|
||||
import noppes.npcs.client.gui.util.GuiNPCInterface;
|
||||
import noppes.npcs.client.gui.util.IPlayerDataInfo;
|
||||
import noppes.npcs.client.gui.util.IScrollData;
|
||||
import noppes.npcs.constants.EnumGuiType;
|
||||
import noppes.npcs.constants.EnumScrollData;
|
||||
import noppes.npcs.controllers.data.Dialog;
|
||||
@@ -36,50 +39,52 @@ import java.util.Vector;
|
||||
|
||||
public class NoppesUtil {
|
||||
|
||||
public static void requestOpenGUI(EnumGuiType gui) {
|
||||
requestOpenGUI(gui, 0, 0, 0);
|
||||
}
|
||||
public static void requestOpenGUI(EnumGuiType gui) {
|
||||
requestOpenGUI(gui, 0, 0, 0);
|
||||
}
|
||||
|
||||
public static void requestOpenGUI(EnumGuiType gui, int i, int j, int k) {
|
||||
public static void requestOpenGUI(EnumGuiType gui, int i, int j, int k) {
|
||||
PacketClient.sendClient(new GuiRequestPacket(gui.ordinal(), i, j, k));
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
if (ClientCacheHandler.skinOverlays.containsKey(player.getUniqueID())) {
|
||||
oldOverlays = ClientCacheHandler.skinOverlays.get(player.getUniqueID());
|
||||
}
|
||||
HashMap<Integer, SkinOverlay> skinOverlays = new HashMap<>();
|
||||
HashMap<Integer, SkinOverlay> oldOverlays = new HashMap<>();
|
||||
NBTTagList skinOverlayList = compound.getTagList("SkinOverlayData", 10);
|
||||
if (ClientCacheHandler.skinOverlays.containsKey(player.getUniqueID())) {
|
||||
oldOverlays = ClientCacheHandler.skinOverlays.get(player.getUniqueID());
|
||||
}
|
||||
|
||||
for (int i = 0; i < skinOverlayList.tagCount(); i++) {
|
||||
int tagID = skinOverlayList.getCompoundTagAt(i).getInteger("SkinOverlayID");
|
||||
SkinOverlay overlay = (SkinOverlay) SkinOverlay.overlayFromNBT(skinOverlayList.getCompoundTagAt(i));
|
||||
if (oldOverlays.containsKey(tagID)) {
|
||||
overlay.ticks = oldOverlays.get(tagID).ticks;
|
||||
}
|
||||
skinOverlays.put(tagID,overlay);
|
||||
}
|
||||
ClientCacheHandler.skinOverlays.put(player.getUniqueID(), skinOverlays);
|
||||
}
|
||||
for (int i = 0; i < skinOverlayList.tagCount(); i++) {
|
||||
int tagID = skinOverlayList.getCompoundTagAt(i).getInteger("SkinOverlayID");
|
||||
SkinOverlay overlay = (SkinOverlay) SkinOverlay.overlayFromNBT(skinOverlayList.getCompoundTagAt(i));
|
||||
if (oldOverlays.containsKey(tagID)) {
|
||||
overlay.ticks = oldOverlays.get(tagID).ticks;
|
||||
}
|
||||
skinOverlays.put(tagID, overlay);
|
||||
}
|
||||
ClientCacheHandler.skinOverlays.put(player.getUniqueID(), skinOverlays);
|
||||
}
|
||||
|
||||
public static void clickSound() {
|
||||
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
}
|
||||
}
|
||||
|
||||
private static EntityNPCInterface lastNpc;
|
||||
public static EntityNPCInterface getLastNpc() {
|
||||
return lastNpc;
|
||||
}
|
||||
public static void setLastNpc(EntityNPCInterface npc) {
|
||||
lastNpc = npc;
|
||||
}
|
||||
private static EntityNPCInterface lastNpc;
|
||||
|
||||
public static void openGUI(EntityPlayer player, Object guiscreen) {
|
||||
CustomNpcs.proxy.openGui(player, guiscreen);
|
||||
}
|
||||
public static EntityNPCInterface getLastNpc() {
|
||||
return lastNpc;
|
||||
}
|
||||
|
||||
public static void openFolder(File dir){
|
||||
public static void setLastNpc(EntityNPCInterface npc) {
|
||||
lastNpc = npc;
|
||||
}
|
||||
|
||||
public static void openGUI(EntityPlayer player, Object guiscreen) {
|
||||
CustomNpcs.proxy.openGui(player, guiscreen);
|
||||
}
|
||||
|
||||
public static void openFolder(File dir) {
|
||||
if (dir == null || !dir.exists() || !dir.isDirectory()) {
|
||||
// Log an error or simply return if there's nothing to open
|
||||
return;
|
||||
@@ -87,158 +92,148 @@ public class NoppesUtil {
|
||||
|
||||
String s = dir.getAbsolutePath();
|
||||
|
||||
if (Util.getOSType() == Util.EnumOS.OSX)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Util.getOSType() == Util.EnumOS.OSX) {
|
||||
try {
|
||||
//logger.info(s);
|
||||
Runtime.getRuntime().exec(new String[] {"/usr/bin/open", s});
|
||||
Runtime.getRuntime().exec(new String[]{"/usr/bin/open", s});
|
||||
return;
|
||||
}
|
||||
catch (IOException ioexception1)
|
||||
{
|
||||
} catch (IOException ioexception1) {
|
||||
//logger.error("Couldn\'t open file", ioexception1);
|
||||
}
|
||||
}
|
||||
else if (Util.getOSType() == Util.EnumOS.WINDOWS)
|
||||
{
|
||||
String s1 = String.format("cmd.exe /C start \"Open file\" \"%s\"", new Object[] {s});
|
||||
} else if (Util.getOSType() == Util.EnumOS.WINDOWS) {
|
||||
String s1 = String.format("cmd.exe /C start \"Open file\" \"%s\"", new Object[]{s});
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
Runtime.getRuntime().exec(s1);
|
||||
return;
|
||||
}
|
||||
catch (IOException ioexception)
|
||||
{
|
||||
} catch (IOException ioexception) {
|
||||
//logger.error("Couldn\'t open file", ioexception);
|
||||
}
|
||||
}
|
||||
|
||||
boolean flag = false;
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
Class oclass = Class.forName("java.awt.Desktop");
|
||||
Object object = oclass.getMethod("getDesktop", new Class[0]).invoke((Object)null, new Object[0]);
|
||||
oclass.getMethod("browse", new Class[] {URI.class}).invoke(object, new Object[] {dir.toURI()});
|
||||
}
|
||||
catch (Throwable throwable)
|
||||
{
|
||||
Object object = oclass.getMethod("getDesktop", new Class[0]).invoke((Object) null, new Object[0]);
|
||||
oclass.getMethod("browse", new Class[]{URI.class}).invoke(object, new Object[]{dir.toURI()});
|
||||
} catch (Throwable throwable) {
|
||||
//logger.error("Couldn\'t open link", throwable);
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (flag)
|
||||
{
|
||||
if (flag) {
|
||||
//logger.info("Opening via system class!");
|
||||
Sys.openURL("file://" + s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void setScrollList(ByteBuf buffer) {
|
||||
GuiScreen gui = Minecraft.getMinecraft().currentScreen;
|
||||
if(gui instanceof GuiNPCInterface && ((GuiNPCInterface)gui).hasSubGui())
|
||||
gui = ((GuiNPCInterface)gui).getSubGui();
|
||||
if(gui == null || !(gui instanceof IScrollData))
|
||||
return;
|
||||
Vector<String> data = new Vector<String>();
|
||||
String line;
|
||||
public static void setScrollList(ByteBuf buffer) {
|
||||
GuiScreen gui = Minecraft.getMinecraft().currentScreen;
|
||||
if (gui instanceof GuiNPCInterface && ((GuiNPCInterface) gui).hasSubGui())
|
||||
gui = ((GuiNPCInterface) gui).getSubGui();
|
||||
if (gui == null || !(gui instanceof IScrollData))
|
||||
return;
|
||||
Vector<String> data = new Vector<String>();
|
||||
String line;
|
||||
|
||||
EnumScrollData dataType = EnumScrollData.values()[buffer.readInt()];
|
||||
|
||||
try {
|
||||
int size = buffer.readInt();
|
||||
for(int i = 0; i < size; i++){
|
||||
data.add(ByteBufUtils.readString(buffer));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
int size = buffer.readInt();
|
||||
for (int i = 0; i < size; i++) {
|
||||
data.add(ByteBufUtils.readString(buffer));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
((IScrollData)gui).setData(data,null, dataType);
|
||||
}
|
||||
((IScrollData) gui).setData(data, null, dataType);
|
||||
}
|
||||
|
||||
private static HashMap<String,Integer> data = new HashMap<String,Integer>();
|
||||
public static void setScrollData(ByteBuf buffer) {
|
||||
GuiScreen gui = Minecraft.getMinecraft().currentScreen;
|
||||
if(gui == null)
|
||||
return;
|
||||
private static HashMap<String, Integer> data = new HashMap<String, Integer>();
|
||||
|
||||
public static void setScrollData(ByteBuf buffer) {
|
||||
GuiScreen gui = Minecraft.getMinecraft().currentScreen;
|
||||
if (gui == null)
|
||||
return;
|
||||
|
||||
EnumScrollData dataType = EnumScrollData.values()[buffer.readInt()];
|
||||
try {
|
||||
int size = buffer.readInt();
|
||||
for(int i = 0; i < size; i++){
|
||||
int id = buffer.readInt();
|
||||
String name = ByteBufUtils.readString(buffer);
|
||||
data.put(name, id);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
if(gui instanceof GuiNPCInterface && ((GuiNPCInterface)gui).hasSubGui()){
|
||||
gui = (GuiScreen) ((GuiNPCInterface)gui).getSubGui();
|
||||
}
|
||||
if(gui instanceof GuiContainerNPCInterface && ((GuiContainerNPCInterface)gui).hasSubGui()){
|
||||
gui = (GuiScreen) ((GuiContainerNPCInterface)gui).getSubGui();
|
||||
}
|
||||
if(gui instanceof IScrollData)
|
||||
((IScrollData)gui).setData(new Vector<String>(data.keySet()), data, dataType);
|
||||
data = new HashMap<String,Integer>();
|
||||
}
|
||||
try {
|
||||
int size = buffer.readInt();
|
||||
for (int i = 0; i < size; i++) {
|
||||
int id = buffer.readInt();
|
||||
String name = ByteBufUtils.readString(buffer);
|
||||
data.put(name, id);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
if (gui instanceof GuiNPCInterface && ((GuiNPCInterface) gui).hasSubGui()) {
|
||||
gui = (GuiScreen) ((GuiNPCInterface) gui).getSubGui();
|
||||
}
|
||||
if (gui instanceof GuiContainerNPCInterface && ((GuiContainerNPCInterface) gui).hasSubGui()) {
|
||||
gui = (GuiScreen) ((GuiContainerNPCInterface) gui).getSubGui();
|
||||
}
|
||||
if (gui instanceof IScrollData)
|
||||
((IScrollData) gui).setData(new Vector<String>(data.keySet()), data, dataType);
|
||||
data = new HashMap<String, Integer>();
|
||||
}
|
||||
|
||||
public static void guiQuestCompletion(EntityPlayer player, NBTTagCompound read) {
|
||||
Quest quest = new Quest();
|
||||
quest.readNBT(read);
|
||||
if (!quest.completeText.isEmpty()) {
|
||||
NoppesUtil.openGUI(player, new GuiQuestCompletion(quest));
|
||||
}
|
||||
}
|
||||
public static void guiQuestCompletion(EntityPlayer player, NBTTagCompound read) {
|
||||
Quest quest = new Quest();
|
||||
quest.readNBT(read);
|
||||
if (!quest.completeText.isEmpty()) {
|
||||
NoppesUtil.openGUI(player, new GuiQuestCompletion(quest));
|
||||
}
|
||||
}
|
||||
|
||||
public static void openDialog(NBTTagCompound compound, EntityNPCInterface npc, EntityPlayer player){
|
||||
Dialog dialog = new Dialog();
|
||||
dialog.readNBT(compound);
|
||||
GuiScreen gui = Minecraft.getMinecraft().currentScreen;
|
||||
if(gui == null || !(gui instanceof GuiDialogInteract))
|
||||
CustomNpcs.proxy.openGui(player, new GuiDialogInteract(npc, dialog));
|
||||
else{
|
||||
GuiDialogInteract dia = (GuiDialogInteract) gui;
|
||||
dia.appendDialog(dialog);
|
||||
}
|
||||
}
|
||||
public static void saveRedstoneBlock(EntityPlayer player, NBTTagCompound compound){
|
||||
int x = compound.getInteger("x");
|
||||
int y = compound.getInteger("y");
|
||||
int z = compound.getInteger("z");
|
||||
public static void openDialog(NBTTagCompound compound, EntityNPCInterface npc, EntityPlayer player) {
|
||||
Dialog dialog = new Dialog();
|
||||
dialog.readNBT(compound);
|
||||
GuiScreen gui = Minecraft.getMinecraft().currentScreen;
|
||||
if (gui == null || !(gui instanceof GuiDialogInteract))
|
||||
CustomNpcs.proxy.openGui(player, new GuiDialogInteract(npc, dialog));
|
||||
else {
|
||||
GuiDialogInteract dia = (GuiDialogInteract) gui;
|
||||
dia.appendDialog(dialog);
|
||||
}
|
||||
}
|
||||
|
||||
TileEntity tile = player.worldObj.getTileEntity(x, y, z);
|
||||
tile.readFromNBT(compound);
|
||||
public static void saveRedstoneBlock(EntityPlayer player, NBTTagCompound compound) {
|
||||
int x = compound.getInteger("x");
|
||||
int y = compound.getInteger("y");
|
||||
int z = compound.getInteger("z");
|
||||
|
||||
CustomNpcs.proxy.openGui(x, y, z, EnumGuiType.RedstoneBlock, player);
|
||||
}
|
||||
public static void saveWayPointBlock(EntityPlayer player, NBTTagCompound compound){
|
||||
int x = compound.getInteger("x");
|
||||
int y = compound.getInteger("y");
|
||||
int z = compound.getInteger("z");
|
||||
TileEntity tile = player.worldObj.getTileEntity(x, y, z);
|
||||
tile.readFromNBT(compound);
|
||||
|
||||
TileEntity tile = player.worldObj.getTileEntity(x, y, z);
|
||||
tile.readFromNBT(compound);
|
||||
CustomNpcs.proxy.openGui(x, y, z, EnumGuiType.RedstoneBlock, player);
|
||||
}
|
||||
|
||||
CustomNpcs.proxy.openGui(x, y, z, EnumGuiType.Waypoint, player);
|
||||
}
|
||||
public static void saveWayPointBlock(EntityPlayer player, NBTTagCompound compound) {
|
||||
int x = compound.getInteger("x");
|
||||
int y = compound.getInteger("y");
|
||||
int z = compound.getInteger("z");
|
||||
|
||||
public static void isGUIOpen(boolean isGUIOpen) {
|
||||
TileEntity tile = player.worldObj.getTileEntity(x, y, z);
|
||||
tile.readFromNBT(compound);
|
||||
|
||||
CustomNpcs.proxy.openGui(x, y, z, EnumGuiType.Waypoint, player);
|
||||
}
|
||||
|
||||
public static void isGUIOpen(boolean isGUIOpen) {
|
||||
PacketClient.sendClient(new IsGuiOpenInform(isGUIOpen));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the incoming large packet with full player data.
|
||||
* The packet writes:
|
||||
* - player name (String)
|
||||
* - questCategories, questActive, questFinished (maps)
|
||||
* - dialogCategories, dialogRead (maps)
|
||||
* - transportCategories, transportLocations (maps)
|
||||
* - bankData, factionData (maps)
|
||||
*
|
||||
* - player name (String)
|
||||
* - questCategories, questActive, questFinished (maps)
|
||||
* - dialogCategories, dialogRead (maps)
|
||||
* - transportCategories, transportLocations (maps)
|
||||
* - bankData, factionData (maps)
|
||||
* <p>
|
||||
* The existing PlayerDataController functions are used on the server side;
|
||||
* here we simply update the active SubGuiPlayerDataNew if present.
|
||||
*/
|
||||
@@ -257,14 +252,14 @@ public class NoppesUtil {
|
||||
magicData.readToNBT(ByteBufUtils.readNBT(data));
|
||||
|
||||
GuiScreen gui = Minecraft.getMinecraft().currentScreen;
|
||||
if(gui == null)
|
||||
if (gui == null)
|
||||
return;
|
||||
if(gui instanceof GuiNPCInterface && ((GuiNPCInterface)gui).hasSubGui()){
|
||||
gui = (GuiScreen) ((GuiNPCInterface)gui).getSubGui();
|
||||
if (gui instanceof GuiNPCInterface && ((GuiNPCInterface) gui).hasSubGui()) {
|
||||
gui = (GuiScreen) ((GuiNPCInterface) gui).getSubGui();
|
||||
}
|
||||
|
||||
if(gui instanceof GuiContainerNPCInterface && ((GuiContainerNPCInterface)gui).hasSubGui()){
|
||||
gui = (GuiScreen) ((GuiContainerNPCInterface)gui).getSubGui();
|
||||
if (gui instanceof GuiContainerNPCInterface && ((GuiContainerNPCInterface) gui).hasSubGui()) {
|
||||
gui = (GuiScreen) ((GuiContainerNPCInterface) gui).getSubGui();
|
||||
}
|
||||
if (gui instanceof IPlayerDataInfo) {
|
||||
IPlayerDataInfo info = (IPlayerDataInfo) gui;
|
||||
|
||||
@@ -15,46 +15,46 @@ import org.lwjgl.opengl.GL11;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
public class RenderChatMessages implements IChatMessages{
|
||||
private Map<Long,TextBlockClient> messages = new TreeMap<Long,TextBlockClient>();
|
||||
public class RenderChatMessages implements IChatMessages {
|
||||
private Map<Long, TextBlockClient> messages = new TreeMap<Long, TextBlockClient>();
|
||||
|
||||
private int boxLength = 46;
|
||||
private float scale = 0.5f;
|
||||
private int boxLength = 46;
|
||||
private float scale = 0.5f;
|
||||
|
||||
private String lastMessage = "";
|
||||
private long lastMessageTime = 0;
|
||||
private String lastMessage = "";
|
||||
private long lastMessageTime = 0;
|
||||
|
||||
@Override
|
||||
public void addMessage(String message, EntityNPCInterface npc){
|
||||
if(!ConfigClient.EnableChatBubbles)
|
||||
return;
|
||||
long time = System.currentTimeMillis();
|
||||
if(message.equals(lastMessage) && lastMessageTime + 5000 > time){
|
||||
return;
|
||||
}
|
||||
Map<Long,TextBlockClient> messages = new TreeMap<Long,TextBlockClient>(this.messages);
|
||||
messages.put(time, new TextBlockClient(message, (int) (boxLength * 4), true, Minecraft.getMinecraft().thePlayer, npc));
|
||||
@Override
|
||||
public void addMessage(String message, EntityNPCInterface npc) {
|
||||
if (!ConfigClient.EnableChatBubbles)
|
||||
return;
|
||||
long time = System.currentTimeMillis();
|
||||
if (message.equals(lastMessage) && lastMessageTime + 5000 > time) {
|
||||
return;
|
||||
}
|
||||
Map<Long, TextBlockClient> messages = new TreeMap<Long, TextBlockClient>(this.messages);
|
||||
messages.put(time, new TextBlockClient(message, (int) (boxLength * 4), true, Minecraft.getMinecraft().thePlayer, npc));
|
||||
|
||||
if(messages.size() > 3){
|
||||
messages.remove(messages.keySet().iterator().next());
|
||||
}
|
||||
this.messages = messages;
|
||||
lastMessage = message;
|
||||
lastMessageTime = time;
|
||||
}
|
||||
if (messages.size() > 3) {
|
||||
messages.remove(messages.keySet().iterator().next());
|
||||
}
|
||||
this.messages = messages;
|
||||
lastMessage = message;
|
||||
lastMessageTime = time;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderMessages(double par3, double par5, double par7, float scale, boolean inRange) {
|
||||
Map<Long,TextBlockClient> messages = getMessages();
|
||||
if(messages.isEmpty())
|
||||
Map<Long, TextBlockClient> messages = getMessages();
|
||||
if (messages.isEmpty())
|
||||
return;
|
||||
if(inRange)
|
||||
if (inRange)
|
||||
render(par3, par5, par7, scale, false);
|
||||
render(par3, par5, par7, scale, true);
|
||||
}
|
||||
|
||||
public void render(double par3, double par5, double par7, float textscale, boolean depth){
|
||||
FontRenderer font = Minecraft.getMinecraft().fontRenderer;
|
||||
public void render(double par3, double par5, double par7, float textscale, boolean depth) {
|
||||
FontRenderer font = Minecraft.getMinecraft().fontRenderer;
|
||||
float var13 = 1.6F;
|
||||
float var14 = 0.016666668F * var13;
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
@@ -64,13 +64,13 @@ public class RenderChatMessages implements IChatMessages{
|
||||
size += block.lines.size();
|
||||
|
||||
int fontHeight;
|
||||
if(ConfigClient.ChatBubblesFontType)
|
||||
if (ConfigClient.ChatBubblesFontType)
|
||||
fontHeight = ClientProxy.Font.height();
|
||||
else
|
||||
fontHeight = font.FONT_HEIGHT;
|
||||
|
||||
int textYSize = (int) (size * fontHeight * scale);
|
||||
GL11.glTranslatef((float)par3 + 0.0F, (float)par5 + textYSize * textscale * var14, (float)par7);
|
||||
GL11.glTranslatef((float) par3 + 0.0F, (float) par5 + textYSize * textscale * var14, (float) par7);
|
||||
GL11.glScalef(textscale, textscale, textscale);
|
||||
GL11.glNormal3f(0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(-RenderManager.instance.playerViewY, 0.0F, 1F, 0.0F);
|
||||
@@ -123,10 +123,10 @@ public class RenderChatMessages implements IChatMessages{
|
||||
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
int index = 0;
|
||||
for(TextBlockClient block : messages.values()){
|
||||
for(IChatComponent chat : block.lines){
|
||||
for (TextBlockClient block : messages.values()) {
|
||||
for (IChatComponent chat : block.lines) {
|
||||
String message = chat.getFormattedText();
|
||||
if(ConfigClient.ChatBubblesFontType)
|
||||
if (ConfigClient.ChatBubblesFontType)
|
||||
ClientProxy.Font.drawString(message, -ClientProxy.Font.width(message) / 2, index * fontHeight, black);
|
||||
else
|
||||
font.drawString(message, -font.getStringWidth(message) / 2, index * fontHeight, black);
|
||||
@@ -144,48 +144,45 @@ public class RenderChatMessages implements IChatMessages{
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
private void drawRect(int par0, int par1, int par2, int par3, int par4, double par5)
|
||||
{
|
||||
private void drawRect(int par0, int par1, int par2, int par3, int par4, double par5) {
|
||||
int j1;
|
||||
|
||||
if (par0 < par2)
|
||||
{
|
||||
if (par0 < par2) {
|
||||
j1 = par0;
|
||||
par0 = par2;
|
||||
par2 = j1;
|
||||
}
|
||||
|
||||
if (par1 < par3)
|
||||
{
|
||||
if (par1 < par3) {
|
||||
j1 = par1;
|
||||
par1 = par3;
|
||||
par3 = j1;
|
||||
}
|
||||
|
||||
float f = (float)(par4 >> 24 & 255) / 255.0F;
|
||||
float f1 = (float)(par4 >> 16 & 255) / 255.0F;
|
||||
float f2 = (float)(par4 >> 8 & 255) / 255.0F;
|
||||
float f3 = (float)(par4 & 255) / 255.0F;
|
||||
float f = (float) (par4 >> 24 & 255) / 255.0F;
|
||||
float f1 = (float) (par4 >> 16 & 255) / 255.0F;
|
||||
float f2 = (float) (par4 >> 8 & 255) / 255.0F;
|
||||
float f3 = (float) (par4 & 255) / 255.0F;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
GL11.glColor4f(f1, f2, f3, f);
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertex((double)par0, (double)par3, par5);
|
||||
tessellator.addVertex((double)par2, (double)par3, par5);
|
||||
tessellator.addVertex((double)par2, (double)par1, par5);
|
||||
tessellator.addVertex((double)par0, (double)par1, par5);
|
||||
tessellator.addVertex((double) par0, (double) par3, par5);
|
||||
tessellator.addVertex((double) par2, (double) par3, par5);
|
||||
tessellator.addVertex((double) par2, (double) par1, par5);
|
||||
tessellator.addVertex((double) par0, (double) par1, par5);
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
private Map<Long,TextBlockClient> getMessages(){
|
||||
Map<Long,TextBlockClient> messages = new TreeMap<Long,TextBlockClient>();
|
||||
long time = System.currentTimeMillis();
|
||||
for(long timestamp : this.messages.keySet()){
|
||||
if(time > timestamp + 10000)
|
||||
continue;
|
||||
TextBlockClient message = this.messages.get(timestamp);
|
||||
messages.put(timestamp, message);
|
||||
}
|
||||
this.messages = messages;
|
||||
return messages;
|
||||
}
|
||||
private Map<Long, TextBlockClient> getMessages() {
|
||||
Map<Long, TextBlockClient> messages = new TreeMap<Long, TextBlockClient>();
|
||||
long time = System.currentTimeMillis();
|
||||
for (long timestamp : this.messages.keySet()) {
|
||||
if (time > timestamp + 10000)
|
||||
continue;
|
||||
TextBlockClient message = this.messages.get(timestamp);
|
||||
messages.put(timestamp, message);
|
||||
}
|
||||
this.messages = messages;
|
||||
return messages;
|
||||
}
|
||||
}
|
||||
@@ -9,76 +9,75 @@ import noppes.npcs.NoppesStringUtils;
|
||||
import noppes.npcs.TextBlock;
|
||||
import noppes.npcs.controllers.data.Dialog;
|
||||
|
||||
public class TextBlockClient extends TextBlock{
|
||||
private ChatStyle style;
|
||||
public int color = 0xe0e0e0;
|
||||
public int titleColor = 0xe0e0e0;
|
||||
public int titlePos = 0;
|
||||
private String name;
|
||||
private ICommandSender sender;
|
||||
public class TextBlockClient extends TextBlock {
|
||||
private ChatStyle style;
|
||||
public int color = 0xe0e0e0;
|
||||
public int titleColor = 0xe0e0e0;
|
||||
public int titlePos = 0;
|
||||
private String name;
|
||||
private ICommandSender sender;
|
||||
|
||||
public TextBlockClient(ICommandSender sender, Dialog dialog, Object... obs) {
|
||||
this(dialog.text, dialog.textWidth, false, obs);
|
||||
this.color = dialog.color;
|
||||
this.titleColor = dialog.titleColor;
|
||||
this.titlePos = dialog.titlePos;
|
||||
this.sender = sender;
|
||||
}
|
||||
public TextBlockClient(ICommandSender sender, Dialog dialog, Object... obs) {
|
||||
this(dialog.text, dialog.textWidth, false, obs);
|
||||
this.color = dialog.color;
|
||||
this.titleColor = dialog.titleColor;
|
||||
this.titlePos = dialog.titlePos;
|
||||
this.sender = sender;
|
||||
}
|
||||
|
||||
public TextBlockClient(String name, String text, int lineWidth, int color, Object... obs) {
|
||||
this(text, lineWidth, false, obs);
|
||||
this.color = color;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName(){
|
||||
if(sender != null)
|
||||
return sender.getCommandSenderName();
|
||||
return name;
|
||||
}
|
||||
|
||||
public TextBlockClient(String text, int lineWidth, boolean mcFont, Object... obs){
|
||||
style = new ChatStyle();
|
||||
text = NoppesStringUtils.formatText(text, obs);
|
||||
|
||||
String line = "";
|
||||
text = text.replace("\n", " \n ");
|
||||
text = text.replace("\r", " \r ");
|
||||
String[] words = text.split(" ");
|
||||
|
||||
FontRenderer font = Minecraft.getMinecraft().fontRenderer;
|
||||
for(String word : words){
|
||||
if(word.isEmpty())
|
||||
continue;
|
||||
if(word.length() == 1){
|
||||
char c = word.charAt(0);
|
||||
if(c == '\r' || c == '\n'){
|
||||
addLine(line);
|
||||
line = "";
|
||||
continue;
|
||||
}
|
||||
}
|
||||
String newLine;
|
||||
if(line.isEmpty())
|
||||
newLine = word;
|
||||
else
|
||||
newLine = line + " " + word;
|
||||
public TextBlockClient(String name, String text, int lineWidth, int color, Object... obs) {
|
||||
this(text, lineWidth, false, obs);
|
||||
this.color = color;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
if((mcFont?font.getStringWidth(newLine): ClientProxy.Font.width(newLine)) > lineWidth){
|
||||
addLine(line);
|
||||
line = word.trim();
|
||||
}
|
||||
else{
|
||||
line = newLine;
|
||||
}
|
||||
}
|
||||
if(!line.isEmpty())
|
||||
addLine(line);
|
||||
}
|
||||
public String getName() {
|
||||
if (sender != null)
|
||||
return sender.getCommandSenderName();
|
||||
return name;
|
||||
}
|
||||
|
||||
private void addLine(String text){
|
||||
ChatComponentText line = new ChatComponentText(text);
|
||||
line.setChatStyle(style);
|
||||
lines.add(line);
|
||||
}
|
||||
public TextBlockClient(String text, int lineWidth, boolean mcFont, Object... obs) {
|
||||
style = new ChatStyle();
|
||||
text = NoppesStringUtils.formatText(text, obs);
|
||||
|
||||
String line = "";
|
||||
text = text.replace("\n", " \n ");
|
||||
text = text.replace("\r", " \r ");
|
||||
String[] words = text.split(" ");
|
||||
|
||||
FontRenderer font = Minecraft.getMinecraft().fontRenderer;
|
||||
for (String word : words) {
|
||||
if (word.isEmpty())
|
||||
continue;
|
||||
if (word.length() == 1) {
|
||||
char c = word.charAt(0);
|
||||
if (c == '\r' || c == '\n') {
|
||||
addLine(line);
|
||||
line = "";
|
||||
continue;
|
||||
}
|
||||
}
|
||||
String newLine;
|
||||
if (line.isEmpty())
|
||||
newLine = word;
|
||||
else
|
||||
newLine = line + " " + word;
|
||||
|
||||
if ((mcFont ? font.getStringWidth(newLine) : ClientProxy.Font.width(newLine)) > lineWidth) {
|
||||
addLine(line);
|
||||
line = word.trim();
|
||||
} else {
|
||||
line = newLine;
|
||||
}
|
||||
}
|
||||
if (!line.isEmpty())
|
||||
addLine(line);
|
||||
}
|
||||
|
||||
private void addLine(String text) {
|
||||
ChatComponentText line = new ChatComponentText(text);
|
||||
line.setChatStyle(style);
|
||||
lines.add(line);
|
||||
}
|
||||
}
|
||||
@@ -14,40 +14,40 @@ import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
public class TranslateUtil {
|
||||
private static final String TranslateUrl = "http://translate.google.com/translate_a/t?client=t&text=%s&hl=en&sl=%s&tl=%s&ie=UTF-8&oe=UTF-8&multires=1&otf=1&pc=1&trs=1&ssel=3&tsel=6&sc=1";
|
||||
private static final String AudioUrl = "http://translate.google.com/translate_tts?q=%s&tl=%s";
|
||||
private static final String TranslateUrl = "http://translate.google.com/translate_a/t?client=t&text=%s&hl=en&sl=%s&tl=%s&ie=UTF-8&oe=UTF-8&multires=1&otf=1&pc=1&trs=1&ssel=3&tsel=6&sc=1";
|
||||
private static final String AudioUrl = "http://translate.google.com/translate_tts?q=%s&tl=%s";
|
||||
|
||||
public static String Translate(String text){
|
||||
public static String Translate(String text) {
|
||||
|
||||
try {
|
||||
String urlStr = String.format(TranslateUrl, URLEncoder.encode(text,"utf8"), "auto", "nl");
|
||||
URL url = new URL(urlStr);
|
||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||
try {
|
||||
String urlStr = String.format(TranslateUrl, URLEncoder.encode(text, "utf8"), "auto", "nl");
|
||||
URL url = new URL(urlStr);
|
||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||
|
||||
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");
|
||||
//connection.setRequestProperty("referer", "accounterlive.com");
|
||||
connection.connect();
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||
String line = reader.readLine();
|
||||
reader.close();
|
||||
connection.disconnect();
|
||||
if(line != null){
|
||||
String parsed = parseJson(line);
|
||||
if(parsed != null)
|
||||
return parsed;
|
||||
}
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
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");
|
||||
//connection.setRequestProperty("referer", "accounterlive.com");
|
||||
connection.connect();
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||
String line = reader.readLine();
|
||||
reader.close();
|
||||
connection.disconnect();
|
||||
if (line != null) {
|
||||
String parsed = parseJson(line);
|
||||
if (parsed != null)
|
||||
return parsed;
|
||||
}
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
// public static void PlayAudio(String text){
|
||||
// try {
|
||||
@@ -80,16 +80,16 @@ public class TranslateUtil {
|
||||
// }
|
||||
// }
|
||||
|
||||
private static String parseJson(String line) {
|
||||
JsonParser parser = new JsonParser();
|
||||
JsonElement element = parser.parse(line);
|
||||
while(element.isJsonArray()){
|
||||
JsonArray array = (JsonArray) element;
|
||||
if(array.size() == 0)
|
||||
return null;
|
||||
element = array.get(0);
|
||||
}
|
||||
// System.out.println(element.getAsString());
|
||||
return element.getAsString();
|
||||
}
|
||||
private static String parseJson(String line) {
|
||||
JsonParser parser = new JsonParser();
|
||||
JsonElement element = parser.parse(line);
|
||||
while (element.isJsonArray()) {
|
||||
JsonArray array = (JsonArray) element;
|
||||
if (array.size() == 0)
|
||||
return null;
|
||||
element = array.get(0);
|
||||
}
|
||||
// System.out.println(element.getAsString());
|
||||
return element.getAsString();
|
||||
}
|
||||
}
|
||||
@@ -6,32 +6,33 @@ import net.minecraft.event.ClickEvent;
|
||||
import net.minecraft.event.ClickEvent.Action;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
|
||||
public class VersionChecker extends Thread{
|
||||
private int revision = 15;
|
||||
public VersionChecker(){
|
||||
|
||||
}
|
||||
public void run(){
|
||||
String name = '\u00A7'+ "cCustomNPC+" + '\u00A7' + "f";
|
||||
String link = '\u00A7'+"9"+'\u00A7' + "nClick here";
|
||||
String text = name +" installed. For more info " + link;
|
||||
|
||||
public class VersionChecker extends Thread {
|
||||
private int revision = 15;
|
||||
|
||||
public VersionChecker() {
|
||||
|
||||
}
|
||||
|
||||
public void run() {
|
||||
String name = '\u00A7' + "cCustomNPC+" + '\u00A7' + "f";
|
||||
String link = '\u00A7' + "9" + '\u00A7' + "nClick here";
|
||||
String text = name + " installed. For more info " + link;
|
||||
|
||||
EntityPlayer player;
|
||||
try{
|
||||
player = Minecraft.getMinecraft().thePlayer;
|
||||
}
|
||||
catch(NoSuchMethodError e){
|
||||
return;
|
||||
}
|
||||
while((player = Minecraft.getMinecraft().thePlayer) == null){
|
||||
try {
|
||||
Thread.sleep(2000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
player = Minecraft.getMinecraft().thePlayer;
|
||||
} catch (NoSuchMethodError e) {
|
||||
return;
|
||||
}
|
||||
while ((player = Minecraft.getMinecraft().thePlayer) == null) {
|
||||
try {
|
||||
Thread.sleep(2000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
ChatComponentTranslation message = new ChatComponentTranslation(text);
|
||||
message.getChatStyle().setChatClickEvent(new ClickEvent(Action.OPEN_URL, "https://www.curseforge.com/minecraft/mc-mods/customnpc-plus"));
|
||||
player.addChatMessage(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,46 +10,45 @@ import java.io.File;
|
||||
import java.util.HashSet;
|
||||
import java.util.UUID;
|
||||
|
||||
public class ClientCloneController extends ServerCloneController{
|
||||
public static ClientCloneController Instance;
|
||||
public class ClientCloneController extends ServerCloneController {
|
||||
public static ClientCloneController Instance;
|
||||
|
||||
@Override
|
||||
public File getDir(){
|
||||
File dir = new File(CustomNpcs.Dir,"clones");
|
||||
if(!dir.exists())
|
||||
dir.mkdir();
|
||||
return dir;
|
||||
}
|
||||
@Override
|
||||
public File getDir() {
|
||||
File dir = new File(CustomNpcs.Dir, "clones");
|
||||
if (!dir.exists())
|
||||
dir.mkdir();
|
||||
return dir;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addToTagMap(NBTTagCompound nbttagcompound, String name, int tab){
|
||||
HashSet<UUID> tagUUIDs = new HashSet<UUID>();
|
||||
if(nbttagcompound.hasKey("TagUUIDs")){
|
||||
NBTTagList nbtTagList = nbttagcompound.getTagList("TagUUIDs",8);
|
||||
for (int i = 0; i < nbtTagList.tagCount(); i++) {
|
||||
tagUUIDs.add(UUID.fromString(nbtTagList.getStringTagAt(i)));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean addToTagMap(NBTTagCompound nbttagcompound, String name, int tab) {
|
||||
HashSet<UUID> tagUUIDs = new HashSet<UUID>();
|
||||
if (nbttagcompound.hasKey("TagUUIDs")) {
|
||||
NBTTagList nbtTagList = nbttagcompound.getTagList("TagUUIDs", 8);
|
||||
for (int i = 0; i < nbtTagList.tagCount(); i++) {
|
||||
tagUUIDs.add(UUID.fromString(nbtTagList.getStringTagAt(i)));
|
||||
}
|
||||
}
|
||||
|
||||
TagMap tagMap = ClientTagMapController.Instance.getTagMap(tab);
|
||||
if(!tagUUIDs.isEmpty()){
|
||||
if (!tagUUIDs.isEmpty()) {
|
||||
tagMap.putClone(name, tagUUIDs);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
tagMap.removeClone(name);
|
||||
}
|
||||
ClientTagMapController.Instance.saveTagMap(tagMap);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeFromTagMap(String name, int tab){
|
||||
TagMap tagMap = ClientTagMapController.Instance.getTagMap(tab);
|
||||
if(tagMap.removeClone(name)){
|
||||
ClientTagMapController.Instance.saveTagMap(tagMap);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean removeFromTagMap(String name, int tab) {
|
||||
TagMap tagMap = ClientTagMapController.Instance.getTagMap(tab);
|
||||
if (tagMap.removeClone(name)) {
|
||||
ClientTagMapController.Instance.saveTagMap(tagMap);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,13 +6,13 @@ import noppes.npcs.controllers.ServerTagMapController;
|
||||
import java.io.File;
|
||||
|
||||
public class ClientTagMapController extends ServerTagMapController {
|
||||
public static ClientTagMapController Instance;
|
||||
public static ClientTagMapController Instance;
|
||||
|
||||
@Override
|
||||
public File getDir(){
|
||||
File dir = new File(CustomNpcs.Dir,"clones");
|
||||
if(!dir.exists())
|
||||
dir.mkdir();
|
||||
return dir;
|
||||
}
|
||||
@Override
|
||||
public File getDir() {
|
||||
File dir = new File(CustomNpcs.Dir, "clones");
|
||||
if (!dir.exists())
|
||||
dir.mkdir();
|
||||
return dir;
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@ import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
|
||||
public class MusicController {
|
||||
public static MusicController Instance;
|
||||
public static MusicController Instance;
|
||||
private final HashMap<String, ScriptClientSound> sounds = new HashMap<>();
|
||||
private int playDelay;
|
||||
public ScriptClientSound playingSound;
|
||||
@@ -19,9 +19,9 @@ public class MusicController {
|
||||
private Entity entity;
|
||||
private int offRange;
|
||||
|
||||
public MusicController(){
|
||||
Instance = this;
|
||||
}
|
||||
public MusicController() {
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
public void onUpdate() {
|
||||
if (this.playingSound != null
|
||||
@@ -54,33 +54,34 @@ public class MusicController {
|
||||
}
|
||||
}
|
||||
|
||||
public void stopMusic(){
|
||||
public void stopMusic() {
|
||||
SoundHandler soundHandler = Minecraft.getMinecraft().getSoundHandler();
|
||||
if (soundHandler != null) {
|
||||
try {
|
||||
soundHandler.stopSounds();
|
||||
} catch (Exception ignored) {}
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
if (this.playingSound != null) {
|
||||
this.playingSound.stopSound();
|
||||
this.playingSound = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void playMusicJukebox(String music, Entity entity, int offRange){
|
||||
public void playMusicJukebox(String music, Entity entity, int offRange) {
|
||||
if (this.playDelay > 0) {
|
||||
return;
|
||||
}
|
||||
this.playDelay = 20;
|
||||
|
||||
if (this.isPlaying(music)) {
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
this.stopMusic();
|
||||
|
||||
ScriptClientSound clientSound = new ScriptClientSound(music);
|
||||
clientSound.setEntity(entity);
|
||||
clientSound.setVolume(Math.max(1, offRange/16.0F));
|
||||
clientSound.setVolume(Math.max(1, offRange / 16.0F));
|
||||
clientSound.setAttenuationType(ISound.AttenuationType.LINEAR);
|
||||
clientSound.setRepeat(true);
|
||||
this.playingSound = clientSound;
|
||||
@@ -94,9 +95,9 @@ public class MusicController {
|
||||
} catch (Exception e) {
|
||||
this.stopAllSounds();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void playMusicBackground(String music, Entity entity, int offRange) {
|
||||
public void playMusicBackground(String music, Entity entity, int offRange) {
|
||||
if (this.playDelay > 0) {
|
||||
return;
|
||||
}
|
||||
@@ -121,7 +122,7 @@ public class MusicController {
|
||||
} catch (Exception e) {
|
||||
this.stopAllSounds();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void playSound(String music, float x, float y, float z) {
|
||||
if (this.playDelay > 0) {
|
||||
@@ -145,7 +146,7 @@ public class MusicController {
|
||||
this.sounds.put(clientSound.sound, clientSound);
|
||||
}
|
||||
|
||||
public boolean isPlaying(String music) {
|
||||
public boolean isPlaying(String music) {
|
||||
if (this.sounds.containsKey(music)) return true;
|
||||
|
||||
if (this.playingSound != null && this.playingSound.sound.equals(music)) {
|
||||
@@ -157,7 +158,7 @@ public class MusicController {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isPlaying() {
|
||||
return this.playingSound != null;
|
||||
|
||||
@@ -7,181 +7,181 @@ import noppes.npcs.entity.data.ModelPartData;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class Preset {
|
||||
|
||||
public ModelData data = new ModelData();
|
||||
public String name;
|
||||
|
||||
public NBTTagCompound writeToNBT(){
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setString("PresetName", name);
|
||||
compound.setTag("PresetData", data.writeToNBT());
|
||||
return compound;
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
name = compound.getString("PresetName");
|
||||
data.readFromNBT(compound.getCompoundTag("PresetData"));
|
||||
}
|
||||
|
||||
public static void FillDefault(HashMap<String,Preset> presets){
|
||||
ModelData data = new ModelData();
|
||||
Preset preset = new Preset();
|
||||
preset.name = "Elf Male";
|
||||
preset.data = data;
|
||||
data.modelScale.legs.setScale(0.85f,1.15f);
|
||||
data.modelScale.arms.setScale(0.85f,1.15f);
|
||||
data.modelScale.body.setScale(0.85f,1.15f);
|
||||
data.modelScale.head.setScale(0.85f,0.95f);
|
||||
presets.put("elf male", preset);
|
||||
|
||||
data = new ModelData();
|
||||
preset = new Preset();
|
||||
preset.name = "Elf Female";
|
||||
preset.data = data;
|
||||
data.breasts = 2;
|
||||
data.modelScale.legs.setScale(0.8f,1.05f);
|
||||
data.modelScale.arms.setScale(0.8f,1.05f);
|
||||
data.modelScale.body.setScale(0.8f,1.05f);
|
||||
data.modelScale.head.setScale(0.8f,0.85f);
|
||||
presets.put("elf female", preset);
|
||||
public ModelData data = new ModelData();
|
||||
public String name;
|
||||
|
||||
data = new ModelData();
|
||||
preset = new Preset();
|
||||
preset.name = "Dwarf Male";
|
||||
preset.data = data;
|
||||
data.modelScale.legs.setScale(1.1f,0.7f, 0.9f);
|
||||
data.modelScale.arms.setScale(0.9f,0.7f);
|
||||
data.modelScale.body.setScale(1.2f, 0.7f, 1.5f);
|
||||
data.modelScale.head.setScale(0.85f,0.85f);
|
||||
presets.put("dwarf male", preset);
|
||||
public NBTTagCompound writeToNBT() {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setString("PresetName", name);
|
||||
compound.setTag("PresetData", data.writeToNBT());
|
||||
return compound;
|
||||
}
|
||||
|
||||
data = new ModelData();
|
||||
preset = new Preset();
|
||||
preset.name = "Dwarf Female";
|
||||
preset.data = data;
|
||||
data.breasts = 2;
|
||||
data.modelScale.legs.setScale(0.9f,0.65f);
|
||||
data.modelScale.arms.setScale(0.9f,0.65f);
|
||||
data.modelScale.body.setScale(1f, 0.65f, 1.1f);
|
||||
data.modelScale.head.setScale(0.85f,0.85f);
|
||||
presets.put("dwarf female", preset);
|
||||
public void readFromNBT(NBTTagCompound compound) {
|
||||
name = compound.getString("PresetName");
|
||||
data.readFromNBT(compound.getCompoundTag("PresetData"));
|
||||
}
|
||||
|
||||
data = new ModelData();
|
||||
preset = new Preset();
|
||||
preset.name = "Orc Male";
|
||||
preset.data = data;
|
||||
data.modelScale.legs.setScale(1.2f,1.05f);
|
||||
data.modelScale.arms.setScale(1.2f,1.05f);
|
||||
data.modelScale.body.setScale(1.4f, 1.1f, 1.5f);
|
||||
data.modelScale.head.setScale(1.2f,1.1f);
|
||||
presets.put("orc male", preset);
|
||||
public static void FillDefault(HashMap<String, Preset> presets) {
|
||||
ModelData data = new ModelData();
|
||||
Preset preset = new Preset();
|
||||
preset.name = "Elf Male";
|
||||
preset.data = data;
|
||||
data.modelScale.legs.setScale(0.85f, 1.15f);
|
||||
data.modelScale.arms.setScale(0.85f, 1.15f);
|
||||
data.modelScale.body.setScale(0.85f, 1.15f);
|
||||
data.modelScale.head.setScale(0.85f, 0.95f);
|
||||
presets.put("elf male", preset);
|
||||
|
||||
data = new ModelData();
|
||||
preset = new Preset();
|
||||
preset.name = "Orc Female";
|
||||
preset.data = data;
|
||||
data.breasts = 2;
|
||||
data.modelScale.legs.setScale(1.1f,1);
|
||||
data.modelScale.arms.setScale(1.1f,1);
|
||||
data.modelScale.body.setScale(1.1f, 1f, 1.25f);
|
||||
presets.put("orc female", preset);
|
||||
data = new ModelData();
|
||||
preset = new Preset();
|
||||
preset.name = "Elf Female";
|
||||
preset.data = data;
|
||||
data.breasts = 2;
|
||||
data.modelScale.legs.setScale(0.8f, 1.05f);
|
||||
data.modelScale.arms.setScale(0.8f, 1.05f);
|
||||
data.modelScale.body.setScale(0.8f, 1.05f);
|
||||
data.modelScale.head.setScale(0.8f, 0.85f);
|
||||
presets.put("elf female", preset);
|
||||
|
||||
data = new ModelData();
|
||||
preset = new Preset();
|
||||
preset.name = "Human Male";
|
||||
preset.data = data;
|
||||
presets.put("human male", preset);
|
||||
data = new ModelData();
|
||||
preset = new Preset();
|
||||
preset.name = "Dwarf Male";
|
||||
preset.data = data;
|
||||
data.modelScale.legs.setScale(1.1f, 0.7f, 0.9f);
|
||||
data.modelScale.arms.setScale(0.9f, 0.7f);
|
||||
data.modelScale.body.setScale(1.2f, 0.7f, 1.5f);
|
||||
data.modelScale.head.setScale(0.85f, 0.85f);
|
||||
presets.put("dwarf male", preset);
|
||||
|
||||
data = new ModelData();
|
||||
preset = new Preset();
|
||||
preset.name = "Human Female";
|
||||
preset.data = data;
|
||||
data.breasts = 2;
|
||||
data.modelScale.head.setScale(0.95f,0.95f);
|
||||
data.modelScale.legs.setScale(0.92f,0.92f);
|
||||
data.modelScale.arms.setScale(0.80f,0.92f);
|
||||
data.modelScale.body.setScale(0.92f, 0.92f);
|
||||
presets.put("human female", preset);
|
||||
data = new ModelData();
|
||||
preset = new Preset();
|
||||
preset.name = "Dwarf Female";
|
||||
preset.data = data;
|
||||
data.breasts = 2;
|
||||
data.modelScale.legs.setScale(0.9f, 0.65f);
|
||||
data.modelScale.arms.setScale(0.9f, 0.65f);
|
||||
data.modelScale.body.setScale(1f, 0.65f, 1.1f);
|
||||
data.modelScale.head.setScale(0.85f, 0.85f);
|
||||
presets.put("dwarf female", preset);
|
||||
|
||||
data = new ModelData();
|
||||
preset = new Preset();
|
||||
preset.name = "Cat Male";
|
||||
preset.data = data;
|
||||
ModelPartData ears = data.getOrCreatePart("ears");
|
||||
ears.setTexture("ears/type1", 0);
|
||||
ears.color = 0xD9A64E;
|
||||
ModelPartData snout = data.getOrCreatePart("snout");
|
||||
snout.setTexture("snout/small1", 0);
|
||||
snout.color = 0xD9A64E;
|
||||
ModelPartData tail = data.getOrCreatePart("tail");
|
||||
tail.setTexture("tail/tail1", 0);
|
||||
tail.color = 0xD9A64E;
|
||||
presets.put("cat male", preset);
|
||||
data = new ModelData();
|
||||
preset = new Preset();
|
||||
preset.name = "Orc Male";
|
||||
preset.data = data;
|
||||
data.modelScale.legs.setScale(1.2f, 1.05f);
|
||||
data.modelScale.arms.setScale(1.2f, 1.05f);
|
||||
data.modelScale.body.setScale(1.4f, 1.1f, 1.5f);
|
||||
data.modelScale.head.setScale(1.2f, 1.1f);
|
||||
presets.put("orc male", preset);
|
||||
|
||||
data = new ModelData();
|
||||
preset = new Preset();
|
||||
preset.name = "Cat Female";
|
||||
preset.data = data;
|
||||
ears = data.getOrCreatePart("ears");
|
||||
ears.setTexture("ears/type1", 0);
|
||||
ears.color = 0xD9A64E;
|
||||
snout = data.getOrCreatePart("snout");
|
||||
snout.setTexture("snout/small1", 0);
|
||||
snout.color = 0xD9A64E;
|
||||
tail = data.getOrCreatePart("tail");
|
||||
tail.setTexture("tail/tail1", 0);
|
||||
tail.color = 0xD9A64E;
|
||||
data.breasts = 2;
|
||||
data.modelScale.head.setScale(0.95f,0.95f);
|
||||
data.modelScale.legs.setScale(0.92f,0.92f);
|
||||
data.modelScale.arms.setScale(0.80f,0.92f);
|
||||
data.modelScale.body.setScale(0.92f, 0.92f);
|
||||
presets.put("cat female", preset);
|
||||
data = new ModelData();
|
||||
preset = new Preset();
|
||||
preset.name = "Orc Female";
|
||||
preset.data = data;
|
||||
data.breasts = 2;
|
||||
data.modelScale.legs.setScale(1.1f, 1);
|
||||
data.modelScale.arms.setScale(1.1f, 1);
|
||||
data.modelScale.body.setScale(1.1f, 1f, 1.25f);
|
||||
presets.put("orc female", preset);
|
||||
|
||||
data = new ModelData();
|
||||
preset = new Preset();
|
||||
preset.name = "Wolf Male";
|
||||
preset.data = data;
|
||||
ears = data.getOrCreatePart("ears");
|
||||
ears.setTexture("ears/type1", 0);
|
||||
ears.color = 0x5E5855;
|
||||
snout = data.getOrCreatePart("snout");
|
||||
snout.setTexture("snout/large1", 2);
|
||||
snout.color = 0x5E5855;
|
||||
tail = data.getOrCreatePart("tail");
|
||||
tail.setTexture("tail/tail2", 0);
|
||||
tail.color = 0x5E5855;
|
||||
presets.put("wolf male", preset);
|
||||
data = new ModelData();
|
||||
preset = new Preset();
|
||||
preset.name = "Human Male";
|
||||
preset.data = data;
|
||||
presets.put("human male", preset);
|
||||
|
||||
data = new ModelData();
|
||||
preset = new Preset();
|
||||
preset.name = "Wolf Female";
|
||||
preset.data = data;
|
||||
ears = data.getOrCreatePart("ears");
|
||||
ears.setTexture("ears/type1", 0);
|
||||
ears.color = 0x5E5855;
|
||||
snout = data.getOrCreatePart("snout");
|
||||
snout.setTexture("snout/large1", 2);
|
||||
snout.color = 0x5E5855;
|
||||
tail = data.getOrCreatePart("tail");
|
||||
tail.setTexture("tail/tail2", 0);
|
||||
tail.color = 0x5E5855;
|
||||
data.breasts = 2;
|
||||
data.modelScale.head.setScale(0.95f,0.95f);
|
||||
data.modelScale.legs.setScale(0.92f,0.92f);
|
||||
data.modelScale.arms.setScale(0.80f,0.92f);
|
||||
data.modelScale.body.setScale(0.92f, 0.92f);
|
||||
presets.put("wolf female", preset);
|
||||
data = new ModelData();
|
||||
preset = new Preset();
|
||||
preset.name = "Human Female";
|
||||
preset.data = data;
|
||||
data.breasts = 2;
|
||||
data.modelScale.head.setScale(0.95f, 0.95f);
|
||||
data.modelScale.legs.setScale(0.92f, 0.92f);
|
||||
data.modelScale.arms.setScale(0.80f, 0.92f);
|
||||
data.modelScale.body.setScale(0.92f, 0.92f);
|
||||
presets.put("human female", preset);
|
||||
|
||||
data = new ModelData();
|
||||
preset = new Preset();
|
||||
preset.name = "Enderchibi";
|
||||
preset.data = data;
|
||||
data.modelScale.legs.setScale(0.65f,0.75f);
|
||||
data.modelScale.arms.setScale(0.50f,1.45f);
|
||||
ModelPartData part = data.getOrCreatePart("particles");
|
||||
part.setTexture("particle/type1", 1);
|
||||
part.color = 0xFF0000;
|
||||
presets.put("enderchibi", preset);
|
||||
}
|
||||
data = new ModelData();
|
||||
preset = new Preset();
|
||||
preset.name = "Cat Male";
|
||||
preset.data = data;
|
||||
ModelPartData ears = data.getOrCreatePart("ears");
|
||||
ears.setTexture("ears/type1", 0);
|
||||
ears.color = 0xD9A64E;
|
||||
ModelPartData snout = data.getOrCreatePart("snout");
|
||||
snout.setTexture("snout/small1", 0);
|
||||
snout.color = 0xD9A64E;
|
||||
ModelPartData tail = data.getOrCreatePart("tail");
|
||||
tail.setTexture("tail/tail1", 0);
|
||||
tail.color = 0xD9A64E;
|
||||
presets.put("cat male", preset);
|
||||
|
||||
data = new ModelData();
|
||||
preset = new Preset();
|
||||
preset.name = "Cat Female";
|
||||
preset.data = data;
|
||||
ears = data.getOrCreatePart("ears");
|
||||
ears.setTexture("ears/type1", 0);
|
||||
ears.color = 0xD9A64E;
|
||||
snout = data.getOrCreatePart("snout");
|
||||
snout.setTexture("snout/small1", 0);
|
||||
snout.color = 0xD9A64E;
|
||||
tail = data.getOrCreatePart("tail");
|
||||
tail.setTexture("tail/tail1", 0);
|
||||
tail.color = 0xD9A64E;
|
||||
data.breasts = 2;
|
||||
data.modelScale.head.setScale(0.95f, 0.95f);
|
||||
data.modelScale.legs.setScale(0.92f, 0.92f);
|
||||
data.modelScale.arms.setScale(0.80f, 0.92f);
|
||||
data.modelScale.body.setScale(0.92f, 0.92f);
|
||||
presets.put("cat female", preset);
|
||||
|
||||
data = new ModelData();
|
||||
preset = new Preset();
|
||||
preset.name = "Wolf Male";
|
||||
preset.data = data;
|
||||
ears = data.getOrCreatePart("ears");
|
||||
ears.setTexture("ears/type1", 0);
|
||||
ears.color = 0x5E5855;
|
||||
snout = data.getOrCreatePart("snout");
|
||||
snout.setTexture("snout/large1", 2);
|
||||
snout.color = 0x5E5855;
|
||||
tail = data.getOrCreatePart("tail");
|
||||
tail.setTexture("tail/tail2", 0);
|
||||
tail.color = 0x5E5855;
|
||||
presets.put("wolf male", preset);
|
||||
|
||||
data = new ModelData();
|
||||
preset = new Preset();
|
||||
preset.name = "Wolf Female";
|
||||
preset.data = data;
|
||||
ears = data.getOrCreatePart("ears");
|
||||
ears.setTexture("ears/type1", 0);
|
||||
ears.color = 0x5E5855;
|
||||
snout = data.getOrCreatePart("snout");
|
||||
snout.setTexture("snout/large1", 2);
|
||||
snout.color = 0x5E5855;
|
||||
tail = data.getOrCreatePart("tail");
|
||||
tail.setTexture("tail/tail2", 0);
|
||||
tail.color = 0x5E5855;
|
||||
data.breasts = 2;
|
||||
data.modelScale.head.setScale(0.95f, 0.95f);
|
||||
data.modelScale.legs.setScale(0.92f, 0.92f);
|
||||
data.modelScale.arms.setScale(0.80f, 0.92f);
|
||||
data.modelScale.body.setScale(0.92f, 0.92f);
|
||||
presets.put("wolf female", preset);
|
||||
|
||||
data = new ModelData();
|
||||
preset = new Preset();
|
||||
preset.name = "Enderchibi";
|
||||
preset.data = data;
|
||||
data.modelScale.legs.setScale(0.65f, 0.75f);
|
||||
data.modelScale.arms.setScale(0.50f, 1.45f);
|
||||
ModelPartData part = data.getOrCreatePart("particles");
|
||||
part.setTexture("particle/type1", 1);
|
||||
part.color = 0xFF0000;
|
||||
presets.put("enderchibi", preset);
|
||||
}
|
||||
}
|
||||
@@ -12,112 +12,109 @@ import java.util.HashMap;
|
||||
|
||||
public class PresetController {
|
||||
|
||||
public HashMap<String,Preset> presets = new HashMap<String,Preset>();
|
||||
|
||||
private File dir;
|
||||
public static PresetController instance;
|
||||
|
||||
public PresetController(File dir){
|
||||
instance = this;
|
||||
this.dir = dir;
|
||||
load();
|
||||
}
|
||||
public HashMap<String, Preset> presets = new HashMap<String, Preset>();
|
||||
|
||||
public Preset getPreset(String username) {
|
||||
if(presets.isEmpty())
|
||||
load();
|
||||
return presets.get(username.toLowerCase());
|
||||
}
|
||||
|
||||
public void load(){
|
||||
NBTTagCompound compound = loadPreset();
|
||||
HashMap<String,Preset> presets = new HashMap<String, Preset>();
|
||||
if(compound != null){
|
||||
NBTTagList list = compound.getTagList("Presets", 10);
|
||||
for(int i = 0; i < list.tagCount(); i++){
|
||||
NBTTagCompound comp = list.getCompoundTagAt(i);
|
||||
Preset preset = new Preset();
|
||||
preset.readFromNBT(comp);
|
||||
presets.put(preset.name.toLowerCase(), preset);
|
||||
}
|
||||
}
|
||||
Preset.FillDefault(presets);
|
||||
this.presets = presets;
|
||||
}
|
||||
private File dir;
|
||||
public static PresetController instance;
|
||||
|
||||
private NBTTagCompound loadPreset(){
|
||||
String filename = "presets.dat";
|
||||
try {
|
||||
File file = new File(dir, filename);
|
||||
if(!file.exists()){
|
||||
return null;
|
||||
}
|
||||
return CompressedStreamTools.readCompressed(new FileInputStream(file));
|
||||
} catch (Exception e) {
|
||||
LogWriter.except(e);
|
||||
}
|
||||
try {
|
||||
File file = new File(dir, filename+"_old");
|
||||
if(!file.exists()){
|
||||
return null;
|
||||
}
|
||||
return CompressedStreamTools.readCompressed(new FileInputStream(file));
|
||||
|
||||
} catch (Exception e) {
|
||||
LogWriter.except(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void save(){
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
NBTTagList list = new NBTTagList();
|
||||
for(Preset preset : presets.values()){
|
||||
list.appendTag(preset.writeToNBT());
|
||||
}
|
||||
|
||||
compound.setTag("Presets", list);
|
||||
savePreset(compound);
|
||||
}
|
||||
public PresetController(File dir) {
|
||||
instance = this;
|
||||
this.dir = dir;
|
||||
load();
|
||||
}
|
||||
|
||||
private void savePreset(NBTTagCompound compound){
|
||||
String filename = "presets.dat";
|
||||
try {
|
||||
File file = new File(dir, filename+"_new");
|
||||
File file1 = new File(dir, filename+"_old");
|
||||
public Preset getPreset(String username) {
|
||||
if (presets.isEmpty())
|
||||
load();
|
||||
return presets.get(username.toLowerCase());
|
||||
}
|
||||
|
||||
public void load() {
|
||||
NBTTagCompound compound = loadPreset();
|
||||
HashMap<String, Preset> presets = new HashMap<String, Preset>();
|
||||
if (compound != null) {
|
||||
NBTTagList list = compound.getTagList("Presets", 10);
|
||||
for (int i = 0; i < list.tagCount(); i++) {
|
||||
NBTTagCompound comp = list.getCompoundTagAt(i);
|
||||
Preset preset = new Preset();
|
||||
preset.readFromNBT(comp);
|
||||
presets.put(preset.name.toLowerCase(), preset);
|
||||
}
|
||||
}
|
||||
Preset.FillDefault(presets);
|
||||
this.presets = presets;
|
||||
}
|
||||
|
||||
private NBTTagCompound loadPreset() {
|
||||
String filename = "presets.dat";
|
||||
try {
|
||||
File file = new File(dir, filename);
|
||||
if (!file.exists()) {
|
||||
return null;
|
||||
}
|
||||
return CompressedStreamTools.readCompressed(new FileInputStream(file));
|
||||
} catch (Exception e) {
|
||||
LogWriter.except(e);
|
||||
}
|
||||
try {
|
||||
File file = new File(dir, filename + "_old");
|
||||
if (!file.exists()) {
|
||||
return null;
|
||||
}
|
||||
return CompressedStreamTools.readCompressed(new FileInputStream(file));
|
||||
|
||||
} catch (Exception e) {
|
||||
LogWriter.except(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void save() {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
NBTTagList list = new NBTTagList();
|
||||
for (Preset preset : presets.values()) {
|
||||
list.appendTag(preset.writeToNBT());
|
||||
}
|
||||
|
||||
compound.setTag("Presets", list);
|
||||
savePreset(compound);
|
||||
}
|
||||
|
||||
private void savePreset(NBTTagCompound compound) {
|
||||
String filename = "presets.dat";
|
||||
try {
|
||||
File file = new File(dir, filename + "_new");
|
||||
File file1 = new File(dir, filename + "_old");
|
||||
File file2 = new File(dir, filename);
|
||||
CompressedStreamTools.writeCompressed(compound, new FileOutputStream(file));
|
||||
if(file1.exists())
|
||||
{
|
||||
if (file1.exists()) {
|
||||
file1.delete();
|
||||
}
|
||||
file2.renameTo(file1);
|
||||
if(file2.exists())
|
||||
{
|
||||
if (file2.exists()) {
|
||||
file2.delete();
|
||||
}
|
||||
file.renameTo(file2);
|
||||
if(file.exists())
|
||||
{
|
||||
if (file.exists()) {
|
||||
file.delete();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LogWriter.except(e);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LogWriter.except(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void addPreset(Preset preset) {
|
||||
while(presets.containsKey(preset.name.toLowerCase())){
|
||||
preset.name += "_";
|
||||
}
|
||||
presets.put(preset.name.toLowerCase(), preset);
|
||||
save();
|
||||
}
|
||||
public void addPreset(Preset preset) {
|
||||
while (presets.containsKey(preset.name.toLowerCase())) {
|
||||
preset.name += "_";
|
||||
}
|
||||
presets.put(preset.name.toLowerCase(), preset);
|
||||
save();
|
||||
}
|
||||
|
||||
public void removePreset(String preset) {
|
||||
if(preset == null)
|
||||
return;
|
||||
presets.remove(preset.toLowerCase());
|
||||
save();
|
||||
}
|
||||
public void removePreset(String preset) {
|
||||
if (preset == null)
|
||||
return;
|
||||
presets.remove(preset.toLowerCase());
|
||||
save();
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,7 @@ public class ScriptSoundController {
|
||||
soundHandler.stopSound(sound);
|
||||
sounds.get(id).stopSound();
|
||||
}
|
||||
sounds.put(id,sound);
|
||||
sounds.put(id, sound);
|
||||
soundHandler.playSound(sound);
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ public class CustomFX extends EntityFX {
|
||||
protected int timeSinceStart;
|
||||
public int animRate;
|
||||
public boolean animLoop;
|
||||
public int animStart,animEnd;
|
||||
public int animStart, animEnd;
|
||||
protected int animPosX;
|
||||
protected int animPosY;
|
||||
|
||||
@@ -96,21 +96,21 @@ public class CustomFX extends EntityFX {
|
||||
customFX.HEXColorRate = particle.HEXColorRate;
|
||||
customFX.HEXColorStart = particle.HEXColorStart;
|
||||
customFX.particleRed = (customFX.HEXColor >> 16 & 255) / 255f;
|
||||
customFX.particleGreen = (customFX.HEXColor >> 8 & 255) / 255f;
|
||||
customFX.particleGreen = (customFX.HEXColor >> 8 & 255) / 255f;
|
||||
customFX.particleBlue = (customFX.HEXColor & 255) / 255f;
|
||||
|
||||
customFX.scaleX1 = particle.scaleX1;
|
||||
customFX.scaleX2 = particle.scaleX2;
|
||||
customFX.scaleXRate = Math.abs(particle.scaleXRate);
|
||||
customFX.scaleXRateStart = particle.scaleXRateStart;
|
||||
if(customFX.scaleX1 > customFX.scaleX2)
|
||||
if (customFX.scaleX1 > customFX.scaleX2)
|
||||
customFX.scaleXRate *= -1;
|
||||
|
||||
customFX.scaleY1 = particle.scaleY1;
|
||||
customFX.scaleY2 = particle.scaleY2;
|
||||
customFX.scaleYRate = Math.abs(particle.scaleYRate);
|
||||
customFX.scaleYRateStart = particle.scaleYRateStart;
|
||||
if(customFX.scaleY1 > customFX.scaleY2)
|
||||
if (customFX.scaleY1 > customFX.scaleY2)
|
||||
customFX.scaleYRate *= -1;
|
||||
|
||||
customFX.alpha1 = particle.alpha1;
|
||||
@@ -118,7 +118,7 @@ public class CustomFX extends EntityFX {
|
||||
customFX.alphaRate = Math.abs(particle.alphaRate);
|
||||
customFX.alphaRateStart = particle.alphaRateStart;
|
||||
customFX.particleAlpha = customFX.alpha1;
|
||||
if(customFX.alpha1 > customFX.alpha2)
|
||||
if (customFX.alpha1 > customFX.alpha2)
|
||||
customFX.alphaRate *= -1;
|
||||
|
||||
customFX.rotationX1 = particle.rotationX1;
|
||||
@@ -126,7 +126,7 @@ public class CustomFX extends EntityFX {
|
||||
customFX.rotationXRate = Math.abs(particle.rotationXRate);
|
||||
customFX.rotationXRateStart = particle.rotationXRateStart;
|
||||
customFX.rotationX = customFX.rotationX1;
|
||||
if(customFX.rotationX1 > customFX.rotationX2)
|
||||
if (customFX.rotationX1 > customFX.rotationX2)
|
||||
customFX.rotationXRate *= -1;
|
||||
|
||||
customFX.rotationY1 = particle.rotationY1;
|
||||
@@ -134,7 +134,7 @@ public class CustomFX extends EntityFX {
|
||||
customFX.rotationYRate = Math.abs(particle.rotationYRate);
|
||||
customFX.rotationYRateStart = particle.rotationYRateStart;
|
||||
customFX.rotationY = customFX.rotationY1;
|
||||
if(customFX.rotationY1 > customFX.rotationY2)
|
||||
if (customFX.rotationY1 > customFX.rotationY2)
|
||||
customFX.rotationYRate *= -1;
|
||||
|
||||
customFX.rotationZ1 = particle.rotationZ1;
|
||||
@@ -142,10 +142,10 @@ public class CustomFX extends EntityFX {
|
||||
customFX.rotationZRate = Math.abs(particle.rotationZRate);
|
||||
customFX.rotationZRateStart = particle.rotationZRateStart;
|
||||
customFX.rotationZ = customFX.rotationZ1;
|
||||
if(customFX.rotationZ1 > customFX.rotationZ2)
|
||||
if (customFX.rotationZ1 > customFX.rotationZ2)
|
||||
customFX.rotationZRate *= -1;
|
||||
|
||||
customFX.particleGravity = particle.gravity/0.04F;
|
||||
customFX.particleGravity = particle.gravity / 0.04F;
|
||||
customFX.particleMaxAge = particle.maxAge;
|
||||
|
||||
customFX.motionX = particle.motionX;
|
||||
@@ -163,7 +163,7 @@ public class CustomFX extends EntityFX {
|
||||
customFX.animLoop = particle.animLoop;
|
||||
customFX.animStart = particle.animStart;
|
||||
customFX.animEnd = particle.animEnd;
|
||||
if(customFX.animEnd < customFX.animStart)
|
||||
if (customFX.animEnd < customFX.animStart)
|
||||
customFX.animEnd = customFX.animStart + customFX.particleMaxAge;
|
||||
|
||||
customFX.facePlayer = particle.facePlayer;
|
||||
@@ -180,8 +180,7 @@ public class CustomFX extends EntityFX {
|
||||
|
||||
++this.timeSinceStart;
|
||||
|
||||
if (this.timeSinceStart == this.particleMaxAge)
|
||||
{
|
||||
if (this.timeSinceStart == this.particleMaxAge) {
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
@@ -189,7 +188,7 @@ public class CustomFX extends EntityFX {
|
||||
this.prevPosY = this.posY;
|
||||
this.prevPosZ = this.posZ;
|
||||
|
||||
this.motionY -= 0.04D * (double)this.particleGravity;
|
||||
this.motionY -= 0.04D * (double) this.particleGravity;
|
||||
this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
||||
|
||||
if (animRate > 0 && timeSinceStart % animRate == 0 && timeSinceStart > 0 && timeSinceStart >= animStart && timeSinceStart <= animEnd && (animLoop || animPosY <= imageData.getTotalHeight())) {
|
||||
@@ -204,16 +203,15 @@ public class CustomFX extends EntityFX {
|
||||
}
|
||||
|
||||
particleRed = (HEXColor >> 16 & 255) / 255f;
|
||||
particleGreen = (HEXColor >> 8 & 255) / 255f;
|
||||
particleGreen = (HEXColor >> 8 & 255) / 255f;
|
||||
particleBlue = (HEXColor & 255) / 255f;
|
||||
|
||||
if(timeSinceStart >= HEXColorStart)
|
||||
if (timeSinceStart >= HEXColorStart)
|
||||
HEXColor = lerpColor(HEXColor, HEXColor2, HEXColorRate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderParticle(Tessellator tessellator, float partialTick, float cosYaw, float cosPitch, float sinYaw, float sinSinPitch, float cosSinPitch)
|
||||
{
|
||||
public void renderParticle(Tessellator tessellator, float partialTick, float cosYaw, float cosPitch, float sinYaw, float sinSinPitch, float cosSinPitch) {
|
||||
if (!this.imageLoaded()) {
|
||||
return;
|
||||
}
|
||||
@@ -224,46 +222,46 @@ public class CustomFX extends EntityFX {
|
||||
setDead();
|
||||
}
|
||||
|
||||
if(entity != null){
|
||||
startX = (float)(entity.prevPosX + (entity.posX - entity.prevPosX) * (double)partialTick);
|
||||
startY = (float)(entity.prevPosY + (entity.posY - entity.prevPosY) * (double)partialTick);
|
||||
startZ = (float)(entity.prevPosZ + (entity.posZ - entity.prevPosZ) * (double)partialTick);
|
||||
if (entity != null) {
|
||||
startX = (float) (entity.prevPosX + (entity.posX - entity.prevPosX) * (double) partialTick);
|
||||
startY = (float) (entity.prevPosY + (entity.posY - entity.prevPosY) * (double) partialTick);
|
||||
startZ = (float) (entity.prevPosZ + (entity.posZ - entity.prevPosZ) * (double) partialTick);
|
||||
}
|
||||
|
||||
float scaleXChange = this.scaleXRate / (float)particleMaxAge;
|
||||
if((this.scaleXRate < 0 && this.scaleX1+scaleXChange < this.scaleX2) || (this.scaleXRate > 0 && this.scaleX1+scaleXChange > this.scaleX2))
|
||||
float scaleXChange = this.scaleXRate / (float) particleMaxAge;
|
||||
if ((this.scaleXRate < 0 && this.scaleX1 + scaleXChange < this.scaleX2) || (this.scaleXRate > 0 && this.scaleX1 + scaleXChange > this.scaleX2))
|
||||
this.scaleX1 = this.scaleX2;
|
||||
else if(timeSinceStart >= this.scaleXRateStart)
|
||||
else if (timeSinceStart >= this.scaleXRateStart)
|
||||
this.scaleX1 += scaleXChange;
|
||||
|
||||
float scaleYChange = this.scaleYRate / (float)particleMaxAge;
|
||||
if((this.scaleYRate < 0 && this.scaleY1+scaleYChange < this.scaleY2) || (this.scaleYRate > 0 && this.scaleY1+scaleYChange > this.scaleY2))
|
||||
float scaleYChange = this.scaleYRate / (float) particleMaxAge;
|
||||
if ((this.scaleYRate < 0 && this.scaleY1 + scaleYChange < this.scaleY2) || (this.scaleYRate > 0 && this.scaleY1 + scaleYChange > this.scaleY2))
|
||||
this.scaleY1 = this.scaleY2;
|
||||
else if(timeSinceStart >= this.scaleYRateStart)
|
||||
else if (timeSinceStart >= this.scaleYRateStart)
|
||||
this.scaleY1 += scaleYChange;
|
||||
|
||||
float alphaChange = this.alphaRate / (float)particleMaxAge;
|
||||
if((this.alphaRate < 0 && particleAlpha+alphaChange < this.alpha2) || (this.alphaRate > 0 && particleAlpha+alphaChange > this.alpha2))
|
||||
float alphaChange = this.alphaRate / (float) particleMaxAge;
|
||||
if ((this.alphaRate < 0 && particleAlpha + alphaChange < this.alpha2) || (this.alphaRate > 0 && particleAlpha + alphaChange > this.alpha2))
|
||||
particleAlpha = this.alpha2;
|
||||
else if(timeSinceStart >= this.alphaRateStart)
|
||||
else if (timeSinceStart >= this.alphaRateStart)
|
||||
particleAlpha += alphaChange;
|
||||
|
||||
float rotationXChange = this.rotationXRate / (float)particleMaxAge;
|
||||
if((this.rotationXRate < 0 && rotationX+rotationXChange < this.rotationX2) || (this.rotationXRate > 0 && rotationX+rotationXChange > this.rotationX2))
|
||||
float rotationXChange = this.rotationXRate / (float) particleMaxAge;
|
||||
if ((this.rotationXRate < 0 && rotationX + rotationXChange < this.rotationX2) || (this.rotationXRate > 0 && rotationX + rotationXChange > this.rotationX2))
|
||||
rotationX = this.rotationX2;
|
||||
else if(timeSinceStart >= this.rotationXRateStart)
|
||||
else if (timeSinceStart >= this.rotationXRateStart)
|
||||
rotationX += rotationXChange;
|
||||
|
||||
float rotationYChange = this.rotationYRate / (float)particleMaxAge;
|
||||
if((this.rotationYRate < 0 && rotationY+rotationYChange < this.rotationY2) || (this.rotationYRate > 0 && rotationY+rotationYChange > this.rotationY2))
|
||||
float rotationYChange = this.rotationYRate / (float) particleMaxAge;
|
||||
if ((this.rotationYRate < 0 && rotationY + rotationYChange < this.rotationY2) || (this.rotationYRate > 0 && rotationY + rotationYChange > this.rotationY2))
|
||||
rotationY = this.rotationY2;
|
||||
else if(timeSinceStart >= this.rotationYRateStart)
|
||||
else if (timeSinceStart >= this.rotationYRateStart)
|
||||
rotationY += rotationYChange;
|
||||
|
||||
float rotationZChange = this.rotationZRate / (float)particleMaxAge;
|
||||
if((this.rotationZRate < 0 && rotationZ+rotationZChange < this.rotationZ2) || (this.rotationZRate > 0 && rotationZ+rotationZChange > this.rotationZ2))
|
||||
float rotationZChange = this.rotationZRate / (float) particleMaxAge;
|
||||
if ((this.rotationZRate < 0 && rotationZ + rotationZChange < this.rotationZ2) || (this.rotationZRate > 0 && rotationZ + rotationZChange > this.rotationZ2))
|
||||
rotationZ = this.rotationZ2;
|
||||
else if(timeSinceStart >= this.rotationZRateStart)
|
||||
else if (timeSinceStart >= this.rotationZRateStart)
|
||||
rotationZ += rotationZChange;
|
||||
|
||||
renderParticleSide(true, tessellator, partialTick);
|
||||
@@ -274,81 +272,77 @@ public class CustomFX extends EntityFX {
|
||||
tessellator.startDrawingQuads();
|
||||
}
|
||||
|
||||
public void renderParticleSide(boolean front, Tessellator tessellator, float partialTick){
|
||||
public void renderParticleSide(boolean front, Tessellator tessellator, float partialTick) {
|
||||
int totalWidth = imageData.getTotalWidth();
|
||||
int totalHeight = imageData.getTotalHeight();
|
||||
|
||||
float u1 = (float)offsetX/(float)totalWidth + (float)animPosX/(float)totalWidth;
|
||||
float u2 = u1 + (float)width/(float)totalWidth;
|
||||
float v1 = (float)offsetY/(float)totalHeight + (float)animPosY/(float)totalHeight;
|
||||
float v2 = v1 + (float)height/(float)totalHeight;
|
||||
float u1 = (float) offsetX / (float) totalWidth + (float) animPosX / (float) totalWidth;
|
||||
float u2 = u1 + (float) width / (float) totalWidth;
|
||||
float v1 = (float) offsetY / (float) totalHeight + (float) animPosY / (float) totalHeight;
|
||||
float v2 = v1 + (float) height / (float) totalHeight;
|
||||
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
float posX = (float)((prevPosX + (this.posX - prevPosX) * (double)partialTick) - interpPosX) + startX;
|
||||
float posY = (float)((prevPosY + (this.posY - prevPosY) * (double)partialTick) - interpPosY) + startY;
|
||||
float posZ = (float)((prevPosZ + (this.posZ - prevPosZ) * (double)partialTick) - interpPosZ) + startZ;
|
||||
float posX = (float) ((prevPosX + (this.posX - prevPosX) * (double) partialTick) - interpPosX) + startX;
|
||||
float posY = (float) ((prevPosY + (this.posY - prevPosY) * (double) partialTick) - interpPosY) + startY;
|
||||
float posZ = (float) ((prevPosZ + (this.posZ - prevPosZ) * (double) partialTick) - interpPosZ) + startZ;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
renderPosX = startX + posX + this.posX;
|
||||
renderPosY = startY + posY + this.posY;
|
||||
renderPosZ = startZ + posZ + this.posZ;
|
||||
renderPosX = startX + posX + this.posX;
|
||||
renderPosY = startY + posY + this.posY;
|
||||
renderPosZ = startZ + posZ + this.posZ;
|
||||
|
||||
GL11.glTranslated(posX,posY,posZ);
|
||||
if(facePlayer) {
|
||||
GL11.glRotated(180 - player.rotationYaw, 0.0, 1.0, 0.0);
|
||||
GL11.glRotated(-player.rotationPitch + 90, 1.0, 0.0, 0.0);
|
||||
GL11.glTranslated(posX, posY, posZ);
|
||||
if (facePlayer) {
|
||||
GL11.glRotated(180 - player.rotationYaw, 0.0, 1.0, 0.0);
|
||||
GL11.glRotated(-player.rotationPitch + 90, 1.0, 0.0, 0.0);
|
||||
|
||||
GL11.glRotated(rotationX, 1.0, 0.0, 0.0);
|
||||
GL11.glRotated(rotationZ, 0.0, 1.0, 0.0);
|
||||
GL11.glRotated(rotationY + (!front ? 180 : 0), 0.0, 0.0, 1.0);
|
||||
} else {
|
||||
GL11.glRotated(rotationX, 1.0, 0.0, 0.0);
|
||||
GL11.glRotated(rotationY, 0.0, 1.0, 0.0);
|
||||
GL11.glRotated(rotationZ + (!front ? 180 : 0), 0.0, 0.0, 1.0);
|
||||
}
|
||||
GL11.glRotated(rotationX, 1.0, 0.0, 0.0);
|
||||
GL11.glRotated(rotationZ, 0.0, 1.0, 0.0);
|
||||
GL11.glRotated(rotationY + (!front ? 180 : 0), 0.0, 0.0, 1.0);
|
||||
} else {
|
||||
GL11.glRotated(rotationX, 1.0, 0.0, 0.0);
|
||||
GL11.glRotated(rotationY, 0.0, 1.0, 0.0);
|
||||
GL11.glRotated(rotationZ + (!front ? 180 : 0), 0.0, 0.0, 1.0);
|
||||
}
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
if (!this.glows) {
|
||||
tessellator.setBrightness(this.getBrightnessForRender(partialTick));
|
||||
} else {
|
||||
tessellator.setBrightness(240);
|
||||
}
|
||||
tessellator.startDrawingQuads();
|
||||
if (!this.glows) {
|
||||
tessellator.setBrightness(this.getBrightnessForRender(partialTick));
|
||||
} else {
|
||||
tessellator.setBrightness(240);
|
||||
}
|
||||
|
||||
float textureXScale = 1.0F, textureYScale = 1.0F;
|
||||
if (totalWidth > totalHeight) {
|
||||
textureYScale = (float) totalHeight/totalWidth;
|
||||
GL11.glScalef(1/textureYScale/2,1/textureYScale/2,1/textureYScale/2);
|
||||
} else if(totalHeight > totalWidth) {
|
||||
textureXScale = (float) totalWidth/totalHeight;
|
||||
GL11.glScalef(1/textureXScale/2,1/textureXScale/2,1/textureXScale/2);
|
||||
}
|
||||
textureXScale *= scaleX1/10.0F;
|
||||
textureYScale *= scaleY1/10.0F;
|
||||
float textureXScale = 1.0F, textureYScale = 1.0F;
|
||||
if (totalWidth > totalHeight) {
|
||||
textureYScale = (float) totalHeight / totalWidth;
|
||||
GL11.glScalef(1 / textureYScale / 2, 1 / textureYScale / 2, 1 / textureYScale / 2);
|
||||
} else if (totalHeight > totalWidth) {
|
||||
textureXScale = (float) totalWidth / totalHeight;
|
||||
GL11.glScalef(1 / textureXScale / 2, 1 / textureXScale / 2, 1 / textureXScale / 2);
|
||||
}
|
||||
textureXScale *= scaleX1 / 10.0F;
|
||||
textureYScale *= scaleY1 / 10.0F;
|
||||
|
||||
tessellator.setColorOpaque_F(1, 1, 1);
|
||||
tessellator.setColorRGBA_F(particleRed, particleGreen, particleBlue, particleAlpha);
|
||||
tessellator.addVertexWithUV( textureXScale * (u2-u1)/2, 0, textureYScale * (v2-v1)/2, u2, v2);
|
||||
tessellator.addVertexWithUV( textureXScale * (u2-u1)/2, 0, textureYScale * -(v2-v1)/2, u2, v1);
|
||||
tessellator.addVertexWithUV( textureXScale * -(u2-u1)/2, 0, textureYScale * -(v2-v1)/2, u1, v1);
|
||||
tessellator.addVertexWithUV( textureXScale * -(u2-u1)/2, 0, textureYScale * (v2-v1)/2, u1, v2);
|
||||
tessellator.draw();
|
||||
tessellator.setColorOpaque_F(1, 1, 1);
|
||||
tessellator.setColorRGBA_F(particleRed, particleGreen, particleBlue, particleAlpha);
|
||||
tessellator.addVertexWithUV(textureXScale * (u2 - u1) / 2, 0, textureYScale * (v2 - v1) / 2, u2, v2);
|
||||
tessellator.addVertexWithUV(textureXScale * (u2 - u1) / 2, 0, textureYScale * -(v2 - v1) / 2, u2, v1);
|
||||
tessellator.addVertexWithUV(textureXScale * -(u2 - u1) / 2, 0, textureYScale * -(v2 - v1) / 2, u1, v1);
|
||||
tessellator.addVertexWithUV(textureXScale * -(u2 - u1) / 2, 0, textureYScale * (v2 - v1) / 2, u1, v2);
|
||||
tessellator.draw();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getBrightnessForRender(float p_70070_1_)
|
||||
{
|
||||
public int getBrightnessForRender(float p_70070_1_) {
|
||||
int i = MathHelper.floor_double(renderPosX);
|
||||
int j = MathHelper.floor_double(renderPosZ);
|
||||
|
||||
if (this.worldObj.blockExists(i, 0, j))
|
||||
{
|
||||
if (this.worldObj.blockExists(i, 0, j)) {
|
||||
double d0 = (this.boundingBox.maxY - this.boundingBox.minY) * 0.66D;
|
||||
int k = MathHelper.floor_double(renderPosY - (double)this.yOffset + d0);
|
||||
int k = MathHelper.floor_double(renderPosY - (double) this.yOffset + d0);
|
||||
return this.worldObj.getLightBrightnessForSkyBlocks(i, k, j, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -366,11 +360,11 @@ public class CustomFX extends EntityFX {
|
||||
float rg = ag + ratio * (bg - ag);
|
||||
float rb = ab + ratio * (bb - ab);
|
||||
|
||||
return (int)(((int)rr << 16) + ((int)rg << 8) + (rb));
|
||||
return (int) (((int) rr << 16) + ((int) rg << 8) + (rb));
|
||||
}
|
||||
|
||||
public int getFXLayer(){
|
||||
return 0;
|
||||
public int getFXLayer() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean imageLoaded() {
|
||||
|
||||
@@ -15,14 +15,15 @@ import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.EntityEvent.EntityConstructing;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class EntityBigSmokeFX extends EntityFX
|
||||
{
|
||||
public class EntityBigSmokeFX extends EntityFX {
|
||||
|
||||
/** there are 12 smoke textures. */
|
||||
/**
|
||||
* there are 12 smoke textures.
|
||||
*/
|
||||
public static final int TEXTURE_COUNT = 12;
|
||||
public static final ResourceLocation[] TEXTURES = new ResourceLocation[TEXTURE_COUNT];
|
||||
static
|
||||
{
|
||||
|
||||
static {
|
||||
for (int i = 0; i < TEXTURE_COUNT; i++)
|
||||
TEXTURES[i] = new ResourceLocation("customnpcs" + ":" + "textures/particle/big_smoke_" + i + ".png");
|
||||
}
|
||||
@@ -71,8 +72,7 @@ public class EntityBigSmokeFX extends EntityFX
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderParticle(Tessellator tess, float partialTicks, float rotX, float rotXZ, float rotZ, float rotYZ, float rotXY)
|
||||
{
|
||||
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;
|
||||
@@ -120,8 +120,7 @@ public class EntityBigSmokeFX extends EntityFX
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFXLayer()
|
||||
{
|
||||
public int getFXLayer() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@@ -156,7 +155,6 @@ public class EntityBigSmokeFX extends EntityFX
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 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>
|
||||
@@ -176,8 +174,7 @@ public class EntityBigSmokeFX extends EntityFX
|
||||
* This event is {@link Cancelable}. If canceled, the entity will be removed.<br>
|
||||
*/
|
||||
@Cancelable
|
||||
public static class EntityBigSmokeFXConstructingEvent extends EntityConstructing
|
||||
{
|
||||
public static class EntityBigSmokeFXConstructingEvent extends EntityConstructing {
|
||||
public final int[] campfirePosition;
|
||||
|
||||
public float particleRed;
|
||||
@@ -192,11 +189,10 @@ public class EntityBigSmokeFX extends EntityFX
|
||||
public float alphaFadePerTick;
|
||||
public int particleMaxAge;
|
||||
|
||||
public EntityBigSmokeFXConstructingEvent(EntityBigSmokeFX entity, int x, int y, int z)
|
||||
{
|
||||
public EntityBigSmokeFXConstructingEvent(EntityBigSmokeFX entity, int x, int y, int z) {
|
||||
super(entity);
|
||||
|
||||
campfirePosition = new int[] { x, y, z };
|
||||
campfirePosition = new int[]{x, y, z};
|
||||
|
||||
particleRed = entity.particleRed;
|
||||
particleGreen = entity.particleGreen;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
|
||||
// Jad home page: http://www.kpdus.com/jad.html
|
||||
// Decompiler options: packimports(3) braces deadcode
|
||||
// Decompiler options: packimports(3) braces deadcode
|
||||
|
||||
package noppes.npcs.client.fx;
|
||||
|
||||
@@ -13,61 +13,59 @@ import net.minecraft.util.MathHelper;
|
||||
// Referenced classes of package net.minecraft.src:
|
||||
// EntityFX, World, Tessellator
|
||||
|
||||
public class EntityElementalStaffFX extends EntityPortalFX
|
||||
{
|
||||
double x,y,z;
|
||||
EntityLivingBase player;
|
||||
public EntityElementalStaffFX(EntityLivingBase player, double d, double d1, double d2,
|
||||
double f1, double f2, double f3, int color)
|
||||
{
|
||||
public class EntityElementalStaffFX extends EntityPortalFX {
|
||||
double x, y, z;
|
||||
EntityLivingBase player;
|
||||
|
||||
public EntityElementalStaffFX(EntityLivingBase player, double d, double d1, double d2,
|
||||
double f1, double f2, double f3, int color) {
|
||||
super(player.worldObj, player.posX + d, player.posY + d1, player.posZ + d2, f1, f2, f3);
|
||||
|
||||
|
||||
|
||||
|
||||
this.player = player;
|
||||
|
||||
|
||||
x = d;
|
||||
y = d1;
|
||||
z = d2;
|
||||
float[] colors;
|
||||
if(color <= 15)
|
||||
colors = EntitySheep.fleeceColorTable[color];
|
||||
if (color <= 15)
|
||||
colors = EntitySheep.fleeceColorTable[color];
|
||||
else
|
||||
colors = new float[]{((color>>16)&0xFF) / 255f, ((color>>8)&0xFF) / 255f,(color&0xFF) / 255f};
|
||||
colors = new float[]{((color >> 16) & 0xFF) / 255f, ((color >> 8) & 0xFF) / 255f, (color & 0xFF) / 255f};
|
||||
particleRed = colors[0];
|
||||
particleGreen = colors[1];
|
||||
particleBlue = colors[2];
|
||||
particleMaxAge = (int)(16D / (Math.random() * 0.80000000000000004D + 0.20000000000000001D));
|
||||
particleMaxAge = (int) (16D / (Math.random() * 0.80000000000000004D + 0.20000000000000001D));
|
||||
noClip = false;
|
||||
}
|
||||
|
||||
public void onUpdate()
|
||||
{
|
||||
if(player.isDead){
|
||||
this.setDead();
|
||||
return;
|
||||
}
|
||||
|
||||
public void onUpdate() {
|
||||
if (player.isDead) {
|
||||
this.setDead();
|
||||
return;
|
||||
}
|
||||
|
||||
this.prevPosX = this.posX;
|
||||
this.prevPosY = this.posY;
|
||||
this.prevPosZ = this.posZ;
|
||||
float var1 = (float)this.particleAge / (float)this.particleMaxAge;
|
||||
float var1 = (float) this.particleAge / (float) this.particleMaxAge;
|
||||
float var2 = var1;
|
||||
var1 = -var1 + var1 * var1 * 2.0F;
|
||||
var1 = 1.0F - var1;
|
||||
|
||||
double dx = -MathHelper.sin((float) ((player.rotationYaw / 180F) * Math.PI)) * MathHelper.cos((float) ((player.rotationPitch / 180F) * Math.PI));
|
||||
double dz = MathHelper.cos((float) ((player.rotationYaw / 180F) * Math.PI)) * MathHelper.cos((float) ((player.rotationPitch / 180F) * Math.PI));
|
||||
|
||||
this.posX = player.posX + x + dx + this.motionX * (double)var1;
|
||||
this.posY = player.posY + y + this.motionY * (double)var1 + (double)(1.0F - var2) - player.rotationPitch/40;
|
||||
this.posZ = player.posZ + z + dz + this.motionZ * (double)var1;
|
||||
double dx = -MathHelper.sin((float) ((player.rotationYaw / 180F) * Math.PI)) * MathHelper.cos((float) ((player.rotationPitch / 180F) * Math.PI));
|
||||
double dz = MathHelper.cos((float) ((player.rotationYaw / 180F) * Math.PI)) * MathHelper.cos((float) ((player.rotationPitch / 180F) * Math.PI));
|
||||
|
||||
if (this.particleAge++ >= this.particleMaxAge)
|
||||
{
|
||||
this.posX = player.posX + x + dx + this.motionX * (double) var1;
|
||||
this.posY = player.posY + y + this.motionY * (double) var1 + (double) (1.0F - var2) - player.rotationPitch / 40;
|
||||
this.posZ = player.posZ + z + dz + this.motionZ * (double) var1;
|
||||
|
||||
if (this.particleAge++ >= this.particleMaxAge) {
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
public void setDead(){
|
||||
super.setDead();
|
||||
|
||||
public void setDead() {
|
||||
super.setDead();
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.entity.data.ModelPartData;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class EntityEnderFX extends EntityPortalFX{
|
||||
public class EntityEnderFX extends EntityPortalFX {
|
||||
|
||||
private float portalParticleScale;
|
||||
private int particleNumber;
|
||||
@@ -18,57 +18,56 @@ public class EntityEnderFX extends EntityPortalFX{
|
||||
private boolean move = true;
|
||||
private float startX = 0, startY = 0, startZ = 0;
|
||||
|
||||
public EntityEnderFX(EntityCustomNpc npc, double par2, double par4,
|
||||
double par6, double par8, double par10, double par12, ModelPartData data) {
|
||||
super(npc.worldObj, par2, par4, par6, par8, par10, par12);
|
||||
public EntityEnderFX(EntityCustomNpc npc, double par2, double par4,
|
||||
double par6, double par8, double par10, double par12, ModelPartData data) {
|
||||
super(npc.worldObj, par2, par4, par6, par8, par10, par12);
|
||||
|
||||
this.npc = npc;
|
||||
particleNumber = npc.getRNG().nextInt(2);
|
||||
this.npc = npc;
|
||||
particleNumber = npc.getRNG().nextInt(2);
|
||||
portalParticleScale = particleScale = rand.nextFloat() * 0.2F + 0.5F;
|
||||
|
||||
particleRed = (data.color >> 16 & 255) / 255f;
|
||||
particleGreen = (data.color >> 8 & 255) / 255f;
|
||||
particleGreen = (data.color >> 8 & 255) / 255f;
|
||||
particleBlue = (data.color & 255) / 255f;
|
||||
|
||||
if(npc.getRNG().nextInt(3) == 1){
|
||||
move = false;
|
||||
if (npc.getRNG().nextInt(3) == 1) {
|
||||
move = false;
|
||||
this.startX = (float) npc.posX;
|
||||
this.startY = (float) npc.posY;
|
||||
this.startZ = (float) npc.posZ;
|
||||
}
|
||||
|
||||
if(data.playerTexture)
|
||||
location = npc.textureLocation;
|
||||
if (data.playerTexture)
|
||||
location = npc.textureLocation;
|
||||
else
|
||||
location = new ResourceLocation(data.texture);
|
||||
}
|
||||
location = new ResourceLocation(data.texture);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
|
||||
{
|
||||
if(move){
|
||||
startX = (float)(npc.prevPosX + (npc.posX - npc.prevPosX) * (double)par2);
|
||||
startY = (float)(npc.prevPosY + (npc.posY - npc.prevPosY) * (double)par2);
|
||||
startZ = (float)(npc.prevPosZ + (npc.posZ - npc.prevPosZ) * (double)par2);
|
||||
}
|
||||
@Override
|
||||
public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7) {
|
||||
if (move) {
|
||||
startX = (float) (npc.prevPosX + (npc.posX - npc.prevPosX) * (double) par2);
|
||||
startY = (float) (npc.prevPosY + (npc.posY - npc.prevPosY) * (double) par2);
|
||||
startZ = (float) (npc.prevPosZ + (npc.posZ - npc.prevPosZ) * (double) par2);
|
||||
}
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.draw();
|
||||
float scale = ((float)particleAge + par2) / (float)particleMaxAge;
|
||||
float scale = ((float) particleAge + par2) / (float) particleMaxAge;
|
||||
scale = 1.0F - scale;
|
||||
scale *= scale;
|
||||
scale = 1.0F - scale;
|
||||
particleScale = portalParticleScale * scale;
|
||||
|
||||
ClientProxy.bindTexture(location);
|
||||
ClientProxy.bindTexture(location);
|
||||
|
||||
float f = 0.875f;
|
||||
float f1 = f + 0.125f;
|
||||
float f2 = 0.75f - (particleNumber * 0.25f);
|
||||
float f3 = f2 + 0.25f;
|
||||
float f4 = 0.1F * particleScale;
|
||||
float f5 = (float)(((prevPosX + (posX - prevPosX) * (double)par2) - interpPosX) + startX);
|
||||
float f6 = (float)(((prevPosY + (posY - prevPosY) * (double)par2) - interpPosY) + startY);
|
||||
float f7 = (float)(((prevPosZ + (posZ - prevPosZ) * (double)par2) - interpPosZ) + startZ);
|
||||
float f5 = (float) (((prevPosX + (posX - prevPosX) * (double) par2) - interpPosX) + startX);
|
||||
float f6 = (float) (((prevPosY + (posY - prevPosY) * (double) par2) - interpPosY) + startY);
|
||||
float f7 = (float) (((prevPosZ + (posZ - prevPosZ) * (double) par2) - interpPosZ) + startZ);
|
||||
|
||||
GL11.glColor4f(1, 1, 1, 1.0F);
|
||||
tessellator.startDrawingQuads();
|
||||
@@ -85,7 +84,7 @@ public class EntityEnderFX extends EntityPortalFX{
|
||||
tessellator.startDrawingQuads();
|
||||
}
|
||||
|
||||
public int getFXLayer(){
|
||||
return 0;
|
||||
public int getFXLayer() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -5,9 +5,7 @@ import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
||||
|
||||
public class EntityRainbowFX extends EntityFX
|
||||
{
|
||||
public class EntityRainbowFX extends EntityFX {
|
||||
|
||||
public static float colorTable[][] = {
|
||||
{
|
||||
@@ -26,27 +24,25 @@ public class EntityRainbowFX extends EntityFX
|
||||
0F, 0, 1.0f
|
||||
},
|
||||
{
|
||||
0,4375F, 0, 1.0f
|
||||
0, 4375F, 0, 1.0f
|
||||
},
|
||||
{
|
||||
0.5625F, 0, 1.0f
|
||||
}
|
||||
};
|
||||
public EntityRainbowFX(World world, double d, double d1, double d2,
|
||||
double f, double f1, double f2)
|
||||
{
|
||||
|
||||
public EntityRainbowFX(World world, double d, double d1, double d2,
|
||||
double f, double f1, double f2) {
|
||||
this(world, d, d1, d2, 1.0F, f, f1, f2);
|
||||
}
|
||||
|
||||
public EntityRainbowFX(World world, double d, double d1, double d2,
|
||||
float f, double f1, double f2, double f3)
|
||||
{
|
||||
public EntityRainbowFX(World world, double d, double d1, double d2,
|
||||
float f, double f1, double f2, double f3) {
|
||||
super(world, d, d1, d2, 0.0D, 0.0D, 0.0D);
|
||||
motionX *= 0.10000000149011612D;
|
||||
motionY *= 0.10000000149011612D;
|
||||
motionZ *= 0.10000000149011612D;
|
||||
if(f1 == 0.0F)
|
||||
{
|
||||
if (f1 == 0.0F) {
|
||||
f1 = 1.0F;
|
||||
}
|
||||
int i = world.rand.nextInt(colorTable.length);
|
||||
@@ -56,47 +52,40 @@ public class EntityRainbowFX extends EntityFX
|
||||
particleScale *= 0.75F;
|
||||
particleScale *= f;
|
||||
reddustParticleScale = particleScale;
|
||||
particleMaxAge = (int)(16D / (Math.random() * 0.80000000000000004D + 0.20000000000000001D));
|
||||
particleMaxAge = (int) (16D / (Math.random() * 0.80000000000000004D + 0.20000000000000001D));
|
||||
particleMaxAge *= f;
|
||||
noClip = false;
|
||||
}
|
||||
|
||||
public void renderParticle(Tessellator tessellator, float f, float f1, float f2, float f3, float f4, float f5)
|
||||
{
|
||||
float f6 = (((float)particleAge + f) / (float)particleMaxAge) * 32F;
|
||||
if(f6 < 0.0F)
|
||||
{
|
||||
public void renderParticle(Tessellator tessellator, float f, float f1, float f2, float f3, float f4, float f5) {
|
||||
float f6 = (((float) particleAge + f) / (float) particleMaxAge) * 32F;
|
||||
if (f6 < 0.0F) {
|
||||
f6 = 0.0F;
|
||||
}
|
||||
if(f6 > 1.0F)
|
||||
{
|
||||
if (f6 > 1.0F) {
|
||||
f6 = 1.0F;
|
||||
}
|
||||
particleScale = reddustParticleScale * f6;
|
||||
super.renderParticle(tessellator, f, f1, f2, f3, f4, f5);
|
||||
}
|
||||
|
||||
public void onUpdate()
|
||||
{
|
||||
public void onUpdate() {
|
||||
prevPosX = posX;
|
||||
prevPosY = posY;
|
||||
prevPosZ = posZ;
|
||||
if(particleAge++ >= particleMaxAge)
|
||||
{
|
||||
if (particleAge++ >= particleMaxAge) {
|
||||
setDead();
|
||||
}
|
||||
setParticleTextureIndex(7 - (particleAge * 8) / particleMaxAge);
|
||||
moveEntity(motionX, motionY, motionZ);
|
||||
if(posY == prevPosY)
|
||||
{
|
||||
if (posY == prevPosY) {
|
||||
motionX *= 1.1000000000000001D;
|
||||
motionZ *= 1.1000000000000001D;
|
||||
}
|
||||
motionX *= 0.95999997854232788D;
|
||||
motionY *= 0.95999997854232788D;
|
||||
motionZ *= 0.95999997854232788D;
|
||||
if(onGround)
|
||||
{
|
||||
if (onGround) {
|
||||
motionX *= 0.69999998807907104D;
|
||||
motionZ *= 0.69999998807907104D;
|
||||
}
|
||||
|
||||
@@ -10,26 +10,27 @@ import noppes.npcs.controllers.ScriptContainer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class EventGuiScriptList extends SubGuiInterface{
|
||||
public class EventGuiScriptList extends SubGuiInterface {
|
||||
private GuiCustomScroll scroll1;
|
||||
private GuiCustomScroll scroll2;
|
||||
private ScriptContainer container;
|
||||
private List<String> scripts;
|
||||
|
||||
public EventGuiScriptList(List<String> scripts, ScriptContainer container){
|
||||
public EventGuiScriptList(List<String> scripts, ScriptContainer container) {
|
||||
this.container = container;
|
||||
setBackground("menubg.png");
|
||||
xSize = 346;
|
||||
ySize = 216;
|
||||
if(scripts == null)
|
||||
if (scripts == null)
|
||||
scripts = new ArrayList<String>();
|
||||
this.scripts = scripts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui(){
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
if(scroll1 == null){
|
||||
scroll1 = new GuiCustomScroll(this,0);
|
||||
if (scroll1 == null) {
|
||||
scroll1 = new GuiCustomScroll(this, 0);
|
||||
scroll1.setSize(140, 180);
|
||||
}
|
||||
scroll1.guiLeft = guiLeft + 4;
|
||||
@@ -37,8 +38,8 @@ public class EventGuiScriptList extends SubGuiInterface{
|
||||
this.addScroll(scroll1);
|
||||
addLabel(new GuiNpcLabel(1, "script.availableScripts", guiLeft + 4, guiTop + 4));
|
||||
|
||||
if(scroll2 == null){
|
||||
scroll2 = new GuiCustomScroll(this,1);
|
||||
if (scroll2 == null) {
|
||||
scroll2 = new GuiCustomScroll(this, 1);
|
||||
scroll2.setSize(140, 180);
|
||||
}
|
||||
scroll2.guiLeft = guiLeft + 200;
|
||||
@@ -59,42 +60,43 @@ public class EventGuiScriptList extends SubGuiInterface{
|
||||
addButton(new GuiNpcButton(66, guiLeft + 260, guiTop + 194, 60, 20, "gui.done"));
|
||||
}
|
||||
|
||||
protected void actionPerformed(GuiButton guibutton){
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
if(button.id == 1){
|
||||
if(scroll1.hasSelected()){
|
||||
if (button.id == 1) {
|
||||
if (scroll1.hasSelected()) {
|
||||
container.scripts.add(scroll1.getSelected());
|
||||
scroll1.selected = -1;
|
||||
scroll2.selected = -1;
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
if(button.id == 2){
|
||||
if(scroll2.hasSelected()){
|
||||
if (button.id == 2) {
|
||||
if (scroll2.hasSelected()) {
|
||||
container.scripts.remove(scroll2.getSelected());
|
||||
scroll2.selected = -1;
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
if(button.id == 3){
|
||||
if (button.id == 3) {
|
||||
container.scripts.clear();
|
||||
for(String script : scripts){
|
||||
for (String script : scripts) {
|
||||
container.scripts.add(script);
|
||||
}
|
||||
scroll1.selected = -1;
|
||||
scroll2.selected = -1;
|
||||
initGui();
|
||||
}
|
||||
if(button.id == 4){
|
||||
if (button.id == 4) {
|
||||
container.scripts.clear();
|
||||
scroll1.selected = -1;
|
||||
scroll2.selected = -1;
|
||||
initGui();
|
||||
}
|
||||
if(button.id == 66){
|
||||
if (button.id == 66) {
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
|
||||
|
||||
@@ -8,55 +8,58 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.blocks.tiles.TileBorder;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
|
||||
public class GuiBorderBlock extends GuiNPCInterface implements IGuiData{
|
||||
public class GuiBorderBlock extends GuiNPCInterface implements IGuiData {
|
||||
|
||||
private TileBorder tile;
|
||||
private TileBorder tile;
|
||||
|
||||
public GuiBorderBlock(int x, int y, int z) {
|
||||
super();
|
||||
tile = (TileBorder) player.worldObj.getTileEntity(x, y, z);
|
||||
super();
|
||||
tile = (TileBorder) player.worldObj.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));
|
||||
addTextField(new GuiNpcTextField(0, this, fontRendererObj, guiLeft+ 60, guiTop + 71,40,20, tile.height + ""));
|
||||
getTextField(0).integersOnly = true;
|
||||
getTextField(0).setMinMaxDefault(0, 500, 6);
|
||||
|
||||
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) {
|
||||
int id = guibutton.id;
|
||||
if(id == 0)
|
||||
close();
|
||||
if (id == 4) {
|
||||
save();
|
||||
setSubGui(new SubGuiNpcAvailability(tile.availability));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void save() {
|
||||
if(tile == null)
|
||||
return;
|
||||
tile.height = getTextField(0).getInteger();
|
||||
tile.message = getTextField(1).getText();
|
||||
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
tile.writeToNBT(compound);
|
||||
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));
|
||||
addTextField(new GuiNpcTextField(0, this, fontRendererObj, guiLeft + 60, guiTop + 71, 40, 20, tile.height + ""));
|
||||
getTextField(0).integersOnly = true;
|
||||
getTextField(0).setMinMaxDefault(0, 500, 6);
|
||||
|
||||
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) {
|
||||
int id = guibutton.id;
|
||||
if (id == 0)
|
||||
close();
|
||||
if (id == 4) {
|
||||
save();
|
||||
setSubGui(new SubGuiNpcAvailability(tile.availability));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
if (tile == null)
|
||||
return;
|
||||
tile.height = getTextField(0).getInteger();
|
||||
tile.message = getTextField(1).getText();
|
||||
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
tile.writeToNBT(compound);
|
||||
PacketClient.sendClient(new TileEntitySavePacket(compound));
|
||||
}
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
tile.readFromNBT(compound);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
tile.readFromNBT(compound);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,19 +1,19 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import noppes.npcs.client.ClientCacheHandler;
|
||||
import noppes.npcs.client.gui.util.GuiDiagram;
|
||||
import noppes.npcs.client.gui.util.GuiNPCInterface;
|
||||
import noppes.npcs.client.renderer.ImageData;
|
||||
import noppes.npcs.controllers.MagicController;
|
||||
import noppes.npcs.controllers.data.Magic;
|
||||
import noppes.npcs.controllers.data.MagicAssociation;
|
||||
import noppes.npcs.controllers.data.MagicCycle;
|
||||
import noppes.npcs.constants.EnumDiagramLayout;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import noppes.npcs.client.ClientCacheHandler;
|
||||
import noppes.npcs.client.gui.util.GuiDiagram;
|
||||
import noppes.npcs.client.gui.util.GuiNPCInterface;
|
||||
import noppes.npcs.client.renderer.ImageData;
|
||||
import noppes.npcs.constants.EnumDiagramLayout;
|
||||
import noppes.npcs.controllers.MagicController;
|
||||
import noppes.npcs.controllers.data.Magic;
|
||||
import noppes.npcs.controllers.data.MagicAssociation;
|
||||
import noppes.npcs.controllers.data.MagicCycle;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -183,6 +183,7 @@ public class GuiMagicCycleMap extends GuiDiagram {
|
||||
// Inner class wrapping a Magic as a DiagramIcon.
|
||||
private class MagicIcon extends DiagramIcon {
|
||||
public Magic magic;
|
||||
|
||||
public MagicIcon(Magic magic) {
|
||||
super(magic.id, 0, 0);
|
||||
this.magic = magic;
|
||||
|
||||
@@ -25,18 +25,19 @@ import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiMerchantAdd extends GuiContainer
|
||||
{
|
||||
public class GuiMerchantAdd extends GuiContainer {
|
||||
private static final ResourceLocation merchantGuiTextures = new ResourceLocation("textures/gui/container/villager.png");
|
||||
|
||||
/** Instance of IMerchant interface. */
|
||||
/**
|
||||
* Instance of IMerchant interface.
|
||||
*/
|
||||
private IMerchant theIMerchant;
|
||||
private MerchantButton nextRecipeButtonIndex;
|
||||
private MerchantButton previousRecipeButtonIndex;
|
||||
private int currentRecipeIndex;
|
||||
private String field_94082_v;
|
||||
public GuiMerchantAdd()
|
||||
{
|
||||
|
||||
public GuiMerchantAdd() {
|
||||
super(new ContainerMerchantAdd(Minecraft.getMinecraft().thePlayer, ServerEventsHandler.Merchant, Minecraft.getMinecraft().theWorld));
|
||||
this.theIMerchant = ServerEventsHandler.Merchant;
|
||||
this.field_94082_v = I18n.format("entity.Villager.name");
|
||||
@@ -45,16 +46,15 @@ public class GuiMerchantAdd extends GuiContainer
|
||||
/**
|
||||
* Adds the buttons (and other controls) to the screen in question.
|
||||
*/
|
||||
public void initGui()
|
||||
{
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
int i = (this.width - this.xSize) / 2;
|
||||
int j = (this.height - this.ySize) / 2;
|
||||
this.buttonList.add(this.nextRecipeButtonIndex = new MerchantButton(1, i + 120 + 27, j + 24 - 1, true));
|
||||
this.buttonList.add(this.previousRecipeButtonIndex = new MerchantButton(2, i + 36 - 19, j + 24 - 1, false));
|
||||
this.buttonList.add(new GuiNpcButton(4, i + xSize, j + 20, 60, 20, "gui.remove"));
|
||||
this.buttonList.add(new GuiNpcButton(5, i + xSize, j + 50, 60, 20, "gui.add"));
|
||||
this.buttonList.add(new GuiNpcButton(4, i + xSize, j + 20, 60, 20, "gui.remove"));
|
||||
this.buttonList.add(new GuiNpcButton(5, i + xSize, j + 50, 60, 20, "gui.add"));
|
||||
this.nextRecipeButtonIndex.enabled = false;
|
||||
this.previousRecipeButtonIndex.enabled = false;
|
||||
}
|
||||
@@ -62,8 +62,7 @@ public class GuiMerchantAdd extends GuiContainer
|
||||
/**
|
||||
* Draw the foreground layer for the GuiContainer (everything in front of the items)
|
||||
*/
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2)
|
||||
{
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
|
||||
this.fontRendererObj.drawString(this.field_94082_v, this.xSize / 2 - this.fontRendererObj.getStringWidth(this.field_94082_v) / 2, 6, CustomNpcResourceListener.DefaultTextColor);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, CustomNpcResourceListener.DefaultTextColor);
|
||||
}
|
||||
@@ -71,14 +70,12 @@ public class GuiMerchantAdd extends GuiContainer
|
||||
/**
|
||||
* Called from the main game loop to update the screen.
|
||||
*/
|
||||
public void updateScreen()
|
||||
{
|
||||
public void updateScreen() {
|
||||
super.updateScreen();
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
MerchantRecipeList merchantrecipelist = this.theIMerchant.getRecipes(mc.thePlayer);
|
||||
|
||||
if (merchantrecipelist != null)
|
||||
{
|
||||
if (merchantrecipelist != null) {
|
||||
this.nextRecipeButtonIndex.enabled = this.currentRecipeIndex < merchantrecipelist.size() - 1;
|
||||
this.previousRecipeButtonIndex.enabled = this.currentRecipeIndex > 0;
|
||||
}
|
||||
@@ -87,72 +84,62 @@ public class GuiMerchantAdd extends GuiContainer
|
||||
/**
|
||||
* Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e).
|
||||
*/
|
||||
protected void actionPerformed(GuiButton par1GuiButton)
|
||||
{
|
||||
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||
boolean flag = false;
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
if (par1GuiButton == this.nextRecipeButtonIndex)
|
||||
{
|
||||
if (par1GuiButton == this.nextRecipeButtonIndex) {
|
||||
++this.currentRecipeIndex;
|
||||
flag = true;
|
||||
}
|
||||
else if (par1GuiButton == this.previousRecipeButtonIndex)
|
||||
{
|
||||
} else if (par1GuiButton == this.previousRecipeButtonIndex) {
|
||||
--this.currentRecipeIndex;
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if(par1GuiButton.id == 4){
|
||||
if (par1GuiButton.id == 4) {
|
||||
MerchantRecipeList merchantrecipelist = this.theIMerchant.getRecipes(mc.thePlayer);
|
||||
if(currentRecipeIndex < merchantrecipelist.size()){
|
||||
merchantrecipelist.remove(currentRecipeIndex);
|
||||
if(currentRecipeIndex > 0)
|
||||
currentRecipeIndex--;
|
||||
if (currentRecipeIndex < merchantrecipelist.size()) {
|
||||
merchantrecipelist.remove(currentRecipeIndex);
|
||||
if (currentRecipeIndex > 0)
|
||||
currentRecipeIndex--;
|
||||
PacketClient.sendClient(new MerchantUpdatePacket(ServerEventsHandler.Merchant.getEntityId(), merchantrecipelist));
|
||||
}
|
||||
}
|
||||
|
||||
if(par1GuiButton.id == 5){
|
||||
ItemStack item1 = this.inventorySlots.getSlot(0).getStack();
|
||||
ItemStack item2 = this.inventorySlots.getSlot(1).getStack();
|
||||
ItemStack sold = this.inventorySlots.getSlot(2).getStack();
|
||||
if(item1 == null && item2 != null){
|
||||
item1 = item2;
|
||||
item2 = null;
|
||||
}
|
||||
if (par1GuiButton.id == 5) {
|
||||
ItemStack item1 = this.inventorySlots.getSlot(0).getStack();
|
||||
ItemStack item2 = this.inventorySlots.getSlot(1).getStack();
|
||||
ItemStack sold = this.inventorySlots.getSlot(2).getStack();
|
||||
if (item1 == null && item2 != null) {
|
||||
item1 = item2;
|
||||
item2 = null;
|
||||
}
|
||||
|
||||
if(item1 != null && sold != null){
|
||||
item1 = item1.copy();
|
||||
sold = sold.copy();
|
||||
if(item2 != null)
|
||||
item2 = item2.copy();
|
||||
MerchantRecipe recipe = new MerchantRecipe(item1, item2, sold);
|
||||
recipe.func_82783_a(Integer.MAX_VALUE - 8);
|
||||
if (item1 != null && sold != null) {
|
||||
item1 = item1.copy();
|
||||
sold = sold.copy();
|
||||
if (item2 != null)
|
||||
item2 = item2.copy();
|
||||
MerchantRecipe recipe = new MerchantRecipe(item1, item2, sold);
|
||||
recipe.func_82783_a(Integer.MAX_VALUE - 8);
|
||||
|
||||
MerchantRecipeList merchantrecipelist = this.theIMerchant.getRecipes(mc.thePlayer);
|
||||
merchantrecipelist.add(recipe);
|
||||
PacketClient.sendClient(new MerchantUpdatePacket(ServerEventsHandler.Merchant.getEntityId(), merchantrecipelist));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (flag)
|
||||
{
|
||||
((ContainerMerchantAdd)this.inventorySlots).setCurrentRecipeIndex(this.currentRecipeIndex);
|
||||
if (flag) {
|
||||
((ContainerMerchantAdd) this.inventorySlots).setCurrentRecipeIndex(this.currentRecipeIndex);
|
||||
ByteBuf bytebuf = Unpooled.buffer();
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
bytebuf.writeInt(this.currentRecipeIndex);
|
||||
this.mc.getNetHandler().addToSendQueue(new C17PacketCustomPayload("MC|TrSel", bytebuf));
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
} catch (Exception exception) {
|
||||
//field_147039_u.error("Couldn\'t send trade info", exception);
|
||||
}
|
||||
finally
|
||||
{
|
||||
} finally {
|
||||
bytebuf.release();
|
||||
}
|
||||
}
|
||||
@@ -161,9 +148,8 @@ public class GuiMerchantAdd extends GuiContainer
|
||||
/**
|
||||
* Draw the background layer for the GuiContainer (everything behind the items)
|
||||
*/
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
|
||||
{
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
mc.getTextureManager().bindTexture(merchantGuiTextures);
|
||||
@@ -172,13 +158,11 @@ public class GuiMerchantAdd extends GuiContainer
|
||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
MerchantRecipeList merchantrecipelist = this.theIMerchant.getRecipes(mc.thePlayer);
|
||||
|
||||
if (merchantrecipelist != null && !merchantrecipelist.isEmpty())
|
||||
{
|
||||
if (merchantrecipelist != null && !merchantrecipelist.isEmpty()) {
|
||||
int i1 = this.currentRecipeIndex;
|
||||
MerchantRecipe merchantrecipe = (MerchantRecipe)merchantrecipelist.get(i1);
|
||||
MerchantRecipe merchantrecipe = (MerchantRecipe) merchantrecipelist.get(i1);
|
||||
|
||||
if (merchantrecipe.isRecipeDisabled())
|
||||
{
|
||||
if (merchantrecipe.isRecipeDisabled()) {
|
||||
mc.getTextureManager().bindTexture(merchantGuiTextures);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
@@ -191,19 +175,17 @@ public class GuiMerchantAdd extends GuiContainer
|
||||
/**
|
||||
* Draws the screen and all the components in it.
|
||||
*/
|
||||
@Override
|
||||
public void drawScreen(int par1, int par2, float par3)
|
||||
{
|
||||
@Override
|
||||
public void drawScreen(int par1, int par2, float par3) {
|
||||
super.drawScreen(par1, par2, par3);
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
MerchantRecipeList merchantrecipelist = this.theIMerchant.getRecipes(mc.thePlayer);
|
||||
|
||||
if (merchantrecipelist != null && !merchantrecipelist.isEmpty())
|
||||
{
|
||||
if (merchantrecipelist != null && !merchantrecipelist.isEmpty()) {
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
int i1 = this.currentRecipeIndex;
|
||||
MerchantRecipe merchantrecipe = (MerchantRecipe)merchantrecipelist.get(i1);
|
||||
MerchantRecipe merchantrecipe = (MerchantRecipe) merchantrecipelist.get(i1);
|
||||
GL11.glPushMatrix();
|
||||
ItemStack itemstack = merchantrecipe.getItemToBuy();
|
||||
ItemStack itemstack1 = merchantrecipe.getSecondItemToBuy();
|
||||
@@ -217,10 +199,9 @@ public class GuiMerchantAdd extends GuiContainer
|
||||
itemRender.renderItemAndEffectIntoGUI(this.fontRendererObj, mc.getTextureManager(), itemstack, k + 36, l + 24);
|
||||
itemRender.renderItemOverlayIntoGUI(this.fontRendererObj, mc.getTextureManager(), itemstack, k + 36, l + 24);
|
||||
|
||||
if (itemstack1 != null)
|
||||
{
|
||||
itemRender.renderItemAndEffectIntoGUI(this.fontRendererObj, mc.getTextureManager(), itemstack1, k + 62, l + 24);
|
||||
itemRender.renderItemOverlayIntoGUI(this.fontRendererObj, mc.getTextureManager(), itemstack1, k + 62, l + 24);
|
||||
if (itemstack1 != null) {
|
||||
itemRender.renderItemAndEffectIntoGUI(this.fontRendererObj, mc.getTextureManager(), itemstack1, k + 62, l + 24);
|
||||
itemRender.renderItemOverlayIntoGUI(this.fontRendererObj, mc.getTextureManager(), itemstack1, k + 62, l + 24);
|
||||
}
|
||||
|
||||
itemRender.renderItemAndEffectIntoGUI(this.fontRendererObj, mc.getTextureManager(), itemstack2, k + 120, l + 24);
|
||||
@@ -228,16 +209,11 @@ public class GuiMerchantAdd extends GuiContainer
|
||||
itemRender.zLevel = 0.0F;
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
|
||||
if (this.func_146978_c(36, 24, 16, 16, par1, par2))
|
||||
{
|
||||
if (this.func_146978_c(36, 24, 16, 16, par1, par2)) {
|
||||
this.renderToolTip(itemstack, par1, par2);
|
||||
}
|
||||
else if (itemstack1 != null && this.func_146978_c(62, 24, 16, 16, par1, par2))
|
||||
{
|
||||
} else if (itemstack1 != null && this.func_146978_c(62, 24, 16, 16, par1, par2)) {
|
||||
this.renderToolTip(itemstack1, par1, par2);
|
||||
}
|
||||
else if (this.func_146978_c(120, 24, 16, 16, par1, par2))
|
||||
{
|
||||
} else if (this.func_146978_c(120, 24, 16, 16, par1, par2)) {
|
||||
this.renderToolTip(itemstack2, par1, par2);
|
||||
}
|
||||
|
||||
@@ -251,53 +227,44 @@ public class GuiMerchantAdd extends GuiContainer
|
||||
/**
|
||||
* Gets the Instance of IMerchant interface.
|
||||
*/
|
||||
public IMerchant getIMerchant()
|
||||
{
|
||||
public IMerchant getIMerchant() {
|
||||
return this.theIMerchant;
|
||||
}
|
||||
|
||||
static ResourceLocation func_110417_h()
|
||||
{
|
||||
static ResourceLocation func_110417_h() {
|
||||
return merchantGuiTextures;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
static class MerchantButton extends GuiButton
|
||||
{
|
||||
private final boolean field_146157_o;
|
||||
static class MerchantButton extends GuiButton {
|
||||
private final boolean field_146157_o;
|
||||
|
||||
public MerchantButton(int par1, int par2, int par3, boolean par4)
|
||||
{
|
||||
super(par1, par2, par3, 12, 19, "");
|
||||
this.field_146157_o = par4;
|
||||
}
|
||||
public MerchantButton(int par1, int par2, int par3, boolean par4) {
|
||||
super(par1, par2, par3, 12, 19, "");
|
||||
this.field_146157_o = par4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft p_146112_1_, int p_146112_2_, int p_146112_3_)
|
||||
{
|
||||
if (this.visible)
|
||||
{
|
||||
p_146112_1_.getTextureManager().bindTexture(GuiMerchantAdd.merchantGuiTextures);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
boolean flag = p_146112_2_ >= this.xPosition && p_146112_3_ >= this.yPosition && p_146112_2_ < this.xPosition + this.width && p_146112_3_ < this.yPosition + this.height;
|
||||
int k = 0;
|
||||
int l = 176;
|
||||
@Override
|
||||
public void drawButton(Minecraft p_146112_1_, int p_146112_2_, int p_146112_3_) {
|
||||
if (this.visible) {
|
||||
p_146112_1_.getTextureManager().bindTexture(GuiMerchantAdd.merchantGuiTextures);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
boolean flag = p_146112_2_ >= this.xPosition && p_146112_3_ >= this.yPosition && p_146112_2_ < this.xPosition + this.width && p_146112_3_ < this.yPosition + this.height;
|
||||
int k = 0;
|
||||
int l = 176;
|
||||
|
||||
if (!this.enabled)
|
||||
{
|
||||
l += this.width * 2;
|
||||
}
|
||||
else if (flag)
|
||||
{
|
||||
l += this.width;
|
||||
}
|
||||
|
||||
if (!this.field_146157_o)
|
||||
{
|
||||
k += this.height;
|
||||
}
|
||||
|
||||
this.drawTexturedModalRect(this.xPosition, this.yPosition, l, k, this.width, this.height);
|
||||
if (!this.enabled) {
|
||||
l += this.width * 2;
|
||||
} else if (flag) {
|
||||
l += this.width;
|
||||
}
|
||||
|
||||
if (!this.field_146157_o) {
|
||||
k += this.height;
|
||||
}
|
||||
|
||||
this.drawTexturedModalRect(this.xPosition, this.yPosition, l, k, this.width, this.height);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,87 +13,83 @@ import java.util.HashMap;
|
||||
import java.util.Vector;
|
||||
|
||||
|
||||
public class GuiNPCFactionSelection extends GuiNPCInterface implements IScrollData
|
||||
{
|
||||
private GuiNPCStringSlot slot;
|
||||
private GuiScreen parent;
|
||||
private HashMap<String,Integer> data = new HashMap<String,Integer>();
|
||||
private int factionId;
|
||||
public GuiSelectionListener listener;
|
||||
public GuiNPCFactionSelection(EntityNPCInterface npc,GuiScreen parent,int dialog)
|
||||
{
|
||||
super(npc);
|
||||
drawDefaultBackground = false;
|
||||
title = "Select Faction Category";
|
||||
this.parent = parent;
|
||||
this.factionId = dialog;
|
||||
public class GuiNPCFactionSelection extends GuiNPCInterface implements IScrollData {
|
||||
private GuiNPCStringSlot slot;
|
||||
private GuiScreen parent;
|
||||
private HashMap<String, Integer> data = new HashMap<String, Integer>();
|
||||
private int factionId;
|
||||
public GuiSelectionListener listener;
|
||||
|
||||
public GuiNPCFactionSelection(EntityNPCInterface npc, GuiScreen parent, int dialog) {
|
||||
super(npc);
|
||||
drawDefaultBackground = false;
|
||||
title = "Select Faction Category";
|
||||
this.parent = parent;
|
||||
this.factionId = dialog;
|
||||
|
||||
PacketClient.sendClient(new FactionsGetPacket());
|
||||
|
||||
if(parent instanceof GuiSelectionListener){
|
||||
listener = (GuiSelectionListener) parent;
|
||||
}
|
||||
if (parent instanceof GuiSelectionListener) {
|
||||
listener = (GuiSelectionListener) parent;
|
||||
}
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
{
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
Vector<String> list = new Vector<String>();
|
||||
slot = new GuiNPCStringSlot(list,this,false,18);
|
||||
slot = new GuiNPCStringSlot(list, this, false, 18);
|
||||
slot.registerScrollButtons(4, 5);
|
||||
|
||||
this.addButton(new GuiNpcButton(2, width / 2 -100, height - 41,98, 20, "gui.back"));
|
||||
this.addButton(new GuiNpcButton(4, width / 2 + 2, height - 41,98, 20, "gui.select"));
|
||||
this.addButton(new GuiNpcButton(2, width / 2 - 100, height - 41, 98, 20, "gui.back"));
|
||||
this.addButton(new GuiNpcButton(4, width / 2 + 2, height - 41, 98, 20, "gui.select"));
|
||||
}
|
||||
|
||||
|
||||
public void drawScreen(int i, int j, float f)
|
||||
{
|
||||
slot.drawScreen(i, j, f);
|
||||
public void drawScreen(int i, int j, float f) {
|
||||
slot.drawScreen(i, j, f);
|
||||
super.drawScreen(i, j, f);
|
||||
}
|
||||
|
||||
protected void actionPerformed(GuiButton guibutton)
|
||||
{
|
||||
int id = guibutton.id;
|
||||
if(id == 2)
|
||||
{
|
||||
close();
|
||||
NoppesUtil.openGUI(player, parent);
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
int id = guibutton.id;
|
||||
if (id == 2) {
|
||||
close();
|
||||
NoppesUtil.openGUI(player, parent);
|
||||
}
|
||||
if(id == 4)
|
||||
{
|
||||
doubleClicked();
|
||||
if (id == 4) {
|
||||
doubleClicked();
|
||||
}
|
||||
}
|
||||
public void doubleClicked() {
|
||||
if(slot.selected == null || slot.selected.isEmpty())
|
||||
return;
|
||||
factionId = data.get(slot.selected);
|
||||
close();
|
||||
NoppesUtil.openGUI(player, parent);
|
||||
|
||||
}
|
||||
public void save() {
|
||||
if(factionId >= 0){
|
||||
if(listener != null)
|
||||
listener.selected(factionId, slot.selected);
|
||||
}
|
||||
}
|
||||
public void doubleClicked() {
|
||||
if (slot.selected == null || slot.selected.isEmpty())
|
||||
return;
|
||||
factionId = data.get(slot.selected);
|
||||
close();
|
||||
NoppesUtil.openGUI(player, parent);
|
||||
|
||||
@Override
|
||||
public void setData(Vector<String> list, HashMap<String, Integer> data, EnumScrollData type) {
|
||||
this.data = data;
|
||||
this.slot.setList(list);
|
||||
if(factionId >= 0)
|
||||
for(String name : data.keySet())
|
||||
if(data.get(name) == factionId)
|
||||
slot.selected = name;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(String selected) {
|
||||
public void save() {
|
||||
if (factionId >= 0) {
|
||||
if (listener != null)
|
||||
listener.selected(factionId, slot.selected);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public void setData(Vector<String> list, HashMap<String, Integer> data, EnumScrollData type) {
|
||||
this.data = data;
|
||||
this.slot.setList(list);
|
||||
if (factionId >= 0)
|
||||
for (String name : data.keySet())
|
||||
if (data.get(name) == factionId)
|
||||
slot.selected = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(String selected) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,56 +13,52 @@ import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class GuiNPCLinesEdit extends GuiNPCInterface2 implements IGuiData, ISubGuiListener, ITextfieldListener
|
||||
{
|
||||
private Lines lines;
|
||||
public class GuiNPCLinesEdit extends GuiNPCInterface2 implements IGuiData, ISubGuiListener, ITextfieldListener {
|
||||
private Lines lines;
|
||||
private int selectedId = -1;
|
||||
private GuiSoundSelection gui;
|
||||
|
||||
public GuiNPCLinesEdit(EntityNPCInterface npc, Lines lines)
|
||||
{
|
||||
super(npc);
|
||||
this.lines = lines;
|
||||
public GuiNPCLinesEdit(EntityNPCInterface npc, Lines lines) {
|
||||
super(npc);
|
||||
this.lines = lines;
|
||||
|
||||
PacketClient.sendClient(new MainmenuAdvancedGetPacket());
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
{
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
for(int i = 0; i < 8; i++){
|
||||
String text = "";
|
||||
String sound = "";
|
||||
if(lines.lines.containsKey(i)){
|
||||
for (int i = 0; i < 8; i++) {
|
||||
String text = "";
|
||||
String sound = "";
|
||||
if (lines.lines.containsKey(i)) {
|
||||
Line line = lines.lines.get(i);
|
||||
text = line.getText();
|
||||
sound = line.getSound();
|
||||
}
|
||||
addTextField(new GuiNpcTextField(i,this, fontRendererObj, guiLeft + 4, guiTop + 4 + i * 24, 200, 20,text));
|
||||
addTextField(new GuiNpcTextField(i + 8,this, fontRendererObj, guiLeft + 208, guiTop + 4 + i * 24, 146, 20,sound));
|
||||
addButton(new GuiNpcButton(i, guiLeft + 358, guiTop + 4 + i * 24, 60, 20, "gui.select"));
|
||||
}
|
||||
addTextField(new GuiNpcTextField(i, this, fontRendererObj, guiLeft + 4, guiTop + 4 + i * 24, 200, 20, text));
|
||||
addTextField(new GuiNpcTextField(i + 8, this, fontRendererObj, guiLeft + 208, guiTop + 4 + i * 24, 146, 20, sound));
|
||||
addButton(new GuiNpcButton(i, guiLeft + 358, guiTop + 4 + i * 24, 60, 20, "gui.select"));
|
||||
}
|
||||
}
|
||||
|
||||
protected void actionPerformed(GuiButton guibutton)
|
||||
{
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
selectedId = button.id + 8;
|
||||
setSubGui(new GuiSoundSelection(getTextField(selectedId).getText()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
npc.advanced.readToNBT(compound);
|
||||
initGui();
|
||||
}
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
npc.advanced.readToNBT(compound);
|
||||
initGui();
|
||||
}
|
||||
|
||||
private void saveLines(){
|
||||
HashMap<Integer,Line> lines = new HashMap<Integer,Line>();
|
||||
for(int i = 0; i < 8; i++){
|
||||
private void saveLines() {
|
||||
HashMap<Integer, Line> lines = new HashMap<Integer, Line>();
|
||||
for (int i = 0; i < 8; i++) {
|
||||
GuiNpcTextField tf = getTextField(i);
|
||||
GuiNpcTextField tf2 = getTextField(i + 8);
|
||||
if(!tf.isEmpty() || !tf2.isEmpty()){
|
||||
if (!tf.isEmpty() || !tf2.isEmpty()) {
|
||||
Line line = new Line();
|
||||
line.setText(tf.getText());
|
||||
line.setSound(tf2.getText());
|
||||
@@ -73,16 +69,16 @@ public class GuiNPCLinesEdit extends GuiNPCInterface2 implements IGuiData, ISubG
|
||||
this.lines.lines = lines;
|
||||
}
|
||||
|
||||
public void save() {
|
||||
saveLines();
|
||||
public void save() {
|
||||
saveLines();
|
||||
|
||||
PacketClient.sendClient(new MainmenuAdvancedSavePacket(npc.advanced.writeToNBT(new NBTTagCompound())));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void subGuiClosed(SubGuiInterface subgui) {
|
||||
GuiSoundSelection gss = (GuiSoundSelection) subgui;
|
||||
if(gss.selectedResource != null) {
|
||||
if (gss.selectedResource != null) {
|
||||
getTextField(selectedId).setText(gss.selectedResource.toString());
|
||||
saveLines();
|
||||
initGui();
|
||||
|
||||
@@ -12,56 +12,51 @@ import noppes.npcs.client.gui.util.GuiNpcLabel;
|
||||
import noppes.npcs.client.gui.util.GuiNpcTextField;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
public class GuiNPCTransportCategoryEdit extends GuiNPCInterface
|
||||
{
|
||||
private GuiScreen parent;
|
||||
private String name;
|
||||
private int id;
|
||||
public GuiNPCTransportCategoryEdit(EntityNPCInterface npc,GuiScreen parent, String name, int id)
|
||||
{
|
||||
super(npc);
|
||||
this.parent = parent;
|
||||
this.name = name;
|
||||
this.id = id;
|
||||
title = "Npc Transport Category";
|
||||
public class GuiNPCTransportCategoryEdit extends GuiNPCInterface {
|
||||
private GuiScreen parent;
|
||||
private String name;
|
||||
private int id;
|
||||
|
||||
public GuiNPCTransportCategoryEdit(EntityNPCInterface npc, GuiScreen parent, String name, int id) {
|
||||
super(npc);
|
||||
this.parent = parent;
|
||||
this.name = name;
|
||||
this.id = id;
|
||||
title = "Npc Transport Category";
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
{
|
||||
public void initGui() {
|
||||
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.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"));
|
||||
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"));
|
||||
}
|
||||
|
||||
|
||||
public void drawScreen(int i, int j, float f)
|
||||
{
|
||||
public void drawScreen(int i, int j, float f) {
|
||||
super.drawScreen(i, j, f);
|
||||
}
|
||||
|
||||
protected void actionPerformed(GuiButton guibutton)
|
||||
{
|
||||
int id = guibutton.id;
|
||||
if(id == 2)
|
||||
{
|
||||
NoppesUtil.openGUI(player, parent);
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
int id = guibutton.id;
|
||||
if (id == 2) {
|
||||
NoppesUtil.openGUI(player, parent);
|
||||
PacketClient.sendClient(new TransportCategoriesGetPacket());
|
||||
}
|
||||
if(id == 3)
|
||||
{
|
||||
save();
|
||||
NoppesUtil.openGUI(player, parent);
|
||||
if (id == 3) {
|
||||
save();
|
||||
NoppesUtil.openGUI(player, parent);
|
||||
PacketClient.sendClient(new TransportCategoriesGetPacket());
|
||||
}
|
||||
}
|
||||
public void save() {
|
||||
String name = getTextField(1).getText();
|
||||
if(name.trim().isEmpty())
|
||||
return;
|
||||
|
||||
public void save() {
|
||||
String name = getTextField(1).getText();
|
||||
if (name.trim().isEmpty())
|
||||
return;
|
||||
|
||||
PacketClient.sendClient(new TransportCategorySavePacket(name, id));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,22 +13,23 @@ import noppes.npcs.constants.EnumScrollData;
|
||||
import java.util.HashMap;
|
||||
import java.util.Vector;
|
||||
|
||||
public class GuiNpcDimension extends GuiNPCInterface implements IScrollData{
|
||||
public class GuiNpcDimension extends GuiNPCInterface implements IScrollData {
|
||||
|
||||
private GuiCustomScroll scroll;
|
||||
private HashMap<String, Integer> data = new HashMap<String, Integer>();
|
||||
public GuiNpcDimension() {
|
||||
super();
|
||||
|
||||
public GuiNpcDimension() {
|
||||
super();
|
||||
xSize = 256;
|
||||
setBackground("menubg.png");
|
||||
PacketClient.sendClient(new DimensionsGetPacket());
|
||||
}
|
||||
public void initGui()
|
||||
{
|
||||
}
|
||||
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
if(scroll == null){
|
||||
scroll = new GuiCustomScroll(this,0);
|
||||
scroll.setSize(165, 208);
|
||||
if (scroll == null) {
|
||||
scroll = new GuiCustomScroll(this, 0);
|
||||
scroll.setSize(165, 208);
|
||||
}
|
||||
scroll.guiLeft = guiLeft + 4;
|
||||
scroll.guiTop = guiTop + 4;
|
||||
@@ -39,57 +40,57 @@ public class GuiNpcDimension extends GuiNPCInterface implements IScrollData{
|
||||
|
||||
this.addLabel(new GuiNpcLabel(0, title, guiLeft + x, guiTop - 8));
|
||||
|
||||
this.addButton(new GuiNpcButton(4, guiLeft + 170, guiTop + 72,82,20, "remote.tp"));
|
||||
this.addButton(new GuiNpcButton(4, guiLeft + 170, guiTop + 72, 82, 20, "remote.tp"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void confirmClicked(boolean flag, int i)
|
||||
{
|
||||
if(flag){
|
||||
public void confirmClicked(boolean flag, int i) {
|
||||
if (flag) {
|
||||
PacketClient.sendClient(new RemoteDeletePacket(data.get(scroll.getSelected())));
|
||||
}
|
||||
NoppesUtil.openGUI(player, this);
|
||||
}
|
||||
NoppesUtil.openGUI(player, this);
|
||||
}
|
||||
protected void actionPerformed(GuiButton guibutton)
|
||||
{
|
||||
int id = guibutton.id;
|
||||
|
||||
if(!data.containsKey(scroll.getSelected()))
|
||||
return;
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
int id = guibutton.id;
|
||||
|
||||
if(id == 4){
|
||||
if (!data.containsKey(scroll.getSelected()))
|
||||
return;
|
||||
|
||||
if (id == 4) {
|
||||
PacketClient.sendClient(new DimensionTeleportPacket(data.get(scroll.getSelected())));
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int i, int j, int k)
|
||||
{
|
||||
super.mouseClicked(i, j, k);
|
||||
scroll.mouseClicked(i, j, k);
|
||||
}
|
||||
@Override
|
||||
public void keyTyped(char c, int i)
|
||||
{
|
||||
if (i == 1 || isInventoryKey(i))
|
||||
{
|
||||
close();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void save() {
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int i, int j, int k) {
|
||||
super.mouseClicked(i, j, k);
|
||||
scroll.mouseClicked(i, j, k);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyTyped(char c, int i) {
|
||||
if (i == 1 || isInventoryKey(i)) {
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
|
||||
|
||||
}
|
||||
@Override
|
||||
public void setData(Vector<String> list, HashMap<String, Integer> data, EnumScrollData type) {
|
||||
scroll.setList(list);
|
||||
this.data = data;
|
||||
}
|
||||
@Override
|
||||
public void setSelected(String selected) {
|
||||
getButton(3).setDisplayText(selected);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(Vector<String> list, HashMap<String, Integer> data, EnumScrollData type) {
|
||||
scroll.setList(list);
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(String selected) {
|
||||
getButton(3).setDisplayText(selected);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -21,517 +21,511 @@ import java.lang.reflect.Modifier;
|
||||
import java.util.*;
|
||||
|
||||
public class GuiNpcMobSpawner extends GuiNPCInterface implements IGuiData {
|
||||
public static HashMap<UUID, Tag> tags = new HashMap<>();
|
||||
public static HashMap<String, UUID> tagNames = new HashMap<>();
|
||||
public static HashSet<String> tagFilters = new HashSet<>();
|
||||
public static byte displayTags = 0;
|
||||
public static HashMap<UUID, Tag> tags = new HashMap<>();
|
||||
public static HashMap<String, UUID> tagNames = new HashMap<>();
|
||||
public static HashSet<String> tagFilters = new HashSet<>();
|
||||
public static byte displayTags = 0;
|
||||
|
||||
// 0 - Any, 1 - All, 2 - Not Any, 3 - Not All
|
||||
public static byte filterCondition = 0;
|
||||
// 0 - Any, 1 - All, 2 - Not Any, 3 - Not All
|
||||
public static byte filterCondition = 0;
|
||||
|
||||
public static byte ascending = 0;
|
||||
public static byte ascending = 0;
|
||||
|
||||
// 0 - By Name, 1 - By Date
|
||||
public static byte sortType = 0;
|
||||
// 0 - By Name, 1 - By Date
|
||||
public static byte sortType = 0;
|
||||
|
||||
public TagMap tagMap;
|
||||
public TagMap tagMap;
|
||||
|
||||
private final GuiCustomScrollCloner scroll = new GuiCustomScrollCloner(this,0);
|
||||
private final GuiCustomScroll filterScroll = new GuiCustomScroll(this,1);
|
||||
private final GuiCustomScrollCloner scroll = new GuiCustomScrollCloner(this, 0);
|
||||
private final GuiCustomScroll filterScroll = new GuiCustomScroll(this, 1);
|
||||
|
||||
private int posX,posY,posZ;
|
||||
private int posX, posY, posZ;
|
||||
|
||||
private List<String> list;
|
||||
private List<String> rawList;
|
||||
private List<String> tagList;
|
||||
private List<String> list;
|
||||
private List<String> rawList;
|
||||
private List<String> tagList;
|
||||
|
||||
private static int showingClones = 0;
|
||||
private static int showingClones = 0;
|
||||
|
||||
private static String search = "";
|
||||
private static String tagSearch = "";
|
||||
private static String search = "";
|
||||
private static String tagSearch = "";
|
||||
|
||||
private int activeTab = 1;
|
||||
private int activeTab = 1;
|
||||
|
||||
public GuiNpcMobSpawner(int i, int j, int k) {
|
||||
super();
|
||||
xSize = 354;
|
||||
posX = i;
|
||||
posY = j;
|
||||
posZ = k;
|
||||
public GuiNpcMobSpawner(int i, int j, int k) {
|
||||
super();
|
||||
xSize = 354;
|
||||
posX = i;
|
||||
posY = j;
|
||||
posZ = k;
|
||||
|
||||
this.closeOnEsc = true;
|
||||
this.closeOnEsc = true;
|
||||
|
||||
setBackground("menubg.png");
|
||||
setBackground("menubg.png");
|
||||
PacketClient.sendClient(new CloneAllTagsPacket());
|
||||
}
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
guiTop += 10;
|
||||
guiLeft += 30;
|
||||
}
|
||||
|
||||
scroll.clear();
|
||||
scroll.setSize(293, 188);
|
||||
scroll.guiLeft = guiLeft + 4;
|
||||
scroll.guiTop = guiTop + 26;
|
||||
filterScroll.clear();
|
||||
filterScroll.setSize(140, 166);
|
||||
filterScroll.guiLeft = guiLeft + 4;
|
||||
filterScroll.guiTop = guiTop + 19;
|
||||
filterScroll.multipleSelection = true;
|
||||
filterScroll.setSelectedList(tagFilters);
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
guiTop += 10;
|
||||
guiLeft += 30;
|
||||
|
||||
GuiMenuTopButton button;
|
||||
addTopButton(button = new GuiMenuTopButton(3,guiLeft + 4, guiTop - 17, "spawner.clones"));
|
||||
button.active = showingClones == 0;
|
||||
addTopButton(button = new GuiMenuTopButton(5, button, "gui.server"));
|
||||
button.active = showingClones == 2;
|
||||
addTopButton(button = new GuiMenuTopButton(4, button, "spawner.entities"));
|
||||
button.active = showingClones == 1;
|
||||
addTopButton(button = new GuiMenuTopButton(16, guiLeft + (xSize - 67), guiTop - 17, "gui.filters"));
|
||||
button.active = showingClones == 3;
|
||||
addTopButton(button = new GuiMenuTopButton(17, guiLeft + (xSize - 22), guiTop - 17, "X"));
|
||||
scroll.clear();
|
||||
scroll.setSize(293, 188);
|
||||
scroll.guiLeft = guiLeft + 4;
|
||||
scroll.guiTop = guiTop + 26;
|
||||
filterScroll.clear();
|
||||
filterScroll.setSize(140, 166);
|
||||
filterScroll.guiLeft = guiLeft + 4;
|
||||
filterScroll.guiTop = guiTop + 19;
|
||||
filterScroll.multipleSelection = true;
|
||||
filterScroll.setSelectedList(tagFilters);
|
||||
|
||||
if (showingClones < 3){
|
||||
addScroll(scroll);
|
||||
addTextField(new GuiNpcTextField(1, this, fontRendererObj, guiLeft + 4, guiTop + 4, 293, 20, search));
|
||||
addButton(new GuiNpcButton(1, guiLeft + 298, guiTop + 6, 52, 20, "item.monsterPlacer.name"));
|
||||
addButton(new GuiNpcButton(2, guiLeft + 298, guiTop + 140, 52, 20, "spawner.mobspawner"));
|
||||
GuiMenuTopButton button;
|
||||
addTopButton(button = new GuiMenuTopButton(3, guiLeft + 4, guiTop - 17, "spawner.clones"));
|
||||
button.active = showingClones == 0;
|
||||
addTopButton(button = new GuiMenuTopButton(5, button, "gui.server"));
|
||||
button.active = showingClones == 2;
|
||||
addTopButton(button = new GuiMenuTopButton(4, button, "spawner.entities"));
|
||||
button.active = showingClones == 1;
|
||||
addTopButton(button = new GuiMenuTopButton(16, guiLeft + (xSize - 67), guiTop - 17, "gui.filters"));
|
||||
button.active = showingClones == 3;
|
||||
addTopButton(button = new GuiMenuTopButton(17, guiLeft + (xSize - 22), guiTop - 17, "X"));
|
||||
|
||||
if(showingClones == 0 || showingClones == 2){
|
||||
if (showingClones < 3) {
|
||||
addScroll(scroll);
|
||||
addTextField(new GuiNpcTextField(1, this, fontRendererObj, guiLeft + 4, guiTop + 4, 293, 20, search));
|
||||
addButton(new GuiNpcButton(1, guiLeft + 298, guiTop + 6, 52, 20, "item.monsterPlacer.name"));
|
||||
addButton(new GuiNpcButton(2, guiLeft + 298, guiTop + 140, 52, 20, "spawner.mobspawner"));
|
||||
|
||||
addSideButton(new GuiMenuSideButton(21,guiLeft - 70, this.guiTop + 2, 70,22, "1"));
|
||||
addSideButton(new GuiMenuSideButton(22,guiLeft - 70, this.guiTop + 23, 70,22, "2"));
|
||||
addSideButton(new GuiMenuSideButton(23,guiLeft - 70, this.guiTop + 44, 70,22, "3"));
|
||||
addSideButton(new GuiMenuSideButton(24,guiLeft - 70, this.guiTop + 65, 70,22, "4"));
|
||||
addSideButton(new GuiMenuSideButton(25,guiLeft - 70, this.guiTop + 86, 70,22, "5"));
|
||||
addSideButton(new GuiMenuSideButton(26,guiLeft - 70, this.guiTop + 107, 35,22, "6"));
|
||||
addSideButton(new GuiMenuSideButton(27,guiLeft - 35, this.guiTop + 107, 35,22, "7"));
|
||||
addSideButton(new GuiMenuSideButton(28,guiLeft - 70, this.guiTop + 128, 35,22, "8"));
|
||||
addSideButton(new GuiMenuSideButton(29,guiLeft - 35, this.guiTop + 128, 35,22, "9"));
|
||||
addSideButton(new GuiMenuSideButton(30,guiLeft - 70, this.guiTop + 149, 35,22, "10"));
|
||||
addSideButton(new GuiMenuSideButton(31,guiLeft - 35, this.guiTop + 149, 35,22, "11"));
|
||||
addSideButton(new GuiMenuSideButton(32,guiLeft - 70, this.guiTop + 170, 35,22, "12"));
|
||||
addSideButton(new GuiMenuSideButton(33,guiLeft - 35, this.guiTop + 170, 35,22, "13"));
|
||||
addSideButton(new GuiMenuSideButton(34,guiLeft - 70, this.guiTop + 191, 35,22, "14"));
|
||||
addSideButton(new GuiMenuSideButton(35,guiLeft - 35, this.guiTop + 191, 35,22, "15"));
|
||||
if (showingClones == 0 || showingClones == 2) {
|
||||
|
||||
addButton(new GuiNpcButton(6, guiLeft + 298, guiTop + 190, 52, 20, "gui.remove"));
|
||||
addSideButton(new GuiMenuSideButton(21, guiLeft - 70, this.guiTop + 2, 70, 22, "1"));
|
||||
addSideButton(new GuiMenuSideButton(22, guiLeft - 70, this.guiTop + 23, 70, 22, "2"));
|
||||
addSideButton(new GuiMenuSideButton(23, guiLeft - 70, this.guiTop + 44, 70, 22, "3"));
|
||||
addSideButton(new GuiMenuSideButton(24, guiLeft - 70, this.guiTop + 65, 70, 22, "4"));
|
||||
addSideButton(new GuiMenuSideButton(25, guiLeft - 70, this.guiTop + 86, 70, 22, "5"));
|
||||
addSideButton(new GuiMenuSideButton(26, guiLeft - 70, this.guiTop + 107, 35, 22, "6"));
|
||||
addSideButton(new GuiMenuSideButton(27, guiLeft - 35, this.guiTop + 107, 35, 22, "7"));
|
||||
addSideButton(new GuiMenuSideButton(28, guiLeft - 70, this.guiTop + 128, 35, 22, "8"));
|
||||
addSideButton(new GuiMenuSideButton(29, guiLeft - 35, this.guiTop + 128, 35, 22, "9"));
|
||||
addSideButton(new GuiMenuSideButton(30, guiLeft - 70, this.guiTop + 149, 35, 22, "10"));
|
||||
addSideButton(new GuiMenuSideButton(31, guiLeft - 35, this.guiTop + 149, 35, 22, "11"));
|
||||
addSideButton(new GuiMenuSideButton(32, guiLeft - 70, this.guiTop + 170, 35, 22, "12"));
|
||||
addSideButton(new GuiMenuSideButton(33, guiLeft - 35, this.guiTop + 170, 35, 22, "13"));
|
||||
addSideButton(new GuiMenuSideButton(34, guiLeft - 70, this.guiTop + 191, 35, 22, "14"));
|
||||
addSideButton(new GuiMenuSideButton(35, guiLeft - 35, this.guiTop + 191, 35, 22, "15"));
|
||||
|
||||
getSideButton(20 + activeTab).active = true;
|
||||
showClones();
|
||||
}
|
||||
else {
|
||||
showEntities();
|
||||
}
|
||||
} else {
|
||||
// Show Filters
|
||||
addLabel(new GuiNpcLabel(1, StatCollector.translateToLocal("cloner.tagFilters"), guiLeft + 7, guiTop + 7));
|
||||
addScroll(filterScroll);
|
||||
addTextField(new GuiNpcTextField(2, this, fontRendererObj, guiLeft + 4, guiTop + 190, 140, 20, tagSearch));
|
||||
addButton(new GuiNpcButton(6, guiLeft + 298, guiTop + 190, 52, 20, "gui.remove"));
|
||||
|
||||
addLabel(new GuiNpcLabel(2, StatCollector.translateToLocal("cloner.tagVisibility"), guiLeft + 150, guiTop + 27));
|
||||
addButton(new GuiNpcButton(12, guiLeft + 215, guiTop + 20, new String[]{"display.show", "display.all", "display.hide"}, displayTags));
|
||||
getSideButton(20 + activeTab).active = true;
|
||||
showClones();
|
||||
} else {
|
||||
showEntities();
|
||||
}
|
||||
} else {
|
||||
// Show Filters
|
||||
addLabel(new GuiNpcLabel(1, StatCollector.translateToLocal("cloner.tagFilters"), guiLeft + 7, guiTop + 7));
|
||||
addScroll(filterScroll);
|
||||
addTextField(new GuiNpcTextField(2, this, fontRendererObj, guiLeft + 4, guiTop + 190, 140, 20, tagSearch));
|
||||
|
||||
addLabel(new GuiNpcLabel(3, StatCollector.translateToLocal("filter.contains"), guiLeft + 150, guiTop + 50));
|
||||
addButton(new GuiNpcButton(13, guiLeft + 215, guiTop + 43, new String[]{"filter.any", "filter.all", "filter.notany", "filter.notall"}, filterCondition));
|
||||
addLabel(new GuiNpcLabel(2, StatCollector.translateToLocal("cloner.tagVisibility"), guiLeft + 150, guiTop + 27));
|
||||
addButton(new GuiNpcButton(12, guiLeft + 215, guiTop + 20, new String[]{"display.show", "display.all", "display.hide"}, displayTags));
|
||||
|
||||
addButton(new GuiNpcButton(11, guiLeft + 150, guiTop + 66, 130, 20, "gui.deselectAll"));
|
||||
addLabel(new GuiNpcLabel(3, StatCollector.translateToLocal("filter.contains"), guiLeft + 150, guiTop + 50));
|
||||
addButton(new GuiNpcButton(13, guiLeft + 215, guiTop + 43, new String[]{"filter.any", "filter.all", "filter.notany", "filter.notall"}, filterCondition));
|
||||
|
||||
addButton(new GuiNpcButton(11, guiLeft + 150, guiTop + 66, 130, 20, "gui.deselectAll"));
|
||||
|
||||
|
||||
addLabel(new GuiNpcLabel(4, StatCollector.translateToLocal("cloner.order"), guiLeft + 150, guiTop + 112));
|
||||
addButton(new GuiNpcButton(14, guiLeft + 215, guiTop + 105, new String[]{"cloner.ascending", "cloner.descending"}, ascending));
|
||||
addLabel(new GuiNpcLabel(4, StatCollector.translateToLocal("cloner.order"), guiLeft + 150, guiTop + 112));
|
||||
addButton(new GuiNpcButton(14, guiLeft + 215, guiTop + 105, new String[]{"cloner.ascending", "cloner.descending"}, ascending));
|
||||
|
||||
addLabel(new GuiNpcLabel(5, StatCollector.translateToLocal("cloner.type"), guiLeft + 150, guiTop + 135));
|
||||
addButton(new GuiNpcButton(15, guiLeft + 215, guiTop + 128, new String[]{"cloner.name", "cloner.date"}, sortType));
|
||||
addLabel(new GuiNpcLabel(5, StatCollector.translateToLocal("cloner.type"), guiLeft + 150, guiTop + 135));
|
||||
addButton(new GuiNpcButton(15, guiLeft + 215, guiTop + 128, new String[]{"cloner.name", "cloner.date"}, sortType));
|
||||
|
||||
|
||||
getButton(12).width = 65;
|
||||
getButton(12).height = 20;
|
||||
getButton(12).width = 65;
|
||||
getButton(12).height = 20;
|
||||
|
||||
getButton(13).width = 65;
|
||||
getButton(13).height = 20;
|
||||
getButton(13).width = 65;
|
||||
getButton(13).height = 20;
|
||||
|
||||
getButton(14).width = 65;
|
||||
getButton(14).height = 20;
|
||||
getButton(14).width = 65;
|
||||
getButton(14).height = 20;
|
||||
|
||||
getButton(15).width = 65;
|
||||
getButton(15).height = 20;
|
||||
getButton(15).width = 65;
|
||||
getButton(15).height = 20;
|
||||
|
||||
showFilters();
|
||||
}
|
||||
}
|
||||
showFilters();
|
||||
}
|
||||
}
|
||||
|
||||
public int getShowingClones() {return showingClones; }
|
||||
public int getShowingClones() {
|
||||
return showingClones;
|
||||
}
|
||||
|
||||
public void showFilters(){
|
||||
filterScroll.setList(getTagList());
|
||||
}
|
||||
public void showFilters() {
|
||||
filterScroll.setList(getTagList());
|
||||
}
|
||||
|
||||
private void showEntities() {
|
||||
Map<?,?> data = EntityList.stringToClassMapping;
|
||||
ArrayList<String> list = new ArrayList<String>();
|
||||
for(Object name : data.keySet()){
|
||||
Class<?> c = (Class<?>) data.get(name);
|
||||
try {
|
||||
if(EntityLiving.class.isAssignableFrom(c) && c.getConstructor(new Class[] {World.class}) != null && !Modifier.isAbstract(c.getModifiers()))
|
||||
list.add(name.toString());
|
||||
} catch (SecurityException e) {
|
||||
e.printStackTrace();
|
||||
} catch (NoSuchMethodException e) {
|
||||
}
|
||||
}
|
||||
this.list = list;
|
||||
this.rawList = new ArrayList<String>(this.list);
|
||||
scroll.setList(getSearchList(), ascending == 0, sortType == 0);
|
||||
}
|
||||
private void showClones() {
|
||||
if(showingClones == 2){
|
||||
private void showEntities() {
|
||||
Map<?, ?> data = EntityList.stringToClassMapping;
|
||||
ArrayList<String> list = new ArrayList<String>();
|
||||
for (Object name : data.keySet()) {
|
||||
Class<?> c = (Class<?>) data.get(name);
|
||||
try {
|
||||
if (EntityLiving.class.isAssignableFrom(c) && c.getConstructor(new Class[]{World.class}) != null && !Modifier.isAbstract(c.getModifiers()))
|
||||
list.add(name.toString());
|
||||
} catch (SecurityException e) {
|
||||
e.printStackTrace();
|
||||
} catch (NoSuchMethodException e) {
|
||||
}
|
||||
}
|
||||
this.list = list;
|
||||
this.rawList = new ArrayList<String>(this.list);
|
||||
scroll.setList(getSearchList(), ascending == 0, sortType == 0);
|
||||
}
|
||||
|
||||
private void showClones() {
|
||||
if (showingClones == 2) {
|
||||
PacketClient.sendClient(new CloneTagListPacket(activeTab));
|
||||
PacketClient.sendClient(new CloneListPacket(activeTab));
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if(sortType == 0){
|
||||
this.list = ClientCloneController.Instance.getClones(activeTab);
|
||||
}
|
||||
else {
|
||||
this.list = ClientCloneController.Instance.getClonesDate(activeTab);
|
||||
}
|
||||
if (sortType == 0) {
|
||||
this.list = ClientCloneController.Instance.getClones(activeTab);
|
||||
} else {
|
||||
this.list = ClientCloneController.Instance.getClonesDate(activeTab);
|
||||
}
|
||||
|
||||
this.tagMap = ClientTagMapController.Instance.getTagMap(activeTab);
|
||||
this.rawList = new ArrayList<String>(this.list);
|
||||
if(this.tagMap != null){
|
||||
if(GuiNpcMobSpawner.displayTags == 0 || GuiNpcMobSpawner.displayTags == 1){
|
||||
for(int i = 0; i < this.list.size(); i++){
|
||||
StringBuilder npcName = new StringBuilder(list.get(i));
|
||||
if (this.tagMap.hasClone(list.get(i))) {
|
||||
for (UUID tagUUID : this.tagMap.getUUIDsList(list.get(i))){
|
||||
Tag tag = tags.get(tagUUID);
|
||||
if(tag != null){
|
||||
if(GuiNpcMobSpawner.displayTags == 1 || !tag.getIsHidden()){
|
||||
npcName.append(" [" + tag.name + "]");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.rawList.set(i, npcName.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
this.tagMap = ClientTagMapController.Instance.getTagMap(activeTab);
|
||||
this.rawList = new ArrayList<String>(this.list);
|
||||
if (this.tagMap != null) {
|
||||
if (GuiNpcMobSpawner.displayTags == 0 || GuiNpcMobSpawner.displayTags == 1) {
|
||||
for (int i = 0; i < this.list.size(); i++) {
|
||||
StringBuilder npcName = new StringBuilder(list.get(i));
|
||||
if (this.tagMap.hasClone(list.get(i))) {
|
||||
for (UUID tagUUID : this.tagMap.getUUIDsList(list.get(i))) {
|
||||
Tag tag = tags.get(tagUUID);
|
||||
if (tag != null) {
|
||||
if (GuiNpcMobSpawner.displayTags == 1 || !tag.getIsHidden()) {
|
||||
npcName.append(" [" + tag.name + "]");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.rawList.set(i, npcName.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
scroll.setList(getSearchList(), ascending == 0, sortType == 0);
|
||||
}
|
||||
public void keyTyped(char c, int i)
|
||||
{
|
||||
super.keyTyped(c, i);
|
||||
if(getTextField(1) != null){
|
||||
if(search.equals(getTextField(1).getText()))
|
||||
return;
|
||||
search = getTextField(1).getText().toLowerCase();
|
||||
scroll.setList(getSearchList(), ascending == 0, sortType == 0);
|
||||
}
|
||||
if(getTextField(2) != null){
|
||||
if(tagSearch.equals(getTextField(2).getText()))
|
||||
return;
|
||||
tagSearch = getTextField(2).getText().toLowerCase();
|
||||
filterScroll.setList(getTagList());
|
||||
}
|
||||
scroll.setList(getSearchList(), ascending == 0, sortType == 0);
|
||||
}
|
||||
|
||||
}
|
||||
public void keyTyped(char c, int i) {
|
||||
super.keyTyped(c, i);
|
||||
if (getTextField(1) != null) {
|
||||
if (search.equals(getTextField(1).getText()))
|
||||
return;
|
||||
search = getTextField(1).getText().toLowerCase();
|
||||
scroll.setList(getSearchList(), ascending == 0, sortType == 0);
|
||||
}
|
||||
if (getTextField(2) != null) {
|
||||
if (tagSearch.equals(getTextField(2).getText()))
|
||||
return;
|
||||
tagSearch = getTextField(2).getText().toLowerCase();
|
||||
filterScroll.setList(getTagList());
|
||||
}
|
||||
|
||||
private List<String> getSearchList(){
|
||||
if(this.list == null){
|
||||
this.list = new ArrayList<String>();
|
||||
}
|
||||
if(this.rawList == null){
|
||||
this.rawList = new ArrayList<String>();
|
||||
}
|
||||
}
|
||||
|
||||
// No Filters - or - Entities
|
||||
if(tagFilters.size() == 0 || showingClones == 1){
|
||||
// No Search
|
||||
if(search.isEmpty())
|
||||
return new ArrayList<String>(this.list);
|
||||
// Yes Search
|
||||
else {
|
||||
List<String> list = new ArrayList<String>();
|
||||
for(int i = 0; i < this.list.size(); i++){
|
||||
if(this.rawList.get(i).toLowerCase().contains(search)){
|
||||
list.add(this.list.get(i));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
private List<String> getSearchList() {
|
||||
if (this.list == null) {
|
||||
this.list = new ArrayList<String>();
|
||||
}
|
||||
if (this.rawList == null) {
|
||||
this.rawList = new ArrayList<String>();
|
||||
}
|
||||
|
||||
////////////////////////
|
||||
//// WITH FILTERS
|
||||
// No Filters - or - Entities
|
||||
if (tagFilters.size() == 0 || showingClones == 1) {
|
||||
// No Search
|
||||
if (search.isEmpty())
|
||||
return new ArrayList<String>(this.list);
|
||||
// Yes Search
|
||||
else {
|
||||
List<String> list = new ArrayList<String>();
|
||||
for (int i = 0; i < this.list.size(); i++) {
|
||||
if (this.rawList.get(i).toLowerCase().contains(search)) {
|
||||
list.add(this.list.get(i));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
// No Search
|
||||
if(search.isEmpty()){
|
||||
List<String> list = new ArrayList<String>();
|
||||
for(String name : this.list){
|
||||
if(tagMap.hasClone(name)){
|
||||
if(meetsCondition(name)){
|
||||
list.add(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
////////////////////////
|
||||
//// WITH FILTERS
|
||||
|
||||
// Yes Search
|
||||
List<String> list = new ArrayList<String>();
|
||||
for(int i = 0; i < this.list.size(); i++){
|
||||
if(this.rawList.get(i).toLowerCase().contains(search)){
|
||||
String npcName = this.list.get(i);
|
||||
if(tagMap.hasClone(npcName)){
|
||||
if(meetsCondition(npcName)){
|
||||
list.add(npcName);
|
||||
}
|
||||
}
|
||||
}
|
||||
// No Search
|
||||
if (search.isEmpty()) {
|
||||
List<String> list = new ArrayList<String>();
|
||||
for (String name : this.list) {
|
||||
if (tagMap.hasClone(name)) {
|
||||
if (meetsCondition(name)) {
|
||||
list.add(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
return list;
|
||||
}
|
||||
// Yes Search
|
||||
List<String> list = new ArrayList<String>();
|
||||
for (int i = 0; i < this.list.size(); i++) {
|
||||
if (this.rawList.get(i).toLowerCase().contains(search)) {
|
||||
String npcName = this.list.get(i);
|
||||
if (tagMap.hasClone(npcName)) {
|
||||
if (meetsCondition(npcName)) {
|
||||
list.add(npcName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean meetsCondition(String name){
|
||||
if(tagMap == null){
|
||||
return true;
|
||||
}
|
||||
boolean conditionMet = true;
|
||||
boolean allRequirement = filterCondition == 1 || filterCondition == 3;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
for(String tagName : tagFilters){
|
||||
UUID tagUUID = tagNames.get(tagName);
|
||||
if(tagUUID != null) {
|
||||
boolean hasTag = tagMap.hasTag(name, tagUUID);
|
||||
if (!allRequirement) {
|
||||
if (!hasTag && filterCondition == 0) {
|
||||
conditionMet = false;
|
||||
break;
|
||||
} else if (hasTag && filterCondition == 2) {
|
||||
conditionMet = false;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (!hasTag && filterCondition == 1) {
|
||||
conditionMet = false;
|
||||
break;
|
||||
} else if (hasTag && filterCondition == 3) {
|
||||
conditionMet = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private boolean meetsCondition(String name) {
|
||||
if (tagMap == null) {
|
||||
return true;
|
||||
}
|
||||
boolean conditionMet = true;
|
||||
boolean allRequirement = filterCondition == 1 || filterCondition == 3;
|
||||
|
||||
return conditionMet;
|
||||
}
|
||||
for (String tagName : tagFilters) {
|
||||
UUID tagUUID = tagNames.get(tagName);
|
||||
if (tagUUID != null) {
|
||||
boolean hasTag = tagMap.hasTag(name, tagUUID);
|
||||
if (!allRequirement) {
|
||||
if (!hasTag && filterCondition == 0) {
|
||||
conditionMet = false;
|
||||
break;
|
||||
} else if (hasTag && filterCondition == 2) {
|
||||
conditionMet = false;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (!hasTag && filterCondition == 1) {
|
||||
conditionMet = false;
|
||||
break;
|
||||
} else if (hasTag && filterCondition == 3) {
|
||||
conditionMet = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<String> getTagList(){
|
||||
if(this.tagList == null){
|
||||
this.tagList = new ArrayList<String>();
|
||||
}
|
||||
// No Search // No Filters - or - Entities
|
||||
if(tagSearch.isEmpty())
|
||||
return new ArrayList<String>(tagNames.keySet());
|
||||
// Yes Search // No Filters - or - Entities
|
||||
return conditionMet;
|
||||
}
|
||||
|
||||
List<String> list = new ArrayList<String>();
|
||||
for(String name : this.tagList){
|
||||
if(name.toLowerCase().contains(tagSearch))
|
||||
list.add(name);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
private List<String> getTagList() {
|
||||
if (this.tagList == null) {
|
||||
this.tagList = new ArrayList<String>();
|
||||
}
|
||||
// No Search // No Filters - or - Entities
|
||||
if (tagSearch.isEmpty())
|
||||
return new ArrayList<String>(tagNames.keySet());
|
||||
// Yes Search // No Filters - or - Entities
|
||||
|
||||
private NBTTagCompound getCompound(){
|
||||
String sel = scroll.getSelected();
|
||||
if(sel == null)
|
||||
return null;
|
||||
List<String> list = new ArrayList<String>();
|
||||
for (String name : this.tagList) {
|
||||
if (name.toLowerCase().contains(tagSearch))
|
||||
list.add(name);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
if(showingClones == 0){
|
||||
return ClientCloneController.Instance.getCloneData(player, sel, activeTab);
|
||||
}
|
||||
else{
|
||||
Entity entity = EntityList.createEntityByName(sel, Minecraft.getMinecraft().theWorld);
|
||||
if(entity == null)
|
||||
return null;
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
entity.writeToNBTOptional(compound);
|
||||
return compound;
|
||||
}
|
||||
}
|
||||
private NBTTagCompound getCompound() {
|
||||
String sel = scroll.getSelected();
|
||||
if (sel == null)
|
||||
return null;
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton){
|
||||
int id = guibutton.id;
|
||||
if(id == 0){
|
||||
close();
|
||||
}
|
||||
if(id == 1){
|
||||
if(showingClones == 2){
|
||||
String sel = scroll.getSelected();
|
||||
if(sel == null)
|
||||
return;
|
||||
if (showingClones == 0) {
|
||||
return ClientCloneController.Instance.getCloneData(player, sel, activeTab);
|
||||
} else {
|
||||
Entity entity = EntityList.createEntityByName(sel, Minecraft.getMinecraft().theWorld);
|
||||
if (entity == null)
|
||||
return null;
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
entity.writeToNBTOptional(compound);
|
||||
return compound;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
int id = guibutton.id;
|
||||
if (id == 0) {
|
||||
close();
|
||||
}
|
||||
if (id == 1) {
|
||||
if (showingClones == 2) {
|
||||
String sel = scroll.getSelected();
|
||||
if (sel == null)
|
||||
return;
|
||||
SpawnMobPacket.Server(posX, posY, posZ, sel, activeTab);
|
||||
close();
|
||||
}
|
||||
else{
|
||||
NBTTagCompound compound = getCompound();
|
||||
if(compound == null)
|
||||
return;
|
||||
close();
|
||||
} else {
|
||||
NBTTagCompound compound = getCompound();
|
||||
if (compound == null)
|
||||
return;
|
||||
SpawnMobPacket.Client(posX, posY, posZ, compound);
|
||||
close();
|
||||
}
|
||||
}
|
||||
if(id == 2){
|
||||
if(showingClones == 2){
|
||||
String sel = scroll.getSelected();
|
||||
if(sel == null)
|
||||
return;
|
||||
close();
|
||||
}
|
||||
}
|
||||
if (id == 2) {
|
||||
if (showingClones == 2) {
|
||||
String sel = scroll.getSelected();
|
||||
if (sel == null)
|
||||
return;
|
||||
MobSpawnerPacket.Server(posX, posY, posZ, sel, activeTab);
|
||||
close();
|
||||
}
|
||||
else{
|
||||
NBTTagCompound compound = getCompound();
|
||||
if(compound == null)
|
||||
return;
|
||||
close();
|
||||
} else {
|
||||
NBTTagCompound compound = getCompound();
|
||||
if (compound == null)
|
||||
return;
|
||||
MobSpawnerPacket.Client(posX, posY, posZ, compound);
|
||||
close();
|
||||
close();
|
||||
|
||||
}
|
||||
}
|
||||
if(id == 3){
|
||||
showingClones = 0;
|
||||
initGui();
|
||||
}
|
||||
if(id == 4){
|
||||
showingClones = 1;
|
||||
initGui();
|
||||
}
|
||||
if(id == 5){
|
||||
showingClones = 2;
|
||||
initGui();
|
||||
}
|
||||
if(id == 16){
|
||||
showingClones = 3;
|
||||
initGui();
|
||||
}
|
||||
if(id == 17){
|
||||
close();
|
||||
}
|
||||
if(id == 6){
|
||||
if(scroll.getSelected() != null){
|
||||
if(showingClones == 2){
|
||||
}
|
||||
}
|
||||
if (id == 3) {
|
||||
showingClones = 0;
|
||||
initGui();
|
||||
}
|
||||
if (id == 4) {
|
||||
showingClones = 1;
|
||||
initGui();
|
||||
}
|
||||
if (id == 5) {
|
||||
showingClones = 2;
|
||||
initGui();
|
||||
}
|
||||
if (id == 16) {
|
||||
showingClones = 3;
|
||||
initGui();
|
||||
}
|
||||
if (id == 17) {
|
||||
close();
|
||||
}
|
||||
if (id == 6) {
|
||||
if (scroll.getSelected() != null) {
|
||||
if (showingClones == 2) {
|
||||
PacketClient.sendClient(new CloneRemovePacket(activeTab, scroll.getSelected()));
|
||||
return;
|
||||
}
|
||||
ClientCloneController.Instance.removeClone(scroll.getSelected(), activeTab);
|
||||
scroll.selected = -1;
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
if (id == 11) {
|
||||
tagFilters = new HashSet<>();
|
||||
filterScroll.setSelectedList(tagFilters);
|
||||
initGui();
|
||||
}
|
||||
if (id == 12) {
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
displayTags = (byte) button.getValue();
|
||||
}
|
||||
if (id == 13) {
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
filterCondition = (byte) button.getValue();
|
||||
}
|
||||
if (id == 14) {
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
ascending = (byte) button.getValue();
|
||||
}
|
||||
if (id == 15) {
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
sortType = (byte) button.getValue();
|
||||
}
|
||||
if(id > 20){
|
||||
activeTab = id - 20;
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
ClientCloneController.Instance.removeClone(scroll.getSelected(), activeTab);
|
||||
scroll.selected = -1;
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
if (id == 11) {
|
||||
tagFilters = new HashSet<>();
|
||||
filterScroll.setSelectedList(tagFilters);
|
||||
initGui();
|
||||
}
|
||||
if (id == 12) {
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
displayTags = (byte) button.getValue();
|
||||
}
|
||||
if (id == 13) {
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
filterCondition = (byte) button.getValue();
|
||||
}
|
||||
if (id == 14) {
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
ascending = (byte) button.getValue();
|
||||
}
|
||||
if (id == 15) {
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
sortType = (byte) button.getValue();
|
||||
}
|
||||
if (id > 20) {
|
||||
activeTab = id - 20;
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
@Override
|
||||
public void save() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
if (compound.hasKey("CloneTags")) {
|
||||
this.tagMap = new TagMap(activeTab);
|
||||
NBTTagCompound cloneTags = compound.getCompoundTag("CloneTags");
|
||||
this.tagMap.readNBT(cloneTags);
|
||||
}
|
||||
else if (compound.hasKey("AllTags")) {
|
||||
NBTTagList validTags = compound.getTagList("AllTags", 10);
|
||||
if(validTags != null){
|
||||
HashMap<UUID, Tag> tagsUpdate = new HashMap<>();
|
||||
HashMap<String, UUID> tagNamesUpdate = new HashMap<>();
|
||||
for(int j = 0; j < validTags.tagCount(); j++)
|
||||
{
|
||||
NBTTagCompound tagStructure = validTags.getCompoundTagAt(j);
|
||||
Tag tag = new Tag();
|
||||
tag.readNBT(tagStructure);
|
||||
tagsUpdate.put(tag.uuid, tag);
|
||||
tagNamesUpdate.put(tag.name, tag.uuid);
|
||||
}
|
||||
tags = tagsUpdate;
|
||||
tagNames = tagNamesUpdate;
|
||||
this.tagList = new ArrayList<String>(tagNames.keySet());
|
||||
filterScroll.setList(getTagList());
|
||||
}
|
||||
}
|
||||
else {
|
||||
List<String> list = new ArrayList<String>();
|
||||
if(sortType == 1){
|
||||
NBTTagList nbtlist = compound.getTagList("ListDate", 8);
|
||||
for(int i = 0; i < nbtlist.tagCount(); i++){
|
||||
list.add(nbtlist.getStringTagAt(i));
|
||||
}
|
||||
}
|
||||
else {
|
||||
NBTTagList nbtlist = compound.getTagList("List", 8);
|
||||
for(int i = 0; i < nbtlist.tagCount(); i++){
|
||||
list.add(nbtlist.getStringTagAt(i));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
if (compound.hasKey("CloneTags")) {
|
||||
this.tagMap = new TagMap(activeTab);
|
||||
NBTTagCompound cloneTags = compound.getCompoundTag("CloneTags");
|
||||
this.tagMap.readNBT(cloneTags);
|
||||
} else if (compound.hasKey("AllTags")) {
|
||||
NBTTagList validTags = compound.getTagList("AllTags", 10);
|
||||
if (validTags != null) {
|
||||
HashMap<UUID, Tag> tagsUpdate = new HashMap<>();
|
||||
HashMap<String, UUID> tagNamesUpdate = new HashMap<>();
|
||||
for (int j = 0; j < validTags.tagCount(); j++) {
|
||||
NBTTagCompound tagStructure = validTags.getCompoundTagAt(j);
|
||||
Tag tag = new Tag();
|
||||
tag.readNBT(tagStructure);
|
||||
tagsUpdate.put(tag.uuid, tag);
|
||||
tagNamesUpdate.put(tag.name, tag.uuid);
|
||||
}
|
||||
tags = tagsUpdate;
|
||||
tagNames = tagNamesUpdate;
|
||||
this.tagList = new ArrayList<String>(tagNames.keySet());
|
||||
filterScroll.setList(getTagList());
|
||||
}
|
||||
} else {
|
||||
List<String> list = new ArrayList<String>();
|
||||
if (sortType == 1) {
|
||||
NBTTagList nbtlist = compound.getTagList("ListDate", 8);
|
||||
for (int i = 0; i < nbtlist.tagCount(); i++) {
|
||||
list.add(nbtlist.getStringTagAt(i));
|
||||
}
|
||||
} else {
|
||||
NBTTagList nbtlist = compound.getTagList("List", 8);
|
||||
for (int i = 0; i < nbtlist.tagCount(); i++) {
|
||||
list.add(nbtlist.getStringTagAt(i));
|
||||
}
|
||||
}
|
||||
|
||||
this.list = list;
|
||||
this.list = list;
|
||||
|
||||
this.rawList = new ArrayList<String>(this.list);
|
||||
if(this.tagMap != null){
|
||||
if(GuiNpcMobSpawner.displayTags == 0 || GuiNpcMobSpawner.displayTags == 1){
|
||||
for(int i = 0; i < this.list.size(); i++){
|
||||
StringBuilder npcName = new StringBuilder(list.get(i));
|
||||
if (this.tagMap.hasClone(list.get(i))) {
|
||||
for (UUID tagUUID : this.tagMap.getUUIDsList(list.get(i))){
|
||||
Tag tag = tags.get(tagUUID);
|
||||
if(tag != null){
|
||||
if(GuiNpcMobSpawner.displayTags == 1 || !tag.getIsHidden()){
|
||||
npcName.append(" [" + tag.name + "]");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.rawList.set(i, npcName.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
this.rawList = new ArrayList<String>(this.list);
|
||||
if (this.tagMap != null) {
|
||||
if (GuiNpcMobSpawner.displayTags == 0 || GuiNpcMobSpawner.displayTags == 1) {
|
||||
for (int i = 0; i < this.list.size(); i++) {
|
||||
StringBuilder npcName = new StringBuilder(list.get(i));
|
||||
if (this.tagMap.hasClone(list.get(i))) {
|
||||
for (UUID tagUUID : this.tagMap.getUUIDsList(list.get(i))) {
|
||||
Tag tag = tags.get(tagUUID);
|
||||
if (tag != null) {
|
||||
if (GuiNpcMobSpawner.displayTags == 1 || !tag.getIsHidden()) {
|
||||
npcName.append(" [" + tag.name + "]");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.rawList.set(i, npcName.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
scroll.setList(getSearchList(), ascending == 0, sortType == 0);
|
||||
}
|
||||
}
|
||||
scroll.setList(getSearchList(), ascending == 0, sortType == 0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -27,173 +27,169 @@ public class GuiNpcMobSpawnerAdd extends GuiNPCInterface implements GuiYesNoCall
|
||||
|
||||
private Entity toClone;
|
||||
private NBTTagCompound compound;
|
||||
private static boolean serverSide = false;
|
||||
private static int tab = 1;
|
||||
public boolean isNPC = false;
|
||||
private static boolean serverSide = false;
|
||||
private static int tab = 1;
|
||||
public boolean isNPC = false;
|
||||
|
||||
// Selected Tags to Add
|
||||
// Selected Tags to Add
|
||||
public static NBTTagList tagsCompound;
|
||||
public static HashSet<String> addTags;
|
||||
public static ArrayList<String> allTags = new ArrayList<>();
|
||||
public static HashSet<String> addTags;
|
||||
public static ArrayList<String> allTags = new ArrayList<>();
|
||||
public static HashSet<UUID> addTagUUIDs;
|
||||
public static HashMap<String, UUID> tagMap = new HashMap<>();
|
||||
|
||||
public GuiNpcMobSpawnerAdd(NBTTagCompound compound){
|
||||
this.toClone = EntityList.createEntityFromNBT(compound, Minecraft.getMinecraft().theWorld);
|
||||
this.compound = compound;
|
||||
public GuiNpcMobSpawnerAdd(NBTTagCompound compound) {
|
||||
this.toClone = EntityList.createEntityFromNBT(compound, Minecraft.getMinecraft().theWorld);
|
||||
this.compound = compound;
|
||||
tagsCompound = new NBTTagList();
|
||||
|
||||
if(toClone instanceof EntityNPCInterface){
|
||||
isNPC = true;
|
||||
tagsCompound = this.compound.getTagList("TagUUIDs",8);
|
||||
}
|
||||
setBackground("menubg.png");
|
||||
xSize = 256;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
if (toClone instanceof EntityNPCInterface) {
|
||||
isNPC = true;
|
||||
tagsCompound = this.compound.getTagList("TagUUIDs", 8);
|
||||
}
|
||||
setBackground("menubg.png");
|
||||
xSize = 256;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
|
||||
if(addTags == null){
|
||||
addTags = new HashSet<>();
|
||||
}
|
||||
if(addTagUUIDs == null){
|
||||
if (addTags == null) {
|
||||
addTags = new HashSet<>();
|
||||
}
|
||||
if (addTagUUIDs == null) {
|
||||
addTagUUIDs = new HashSet<>();
|
||||
}
|
||||
if(isNPC){
|
||||
if (isNPC) {
|
||||
PacketClient.sendClient(new CloneAllTagsShortPacket());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui(){
|
||||
super.initGui();
|
||||
String name = toClone.getCommandSenderName();
|
||||
addLabel(new GuiNpcLabel(0, "Save as", guiLeft + 4, guiTop + 6));
|
||||
addTextField(new GuiNpcTextField(0, this, fontRendererObj, guiLeft + 4, guiTop + 18, 200, 20, name));
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
String name = toClone.getCommandSenderName();
|
||||
addLabel(new GuiNpcLabel(0, "Save as", guiLeft + 4, guiTop + 6));
|
||||
addTextField(new GuiNpcTextField(0, this, fontRendererObj, guiLeft + 4, guiTop + 18, 200, 20, name));
|
||||
|
||||
|
||||
addLabel(new GuiNpcLabel(1, "Tab", guiLeft + 10, guiTop + 50));
|
||||
addButton(new GuiButtonBiDirectional(2, guiLeft + 40, guiTop + 45, 60, 20, new String[]{"1","2","3","4","5","6","7","8","9","10","11","12","13","14","15"}, tab - 1));
|
||||
addLabel(new GuiNpcLabel(1, "Tab", guiLeft + 10, guiTop + 50));
|
||||
addButton(new GuiButtonBiDirectional(2, guiLeft + 40, guiTop + 45, 60, 20, new String[]{"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15"}, tab - 1));
|
||||
|
||||
addButton(new GuiNpcButton(3, guiLeft + 4, guiTop + 95, new String[]{"Client side", "Server side"}, serverSide?1:0));
|
||||
addLabel(new GuiNpcLabel(1, "Tab", guiLeft + 10, guiTop + 50));
|
||||
addButton(new GuiNpcButton(3, guiLeft + 4, guiTop + 95, new String[]{"Client side", "Server side"}, serverSide ? 1 : 0));
|
||||
addLabel(new GuiNpcLabel(1, "Tab", guiLeft + 10, guiTop + 50));
|
||||
|
||||
addButton(new GuiNpcButton(0, guiLeft + 4, guiTop + 70, 80, 20, "gui.save"));
|
||||
addButton(new GuiNpcButton(1, guiLeft + 86, guiTop + 70, 80, 20, "gui.cancel"));
|
||||
addButton(new GuiNpcButton(0, guiLeft + 4, guiTop + 70, 80, 20, "gui.save"));
|
||||
addButton(new GuiNpcButton(1, guiLeft + 86, guiTop + 70, 80, 20, "gui.cancel"));
|
||||
|
||||
if(isNPC){
|
||||
addButton(new GuiNpcButton(4, guiLeft + 4, guiTop + 120, 99, 20, "cloner.wandTags"));
|
||||
addButton(new GuiNpcButton(5, guiLeft + 106, guiTop + 120, 99, 20, "cloner.npcTags"));
|
||||
if(addTags.size() > 0){
|
||||
addLabel(new GuiNpcLabel(6, "cloner.wandtagsapplied", guiLeft + 10, guiTop + 160));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isNPC) {
|
||||
addButton(new GuiNpcButton(4, guiLeft + 4, guiTop + 120, 99, 20, "cloner.wandTags"));
|
||||
addButton(new GuiNpcButton(5, guiLeft + 106, guiTop + 120, 99, 20, "cloner.npcTags"));
|
||||
if (addTags.size() > 0) {
|
||||
addLabel(new GuiNpcLabel(6, "cloner.wandtagsapplied", guiLeft + 10, guiTop + 160));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void buttonEvent(GuiButton guibutton) {
|
||||
int id = guibutton.id;
|
||||
if(id == 0){
|
||||
String name = getTextField(0).getText();
|
||||
if(name.isEmpty())
|
||||
return;
|
||||
int tab = ((GuiNpcButton)guibutton).getValue() + 1;
|
||||
if(!serverSide){
|
||||
if(ClientCloneController.Instance.getCloneData(null, name, tab) != null)
|
||||
displayGuiScreen(new GuiYesNo(this, "Warning", "You are about to overwrite a clone", 1));
|
||||
else
|
||||
confirmClicked(true, 0);
|
||||
}
|
||||
else
|
||||
public void buttonEvent(GuiButton guibutton) {
|
||||
int id = guibutton.id;
|
||||
if (id == 0) {
|
||||
String name = getTextField(0).getText();
|
||||
if (name.isEmpty())
|
||||
return;
|
||||
int tab = ((GuiNpcButton) guibutton).getValue() + 1;
|
||||
if (!serverSide) {
|
||||
if (ClientCloneController.Instance.getCloneData(null, name, tab) != null)
|
||||
displayGuiScreen(new GuiYesNo(this, "Warning", "You are about to overwrite a clone", 1));
|
||||
else
|
||||
confirmClicked(true, 0);
|
||||
} else
|
||||
PacketClient.sendClient(new ClonePreSavePacket(name, tab));
|
||||
}
|
||||
if(id == 1){
|
||||
close();
|
||||
}
|
||||
if(id == 2){
|
||||
tab = ((GuiNpcButton)guibutton).getValue() + 1;
|
||||
}
|
||||
if(id == 3){
|
||||
serverSide = ((GuiNpcButton)guibutton).getValue() == 1;
|
||||
}
|
||||
if (id == 4) {
|
||||
if(isNPC){
|
||||
this.setSubGui(new SubGuiClonerQuickTags(this));
|
||||
}
|
||||
}
|
||||
if (id == 5) {
|
||||
if(isNPC){
|
||||
this.setSubGui(new SubGuiClonerNPCTags((EntityNPCInterface) toClone, this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void confirmClicked(boolean confirm, int id){
|
||||
if(confirm){
|
||||
String name = getTextField(0).getText();
|
||||
NBTTagCompound extraTags = new NBTTagCompound();
|
||||
if(isNPC){
|
||||
extraTags = setTempTags();
|
||||
}
|
||||
if(!serverSide){
|
||||
if(isNPC){
|
||||
compound.setTag("TagUUIDs", tagsCompound);
|
||||
}
|
||||
ClientCloneController.Instance.addClone(compound, name, tab, extraTags);
|
||||
}
|
||||
else {
|
||||
NBTTagCompound compounder = new NBTTagCompound();
|
||||
if(isNPC){
|
||||
compounder.setTag("TagUUIDs", tagsCompound);
|
||||
}
|
||||
PacketClient.sendClient(new CloneSavePacket(name, tab, extraTags, compounder));
|
||||
}
|
||||
|
||||
close();
|
||||
}
|
||||
else
|
||||
displayGuiScreen(this);
|
||||
}
|
||||
if (id == 1) {
|
||||
close();
|
||||
}
|
||||
if (id == 2) {
|
||||
tab = ((GuiNpcButton) guibutton).getValue() + 1;
|
||||
}
|
||||
if (id == 3) {
|
||||
serverSide = ((GuiNpcButton) guibutton).getValue() == 1;
|
||||
}
|
||||
if (id == 4) {
|
||||
if (isNPC) {
|
||||
this.setSubGui(new SubGuiClonerQuickTags(this));
|
||||
}
|
||||
}
|
||||
if (id == 5) {
|
||||
if (isNPC) {
|
||||
this.setSubGui(new SubGuiClonerNPCTags((EntityNPCInterface) toClone, this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void save() {}
|
||||
@Override
|
||||
public void confirmClicked(boolean confirm, int id) {
|
||||
if (confirm) {
|
||||
String name = getTextField(0).getText();
|
||||
NBTTagCompound extraTags = new NBTTagCompound();
|
||||
if (isNPC) {
|
||||
extraTags = setTempTags();
|
||||
}
|
||||
if (!serverSide) {
|
||||
if (isNPC) {
|
||||
compound.setTag("TagUUIDs", tagsCompound);
|
||||
}
|
||||
ClientCloneController.Instance.addClone(compound, name, tab, extraTags);
|
||||
} else {
|
||||
NBTTagCompound compounder = new NBTTagCompound();
|
||||
if (isNPC) {
|
||||
compounder.setTag("TagUUIDs", tagsCompound);
|
||||
}
|
||||
PacketClient.sendClient(new CloneSavePacket(name, tab, extraTags, compounder));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
if(compound.hasKey("NameExists")){
|
||||
if(compound.getBoolean("NameExists"))
|
||||
displayGuiScreen(new GuiYesNo(this, "Warning", "You are about to overwrite a clone", 1));
|
||||
else
|
||||
confirmClicked(true, 0);
|
||||
}
|
||||
else if (compound.hasKey("ShortTags")) {
|
||||
NBTTagList validTags = compound.getTagList("ShortTags", 10);
|
||||
tagMap.clear();
|
||||
allTags.clear();
|
||||
close();
|
||||
} else
|
||||
displayGuiScreen(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
if (compound.hasKey("NameExists")) {
|
||||
if (compound.getBoolean("NameExists"))
|
||||
displayGuiScreen(new GuiYesNo(this, "Warning", "You are about to overwrite a clone", 1));
|
||||
else
|
||||
confirmClicked(true, 0);
|
||||
} else if (compound.hasKey("ShortTags")) {
|
||||
NBTTagList validTags = compound.getTagList("ShortTags", 10);
|
||||
tagMap.clear();
|
||||
allTags.clear();
|
||||
addTagUUIDs.clear();
|
||||
if(validTags != null){
|
||||
for(int j = 0; j < validTags.tagCount(); j++)
|
||||
{
|
||||
NBTTagCompound tagStructure = validTags.getCompoundTagAt(j);
|
||||
Tag tag = new Tag();
|
||||
tag.readShortNBT(tagStructure);
|
||||
tagMap.put(tag.name, tag.uuid);
|
||||
if (validTags != null) {
|
||||
for (int j = 0; j < validTags.tagCount(); j++) {
|
||||
NBTTagCompound tagStructure = validTags.getCompoundTagAt(j);
|
||||
Tag tag = new Tag();
|
||||
tag.readShortNBT(tagStructure);
|
||||
tagMap.put(tag.name, tag.uuid);
|
||||
addTagUUIDs.add(tag.uuid);
|
||||
}
|
||||
allTags.addAll(tagMap.keySet());
|
||||
allTags.sort(String.CASE_INSENSITIVE_ORDER);
|
||||
}
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
}
|
||||
allTags.addAll(tagMap.keySet());
|
||||
allTags.sort(String.CASE_INSENSITIVE_ORDER);
|
||||
}
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void subGuiClosed(SubGuiInterface subgui) {
|
||||
initGui();
|
||||
}
|
||||
@Override
|
||||
public void subGuiClosed(SubGuiInterface subgui) {
|
||||
initGui();
|
||||
}
|
||||
|
||||
public NBTTagCompound setTempTags(){
|
||||
public NBTTagCompound setTempTags() {
|
||||
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
||||
NBTTagList nbtTagList = new NBTTagList();
|
||||
for (String name : addTags) {
|
||||
@@ -203,7 +199,7 @@ public class GuiNpcMobSpawnerAdd extends GuiNPCInterface implements GuiYesNoCall
|
||||
addTags.remove(name);
|
||||
}
|
||||
}
|
||||
nbtTagCompound.setTag("TempTagUUIDs", nbtTagList);
|
||||
return nbtTagCompound;
|
||||
}
|
||||
nbtTagCompound.setTag("TempTagUUIDs", nbtTagList);
|
||||
return nbtTagCompound;
|
||||
}
|
||||
}
|
||||
@@ -20,22 +20,22 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class GuiNpcMobSpawnerMounter extends GuiNPCInterface implements IGuiData{
|
||||
public class GuiNpcMobSpawnerMounter extends GuiNPCInterface implements IGuiData {
|
||||
|
||||
private GuiCustomScroll scroll;
|
||||
|
||||
private int posX,posY,posZ;
|
||||
private int posX, posY, posZ;
|
||||
|
||||
private List<String> list;
|
||||
|
||||
private static int showingClones = 0;
|
||||
|
||||
private static String search = "";
|
||||
private static String search = "";
|
||||
|
||||
private int activeTab = 1;
|
||||
private int activeTab = 1;
|
||||
|
||||
public GuiNpcMobSpawnerMounter(int i, int j, int k) {
|
||||
super();
|
||||
public GuiNpcMobSpawnerMounter(int i, int j, int k) {
|
||||
super();
|
||||
xSize = 256;
|
||||
|
||||
posX = i;
|
||||
@@ -45,26 +45,25 @@ public class GuiNpcMobSpawnerMounter extends GuiNPCInterface implements IGuiData
|
||||
this.closeOnEsc = true;
|
||||
|
||||
setBackground("menubg.png");
|
||||
}
|
||||
public void initGui()
|
||||
{
|
||||
}
|
||||
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
guiTop += 10;
|
||||
|
||||
if(scroll == null){
|
||||
scroll = new GuiCustomScroll(this,0);
|
||||
scroll.setSize(165, 188);
|
||||
}
|
||||
else
|
||||
scroll.clear();
|
||||
if (scroll == null) {
|
||||
scroll = new GuiCustomScroll(this, 0);
|
||||
scroll.setSize(165, 188);
|
||||
} else
|
||||
scroll.clear();
|
||||
scroll.guiLeft = guiLeft + 4;
|
||||
scroll.guiTop = guiTop + 26;
|
||||
addScroll(scroll);
|
||||
|
||||
addTextField(new GuiNpcTextField(1, this, fontRendererObj, guiLeft + 4, guiTop + 4, 165, 20, search));
|
||||
addTextField(new GuiNpcTextField(1, this, fontRendererObj, guiLeft + 4, guiTop + 4, 165, 20, search));
|
||||
|
||||
GuiMenuTopButton button;
|
||||
addTopButton(button = new GuiMenuTopButton(3,guiLeft + 4, guiTop - 17, "spawner.clones"));
|
||||
addTopButton(button = new GuiMenuTopButton(3, guiLeft + 4, guiTop - 17, "spawner.clones"));
|
||||
button.active = showingClones == 0;
|
||||
addTopButton(button = new GuiMenuTopButton(4, button, "spawner.entities"));
|
||||
button.active = showingClones == 1;
|
||||
@@ -75,137 +74,137 @@ public class GuiNpcMobSpawnerMounter extends GuiNPCInterface implements IGuiData
|
||||
|
||||
addButton(new GuiNpcButton(2, guiLeft + 170, guiTop + 50, 82, 20, "spawner.mountplayer"));
|
||||
|
||||
if(showingClones == 0 || showingClones == 2){
|
||||
addSideButton(new GuiMenuSideButton(21,guiLeft - 90, this.guiTop + 2, 90,22, "1"));
|
||||
addSideButton(new GuiMenuSideButton(22,guiLeft - 90, this.guiTop + 23, 90,22, "2"));
|
||||
addSideButton(new GuiMenuSideButton(23,guiLeft - 90, this.guiTop + 44, 90,22, "3"));
|
||||
addSideButton(new GuiMenuSideButton(24,guiLeft - 90, this.guiTop + 65, 90,22, "4"));
|
||||
addSideButton(new GuiMenuSideButton(25,guiLeft - 90, this.guiTop + 86, 90,22, "5"));
|
||||
addSideButton(new GuiMenuSideButton(26,guiLeft - 45, this.guiTop + 107, 45,22, "6"));
|
||||
addSideButton(new GuiMenuSideButton(27,guiLeft - 90, this.guiTop + 107, 45,22, "7"));
|
||||
addSideButton(new GuiMenuSideButton(28,guiLeft - 45, this.guiTop + 128, 45,22, "8"));
|
||||
addSideButton(new GuiMenuSideButton(29,guiLeft - 90, this.guiTop + 128, 45,22, "9"));
|
||||
addSideButton(new GuiMenuSideButton(30,guiLeft - 45, this.guiTop + 149, 45,22, "10"));
|
||||
addSideButton(new GuiMenuSideButton(31,guiLeft - 90, this.guiTop + 149, 45,22, "11"));
|
||||
addSideButton(new GuiMenuSideButton(32,guiLeft - 45, this.guiTop + 170, 45,22, "12"));
|
||||
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"));
|
||||
if (showingClones == 0 || showingClones == 2) {
|
||||
addSideButton(new GuiMenuSideButton(21, guiLeft - 90, this.guiTop + 2, 90, 22, "1"));
|
||||
addSideButton(new GuiMenuSideButton(22, guiLeft - 90, this.guiTop + 23, 90, 22, "2"));
|
||||
addSideButton(new GuiMenuSideButton(23, guiLeft - 90, this.guiTop + 44, 90, 22, "3"));
|
||||
addSideButton(new GuiMenuSideButton(24, guiLeft - 90, this.guiTop + 65, 90, 22, "4"));
|
||||
addSideButton(new GuiMenuSideButton(25, guiLeft - 90, this.guiTop + 86, 90, 22, "5"));
|
||||
addSideButton(new GuiMenuSideButton(26, guiLeft - 45, this.guiTop + 107, 45, 22, "6"));
|
||||
addSideButton(new GuiMenuSideButton(27, guiLeft - 90, this.guiTop + 107, 45, 22, "7"));
|
||||
addSideButton(new GuiMenuSideButton(28, guiLeft - 45, this.guiTop + 128, 45, 22, "8"));
|
||||
addSideButton(new GuiMenuSideButton(29, guiLeft - 90, this.guiTop + 128, 45, 22, "9"));
|
||||
addSideButton(new GuiMenuSideButton(30, guiLeft - 45, this.guiTop + 149, 45, 22, "10"));
|
||||
addSideButton(new GuiMenuSideButton(31, guiLeft - 90, this.guiTop + 149, 45, 22, "11"));
|
||||
addSideButton(new GuiMenuSideButton(32, guiLeft - 45, this.guiTop + 170, 45, 22, "12"));
|
||||
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();
|
||||
}
|
||||
else
|
||||
showEntities();
|
||||
getSideButton(20 + activeTab).active = true;
|
||||
showClones();
|
||||
} else
|
||||
showEntities();
|
||||
}
|
||||
private void showEntities() {
|
||||
Map<?,?> data = EntityList.stringToClassMapping;
|
||||
|
||||
private void showEntities() {
|
||||
Map<?, ?> data = EntityList.stringToClassMapping;
|
||||
ArrayList<String> list = new ArrayList<String>();
|
||||
for(Object name : data.keySet()){
|
||||
Class<?> c = (Class<?>) data.get(name);
|
||||
try {
|
||||
if(EntityLiving.class.isAssignableFrom(c) && c.getConstructor(new Class[] {World.class}) != null && !Modifier.isAbstract(c.getModifiers()))
|
||||
list.add(name.toString());
|
||||
} catch (SecurityException e) {
|
||||
e.printStackTrace();
|
||||
} catch (NoSuchMethodException e) {
|
||||
}
|
||||
for (Object name : data.keySet()) {
|
||||
Class<?> c = (Class<?>) data.get(name);
|
||||
try {
|
||||
if (EntityLiving.class.isAssignableFrom(c) && c.getConstructor(new Class[]{World.class}) != null && !Modifier.isAbstract(c.getModifiers()))
|
||||
list.add(name.toString());
|
||||
} catch (SecurityException e) {
|
||||
e.printStackTrace();
|
||||
} catch (NoSuchMethodException e) {
|
||||
}
|
||||
}
|
||||
this.list = list;
|
||||
scroll.setList(getSearchList());
|
||||
}
|
||||
private void showClones() {
|
||||
}
|
||||
|
||||
if(showingClones == 2){
|
||||
private void showClones() {
|
||||
|
||||
if (showingClones == 2) {
|
||||
PacketClient.sendClient(new CloneListPacket(activeTab));
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
ArrayList<String> list = new ArrayList<String>();
|
||||
this.list = 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();
|
||||
scroll.setList(getSearchList());
|
||||
}
|
||||
private List<String> getSearchList(){
|
||||
if(search.isEmpty())
|
||||
return new ArrayList<String>(list);
|
||||
List<String> list = new ArrayList<String>();
|
||||
for(String name : this.list){
|
||||
if(name.toLowerCase().contains(search))
|
||||
list.add(name);
|
||||
}
|
||||
return list;
|
||||
|
||||
public void keyTyped(char c, int i) {
|
||||
super.keyTyped(c, i);
|
||||
|
||||
if (search.equals(getTextField(1).getText()))
|
||||
return;
|
||||
search = getTextField(1).getText().toLowerCase();
|
||||
scroll.setList(getSearchList());
|
||||
}
|
||||
private NBTTagCompound getCompound(){
|
||||
String sel = scroll.getSelected();
|
||||
if(sel == null)
|
||||
return null;
|
||||
|
||||
if(showingClones == 0){
|
||||
return ClientCloneController.Instance.getCloneData(player, sel, activeTab);
|
||||
}
|
||||
else{
|
||||
Entity entity = EntityList.createEntityByName(sel, Minecraft.getMinecraft().theWorld);
|
||||
if(entity == null)
|
||||
return null;
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
entity.writeToNBTOptional(compound);
|
||||
return compound;
|
||||
}
|
||||
private List<String> getSearchList() {
|
||||
if (search.isEmpty())
|
||||
return new ArrayList<String>(list);
|
||||
List<String> list = new ArrayList<String>();
|
||||
for (String name : this.list) {
|
||||
if (name.toLowerCase().contains(search))
|
||||
list.add(name);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
private NBTTagCompound getCompound() {
|
||||
String sel = scroll.getSelected();
|
||||
if (sel == null)
|
||||
return null;
|
||||
|
||||
protected void actionPerformed(GuiButton guibutton)
|
||||
{
|
||||
int id = guibutton.id;
|
||||
if(id == 0){
|
||||
close();
|
||||
}
|
||||
if(id == 1){
|
||||
NBTTagCompound compound = getCompound();
|
||||
if(compound != null){
|
||||
compound.setTag("Pos", this.newDoubleNBTList(new double[] {this.posX + 0.5, this.posY + 1, this.posZ + 0.5}));
|
||||
if (showingClones == 0) {
|
||||
return ClientCloneController.Instance.getCloneData(player, sel, activeTab);
|
||||
} else {
|
||||
Entity entity = EntityList.createEntityByName(sel, Minecraft.getMinecraft().theWorld);
|
||||
if (entity == null)
|
||||
return null;
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
entity.writeToNBTOptional(compound);
|
||||
return compound;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
int id = guibutton.id;
|
||||
if (id == 0) {
|
||||
close();
|
||||
}
|
||||
if (id == 1) {
|
||||
NBTTagCompound compound = getCompound();
|
||||
if (compound != null) {
|
||||
compound.setTag("Pos", this.newDoubleNBTList(new double[]{this.posX + 0.5, this.posY + 1, this.posZ + 0.5}));
|
||||
MountPacket.Spawn(compound);
|
||||
close();
|
||||
}
|
||||
}
|
||||
if(id == 2){
|
||||
close();
|
||||
}
|
||||
}
|
||||
if (id == 2) {
|
||||
MountPacket.Player();
|
||||
close();
|
||||
}
|
||||
if(id == 3){
|
||||
showingClones = 0;
|
||||
initGui();
|
||||
}
|
||||
if(id == 4){
|
||||
showingClones = 1;
|
||||
initGui();
|
||||
}
|
||||
if(id == 5){
|
||||
showingClones = 2;
|
||||
initGui();
|
||||
}
|
||||
if(id > 20){
|
||||
activeTab = id - 20;
|
||||
initGui();
|
||||
}
|
||||
close();
|
||||
}
|
||||
if (id == 3) {
|
||||
showingClones = 0;
|
||||
initGui();
|
||||
}
|
||||
if (id == 4) {
|
||||
showingClones = 1;
|
||||
initGui();
|
||||
}
|
||||
if (id == 5) {
|
||||
showingClones = 2;
|
||||
initGui();
|
||||
}
|
||||
if (id > 20) {
|
||||
activeTab = id - 20;
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
protected NBTTagList newDoubleNBTList(double ... par1ArrayOfDouble)
|
||||
{
|
||||
|
||||
protected NBTTagList newDoubleNBTList(double... par1ArrayOfDouble) {
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
double[] adouble = par1ArrayOfDouble;
|
||||
int i = par1ArrayOfDouble.length;
|
||||
|
||||
for (int j = 0; j < i; ++j)
|
||||
{
|
||||
for (int j = 0; j < i; ++j) {
|
||||
double d1 = adouble[j];
|
||||
nbttaglist.appendTag(new NBTTagDouble(d1));
|
||||
}
|
||||
@@ -213,19 +212,20 @@ public class GuiNpcMobSpawnerMounter extends GuiNPCInterface implements IGuiData
|
||||
return nbttaglist;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
@Override
|
||||
public void save() {
|
||||
|
||||
|
||||
}
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
NBTTagList nbtlist = compound.getTagList("List", 8);
|
||||
List<String> list = new ArrayList<String>();
|
||||
for(int i = 0; i < nbtlist.tagCount(); i++){
|
||||
list.add(nbtlist.getStringTagAt(i));
|
||||
}
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
NBTTagList nbtlist = compound.getTagList("List", 8);
|
||||
List<String> list = new ArrayList<String>();
|
||||
for (int i = 0; i < nbtlist.tagCount(); i++) {
|
||||
list.add(nbtlist.getStringTagAt(i));
|
||||
}
|
||||
this.list = list;
|
||||
scroll.setList(getSearchList());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,127 +12,127 @@ import noppes.npcs.client.gui.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class GuiNpcMobSpawnerSelector extends SubGuiInterface implements IGuiData{
|
||||
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;
|
||||
private static String search = "";
|
||||
public int activeTab = 1;
|
||||
public boolean isServer = false;
|
||||
|
||||
public GuiNpcMobSpawnerSelector() {
|
||||
super();
|
||||
public GuiNpcMobSpawnerSelector() {
|
||||
super();
|
||||
xSize = 256;
|
||||
this.closeOnEsc = true;
|
||||
setBackground("menubg.png");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void initGui(){
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
if(scroll == null){
|
||||
scroll = new GuiCustomScroll(this,0);
|
||||
scroll.setSize(165, 188);
|
||||
}
|
||||
else
|
||||
scroll.clear();
|
||||
if (scroll == null) {
|
||||
scroll = new GuiCustomScroll(this, 0);
|
||||
scroll.setSize(165, 188);
|
||||
} else
|
||||
scroll.clear();
|
||||
scroll.guiLeft = guiLeft + 4;
|
||||
scroll.guiTop = guiTop + 26;
|
||||
addScroll(scroll);
|
||||
|
||||
addTextField(new GuiNpcTextField(1, this, fontRendererObj, guiLeft + 4, guiTop + 4, 165, 20, search));
|
||||
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"));
|
||||
addButton(new GuiNpcButton(1, guiLeft + 171, guiTop + 103, 80, 20, "gui.cancel"));
|
||||
addButton(new GuiNpcButton(0, guiLeft + 171, guiTop + 80, 80, 20, "gui.done"));
|
||||
addButton(new GuiNpcButton(1, guiLeft + 171, guiTop + 103, 80, 20, "gui.cancel"));
|
||||
|
||||
addSideButton(new GuiMenuSideButton(21,guiLeft - 90, this.guiTop + 2, 90,22, "1"));
|
||||
addSideButton(new GuiMenuSideButton(22,guiLeft - 90, this.guiTop + 23, 90,22, "2"));
|
||||
addSideButton(new GuiMenuSideButton(23,guiLeft - 90, this.guiTop + 44, 90,22, "3"));
|
||||
addSideButton(new GuiMenuSideButton(24,guiLeft - 90, this.guiTop + 65, 90,22, "4"));
|
||||
addSideButton(new GuiMenuSideButton(25,guiLeft - 90, this.guiTop + 86, 90,22, "5"));
|
||||
addSideButton(new GuiMenuSideButton(26,guiLeft - 45, this.guiTop + 107, 45,22, "6"));
|
||||
addSideButton(new GuiMenuSideButton(27,guiLeft - 90, this.guiTop + 107, 45,22, "7"));
|
||||
addSideButton(new GuiMenuSideButton(28,guiLeft - 45, this.guiTop + 128, 45,22, "8"));
|
||||
addSideButton(new GuiMenuSideButton(29,guiLeft - 90, this.guiTop + 128, 45,22, "9"));
|
||||
addSideButton(new GuiMenuSideButton(30,guiLeft - 45, this.guiTop + 149, 45,22, "10"));
|
||||
addSideButton(new GuiMenuSideButton(31,guiLeft - 90, this.guiTop + 149, 45,22, "11"));
|
||||
addSideButton(new GuiMenuSideButton(32,guiLeft - 45, this.guiTop + 170, 45,22, "12"));
|
||||
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"));
|
||||
addSideButton(new GuiMenuSideButton(21, guiLeft - 90, this.guiTop + 2, 90, 22, "1"));
|
||||
addSideButton(new GuiMenuSideButton(22, guiLeft - 90, this.guiTop + 23, 90, 22, "2"));
|
||||
addSideButton(new GuiMenuSideButton(23, guiLeft - 90, this.guiTop + 44, 90, 22, "3"));
|
||||
addSideButton(new GuiMenuSideButton(24, guiLeft - 90, this.guiTop + 65, 90, 22, "4"));
|
||||
addSideButton(new GuiMenuSideButton(25, guiLeft - 90, this.guiTop + 86, 90, 22, "5"));
|
||||
addSideButton(new GuiMenuSideButton(26, guiLeft - 45, this.guiTop + 107, 45, 22, "6"));
|
||||
addSideButton(new GuiMenuSideButton(27, guiLeft - 90, this.guiTop + 107, 45, 22, "7"));
|
||||
addSideButton(new GuiMenuSideButton(28, guiLeft - 45, this.guiTop + 128, 45, 22, "8"));
|
||||
addSideButton(new GuiMenuSideButton(29, guiLeft - 90, this.guiTop + 128, 45, 22, "9"));
|
||||
addSideButton(new GuiMenuSideButton(30, guiLeft - 45, this.guiTop + 149, 45, 22, "10"));
|
||||
addSideButton(new GuiMenuSideButton(31, guiLeft - 90, this.guiTop + 149, 45, 22, "11"));
|
||||
addSideButton(new GuiMenuSideButton(32, guiLeft - 45, this.guiTop + 170, 45, 22, "12"));
|
||||
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();
|
||||
getSideButton(20 + activeTab).active = true;
|
||||
showClones();
|
||||
}
|
||||
|
||||
public String getSelected(){
|
||||
return scroll.getSelected();
|
||||
public String getSelected() {
|
||||
return scroll.getSelected();
|
||||
}
|
||||
private void showClones() {
|
||||
|
||||
if(isServer){
|
||||
private void showClones() {
|
||||
|
||||
if (isServer) {
|
||||
PacketClient.sendClient(new CloneListPacket(activeTab));
|
||||
return;
|
||||
}
|
||||
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();
|
||||
scroll.setList(getSearchList());
|
||||
}
|
||||
private List<String> getSearchList(){
|
||||
if(search.isEmpty())
|
||||
return new ArrayList<String>(list);
|
||||
List<String> list = new ArrayList<String>();
|
||||
for(String name : this.list){
|
||||
if(name.toLowerCase().contains(search))
|
||||
list.add(name);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
public NBTTagCompound getCompound(){
|
||||
String sel = scroll.getSelected();
|
||||
if(sel == null)
|
||||
return null;
|
||||
|
||||
NBTTagCompound compound = ClientCloneController.Instance.getCloneData(player, sel, activeTab);
|
||||
compound.setString("ClonedName", sel);
|
||||
return compound;
|
||||
}
|
||||
public void keyTyped(char c, int i) {
|
||||
super.keyTyped(c, i);
|
||||
|
||||
public void buttonEvent(GuiButton guibutton)
|
||||
{
|
||||
int id = guibutton.id;
|
||||
if(id == 0){
|
||||
close();
|
||||
}
|
||||
if(id == 1){
|
||||
scroll.clear();
|
||||
close();
|
||||
}
|
||||
if(id > 20){
|
||||
activeTab = id - 20;
|
||||
initGui();
|
||||
}
|
||||
if (search.equals(getTextField(1).getText()))
|
||||
return;
|
||||
search = getTextField(1).getText().toLowerCase();
|
||||
scroll.setList(getSearchList());
|
||||
}
|
||||
protected NBTTagList newDoubleNBTList(double ... par1ArrayOfDouble)
|
||||
{
|
||||
|
||||
private List<String> getSearchList() {
|
||||
if (search.isEmpty())
|
||||
return new ArrayList<String>(list);
|
||||
List<String> list = new ArrayList<String>();
|
||||
for (String name : this.list) {
|
||||
if (name.toLowerCase().contains(search))
|
||||
list.add(name);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public NBTTagCompound getCompound() {
|
||||
String sel = scroll.getSelected();
|
||||
if (sel == null)
|
||||
return null;
|
||||
|
||||
NBTTagCompound compound = ClientCloneController.Instance.getCloneData(player, sel, activeTab);
|
||||
compound.setString("ClonedName", sel);
|
||||
return compound;
|
||||
}
|
||||
|
||||
public void buttonEvent(GuiButton guibutton) {
|
||||
int id = guibutton.id;
|
||||
if (id == 0) {
|
||||
close();
|
||||
}
|
||||
if (id == 1) {
|
||||
scroll.clear();
|
||||
close();
|
||||
}
|
||||
if (id > 20) {
|
||||
activeTab = id - 20;
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
|
||||
protected NBTTagList newDoubleNBTList(double... par1ArrayOfDouble) {
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
double[] adouble = par1ArrayOfDouble;
|
||||
int i = par1ArrayOfDouble.length;
|
||||
|
||||
for (int j = 0; j < i; ++j)
|
||||
{
|
||||
for (int j = 0; j < i; ++j) {
|
||||
double d1 = adouble[j];
|
||||
nbttaglist.appendTag(new NBTTagDouble(d1));
|
||||
}
|
||||
@@ -140,22 +140,22 @@ public class GuiNpcMobSpawnerSelector extends SubGuiInterface implements IGuiDat
|
||||
return nbttaglist;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
@Override
|
||||
public void save() {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
NBTTagList nbtlist = compound.getTagList("List", 8);
|
||||
List<String> list = new ArrayList<String>();
|
||||
for(int i = 0; i < nbtlist.tagCount(); i++){
|
||||
list.add(nbtlist.getStringTagAt(i));
|
||||
}
|
||||
this.list = list;
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
NBTTagList nbtlist = compound.getTagList("List", 8);
|
||||
List<String> list = new ArrayList<String>();
|
||||
for (int i = 0; i < nbtlist.tagCount(); i++) {
|
||||
list.add(nbtlist.getStringTagAt(i));
|
||||
}
|
||||
this.list = list;
|
||||
scroll.setList(getSearchList());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,111 +17,109 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class GuiNpcPather extends GuiNPCInterface implements IGuiData{
|
||||
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;
|
||||
public GuiNpcPather(EntityNPCInterface npc) {
|
||||
super();
|
||||
drawDefaultBackground = false;
|
||||
xSize = 176;
|
||||
title = "Npc Pather";
|
||||
setBackground("smallbg.png");
|
||||
ai = npc.ais;
|
||||
PacketClient.sendClient(new MovingPathGetPacket());
|
||||
}
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
scroll = new GuiCustomScroll(this,0);
|
||||
scroll = new GuiCustomScroll(this, 0);
|
||||
scroll.setSize(160, 164);
|
||||
List<String> list = new ArrayList<String>();
|
||||
for(int[] arr: ai.getMovingPath()){
|
||||
list.add("x:" + arr[0] + " y:" + arr[1] + " z:" + arr[2]);
|
||||
for (int[] arr : ai.getMovingPath()) {
|
||||
list.add("x:" + arr[0] + " y:" + arr[1] + " z:" + arr[2]);
|
||||
}
|
||||
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"));
|
||||
this.addButton(new GuiNpcButton(2, guiLeft + 118, guiTop + 178,52,20, "selectWorld.deleteButton"));
|
||||
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"));
|
||||
this.addButton(new GuiNpcButton(2, guiLeft + 118, guiTop + 178, 52, 20, "selectWorld.deleteButton"));
|
||||
}
|
||||
|
||||
protected void actionPerformed(GuiButton guibutton)
|
||||
{
|
||||
if(scroll.selected < 0)
|
||||
return;
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
if (scroll.selected < 0)
|
||||
return;
|
||||
|
||||
int id = guibutton.id;
|
||||
if(id == 0){
|
||||
List<int[]> list = ai.getMovingPath();
|
||||
int selected = scroll.selected;
|
||||
if(list.size() <= selected + 1)
|
||||
return;
|
||||
int[] a = list.get(selected);
|
||||
int[] b = list.get(selected + 1);
|
||||
list.set(selected, b);
|
||||
list.set(selected + 1, a);
|
||||
ai.setMovingPath(list);
|
||||
initGui();
|
||||
scroll.selected = selected + 1;
|
||||
}
|
||||
if(id == 1){
|
||||
if(scroll.selected - 1 < 0)
|
||||
return;
|
||||
List<int[]> list = ai.getMovingPath();
|
||||
int selected = scroll.selected;
|
||||
int[] a = list.get(selected);
|
||||
int[] b = list.get(selected - 1);
|
||||
list.set(selected, b);
|
||||
list.set(selected - 1, a);
|
||||
ai.setMovingPath(list);
|
||||
initGui();
|
||||
scroll.selected = selected - 1;
|
||||
}
|
||||
if(id == 2){
|
||||
List<int[]> list = ai.getMovingPath();
|
||||
if(list.size() <= 1)
|
||||
return;
|
||||
list.remove(scroll.selected);
|
||||
ai.setMovingPath(list);
|
||||
initGui();
|
||||
}
|
||||
int id = guibutton.id;
|
||||
if (id == 0) {
|
||||
List<int[]> list = ai.getMovingPath();
|
||||
int selected = scroll.selected;
|
||||
if (list.size() <= selected + 1)
|
||||
return;
|
||||
int[] a = list.get(selected);
|
||||
int[] b = list.get(selected + 1);
|
||||
list.set(selected, b);
|
||||
list.set(selected + 1, a);
|
||||
ai.setMovingPath(list);
|
||||
initGui();
|
||||
scroll.selected = selected + 1;
|
||||
}
|
||||
if (id == 1) {
|
||||
if (scroll.selected - 1 < 0)
|
||||
return;
|
||||
List<int[]> list = ai.getMovingPath();
|
||||
int selected = scroll.selected;
|
||||
int[] a = list.get(selected);
|
||||
int[] b = list.get(selected - 1);
|
||||
list.set(selected, b);
|
||||
list.set(selected - 1, a);
|
||||
ai.setMovingPath(list);
|
||||
initGui();
|
||||
scroll.selected = selected - 1;
|
||||
}
|
||||
if (id == 2) {
|
||||
List<int[]> list = ai.getMovingPath();
|
||||
if (list.size() <= 1)
|
||||
return;
|
||||
list.remove(scroll.selected);
|
||||
ai.setMovingPath(list);
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j)
|
||||
{
|
||||
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int i, int j, int k)
|
||||
{
|
||||
super.mouseClicked(i, j, k);
|
||||
scroll.mouseClicked(i, j, k);
|
||||
public void mouseClicked(int i, int j, int k) {
|
||||
super.mouseClicked(i, j, k);
|
||||
scroll.mouseClicked(i, j, k);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyTyped(char c, int i)
|
||||
{
|
||||
if (i == 1 || isInventoryKey(i))
|
||||
{
|
||||
public void keyTyped(char c, int i) {
|
||||
if (i == 1 || isInventoryKey(i)) {
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setTag("MovingPathNew", NBTTags.nbtIntegerArraySet(ai.getMovingPath()));
|
||||
@Override
|
||||
public void save() {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setTag("MovingPathNew", NBTTags.nbtIntegerArraySet(ai.getMovingPath()));
|
||||
PacketClient.sendClient(new MovingPathSavePacket(compound));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
ai.readToNBT(compound);
|
||||
initGui();
|
||||
}
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
ai.readToNBT(compound);
|
||||
initGui();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,110 +12,109 @@ import noppes.npcs.client.gui.util.GuiNpcLabel;
|
||||
import noppes.npcs.client.gui.util.GuiNpcTextField;
|
||||
|
||||
|
||||
public class GuiNpcRedstoneBlock extends GuiNPCInterface{
|
||||
public class GuiNpcRedstoneBlock extends GuiNPCInterface {
|
||||
|
||||
private TileRedstoneBlock tile;
|
||||
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));
|
||||
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));
|
||||
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));
|
||||
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));
|
||||
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));
|
||||
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));
|
||||
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));
|
||||
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));
|
||||
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));
|
||||
addTextField(new GuiNpcTextField(3, this, fontRendererObj, guiLeft+ 80, guiTop + 94,30,20, tile.offRange + ""));
|
||||
getTextField(3).integersOnly = true;
|
||||
getTextField(3).setMinMaxDefault(0, 50, 10);
|
||||
}
|
||||
addButton(new GuiNpcButton(0, guiLeft + 40, guiTop + 190,120,20, "Done"));
|
||||
super();
|
||||
tile = (TileRedstoneBlock) player.worldObj.getTileEntity(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
int id = guibutton.id;
|
||||
if(id == 0)
|
||||
close();
|
||||
if(id == 1){
|
||||
tile.isDetailed = ((GuiNpcButton)guibutton).getValue() == 1;
|
||||
initGui();
|
||||
}
|
||||
if (id == 4) {
|
||||
save();
|
||||
setSubGui(new SubGuiNpcAvailability(tile.availability));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void save() {
|
||||
if(tile == null)
|
||||
return;
|
||||
if(tile.isDetailed){
|
||||
tile.onRangeX = getTextField(0).getInteger();
|
||||
tile.onRangeY = getTextField(1).getInteger();
|
||||
tile.onRangeZ = getTextField(2).getInteger();
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
tile.offRangeX = getTextField(3).getInteger();
|
||||
tile.offRangeY = getTextField(4).getInteger();
|
||||
tile.offRangeZ = getTextField(5).getInteger();
|
||||
this.addButton(new GuiNpcButton(4, guiLeft + 40, guiTop + 20, 120, 20, "availability.options"));
|
||||
|
||||
if(tile.onRangeX > tile.offRangeX)
|
||||
tile.offRangeX = tile.onRangeX;
|
||||
if(tile.onRangeY > tile.offRangeY)
|
||||
tile.offRangeY = tile.onRangeY;
|
||||
if(tile.onRangeZ > tile.offRangeZ)
|
||||
tile.offRangeZ = tile.onRangeZ;
|
||||
}
|
||||
else{
|
||||
tile.onRange = getTextField(0).getInteger();
|
||||
tile.offRange = getTextField(3).getInteger();
|
||||
if(tile.onRange > tile.offRange)
|
||||
tile.offRange = tile.onRange;
|
||||
}
|
||||
tile.isActivated = false;
|
||||
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));
|
||||
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
tile.writeToNBT(compound);
|
||||
if (tile.isDetailed) {
|
||||
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));
|
||||
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));
|
||||
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));
|
||||
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));
|
||||
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));
|
||||
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));
|
||||
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));
|
||||
addTextField(new GuiNpcTextField(3, this, fontRendererObj, guiLeft + 80, guiTop + 94, 30, 20, tile.offRange + ""));
|
||||
getTextField(3).integersOnly = true;
|
||||
getTextField(3).setMinMaxDefault(0, 50, 10);
|
||||
}
|
||||
addButton(new GuiNpcButton(0, guiLeft + 40, guiTop + 190, 120, 20, "Done"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
int id = guibutton.id;
|
||||
if (id == 0)
|
||||
close();
|
||||
if (id == 1) {
|
||||
tile.isDetailed = ((GuiNpcButton) guibutton).getValue() == 1;
|
||||
initGui();
|
||||
}
|
||||
if (id == 4) {
|
||||
save();
|
||||
setSubGui(new SubGuiNpcAvailability(tile.availability));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
if (tile == null)
|
||||
return;
|
||||
if (tile.isDetailed) {
|
||||
tile.onRangeX = getTextField(0).getInteger();
|
||||
tile.onRangeY = getTextField(1).getInteger();
|
||||
tile.onRangeZ = getTextField(2).getInteger();
|
||||
|
||||
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)
|
||||
tile.offRangeY = tile.onRangeY;
|
||||
if (tile.onRangeZ > tile.offRangeZ)
|
||||
tile.offRangeZ = tile.onRangeZ;
|
||||
} else {
|
||||
tile.onRange = getTextField(0).getInteger();
|
||||
tile.offRange = getTextField(3).getInteger();
|
||||
if (tile.onRange > tile.offRange)
|
||||
tile.offRange = tile.onRange;
|
||||
}
|
||||
tile.isActivated = false;
|
||||
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
tile.writeToNBT(compound);
|
||||
PacketClient.sendClient(new TileEntitySavePacket(compound));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,25 +17,25 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
public class GuiNpcRemoteEditor extends GuiNPCInterface implements IScrollData, GuiYesNoCallback{
|
||||
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();
|
||||
public GuiNpcRemoteEditor() {
|
||||
super();
|
||||
xSize = 256;
|
||||
setBackground("menubg.png");
|
||||
PacketClient.sendClient(new RemoteNpcsGetPacket());
|
||||
PacketClient.sendClient(new RemoteFreezeGetPacket());
|
||||
}
|
||||
public void initGui()
|
||||
{
|
||||
}
|
||||
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
if(scroll == null){
|
||||
scroll = new GuiCustomScroll(this,0, 0);
|
||||
scroll.setSize(165, 188);
|
||||
if (scroll == null) {
|
||||
scroll = new GuiCustomScroll(this, 0, 0);
|
||||
scroll.setSize(165, 188);
|
||||
}
|
||||
scroll.guiLeft = guiLeft + 4;
|
||||
scroll.guiTop = guiTop + 4;
|
||||
@@ -48,118 +48,117 @@ public class GuiNpcRemoteEditor extends GuiNPCInterface implements IScrollData,
|
||||
|
||||
this.addLabel(new GuiNpcLabel(0, title, guiLeft + x, guiTop - 8));
|
||||
|
||||
this.addButton(new GuiNpcButton(0, guiLeft + 170, guiTop + 6,82,20, "selectServer.edit"));
|
||||
this.addButton(new GuiNpcButton(1, guiLeft + 170, guiTop + 28,82,20, "selectWorld.deleteButton"));
|
||||
this.addButton(new GuiNpcButton(2, guiLeft + 170, guiTop + 50,82,20, "remote.reset"));
|
||||
this.addButton(new GuiNpcButton(3, guiLeft + 170, guiTop + 132,82,20, "remote.freeze"));
|
||||
this.addButton(new GuiNpcButton(4, guiLeft + 170, guiTop + 72,82,20, "remote.tp"));
|
||||
this.addButton(new GuiNpcButton(5, guiLeft + 170, guiTop + 110,82,20, "remote.resetall"));
|
||||
this.addButton(new GuiNpcButton(6, guiLeft + 170, guiTop + 165,82,20, "menu.global"));
|
||||
this.addButton(new GuiNpcButton(0, guiLeft + 170, guiTop + 6, 82, 20, "selectServer.edit"));
|
||||
this.addButton(new GuiNpcButton(1, guiLeft + 170, guiTop + 28, 82, 20, "selectWorld.deleteButton"));
|
||||
this.addButton(new GuiNpcButton(2, guiLeft + 170, guiTop + 50, 82, 20, "remote.reset"));
|
||||
this.addButton(new GuiNpcButton(3, guiLeft + 170, guiTop + 132, 82, 20, "remote.freeze"));
|
||||
this.addButton(new GuiNpcButton(4, guiLeft + 170, guiTop + 72, 82, 20, "remote.tp"));
|
||||
this.addButton(new GuiNpcButton(5, guiLeft + 170, guiTop + 110, 82, 20, "remote.resetall"));
|
||||
this.addButton(new GuiNpcButton(6, guiLeft + 170, guiTop + 165, 82, 20, "menu.global"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void confirmClicked(boolean flag, int i){
|
||||
if(flag){
|
||||
public void confirmClicked(boolean flag, int i) {
|
||||
if (flag) {
|
||||
PacketClient.sendClient(new RemoteDeletePacket(data.get(scroll.getSelected())));
|
||||
}
|
||||
NoppesUtil.openGUI(player, this);
|
||||
}
|
||||
NoppesUtil.openGUI(player, this);
|
||||
}
|
||||
protected void actionPerformed(GuiButton guibutton)
|
||||
{
|
||||
int id = guibutton.id;
|
||||
if(id == 3){
|
||||
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
int id = guibutton.id;
|
||||
if (id == 3) {
|
||||
PacketClient.sendClient(new RemoteFreezePacket());
|
||||
}
|
||||
if(id == 5){
|
||||
for(int ids : data.values()){
|
||||
}
|
||||
if (id == 5) {
|
||||
for (int ids : data.values()) {
|
||||
PacketClient.sendClient(new RemoteResetPacket(ids));
|
||||
Entity entity = player.worldObj.getEntityByID(ids);
|
||||
if(entity != null && entity instanceof EntityNPCInterface)
|
||||
((EntityNPCInterface)entity).reset();
|
||||
}
|
||||
}
|
||||
if(id == 6){
|
||||
NoppesUtil.setLastNpc(null);
|
||||
Entity entity = player.worldObj.getEntityByID(ids);
|
||||
if (entity != null && entity instanceof EntityNPCInterface)
|
||||
((EntityNPCInterface) entity).reset();
|
||||
}
|
||||
}
|
||||
if (id == 6) {
|
||||
NoppesUtil.setLastNpc(null);
|
||||
PacketClient.sendClient(new RemoteGlobalMenuPacket());
|
||||
}
|
||||
}
|
||||
|
||||
if(!data.containsKey(scroll.getSelected()))
|
||||
return;
|
||||
if (!data.containsKey(scroll.getSelected()))
|
||||
return;
|
||||
|
||||
if(id == 0){
|
||||
if (id == 0) {
|
||||
PacketClient.sendClient(new RemoteMainMenuPacket(data.get(scroll.getSelected())));
|
||||
}
|
||||
if(id == 1){
|
||||
}
|
||||
if (id == 1) {
|
||||
GuiYesNo guiyesno = new GuiYesNo(this, "Confirm", StatCollector.translateToLocal("gui.delete"), 0);
|
||||
displayGuiScreen(guiyesno);
|
||||
}
|
||||
if(id == 2){
|
||||
}
|
||||
if (id == 2) {
|
||||
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){
|
||||
Entity entity = player.worldObj.getEntityByID(selected);
|
||||
if (entity != null && entity instanceof EntityNPCInterface)
|
||||
((EntityNPCInterface) entity).reset();
|
||||
}
|
||||
if (id == 4) {
|
||||
PacketClient.sendClient(new RemoteTpToNpcPacket(data.get(scroll.getSelected())));
|
||||
close();
|
||||
}
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int i, int j, int k)
|
||||
{
|
||||
super.mouseClicked(i, j, k);
|
||||
scroll.mouseClicked(i, j, k);
|
||||
public void mouseClicked(int i, int j, int k) {
|
||||
super.mouseClicked(i, j, k);
|
||||
scroll.mouseClicked(i, j, k);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyTyped(char c, int i)
|
||||
{
|
||||
public void keyTyped(char c, int i) {
|
||||
super.keyTyped(c, i);
|
||||
if(getTextField(66) != null){
|
||||
if(getTextField(66).isFocused()){
|
||||
if (i == 1)
|
||||
{
|
||||
if (getTextField(66) != null) {
|
||||
if (getTextField(66).isFocused()) {
|
||||
if (i == 1) {
|
||||
close();
|
||||
return;
|
||||
}
|
||||
if(search.equals(getTextField(66).getText()))
|
||||
if (search.equals(getTextField(66).getText()))
|
||||
return;
|
||||
search = getTextField(66).getText().toLowerCase();
|
||||
scroll.resetScroll();
|
||||
scroll.setList(getNPCSearch());
|
||||
}
|
||||
}
|
||||
if (i == 1)
|
||||
{
|
||||
if (i == 1) {
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
private List<String> getNPCSearch(){
|
||||
if(search.isEmpty()){
|
||||
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))
|
||||
for (String name : this.data.keySet()) {
|
||||
if (name.toLowerCase().contains(search))
|
||||
list.add(name);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {}
|
||||
@Override
|
||||
public void save() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(Vector<String> list, HashMap<String, Integer> data, EnumScrollData type) {
|
||||
@Override
|
||||
public void setData(Vector<String> list, HashMap<String, Integer> data, EnumScrollData type) {
|
||||
this.data = data;
|
||||
scroll.resetScroll();
|
||||
scroll.setList(getNPCSearch());
|
||||
}
|
||||
@Override
|
||||
public void setSelected(String selected) {
|
||||
getButton(3).setDisplayText(selected);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(String selected) {
|
||||
getButton(3).setDisplayText(selected);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,108 +12,106 @@ import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Vector;
|
||||
|
||||
public abstract class GuiNpcSelectionInterface extends GuiNPCInterface{
|
||||
public GuiNPCStringSlot slot;
|
||||
public GuiScreen parent;
|
||||
|
||||
private String up = "..<" + StatCollector.translateToLocal("gui.up") + ">..";
|
||||
public abstract class GuiNpcSelectionInterface extends GuiNPCInterface {
|
||||
public GuiNPCStringSlot slot;
|
||||
public GuiScreen parent;
|
||||
|
||||
private String root = "";
|
||||
public AssetsBrowser assets;
|
||||
private HashSet<String> dataFolder = new HashSet<String>();
|
||||
protected HashSet<String> dataTextures = new HashSet<String>();
|
||||
|
||||
public GuiNpcSelectionInterface(EntityNPCInterface npc, GuiScreen parent, String sound){
|
||||
super(npc);
|
||||
root = AssetsBrowser.getRoot(sound);
|
||||
assets = new AssetsBrowser(root, getExtension());
|
||||
drawDefaultBackground = false;
|
||||
title = "";
|
||||
this.parent = parent;
|
||||
private String up = "..<" + StatCollector.translateToLocal("gui.up") + ">..";
|
||||
|
||||
private String root = "";
|
||||
public AssetsBrowser assets;
|
||||
private HashSet<String> dataFolder = new HashSet<String>();
|
||||
protected HashSet<String> dataTextures = new HashSet<String>();
|
||||
|
||||
public GuiNpcSelectionInterface(EntityNPCInterface npc, GuiScreen parent, String sound) {
|
||||
super(npc);
|
||||
root = AssetsBrowser.getRoot(sound);
|
||||
assets = new AssetsBrowser(root, getExtension());
|
||||
drawDefaultBackground = false;
|
||||
title = "";
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui(){
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
dataFolder.clear();
|
||||
String ss = "Current Folder: /assets" + root;
|
||||
addLabel(new GuiNpcLabel(0,ss, width / 2 - (this.fontRendererObj.getStringWidth(ss)/2), 20, 0xffffff));
|
||||
addLabel(new GuiNpcLabel(0, ss, width / 2 - (this.fontRendererObj.getStringWidth(ss) / 2), 20, 0xffffff));
|
||||
Vector<String> list = new Vector<String>();
|
||||
if(!assets.isRoot)
|
||||
list.add(up);
|
||||
for(String folder : assets.folders){
|
||||
list.add("/" + folder);
|
||||
dataFolder.add("/" + folder);
|
||||
if (!assets.isRoot)
|
||||
list.add(up);
|
||||
for (String folder : assets.folders) {
|
||||
list.add("/" + folder);
|
||||
dataFolder.add("/" + folder);
|
||||
}
|
||||
for(String texture : assets.files){
|
||||
list.add(texture);
|
||||
dataTextures.add(texture);
|
||||
for (String texture : assets.files) {
|
||||
list.add(texture);
|
||||
dataTextures.add(texture);
|
||||
}
|
||||
Collections.sort(list,String.CASE_INSENSITIVE_ORDER);
|
||||
slot = new GuiNPCStringSlot(list,this,false,18);
|
||||
Collections.sort(list, String.CASE_INSENSITIVE_ORDER);
|
||||
slot = new GuiNPCStringSlot(list, this, false, 18);
|
||||
slot.registerScrollButtons(4, 5);
|
||||
|
||||
this.addButton(new GuiNpcButton(2, width / 2 - 100, height - 44,98, 20, "gui.back"));
|
||||
this.addButton(new GuiNpcButton(3, width / 2 + 2, height - 44,98, 20, "gui.up"));
|
||||
getButton(3).enabled = !assets.isRoot;
|
||||
this.addButton(new GuiNpcButton(2, width / 2 - 100, height - 44, 98, 20, "gui.back"));
|
||||
this.addButton(new GuiNpcButton(3, width / 2 + 2, height - 44, 98, 20, "gui.up"));
|
||||
getButton(3).enabled = !assets.isRoot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int i, int j, float f)
|
||||
{
|
||||
slot.drawScreen(i, j, f);
|
||||
public void drawScreen(int i, int j, float f) {
|
||||
slot.drawScreen(i, j, f);
|
||||
super.drawScreen(i, j, f);
|
||||
}
|
||||
@Override
|
||||
public void elementClicked(){
|
||||
if(slot.selected != null && this.dataTextures.contains(slot.selected)){
|
||||
if(parent instanceof GuiNPCInterface){
|
||||
((GuiNPCInterface)parent).elementClicked();
|
||||
}
|
||||
else if(parent instanceof GuiNPCInterface2){
|
||||
((GuiNPCInterface2)parent).elementClicked();
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void doubleClicked(){
|
||||
if(slot.selected.equals(up)){
|
||||
root = root.substring(0,root.lastIndexOf("/"));
|
||||
assets = new AssetsBrowser(root, getExtension());
|
||||
initGui();
|
||||
}
|
||||
else if(dataFolder.contains(slot.selected)){
|
||||
root += slot.selected;
|
||||
assets = new AssetsBrowser(root, getExtension());
|
||||
initGui();
|
||||
}
|
||||
else {
|
||||
close();
|
||||
NoppesUtil.openGUI(player, parent);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton){
|
||||
int id = guibutton.id;
|
||||
if(id == 2){
|
||||
close();
|
||||
NoppesUtil.openGUI(player, parent);
|
||||
}
|
||||
if(id == 3){
|
||||
root = root.substring(0,root.lastIndexOf("/"));
|
||||
assets = new AssetsBrowser(root, getExtension());
|
||||
initGui();
|
||||
public void elementClicked() {
|
||||
if (slot.selected != null && this.dataTextures.contains(slot.selected)) {
|
||||
if (parent instanceof GuiNPCInterface) {
|
||||
((GuiNPCInterface) parent).elementClicked();
|
||||
} else if (parent instanceof GuiNPCInterface2) {
|
||||
((GuiNPCInterface2) parent).elementClicked();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
}
|
||||
|
||||
public String getSelected(){
|
||||
return assets.getAsset(slot.selected);
|
||||
public void doubleClicked() {
|
||||
if (slot.selected.equals(up)) {
|
||||
root = root.substring(0, root.lastIndexOf("/"));
|
||||
assets = new AssetsBrowser(root, getExtension());
|
||||
initGui();
|
||||
} else if (dataFolder.contains(slot.selected)) {
|
||||
root += slot.selected;
|
||||
assets = new AssetsBrowser(root, getExtension());
|
||||
initGui();
|
||||
} else {
|
||||
close();
|
||||
NoppesUtil.openGUI(player, parent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
int id = guibutton.id;
|
||||
if (id == 2) {
|
||||
close();
|
||||
NoppesUtil.openGUI(player, parent);
|
||||
}
|
||||
if (id == 3) {
|
||||
root = root.substring(0, root.lastIndexOf("/"));
|
||||
assets = new AssetsBrowser(root, getExtension());
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
}
|
||||
|
||||
public String getSelected() {
|
||||
return assets.getAsset(slot.selected);
|
||||
}
|
||||
|
||||
public abstract String[] getExtension();
|
||||
}
|
||||
@@ -7,31 +7,27 @@ import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class GuiNpcTextureCloaks extends GuiNpcSelectionInterface
|
||||
{
|
||||
public GuiNpcTextureCloaks(EntityNPCInterface npc,GuiScreen parent)
|
||||
{
|
||||
super(npc, parent, npc.display.cloakTexture.isEmpty()?"customnpcs:textures/cloak/":npc.display.cloakTexture);
|
||||
title = "Select Cloak";
|
||||
public class GuiNpcTextureCloaks extends GuiNpcSelectionInterface {
|
||||
public GuiNpcTextureCloaks(EntityNPCInterface npc, GuiScreen parent) {
|
||||
super(npc, parent, npc.display.cloakTexture.isEmpty() ? "customnpcs:textures/cloak/" : npc.display.cloakTexture);
|
||||
title = "Select Cloak";
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
{
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
int index = npc.display.cloakTexture.lastIndexOf("/");
|
||||
if(index > 0){
|
||||
String asset = npc.display.cloakTexture.substring(index + 1);
|
||||
if(npc.display.cloakTexture.equals(assets.getAsset(asset)))
|
||||
slot.selected = asset;
|
||||
if (index > 0) {
|
||||
String asset = npc.display.cloakTexture.substring(index + 1);
|
||||
if (npc.display.cloakTexture.equals(assets.getAsset(asset)))
|
||||
slot.selected = asset;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void drawScreen(int i, int j, float f)
|
||||
{
|
||||
public void drawScreen(int i, int j, float f) {
|
||||
npc.isDrawn = true;
|
||||
int l = (width/2)-180;
|
||||
int i1 = (height/2) - 90;
|
||||
int l = (width / 2) - 180;
|
||||
int i1 = (height / 2) - 90;
|
||||
GL11.glEnable(32826 /*GL_RESCALE_NORMAL_EXT*/);
|
||||
GL11.glEnable(2903 /*GL_COLOR_MATERIAL*/);
|
||||
GL11.glPushMatrix();
|
||||
@@ -43,17 +39,17 @@ public class GuiNpcTextureCloaks extends GuiNpcSelectionInterface
|
||||
float f3 = npc.rotationYaw;
|
||||
float f4 = npc.rotationPitch;
|
||||
float f7 = npc.rotationYawHead;
|
||||
float f5 = (float)(l + 33) - i;
|
||||
float f6 = (float)((i1 + 131) - 50) - j;
|
||||
float f5 = (float) (l + 33) - i;
|
||||
float f6 = (float) ((i1 + 131) - 50) - j;
|
||||
GL11.glRotatef(135F, 0.0F, 1.0F, 0.0F);
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
GL11.glRotatef(-135F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(-(float)Math.atan(f6 / 40F) * 20F, 1.0F, 0.0F, 0.0F);
|
||||
npc.renderYawOffset = (float)Math.atan(f5 / 40F) * 20F + 180;
|
||||
npc.rotationYaw = (float)Math.atan(f5 / 40F) * 40f + 180;
|
||||
npc.rotationPitch = -(float)Math.atan(f6 / 40F) * 20F;
|
||||
GL11.glRotatef(-(float) Math.atan(f6 / 40F) * 20F, 1.0F, 0.0F, 0.0F);
|
||||
npc.renderYawOffset = (float) Math.atan(f5 / 40F) * 20F + 180;
|
||||
npc.rotationYaw = (float) Math.atan(f5 / 40F) * 40f + 180;
|
||||
npc.rotationPitch = -(float) Math.atan(f6 / 40F) * 20F;
|
||||
npc.rotationYawHead = npc.rotationYaw;
|
||||
npc.cloakUpdate();
|
||||
npc.cloakUpdate();
|
||||
GL11.glTranslatef(0.0F, npc.yOffset, 0.0F);
|
||||
RenderManager.instance.playerViewY = 180F;
|
||||
RenderManager.instance.renderEntityWithPosYaw(npc, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F);
|
||||
@@ -72,20 +68,21 @@ public class GuiNpcTextureCloaks extends GuiNpcSelectionInterface
|
||||
|
||||
super.drawScreen(i, j, f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void elementClicked(){
|
||||
if(dataTextures.contains(slot.selected) && slot.selected != null){
|
||||
npc.display.cloakTexture = assets.getAsset(slot.selected);
|
||||
}
|
||||
public void elementClicked() {
|
||||
if (dataTextures.contains(slot.selected) && slot.selected != null) {
|
||||
npc.display.cloakTexture = assets.getAsset(slot.selected);
|
||||
}
|
||||
}
|
||||
|
||||
public void save() {
|
||||
}
|
||||
public void save() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getExtension() {
|
||||
return new String[]{"png"};
|
||||
}
|
||||
@Override
|
||||
public String[] getExtension() {
|
||||
return new String[]{"png"};
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -8,30 +8,29 @@ import noppes.npcs.controllers.data.SkinOverlay;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class GuiNpcTextureOverlays extends GuiNpcSelectionInterface{
|
||||
public GuiNpcTextureOverlays(EntityNPCInterface npc,GuiScreen parent){
|
||||
public class GuiNpcTextureOverlays extends GuiNpcSelectionInterface {
|
||||
public GuiNpcTextureOverlays(EntityNPCInterface npc, GuiScreen parent) {
|
||||
super(npc, parent, npc.display.skinOverlayData.overlayList.containsKey(0) ? !npc.display.skinOverlayData.overlayList.get(0).getTexture().isEmpty() ? npc.display.skinOverlayData.overlayList.get(0).getTexture() : "customnpcs:textures/overlays/" : "customnpcs:textures/overlays/");
|
||||
title = "Select Overlay";
|
||||
this.parent = parent;
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public void initGui(){
|
||||
super.initGui();
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
String str = npc.display.skinOverlayData.overlayList.containsKey(0) ? npc.display.skinOverlayData.overlayList.get(0).getTexture() : "";
|
||||
int index = str.lastIndexOf("/");
|
||||
if(index > 0){
|
||||
String asset = str.substring(index + 1);
|
||||
if(str.equals(assets.getAsset(asset)))
|
||||
slot.selected = asset;
|
||||
if (index > 0) {
|
||||
String asset = str.substring(index + 1);
|
||||
if (str.equals(assets.getAsset(asset)))
|
||||
slot.selected = asset;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void drawScreen(int i, int j, float f)
|
||||
{
|
||||
public void drawScreen(int i, int j, float f) {
|
||||
npc.isDrawn = true;
|
||||
int l = (width/2)-180;
|
||||
int i1 = (height/2) - 90;
|
||||
int l = (width / 2) - 180;
|
||||
int i1 = (height / 2) - 90;
|
||||
GL11.glEnable(32826 /*GL_RESCALE_NORMAL_EXT*/);
|
||||
GL11.glEnable(2903 /*GL_COLOR_MATERIAL*/);
|
||||
GL11.glPushMatrix();
|
||||
@@ -43,15 +42,15 @@ public class GuiNpcTextureOverlays extends GuiNpcSelectionInterface{
|
||||
float f3 = npc.rotationYaw;
|
||||
float f4 = npc.rotationPitch;
|
||||
float f7 = npc.rotationYawHead;
|
||||
float f5 = (float)(l + 33) - i;
|
||||
float f6 = (float)((i1 + 131) - 50) - j;
|
||||
float f5 = (float) (l + 33) - i;
|
||||
float f6 = (float) ((i1 + 131) - 50) - j;
|
||||
GL11.glRotatef(135F, 0.0F, 1.0F, 0.0F);
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
GL11.glRotatef(-135F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(-(float)Math.atan(f6 / 40F) * 20F, 1.0F, 0.0F, 0.0F);
|
||||
npc.renderYawOffset = (float)Math.atan(f5 / 40F) * 20F;
|
||||
npc.rotationYaw = (float)Math.atan(f5 / 40F) * 40F;
|
||||
npc.rotationPitch = -(float)Math.atan(f6 / 40F) * 20F;
|
||||
GL11.glRotatef(-(float) Math.atan(f6 / 40F) * 20F, 1.0F, 0.0F, 0.0F);
|
||||
npc.renderYawOffset = (float) Math.atan(f5 / 40F) * 20F;
|
||||
npc.rotationYaw = (float) Math.atan(f5 / 40F) * 40F;
|
||||
npc.rotationPitch = -(float) Math.atan(f6 / 40F) * 20F;
|
||||
npc.rotationYawHead = npc.rotationYaw;
|
||||
//npc.updateCloak();
|
||||
GL11.glTranslatef(0.0F, npc.yOffset, 0.0F);
|
||||
@@ -74,22 +73,22 @@ public class GuiNpcTextureOverlays extends GuiNpcSelectionInterface{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void elementClicked(){
|
||||
if(dataTextures.contains(slot.selected) && slot.selected != null){
|
||||
//npc.display.glowTexture = assets.getAsset(slot.selected);
|
||||
//npc.textureGlowLocation = null;
|
||||
public void elementClicked() {
|
||||
if (dataTextures.contains(slot.selected) && slot.selected != null) {
|
||||
//npc.display.glowTexture = assets.getAsset(slot.selected);
|
||||
//npc.textureGlowLocation = null;
|
||||
|
||||
npc.display.skinOverlayData.overlayList.put(0,new SkinOverlay(assets.getAsset(slot.selected)));
|
||||
}
|
||||
npc.display.skinOverlayData.overlayList.put(0, new SkinOverlay(assets.getAsset(slot.selected)));
|
||||
}
|
||||
}
|
||||
|
||||
public void save() {
|
||||
}
|
||||
public void save() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getExtension() {
|
||||
return new String[]{"png"};
|
||||
}
|
||||
@Override
|
||||
public String[] getExtension() {
|
||||
return new String[]{"png"};
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -11,43 +11,45 @@ import noppes.npcs.client.gui.util.GuiNpcLabel;
|
||||
import noppes.npcs.client.gui.util.GuiNpcTextField;
|
||||
|
||||
|
||||
public class GuiNpcWaypoint extends GuiNPCInterface{
|
||||
public class GuiNpcWaypoint extends GuiNPCInterface {
|
||||
|
||||
private TileWaypoint tile;
|
||||
private TileWaypoint tile;
|
||||
|
||||
public GuiNpcWaypoint(int x, int y, int z) {
|
||||
super();
|
||||
tile = (TileWaypoint) player.worldObj.getTileEntity(x, y, z);
|
||||
xSize = 265;
|
||||
}
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
|
||||
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));
|
||||
addTextField(new GuiNpcTextField(1, this, fontRendererObj, guiLeft+ 60, guiTop + 92,200,20, tile.range + ""));
|
||||
getTextField(1).integersOnly = true;
|
||||
getTextField(1).setMinMaxDefault(2, 60, 10);
|
||||
|
||||
addButton(new GuiNpcButton(0, guiLeft + 40, guiTop + 190,120,20, "Done"));
|
||||
super();
|
||||
tile = (TileWaypoint) player.worldObj.getTileEntity(x, y, z);
|
||||
xSize = 265;
|
||||
}
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
int id = guibutton.id;
|
||||
if(id == 0)
|
||||
close();
|
||||
}
|
||||
@Override
|
||||
public void save() {
|
||||
tile.name = getTextField(0).getText();
|
||||
tile.range = getTextField(1).getInteger();
|
||||
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
tile.writeToNBT(compound);
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
|
||||
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));
|
||||
addTextField(new GuiNpcTextField(1, this, fontRendererObj, guiLeft + 60, guiTop + 92, 200, 20, tile.range + ""));
|
||||
getTextField(1).integersOnly = true;
|
||||
getTextField(1).setMinMaxDefault(2, 60, 10);
|
||||
|
||||
addButton(new GuiNpcButton(0, guiLeft + 40, guiTop + 190, 120, 20, "Done"));
|
||||
}
|
||||
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
int id = guibutton.id;
|
||||
if (id == 0)
|
||||
close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
tile.name = getTextField(0).getText();
|
||||
tile.range = getTextField(1).getInteger();
|
||||
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
tile.writeToNBT(compound);
|
||||
PacketClient.sendClient(new TileEntitySavePacket(compound));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -21,154 +21,152 @@ import noppes.npcs.entity.EntityNPCInterface;
|
||||
import java.util.*;
|
||||
|
||||
public class GuiScript extends GuiNPCInterface implements IGuiData, GuiYesNoCallback, ICustomScrollListener, IJTextAreaListener, ITextChangeListener {
|
||||
public boolean showScript = false;
|
||||
private int activeTab = 0;
|
||||
public DataScript script;
|
||||
public Map<String,List<String>> languages = new HashMap<String,List<String>>();
|
||||
public boolean showScript = false;
|
||||
private int activeTab = 0;
|
||||
public DataScript script;
|
||||
public Map<String, List<String>> languages = new HashMap<String, List<String>>();
|
||||
|
||||
private static int activeConsole = 0;
|
||||
private static int activeConsole = 0;
|
||||
|
||||
public GuiScript(EntityNPCInterface npc) {
|
||||
super(npc);
|
||||
script = npc.script;
|
||||
drawDefaultBackground = true;
|
||||
closeOnEsc = true;
|
||||
xSize = 420;
|
||||
public GuiScript(EntityNPCInterface npc) {
|
||||
super(npc);
|
||||
script = npc.script;
|
||||
drawDefaultBackground = true;
|
||||
closeOnEsc = true;
|
||||
xSize = 420;
|
||||
|
||||
setBackground("menubg.png");
|
||||
setBackground("menubg.png");
|
||||
NPCScriptPacket.Get();
|
||||
}
|
||||
}
|
||||
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
guiTop += 10;
|
||||
GuiMenuTopButton top;
|
||||
addTopButton(top = new GuiMenuTopButton(13, guiLeft + 4, guiTop - 17, "script.scripts"));
|
||||
addTopButton(new GuiMenuTopButton(16, guiLeft + (xSize - 102), guiTop - 17, "eventscript.eventScripts"));
|
||||
addTopButton(new GuiMenuTopButton(17, guiLeft + (xSize - 22), guiTop - 17, "X"));
|
||||
top.active = showScript;
|
||||
addTopButton(top = new GuiMenuTopButton(14, top, "gui.settings"));
|
||||
top.active = !showScript;
|
||||
addTopButton(new GuiMenuTopButton(15, top, "gui.website"));
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
guiTop += 10;
|
||||
GuiMenuTopButton top;
|
||||
addTopButton(top = new GuiMenuTopButton(13, guiLeft + 4, guiTop - 17, "script.scripts"));
|
||||
addTopButton(new GuiMenuTopButton(16, guiLeft + (xSize - 102), guiTop - 17, "eventscript.eventScripts"));
|
||||
addTopButton(new GuiMenuTopButton(17, guiLeft + (xSize - 22), guiTop - 17, "X"));
|
||||
top.active = showScript;
|
||||
addTopButton(top = new GuiMenuTopButton(14, top, "gui.settings"));
|
||||
top.active = !showScript;
|
||||
addTopButton(new GuiMenuTopButton(15, top, "gui.website"));
|
||||
|
||||
List<String> list = new ArrayList<String>();
|
||||
list.add("script.init");
|
||||
list.add("script.update");
|
||||
list.add("script.interact");
|
||||
list.add("dialog.dialog");
|
||||
list.add("script.damaged");
|
||||
list.add("script.killed");
|
||||
list.add("script.attack");
|
||||
list.add("script.target");
|
||||
list.add("script.collide");
|
||||
list.add("script.kills");
|
||||
list.add("script.dialog_closed");
|
||||
list.add("script.timer");
|
||||
list.add("script.targetLost");
|
||||
list.add("script.projectileTick");
|
||||
list.add("script.projectileImpact");
|
||||
List<String> list = new ArrayList<String>();
|
||||
list.add("script.init");
|
||||
list.add("script.update");
|
||||
list.add("script.interact");
|
||||
list.add("dialog.dialog");
|
||||
list.add("script.damaged");
|
||||
list.add("script.killed");
|
||||
list.add("script.attack");
|
||||
list.add("script.target");
|
||||
list.add("script.collide");
|
||||
list.add("script.kills");
|
||||
list.add("script.dialog_closed");
|
||||
list.add("script.timer");
|
||||
list.add("script.targetLost");
|
||||
list.add("script.projectileTick");
|
||||
list.add("script.projectileImpact");
|
||||
|
||||
if(showScript){
|
||||
addLabel(new GuiNpcLabel(0, "script.hooks", guiLeft + 4, guiTop + 5));
|
||||
GuiCustomScroll hooks = new GuiCustomScroll(this, 1);
|
||||
hooks.setSize(68, 198);
|
||||
hooks.guiLeft = guiLeft + 4;
|
||||
hooks.guiTop = guiTop + 14;
|
||||
hooks.setUnsortedList(list);
|
||||
hooks.selected = activeTab;
|
||||
addScroll(hooks);
|
||||
if (showScript) {
|
||||
addLabel(new GuiNpcLabel(0, "script.hooks", guiLeft + 4, guiTop + 5));
|
||||
GuiCustomScroll hooks = new GuiCustomScroll(this, 1);
|
||||
hooks.setSize(68, 198);
|
||||
hooks.guiLeft = guiLeft + 4;
|
||||
hooks.guiTop = guiTop + 14;
|
||||
hooks.setUnsortedList(list);
|
||||
hooks.selected = activeTab;
|
||||
addScroll(hooks);
|
||||
|
||||
ScriptContainer container = script.getNPCScript(activeTab);
|
||||
ScriptContainer container = script.getNPCScript(activeTab);
|
||||
|
||||
GuiScriptTextArea ta = new GuiScriptTextArea(this,2, guiLeft + 74, guiTop + 4, 239, 208, container == null?"":container.script);
|
||||
ta.enableCodeHighlighting();
|
||||
ta.setListener(this);
|
||||
this.addTextField(ta);
|
||||
GuiScriptTextArea ta = new GuiScriptTextArea(this, 2, guiLeft + 74, guiTop + 4, 239, 208, container == null ? "" : container.script);
|
||||
ta.enableCodeHighlighting();
|
||||
ta.setListener(this);
|
||||
this.addTextField(ta);
|
||||
|
||||
addButton(new GuiNpcButton(102, guiLeft + 315, guiTop + 4, 50, 20, "gui.clear"));
|
||||
addButton(new GuiNpcButton(101, guiLeft + 366, guiTop + 4, 50, 20, "gui.paste"));
|
||||
addButton(new GuiNpcButton(100, guiLeft + 315, guiTop + 25, 50, 20, "gui.copy"));
|
||||
addButton(new GuiNpcButton(102, guiLeft + 315, guiTop + 4, 50, 20, "gui.clear"));
|
||||
addButton(new GuiNpcButton(101, guiLeft + 366, guiTop + 4, 50, 20, "gui.paste"));
|
||||
addButton(new GuiNpcButton(100, guiLeft + 315, guiTop + 25, 50, 20, "gui.copy"));
|
||||
|
||||
addButton(new GuiNpcButton(107, guiLeft + 315, guiTop + 70, 80, 20, "script.loadscript"));
|
||||
addButton(new GuiNpcButton(107, guiLeft + 315, guiTop + 70, 80, 20, "script.loadscript"));
|
||||
|
||||
GuiCustomScroll scroll = new GuiCustomScroll(this, 0).setUnselectable();
|
||||
scroll.setSize(100, 120);
|
||||
scroll.guiLeft = guiLeft + 315;
|
||||
scroll.guiTop = guiTop + 92;
|
||||
if(container != null)
|
||||
scroll.setList(container.scripts);
|
||||
addScroll(scroll);
|
||||
}
|
||||
else{
|
||||
addLabel(new GuiNpcLabel(0, "script.console", guiLeft + 4, guiTop + 16));
|
||||
getTopButton(14).active = true;
|
||||
addTextField(new GuiNpcTextArea(2, this, guiLeft + 4, guiTop + 26, 226, 186, getConsoleText()));
|
||||
getTextField(2).canEdit = false;
|
||||
addButton(new GuiNpcButton(100, guiLeft + 232, guiTop + 170, 56, 20, "gui.copy"));
|
||||
addButton(new GuiNpcButton(102, guiLeft + 232, guiTop + 192, 56, 20, "gui.clear"));
|
||||
GuiCustomScroll scroll = new GuiCustomScroll(this, 0).setUnselectable();
|
||||
scroll.setSize(100, 120);
|
||||
scroll.guiLeft = guiLeft + 315;
|
||||
scroll.guiTop = guiTop + 92;
|
||||
if (container != null)
|
||||
scroll.setList(container.scripts);
|
||||
addScroll(scroll);
|
||||
} else {
|
||||
addLabel(new GuiNpcLabel(0, "script.console", guiLeft + 4, guiTop + 16));
|
||||
getTopButton(14).active = true;
|
||||
addTextField(new GuiNpcTextArea(2, this, guiLeft + 4, guiTop + 26, 226, 186, getConsoleText()));
|
||||
getTextField(2).canEdit = false;
|
||||
addButton(new GuiNpcButton(100, guiLeft + 232, guiTop + 170, 56, 20, "gui.copy"));
|
||||
addButton(new GuiNpcButton(102, guiLeft + 232, guiTop + 192, 56, 20, "gui.clear"));
|
||||
|
||||
List<String> l = new ArrayList<String>();
|
||||
l.add("All");
|
||||
l.addAll(list);
|
||||
addButton(new GuiNpcButton(105, guiLeft + 60, guiTop + 4, 80, 20, l.toArray(new String[l.size()]), activeConsole));
|
||||
List<String> l = new ArrayList<String>();
|
||||
l.add("All");
|
||||
l.addAll(list);
|
||||
addButton(new GuiNpcButton(105, guiLeft + 60, guiTop + 4, 80, 20, l.toArray(new String[l.size()]), activeConsole));
|
||||
|
||||
addLabel(new GuiNpcLabel(1, "script.language", guiLeft + 232, guiTop + 30));
|
||||
addButton(new GuiNpcButton(103, guiLeft + 294, guiTop + 25, 80, 20, languages.keySet().toArray(new String[languages.keySet().size()]), getScriptIndex()));
|
||||
getButton(103).enabled = languages.size() > 0;
|
||||
addLabel(new GuiNpcLabel(1, "script.language", guiLeft + 232, guiTop + 30));
|
||||
addButton(new GuiNpcButton(103, guiLeft + 294, guiTop + 25, 80, 20, languages.keySet().toArray(new String[languages.keySet().size()]), getScriptIndex()));
|
||||
getButton(103).enabled = languages.size() > 0;
|
||||
|
||||
addLabel(new GuiNpcLabel(2, "gui.enabled", guiLeft + 232, guiTop + 53));
|
||||
addButton(new GuiNpcButton(104, guiLeft + 294, guiTop + 48, 50, 20, new String[]{"gui.no","gui.yes"}, script.enabled?1:0));
|
||||
addLabel(new GuiNpcLabel(2, "gui.enabled", guiLeft + 232, guiTop + 53));
|
||||
addButton(new GuiNpcButton(104, guiLeft + 294, guiTop + 48, 50, 20, new String[]{"gui.no", "gui.yes"}, script.enabled ? 1 : 0));
|
||||
|
||||
if(MinecraftServer.getServer() != null)
|
||||
addButton(new GuiNpcButton(106, guiLeft + 232, guiTop + 71, 150, 20, "script.openfolder"));
|
||||
}
|
||||
}
|
||||
if (MinecraftServer.getServer() != null)
|
||||
addButton(new GuiNpcButton(106, guiLeft + 232, guiTop + 71, 150, 20, "script.openfolder"));
|
||||
}
|
||||
}
|
||||
|
||||
private int getScriptIndex() {
|
||||
int i = 0;
|
||||
for(String language : languages.keySet()){
|
||||
if(language.equalsIgnoreCase(script.scriptLanguage))
|
||||
return i;
|
||||
i++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
private int getScriptIndex() {
|
||||
int i = 0;
|
||||
for (String language : languages.keySet()) {
|
||||
if (language.equalsIgnoreCase(script.scriptLanguage))
|
||||
return i;
|
||||
i++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private String getConsoleText() {
|
||||
Map<Long, String> map = this.script.getOldConsoleText();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
Iterator var3 = map.entrySet().iterator();
|
||||
private String getConsoleText() {
|
||||
Map<Long, String> map = this.script.getOldConsoleText();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
Iterator var3 = map.entrySet().iterator();
|
||||
|
||||
while(var3.hasNext()) {
|
||||
Map.Entry<Long, String> entry = (Map.Entry)var3.next();
|
||||
builder.insert(0, new Date((Long)entry.getKey()) + (String)entry.getValue() + "\n");
|
||||
}
|
||||
while (var3.hasNext()) {
|
||||
Map.Entry<Long, String> entry = (Map.Entry) var3.next();
|
||||
builder.insert(0, new Date((Long) entry.getKey()) + (String) entry.getValue() + "\n");
|
||||
}
|
||||
|
||||
return builder.toString();
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void confirmClicked(boolean result, int id) {
|
||||
NoppesUtil.openGUI(player, this);
|
||||
if(!result)
|
||||
if (!result)
|
||||
return;
|
||||
if(id == 0) {
|
||||
if (id == 0) {
|
||||
openLink("https://kamkeel.github.io/CustomNPC-Plus/");
|
||||
}
|
||||
if(id == 101) {
|
||||
if (id == 101) {
|
||||
getTextField(2).setText(NoppesStringUtils.getClipboardContents());
|
||||
}
|
||||
if(id == 102) {
|
||||
if (id == 102) {
|
||||
getTextField(2).setText("");
|
||||
if(!showScript){
|
||||
if(activeConsole == 0){
|
||||
for(ScriptContainer container : script.getNPCScripts())
|
||||
if (!showScript) {
|
||||
if (activeConsole == 0) {
|
||||
for (ScriptContainer container : script.getNPCScripts())
|
||||
container.console.clear();
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
ScriptContainer container = script.getNPCScript(activeConsole - 1);
|
||||
if(container != null)
|
||||
if (container != null)
|
||||
container.console.clear();
|
||||
}
|
||||
}
|
||||
@@ -178,118 +176,118 @@ public class GuiScript extends GuiNPCInterface implements IGuiData, GuiYesNoCall
|
||||
displayGuiScreen(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
if(guibutton.id == 13){
|
||||
showScript = true;
|
||||
initGui();
|
||||
}
|
||||
if(guibutton.id == 14){
|
||||
setScript();
|
||||
showScript = false;
|
||||
initGui();
|
||||
}
|
||||
if(guibutton.id == 15){
|
||||
GuiConfirmOpenLink guiyesno = new GuiConfirmOpenLink(this, "https://kamkeel.github.io/CustomNPC-Plus/", 0, true);
|
||||
mc.displayGuiScreen(guiyesno);
|
||||
}
|
||||
if(guibutton.id == 16){
|
||||
close();
|
||||
mc.displayGuiScreen(new GuiNPCEventScripts(npc));
|
||||
}
|
||||
if(guibutton.id == 17){
|
||||
close();
|
||||
}
|
||||
if (guibutton.id == 100) {
|
||||
NoppesStringUtils.setClipboardContents(getTextField(2).getText());
|
||||
}
|
||||
if (guibutton.id == 101) {
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
if (guibutton.id == 13) {
|
||||
showScript = true;
|
||||
initGui();
|
||||
}
|
||||
if (guibutton.id == 14) {
|
||||
setScript();
|
||||
showScript = false;
|
||||
initGui();
|
||||
}
|
||||
if (guibutton.id == 15) {
|
||||
GuiConfirmOpenLink guiyesno = new GuiConfirmOpenLink(this, "https://kamkeel.github.io/CustomNPC-Plus/", 0, true);
|
||||
mc.displayGuiScreen(guiyesno);
|
||||
}
|
||||
if (guibutton.id == 16) {
|
||||
close();
|
||||
mc.displayGuiScreen(new GuiNPCEventScripts(npc));
|
||||
}
|
||||
if (guibutton.id == 17) {
|
||||
close();
|
||||
}
|
||||
if (guibutton.id == 100) {
|
||||
NoppesStringUtils.setClipboardContents(getTextField(2).getText());
|
||||
}
|
||||
if (guibutton.id == 101) {
|
||||
GuiYesNo guiyesno = new GuiYesNo(this, StatCollector.translateToLocal("gui.paste"), StatCollector.translateToLocal("gui.sure"), 101);
|
||||
displayGuiScreen(guiyesno);
|
||||
}
|
||||
if (guibutton.id == 102) {
|
||||
}
|
||||
if (guibutton.id == 102) {
|
||||
GuiYesNo guiyesno = new GuiYesNo(this, StatCollector.translateToLocal("gui.clear"), StatCollector.translateToLocal("gui.sure"), 102);
|
||||
displayGuiScreen(guiyesno);
|
||||
}
|
||||
if (guibutton.id == 103) {
|
||||
script.scriptLanguage = ((GuiNpcButton)guibutton).displayString;
|
||||
}
|
||||
if (guibutton.id == 104) {
|
||||
script.enabled = ((GuiNpcButton)guibutton).getValue() == 1;
|
||||
}
|
||||
if (guibutton.id == 105) {
|
||||
activeConsole = ((GuiNpcButton)guibutton).getValue();
|
||||
initGui();
|
||||
}
|
||||
if (guibutton.id == 106) {
|
||||
NoppesUtil.openFolder(ScriptController.Instance.dir);
|
||||
}
|
||||
if (guibutton.id == 107) {
|
||||
ScriptContainer container = script.getNPCScript(activeTab);
|
||||
if(container == null)
|
||||
script.setNPCScript(activeTab, container = new ScriptContainer(this.script));
|
||||
setSubGui(new GuiScriptList(languages.get(script.scriptLanguage), container));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (guibutton.id == 103) {
|
||||
script.scriptLanguage = ((GuiNpcButton) guibutton).displayString;
|
||||
}
|
||||
if (guibutton.id == 104) {
|
||||
script.enabled = ((GuiNpcButton) guibutton).getValue() == 1;
|
||||
}
|
||||
if (guibutton.id == 105) {
|
||||
activeConsole = ((GuiNpcButton) guibutton).getValue();
|
||||
initGui();
|
||||
}
|
||||
if (guibutton.id == 106) {
|
||||
NoppesUtil.openFolder(ScriptController.Instance.dir);
|
||||
}
|
||||
if (guibutton.id == 107) {
|
||||
ScriptContainer container = script.getNPCScript(activeTab);
|
||||
if (container == null)
|
||||
script.setNPCScript(activeTab, container = new ScriptContainer(this.script));
|
||||
setSubGui(new GuiScriptList(languages.get(script.scriptLanguage), container));
|
||||
}
|
||||
}
|
||||
|
||||
private void setScript(){
|
||||
if(showScript){
|
||||
ScriptContainer container = script.getNPCScript(activeTab);
|
||||
if(container == null)
|
||||
script.setNPCScript(activeTab, container = new ScriptContainer(this.script));
|
||||
String text = getTextField(2).getText();
|
||||
text = text.replace("\r\n", "\n");
|
||||
text = text.replace("\r", "\n");
|
||||
container.script = text;
|
||||
}
|
||||
}
|
||||
private void setScript() {
|
||||
if (showScript) {
|
||||
ScriptContainer container = script.getNPCScript(activeTab);
|
||||
if (container == null)
|
||||
script.setNPCScript(activeTab, container = new ScriptContainer(this.script));
|
||||
String text = getTextField(2).getText();
|
||||
text = text.replace("\r\n", "\n");
|
||||
text = text.replace("\r", "\n");
|
||||
container.script = text;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
script.readFromNBT(compound);
|
||||
NBTTagList data = compound.getTagList("Languages", 10);
|
||||
Map<String,List<String>> languages = new HashMap<String,List<String>>();
|
||||
for(int i = 0; i < data.tagCount(); i++){
|
||||
NBTTagCompound comp = data.getCompoundTagAt(i);
|
||||
List<String> scripts = new ArrayList<String>();
|
||||
NBTTagList list = comp.getTagList("Scripts", 8);
|
||||
for(int j = 0; j < list.tagCount(); j++){
|
||||
scripts.add(list.getStringTagAt(j));
|
||||
}
|
||||
languages.put(comp.getString("Language"), scripts);
|
||||
}
|
||||
this.languages = languages;
|
||||
initGui();
|
||||
}
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
script.readFromNBT(compound);
|
||||
NBTTagList data = compound.getTagList("Languages", 10);
|
||||
Map<String, List<String>> languages = new HashMap<String, List<String>>();
|
||||
for (int i = 0; i < data.tagCount(); i++) {
|
||||
NBTTagCompound comp = data.getCompoundTagAt(i);
|
||||
List<String> scripts = new ArrayList<String>();
|
||||
NBTTagList list = comp.getTagList("Scripts", 8);
|
||||
for (int j = 0; j < list.tagCount(); j++) {
|
||||
scripts.add(list.getStringTagAt(j));
|
||||
}
|
||||
languages.put(comp.getString("Language"), scripts);
|
||||
}
|
||||
this.languages = languages;
|
||||
initGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
setScript();
|
||||
@Override
|
||||
public void save() {
|
||||
setScript();
|
||||
NPCScriptPacket.Save(script.writeToNBT(new NBTTagCompound()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void customScrollClicked(int i, int j, int k, GuiCustomScroll scroll) {
|
||||
if(scroll.id == 1){
|
||||
setScript();
|
||||
activeTab = scroll.selected;
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void customScrollClicked(int i, int j, int k, GuiCustomScroll scroll) {
|
||||
if (scroll.id == 1) {
|
||||
setScript();
|
||||
activeTab = scroll.selected;
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
|
||||
public void textUpdate(String text) {
|
||||
ScriptContainer container = script.getNPCScript(activeTab);
|
||||
if(container != null)
|
||||
container.script = text;
|
||||
}
|
||||
public void textUpdate(String text) {
|
||||
ScriptContainer container = script.getNPCScript(activeTab);
|
||||
if (container != null)
|
||||
container.script = text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveText(String text) {
|
||||
ScriptContainer container = script.getNPCScript(activeTab);
|
||||
if(container != null)
|
||||
container.script = text;
|
||||
initGui();
|
||||
}
|
||||
@Override
|
||||
public void saveText(String text) {
|
||||
ScriptContainer container = script.getNPCScript(activeTab);
|
||||
if (container != null)
|
||||
container.script = text;
|
||||
initGui();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,36 +10,37 @@ import noppes.npcs.controllers.ScriptContainer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class GuiScriptList extends SubGuiInterface{
|
||||
private GuiCustomScroll scroll1;
|
||||
private GuiCustomScroll scroll2;
|
||||
private ScriptContainer container;
|
||||
private List<String> scripts;
|
||||
public class GuiScriptList extends SubGuiInterface {
|
||||
private GuiCustomScroll scroll1;
|
||||
private GuiCustomScroll scroll2;
|
||||
private ScriptContainer container;
|
||||
private List<String> scripts;
|
||||
|
||||
public GuiScriptList(List<String> scripts, ScriptContainer container){
|
||||
this.container = container;
|
||||
setBackground("menubg.png");
|
||||
xSize = 346;
|
||||
ySize = 216;
|
||||
if(scripts == null)
|
||||
scripts = new ArrayList<String>();
|
||||
this.scripts = scripts;
|
||||
}
|
||||
@Override
|
||||
public void initGui(){
|
||||
super.initGui();
|
||||
if(scroll1 == null){
|
||||
scroll1 = new GuiCustomScroll(this,0);
|
||||
scroll1.setSize(140, 180);
|
||||
public GuiScriptList(List<String> scripts, ScriptContainer container) {
|
||||
this.container = container;
|
||||
setBackground("menubg.png");
|
||||
xSize = 346;
|
||||
ySize = 216;
|
||||
if (scripts == null)
|
||||
scripts = new ArrayList<String>();
|
||||
this.scripts = scripts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
if (scroll1 == null) {
|
||||
scroll1 = new GuiCustomScroll(this, 0);
|
||||
scroll1.setSize(140, 180);
|
||||
}
|
||||
scroll1.guiLeft = guiLeft + 4;
|
||||
scroll1.guiTop = guiTop + 14;
|
||||
this.addScroll(scroll1);
|
||||
addLabel(new GuiNpcLabel(1, "script.availableScripts", guiLeft + 4, guiTop + 4));
|
||||
|
||||
if(scroll2 == null){
|
||||
scroll2 = new GuiCustomScroll(this,1);
|
||||
scroll2.setSize(140, 180);
|
||||
if (scroll2 == null) {
|
||||
scroll2 = new GuiCustomScroll(this, 1);
|
||||
scroll2.setSize(140, 180);
|
||||
}
|
||||
scroll2.guiLeft = guiLeft + 200;
|
||||
scroll2.guiTop = guiTop + 14;
|
||||
@@ -50,54 +51,55 @@ public class GuiScriptList extends SubGuiInterface{
|
||||
scroll1.setList(temp);
|
||||
scroll2.setList(container.scripts);
|
||||
|
||||
addButton(new GuiNpcButton(1, guiLeft + 145, guiTop + 40, 55, 20, ">"));
|
||||
addButton(new GuiNpcButton(2, guiLeft + 145, guiTop + 62, 55, 20, "<"));
|
||||
addButton(new GuiNpcButton(1, guiLeft + 145, guiTop + 40, 55, 20, ">"));
|
||||
addButton(new GuiNpcButton(2, guiLeft + 145, guiTop + 62, 55, 20, "<"));
|
||||
|
||||
addButton(new GuiNpcButton(3, guiLeft + 145, guiTop + 90, 55, 20, ">>"));
|
||||
addButton(new GuiNpcButton(4, guiLeft + 145, guiTop + 112, 55, 20, "<<"));
|
||||
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"));
|
||||
}
|
||||
addButton(new GuiNpcButton(66, guiLeft + 260, guiTop + 194, 60, 20, "gui.done"));
|
||||
}
|
||||
|
||||
protected void actionPerformed(GuiButton guibutton){
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
if(button.id == 1){
|
||||
if(scroll1.hasSelected()){
|
||||
container.scripts.add(scroll1.getSelected());
|
||||
scroll1.selected = -1;
|
||||
scroll2.selected = -1;
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
if(button.id == 2){
|
||||
if(scroll2.hasSelected()){
|
||||
container.scripts.remove(scroll2.getSelected());
|
||||
scroll2.selected = -1;
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
if(button.id == 3){
|
||||
container.scripts.clear();
|
||||
for(String script : scripts){
|
||||
container.scripts.add(script);
|
||||
}
|
||||
scroll1.selected = -1;
|
||||
scroll2.selected = -1;
|
||||
initGui();
|
||||
}
|
||||
if(button.id == 4){
|
||||
container.scripts.clear();
|
||||
scroll1.selected = -1;
|
||||
scroll2.selected = -1;
|
||||
initGui();
|
||||
}
|
||||
if(button.id == 66){
|
||||
close();
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
if (button.id == 1) {
|
||||
if (scroll1.hasSelected()) {
|
||||
container.scripts.add(scroll1.getSelected());
|
||||
scroll1.selected = -1;
|
||||
scroll2.selected = -1;
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
if (button.id == 2) {
|
||||
if (scroll2.hasSelected()) {
|
||||
container.scripts.remove(scroll2.getSelected());
|
||||
scroll2.selected = -1;
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
if (button.id == 3) {
|
||||
container.scripts.clear();
|
||||
for (String script : scripts) {
|
||||
container.scripts.add(script);
|
||||
}
|
||||
scroll1.selected = -1;
|
||||
scroll2.selected = -1;
|
||||
initGui();
|
||||
}
|
||||
if (button.id == 4) {
|
||||
container.scripts.clear();
|
||||
scroll1.selected = -1;
|
||||
scroll2.selected = -1;
|
||||
initGui();
|
||||
}
|
||||
if (button.id == 66) {
|
||||
close();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void save() {
|
||||
|
||||
}
|
||||
@Override
|
||||
public void save() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -43,7 +43,7 @@ public class SubGuiAnimationFrame extends SubGuiInterface implements ITextfieldL
|
||||
return;
|
||||
}
|
||||
|
||||
int value = ((GuiNpcButton)guibutton).getValue();
|
||||
int value = ((GuiNpcButton) guibutton).getValue();
|
||||
if (guibutton.id == 10) {
|
||||
editingFrame.setCustomized(!editingFrame.isCustomized());
|
||||
} else if (guibutton.id == 12) {
|
||||
|
||||
@@ -34,7 +34,7 @@ public class SubGuiAnimationOptions extends SubGuiInterface {
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
super.actionPerformed(guibutton);
|
||||
int value = ((GuiNpcButton)guibutton).getValue();
|
||||
int value = ((GuiNpcButton) guibutton).getValue();
|
||||
|
||||
if (guibutton.id == 11) {
|
||||
animation.whileStanding = value == 0;
|
||||
|
||||
@@ -18,7 +18,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
public class SubGuiClonerNPCTags extends SubGuiInterface implements IGuiData,IScrollData {
|
||||
public class SubGuiClonerNPCTags extends SubGuiInterface implements IGuiData, IScrollData {
|
||||
private GuiCustomScroll scrollTags;
|
||||
private GuiCustomScroll npcTags;
|
||||
private final ArrayList<String> allTags = new ArrayList<>();
|
||||
@@ -27,8 +27,7 @@ public class SubGuiClonerNPCTags extends SubGuiInterface implements IGuiData,ISc
|
||||
private final EntityNPCInterface npc;
|
||||
private GuiNpcMobSpawnerAdd mobSpawnerAdd;
|
||||
|
||||
public SubGuiClonerNPCTags(EntityNPCInterface npc, GuiNpcMobSpawnerAdd guiNpcMobSpawnerAdd)
|
||||
{
|
||||
public SubGuiClonerNPCTags(EntityNPCInterface npc, GuiNpcMobSpawnerAdd guiNpcMobSpawnerAdd) {
|
||||
this.parent = guiNpcMobSpawnerAdd;
|
||||
this.mobSpawnerAdd = guiNpcMobSpawnerAdd;
|
||||
PacketClient.sendClient(new TagsGetPacket());
|
||||
@@ -40,15 +39,14 @@ public class SubGuiClonerNPCTags extends SubGuiInterface implements IGuiData,ISc
|
||||
closeOnEsc = true;
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
{
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
addLabel(new GuiNpcLabel(5, npc.display.name + " " + StatCollector.translateToLocal("tags.tags"), guiLeft + 10, guiTop + 8));
|
||||
|
||||
addLabel(new GuiNpcLabel(1, StatCollector.translateToLocal("tags.allTags"), guiLeft + 10, guiTop + 22));
|
||||
if(scrollTags == null){
|
||||
scrollTags = new GuiCustomScroll(this,0);
|
||||
if (scrollTags == null) {
|
||||
scrollTags = new GuiCustomScroll(this, 0);
|
||||
scrollTags.setSize(110, 145);
|
||||
}
|
||||
scrollTags.guiLeft = guiLeft + 10;
|
||||
@@ -57,8 +55,8 @@ public class SubGuiClonerNPCTags extends SubGuiInterface implements IGuiData,ISc
|
||||
addTextField(new GuiNpcTextField(4, this, fontRendererObj, guiLeft + 10, guiTop + 24 + 160, 110, 20, search));
|
||||
|
||||
addLabel(new GuiNpcLabel(2, StatCollector.translateToLocal("tags.selectedTags"), guiLeft + 185, guiTop + 22));
|
||||
if(npcTags == null){
|
||||
npcTags = new GuiCustomScroll(this,1);
|
||||
if (npcTags == null) {
|
||||
npcTags = new GuiCustomScroll(this, 1);
|
||||
npcTags.setSize(110, 170);
|
||||
}
|
||||
npcTags.guiLeft = guiLeft + 185;
|
||||
@@ -98,14 +96,13 @@ public class SubGuiClonerNPCTags extends SubGuiInterface implements IGuiData,ISc
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close(){
|
||||
public void close() {
|
||||
super.close();
|
||||
save();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(Vector<String> list, HashMap<String, Integer> data, EnumScrollData type)
|
||||
{
|
||||
public void setData(Vector<String> list, HashMap<String, Integer> data, EnumScrollData type) {
|
||||
allTags.addAll(data.keySet());
|
||||
allTags.sort(String.CASE_INSENSITIVE_ORDER);
|
||||
scrollTags.setList(allTags);
|
||||
@@ -114,17 +111,16 @@ public class SubGuiClonerNPCTags extends SubGuiInterface implements IGuiData,ISc
|
||||
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
NBTTagList tagList = compound.getTagList("TagNames",8);
|
||||
NBTTagList tagList = compound.getTagList("TagNames", 8);
|
||||
tagNames.clear();
|
||||
for (int i = 0; i < tagList.tagCount(); i++) {
|
||||
tagNames.add(tagList.getStringTagAt(i));
|
||||
}
|
||||
}
|
||||
|
||||
public void mouseClicked(int i, int j, int k)
|
||||
{
|
||||
public void mouseClicked(int i, int j, int k) {
|
||||
super.mouseClicked(i, j, k);
|
||||
if(k == 0 && scrollTags != null)
|
||||
if (k == 0 && scrollTags != null)
|
||||
scrollTags.mouseClicked(i, j, k);
|
||||
}
|
||||
|
||||
@@ -140,33 +136,32 @@ public class SubGuiClonerNPCTags extends SubGuiInterface implements IGuiData,ISc
|
||||
NBTTagList UUIDTagList = new NBTTagList();
|
||||
for (String string : this.tagNames) {
|
||||
tagList.appendTag(new NBTTagString(string));
|
||||
if(GuiNpcMobSpawnerAdd.tagMap.containsKey(string))
|
||||
if (GuiNpcMobSpawnerAdd.tagMap.containsKey(string))
|
||||
UUIDTagList.appendTag(new NBTTagString(GuiNpcMobSpawnerAdd.tagMap.get(string).toString()));
|
||||
}
|
||||
|
||||
GuiNpcMobSpawnerAdd.tagsCompound = UUIDTagList;
|
||||
tagCompound.setTag("TagNames",tagList);
|
||||
tagCompound.setTag("TagNames", tagList);
|
||||
PacketClient.sendClient(new TagSetPacket(tagCompound));
|
||||
}
|
||||
|
||||
public void keyTyped(char c, int i)
|
||||
{
|
||||
public void keyTyped(char c, int i) {
|
||||
super.keyTyped(c, i);
|
||||
if(getTextField(4) != null){
|
||||
if(search.equals(getTextField(4).getText()))
|
||||
if (getTextField(4) != null) {
|
||||
if (search.equals(getTextField(4).getText()))
|
||||
return;
|
||||
search = getTextField(4).getText().toLowerCase();
|
||||
scrollTags.setList(getSearchList());
|
||||
}
|
||||
}
|
||||
|
||||
private List<String> getSearchList(){
|
||||
if(search.isEmpty()){
|
||||
private List<String> getSearchList() {
|
||||
if (search.isEmpty()) {
|
||||
return new ArrayList<String>(allTags);
|
||||
}
|
||||
List<String> list = new ArrayList<String>();
|
||||
for(String name : this.allTags){
|
||||
if(name.toLowerCase().contains(search))
|
||||
for (String name : this.allTags) {
|
||||
if (name.toLowerCase().contains(search))
|
||||
list.add(name);
|
||||
}
|
||||
return list;
|
||||
|
||||
@@ -7,116 +7,114 @@ import noppes.npcs.constants.EnumScrollData;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class SubGuiClonerQuickTags extends SubGuiInterface implements IScrollData
|
||||
{
|
||||
public GuiNpcMobSpawnerAdd parent;
|
||||
public GuiCustomScroll quickScroll = new GuiCustomScroll(this,0);
|
||||
public GuiCustomScroll selectedScroll = new GuiCustomScroll(this,5);
|
||||
private static String quickSearch = "";
|
||||
public class SubGuiClonerQuickTags extends SubGuiInterface implements IScrollData {
|
||||
public GuiNpcMobSpawnerAdd parent;
|
||||
public GuiCustomScroll quickScroll = new GuiCustomScroll(this, 0);
|
||||
public GuiCustomScroll selectedScroll = new GuiCustomScroll(this, 5);
|
||||
private static String quickSearch = "";
|
||||
|
||||
public SubGuiClonerQuickTags(GuiNpcMobSpawnerAdd par){
|
||||
this.parent = par;
|
||||
setBackground("menubg.png");
|
||||
xSize = 305;
|
||||
ySize = 220;
|
||||
closeOnEsc = true;
|
||||
public SubGuiClonerQuickTags(GuiNpcMobSpawnerAdd par) {
|
||||
this.parent = par;
|
||||
setBackground("menubg.png");
|
||||
xSize = 305;
|
||||
ySize = 220;
|
||||
closeOnEsc = true;
|
||||
}
|
||||
|
||||
public void initGui(){
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
quickScroll.clear();
|
||||
quickScroll.setSize(140, 166);
|
||||
quickScroll.guiLeft = guiLeft + 4;
|
||||
quickScroll.guiTop = guiTop + 19;
|
||||
quickScroll.multipleSelection = true;
|
||||
quickScroll.setSelectedList(GuiNpcMobSpawnerAdd.addTags);
|
||||
quickScroll.clear();
|
||||
quickScroll.setSize(140, 166);
|
||||
quickScroll.guiLeft = guiLeft + 4;
|
||||
quickScroll.guiTop = guiTop + 19;
|
||||
quickScroll.multipleSelection = true;
|
||||
quickScroll.setSelectedList(GuiNpcMobSpawnerAdd.addTags);
|
||||
this.addScroll(quickScroll);
|
||||
|
||||
addLabel(new GuiNpcLabel(1, StatCollector.translateToLocal("cloner.wandTags"), guiLeft + 7, guiTop + 7));
|
||||
addScroll(quickScroll);
|
||||
addTextField(new GuiNpcTextField(2, this, fontRendererObj, guiLeft + 4, guiTop + 190, 140, 20, quickSearch));
|
||||
addLabel(new GuiNpcLabel(1, StatCollector.translateToLocal("cloner.wandTags"), guiLeft + 7, guiTop + 7));
|
||||
addScroll(quickScroll);
|
||||
addTextField(new GuiNpcTextField(2, this, fontRendererObj, guiLeft + 4, guiTop + 190, 140, 20, quickSearch));
|
||||
|
||||
addButton(new GuiNpcButton(10, guiLeft + 150, guiTop + 20, 120, 20, "gui.selectAll"));
|
||||
addButton(new GuiNpcButton(11, guiLeft + 150, guiTop + 43, 120, 20, "gui.deselectAll"));
|
||||
addButton(new GuiNpcButton(10, guiLeft + 150, guiTop + 20, 120, 20, "gui.selectAll"));
|
||||
addButton(new GuiNpcButton(11, guiLeft + 150, guiTop + 43, 120, 20, "gui.deselectAll"));
|
||||
|
||||
selectedScroll.clear();
|
||||
selectedScroll.setSize(145, 103);
|
||||
selectedScroll.guiLeft = guiLeft + 150;
|
||||
selectedScroll.guiTop = guiTop + 82;
|
||||
selectedScroll.setUnselectable();
|
||||
this.addScroll(selectedScroll);
|
||||
selectedScroll.clear();
|
||||
selectedScroll.setSize(145, 103);
|
||||
selectedScroll.guiLeft = guiLeft + 150;
|
||||
selectedScroll.guiTop = guiTop + 82;
|
||||
selectedScroll.setUnselectable();
|
||||
this.addScroll(selectedScroll);
|
||||
|
||||
addLabel(new GuiNpcLabel(3, StatCollector.translateToLocal("tags.selectedTags"), guiLeft + 153, guiTop + 68));
|
||||
addScroll(selectedScroll);
|
||||
addLabel(new GuiNpcLabel(3, StatCollector.translateToLocal("tags.selectedTags"), guiLeft + 153, guiTop + 68));
|
||||
addScroll(selectedScroll);
|
||||
|
||||
addButton(new GuiNpcButton(66, guiLeft + 240, guiTop + 190, 60, 20, "gui.done"));
|
||||
addButton(new GuiNpcButton(66, guiLeft + 240, guiTop + 190, 60, 20, "gui.done"));
|
||||
|
||||
setSelected();
|
||||
refreshSelected();
|
||||
setSelected();
|
||||
refreshSelected();
|
||||
}
|
||||
protected void actionPerformed(GuiButton guibutton){
|
||||
if (guibutton.id == 10) {
|
||||
GuiNpcMobSpawnerAdd.addTags = new HashSet<>(parent.allTags);
|
||||
quickScroll.setSelectedList(GuiNpcMobSpawnerAdd.addTags);
|
||||
refreshSelected();
|
||||
}
|
||||
if (guibutton.id == 11) {
|
||||
GuiNpcMobSpawnerAdd.addTags = new HashSet<>();
|
||||
quickScroll.setSelectedList(GuiNpcMobSpawnerAdd.addTags);
|
||||
refreshSelected();
|
||||
}
|
||||
if (guibutton.id == 66) {
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int i, int j, int k)
|
||||
{
|
||||
super.mouseClicked(i, j, k);
|
||||
refreshSelected();
|
||||
}
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
if (guibutton.id == 10) {
|
||||
GuiNpcMobSpawnerAdd.addTags = new HashSet<>(parent.allTags);
|
||||
quickScroll.setSelectedList(GuiNpcMobSpawnerAdd.addTags);
|
||||
refreshSelected();
|
||||
}
|
||||
if (guibutton.id == 11) {
|
||||
GuiNpcMobSpawnerAdd.addTags = new HashSet<>();
|
||||
quickScroll.setSelectedList(GuiNpcMobSpawnerAdd.addTags);
|
||||
refreshSelected();
|
||||
}
|
||||
if (guibutton.id == 66) {
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
public void setSelected(){
|
||||
quickScroll.setList(getQuickTags());
|
||||
}
|
||||
@Override
|
||||
public void mouseClicked(int i, int j, int k) {
|
||||
super.mouseClicked(i, j, k);
|
||||
refreshSelected();
|
||||
}
|
||||
|
||||
public void refreshSelected(){
|
||||
List<String> sortedList = new ArrayList<>(new TreeSet<>(GuiNpcMobSpawnerAdd.addTags));
|
||||
selectedScroll.setList(sortedList);
|
||||
}
|
||||
public void setSelected() {
|
||||
quickScroll.setList(getQuickTags());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyTyped(char c, int i)
|
||||
{
|
||||
super.keyTyped(c, i);
|
||||
if(getTextField(2) != null){
|
||||
if(quickSearch.equals(getTextField(2).getText()))
|
||||
return;
|
||||
quickSearch = getTextField(2).getText().toLowerCase();
|
||||
quickScroll.setList(getQuickTags());
|
||||
}
|
||||
}
|
||||
public void refreshSelected() {
|
||||
List<String> sortedList = new ArrayList<>(new TreeSet<>(GuiNpcMobSpawnerAdd.addTags));
|
||||
selectedScroll.setList(sortedList);
|
||||
}
|
||||
|
||||
private List<String> getQuickTags(){
|
||||
if(quickSearch.isEmpty()){
|
||||
return new ArrayList<String>(parent.allTags);
|
||||
}
|
||||
List<String> list = new ArrayList<String>();
|
||||
for(String name : this.parent.allTags){
|
||||
if(name.toLowerCase().contains(quickSearch))
|
||||
list.add(name);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@Override
|
||||
public void keyTyped(char c, int i) {
|
||||
super.keyTyped(c, i);
|
||||
if (getTextField(2) != null) {
|
||||
if (quickSearch.equals(getTextField(2).getText()))
|
||||
return;
|
||||
quickSearch = getTextField(2).getText().toLowerCase();
|
||||
quickScroll.setList(getQuickTags());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(Vector<String> list, HashMap<String, Integer> data, EnumScrollData type) {
|
||||
private List<String> getQuickTags() {
|
||||
if (quickSearch.isEmpty()) {
|
||||
return new ArrayList<String>(parent.allTags);
|
||||
}
|
||||
List<String> list = new ArrayList<String>();
|
||||
for (String name : this.parent.allTags) {
|
||||
if (name.toLowerCase().contains(quickSearch))
|
||||
list.add(name);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public void setData(Vector<String> list, HashMap<String, Integer> data, EnumScrollData type) {
|
||||
|
||||
@Override
|
||||
public void setSelected(String selected) {
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public void setSelected(String selected) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -14,117 +14,114 @@ import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
public class SubGuiColorSelector extends SubGuiInterface implements ITextfieldListener{
|
||||
public class SubGuiColorSelector extends SubGuiInterface implements ITextfieldListener {
|
||||
|
||||
private final static ResourceLocation resource = new ResourceLocation("customnpcs:textures/gui/color.png");
|
||||
|
||||
private int colorX, colorY;
|
||||
|
||||
private GuiNpcTextField textfield;
|
||||
|
||||
public int color;
|
||||
private final static ResourceLocation resource = new ResourceLocation("customnpcs:textures/gui/color.png");
|
||||
|
||||
public SubGuiColorSelector(int color){
|
||||
xSize = 176;
|
||||
ySize = 222;
|
||||
this.color = color;
|
||||
setBackground("smallbg.png");
|
||||
}
|
||||
private int colorX, colorY;
|
||||
|
||||
private GuiNpcTextField textfield;
|
||||
|
||||
public int color;
|
||||
|
||||
public SubGuiColorSelector(int color) {
|
||||
xSize = 176;
|
||||
ySize = 222;
|
||||
this.color = color;
|
||||
setBackground("smallbg.png");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
colorX = guiLeft + 30;
|
||||
colorY = guiTop + 50;
|
||||
|
||||
this.addTextField(textfield = new GuiNpcTextField(0, this, guiLeft + 53, guiTop + 20, 70, 20, getColor()));
|
||||
textfield.setTextColor(color);
|
||||
super.initGui();
|
||||
colorX = guiLeft + 30;
|
||||
colorY = guiTop + 50;
|
||||
|
||||
addButton(new GuiNpcButton(66, guiLeft + 112, guiTop + 198, 60, 20, "gui.done"));
|
||||
this.addTextField(textfield = new GuiNpcTextField(0, this, guiLeft + 53, guiTop + 20, 70, 20, getColor()));
|
||||
textfield.setTextColor(color);
|
||||
|
||||
addButton(new GuiNpcButton(66, guiLeft + 112, guiTop + 198, 60, 20, "gui.done"));
|
||||
}
|
||||
|
||||
public String getColor(){
|
||||
String str = Integer.toHexString(color);
|
||||
while(str.length() < 6)
|
||||
str = "0" + str;
|
||||
return str;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyTyped(char c, int i){
|
||||
String prev = textfield.getText();
|
||||
super.keyTyped(c, i);
|
||||
String newText = textfield.getText();
|
||||
if(newText.equals(prev))
|
||||
return;
|
||||
try{
|
||||
color = Integer.parseInt(textfield.getText(),16);
|
||||
textfield.setTextColor(color);
|
||||
}
|
||||
catch(NumberFormatException e){
|
||||
textfield.setText(prev);
|
||||
}
|
||||
|
||||
public String getColor() {
|
||||
String str = Integer.toHexString(color);
|
||||
while (str.length() < 6)
|
||||
str = "0" + str;
|
||||
return str;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton btn) {
|
||||
super.actionPerformed(btn);
|
||||
if(btn.id == 66){
|
||||
close();
|
||||
public void keyTyped(char c, int i) {
|
||||
String prev = textfield.getText();
|
||||
super.keyTyped(c, i);
|
||||
String newText = textfield.getText();
|
||||
if (newText.equals(prev))
|
||||
return;
|
||||
try {
|
||||
color = Integer.parseInt(textfield.getText(), 16);
|
||||
textfield.setTextColor(color);
|
||||
} catch (NumberFormatException e) {
|
||||
textfield.setText(prev);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close(){
|
||||
protected void actionPerformed(GuiButton btn) {
|
||||
super.actionPerformed(btn);
|
||||
if (btn.id == 66) {
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
super.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int par1, int par2, float par3){
|
||||
super.drawScreen(par1, par2, par3);
|
||||
public void drawScreen(int par1, int par2, float par3) {
|
||||
super.drawScreen(par1, par2, par3);
|
||||
|
||||
mc.getTextureManager().bindTexture(resource);
|
||||
|
||||
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
this.drawTexturedModalRect(colorX, colorY, 0, 0, 120, 120);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int i, int j, int k){
|
||||
super.mouseClicked(i, j, k);
|
||||
if( i < colorX || i > colorX + 117 || j < colorY || j > colorY + 117)
|
||||
return;
|
||||
InputStream stream = null;
|
||||
try {
|
||||
IResource iresource = this.mc.getResourceManager().getResource(resource);
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int i, int j, int k) {
|
||||
super.mouseClicked(i, j, k);
|
||||
if (i < colorX || i > colorX + 117 || j < colorY || j > colorY + 117)
|
||||
return;
|
||||
InputStream stream = null;
|
||||
try {
|
||||
IResource iresource = this.mc.getResourceManager().getResource(resource);
|
||||
BufferedImage bufferedimage = ImageIO.read(stream = iresource.getInputStream());
|
||||
color = bufferedimage.getRGB((i - guiLeft - 30) * 4, (j - guiTop - 50) * 4) & 16777215;
|
||||
textfield.setTextColor(color);
|
||||
textfield.setText(getColor());
|
||||
|
||||
} catch (IOException e) {
|
||||
}
|
||||
finally{
|
||||
if(stream != null){
|
||||
try {
|
||||
stream.close();
|
||||
} catch (IOException e) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
color = bufferedimage.getRGB((i - guiLeft - 30) * 4, (j - guiTop - 50) * 4) & 16777215;
|
||||
textfield.setTextColor(color);
|
||||
textfield.setText(getColor());
|
||||
|
||||
} catch (IOException e) {
|
||||
} finally {
|
||||
if (stream != null) {
|
||||
try {
|
||||
stream.close();
|
||||
} catch (IOException e) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unFocused(GuiNpcTextField textfield) {
|
||||
int color = 0;
|
||||
try{
|
||||
color = Integer.parseInt(textfield.getText(),16);
|
||||
}
|
||||
catch(NumberFormatException e){
|
||||
color = 0;
|
||||
}
|
||||
this.color = color;
|
||||
textfield.setTextColor(color);
|
||||
}
|
||||
@Override
|
||||
public void unFocused(GuiNpcTextField textfield) {
|
||||
int color = 0;
|
||||
try {
|
||||
color = Integer.parseInt(textfield.getText(), 16);
|
||||
} catch (NumberFormatException e) {
|
||||
color = 0;
|
||||
}
|
||||
this.color = color;
|
||||
textfield.setTextColor(color);
|
||||
}
|
||||
}
|
||||
@@ -4,10 +4,10 @@ import net.minecraft.client.gui.GuiButton;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.controllers.data.HitboxData;
|
||||
|
||||
public class SubGuiCustomHitbox extends SubGuiInterface implements ITextfieldListener
|
||||
{
|
||||
public class SubGuiCustomHitbox extends SubGuiInterface implements ITextfieldListener {
|
||||
private final HitboxData hitboxData;
|
||||
public SubGuiCustomHitbox(HitboxData hitboxData){
|
||||
|
||||
public SubGuiCustomHitbox(HitboxData hitboxData) {
|
||||
this.hitboxData = hitboxData;
|
||||
setBackground("menubg.png");
|
||||
xSize = 256;
|
||||
@@ -16,43 +16,43 @@ public class SubGuiCustomHitbox extends SubGuiInterface implements ITextfieldLis
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui(){
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
addLabel(new GuiNpcLabel(0,"hitbox.hitbox", guiLeft + 5, guiTop + 35));
|
||||
addButton(new GuiNpcButtonYesNo(0,guiLeft + 122, guiTop + 30, 56, 20 ,hitboxData.isHitboxEnabled()));
|
||||
if(hitboxData.isHitboxEnabled()){
|
||||
addLabel(new GuiNpcLabel(3,"hitbox.width", guiLeft + 5, guiTop + 57));
|
||||
addTextField(new GuiNpcTextField(2,this, fontRendererObj, guiLeft + 122, guiTop + 53, 50, 18, hitboxData.getWidthScale() + ""));
|
||||
addLabel(new GuiNpcLabel(0, "hitbox.hitbox", guiLeft + 5, guiTop + 35));
|
||||
addButton(new GuiNpcButtonYesNo(0, guiLeft + 122, guiTop + 30, 56, 20, hitboxData.isHitboxEnabled()));
|
||||
if (hitboxData.isHitboxEnabled()) {
|
||||
addLabel(new GuiNpcLabel(3, "hitbox.width", guiLeft + 5, guiTop + 57));
|
||||
addTextField(new GuiNpcTextField(2, this, fontRendererObj, guiLeft + 122, guiTop + 53, 50, 18, hitboxData.getWidthScale() + ""));
|
||||
getTextField(2).floatsOnly = true;
|
||||
getTextField(2).setMinMaxDefaultFloat(0, Float.MAX_VALUE, 1);
|
||||
|
||||
addLabel(new GuiNpcLabel(4,"hitbox.height", guiLeft + 5, guiTop + 79));
|
||||
addTextField(new GuiNpcTextField(3,this, fontRendererObj, guiLeft + 122, guiTop + 75, 50, 18, hitboxData.getHeightScale() + ""));
|
||||
addLabel(new GuiNpcLabel(4, "hitbox.height", guiLeft + 5, guiTop + 79));
|
||||
addTextField(new GuiNpcTextField(3, this, fontRendererObj, guiLeft + 122, guiTop + 75, 50, 18, hitboxData.getHeightScale() + ""));
|
||||
getTextField(3).floatsOnly = true;
|
||||
getTextField(3).setMinMaxDefaultFloat(0, Float.MAX_VALUE, 1);
|
||||
}
|
||||
addButton(new GuiNpcButton(66, guiLeft + 82, guiTop + 190,98, 20, "gui.done"));
|
||||
addButton(new GuiNpcButton(66, guiLeft + 82, guiTop + 190, 98, 20, "gui.done"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton){
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
int id = guibutton.id;
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
if(button.id == 0){
|
||||
hitboxData.setHitboxEnabled(((GuiNpcButtonYesNo)button).getBoolean());
|
||||
if (button.id == 0) {
|
||||
hitboxData.setHitboxEnabled(((GuiNpcButtonYesNo) button).getBoolean());
|
||||
initGui();
|
||||
}
|
||||
if(id == 66){
|
||||
if (id == 66) {
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unFocused(GuiNpcTextField textfield) {
|
||||
if(textfield.id == 2){
|
||||
if (textfield.id == 2) {
|
||||
hitboxData.setWidthScale(textfield.getFloat());
|
||||
}
|
||||
if(textfield.id == 3){
|
||||
if (textfield.id == 3) {
|
||||
hitboxData.setHeightScale(textfield.getFloat());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,36 +5,37 @@ import noppes.npcs.client.gui.util.GuiNpcButton;
|
||||
import noppes.npcs.client.gui.util.GuiNpcTextField;
|
||||
import noppes.npcs.client.gui.util.SubGuiInterface;
|
||||
|
||||
public class SubGuiEditText extends SubGuiInterface{
|
||||
public String text;
|
||||
public boolean cancelled = true;
|
||||
public SubGuiEditText(String text){
|
||||
this.text = text;
|
||||
setBackground("extrasmallbg.png");
|
||||
closeOnEsc = true;
|
||||
xSize = 176;
|
||||
ySize = 71;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui(){
|
||||
super.initGui();
|
||||
addTextField(new GuiNpcTextField(0, parent, guiLeft + 4, guiTop + 14, 168, 20, text));
|
||||
|
||||
this.addButton(new GuiNpcButton(0, guiLeft + 4, guiTop + 44, 80, 20, "gui.done"));
|
||||
this.addButton(new GuiNpcButton(1, guiLeft + 90, guiTop + 44, 80, 20, "gui.cancel"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buttonEvent(GuiButton button){
|
||||
if(button.id == 0){
|
||||
cancelled = false;
|
||||
text = getTextField(0).getText();
|
||||
}
|
||||
close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
}
|
||||
public class SubGuiEditText extends SubGuiInterface {
|
||||
public String text;
|
||||
public boolean cancelled = true;
|
||||
|
||||
public SubGuiEditText(String text) {
|
||||
this.text = text;
|
||||
setBackground("extrasmallbg.png");
|
||||
closeOnEsc = true;
|
||||
xSize = 176;
|
||||
ySize = 71;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
addTextField(new GuiNpcTextField(0, parent, guiLeft + 4, guiTop + 14, 168, 20, text));
|
||||
|
||||
this.addButton(new GuiNpcButton(0, guiLeft + 4, guiTop + 44, 80, 20, "gui.done"));
|
||||
this.addButton(new GuiNpcButton(1, guiLeft + 90, guiTop + 44, 80, 20, "gui.cancel"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buttonEvent(GuiButton button) {
|
||||
if (button.id == 0) {
|
||||
cancelled = false;
|
||||
text = getTextField(0).getText();
|
||||
}
|
||||
close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
}
|
||||
}
|
||||
@@ -71,7 +71,7 @@ public class SubGuiEffectGeneral extends SubGuiInterface implements ITextfieldLi
|
||||
y += 23;
|
||||
|
||||
addTextField(setIntegerOnly(
|
||||
new GuiNpcTextField(3, this, x + 70, y, 83, 20, ""+effect.everyXTick),
|
||||
new GuiNpcTextField(3, this, x + 70, y, 83, 20, "" + effect.everyXTick),
|
||||
10,
|
||||
1200,
|
||||
effect.everyXTick
|
||||
@@ -81,20 +81,20 @@ public class SubGuiEffectGeneral extends SubGuiInterface implements ITextfieldLi
|
||||
addLabel(new GuiNpcLabel(3, "effect.editor.runsEveryX", x, y + 5));
|
||||
|
||||
int oldX = x;
|
||||
int xEnd = guiLeft+xSize-10;
|
||||
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));
|
||||
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;
|
||||
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),
|
||||
new GuiNpcTextField(4, this, x + 70, y, 83, 20, "" + effect.length),
|
||||
-100,
|
||||
86400,
|
||||
effect.length
|
||||
effect.length
|
||||
));
|
||||
|
||||
addLabel(new GuiNpcLabel(4, "effect.editor.defaultLength", x, y + 5));
|
||||
@@ -141,20 +141,20 @@ public class SubGuiEffectGeneral extends SubGuiInterface implements ITextfieldLi
|
||||
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.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),
|
||||
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),
|
||||
new GuiNpcTextField(7, this, scrollWindow.clipWidth - 60 - 10, y, 60, 20, "" + effect.iconY),
|
||||
0,
|
||||
10240,
|
||||
effect.iconY
|
||||
@@ -164,13 +164,13 @@ public class SubGuiEffectGeneral extends SubGuiInterface implements ITextfieldLi
|
||||
|
||||
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),
|
||||
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),
|
||||
new GuiNpcTextField(9, this, scrollWindow.clipWidth - 60 - 10, y, 60, 20, "" + effect.height),
|
||||
0,
|
||||
10240,
|
||||
effect.height
|
||||
@@ -220,13 +220,13 @@ public class SubGuiEffectGeneral extends SubGuiInterface implements ITextfieldLi
|
||||
break;
|
||||
case 3:
|
||||
effect.setEveryXTick(guiNpcTextField.getInteger());
|
||||
guiNpcTextField.setText(effect.everyXTick+"");
|
||||
guiNpcTextField.setText(effect.everyXTick + "");
|
||||
break;
|
||||
case 4:
|
||||
int length = guiNpcTextField.getInteger();
|
||||
if (length < 0)
|
||||
length = -100;
|
||||
guiNpcTextField.setText(length+"");
|
||||
guiNpcTextField.setText(length + "");
|
||||
effect.length = length;
|
||||
break;
|
||||
case 5:
|
||||
|
||||
@@ -3,10 +3,7 @@ package noppes.npcs.client.gui;
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.magic.MagicSavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.client.gui.SubGuiColorSelector;
|
||||
import noppes.npcs.client.gui.global.GuiNpcManageMagic;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumTextureType;
|
||||
@@ -46,12 +43,12 @@ public class SubGuiMagic extends SubGuiInterface implements ITextfieldListener,
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
int y = guiTop + 6;
|
||||
int y = guiTop + 6;
|
||||
|
||||
addLabel(new GuiNpcLabel(1,"gui.name", guiLeft + 4, y + 5));
|
||||
addLabel(new GuiNpcLabel(1, "gui.name", guiLeft + 4, y + 5));
|
||||
addTextField(new GuiNpcTextField(1, this, this.fontRendererObj, guiLeft + 80, y, 200, 20, magic.name));
|
||||
|
||||
addLabel(new GuiNpcLabel(-10,"ID", guiLeft + 200 + 80 + 5, y + 2));
|
||||
addLabel(new GuiNpcLabel(-10, "ID", guiLeft + 200 + 80 + 5, y + 2));
|
||||
addLabel(new GuiNpcLabel(-11, magic.id + "", guiLeft + 200 + 80 + 5, y + 12));
|
||||
|
||||
y += 25;
|
||||
@@ -61,7 +58,7 @@ public class SubGuiMagic extends SubGuiInterface implements ITextfieldListener,
|
||||
addTextField(new GuiNpcTextField(2, this, fontRendererObj, guiLeft + 80, y, 200, 20, magic.displayName));
|
||||
|
||||
String color = Integer.toHexString(magic.color);
|
||||
while(color.length() < 6)
|
||||
while (color.length() < 6)
|
||||
color = 0 + color;
|
||||
addButton(new GuiNpcButton(12, guiLeft + 80 + 5 + 200, y, 65, 20, color));
|
||||
getButton(12).setTextColor(magic.color);
|
||||
@@ -74,8 +71,8 @@ public class SubGuiMagic extends SubGuiInterface implements ITextfieldListener,
|
||||
|
||||
|
||||
// Interactions
|
||||
if(allMagic == null){
|
||||
allMagic = new GuiCustomScroll(this,0);
|
||||
if (allMagic == null) {
|
||||
allMagic = new GuiCustomScroll(this, 0);
|
||||
allMagic.setSize(150, 107);
|
||||
}
|
||||
allMagic.guiLeft = guiLeft + 5;
|
||||
@@ -84,8 +81,8 @@ public class SubGuiMagic extends SubGuiInterface implements ITextfieldListener,
|
||||
addTextField(new GuiNpcTextField(34, this, fontRendererObj, guiLeft + 5, guiTop + 30 + 160, 150, 20, search));
|
||||
allMagic.setList(getSearchList());
|
||||
|
||||
if(interactionsScroll == null){
|
||||
interactionsScroll = new GuiCustomScroll(this,1);
|
||||
if (interactionsScroll == null) {
|
||||
interactionsScroll = new GuiCustomScroll(this, 1);
|
||||
interactionsScroll.setSize(150, 107);
|
||||
}
|
||||
interactionsScroll.guiLeft = guiLeft + 200;
|
||||
@@ -97,7 +94,7 @@ public class SubGuiMagic extends SubGuiInterface implements ITextfieldListener,
|
||||
interactionField = new GuiNpcTextField(90, this, fontRendererObj, guiLeft + 245, guiTop + 30 + 160, 45, 20, "");
|
||||
interactionField.setFloatsOnly();
|
||||
addTextField(interactionField);
|
||||
if(selectedInteraction != null){
|
||||
if (selectedInteraction != null) {
|
||||
interactionField.setText(interactionValues.get(selectedInteraction) + "");
|
||||
} else {
|
||||
interactionField.enabled = false;
|
||||
@@ -115,11 +112,11 @@ public class SubGuiMagic extends SubGuiInterface implements ITextfieldListener,
|
||||
|
||||
@Override
|
||||
public void actionPerformed(GuiButton button) {
|
||||
if(button.id == 99){
|
||||
if (button.id == 99) {
|
||||
close();
|
||||
}
|
||||
if(button.id == 13){
|
||||
magic.type = EnumTextureType.values()[((GuiNpcButton)button).getValue()];
|
||||
if (button.id == 13) {
|
||||
magic.type = EnumTextureType.values()[((GuiNpcButton) button).getValue()];
|
||||
}
|
||||
if (button.id == 12) {
|
||||
setSubGui(new SubGuiColorSelector(magic.color));
|
||||
@@ -141,8 +138,8 @@ public class SubGuiMagic extends SubGuiInterface implements ITextfieldListener,
|
||||
}
|
||||
if (button.id == 62) {
|
||||
// Add All
|
||||
for(String name : this.parent.magicData.keySet()){
|
||||
if(!interactionNames.containsKey(name)){
|
||||
for (String name : this.parent.magicData.keySet()) {
|
||||
if (!interactionNames.containsKey(name)) {
|
||||
interactionNames.put(name, this.parent.magicData.get(name));
|
||||
interactionValues.put(name, 0.0f);
|
||||
}
|
||||
@@ -163,27 +160,26 @@ public class SubGuiMagic extends SubGuiInterface implements ITextfieldListener,
|
||||
|
||||
@Override
|
||||
public void unFocused(GuiNpcTextField guiNpcTextField) {
|
||||
if(guiNpcTextField.id == 1) {
|
||||
if(magic.id < 0)
|
||||
if (guiNpcTextField.id == 1) {
|
||||
if (magic.id < 0)
|
||||
guiNpcTextField.setText("");
|
||||
else{
|
||||
else {
|
||||
String name = guiNpcTextField.getText();
|
||||
if(name.isEmpty() || ((GuiNpcManageMagic)this.parent).magicData.containsKey(name)){
|
||||
if (name.isEmpty() || ((GuiNpcManageMagic) this.parent).magicData.containsKey(name)) {
|
||||
guiNpcTextField.setText(magic.name);
|
||||
}
|
||||
else if(magic.id >= 0){
|
||||
} else if (magic.id >= 0) {
|
||||
String old = magic.name;
|
||||
((GuiNpcManageMagic)this.parent).magicData.remove(old);
|
||||
((GuiNpcManageMagic) this.parent).magicData.remove(old);
|
||||
magic.name = name;
|
||||
((GuiNpcManageMagic)this.parent).magicData.put(magic.name, magic.id);
|
||||
((GuiNpcManageMagic)this.parent).rightScroll.replace(old, magic.name);
|
||||
((GuiNpcManageMagic) this.parent).magicData.put(magic.name, magic.id);
|
||||
((GuiNpcManageMagic) this.parent).rightScroll.replace(old, magic.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(guiNpcTextField.id == 2){
|
||||
if (guiNpcTextField.id == 2) {
|
||||
magic.displayName = guiNpcTextField.getText();
|
||||
}
|
||||
if(guiNpcTextField.id == 3){
|
||||
if (guiNpcTextField.id == 3) {
|
||||
magic.iconTexture = guiNpcTextField.getText();
|
||||
}
|
||||
if (guiNpcTextField.id == 90 && selectedInteraction != null) {
|
||||
@@ -191,18 +187,16 @@ public class SubGuiMagic extends SubGuiInterface implements ITextfieldListener,
|
||||
}
|
||||
}
|
||||
|
||||
public void mouseClicked(int i, int j, int k)
|
||||
{
|
||||
public void mouseClicked(int i, int j, int k) {
|
||||
super.mouseClicked(i, j, k);
|
||||
if(k == 0 && allMagic != null)
|
||||
if (k == 0 && allMagic != null)
|
||||
allMagic.mouseClicked(i, j, k);
|
||||
}
|
||||
|
||||
public void keyTyped(char c, int i)
|
||||
{
|
||||
public void keyTyped(char c, int i) {
|
||||
super.keyTyped(c, i);
|
||||
if(getTextField(34) != null && getTextField(34).isFocused()){
|
||||
if(search.equals(getTextField(34).getText()))
|
||||
if (getTextField(34) != null && getTextField(34).isFocused()) {
|
||||
if (search.equals(getTextField(34).getText()))
|
||||
return;
|
||||
search = getTextField(34).getText().toLowerCase();
|
||||
allMagic.setList(getSearchList());
|
||||
@@ -210,26 +204,26 @@ public class SubGuiMagic extends SubGuiInterface implements ITextfieldListener,
|
||||
}
|
||||
}
|
||||
|
||||
private List<String> getSearchList(){
|
||||
private List<String> getSearchList() {
|
||||
List<String> original = new ArrayList<>(this.parent.magicData.keySet());
|
||||
if(search.isEmpty()){
|
||||
if (search.isEmpty()) {
|
||||
return original;
|
||||
}
|
||||
List<String> filtered = new ArrayList<>();
|
||||
for(String name : original){
|
||||
if(name.toLowerCase().contains(search)){
|
||||
for (String name : original) {
|
||||
if (name.toLowerCase().contains(search)) {
|
||||
filtered.add(name);
|
||||
}
|
||||
}
|
||||
return filtered;
|
||||
}
|
||||
|
||||
public void processInteractions(){
|
||||
public void processInteractions() {
|
||||
interactionNames.clear();
|
||||
interactionValues.clear();
|
||||
for(int id : magic.interactions.keySet()){
|
||||
for(String name : this.parent.magicData.keySet()){
|
||||
if(this.parent.magicData.get(name) == id){
|
||||
for (int id : magic.interactions.keySet()) {
|
||||
for (String name : this.parent.magicData.keySet()) {
|
||||
if (this.parent.magicData.get(name) == id) {
|
||||
interactionNames.put(name, id);
|
||||
interactionValues.put(name, magic.interactions.get(id));
|
||||
}
|
||||
@@ -237,22 +231,22 @@ public class SubGuiMagic extends SubGuiInterface implements ITextfieldListener,
|
||||
}
|
||||
}
|
||||
|
||||
public void setInteractions(){
|
||||
public void setInteractions() {
|
||||
magic.interactions.clear();
|
||||
for(String name : interactionNames.keySet()){
|
||||
for (String name : interactionNames.keySet()) {
|
||||
magic.interactions.put(interactionNames.get(name), interactionValues.get(name));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void subGuiClosed(SubGuiInterface subgui) {
|
||||
if(subgui instanceof SubGuiColorSelector){
|
||||
if (subgui instanceof SubGuiColorSelector) {
|
||||
magic.color = ((SubGuiColorSelector) subgui).color;
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
|
||||
public void close(){
|
||||
public void close() {
|
||||
setInteractions();
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
magic.writeNBT(compound);
|
||||
@@ -262,7 +256,7 @@ public class SubGuiMagic extends SubGuiInterface implements ITextfieldListener,
|
||||
|
||||
@Override
|
||||
public void customScrollClicked(int i, int j, int k, GuiCustomScroll guiCustomScroll) {
|
||||
if(guiCustomScroll.id == 1){
|
||||
if (guiCustomScroll.id == 1) {
|
||||
GuiNpcTextField.unfocus();
|
||||
selectedInteraction = interactionsScroll.getSelected();
|
||||
interactionField.enabled = true;
|
||||
@@ -271,5 +265,6 @@ public class SubGuiMagic extends SubGuiInterface implements ITextfieldListener,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void customScrollDoubleClicked(String selection, GuiCustomScroll scroll) {}
|
||||
public void customScrollDoubleClicked(String selection, GuiCustomScroll scroll) {
|
||||
}
|
||||
}
|
||||
@@ -4,11 +4,9 @@ import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.magic.MagicCycleSavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.client.gui.global.GuiNpcManageMagic;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumDiagramLayout;
|
||||
import noppes.npcs.controllers.data.Magic;
|
||||
import noppes.npcs.controllers.data.MagicAssociation;
|
||||
import noppes.npcs.controllers.data.MagicCycle;
|
||||
|
||||
@@ -62,7 +60,7 @@ public class SubGuiMagicCycle extends SubGuiInterface implements ITextfieldListe
|
||||
addLabel(new GuiNpcLabel(1, "gui.name", guiLeft + 4, y + 5));
|
||||
addTextField(new GuiNpcTextField(1, this, fontRendererObj, guiLeft + 80, y, 200, 20, cycle.name));
|
||||
|
||||
addLabel(new GuiNpcLabel(-10,"ID", guiLeft + 200 + 80 + 5, y + 2));
|
||||
addLabel(new GuiNpcLabel(-10, "ID", guiLeft + 200 + 80 + 5, y + 2));
|
||||
addLabel(new GuiNpcLabel(-11, cycle.id + "", guiLeft + 200 + 80 + 5, y + 12));
|
||||
|
||||
// Layout button – cycles through available layouts
|
||||
@@ -96,7 +94,7 @@ public class SubGuiMagicCycle extends SubGuiInterface implements ITextfieldListe
|
||||
|
||||
// --- Association Management ---
|
||||
// Scroll for available magics to add
|
||||
if(allMagic == null){
|
||||
if (allMagic == null) {
|
||||
allMagic = new GuiCustomScroll(this, 0);
|
||||
allMagic.setSize(150, 100);
|
||||
}
|
||||
@@ -110,7 +108,7 @@ public class SubGuiMagicCycle extends SubGuiInterface implements ITextfieldListe
|
||||
addTextField(new GuiNpcTextField(34, this, fontRendererObj, guiLeft + 5, y + 105, 150, 20, search));
|
||||
|
||||
// Scroll for current associations
|
||||
if(associationScroll == null){
|
||||
if (associationScroll == null) {
|
||||
associationScroll = new GuiCustomScroll(this, 1);
|
||||
associationScroll.setSize(150, 125);
|
||||
}
|
||||
@@ -133,12 +131,12 @@ public class SubGuiMagicCycle extends SubGuiInterface implements ITextfieldListe
|
||||
@Override
|
||||
public void actionPerformed(GuiButton button) {
|
||||
// Layout button: update cycle layout.
|
||||
if(button.id == 13) {
|
||||
cycle.layout = EnumDiagramLayout.values()[((GuiNpcButton)button).getValue()];
|
||||
if (button.id == 13) {
|
||||
cycle.layout = EnumDiagramLayout.values()[((GuiNpcButton) button).getValue()];
|
||||
}
|
||||
// Add single association
|
||||
if(button.id == 60 && allMagic.hasSelected() && !associationMap.containsKey(allMagic.getSelected())
|
||||
&& parent.magicData.containsKey(allMagic.getSelected())) {
|
||||
if (button.id == 60 && allMagic.hasSelected() && !associationMap.containsKey(allMagic.getSelected())
|
||||
&& parent.magicData.containsKey(allMagic.getSelected())) {
|
||||
MagicAssociation assoc = new MagicAssociation();
|
||||
assoc.magicId = parent.magicData.get(allMagic.getSelected());
|
||||
assoc.index = 0;
|
||||
@@ -147,7 +145,7 @@ public class SubGuiMagicCycle extends SubGuiInterface implements ITextfieldListe
|
||||
associationScroll.list.add(allMagic.getSelected());
|
||||
}
|
||||
// Remove single association
|
||||
if(button.id == 61 && associationScroll.hasSelected()) {
|
||||
if (button.id == 61 && associationScroll.hasSelected()) {
|
||||
associationMap.remove(associationScroll.getSelected());
|
||||
associationScroll.list.remove(associationScroll.selected);
|
||||
associationScroll.selected = -1;
|
||||
@@ -157,9 +155,9 @@ public class SubGuiMagicCycle extends SubGuiInterface implements ITextfieldListe
|
||||
priorityField.setText("");
|
||||
}
|
||||
// Add All available associations
|
||||
if(button.id == 62) {
|
||||
for(String name : parent.magicData.keySet()){
|
||||
if(!associationMap.containsKey(name)){
|
||||
if (button.id == 62) {
|
||||
for (String name : parent.magicData.keySet()) {
|
||||
if (!associationMap.containsKey(name)) {
|
||||
MagicAssociation assoc = new MagicAssociation();
|
||||
assoc.magicId = parent.magicData.get(name);
|
||||
assoc.index = 0;
|
||||
@@ -170,7 +168,7 @@ public class SubGuiMagicCycle extends SubGuiInterface implements ITextfieldListe
|
||||
associationScroll.setList(new ArrayList<>(associationMap.keySet()));
|
||||
}
|
||||
// Remove All associations
|
||||
if(button.id == 63) {
|
||||
if (button.id == 63) {
|
||||
associationMap.clear();
|
||||
associationScroll.setList(new ArrayList<>());
|
||||
associationScroll.selected = -1;
|
||||
@@ -180,7 +178,7 @@ public class SubGuiMagicCycle extends SubGuiInterface implements ITextfieldListe
|
||||
priorityField.setText("");
|
||||
}
|
||||
// Done – save changes and close
|
||||
if(button.id == 99) {
|
||||
if (button.id == 99) {
|
||||
close();
|
||||
}
|
||||
}
|
||||
@@ -188,24 +186,26 @@ public class SubGuiMagicCycle extends SubGuiInterface implements ITextfieldListe
|
||||
@Override
|
||||
public void unFocused(GuiNpcTextField textField) {
|
||||
// Update cycle basic data.
|
||||
if(textField.id == 1) {
|
||||
if (textField.id == 1) {
|
||||
cycle.name = textField.getText();
|
||||
}
|
||||
if(textField.id == 2) {
|
||||
if (textField.id == 2) {
|
||||
cycle.displayName = textField.getText();
|
||||
}
|
||||
// Update association ordering values when fields lose focus.
|
||||
if(textField.id == 91 && selectedAssociation != null) {
|
||||
if (textField.id == 91 && selectedAssociation != null) {
|
||||
try {
|
||||
int idx = Integer.parseInt(textField.getText());
|
||||
associationMap.get(selectedAssociation).index = idx;
|
||||
} catch(NumberFormatException e) { }
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
}
|
||||
if(textField.id == 92 && selectedAssociation != null) {
|
||||
if (textField.id == 92 && selectedAssociation != null) {
|
||||
try {
|
||||
int prio = Integer.parseInt(textField.getText());
|
||||
associationMap.get(selectedAssociation).priority = prio;
|
||||
} catch(NumberFormatException e) { }
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,8 +213,8 @@ public class SubGuiMagicCycle extends SubGuiInterface implements ITextfieldListe
|
||||
public void keyTyped(char c, int i) {
|
||||
super.keyTyped(c, i);
|
||||
// Available magic search (text field ID 34)
|
||||
if(getTextField(34) != null && getTextField(34).isFocused()){
|
||||
if(search.equals(getTextField(34).getText()))
|
||||
if (getTextField(34) != null && getTextField(34).isFocused()) {
|
||||
if (search.equals(getTextField(34).getText()))
|
||||
return;
|
||||
search = getTextField(34).getText().toLowerCase();
|
||||
allMagic.setList(getAvailableMagicList());
|
||||
@@ -226,11 +226,11 @@ public class SubGuiMagicCycle extends SubGuiInterface implements ITextfieldListe
|
||||
* Returns a filtered list of available magic names based on parent's magicData and the search string.
|
||||
* Only those not already in the associationMap are shown.
|
||||
*/
|
||||
private List<String> getAvailableMagicList(){
|
||||
private List<String> getAvailableMagicList() {
|
||||
List<String> original = new ArrayList<>(parent.magicData.keySet());
|
||||
List<String> filtered = new ArrayList<>();
|
||||
for(String name : original){
|
||||
if(!associationMap.containsKey(name) && name.toLowerCase().contains(search)){
|
||||
for (String name : original) {
|
||||
if (!associationMap.containsKey(name) && name.toLowerCase().contains(search)) {
|
||||
filtered.add(name);
|
||||
}
|
||||
}
|
||||
@@ -240,12 +240,12 @@ public class SubGuiMagicCycle extends SubGuiInterface implements ITextfieldListe
|
||||
/**
|
||||
* Populates associationMap from cycle.associations using parent's magicData.
|
||||
*/
|
||||
public void processAssociations(){
|
||||
public void processAssociations() {
|
||||
associationMap.clear();
|
||||
// For each association stored in the cycle, find the corresponding magic name.
|
||||
for(MagicAssociation assoc : cycle.associations.values()){
|
||||
for(String name : parent.magicData.keySet()){
|
||||
if(parent.magicData.get(name) == assoc.magicId){
|
||||
for (MagicAssociation assoc : cycle.associations.values()) {
|
||||
for (String name : parent.magicData.keySet()) {
|
||||
if (parent.magicData.get(name) == assoc.magicId) {
|
||||
associationMap.put(name, assoc);
|
||||
break;
|
||||
}
|
||||
@@ -256,9 +256,9 @@ public class SubGuiMagicCycle extends SubGuiInterface implements ITextfieldListe
|
||||
@Override
|
||||
public void customScrollClicked(int id, int index, int clickType, GuiCustomScroll scroll) {
|
||||
// When clicking the association scroll, update the ordering text fields.
|
||||
if(scroll.id == 1){
|
||||
if (scroll.id == 1) {
|
||||
selectedAssociation = scroll.getSelected();
|
||||
if(selectedAssociation != null && associationMap.containsKey(selectedAssociation)){
|
||||
if (selectedAssociation != null && associationMap.containsKey(selectedAssociation)) {
|
||||
indexField.enabled = true;
|
||||
priorityField.enabled = true;
|
||||
indexField.setText(associationMap.get(selectedAssociation).index + "");
|
||||
@@ -268,7 +268,8 @@ public class SubGuiMagicCycle extends SubGuiInterface implements ITextfieldListe
|
||||
}
|
||||
|
||||
@Override
|
||||
public void customScrollDoubleClicked(String selection, GuiCustomScroll scroll) { }
|
||||
public void customScrollDoubleClicked(String selection, GuiCustomScroll scroll) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void subGuiClosed(SubGuiInterface subgui) {
|
||||
@@ -279,10 +280,10 @@ public class SubGuiMagicCycle extends SubGuiInterface implements ITextfieldListe
|
||||
* Called when the user clicks "Done". Updates the cycle's associations from associationMap,
|
||||
* writes the NBT data, and sends a MagicCycleSavePacket.
|
||||
*/
|
||||
public void close(){
|
||||
public void close() {
|
||||
// Clear the cycle's associations and update them from our associationMap.
|
||||
cycle.associations.clear();
|
||||
for(String name : associationMap.keySet()){
|
||||
for (String name : associationMap.keySet()) {
|
||||
cycle.associations.put(associationMap.get(name).magicId, associationMap.get(name));
|
||||
}
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
|
||||
@@ -1,20 +1,9 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.magic.MagicSavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.gui.global.GuiNpcManageMagic;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumTextureType;
|
||||
import noppes.npcs.client.gui.util.SubGuiInterface;
|
||||
import noppes.npcs.controllers.MagicController;
|
||||
import noppes.npcs.controllers.data.Magic;
|
||||
import noppes.npcs.controllers.data.MagicCycle;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class SubGuiMagicCycleViewer extends SubGuiInterface {
|
||||
|
||||
private final MagicCycle magicCycle;
|
||||
@@ -37,7 +26,7 @@ public class SubGuiMagicCycleViewer extends SubGuiInterface {
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
if(magicCycle == null)
|
||||
if (magicCycle == null)
|
||||
return;
|
||||
|
||||
// Position the map in a designated area (e.g., right panel)
|
||||
|
||||
@@ -11,86 +11,87 @@ import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.containers.ContainerMail;
|
||||
import noppes.npcs.controllers.data.PlayerMail;
|
||||
|
||||
public class SubGuiMailmanSendSetup extends SubGuiInterface implements ITextfieldListener, GuiSelectionListener{
|
||||
public class SubGuiMailmanSendSetup extends SubGuiInterface implements ITextfieldListener, GuiSelectionListener {
|
||||
|
||||
private PlayerMail mail;
|
||||
private PlayerMail mail;
|
||||
|
||||
public SubGuiMailmanSendSetup(PlayerMail mail, GuiScreen parent){
|
||||
this.parent = parent;
|
||||
public SubGuiMailmanSendSetup(PlayerMail mail, GuiScreen parent) {
|
||||
this.parent = parent;
|
||||
xSize = 256;
|
||||
setBackground("menubg.png");
|
||||
this.mail = mail;
|
||||
}
|
||||
this.mail = mail;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui(){
|
||||
super.initGui();
|
||||
addLabel(new GuiNpcLabel(1, "mailbox.subject", guiLeft + 4, guiTop + 19));
|
||||
addTextField(new GuiNpcTextField(1, this, fontRendererObj, guiLeft + 60, guiTop + 14, 180, 20, mail.subject));
|
||||
addLabel(new GuiNpcLabel(0, "mailbox.sender", guiLeft + 4, guiTop + 41));
|
||||
addTextField(new GuiNpcTextField(0, this, fontRendererObj, guiLeft + 60, guiTop + 36, 180, 20, mail.sender));
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
addLabel(new GuiNpcLabel(1, "mailbox.subject", guiLeft + 4, guiTop + 19));
|
||||
addTextField(new GuiNpcTextField(1, this, fontRendererObj, guiLeft + 60, guiTop + 14, 180, 20, mail.subject));
|
||||
addLabel(new GuiNpcLabel(0, "mailbox.sender", guiLeft + 4, guiTop + 41));
|
||||
addTextField(new GuiNpcTextField(0, this, fontRendererObj, guiLeft + 60, guiTop + 36, 180, 20, mail.sender));
|
||||
|
||||
addButton(new GuiNpcButton(2, guiLeft + 29, guiTop + 100, "mailbox.write"));
|
||||
addButton(new GuiNpcButton(2, guiLeft + 29, guiTop + 100, "mailbox.write"));
|
||||
|
||||
addLabel(new GuiNpcLabel(3, "quest.quest", guiLeft + 13, guiTop + 135));
|
||||
String title = mail.questTitle;
|
||||
if(title.isEmpty())
|
||||
title = "gui.select";
|
||||
addButton(new GuiNpcButton(3, guiLeft + 70, guiTop + 130, 100, 20, title));
|
||||
addButton(new GuiNpcButton(4, guiLeft + 171, guiTop + 130, 20, 20, "X"));
|
||||
addLabel(new GuiNpcLabel(3, "quest.quest", guiLeft + 13, guiTop + 135));
|
||||
String title = mail.questTitle;
|
||||
if (title.isEmpty())
|
||||
title = "gui.select";
|
||||
addButton(new GuiNpcButton(3, guiLeft + 70, guiTop + 130, 100, 20, title));
|
||||
addButton(new GuiNpcButton(4, guiLeft + 171, guiTop + 130, 20, 20, "X"));
|
||||
|
||||
addButton(new GuiNpcButton(0, guiLeft + 26, guiTop + 190, 100, 20, "gui.done"));
|
||||
addButton(new GuiNpcButton(1, guiLeft + 130, guiTop + 190, 100, 20, "gui.cancel"));
|
||||
addButton(new GuiNpcButton(0, guiLeft + 26, guiTop + 190, 100, 20, "gui.done"));
|
||||
addButton(new GuiNpcButton(1, guiLeft + 130, guiTop + 190, 100, 20, "gui.cancel"));
|
||||
|
||||
if(player.openContainer instanceof ContainerMail){
|
||||
ContainerMail container = (ContainerMail) player.openContainer;
|
||||
mail.items = container.mail.items;
|
||||
}
|
||||
}
|
||||
if (player.openContainer instanceof ContainerMail) {
|
||||
ContainerMail container = (ContainerMail) player.openContainer;
|
||||
mail.items = container.mail.items;
|
||||
}
|
||||
}
|
||||
|
||||
public void buttonEvent(GuiButton guibutton) {
|
||||
int id = guibutton.id;
|
||||
if(id == 0){
|
||||
close();
|
||||
}
|
||||
if(id == 1){
|
||||
mail.questId = -1;
|
||||
mail.questTitle = "";
|
||||
mail.message = new NBTTagCompound();
|
||||
close();
|
||||
}
|
||||
if(id == 2){
|
||||
GuiMailmanWrite.parent = getParent();
|
||||
GuiMailmanWrite.mail = mail;
|
||||
public void buttonEvent(GuiButton guibutton) {
|
||||
int id = guibutton.id;
|
||||
if (id == 0) {
|
||||
close();
|
||||
}
|
||||
if (id == 1) {
|
||||
mail.questId = -1;
|
||||
mail.questTitle = "";
|
||||
mail.message = new NBTTagCompound();
|
||||
close();
|
||||
}
|
||||
if (id == 2) {
|
||||
GuiMailmanWrite.parent = getParent();
|
||||
GuiMailmanWrite.mail = mail;
|
||||
|
||||
PacketClient.sendClient(new MailOpenSetupPacket(mail.writeNBT()));
|
||||
}
|
||||
if(id == 3){
|
||||
}
|
||||
if (id == 3) {
|
||||
setSubGui(new GuiQuestSelection(mail.questId));
|
||||
}
|
||||
if(id == 4){
|
||||
mail.questId = -1;
|
||||
mail.questTitle = "";
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (id == 4) {
|
||||
mail.questId = -1;
|
||||
mail.questTitle = "";
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selected(int ob, String name) {
|
||||
@Override
|
||||
public void selected(int ob, String name) {
|
||||
mail.questId = ob;
|
||||
mail.questTitle = name;
|
||||
initGui();
|
||||
}
|
||||
@Override
|
||||
public void save() {
|
||||
initGui();
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public void save() {
|
||||
|
||||
@Override
|
||||
public void unFocused(GuiNpcTextField textField) {
|
||||
if(textField.id == 0)
|
||||
mail.sender = textField.getText();
|
||||
if(textField.id == 1)
|
||||
mail.subject = textField.getText();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unFocused(GuiNpcTextField textField) {
|
||||
if (textField.id == 0)
|
||||
mail.sender = textField.getText();
|
||||
if (textField.id == 1)
|
||||
mail.subject = textField.getText();
|
||||
}
|
||||
}
|
||||
@@ -10,149 +10,146 @@ import noppes.npcs.constants.EnumDayTime;
|
||||
import noppes.npcs.controllers.data.Availability;
|
||||
import noppes.npcs.controllers.data.Faction;
|
||||
|
||||
public class SubGuiNpcAvailability extends SubGuiInterface implements ITextfieldListener, GuiSelectionListener, IGuiData
|
||||
{
|
||||
private Availability availabitily;
|
||||
private int slot = 0;
|
||||
public class SubGuiNpcAvailability extends SubGuiInterface implements ITextfieldListener, GuiSelectionListener, IGuiData {
|
||||
private Availability availabitily;
|
||||
private int slot = 0;
|
||||
|
||||
public SubGuiNpcAvailability(Availability availabitily)
|
||||
{
|
||||
this.availabitily = availabitily;
|
||||
setBackground("menubg.png");
|
||||
xSize = 256;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
public SubGuiNpcAvailability(Availability availabitily) {
|
||||
this.availabitily = availabitily;
|
||||
setBackground("menubg.png");
|
||||
xSize = 256;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
{
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
addLabel(new GuiNpcLabel(1,"availability.available", guiLeft, guiTop + 4));
|
||||
addLabel(new GuiNpcLabel(1, "availability.available", guiLeft, guiTop + 4));
|
||||
getLabel(1).center(xSize);
|
||||
|
||||
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(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"));
|
||||
getButton(25).setEnabled(availabitily.faction2Available != EnumAvailabilityFactionType.Always);
|
||||
getButton(27).setEnabled(availabitily.faction2Available != EnumAvailabilityFactionType.Always);
|
||||
this.addButton(new GuiNpcButton(26, guiLeft + 230, guiTop + 126,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"));
|
||||
getButton(25).setEnabled(availabitily.faction2Available != EnumAvailabilityFactionType.Always);
|
||||
getButton(27).setEnabled(availabitily.faction2Available != EnumAvailabilityFactionType.Always);
|
||||
this.addButton(new GuiNpcButton(26, guiLeft + 230, guiTop + 126, 20, 20, "X"));
|
||||
|
||||
addLabel(new GuiNpcLabel(50,"availability.daytime", guiLeft + 4 , guiTop + 153));
|
||||
this.addButton(new GuiNpcButton(50, guiLeft + 50, guiTop + 148,150, 20, new String[]{"availability.wholeday","availability.night","availability.day"},availabitily.daytime.ordinal()));
|
||||
addLabel(new GuiNpcLabel(50, "availability.daytime", guiLeft + 4, guiTop + 153));
|
||||
this.addButton(new GuiNpcButton(50, guiLeft + 50, guiTop + 148, 150, 20, new String[]{"availability.wholeday", "availability.night", "availability.day"}, availabitily.daytime.ordinal()));
|
||||
|
||||
addLabel(new GuiNpcLabel(51,"availability.minlevel", guiLeft + 4 , guiTop + 175));
|
||||
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);
|
||||
addLabel(new GuiNpcLabel(51, "availability.minlevel", guiLeft + 4, guiTop + 175));
|
||||
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"));
|
||||
this.addButton(new GuiNpcButton(66, guiLeft + 82, guiTop + 192, 98, 20, "gui.done"));
|
||||
|
||||
updateGuiButtons();
|
||||
updateGuiButtons();
|
||||
}
|
||||
|
||||
|
||||
private void updateGuiButtons() {
|
||||
if(availabitily.factionId >= 0){
|
||||
if (availabitily.factionId >= 0) {
|
||||
FactionGetPacket.getFaction(availabitily.factionId);
|
||||
}
|
||||
if(availabitily.faction2Id >= 0){
|
||||
}
|
||||
if (availabitily.faction2Id >= 0) {
|
||||
FactionGetPacket.getFaction(availabitily.faction2Id);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton){
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
|
||||
if(button.id == 0){
|
||||
setSubGui(new SubGuiNpcAvailabilityDialog(availabitily));
|
||||
}
|
||||
if(button.id == 1){
|
||||
setSubGui(new SubGuiNpcAvailabilityQuest(availabitily));
|
||||
}
|
||||
|
||||
if(button.id == 20){
|
||||
availabitily.setFactionAvailability(button.getValue());
|
||||
if(availabitily.factionAvailable == EnumAvailabilityFactionType.Always)
|
||||
availabitily.factionId = -1;
|
||||
initGui();
|
||||
}
|
||||
if(button.id == 24){
|
||||
availabitily.setFaction2Availability(button.getValue());
|
||||
if(availabitily.faction2Available == EnumAvailabilityFactionType.Always)
|
||||
availabitily.faction2Id = -1;
|
||||
initGui();
|
||||
}
|
||||
if(button.id == 21){
|
||||
slot = 1;
|
||||
GuiNPCFactionSelection gui = new GuiNPCFactionSelection(npc, getParent(), availabitily.factionId);
|
||||
gui.listener = this;
|
||||
NoppesUtil.openGUI(player, gui);
|
||||
}
|
||||
if(button.id == 25){
|
||||
slot = 2;
|
||||
GuiNPCFactionSelection gui = new GuiNPCFactionSelection(npc, getParent(), availabitily.faction2Id);
|
||||
gui.listener = this;
|
||||
NoppesUtil.openGUI(player, gui);
|
||||
}
|
||||
if(button.id == 22){
|
||||
availabitily.setFactionAvailabilityStance(button.getValue());
|
||||
}
|
||||
|
||||
if(button.id == 27){
|
||||
availabitily.setFaction2AvailabilityStance(button.getValue());
|
||||
}
|
||||
if(button.id == 23){
|
||||
availabitily.factionId = -1;
|
||||
getButton(21).setDisplayText("availability.selectfaction");
|
||||
}
|
||||
if(button.id == 26){
|
||||
availabitily.faction2Id = -1;
|
||||
getButton(25).setDisplayText("availability.selectfaction");
|
||||
}
|
||||
if(button.id == 50){
|
||||
availabitily.daytime = EnumDayTime.values()[button.getValue()];
|
||||
}
|
||||
if(button.id == 66){
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selected(int id, String name) {
|
||||
if(slot == 1)
|
||||
availabitily.factionId = id;
|
||||
if(slot == 2)
|
||||
availabitily.faction2Id = id;
|
||||
}
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
if(compound.hasKey("Slot")){
|
||||
Faction faction = new Faction();
|
||||
faction.readNBT(compound);
|
||||
if(availabitily.factionId == faction.id)
|
||||
getButton(21).setDisplayText(faction.name);
|
||||
if(availabitily.faction2Id == faction.id)
|
||||
getButton(25).setDisplayText(faction.name);
|
||||
}
|
||||
}
|
||||
if (button.id == 0) {
|
||||
setSubGui(new SubGuiNpcAvailabilityDialog(availabitily));
|
||||
}
|
||||
if (button.id == 1) {
|
||||
setSubGui(new SubGuiNpcAvailabilityQuest(availabitily));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unFocused(GuiNpcTextField textfield) {
|
||||
if(textfield.id == 51)
|
||||
availabitily.minPlayerLevel = textfield.getInteger();
|
||||
}
|
||||
if (button.id == 20) {
|
||||
availabitily.setFactionAvailability(button.getValue());
|
||||
if (availabitily.factionAvailable == EnumAvailabilityFactionType.Always)
|
||||
availabitily.factionId = -1;
|
||||
initGui();
|
||||
}
|
||||
if (button.id == 24) {
|
||||
availabitily.setFaction2Availability(button.getValue());
|
||||
if (availabitily.faction2Available == EnumAvailabilityFactionType.Always)
|
||||
availabitily.faction2Id = -1;
|
||||
initGui();
|
||||
}
|
||||
if (button.id == 21) {
|
||||
slot = 1;
|
||||
GuiNPCFactionSelection gui = new GuiNPCFactionSelection(npc, getParent(), availabitily.factionId);
|
||||
gui.listener = this;
|
||||
NoppesUtil.openGUI(player, gui);
|
||||
}
|
||||
if (button.id == 25) {
|
||||
slot = 2;
|
||||
GuiNPCFactionSelection gui = new GuiNPCFactionSelection(npc, getParent(), availabitily.faction2Id);
|
||||
gui.listener = this;
|
||||
NoppesUtil.openGUI(player, gui);
|
||||
}
|
||||
if (button.id == 22) {
|
||||
availabitily.setFactionAvailabilityStance(button.getValue());
|
||||
}
|
||||
|
||||
if (button.id == 27) {
|
||||
availabitily.setFaction2AvailabilityStance(button.getValue());
|
||||
}
|
||||
if (button.id == 23) {
|
||||
availabitily.factionId = -1;
|
||||
getButton(21).setDisplayText("availability.selectfaction");
|
||||
}
|
||||
if (button.id == 26) {
|
||||
availabitily.faction2Id = -1;
|
||||
getButton(25).setDisplayText("availability.selectfaction");
|
||||
}
|
||||
if (button.id == 50) {
|
||||
availabitily.daytime = EnumDayTime.values()[button.getValue()];
|
||||
}
|
||||
if (button.id == 66) {
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selected(int id, String name) {
|
||||
if (slot == 1)
|
||||
availabitily.factionId = id;
|
||||
if (slot == 2)
|
||||
availabitily.faction2Id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
if (compound.hasKey("Slot")) {
|
||||
Faction faction = new Faction();
|
||||
faction.readNBT(compound);
|
||||
if (availabitily.factionId == faction.id)
|
||||
getButton(21).setDisplayText(faction.name);
|
||||
if (availabitily.faction2Id == faction.id)
|
||||
getButton(25).setDisplayText(faction.name);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unFocused(GuiNpcTextField textfield) {
|
||||
if (textfield.id == 51)
|
||||
availabitily.minPlayerLevel = textfield.getInteger();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,164 +9,164 @@ import noppes.npcs.constants.EnumAvailabilityDialog;
|
||||
import noppes.npcs.controllers.data.Availability;
|
||||
import noppes.npcs.controllers.data.Dialog;
|
||||
|
||||
public class SubGuiNpcAvailabilityDialog extends SubGuiInterface implements GuiSelectionListener, IGuiData{
|
||||
private Availability availabitily;
|
||||
private int slot = 0;
|
||||
public class SubGuiNpcAvailabilityDialog extends SubGuiInterface implements GuiSelectionListener, IGuiData {
|
||||
private Availability availabitily;
|
||||
private int slot = 0;
|
||||
|
||||
public SubGuiNpcAvailabilityDialog(Availability availabitily){
|
||||
this.availabitily = availabitily;
|
||||
setBackground("menubg.png");
|
||||
xSize = 256;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
public SubGuiNpcAvailabilityDialog(Availability availabitily) {
|
||||
this.availabitily = availabitily;
|
||||
setBackground("menubg.png");
|
||||
xSize = 256;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui(){
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
addLabel(new GuiNpcLabel(1,"availability.available", guiLeft, guiTop + 4));
|
||||
addLabel(new GuiNpcLabel(1, "availability.available", guiLeft, guiTop + 4));
|
||||
getLabel(1).center(xSize);
|
||||
|
||||
int y = guiTop + 12;
|
||||
this.addButton(new GuiNpcButton(0, guiLeft + 4, y, 50, 20, new String[]{"availability.always","availability.after","availability.before"},availabitily.dialogAvailable.ordinal()));
|
||||
this.addButton(new GuiNpcButton(10, guiLeft + 56, y, 172, 20, "availability.selectdialog"));
|
||||
getButton(10).setEnabled(availabitily.dialogAvailable != EnumAvailabilityDialog.Always);
|
||||
this.addButton(new GuiNpcButton(20, guiLeft + 230, y,20, 20, "X"));
|
||||
this.addButton(new GuiNpcButton(0, guiLeft + 4, y, 50, 20, new String[]{"availability.always", "availability.after", "availability.before"}, availabitily.dialogAvailable.ordinal()));
|
||||
this.addButton(new GuiNpcButton(10, guiLeft + 56, y, 172, 20, "availability.selectdialog"));
|
||||
getButton(10).setEnabled(availabitily.dialogAvailable != EnumAvailabilityDialog.Always);
|
||||
this.addButton(new GuiNpcButton(20, guiLeft + 230, y, 20, 20, "X"));
|
||||
|
||||
y += 23;
|
||||
this.addButton(new GuiNpcButton(1, guiLeft + 4, y, 50, 20, new String[]{"availability.always","availability.after","availability.before"},availabitily.dialog2Available.ordinal()));
|
||||
this.addButton(new GuiNpcButton(11, guiLeft + 56, y, 172, 20, "availability.selectdialog"));
|
||||
getButton(11).setEnabled(availabitily.dialog2Available != EnumAvailabilityDialog.Always);
|
||||
this.addButton(new GuiNpcButton(21, guiLeft + 230, y,20, 20, "X"));
|
||||
y += 23;
|
||||
this.addButton(new GuiNpcButton(1, guiLeft + 4, y, 50, 20, new String[]{"availability.always", "availability.after", "availability.before"}, availabitily.dialog2Available.ordinal()));
|
||||
this.addButton(new GuiNpcButton(11, guiLeft + 56, y, 172, 20, "availability.selectdialog"));
|
||||
getButton(11).setEnabled(availabitily.dialog2Available != EnumAvailabilityDialog.Always);
|
||||
this.addButton(new GuiNpcButton(21, guiLeft + 230, y, 20, 20, "X"));
|
||||
|
||||
y += 23;
|
||||
this.addButton(new GuiNpcButton(2, guiLeft + 4, y, 50, 20, new String[]{"availability.always","availability.after","availability.before"},availabitily.dialog3Available.ordinal()));
|
||||
this.addButton(new GuiNpcButton(12, guiLeft + 56, y, 172, 20, "availability.selectdialog"));
|
||||
getButton(12).setEnabled(availabitily.dialog3Available != EnumAvailabilityDialog.Always);
|
||||
this.addButton(new GuiNpcButton(22, guiLeft + 230, y,20, 20, "X"));
|
||||
y += 23;
|
||||
this.addButton(new GuiNpcButton(2, guiLeft + 4, y, 50, 20, new String[]{"availability.always", "availability.after", "availability.before"}, availabitily.dialog3Available.ordinal()));
|
||||
this.addButton(new GuiNpcButton(12, guiLeft + 56, y, 172, 20, "availability.selectdialog"));
|
||||
getButton(12).setEnabled(availabitily.dialog3Available != EnumAvailabilityDialog.Always);
|
||||
this.addButton(new GuiNpcButton(22, guiLeft + 230, y, 20, 20, "X"));
|
||||
|
||||
y += 23;
|
||||
this.addButton(new GuiNpcButton(3, guiLeft + 4, y, 50, 20, new String[]{"availability.always","availability.after","availability.before"},availabitily.dialog4Available.ordinal()));
|
||||
this.addButton(new GuiNpcButton(13, guiLeft + 56, y, 172, 20, "availability.selectdialog"));
|
||||
getButton(13).setEnabled(availabitily.dialog4Available != EnumAvailabilityDialog.Always);
|
||||
this.addButton(new GuiNpcButton(23, guiLeft + 230, y,20, 20, "X"));
|
||||
y += 23;
|
||||
this.addButton(new GuiNpcButton(3, guiLeft + 4, y, 50, 20, new String[]{"availability.always", "availability.after", "availability.before"}, availabitily.dialog4Available.ordinal()));
|
||||
this.addButton(new GuiNpcButton(13, guiLeft + 56, y, 172, 20, "availability.selectdialog"));
|
||||
getButton(13).setEnabled(availabitily.dialog4Available != EnumAvailabilityDialog.Always);
|
||||
this.addButton(new GuiNpcButton(23, guiLeft + 230, y, 20, 20, "X"));
|
||||
|
||||
|
||||
this.addButton(new GuiNpcButton(66, guiLeft + 82, guiTop + 192,98, 20, "gui.done"));
|
||||
this.addButton(new GuiNpcButton(66, guiLeft + 82, guiTop + 192, 98, 20, "gui.done"));
|
||||
|
||||
updateGuiButtons();
|
||||
updateGuiButtons();
|
||||
}
|
||||
|
||||
|
||||
private void updateGuiButtons() {
|
||||
getButton(10).setDisplayText("availability.selectdialog");
|
||||
getButton(11).setDisplayText("availability.selectdialog");
|
||||
getButton(12).setDisplayText("availability.selectdialog");
|
||||
getButton(13).setDisplayText("availability.selectdialog");
|
||||
getButton(10).setDisplayText("availability.selectdialog");
|
||||
getButton(11).setDisplayText("availability.selectdialog");
|
||||
getButton(12).setDisplayText("availability.selectdialog");
|
||||
getButton(13).setDisplayText("availability.selectdialog");
|
||||
|
||||
if(availabitily.dialogId >= 0){
|
||||
if (availabitily.dialogId >= 0) {
|
||||
DialogGetPacket.getDialog(availabitily.dialogId);
|
||||
}
|
||||
if(availabitily.dialog2Id >= 0){
|
||||
}
|
||||
if (availabitily.dialog2Id >= 0) {
|
||||
DialogGetPacket.getDialog(availabitily.dialog2Id);
|
||||
}
|
||||
if(availabitily.dialog3Id >= 0){
|
||||
}
|
||||
if (availabitily.dialog3Id >= 0) {
|
||||
DialogGetPacket.getDialog(availabitily.dialog3Id);
|
||||
}
|
||||
if(availabitily.dialog4Id >= 0){
|
||||
}
|
||||
if (availabitily.dialog4Id >= 0) {
|
||||
DialogGetPacket.getDialog(availabitily.dialog4Id);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton){
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
|
||||
if(button.id == 0){
|
||||
availabitily.dialogAvailable = EnumAvailabilityDialog.values()[button.getValue()];
|
||||
if(availabitily.dialogAvailable == EnumAvailabilityDialog.Always)
|
||||
availabitily.dialogId = -1;
|
||||
initGui();
|
||||
}
|
||||
if(button.id == 1){
|
||||
availabitily.dialog2Available = EnumAvailabilityDialog.values()[button.getValue()];
|
||||
if(availabitily.dialog2Available == EnumAvailabilityDialog.Always)
|
||||
availabitily.dialog2Id = -1;
|
||||
initGui();
|
||||
}
|
||||
if(button.id == 2){
|
||||
availabitily.dialog3Available = EnumAvailabilityDialog.values()[button.getValue()];
|
||||
if(availabitily.dialog3Available == EnumAvailabilityDialog.Always)
|
||||
availabitily.dialog3Id = -1;
|
||||
initGui();
|
||||
}
|
||||
if(button.id == 3){
|
||||
availabitily.dialog4Available = EnumAvailabilityDialog.values()[button.getValue()];
|
||||
if(availabitily.dialog4Available == EnumAvailabilityDialog.Always)
|
||||
availabitily.dialog4Id = -1;
|
||||
initGui();
|
||||
}
|
||||
if(button.id == 10){
|
||||
slot = 1;
|
||||
setSubGui(new GuiDialogSelection(availabitily.questId));
|
||||
}
|
||||
if(button.id == 11){
|
||||
slot = 2;
|
||||
setSubGui(new GuiDialogSelection(availabitily.quest2Id));
|
||||
}
|
||||
if(button.id == 12){
|
||||
slot = 3;
|
||||
setSubGui(new GuiDialogSelection(availabitily.quest3Id));
|
||||
}
|
||||
if(button.id == 13){
|
||||
slot = 4;
|
||||
setSubGui(new GuiDialogSelection(availabitily.quest4Id));
|
||||
}
|
||||
if(button.id == 20){
|
||||
availabitily.dialogId = -1;
|
||||
getButton(10).setDisplayText("availability.selectdialog");
|
||||
}
|
||||
if(button.id == 21){
|
||||
availabitily.dialog2Id = -1;
|
||||
getButton(11).setDisplayText("availability.selectdialog");
|
||||
}
|
||||
if(button.id == 22){
|
||||
availabitily.dialog3Id = -1;
|
||||
getButton(12).setDisplayText("availability.selectdialog");
|
||||
}
|
||||
if(button.id == 23){
|
||||
availabitily.dialog4Id = -1;
|
||||
getButton(13).setDisplayText("availability.selectdialog");
|
||||
}
|
||||
if(button.id == 66){
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selected(int id, String name) {
|
||||
if(slot == 1)
|
||||
availabitily.dialogId = id;
|
||||
if(slot == 2)
|
||||
availabitily.dialog2Id = id;
|
||||
if(slot == 3)
|
||||
availabitily.dialog3Id = id;
|
||||
if(slot == 4)
|
||||
availabitily.dialog4Id = id;
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
|
||||
if (button.id == 0) {
|
||||
availabitily.dialogAvailable = EnumAvailabilityDialog.values()[button.getValue()];
|
||||
if (availabitily.dialogAvailable == EnumAvailabilityDialog.Always)
|
||||
availabitily.dialogId = -1;
|
||||
initGui();
|
||||
}
|
||||
if (button.id == 1) {
|
||||
availabitily.dialog2Available = EnumAvailabilityDialog.values()[button.getValue()];
|
||||
if (availabitily.dialog2Available == EnumAvailabilityDialog.Always)
|
||||
availabitily.dialog2Id = -1;
|
||||
initGui();
|
||||
}
|
||||
if (button.id == 2) {
|
||||
availabitily.dialog3Available = EnumAvailabilityDialog.values()[button.getValue()];
|
||||
if (availabitily.dialog3Available == EnumAvailabilityDialog.Always)
|
||||
availabitily.dialog3Id = -1;
|
||||
initGui();
|
||||
}
|
||||
if (button.id == 3) {
|
||||
availabitily.dialog4Available = EnumAvailabilityDialog.values()[button.getValue()];
|
||||
if (availabitily.dialog4Available == EnumAvailabilityDialog.Always)
|
||||
availabitily.dialog4Id = -1;
|
||||
initGui();
|
||||
}
|
||||
if (button.id == 10) {
|
||||
slot = 1;
|
||||
setSubGui(new GuiDialogSelection(availabitily.questId));
|
||||
}
|
||||
if (button.id == 11) {
|
||||
slot = 2;
|
||||
setSubGui(new GuiDialogSelection(availabitily.quest2Id));
|
||||
}
|
||||
if (button.id == 12) {
|
||||
slot = 3;
|
||||
setSubGui(new GuiDialogSelection(availabitily.quest3Id));
|
||||
}
|
||||
if (button.id == 13) {
|
||||
slot = 4;
|
||||
setSubGui(new GuiDialogSelection(availabitily.quest4Id));
|
||||
}
|
||||
if (button.id == 20) {
|
||||
availabitily.dialogId = -1;
|
||||
getButton(10).setDisplayText("availability.selectdialog");
|
||||
}
|
||||
if (button.id == 21) {
|
||||
availabitily.dialog2Id = -1;
|
||||
getButton(11).setDisplayText("availability.selectdialog");
|
||||
}
|
||||
if (button.id == 22) {
|
||||
availabitily.dialog3Id = -1;
|
||||
getButton(12).setDisplayText("availability.selectdialog");
|
||||
}
|
||||
if (button.id == 23) {
|
||||
availabitily.dialog4Id = -1;
|
||||
getButton(13).setDisplayText("availability.selectdialog");
|
||||
}
|
||||
if (button.id == 66) {
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selected(int id, String name) {
|
||||
if (slot == 1)
|
||||
availabitily.dialogId = id;
|
||||
if (slot == 2)
|
||||
availabitily.dialog2Id = id;
|
||||
if (slot == 3)
|
||||
availabitily.dialog3Id = id;
|
||||
if (slot == 4)
|
||||
availabitily.dialog4Id = id;
|
||||
updateGuiButtons();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
Dialog dialog = new Dialog();
|
||||
dialog.readNBT(compound);
|
||||
if(availabitily.dialogId == dialog.id)
|
||||
getButton(10).setDisplayText(dialog.title);
|
||||
if(availabitily.dialog2Id == dialog.id)
|
||||
getButton(11).setDisplayText(dialog.title);
|
||||
if(availabitily.dialog3Id == dialog.id)
|
||||
getButton(12).setDisplayText(dialog.title);
|
||||
if(availabitily.dialog4Id == dialog.id)
|
||||
getButton(13).setDisplayText(dialog.title);
|
||||
}
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
Dialog dialog = new Dialog();
|
||||
dialog.readNBT(compound);
|
||||
if (availabitily.dialogId == dialog.id)
|
||||
getButton(10).setDisplayText(dialog.title);
|
||||
if (availabitily.dialog2Id == dialog.id)
|
||||
getButton(11).setDisplayText(dialog.title);
|
||||
if (availabitily.dialog3Id == dialog.id)
|
||||
getButton(12).setDisplayText(dialog.title);
|
||||
if (availabitily.dialog4Id == dialog.id)
|
||||
getButton(13).setDisplayText(dialog.title);
|
||||
}
|
||||
}
|
||||
@@ -10,167 +10,167 @@ import noppes.npcs.controllers.data.Availability;
|
||||
import noppes.npcs.controllers.data.Quest;
|
||||
|
||||
public class SubGuiNpcAvailabilityQuest extends SubGuiInterface implements GuiSelectionListener, IGuiData {
|
||||
private Availability availabitily;
|
||||
private int slot = 0;
|
||||
private Availability availabitily;
|
||||
private int slot = 0;
|
||||
|
||||
public SubGuiNpcAvailabilityQuest(Availability availabitily){
|
||||
this.availabitily = availabitily;
|
||||
setBackground("menubg.png");
|
||||
xSize = 316;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
}
|
||||
public SubGuiNpcAvailabilityQuest(Availability availabitily) {
|
||||
this.availabitily = availabitily;
|
||||
setBackground("menubg.png");
|
||||
xSize = 316;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui(){
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
addLabel(new GuiNpcLabel(1,"availability.available", guiLeft, guiTop + 4));
|
||||
addLabel(new GuiNpcLabel(1, "availability.available", guiLeft, guiTop + 4));
|
||||
getLabel(1).center(xSize);
|
||||
|
||||
int y = guiTop + 12;
|
||||
this.addButton(new GuiNpcButton(0, guiLeft + 4, y, 90, 20, new String[]{"availability.always","availability.after","availability.before","availability.whenactive", "availability.whennotactive", "availability.acceptable", "availability.notacceptable"},availabitily.questAvailable.ordinal()));
|
||||
this.addButton(new GuiNpcButton(10, guiLeft + 96, y, 192, 20, "availability.selectquest"));
|
||||
getButton(10).setEnabled(availabitily.questAvailable != EnumAvailabilityQuest.Always);
|
||||
this.addButton(new GuiNpcButton(20, guiLeft + 290, y, 20, 20, "X"));
|
||||
this.addButton(new GuiNpcButton(0, guiLeft + 4, y, 90, 20, new String[]{"availability.always", "availability.after", "availability.before", "availability.whenactive", "availability.whennotactive", "availability.acceptable", "availability.notacceptable"}, availabitily.questAvailable.ordinal()));
|
||||
this.addButton(new GuiNpcButton(10, guiLeft + 96, y, 192, 20, "availability.selectquest"));
|
||||
getButton(10).setEnabled(availabitily.questAvailable != EnumAvailabilityQuest.Always);
|
||||
this.addButton(new GuiNpcButton(20, guiLeft + 290, y, 20, 20, "X"));
|
||||
|
||||
y += 23;
|
||||
this.addButton(new GuiNpcButton(1, guiLeft + 4, y, 90, 20, new String[]{"availability.always","availability.after","availability.before","availability.whenactive", "availability.whennotactive", "availability.acceptable", "availability.notacceptable"},availabitily.quest2Available.ordinal()));
|
||||
this.addButton(new GuiNpcButton(11, guiLeft + 96, y, 192, 20, "availability.selectquest"));
|
||||
getButton(11).setEnabled(availabitily.quest2Available != EnumAvailabilityQuest.Always);
|
||||
this.addButton(new GuiNpcButton(21, guiLeft + 290, y, 20, 20, "X"));
|
||||
y += 23;
|
||||
this.addButton(new GuiNpcButton(1, guiLeft + 4, y, 90, 20, new String[]{"availability.always", "availability.after", "availability.before", "availability.whenactive", "availability.whennotactive", "availability.acceptable", "availability.notacceptable"}, availabitily.quest2Available.ordinal()));
|
||||
this.addButton(new GuiNpcButton(11, guiLeft + 96, y, 192, 20, "availability.selectquest"));
|
||||
getButton(11).setEnabled(availabitily.quest2Available != EnumAvailabilityQuest.Always);
|
||||
this.addButton(new GuiNpcButton(21, guiLeft + 290, y, 20, 20, "X"));
|
||||
|
||||
y += 23;
|
||||
this.addButton(new GuiNpcButton(2, guiLeft + 4, y, 90, 20, new String[]{"availability.always","availability.after","availability.before","availability.whenactive", "availability.whennotactive", "availability.acceptable", "availability.notacceptable"},availabitily.quest3Available.ordinal()));
|
||||
this.addButton(new GuiNpcButton(12, guiLeft + 96, y, 192, 20, "availability.selectquest"));
|
||||
getButton(12).setEnabled(availabitily.quest3Available != EnumAvailabilityQuest.Always);
|
||||
this.addButton(new GuiNpcButton(22, guiLeft + 290, y, 20, 20, "X"));
|
||||
y += 23;
|
||||
this.addButton(new GuiNpcButton(2, guiLeft + 4, y, 90, 20, new String[]{"availability.always", "availability.after", "availability.before", "availability.whenactive", "availability.whennotactive", "availability.acceptable", "availability.notacceptable"}, availabitily.quest3Available.ordinal()));
|
||||
this.addButton(new GuiNpcButton(12, guiLeft + 96, y, 192, 20, "availability.selectquest"));
|
||||
getButton(12).setEnabled(availabitily.quest3Available != EnumAvailabilityQuest.Always);
|
||||
this.addButton(new GuiNpcButton(22, guiLeft + 290, y, 20, 20, "X"));
|
||||
|
||||
y += 23;
|
||||
this.addButton(new GuiNpcButton(3, guiLeft + 4, y, 90, 20, new String[]{"availability.always","availability.after","availability.before","availability.whenactive", "availability.whennotactive", "availability.acceptable", "availability.notacceptable"},availabitily.quest4Available.ordinal()));
|
||||
this.addButton(new GuiNpcButton(13, guiLeft + 96, y, 192, 20, "availability.selectquest"));
|
||||
getButton(13).setEnabled(availabitily.quest4Available != EnumAvailabilityQuest.Always);
|
||||
this.addButton(new GuiNpcButton(23, guiLeft + 290, y, 20, 20, "X"));
|
||||
y += 23;
|
||||
this.addButton(new GuiNpcButton(3, guiLeft + 4, y, 90, 20, new String[]{"availability.always", "availability.after", "availability.before", "availability.whenactive", "availability.whennotactive", "availability.acceptable", "availability.notacceptable"}, availabitily.quest4Available.ordinal()));
|
||||
this.addButton(new GuiNpcButton(13, guiLeft + 96, y, 192, 20, "availability.selectquest"));
|
||||
getButton(13).setEnabled(availabitily.quest4Available != EnumAvailabilityQuest.Always);
|
||||
this.addButton(new GuiNpcButton(23, guiLeft + 290, y, 20, 20, "X"));
|
||||
|
||||
|
||||
this.addButton(new GuiNpcButton(66, guiLeft + 82, guiTop + 192,98, 20, "gui.done"));
|
||||
this.addButton(new GuiNpcButton(66, guiLeft + 82, guiTop + 192, 98, 20, "gui.done"));
|
||||
|
||||
updateGuiButtons();
|
||||
updateGuiButtons();
|
||||
}
|
||||
|
||||
|
||||
private void updateGuiButtons() {
|
||||
getButton(10).setDisplayText("availability.selectquest");
|
||||
getButton(11).setDisplayText("availability.selectquest");
|
||||
getButton(12).setDisplayText("availability.selectquest");
|
||||
getButton(13).setDisplayText("availability.selectquest");
|
||||
getButton(10).setDisplayText("availability.selectquest");
|
||||
getButton(11).setDisplayText("availability.selectquest");
|
||||
getButton(12).setDisplayText("availability.selectquest");
|
||||
getButton(13).setDisplayText("availability.selectquest");
|
||||
|
||||
if(availabitily.questId >= 0){
|
||||
if (availabitily.questId >= 0) {
|
||||
QuestGetPacket.getQuest(availabitily.questId);
|
||||
}
|
||||
if(availabitily.quest2Id >= 0){
|
||||
}
|
||||
if (availabitily.quest2Id >= 0) {
|
||||
QuestGetPacket.getQuest(availabitily.quest2Id);
|
||||
}
|
||||
if(availabitily.quest3Id >= 0){
|
||||
}
|
||||
if (availabitily.quest3Id >= 0) {
|
||||
QuestGetPacket.getQuest(availabitily.quest3Id);
|
||||
}
|
||||
if(availabitily.quest4Id >= 0){
|
||||
}
|
||||
if (availabitily.quest4Id >= 0) {
|
||||
QuestGetPacket.getQuest(availabitily.quest4Id);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton){
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
|
||||
if(button.id == 0){
|
||||
availabitily.questAvailable = EnumAvailabilityQuest.values()[button.getValue()];
|
||||
if(availabitily.questAvailable == EnumAvailabilityQuest.Always)
|
||||
availabitily.questId = -1;
|
||||
initGui();
|
||||
}
|
||||
if(button.id == 1){
|
||||
availabitily.quest2Available = EnumAvailabilityQuest.values()[button.getValue()];
|
||||
if(availabitily.quest2Available == EnumAvailabilityQuest.Always)
|
||||
availabitily.quest2Id = -1;
|
||||
initGui();
|
||||
}
|
||||
if(button.id == 2){
|
||||
availabitily.quest3Available = EnumAvailabilityQuest.values()[button.getValue()];
|
||||
if(availabitily.quest3Available == EnumAvailabilityQuest.Always)
|
||||
availabitily.quest3Id = -1;
|
||||
initGui();
|
||||
}
|
||||
if(button.id == 3){
|
||||
availabitily.quest4Available = EnumAvailabilityQuest.values()[button.getValue()];
|
||||
if(availabitily.quest4Available == EnumAvailabilityQuest.Always)
|
||||
availabitily.quest4Id = -1;
|
||||
initGui();
|
||||
}
|
||||
if(button.id == 10){
|
||||
slot = 1;
|
||||
setSubGui(new GuiQuestSelection(availabitily.questId));
|
||||
}
|
||||
if(button.id == 11){
|
||||
slot = 2;
|
||||
setSubGui(new GuiQuestSelection(availabitily.quest2Id));
|
||||
}
|
||||
if(button.id == 12){
|
||||
slot = 3;
|
||||
setSubGui(new GuiQuestSelection(availabitily.quest3Id));
|
||||
}
|
||||
if(button.id == 13){
|
||||
slot = 4;
|
||||
setSubGui(new GuiQuestSelection(availabitily.quest4Id));
|
||||
}
|
||||
|
||||
if(button.id == 20){
|
||||
availabitily.questId = -1;
|
||||
getButton(10).setDisplayText("availability.selectquest");
|
||||
}
|
||||
if(button.id == 21){
|
||||
availabitily.quest2Id = -1;
|
||||
getButton(11).setDisplayText("availability.selectquest");
|
||||
}
|
||||
if(button.id == 22){
|
||||
availabitily.quest3Id = -1;
|
||||
getButton(12).setDisplayText("availability.selectquest");
|
||||
}
|
||||
if(button.id == 23){
|
||||
availabitily.quest4Id = -1;
|
||||
getButton(13).setDisplayText("availability.selectquest");
|
||||
}
|
||||
|
||||
if(button.id == 66){
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selected(int id, String name) {
|
||||
if(slot == 1)
|
||||
availabitily.questId = id;
|
||||
if(slot == 2)
|
||||
availabitily.quest2Id = id;
|
||||
if(slot == 3)
|
||||
availabitily.quest3Id = id;
|
||||
if(slot == 4)
|
||||
availabitily.quest4Id = id;
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
|
||||
if (button.id == 0) {
|
||||
availabitily.questAvailable = EnumAvailabilityQuest.values()[button.getValue()];
|
||||
if (availabitily.questAvailable == EnumAvailabilityQuest.Always)
|
||||
availabitily.questId = -1;
|
||||
initGui();
|
||||
}
|
||||
if (button.id == 1) {
|
||||
availabitily.quest2Available = EnumAvailabilityQuest.values()[button.getValue()];
|
||||
if (availabitily.quest2Available == EnumAvailabilityQuest.Always)
|
||||
availabitily.quest2Id = -1;
|
||||
initGui();
|
||||
}
|
||||
if (button.id == 2) {
|
||||
availabitily.quest3Available = EnumAvailabilityQuest.values()[button.getValue()];
|
||||
if (availabitily.quest3Available == EnumAvailabilityQuest.Always)
|
||||
availabitily.quest3Id = -1;
|
||||
initGui();
|
||||
}
|
||||
if (button.id == 3) {
|
||||
availabitily.quest4Available = EnumAvailabilityQuest.values()[button.getValue()];
|
||||
if (availabitily.quest4Available == EnumAvailabilityQuest.Always)
|
||||
availabitily.quest4Id = -1;
|
||||
initGui();
|
||||
}
|
||||
if (button.id == 10) {
|
||||
slot = 1;
|
||||
setSubGui(new GuiQuestSelection(availabitily.questId));
|
||||
}
|
||||
if (button.id == 11) {
|
||||
slot = 2;
|
||||
setSubGui(new GuiQuestSelection(availabitily.quest2Id));
|
||||
}
|
||||
if (button.id == 12) {
|
||||
slot = 3;
|
||||
setSubGui(new GuiQuestSelection(availabitily.quest3Id));
|
||||
}
|
||||
if (button.id == 13) {
|
||||
slot = 4;
|
||||
setSubGui(new GuiQuestSelection(availabitily.quest4Id));
|
||||
}
|
||||
|
||||
if (button.id == 20) {
|
||||
availabitily.questId = -1;
|
||||
getButton(10).setDisplayText("availability.selectquest");
|
||||
}
|
||||
if (button.id == 21) {
|
||||
availabitily.quest2Id = -1;
|
||||
getButton(11).setDisplayText("availability.selectquest");
|
||||
}
|
||||
if (button.id == 22) {
|
||||
availabitily.quest3Id = -1;
|
||||
getButton(12).setDisplayText("availability.selectquest");
|
||||
}
|
||||
if (button.id == 23) {
|
||||
availabitily.quest4Id = -1;
|
||||
getButton(13).setDisplayText("availability.selectquest");
|
||||
}
|
||||
|
||||
if (button.id == 66) {
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selected(int id, String name) {
|
||||
if (slot == 1)
|
||||
availabitily.questId = id;
|
||||
if (slot == 2)
|
||||
availabitily.quest2Id = id;
|
||||
if (slot == 3)
|
||||
availabitily.quest3Id = id;
|
||||
if (slot == 4)
|
||||
availabitily.quest4Id = id;
|
||||
updateGuiButtons();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
Quest quest = new Quest();
|
||||
quest.readNBT(compound);
|
||||
if(availabitily.questId == quest.id)
|
||||
getButton(10).setDisplayText(quest.title);
|
||||
if(availabitily.quest2Id == quest.id)
|
||||
getButton(11).setDisplayText(quest.title);
|
||||
if(availabitily.quest3Id == quest.id)
|
||||
getButton(12).setDisplayText(quest.title);
|
||||
if(availabitily.quest4Id == quest.id)
|
||||
getButton(13).setDisplayText(quest.title);
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
Quest quest = new Quest();
|
||||
quest.readNBT(compound);
|
||||
if (availabitily.questId == quest.id)
|
||||
getButton(10).setDisplayText(quest.title);
|
||||
if (availabitily.quest2Id == quest.id)
|
||||
getButton(11).setDisplayText(quest.title);
|
||||
if (availabitily.quest3Id == quest.id)
|
||||
getButton(12).setDisplayText(quest.title);
|
||||
if (availabitily.quest4Id == quest.id)
|
||||
getButton(13).setDisplayText(quest.title);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,34 +11,33 @@ import noppes.npcs.controllers.data.SpawnData;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SubGuiNpcBiomes extends SubGuiInterface
|
||||
{
|
||||
private SpawnData data;
|
||||
private GuiCustomScroll scroll1;
|
||||
private GuiCustomScroll scroll2;
|
||||
public class SubGuiNpcBiomes extends SubGuiInterface {
|
||||
private SpawnData data;
|
||||
private GuiCustomScroll scroll1;
|
||||
private GuiCustomScroll scroll2;
|
||||
|
||||
public SubGuiNpcBiomes(SpawnData data){
|
||||
this.data = data;
|
||||
setBackground("menubg.png");
|
||||
xSize = 346;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
public SubGuiNpcBiomes(SpawnData data) {
|
||||
this.data = data;
|
||||
setBackground("menubg.png");
|
||||
xSize = 346;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
}
|
||||
|
||||
public void initGui(){
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
if(scroll1 == null){
|
||||
scroll1 = new GuiCustomScroll(this,0);
|
||||
scroll1.setSize(140, 180);
|
||||
if (scroll1 == null) {
|
||||
scroll1 = new GuiCustomScroll(this, 0);
|
||||
scroll1.setSize(140, 180);
|
||||
}
|
||||
scroll1.guiLeft = guiLeft + 4;
|
||||
scroll1.guiTop = guiTop + 14;
|
||||
this.addScroll(scroll1);
|
||||
addLabel(new GuiNpcLabel(1, "spawning.availableBiomes", guiLeft + 4, guiTop + 4));
|
||||
|
||||
if(scroll2 == null){
|
||||
scroll2 = new GuiCustomScroll(this,1);
|
||||
scroll2.setSize(140, 180);
|
||||
if (scroll2 == null) {
|
||||
scroll2 = new GuiCustomScroll(this, 1);
|
||||
scroll2.setSize(140, 180);
|
||||
}
|
||||
scroll2.guiLeft = guiLeft + 200;
|
||||
scroll2.guiTop = guiTop + 14;
|
||||
@@ -48,58 +47,58 @@ public class SubGuiNpcBiomes extends SubGuiInterface
|
||||
List<String> biomes = new ArrayList<String>();
|
||||
for (BiomeGenBase base : BiomeGenBase.getBiomeGenArray()) {
|
||||
if (base != null && base.biomeName != null && !data.biomes.contains(base.biomeName)) {
|
||||
biomes.add(base.biomeName);
|
||||
biomes.add(base.biomeName);
|
||||
}
|
||||
}
|
||||
scroll1.setList(biomes);
|
||||
scroll2.setList(data.biomes);
|
||||
|
||||
addButton(new GuiNpcButton(1, guiLeft + 145, guiTop + 40, 55, 20, ">"));
|
||||
addButton(new GuiNpcButton(2, guiLeft + 145, guiTop + 62, 55, 20, "<"));
|
||||
addButton(new GuiNpcButton(1, guiLeft + 145, guiTop + 40, 55, 20, ">"));
|
||||
addButton(new GuiNpcButton(2, guiLeft + 145, guiTop + 62, 55, 20, "<"));
|
||||
|
||||
addButton(new GuiNpcButton(3, guiLeft + 145, guiTop + 90, 55, 20, ">>"));
|
||||
addButton(new GuiNpcButton(4, guiLeft + 145, guiTop + 112, 55, 20, "<<"));
|
||||
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"));
|
||||
addButton(new GuiNpcButton(66, guiLeft + 260, guiTop + 194, 60, 20, "gui.done"));
|
||||
}
|
||||
|
||||
protected void actionPerformed(GuiButton guibutton){
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
if(button.id == 1){
|
||||
if(scroll1.hasSelected()){
|
||||
data.biomes.add(scroll1.getSelected());
|
||||
scroll1.selected = -1;
|
||||
scroll1.selected = -1;
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
if(button.id == 2){
|
||||
if(scroll2.hasSelected()){
|
||||
data.biomes.remove(scroll2.getSelected());
|
||||
scroll2.selected = -1;
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
if(button.id == 3){
|
||||
data.biomes.clear();
|
||||
for (BiomeGenBase base : BiomeGenBase.getBiomeGenArray()) {
|
||||
if (base != null) {
|
||||
data.biomes.add(base.biomeName);
|
||||
}
|
||||
}
|
||||
scroll1.selected = -1;
|
||||
scroll2.selected = -1;
|
||||
initGui();
|
||||
}
|
||||
if(button.id == 4){
|
||||
data.biomes.clear();
|
||||
scroll1.selected = -1;
|
||||
scroll2.selected = -1;
|
||||
initGui();
|
||||
}
|
||||
if(button.id == 66){
|
||||
close();
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
if (button.id == 1) {
|
||||
if (scroll1.hasSelected()) {
|
||||
data.biomes.add(scroll1.getSelected());
|
||||
scroll1.selected = -1;
|
||||
scroll1.selected = -1;
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
if (button.id == 2) {
|
||||
if (scroll2.hasSelected()) {
|
||||
data.biomes.remove(scroll2.getSelected());
|
||||
scroll2.selected = -1;
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
if (button.id == 3) {
|
||||
data.biomes.clear();
|
||||
for (BiomeGenBase base : BiomeGenBase.getBiomeGenArray()) {
|
||||
if (base != null) {
|
||||
data.biomes.add(base.biomeName);
|
||||
}
|
||||
}
|
||||
scroll1.selected = -1;
|
||||
scroll2.selected = -1;
|
||||
initGui();
|
||||
}
|
||||
if (button.id == 4) {
|
||||
data.biomes.clear();
|
||||
scroll1.selected = -1;
|
||||
scroll2.selected = -1;
|
||||
initGui();
|
||||
}
|
||||
if (button.id == 66) {
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,56 +3,52 @@ package noppes.npcs.client.gui;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
|
||||
public class SubGuiNpcCommand extends SubGuiInterface implements ITextfieldListener
|
||||
{
|
||||
public String command;
|
||||
public class SubGuiNpcCommand extends SubGuiInterface implements ITextfieldListener {
|
||||
public String command;
|
||||
|
||||
public SubGuiNpcCommand(String command)
|
||||
{
|
||||
this.command = command;
|
||||
setBackground("menubg.png");
|
||||
xSize = 256;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
public SubGuiNpcCommand(String command) {
|
||||
this.command = command;
|
||||
setBackground("menubg.png");
|
||||
xSize = 256;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
{
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
this.addLabel(new GuiNpcLabel(4, "advMode.command", guiLeft + 4, guiTop + 74));
|
||||
this.addTextField(new GuiNpcTextField(4, this, this.fontRendererObj, guiLeft + 4, guiTop + 84, 248, 20, command));
|
||||
this.getTextField(4).setMaxStringLength(32767);
|
||||
this.addTextField(new GuiNpcTextField(4, this, this.fontRendererObj, guiLeft + 4, guiTop + 84, 248, 20, command));
|
||||
this.getTextField(4).setMaxStringLength(32767);
|
||||
|
||||
this.addLabel(new GuiNpcLabel(5, "advMode.nearestPlayer", guiLeft + 4, guiTop + 110));
|
||||
this.addLabel(new GuiNpcLabel(6, "advMode.randomPlayer", guiLeft + 4, guiTop + 125));
|
||||
this.addLabel(new GuiNpcLabel(7, "advMode.allPlayers", guiLeft + 4, guiTop + 140));
|
||||
this.addLabel(new GuiNpcLabel(8, "dialog.commandoptionplayer", guiLeft + 4, guiTop + 155));
|
||||
this.addLabel(new GuiNpcLabel(5, "advMode.nearestPlayer", guiLeft + 4, guiTop + 110));
|
||||
this.addLabel(new GuiNpcLabel(6, "advMode.randomPlayer", guiLeft + 4, guiTop + 125));
|
||||
this.addLabel(new GuiNpcLabel(7, "advMode.allPlayers", guiLeft + 4, guiTop + 140));
|
||||
this.addLabel(new GuiNpcLabel(8, "dialog.commandoptionplayer", guiLeft + 4, guiTop + 155));
|
||||
this.addLabel(new GuiNpcLabel(9, "dialog.commandmultiple", guiLeft + 4, guiTop + 170));
|
||||
|
||||
this.addButton(new GuiNpcButton(66, guiLeft + 82, guiTop + 190,98, 20, "gui.done"));
|
||||
this.addButton(new GuiNpcButton(66, guiLeft + 82, guiTop + 190, 98, 20, "gui.done"));
|
||||
|
||||
}
|
||||
|
||||
protected void actionPerformed(GuiButton guibutton)
|
||||
{
|
||||
int id = guibutton.id;
|
||||
if(id == 66){
|
||||
close();
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
int id = guibutton.id;
|
||||
if (id == 66) {
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close(){
|
||||
if(getTextField(4) != null){
|
||||
public void close() {
|
||||
if (getTextField(4) != null) {
|
||||
unFocused(getTextField(4));
|
||||
}
|
||||
super.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unFocused(GuiNpcTextField textfield) {
|
||||
if(textfield.id == 4){
|
||||
command = textfield.getText();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void unFocused(GuiNpcTextField textfield) {
|
||||
if (textfield.id == 4) {
|
||||
command = textfield.getText();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,191 +15,182 @@ import noppes.npcs.controllers.data.Dialog;
|
||||
import noppes.npcs.controllers.data.PlayerMail;
|
||||
import noppes.npcs.entity.EntityDialogNpc;
|
||||
|
||||
public class SubGuiNpcDialog extends SubGuiInterface implements ISubGuiListener, GuiSelectionListener,ITextfieldListener
|
||||
{
|
||||
public int dialogCategoryID;
|
||||
public Dialog dialog;
|
||||
private final GuiNPCManageDialogs parent;
|
||||
public class SubGuiNpcDialog extends SubGuiInterface implements ISubGuiListener, GuiSelectionListener, ITextfieldListener {
|
||||
public int dialogCategoryID;
|
||||
public Dialog dialog;
|
||||
private final GuiNPCManageDialogs parent;
|
||||
|
||||
public SubGuiNpcDialog(GuiNPCManageDialogs parent, Dialog dialog, int catId)
|
||||
{
|
||||
this.parent = parent;
|
||||
this.dialog = dialog;
|
||||
this.dialogCategoryID = catId;
|
||||
setBackground("menubg.png");
|
||||
xSize = 360;
|
||||
ySize = 216;
|
||||
}
|
||||
public SubGuiNpcDialog(GuiNPCManageDialogs parent, Dialog dialog, int catId) {
|
||||
this.parent = parent;
|
||||
this.dialog = dialog;
|
||||
this.dialogCategoryID = catId;
|
||||
setBackground("menubg.png");
|
||||
xSize = 360;
|
||||
ySize = 216;
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
{
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
addLabel(new GuiNpcLabel(1,"gui.title", guiLeft + 4, guiTop + 8));
|
||||
addTextField(new GuiNpcTextField(1, this, this.fontRendererObj, guiLeft + 36, guiTop + 3, 200, 20, dialog.title));
|
||||
addLabel(new GuiNpcLabel(1, "gui.title", guiLeft + 4, guiTop + 8));
|
||||
addTextField(new GuiNpcTextField(1, this, this.fontRendererObj, guiLeft + 36, guiTop + 3, 200, 20, dialog.title));
|
||||
|
||||
addLabel(new GuiNpcLabel(0,"ID", guiLeft + 238, guiTop + 4));
|
||||
addLabel(new GuiNpcLabel(2, dialog.id + "", guiLeft + 238, guiTop + 14));
|
||||
addLabel(new GuiNpcLabel(0, "ID", guiLeft + 238, guiTop + 4));
|
||||
addLabel(new GuiNpcLabel(2, dialog.id + "", guiLeft + 238, guiTop + 14));
|
||||
|
||||
addLabel(new GuiNpcLabel(3, "dialog.dialogtext", guiLeft + 7, guiTop + 33));
|
||||
addButton(new GuiNpcButton(3, guiLeft + 120, guiTop + 28, 50, 20, "selectServer.edit"));
|
||||
addLabel(new GuiNpcLabel(3, "dialog.dialogtext", guiLeft + 7, guiTop + 33));
|
||||
addButton(new GuiNpcButton(3, guiLeft + 120, guiTop + 28, 50, 20, "selectServer.edit"));
|
||||
|
||||
addLabel(new GuiNpcLabel(6, "dialog.options", guiLeft + 7, guiTop + 57));
|
||||
addButton(new GuiNpcButton(6, guiLeft + 120, guiTop + 52, 50, 20, "selectServer.edit"));
|
||||
addLabel(new GuiNpcLabel(6, "dialog.options", guiLeft + 7, guiTop + 57));
|
||||
addButton(new GuiNpcButton(6, guiLeft + 120, guiTop + 52, 50, 20, "selectServer.edit"));
|
||||
|
||||
addLabel(new GuiNpcLabel(11, "dialog.visualOption", guiLeft + 7, guiTop + 81));
|
||||
addButton(new GuiNpcButton(11, guiLeft + 120, guiTop + 76, 50, 20, "selectServer.edit"));
|
||||
addLabel(new GuiNpcLabel(11, "dialog.visualOption", guiLeft + 7, guiTop + 81));
|
||||
addButton(new GuiNpcButton(11, guiLeft + 120, guiTop + 76, 50, 20, "selectServer.edit"));
|
||||
|
||||
addLabel(new GuiNpcLabel(9, "gui.selectSound", guiLeft + 7, guiTop + 105));
|
||||
addTextField(new GuiNpcTextField(2, this, fontRendererObj, guiLeft + 90, guiTop + 100, 194, 20, dialog.sound));
|
||||
addButton(new GuiNpcButton(9, guiLeft + 293, guiTop + 100, 60, 20, "gui.select"));
|
||||
addLabel(new GuiNpcLabel(9, "gui.selectSound", guiLeft + 7, guiTop + 105));
|
||||
addTextField(new GuiNpcTextField(2, this, fontRendererObj, guiLeft + 90, guiTop + 100, 194, 20, dialog.sound));
|
||||
addButton(new GuiNpcButton(9, guiLeft + 293, guiTop + 100, 60, 20, "gui.select"));
|
||||
|
||||
addLabel(new GuiNpcLabel(4, "availability.options", guiLeft + 180, guiTop + 33));
|
||||
addButton(new GuiNpcButton(4, guiLeft + 303, guiTop + 28, 50, 20, "selectServer.edit"));
|
||||
addLabel(new GuiNpcLabel(4, "availability.options", guiLeft + 180, guiTop + 33));
|
||||
addButton(new GuiNpcButton(4, guiLeft + 303, guiTop + 28, 50, 20, "selectServer.edit"));
|
||||
|
||||
addLabel(new GuiNpcLabel(5, "faction.options", guiLeft + 180, guiTop + 57));
|
||||
addButton(new GuiNpcButton(5, guiLeft + 303, guiTop + 52, 50, 20, "selectServer.edit"));
|
||||
addLabel(new GuiNpcLabel(5, "faction.options", guiLeft + 180, guiTop + 57));
|
||||
addButton(new GuiNpcButton(5, guiLeft + 303, guiTop + 52, 50, 20, "selectServer.edit"));
|
||||
|
||||
addButton(new GuiNpcButton(7, guiLeft + 4, guiTop + 130, 144, 20, "availability.selectquest"));
|
||||
addButton(new GuiNpcButton(8, guiLeft + 150, guiTop + 130, 20, 20, "X"));
|
||||
addButton(new GuiNpcButton(7, guiLeft + 4, guiTop + 130, 144, 20, "availability.selectquest"));
|
||||
addButton(new GuiNpcButton(8, guiLeft + 150, guiTop + 130, 20, 20, "X"));
|
||||
|
||||
addButton(new GuiNpcButton(13, guiLeft + 4, guiTop + 154, 144, 20, "mailbox.setup"));
|
||||
addButton(new GuiNpcButton(14, guiLeft + 150, guiTop + 154, 20, 20, "X"));
|
||||
addButton(new GuiNpcButton(13, guiLeft + 4, guiTop + 154, 144, 20, "mailbox.setup"));
|
||||
addButton(new GuiNpcButton(14, guiLeft + 150, guiTop + 154, 20, 20, "X"));
|
||||
|
||||
addButton(new GuiNpcButton(10, guiLeft + 303, guiTop + 130, 50, 20, "selectServer.edit"));
|
||||
addLabel(new GuiNpcLabel(10, "advMode.command", guiLeft + 180, guiTop + 130 + 5));
|
||||
addButton(new GuiNpcButton(10, guiLeft + 303, guiTop + 130, 50, 20, "selectServer.edit"));
|
||||
addLabel(new GuiNpcLabel(10, "advMode.command", guiLeft + 180, guiTop + 130 + 5));
|
||||
|
||||
addButton(new GuiNpcButtonYesNo(15, guiLeft + 303, guiTop + 154, dialog.disableEsc));
|
||||
addLabel(new GuiNpcLabel(15, "dialog.disableEsc", guiLeft + 180, guiTop + 154 + 5));
|
||||
addButton(new GuiNpcButtonYesNo(15, guiLeft + 303, guiTop + 154, dialog.disableEsc));
|
||||
addLabel(new GuiNpcLabel(15, "dialog.disableEsc", guiLeft + 180, guiTop + 154 + 5));
|
||||
|
||||
addButton(new GuiNpcButton(16, guiLeft + 303, guiTop + 192, 50, 20, "gui.done"));
|
||||
addButton(new GuiNpcButton(16, guiLeft + 303, guiTop + 192, 50, 20, "gui.done"));
|
||||
addButton(new GuiNpcButton(17, guiLeft + 303 - 55, guiTop + 192, 50, 20, "gui.test"));
|
||||
|
||||
if(!parent.dialogQuestName.equals(""))
|
||||
getButton(7).setDisplayText(parent.dialogQuestName);
|
||||
if (!parent.dialogQuestName.equals(""))
|
||||
getButton(7).setDisplayText(parent.dialogQuestName);
|
||||
|
||||
if(!dialog.mail.subject.isEmpty())
|
||||
getButton(13).setDisplayText(dialog.mail.subject);
|
||||
}
|
||||
if (!dialog.mail.subject.isEmpty())
|
||||
getButton(13).setDisplayText(dialog.mail.subject);
|
||||
}
|
||||
|
||||
public void buttonEvent(GuiButton guibutton)
|
||||
{
|
||||
int id = guibutton.id;
|
||||
if(id == 3 && dialog.id >= 0){
|
||||
setSubGui(new SubGuiNpcTextArea(dialog.text));
|
||||
}
|
||||
if(id == 4 && dialog.id >= 0){
|
||||
setSubGui(new SubGuiNpcAvailability(dialog.availability));
|
||||
}
|
||||
if(id == 5 && dialog.id >= 0){
|
||||
setSubGui(new SubGuiNpcFactionOptions(dialog.factionOptions));
|
||||
}
|
||||
if(id == 6 && dialog.id >= 0){
|
||||
setSubGui(new SubGuiNpcDialogOptions(dialog));
|
||||
}
|
||||
if(id == 7 && dialog.id >= 0){
|
||||
public void buttonEvent(GuiButton guibutton) {
|
||||
int id = guibutton.id;
|
||||
if (id == 3 && dialog.id >= 0) {
|
||||
setSubGui(new SubGuiNpcTextArea(dialog.text));
|
||||
}
|
||||
if (id == 4 && dialog.id >= 0) {
|
||||
setSubGui(new SubGuiNpcAvailability(dialog.availability));
|
||||
}
|
||||
if (id == 5 && dialog.id >= 0) {
|
||||
setSubGui(new SubGuiNpcFactionOptions(dialog.factionOptions));
|
||||
}
|
||||
if (id == 6 && dialog.id >= 0) {
|
||||
setSubGui(new SubGuiNpcDialogOptions(dialog));
|
||||
}
|
||||
if (id == 7 && dialog.id >= 0) {
|
||||
setSubGui(new GuiQuestSelection(dialog.quest));
|
||||
}
|
||||
if(id == 8 && dialog.id >= 0){
|
||||
dialog.quest = -1;
|
||||
parent.dialogQuestName = "";
|
||||
initGui();
|
||||
}
|
||||
if(id == 9 && dialog.id >= 0){
|
||||
}
|
||||
if (id == 8 && dialog.id >= 0) {
|
||||
dialog.quest = -1;
|
||||
parent.dialogQuestName = "";
|
||||
initGui();
|
||||
}
|
||||
if (id == 9 && dialog.id >= 0) {
|
||||
setSubGui(new GuiSoundSelection((getTextField(2).getText())));
|
||||
}
|
||||
if(id == 10){
|
||||
setSubGui(new SubGuiNpcCommand(dialog.command));
|
||||
}
|
||||
if(id == 11){
|
||||
setSubGui(new SubGuiNpcDialogVisual(dialog));
|
||||
}
|
||||
if(id == 13){
|
||||
setSubGui(new SubGuiMailmanSendSetup(dialog.mail, getParent()));
|
||||
}
|
||||
if(id == 14){
|
||||
dialog.mail = new PlayerMail();
|
||||
initGui();
|
||||
}
|
||||
if(id == 15){
|
||||
if(guibutton instanceof GuiNpcButton){
|
||||
dialog.disableEsc = ((GuiNpcButton) guibutton).getValue() == 1;
|
||||
}
|
||||
}
|
||||
if(id == 16){
|
||||
close();
|
||||
}
|
||||
if(id == 17){
|
||||
}
|
||||
if (id == 10) {
|
||||
setSubGui(new SubGuiNpcCommand(dialog.command));
|
||||
}
|
||||
if (id == 11) {
|
||||
setSubGui(new SubGuiNpcDialogVisual(dialog));
|
||||
}
|
||||
if (id == 13) {
|
||||
setSubGui(new SubGuiMailmanSendSetup(dialog.mail, getParent()));
|
||||
}
|
||||
if (id == 14) {
|
||||
dialog.mail = new PlayerMail();
|
||||
initGui();
|
||||
}
|
||||
if (id == 15) {
|
||||
if (guibutton instanceof GuiNpcButton) {
|
||||
dialog.disableEsc = ((GuiNpcButton) guibutton).getValue() == 1;
|
||||
}
|
||||
}
|
||||
if (id == 16) {
|
||||
close();
|
||||
}
|
||||
if (id == 17) {
|
||||
EntityDialogNpc npc = new EntityDialogNpc(player.worldObj);
|
||||
npc.display.name = "TEST";
|
||||
EntityUtil.Copy(player, npc);
|
||||
GuiDialogInteract gui = new GuiDialogInteract(getParent(), npc, dialog);
|
||||
NoppesUtil.openGUI(player, gui);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unFocused(GuiNpcTextField guiNpcTextField) {
|
||||
if(guiNpcTextField.id == 1) {
|
||||
if(dialog.id < 0)
|
||||
guiNpcTextField.setText("");
|
||||
else{
|
||||
String name = guiNpcTextField.getText();
|
||||
if(name.isEmpty() || this.parent.dialogData.containsKey(name)){
|
||||
guiNpcTextField.setText(dialog.title);
|
||||
}
|
||||
else if(dialog.id >= 0){
|
||||
String old = dialog.title;
|
||||
this.parent.dialogData.remove(old);
|
||||
dialog.title = name;
|
||||
this.parent.dialogData.put(dialog.title, dialog.id);
|
||||
this.parent.dialogScroll.replace(old,dialog.title);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(guiNpcTextField.id == 2) {
|
||||
dialog.sound = guiNpcTextField.getText();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void unFocused(GuiNpcTextField guiNpcTextField) {
|
||||
if (guiNpcTextField.id == 1) {
|
||||
if (dialog.id < 0)
|
||||
guiNpcTextField.setText("");
|
||||
else {
|
||||
String name = guiNpcTextField.getText();
|
||||
if (name.isEmpty() || this.parent.dialogData.containsKey(name)) {
|
||||
guiNpcTextField.setText(dialog.title);
|
||||
} else if (dialog.id >= 0) {
|
||||
String old = dialog.title;
|
||||
this.parent.dialogData.remove(old);
|
||||
dialog.title = name;
|
||||
this.parent.dialogData.put(dialog.title, dialog.id);
|
||||
this.parent.dialogScroll.replace(old, dialog.title);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (guiNpcTextField.id == 2) {
|
||||
dialog.sound = guiNpcTextField.getText();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void subGuiClosed(SubGuiInterface subgui){
|
||||
if(subgui instanceof SubGuiNpcTextArea){
|
||||
SubGuiNpcTextArea gui = (SubGuiNpcTextArea) subgui;
|
||||
dialog.text = gui.text;
|
||||
}
|
||||
else if(subgui instanceof SubGuiNpcCommand){
|
||||
dialog.command = ((SubGuiNpcCommand) subgui).command;
|
||||
}
|
||||
else if(subgui instanceof GuiQuestSelection){
|
||||
@Override
|
||||
public void subGuiClosed(SubGuiInterface subgui) {
|
||||
if (subgui instanceof SubGuiNpcTextArea) {
|
||||
SubGuiNpcTextArea gui = (SubGuiNpcTextArea) subgui;
|
||||
dialog.text = gui.text;
|
||||
} else if (subgui instanceof SubGuiNpcCommand) {
|
||||
dialog.command = ((SubGuiNpcCommand) subgui).command;
|
||||
} else if (subgui instanceof GuiQuestSelection) {
|
||||
GuiQuestSelection gqs = (GuiQuestSelection) subgui;
|
||||
if(gqs.selectedQuest != null) {
|
||||
if (gqs.selectedQuest != null) {
|
||||
dialog.quest = gqs.selectedQuest.id;
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
else if(subgui instanceof SubGuiMailmanSendSetup){
|
||||
initGui();
|
||||
}
|
||||
else if (subgui instanceof GuiSoundSelection){
|
||||
} else if (subgui instanceof SubGuiMailmanSendSetup) {
|
||||
initGui();
|
||||
} else if (subgui instanceof GuiSoundSelection) {
|
||||
GuiSoundSelection gss = (GuiSoundSelection) subgui;
|
||||
if(gss.selectedResource != null) {
|
||||
if (gss.selectedResource != null) {
|
||||
getTextField(2).setText(gss.selectedResource.toString());
|
||||
unFocused(getTextField(2));
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selected(int ob, String name) {
|
||||
dialog.quest = ob;
|
||||
parent.dialogQuestName = name;
|
||||
initGui();
|
||||
@Override
|
||||
public void selected(int ob, String name) {
|
||||
dialog.quest = ob;
|
||||
parent.dialogQuestName = name;
|
||||
initGui();
|
||||
PacketClient.sendClient(new DialogSavePacket(this.dialogCategoryID, dialog.writeToNBT(new NBTTagCompound()), false));
|
||||
}
|
||||
}
|
||||
|
||||
public void save(){
|
||||
public void save() {
|
||||
PacketClient.sendClient(new DialogSavePacket(this.dialogCategoryID, dialog.writeToNBT(new NBTTagCompound()), false));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,20 +9,20 @@ import noppes.npcs.constants.EnumOptionType;
|
||||
import noppes.npcs.controllers.data.Dialog;
|
||||
import noppes.npcs.controllers.data.DialogOption;
|
||||
|
||||
public class SubGuiNpcDialogOption extends SubGuiInterface implements IGuiData, ITextfieldListener, GuiSelectionListener, ISubGuiListener{
|
||||
private DialogOption option;
|
||||
public static int LastColor = 0xe0e0e0;
|
||||
public class SubGuiNpcDialogOption extends SubGuiInterface implements IGuiData, ITextfieldListener, GuiSelectionListener, ISubGuiListener {
|
||||
private DialogOption option;
|
||||
public static int LastColor = 0xe0e0e0;
|
||||
|
||||
public SubGuiNpcDialogOption(DialogOption option){
|
||||
this.option = option;
|
||||
setBackground("menubg.png");
|
||||
xSize = 256;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
public SubGuiNpcDialogOption(DialogOption option) {
|
||||
this.option = option;
|
||||
setBackground("menubg.png");
|
||||
xSize = 256;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui(){
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
this.addLabel(new GuiNpcLabel(66, "dialog.editoption", guiLeft, guiTop + 4));
|
||||
this.getLabel(66).center(xSize);
|
||||
@@ -31,97 +31,96 @@ public class SubGuiNpcDialogOption extends SubGuiInterface implements IGuiData,
|
||||
this.addTextField(new GuiNpcTextField(0, this, this.fontRendererObj, guiLeft + 40, guiTop + 15, 196, 20, option.title));
|
||||
|
||||
String color = Integer.toHexString(option.optionColor);
|
||||
while(color.length() < 6)
|
||||
color = 0 + color;
|
||||
while (color.length() < 6)
|
||||
color = 0 + color;
|
||||
addLabel(new GuiNpcLabel(2, "gui.color", guiLeft + 4, guiTop + 45));
|
||||
this.addButton(new GuiNpcButton(2, guiLeft + 62, guiTop + 40, 92, 20, color));
|
||||
this.getButton(2).setTextColor(option.optionColor);
|
||||
this.addButton(new GuiNpcButton(2, guiLeft + 62, guiTop + 40, 92, 20, color));
|
||||
this.getButton(2).setTextColor(option.optionColor);
|
||||
|
||||
this.addLabel(new GuiNpcLabel(1, "dialog.optiontype", guiLeft + 4, guiTop + 67));
|
||||
this.addButton(new GuiNpcButton(1, guiLeft + 62, guiTop + 62, 92, 20, new String[]{"gui.close","dialog.dialog","gui.disabled","menu.role","tile.commandBlock.name"},option.optionType.ordinal()));
|
||||
this.addButton(new GuiNpcButton(1, guiLeft + 62, guiTop + 62, 92, 20, new String[]{"gui.close", "dialog.dialog", "gui.disabled", "menu.role", "tile.commandBlock.name"}, option.optionType.ordinal()));
|
||||
|
||||
if(option.optionType == EnumOptionType.DialogOption){
|
||||
this.addButton(new GuiNpcButton(3, guiLeft + 4, guiTop + 84, "availability.selectdialog"));
|
||||
if(option.dialogId >= 0)
|
||||
if (option.optionType == EnumOptionType.DialogOption) {
|
||||
this.addButton(new GuiNpcButton(3, guiLeft + 4, guiTop + 84, "availability.selectdialog"));
|
||||
if (option.dialogId >= 0)
|
||||
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));
|
||||
this.getTextField(4).setMaxStringLength(32767);
|
||||
}
|
||||
if (option.optionType == EnumOptionType.CommandBlock) {
|
||||
this.addTextField(new GuiNpcTextField(4, this, this.fontRendererObj, guiLeft + 4, guiTop + 84, 248, 20, option.command));
|
||||
this.getTextField(4).setMaxStringLength(32767);
|
||||
|
||||
this.addLabel(new GuiNpcLabel(5, "advMode.nearestPlayer", guiLeft + 4, guiTop + 110));
|
||||
this.addLabel(new GuiNpcLabel(6, "advMode.randomPlayer", guiLeft + 4, guiTop + 125));
|
||||
this.addLabel(new GuiNpcLabel(7, "advMode.allPlayers", guiLeft + 4, guiTop + 140));
|
||||
this.addLabel(new GuiNpcLabel(8, "dialog.commandoptionplayer", guiLeft + 4, guiTop + 155));
|
||||
this.addLabel(new GuiNpcLabel(9, "dialog.commandmultiple", guiLeft + 4, guiTop + 170));
|
||||
}
|
||||
}
|
||||
|
||||
this.addButton(new GuiNpcButton(66, guiLeft + 82, guiTop + 190,98, 20, "gui.done"));
|
||||
this.addButton(new GuiNpcButton(66, guiLeft + 82, guiTop + 190, 98, 20, "gui.done"));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton){
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
|
||||
if(button.id == 1){
|
||||
option.optionType = EnumOptionType.values()[button.getValue()];
|
||||
initGui();
|
||||
}
|
||||
if(button.id == 2){
|
||||
this.setSubGui(new SubGuiColorSelector(option.optionColor));
|
||||
}
|
||||
if(button.id == 3){
|
||||
if (button.id == 1) {
|
||||
option.optionType = EnumOptionType.values()[button.getValue()];
|
||||
initGui();
|
||||
}
|
||||
if (button.id == 2) {
|
||||
this.setSubGui(new SubGuiColorSelector(option.optionColor));
|
||||
}
|
||||
if (button.id == 3) {
|
||||
setSubGui(new GuiDialogSelection(option.dialogId));
|
||||
}
|
||||
if(button.id == 66)
|
||||
{
|
||||
close();
|
||||
}
|
||||
if (button.id == 66) {
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unFocused(GuiNpcTextField textfield) {
|
||||
if(textfield.id == 0){
|
||||
if(textfield.isEmpty())
|
||||
textfield.setText(option.title);
|
||||
else{
|
||||
option.title = textfield.getText();
|
||||
}
|
||||
}
|
||||
if(textfield.id == 4){
|
||||
option.command = textfield.getText();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
if(compound.hasKey("DialogId")){
|
||||
Dialog dialog = new Dialog();
|
||||
dialog.readNBT(compound);
|
||||
option.dialogId = dialog.id;
|
||||
if(this.getButton(3) != null)
|
||||
getButton(3).setDisplayText(dialog.title);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selected(int ob, String name) {
|
||||
option.dialogId = ob;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void subGuiClosed(SubGuiInterface subgui) {
|
||||
if(subgui instanceof SubGuiColorSelector) {
|
||||
LastColor = option.optionColor = ((SubGuiColorSelector)subgui).color;
|
||||
@Override
|
||||
public void unFocused(GuiNpcTextField textfield) {
|
||||
if (textfield.id == 0) {
|
||||
if (textfield.isEmpty())
|
||||
textfield.setText(option.title);
|
||||
else {
|
||||
option.title = textfield.getText();
|
||||
}
|
||||
}
|
||||
if(subgui instanceof GuiDialogSelection) {
|
||||
Dialog dialog = ((GuiDialogSelection)subgui).selectedDialog;
|
||||
if(dialog != null) {
|
||||
if (textfield.id == 4) {
|
||||
option.command = textfield.getText();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
if (compound.hasKey("DialogId")) {
|
||||
Dialog dialog = new Dialog();
|
||||
dialog.readNBT(compound);
|
||||
option.dialogId = dialog.id;
|
||||
if (this.getButton(3) != null)
|
||||
getButton(3).setDisplayText(dialog.title);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selected(int ob, String name) {
|
||||
option.dialogId = ob;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void subGuiClosed(SubGuiInterface subgui) {
|
||||
if (subgui instanceof SubGuiColorSelector) {
|
||||
LastColor = option.optionColor = ((SubGuiColorSelector) subgui).color;
|
||||
}
|
||||
if (subgui instanceof GuiDialogSelection) {
|
||||
Dialog dialog = ((GuiDialogSelection) subgui).selectedDialog;
|
||||
if (dialog != null) {
|
||||
option.dialogId = dialog.id;
|
||||
}
|
||||
}
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,55 +8,50 @@ import noppes.npcs.constants.EnumOptionType;
|
||||
import noppes.npcs.controllers.data.Dialog;
|
||||
import noppes.npcs.controllers.data.DialogOption;
|
||||
|
||||
public class SubGuiNpcDialogOptions extends SubGuiInterface
|
||||
{
|
||||
private Dialog dialog;
|
||||
|
||||
public SubGuiNpcDialogOptions(Dialog dialog)
|
||||
{
|
||||
this.dialog = dialog;
|
||||
setBackground("menubg.png");
|
||||
xSize = 256;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
public class SubGuiNpcDialogOptions extends SubGuiInterface {
|
||||
private Dialog dialog;
|
||||
|
||||
public SubGuiNpcDialogOptions(Dialog dialog) {
|
||||
this.dialog = dialog;
|
||||
setBackground("menubg.png");
|
||||
xSize = 256;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
{
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
this.addLabel(new GuiNpcLabel(66, "dialog.options", guiLeft, guiTop + 4));
|
||||
this.getLabel(66).center(xSize);
|
||||
|
||||
for (int i = 0; i < 6; i++) {
|
||||
String optionString = "";
|
||||
DialogOption option = dialog.options.get(i);
|
||||
if(option != null && option.optionType != EnumOptionType.Disabled)
|
||||
optionString += option.title;
|
||||
|
||||
this.addLabel(new GuiNpcLabel(i + 10, i + 1 + ": ", guiLeft + 4, guiTop + 16 + i * 32));
|
||||
this.addLabel(new GuiNpcLabel(i, optionString, guiLeft + 14, guiTop + 12 + i * 32));
|
||||
this.addButton(new GuiNpcButton(i, guiLeft + 13, guiTop + 21 + i * 32, 60, 20, "selectServer.edit"));
|
||||
|
||||
}
|
||||
for (int i = 0; i < 6; i++) {
|
||||
String optionString = "";
|
||||
DialogOption option = dialog.options.get(i);
|
||||
if (option != null && option.optionType != EnumOptionType.Disabled)
|
||||
optionString += option.title;
|
||||
|
||||
this.addLabel(new GuiNpcLabel(i + 10, i + 1 + ": ", guiLeft + 4, guiTop + 16 + i * 32));
|
||||
this.addLabel(new GuiNpcLabel(i, optionString, guiLeft + 14, guiTop + 12 + i * 32));
|
||||
this.addButton(new GuiNpcButton(i, guiLeft + 13, guiTop + 21 + i * 32, 60, 20, "selectServer.edit"));
|
||||
|
||||
}
|
||||
|
||||
this.addButton(new GuiNpcButton(66, guiLeft + 82, guiTop + 194, 98, 20, "gui.done"));
|
||||
|
||||
this.addButton(new GuiNpcButton(66, guiLeft + 82, guiTop + 194,98, 20, "gui.done"));
|
||||
|
||||
}
|
||||
|
||||
protected void actionPerformed(GuiButton guibutton)
|
||||
{
|
||||
int id = guibutton.id;
|
||||
if(id < 6){
|
||||
DialogOption option = dialog.options.get(id);
|
||||
if(option == null){
|
||||
dialog.options.put(id, option = new DialogOption());
|
||||
option.optionColor = SubGuiNpcDialogOption.LastColor;
|
||||
}
|
||||
this.setSubGui(new SubGuiNpcDialogOption(option));
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
int id = guibutton.id;
|
||||
if (id < 6) {
|
||||
DialogOption option = dialog.options.get(id);
|
||||
if (option == null) {
|
||||
dialog.options.put(id, option = new DialogOption());
|
||||
option.optionColor = SubGuiNpcDialogOption.LastColor;
|
||||
}
|
||||
this.setSubGui(new SubGuiNpcDialogOption(option));
|
||||
}
|
||||
if(id == 66)
|
||||
{
|
||||
close();
|
||||
if (id == 66) {
|
||||
close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,17 +32,16 @@ public class SubGuiNpcDialogVisual extends SubGuiInterface implements ISubGuiLis
|
||||
closeOnEsc = true;
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
{
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
int y = guiTop - 10;
|
||||
|
||||
GuiMenuTopButton close = new GuiMenuTopButton(0,guiLeft + xSize - 22, guiTop - 17, "X");
|
||||
GuiMenuTopButton general = new GuiMenuTopButton(1, guiLeft + 4, guiTop - 17, "General");
|
||||
GuiMenuTopButton spacing = new GuiMenuTopButton(2, general.xPosition + general.getWidth(), guiTop - 17, "Spacing");
|
||||
GuiMenuTopButton images = new GuiMenuTopButton(3, spacing.xPosition + spacing.getWidth(), guiTop - 17, "Images");
|
||||
topButtons = new GuiMenuTopButton[]{general,images,spacing,close};
|
||||
for(GuiMenuTopButton button : topButtons) {
|
||||
GuiMenuTopButton close = new GuiMenuTopButton(0, guiLeft + xSize - 22, guiTop - 17, "X");
|
||||
GuiMenuTopButton general = new GuiMenuTopButton(1, guiLeft + 4, guiTop - 17, "General");
|
||||
GuiMenuTopButton spacing = new GuiMenuTopButton(2, general.xPosition + general.getWidth(), guiTop - 17, "Spacing");
|
||||
GuiMenuTopButton images = new GuiMenuTopButton(3, spacing.xPosition + spacing.getWidth(), guiTop - 17, "Images");
|
||||
topButtons = new GuiMenuTopButton[]{general, images, spacing, close};
|
||||
for (GuiMenuTopButton button : topButtons) {
|
||||
button.active = button.id == activeMenu;
|
||||
addButton(button);
|
||||
}
|
||||
@@ -202,7 +201,7 @@ public class SubGuiNpcDialogVisual extends SubGuiInterface implements ISubGuiLis
|
||||
getTextField(17).setMinMaxDefault(-Integer.MAX_VALUE, Integer.MAX_VALUE, 0);
|
||||
|
||||
String color = Integer.toHexString(dialogImage.color);
|
||||
while(color.length() < 6)
|
||||
while (color.length() < 6)
|
||||
color = 0 + color;
|
||||
addButton(new GuiNpcButton(18, guiLeft + 35, y += 25, 60, 20, color));
|
||||
addLabel(new GuiNpcLabel(15, "gui.color", guiLeft + 4, y + 5));
|
||||
@@ -232,10 +231,10 @@ public class SubGuiNpcDialogVisual extends SubGuiInterface implements ISubGuiLis
|
||||
addLabel(new GuiNpcLabel(20, "gui.type", guiLeft + 4, y + 5));
|
||||
|
||||
addButton(new GuiNpcButton(24, guiLeft + 160, y, 60, 20,
|
||||
new String[]{"display.topLeft", "display.topCenter", "display.topRight",
|
||||
"display.left", "display.center", "display.right",
|
||||
"display.botLeft", "display.botCenter", "display.botRight"},
|
||||
dialogImage.alignment));
|
||||
new String[]{"display.topLeft", "display.topCenter", "display.topRight",
|
||||
"display.left", "display.center", "display.right",
|
||||
"display.botLeft", "display.botCenter", "display.botRight"},
|
||||
dialogImage.alignment));
|
||||
addLabel(new GuiNpcLabel(21, "display.alignment", guiLeft + 110, y + 5));
|
||||
getButton(24).setEnabled(dialogImage.imageType == 0);
|
||||
getButton(24).setVisible(dialogImage.imageType == 0);
|
||||
@@ -266,7 +265,7 @@ public class SubGuiNpcDialogVisual extends SubGuiInterface implements ISubGuiLis
|
||||
NoppesUtil.clickSound();
|
||||
|
||||
int id = button.id;
|
||||
if(id == 0){
|
||||
if (id == 0) {
|
||||
close();
|
||||
return;
|
||||
}
|
||||
@@ -277,7 +276,7 @@ public class SubGuiNpcDialogVisual extends SubGuiInterface implements ISubGuiLis
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton){
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
|
||||
if (guibutton instanceof GuiMenuTopButton) {
|
||||
@@ -385,15 +384,15 @@ public class SubGuiNpcDialogVisual extends SubGuiInterface implements ISubGuiLis
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int i, int j, float f){
|
||||
super.drawScreen(i,j,f);
|
||||
for(GuiMenuTopButton button: topButtons)
|
||||
public void drawScreen(int i, int j, float f) {
|
||||
super.drawScreen(i, j, f);
|
||||
for (GuiMenuTopButton button : topButtons)
|
||||
button.drawButton(mc, i, j);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void subGuiClosed(SubGuiInterface subgui){
|
||||
public void subGuiClosed(SubGuiInterface subgui) {
|
||||
if (activeMenu == 1) {
|
||||
if (lastColorClicked == 0) {
|
||||
dialog.color = ((SubGuiColorSelector) subgui).color;
|
||||
@@ -418,8 +417,8 @@ public class SubGuiNpcDialogVisual extends SubGuiInterface implements ISubGuiLis
|
||||
|
||||
public void save() {
|
||||
GuiNpcTextField.unfocus();
|
||||
if(dialog.id >= 0)
|
||||
PacketClient.sendClient(new DialogSavePacket(((SubGuiNpcDialog)parent).dialogCategoryID, dialog.writeToNBT(new NBTTagCompound()), false));
|
||||
if (dialog.id >= 0)
|
||||
PacketClient.sendClient(new DialogSavePacket(((SubGuiNpcDialog) parent).dialogCategoryID, dialog.writeToNBT(new NBTTagCompound()), false));
|
||||
}
|
||||
|
||||
private DialogImage getSelectedImage() {
|
||||
@@ -545,7 +544,7 @@ public class SubGuiNpcDialogVisual extends SubGuiInterface implements ISubGuiLis
|
||||
|
||||
@Override
|
||||
public void customScrollClicked(int i, int j, int k, GuiCustomScroll guiCustomScroll) {
|
||||
if(guiCustomScroll.id == 0 && imageScroll != null) {
|
||||
if (guiCustomScroll.id == 0 && imageScroll != null) {
|
||||
selected = guiCustomScroll.selected;
|
||||
initGui();
|
||||
}
|
||||
|
||||
@@ -9,112 +9,111 @@ import noppes.npcs.controllers.data.SpawnData;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class SubGuiNpcDimensions extends SubGuiInterface implements IScrollData
|
||||
{
|
||||
private final SpawnData data;
|
||||
private GuiCustomScroll allDimensions;
|
||||
private HashMap<String, Integer> dimensionMap = new HashMap<>();
|
||||
private GuiCustomScroll dataDimensions;
|
||||
public class SubGuiNpcDimensions extends SubGuiInterface implements IScrollData {
|
||||
private final SpawnData data;
|
||||
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;
|
||||
public SubGuiNpcDimensions(SpawnData data) {
|
||||
this.data = data;
|
||||
setBackground("menubg.png");
|
||||
xSize = 346;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
PacketClient.sendClient(new DimensionsGetPacket());
|
||||
}
|
||||
|
||||
public void initGui(){
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
if(allDimensions == null){
|
||||
allDimensions = new GuiCustomScroll(this,0);
|
||||
allDimensions.setSize(140, 180);
|
||||
if (allDimensions == null) {
|
||||
allDimensions = new GuiCustomScroll(this, 0);
|
||||
allDimensions.setSize(140, 180);
|
||||
}
|
||||
allDimensions.guiLeft = guiLeft + 4;
|
||||
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);
|
||||
if (dataDimensions == null) {
|
||||
dataDimensions = new GuiCustomScroll(this, 1);
|
||||
dataDimensions.setSize(140, 180);
|
||||
}
|
||||
dataDimensions.guiLeft = guiLeft + 200;
|
||||
dataDimensions.guiTop = guiTop + 14;
|
||||
this.addScroll(dataDimensions);
|
||||
addLabel(new GuiNpcLabel(2, "spawning.spawningDimensions", guiLeft + 200, guiTop + 4));
|
||||
|
||||
ArrayList<String> dimensions = new ArrayList<>();
|
||||
Set<Map.Entry<String,Integer>> entrySet = this.dimensionMap.entrySet();
|
||||
for (Map.Entry<String,Integer> entry : entrySet) {
|
||||
if (this.data.dimensions.contains(entry.getValue())) {
|
||||
dimensions.add(entry.getKey());
|
||||
}
|
||||
}
|
||||
dataDimensions.setList(dimensions);
|
||||
ArrayList<String> dimensions = new ArrayList<>();
|
||||
Set<Map.Entry<String, Integer>> entrySet = this.dimensionMap.entrySet();
|
||||
for (Map.Entry<String, Integer> entry : entrySet) {
|
||||
if (this.data.dimensions.contains(entry.getValue())) {
|
||||
dimensions.add(entry.getKey());
|
||||
}
|
||||
}
|
||||
dataDimensions.setList(dimensions);
|
||||
|
||||
addButton(new GuiNpcButton(1, guiLeft + 145, guiTop + 40, 55, 20, ">"));
|
||||
addButton(new GuiNpcButton(2, guiLeft + 145, guiTop + 62, 55, 20, "<"));
|
||||
addButton(new GuiNpcButton(1, guiLeft + 145, guiTop + 40, 55, 20, ">"));
|
||||
addButton(new GuiNpcButton(2, guiLeft + 145, guiTop + 62, 55, 20, "<"));
|
||||
|
||||
addButton(new GuiNpcButton(3, guiLeft + 145, guiTop + 90, 55, 20, ">>"));
|
||||
addButton(new GuiNpcButton(4, guiLeft + 145, guiTop + 112, 55, 20, "<<"));
|
||||
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"));
|
||||
addButton(new GuiNpcButton(66, guiLeft + 260, guiTop + 194, 60, 20, "gui.done"));
|
||||
}
|
||||
|
||||
protected void actionPerformed(GuiButton guibutton){
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
if(button.id == 1){
|
||||
if(allDimensions.hasSelected()){
|
||||
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();
|
||||
this.data.dimensions.addAll(this.dimensionMap.values());
|
||||
allDimensions.selected = -1;
|
||||
initGui();
|
||||
}
|
||||
if(button.id == 4){
|
||||
data.dimensions.clear();
|
||||
allDimensions.selected = -1;
|
||||
initGui();
|
||||
}
|
||||
if(button.id == 66){
|
||||
close();
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
if (button.id == 1) {
|
||||
if (allDimensions.hasSelected()) {
|
||||
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();
|
||||
this.data.dimensions.addAll(this.dimensionMap.values());
|
||||
allDimensions.selected = -1;
|
||||
initGui();
|
||||
}
|
||||
if (button.id == 4) {
|
||||
data.dimensions.clear();
|
||||
allDimensions.selected = -1;
|
||||
initGui();
|
||||
}
|
||||
if (button.id == 66) {
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(Vector<String> list, HashMap<String, Integer> data, EnumScrollData type) {
|
||||
this.allDimensions.setList(list);
|
||||
this.dimensionMap = data;
|
||||
@Override
|
||||
public void setData(Vector<String> list, HashMap<String, Integer> data, EnumScrollData type) {
|
||||
this.allDimensions.setList(list);
|
||||
this.dimensionMap = data;
|
||||
|
||||
ArrayList<String> dimensions = new ArrayList<>();
|
||||
Set<Map.Entry<String,Integer>> entrySet = this.dimensionMap.entrySet();
|
||||
for (Map.Entry<String,Integer> entry : entrySet) {
|
||||
if (this.data.dimensions.contains(entry.getValue())) {
|
||||
dimensions.add(entry.getKey());
|
||||
}
|
||||
}
|
||||
dataDimensions.setList(dimensions);
|
||||
ArrayList<String> dimensions = new ArrayList<>();
|
||||
Set<Map.Entry<String, Integer>> entrySet = this.dimensionMap.entrySet();
|
||||
for (Map.Entry<String, Integer> entry : entrySet) {
|
||||
if (this.data.dimensions.contains(entry.getValue())) {
|
||||
dimensions.add(entry.getKey());
|
||||
}
|
||||
}
|
||||
dataDimensions.setList(dimensions);
|
||||
|
||||
initGui();
|
||||
}
|
||||
initGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(String selected) {
|
||||
@Override
|
||||
public void setSelected(String selected) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,68 +11,65 @@ import noppes.npcs.controllers.data.FactionOptions;
|
||||
import java.util.HashMap;
|
||||
import java.util.Vector;
|
||||
|
||||
public class SubGuiNpcFactionOptions extends SubGuiInterface implements IScrollData,ICustomScrollListener
|
||||
{
|
||||
private FactionOptions options;
|
||||
private HashMap<String,Integer> data = new HashMap<String,Integer>();
|
||||
private GuiCustomScroll scrollFactions;
|
||||
public class SubGuiNpcFactionOptions extends SubGuiInterface implements IScrollData, ICustomScrollListener {
|
||||
private FactionOptions options;
|
||||
private HashMap<String, Integer> data = new HashMap<String, Integer>();
|
||||
private GuiCustomScroll scrollFactions;
|
||||
|
||||
private int selected = -1;
|
||||
private int selected = -1;
|
||||
|
||||
public SubGuiNpcFactionOptions(FactionOptions options)
|
||||
{
|
||||
this.options = options;
|
||||
setBackground("menubg.png");
|
||||
xSize = 256;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
public SubGuiNpcFactionOptions(FactionOptions options) {
|
||||
this.options = options;
|
||||
setBackground("menubg.png");
|
||||
xSize = 256;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
PacketClient.sendClient(new FactionsGetPacket());
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
{
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
if(scrollFactions == null){
|
||||
scrollFactions = new GuiCustomScroll(this,0);
|
||||
scrollFactions.setSize(120, 208);
|
||||
if (scrollFactions == null) {
|
||||
scrollFactions = new GuiCustomScroll(this, 0);
|
||||
scrollFactions.setSize(120, 208);
|
||||
}
|
||||
scrollFactions.guiLeft = guiLeft + 130;
|
||||
scrollFactions.guiTop = guiTop + 4;
|
||||
addScroll(scrollFactions);
|
||||
|
||||
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));
|
||||
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");
|
||||
if (options.decreaseFactionPoints)
|
||||
label += StatCollector.translateToLocal("gui.decrease");
|
||||
else
|
||||
label += StatCollector.translateToLocal("gui.increase");
|
||||
label += StatCollector.translateToLocal("gui.increase");
|
||||
label += " " + options.factionPoints + " " + StatCollector.translateToLocal("faction.points");
|
||||
|
||||
addLabel(new GuiNpcLabel(3, label, guiLeft + 12, guiTop + 16));
|
||||
addLabel(new GuiNpcLabel(3, label, guiLeft + 12, guiTop + 16));
|
||||
addButton(new GuiNpcButton(0, guiLeft + 110, guiTop + 7, 20, 20, "X"));
|
||||
}
|
||||
|
||||
addLabel(new GuiNpcLabel(4, "2: ", guiLeft + 4, guiTop + 40));
|
||||
if(data.containsValue(options.faction2Id)){
|
||||
addLabel(new GuiNpcLabel(5, getFactionName(options.faction2Id), guiLeft + 12, guiTop + 36));
|
||||
addLabel(new GuiNpcLabel(4, "2: ", guiLeft + 4, guiTop + 40));
|
||||
if (data.containsValue(options.faction2Id)) {
|
||||
addLabel(new GuiNpcLabel(5, getFactionName(options.faction2Id), guiLeft + 12, guiTop + 36));
|
||||
|
||||
String label = "";
|
||||
if(options.decreaseFaction2Points)
|
||||
label += StatCollector.translateToLocal("gui.decrease");
|
||||
if (options.decreaseFaction2Points)
|
||||
label += StatCollector.translateToLocal("gui.decrease");
|
||||
else
|
||||
label += StatCollector.translateToLocal("gui.increase");
|
||||
label += StatCollector.translateToLocal("gui.increase");
|
||||
label += " " + options.faction2Points + " " + StatCollector.translateToLocal("faction.points");
|
||||
|
||||
addLabel(new GuiNpcLabel(6, label, guiLeft + 12, guiTop + 44));
|
||||
addLabel(new GuiNpcLabel(6, label, guiLeft + 12, guiTop + 44));
|
||||
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));
|
||||
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;
|
||||
@@ -83,69 +80,64 @@ public class SubGuiNpcFactionOptions extends SubGuiInterface implements IScrollD
|
||||
|
||||
addButton(new GuiNpcButton(66, guiLeft + 20, guiTop + 192, 90, 20, "gui.done"));
|
||||
}
|
||||
private String getFactionName(int faction){
|
||||
for(String s : data.keySet())
|
||||
if(data.get(s) == faction)
|
||||
return s;
|
||||
return null;
|
||||
|
||||
private String getFactionName(int faction) {
|
||||
for (String s : data.keySet())
|
||||
if (data.get(s) == faction)
|
||||
return s;
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void actionPerformed(GuiButton guibutton)
|
||||
{
|
||||
int id = guibutton.id;
|
||||
if(id == 0)
|
||||
{
|
||||
options.factionId = -1;
|
||||
initGui();
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
int id = guibutton.id;
|
||||
if (id == 0) {
|
||||
options.factionId = -1;
|
||||
initGui();
|
||||
}
|
||||
if(id == 1)
|
||||
{
|
||||
options.faction2Id = -1;
|
||||
initGui();
|
||||
if (id == 1) {
|
||||
options.faction2Id = -1;
|
||||
initGui();
|
||||
}
|
||||
if(id == 3)
|
||||
{
|
||||
if(!data.containsValue(options.factionId)){
|
||||
options.factionId = selected;
|
||||
options.decreaseFactionPoints = getButton(2).getValue() == 1;
|
||||
options.factionPoints = getTextField(1).getInteger();
|
||||
}
|
||||
else if(!data.containsValue(options.faction2Id)){
|
||||
options.faction2Id = selected;
|
||||
options.decreaseFaction2Points = getButton(2).getValue() == 1;
|
||||
options.faction2Points = getTextField(1).getInteger();
|
||||
}
|
||||
initGui();
|
||||
if (id == 3) {
|
||||
if (!data.containsValue(options.factionId)) {
|
||||
options.factionId = selected;
|
||||
options.decreaseFactionPoints = getButton(2).getValue() == 1;
|
||||
options.factionPoints = getTextField(1).getInteger();
|
||||
} else if (!data.containsValue(options.faction2Id)) {
|
||||
options.faction2Id = selected;
|
||||
options.decreaseFaction2Points = getButton(2).getValue() == 1;
|
||||
options.faction2Points = getTextField(1).getInteger();
|
||||
}
|
||||
initGui();
|
||||
}
|
||||
if(id == 66)
|
||||
{
|
||||
close();
|
||||
if (id == 66) {
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void customScrollClicked(int i, int j, int k,
|
||||
GuiCustomScroll guiCustomScroll) {
|
||||
selected = data.get(guiCustomScroll.getSelected());
|
||||
initGui();
|
||||
}
|
||||
@Override
|
||||
public void customScrollClicked(int i, int j, int k,
|
||||
GuiCustomScroll guiCustomScroll) {
|
||||
selected = data.get(guiCustomScroll.getSelected());
|
||||
initGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(Vector<String> list, HashMap<String, Integer> data, EnumScrollData type) {
|
||||
GuiCustomScroll scroll = getScroll(0);
|
||||
String name = scroll.getSelected();
|
||||
this.data = data;
|
||||
scroll.setList(list);
|
||||
@Override
|
||||
public void setData(Vector<String> list, HashMap<String, Integer> data, EnumScrollData type) {
|
||||
GuiCustomScroll scroll = getScroll(0);
|
||||
String name = scroll.getSelected();
|
||||
this.data = data;
|
||||
scroll.setList(list);
|
||||
|
||||
if(name != null)
|
||||
scroll.setSelected(name);
|
||||
if (name != null)
|
||||
scroll.setSelected(name);
|
||||
|
||||
initGui();
|
||||
}
|
||||
initGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(String selected) {
|
||||
@Override
|
||||
public void setSelected(String selected) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,62 +5,62 @@ import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.controllers.data.Faction;
|
||||
|
||||
public class SubGuiNpcFactionPoints extends SubGuiInterface implements ITextfieldListener
|
||||
{
|
||||
private Faction faction;
|
||||
public SubGuiNpcFactionPoints(Faction faction){
|
||||
this.faction = faction;
|
||||
setBackground("menubg.png");
|
||||
xSize = 256;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
public class SubGuiNpcFactionPoints extends SubGuiInterface implements ITextfieldListener {
|
||||
private Faction faction;
|
||||
|
||||
public SubGuiNpcFactionPoints(Faction faction) {
|
||||
this.faction = faction;
|
||||
setBackground("menubg.png");
|
||||
xSize = 256;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui(){
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
addLabel(new GuiNpcLabel(2,"faction.default", guiLeft + 4, guiTop + 33));
|
||||
|
||||
this.addTextField(new GuiNpcTextField(2, this, guiLeft + 8 + fontRendererObj.getStringWidth(getLabel(2).label), guiTop + 28, 70, 20, faction.defaultPoints + ""));
|
||||
getTextField(2).setMaxStringLength(6);
|
||||
getTextField(2).integersOnly = true;
|
||||
|
||||
String title = StatCollector.translateToLocal("faction.unfriendly") + "<->" + StatCollector.translateToLocal("faction.neutral");
|
||||
addLabel(new GuiNpcLabel(3, title, guiLeft + 4, guiTop + 80));
|
||||
addTextField(new GuiNpcTextField(3, this, guiLeft + 8 + fontRendererObj.getStringWidth(title), guiTop + 75, 70, 20, faction.neutralPoints + ""));
|
||||
|
||||
title = StatCollector.translateToLocal("faction.neutral") + "<->" + StatCollector.translateToLocal("faction.friendly");
|
||||
addLabel(new GuiNpcLabel(4, title, guiLeft + 4, guiTop + 105));
|
||||
addTextField(new GuiNpcTextField(4, this, guiLeft + 8 + fontRendererObj.getStringWidth(title), guiTop + 100, 70, 20, faction.friendlyPoints + ""));
|
||||
addLabel(new GuiNpcLabel(2, "faction.default", guiLeft + 4, guiTop + 33));
|
||||
|
||||
getTextField(3).integersOnly = true;
|
||||
getTextField(4).integersOnly = true;
|
||||
|
||||
if(getTextField(3).xPosition > getTextField(4).xPosition)
|
||||
getTextField(4).xPosition = getTextField(3).xPosition;
|
||||
else
|
||||
getTextField(3).xPosition = getTextField(4).xPosition;
|
||||
|
||||
addButton(new GuiNpcButton(66, guiLeft + 20, guiTop + 192, 90, 20, "gui.done"));
|
||||
this.addTextField(new GuiNpcTextField(2, this, guiLeft + 8 + fontRendererObj.getStringWidth(getLabel(2).label), guiTop + 28, 70, 20, faction.defaultPoints + ""));
|
||||
getTextField(2).setMaxStringLength(6);
|
||||
getTextField(2).integersOnly = true;
|
||||
|
||||
String title = StatCollector.translateToLocal("faction.unfriendly") + "<->" + StatCollector.translateToLocal("faction.neutral");
|
||||
addLabel(new GuiNpcLabel(3, title, guiLeft + 4, guiTop + 80));
|
||||
addTextField(new GuiNpcTextField(3, this, guiLeft + 8 + fontRendererObj.getStringWidth(title), guiTop + 75, 70, 20, faction.neutralPoints + ""));
|
||||
|
||||
title = StatCollector.translateToLocal("faction.neutral") + "<->" + StatCollector.translateToLocal("faction.friendly");
|
||||
addLabel(new GuiNpcLabel(4, title, guiLeft + 4, guiTop + 105));
|
||||
addTextField(new GuiNpcTextField(4, this, guiLeft + 8 + fontRendererObj.getStringWidth(title), guiTop + 100, 70, 20, faction.friendlyPoints + ""));
|
||||
|
||||
getTextField(3).integersOnly = true;
|
||||
getTextField(4).integersOnly = true;
|
||||
|
||||
if (getTextField(3).xPosition > getTextField(4).xPosition)
|
||||
getTextField(4).xPosition = getTextField(3).xPosition;
|
||||
else
|
||||
getTextField(3).xPosition = getTextField(4).xPosition;
|
||||
|
||||
addButton(new GuiNpcButton(66, guiLeft + 20, guiTop + 192, 90, 20, "gui.done"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unFocused(GuiNpcTextField textfield) {
|
||||
if(textfield.id == 2) {
|
||||
faction.defaultPoints = textfield.getInteger();
|
||||
}else if(textfield.id == 3) {
|
||||
faction.neutralPoints = textfield.getInteger();
|
||||
}else if(textfield.id == 4) {
|
||||
faction.friendlyPoints = textfield.getInteger();
|
||||
}
|
||||
}
|
||||
public void unFocused(GuiNpcTextField textfield) {
|
||||
if (textfield.id == 2) {
|
||||
faction.defaultPoints = textfield.getInteger();
|
||||
} else if (textfield.id == 3) {
|
||||
faction.neutralPoints = textfield.getInteger();
|
||||
} else if (textfield.id == 4) {
|
||||
faction.friendlyPoints = textfield.getInteger();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton){
|
||||
int id = guibutton.id;
|
||||
if(id == 66){
|
||||
close();
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
int id = guibutton.id;
|
||||
if (id == 66) {
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,86 +5,77 @@ import noppes.npcs.DataStats;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPotionType;
|
||||
|
||||
public class SubGuiNpcMeleeProperties extends SubGuiInterface implements ITextfieldListener
|
||||
{
|
||||
private DataStats stats;
|
||||
private String[] potionNames = new String[]{"gui.none", "tile.fire.name", "potion.poison", "potion.hunger", "potion.weakness", "potion.moveSlowdown", "potion.confusion", "potion.blindness", "potion.wither"};
|
||||
public class SubGuiNpcMeleeProperties extends SubGuiInterface implements ITextfieldListener {
|
||||
private DataStats stats;
|
||||
private String[] potionNames = new String[]{"gui.none", "tile.fire.name", "potion.poison", "potion.hunger", "potion.weakness", "potion.moveSlowdown", "potion.confusion", "potion.blindness", "potion.wither"};
|
||||
|
||||
public SubGuiNpcMeleeProperties(DataStats stats)
|
||||
{
|
||||
this.stats = stats;
|
||||
setBackground("menubg.png");
|
||||
xSize = 256;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
public SubGuiNpcMeleeProperties(DataStats stats) {
|
||||
this.stats = stats;
|
||||
setBackground("menubg.png");
|
||||
xSize = 256;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
{
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
addLabel(new GuiNpcLabel(1,"stats.meleestrength", guiLeft + 5, guiTop + 15));
|
||||
addTextField(new GuiNpcTextField(1,this, fontRendererObj, guiLeft + 85, guiTop + 10, 160, 18, String.format("%.0f", stats.getAttackStrength()) + ""));
|
||||
addLabel(new GuiNpcLabel(1, "stats.meleestrength", guiLeft + 5, guiTop + 15));
|
||||
addTextField(new GuiNpcTextField(1, this, fontRendererObj, guiLeft + 85, guiTop + 10, 160, 18, String.format("%.0f", stats.getAttackStrength()) + ""));
|
||||
getTextField(1).floatsOnly = true;
|
||||
getTextField(1).setMinMaxDefaultFloat(0,Float.MAX_VALUE,5);
|
||||
addLabel(new GuiNpcLabel(2,"stats.meleerange", guiLeft + 5, guiTop + 45));
|
||||
addTextField(new GuiNpcTextField(2,this, fontRendererObj, guiLeft + 85, guiTop + 40, 40, 18, stats.attackRange+""));
|
||||
getTextField(1).setMinMaxDefaultFloat(0, Float.MAX_VALUE, 5);
|
||||
addLabel(new GuiNpcLabel(2, "stats.meleerange", guiLeft + 5, guiTop + 45));
|
||||
addTextField(new GuiNpcTextField(2, this, fontRendererObj, guiLeft + 85, guiTop + 40, 40, 18, stats.attackRange + ""));
|
||||
getTextField(2).integersOnly = true;
|
||||
getTextField(2).setMinMaxDefault(1, Integer.MAX_VALUE, 2);
|
||||
addLabel(new GuiNpcLabel(3,"stats.meleespeed", guiLeft + 5, guiTop + 75));
|
||||
addTextField(new GuiNpcTextField(3,this, fontRendererObj, guiLeft + 85, guiTop + 70, 40, 18, stats.attackSpeed+""));
|
||||
addLabel(new GuiNpcLabel(3, "stats.meleespeed", guiLeft + 5, guiTop + 75));
|
||||
addTextField(new GuiNpcTextField(3, this, fontRendererObj, guiLeft + 85, guiTop + 70, 40, 18, stats.attackSpeed + ""));
|
||||
getTextField(3).integersOnly = true;
|
||||
getTextField(3).setMinMaxDefault(1, Integer.MAX_VALUE, 20);
|
||||
|
||||
addLabel(new GuiNpcLabel(4,"enchantment.knockback", guiLeft + 5, guiTop + 105));
|
||||
addTextField(new GuiNpcTextField(4,this, fontRendererObj, guiLeft + 85, guiTop + 100, 40, 18, stats.knockback + ""));
|
||||
getTextField(4).integersOnly = true;
|
||||
getTextField(4).setMinMaxDefault(0, Integer.MAX_VALUE, 0);
|
||||
addLabel(new GuiNpcLabel(5,"stats.meleeeffect", guiLeft + 5, guiTop + 135));
|
||||
addButton(new GuiButtonBiDirectional(5,guiLeft + 85, guiTop + 130, 100, 20, potionNames, stats.potionType.ordinal()));
|
||||
if(stats.potionType != EnumPotionType.None) {
|
||||
addLabel(new GuiNpcLabel(6,"gui.time", guiLeft + 5, guiTop + 165));
|
||||
addTextField(new GuiNpcTextField(6,this, fontRendererObj, guiLeft + 85, guiTop + 160, 40, 18, stats.potionDuration + ""));
|
||||
getTextField(6).integersOnly = true;
|
||||
getTextField(6).setMinMaxDefault(1, Integer.MAX_VALUE, 5);
|
||||
if(stats.potionType != EnumPotionType.Fire) {
|
||||
addLabel(new GuiNpcLabel(7,"stats.amplify", guiLeft + 5, guiTop + 195));
|
||||
addButton(new GuiButtonBiDirectional(7,guiLeft + 85, guiTop + 190, 52, 20, new String[]{"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"} ,stats.potionAmp));
|
||||
}
|
||||
}
|
||||
addButton(new GuiNpcButton(66, guiLeft + 190, guiTop + 190, 60, 20, "gui.done"));
|
||||
addLabel(new GuiNpcLabel(4, "enchantment.knockback", guiLeft + 5, guiTop + 105));
|
||||
addTextField(new GuiNpcTextField(4, this, fontRendererObj, guiLeft + 85, guiTop + 100, 40, 18, stats.knockback + ""));
|
||||
getTextField(4).integersOnly = true;
|
||||
getTextField(4).setMinMaxDefault(0, Integer.MAX_VALUE, 0);
|
||||
addLabel(new GuiNpcLabel(5, "stats.meleeeffect", guiLeft + 5, guiTop + 135));
|
||||
addButton(new GuiButtonBiDirectional(5, guiLeft + 85, guiTop + 130, 100, 20, potionNames, stats.potionType.ordinal()));
|
||||
if (stats.potionType != EnumPotionType.None) {
|
||||
addLabel(new GuiNpcLabel(6, "gui.time", guiLeft + 5, guiTop + 165));
|
||||
addTextField(new GuiNpcTextField(6, this, fontRendererObj, guiLeft + 85, guiTop + 160, 40, 18, stats.potionDuration + ""));
|
||||
getTextField(6).integersOnly = true;
|
||||
getTextField(6).setMinMaxDefault(1, Integer.MAX_VALUE, 5);
|
||||
if (stats.potionType != EnumPotionType.Fire) {
|
||||
addLabel(new GuiNpcLabel(7, "stats.amplify", guiLeft + 5, guiTop + 195));
|
||||
addButton(new GuiButtonBiDirectional(7, guiLeft + 85, guiTop + 190, 52, 20, new String[]{"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"}, stats.potionAmp));
|
||||
}
|
||||
}
|
||||
addButton(new GuiNpcButton(66, guiLeft + 190, guiTop + 190, 60, 20, "gui.done"));
|
||||
}
|
||||
|
||||
public void unFocused(GuiNpcTextField textfield) {
|
||||
if(textfield.id == 1){
|
||||
stats.setAttackStrength(Float.parseFloat(textfield.getText()));
|
||||
}
|
||||
else if(textfield.id == 2){
|
||||
stats.attackRange = textfield.getInteger();
|
||||
}
|
||||
else if(textfield.id == 3){
|
||||
stats.attackSpeed = textfield.getInteger();
|
||||
}
|
||||
else if(textfield.id == 4){
|
||||
stats.knockback = textfield.getInteger();
|
||||
}
|
||||
else if(textfield.id == 6){
|
||||
stats.potionDuration = textfield.getInteger();
|
||||
}
|
||||
}
|
||||
public void unFocused(GuiNpcTextField textfield) {
|
||||
if (textfield.id == 1) {
|
||||
stats.setAttackStrength(Float.parseFloat(textfield.getText()));
|
||||
} else if (textfield.id == 2) {
|
||||
stats.attackRange = textfield.getInteger();
|
||||
} else if (textfield.id == 3) {
|
||||
stats.attackSpeed = textfield.getInteger();
|
||||
} else if (textfield.id == 4) {
|
||||
stats.knockback = textfield.getInteger();
|
||||
} else if (textfield.id == 6) {
|
||||
stats.potionDuration = textfield.getInteger();
|
||||
}
|
||||
}
|
||||
|
||||
protected void actionPerformed(GuiButton guibutton)
|
||||
{
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
if(button.id == 5){
|
||||
stats.potionType = EnumPotionType.values()[button.getValue()];
|
||||
initGui();
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
if (button.id == 5) {
|
||||
stats.potionType = EnumPotionType.values()[button.getValue()];
|
||||
initGui();
|
||||
}
|
||||
if(button.id == 7){
|
||||
stats.potionAmp = button.getValue();
|
||||
if (button.id == 7) {
|
||||
stats.potionAmp = button.getValue();
|
||||
}
|
||||
if(button.id == 66)
|
||||
{
|
||||
close();
|
||||
if (button.id == 66) {
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,200 +7,181 @@ import noppes.npcs.constants.EnumAnimation;
|
||||
import noppes.npcs.constants.EnumMovingType;
|
||||
import noppes.npcs.constants.EnumStandingType;
|
||||
|
||||
public class SubGuiNpcMovement extends SubGuiInterface implements ITextfieldListener
|
||||
{
|
||||
private DataAI ai;
|
||||
|
||||
public SubGuiNpcMovement(DataAI ai){
|
||||
this.ai = ai;
|
||||
setBackground("menubg.png");
|
||||
xSize = 256;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
public class SubGuiNpcMovement extends SubGuiInterface implements ITextfieldListener {
|
||||
private DataAI ai;
|
||||
|
||||
public SubGuiNpcMovement(DataAI ai) {
|
||||
this.ai = ai;
|
||||
setBackground("menubg.png");
|
||||
xSize = 256;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
}
|
||||
|
||||
public void initGui(){
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
int y = guiTop + 4;
|
||||
this.addLabel(new GuiNpcLabel(0, "movement.type", guiLeft + 4, y + 5));
|
||||
this.addButton(new GuiNpcButton(0, guiLeft + 80, y, 100, 20, EnumMovingType.names(), ai.movingType.ordinal()));
|
||||
this.addButton(new GuiNpcButton(0, guiLeft + 80, y, 100, 20, EnumMovingType.names(), ai.movingType.ordinal()));
|
||||
|
||||
this.addButton(new GuiNpcButton(15, guiLeft + 80, y += 22, 100, 20, new String[]{"movement.ground","movement.flying"}, ai.movementType));
|
||||
this.addButton(new GuiNpcButton(15, guiLeft + 80, y += 22, 100, 20, new String[]{"movement.ground", "movement.flying"}, ai.movementType));
|
||||
|
||||
if(ai.movementType == 1){
|
||||
this.addLabel(new GuiNpcLabel(18, "fly.speed", guiLeft + 4, y + 140));
|
||||
addTextField(new GuiNpcTextField(18,this, guiLeft + 80, y + 135, 40, 20, ai.flySpeed + ""));
|
||||
getTextField(18).doublesOnly = true;
|
||||
getTextField(18).setMinMaxDefaultDouble(0.0D,Double.MAX_VALUE,1.0D);
|
||||
if (ai.movementType == 1) {
|
||||
this.addLabel(new GuiNpcLabel(18, "fly.speed", guiLeft + 4, y + 140));
|
||||
addTextField(new GuiNpcTextField(18, this, guiLeft + 80, y + 135, 40, 20, ai.flySpeed + ""));
|
||||
getTextField(18).doublesOnly = true;
|
||||
getTextField(18).setMinMaxDefaultDouble(0.0D, Double.MAX_VALUE, 1.0D);
|
||||
|
||||
this.addLabel(new GuiNpcLabel(19, "fly.gravity", guiLeft + 4, y + 160));
|
||||
addTextField(new GuiNpcTextField(19,this, guiLeft + 80, y + 155, 40, 20, ai.flyGravity + ""));
|
||||
getTextField(19).doublesOnly = true;
|
||||
getTextField(19).setMinMaxDefaultDouble(0.0D,1.0D,0.0D);
|
||||
this.addLabel(new GuiNpcLabel(19, "fly.gravity", guiLeft + 4, y + 160));
|
||||
addTextField(new GuiNpcTextField(19, this, guiLeft + 80, y + 155, 40, 20, ai.flyGravity + ""));
|
||||
getTextField(19).doublesOnly = true;
|
||||
getTextField(19).setMinMaxDefaultDouble(0.0D, 1.0D, 0.0D);
|
||||
|
||||
this.addLabel(new GuiNpcLabel(20, "Limit Height", guiLeft + 150, y + 116));
|
||||
addButton(new GuiNpcButton(20, guiLeft + 210, y + 110, 40, 20, new String[]{"gui.no","gui.yes"}, ai.hasFlyLimit?1:0));
|
||||
this.addLabel(new GuiNpcLabel(20, "Limit Height", guiLeft + 150, y + 116));
|
||||
addButton(new GuiNpcButton(20, guiLeft + 210, y + 110, 40, 20, new String[]{"gui.no", "gui.yes"}, ai.hasFlyLimit ? 1 : 0));
|
||||
|
||||
if(ai.hasFlyLimit) {
|
||||
this.addLabel(new GuiNpcLabel(21, "Height", guiLeft + 150, y + 140));
|
||||
addTextField(new GuiNpcTextField(21, this, guiLeft + 185, y + 135, 40, 20, ai.flyHeightLimit + ""));
|
||||
getTextField(21).integersOnly = true;
|
||||
getTextField(21).setMinMaxDefaultDouble(0.0D, Double.MAX_VALUE, 1.0D);
|
||||
}
|
||||
}
|
||||
if (ai.hasFlyLimit) {
|
||||
this.addLabel(new GuiNpcLabel(21, "Height", guiLeft + 150, y + 140));
|
||||
addTextField(new GuiNpcTextField(21, this, guiLeft + 185, y + 135, 40, 20, ai.flyHeightLimit + ""));
|
||||
getTextField(21).integersOnly = true;
|
||||
getTextField(21).setMinMaxDefaultDouble(0.0D, Double.MAX_VALUE, 1.0D);
|
||||
}
|
||||
}
|
||||
|
||||
if(ai.movingType == EnumMovingType.Wandering){
|
||||
addTextField(new GuiNpcTextField(4,this, guiLeft + 100, y += 22, 40, 20, ai.walkingRange + ""));
|
||||
getTextField(4).integersOnly = true;
|
||||
getTextField(4).setMinMaxDefault(0, Integer.MAX_VALUE, 5);
|
||||
addLabel(new GuiNpcLabel(4,"gui.range", guiLeft + 4, y + 5));
|
||||
|
||||
addButton(new GuiNpcButton(5, guiLeft + 100, y += 22, 50, 20, new String[]{"gui.no","gui.yes"}, ai.npcInteracting?1:0));
|
||||
addLabel(new GuiNpcLabel(5,"movement.wanderinteract", guiLeft + 4, y + 5));
|
||||
}
|
||||
else if(ai.movingType == EnumMovingType.Standing){
|
||||
addTextField(new GuiNpcTextField(7,this, guiLeft + 99, y += 22, 24, 20, (int)ai.bodyOffsetX + ""));
|
||||
addLabel(new GuiNpcLabel(17, "spawner.posoffset", guiLeft + 4, y + 5));
|
||||
addLabel(new GuiNpcLabel(7,"X:", guiLeft + 115, y + 5));
|
||||
getTextField(7).integersOnly = true;
|
||||
getTextField(7).setMinMaxDefault(0, 10, 5);
|
||||
addLabel(new GuiNpcLabel(8,"Y:", guiLeft + 125, y + 5));
|
||||
addTextField(new GuiNpcTextField(8,this, guiLeft + 135, y, 24, 20, (int)ai.bodyOffsetY + ""));
|
||||
getTextField(8).integersOnly = true;
|
||||
getTextField(8).setMinMaxDefault(0, 10, 5);
|
||||
addLabel(new GuiNpcLabel(9,"Z:", guiLeft + 161, y + 5));
|
||||
addTextField(new GuiNpcTextField(9,this, guiLeft + 171, y, 24, 20, (int)ai.bodyOffsetZ + ""));
|
||||
getTextField(9).integersOnly = true;
|
||||
getTextField(9).setMinMaxDefault(0, 10, 5);
|
||||
if (ai.movingType == EnumMovingType.Wandering) {
|
||||
addTextField(new GuiNpcTextField(4, this, guiLeft + 100, y += 22, 40, 20, ai.walkingRange + ""));
|
||||
getTextField(4).integersOnly = true;
|
||||
getTextField(4).setMinMaxDefault(0, Integer.MAX_VALUE, 5);
|
||||
addLabel(new GuiNpcLabel(4, "gui.range", guiLeft + 4, y + 5));
|
||||
|
||||
this.addButton(new GuiNpcButton(3, guiLeft + 80, y += 22, 100, 20, new String[]{"stats.normal","movement.sitting","movement.lying","movement.sneaking","movement.dancing","movement.aiming", "movement.crawling", "movement.hug"},ai.animationType.ordinal()));
|
||||
this.addLabel(new GuiNpcLabel(3, "movement.animation", guiLeft + 4, y + 5));
|
||||
|
||||
if(ai.animationType != EnumAnimation.LYING){
|
||||
this.addButton(new GuiNpcButton(4, guiLeft + 80, y += 22, 80, 20, new String[]{"movement.body","movement.manual","movement.stalking","movement.head"},ai.standingType.ordinal()));
|
||||
this.addLabel(new GuiNpcLabel(1, "movement.rotation", guiLeft + 4, y + 5));
|
||||
}
|
||||
else{
|
||||
addTextField(new GuiNpcTextField(5,this, guiLeft + 99, y += 22, 40, 20, ai.orientation + ""));
|
||||
getTextField(5).integersOnly = true;
|
||||
getTextField(5).setMinMaxDefault(0, 359, 0);
|
||||
this.addLabel(new GuiNpcLabel(6, "movement.rotation", guiLeft + 4, y + 5));
|
||||
addLabel(new GuiNpcLabel(5,"(0-359)", guiLeft + 142, y + 5));
|
||||
}
|
||||
if(ai.standingType == EnumStandingType.NoRotation || ai.standingType == EnumStandingType.HeadRotation){
|
||||
addTextField(new GuiNpcTextField(5,this, guiLeft + 165, y, 40, 20, ai.orientation + ""));
|
||||
getTextField(5).integersOnly = true;
|
||||
getTextField(5).setMinMaxDefault(0, 359, 0);
|
||||
addLabel(new GuiNpcLabel(5,"(0-359)", guiLeft + 207, y + 5));
|
||||
}
|
||||
}
|
||||
if(ai.movingType != EnumMovingType.Standing){
|
||||
this.addButton(new GuiNpcButton(12, guiLeft + 80, y += 22, 100, 20, new String[]{"stats.normal","movement.sneaking","movement.aiming", "movement.dancing", "movement.crawling", "movement.hug"},ai.animationType.getWalkingAnimation()));
|
||||
this.addLabel(new GuiNpcLabel(12, "movement.animation", guiLeft + 4, y + 5));
|
||||
}
|
||||
|
||||
if(ai.movingType == EnumMovingType.MovingPath){
|
||||
this.addButton(new GuiNpcButton(8, guiLeft + 80, y += 22, 80, 20, new String[]{"ai.looping","ai.backtracking"}, ai.movingPattern));
|
||||
this.addLabel(new GuiNpcLabel(8, "movement.name", guiLeft + 4, y + 5));
|
||||
this.addButton(new GuiNpcButton(9, guiLeft + 80, y += 22, 80, 20, new String[]{"gui.no","gui.yes"}, ai.movingPause?1:0));
|
||||
this.addLabel(new GuiNpcLabel(9, "movement.pauses", guiLeft + 4, y + 5));
|
||||
}
|
||||
addButton(new GuiNpcButton(13, guiLeft + 100, y += 22, 50, 20, new String[]{"gui.no","gui.yes"}, ai.stopAndInteract?1:0));
|
||||
addLabel(new GuiNpcLabel(13,"movement.stopinteract", guiLeft + 4, y + 5));
|
||||
addButton(new GuiNpcButton(5, guiLeft + 100, y += 22, 50, 20, new String[]{"gui.no", "gui.yes"}, ai.npcInteracting ? 1 : 0));
|
||||
addLabel(new GuiNpcLabel(5, "movement.wanderinteract", guiLeft + 4, y + 5));
|
||||
} else if (ai.movingType == EnumMovingType.Standing) {
|
||||
addTextField(new GuiNpcTextField(7, this, guiLeft + 99, y += 22, 24, 20, (int) ai.bodyOffsetX + ""));
|
||||
addLabel(new GuiNpcLabel(17, "spawner.posoffset", guiLeft + 4, y + 5));
|
||||
addLabel(new GuiNpcLabel(7, "X:", guiLeft + 115, y + 5));
|
||||
getTextField(7).integersOnly = true;
|
||||
getTextField(7).setMinMaxDefault(0, 10, 5);
|
||||
addLabel(new GuiNpcLabel(8, "Y:", guiLeft + 125, y + 5));
|
||||
addTextField(new GuiNpcTextField(8, this, guiLeft + 135, y, 24, 20, (int) ai.bodyOffsetY + ""));
|
||||
getTextField(8).integersOnly = true;
|
||||
getTextField(8).setMinMaxDefault(0, 10, 5);
|
||||
addLabel(new GuiNpcLabel(9, "Z:", guiLeft + 161, y + 5));
|
||||
addTextField(new GuiNpcTextField(9, this, guiLeft + 171, y, 24, 20, (int) ai.bodyOffsetZ + ""));
|
||||
getTextField(9).integersOnly = true;
|
||||
getTextField(9).setMinMaxDefault(0, 10, 5);
|
||||
|
||||
addTextField(new GuiNpcTextField(14,this, guiLeft + 80, y += 22, 50, 18, ai.getWalkingSpeed()+""));
|
||||
this.addButton(new GuiNpcButton(3, guiLeft + 80, y += 22, 100, 20, new String[]{"stats.normal", "movement.sitting", "movement.lying", "movement.sneaking", "movement.dancing", "movement.aiming", "movement.crawling", "movement.hug"}, ai.animationType.ordinal()));
|
||||
this.addLabel(new GuiNpcLabel(3, "movement.animation", guiLeft + 4, y + 5));
|
||||
|
||||
if (ai.animationType != EnumAnimation.LYING) {
|
||||
this.addButton(new GuiNpcButton(4, guiLeft + 80, y += 22, 80, 20, new String[]{"movement.body", "movement.manual", "movement.stalking", "movement.head"}, ai.standingType.ordinal()));
|
||||
this.addLabel(new GuiNpcLabel(1, "movement.rotation", guiLeft + 4, y + 5));
|
||||
} else {
|
||||
addTextField(new GuiNpcTextField(5, this, guiLeft + 99, y += 22, 40, 20, ai.orientation + ""));
|
||||
getTextField(5).integersOnly = true;
|
||||
getTextField(5).setMinMaxDefault(0, 359, 0);
|
||||
this.addLabel(new GuiNpcLabel(6, "movement.rotation", guiLeft + 4, y + 5));
|
||||
addLabel(new GuiNpcLabel(5, "(0-359)", guiLeft + 142, y + 5));
|
||||
}
|
||||
if (ai.standingType == EnumStandingType.NoRotation || ai.standingType == EnumStandingType.HeadRotation) {
|
||||
addTextField(new GuiNpcTextField(5, this, guiLeft + 165, y, 40, 20, ai.orientation + ""));
|
||||
getTextField(5).integersOnly = true;
|
||||
getTextField(5).setMinMaxDefault(0, 359, 0);
|
||||
addLabel(new GuiNpcLabel(5, "(0-359)", guiLeft + 207, y + 5));
|
||||
}
|
||||
}
|
||||
if (ai.movingType != EnumMovingType.Standing) {
|
||||
this.addButton(new GuiNpcButton(12, guiLeft + 80, y += 22, 100, 20, new String[]{"stats.normal", "movement.sneaking", "movement.aiming", "movement.dancing", "movement.crawling", "movement.hug"}, ai.animationType.getWalkingAnimation()));
|
||||
this.addLabel(new GuiNpcLabel(12, "movement.animation", guiLeft + 4, y + 5));
|
||||
}
|
||||
|
||||
if (ai.movingType == EnumMovingType.MovingPath) {
|
||||
this.addButton(new GuiNpcButton(8, guiLeft + 80, y += 22, 80, 20, new String[]{"ai.looping", "ai.backtracking"}, ai.movingPattern));
|
||||
this.addLabel(new GuiNpcLabel(8, "movement.name", guiLeft + 4, y + 5));
|
||||
this.addButton(new GuiNpcButton(9, guiLeft + 80, y += 22, 80, 20, new String[]{"gui.no", "gui.yes"}, ai.movingPause ? 1 : 0));
|
||||
this.addLabel(new GuiNpcLabel(9, "movement.pauses", guiLeft + 4, y + 5));
|
||||
}
|
||||
addButton(new GuiNpcButton(13, guiLeft + 100, y += 22, 50, 20, new String[]{"gui.no", "gui.yes"}, ai.stopAndInteract ? 1 : 0));
|
||||
addLabel(new GuiNpcLabel(13, "movement.stopinteract", guiLeft + 4, y + 5));
|
||||
|
||||
addTextField(new GuiNpcTextField(14, this, guiLeft + 80, y += 22, 50, 18, ai.getWalkingSpeed() + ""));
|
||||
getTextField(14).integersOnly = true;
|
||||
getTextField(14).setMinMaxDefault(0, Integer.MAX_VALUE, 4);
|
||||
addLabel(new GuiNpcLabel(14,"stats.walkspeed", guiLeft + 5, y + 5));
|
||||
|
||||
addButton(new GuiNpcButton(66, guiLeft + 190, guiTop + 190, 60, 20, "gui.done"));
|
||||
addLabel(new GuiNpcLabel(14, "stats.walkspeed", guiLeft + 5, y + 5));
|
||||
|
||||
addButton(new GuiNpcButton(66, guiLeft + 190, guiTop + 190, 60, 20, "gui.done"));
|
||||
}
|
||||
|
||||
protected void actionPerformed(GuiButton guibutton){
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
if(button.id == 0){
|
||||
ai.movingType = EnumMovingType.values()[button.getValue()];
|
||||
if(ai.movingType != EnumMovingType.Standing){
|
||||
ai.animationType = EnumAnimation.NONE;
|
||||
ai.standingType = EnumStandingType.RotateBody;
|
||||
ai.bodyOffsetX = ai.bodyOffsetY = ai.bodyOffsetZ = 5;
|
||||
}
|
||||
initGui();
|
||||
}
|
||||
else if(button.id == 3){
|
||||
ai.animationType = EnumAnimation.values()[button.getValue()];
|
||||
initGui();
|
||||
}
|
||||
else if(button.id == 4){
|
||||
ai.standingType = EnumStandingType.values()[button.getValue()];
|
||||
initGui();
|
||||
}
|
||||
else if(button.id == 5){
|
||||
ai.npcInteracting = button.getValue() == 1;
|
||||
}
|
||||
else if (button.id == 8) {
|
||||
ai.movingPattern = button.getValue();
|
||||
}
|
||||
else if (button.id == 9) {
|
||||
ai.movingPause = button.getValue() == 1;
|
||||
}
|
||||
else if (button.id == 12) {
|
||||
if(button.getValue() == 0)
|
||||
ai.animationType = EnumAnimation.NONE;
|
||||
if(button.getValue() == 1)
|
||||
ai.animationType = EnumAnimation.SNEAKING;
|
||||
if(button.getValue() == 2)
|
||||
ai.animationType = EnumAnimation.AIMING;
|
||||
if(button.getValue() == 3)
|
||||
ai.animationType = EnumAnimation.DANCING;
|
||||
if(button.getValue() == 4)
|
||||
ai.animationType = EnumAnimation.CRAWLING;
|
||||
if(button.getValue() == 5)
|
||||
ai.animationType = EnumAnimation.HUG;
|
||||
}
|
||||
else if (button.id == 13) {
|
||||
ai.stopAndInteract = button.getValue() == 1;
|
||||
}
|
||||
else if (button.id == 15) {
|
||||
ai.movementType = button.getValue();
|
||||
initGui();
|
||||
} else if (button.id == 20) {
|
||||
ai.hasFlyLimit = button.getValue() == 1;
|
||||
initGui();
|
||||
} else if (button.id == 66) {
|
||||
close();
|
||||
}
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
if (button.id == 0) {
|
||||
ai.movingType = EnumMovingType.values()[button.getValue()];
|
||||
if (ai.movingType != EnumMovingType.Standing) {
|
||||
ai.animationType = EnumAnimation.NONE;
|
||||
ai.standingType = EnumStandingType.RotateBody;
|
||||
ai.bodyOffsetX = ai.bodyOffsetY = ai.bodyOffsetZ = 5;
|
||||
}
|
||||
initGui();
|
||||
} else if (button.id == 3) {
|
||||
ai.animationType = EnumAnimation.values()[button.getValue()];
|
||||
initGui();
|
||||
} else if (button.id == 4) {
|
||||
ai.standingType = EnumStandingType.values()[button.getValue()];
|
||||
initGui();
|
||||
} else if (button.id == 5) {
|
||||
ai.npcInteracting = button.getValue() == 1;
|
||||
} else if (button.id == 8) {
|
||||
ai.movingPattern = button.getValue();
|
||||
} else if (button.id == 9) {
|
||||
ai.movingPause = button.getValue() == 1;
|
||||
} else if (button.id == 12) {
|
||||
if (button.getValue() == 0)
|
||||
ai.animationType = EnumAnimation.NONE;
|
||||
if (button.getValue() == 1)
|
||||
ai.animationType = EnumAnimation.SNEAKING;
|
||||
if (button.getValue() == 2)
|
||||
ai.animationType = EnumAnimation.AIMING;
|
||||
if (button.getValue() == 3)
|
||||
ai.animationType = EnumAnimation.DANCING;
|
||||
if (button.getValue() == 4)
|
||||
ai.animationType = EnumAnimation.CRAWLING;
|
||||
if (button.getValue() == 5)
|
||||
ai.animationType = EnumAnimation.HUG;
|
||||
} else if (button.id == 13) {
|
||||
ai.stopAndInteract = button.getValue() == 1;
|
||||
} else if (button.id == 15) {
|
||||
ai.movementType = button.getValue();
|
||||
initGui();
|
||||
} else if (button.id == 20) {
|
||||
ai.hasFlyLimit = button.getValue() == 1;
|
||||
initGui();
|
||||
} else if (button.id == 66) {
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unFocused(GuiNpcTextField textfield) {
|
||||
if(textfield.id == 7){
|
||||
ai.bodyOffsetX = textfield.getInteger();
|
||||
}
|
||||
else if(textfield.id == 8){
|
||||
ai.bodyOffsetY = textfield.getInteger();
|
||||
}
|
||||
else if(textfield.id == 9){
|
||||
ai.bodyOffsetZ = textfield.getInteger();
|
||||
}
|
||||
else if(textfield.id == 5){
|
||||
ai.orientation = textfield.getInteger();
|
||||
}
|
||||
else if(textfield.id == 4){
|
||||
ai.walkingRange = textfield.getInteger();
|
||||
}
|
||||
else if(textfield.id == 14){
|
||||
ai.setWalkingSpeed(textfield.getInteger());
|
||||
}
|
||||
else if(textfield.id == 18){
|
||||
ai.flySpeed = textfield.getDouble();
|
||||
}
|
||||
else if(textfield.id == 19){
|
||||
ai.flyGravity = textfield.getDouble();
|
||||
}
|
||||
else if(textfield.id == 21){
|
||||
ai.flyHeightLimit = textfield.getInteger();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void unFocused(GuiNpcTextField textfield) {
|
||||
if (textfield.id == 7) {
|
||||
ai.bodyOffsetX = textfield.getInteger();
|
||||
} else if (textfield.id == 8) {
|
||||
ai.bodyOffsetY = textfield.getInteger();
|
||||
} else if (textfield.id == 9) {
|
||||
ai.bodyOffsetZ = textfield.getInteger();
|
||||
} else if (textfield.id == 5) {
|
||||
ai.orientation = textfield.getInteger();
|
||||
} else if (textfield.id == 4) {
|
||||
ai.walkingRange = textfield.getInteger();
|
||||
} else if (textfield.id == 14) {
|
||||
ai.setWalkingSpeed(textfield.getInteger());
|
||||
} else if (textfield.id == 18) {
|
||||
ai.flySpeed = textfield.getDouble();
|
||||
} else if (textfield.id == 19) {
|
||||
ai.flyGravity = textfield.getDouble();
|
||||
} else if (textfield.id == 21) {
|
||||
ai.flyHeightLimit = textfield.getInteger();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,58 +6,59 @@ import noppes.npcs.client.gui.mainmenu.GuiNpcDisplay;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
|
||||
public class SubGuiNpcName extends SubGuiInterface implements ITextfieldListener {
|
||||
private DataDisplay display;
|
||||
public SubGuiNpcName(DataDisplay display){
|
||||
this.display = display;
|
||||
setBackground("menubg.png");
|
||||
xSize = 256;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
private DataDisplay display;
|
||||
|
||||
public SubGuiNpcName(DataDisplay display) {
|
||||
this.display = display;
|
||||
setBackground("menubg.png");
|
||||
xSize = 256;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui(){
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
int y = guiTop + 4;
|
||||
addButton(new GuiNpcButton(66, guiLeft + xSize - 24, y, 20, 20, "X"));
|
||||
|
||||
addTextField(new GuiNpcTextField(0,this, fontRendererObj, guiLeft + 4, y += 50, 226, 20, display.name));
|
||||
this.addButton(new GuiButtonBiDirectional(1, guiLeft + 4, y += 22 , 200, 20, new String[] {"markov.roman.name", "markov.japanese.name", "markov.slavic.name", "markov.welsh.name", "markov.sami.name", "markov.oldNorse.name", "markov.ancientGreek.name", "markov.aztec.name", "markov.classicCNPCs.name", "markov.spanish.name"}, display.getMarkovGeneratorId()));
|
||||
|
||||
this.addButton(new GuiButtonBiDirectional(2, guiLeft + 64, y += 22 , 120, 20, new String[] {"markov.gender.either", "markov.gender.male", "markov.gender.female"}, display.getMarkovGender()));
|
||||
addLabel(new GuiNpcLabel(2,"markov.gender.name", guiLeft + 5, y + 5));
|
||||
|
||||
addButton(new GuiNpcButton(3, guiLeft + 4, y += 42, 70, 20, "markov.generate"));
|
||||
addButton(new GuiNpcButton(66, guiLeft + xSize - 24, y, 20, 20, "X"));
|
||||
|
||||
addTextField(new GuiNpcTextField(0, this, fontRendererObj, guiLeft + 4, y += 50, 226, 20, display.name));
|
||||
this.addButton(new GuiButtonBiDirectional(1, guiLeft + 4, y += 22, 200, 20, new String[]{"markov.roman.name", "markov.japanese.name", "markov.slavic.name", "markov.welsh.name", "markov.sami.name", "markov.oldNorse.name", "markov.ancientGreek.name", "markov.aztec.name", "markov.classicCNPCs.name", "markov.spanish.name"}, display.getMarkovGeneratorId()));
|
||||
|
||||
this.addButton(new GuiButtonBiDirectional(2, guiLeft + 64, y += 22, 120, 20, new String[]{"markov.gender.either", "markov.gender.male", "markov.gender.female"}, display.getMarkovGender()));
|
||||
addLabel(new GuiNpcLabel(2, "markov.gender.name", guiLeft + 5, y + 5));
|
||||
|
||||
addButton(new GuiNpcButton(3, guiLeft + 4, y += 42, 70, 20, "markov.generate"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unFocused(GuiNpcTextField textfield) {
|
||||
if(textfield.id == 0){
|
||||
if(!textfield.isEmpty())
|
||||
display.setName(textfield.getText());
|
||||
else
|
||||
textfield.setText(display.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton){
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
@Override
|
||||
public void unFocused(GuiNpcTextField textfield) {
|
||||
if (textfield.id == 0) {
|
||||
if (!textfield.isEmpty())
|
||||
display.setName(textfield.getText());
|
||||
else
|
||||
textfield.setText(display.getName());
|
||||
}
|
||||
}
|
||||
|
||||
if(button.id == 1) {
|
||||
display.setMarkovGeneratorId(button.getValue());
|
||||
}
|
||||
if(button.id == 2) {
|
||||
display.setMarkovGender(button.getValue());
|
||||
}
|
||||
if(button.id == 3) {
|
||||
String name = display.getRandomName();
|
||||
display.setName(name);
|
||||
getTextField(0).setText(name);
|
||||
((GuiNpcDisplay)parent).nameText.setText(name);
|
||||
}
|
||||
if(button.id == 66){
|
||||
close();
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
|
||||
if (button.id == 1) {
|
||||
display.setMarkovGeneratorId(button.getValue());
|
||||
}
|
||||
if (button.id == 2) {
|
||||
display.setMarkovGender(button.getValue());
|
||||
}
|
||||
if (button.id == 3) {
|
||||
String name = display.getRandomName();
|
||||
display.setName(name);
|
||||
getTextField(0).setText(name);
|
||||
((GuiNpcDisplay) parent).nameText.setText(name);
|
||||
}
|
||||
if (button.id == 66) {
|
||||
close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,21 +7,18 @@ import noppes.npcs.constants.EnumPartyObjectives;
|
||||
import noppes.npcs.constants.EnumPartyRequirements;
|
||||
import noppes.npcs.controllers.data.PartyOptions;
|
||||
|
||||
public class SubGuiNpcPartyOptions extends SubGuiInterface implements ITextfieldListener
|
||||
{
|
||||
private final PartyOptions options;
|
||||
public class SubGuiNpcPartyOptions extends SubGuiInterface implements ITextfieldListener {
|
||||
private final PartyOptions options;
|
||||
|
||||
public SubGuiNpcPartyOptions(PartyOptions options)
|
||||
{
|
||||
this.options = options;
|
||||
setBackground("menubg.png");
|
||||
xSize = 256;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
public SubGuiNpcPartyOptions(PartyOptions options) {
|
||||
this.options = options;
|
||||
setBackground("menubg.png");
|
||||
xSize = 256;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
{
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
int y = 0;
|
||||
@@ -88,9 +85,8 @@ public class SubGuiNpcPartyOptions extends SubGuiInterface implements ITextfield
|
||||
addButton(new GuiNpcButton(66, guiLeft + 200, guiTop + 192, 50, 20, "gui.done"));
|
||||
}
|
||||
|
||||
protected void actionPerformed(GuiButton guibutton)
|
||||
{
|
||||
int id = guibutton.id;
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
int id = guibutton.id;
|
||||
switch (id) {
|
||||
case 0:
|
||||
options.allowParty = !options.allowParty;
|
||||
|
||||
@@ -1,25 +1,24 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.client.gui.util.GuiNpcButton;
|
||||
import noppes.npcs.client.gui.util.GuiNpcLabel;
|
||||
import noppes.npcs.client.gui.util.SubGuiInterface;
|
||||
import noppes.npcs.constants.EnumProfileSync;
|
||||
import noppes.npcs.controllers.data.ProfileOptions;
|
||||
|
||||
public class SubGuiNpcProfileOptions extends SubGuiInterface
|
||||
{
|
||||
private final ProfileOptions options;
|
||||
public class SubGuiNpcProfileOptions extends SubGuiInterface {
|
||||
private final ProfileOptions options;
|
||||
|
||||
public SubGuiNpcProfileOptions(ProfileOptions options)
|
||||
{
|
||||
this.options = options;
|
||||
setBackground("menubg.png");
|
||||
xSize = 256;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
public SubGuiNpcProfileOptions(ProfileOptions options) {
|
||||
this.options = options;
|
||||
setBackground("menubg.png");
|
||||
xSize = 256;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
{
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
int y = 0;
|
||||
@@ -43,9 +42,8 @@ public class SubGuiNpcProfileOptions extends SubGuiInterface
|
||||
addButton(new GuiNpcButton(66, guiLeft + 200, guiTop + 192, 50, 20, "gui.done"));
|
||||
}
|
||||
|
||||
protected void actionPerformed(GuiButton guibutton)
|
||||
{
|
||||
int id = guibutton.id;
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
int id = guibutton.id;
|
||||
switch (id) {
|
||||
case 0:
|
||||
options.enableOptions = !options.enableOptions;
|
||||
|
||||
@@ -6,136 +6,128 @@ import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumParticleType;
|
||||
import noppes.npcs.constants.EnumPotionType;
|
||||
|
||||
public class SubGuiNpcProjectiles extends SubGuiInterface implements ITextfieldListener
|
||||
{
|
||||
private DataStats stats;
|
||||
private String[] potionNames = new String[]{"gui.none", "tile.fire.name", "potion.poison", "potion.hunger", "potion.weakness", "potion.moveSlowdown", "potion.confusion", "potion.blindness", "potion.wither"};
|
||||
private String[] trailNames = new String[]{"gui.none", "Smoke", "Portal", "Redstone", "Lightning", "LargeSmoke", "Magic", "Enchant"};
|
||||
public SubGuiNpcProjectiles(DataStats stats)
|
||||
{
|
||||
this.stats = stats;
|
||||
setBackground("menubg.png");
|
||||
xSize = 256;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
public class SubGuiNpcProjectiles extends SubGuiInterface implements ITextfieldListener {
|
||||
private DataStats stats;
|
||||
private String[] potionNames = new String[]{"gui.none", "tile.fire.name", "potion.poison", "potion.hunger", "potion.weakness", "potion.moveSlowdown", "potion.confusion", "potion.blindness", "potion.wither"};
|
||||
private String[] trailNames = new String[]{"gui.none", "Smoke", "Portal", "Redstone", "Lightning", "LargeSmoke", "Magic", "Enchant"};
|
||||
|
||||
public SubGuiNpcProjectiles(DataStats stats) {
|
||||
this.stats = stats;
|
||||
setBackground("menubg.png");
|
||||
xSize = 256;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
{
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
addLabel(new GuiNpcLabel(1,"enchantment.arrowDamage", guiLeft + 5, guiTop + 15));
|
||||
addTextField(new GuiNpcTextField(1,this, fontRendererObj, guiLeft + 45, guiTop + 10, 50, 18, String.format("%.0f", stats.pDamage) +""));
|
||||
addLabel(new GuiNpcLabel(1, "enchantment.arrowDamage", guiLeft + 5, guiTop + 15));
|
||||
addTextField(new GuiNpcTextField(1, this, fontRendererObj, guiLeft + 45, guiTop + 10, 50, 18, String.format("%.0f", stats.pDamage) + ""));
|
||||
getTextField(1).setFloatsOnly();
|
||||
getTextField(1).setMinMaxDefaultFloat(0, Float.MAX_VALUE, 5);
|
||||
addLabel(new GuiNpcLabel(2,"enchantment.arrowKnockback", guiLeft + 110, guiTop + 15));
|
||||
addTextField(new GuiNpcTextField(2,this, fontRendererObj, guiLeft + 150, guiTop + 10, 50, 18, stats.pImpact+""));
|
||||
addLabel(new GuiNpcLabel(2, "enchantment.arrowKnockback", guiLeft + 110, guiTop + 15));
|
||||
addTextField(new GuiNpcTextField(2, this, fontRendererObj, guiLeft + 150, guiTop + 10, 50, 18, stats.pImpact + ""));
|
||||
getTextField(2).integersOnly = true;
|
||||
getTextField(2).setMinMaxDefault(0, Integer.MAX_VALUE, 0);
|
||||
addLabel(new GuiNpcLabel(3,"stats.size", guiLeft + 5, guiTop + 45));
|
||||
addTextField(new GuiNpcTextField(3,this, fontRendererObj, guiLeft + 45, guiTop + 40, 50, 18, stats.pSize+""));
|
||||
addLabel(new GuiNpcLabel(3, "stats.size", guiLeft + 5, guiTop + 45));
|
||||
addTextField(new GuiNpcTextField(3, this, fontRendererObj, guiLeft + 45, guiTop + 40, 50, 18, stats.pSize + ""));
|
||||
getTextField(3).integersOnly = true;
|
||||
getTextField(3).setMinMaxDefault(1, Integer.MAX_VALUE, 10);
|
||||
addLabel(new GuiNpcLabel(4,"stats.speed", guiLeft + 5, guiTop + 75));
|
||||
addTextField(new GuiNpcTextField(4,this, fontRendererObj, guiLeft + 45, guiTop + 70, 50, 18, stats.pSpeed+""));
|
||||
addLabel(new GuiNpcLabel(4, "stats.speed", guiLeft + 5, guiTop + 75));
|
||||
addTextField(new GuiNpcTextField(4, this, fontRendererObj, guiLeft + 45, guiTop + 70, 50, 18, stats.pSpeed + ""));
|
||||
getTextField(4).integersOnly = true;
|
||||
getTextField(4).setMinMaxDefault(1, Integer.MAX_VALUE, 10);
|
||||
|
||||
addLabel(new GuiNpcLabel(5,"stats.hasgravity", guiLeft + 5, guiTop + 105));
|
||||
addButton(new GuiNpcButton(0, guiLeft + 60, guiTop + 100, 60, 20, new String[]{"gui.no", "gui.yes"} ,stats.pPhysics ? 1:0));
|
||||
if(!stats.pPhysics) {
|
||||
addButton(new GuiNpcButton(1, guiLeft + 140, guiTop + 100, 60, 20, new String[]{"gui.constant", "gui.accelerate"} ,stats.pXlr8 ? 1:0));
|
||||
}
|
||||
addLabel(new GuiNpcLabel(6,"stats.explosive", guiLeft + 5, guiTop + 135));
|
||||
addButton(new GuiNpcButton(2, guiLeft + 60, guiTop + 130, 60, 20, new String[]{"gui.no", "gui.yes"} ,stats.pExplode ? 1:0));
|
||||
if(stats.pExplode) {
|
||||
addButton(new GuiNpcButton(3, guiLeft + 140, guiTop + 130, 60, 20, new String[]{"gui.none", "gui.small", "gui.medium", "gui.large"} ,stats.pArea));
|
||||
}
|
||||
addLabel(new GuiNpcLabel(7,"stats.rangedeffect", guiLeft + 5, guiTop + 165));
|
||||
addButton(new GuiNpcButton(4,guiLeft + 60, guiTop + 160, 60, 20, potionNames, stats.pEffect.ordinal()));
|
||||
if(stats.pEffect != EnumPotionType.None) {
|
||||
addTextField(new GuiNpcTextField(5,this, fontRendererObj, guiLeft + 140, guiTop + 160, 60, 18, stats.pDur + ""));
|
||||
getTextField(5).integersOnly = true;
|
||||
getTextField(5).setMinMaxDefault(1, Integer.MAX_VALUE, 5);
|
||||
if(stats.pEffect != EnumPotionType.Fire) {
|
||||
addButton(new GuiNpcButton(10, guiLeft + 210, guiTop + 160, 40, 20, new String[]{"stats.regular", "stats.amplified"} ,stats.pEffAmp));
|
||||
}
|
||||
}
|
||||
|
||||
addLabel(new GuiNpcLabel(8,"stats.trail", guiLeft + 5, guiTop + 195));
|
||||
addButton(new GuiNpcButton(5, guiLeft + 60, guiTop + 190, 60, 20, trailNames, stats.pTrail.ordinal()));
|
||||
|
||||
addButton(new GuiNpcButton(7, guiLeft + 220, guiTop + 10, 30, 20, new String[]{"2D", "3D"} ,stats.pRender3D ? 1:0));
|
||||
if (stats.pRender3D) {
|
||||
addLabel(new GuiNpcLabel(10,"stats.spin", guiLeft + 160, guiTop + 45));
|
||||
addButton(new GuiNpcButton(8, guiLeft + 220, guiTop + 40, 30, 20, new String[]{"gui.no", "gui.yes"} ,stats.pSpin ? 1:0));
|
||||
addLabel(new GuiNpcLabel(11,"stats.stick", guiLeft + 160, guiTop + 75));
|
||||
addButton(new GuiNpcButton(9, guiLeft + 220, guiTop + 70, 30, 20, new String[]{"gui.no", "gui.yes"} ,stats.pStick ? 1:0));
|
||||
}
|
||||
addButton(new GuiNpcButton(6, guiLeft + 140, guiTop + 190, 60, 20, new String[]{"stats.noglow", "stats.glows"} ,stats.pGlows ? 1:0));
|
||||
addButton(new GuiNpcButton(66, guiLeft + 210, guiTop + 190, 40, 20, "gui.done"));
|
||||
|
||||
addLabel(new GuiNpcLabel(5, "stats.hasgravity", guiLeft + 5, guiTop + 105));
|
||||
addButton(new GuiNpcButton(0, guiLeft + 60, guiTop + 100, 60, 20, new String[]{"gui.no", "gui.yes"}, stats.pPhysics ? 1 : 0));
|
||||
if (!stats.pPhysics) {
|
||||
addButton(new GuiNpcButton(1, guiLeft + 140, guiTop + 100, 60, 20, new String[]{"gui.constant", "gui.accelerate"}, stats.pXlr8 ? 1 : 0));
|
||||
}
|
||||
addLabel(new GuiNpcLabel(6, "stats.explosive", guiLeft + 5, guiTop + 135));
|
||||
addButton(new GuiNpcButton(2, guiLeft + 60, guiTop + 130, 60, 20, new String[]{"gui.no", "gui.yes"}, stats.pExplode ? 1 : 0));
|
||||
if (stats.pExplode) {
|
||||
addButton(new GuiNpcButton(3, guiLeft + 140, guiTop + 130, 60, 20, new String[]{"gui.none", "gui.small", "gui.medium", "gui.large"}, stats.pArea));
|
||||
}
|
||||
addLabel(new GuiNpcLabel(7, "stats.rangedeffect", guiLeft + 5, guiTop + 165));
|
||||
addButton(new GuiNpcButton(4, guiLeft + 60, guiTop + 160, 60, 20, potionNames, stats.pEffect.ordinal()));
|
||||
if (stats.pEffect != EnumPotionType.None) {
|
||||
addTextField(new GuiNpcTextField(5, this, fontRendererObj, guiLeft + 140, guiTop + 160, 60, 18, stats.pDur + ""));
|
||||
getTextField(5).integersOnly = true;
|
||||
getTextField(5).setMinMaxDefault(1, Integer.MAX_VALUE, 5);
|
||||
if (stats.pEffect != EnumPotionType.Fire) {
|
||||
addButton(new GuiNpcButton(10, guiLeft + 210, guiTop + 160, 40, 20, new String[]{"stats.regular", "stats.amplified"}, stats.pEffAmp));
|
||||
}
|
||||
}
|
||||
|
||||
addLabel(new GuiNpcLabel(8, "stats.trail", guiLeft + 5, guiTop + 195));
|
||||
addButton(new GuiNpcButton(5, guiLeft + 60, guiTop + 190, 60, 20, trailNames, stats.pTrail.ordinal()));
|
||||
|
||||
addButton(new GuiNpcButton(7, guiLeft + 220, guiTop + 10, 30, 20, new String[]{"2D", "3D"}, stats.pRender3D ? 1 : 0));
|
||||
if (stats.pRender3D) {
|
||||
addLabel(new GuiNpcLabel(10, "stats.spin", guiLeft + 160, guiTop + 45));
|
||||
addButton(new GuiNpcButton(8, guiLeft + 220, guiTop + 40, 30, 20, new String[]{"gui.no", "gui.yes"}, stats.pSpin ? 1 : 0));
|
||||
addLabel(new GuiNpcLabel(11, "stats.stick", guiLeft + 160, guiTop + 75));
|
||||
addButton(new GuiNpcButton(9, guiLeft + 220, guiTop + 70, 30, 20, new String[]{"gui.no", "gui.yes"}, stats.pStick ? 1 : 0));
|
||||
}
|
||||
addButton(new GuiNpcButton(6, guiLeft + 140, guiTop + 190, 60, 20, new String[]{"stats.noglow", "stats.glows"}, stats.pGlows ? 1 : 0));
|
||||
addButton(new GuiNpcButton(66, guiLeft + 210, guiTop + 190, 40, 20, "gui.done"));
|
||||
}
|
||||
|
||||
public void unFocused(GuiNpcTextField textfield) {
|
||||
if(textfield.id == 1){
|
||||
stats.pDamage = (float)(Math.floor(Float.parseFloat(textfield.getText())));
|
||||
}
|
||||
else if(textfield.id == 2){
|
||||
stats.pImpact = textfield.getInteger();
|
||||
}
|
||||
else if(textfield.id == 3){
|
||||
stats.pSize = textfield.getInteger();
|
||||
}
|
||||
else if(textfield.id == 4){
|
||||
stats.pSpeed = textfield.getInteger();
|
||||
}
|
||||
else if(textfield.id == 5){
|
||||
stats.pDur = textfield.getInteger();
|
||||
}
|
||||
}
|
||||
|
||||
protected void actionPerformed(GuiButton guibutton)
|
||||
{
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
if(button.id == 0){
|
||||
stats.pPhysics = (button.getValue() == 1);
|
||||
initGui();
|
||||
public void unFocused(GuiNpcTextField textfield) {
|
||||
if (textfield.id == 1) {
|
||||
stats.pDamage = (float) (Math.floor(Float.parseFloat(textfield.getText())));
|
||||
} else if (textfield.id == 2) {
|
||||
stats.pImpact = textfield.getInteger();
|
||||
} else if (textfield.id == 3) {
|
||||
stats.pSize = textfield.getInteger();
|
||||
} else if (textfield.id == 4) {
|
||||
stats.pSpeed = textfield.getInteger();
|
||||
} else if (textfield.id == 5) {
|
||||
stats.pDur = textfield.getInteger();
|
||||
}
|
||||
if(button.id == 1){
|
||||
stats.pXlr8 = (button.getValue() == 1);
|
||||
}
|
||||
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
if (button.id == 0) {
|
||||
stats.pPhysics = (button.getValue() == 1);
|
||||
initGui();
|
||||
}
|
||||
if(button.id == 2){
|
||||
stats.pExplode = (button.getValue() == 1);
|
||||
initGui();
|
||||
if (button.id == 1) {
|
||||
stats.pXlr8 = (button.getValue() == 1);
|
||||
}
|
||||
if(button.id == 3){
|
||||
stats.pArea = button.getValue();
|
||||
if (button.id == 2) {
|
||||
stats.pExplode = (button.getValue() == 1);
|
||||
initGui();
|
||||
}
|
||||
if(button.id == 4){
|
||||
stats.pEffect = EnumPotionType.values()[button.getValue()];
|
||||
initGui();
|
||||
if (button.id == 3) {
|
||||
stats.pArea = button.getValue();
|
||||
}
|
||||
if(button.id == 5){
|
||||
stats.pTrail = EnumParticleType.values()[button.getValue()];
|
||||
if (button.id == 4) {
|
||||
stats.pEffect = EnumPotionType.values()[button.getValue()];
|
||||
initGui();
|
||||
}
|
||||
if(button.id == 6){
|
||||
stats.pGlows = (button.getValue() == 1);
|
||||
if (button.id == 5) {
|
||||
stats.pTrail = EnumParticleType.values()[button.getValue()];
|
||||
}
|
||||
if(button.id == 7){
|
||||
stats.pRender3D = (button.getValue() == 1);
|
||||
initGui();
|
||||
if (button.id == 6) {
|
||||
stats.pGlows = (button.getValue() == 1);
|
||||
}
|
||||
if(button.id == 8){
|
||||
stats.pSpin = (button.getValue() == 1);
|
||||
if (button.id == 7) {
|
||||
stats.pRender3D = (button.getValue() == 1);
|
||||
initGui();
|
||||
}
|
||||
if(button.id == 9){
|
||||
stats.pStick = (button.getValue() == 1);
|
||||
if (button.id == 8) {
|
||||
stats.pSpin = (button.getValue() == 1);
|
||||
}
|
||||
if(button.id == 10){
|
||||
stats.pEffAmp = button.getValue();
|
||||
if (button.id == 9) {
|
||||
stats.pStick = (button.getValue() == 1);
|
||||
}
|
||||
if(button.id == 66)
|
||||
{
|
||||
close();
|
||||
if (button.id == 10) {
|
||||
stats.pEffAmp = button.getValue();
|
||||
}
|
||||
if (button.id == 66) {
|
||||
close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,231 +19,219 @@ import noppes.npcs.constants.EnumQuestType;
|
||||
import noppes.npcs.controllers.data.PlayerMail;
|
||||
import noppes.npcs.controllers.data.Quest;
|
||||
|
||||
public class SubGuiNpcQuest extends SubGuiInterface implements ISubGuiListener, GuiSelectionListener,ITextfieldListener
|
||||
{
|
||||
public class SubGuiNpcQuest extends SubGuiInterface implements ISubGuiListener, GuiSelectionListener, ITextfieldListener {
|
||||
|
||||
public int questCategoryID;
|
||||
public Quest quest;
|
||||
private final GuiNPCManageQuest parent;
|
||||
private boolean questlogTA = false;
|
||||
public int questCategoryID;
|
||||
public Quest quest;
|
||||
private final GuiNPCManageQuest parent;
|
||||
private boolean questlogTA = false;
|
||||
|
||||
public SubGuiNpcQuest(GuiNPCManageQuest parent, Quest quest, int catId)
|
||||
{
|
||||
this.parent = parent;
|
||||
this.quest = quest;
|
||||
this.questCategoryID = catId;
|
||||
setBackground("menubg.png");
|
||||
xSize = 360;
|
||||
ySize = 216;
|
||||
}
|
||||
public SubGuiNpcQuest(GuiNPCManageQuest parent, Quest quest, int catId) {
|
||||
this.parent = parent;
|
||||
this.quest = quest;
|
||||
this.questCategoryID = catId;
|
||||
setBackground("menubg.png");
|
||||
xSize = 360;
|
||||
ySize = 216;
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
{
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
addLabel(new GuiNpcLabel(1,"gui.title", guiLeft + 4, guiTop + 8));
|
||||
addTextField(new GuiNpcTextField(1, this, this.fontRendererObj, guiLeft + 36, guiTop + 3, 200, 20, quest.title));
|
||||
addLabel(new GuiNpcLabel(1, "gui.title", guiLeft + 4, guiTop + 8));
|
||||
addTextField(new GuiNpcTextField(1, this, this.fontRendererObj, guiLeft + 36, guiTop + 3, 200, 20, quest.title));
|
||||
|
||||
addLabel(new GuiNpcLabel(0,"ID", guiLeft + 238, guiTop + 4));
|
||||
addLabel(new GuiNpcLabel(2, quest.id + "", guiLeft + 238, guiTop + 14));
|
||||
addLabel(new GuiNpcLabel(0, "ID", guiLeft + 238, guiTop + 4));
|
||||
addLabel(new GuiNpcLabel(2, quest.id + "", guiLeft + 238, guiTop + 14));
|
||||
|
||||
addLabel(new GuiNpcLabel(3, "quest.completedtext", guiLeft + 7, guiTop + 33));
|
||||
addButton(new GuiNpcButton(3, guiLeft + 120, guiTop + 28, 50, 20, "selectServer.edit"));
|
||||
addLabel(new GuiNpcLabel(3, "quest.completedtext", guiLeft + 7, guiTop + 33));
|
||||
addButton(new GuiNpcButton(3, guiLeft + 120, guiTop + 28, 50, 20, "selectServer.edit"));
|
||||
|
||||
addLabel(new GuiNpcLabel(4, "quest.questlogtext", guiLeft + 7, guiTop + 57));
|
||||
addButton(new GuiNpcButton(4, guiLeft + 120, guiTop + 52, 50, 20, "selectServer.edit"));
|
||||
addLabel(new GuiNpcLabel(4, "quest.questlogtext", guiLeft + 7, guiTop + 57));
|
||||
addButton(new GuiNpcButton(4, guiLeft + 120, guiTop + 52, 50, 20, "selectServer.edit"));
|
||||
|
||||
addLabel(new GuiNpcLabel(5, "quest.reward", guiLeft + 7, guiTop + 81));
|
||||
addButton(new GuiNpcButton(5, guiLeft + 120, guiTop + 76, 50, 20, "selectServer.edit"));
|
||||
addLabel(new GuiNpcLabel(5, "quest.reward", guiLeft + 7, guiTop + 81));
|
||||
addButton(new GuiNpcButton(5, guiLeft + 120, guiTop + 76, 50, 20, "selectServer.edit"));
|
||||
|
||||
addLabel(new GuiNpcLabel(10, "faction.options", guiLeft + 180, guiTop + 33));
|
||||
addButton(new GuiNpcButton(10, guiLeft + 303, guiTop + 28, 50, 20, "selectServer.edit"));
|
||||
addLabel(new GuiNpcLabel(10, "faction.options", guiLeft + 180, guiTop + 33));
|
||||
addButton(new GuiNpcButton(10, guiLeft + 303, guiTop + 28, 50, 20, "selectServer.edit"));
|
||||
|
||||
addLabel(new GuiNpcLabel(11, "advMode.command", guiLeft + 180, guiTop + 57));
|
||||
addButton(new GuiNpcButton(11, guiLeft + 303, guiTop + 52, 50, 20, "selectServer.edit"));
|
||||
addLabel(new GuiNpcLabel(11, "advMode.command", guiLeft + 180, guiTop + 57));
|
||||
addButton(new GuiNpcButton(11, guiLeft + 303, guiTop + 52, 50, 20, "selectServer.edit"));
|
||||
|
||||
addLabel(new GuiNpcLabel(6, "gui.type", guiLeft + 180, guiTop + 81));
|
||||
addButton(new GuiNpcButton(6, guiLeft + 240, guiTop + 76, 60, 20, new String[]{"quest.item","quest.dialog","quest.kill","quest.location","quest.areakill","quest.manual"},quest.type.ordinal()));
|
||||
addButton(new GuiNpcButton(7, guiLeft + 303, guiTop + 76,50, 20, "selectServer.edit"));
|
||||
addLabel(new GuiNpcLabel(6, "gui.type", guiLeft + 180, guiTop + 81));
|
||||
addButton(new GuiNpcButton(6, guiLeft + 240, guiTop + 76, 60, 20, new String[]{"quest.item", "quest.dialog", "quest.kill", "quest.location", "quest.areakill", "quest.manual"}, quest.type.ordinal()));
|
||||
addButton(new GuiNpcButton(7, guiLeft + 303, guiTop + 76, 50, 20, "selectServer.edit"));
|
||||
|
||||
addLabel(new GuiNpcLabel(17, "party.options", guiLeft + 180, guiTop + 135));
|
||||
addButton(new GuiNpcButton(18, guiLeft + 303, guiTop + 130, 50, 20, "selectServer.edit"));
|
||||
addLabel(new GuiNpcLabel(17, "party.options", guiLeft + 180, guiTop + 135));
|
||||
addButton(new GuiNpcButton(18, guiLeft + 303, guiTop + 130, 50, 20, "selectServer.edit"));
|
||||
|
||||
addLabel(new GuiNpcLabel(33, "quest.profile", guiLeft + 180, guiTop + 159));
|
||||
addButton(new GuiNpcButton(33, guiLeft + 303, guiTop + 154, 50, 20, "selectServer.edit"));
|
||||
|
||||
this.addButton(new GuiNpcButton(9, guiLeft + 7, guiTop + 102,90, 20, new String[]{"quest.npc","quest.instant"},quest.completion.ordinal()));
|
||||
if(quest.completerNpc.isEmpty() && npc != null)
|
||||
quest.completerNpc = npc.display.name;
|
||||
this.addTextField(new GuiNpcTextField(2,this, this.fontRendererObj, guiLeft + 104, guiTop + 102, 154, 20, quest.completerNpc));
|
||||
this.getTextField(2).enabled = quest.completion == EnumQuestCompletion.Npc;
|
||||
this.addButton(new GuiNpcButton(9, guiLeft + 7, guiTop + 102, 90, 20, new String[]{"quest.npc", "quest.instant"}, quest.completion.ordinal()));
|
||||
if (quest.completerNpc.isEmpty() && npc != null)
|
||||
quest.completerNpc = npc.display.name;
|
||||
this.addTextField(new GuiNpcTextField(2, this, this.fontRendererObj, guiLeft + 104, guiTop + 102, 154, 20, quest.completerNpc));
|
||||
this.getTextField(2).enabled = quest.completion == EnumQuestCompletion.Npc;
|
||||
|
||||
addButton(new GuiNpcButton(15, guiLeft + 4, guiTop + 130, 144, 20, "quest.next"));
|
||||
addButton(new GuiNpcButton(12, guiLeft + 150, guiTop + 130, 20, 20, "X"));
|
||||
if(!parent.nextQuestName.isEmpty())
|
||||
getButton(15).setDisplayText(parent.nextQuestName);
|
||||
addButton(new GuiNpcButton(15, guiLeft + 4, guiTop + 130, 144, 20, "quest.next"));
|
||||
addButton(new GuiNpcButton(12, guiLeft + 150, guiTop + 130, 20, 20, "X"));
|
||||
if (!parent.nextQuestName.isEmpty())
|
||||
getButton(15).setDisplayText(parent.nextQuestName);
|
||||
|
||||
addButton(new GuiNpcButton(13, guiLeft + 4, guiTop + 154, 144, 20, "mailbox.setup"));
|
||||
addButton(new GuiNpcButton(14, guiLeft + 150, guiTop + 154, 20, 20, "X"));
|
||||
if(!quest.mail.subject.isEmpty())
|
||||
getButton(13).setDisplayText(quest.mail.subject);
|
||||
addButton(new GuiNpcButton(13, guiLeft + 4, guiTop + 154, 144, 20, "mailbox.setup"));
|
||||
addButton(new GuiNpcButton(14, guiLeft + 150, guiTop + 154, 20, 20, "X"));
|
||||
if (!quest.mail.subject.isEmpty())
|
||||
getButton(13).setDisplayText(quest.mail.subject);
|
||||
|
||||
addLabel(new GuiNpcLabel(8, "quest.repeatable", guiLeft + 7, guiTop + 178 + 5));
|
||||
this.addButton(new GuiNpcButton(8, guiLeft + 100, guiTop + 178, 70, 20,
|
||||
new String[]{"gui.no", "gui.yes", "quest.mcdaily", "quest.mcweekly", "quest.rldaily", "quest.rlweekly", "quest.mccustom", "quest.rlcustom"}, quest.repeat.ordinal()));
|
||||
if(quest.repeat == EnumQuestRepeat.MCCUSTOM || quest.repeat == EnumQuestRepeat.RLCUSTOM) {
|
||||
if (quest.repeat == EnumQuestRepeat.MCCUSTOM || quest.repeat == EnumQuestRepeat.RLCUSTOM) {
|
||||
addButton(new GuiNpcButton(19, guiLeft + 175, guiTop + 178, 90, 20, "Set Cooldown"));
|
||||
}
|
||||
addButton(new GuiNpcButton(16, guiLeft + 303, guiTop + 192, 50, 20, "gui.done"));
|
||||
addButton(new GuiNpcButton(16, guiLeft + 303, guiTop + 192, 50, 20, "gui.done"));
|
||||
|
||||
if(!quest.mail.subject.isEmpty())
|
||||
getButton(13).setDisplayText(quest.mail.subject);
|
||||
}
|
||||
if (!quest.mail.subject.isEmpty())
|
||||
getButton(13).setDisplayText(quest.mail.subject);
|
||||
}
|
||||
|
||||
public void buttonEvent(GuiButton guibutton)
|
||||
{
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
if(button.id == 3 && quest.id >= 0){
|
||||
questlogTA = false;
|
||||
setSubGui(new SubGuiNpcTextArea(quest.completeText));
|
||||
}
|
||||
if(button.id == 4 && quest.id >= 0){
|
||||
questlogTA = true;
|
||||
setSubGui(new SubGuiNpcTextArea(quest.logText));
|
||||
}
|
||||
if(button.id == 5 && quest.id >= 0){
|
||||
public void buttonEvent(GuiButton guibutton) {
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
if (button.id == 3 && quest.id >= 0) {
|
||||
questlogTA = false;
|
||||
setSubGui(new SubGuiNpcTextArea(quest.completeText));
|
||||
}
|
||||
if (button.id == 4 && quest.id >= 0) {
|
||||
questlogTA = true;
|
||||
setSubGui(new SubGuiNpcTextArea(quest.logText));
|
||||
}
|
||||
if (button.id == 5 && quest.id >= 0) {
|
||||
PacketClient.sendClient(new QuestOpenGuiPacket(EnumGuiType.QuestReward, quest.writeToNBT(new NBTTagCompound())));
|
||||
}
|
||||
if(button.id == 6 && quest.id >= 0){
|
||||
quest.setType(EnumQuestType.values()[button.getValue()]);
|
||||
}
|
||||
if(button.id == 7)
|
||||
{
|
||||
if(quest.type == EnumQuestType.Item)
|
||||
}
|
||||
if (button.id == 6 && quest.id >= 0) {
|
||||
quest.setType(EnumQuestType.values()[button.getValue()]);
|
||||
}
|
||||
if (button.id == 7) {
|
||||
if (quest.type == EnumQuestType.Item)
|
||||
PacketClient.sendClient(new QuestOpenGuiPacket(EnumGuiType.QuestItem, quest.writeToNBT(new NBTTagCompound())));
|
||||
|
||||
if(quest.type == EnumQuestType.Dialog)
|
||||
setSubGui(new GuiNpcQuestTypeDialog(npc, quest, this));
|
||||
if (quest.type == EnumQuestType.Dialog)
|
||||
setSubGui(new GuiNpcQuestTypeDialog(npc, quest, this));
|
||||
|
||||
if(quest.type == EnumQuestType.Kill)
|
||||
setSubGui(new GuiNpcQuestTypeKill(npc, quest, this));
|
||||
if (quest.type == EnumQuestType.Kill)
|
||||
setSubGui(new GuiNpcQuestTypeKill(npc, quest, this));
|
||||
|
||||
if(quest.type == EnumQuestType.Location)
|
||||
setSubGui(new GuiNpcQuestTypeLocation(npc, quest, this));
|
||||
if (quest.type == EnumQuestType.Location)
|
||||
setSubGui(new GuiNpcQuestTypeLocation(npc, quest, this));
|
||||
|
||||
if(quest.type == EnumQuestType.AreaKill)
|
||||
setSubGui(new GuiNpcQuestTypeKill(npc, quest, this));
|
||||
if (quest.type == EnumQuestType.AreaKill)
|
||||
setSubGui(new GuiNpcQuestTypeKill(npc, quest, this));
|
||||
|
||||
if(quest.type == EnumQuestType.Manual)
|
||||
if (quest.type == EnumQuestType.Manual)
|
||||
setSubGui(new GuiNpcQuestTypeManual(npc, quest, this));
|
||||
}
|
||||
if(button.id == 8)
|
||||
{
|
||||
quest.repeat = EnumQuestRepeat.values()[button.getValue()];
|
||||
}
|
||||
if (button.id == 8) {
|
||||
quest.repeat = EnumQuestRepeat.values()[button.getValue()];
|
||||
initGui();
|
||||
}
|
||||
if(button.id == 9)
|
||||
{
|
||||
quest.completion = EnumQuestCompletion.values()[button.getValue()];
|
||||
this.getTextField(2).enabled = quest.completion == EnumQuestCompletion.Npc;
|
||||
}
|
||||
if(button.id == 10)
|
||||
{
|
||||
setSubGui(new SubGuiNpcFactionOptions(quest.factionOptions));
|
||||
}
|
||||
if(button.id == 11){
|
||||
setSubGui(new SubGuiNpcCommand(quest.command));
|
||||
}
|
||||
if(button.id == 12 && quest.id >= 0){
|
||||
quest.nextQuestid = -1;
|
||||
parent.nextQuestName = "";
|
||||
initGui();
|
||||
}
|
||||
if(button.id == 13){
|
||||
setSubGui(new SubGuiMailmanSendSetup(quest.mail, getParent()));
|
||||
}
|
||||
if(button.id == 14){
|
||||
quest.mail = new PlayerMail();
|
||||
initGui();
|
||||
}
|
||||
if(button.id == 15 && quest.id >= 0){
|
||||
}
|
||||
if (button.id == 9) {
|
||||
quest.completion = EnumQuestCompletion.values()[button.getValue()];
|
||||
this.getTextField(2).enabled = quest.completion == EnumQuestCompletion.Npc;
|
||||
}
|
||||
if (button.id == 10) {
|
||||
setSubGui(new SubGuiNpcFactionOptions(quest.factionOptions));
|
||||
}
|
||||
if (button.id == 11) {
|
||||
setSubGui(new SubGuiNpcCommand(quest.command));
|
||||
}
|
||||
if (button.id == 12 && quest.id >= 0) {
|
||||
quest.nextQuestid = -1;
|
||||
parent.nextQuestName = "";
|
||||
initGui();
|
||||
}
|
||||
if (button.id == 13) {
|
||||
setSubGui(new SubGuiMailmanSendSetup(quest.mail, getParent()));
|
||||
}
|
||||
if (button.id == 14) {
|
||||
quest.mail = new PlayerMail();
|
||||
initGui();
|
||||
}
|
||||
if (button.id == 15 && quest.id >= 0) {
|
||||
setSubGui(new GuiQuestSelection(quest.nextQuestid));
|
||||
}
|
||||
if(button.id == 18)
|
||||
{
|
||||
setSubGui(new SubGuiNpcPartyOptions(quest.partyOptions));
|
||||
}
|
||||
if(button.id == 19) {
|
||||
}
|
||||
if (button.id == 18) {
|
||||
setSubGui(new SubGuiNpcPartyOptions(quest.partyOptions));
|
||||
}
|
||||
if (button.id == 19) {
|
||||
boolean isMCCustom = (quest.repeat == EnumQuestRepeat.MCCUSTOM);
|
||||
setSubGui(new SubGuiNpcCooldownPicker(isMCCustom, quest.customCooldown));
|
||||
}
|
||||
if(button.id == 33){
|
||||
if (button.id == 33) {
|
||||
setSubGui(new SubGuiNpcProfileOptions(quest.profileOptions));
|
||||
}
|
||||
if(button.id == 16){
|
||||
close();
|
||||
}
|
||||
}
|
||||
if (button.id == 16) {
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void unFocused(GuiNpcTextField guiNpcTextField) {
|
||||
if(guiNpcTextField.id == 1) {
|
||||
if(quest.id < 0)
|
||||
guiNpcTextField.setText("");
|
||||
else{
|
||||
String name = guiNpcTextField.getText();
|
||||
if(name.isEmpty() || this.parent.questData.containsKey(name)){
|
||||
guiNpcTextField.setText(quest.title);
|
||||
}
|
||||
else if(quest.id >= 0){
|
||||
String old = quest.title;
|
||||
this.parent.questData.remove(old);
|
||||
quest.title = name;
|
||||
this.parent.questData.put(quest.title, quest.id);
|
||||
this.parent.questScroll.replace(old, quest.title);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(guiNpcTextField.id == 2){
|
||||
quest.completerNpc = guiNpcTextField.getText();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void unFocused(GuiNpcTextField guiNpcTextField) {
|
||||
if (guiNpcTextField.id == 1) {
|
||||
if (quest.id < 0)
|
||||
guiNpcTextField.setText("");
|
||||
else {
|
||||
String name = guiNpcTextField.getText();
|
||||
if (name.isEmpty() || this.parent.questData.containsKey(name)) {
|
||||
guiNpcTextField.setText(quest.title);
|
||||
} else if (quest.id >= 0) {
|
||||
String old = quest.title;
|
||||
this.parent.questData.remove(old);
|
||||
quest.title = name;
|
||||
this.parent.questData.put(quest.title, quest.id);
|
||||
this.parent.questScroll.replace(old, quest.title);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (guiNpcTextField.id == 2) {
|
||||
quest.completerNpc = guiNpcTextField.getText();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void subGuiClosed(SubGuiInterface subgui){
|
||||
if(subgui instanceof SubGuiNpcTextArea){
|
||||
SubGuiNpcTextArea gui = (SubGuiNpcTextArea) subgui;
|
||||
if(questlogTA)
|
||||
quest.logText = gui.text;
|
||||
else
|
||||
quest.completeText = gui.text;
|
||||
}
|
||||
else if(subgui instanceof SubGuiNpcCommand){
|
||||
SubGuiNpcCommand sub = (SubGuiNpcCommand) subgui;
|
||||
quest.command = sub.command;
|
||||
@Override
|
||||
public void subGuiClosed(SubGuiInterface subgui) {
|
||||
if (subgui instanceof SubGuiNpcTextArea) {
|
||||
SubGuiNpcTextArea gui = (SubGuiNpcTextArea) subgui;
|
||||
if (questlogTA)
|
||||
quest.logText = gui.text;
|
||||
else
|
||||
quest.completeText = gui.text;
|
||||
} else if (subgui instanceof SubGuiNpcCommand) {
|
||||
SubGuiNpcCommand sub = (SubGuiNpcCommand) subgui;
|
||||
quest.command = sub.command;
|
||||
initGui();
|
||||
|
||||
} else if(subgui instanceof SubGuiNpcCooldownPicker){
|
||||
} else if (subgui instanceof SubGuiNpcCooldownPicker) {
|
||||
SubGuiNpcCooldownPicker cooldownGui = (SubGuiNpcCooldownPicker) subgui;
|
||||
quest.customCooldown = cooldownGui.cooldownValue;
|
||||
initGui();
|
||||
} else {
|
||||
initGui();
|
||||
}
|
||||
else {
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selected(int id, String name) {
|
||||
quest.nextQuestid = id;
|
||||
quest.nextQuestTitle = name;
|
||||
parent.nextQuestName = name;
|
||||
initGui();
|
||||
@Override
|
||||
public void selected(int id, String name) {
|
||||
quest.nextQuestid = id;
|
||||
quest.nextQuestTitle = name;
|
||||
parent.nextQuestName = name;
|
||||
initGui();
|
||||
PacketClient.sendClient(new QuestSavePacket(this.questCategoryID, quest.writeToNBT(new NBTTagCompound()), false));
|
||||
}
|
||||
}
|
||||
|
||||
public void save(){
|
||||
public void save() {
|
||||
PacketClient.sendClient(new QuestSavePacket(this.questCategoryID, quest.writeToNBT(new NBTTagCompound()), false));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,25 +5,23 @@ import noppes.npcs.DataStats;
|
||||
import noppes.npcs.client.gui.select.GuiSoundSelection;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
|
||||
public class SubGuiNpcRangeProperties extends SubGuiInterface implements ITextfieldListener, ISubGuiListener
|
||||
{
|
||||
private DataStats stats;
|
||||
public class SubGuiNpcRangeProperties extends SubGuiInterface implements ITextfieldListener, ISubGuiListener {
|
||||
private DataStats stats;
|
||||
private GuiNpcTextField soundSelected = null;
|
||||
|
||||
public SubGuiNpcRangeProperties(DataStats stats)
|
||||
{
|
||||
this.stats = stats;
|
||||
setBackground("menubg.png");
|
||||
xSize = 256;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
public SubGuiNpcRangeProperties(DataStats stats) {
|
||||
this.stats = stats;
|
||||
setBackground("menubg.png");
|
||||
xSize = 256;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
}
|
||||
|
||||
public void initGui(){
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
int y = guiTop + 4;
|
||||
addTextField(new GuiNpcTextField(1,this, fontRendererObj, guiLeft + 80, y, 50, 18, stats.accuracy+""));
|
||||
addLabel(new GuiNpcLabel(1,"stats.accuracy", guiLeft + 5, y + 5));
|
||||
addTextField(new GuiNpcTextField(1, this, fontRendererObj, guiLeft + 80, y, 50, 18, stats.accuracy + ""));
|
||||
addLabel(new GuiNpcLabel(1, "stats.accuracy", guiLeft + 5, y + 5));
|
||||
getTextField(1).integersOnly = true;
|
||||
getTextField(1).setMinMaxDefault(0, 100, 90);
|
||||
|
||||
@@ -32,18 +30,18 @@ public class SubGuiNpcRangeProperties extends SubGuiInterface implements ITextfi
|
||||
getTextField(8).integersOnly = true;
|
||||
getTextField(8).setMinMaxDefault(1, Integer.MAX_VALUE, 1);
|
||||
|
||||
addTextField(new GuiNpcTextField(2,this, fontRendererObj, guiLeft + 80, y += 22, 50, 18, stats.rangedRange+""));
|
||||
addLabel(new GuiNpcLabel(2,"stats.rangedrange", guiLeft + 5, y + 5));
|
||||
addTextField(new GuiNpcTextField(2, this, fontRendererObj, guiLeft + 80, y += 22, 50, 18, stats.rangedRange + ""));
|
||||
addLabel(new GuiNpcLabel(2, "stats.rangedrange", guiLeft + 5, y + 5));
|
||||
getTextField(2).integersOnly = true;
|
||||
getTextField(2).setMinMaxDefault(1, 64, 2);
|
||||
|
||||
addTextField(new GuiNpcTextField(3,this, fontRendererObj, guiLeft + 80, y += 22, 50, 18, stats.minDelay+""));
|
||||
addLabel(new GuiNpcLabel(3,"stats.mindelay", guiLeft + 5, y + 5));
|
||||
addTextField(new GuiNpcTextField(3, this, fontRendererObj, guiLeft + 80, y += 22, 50, 18, stats.minDelay + ""));
|
||||
addLabel(new GuiNpcLabel(3, "stats.mindelay", guiLeft + 5, y + 5));
|
||||
getTextField(3).integersOnly = true;
|
||||
getTextField(3).setMinMaxDefault(1, Integer.MAX_VALUE, 20);
|
||||
|
||||
addTextField(new GuiNpcTextField(4,this, fontRendererObj, guiLeft + 200, y, 50, 18, stats.maxDelay+""));
|
||||
addLabel(new GuiNpcLabel(4,"stats.maxdelay", guiLeft + 135, y + 5));
|
||||
addTextField(new GuiNpcTextField(4, this, fontRendererObj, guiLeft + 200, y, 50, 18, stats.maxDelay + ""));
|
||||
addLabel(new GuiNpcLabel(4, "stats.maxdelay", guiLeft + 135, y + 5));
|
||||
getTextField(4).integersOnly = true;
|
||||
getTextField(4).setMinMaxDefault(1, Integer.MAX_VALUE, 20);
|
||||
|
||||
@@ -53,85 +51,70 @@ public class SubGuiNpcRangeProperties extends SubGuiInterface implements ITextfi
|
||||
getTextField(6).integersOnly = true;
|
||||
getTextField(6).setMinMaxDefault(1, Integer.MAX_VALUE, 20);
|
||||
|
||||
addTextField(new GuiNpcTextField(5, this, fontRendererObj, guiLeft + 200, y , 50, 18, stats.fireRate + ""));
|
||||
addTextField(new GuiNpcTextField(5, this, fontRendererObj, guiLeft + 200, y, 50, 18, stats.fireRate + ""));
|
||||
addLabel(new GuiNpcLabel(5, "stats.burstspeed", guiLeft + 135, y + 5));
|
||||
getTextField(5).integersOnly = true;
|
||||
getTextField(5).setMinMaxDefault(0, Integer.MAX_VALUE, 0);
|
||||
getTextField(5).integersOnly = true;
|
||||
getTextField(5).setMinMaxDefault(0, Integer.MAX_VALUE, 0);
|
||||
|
||||
|
||||
addTextField(new GuiNpcTextField(7,this, fontRendererObj, guiLeft + 80, y += 22, 100, 20, stats.fireSound));
|
||||
addLabel(new GuiNpcLabel(7, "stats.firesound:", guiLeft + 5, y + 5));
|
||||
addButton(new GuiNpcButton(7, guiLeft + 187, y, 60, 20, "gui.select"));
|
||||
addTextField(new GuiNpcTextField(7, this, fontRendererObj, guiLeft + 80, y += 22, 100, 20, stats.fireSound));
|
||||
addLabel(new GuiNpcLabel(7, "stats.firesound:", guiLeft + 5, y + 5));
|
||||
addButton(new GuiNpcButton(7, guiLeft + 187, y, 60, 20, "gui.select"));
|
||||
|
||||
addButton(new GuiNpcButtonYesNo(9, guiLeft + 100, y += 22, stats.aimWhileShooting));
|
||||
addLabel(new GuiNpcLabel(9, "stats.aimWhileShooting", guiLeft + 5, y + 5));
|
||||
addButton(new GuiNpcButtonYesNo(9, guiLeft + 100, y += 22, stats.aimWhileShooting));
|
||||
addLabel(new GuiNpcLabel(9, "stats.aimWhileShooting", guiLeft + 5, y + 5));
|
||||
|
||||
addButton(new GuiNpcButton(66, guiLeft + 190, guiTop + 190, 60, 20, "gui.done"));
|
||||
addButton(new GuiNpcButton(66, guiLeft + 190, guiTop + 190, 60, 20, "gui.done"));
|
||||
}
|
||||
|
||||
public void unFocused(GuiNpcTextField textfield) {
|
||||
if(textfield.id == 1){
|
||||
stats.accuracy = textfield.getInteger();
|
||||
}
|
||||
else if(textfield.id == 2){
|
||||
stats.rangedRange = textfield.getInteger();
|
||||
}
|
||||
else if(textfield.id == 3){
|
||||
if (textfield.getInteger() > stats.maxDelay)
|
||||
{
|
||||
stats.minDelay = stats.maxDelay;
|
||||
textfield.setText(stats.minDelay + "");
|
||||
}
|
||||
else
|
||||
{
|
||||
stats.minDelay = textfield.getInteger();
|
||||
}
|
||||
}
|
||||
else if(textfield.id == 4){
|
||||
if (textfield.getInteger() < stats.minDelay)
|
||||
{
|
||||
stats.maxDelay = stats.minDelay;
|
||||
textfield.setText(stats.maxDelay + "");
|
||||
}
|
||||
else
|
||||
{
|
||||
stats.maxDelay = textfield.getInteger();
|
||||
}
|
||||
}
|
||||
else if(textfield.id == 5){
|
||||
stats.fireRate = textfield.getInteger();
|
||||
}
|
||||
else if(textfield.id == 6){
|
||||
stats.burstCount = textfield.getInteger();
|
||||
}
|
||||
else if(textfield.id == 7){
|
||||
stats.fireSound = textfield.getText();
|
||||
}
|
||||
else if(textfield.id == 8){
|
||||
stats.shotCount = textfield.getInteger();
|
||||
}
|
||||
}
|
||||
public void unFocused(GuiNpcTextField textfield) {
|
||||
if (textfield.id == 1) {
|
||||
stats.accuracy = textfield.getInteger();
|
||||
} else if (textfield.id == 2) {
|
||||
stats.rangedRange = textfield.getInteger();
|
||||
} else if (textfield.id == 3) {
|
||||
if (textfield.getInteger() > stats.maxDelay) {
|
||||
stats.minDelay = stats.maxDelay;
|
||||
textfield.setText(stats.minDelay + "");
|
||||
} else {
|
||||
stats.minDelay = textfield.getInteger();
|
||||
}
|
||||
} else if (textfield.id == 4) {
|
||||
if (textfield.getInteger() < stats.minDelay) {
|
||||
stats.maxDelay = stats.minDelay;
|
||||
textfield.setText(stats.maxDelay + "");
|
||||
} else {
|
||||
stats.maxDelay = textfield.getInteger();
|
||||
}
|
||||
} else if (textfield.id == 5) {
|
||||
stats.fireRate = textfield.getInteger();
|
||||
} else if (textfield.id == 6) {
|
||||
stats.burstCount = textfield.getInteger();
|
||||
} else if (textfield.id == 7) {
|
||||
stats.fireSound = textfield.getText();
|
||||
} else if (textfield.id == 8) {
|
||||
stats.shotCount = textfield.getInteger();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton){
|
||||
int id = guibutton.id;
|
||||
if(id == 7){
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
int id = guibutton.id;
|
||||
if (id == 7) {
|
||||
soundSelected = getTextField(7);
|
||||
setSubGui(new GuiSoundSelection(soundSelected.getText()));
|
||||
}
|
||||
if(id == 66)
|
||||
{
|
||||
close();
|
||||
if (id == 66) {
|
||||
close();
|
||||
} else if (id == 9) {
|
||||
stats.aimWhileShooting = ((GuiNpcButtonYesNo) guibutton).getBoolean();
|
||||
}
|
||||
else if(id == 9){
|
||||
stats.aimWhileShooting = ((GuiNpcButtonYesNo)guibutton).getBoolean();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void subGuiClosed(SubGuiInterface subgui) {
|
||||
GuiSoundSelection gss = (GuiSoundSelection) subgui;
|
||||
if(gss.selectedResource != null) {
|
||||
if (gss.selectedResource != null) {
|
||||
soundSelected.setText(gss.selectedResource.toString());
|
||||
unFocused(soundSelected);
|
||||
initGui();
|
||||
|
||||
@@ -4,90 +4,86 @@ import net.minecraft.client.gui.GuiButton;
|
||||
import noppes.npcs.Resistances;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
|
||||
public class SubGuiNpcResistanceProperties extends SubGuiInterface implements ISliderListener
|
||||
{
|
||||
private Resistances resistances;
|
||||
public SubGuiNpcResistanceProperties(Resistances resistances)
|
||||
{
|
||||
this.resistances = resistances;
|
||||
setBackground("menubg.png");
|
||||
xSize = 256;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
public class SubGuiNpcResistanceProperties extends SubGuiInterface implements ISliderListener {
|
||||
private Resistances resistances;
|
||||
|
||||
public SubGuiNpcResistanceProperties(Resistances resistances) {
|
||||
this.resistances = resistances;
|
||||
setBackground("menubg.png");
|
||||
xSize = 256;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
{
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
int y = guiTop + 10;
|
||||
addLabel(new GuiNpcLabel(0,"enchantment.knockback", guiLeft + 4, y + 5));
|
||||
addSlider(new GuiNpcSlider(this, 0, guiLeft + 94, y, (int)(resistances.knockback * 100 - 100) + "%", resistances.knockback / 2));
|
||||
addLabel(new GuiNpcLabel(0, "enchantment.knockback", guiLeft + 4, y + 5));
|
||||
addSlider(new GuiNpcSlider(this, 0, guiLeft + 94, y, (int) (resistances.knockback * 100 - 100) + "%", resistances.knockback / 2));
|
||||
|
||||
y += 22;
|
||||
|
||||
addLabel(new GuiNpcLabel(1,"item.arrow.name", guiLeft + 4, y + 5));
|
||||
addSlider(new GuiNpcSlider(this, 1, guiLeft + 94, y, (int)(resistances.arrow * 100 - 100) + "%", resistances.arrow / 2));
|
||||
addLabel(new GuiNpcLabel(1, "item.arrow.name", guiLeft + 4, y + 5));
|
||||
addSlider(new GuiNpcSlider(this, 1, guiLeft + 94, y, (int) (resistances.arrow * 100 - 100) + "%", resistances.arrow / 2));
|
||||
getSlider(1).enabled = !resistances.disableDamage;
|
||||
|
||||
y += 22;
|
||||
|
||||
addLabel(new GuiNpcLabel(2,"stats.melee", guiLeft + 4, y + 5));
|
||||
addSlider(new GuiNpcSlider(this, 2, guiLeft + 94, y, (int)(resistances.playermelee * 100 - 100) + "%", resistances.playermelee / 2));
|
||||
addLabel(new GuiNpcLabel(2, "stats.melee", guiLeft + 4, y + 5));
|
||||
addSlider(new GuiNpcSlider(this, 2, guiLeft + 94, y, (int) (resistances.playermelee * 100 - 100) + "%", resistances.playermelee / 2));
|
||||
getSlider(2).enabled = !resistances.disableDamage;
|
||||
|
||||
y += 22;
|
||||
|
||||
addLabel(new GuiNpcLabel(3,"stats.explosion", guiLeft + 4, y + 5));
|
||||
addSlider(new GuiNpcSlider(this, 3, guiLeft + 94, y, (int)(resistances.explosion * 100 - 100) + "%", resistances.explosion / 2));
|
||||
addLabel(new GuiNpcLabel(3, "stats.explosion", guiLeft + 4, y + 5));
|
||||
addSlider(new GuiNpcSlider(this, 3, guiLeft + 94, y, (int) (resistances.explosion * 100 - 100) + "%", resistances.explosion / 2));
|
||||
getSlider(3).enabled = !resistances.disableDamage;
|
||||
|
||||
y += 22;
|
||||
|
||||
addLabel(new GuiNpcLabel(21,"stats.disabledamage", guiLeft + 4, y + 5));
|
||||
this.addButton(new GuiNpcButton(21, guiLeft + 94, y, 56, 20, new String[]{"gui.no","gui.yes"}, this.resistances.disableDamage? 1:0));
|
||||
addLabel(new GuiNpcLabel(21, "stats.disabledamage", guiLeft + 4, y + 5));
|
||||
this.addButton(new GuiNpcButton(21, guiLeft + 94, y, 56, 20, new String[]{"gui.no", "gui.yes"}, this.resistances.disableDamage ? 1 : 0));
|
||||
|
||||
addButton(new GuiNpcButton(66, guiLeft + 190, guiTop + 190, 60, 20, "gui.done"));
|
||||
addButton(new GuiNpcButton(66, guiLeft + 190, guiTop + 190, 60, 20, "gui.done"));
|
||||
}
|
||||
|
||||
protected void actionPerformed(GuiButton guibutton)
|
||||
{
|
||||
int id = guibutton.id;
|
||||
if(id == 21){
|
||||
resistances.disableDamage = ((GuiNpcButton)guibutton).getValue() == 1;
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
int id = guibutton.id;
|
||||
if (id == 21) {
|
||||
resistances.disableDamage = ((GuiNpcButton) guibutton).getValue() == 1;
|
||||
initGui();
|
||||
}
|
||||
if(id == 66)
|
||||
{
|
||||
close();
|
||||
if (id == 66) {
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseDragged(GuiNpcSlider slider) {
|
||||
slider.displayString = (int)(slider.sliderValue * 200 - 100) + "%";
|
||||
}
|
||||
@Override
|
||||
public void mouseDragged(GuiNpcSlider slider) {
|
||||
slider.displayString = (int) (slider.sliderValue * 200 - 100) + "%";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mousePressed(GuiNpcSlider slider) {
|
||||
@Override
|
||||
public void mousePressed(GuiNpcSlider slider) {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(GuiNpcSlider slider) {
|
||||
if(slider.id == 0){
|
||||
resistances.knockback = slider.sliderValue * 2;
|
||||
}
|
||||
if(slider.id == 1){
|
||||
resistances.arrow = slider.sliderValue * 2;
|
||||
}
|
||||
if(slider.id == 2){
|
||||
resistances.playermelee = slider.sliderValue * 2;
|
||||
}
|
||||
if(slider.id == 3){
|
||||
resistances.explosion = slider.sliderValue * 2;
|
||||
}
|
||||
@Override
|
||||
public void mouseReleased(GuiNpcSlider slider) {
|
||||
if (slider.id == 0) {
|
||||
resistances.knockback = slider.sliderValue * 2;
|
||||
}
|
||||
if (slider.id == 1) {
|
||||
resistances.arrow = slider.sliderValue * 2;
|
||||
}
|
||||
if (slider.id == 2) {
|
||||
resistances.playermelee = slider.sliderValue * 2;
|
||||
}
|
||||
if (slider.id == 3) {
|
||||
resistances.explosion = slider.sliderValue * 2;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,68 +4,66 @@ import net.minecraft.client.gui.GuiButton;
|
||||
import noppes.npcs.DataStats;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
|
||||
public class SubGuiNpcRespawn extends SubGuiInterface implements ITextfieldListener
|
||||
{
|
||||
private DataStats stats;
|
||||
public SubGuiNpcRespawn(DataStats stats){
|
||||
this.stats = stats;
|
||||
setBackground("menubg.png");
|
||||
xSize = 256;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
public class SubGuiNpcRespawn extends SubGuiInterface implements ITextfieldListener {
|
||||
private DataStats stats;
|
||||
|
||||
public SubGuiNpcRespawn(DataStats stats) {
|
||||
this.stats = stats;
|
||||
setBackground("menubg.png");
|
||||
xSize = 256;
|
||||
ySize = 216;
|
||||
closeOnEsc = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui(){
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
addLabel(new GuiNpcLabel(0,"stats.respawn", guiLeft + 5, guiTop + 35));
|
||||
addButton(new GuiNpcButton(0,guiLeft + 122, guiTop + 30, 56, 20, new String[]{"gui.yes","gui.day","gui.night","gui.no"} ,stats.spawnCycle));
|
||||
if(stats.respawnTime > 0){
|
||||
addLabel(new GuiNpcLabel(3,"gui.time", guiLeft + 5, guiTop + 57));
|
||||
addTextField(new GuiNpcTextField(2,this, fontRendererObj, guiLeft + 122, guiTop + 53, 50, 18, stats.respawnTime + ""));
|
||||
getTextField(2).integersOnly = true;
|
||||
getTextField(2).setMinMaxDefault(1, Integer.MAX_VALUE, 20);
|
||||
|
||||
addLabel(new GuiNpcLabel(4,"stats.deadbody", guiLeft + 4, guiTop + 79));
|
||||
addButton(new GuiNpcButton(4,guiLeft + 122, guiTop + 74, 51, 20, new String[]{"gui.no","gui.yes"} ,stats.hideKilledBody?1:0));
|
||||
}
|
||||
|
||||
addLabel(new GuiNpcLabel(0, "stats.respawn", guiLeft + 5, guiTop + 35));
|
||||
addButton(new GuiNpcButton(0, guiLeft + 122, guiTop + 30, 56, 20, new String[]{"gui.yes", "gui.day", "gui.night", "gui.no"}, stats.spawnCycle));
|
||||
if (stats.respawnTime > 0) {
|
||||
addLabel(new GuiNpcLabel(3, "gui.time", guiLeft + 5, guiTop + 57));
|
||||
addTextField(new GuiNpcTextField(2, this, fontRendererObj, guiLeft + 122, guiTop + 53, 50, 18, stats.respawnTime + ""));
|
||||
getTextField(2).integersOnly = true;
|
||||
getTextField(2).setMinMaxDefault(1, Integer.MAX_VALUE, 20);
|
||||
|
||||
addLabel(new GuiNpcLabel(1,"stats.naturallydespawns", guiLeft + 4, guiTop + 101));
|
||||
addButton(new GuiNpcButton(1,guiLeft + 122, guiTop + 96, 51, 20, new String[]{"gui.no","gui.yes"} ,stats.canDespawn?1:0));
|
||||
addLabel(new GuiNpcLabel(4, "stats.deadbody", guiLeft + 4, guiTop + 79));
|
||||
addButton(new GuiNpcButton(4, guiLeft + 122, guiTop + 74, 51, 20, new String[]{"gui.no", "gui.yes"}, stats.hideKilledBody ? 1 : 0));
|
||||
}
|
||||
|
||||
addButton(new GuiNpcButton(66, guiLeft + 82, guiTop + 190,98, 20, "gui.done"));
|
||||
|
||||
addLabel(new GuiNpcLabel(1, "stats.naturallydespawns", guiLeft + 4, guiTop + 101));
|
||||
addButton(new GuiNpcButton(1, guiLeft + 122, guiTop + 96, 51, 20, new String[]{"gui.no", "gui.yes"}, stats.canDespawn ? 1 : 0));
|
||||
|
||||
addButton(new GuiNpcButton(66, guiLeft + 82, guiTop + 190, 98, 20, "gui.done"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton){
|
||||
int id = guibutton.id;
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
if(button.id == 0){
|
||||
stats.spawnCycle = button.getValue();
|
||||
if(stats.spawnCycle == 3)
|
||||
stats.respawnTime = 0;
|
||||
else
|
||||
stats.respawnTime = 20;
|
||||
initGui();
|
||||
}
|
||||
else if(button.id == 1){
|
||||
stats.canDespawn = button.getValue() == 1;
|
||||
stats.playerSetCanDespawn = stats.canDespawn;
|
||||
}
|
||||
else if(button.id == 4){
|
||||
stats.hideKilledBody = button.getValue() == 1;
|
||||
}
|
||||
if(id == 66){
|
||||
close();
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
int id = guibutton.id;
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
if (button.id == 0) {
|
||||
stats.spawnCycle = button.getValue();
|
||||
if (stats.spawnCycle == 3)
|
||||
stats.respawnTime = 0;
|
||||
else
|
||||
stats.respawnTime = 20;
|
||||
initGui();
|
||||
} else if (button.id == 1) {
|
||||
stats.canDespawn = button.getValue() == 1;
|
||||
stats.playerSetCanDespawn = stats.canDespawn;
|
||||
} else if (button.id == 4) {
|
||||
stats.hideKilledBody = button.getValue() == 1;
|
||||
}
|
||||
if (id == 66) {
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unFocused(GuiNpcTextField textfield) {
|
||||
if(textfield.id == 2){
|
||||
stats.respawnTime = textfield.getInteger();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void unFocused(GuiNpcTextField textfield) {
|
||||
if (textfield.id == 2) {
|
||||
stats.respawnTime = textfield.getInteger();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,61 +6,61 @@ import noppes.npcs.client.gui.util.GuiNpcButton;
|
||||
import noppes.npcs.client.gui.util.GuiNpcTextArea;
|
||||
import noppes.npcs.client.gui.util.SubGuiInterface;
|
||||
|
||||
public class SubGuiNpcTextArea extends SubGuiInterface{
|
||||
public String text;
|
||||
private GuiNpcTextArea textarea;
|
||||
public class SubGuiNpcTextArea extends SubGuiInterface {
|
||||
public String text;
|
||||
private GuiNpcTextArea textarea;
|
||||
|
||||
public SubGuiNpcTextArea(String text){
|
||||
this.text = text;
|
||||
setBackground("bgfilled.png");
|
||||
xSize = 256;
|
||||
ySize = 256;
|
||||
closeOnEsc = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui(){
|
||||
xSize = (int) (width * 0.88);
|
||||
ySize = (int) (xSize * 0.56);
|
||||
bgScale = xSize / 440f;
|
||||
super.initGui();
|
||||
if(textarea != null)
|
||||
this.text = textarea.getText();
|
||||
int yoffset = (int) (ySize * 0.02);
|
||||
this.addTextField(textarea = new GuiNpcTextArea(2, this, guiLeft + yoffset, guiTop + yoffset, xSize - 100 - yoffset * 2, ySize - yoffset * 2, text));
|
||||
public SubGuiNpcTextArea(String text) {
|
||||
this.text = text;
|
||||
setBackground("bgfilled.png");
|
||||
xSize = 256;
|
||||
ySize = 256;
|
||||
closeOnEsc = true;
|
||||
}
|
||||
|
||||
|
||||
this.buttonList.add(new GuiNpcButton(102, guiLeft + xSize - 90 - yoffset, guiTop + 20, 56, 20, "gui.clear"));
|
||||
this.buttonList.add(new GuiNpcButton(101, guiLeft + xSize - 90 - yoffset, guiTop + 43, 56, 20, "gui.paste"));
|
||||
this.buttonList.add(new GuiNpcButton(100, guiLeft + xSize - 90 - yoffset, guiTop + 66, 56, 20, "gui.copy"));
|
||||
|
||||
this.buttonList.add(new GuiNpcButton(0, guiLeft + xSize - 90 - yoffset, guiTop + 160, 56, 20, "gui.close"));
|
||||
|
||||
xSize = 420;
|
||||
ySize = 256;
|
||||
}
|
||||
@Override
|
||||
public void initGui() {
|
||||
xSize = (int) (width * 0.88);
|
||||
ySize = (int) (xSize * 0.56);
|
||||
bgScale = xSize / 440f;
|
||||
super.initGui();
|
||||
if (textarea != null)
|
||||
this.text = textarea.getText();
|
||||
int yoffset = (int) (ySize * 0.02);
|
||||
this.addTextField(textarea = new GuiNpcTextArea(2, this, guiLeft + yoffset, guiTop + yoffset, xSize - 100 - yoffset * 2, ySize - yoffset * 2, text));
|
||||
|
||||
|
||||
@Override
|
||||
public void close(){
|
||||
text = getTextField(2).getText();
|
||||
super.close();
|
||||
}
|
||||
this.buttonList.add(new GuiNpcButton(102, guiLeft + xSize - 90 - yoffset, guiTop + 20, 56, 20, "gui.clear"));
|
||||
this.buttonList.add(new GuiNpcButton(101, guiLeft + xSize - 90 - yoffset, guiTop + 43, 56, 20, "gui.paste"));
|
||||
this.buttonList.add(new GuiNpcButton(100, guiLeft + xSize - 90 - yoffset, guiTop + 66, 56, 20, "gui.copy"));
|
||||
|
||||
@Override
|
||||
public void buttonEvent(GuiButton guibutton) {
|
||||
int id = guibutton.id;
|
||||
if (id == 100) {
|
||||
NoppesStringUtils.setClipboardContents(getTextField(2).getText());
|
||||
}
|
||||
if (id == 101) {
|
||||
getTextField(2).setText(NoppesStringUtils.getClipboardContents());
|
||||
}
|
||||
if (id == 102) {
|
||||
getTextField(2).setText("");
|
||||
}
|
||||
if(id == 0){
|
||||
close();
|
||||
}
|
||||
}
|
||||
this.buttonList.add(new GuiNpcButton(0, guiLeft + xSize - 90 - yoffset, guiTop + 160, 56, 20, "gui.close"));
|
||||
|
||||
xSize = 420;
|
||||
ySize = 256;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
text = getTextField(2).getText();
|
||||
super.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buttonEvent(GuiButton guibutton) {
|
||||
int id = guibutton.id;
|
||||
if (id == 100) {
|
||||
NoppesStringUtils.setClipboardContents(getTextField(2).getText());
|
||||
}
|
||||
if (id == 101) {
|
||||
getTextField(2).setText(NoppesStringUtils.getClipboardContents());
|
||||
}
|
||||
if (id == 102) {
|
||||
getTextField(2).setText("");
|
||||
}
|
||||
if (id == 0) {
|
||||
close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,27 +22,27 @@ public class SubGuiNpcTint extends SubGuiInterface implements ISubGuiListener, I
|
||||
int y = 30;
|
||||
addLabel(new GuiNpcLabel(0, "tint.enable", guiLeft + 5, guiTop + y + 5));
|
||||
addButton(new GuiNpcButtonYesNo(0, guiLeft + 122, guiTop + y, 56, 20, tintData.isTintEnabled()));
|
||||
y+=22;
|
||||
y += 22;
|
||||
if (tintData.isTintEnabled()) {
|
||||
addLabel(new GuiNpcLabel(1, "tint.enablegeneral", guiLeft + 5, guiTop + y + 5));
|
||||
addButton(new GuiNpcButtonYesNo(1, guiLeft + 122, guiTop + y, 56, 20, tintData.isGeneralTintEnabled()));
|
||||
y+=22;
|
||||
if(tintData.isGeneralTintEnabled()) {
|
||||
y += 22;
|
||||
if (tintData.isGeneralTintEnabled()) {
|
||||
String color = Integer.toHexString(tintData.getGeneralTint());
|
||||
while (color.length() < 6) color = 0 + color;
|
||||
addLabel(new GuiNpcLabel(2, "tint.tint", guiLeft + 4, guiTop + y + 5));
|
||||
addButton(new GuiNpcButton(2, guiLeft + 122, guiTop + y, 60, 20, color));
|
||||
getButton(2).setTextColor(tintData.getGeneralTint());
|
||||
y+=22;
|
||||
addLabel(new GuiNpcLabel(3,"tint.alpha", guiLeft + 5, guiTop + y + 5));
|
||||
addTextField(new GuiNpcTextField(3,this, fontRendererObj, guiLeft + 122, guiTop + y, 60, 20, tintData.getGeneralAlpha() + ""));
|
||||
y += 22;
|
||||
addLabel(new GuiNpcLabel(3, "tint.alpha", guiLeft + 5, guiTop + y + 5));
|
||||
addTextField(new GuiNpcTextField(3, this, fontRendererObj, guiLeft + 122, guiTop + y, 60, 20, tintData.getGeneralAlpha() + ""));
|
||||
getTextField(3).integersOnly = true;
|
||||
getTextField(3).setMinMaxDefault(1, 100, 40);
|
||||
y+=22;
|
||||
y += 22;
|
||||
}
|
||||
addLabel(new GuiNpcLabel(4, "tint.enablehurt", guiLeft + 5, guiTop + y + 5));
|
||||
addButton(new GuiNpcButtonYesNo(4, guiLeft + 122, guiTop + y, 56, 20, tintData.isHurtTintEnabled()));
|
||||
y+=22;
|
||||
y += 22;
|
||||
if (tintData.isHurtTintEnabled()) {
|
||||
String color2 = Integer.toHexString(tintData.getHurtTint());
|
||||
while (color2.length() < 6) color2 = 0 + color2;
|
||||
@@ -96,7 +96,7 @@ public class SubGuiNpcTint extends SubGuiInterface implements ISubGuiListener, I
|
||||
|
||||
@Override
|
||||
public void unFocused(GuiNpcTextField textfield) {
|
||||
if(textfield.id==3){
|
||||
if (textfield.id == 3) {
|
||||
tintData.setGeneralAlpha(textfield.getInteger());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@ package noppes.npcs.client.gui;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.magic.MagicGetAllPacket;
|
||||
import kamkeel.npcs.network.packets.request.playerdata.PlayerDataGetInfoPacket;
|
||||
import kamkeel.npcs.network.packets.request.playerdata.PlayerDataDeleteInfoPacket;
|
||||
import kamkeel.npcs.network.packets.request.playerdata.PlayerDataGetInfoPacket;
|
||||
import kamkeel.npcs.network.packets.request.playerdata.PlayerDataSaveInfoPacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -212,7 +212,7 @@ public class SubGuiPlayerData extends SubGuiInterface implements IPlayerDataInfo
|
||||
}
|
||||
break;
|
||||
}
|
||||
if(currentTab != 15)
|
||||
if (currentTab != 15)
|
||||
addButton(new GuiNpcButton(30, guiLeft + xSize - 60, guiTop + 10 - 7, 50, 20, "gui.remove"));
|
||||
}
|
||||
|
||||
@@ -459,7 +459,7 @@ public class SubGuiPlayerData extends SubGuiInterface implements IPlayerDataInfo
|
||||
|
||||
addTextField(splitField);
|
||||
addTextField(damageField);
|
||||
if(magicSelectedScroll.hasSelected()){
|
||||
if (magicSelectedScroll.hasSelected()) {
|
||||
String sel = magicSelectedScroll.getSelected();
|
||||
int id = availableMagicElements.get(sel);
|
||||
if (magicData.hasMagic(id)) {
|
||||
@@ -997,7 +997,7 @@ public class SubGuiPlayerData extends SubGuiInterface implements IPlayerDataInfo
|
||||
super.actionPerformed(button);
|
||||
}
|
||||
|
||||
private void saveMagicCompound(){
|
||||
private void saveMagicCompound() {
|
||||
NBTTagCompound magicCompound = new NBTTagCompound();
|
||||
magicData.writeToNBT(magicCompound);
|
||||
PacketClient.sendClient(new PlayerDataSaveInfoPacket(playerName, EnumPlayerData.Magic, magicCompound));
|
||||
@@ -1121,7 +1121,8 @@ public class SubGuiPlayerData extends SubGuiInterface implements IPlayerDataInfo
|
||||
}
|
||||
|
||||
@Override
|
||||
public void customScrollDoubleClicked(String selection, GuiCustomScroll scroll) {}
|
||||
public void customScrollDoubleClicked(String selection, GuiCustomScroll scroll) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unFocused(GuiNpcTextField textField) {
|
||||
@@ -1133,12 +1134,14 @@ public class SubGuiPlayerData extends SubGuiInterface implements IPlayerDataInfo
|
||||
try {
|
||||
float split = Float.parseFloat(textField.getText());
|
||||
magicData.getMagic(id).split = split;
|
||||
} catch(NumberFormatException e) { }
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
} else if (textField.id == 74) {
|
||||
try {
|
||||
float dmg = Float.parseFloat(textField.getText());
|
||||
magicData.getMagic(id).damage = dmg;
|
||||
} catch(NumberFormatException e) { }
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
saveMagicCompound();
|
||||
@@ -1154,7 +1157,7 @@ public class SubGuiPlayerData extends SubGuiInterface implements IPlayerDataInfo
|
||||
selected.add(name);
|
||||
}
|
||||
}
|
||||
if(magicSelectedScroll != null)
|
||||
if (magicSelectedScroll != null)
|
||||
magicSelectedScroll.setList(selected);
|
||||
}
|
||||
|
||||
@@ -1170,5 +1173,6 @@ public class SubGuiPlayerData extends SubGuiInterface implements IPlayerDataInfo
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(String selected) {}
|
||||
public void setSelected(String selected) {
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import noppes.npcs.controllers.data.SpawnData;
|
||||
public class SubGuiSpawningOptions extends SubGuiInterface implements ITextfieldListener {
|
||||
private SpawnData data;
|
||||
|
||||
public SubGuiSpawningOptions(SpawnData data){
|
||||
public SubGuiSpawningOptions(SpawnData data) {
|
||||
this.data = data;
|
||||
setBackground("menubg.png");
|
||||
xSize = 216;
|
||||
|
||||
@@ -14,27 +14,27 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
public class GuiNPCAdvancedLinkedNpc extends GuiNPCInterface2 implements IScrollData, ICustomScrollListener{
|
||||
private GuiCustomScroll scroll;
|
||||
private List<String> data = new ArrayList<String>();
|
||||
public class GuiNPCAdvancedLinkedNpc extends GuiNPCInterface2 implements IScrollData, ICustomScrollListener {
|
||||
private GuiCustomScroll scroll;
|
||||
private List<String> data = new ArrayList<String>();
|
||||
|
||||
public static GuiScreen Instance;
|
||||
public static GuiScreen Instance;
|
||||
|
||||
public GuiNPCAdvancedLinkedNpc(EntityNPCInterface npc){
|
||||
super(npc);
|
||||
Instance = this;
|
||||
public GuiNPCAdvancedLinkedNpc(EntityNPCInterface npc) {
|
||||
super(npc);
|
||||
Instance = this;
|
||||
LinkedGetAllPacket.GetNPCs();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui(){
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
this.addButton(new GuiNpcButton(1,guiLeft + 358, guiTop + 38, 58, 20, "gui.clear"));
|
||||
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);
|
||||
if (scroll == null) {
|
||||
scroll = new GuiCustomScroll(this, 0);
|
||||
scroll.setSize(143, 208);
|
||||
}
|
||||
scroll.guiLeft = guiLeft + 137;
|
||||
scroll.guiTop = guiTop + 4;
|
||||
@@ -44,33 +44,33 @@ public class GuiNPCAdvancedLinkedNpc extends GuiNPCInterface2 implements IScroll
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buttonEvent(GuiButton button){
|
||||
if(button.id == 1){
|
||||
public void buttonEvent(GuiButton button) {
|
||||
if (button.id == 1) {
|
||||
PacketClient.sendClient(new LinkedSetPacket(""));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(Vector<String> list, HashMap<String, Integer> data, EnumScrollData type) {
|
||||
this.data = new ArrayList<String>(list);
|
||||
initGui();
|
||||
}
|
||||
@Override
|
||||
public void setData(Vector<String> list, HashMap<String, Integer> data, EnumScrollData type) {
|
||||
this.data = new ArrayList<String>(list);
|
||||
initGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(String selected) {
|
||||
scroll.setSelected(selected);
|
||||
}
|
||||
@Override
|
||||
public void setSelected(String selected) {
|
||||
scroll.setSelected(selected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
@Override
|
||||
public void save() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void customScrollClicked(int i, int j, int k,
|
||||
GuiCustomScroll guiCustomScroll) {
|
||||
@Override
|
||||
public void customScrollClicked(int i, int j, int k,
|
||||
GuiCustomScroll guiCustomScroll) {
|
||||
PacketClient.sendClient(new LinkedSetPacket(guiCustomScroll.getSelected()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,71 +15,73 @@ import noppes.npcs.entity.EntityNPCInterface;
|
||||
import java.util.HashMap;
|
||||
|
||||
|
||||
public class GuiNPCDialogNpcOptions extends GuiNPCInterface2 implements GuiSelectionListener, IGuiData{
|
||||
private GuiScreen parent;
|
||||
private HashMap<Integer, DialogOption> data = new HashMap<Integer,DialogOption>();
|
||||
public class GuiNPCDialogNpcOptions extends GuiNPCInterface2 implements GuiSelectionListener, IGuiData {
|
||||
private GuiScreen parent;
|
||||
private HashMap<Integer, DialogOption> data = new HashMap<Integer, DialogOption>();
|
||||
|
||||
public GuiNPCDialogNpcOptions(EntityNPCInterface npc, GuiScreen parent) {
|
||||
super(npc);
|
||||
this.parent = parent;
|
||||
this.drawDefaultBackground = true;
|
||||
public GuiNPCDialogNpcOptions(EntityNPCInterface npc, GuiScreen parent) {
|
||||
super(npc);
|
||||
this.parent = parent;
|
||||
this.drawDefaultBackground = true;
|
||||
PacketClient.sendClient(new DialogNpcGetPacket());
|
||||
}
|
||||
}
|
||||
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
for (int i = 0; i < 12; i++) {
|
||||
int offset = i >=6 ?200:0;
|
||||
this.addButton(new GuiNpcButton(i + 20, guiLeft + 20 + offset, guiTop + 13 + i % 6 * 22, 20, 20, "X"));
|
||||
this.addLabel(new GuiNpcLabel(i, "" + i, guiLeft + 6 + offset, guiTop + 18 + i % 6 * 22));
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
for (int i = 0; i < 12; i++) {
|
||||
int offset = i >= 6 ? 200 : 0;
|
||||
this.addButton(new GuiNpcButton(i + 20, guiLeft + 20 + offset, guiTop + 13 + i % 6 * 22, 20, 20, "X"));
|
||||
this.addLabel(new GuiNpcLabel(i, "" + i, guiLeft + 6 + offset, guiTop + 18 + i % 6 * 22));
|
||||
|
||||
String title = "dialog.selectoption";
|
||||
if(data.containsKey(i))
|
||||
title = data.get(i).title;
|
||||
this.addButton(new GuiNpcButton(i, guiLeft + 44 + offset, guiTop + 13 + i % 6 * 22, 140, 20, title));
|
||||
String title = "dialog.selectoption";
|
||||
if (data.containsKey(i))
|
||||
title = data.get(i).title;
|
||||
this.addButton(new GuiNpcButton(i, guiLeft + 44 + offset, guiTop + 13 + i % 6 * 22, 140, 20, title));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void drawScreen(int i, int j, float f) {
|
||||
super.drawScreen(i, j, f);
|
||||
}
|
||||
private int selectedSlot;
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
int id = guibutton.id;
|
||||
if (id >= 0 && id < 20) {
|
||||
selectedSlot = id;
|
||||
int dialogID = -1;
|
||||
if(data.containsKey(id))
|
||||
dialogID = data.get(id).dialogId;
|
||||
public void drawScreen(int i, int j, float f) {
|
||||
super.drawScreen(i, j, f);
|
||||
}
|
||||
|
||||
private int selectedSlot;
|
||||
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
int id = guibutton.id;
|
||||
if (id >= 0 && id < 20) {
|
||||
selectedSlot = id;
|
||||
int dialogID = -1;
|
||||
if (data.containsKey(id))
|
||||
dialogID = data.get(id).dialogId;
|
||||
setSubGui(new GuiDialogSelection(dialogID));
|
||||
}
|
||||
if (id >= 20 && id < 40) {
|
||||
int slot = id - 20;
|
||||
data.remove(slot);
|
||||
}
|
||||
if (id >= 20 && id < 40) {
|
||||
int slot = id - 20;
|
||||
data.remove(slot);
|
||||
PacketClient.sendClient(new DialogNpcRemovePacket(slot));
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
|
||||
public void save() {
|
||||
return;
|
||||
}
|
||||
public void save() {
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selected(int id, String name) {
|
||||
@Override
|
||||
public void selected(int id, String name) {
|
||||
PacketClient.sendClient(new DialogNpcSetPacket(selectedSlot, id));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
int pos = compound.getInteger("Position");
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
int pos = compound.getInteger("Position");
|
||||
|
||||
DialogOption dialog = new DialogOption();
|
||||
dialog.readNBT(compound);
|
||||
DialogOption dialog = new DialogOption();
|
||||
dialog.readNBT(compound);
|
||||
|
||||
data.put(pos, dialog);
|
||||
initGui();
|
||||
}
|
||||
data.put(pos, dialog);
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
@@ -14,33 +14,30 @@ import noppes.npcs.entity.EntityNPCInterface;
|
||||
import java.util.HashMap;
|
||||
import java.util.Vector;
|
||||
|
||||
public class GuiNPCFactionSetup extends GuiNPCInterface2 implements IScrollData,ICustomScrollListener
|
||||
{
|
||||
private GuiCustomScroll scrollFactions;
|
||||
private HashMap<String,Integer> data = new HashMap<String,Integer>();
|
||||
public class GuiNPCFactionSetup extends GuiNPCInterface2 implements IScrollData, ICustomScrollListener {
|
||||
private GuiCustomScroll scrollFactions;
|
||||
private HashMap<String, Integer> data = new HashMap<String, Integer>();
|
||||
|
||||
public GuiNPCFactionSetup(EntityNPCInterface npc)
|
||||
{
|
||||
super(npc);
|
||||
public GuiNPCFactionSetup(EntityNPCInterface npc) {
|
||||
super(npc);
|
||||
PacketClient.sendClient(new FactionsGetPacket());
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
{
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
this.addLabel(new GuiNpcLabel(0, "faction.attackHostile", guiLeft + 4, guiTop + 25));
|
||||
this.addButton(new GuiNpcButton(0, guiLeft + 144, guiTop + 20,40,20, new String[]{"gui.no","gui.yes"}, npc.advanced.attackOtherFactions?1:0));
|
||||
this.addButton(new GuiNpcButton(0, guiLeft + 144, guiTop + 20, 40, 20, new String[]{"gui.no", "gui.yes"}, npc.advanced.attackOtherFactions ? 1 : 0));
|
||||
|
||||
this.addLabel(new GuiNpcLabel(1, "faction.defend", guiLeft + 4, guiTop + 47));
|
||||
this.addButton(new GuiNpcButton(1, guiLeft + 144, guiTop + 42,40,20, new String[]{"gui.no","gui.yes"}, npc.advanced.defendFaction?1:0));
|
||||
this.addButton(new GuiNpcButton(1, guiLeft + 144, guiTop + 42, 40, 20, new String[]{"gui.no", "gui.yes"}, npc.advanced.defendFaction ? 1 : 0));
|
||||
|
||||
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);
|
||||
if (scrollFactions == null) {
|
||||
scrollFactions = new GuiCustomScroll(this, 0, 0);
|
||||
scrollFactions.setSize(180, 200);
|
||||
}
|
||||
scrollFactions.guiLeft = guiLeft + 200;
|
||||
scrollFactions.guiTop = guiTop + 4;
|
||||
@@ -49,54 +46,49 @@ public class GuiNPCFactionSetup extends GuiNPCInterface2 implements IScrollData,
|
||||
|
||||
@Override
|
||||
public void buttonEvent(GuiButton guibutton) {
|
||||
{
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
if(button.id == 0)
|
||||
{
|
||||
npc.advanced.attackOtherFactions = button.getValue() == 1;
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
if (button.id == 0) {
|
||||
npc.advanced.attackOtherFactions = button.getValue() == 1;
|
||||
}
|
||||
if (button.id == 1) {
|
||||
npc.advanced.defendFaction = button.getValue() == 1;
|
||||
}
|
||||
if (button.id == 12)
|
||||
setSubGui(new SubGuiNpcFactionOptions(npc.advanced.factions));
|
||||
}
|
||||
if(button.id == 1)
|
||||
{
|
||||
npc.advanced.defendFaction = button.getValue() == 1;
|
||||
}
|
||||
if(button.id == 12)
|
||||
setSubGui(new SubGuiNpcFactionOptions(npc.advanced.factions));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(Vector<String> list, HashMap<String, Integer> data, EnumScrollData type)
|
||||
{
|
||||
String name = npc.getFaction().name;
|
||||
this.data = data;
|
||||
scrollFactions.setList(list);
|
||||
@Override
|
||||
public void setData(Vector<String> list, HashMap<String, Integer> data, EnumScrollData type) {
|
||||
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);
|
||||
if (name != null)
|
||||
setSelected(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(String selected) {
|
||||
scrollFactions.setSelected(selected);
|
||||
}
|
||||
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 customScrollClicked(int i, int j, int k, GuiCustomScroll guiCustomScroll) {
|
||||
if(guiCustomScroll.id == 0)
|
||||
{
|
||||
@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) {
|
||||
PacketClient.sendClient(new FactionSetPacket(data.get(scrollFactions.getSelected())));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void save() {
|
||||
public void save() {
|
||||
PacketClient.sendClient(new MainmenuAdvancedSavePacket(npc.advanced.writeToNBT(new NBTTagCompound())));
|
||||
}
|
||||
}
|
||||
@@ -15,50 +15,50 @@ import noppes.npcs.entity.EntityNPCInterface;
|
||||
public class GuiNPCLinesMenu extends GuiNPCInterface2 {
|
||||
|
||||
public GuiNPCLinesMenu(EntityNPCInterface npc) {
|
||||
super(npc);
|
||||
super(npc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui(){
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
this.addButton(new GuiNpcButton(0, guiLeft + 85, guiTop + 20, "World Lines"));
|
||||
this.addButton(new GuiNpcButton(1, guiLeft + 85, guiTop + 43, "Attack Lines"));
|
||||
this.addButton(new GuiNpcButton(2, guiLeft + 85, guiTop + 66, "Interact Lines"));
|
||||
this.addButton(new GuiNpcButton(5, guiLeft + 85, guiTop + 89, "Killed Lines"));
|
||||
this.addButton(new GuiNpcButton(6, guiLeft + 85, guiTop + 112, "Kill Lines"));
|
||||
this.addButton(new GuiNpcButton(0, guiLeft + 85, guiTop + 20, "World Lines"));
|
||||
this.addButton(new GuiNpcButton(1, guiLeft + 85, guiTop + 43, "Attack Lines"));
|
||||
this.addButton(new GuiNpcButton(2, guiLeft + 85, guiTop + 66, "Interact Lines"));
|
||||
this.addButton(new GuiNpcButton(5, guiLeft + 85, guiTop + 89, "Killed Lines"));
|
||||
this.addButton(new GuiNpcButton(6, guiLeft + 85, guiTop + 112, "Kill Lines"));
|
||||
|
||||
|
||||
this.addLabel(new GuiNpcLabel(16, "Random Lines", guiLeft + 85, guiTop + 157));
|
||||
this.addButton(new GuiNpcButtonYesNo(16, guiLeft + 175, guiTop + 152, !npc.advanced.orderedLines));
|
||||
this.addLabel(new GuiNpcLabel(16, "Random Lines", guiLeft + 85, guiTop + 157));
|
||||
this.addButton(new GuiNpcButtonYesNo(16, guiLeft + 175, guiTop + 152, !npc.advanced.orderedLines));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton){
|
||||
int id = guibutton.id;
|
||||
if(id == 0){
|
||||
NoppesUtil.openGUI(player, new GuiNPCLinesEdit(npc, npc.advanced.worldLines));
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
int id = guibutton.id;
|
||||
if (id == 0) {
|
||||
NoppesUtil.openGUI(player, new GuiNPCLinesEdit(npc, npc.advanced.worldLines));
|
||||
}
|
||||
if(id == 1){
|
||||
NoppesUtil.openGUI(player, new GuiNPCLinesEdit(npc, npc.advanced.attackLines));
|
||||
if (id == 1) {
|
||||
NoppesUtil.openGUI(player, new GuiNPCLinesEdit(npc, npc.advanced.attackLines));
|
||||
}
|
||||
if(id == 2){
|
||||
NoppesUtil.openGUI(player, new GuiNPCLinesEdit(npc, npc.advanced.interactLines));
|
||||
if (id == 2) {
|
||||
NoppesUtil.openGUI(player, new GuiNPCLinesEdit(npc, npc.advanced.interactLines));
|
||||
}
|
||||
if(id == 5){
|
||||
NoppesUtil.openGUI(player, new GuiNPCLinesEdit(npc, npc.advanced.killedLines));
|
||||
if (id == 5) {
|
||||
NoppesUtil.openGUI(player, new GuiNPCLinesEdit(npc, npc.advanced.killedLines));
|
||||
}
|
||||
if(id == 6){
|
||||
NoppesUtil.openGUI(player, new GuiNPCLinesEdit(npc, npc.advanced.killLines));
|
||||
if (id == 6) {
|
||||
NoppesUtil.openGUI(player, new GuiNPCLinesEdit(npc, npc.advanced.killLines));
|
||||
}
|
||||
if(id == 16){
|
||||
npc.advanced.orderedLines = !((GuiNpcButtonYesNo)guibutton).getBoolean();
|
||||
if (id == 16) {
|
||||
npc.advanced.orderedLines = !((GuiNpcButtonYesNo) guibutton).getBoolean();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
@Override
|
||||
public void save() {
|
||||
PacketClient.sendClient(new MainmenuAdvancedSavePacket(npc.advanced.writeToNBT(new NBTTagCompound())));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -261,12 +261,14 @@ public class GuiNPCMagic extends GuiNPCInterface2 implements IScrollData, ICusto
|
||||
try {
|
||||
float split = Float.parseFloat(textField.getText());
|
||||
npcMagicData.getMagic(id).split = split;
|
||||
} catch (NumberFormatException e) { }
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
} else if (textField.id == 74) {
|
||||
try {
|
||||
float bonus = Float.parseFloat(textField.getText());
|
||||
npcMagicData.getMagic(id).damage = bonus;
|
||||
} catch (NumberFormatException e) { }
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
}
|
||||
save();
|
||||
}
|
||||
|
||||
@@ -11,74 +11,74 @@ import noppes.npcs.controllers.data.MarkData;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
public class GuiNPCMarks extends GuiNPCInterface2 implements ISubGuiListener {
|
||||
private final String[] marks = new String[]{"gui.none", "mark.question", "mark.exclamation", "mark.pointer", "mark.skull", "mark.cross", "mark.star"};
|
||||
private MarkData data;
|
||||
private MarkData.Mark selectedMark;
|
||||
private final String[] marks = new String[]{"gui.none", "mark.question", "mark.exclamation", "mark.pointer", "mark.skull", "mark.cross", "mark.star"};
|
||||
private MarkData data;
|
||||
private MarkData.Mark selectedMark;
|
||||
|
||||
public GuiNPCMarks(EntityNPCInterface npc){
|
||||
super(npc);
|
||||
this.data = MarkData.get(npc);
|
||||
public GuiNPCMarks(EntityNPCInterface npc) {
|
||||
super(npc);
|
||||
this.data = MarkData.get(npc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui(){
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
int y = guiTop + 14;
|
||||
for(int i = 0; i < data.marks.size(); i++){
|
||||
MarkData.Mark mark = data.marks.get(i);
|
||||
this.addButton(new GuiButtonBiDirectional(1 + i * 10, guiLeft + 6, y, 120, 20, marks, mark.type));
|
||||
for (int i = 0; i < data.marks.size(); i++) {
|
||||
MarkData.Mark mark = data.marks.get(i);
|
||||
this.addButton(new GuiButtonBiDirectional(1 + i * 10, guiLeft + 6, y, 120, 20, marks, mark.type));
|
||||
|
||||
String color = Integer.toHexString(mark.color);
|
||||
while(color.length() < 6)
|
||||
color = "0" + color;
|
||||
addButton(new GuiNpcButton(2 + i * 10, guiLeft + 128, y, 60, 20, color));
|
||||
getButton(2 + i * 10).setTextColor(mark.color);
|
||||
String color = Integer.toHexString(mark.color);
|
||||
while (color.length() < 6)
|
||||
color = "0" + color;
|
||||
addButton(new GuiNpcButton(2 + i * 10, guiLeft + 128, y, 60, 20, color));
|
||||
getButton(2 + i * 10).setTextColor(mark.color);
|
||||
|
||||
this.addButton(new GuiNpcButton(3 + i * 10, guiLeft + 190, y, 120, 20, "availability.options"));
|
||||
this.addButton(new GuiNpcButton(4 + i * 10, guiLeft + 312, y, 40, 20, "X"));
|
||||
y += 22;
|
||||
this.addButton(new GuiNpcButton(3 + i * 10, guiLeft + 190, y, 120, 20, "availability.options"));
|
||||
this.addButton(new GuiNpcButton(4 + i * 10, guiLeft + 312, y, 40, 20, "X"));
|
||||
y += 22;
|
||||
}
|
||||
|
||||
if(data.marks.size() < 9){
|
||||
this.addButton(new GuiNpcButton(101 , guiLeft + 6, y + 2, 60, 20, "gui.add"));
|
||||
if (data.marks.size() < 9) {
|
||||
this.addButton(new GuiNpcButton(101, guiLeft + 6, y + 2, 60, 20, "gui.add"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buttonEvent(GuiButton button){
|
||||
if(button.id < 90){
|
||||
selectedMark = data.marks.get(button.id / 10);
|
||||
if(button.id % 10 == 1){
|
||||
selectedMark.type = ((GuiNpcButton)button).getValue();
|
||||
}
|
||||
if(button.id % 10 == 2){
|
||||
this.setSubGui(new SubGuiColorSelector(selectedMark.color));
|
||||
}
|
||||
if(button.id % 10 == 3){
|
||||
setSubGui(new SubGuiNpcAvailability(selectedMark.availability));
|
||||
}
|
||||
if(button.id % 10 == 4){
|
||||
data.marks.remove(selectedMark);
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
if(button.id == 101){
|
||||
data.addMark(MarkType.NONE);
|
||||
initGui();
|
||||
public void buttonEvent(GuiButton button) {
|
||||
if (button.id < 90) {
|
||||
selectedMark = data.marks.get(button.id / 10);
|
||||
if (button.id % 10 == 1) {
|
||||
selectedMark.type = ((GuiNpcButton) button).getValue();
|
||||
}
|
||||
if (button.id % 10 == 2) {
|
||||
this.setSubGui(new SubGuiColorSelector(selectedMark.color));
|
||||
}
|
||||
if (button.id % 10 == 3) {
|
||||
setSubGui(new SubGuiNpcAvailability(selectedMark.availability));
|
||||
}
|
||||
if (button.id % 10 == 4) {
|
||||
data.marks.remove(selectedMark);
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
if (button.id == 101) {
|
||||
data.addMark(MarkType.NONE);
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void subGuiClosed(SubGuiInterface subgui) {
|
||||
if(subgui instanceof SubGuiColorSelector){
|
||||
selectedMark.color = ((SubGuiColorSelector)subgui).color;
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void subGuiClosed(SubGuiInterface subgui) {
|
||||
if (subgui instanceof SubGuiColorSelector) {
|
||||
selectedMark.color = ((SubGuiColorSelector) subgui).color;
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
@Override
|
||||
public void save() {
|
||||
PacketClient.sendClient(new MainmenuAdvancedMarkDataPacket(data.getNBT()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,90 +13,87 @@ import noppes.npcs.client.gui.util.IGuiData;
|
||||
import noppes.npcs.controllers.data.DataTransform;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
public class GuiNPCNightSetup extends GuiNPCInterface2 implements IGuiData
|
||||
{
|
||||
private DataTransform data;
|
||||
public class GuiNPCNightSetup extends GuiNPCInterface2 implements IGuiData {
|
||||
private DataTransform data;
|
||||
|
||||
public GuiNPCNightSetup(EntityNPCInterface npc)
|
||||
{
|
||||
super(npc);
|
||||
data = npc.transform;
|
||||
public GuiNPCNightSetup(EntityNPCInterface npc) {
|
||||
super(npc);
|
||||
data = npc.transform;
|
||||
PacketClient.sendClient(new TransformGetPacket());
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
{
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
this.addLabel(new GuiNpcLabel(0, "menu.display", guiLeft + 4, guiTop + 25));
|
||||
this.addButton(new GuiNpcButton(0, guiLeft + 104, guiTop + 20, 50, 20, new String[]{"gui.no","gui.yes"}, data.hasDisplay?1:0));
|
||||
this.addButton(new GuiNpcButton(0, guiLeft + 104, guiTop + 20, 50, 20, new String[]{"gui.no", "gui.yes"}, data.hasDisplay ? 1 : 0));
|
||||
|
||||
this.addLabel(new GuiNpcLabel(1, "menu.stats", guiLeft + 4, guiTop + 47));
|
||||
this.addButton(new GuiNpcButton(1, guiLeft + 104, guiTop + 42, 50, 20, new String[]{"gui.no","gui.yes"}, data.hasStats?1:0));
|
||||
this.addButton(new GuiNpcButton(1, guiLeft + 104, guiTop + 42, 50, 20, new String[]{"gui.no", "gui.yes"}, data.hasStats ? 1 : 0));
|
||||
|
||||
this.addLabel(new GuiNpcLabel(2, "menu.ai", guiLeft + 4, guiTop + 69));
|
||||
this.addButton(new GuiNpcButton(2, guiLeft + 104, guiTop + 64, 50, 20, new String[]{"gui.no","gui.yes"}, data.hasAi?1:0));
|
||||
this.addButton(new GuiNpcButton(2, guiLeft + 104, guiTop + 64, 50, 20, new String[]{"gui.no", "gui.yes"}, data.hasAi ? 1 : 0));
|
||||
|
||||
this.addLabel(new GuiNpcLabel(3, "menu.inventory", guiLeft + 4, guiTop + 91));
|
||||
this.addButton(new GuiNpcButton(3, guiLeft + 104, guiTop + 86, 50, 20, new String[]{"gui.no","gui.yes"}, data.hasInv?1:0));
|
||||
this.addButton(new GuiNpcButton(3, guiLeft + 104, guiTop + 86, 50, 20, new String[]{"gui.no", "gui.yes"}, data.hasInv ? 1 : 0));
|
||||
|
||||
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.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.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.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));
|
||||
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"));
|
||||
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"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buttonEvent(GuiButton guibutton) {
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
if(button.id == 0)
|
||||
data.hasDisplay = button.getValue() == 1;
|
||||
if(button.id == 1)
|
||||
data.hasStats = button.getValue() == 1;
|
||||
if(button.id == 2)
|
||||
data.hasAi = button.getValue() == 1;
|
||||
if(button.id == 3)
|
||||
data.hasInv = button.getValue() == 1;
|
||||
if(button.id == 4)
|
||||
data.hasAdvanced = button.getValue() == 1;
|
||||
if(button.id == 5)
|
||||
data.hasRole = button.getValue() == 1;
|
||||
if(button.id == 6)
|
||||
data.hasJob = button.getValue() == 1;
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
if (button.id == 0)
|
||||
data.hasDisplay = button.getValue() == 1;
|
||||
if (button.id == 1)
|
||||
data.hasStats = button.getValue() == 1;
|
||||
if (button.id == 2)
|
||||
data.hasAi = button.getValue() == 1;
|
||||
if (button.id == 3)
|
||||
data.hasInv = button.getValue() == 1;
|
||||
if (button.id == 4)
|
||||
data.hasAdvanced = button.getValue() == 1;
|
||||
if (button.id == 5)
|
||||
data.hasRole = button.getValue() == 1;
|
||||
if (button.id == 6)
|
||||
data.hasJob = button.getValue() == 1;
|
||||
|
||||
if(button.id == 10){
|
||||
data.editingModus = button.getValue() == 1;
|
||||
save();
|
||||
initGui();
|
||||
if (button.id == 10) {
|
||||
data.editingModus = button.getValue() == 1;
|
||||
save();
|
||||
initGui();
|
||||
}
|
||||
if(button.id == 11){
|
||||
if (button.id == 11) {
|
||||
PacketClient.sendClient(new TransformLoadPacket(false));
|
||||
}
|
||||
if(button.id == 12){
|
||||
if (button.id == 12) {
|
||||
PacketClient.sendClient(new TransformLoadPacket(true));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void save() {
|
||||
public void save() {
|
||||
PacketClient.sendClient(new TransformSavePacket(data.writeOptions(new NBTTagCompound())));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
data.readOptions(compound);
|
||||
initGui();
|
||||
}
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
data.readOptions(compound);
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
@@ -8,76 +8,76 @@ import noppes.npcs.client.gui.select.GuiSoundSelection;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
public class GuiNPCSoundsMenu extends GuiNPCInterface2 implements ITextfieldListener, ISubGuiListener
|
||||
{
|
||||
private GuiNpcTextField selectedField;
|
||||
public GuiNPCSoundsMenu(EntityNPCInterface npc){
|
||||
super(npc);
|
||||
public class GuiNPCSoundsMenu extends GuiNPCInterface2 implements ITextfieldListener, ISubGuiListener {
|
||||
private GuiNpcTextField selectedField;
|
||||
|
||||
public GuiNPCSoundsMenu(EntityNPCInterface npc) {
|
||||
super(npc);
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
{
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
addLabel(new GuiNpcLabel(0,"advanced.idlesound", guiLeft + 5, guiTop + 20));
|
||||
addTextField(new GuiNpcTextField(0,this, fontRendererObj, guiLeft + 80, guiTop + 15, 200, 20, npc.advanced.idleSound));
|
||||
addLabel(new GuiNpcLabel(0, "advanced.idlesound", guiLeft + 5, guiTop + 20));
|
||||
addTextField(new GuiNpcTextField(0, this, fontRendererObj, guiLeft + 80, guiTop + 15, 200, 20, npc.advanced.idleSound));
|
||||
addButton(new GuiNpcButton(0, guiLeft + 290, guiTop + 15, 80, 20, "gui.selectSound"));
|
||||
|
||||
addLabel(new GuiNpcLabel(2,"advanced.angersound", guiLeft + 5, guiTop + 45));
|
||||
addTextField(new GuiNpcTextField(2,this, fontRendererObj, guiLeft + 80, guiTop + 40, 200, 20, npc.advanced.angrySound));
|
||||
addLabel(new GuiNpcLabel(2, "advanced.angersound", guiLeft + 5, guiTop + 45));
|
||||
addTextField(new GuiNpcTextField(2, this, fontRendererObj, guiLeft + 80, guiTop + 40, 200, 20, npc.advanced.angrySound));
|
||||
addButton(new GuiNpcButton(2, guiLeft + 290, guiTop + 40, 80, 20, "gui.selectSound"));
|
||||
|
||||
addLabel(new GuiNpcLabel(3,"advanced.hurtsound", guiLeft + 5, guiTop + 70));
|
||||
addTextField(new GuiNpcTextField(3,this, fontRendererObj, guiLeft + 80, guiTop + 65, 200, 20, npc.advanced.hurtSound));
|
||||
addLabel(new GuiNpcLabel(3, "advanced.hurtsound", guiLeft + 5, guiTop + 70));
|
||||
addTextField(new GuiNpcTextField(3, this, fontRendererObj, guiLeft + 80, guiTop + 65, 200, 20, npc.advanced.hurtSound));
|
||||
addButton(new GuiNpcButton(3, guiLeft + 290, guiTop + 65, 80, 20, "gui.selectSound"));
|
||||
|
||||
addLabel(new GuiNpcLabel(4,"advanced.deathsound", guiLeft + 5, guiTop + 95));
|
||||
addTextField(new GuiNpcTextField(4,this, fontRendererObj, guiLeft + 80, guiTop + 90, 200, 20, npc.advanced.deathSound));
|
||||
addLabel(new GuiNpcLabel(4, "advanced.deathsound", guiLeft + 5, guiTop + 95));
|
||||
addTextField(new GuiNpcTextField(4, this, fontRendererObj, guiLeft + 80, guiTop + 90, 200, 20, npc.advanced.deathSound));
|
||||
addButton(new GuiNpcButton(4, guiLeft + 290, guiTop + 90, 80, 20, "gui.selectSound"));
|
||||
|
||||
addLabel(new GuiNpcLabel(5,"advanced.stepsound", guiLeft + 5, guiTop + 120));
|
||||
addTextField(new GuiNpcTextField(5,this, fontRendererObj, guiLeft + 80, guiTop + 115, 200, 20, npc.advanced.stepSound));
|
||||
addLabel(new GuiNpcLabel(5, "advanced.stepsound", guiLeft + 5, guiTop + 120));
|
||||
addTextField(new GuiNpcTextField(5, this, fontRendererObj, guiLeft + 80, guiTop + 115, 200, 20, npc.advanced.stepSound));
|
||||
addButton(new GuiNpcButton(5, guiLeft + 290, guiTop + 115, 80, 20, "gui.selectSound"));
|
||||
|
||||
addLabel(new GuiNpcLabel(6,"advanced.haspitch", guiLeft + 5, guiTop + 150));
|
||||
addButton(new GuiNpcButton(6, guiLeft + 120, guiTop + 145, 80, 20, new String[]{"gui.no","gui.yes"}, npc.advanced.disablePitch?0:1));
|
||||
addLabel(new GuiNpcLabel(6, "advanced.haspitch", guiLeft + 5, guiTop + 150));
|
||||
addButton(new GuiNpcButton(6, guiLeft + 120, guiTop + 145, 80, 20, new String[]{"gui.no", "gui.yes"}, npc.advanced.disablePitch ? 0 : 1));
|
||||
|
||||
}
|
||||
public void buttonEvent(GuiButton button){
|
||||
if(button.id == 6)
|
||||
npc.advanced.disablePitch =((GuiNpcButton)button).getValue() == 0;
|
||||
else{
|
||||
|
||||
public void buttonEvent(GuiButton button) {
|
||||
if (button.id == 6)
|
||||
npc.advanced.disablePitch = ((GuiNpcButton) button).getValue() == 0;
|
||||
else {
|
||||
selectedField = getTextField(button.id);
|
||||
setSubGui(new GuiSoundSelection(selectedField.getText()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unFocused(GuiNpcTextField textfield) {
|
||||
if(textfield.id == 0)
|
||||
npc.advanced.idleSound = textfield.getText();
|
||||
if(textfield.id == 2)
|
||||
npc.advanced.angrySound = textfield.getText();
|
||||
if(textfield.id == 3)
|
||||
npc.advanced.hurtSound = textfield.getText();
|
||||
if(textfield.id == 4)
|
||||
npc.advanced.deathSound = textfield.getText();
|
||||
if(textfield.id == 5)
|
||||
npc.advanced.stepSound = textfield.getText();
|
||||
}
|
||||
@Override
|
||||
public void unFocused(GuiNpcTextField textfield) {
|
||||
if (textfield.id == 0)
|
||||
npc.advanced.idleSound = textfield.getText();
|
||||
if (textfield.id == 2)
|
||||
npc.advanced.angrySound = textfield.getText();
|
||||
if (textfield.id == 3)
|
||||
npc.advanced.hurtSound = textfield.getText();
|
||||
if (textfield.id == 4)
|
||||
npc.advanced.deathSound = textfield.getText();
|
||||
if (textfield.id == 5)
|
||||
npc.advanced.stepSound = textfield.getText();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void subGuiClosed(SubGuiInterface subgui) {
|
||||
GuiSoundSelection gss = (GuiSoundSelection) subgui;
|
||||
if(gss.selectedResource != null) {
|
||||
if (gss.selectedResource != null) {
|
||||
selectedField.setText(gss.selectedResource.toString());
|
||||
unFocused(selectedField);
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
@Override
|
||||
public void save() {
|
||||
PacketClient.sendClient(new MainmenuAdvancedSavePacket(npc.advanced.writeToNBT(new NBTTagCompound())));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,133 +18,128 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
public class GuiNPCTagSetup extends GuiNPCInterface2 implements IScrollData,ICustomScrollListener,IGuiData
|
||||
{
|
||||
private GuiCustomScroll scrollTags;
|
||||
private GuiCustomScroll npcTags;
|
||||
private final ArrayList<String> allTags = new ArrayList<>();
|
||||
private ArrayList<String> tagNames = new ArrayList<>();
|
||||
private String search = "";
|
||||
public class GuiNPCTagSetup extends GuiNPCInterface2 implements IScrollData, ICustomScrollListener, IGuiData {
|
||||
private GuiCustomScroll scrollTags;
|
||||
private GuiCustomScroll npcTags;
|
||||
private final ArrayList<String> allTags = new ArrayList<>();
|
||||
private ArrayList<String> tagNames = new ArrayList<>();
|
||||
private String search = "";
|
||||
|
||||
public GuiNPCTagSetup(EntityNPCInterface npc)
|
||||
{
|
||||
super(npc);
|
||||
public GuiNPCTagSetup(EntityNPCInterface npc) {
|
||||
super(npc);
|
||||
PacketClient.sendClient(new TagsGetPacket());
|
||||
PacketClient.sendClient(new TagsNpcGetPacket());
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
{
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
addLabel(new GuiNpcLabel(1, StatCollector.translateToLocal("tags.allTags"), guiLeft + 22, guiTop + 11));
|
||||
if(scrollTags == null){
|
||||
scrollTags = new GuiCustomScroll(this,0);
|
||||
scrollTags.setSize(150, 155);
|
||||
addLabel(new GuiNpcLabel(1, StatCollector.translateToLocal("tags.allTags"), guiLeft + 22, guiTop + 11));
|
||||
if (scrollTags == null) {
|
||||
scrollTags = new GuiCustomScroll(this, 0);
|
||||
scrollTags.setSize(150, 155);
|
||||
}
|
||||
scrollTags.guiLeft = guiLeft + 20;
|
||||
scrollTags.guiTop = guiTop + 24;
|
||||
this.addScroll(scrollTags);
|
||||
addTextField(new GuiNpcTextField(4, this, fontRendererObj, guiLeft + 20, guiTop + 24 + 160, 150, 20, search));
|
||||
addTextField(new GuiNpcTextField(4, this, fontRendererObj, guiLeft + 20, guiTop + 24 + 160, 150, 20, search));
|
||||
|
||||
addLabel(new GuiNpcLabel(2, StatCollector.translateToLocal("tags.selectedTags"), guiLeft + 252, guiTop + 11));
|
||||
if(npcTags == null){
|
||||
npcTags = new GuiCustomScroll(this,1);
|
||||
npcTags.setSize(150, 180);
|
||||
}
|
||||
npcTags.guiLeft = guiLeft + 250;
|
||||
npcTags.guiTop = guiTop + 24;
|
||||
npcTags.setList(tagNames);
|
||||
this.addScroll(npcTags);
|
||||
addLabel(new GuiNpcLabel(2, StatCollector.translateToLocal("tags.selectedTags"), guiLeft + 252, guiTop + 11));
|
||||
if (npcTags == null) {
|
||||
npcTags = new GuiCustomScroll(this, 1);
|
||||
npcTags.setSize(150, 180);
|
||||
}
|
||||
npcTags.guiLeft = guiLeft + 250;
|
||||
npcTags.guiTop = guiTop + 24;
|
||||
npcTags.setList(tagNames);
|
||||
this.addScroll(npcTags);
|
||||
|
||||
addButton(new GuiNpcButton(10, guiLeft + 185, guiTop + 90, 55, 20, ">"));
|
||||
addButton(new GuiNpcButton(11, guiLeft + 185, guiTop + 112, 55, 20, "<"));
|
||||
addButton(new GuiNpcButton(10, guiLeft + 185, guiTop + 90, 55, 20, ">"));
|
||||
addButton(new GuiNpcButton(11, guiLeft + 185, guiTop + 112, 55, 20, "<"));
|
||||
|
||||
addButton(new GuiNpcButton(12, guiLeft + 185, guiTop + 140, 55, 20, ">>"));
|
||||
addButton(new GuiNpcButton(13, guiLeft + 185, guiTop + 162, 55, 20, "<<"));
|
||||
addButton(new GuiNpcButton(12, guiLeft + 185, guiTop + 140, 55, 20, ">>"));
|
||||
addButton(new GuiNpcButton(13, guiLeft + 185, guiTop + 162, 55, 20, "<<"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buttonEvent(GuiButton guibutton) {
|
||||
if (guibutton.id == 10 && scrollTags.hasSelected() && !tagNames.contains(scrollTags.getSelected())) {
|
||||
tagNames.add(scrollTags.getSelected());
|
||||
}
|
||||
if (guibutton.id == 12) {
|
||||
tagNames.clear();
|
||||
tagNames.addAll(allTags);
|
||||
}
|
||||
if (guibutton.id == 11 && npcTags.hasSelected()) {
|
||||
tagNames.remove(npcTags.getSelected());
|
||||
}
|
||||
if (guibutton.id == 13) {
|
||||
tagNames.clear();
|
||||
}
|
||||
initGui();
|
||||
if (guibutton.id == 10 && scrollTags.hasSelected() && !tagNames.contains(scrollTags.getSelected())) {
|
||||
tagNames.add(scrollTags.getSelected());
|
||||
}
|
||||
if (guibutton.id == 12) {
|
||||
tagNames.clear();
|
||||
tagNames.addAll(allTags);
|
||||
}
|
||||
if (guibutton.id == 11 && npcTags.hasSelected()) {
|
||||
tagNames.remove(npcTags.getSelected());
|
||||
}
|
||||
if (guibutton.id == 13) {
|
||||
tagNames.clear();
|
||||
}
|
||||
initGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(Vector<String> list, HashMap<String, Integer> data, EnumScrollData type)
|
||||
{
|
||||
allTags.addAll(data.keySet());
|
||||
allTags.sort(String.CASE_INSENSITIVE_ORDER);
|
||||
scrollTags.setList(allTags);
|
||||
initGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
NBTTagList tagList = compound.getTagList("TagNames",8);
|
||||
tagNames.clear();
|
||||
for (int i = 0; i < tagList.tagCount(); i++) {
|
||||
tagNames.add(tagList.getStringTagAt(i));
|
||||
}
|
||||
}
|
||||
|
||||
public void mouseClicked(int i, int j, int k)
|
||||
{
|
||||
super.mouseClicked(i, j, k);
|
||||
if(k == 0 && scrollTags != null)
|
||||
scrollTags.mouseClicked(i, j, k);
|
||||
@Override
|
||||
public void setData(Vector<String> list, HashMap<String, Integer> data, EnumScrollData type) {
|
||||
allTags.addAll(data.keySet());
|
||||
allTags.sort(String.CASE_INSENSITIVE_ORDER);
|
||||
scrollTags.setList(allTags);
|
||||
initGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(String selected) {
|
||||
scrollTags.setSelected(selected);
|
||||
}
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
NBTTagList tagList = compound.getTagList("TagNames", 8);
|
||||
tagNames.clear();
|
||||
for (int i = 0; i < tagList.tagCount(); i++) {
|
||||
tagNames.add(tagList.getStringTagAt(i));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void customScrollClicked(int i, int j, int k, GuiCustomScroll guiCustomScroll) {}
|
||||
public void mouseClicked(int i, int j, int k) {
|
||||
super.mouseClicked(i, j, k);
|
||||
if (k == 0 && scrollTags != null)
|
||||
scrollTags.mouseClicked(i, j, k);
|
||||
}
|
||||
|
||||
public void save() {
|
||||
NBTTagCompound tagCompound = new NBTTagCompound();
|
||||
NBTTagList tagList = new NBTTagList();
|
||||
for (String string : this.tagNames) {
|
||||
tagList.appendTag(new NBTTagString(string));
|
||||
}
|
||||
tagCompound.setTag("TagNames",tagList);
|
||||
@Override
|
||||
public void setSelected(String selected) {
|
||||
scrollTags.setSelected(selected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void customScrollClicked(int i, int j, int k, GuiCustomScroll guiCustomScroll) {
|
||||
}
|
||||
|
||||
public void save() {
|
||||
NBTTagCompound tagCompound = new NBTTagCompound();
|
||||
NBTTagList tagList = new NBTTagList();
|
||||
for (String string : this.tagNames) {
|
||||
tagList.appendTag(new NBTTagString(string));
|
||||
}
|
||||
tagCompound.setTag("TagNames", tagList);
|
||||
PacketClient.sendClient(new TagSetPacket(tagCompound));
|
||||
}
|
||||
}
|
||||
|
||||
public void keyTyped(char c, int i)
|
||||
{
|
||||
super.keyTyped(c, i);
|
||||
if(getTextField(4) != null){
|
||||
if(search.equals(getTextField(4).getText()))
|
||||
return;
|
||||
search = getTextField(4).getText().toLowerCase();
|
||||
scrollTags.setList(getSearchList());
|
||||
}
|
||||
}
|
||||
public void keyTyped(char c, int i) {
|
||||
super.keyTyped(c, i);
|
||||
if (getTextField(4) != null) {
|
||||
if (search.equals(getTextField(4).getText()))
|
||||
return;
|
||||
search = getTextField(4).getText().toLowerCase();
|
||||
scrollTags.setList(getSearchList());
|
||||
}
|
||||
}
|
||||
|
||||
private List<String> getSearchList(){
|
||||
if(search.isEmpty()){
|
||||
return new ArrayList<String>(allTags);
|
||||
}
|
||||
List<String> list = new ArrayList<String>();
|
||||
for(String name : this.allTags){
|
||||
if(name.toLowerCase().contains(search))
|
||||
list.add(name);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
private List<String> getSearchList() {
|
||||
if (search.isEmpty()) {
|
||||
return new ArrayList<String>(allTags);
|
||||
}
|
||||
List<String> list = new ArrayList<String>();
|
||||
for (String name : this.allTags) {
|
||||
if (name.toLowerCase().contains(search))
|
||||
list.add(name);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -90,16 +90,16 @@ public class GuiCustom extends GuiScreen implements ICustomScrollListener, IGuiD
|
||||
super.initGui();
|
||||
this.mc.thePlayer.openContainer = this.inventorySlots;
|
||||
if (this.gui != null) {
|
||||
guiLeft = (this.width - this.xSize)/2;
|
||||
guiTop = (this.height - this.ySize)/2;
|
||||
guiLeft = (this.width - this.xSize) / 2;
|
||||
guiTop = (this.height - this.ySize) / 2;
|
||||
this.components.clear();
|
||||
this.clickListeners.clear();
|
||||
this.keyListeners.clear();
|
||||
this.dataHolders.clear();
|
||||
Iterator var1 = this.gui.getComponents().iterator();
|
||||
|
||||
while(var1.hasNext()) {
|
||||
ICustomGuiComponent c = (ICustomGuiComponent)var1.next();
|
||||
while (var1.hasNext()) {
|
||||
ICustomGuiComponent c = (ICustomGuiComponent) var1.next();
|
||||
this.addComponent(c);
|
||||
}
|
||||
}
|
||||
@@ -111,15 +111,14 @@ public class GuiCustom extends GuiScreen implements ICustomScrollListener, IGuiD
|
||||
|
||||
Iterator var1 = this.dataHolders.iterator();
|
||||
|
||||
while(var1.hasNext()) {
|
||||
IDataHolder component = (IDataHolder)var1.next();
|
||||
while (var1.hasNext()) {
|
||||
IDataHolder component = (IDataHolder) var1.next();
|
||||
if (component instanceof GuiTextField) {
|
||||
((GuiTextField)component).updateCursorCounter();
|
||||
((GuiTextField) component).updateCursorCounter();
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.mc.thePlayer.isEntityAlive() || this.mc.thePlayer.isDead)
|
||||
{
|
||||
if (!this.mc.thePlayer.isEntityAlive() || this.mc.thePlayer.isDead) {
|
||||
this.mc.thePlayer.closeScreen();
|
||||
}
|
||||
}
|
||||
@@ -133,12 +132,12 @@ public class GuiCustom extends GuiScreen implements ICustomScrollListener, IGuiD
|
||||
|
||||
Iterator var4 = this.components.values().iterator();
|
||||
|
||||
while(var4.hasNext()) {
|
||||
while (var4.hasNext()) {
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
|
||||
IGuiComponent component = (IGuiComponent)var4.next();
|
||||
IGuiComponent component = (IGuiComponent) var4.next();
|
||||
component.onRender(this.mc, mouseX, mouseY, Mouse.getDWheel(), partialTicks);
|
||||
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
@@ -153,8 +152,7 @@ public class GuiCustom extends GuiScreen implements ICustomScrollListener, IGuiD
|
||||
drawScreenSuper(mouseX, mouseY, partialTicks);
|
||||
}
|
||||
|
||||
public void drawScreenSuper(int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
public void drawScreenSuper(int mouseX, int mouseY, float partialTicks) {
|
||||
//this.drawDefaultBackground();
|
||||
int k = this.guiLeft;
|
||||
int l = this.guiTop;
|
||||
@@ -166,23 +164,21 @@ public class GuiCustom extends GuiScreen implements ICustomScrollListener, IGuiD
|
||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float)k, (float)l, 0.0F);
|
||||
GL11.glTranslatef((float) k, (float) l, 0.0F);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
this.theSlot = null;
|
||||
short short1 = 240;
|
||||
short short2 = 240;
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)short1 / 1.0F, (float)short2 / 1.0F);
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) short1 / 1.0F, (float) short2 / 1.0F);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
int k1;
|
||||
|
||||
for (int i1 = 0; i1 < this.inventorySlots.inventorySlots.size(); ++i1)
|
||||
{
|
||||
Slot slot = (Slot)this.inventorySlots.inventorySlots.get(i1);
|
||||
for (int i1 = 0; i1 < this.inventorySlots.inventorySlots.size(); ++i1) {
|
||||
Slot slot = (Slot) this.inventorySlots.inventorySlots.get(i1);
|
||||
this.drawSlot(slot);
|
||||
|
||||
if (this.isMouseOverSlot(slot, mouseX, mouseY) && slot.func_111238_b())
|
||||
{
|
||||
if (this.isMouseOverSlot(slot, mouseX, mouseY) && slot.func_111238_b()) {
|
||||
this.theSlot = slot;
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
@@ -204,24 +200,19 @@ public class GuiCustom extends GuiScreen implements ICustomScrollListener, IGuiD
|
||||
InventoryPlayer inventoryplayer = this.mc.thePlayer.inventory;
|
||||
ItemStack itemstack = this.draggedStack == null ? inventoryplayer.getItemStack() : this.draggedStack;
|
||||
|
||||
if (itemstack != null)
|
||||
{
|
||||
if (itemstack != null) {
|
||||
byte b0 = 8;
|
||||
k1 = this.draggedStack == null ? 8 : 16;
|
||||
String s = null;
|
||||
|
||||
if (this.draggedStack != null && this.isRightMouseClick)
|
||||
{
|
||||
if (this.draggedStack != null && this.isRightMouseClick) {
|
||||
itemstack = itemstack.copy();
|
||||
itemstack.stackSize = MathHelper.ceiling_float_int((float)itemstack.stackSize / 2.0F);
|
||||
}
|
||||
else if (this.field_147007_t && this.field_147008_s.size() > 1)
|
||||
{
|
||||
itemstack.stackSize = MathHelper.ceiling_float_int((float) itemstack.stackSize / 2.0F);
|
||||
} else if (this.field_147007_t && this.field_147008_s.size() > 1) {
|
||||
itemstack = itemstack.copy();
|
||||
itemstack.stackSize = this.field_146996_I;
|
||||
|
||||
if (itemstack.stackSize == 0)
|
||||
{
|
||||
if (itemstack.stackSize == 0) {
|
||||
s = "" + EnumChatFormatting.YELLOW + "0";
|
||||
}
|
||||
}
|
||||
@@ -229,27 +220,24 @@ public class GuiCustom extends GuiScreen implements ICustomScrollListener, IGuiD
|
||||
this.drawItemStack(itemstack, mouseX - k - b0, mouseY - l - k1, s);
|
||||
}
|
||||
|
||||
if (this.returningStack != null)
|
||||
{
|
||||
float f1 = (float)(Minecraft.getSystemTime() - this.returningStackTime) / 100.0F;
|
||||
if (this.returningStack != null) {
|
||||
float f1 = (float) (Minecraft.getSystemTime() - this.returningStackTime) / 100.0F;
|
||||
|
||||
if (f1 >= 1.0F)
|
||||
{
|
||||
if (f1 >= 1.0F) {
|
||||
f1 = 1.0F;
|
||||
this.returningStack = null;
|
||||
}
|
||||
|
||||
k1 = this.returningStackDestSlot.xDisplayPosition - this.field_147011_y;
|
||||
int j2 = this.returningStackDestSlot.yDisplayPosition - this.field_147010_z;
|
||||
int l1 = this.field_147011_y + (int)((float)k1 * f1);
|
||||
int i2 = this.field_147010_z + (int)((float)j2 * f1);
|
||||
this.drawItemStack(this.returningStack, l1, i2, (String)null);
|
||||
int l1 = this.field_147011_y + (int) ((float) k1 * f1);
|
||||
int i2 = this.field_147010_z + (int) ((float) j2 * f1);
|
||||
this.drawItemStack(this.returningStack, l1, i2, (String) null);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
if (inventoryplayer.getItemStack() == null && this.theSlot != null && this.theSlot.getHasStack())
|
||||
{
|
||||
if (inventoryplayer.getItemStack() == null && this.theSlot != null && this.theSlot.getHasStack()) {
|
||||
ItemStack itemstack1 = this.theSlot.getStack();
|
||||
this.renderToolTip(itemstack1, mouseX, mouseY);
|
||||
}
|
||||
@@ -259,8 +247,7 @@ public class GuiCustom extends GuiScreen implements ICustomScrollListener, IGuiD
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
}
|
||||
|
||||
private void drawItemStack(ItemStack p_146982_1_, int p_146982_2_, int p_146982_3_, String p_146982_4_)
|
||||
{
|
||||
private void drawItemStack(ItemStack p_146982_1_, int p_146982_2_, int p_146982_3_, String p_146982_4_) {
|
||||
GL11.glTranslatef(0.0F, 0.0F, 32.0F);
|
||||
this.zLevel = 200.0F;
|
||||
itemRender.zLevel = 200.0F;
|
||||
@@ -273,13 +260,11 @@ public class GuiCustom extends GuiScreen implements ICustomScrollListener, IGuiD
|
||||
itemRender.zLevel = 0.0F;
|
||||
}
|
||||
|
||||
private boolean isMouseOverSlot(Slot slot, int posX, int posY)
|
||||
{
|
||||
private boolean isMouseOverSlot(Slot slot, int posX, int posY) {
|
||||
return this.isPointInRegion(slot.xDisplayPosition, slot.yDisplayPosition, 16, 16, posX, posY);
|
||||
}
|
||||
|
||||
protected boolean isPointInRegion(int slotDisplayX, int slotDisplayY, int slotSizeX, int slotSizeY, int posX, int posY)
|
||||
{
|
||||
protected boolean isPointInRegion(int slotDisplayX, int slotDisplayY, int slotSizeX, int slotSizeY, int posX, int posY) {
|
||||
int k1 = this.guiLeft;
|
||||
int l1 = this.guiTop;
|
||||
posX -= k1;
|
||||
@@ -287,8 +272,7 @@ public class GuiCustom extends GuiScreen implements ICustomScrollListener, IGuiD
|
||||
return posX >= slotDisplayX - 1 && posX < slotDisplayX + slotSizeX + 1 && posY >= slotDisplayY - 1 && posY < slotDisplayY + slotSizeY + 1;
|
||||
}
|
||||
|
||||
private void drawSlot(Slot p_146977_1_)
|
||||
{
|
||||
private void drawSlot(Slot p_146977_1_) {
|
||||
int i = p_146977_1_.xDisplayPosition;
|
||||
int j = p_146977_1_.yDisplayPosition;
|
||||
ItemStack itemstack = p_146977_1_.getStack();
|
||||
@@ -297,38 +281,29 @@ public class GuiCustom extends GuiScreen implements ICustomScrollListener, IGuiD
|
||||
ItemStack itemstack1 = this.mc.thePlayer.inventory.getItemStack();
|
||||
String s = null;
|
||||
|
||||
if (p_146977_1_ == this.clickedSlot && this.draggedStack != null && this.isRightMouseClick && itemstack != null)
|
||||
{
|
||||
if (p_146977_1_ == this.clickedSlot && this.draggedStack != null && this.isRightMouseClick && itemstack != null) {
|
||||
itemstack = itemstack.copy();
|
||||
itemstack.stackSize /= 2;
|
||||
}
|
||||
else if (this.field_147007_t && this.field_147008_s.contains(p_146977_1_) && itemstack1 != null)
|
||||
{
|
||||
if (this.field_147008_s.size() == 1)
|
||||
{
|
||||
} else if (this.field_147007_t && this.field_147008_s.contains(p_146977_1_) && itemstack1 != null) {
|
||||
if (this.field_147008_s.size() == 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Container.func_94527_a(p_146977_1_, itemstack1, true) && this.inventorySlots.canDragIntoSlot(p_146977_1_))
|
||||
{
|
||||
if (Container.func_94527_a(p_146977_1_, itemstack1, true) && this.inventorySlots.canDragIntoSlot(p_146977_1_)) {
|
||||
itemstack = itemstack1.copy();
|
||||
flag = true;
|
||||
Container.func_94525_a(this.field_147008_s, this.field_146987_F, itemstack, p_146977_1_.getStack() == null ? 0 : p_146977_1_.getStack().stackSize);
|
||||
|
||||
if (itemstack.stackSize > itemstack.getMaxStackSize())
|
||||
{
|
||||
if (itemstack.stackSize > itemstack.getMaxStackSize()) {
|
||||
s = EnumChatFormatting.YELLOW + "" + itemstack.getMaxStackSize();
|
||||
itemstack.stackSize = itemstack.getMaxStackSize();
|
||||
}
|
||||
|
||||
if (itemstack.stackSize > p_146977_1_.getSlotStackLimit())
|
||||
{
|
||||
if (itemstack.stackSize > p_146977_1_.getSlotStackLimit()) {
|
||||
s = EnumChatFormatting.YELLOW + "" + p_146977_1_.getSlotStackLimit();
|
||||
itemstack.stackSize = p_146977_1_.getSlotStackLimit();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.field_147008_s.remove(p_146977_1_);
|
||||
this.func_146980_g();
|
||||
}
|
||||
@@ -337,12 +312,10 @@ public class GuiCustom extends GuiScreen implements ICustomScrollListener, IGuiD
|
||||
this.zLevel = 100.0F;
|
||||
itemRender.zLevel = 100.0F;
|
||||
|
||||
if (itemstack == null)
|
||||
{
|
||||
if (itemstack == null) {
|
||||
IIcon iicon = p_146977_1_.getBackgroundIconIndex();
|
||||
|
||||
if (iicon != null)
|
||||
{
|
||||
if (iicon != null) {
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_BLEND); // Forge: Blending needs to be enabled for this.
|
||||
this.mc.getTextureManager().bindTexture(TextureMap.locationItemsTexture);
|
||||
@@ -353,10 +326,8 @@ public class GuiCustom extends GuiScreen implements ICustomScrollListener, IGuiD
|
||||
}
|
||||
}
|
||||
|
||||
if (!flag1)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
if (!flag1) {
|
||||
if (flag) {
|
||||
drawRect(i, j, i + 16, j + 16, -2130706433);
|
||||
}
|
||||
|
||||
@@ -369,30 +340,25 @@ public class GuiCustom extends GuiScreen implements ICustomScrollListener, IGuiD
|
||||
this.zLevel = 0.0F;
|
||||
}
|
||||
|
||||
private void func_146980_g()
|
||||
{
|
||||
private void func_146980_g() {
|
||||
ItemStack itemstack = this.mc.thePlayer.inventory.getItemStack();
|
||||
|
||||
if (itemstack != null && this.field_147007_t)
|
||||
{
|
||||
if (itemstack != null && this.field_147007_t) {
|
||||
this.field_146996_I = itemstack.stackSize;
|
||||
ItemStack itemstack1;
|
||||
int i;
|
||||
|
||||
for (Iterator iterator = this.field_147008_s.iterator(); iterator.hasNext(); this.field_146996_I -= itemstack1.stackSize - i)
|
||||
{
|
||||
Slot slot = (Slot)iterator.next();
|
||||
for (Iterator iterator = this.field_147008_s.iterator(); iterator.hasNext(); this.field_146996_I -= itemstack1.stackSize - i) {
|
||||
Slot slot = (Slot) iterator.next();
|
||||
itemstack1 = itemstack.copy();
|
||||
i = slot.getStack() == null ? 0 : slot.getStack().stackSize;
|
||||
Container.func_94525_a(this.field_147008_s, this.field_146987_F, itemstack1, i);
|
||||
|
||||
if (itemstack1.stackSize > itemstack1.getMaxStackSize())
|
||||
{
|
||||
if (itemstack1.stackSize > itemstack1.getMaxStackSize()) {
|
||||
itemstack1.stackSize = itemstack1.getMaxStackSize();
|
||||
}
|
||||
|
||||
if (itemstack1.stackSize > slot.getSlotStackLimit())
|
||||
{
|
||||
if (itemstack1.stackSize > slot.getSlotStackLimit()) {
|
||||
itemstack1.stackSize = slot.getSlotStackLimit();
|
||||
}
|
||||
}
|
||||
@@ -408,26 +374,26 @@ public class GuiCustom extends GuiScreen implements ICustomScrollListener, IGuiD
|
||||
}
|
||||
|
||||
private void addComponent(ICustomGuiComponent component) {
|
||||
ScriptGuiComponent c = (ScriptGuiComponent)component;
|
||||
switch(c.getType()) {
|
||||
ScriptGuiComponent c = (ScriptGuiComponent) component;
|
||||
switch (c.getType()) {
|
||||
case 0:
|
||||
CustomGuiButton button = CustomGuiButton.fromComponent((ScriptGuiButton)component);
|
||||
CustomGuiButton button = CustomGuiButton.fromComponent((ScriptGuiButton) component);
|
||||
button.setParent(this);
|
||||
this.components.put(button.getID(), button);
|
||||
this.addClickListener(button);
|
||||
break;
|
||||
case 1:
|
||||
CustomGuiLabel lbl = CustomGuiLabel.fromComponent((ScriptGuiLabel)component);
|
||||
CustomGuiLabel lbl = CustomGuiLabel.fromComponent((ScriptGuiLabel) component);
|
||||
lbl.setParent(this);
|
||||
this.components.put(lbl.getID(), lbl);
|
||||
break;
|
||||
case 2:
|
||||
CustomGuiTexturedRect rect = CustomGuiTexturedRect.fromComponent((ScriptGuiTexturedRect)component);
|
||||
CustomGuiTexturedRect rect = CustomGuiTexturedRect.fromComponent((ScriptGuiTexturedRect) component);
|
||||
rect.setParent(this);
|
||||
this.components.put(rect.getID(), rect);
|
||||
break;
|
||||
case 3:
|
||||
CustomGuiTextField textField = CustomGuiTextField.fromComponent((ScriptGuiTextField)component);
|
||||
CustomGuiTextField textField = CustomGuiTextField.fromComponent((ScriptGuiTextField) component);
|
||||
textField.setParent(this);
|
||||
this.components.put(textField.getID(), textField);
|
||||
this.addDataHolder(textField);
|
||||
@@ -435,8 +401,8 @@ public class GuiCustom extends GuiScreen implements ICustomScrollListener, IGuiD
|
||||
this.addKeyListener(textField);
|
||||
break;
|
||||
case 4:
|
||||
CustomGuiScrollComponent scroll = new CustomGuiScrollComponent(this.mc, this, component.getID(), ((ScriptGuiScroll)component).isMultiSelect());
|
||||
scroll.fromComponent((ScriptGuiScroll)component);
|
||||
CustomGuiScrollComponent scroll = new CustomGuiScrollComponent(this.mc, this, component.getID(), ((ScriptGuiScroll) component).isMultiSelect());
|
||||
scroll.fromComponent((ScriptGuiScroll) component);
|
||||
scroll.setParent(this);
|
||||
this.components.put(scroll.getID(), scroll);
|
||||
this.addDataHolder(scroll);
|
||||
@@ -444,7 +410,7 @@ public class GuiCustom extends GuiScreen implements ICustomScrollListener, IGuiD
|
||||
break;
|
||||
case 6:
|
||||
CustomGuiLine line = CustomGuiLine.fromComponent((ScriptGuiLine) component);
|
||||
this.components.put(line.getID(),line);
|
||||
this.components.put(line.getID(), line);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -460,10 +426,11 @@ public class GuiCustom extends GuiScreen implements ICustomScrollListener, IGuiD
|
||||
}
|
||||
|
||||
public String prevScrollClicked = null;
|
||||
|
||||
public void customScrollClicked(int i, int j, int k, GuiCustomScroll scroll) {
|
||||
PacketClient.sendClient(new CustomScrollClickPacket(this.updateGui().toNBT(), scroll.id, scroll.selected, this.getScrollSelection((CustomGuiScrollComponent)scroll), false));
|
||||
if(Integer.toString(scroll.selected).equals(prevScrollClicked)){
|
||||
PacketClient.sendClient(new CustomScrollClickPacket(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), false));
|
||||
if (Integer.toString(scroll.selected).equals(prevScrollClicked)) {
|
||||
PacketClient.sendClient(new CustomScrollClickPacket(this.updateGui().toNBT(), scroll.id, scroll.selected, this.getScrollSelection((CustomGuiScrollComponent) scroll), true));
|
||||
}
|
||||
prevScrollClicked = Integer.toString(scroll.selected);
|
||||
}
|
||||
@@ -473,21 +440,20 @@ public class GuiCustom extends GuiScreen implements ICustomScrollListener, IGuiD
|
||||
PacketClient.sendClient(new CustomGuiClosePacket(this.updateGui().toNBT()));
|
||||
}
|
||||
|
||||
if (this.mc.thePlayer != null)
|
||||
{
|
||||
if (this.mc.thePlayer != null) {
|
||||
this.inventorySlots.onContainerClosed(this.mc.thePlayer);
|
||||
}
|
||||
}
|
||||
|
||||
public void onTextFieldUnfocused(CustomGuiTextField textField){
|
||||
public void onTextFieldUnfocused(CustomGuiTextField textField) {
|
||||
PacketClient.sendClient(new CustomGuiUnfocusedPacket(textField.getID(), this.updateGui().toNBT()));
|
||||
}
|
||||
|
||||
public ScriptGui updateGui() {
|
||||
Iterator var1 = this.dataHolders.iterator();
|
||||
|
||||
while(var1.hasNext()) {
|
||||
IDataHolder component = (IDataHolder)var1.next();
|
||||
while (var1.hasNext()) {
|
||||
IDataHolder component = (IDataHolder) var1.next();
|
||||
this.gui.updateComponent(component.toComponent());
|
||||
}
|
||||
|
||||
@@ -499,8 +465,8 @@ public class GuiCustom extends GuiScreen implements ICustomScrollListener, IGuiD
|
||||
if (scroll.multiSelect) {
|
||||
Iterator var3 = scroll.getSelectedList().iterator();
|
||||
|
||||
while(var3.hasNext()) {
|
||||
String s = (String)var3.next();
|
||||
while (var3.hasNext()) {
|
||||
String s = (String) var3.next();
|
||||
list.appendTag(new NBTTagString(s));
|
||||
}
|
||||
} else {
|
||||
@@ -513,28 +479,23 @@ public class GuiCustom extends GuiScreen implements ICustomScrollListener, IGuiD
|
||||
}
|
||||
|
||||
protected void keyTyped(char typedChar, int keyCode) {
|
||||
if (keyCode == 1 && closeOnEsc)
|
||||
{
|
||||
if (keyCode == 1 && closeOnEsc) {
|
||||
this.mc.thePlayer.closeScreen();
|
||||
}
|
||||
|
||||
this.checkHotbarKeys(keyCode);
|
||||
|
||||
if (this.theSlot != null && this.theSlot.getHasStack())
|
||||
{
|
||||
if (keyCode == this.mc.gameSettings.keyBindPickBlock.getKeyCode())
|
||||
{
|
||||
if (this.theSlot != null && this.theSlot.getHasStack()) {
|
||||
if (keyCode == this.mc.gameSettings.keyBindPickBlock.getKeyCode()) {
|
||||
this.handleMouseClick(this.theSlot, this.theSlot.slotNumber, 0, 3);
|
||||
}
|
||||
else if (keyCode == this.mc.gameSettings.keyBindDrop.getKeyCode())
|
||||
{
|
||||
} else if (keyCode == this.mc.gameSettings.keyBindDrop.getKeyCode()) {
|
||||
this.handleMouseClick(this.theSlot, this.theSlot.slotNumber, isCtrlKeyDown() ? 1 : 0, 4);
|
||||
}
|
||||
}
|
||||
|
||||
Iterator var3 = this.keyListeners.iterator();
|
||||
|
||||
while(var3.hasNext()) {
|
||||
while (var3.hasNext()) {
|
||||
CustomGuiTextField listener = (CustomGuiTextField) var3.next();
|
||||
listener.keyTyped(typedChar, keyCode);
|
||||
}
|
||||
@@ -557,12 +518,10 @@ public class GuiCustom extends GuiScreen implements ICustomScrollListener, IGuiD
|
||||
boolean flag1 = true;
|
||||
int k1 = -1;
|
||||
|
||||
for (int i = 0; i < this.inventorySlots.inventorySlots.size(); ++i)
|
||||
{
|
||||
Slot invSlot = (Slot)this.inventorySlots.inventorySlots.get(i);
|
||||
for (int i = 0; i < this.inventorySlots.inventorySlots.size(); ++i) {
|
||||
Slot invSlot = (Slot) this.inventorySlots.inventorySlots.get(i);
|
||||
|
||||
if (invSlot.equals(slot))
|
||||
{
|
||||
if (invSlot.equals(slot)) {
|
||||
flag1 = false;
|
||||
}
|
||||
}
|
||||
@@ -629,8 +588,8 @@ public class GuiCustom extends GuiScreen implements ICustomScrollListener, IGuiD
|
||||
|
||||
Iterator var4 = this.clickListeners.iterator();
|
||||
|
||||
while(var4.hasNext()) {
|
||||
IClickListener listener = (IClickListener)var4.next();
|
||||
while (var4.hasNext()) {
|
||||
IClickListener listener = (IClickListener) var4.next();
|
||||
listener.mouseClicked(this, mouseX, mouseY, mouseButton);
|
||||
}
|
||||
|
||||
@@ -654,8 +613,8 @@ public class GuiCustom extends GuiScreen implements ICustomScrollListener, IGuiD
|
||||
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
ScriptGui gui = (ScriptGui)(new ScriptGui()).fromNBT(compound);
|
||||
((ContainerCustomGui)this.inventorySlots).setGui(gui, mc.thePlayer);
|
||||
ScriptGui gui = (ScriptGui) (new ScriptGui()).fromNBT(compound);
|
||||
((ContainerCustomGui) this.inventorySlots).setGui(gui, mc.thePlayer);
|
||||
this.gui = gui;
|
||||
this.xSize = gui.getWidth();
|
||||
this.ySize = gui.getHeight();
|
||||
@@ -670,14 +629,10 @@ public class GuiCustom extends GuiScreen implements ICustomScrollListener, IGuiD
|
||||
/**
|
||||
* This function is what controls the hotbar shortcut check when you press a number key when hovering a stack.
|
||||
*/
|
||||
protected boolean checkHotbarKeys(int p_146983_1_)
|
||||
{
|
||||
if (this.mc.thePlayer.inventory.getItemStack() == null && this.theSlot != null)
|
||||
{
|
||||
for (int j = 0; j < 9; ++j)
|
||||
{
|
||||
if (p_146983_1_ == this.mc.gameSettings.keyBindsHotbar[j].getKeyCode())
|
||||
{
|
||||
protected boolean checkHotbarKeys(int p_146983_1_) {
|
||||
if (this.mc.thePlayer.inventory.getItemStack() == null && this.theSlot != null) {
|
||||
for (int j = 0; j < 9; ++j) {
|
||||
if (p_146983_1_ == this.mc.gameSettings.keyBindsHotbar[j].getKeyCode()) {
|
||||
this.handleMouseClick(this.theSlot, this.theSlot.slotNumber, j, 2);
|
||||
return true;
|
||||
}
|
||||
@@ -687,18 +642,15 @@ public class GuiCustom extends GuiScreen implements ICustomScrollListener, IGuiD
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void handleMouseClick(Slot slot, int index, int p_146984_3_, int p_146984_4_)
|
||||
{
|
||||
if (slot != null)
|
||||
{
|
||||
protected void handleMouseClick(Slot slot, int index, int p_146984_3_, int p_146984_4_) {
|
||||
if (slot != null) {
|
||||
index = slot.slotNumber;
|
||||
}
|
||||
|
||||
this.mc.playerController.windowClick(this.inventorySlots.windowId, index, p_146984_3_, p_146984_4_, this.mc.thePlayer);
|
||||
}
|
||||
|
||||
protected void mouseMovedOrUp(int p_146286_1_, int p_146286_2_, int p_146286_3_)
|
||||
{
|
||||
protected void mouseMovedOrUp(int p_146286_1_, int p_146286_2_, int p_146286_3_) {
|
||||
super.mouseMovedOrUp(p_146286_1_, p_146286_2_, p_146286_3_); //Forge, Call parent to release buttons
|
||||
Slot slot = this.getSlotAtPosition(p_146286_1_, p_146286_2_);
|
||||
int l = this.guiLeft;
|
||||
@@ -706,96 +658,74 @@ public class GuiCustom extends GuiScreen implements ICustomScrollListener, IGuiD
|
||||
boolean flag = p_146286_1_ < l || p_146286_2_ < i1 || p_146286_1_ >= l + this.xSize || p_146286_2_ >= i1 + this.ySize;
|
||||
int j1 = -1;
|
||||
|
||||
if (slot != null)
|
||||
{
|
||||
if (slot != null) {
|
||||
j1 = slot.slotNumber;
|
||||
}
|
||||
|
||||
if (flag)
|
||||
{
|
||||
if (flag) {
|
||||
j1 = -999;
|
||||
}
|
||||
|
||||
Slot slot1;
|
||||
Iterator iterator;
|
||||
|
||||
if (this.field_146993_M && slot != null && p_146286_3_ == 0 && this.inventorySlots.func_94530_a((ItemStack)null, slot))
|
||||
{
|
||||
if (isShiftKeyDown())
|
||||
{
|
||||
if (slot != null && slot.inventory != null && this.field_146994_N != null)
|
||||
{
|
||||
if (this.field_146993_M && slot != null && p_146286_3_ == 0 && this.inventorySlots.func_94530_a((ItemStack) null, slot)) {
|
||||
if (isShiftKeyDown()) {
|
||||
if (slot != null && slot.inventory != null && this.field_146994_N != null) {
|
||||
iterator = this.inventorySlots.inventorySlots.iterator();
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
slot1 = (Slot)iterator.next();
|
||||
while (iterator.hasNext()) {
|
||||
slot1 = (Slot) iterator.next();
|
||||
|
||||
if (slot1 != null && slot1.canTakeStack(this.mc.thePlayer) && slot1.getHasStack() && slot1.inventory == slot.inventory && Container.func_94527_a(slot1, this.field_146994_N, true))
|
||||
{
|
||||
if (slot1 != null && slot1.canTakeStack(this.mc.thePlayer) && slot1.getHasStack() && slot1.inventory == slot.inventory && Container.func_94527_a(slot1, this.field_146994_N, true)) {
|
||||
this.handleMouseClick(slot1, slot1.slotNumber, p_146286_3_, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.handleMouseClick(slot, j1, p_146286_3_, 6);
|
||||
}
|
||||
|
||||
this.field_146993_M = false;
|
||||
this.field_146997_J = 0L;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.field_147007_t && this.field_146988_G != p_146286_3_)
|
||||
{
|
||||
} else {
|
||||
if (this.field_147007_t && this.field_146988_G != p_146286_3_) {
|
||||
this.field_147007_t = false;
|
||||
this.field_147008_s.clear();
|
||||
this.field_146995_H = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.field_146995_H)
|
||||
{
|
||||
if (this.field_146995_H) {
|
||||
this.field_146995_H = false;
|
||||
return;
|
||||
}
|
||||
|
||||
boolean flag1;
|
||||
|
||||
if (this.clickedSlot != null && this.mc.gameSettings.touchscreen)
|
||||
{
|
||||
if (p_146286_3_ == 0 || p_146286_3_ == 1)
|
||||
{
|
||||
if (this.draggedStack == null && slot != this.clickedSlot)
|
||||
{
|
||||
if (this.clickedSlot != null && this.mc.gameSettings.touchscreen) {
|
||||
if (p_146286_3_ == 0 || p_146286_3_ == 1) {
|
||||
if (this.draggedStack == null && slot != this.clickedSlot) {
|
||||
this.draggedStack = this.clickedSlot.getStack();
|
||||
}
|
||||
|
||||
flag1 = Container.func_94527_a(slot, this.draggedStack, false);
|
||||
|
||||
if (j1 != -1 && this.draggedStack != null && flag1)
|
||||
{
|
||||
if (j1 != -1 && this.draggedStack != null && flag1) {
|
||||
this.handleMouseClick(this.clickedSlot, this.clickedSlot.slotNumber, p_146286_3_, 0);
|
||||
this.handleMouseClick(slot, j1, 0, 0);
|
||||
|
||||
if (this.mc.thePlayer.inventory.getItemStack() != null)
|
||||
{
|
||||
if (this.mc.thePlayer.inventory.getItemStack() != null) {
|
||||
this.handleMouseClick(this.clickedSlot, this.clickedSlot.slotNumber, p_146286_3_, 0);
|
||||
this.field_147011_y = p_146286_1_ - l;
|
||||
this.field_147010_z = p_146286_2_ - i1;
|
||||
this.returningStackDestSlot = this.clickedSlot;
|
||||
this.returningStack = this.draggedStack;
|
||||
this.returningStackTime = Minecraft.getSystemTime();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.returningStack = null;
|
||||
}
|
||||
}
|
||||
else if (this.draggedStack != null)
|
||||
{
|
||||
} else if (this.draggedStack != null) {
|
||||
this.field_147011_y = p_146286_1_ - l;
|
||||
this.field_147010_z = p_146286_2_ - i1;
|
||||
this.returningStackDestSlot = this.clickedSlot;
|
||||
@@ -806,32 +736,23 @@ public class GuiCustom extends GuiScreen implements ICustomScrollListener, IGuiD
|
||||
this.draggedStack = null;
|
||||
this.clickedSlot = null;
|
||||
}
|
||||
}
|
||||
else if (this.field_147007_t && !this.field_147008_s.isEmpty())
|
||||
{
|
||||
this.handleMouseClick((Slot)null, -999, Container.func_94534_d(0, this.field_146987_F), 5);
|
||||
} else if (this.field_147007_t && !this.field_147008_s.isEmpty()) {
|
||||
this.handleMouseClick((Slot) null, -999, Container.func_94534_d(0, this.field_146987_F), 5);
|
||||
iterator = this.field_147008_s.iterator();
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
slot1 = (Slot)iterator.next();
|
||||
while (iterator.hasNext()) {
|
||||
slot1 = (Slot) iterator.next();
|
||||
this.handleMouseClick(slot1, slot1.slotNumber, Container.func_94534_d(1, this.field_146987_F), 5);
|
||||
}
|
||||
|
||||
this.handleMouseClick((Slot)null, -999, Container.func_94534_d(2, this.field_146987_F), 5);
|
||||
}
|
||||
else if (this.mc.thePlayer.inventory.getItemStack() != null)
|
||||
{
|
||||
if (p_146286_3_ == this.mc.gameSettings.keyBindPickBlock.getKeyCode() + 100)
|
||||
{
|
||||
this.handleMouseClick((Slot) null, -999, Container.func_94534_d(2, this.field_146987_F), 5);
|
||||
} else if (this.mc.thePlayer.inventory.getItemStack() != null) {
|
||||
if (p_146286_3_ == this.mc.gameSettings.keyBindPickBlock.getKeyCode() + 100) {
|
||||
this.handleMouseClick(slot, j1, p_146286_3_, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
flag1 = j1 != -999 && (Keyboard.isKeyDown(42) || Keyboard.isKeyDown(54));
|
||||
|
||||
if (flag1)
|
||||
{
|
||||
if (flag1) {
|
||||
this.field_146994_N = slot != null && slot.getHasStack() ? slot.getStack() : null;
|
||||
}
|
||||
|
||||
@@ -840,22 +761,18 @@ public class GuiCustom extends GuiScreen implements ICustomScrollListener, IGuiD
|
||||
}
|
||||
}
|
||||
|
||||
if (this.mc.thePlayer.inventory.getItemStack() == null)
|
||||
{
|
||||
if (this.mc.thePlayer.inventory.getItemStack() == null) {
|
||||
this.field_146997_J = 0L;
|
||||
}
|
||||
|
||||
this.field_147007_t = false;
|
||||
}
|
||||
|
||||
private Slot getSlotAtPosition(int posX, int posY)
|
||||
{
|
||||
for (int k = 0; k < this.inventorySlots.inventorySlots.size(); ++k)
|
||||
{
|
||||
Slot slot = (Slot)this.inventorySlots.inventorySlots.get(k);
|
||||
private Slot getSlotAtPosition(int posX, int posY) {
|
||||
for (int k = 0; k < this.inventorySlots.inventorySlots.size(); ++k) {
|
||||
Slot slot = (Slot) this.inventorySlots.inventorySlots.get(k);
|
||||
|
||||
if (this.isMouseOverSlot(slot, posX, posY))
|
||||
{
|
||||
if (this.isMouseOverSlot(slot, posX, posY)) {
|
||||
return slot;
|
||||
}
|
||||
}
|
||||
@@ -863,47 +780,34 @@ public class GuiCustom extends GuiScreen implements ICustomScrollListener, IGuiD
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void mouseClickMove(int p_146273_1_, int p_146273_2_, int p_146273_3_, long p_146273_4_)
|
||||
{
|
||||
protected void mouseClickMove(int p_146273_1_, int p_146273_2_, int p_146273_3_, long p_146273_4_) {
|
||||
Slot slot = this.getSlotAtPosition(p_146273_1_, p_146273_2_);
|
||||
ItemStack itemstack = this.mc.thePlayer.inventory.getItemStack();
|
||||
|
||||
if (this.clickedSlot != null && this.mc.gameSettings.touchscreen)
|
||||
{
|
||||
if (p_146273_3_ == 0 || p_146273_3_ == 1)
|
||||
{
|
||||
if (this.draggedStack == null)
|
||||
{
|
||||
if (slot != this.clickedSlot)
|
||||
{
|
||||
if (this.clickedSlot != null && this.mc.gameSettings.touchscreen) {
|
||||
if (p_146273_3_ == 0 || p_146273_3_ == 1) {
|
||||
if (this.draggedStack == null) {
|
||||
if (slot != this.clickedSlot) {
|
||||
this.draggedStack = this.clickedSlot.getStack().copy();
|
||||
}
|
||||
}
|
||||
else if (this.draggedStack.stackSize > 1 && slot != null && Container.func_94527_a(slot, this.draggedStack, false))
|
||||
{
|
||||
} else if (this.draggedStack.stackSize > 1 && slot != null && Container.func_94527_a(slot, this.draggedStack, false)) {
|
||||
long i1 = Minecraft.getSystemTime();
|
||||
|
||||
if (this.field_146985_D == slot)
|
||||
{
|
||||
if (i1 - this.field_146986_E > 500L)
|
||||
{
|
||||
if (this.field_146985_D == slot) {
|
||||
if (i1 - this.field_146986_E > 500L) {
|
||||
this.handleMouseClick(this.clickedSlot, this.clickedSlot.slotNumber, 0, 0);
|
||||
this.handleMouseClick(slot, slot.slotNumber, 1, 0);
|
||||
this.handleMouseClick(this.clickedSlot, this.clickedSlot.slotNumber, 0, 0);
|
||||
this.field_146986_E = i1 + 750L;
|
||||
--this.draggedStack.stackSize;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.field_146985_D = slot;
|
||||
this.field_146986_E = i1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (this.field_147007_t && slot != null && itemstack != null && itemstack.stackSize > this.field_147008_s.size() && Container.func_94527_a(slot, itemstack, true) && slot.isItemValid(itemstack) && this.inventorySlots.canDragIntoSlot(slot))
|
||||
{
|
||||
} else if (this.field_147007_t && slot != null && itemstack != null && itemstack.stackSize > this.field_147008_s.size() && Container.func_94527_a(slot, itemstack, true) && slot.isItemValid(itemstack) && this.inventorySlots.canDragIntoSlot(slot)) {
|
||||
this.field_147008_s.add(slot);
|
||||
this.func_146980_g();
|
||||
}
|
||||
|
||||
@@ -89,67 +89,67 @@ public class CustomGuiButton extends GuiButton implements IClickListener {
|
||||
FontRenderer fontRenderer = mc.fontRenderer;
|
||||
|
||||
float red = (color >> 16 & 255) / 255f;
|
||||
float green = (color >> 8 & 255) / 255f;
|
||||
float green = (color >> 8 & 255) / 255f;
|
||||
float blue = (color & 255) / 255f;
|
||||
GL11.glColor4f(red,green,blue,this.alpha);
|
||||
GL11.glColor4f(red, green, blue, this.alpha);
|
||||
|
||||
if (this.imageData != null && this.imageData.imageLoaded()) {
|
||||
int totalWidth = this.imageData.getTotalWidth();
|
||||
int totalHeight = this.imageData.getTotalHeight();
|
||||
|
||||
float u1 = (float)textureX/(float)totalWidth;
|
||||
float u2 = u1 + (float)width/(float)totalWidth;
|
||||
float v1 = (float)textureY/(float)totalHeight;
|
||||
float v2 = v1 + (float)height/(float)totalHeight;
|
||||
float u1 = (float) textureX / (float) totalWidth;
|
||||
float u2 = u1 + (float) width / (float) totalWidth;
|
||||
float v1 = (float) textureY / (float) totalHeight;
|
||||
float v2 = v1 + (float) height / (float) totalHeight;
|
||||
|
||||
if (this.enabled) {
|
||||
if (this.field_146123_n) {
|
||||
v1 = (float)(textureY + 2 * this.height)/(float)totalHeight;
|
||||
v1 = (float) (textureY + 2 * this.height) / (float) totalHeight;
|
||||
} else {
|
||||
v1 = (float)(textureY + this.height)/(float)totalHeight;
|
||||
v1 = (float) (textureY + this.height) / (float) totalHeight;
|
||||
}
|
||||
v2 = v1 + (float)height/(float)totalHeight;
|
||||
v2 = v1 + (float) height / (float) totalHeight;
|
||||
}
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(GuiCustom.guiLeft + this.xPosition - u1 * totalWidth * this.scale, GuiCustom.guiTop + this.yPosition - v1 * totalHeight * this.scale,(float)this.id);
|
||||
GL11.glScalef(this.scale,this.scale,1.0F);
|
||||
GL11.glTranslatef(GuiCustom.guiLeft + this.xPosition - u1 * totalWidth * this.scale, GuiCustom.guiTop + this.yPosition - v1 * totalHeight * this.scale, (float) this.id);
|
||||
GL11.glScalef(this.scale, this.scale, 1.0F);
|
||||
|
||||
this.imageData.bindTexture();
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorOpaque_F(1, 1, 1);
|
||||
tessellator.setColorRGBA_F(red, green, blue, alpha);
|
||||
tessellator.addVertexWithUV(u2 * totalWidth, v2 * totalHeight, 0, u2, v2);
|
||||
tessellator.addVertexWithUV(u2 * totalWidth, v1 * totalHeight, 0, u2, v1);
|
||||
tessellator.addVertexWithUV(u1 * totalWidth, v1 * totalHeight, 0, u1, v1);
|
||||
tessellator.addVertexWithUV(u1 * totalWidth, v2 * totalHeight, 0, u1, v2);
|
||||
tessellator.draw();
|
||||
GL11.glTranslated(0.0D, 0.0D, 0.1D);
|
||||
this.drawCenteredString(fontRenderer, this.label, this.width / 2, (this.height - 8) / 2, this.color);
|
||||
this.imageData.bindTexture();
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorOpaque_F(1, 1, 1);
|
||||
tessellator.setColorRGBA_F(red, green, blue, alpha);
|
||||
tessellator.addVertexWithUV(u2 * totalWidth, v2 * totalHeight, 0, u2, v2);
|
||||
tessellator.addVertexWithUV(u2 * totalWidth, v1 * totalHeight, 0, u2, v1);
|
||||
tessellator.addVertexWithUV(u1 * totalWidth, v1 * totalHeight, 0, u1, v1);
|
||||
tessellator.addVertexWithUV(u1 * totalWidth, v2 * totalHeight, 0, u1, v2);
|
||||
tessellator.draw();
|
||||
GL11.glTranslated(0.0D, 0.0D, 0.1D);
|
||||
this.drawCenteredString(fontRenderer, this.label, this.width / 2, (this.height - 8) / 2, this.color);
|
||||
GL11.glPopMatrix();
|
||||
} else {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(GuiCustom.guiLeft + this.xPosition, GuiCustom.guiTop + this.yPosition,(float)this.id);
|
||||
GL11.glScalef(this.scale,this.scale,1.0F);
|
||||
GL11.glTranslatef(GuiCustom.guiLeft + this.xPosition, GuiCustom.guiTop + this.yPosition, (float) this.id);
|
||||
GL11.glScalef(this.scale, this.scale, 1.0F);
|
||||
|
||||
mc.getTextureManager().bindTexture(buttonTextures);
|
||||
int i = this.getHoverState(this.field_146123_n);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
this.drawTexturedModalRect(0, 0, 0, 46 + i * 20, this.width / 2, this.height);
|
||||
this.drawTexturedModalRect(this.width / 2, 0, 200 - this.width / 2, 46 + i * 20, this.width / 2, this.height);
|
||||
this.mouseDragged(mc, mouseX, mouseY);
|
||||
int j = 14737632;
|
||||
if (this.packedFGColour != 0) {
|
||||
j = this.packedFGColour;
|
||||
} else if (!this.enabled) {
|
||||
j = 10526880;
|
||||
} else if (this.field_146123_n) {
|
||||
j = 16777120;
|
||||
}
|
||||
GL11.glTranslated(0.0D, 0.0D, 0.1D);
|
||||
this.drawCenteredString(fontRenderer, this.displayString, this.width / 2, (this.height - 8) / 2, j);
|
||||
mc.getTextureManager().bindTexture(buttonTextures);
|
||||
int i = this.getHoverState(this.field_146123_n);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
this.drawTexturedModalRect(0, 0, 0, 46 + i * 20, this.width / 2, this.height);
|
||||
this.drawTexturedModalRect(this.width / 2, 0, 200 - this.width / 2, 46 + i * 20, this.width / 2, this.height);
|
||||
this.mouseDragged(mc, mouseX, mouseY);
|
||||
int j = 14737632;
|
||||
if (this.packedFGColour != 0) {
|
||||
j = this.packedFGColour;
|
||||
} else if (!this.enabled) {
|
||||
j = 10526880;
|
||||
} else if (this.field_146123_n) {
|
||||
j = 16777120;
|
||||
}
|
||||
GL11.glTranslated(0.0D, 0.0D, 0.1D);
|
||||
this.drawCenteredString(fontRenderer, this.displayString, this.width / 2, (this.height - 8) / 2, j);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ public class CustomGuiLabel extends Gui implements IGuiComponent {
|
||||
private float posX;
|
||||
private float posY;
|
||||
|
||||
public CustomGuiLabel(int id, String fullLabel, int x, int y, int width, int height, boolean shadow){
|
||||
public CustomGuiLabel(int id, String fullLabel, int x, int y, int width, int height, boolean shadow) {
|
||||
this.id = id;
|
||||
this.fullLabel = fullLabel;
|
||||
this.x = x;
|
||||
@@ -73,20 +73,17 @@ public class CustomGuiLabel extends Gui implements IGuiComponent {
|
||||
locationFontTexture = new ResourceLocation("textures/font/ascii.png");
|
||||
readFontTexture();
|
||||
readGlyphSizes();
|
||||
for (int i = 0; i < 32; ++i)
|
||||
{
|
||||
for (int i = 0; i < 32; ++i) {
|
||||
int j = (i >> 3 & 1) * 85;
|
||||
int k = (i >> 2 & 1) * 170 + j;
|
||||
int l = (i >> 1 & 1) * 170 + j;
|
||||
int i1 = (i >> 0 & 1) * 170 + j;
|
||||
|
||||
if (i == 6)
|
||||
{
|
||||
if (i == 6) {
|
||||
k += 85;
|
||||
}
|
||||
|
||||
if (Minecraft.getMinecraft().gameSettings.anaglyph)
|
||||
{
|
||||
if (Minecraft.getMinecraft().gameSettings.anaglyph) {
|
||||
int j1 = (k * 30 + l * 59 + i1 * 11) / 100;
|
||||
int k1 = (k * 30 + l * 70) / 100;
|
||||
int l1 = (k * 30 + i1 * 70) / 100;
|
||||
@@ -95,8 +92,7 @@ public class CustomGuiLabel extends Gui implements IGuiComponent {
|
||||
i1 = l1;
|
||||
}
|
||||
|
||||
if (i >= 16)
|
||||
{
|
||||
if (i >= 16) {
|
||||
k /= 4;
|
||||
l /= 4;
|
||||
i1 /= 4;
|
||||
@@ -112,8 +108,8 @@ public class CustomGuiLabel extends Gui implements IGuiComponent {
|
||||
|
||||
public void onRender(Minecraft mc, int mouseX, int mouseY, int mouseWheel, float partialTicks) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0.0F,0.0F,(float)this.id);
|
||||
this.drawLabel(mouseX,mouseY);
|
||||
GL11.glTranslatef(0.0F, 0.0F, (float) this.id);
|
||||
this.drawLabel(mouseX, mouseY);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@@ -153,40 +149,34 @@ public class CustomGuiLabel extends Gui implements IGuiComponent {
|
||||
return component;
|
||||
}
|
||||
|
||||
public void drawLabel(int mouseX, int mouseY)
|
||||
{
|
||||
public void drawLabel(int mouseX, int mouseY) {
|
||||
GL11.glPushMatrix();
|
||||
red = (color >> 16 & 255) / 255f;
|
||||
green = (color >> 8 & 255) / 255f;
|
||||
blue = (color & 255) / 255f;
|
||||
red = (color >> 16 & 255) / 255f;
|
||||
green = (color >> 8 & 255) / 255f;
|
||||
blue = (color & 255) / 255f;
|
||||
|
||||
GL11.glTranslatef(this.x,this.y,0.0F);
|
||||
GL11.glRotated(rotation,0.0D,0.0D,1.0D);
|
||||
GL11.glScalef(this.scale, this.scale, this.scale);
|
||||
this.drawString(fullLabel, 0, 0, this.color, this.labelShadowEnabled, mouseX, mouseY);
|
||||
GL11.glTranslatef(this.x, this.y, 0.0F);
|
||||
GL11.glRotated(rotation, 0.0D, 0.0D, 1.0D);
|
||||
GL11.glScalef(this.scale, this.scale, this.scale);
|
||||
this.drawString(fullLabel, 0, 0, this.color, this.labelShadowEnabled, mouseX, mouseY);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public int drawString(String p_85187_1_, int p_85187_2_, int p_85187_3_, int p_85187_4_, boolean p_85187_5_, int mouseX, int mouseY)
|
||||
{
|
||||
public int drawString(String p_85187_1_, int p_85187_2_, int p_85187_3_, int p_85187_4_, boolean p_85187_5_, int mouseX, int mouseY) {
|
||||
this.resetStyles();
|
||||
int l;
|
||||
|
||||
if (p_85187_5_)
|
||||
{
|
||||
if (p_85187_5_) {
|
||||
l = this.renderString(p_85187_1_, p_85187_2_ + 1, p_85187_3_ + 1, p_85187_4_, true, mouseX, mouseY);
|
||||
l = Math.max(l, this.renderString(p_85187_1_, p_85187_2_, p_85187_3_, p_85187_4_, false, mouseX, mouseY));
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
l = this.renderString(p_85187_1_, p_85187_2_, p_85187_3_, p_85187_4_, false, mouseX, mouseY);
|
||||
}
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
private void resetStyles()
|
||||
{
|
||||
private void resetStyles() {
|
||||
this.randomStyle = false;
|
||||
this.boldStyle = false;
|
||||
this.italicStyle = false;
|
||||
@@ -194,16 +184,11 @@ public class CustomGuiLabel extends Gui implements IGuiComponent {
|
||||
this.strikethroughStyle = false;
|
||||
}
|
||||
|
||||
private int renderString(String p_78258_1_, int p_78258_2_, int p_78258_3_, int p_78258_4_, boolean p_78258_5_, int mouseX, int mouseY)
|
||||
{
|
||||
if (p_78258_1_ == null)
|
||||
{
|
||||
private int renderString(String p_78258_1_, int p_78258_2_, int p_78258_3_, int p_78258_4_, boolean p_78258_5_, int mouseX, int mouseY) {
|
||||
if (p_78258_1_ == null) {
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.bidiFlag)
|
||||
{
|
||||
} else {
|
||||
if (this.bidiFlag) {
|
||||
p_78258_1_ = this.bidiReorder(p_78258_1_);
|
||||
}
|
||||
|
||||
@@ -219,7 +204,7 @@ public class CustomGuiLabel extends Gui implements IGuiComponent {
|
||||
char c = p_78258_1_.charAt(i);
|
||||
|
||||
boolean formatSymbol = c == '&' && i < p_78258_1_.length() - 1
|
||||
&& "0123456789abcdefklmnor".indexOf(p_78258_1_.toLowerCase().charAt(i + 1)) != -1;
|
||||
&& "0123456789abcdefklmnor".indexOf(p_78258_1_.toLowerCase().charAt(i + 1)) != -1;
|
||||
if (formatSymbol) {
|
||||
String format = "" + c + p_78258_1_.toLowerCase().charAt(i + 1);
|
||||
if (!format.equals("&r")) {
|
||||
@@ -242,18 +227,18 @@ public class CustomGuiLabel extends Gui implements IGuiComponent {
|
||||
}
|
||||
}
|
||||
setColor(this.red, this.green, this.blue, this.alpha);
|
||||
this.posX = (float)p_78258_2_;
|
||||
this.posY = (float)p_78258_3_ + height * ClientProxy.Font.height() * 0.75F;
|
||||
this.posX = (float) p_78258_2_;
|
||||
this.posY = (float) p_78258_3_ + height * ClientProxy.Font.height() * 0.75F;
|
||||
|
||||
endX = Math.max(endX,this.posX + ClientProxy.Font.width(s.toString()));
|
||||
endX = Math.max(endX, this.posX + ClientProxy.Font.width(s.toString()));
|
||||
endY = this.posY + ClientProxy.Font.height() * 0.75F;
|
||||
|
||||
this.renderStringAtPos(s.toString().trim(), p_78258_5_);
|
||||
height++;
|
||||
if (i >= p_78258_1_.length()-1 || height * ClientProxy.Font.height() * 0.75F >= this.height) {
|
||||
if (i >= p_78258_1_.length() - 1 || height * ClientProxy.Font.height() * 0.75F >= this.height) {
|
||||
break;
|
||||
}
|
||||
p_78258_1_ = p_78258_1_.substring(i+1);
|
||||
p_78258_1_ = p_78258_1_.substring(i + 1);
|
||||
}
|
||||
|
||||
float textWidth = this.scale * endX;
|
||||
@@ -264,64 +249,47 @@ public class CustomGuiLabel extends Gui implements IGuiComponent {
|
||||
this.parent.hoverText = this.hoverText;
|
||||
}
|
||||
|
||||
return (int)this.posX;
|
||||
return (int) this.posX;
|
||||
}
|
||||
}
|
||||
|
||||
private void renderStringAtPos(String p_78255_1_, boolean p_78255_2_)
|
||||
{
|
||||
for (int i = 0; i < p_78255_1_.length(); ++i)
|
||||
{
|
||||
private void renderStringAtPos(String p_78255_1_, boolean p_78255_2_) {
|
||||
for (int i = 0; i < p_78255_1_.length(); ++i) {
|
||||
char c0 = p_78255_1_.charAt(i);
|
||||
int j;
|
||||
int k;
|
||||
|
||||
if (c0 == 38 && i + 1 < p_78255_1_.length())
|
||||
{
|
||||
if (c0 == 38 && i + 1 < p_78255_1_.length()) {
|
||||
j = "0123456789abcdefklmnor".indexOf(p_78255_1_.toLowerCase().charAt(i + 1));
|
||||
|
||||
if(j < 16){
|
||||
if (j < 16) {
|
||||
this.randomStyle = false;
|
||||
this.boldStyle = false;
|
||||
this.strikethroughStyle = false;
|
||||
this.underlineStyle = false;
|
||||
this.italicStyle = false;
|
||||
|
||||
if (j < 0 || j > 15)
|
||||
{
|
||||
if (j < 0 || j > 15) {
|
||||
j = 15;
|
||||
}
|
||||
|
||||
if (p_78255_2_)
|
||||
{
|
||||
if (p_78255_2_) {
|
||||
j += 16;
|
||||
}
|
||||
|
||||
k = this.colorCode[j];
|
||||
setColor((float)(k >> 16) / 255.0F, (float)(k >> 8 & 255) / 255.0F, (float)(k & 255) / 255.0F, this.alpha);
|
||||
}
|
||||
else if (j == 16)
|
||||
{
|
||||
setColor((float) (k >> 16) / 255.0F, (float) (k >> 8 & 255) / 255.0F, (float) (k & 255) / 255.0F, this.alpha);
|
||||
} else if (j == 16) {
|
||||
this.randomStyle = true;
|
||||
}
|
||||
else if (j == 17)
|
||||
{
|
||||
} else if (j == 17) {
|
||||
this.boldStyle = true;
|
||||
}
|
||||
else if (j == 18)
|
||||
{
|
||||
} else if (j == 18) {
|
||||
this.strikethroughStyle = true;
|
||||
}
|
||||
else if (j == 19)
|
||||
{
|
||||
} else if (j == 19) {
|
||||
this.underlineStyle = true;
|
||||
}
|
||||
else if (j == 20)
|
||||
{
|
||||
} else if (j == 20) {
|
||||
this.italicStyle = true;
|
||||
}
|
||||
else if (j == 21)
|
||||
{
|
||||
} else if (j == 21) {
|
||||
this.randomStyle = false;
|
||||
this.boldStyle = false;
|
||||
this.strikethroughStyle = false;
|
||||
@@ -330,15 +298,11 @@ public class CustomGuiLabel extends Gui implements IGuiComponent {
|
||||
}
|
||||
|
||||
++i;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
j = "\u00c0\u00c1\u00c2\u00c8\u00ca\u00cb\u00cd\u00d3\u00d4\u00d5\u00da\u00df\u00e3\u00f5\u011f\u0130\u0131\u0152\u0153\u015e\u015f\u0174\u0175\u017e\u0207\u0000\u0000\u0000\u0000\u0000\u0000\u0000 !\"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0000\u00c7\u00fc\u00e9\u00e2\u00e4\u00e0\u00e5\u00e7\u00ea\u00eb\u00e8\u00ef\u00ee\u00ec\u00c4\u00c5\u00c9\u00e6\u00c6\u00f4\u00f6\u00f2\u00fb\u00f9\u00ff\u00d6\u00dc\u00f8\u00a3\u00d8\u00d7\u0192\u00e1\u00ed\u00f3\u00fa\u00f1\u00d1\u00aa\u00ba\u00bf\u00ae\u00ac\u00bd\u00bc\u00a1\u00ab\u00bb\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255d\u255c\u255b\u2510\u2514\u2534\u252c\u251c\u2500\u253c\u255e\u255f\u255a\u2554\u2569\u2566\u2560\u2550\u256c\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256b\u256a\u2518\u250c\u2588\u2584\u258c\u2590\u2580\u03b1\u03b2\u0393\u03c0\u03a3\u03c3\u03bc\u03c4\u03a6\u0398\u03a9\u03b4\u221e\u2205\u2208\u2229\u2261\u00b1\u2265\u2264\u2320\u2321\u00f7\u2248\u00b0\u2219\u00b7\u221a\u207f\u00b2\u25a0\u0000".indexOf(c0);
|
||||
|
||||
if (this.randomStyle && j != -1)
|
||||
{
|
||||
do
|
||||
{
|
||||
if (this.randomStyle && j != -1) {
|
||||
do {
|
||||
k = Minecraft.getMinecraft().fontRenderer.fontRandom.nextInt(this.charWidth.length);
|
||||
}
|
||||
while (this.charWidth[j] != this.charWidth[k]);
|
||||
@@ -349,26 +313,22 @@ public class CustomGuiLabel extends Gui implements IGuiComponent {
|
||||
float f1 = this.unicodeFlag ? 0.5F : 1.0F;
|
||||
boolean flag1 = (c0 == 0 || j == -1 || this.unicodeFlag) && p_78255_2_;
|
||||
|
||||
if (flag1)
|
||||
{
|
||||
if (flag1) {
|
||||
this.posX -= f1;
|
||||
this.posY -= f1;
|
||||
}
|
||||
|
||||
float f = this.renderCharAtPos(j, c0, this.italicStyle);
|
||||
|
||||
if (flag1)
|
||||
{
|
||||
if (flag1) {
|
||||
this.posX += f1;
|
||||
this.posY += f1;
|
||||
}
|
||||
|
||||
if (this.boldStyle)
|
||||
{
|
||||
if (this.boldStyle) {
|
||||
this.posX += f1;
|
||||
|
||||
if (flag1)
|
||||
{
|
||||
if (flag1) {
|
||||
this.posX -= f1;
|
||||
this.posY -= f1;
|
||||
}
|
||||
@@ -376,8 +336,7 @@ public class CustomGuiLabel extends Gui implements IGuiComponent {
|
||||
this.renderCharAtPos(j, c0, this.italicStyle);
|
||||
this.posX -= f1;
|
||||
|
||||
if (flag1)
|
||||
{
|
||||
if (flag1) {
|
||||
this.posX += f1;
|
||||
this.posY += f1;
|
||||
}
|
||||
@@ -390,56 +349,51 @@ public class CustomGuiLabel extends Gui implements IGuiComponent {
|
||||
}
|
||||
}
|
||||
|
||||
protected void doDraw(float f)
|
||||
{
|
||||
protected void doDraw(float f) {
|
||||
{
|
||||
{
|
||||
Tessellator tessellator;
|
||||
|
||||
if (this.strikethroughStyle)
|
||||
{
|
||||
if (this.strikethroughStyle) {
|
||||
tessellator = Tessellator.instance;
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertex((double)this.posX, (double)(this.posY + (float)(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT / 2)), 0.0D);
|
||||
tessellator.addVertex((double)(this.posX + f), (double)(this.posY + (float)(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT / 2)), 0.0D);
|
||||
tessellator.addVertex((double)(this.posX + f), (double)(this.posY + (float)(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT / 2) - 1.0F), 0.0D);
|
||||
tessellator.addVertex((double)this.posX, (double)(this.posY + (float)(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT / 2) - 1.0F), 0.0D);
|
||||
tessellator.addVertex((double) this.posX, (double) (this.posY + (float) (Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT / 2)), 0.0D);
|
||||
tessellator.addVertex((double) (this.posX + f), (double) (this.posY + (float) (Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT / 2)), 0.0D);
|
||||
tessellator.addVertex((double) (this.posX + f), (double) (this.posY + (float) (Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT / 2) - 1.0F), 0.0D);
|
||||
tessellator.addVertex((double) this.posX, (double) (this.posY + (float) (Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT / 2) - 1.0F), 0.0D);
|
||||
tessellator.draw();
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
if (this.underlineStyle)
|
||||
{
|
||||
if (this.underlineStyle) {
|
||||
tessellator = Tessellator.instance;
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
tessellator.startDrawingQuads();
|
||||
int l = this.underlineStyle ? -1 : 0;
|
||||
tessellator.addVertex((double)(this.posX + (float)l), (double)(this.posY + (float)Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT), 0.0D);
|
||||
tessellator.addVertex((double)(this.posX + f), (double)(this.posY + (float)Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT), 0.0D);
|
||||
tessellator.addVertex((double)(this.posX + f), (double)(this.posY + (float)Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT - 1.0F), 0.0D);
|
||||
tessellator.addVertex((double)(this.posX + (float)l), (double)(this.posY + (float)Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT - 1.0F), 0.0D);
|
||||
tessellator.addVertex((double) (this.posX + (float) l), (double) (this.posY + (float) Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT), 0.0D);
|
||||
tessellator.addVertex((double) (this.posX + f), (double) (this.posY + (float) Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT), 0.0D);
|
||||
tessellator.addVertex((double) (this.posX + f), (double) (this.posY + (float) Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT - 1.0F), 0.0D);
|
||||
tessellator.addVertex((double) (this.posX + (float) l), (double) (this.posY + (float) Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT - 1.0F), 0.0D);
|
||||
tessellator.draw();
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
this.posX += (float)((int)f);
|
||||
this.posX += (float) ((int) f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private float renderCharAtPos(int p_78278_1_, char p_78278_2_, boolean p_78278_3_)
|
||||
{
|
||||
private float renderCharAtPos(int p_78278_1_, char p_78278_2_, boolean p_78278_3_) {
|
||||
return p_78278_2_ == 32 ? 4.0F : ("\u00c0\u00c1\u00c2\u00c8\u00ca\u00cb\u00cd\u00d3\u00d4\u00d5\u00da\u00df\u00e3\u00f5\u011f\u0130\u0131\u0152\u0153\u015e\u015f\u0174\u0175\u017e\u0207\u0000\u0000\u0000\u0000\u0000\u0000\u0000 !\"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0000\u00c7\u00fc\u00e9\u00e2\u00e4\u00e0\u00e5\u00e7\u00ea\u00eb\u00e8\u00ef\u00ee\u00ec\u00c4\u00c5\u00c9\u00e6\u00c6\u00f4\u00f6\u00f2\u00fb\u00f9\u00ff\u00d6\u00dc\u00f8\u00a3\u00d8\u00d7\u0192\u00e1\u00ed\u00f3\u00fa\u00f1\u00d1\u00aa\u00ba\u00bf\u00ae\u00ac\u00bd\u00bc\u00a1\u00ab\u00bb\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255d\u255c\u255b\u2510\u2514\u2534\u252c\u251c\u2500\u253c\u255e\u255f\u255a\u2554\u2569\u2566\u2560\u2550\u256c\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256b\u256a\u2518\u250c\u2588\u2584\u258c\u2590\u2580\u03b1\u03b2\u0393\u03c0\u03a3\u03c3\u03bc\u03c4\u03a6\u0398\u03a9\u03b4\u221e\u2205\u2208\u2229\u2261\u00b1\u2265\u2264\u2320\u2321\u00f7\u2248\u00b0\u2219\u00b7\u221a\u207f\u00b2\u25a0\u0000".indexOf(p_78278_2_) != -1 && !this.unicodeFlag ? this.renderDefaultChar(p_78278_1_, p_78278_3_) : this.renderUnicodeChar(p_78278_2_, p_78278_3_));
|
||||
}
|
||||
|
||||
protected float renderDefaultChar(int p_78266_1_, boolean p_78266_2_)
|
||||
{
|
||||
float f = (float)(p_78266_1_ % 16 * 8);
|
||||
float f1 = (float)(p_78266_1_ / 16 * 8);
|
||||
protected float renderDefaultChar(int p_78266_1_, boolean p_78266_2_) {
|
||||
float f = (float) (p_78266_1_ % 16 * 8);
|
||||
float f1 = (float) (p_78266_1_ / 16 * 8);
|
||||
float f2 = p_78266_2_ ? 1.0F : 0.0F;
|
||||
bindTexture(this.locationFontTexture);
|
||||
float f3 = (float)this.charWidth[p_78266_1_] - 0.01F;
|
||||
float f3 = (float) this.charWidth[p_78266_1_] - 0.01F;
|
||||
GL11.glBegin(GL11.GL_TRIANGLE_STRIP);
|
||||
GL11.glTexCoord2f(f / 128.0F, f1 / 128.0F);
|
||||
GL11.glVertex3f(this.posX + f2, this.posY, 0.0F);
|
||||
@@ -450,43 +404,36 @@ public class CustomGuiLabel extends Gui implements IGuiComponent {
|
||||
GL11.glTexCoord2f((f + f3 - 1.0F) / 128.0F, (f1 + 7.99F) / 128.0F);
|
||||
GL11.glVertex3f(this.posX + f3 - 1.0F - f2, this.posY + 7.99F, 0.0F);
|
||||
GL11.glEnd();
|
||||
return (float)this.charWidth[p_78266_1_];
|
||||
return (float) this.charWidth[p_78266_1_];
|
||||
}
|
||||
|
||||
private ResourceLocation getUnicodePageLocation(int p_111271_1_)
|
||||
{
|
||||
if (unicodePageLocations[p_111271_1_] == null)
|
||||
{
|
||||
unicodePageLocations[p_111271_1_] = new ResourceLocation(String.format("textures/font/unicode_page_%02x.png", new Object[] {Integer.valueOf(p_111271_1_)}));
|
||||
private ResourceLocation getUnicodePageLocation(int p_111271_1_) {
|
||||
if (unicodePageLocations[p_111271_1_] == null) {
|
||||
unicodePageLocations[p_111271_1_] = new ResourceLocation(String.format("textures/font/unicode_page_%02x.png", new Object[]{Integer.valueOf(p_111271_1_)}));
|
||||
}
|
||||
|
||||
return unicodePageLocations[p_111271_1_];
|
||||
}
|
||||
|
||||
private void loadGlyphTexture(int p_78257_1_)
|
||||
{
|
||||
private void loadGlyphTexture(int p_78257_1_) {
|
||||
bindTexture(this.getUnicodePageLocation(p_78257_1_));
|
||||
}
|
||||
|
||||
/**
|
||||
* Render a single Unicode character at current (posX,posY) location using one of the /font/glyph_XX.png files...
|
||||
*/
|
||||
protected float renderUnicodeChar(char p_78277_1_, boolean p_78277_2_)
|
||||
{
|
||||
if (this.glyphWidth[p_78277_1_] == 0)
|
||||
{
|
||||
protected float renderUnicodeChar(char p_78277_1_, boolean p_78277_2_) {
|
||||
if (this.glyphWidth[p_78277_1_] == 0) {
|
||||
return 0.0F;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
int i = p_78277_1_ / 256;
|
||||
this.loadGlyphTexture(i);
|
||||
int j = this.glyphWidth[p_78277_1_] >>> 4;
|
||||
int k = this.glyphWidth[p_78277_1_] & 15;
|
||||
float f = (float)j;
|
||||
float f1 = (float)(k + 1);
|
||||
float f2 = (float)(p_78277_1_ % 16 * 16) + f;
|
||||
float f3 = (float)((p_78277_1_ & 255) / 16 * 16);
|
||||
float f = (float) j;
|
||||
float f1 = (float) (k + 1);
|
||||
float f2 = (float) (p_78277_1_ % 16 * 16) + f;
|
||||
float f3 = (float) ((p_78277_1_ & 255) / 16 * 16);
|
||||
float f4 = f1 - f - 0.02F;
|
||||
float f5 = p_78277_2_ ? 1.0F : 0.0F;
|
||||
GL11.glBegin(GL11.GL_TRIANGLE_STRIP);
|
||||
@@ -503,26 +450,20 @@ public class CustomGuiLabel extends Gui implements IGuiComponent {
|
||||
}
|
||||
}
|
||||
|
||||
protected void setColor(float r, float g, float b, float a)
|
||||
{
|
||||
protected void setColor(float r, float g, float b, float a) {
|
||||
GL11.glColor4f(r, g, b, a);
|
||||
}
|
||||
|
||||
protected void bindTexture(ResourceLocation location)
|
||||
{
|
||||
protected void bindTexture(ResourceLocation location) {
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(location);
|
||||
}
|
||||
|
||||
private void readFontTexture()
|
||||
{
|
||||
private void readFontTexture() {
|
||||
BufferedImage bufferedimage;
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
bufferedimage = ImageIO.read(getResourceInputStream(this.locationFontTexture));
|
||||
}
|
||||
catch (IOException ioexception)
|
||||
{
|
||||
} catch (IOException ioexception) {
|
||||
throw new RuntimeException(ioexception);
|
||||
}
|
||||
|
||||
@@ -533,81 +474,65 @@ public class CustomGuiLabel extends Gui implements IGuiComponent {
|
||||
int k = j / 16;
|
||||
int l = i / 16;
|
||||
byte b0 = 1;
|
||||
float f = 8.0F / (float)l;
|
||||
float f = 8.0F / (float) l;
|
||||
int i1 = 0;
|
||||
|
||||
while (i1 < 256)
|
||||
{
|
||||
while (i1 < 256) {
|
||||
int j1 = i1 % 16;
|
||||
int k1 = i1 / 16;
|
||||
|
||||
if (i1 == 32)
|
||||
{
|
||||
if (i1 == 32) {
|
||||
this.charWidth[i1] = 3 + b0;
|
||||
}
|
||||
|
||||
int l1 = l - 1;
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (l1 >= 0)
|
||||
{
|
||||
while (true) {
|
||||
if (l1 >= 0) {
|
||||
int i2 = j1 * l + l1;
|
||||
boolean flag = true;
|
||||
|
||||
for (int j2 = 0; j2 < k && flag; ++j2)
|
||||
{
|
||||
for (int j2 = 0; j2 < k && flag; ++j2) {
|
||||
int k2 = (k1 * l + j2) * i;
|
||||
|
||||
if ((aint[i2 + k2] >> 24 & 255) != 0)
|
||||
{
|
||||
if ((aint[i2 + k2] >> 24 & 255) != 0) {
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (flag)
|
||||
{
|
||||
if (flag) {
|
||||
--l1;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
++l1;
|
||||
this.charWidth[i1] = (int)(0.5D + (double)((float)l1 * f)) + b0;
|
||||
this.charWidth[i1] = (int) (0.5D + (double) ((float) l1 * f)) + b0;
|
||||
++i1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void readGlyphSizes()
|
||||
{
|
||||
try
|
||||
{
|
||||
private void readGlyphSizes() {
|
||||
try {
|
||||
InputStream inputstream = getResourceInputStream(new ResourceLocation("font/glyph_sizes.bin"));
|
||||
inputstream.read(this.glyphWidth);
|
||||
}
|
||||
catch (IOException ioexception)
|
||||
{
|
||||
} catch (IOException ioexception) {
|
||||
throw new RuntimeException(ioexception);
|
||||
}
|
||||
}
|
||||
|
||||
protected InputStream getResourceInputStream(ResourceLocation location) throws IOException
|
||||
{
|
||||
protected InputStream getResourceInputStream(ResourceLocation location) throws IOException {
|
||||
return Minecraft.getMinecraft().getResourceManager().getResource(location).getInputStream();
|
||||
}
|
||||
|
||||
private String bidiReorder(String p_147647_1_)
|
||||
{
|
||||
try
|
||||
{
|
||||
private String bidiReorder(String p_147647_1_) {
|
||||
try {
|
||||
Bidi bidi = new Bidi((new ArabicShaping(8)).shape(p_147647_1_), 127);
|
||||
bidi.setReorderingMode(0);
|
||||
return bidi.writeReordered(2);
|
||||
}
|
||||
catch (ArabicShapingException arabicshapingexception)
|
||||
{
|
||||
} catch (ArabicShapingException arabicshapingexception) {
|
||||
return p_147647_1_;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ public class CustomGuiLine extends Gui implements IGuiComponent {
|
||||
float rotation;
|
||||
int thickness;
|
||||
|
||||
public CustomGuiLine(int id, int x1, int y1, int x2, int y2, int color, int thickness){
|
||||
public CustomGuiLine(int id, int x1, int y1, int x2, int y2, int color, int thickness) {
|
||||
this.id = id;
|
||||
this.x1 = x1;
|
||||
this.y1 = y1;
|
||||
@@ -41,25 +41,25 @@ public class CustomGuiLine extends Gui implements IGuiComponent {
|
||||
}
|
||||
|
||||
public void onRender(Minecraft mc, int mouseX, int mouseY, int mouseWheel, float partialTicks) {
|
||||
double distance = Math.sqrt(Math.pow(x1-x2,2)+Math.pow(y1-y2,2));
|
||||
double distance = Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2));
|
||||
|
||||
mc.getTextureManager().bindTexture(new ResourceLocation("customnpcs:textures/gui/misc.png"));
|
||||
GL11.glPushMatrix();
|
||||
float red = (color >> 16 & 255) / 255f;
|
||||
float green = (color >> 8 & 255) / 255f;
|
||||
float blue = (color & 255) / 255f;
|
||||
GL11.glColor4f(red,green,blue,this.alpha);
|
||||
float red = (color >> 16 & 255) / 255f;
|
||||
float green = (color >> 8 & 255) / 255f;
|
||||
float blue = (color & 255) / 255f;
|
||||
GL11.glColor4f(red, green, blue, this.alpha);
|
||||
|
||||
GL11.glTranslatef(GuiCustom.guiLeft+this.x1,GuiCustom.guiTop+this.y1,(float)this.id);
|
||||
GL11.glRotated(-Math.toDegrees(Math.atan2(x2-x1,y2-y1)),0.0F,0.0F,1.0F);
|
||||
GL11.glRotated(rotation,0.0D,0.0D,1.0D);
|
||||
GL11.glScaled(thickness, distance,0.0D);
|
||||
this.drawTexturedModalRect(0,0,0,0, 1, 1);
|
||||
GL11.glTranslatef(GuiCustom.guiLeft + this.x1, GuiCustom.guiTop + this.y1, (float) this.id);
|
||||
GL11.glRotated(-Math.toDegrees(Math.atan2(x2 - x1, y2 - y1)), 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotated(rotation, 0.0D, 0.0D, 1.0D);
|
||||
GL11.glScaled(thickness, distance, 0.0D);
|
||||
this.drawTexturedModalRect(0, 0, 0, 0, 1, 1);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public ICustomGuiComponent toComponent() {
|
||||
ScriptGuiLine line = new ScriptGuiLine(this.id, this.x1,this.y1,this.x2,this.y2,this.color,this.thickness);
|
||||
ScriptGuiLine line = new ScriptGuiLine(this.id, this.x1, this.y1, this.x2, this.y2, this.color, this.thickness);
|
||||
line.setColor(this.color);
|
||||
line.setAlpha(this.alpha);
|
||||
line.setRotation(this.rotation);
|
||||
|
||||
+13
-13
@@ -40,17 +40,17 @@ public class CustomGuiScrollComponent extends GuiCustomScroll implements IDataHo
|
||||
|
||||
public void onRender(Minecraft mc, int mouseX, int mouseY, int mouseWheel, float partialTicks) {
|
||||
GL11.glPushMatrix();
|
||||
float red = (color >> 16 & 255) / 255f;
|
||||
float green = (color >> 8 & 255) / 255f;
|
||||
float blue = (color & 255) / 255f;
|
||||
GL11.glColor4f(red,green,blue,this.alpha);
|
||||
float red = (color >> 16 & 255) / 255f;
|
||||
float green = (color >> 8 & 255) / 255f;
|
||||
float blue = (color & 255) / 255f;
|
||||
GL11.glColor4f(red, green, blue, this.alpha);
|
||||
|
||||
GL11.glTranslatef(0.0F, 0.0F, (float)this.id);
|
||||
boolean hovered = mouseX >= this.guiLeft && mouseY >= this.guiTop && mouseX < this.guiLeft + this.xSize && mouseY < this.guiTop + this.ySize;
|
||||
super.drawScreen(mouseX, mouseY, partialTicks, mouseWheel);
|
||||
if (hovered && this.hoverText != null && this.hoverText.length > 0) {
|
||||
this.parent.hoverText = this.hoverText;
|
||||
}
|
||||
GL11.glTranslatef(0.0F, 0.0F, (float) this.id);
|
||||
boolean hovered = mouseX >= this.guiLeft && mouseY >= this.guiTop && mouseX < this.guiLeft + this.xSize && mouseY < this.guiTop + this.ySize;
|
||||
super.drawScreen(mouseX, mouseY, partialTicks, mouseWheel);
|
||||
if (hovered && this.hoverText != null && this.hoverText.length > 0) {
|
||||
this.parent.hoverText = this.hoverText;
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ public class CustomGuiScrollComponent extends GuiCustomScroll implements IDataHo
|
||||
}
|
||||
|
||||
public ICustomGuiComponent toComponent() {
|
||||
ScriptGuiScroll component = new ScriptGuiScroll(this.id, this.guiLeft - GuiCustom.guiLeft, this.guiTop - GuiCustom.guiTop, this.xSize, this.ySize, (String[])this.getList().toArray(new String[0]));
|
||||
ScriptGuiScroll component = new ScriptGuiScroll(this.id, this.guiLeft - GuiCustom.guiLeft, this.guiTop - GuiCustom.guiTop, this.xSize, this.ySize, (String[]) this.getList().toArray(new String[0]));
|
||||
component.setHoverText(this.hoverText);
|
||||
component.setColor(color);
|
||||
component.setAlpha(alpha);
|
||||
@@ -94,8 +94,8 @@ public class CustomGuiScrollComponent extends GuiCustomScroll implements IDataHo
|
||||
NBTTagList tagList = new NBTTagList();
|
||||
Iterator var3 = this.getSelectedList().iterator();
|
||||
|
||||
while(var3.hasNext()) {
|
||||
String s = (String)var3.next();
|
||||
while (var3.hasNext()) {
|
||||
String s = (String) var3.next();
|
||||
tagList.appendTag(new NBTTagString(s));
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ public class CustomGuiSlot extends Slot {
|
||||
|
||||
@Override
|
||||
public void onSlotChanged() {
|
||||
if(!player.worldObj.isRemote){
|
||||
if (!player.worldObj.isRemote) {
|
||||
boolean changed;
|
||||
if (getStack() != null && slot.getStack() != null) {
|
||||
changed = !getStack().equals(slot.getStack().getMCItemStack());
|
||||
@@ -33,10 +33,10 @@ public class CustomGuiSlot extends Slot {
|
||||
// Handle the case when either getStack() or slot.getStack() is null (indicating an empty slot)
|
||||
changed = getStack() != null || slot.getStack() != null;
|
||||
}
|
||||
if(changed) {
|
||||
if (changed) {
|
||||
slot.setStack(NpcAPI.Instance().getIItemStack(getStack()));
|
||||
if (player.openContainer instanceof ContainerCustomGui) {
|
||||
EventHooks.onCustomGuiSlot((IPlayer) NpcAPI.Instance().getIEntity(player), ((ContainerCustomGui)player.openContainer).customGui,
|
||||
EventHooks.onCustomGuiSlot((IPlayer) NpcAPI.Instance().getIEntity(player), ((ContainerCustomGui) player.openContainer).customGui,
|
||||
getSlotIndex(), getStack(), slot);
|
||||
}
|
||||
}
|
||||
|
||||
Loaded 100 of 1179 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user