diff --git a/src/main/java/foxz/command/CmdClone.java b/src/main/java/foxz/command/CmdClone.java new file mode 100644 index 000000000..84b34fdc6 --- /dev/null +++ b/src/main/java/foxz/command/CmdClone.java @@ -0,0 +1,286 @@ +package foxz.command; + +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.command.CommandBase; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityList; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import noppes.npcs.controllers.ServerCloneController; +import noppes.npcs.entity.EntityNPCInterface; +import foxz.commandhelper.ChMcLogger; +import foxz.commandhelper.annotations.Command; +import foxz.commandhelper.annotations.SubCommand; +import foxz.commandhelper.permissions.OpOnly; +import foxz.commandhelper.permissions.ParamCheck; +import foxz.commandhelper.permissions.PlayerOnly; +import foxz.utils.Utils; + +@Command( + name = "clone", + desc = "Clone operation (server side)" +) +public class CmdClone extends ChMcLogger { + + public CmdClone(Object sender) { + super(sender); + } + + @SubCommand( + desc = "Add NPC(s) to clone storage", + usage = " [clonedname]", + permissions = {OpOnly.class ,PlayerOnly.class, ParamCheck.class} + ) + public Boolean add(String[] args) { + EntityPlayerMP player = (EntityPlayerMP) pcParam; + int tab = 0; + try{ + tab = Integer.parseInt(args[1]); + } + catch(NumberFormatException ex){ + + } + List list = Utils.getNearbeEntityFromPlayer(EntityNPCInterface.class, player, 80); + for (EntityNPCInterface npc : list) { + if (npc.display.name.equalsIgnoreCase(args[0])) { + String name = npc.display.name; + if (args.length > 2) { + name = args[2]; + } + NBTTagCompound compound = new NBTTagCompound(); + if(!npc.writeToNBTOptional(compound)) + return false; + ServerCloneController.Instance.addClone(compound, name, tab); + return true; + } + } + return true; + } + + @SubCommand(desc = "List NPC from clone storage", usage = "", permissions={OpOnly.class ,ParamCheck.class}) + public Boolean list(String[] args) { + sendmessage("--- Stored NPCs --- (server side)"); + int tab = 0; + try{ + tab = Integer.parseInt(args[0]); + } + catch(NumberFormatException ex){ + + } + for (String name : ServerCloneController.Instance.getClones(tab)) { + sendmessage(name); + } + sendmessage("------------------------------------"); + return true; + } + + @SubCommand(desc = "Remove NPC from clone storage", usage = " ", permissions={OpOnly.class ,ParamCheck.class}) + public Boolean del(String[] args) { + String nametodel = args[0]; + int tab = 0; + try{ + tab = Integer.parseInt(args[1]); + } + catch(NumberFormatException ex){ + + } + boolean deleted = false; + for(String name : ServerCloneController.Instance.getClones(tab)){ + if(nametodel.equalsIgnoreCase(name)){ + ServerCloneController.Instance.removeClone(name, tab); + deleted = true; + break; + } + } + if (!ServerCloneController.Instance.removeClone(nametodel, tab)) { + sendmessage(String.format("Npc '%s' wasn't found", nametodel)); + return false; + } + ; + return true; + } + + @SubCommand( + desc = "Spawn cloned NPC", + usage = " [[world:]x,y,z]] [newname]", + permissions={OpOnly.class ,ParamCheck.class}) + public boolean spawn(String[] args) { + String name = args[0].replaceAll("%", " "); // if name of npc separed by space, user must use % in place of space + int tab = 0; + try{ + tab = Integer.parseInt(args[1]); + } + catch(NumberFormatException ex){ + + } + String newname=null; + NBTTagCompound compound = ServerCloneController.Instance.getCloneData(this.pcParam, name, tab); + if(compound == null){ + sendmessage("Unknown npc"); + return false; + } + World world = pcParam.getEntityWorld(); + double posX = pcParam.getPlayerCoordinates().posX; + double posY = pcParam.getPlayerCoordinates().posY; + double posZ = pcParam.getPlayerCoordinates().posZ; + + if(args.length > 2){ + String location = args[2]; + String[] par; + if (location.contains(":")){ + par = location.split(":"); + location = par[1]; + world = Utils.getWorld(par[0]); + if (world == null){ + sendmessage (String.format("'%s' is an unknown world",par[0])); + return false; + } + } + + if (location.contains(",")){ + par = location.split(","); + if (par.length != 3){ + sendmessage("Location need be x,y,z"); + return false; + } + try{ + posX = CommandBase.func_110666_a(pcParam, posX, par[0]); + posY = CommandBase.func_110665_a(pcParam, posY, par[1].trim(), 0, 0); + posZ = CommandBase.func_110666_a(pcParam, posZ, par[2]); + } catch(NumberFormatException ex){ + sendmessage("Location should be in numbers"); + return false; + } + if (args.length > 3){ + newname = args[3]; + } + } else { + newname = location; + } + } + + if (posX == 0 && posY == 0 && posZ == 0){//incase it was called from the console and not pos was given + sendmessage ("Location needed"); + return false; + } + + Entity entity = EntityList.createEntityFromNBT(compound, world); + entity.setPosition(posX + 0.5, posY + 1, posZ + 0.5); + if(entity instanceof EntityNPCInterface){ + EntityNPCInterface npc = (EntityNPCInterface) entity; + npc.ai.startPos = new int[]{MathHelper.floor_double(posX), MathHelper.floor_double(posY), MathHelper.floor_double(posZ)}; + if(newname != null && !newname.isEmpty()) + npc.display.name = newname.replaceAll("%", " "); // like name, newname must use % in place of space to keep a logical way + } + world.spawnEntityInWorld(entity); + return true; + } + + @SubCommand( + desc = "Spawn cloned NPC", + usage = " [[world:]x,y,z]] [newname]", + permissions={OpOnly.class ,ParamCheck.class}) + public boolean grid(String[] args) { + String name = args[0].replaceAll("%", " "); // if name of npc separed by space, user must use % in place of space + int tab = 0; + try{ + tab = Integer.parseInt(args[1]); + } + catch(NumberFormatException ex){ + + } + + int width, height; + try{ + width = Integer.parseInt(args[2]); + height = Integer.parseInt(args[3]); + } + catch(NumberFormatException ex){ + sendmessage("lenght or width wasnt a number"); + return false; + } + + + String newname=null; + NBTTagCompound compound = ServerCloneController.Instance.getCloneData(this.pcParam, name, tab); + if(compound == null){ + sendmessage("Unknown npc"); + return false; + } + World world = pcParam.getEntityWorld(); + double posX = pcParam.getPlayerCoordinates().posX; + double posY = pcParam.getPlayerCoordinates().posY; + double posZ = pcParam.getPlayerCoordinates().posZ; + + if(args.length > 4){ + String location = args[4]; + String[] par; + if (location.contains(":")){ + par = location.split(":"); + location = par[1]; + world = Utils.getWorld(par[0]); + if (world == null){ + sendmessage (String.format("'%s' is an unknown world",par[0])); + return false; + } + } + + if (location.contains(",")){ + par = location.split(","); + if (par.length != 3){ + sendmessage("Location need be x,y,z"); + return false; + } + try{ + posX = CommandBase.func_110666_a(pcParam, posX, par[0]); + posY = CommandBase.func_110665_a(pcParam, posY, par[1].trim(), 0, 0); + posZ = CommandBase.func_110666_a(pcParam, posZ, par[2]); + } catch(NumberFormatException ex){ + sendmessage("Location should be in numbers"); + return false; + } + if (args.length > 5){ + newname = args[5]; + } + } else { + newname = location; + } + } + + if (posX == 0 && posY == 0 && posZ == 0){//incase it was called from the console and not pos was given + sendmessage ("Location needed"); + return false; + } + + for(int x = 0; x < width; x++){ + for(int z = 0; z < height; z++){ + Entity entity = EntityList.createEntityFromNBT(compound, world); + int xx = MathHelper.floor_double(posX) + x; + int yy = Math.max(MathHelper.floor_double(posY) - 2, 1); + int zz = MathHelper.floor_double(posZ) + z; + + for(int y = 0; y < 10; y++){ + Block b = world.getBlock(xx, yy + y, zz); + Block b2 = world.getBlock(xx, yy + y + 1, zz); + if(b != null && (b2 == null || b2.getCollisionBoundingBoxFromPool(world, xx, yy + y + 1, zz) == null)){ + yy += y; + break; + } + } + entity.setPosition(posX + 0.5 + x, yy + 1, posZ + 0.5 + z); + if(entity instanceof EntityNPCInterface){ + EntityNPCInterface npc = (EntityNPCInterface) entity; + npc.ai.startPos = new int[]{xx, yy, zz}; + if(newname != null && !newname.isEmpty()) + npc.display.name = newname.replaceAll("%", " "); // like name, newname must use % in place of space to keep a logical way + } + world.spawnEntityInWorld(entity); + } + } + return true; + } +} diff --git a/src/main/java/foxz/command/CmdConfig.java b/src/main/java/foxz/command/CmdConfig.java new file mode 100644 index 000000000..3a3d3eabb --- /dev/null +++ b/src/main/java/foxz/command/CmdConfig.java @@ -0,0 +1,196 @@ +package foxz.command; + +import java.util.Arrays; +import java.util.Set; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockIce; +import net.minecraft.block.BlockLeavesBase; +import net.minecraft.block.BlockVine; +import net.minecraft.entity.player.EntityPlayerMP; +import noppes.npcs.CustomNpcs; +import noppes.npcs.Server; +import noppes.npcs.constants.EnumPacketClient; +import noppes.npcs.controllers.ChunkController; +import foxz.commandhelper.ChMcLogger; +import foxz.commandhelper.annotations.Command; +import foxz.commandhelper.annotations.SubCommand; +import foxz.commandhelper.permissions.OpOnly; +import foxz.commandhelper.permissions.PlayerOnly; + +@Command( + name="config", + desc="Some config things you can set ", + usage="" +) +public class CmdConfig extends ChMcLogger { + + public CmdConfig(Object sender) { + super (sender); + } + + @SubCommand( + desc="Disable/Enable the natural leaves decay", + usage="", + permissions={OpOnly.class}, + hasEmptyCall = true + ) + public boolean leavesdecay(String[] args){ + if(args.length == 0){ + sendmessage("LeavesDecay: " + CustomNpcs.LeavesDecayEnabled); + } + else{ + CustomNpcs.LeavesDecayEnabled = Boolean.parseBoolean(args[0]); + CustomNpcs.Config.updateConfig(); + Set names = Block.blockRegistry.getKeys(); + for(String name : names){ + Block block = (Block) Block.blockRegistry.getObject(name); + if(block instanceof BlockLeavesBase){ + block.setTickRandomly(CustomNpcs.LeavesDecayEnabled); + } + } + sendmessage("LeavesDecay is now " + CustomNpcs.LeavesDecayEnabled); + } + return true; + } + + @SubCommand( + desc="Disable/Enable the vines growing", + usage="", + permissions={OpOnly.class}, + hasEmptyCall = true + ) + public boolean vinegrowth(String[] args){ + if(args.length == 0){ + sendmessage("VineGrowth: " + CustomNpcs.VineGrowthEnabled); + } + else{ + CustomNpcs.VineGrowthEnabled = Boolean.parseBoolean(args[0]); + CustomNpcs.Config.updateConfig(); + Set names = Block.blockRegistry.getKeys(); + for(String name : names){ + Block block = (Block) Block.blockRegistry.getObject(name); + if(block instanceof BlockVine){ + block.setTickRandomly(CustomNpcs.VineGrowthEnabled); + } + } + sendmessage("VineGrowth is now " + CustomNpcs.VineGrowthEnabled); + } + return true; + } + + @SubCommand( + desc="Disable/Enable the ice melting", + usage="", + permissions={OpOnly.class}, + hasEmptyCall = true + ) + public boolean icemelts(String[] args){ + if(args.length == 0){ + sendmessage("IceMelts: " + CustomNpcs.IceMeltsEnabled); + } + else{ + CustomNpcs.IceMeltsEnabled = Boolean.parseBoolean(args[0]); + CustomNpcs.Config.updateConfig(); + Set names = Block.blockRegistry.getKeys(); + for(String name : names){ + Block block = (Block) Block.blockRegistry.getObject(name); + if(block instanceof BlockIce){ + block.setTickRandomly(CustomNpcs.IceMeltsEnabled); + } + } + sendmessage("IceMelts is now " + CustomNpcs.IceMeltsEnabled); + } + return true; + } + + @SubCommand( + desc="Disable/Enable guns shooting", + usage="", + permissions={OpOnly.class}, + hasEmptyCall = true + ) + public boolean guns(String[] args){ + if(args.length == 0){ + sendmessage("GunsEnabled: " + CustomNpcs.GunsEnabled); + } + else{ + CustomNpcs.GunsEnabled = Boolean.parseBoolean(args[0]); + CustomNpcs.Config.updateConfig(); + sendmessage("GunsEnabled is now " + CustomNpcs.GunsEnabled); + } + return true; + } + + @SubCommand( + desc="Freezes/Unfreezes npcs", + usage="", + permissions={OpOnly.class}, + hasEmptyCall = true + ) + public boolean freezenpcs(String[] args){ + if(args.length == 0){ + sendmessage("Frozen NPCs: " + CustomNpcs.FreezeNPCs); + } + else{ + CustomNpcs.FreezeNPCs = Boolean.parseBoolean(args[0]); + sendmessage("FrozenNPCs is now " + CustomNpcs.FreezeNPCs); + } + return true; + } + + @SubCommand( + desc="Set how many active chunkloaders you can have", + usage="", + permissions={OpOnly.class}, + hasEmptyCall = true + ) + public boolean chunkloaders(String[] args){ + if(args.length == 0){ + sendmessage("ChunkLoaders: " + ChunkController.instance.size() + "/" + CustomNpcs.ChuckLoaders); + } + else{ + try{ + CustomNpcs.ChuckLoaders = Integer.parseInt(args[0]); + } + catch(NumberFormatException ex){ + sendmessage("Didnt get a number"); + return false; + } + CustomNpcs.Config.updateConfig(); + + int size = ChunkController.instance.size(); + if(size > CustomNpcs.ChuckLoaders){ + ChunkController.instance.unload(size - CustomNpcs.ChuckLoaders); + sendmessage(size - CustomNpcs.ChuckLoaders + " chunksloaders unloaded"); + } + sendmessage("ChunkLoaders: " + ChunkController.instance.size() + "/" + CustomNpcs.ChuckLoaders); + } + return true; + } + + + @SubCommand( + desc="Get/Set font", + usage="[type] [size]", + permissions={PlayerOnly.class}, + hasEmptyCall = true + ) + public void font(String[] args){ + int size = 18; + if(args.length > 1){ + try{ + size = Integer.parseInt(args[args.length - 1]); + args = Arrays.copyOfRange(args, 0, args.length - 1); + } + catch(Exception e){ + + } + } + String font = ""; + for(int i = 0; i < args.length; i++){ + font += " " + args[i]; + } + Server.sendData((EntityPlayerMP)this.pcParam, EnumPacketClient.CONFIG, 0, font.trim(), size); + } +} diff --git a/src/main/java/foxz/command/CmdDialog.java b/src/main/java/foxz/command/CmdDialog.java new file mode 100644 index 000000000..79c88c0a3 --- /dev/null +++ b/src/main/java/foxz/command/CmdDialog.java @@ -0,0 +1,128 @@ +package foxz.command; + +import java.util.Arrays; +import java.util.List; + +import net.minecraft.command.CommandBase; +import net.minecraft.entity.player.EntityPlayer; +import noppes.npcs.NoppesUtilServer; +import noppes.npcs.client.EntityUtil; +import noppes.npcs.controllers.Dialog; +import noppes.npcs.controllers.DialogController; +import noppes.npcs.controllers.DialogOption; +import noppes.npcs.controllers.PlayerData; +import noppes.npcs.entity.EntityDialogNpc; +import foxz.commandhelper.ChMcLogger; +import foxz.commandhelper.annotations.Command; +import foxz.commandhelper.annotations.SubCommand; +import foxz.commandhelper.permissions.OpOnly; +import foxz.commandhelper.permissions.ParamCheck; + +@Command( + name="dialog", + desc="dialog operations", + usage="help" +) +public class CmdDialog extends ChMcLogger { + + public CmdDialog(Object sender) { + super(sender); + } + + + @SubCommand( + desc="force read", + usage=" ", + permissions={OpOnly.class, ParamCheck.class} + ) + public boolean read(String args[]){ + String playername=args[0]; + int diagid; + try { + diagid = Integer.parseInt(args[1]); + } catch (NumberFormatException ex) { + sendmessage("DialogID must be an integer"); + return false; + } + List data = getPlayersData(playername); + if (data.isEmpty()) { + sendmessage(String.format("Unknow player '%s'", playername)); + return false; + } + for(PlayerData playerdata : data){ + playerdata.dialogData.dialogsRead.add(diagid); + playerdata.saveNBTData(null); + } + return true; + } + + @SubCommand( + desc="force unread dialog", + usage=" ", + permissions={OpOnly.class, ParamCheck.class} + ) + public boolean unread(String args[]){ + String playername=args[0]; + int diagid; + try { + diagid = Integer.parseInt(args[1]); + } catch (NumberFormatException ex) { + sendmessage("DialogID must be an integer"); + return false; + } + List data = getPlayersData(playername); + if (data.isEmpty()) { + sendmessage(String.format("Unknow player '%s'", playername)); + return false; + } + for(PlayerData playerdata : data){ + playerdata.dialogData.dialogsRead.remove(diagid); + playerdata.saveNBTData(null); + } + return true; + } + @SubCommand( + desc="reload dialogs from disk", + permissions={OpOnly.class} + ) + public boolean reload(String args[]){ + new DialogController(); + return true; + } + + + @SubCommand( + desc="show dialog", + usage=" ", + permissions={OpOnly.class} + ) + public void show(String args[]){ + EntityPlayer player = CommandBase.getPlayer(pcParam, args[0]); + if(player == null){ + sendmessage(String.format("Unknow player '%s'", args[0])); + return; + } + + int diagid; + try { + diagid = Integer.parseInt(args[1]); + } catch (NumberFormatException ex) { + sendmessage("DialogID must be an integer: " + args[1]); + return; + } + Dialog dialog = DialogController.instance.dialogs.get(diagid); + if(dialog == null){ + sendmessage("Unknown dialog id: " + args[1]); + return; + } + + EntityDialogNpc npc = new EntityDialogNpc(this.pcParam.getEntityWorld()); + npc.display.name = args[2]; + EntityUtil.Copy(player, npc); + DialogOption option = new DialogOption(); + option.dialogId = diagid; + option.title = dialog.title; + npc.dialogs.put(0, option); + NoppesUtilServer.openDialog(player, npc, dialog); + } +} diff --git a/src/main/java/foxz/command/CmdFaction.java b/src/main/java/foxz/command/CmdFaction.java new file mode 100644 index 000000000..bd577e39b --- /dev/null +++ b/src/main/java/foxz/command/CmdFaction.java @@ -0,0 +1,115 @@ +package foxz.command; + +import java.util.List; + +import noppes.npcs.controllers.Faction; +import noppes.npcs.controllers.PlayerData; +import noppes.npcs.controllers.PlayerFactionData; +import foxz.commandhelper.ChMcLogger; +import foxz.commandhelper.annotations.Command; +import foxz.commandhelper.annotations.SubCommand; +import foxz.commandhelper.permissions.OpOnly; +import foxz.commandhelper.permissions.ParamCheck; + +@Command( + name = "faction", + desc = "operations about relationship between player and faction" +) +public class CmdFaction extends ChMcLogger { + + public String playername; + + public Faction selectedFaction; + public List data; + + public CmdFaction(Object sender) { + super(sender); + } + + @SubCommand( + desc = "Add points", + usage = "", + permissions={OpOnly.class, ParamCheck.class} + ) + public Boolean add(String[] args) { + int points; + try { + points = Integer.parseInt(args[0]); + } catch (NumberFormatException ex) { + sendmessage("Must be an integer"); + return false; + } + int factionid = this.selectedFaction.id; + + for(PlayerData playerdata : data){ + PlayerFactionData playerfactiondata = playerdata.factionData; + playerfactiondata.increasePoints(factionid, points); + } + return true; + } + + @SubCommand( + desc = "Substract points", + usage = "", + permissions={OpOnly.class, ParamCheck.class} + ) + public Boolean subtract(String[] args) { + int points; + try { + points = Integer.parseInt(args[0]); + } catch (NumberFormatException ex) { + sendmessage("Must be an integer"); + return false; + } + int factionid = this.selectedFaction.id; + for(PlayerData playerdata : data){ + PlayerFactionData playerfactiondata = playerdata.factionData; + playerfactiondata.increasePoints(factionid, -points); + } + return true; + } + + @SubCommand( + desc = "Reset points to default", + usage = "", + permissions={OpOnly.class} + ) + public Boolean reset(String[] args) { + for(PlayerData playerdata : data){ + playerdata.factionData.factionData.put(this.selectedFaction.id, this.selectedFaction.defaultPoints); + } + return true; + } + + @SubCommand( + desc = "Set points", + usage = "", + permissions={OpOnly.class, ParamCheck.class} + ) + public Boolean set(String[] args) { + int points; + try { + points = Integer.parseInt(args[0]); + } catch (NumberFormatException ex) { + sendmessage("Must be an integer"); + return false; + } + for(PlayerData playerdata : data){ + PlayerFactionData playerfactiondata = playerdata.factionData; + playerfactiondata.factionData.put(this.selectedFaction.id,points); + } + return true; + } + + @SubCommand( + desc="Drop relationship", + usage="", + permissions={OpOnly.class} + ) + public Boolean drop(String[] args){ + for(PlayerData playerdata : data){ + playerdata.factionData.factionData.remove(this.selectedFaction.id); + } + return true; + } +} diff --git a/src/main/java/foxz/command/CmdNoppes.java b/src/main/java/foxz/command/CmdNoppes.java new file mode 100644 index 000000000..d0ca4e546 --- /dev/null +++ b/src/main/java/foxz/command/CmdNoppes.java @@ -0,0 +1,268 @@ +package foxz.command; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import net.minecraft.command.CommandBase; +import net.minecraft.command.ICommandSender; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityList; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.boss.EntityDragon; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.item.EntityXPOrb; +import net.minecraft.entity.monster.EntityGhast; +import net.minecraft.entity.monster.EntityMob; +import net.minecraft.entity.passive.EntityAnimal; +import net.minecraft.entity.passive.EntityHorse; +import net.minecraft.entity.passive.EntityTameable; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.ChatComponentTranslation; +import noppes.npcs.controllers.FactionController; +import noppes.npcs.controllers.PlayerData; +import noppes.npcs.entity.EntityNPCInterface; +import foxz.commandhelper.ChMcLogger; +import foxz.commandhelper.annotations.Command; +import foxz.commandhelper.annotations.SubCommand; +import foxz.commandhelper.permissions.OpOnly; +import foxz.commandhelper.permissions.ParamCheck; +import foxz.commandhelper.permissions.PlayerOnly; +import foxz.utils.Utils; + +@Command( + name = "noppes", + desc = "noppes root command", + sub = {CmdClone.class, CmdScript.class, CmdQuest.class, CmdDialog.class, CmdConfig.class} +) +public class CmdNoppes extends ChMcLogger { + + public CmdFaction cmdfaction = new CmdFaction(ctorParm); + public CmdNpc cmdnpc= new CmdNpc(ctorParm); + public static Map> SlayMap = new LinkedHashMap>(); + + public CmdNoppes(Object sender) { + super(sender); + + SlayMap.clear(); + + SlayMap.put("all",EntityLivingBase.class); + SlayMap.put("mobs",EntityMob.class); + SlayMap.put("animals", EntityAnimal.class); + SlayMap.put("items", EntityItem.class); + SlayMap.put("xporbs", EntityXPOrb.class); + SlayMap.put("npcs", EntityNPCInterface.class); + + HashMap> list = new HashMap>(EntityList.stringToClassMapping); + for(String name : list.keySet()){ + Class cls = list.get(name); + if(EntityNPCInterface.class.isAssignableFrom(cls)) + continue; + if(!EntityLivingBase.class.isAssignableFrom(cls)) + continue; + SlayMap.put(name.toLowerCase(), list.get(name)); + } + + SlayMap.remove("monster"); + SlayMap.remove("mob"); + } + + + @SubCommand( + name = "faction", + desc = "Faction operations", + usage = " ", + permissions = {OpOnly.class, ParamCheck.class} + ) + public Boolean faction(String[] args) { + String playername = args[0]; + String factionname = args[1]; + + cmdfaction.data = getPlayersData(playername); + if (cmdfaction.data.isEmpty()) { + sendmessage(String.format("Unknow player '%s'", playername)); + return false; + } + try{ + cmdfaction.selectedFaction = FactionController.getInstance().getFaction(Integer.parseInt(factionname)); + } + catch(NumberFormatException e){ + cmdfaction.selectedFaction = FactionController.getInstance().getFactionFromName(factionname); // get faction data + } + if (cmdfaction.selectedFaction == null) { + sendmessage(String.format("Unknow facion '%s", factionname)); + return false; + } + args = Arrays.copyOfRange(args, 2, args.length); + cmdfaction.processCommand(this.pcParam, args); + + for(PlayerData playerdata : cmdfaction.data){ + playerdata.saveNBTData(null); + } + return true; + } + + @SubCommand( + desc="NPC manipulations", + usage=" ", + permissions={OpOnly.class,ParamCheck.class} + ) + public boolean npc(String[] args){ + String npcname=args[0].replace("%", " "); + args = Arrays.copyOfRange(args, 1, args.length); + if(args[0].equalsIgnoreCase("create")){ + cmdnpc.processCommand(this.pcParam, new String[]{args[0], npcname}); + return true; + } + int x = pcParam.getPlayerCoordinates().posX; + int y = pcParam.getPlayerCoordinates().posY; + int z = pcParam.getPlayerCoordinates().posZ; + List list = getNearbeEntityFromPlayer(EntityNPCInterface.class, pcParam.getEntityWorld(), x, y, z, 80); + EntityNPCInterface closest = null; + for (EntityNPCInterface npc : list) { + String name = npc.display.name.replace(" ", "_"); + if (name.equalsIgnoreCase(npcname)){ + if(closest == null || closest.getDistanceSq(x, y, z) > npc.getDistanceSq(x, y, z)) + closest = npc; + } + } + if(closest != null){ + cmdnpc.selectedNpc=closest; + cmdnpc.processCommand(this.pcParam, args); + cmdnpc.selectedNpc = null; + } + else + sendmessage(String.format("NPC '%s' was not found",npcname)); + return true; + } + + @SubCommand( + name = "slay", + desc = "Kills given entity within range. Also has all, mobs, animal options. Can have multiple types", + usage = ".. [range]", + permissions = {PlayerOnly.class, OpOnly.class, ParamCheck.class} + ) + public Boolean slay(String[] args) { + EntityPlayerMP player = (EntityPlayerMP) pcParam; + ArrayList> toDelete = new ArrayList>(); + boolean deleteNPCs = false; + for(String delete : args){ + delete = delete.toLowerCase(); + Class cls = SlayMap.get(delete); + if(cls != null) + toDelete.add(cls); + if(delete.equals("mobs")){ + toDelete.add(EntityGhast.class); + toDelete.add(EntityDragon.class); + } + if(delete.equals("npcs")) + deleteNPCs = true; + } + int count = 0; + int range = 120; + try{ + range = Integer.parseInt(args[args.length - 1]); + } + catch(NumberFormatException ex){ + + } + AxisAlignedBB box = player.boundingBox.expand(range, range, range); + List list = player.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, box); + + for(Entity entity : list){ + if(entity instanceof EntityPlayer) + continue; + if(entity instanceof EntityTameable && ((EntityTameable)entity).isTamed()) + continue; + if(entity instanceof EntityNPCInterface && !deleteNPCs) + continue; + if(delete(entity,toDelete)) + count++; + } + if(toDelete.contains(EntityXPOrb.class)){ + list = player.worldObj.getEntitiesWithinAABB(EntityXPOrb.class, box); + for(Entity entity : list){ + entity.isDead = true; + count++; + } + } + if(toDelete.contains(EntityItem.class)){ + list = player.worldObj.getEntitiesWithinAABB(EntityItem.class, box); + for(Entity entity : list){ + entity.isDead = true; + count++; + } + } + + player.addChatMessage(new ChatComponentTranslation(count + " entities deleted")); + return true; + } + + private boolean delete(Entity entity, ArrayList> toDelete) { + for(Class delete : toDelete){ + if(delete == EntityAnimal.class && (entity instanceof EntityHorse)){ + continue; + } + if(delete.isAssignableFrom(entity.getClass())){ + entity.isDead = true; + return true; + } + } + return false; + } + + @Override + public List addTabCompletion(ICommandSender par1, String[] args) { + if(args[0].equalsIgnoreCase("slay")){ + return CommandBase.getListOfStringsMatchingLastWord(args, SlayMap.keySet().toArray(new String[SlayMap.size()])); + } + if(args[0].equalsIgnoreCase("npc") && args.length == 3){ + return cmdnpc.addTabCompletion(par1, Arrays.copyOfRange(args, 1, args.length)); + } + if(args[0].equalsIgnoreCase("faction") && args.length == 4){ + return CommandBase.getListOfStringsMatchingLastWord(args, new String[]{"add", "subtract", "set", "reset", "drop", "create"}); + } + return super.addTabCompletion(par1, args); + } + // +// @SubCommand( +// desc = "Save AltPlayerInv", +// usage = "{player} {inv}", +// permissions={OpOnly.class} +// ) +// public boolean sapi(String[] args) { +// EntityPlayer p = getOnlinePlayer(args[0]); +// sendmessage(String.format("noppes.sapi:%s %s", args[0], args[1])); +// if (p == null) { +// sendmessage("noppes.sapi:unkow " + args[0]); +// return false; +// } +// savePlayerAltInv(p, args[1]); +// sendmessage("noppes.sapi:saved"); +// return true; +// } +// +// @SubCommand( +// desc = "Load AltPlayerInv", +// usage = "{player} {inv}", +// permissions={OpOnly.class} +// ) +// public boolean lapi(String[] args) { +// EntityPlayer p = getOnlinePlayer(args[0]); +// sendmessage(String.format("noppes.lapi:%s %s", args[0], args[1])); +// if (p == null) { +// sendmessage("noppes.sapi:unknow " + args[0]); +// return false; +// } +// +// loadPlayerAltInv(p, args[1]); +// sendmessage("noppes.lapi:loaded"); +// return true; +// } + // +} diff --git a/src/main/java/foxz/command/CmdNpc.java b/src/main/java/foxz/command/CmdNpc.java new file mode 100644 index 000000000..e9ee236aa --- /dev/null +++ b/src/main/java/foxz/command/CmdNpc.java @@ -0,0 +1,166 @@ +package foxz.command; + +import java.util.List; + +import scala.actors.threadpool.Arrays; +import net.minecraft.command.CommandBase; +import net.minecraft.command.ICommandSender; +import net.minecraft.command.PlayerSelector; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import noppes.npcs.NoppesUtilServer; +import noppes.npcs.constants.EnumGuiType; +import noppes.npcs.entity.EntityCustomNpc; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.RoleCompanion; +import noppes.npcs.roles.RoleFollower; +import foxz.commandhelper.ChMcLogger; +import foxz.commandhelper.annotations.Command; +import foxz.commandhelper.annotations.SubCommand; +import foxz.commandhelper.permissions.OpOnly; +import foxz.commandhelper.permissions.PlayerOnly; + +@Command( + name="npc", + desc="NPC manipulation", + usage=" " +) +public class CmdNpc extends ChMcLogger { + + CmdNpc(Object ctorParm) { + super (ctorParm); + } + + public EntityNPCInterface selectedNpc; + + + @SubCommand( + desc="Set Home (respawn place)", + usage="" + ) + public void home(String[] args){ + double posX = pcParam.getPlayerCoordinates().posX; + double posY = pcParam.getPlayerCoordinates().posY; + double posZ = pcParam.getPlayerCoordinates().posZ; + + if(args.length == 3){ + posX = CommandBase.func_110666_a(pcParam, selectedNpc.posX, args[0]); + posY = CommandBase.func_110665_a(pcParam, selectedNpc.posY, args[1].trim(), 0, 0); + posZ = CommandBase.func_110666_a(pcParam, selectedNpc.posZ, args[2]); + } + + selectedNpc.ai.startPos = new int[]{MathHelper.floor_double(posX), MathHelper.floor_double(posY), MathHelper.floor_double(posZ)}; + } + + @SubCommand( + desc="Set npc visibility", + usage="" + ) + public void visible(String[] args){ + if(args.length < 1) + return; + boolean bo = args[0].equalsIgnoreCase("true"); + boolean semi = args[0].equalsIgnoreCase("semi"); + + int current = selectedNpc.display.visible; + if(semi) + selectedNpc.display.visible = 2; + else if(bo) + selectedNpc.display.visible = 0; + else + selectedNpc.display.visible = 1; + + if(current != selectedNpc.display.visible) + selectedNpc.updateClient = true; + + } + + @SubCommand( + desc="Delete an NPC", + usage="" + ) + public void delete(String[] args){ + selectedNpc.delete(); + } + + @SubCommand( + desc="Owner", + usage="" + ) + public void owner(String[] args){ + if(args.length < 1){ + EntityPlayer player = null; + if(selectedNpc.roleInterface instanceof RoleFollower) + player = ((RoleFollower)selectedNpc.roleInterface).owner; + + if(selectedNpc.roleInterface instanceof RoleCompanion) + player = ((RoleCompanion)selectedNpc.roleInterface).owner; + + if(player == null) + sendmessage("No owner"); + else + sendmessage("Owner is: " + player.getCommandSenderName()); + } + else{ + EntityPlayerMP player = CommandBase.getPlayer(pcParam, args[0]); + if(selectedNpc.roleInterface instanceof RoleFollower) + ((RoleFollower)selectedNpc.roleInterface).setOwner(player); + + if(selectedNpc.roleInterface instanceof RoleCompanion) + ((RoleCompanion)selectedNpc.roleInterface).setOwner(player); + } + } + + + @SubCommand( + desc="Set npc name", + usage="" + ) + public void name(String[] args){ + if(args.length < 1) + return; + + String name = args[0]; + for(int i = 1; i < args.length; i++){ + name += " " + args[i]; + } + + if(!selectedNpc.display.name.equals(name)){ + selectedNpc.display.name = name; + selectedNpc.updateClient = true; + } + } + + @SubCommand( + desc = "Creates an NPC", + usage = "[name]", + permissions = {PlayerOnly.class, OpOnly.class} + ) + public void create(String[] args) { + EntityPlayerMP player = (EntityPlayerMP) pcParam; + World pw = player.getEntityWorld(); + EntityCustomNpc npc = new EntityCustomNpc(pw); + if(args.length > 0) + npc.display.name = args[0]; + npc.setPositionAndRotation(player.posX, player.posY, player.posZ, player.cameraYaw, player.cameraPitch); + npc.ai.startPos = new int[]{MathHelper.floor_double(player.posX),MathHelper.floor_double(player.posY),MathHelper.floor_double(player.posZ)}; + pw.spawnEntityInWorld(npc); + npc.setHealth(npc.getMaxHealth()); + NoppesUtilServer.sendOpenGui(player, EnumGuiType.MainMenuDisplay, npc); + } + + @Override + public List addTabCompletion(ICommandSender par1, String[] args) { + if(args.length == 2){ + return CommandBase.getListOfStringsMatchingLastWord(args, new String[]{"create", "home", "visible", "delete", "owner", "name"}); + } + if(args.length == 3 && args[1].equalsIgnoreCase("owner")){ + return CommandBase.getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getAllUsernames()); + } + + return super.addTabCompletion(par1, args); + } +} diff --git a/src/main/java/foxz/command/CmdQuest.java b/src/main/java/foxz/command/CmdQuest.java new file mode 100644 index 000000000..5561b0890 --- /dev/null +++ b/src/main/java/foxz/command/CmdQuest.java @@ -0,0 +1,189 @@ +package foxz.command; + +import static foxz.utils.Utils.getOnlinePlayer; + +import java.util.List; + +import net.minecraft.command.PlayerSelector; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import noppes.npcs.Server; +import noppes.npcs.constants.EnumPacketClient; +import noppes.npcs.controllers.DialogController; +import noppes.npcs.controllers.PlayerData; +import noppes.npcs.controllers.PlayerDataController; +import noppes.npcs.controllers.Quest; +import noppes.npcs.controllers.QuestController; +import noppes.npcs.controllers.QuestData; +import foxz.commandhelper.ChMcLogger; +import foxz.commandhelper.annotations.Command; +import foxz.commandhelper.annotations.SubCommand; +import foxz.commandhelper.permissions.OpOnly; +import foxz.commandhelper.permissions.ParamCheck; + +@Command( + name = "quest", + usage = "help", + desc = "Quest operations" +) +public class CmdQuest extends ChMcLogger{ + + public CmdQuest(Object sender) { + super(sender); + } + + @SubCommand( + desc = "Start a quest", + usage = " ", + permissions = {OpOnly.class, ParamCheck.class} + ) + public Boolean start(String[] args) { + String playername=args[0]; + int questid; + try { + questid = Integer.parseInt(args[1]); + } catch (NumberFormatException ex) { + sendmessage("QuestID must be an integer"); + return false; + } + List data = getPlayersData(playername); + if (data.isEmpty()) { + sendmessage(String.format("Unknow player '%s'", playername)); + return false; + } + Quest quest = QuestController.instance.quests.get(questid); + if (quest == null){ + sendmessage("Unknown QuestID"); + return false; + } + for(PlayerData playerdata : data){ + if(playerdata.questData.activeQuests.containsKey(questid)) + continue; + QuestData questdata = new QuestData(quest); + playerdata.questData.activeQuests.put(questid, questdata); + playerdata.saveNBTData(null); + if(playerdata.player != null){ + Server.sendData((EntityPlayerMP)playerdata.player, EnumPacketClient.MESSAGE, "quest.newquest", quest.title); + Server.sendData((EntityPlayerMP)playerdata.player, EnumPacketClient.CHAT, "quest.newquest", ": ", quest.title); + } + } + return true; + } + + @SubCommand( + desc = "Finish a quest", + usage = " ", + permissions = {OpOnly.class, ParamCheck.class} + ) + public Boolean finish(String args[]){ + String playername=args[0]; + int questid; + try { + questid = Integer.parseInt(args[1]); + } + catch (NumberFormatException ex) { + sendmessage("QuestID must be an integer"); + return false; + } + List data = getPlayersData(playername); + if (data.isEmpty()) { + sendmessage(String.format("Unknow player '%s'", playername)); + return false; + } + + Quest quest = QuestController.instance.quests.get(questid); + if (quest == null){ + sendmessage("Unknown QuestID"); + return false; + } + for(PlayerData playerdata : data){ + playerdata.questData.finishedQuests.put(questid, System.currentTimeMillis()); + playerdata.saveNBTData(null); + } + return true; + } + + @SubCommand( + desc = "Stop a started quest", + usage = " ", + permissions = {OpOnly.class, ParamCheck.class} + ) + public Boolean stop(String[] args) { + String playername=args[0]; + int questid; + try { + questid = Integer.parseInt(args[1]); + } catch (NumberFormatException ex) { + sendmessage("QuestID must be an integer"); + return false; + } + List data = getPlayersData(playername); + if (data.isEmpty()) { + sendmessage(String.format("Unknow player '%s'", playername)); + return false; + } + Quest quest = QuestController.instance.quests.get(questid); + if (quest == null){ + sendmessage("Unknown QuestID"); + return false; + } + for(PlayerData playerdata : data){ + playerdata.questData.activeQuests.remove(questid); + playerdata.saveNBTData(null); + } + return true; + } + + @SubCommand( + desc = "Removes a quest from finished and active quests", + usage = " ", + permissions = {OpOnly.class, ParamCheck.class} + ) + public Boolean remove(String[] args) { + String playername=args[0]; + int questid; + try { + questid = Integer.parseInt(args[1]); + } catch (NumberFormatException ex) { + sendmessage("QuestID must be an integer"); + return false; + } + List data = getPlayersData(playername); + if (data.isEmpty()) { + sendmessage(String.format("Unknow player '%s'", playername)); + return false; + } + Quest quest = QuestController.instance.quests.get(questid); + if (quest == null){ + sendmessage("Unknown QuestID"); + return false; + } + for(PlayerData playerdata : data){ + playerdata.questData.activeQuests.remove(questid); + playerdata.questData.finishedQuests.remove(questid); + playerdata.saveNBTData(null); + } + return true; + } + @SubCommand( + desc="reload quests from disk", + permissions={OpOnly.class} + ) + public boolean reload(String args[]){ + new DialogController(); + return true; + } +} + + + + + + + + + + + + + diff --git a/src/main/java/foxz/command/CmdScript.java b/src/main/java/foxz/command/CmdScript.java new file mode 100644 index 000000000..291582460 --- /dev/null +++ b/src/main/java/foxz/command/CmdScript.java @@ -0,0 +1,30 @@ +package foxz.command; + +import noppes.npcs.controllers.ScriptController; +import foxz.commandhelper.ChMcLogger; +import foxz.commandhelper.annotations.Command; +import foxz.commandhelper.annotations.SubCommand; +import foxz.commandhelper.permissions.OpOnly; + +@Command( + name = "script", + desc = "Script operation" +) +public class CmdScript extends ChMcLogger { + + public CmdScript(Object sender) { + super(sender); + } + + @SubCommand( + desc = "Reload scripts and saved data from disks script folder.", + permissions={OpOnly.class} + ) + public Boolean reload(String args[]) { + if(ScriptController.Instance.loadStoredData()) + sendmessage("Reload succesful"); + else + sendmessage("Failed reloading stored data"); + return true; + } +} diff --git a/src/main/java/foxz/command/CommandNoppes.java b/src/main/java/foxz/command/CommandNoppes.java new file mode 100644 index 000000000..44d57f4fe --- /dev/null +++ b/src/main/java/foxz/command/CommandNoppes.java @@ -0,0 +1,36 @@ +package foxz.command; + +import java.util.List; + +import net.minecraft.command.CommandBase; +import net.minecraft.command.ICommandSender; + +public class CommandNoppes extends CommandBase { + + public CmdNoppes noppes = new CmdNoppes(this); + + @Override + public String getCommandName() { + return noppes.commandHelper.name; + } + + @Override + public String getCommandUsage(ICommandSender var1) { + return noppes.commandHelper.usage; + } + + @Override + public void processCommand(ICommandSender var1, String[] var2) { + noppes.processCommand(var1, var2); + } + + @Override + public List addTabCompletionOptions(ICommandSender par1, String[] par2){ + return noppes.addTabCompletion(par1, par2); + } + + @Override + public int getRequiredPermissionLevel(){ + return 2; + } +} diff --git a/src/main/java/foxz/commandhelper/AbstractCommandHelper.java b/src/main/java/foxz/commandhelper/AbstractCommandHelper.java new file mode 100644 index 000000000..f7eaf5a84 --- /dev/null +++ b/src/main/java/foxz/commandhelper/AbstractCommandHelper.java @@ -0,0 +1,241 @@ +// (c)SJFN@ CommandHelper v14.03.21 by FoxZ@free.fr +// licence : cc-by-nc+no gov,mil usage +package foxz.commandhelper; + +import java.lang.reflect.Constructor; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +import net.minecraft.command.CommandBase; +import net.minecraft.command.ICommandSender; +import net.minecraft.command.PlayerSelector; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.world.World; +import noppes.npcs.controllers.PlayerData; +import noppes.npcs.controllers.PlayerDataController; +import foxz.commandhelper.annotations.Command; +import foxz.commandhelper.annotations.SubCommand; +import foxz.commandhelper.permissions.AbstractPermission; + +public abstract class AbstractCommandHelper extends CommandHelper { + + public Object ctorParm; + public ICommandSender pcParam; + public Object xParam; + public AbstractCommandHelper parentCmdHelper; + public AbstractCommandHelper rootCmdHelper; + + public AbstractCommandHelper(Object sender) { + this.ctorParm = sender; + ctor(); + } + + public void ctor() { + this.commandHelper.name = ((Command) this.getClass().getAnnotation(Command.class)).name(); + this.commandHelper.usage = ((Command) this.getClass().getAnnotation(Command.class)).usage(); + this.commandHelper.desc = ((Command) this.getClass().getAnnotation(Command.class)).desc(); + // sub + for (Class c : this.getClass().getAnnotation(Command.class).sub()) { + try { + String name = ((Command) c.getAnnotation(Command.class)).name().toUpperCase(); + Constructor ctor = c.getConstructor(Object.class); + ctor.setAccessible(true); + AbstractCommandHelper sc = (AbstractCommandHelper) ctor.newInstance(ctorParm); + commands.put(name, sc); + } catch (Exception ex) { + Logger.getLogger(AbstractCommandHelper.class.getName()).log(Level.SEVERE, null, ex); + } + } + // intern + for (Method m : this.getClass().getDeclaredMethods()) { + SubCommand sc = m.getAnnotation(SubCommand.class); + if (sc != null) { + String name = sc.name(); + if (name.equals("")) { + name = m.getName(); + } + commands.put(name.toUpperCase(), new MethodSubCmd(this, m)); + } + } + } + + public Map commands = new HashMap(); + + public abstract void help(String cmd, String desc, String usa); + + public abstract void cmdError(String cmd); + + public abstract void error(String err); + + protected class MethodSubCmd extends CommandHelper { + + public List permissions = new ArrayList(); + + public MethodSubCmd(AbstractCommandHelper ch, Method m) { + SubCommand s = m.getAnnotation(SubCommand.class); + commandHelper.name = s.name(); + if (commandHelper.name.equals("")) { + commandHelper.name = m.getName(); + } + commandHelper.usage = s.usage(); + commandHelper.desc = s.desc(); + commandHelper.hasEmptyCall = s.hasEmptyCall(); + + method = m; + for (Class c : s.permissions()) { + try { + Constructor ctor = c.getDeclaredConstructor(); + ctor.setAccessible(true); + AbstractPermission i = ctor.newInstance(); + permissions.add(i); + } catch (Exception ex) { + Logger.getLogger(AbstractCommandHelper.class.getName()).log(Level.SEVERE, null, ex); + } + } + } + @Override + public List addTabCompletion(ICommandSender par1, String[] args) { + String[] np = currentHelper.usage.split(" "); + if(np.length < args.length) + return null; + String parameter = np[args.length - 1]; + if(parameter.equals("")) + return CommandBase.getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getAllUsernames()); + + return null; + } + + public Method method; + + } + + public void allHelp() { + for (CommandHelper cur : commands.values()) { + help(cur.commandHelper.name, cur.commandHelper.desc, ""); + } + } + + public Helper currentHelper; + + public Boolean processCommand(ICommandSender param, String[] args) { + pcParam = param; + if (parentCmdHelper == null) { + rootCmdHelper = this; + } + if (args.length == 0) { + allHelp(); + return true; + } + + String cmd = args[0].toUpperCase(); + args = Arrays.copyOfRange(args, 1, args.length); + + if ((cmd.equals("HELP") || args.length == 0) && doHelp(param, args, cmd)) { + return true; + } + + CommandHelper ch = commands.get(cmd); + if (ch == null) { + cmdError(cmd); + return false; + } + if (ch instanceof AbstractCommandHelper) { + AbstractCommandHelper f = (AbstractCommandHelper) ch; + f.parentCmdHelper = this; + f.rootCmdHelper = this.rootCmdHelper; + return f.processCommand(param, args); + } + else if (ch instanceof MethodSubCmd) { + MethodSubCmd m = (MethodSubCmd) ch; + m.method.setAccessible(true); + currentHelper = ch.commandHelper; + try { + for (AbstractPermission p : m.permissions) { + if (!p.delegate(this, args)) { + error(p.errorMsg()); + return false; + } + } + return (Boolean) m.method.invoke(this, (Object) args); + } catch (Exception ex) { + Logger.getLogger(AbstractCommandHelper.class.getName()).log(Level.SEVERE, m.commandHelper.name, ex); + } + return true; + } + else + cmdError(cmd); + return false; + } + + private boolean doHelp(ICommandSender param, String[] args, String cmd){ + boolean isHelp = cmd.equals("HELP"); + if(args.length > 0){ + cmd = args[0]; + } + CommandHelper ch = commands.get(cmd.toUpperCase()); + if(ch != null){ + if(ch.commandHelper.hasEmptyCall && !isHelp) + return false; + if(ch instanceof AbstractCommandHelper){ + ((AbstractCommandHelper)ch).pcParam = param; + ((AbstractCommandHelper)ch).allHelp(); + } + else if(ch instanceof MethodSubCmd && ((MethodSubCmd)ch).commandHelper.usage.isEmpty()) + return false; + else + help(ch.commandHelper.name, ch.commandHelper.desc, ch.commandHelper.usage); + } + else + allHelp(); + return true; + } + + @Override + public List addTabCompletion(ICommandSender par1, String[] args) { + if(args.length <= 1){ + List list = new ArrayList(); + for(String command : commands.keySet()) + list.add(command.toLowerCase()); + list.add("help"); + return CommandBase.getListOfStringsMatchingLastWord(args, list.toArray(new String[list.size()])); + } + CommandHelper ch = commands.get(args[0].toUpperCase()); + if(ch == null) + return null; + args = Arrays.copyOfRange(args, 1, args.length); + currentHelper = ch.commandHelper; + return ch.addTabCompletion(par1, args); + } + + public List getPlayersData(String username){ + ArrayList list = new ArrayList(); + EntityPlayerMP[] players = PlayerSelector.matchPlayers(pcParam, username); + if(players == null || players.length == 0){ + PlayerData data = PlayerDataController.instance.getDataFromUsername(username); + if(data != null) + list.add(data); + } + else{ + for(EntityPlayer player : players){ + list.add(PlayerDataController.instance.getPlayerData(player)); + } + } + + return list; + } + + public List getNearbeEntityFromPlayer(Class cls, World world, int x, int y, int z, int range) { + AxisAlignedBB bb = AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1).expand(range, range, range); + List list = world.getEntitiesWithinAABB(cls, bb); + return list; + } +} diff --git a/src/main/java/foxz/commandhelper/ChMcLogger.java b/src/main/java/foxz/commandhelper/ChMcLogger.java new file mode 100644 index 000000000..60f8f6bce --- /dev/null +++ b/src/main/java/foxz/commandhelper/ChMcLogger.java @@ -0,0 +1,35 @@ +package foxz.commandhelper; + +import net.minecraft.command.ICommandSender; +import net.minecraft.util.ChatComponentText; + +public class ChMcLogger extends AbstractCommandHelper { + + public ChMcLogger(Object sender) { + super(sender); + } + + public void sendmessage(String msg) { + ICommandSender sender = (ICommandSender) pcParam; + sender.addChatMessage(new ChatComponentText(msg)); + } + + @Override + public void help(String cmd, String desc, String usa) { + if(usa.isEmpty()) + sendmessage(String.format("%s = %s", cmd, desc)); + else + sendmessage(String.format("%s %s = %s", cmd, usa, desc)); + } + + @Override + public void cmdError(String cmd) { + sendmessage(String.format("Unknow command '%s'", cmd)); + } + + @Override + public void error(String err) { + sendmessage(String.format("Error: %s", err)); + } + +} diff --git a/src/main/java/foxz/commandhelper/CommandHelper.java b/src/main/java/foxz/commandhelper/CommandHelper.java new file mode 100644 index 000000000..b0ac908b1 --- /dev/null +++ b/src/main/java/foxz/commandhelper/CommandHelper.java @@ -0,0 +1,20 @@ +package foxz.commandhelper; + +import java.util.List; + +import net.minecraft.command.ICommandSender; + +public abstract class CommandHelper { + + public class Helper { + + public String name; + public String usage; + public String desc; + public boolean hasEmptyCall; + } + public Helper commandHelper = new Helper(); + public List addTabCompletion(ICommandSender par1, String[] args) { + return null; + } +} diff --git a/src/main/java/foxz/commandhelper/annotations/Command.java b/src/main/java/foxz/commandhelper/annotations/Command.java new file mode 100644 index 000000000..136336cf7 --- /dev/null +++ b/src/main/java/foxz/commandhelper/annotations/Command.java @@ -0,0 +1,18 @@ +package foxz.commandhelper.annotations; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +@Documented +@Retention(value = RetentionPolicy.RUNTIME) +public @interface Command { + + String name(); + + String desc(); + + String usage() default ""; + + Class[] sub() default {}; +} diff --git a/src/main/java/foxz/commandhelper/annotations/SubCommand.java b/src/main/java/foxz/commandhelper/annotations/SubCommand.java new file mode 100644 index 000000000..7cc776486 --- /dev/null +++ b/src/main/java/foxz/commandhelper/annotations/SubCommand.java @@ -0,0 +1,24 @@ +package foxz.commandhelper.annotations; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Documented +@Retention(value = RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) +public @interface SubCommand { + + String name() default ""; + + String usage() default ""; + + boolean hasEmptyCall() default false; + + String desc(); + + Class[] permissions() default {}; + +} diff --git a/src/main/java/foxz/commandhelper/permissions/AbstractPermission.java b/src/main/java/foxz/commandhelper/permissions/AbstractPermission.java new file mode 100644 index 000000000..21452e292 --- /dev/null +++ b/src/main/java/foxz/commandhelper/permissions/AbstractPermission.java @@ -0,0 +1,10 @@ +package foxz.commandhelper.permissions; + +import foxz.commandhelper.AbstractCommandHelper; + +public abstract class AbstractPermission { + + abstract public String errorMsg(); + + abstract public boolean delegate(AbstractCommandHelper parent, String args[]); +} diff --git a/src/main/java/foxz/commandhelper/permissions/OpOnly.java b/src/main/java/foxz/commandhelper/permissions/OpOnly.java new file mode 100644 index 000000000..d2137cf90 --- /dev/null +++ b/src/main/java/foxz/commandhelper/permissions/OpOnly.java @@ -0,0 +1,21 @@ +package foxz.commandhelper.permissions; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.server.MinecraftServer; +import foxz.commandhelper.AbstractCommandHelper; + +public class OpOnly extends AbstractPermission { + + @Override + public String errorMsg() { + return "Op Only"; + } + + @Override + public boolean delegate(AbstractCommandHelper parent, String[] args) { + if(!(parent.pcParam instanceof EntityPlayer)) + return true; + return MinecraftServer.getServer().getConfigurationManager().func_152596_g(((EntityPlayer)parent.pcParam).getGameProfile()); + } + +} diff --git a/src/main/java/foxz/commandhelper/permissions/ParamCheck.java b/src/main/java/foxz/commandhelper/permissions/ParamCheck.java new file mode 100644 index 000000000..4189b5748 --- /dev/null +++ b/src/main/java/foxz/commandhelper/permissions/ParamCheck.java @@ -0,0 +1,29 @@ +package foxz.commandhelper.permissions; + +import foxz.commandhelper.AbstractCommandHelper; + +public class ParamCheck extends AbstractPermission { + + String err; + + @Override + public String errorMsg() { + return err; + } + + @Override + public boolean delegate(AbstractCommandHelper parent, String[] args) { + String[] np = parent.currentHelper.usage.split(" "); + int countRequired = 0; + for(String command : np){ + if(command.startsWith("<")) + countRequired++; + } + if (args.length < countRequired) { + err = np[args.length] + " missing"; + return false; + } + return true; + } + +} diff --git a/src/main/java/foxz/commandhelper/permissions/PlayerOnly.java b/src/main/java/foxz/commandhelper/permissions/PlayerOnly.java new file mode 100644 index 000000000..47c992ad3 --- /dev/null +++ b/src/main/java/foxz/commandhelper/permissions/PlayerOnly.java @@ -0,0 +1,27 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package foxz.commandhelper.permissions; + +import foxz.commandhelper.AbstractCommandHelper; +import net.minecraft.entity.player.EntityPlayer; + +/** + * + * @author foxz + */ +public class PlayerOnly extends AbstractPermission { + + @Override + public String errorMsg() { + return "Player Only"; + } + + @Override + public boolean delegate(AbstractCommandHelper parent, String[] args) { + return parent.pcParam instanceof EntityPlayer; + } + +} diff --git a/src/main/java/foxz/utils/Market.java b/src/main/java/foxz/utils/Market.java new file mode 100644 index 000000000..12403e561 --- /dev/null +++ b/src/main/java/foxz/utils/Market.java @@ -0,0 +1,58 @@ +package foxz.utils; + +import java.io.File; + +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.CustomNpcs; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.RoleTrader; +import noppes.npcs.util.NBTJsonUtil; + +public class Market { + + static public void save(RoleTrader r, String name) { + if(name.isEmpty()) + return; + File file = getFile(name + "_new"); + File file1 = getFile(name); + + try { + NBTJsonUtil.SaveFile(file, r.writeNBT(new NBTTagCompound())); + if(file1.exists()){ + file1.delete(); + } + file.renameTo(file1); + } catch (Exception e) { + + } + } + + + static public void load(RoleTrader role, String name){ + if(role.npc.worldObj.isRemote) + return; + File file = getFile(name); + if(!file.exists()) + return; + + try { + role.readNBT(NBTJsonUtil.LoadFile(file)); + } catch (Exception e) { + } + } + private static File getFile(String name){ + File dir = new File(CustomNpcs.getWorldSaveDirectory(), "markets"); + if(!dir.exists()) + dir.mkdir(); + return new File(dir, name.toLowerCase() + ".json"); + } + + static public void setMarket(EntityNPCInterface npc, String marketName) { + if(marketName.isEmpty()) + return; + if(!getFile(marketName).exists()) + Market.save((RoleTrader) npc.roleInterface, marketName); + + Market.load((RoleTrader) npc.roleInterface, marketName); + } +} diff --git a/src/main/java/foxz/utils/Utils.java b/src/main/java/foxz/utils/Utils.java new file mode 100644 index 000000000..88400474a --- /dev/null +++ b/src/main/java/foxz/utils/Utils.java @@ -0,0 +1,46 @@ +package foxz.utils; + +import java.util.List; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.world.World; +import net.minecraft.world.WorldServer; +import net.minecraftforge.common.DimensionManager; + +public class Utils { + + static public List getNearbeEntityFromPlayer(Class cls,EntityPlayerMP player, int dis) { + AxisAlignedBB range = player.boundingBox.expand(dis, dis, dis); + List list = player.worldObj.getEntitiesWithinAABB(cls, range); + return list; + } + + static public EntityPlayer getOnlinePlayer(String playername){ + return MinecraftServer.getServer().getConfigurationManager().func_152612_a(playername); + } + + static public World getWorld(String t){ + WorldServer[] ws=MinecraftServer.getServer().worldServers; + for (WorldServer w:ws){ + if (w!=null){ + if ((w.provider.dimensionId + "").equalsIgnoreCase(t)){ + return w; + } + } + } + return null; + } + + // +// static public void savePlayerAltInv(EntityPlayer p,String n){ +// NBTTagList tag=p.inventory.writeToNBT(new NBTTagList()); +// p.getEntityData().setTag("AltInv_"+n, tag); +// } +// +// static public void loadPlayerAltInv(EntityPlayer p,String n){ +// p.inventory.readFromNBT((NBTTagList) p.getEntityData().getTag("AltInv_"+n)); +// } + // +} diff --git a/src/main/java/net/minecraft/client/gui/inventory/NPCGuiContainerHelper.java b/src/main/java/net/minecraft/client/gui/inventory/NPCGuiContainerHelper.java new file mode 100644 index 000000000..841cd874f --- /dev/null +++ b/src/main/java/net/minecraft/client/gui/inventory/NPCGuiContainerHelper.java @@ -0,0 +1,18 @@ +package net.minecraft.client.gui.inventory; + +import java.util.List; + +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.gui.inventory.GuiInventory; + +public class NPCGuiContainerHelper { + + public static int getLeft(GuiContainer gui) { + return gui.guiLeft; + } + + public static int getTop(GuiContainer gui) { + return gui.guiTop; + } +} diff --git a/src/main/java/net/minecraft/client/renderer/entity/NPCRendererHelper.java b/src/main/java/net/minecraft/client/renderer/entity/NPCRendererHelper.java new file mode 100644 index 000000000..5782c1cda --- /dev/null +++ b/src/main/java/net/minecraft/client/renderer/entity/NPCRendererHelper.java @@ -0,0 +1,41 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.ResourceLocation; + +public class NPCRendererHelper { + + public static ModelBase getMainModel(RendererLivingEntity render){ + return render.mainModel; + } + + public static String getTexture(RendererLivingEntity render, Entity entity){ + ResourceLocation location = render.getEntityTexture(entity); + return location.toString(); + } + + public static int shouldRenderPass(EntityLivingBase entity, int par2, float par3, RendererLivingEntity renderEntity) { + return renderEntity.shouldRenderPass(entity, par2, par3); + } + + public static void preRenderCallback(EntityLivingBase entity, float f, + RendererLivingEntity renderEntity) { + renderEntity.preRenderCallback(entity, f); + } + + public static ModelBase getPassModel(RendererLivingEntity render) { + return render.renderPassModel; + } + + public static float handleRotationFloat(EntityLivingBase entity, + float par2, RendererLivingEntity renderEntity) { + return renderEntity.handleRotationFloat(entity, par2); + } + + public static void renderEquippedItems(EntityLivingBase entity, float f, + RendererLivingEntity renderEntity) { + renderEntity.renderEquippedItems(entity, f); + } +} diff --git a/src/main/java/net/minecraft/client/resources/NPCResourceHelper.java b/src/main/java/net/minecraft/client/resources/NPCResourceHelper.java new file mode 100644 index 000000000..d8160ba16 --- /dev/null +++ b/src/main/java/net/minecraft/client/resources/NPCResourceHelper.java @@ -0,0 +1,10 @@ +package net.minecraft.client.resources; + +import java.io.File; + +public class NPCResourceHelper { + + public static File getPackFile(AbstractResourcePack pack){ + return pack.resourcePackFile; + } +} diff --git a/src/main/java/net/minecraft/entity/NPCEntityHelper.java b/src/main/java/net/minecraft/entity/NPCEntityHelper.java new file mode 100644 index 000000000..3db54db22 --- /dev/null +++ b/src/main/java/net/minecraft/entity/NPCEntityHelper.java @@ -0,0 +1,15 @@ +package net.minecraft.entity; + +import net.minecraft.item.Item; + +public class NPCEntityHelper { + + public static Item getDropItem(EntityLiving entity){ + return entity.getDropItem(); + } + + public static void setRecentlyHit(EntityLivingBase entity){ + entity.recentlyHit = 100; + } + +} diff --git a/src/main/java/noppes/npcs/CommonProxy.java b/src/main/java/noppes/npcs/CommonProxy.java new file mode 100644 index 000000000..423963949 --- /dev/null +++ b/src/main/java/noppes/npcs/CommonProxy.java @@ -0,0 +1,167 @@ +package noppes.npcs; + +import net.minecraft.client.model.ModelBiped; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.item.Item; +import net.minecraft.world.World; +import noppes.npcs.blocks.tiles.TileNpcContainer; +import noppes.npcs.constants.EnumGuiType; +import noppes.npcs.containers.ContainerCarpentryBench; +import noppes.npcs.containers.ContainerCrate; +import noppes.npcs.containers.ContainerMail; +import noppes.npcs.containers.ContainerManageBanks; +import noppes.npcs.containers.ContainerManageRecipes; +import noppes.npcs.containers.ContainerMerchantAdd; +import noppes.npcs.containers.ContainerNPCBankLarge; +import noppes.npcs.containers.ContainerNPCBankSmall; +import noppes.npcs.containers.ContainerNPCBankUnlock; +import noppes.npcs.containers.ContainerNPCBankUpgrade; +import noppes.npcs.containers.ContainerNPCCompanion; +import noppes.npcs.containers.ContainerNPCFollower; +import noppes.npcs.containers.ContainerNPCFollowerHire; +import noppes.npcs.containers.ContainerNPCFollowerSetup; +import noppes.npcs.containers.ContainerNPCInv; +import noppes.npcs.containers.ContainerNPCTrader; +import noppes.npcs.containers.ContainerNPCTraderSetup; +import noppes.npcs.containers.ContainerNpcItemGiver; +import noppes.npcs.containers.ContainerNpcQuestReward; +import noppes.npcs.containers.ContainerNpcQuestTypeItem; +import noppes.npcs.entity.EntityNPCInterface; +import cpw.mods.fml.common.network.IGuiHandler; + +public class CommonProxy implements IGuiHandler { + + public boolean newVersionAvailable = false; + public int revision = 4; + + public void load() { + CustomNpcs.Channel.register(new PacketHandlerServer()); + CustomNpcs.ChannelPlayer.register(new PacketHandlerPlayer()); + } + + @Override + public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { + if(ID > EnumGuiType.values().length) + return null; + EntityNPCInterface npc = NoppesUtilServer.getEditingNpc(player); + EnumGuiType gui = EnumGuiType.values()[ID]; + return getContainer(gui, player, x, y, z, npc); + } + public Container getContainer(EnumGuiType gui,EntityPlayer player, int x, int y, int z,EntityNPCInterface npc){ + if(gui == EnumGuiType.MainMenuInv) + return new ContainerNPCInv(npc, player); + + if(gui == EnumGuiType.PlayerBankSmall) + return new ContainerNPCBankSmall(player, x , y); + + if(gui == EnumGuiType.PlayerBankUnlock) + return new ContainerNPCBankUnlock(player, x , y); + + if(gui == EnumGuiType.PlayerBankUprade) + return new ContainerNPCBankUpgrade(player, x , y); + + if(gui == EnumGuiType.PlayerBankLarge) + return new ContainerNPCBankLarge(player, x , y); + + if(gui == EnumGuiType.PlayerFollowerHire) + return new ContainerNPCFollowerHire(npc, player); + + if(gui == EnumGuiType.PlayerFollower) + return new ContainerNPCFollower(npc, player); + + if(gui == EnumGuiType.PlayerTrader) + return new ContainerNPCTrader(npc, player); + + if(gui == EnumGuiType.PlayerAnvil) + return new ContainerCarpentryBench(player.inventory, player.worldObj, x, y, z); + + if(gui == EnumGuiType.SetupItemGiver) + return new ContainerNpcItemGiver(npc, player); + + if(gui == EnumGuiType.SetupTrader) + return new ContainerNPCTraderSetup(npc, player); + + if(gui == EnumGuiType.SetupFollower) + return new ContainerNPCFollowerSetup(npc, player); + + if(gui == EnumGuiType.QuestReward) + return new ContainerNpcQuestReward(player); + + if(gui == EnumGuiType.QuestItem) + return new ContainerNpcQuestTypeItem(player); + + if(gui == EnumGuiType.ManageRecipes) + return new ContainerManageRecipes(player,x); + + if(gui == EnumGuiType.ManageBanks) + return new ContainerManageBanks(player); + + if(gui == EnumGuiType.MerchantAdd) + return new ContainerMerchantAdd(player, ServerEventsHandler.Merchant, player.worldObj); + + if(gui == EnumGuiType.Crate) + return new ContainerCrate(player.inventory, (TileNpcContainer)player.worldObj.getTileEntity(x, y, z)); + + if(gui == EnumGuiType.PlayerMailman) + return new ContainerMail(player, x == 1, y == 1); + + if(gui == EnumGuiType.CompanionInv) + return new ContainerNPCCompanion(npc, player); + + return null; + } + + @Override + public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { + // TODO Auto-generated method stub + return null; + } + + public void openGui(EntityNPCInterface npc, EnumGuiType gui) { + // TODO Auto-generated method stub + } + + public void openGui(EntityNPCInterface npc, EnumGuiType gui, int x, int y, int z) { + // TODO Auto-generated method stub + } + + + public void openGui(int i, int j, int k, EnumGuiType gui, EntityPlayer player) { + + } + + public void openGui(EntityPlayer player, Object guiscreen) { + // TODO Auto-generated method stub + + } + + public void spawnParticle(EntityLivingBase player, String string, Object... ob) { + // TODO Auto-generated method stub + + } + + public boolean hasClient() { + return false; + } + + public EntityPlayer getPlayer() { + return null; + } + + public void registerItem(Item item) { + // TODO Auto-generated method stub + + } + + public ModelBiped getSkirtModel() { + return null; + } + + public void spawnParticle(String particle, double x, double y, double z, + double motionX, double motionY, double motionZ, float scale) { + + } + +} diff --git a/src/main/java/noppes/npcs/CreativeTabNpcs.java b/src/main/java/noppes/npcs/CreativeTabNpcs.java new file mode 100644 index 000000000..8a6a8924f --- /dev/null +++ b/src/main/java/noppes/npcs/CreativeTabNpcs.java @@ -0,0 +1,24 @@ +package noppes.npcs; + +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Items; +import net.minecraft.item.Item; + +public class CreativeTabNpcs extends CreativeTabs{ + public Item item = Items.bowl; + public int meta = 0; + + public CreativeTabNpcs(String label) { + super(label); + } + + @Override + public Item getTabIconItem() { + return item; + } + + @Override + public int func_151243_f(){ + return meta; + } +} diff --git a/src/main/java/noppes/npcs/CustomItems.java b/src/main/java/noppes/npcs/CustomItems.java new file mode 100644 index 000000000..ec44b0ab9 --- /dev/null +++ b/src/main/java/noppes/npcs/CustomItems.java @@ -0,0 +1,896 @@ +package noppes.npcs; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockDispenser; +import net.minecraft.dispenser.BehaviorDefaultDispenseItem; +import net.minecraft.dispenser.IBlockSource; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.Item.ToolMaterial; +import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemArmor.ArmorMaterial; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemFlintAndSteel; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumFacing; +import net.minecraftforge.common.util.EnumHelper; +import net.minecraftforge.oredict.OreDictionary; +import noppes.npcs.blocks.BlockBanner; +import noppes.npcs.blocks.BlockBarrel; +import noppes.npcs.blocks.BlockBeam; +import noppes.npcs.blocks.BlockBigSign; +import noppes.npcs.blocks.BlockBlood; +import noppes.npcs.blocks.BlockBook; +import noppes.npcs.blocks.BlockBorder; +import noppes.npcs.blocks.BlockCampfire; +import noppes.npcs.blocks.BlockCandle; +import noppes.npcs.blocks.BlockCarpentryBench; +import noppes.npcs.blocks.BlockChair; +import noppes.npcs.blocks.BlockCouchWood; +import noppes.npcs.blocks.BlockCouchWool; +import noppes.npcs.blocks.BlockCrate; +import noppes.npcs.blocks.BlockCrystal; +import noppes.npcs.blocks.BlockLamp; +import noppes.npcs.blocks.BlockMailbox; +import noppes.npcs.blocks.BlockNpcRedstone; +import noppes.npcs.blocks.BlockPedestal; +import noppes.npcs.blocks.BlockPlaceholder; +import noppes.npcs.blocks.BlockShelf; +import noppes.npcs.blocks.BlockSign; +import noppes.npcs.blocks.BlockStool; +import noppes.npcs.blocks.BlockTable; +import noppes.npcs.blocks.BlockTallLamp; +import noppes.npcs.blocks.BlockTombstone; +import noppes.npcs.blocks.BlockWallBanner; +import noppes.npcs.blocks.BlockWaypoint; +import noppes.npcs.blocks.BlockWeaponRack; +import noppes.npcs.blocks.tiles.TileBanner; +import noppes.npcs.blocks.tiles.TileBarrel; +import noppes.npcs.blocks.tiles.TileBeam; +import noppes.npcs.blocks.tiles.TileBigSign; +import noppes.npcs.blocks.tiles.TileBlockAnvil; +import noppes.npcs.blocks.tiles.TileBook; +import noppes.npcs.blocks.tiles.TileBorder; +import noppes.npcs.blocks.tiles.TileCampfire; +import noppes.npcs.blocks.tiles.TileCandle; +import noppes.npcs.blocks.tiles.TileChair; +import noppes.npcs.blocks.tiles.TileCouchWood; +import noppes.npcs.blocks.tiles.TileCouchWool; +import noppes.npcs.blocks.tiles.TileCrate; +import noppes.npcs.blocks.tiles.TileLamp; +import noppes.npcs.blocks.tiles.TileMailbox; +import noppes.npcs.blocks.tiles.TilePedestal; +import noppes.npcs.blocks.tiles.TileRedstoneBlock; +import noppes.npcs.blocks.tiles.TileShelf; +import noppes.npcs.blocks.tiles.TileSign; +import noppes.npcs.blocks.tiles.TileStool; +import noppes.npcs.blocks.tiles.TileTable; +import noppes.npcs.blocks.tiles.TileTallLamp; +import noppes.npcs.blocks.tiles.TileTombstone; +import noppes.npcs.blocks.tiles.TileWallBanner; +import noppes.npcs.blocks.tiles.TileWaypoint; +import noppes.npcs.blocks.tiles.TileWeaponRack; +import noppes.npcs.constants.EnumNpcToolMaterial; +import noppes.npcs.items.ItemBattleAxe; +import noppes.npcs.items.ItemBroadSword; +import noppes.npcs.items.ItemBullet; +import noppes.npcs.items.ItemClaw; +import noppes.npcs.items.ItemCrossbow; +import noppes.npcs.items.ItemDagger; +import noppes.npcs.items.ItemDaggerReversed; +import noppes.npcs.items.ItemElementalStaff; +import noppes.npcs.items.ItemExcalibur; +import noppes.npcs.items.ItemGlaive; +import noppes.npcs.items.ItemGun; +import noppes.npcs.items.ItemGunChainsaw; +import noppes.npcs.items.ItemKunai; +import noppes.npcs.items.ItemKunaiReversed; +import noppes.npcs.items.ItemLeafBlade; +import noppes.npcs.items.ItemMachineGun; +import noppes.npcs.items.ItemMounter; +import noppes.npcs.items.ItemMusic; +import noppes.npcs.items.ItemMusicBanjo; +import noppes.npcs.items.ItemMusicClarinet; +import noppes.npcs.items.ItemMusicOracina; +import noppes.npcs.items.ItemMusicViolin; +import noppes.npcs.items.ItemMusket; +import noppes.npcs.items.ItemNpcArmor; +import noppes.npcs.items.ItemNpcArmorColorable; +import noppes.npcs.items.ItemNpcBlock; +import noppes.npcs.items.ItemNpcCloner; +import noppes.npcs.items.ItemNpcColored; +import noppes.npcs.items.ItemNpcInterface; +import noppes.npcs.items.ItemNpcMovingPath; +import noppes.npcs.items.ItemNpcScripter; +import noppes.npcs.items.ItemNpcWand; +import noppes.npcs.items.ItemNpcWeaponInterface; +import noppes.npcs.items.ItemOrb; +import noppes.npcs.items.ItemPlaceholder; +import noppes.npcs.items.ItemRotatedShield; +import noppes.npcs.items.ItemScythe; +import noppes.npcs.items.ItemShield; +import noppes.npcs.items.ItemSkirt; +import noppes.npcs.items.ItemSlingshot; +import noppes.npcs.items.ItemSoulstoneEmpty; +import noppes.npcs.items.ItemSoulstoneFilled; +import noppes.npcs.items.ItemSpear; +import noppes.npcs.items.ItemStaff; +import noppes.npcs.items.ItemTeleporter; +import noppes.npcs.items.ItemThrowingShuriken; +import noppes.npcs.items.ItemThrowingWeapon; +import noppes.npcs.items.ItemWand; +import noppes.npcs.items.ItemWarhammer; +import cpw.mods.fml.common.registry.GameRegistry; + +public class CustomItems { + + public static Item wand; + public static Item cloner; + public static Item scripter; + public static Item moving; + public static Item mount; + public static Item teleporter; + + public static Item soulstoneEmpty; + public static Item soulstoneFull; + + public static Item banjo; + public static Item violin; + public static Item violinbow; + public static Item harp; + public static Item guitar; + public static Item frenchHorn; + public static Item clarinet; + public static Item ocarina; + + public static Item coinWood; + public static Item coinStone; + public static Item coinIron; + public static Item coinGold; + public static Item coinDiamond; + public static Item coinBronze; + public static Item coinEmerald; + public static Item moneyBag; + + public static Item bulletWood; + public static Item bulletStone; + public static Item bulletIron; + public static Item bulletGold; + public static Item bulletDiamond; + public static Item bulletBronze; + public static Item bulletEmerald; + public static Item bulletBlack; + + public static Item gunWood; + public static Item gunStone; + public static Item gunIron; + public static Item gunGold; + public static Item gunDiamond; + public static Item gunBronze; + public static Item gunEmerald; + public static Item gunMachine; + + public static Item halberdWood; + public static Item halberdStone; + public static Item halberdIron; + public static Item halberdGold; + public static Item halberdDiamond; + public static Item halberdBronze; + public static Item halberdEmerald; + public static Item halberdDemonic; + public static Item halberdFrost; + public static Item halberdMithril; + + public static Item tridentWood; + public static Item tridentStone; + public static Item tridentIron; + public static Item tridentGold; + public static Item tridentDiamond; + public static Item tridentBronze; + public static Item tridentEmerald; + public static Item tridentCurse; + public static Item tridentDemonic; + public static Item tridentFrost; + public static Item tridentMithril; + + public static Item glaiveWood; + public static Item glaiveStone; + public static Item glaiveIron; + public static Item glaiveGold; + public static Item glaiveDiamond; + public static Item glaiveBronze; + public static Item glaiveEmerald; + public static Item glaiveDemonic; + public static Item glaiveFrost; + public static Item glaiveMithril; + + public static Item battleAxeWood; + public static Item battleAxeStone; + public static Item battleAxeIron; + public static Item battleAxeGold; + public static Item battleAxeDiamond; + public static Item battleAxeBronze; + public static Item battleAxeEmerald; + public static Item battleAxeCurse; + public static Item battleAxeDemonic; + public static Item battleAxeFrost; + public static Item battleAxeMithril; + + public static Item spellNature; + public static Item spellArcane; + public static Item spellItem; + public static Item spellLightning; + public static Item spellIce; + public static Item spellFire; + public static Item spellDark; + public static Item spellHoly; + + public static Item staffWood; + public static Item staffStone; + public static Item staffIron; + public static Item staffGold; + public static Item staffDiamond; + public static Item staffBronze; + public static Item staffEmerald; + public static Item staffDemonic; + public static Item staffFrost; + public static Item staffMithril; + public static Item staffElemental; + public static Item orb; + public static Item mana; + + public static Item swordBronze; + public static Item swordEmerald; + public static Item swordDemonic; + public static Item swordFrost; + public static Item swordMithril; + + public static Item bronze_ingot; + public static Item demonic_ingot; + public static Item mithril_ingot; + + public static Item kunai; + public static Item shuriken; + + public static Item excalibur; + public static Item letter; + public static Item bag; + public static Item satchel; + + public static Block redstoneBlock; + public static Block carpentyBench; + public static Block mailbox; + public static Block waypoint; + public static Block border; + + public static Block banner; + public static Block wallBanner; + public static Block tallLamp; + public static Block blood; + public static Block book; + public static Block chair; + public static Block crate; + public static Block weaponsRack; + public static Block pedestal; + public static Block couchWool; + public static Block couchWood; + public static Block table; + public static Block stool; + public static Block bigsign; + public static Block barrel; + public static Block tombstone; + public static Block shelf; + public static Block sign; + public static Block beam; + public static Block crystal; + + public static Block lamp; + public static Block campfire; + public static Block candle; + + public static Block lamp_unlit; + public static Block campfire_unlit; + public static Block candle_unlit; + + public static Item crossbowBolt; + + public static CreativeTabNpcs tab = new CreativeTabNpcs("cnpcs"); + public static CreativeTabNpcs tabArmor; + public static CreativeTabNpcs tabWeapon; + public static CreativeTabNpcs tabBlocks = new CreativeTabNpcs("cnpcsb"); + public static CreativeTabNpcs tabMisc = new CreativeTabNpcs("cnpcsm"); + + + public static void load(){ + GameRegistry.registerTileEntity(TileRedstoneBlock.class, "TileRedstoneBlock"); + GameRegistry.registerTileEntity(TileBlockAnvil.class, "TileBlockAnvil"); + GameRegistry.registerTileEntity(TileMailbox.class, "TileMailbox"); + GameRegistry.registerTileEntity(TileWaypoint.class, "TileWaypoint"); + GameRegistry.registerTileEntity(TileBanner.class, "TileNPCBanner"); + + if(!CustomNpcs.DisableExtraBlock){ + GameRegistry.registerTileEntity(TileWallBanner.class, "TileNPCWallBanner"); + GameRegistry.registerTileEntity(TileTallLamp.class, "TileNPCTallLamp"); + GameRegistry.registerTileEntity(TileChair.class, "TileNPCChair"); + GameRegistry.registerTileEntity(TileCrate.class, "TileNPCCrate"); + GameRegistry.registerTileEntity(TileWeaponRack.class, "TileNPCWeaponRack"); + GameRegistry.registerTileEntity(TileCouchWool.class, "TileNPCCouchWool"); + GameRegistry.registerTileEntity(TileCouchWood.class, "TileNPCCouchWood"); + GameRegistry.registerTileEntity(TileTable.class, "TileNPCTable"); + GameRegistry.registerTileEntity(TileLamp.class, "TileNPCLamp"); + GameRegistry.registerTileEntity(TileCandle.class, "TileNPCCandle"); + GameRegistry.registerTileEntity(TileBorder.class, "TileNPCBorder"); + GameRegistry.registerTileEntity(TileStool.class, "TileNPCStool"); + GameRegistry.registerTileEntity(TileBigSign.class, "TileNPCBigSign"); + GameRegistry.registerTileEntity(TileBarrel.class, "TileNPCBarrel"); + GameRegistry.registerTileEntity(TileCampfire.class, "TileNPCCampfire"); + GameRegistry.registerTileEntity(TileTombstone.class, "TileNPCTombstone"); + GameRegistry.registerTileEntity(TileShelf.class, "TileNPCShelf"); + GameRegistry.registerTileEntity(TileSign.class, "TileNPCSign"); + GameRegistry.registerTileEntity(TileBeam.class, "TileNPCBeam"); + GameRegistry.registerTileEntity(TileBook.class, "TileNPCBook"); + GameRegistry.registerTileEntity(TilePedestal.class, "TileNPCPedestal"); + } + wand = new ItemNpcWand().setUnlocalizedName("npcWand").setFull3D(); + cloner = new ItemNpcCloner().setUnlocalizedName("npcMobCloner").setFull3D(); + scripter = new ItemNpcScripter().setUnlocalizedName("npcScripter").setFull3D(); + moving = new ItemNpcMovingPath().setUnlocalizedName("npcMovingPath").setFull3D(); + mount = new ItemMounter().setUnlocalizedName("npcMounter").setFull3D(); + teleporter = new ItemTeleporter().setUnlocalizedName("npcTeleporter").setFull3D(); + + redstoneBlock = new BlockNpcRedstone().setHardness(50.0F).setResistance(2000).setBlockName("npcRedstoneBlock").setBlockTextureName("customnpcs:npcRedstoneBlock").setCreativeTab(tab); + carpentyBench = new BlockCarpentryBench().setBlockName("npcCarpentyBench").setHardness(5.0F).setResistance(10.0F).setStepSound(Block.soundTypeWood).setCreativeTab(tabBlocks); + mailbox = new BlockMailbox().setBlockName("npcMailbox").setHardness(5.0F).setResistance(10.0F).setStepSound(Block.soundTypeMetal).setCreativeTab(tabBlocks); + waypoint = new BlockWaypoint().setBlockName("npcLocationBlock").setHardness(5.0F).setResistance(10.0F).setStepSound(Block.soundTypeMetal).setBlockTextureName("customnpcs:npcWaypoint").setCreativeTab(tab); + border = new BlockBorder().setBlockName("npcBorder").setHardness(5.0F).setResistance(10.0F).setStepSound(Block.soundTypeWood).setCreativeTab(tab).setBlockTextureName("customnpcs:npcBorder"); + + soulstoneEmpty = new ItemSoulstoneEmpty().setUnlocalizedName("npcSoulstoneEmpty").setTextureName("customnpcs:npcSoulstoneEmpty").setCreativeTab(tab); + soulstoneFull = new ItemSoulstoneFilled().setUnlocalizedName("npcSoulstoneFilled").setTextureName("customnpcs:npcSoulstoneFilled"); + + BlockDispenser.dispenseBehaviorRegistry.putObject(soulstoneFull, new BehaviorDefaultDispenseItem(){ + + @Override + public ItemStack dispenseStack(IBlockSource source, ItemStack item){ + EnumFacing enumfacing = BlockDispenser.func_149937_b(source.getBlockMetadata()); + int x = source.getXInt() + enumfacing.getFrontOffsetX(); + int z = source.getZInt() + enumfacing.getFrontOffsetZ(); + ((ItemSoulstoneFilled)soulstoneFull).spawn(null, item, source.getWorld(), x, source.getYInt(), z); + item.splitStack(1); + return item; + } + }); + GameRegistry.registerBlock(redstoneBlock, "npcRedstoneBlock"); + GameRegistry.registerBlock(carpentyBench, ItemNpcBlock.class, "npcCarpentyBench"); + GameRegistry.registerBlock(mailbox, ItemBlock.class, "npcMailbox"); + GameRegistry.registerBlock(waypoint, "npcWaypoint"); + GameRegistry.registerBlock(border, "npcBorder"); + + Item.getItemFromBlock(mailbox).setHasSubtypes(true); + Item.getItemFromBlock(carpentyBench).setHasSubtypes(true); + + ((ItemNpcBlock)Item.getItemFromBlock(carpentyBench)).names = new String[]{"tile.npcCarpentyBench", "tile.anvil"}; + + if(!CustomNpcs.DisableExtraBlock){ + blood = new BlockBlood().setBlockName("npcBloodBlock").setBlockTextureName("customnpcs:npcBloodBlock").setCreativeTab(tabBlocks); + banner = new BlockBanner().setBlockName("npcBanner").setHardness(5.0F).setResistance(10.0F).setStepSound(Block.soundTypeMetal).setCreativeTab(tabBlocks); + wallBanner = new BlockWallBanner().setBlockName("npcWallBanner").setHardness(5.0F).setResistance(10.0F).setStepSound(Block.soundTypeMetal).setCreativeTab(tabBlocks); + tallLamp = new BlockTallLamp().setBlockName("npcTallLamp").setHardness(5.0F).setResistance(10.0F).setStepSound(Block.soundTypeMetal).setCreativeTab(tabBlocks); + chair = new BlockChair().setBlockName("npcChair").setHardness(5.0F).setResistance(10.0F).setStepSound(Block.soundTypeWood).setCreativeTab(tabBlocks); + crate = new BlockCrate().setBlockName("npcCrate").setHardness(5.0F).setResistance(10.0F).setStepSound(Block.soundTypeWood).setCreativeTab(tabBlocks); + weaponsRack = new BlockWeaponRack().setBlockName("npcWeaponRack").setHardness(5.0F).setResistance(10.0F).setStepSound(Block.soundTypeWood).setCreativeTab(tabBlocks); + couchWool = new BlockCouchWool().setBlockName("npcCouchWool").setHardness(5.0F).setResistance(10.0F).setStepSound(Block.soundTypeWood).setCreativeTab(tabBlocks); + table = new BlockTable().setBlockName("npcTable").setHardness(5.0F).setResistance(10.0F).setStepSound(Block.soundTypeWood).setCreativeTab(tabBlocks); + couchWood = new BlockCouchWood().setBlockName("npcCouchWood").setHardness(5.0F).setResistance(10.0F).setStepSound(Block.soundTypeWood).setCreativeTab(tabBlocks); + lamp = new BlockLamp(true).setBlockName("npcLamp").setHardness(5.0F).setResistance(10.0F).setStepSound(Block.soundTypeWood).setCreativeTab(tabBlocks); + candle = new BlockCandle(true).setBlockName("npcCandle").setHardness(5.0F).setResistance(10.0F).setStepSound(Block.soundTypeWood).setCreativeTab(tabBlocks); + stool = new BlockStool().setBlockName("npcStool").setHardness(5.0F).setResistance(10.0F).setStepSound(Block.soundTypeWood).setCreativeTab(tabBlocks); + Block placeholder = new BlockPlaceholder().setBlockName("npcPlaceholder").setHardness(5.0F).setResistance(10.0F).setStepSound(Block.soundTypeWood).setCreativeTab(tabMisc); + bigsign = new BlockBigSign().setBlockName("npcBigSign").setHardness(5.0F).setResistance(10.0F).setStepSound(Block.soundTypeWood).setCreativeTab(tabBlocks); + barrel = new BlockBarrel().setBlockName("npcBarrel").setHardness(5.0F).setResistance(10.0F).setStepSound(Block.soundTypeWood).setCreativeTab(tabBlocks); + campfire = new BlockCampfire(true).setBlockName("npcCampfire").setHardness(5.0F).setResistance(10.0F).setStepSound(Block.soundTypeStone).setCreativeTab(tabBlocks); + tombstone = new BlockTombstone().setBlockName("npcTombstone").setHardness(5.0F).setResistance(10.0F).setStepSound(Block.soundTypeStone).setCreativeTab(tabBlocks); + shelf = new BlockShelf().setBlockName("npcShelf").setHardness(5.0F).setResistance(10.0F).setStepSound(Block.soundTypeWood).setCreativeTab(tabBlocks); + sign = new BlockSign().setBlockName("npcSign").setHardness(5.0F).setResistance(10.0F).setStepSound(Block.soundTypeWood).setCreativeTab(tabBlocks); + beam = new BlockBeam().setBlockName("npcBeam").setHardness(5.0F).setResistance(10.0F).setStepSound(Block.soundTypeWood).setCreativeTab(tabBlocks); + book = new BlockBook().setHardness(5.0F).setResistance(10.0F).setStepSound(Block.soundTypeWood).setCreativeTab(tabBlocks); + pedestal = new BlockPedestal().setBlockName("npcPedestal").setHardness(5.0F).setResistance(10.0F).setStepSound(Block.soundTypeWood).setCreativeTab(tabBlocks); + crystal = new BlockCrystal().setBlockName("npcCrystal").setBlockTextureName("customnpcs:npcCrystal").setHardness(5.0F).setResistance(10.0F).setStepSound(Block.soundTypeGlass).setCreativeTab(tabBlocks); + + campfire_unlit = new BlockCampfire(false).setBlockName("npcCampfire").setHardness(5.0F).setResistance(10.0F).setStepSound(Block.soundTypeStone); + lamp_unlit = new BlockLamp(false).setBlockName("npcLamp").setHardness(5.0F).setResistance(10.0F).setStepSound(Block.soundTypeWood); + candle_unlit = new BlockCandle(false).setBlockName("npcCandle").setHardness(5.0F).setResistance(10.0F).setStepSound(Block.soundTypeWood); + + GameRegistry.registerBlock(blood, "npcBloodBlock"); + GameRegistry.registerBlock(banner, ItemBlock.class, "npcBanner"); + GameRegistry.registerBlock(wallBanner, ItemBlock.class, "npcWallBanner"); + GameRegistry.registerBlock(tallLamp, ItemBlock.class, "npcTallLamp"); + GameRegistry.registerBlock(chair, ItemBlock.class, "npcChair"); + GameRegistry.registerBlock(crate, ItemBlock.class, "npcCrate"); + GameRegistry.registerBlock(weaponsRack, ItemBlock.class, "npcWeaponRack"); + GameRegistry.registerBlock(couchWool, ItemBlock.class, "npcCouchWool"); + GameRegistry.registerBlock(couchWood, ItemBlock.class, "npcCouchWood"); + GameRegistry.registerBlock(table, ItemBlock.class, "npcTable"); + GameRegistry.registerBlock(stool, ItemBlock.class, "npcStool"); + GameRegistry.registerBlock(placeholder, ItemPlaceholder.class, "npcPlaceholder"); + GameRegistry.registerBlock(bigsign, "npcBigSign"); + GameRegistry.registerBlock(barrel, ItemBlock.class, "npcBarrel"); + GameRegistry.registerBlock(tombstone, ItemBlock.class, "npcTombstone"); + GameRegistry.registerBlock(shelf, ItemBlock.class, "npcShelf"); + GameRegistry.registerBlock(sign, ItemBlock.class, "npcSign"); + GameRegistry.registerBlock(beam, ItemBlock.class, "npcBeam"); + GameRegistry.registerBlock(book, "npcBook"); + GameRegistry.registerBlock(pedestal, ItemBlock.class, "npcPedestal"); + GameRegistry.registerBlock(crystal, ItemNpcColored.class, "npcCrystalBlock"); + GameRegistry.registerBlock(campfire, "npcCampfire"); + GameRegistry.registerBlock(lamp, "npcLamp"); + GameRegistry.registerBlock(candle, "npcCandle"); + GameRegistry.registerBlock(campfire_unlit, "npcCampfireUnlit"); + GameRegistry.registerBlock(candle_unlit, "npcLampUnlit"); + GameRegistry.registerBlock(lamp_unlit, "npcCandleUnlit"); + + Item.getItemFromBlock(banner).setHasSubtypes(true); + Item.getItemFromBlock(wallBanner).setHasSubtypes(true); + Item.getItemFromBlock(tallLamp).setHasSubtypes(true); + Item.getItemFromBlock(chair).setHasSubtypes(true); + Item.getItemFromBlock(crate).setHasSubtypes(true); + Item.getItemFromBlock(weaponsRack).setHasSubtypes(true); + Item.getItemFromBlock(couchWool).setHasSubtypes(true); + Item.getItemFromBlock(couchWood).setHasSubtypes(true); + Item.getItemFromBlock(table).setHasSubtypes(true); + Item.getItemFromBlock(stool).setHasSubtypes(true); + Item.getItemFromBlock(barrel).setHasSubtypes(true); + Item.getItemFromBlock(tombstone).setHasSubtypes(true); + Item.getItemFromBlock(shelf).setHasSubtypes(true); + Item.getItemFromBlock(sign).setHasSubtypes(true); + Item.getItemFromBlock(beam).setHasSubtypes(true); + Item.getItemFromBlock(pedestal).setHasSubtypes(true); + } + + banjo = new ItemMusicBanjo().setUnlocalizedName("npcBanjo").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcBanjo"); + violin = new ItemMusicViolin().setUnlocalizedName("npcViolin").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcViolin"); + violinbow = new ItemNpcInterface().setUnlocalizedName("npcViolinBow").setFull3D().setMaxStackSize(1).setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcViolinBow"); + harp = new ItemMusicViolin().setUnlocalizedName("npcHarp").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcHarp"); + guitar = new ItemMusicBanjo().setUnlocalizedName("npcGuitar").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcGuitar"); + frenchHorn = new ItemMusic().setRotated().setUnlocalizedName("npcFrenchHorn").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcFrenchHorn"); + ocarina = new ItemMusicOracina().setUnlocalizedName("npcOcarina").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcOcarina"); + clarinet = new ItemMusicClarinet().setUnlocalizedName("npcClarinet").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcClarinet"); + + + if(!CustomNpcs.DisableExtraItems){ + tabArmor = new CreativeTabNpcs("cnpcsa"); + tabWeapon = new CreativeTabNpcs("cnpcsw"); + + gunWood = new ItemGun(26820,EnumNpcToolMaterial.WOOD).setUnlocalizedName("npcWoodenGun").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcWoodenGun"); + bulletWood = new ItemBullet(26821,EnumNpcToolMaterial.WOOD).setUnlocalizedName("npcWoodenBullet").setMaxStackSize(64).setTextureName("customnpcs:npcWoodenBullet"); + + gunStone = new ItemGun(26822,EnumNpcToolMaterial.STONE).setUnlocalizedName("npcStoneGun").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcStoneGun"); + bulletStone = new ItemBullet(26823,EnumNpcToolMaterial.STONE).setUnlocalizedName("npcStoneBullet").setMaxStackSize(64).setTextureName("customnpcs:npcStoneBullet"); + + gunIron = new ItemGun(26824,EnumNpcToolMaterial.IRON).setUnlocalizedName("npcIronGun").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcIronGun"); + bulletIron = new ItemBullet(26825,EnumNpcToolMaterial.IRON).setUnlocalizedName("npcIronBullet").setMaxStackSize(64).setTextureName("customnpcs:npcIronBullet"); + + gunGold = new ItemGun(26826,EnumNpcToolMaterial.GOLD).setUnlocalizedName("npcGoldGun").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcGoldGun"); + bulletGold = new ItemBullet(26827,EnumNpcToolMaterial.GOLD).setUnlocalizedName("npcGoldenBullet").setMaxStackSize(64).setTextureName("customnpcs:npcGoldenBullet"); + + gunDiamond = new ItemGun(26828,EnumNpcToolMaterial.DIA).setUnlocalizedName("npcDiamondGun").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcDiamondGun"); + bulletDiamond = new ItemBullet(26829,EnumNpcToolMaterial.DIA).setUnlocalizedName("npcDiamondBullet").setMaxStackSize(64).setTextureName("customnpcs:npcDiamondBullet"); + + gunBronze = new ItemGun(26830,EnumNpcToolMaterial.BRONZE).setUnlocalizedName("npcBronzeGun").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcBronzeGun"); + bulletBronze = new ItemBullet(26831,EnumNpcToolMaterial.BRONZE).setUnlocalizedName("npcBronzeBullet").setMaxStackSize(64).setTextureName("customnpcs:npcBronzeBullet"); + + gunEmerald = new ItemGun(26832,EnumNpcToolMaterial.EMERALD).setUnlocalizedName("npcEmeraldGun").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcEmeraldGun"); + bulletEmerald = new ItemBullet(26833,EnumNpcToolMaterial.EMERALD).setUnlocalizedName("npcEmeraldBullet").setMaxStackSize(64).setTextureName("customnpcs:npcEmeraldBullet"); + + gunMachine = new ItemMachineGun(26834).setUnlocalizedName("npcMachineGun").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcMachineGun"); + bulletBlack = new ItemBullet(26835,EnumNpcToolMaterial.WOOD).setUnlocalizedName("npcBlackBullet").setMaxStackSize(64).setTextureName("customnpcs:npcBlackBullet"); + + ToolMaterial bronze = EnumHelper.addToolMaterial("BRONZE", 2, 170, 5.0F, 2, 15); + ToolMaterial emerald = EnumHelper.addToolMaterial("REALEMERALD", 3, 1000, 8.0F, 4, 10); + ToolMaterial demonic = EnumHelper.addToolMaterial("DEMONIC", 3, 100, 8.0F, 6, 22); + ToolMaterial frost = EnumHelper.addToolMaterial("FROST", 2, 59, 6.0F, 3, 5); + ToolMaterial mithril = EnumHelper.addToolMaterial("MITHRIL", 3, 3000, 8.0F, 3.0F, 10); + + tridentWood = new ItemSpear(26840,ToolMaterial.WOOD).setUnlocalizedName("npcWoodenTrident").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcWoodenTrident"); + tridentStone = new ItemSpear(26841,ToolMaterial.STONE).setUnlocalizedName("npcStoneTrident").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcStoneTrident"); + tridentIron = new ItemSpear(26842,ToolMaterial.IRON).setUnlocalizedName("npcIronTrident").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcIronTrident"); + tridentGold = new ItemSpear(26843,ToolMaterial.GOLD).setUnlocalizedName("npcGoldTrident").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcGoldTrident"); + tridentDiamond = new ItemSpear(26844,ToolMaterial.EMERALD).setUnlocalizedName("npcDiamondTrident").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcDiamondTrident"); + tridentBronze = new ItemSpear(26845,bronze).setUnlocalizedName("npcBronzeTrident").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcBronzeTrident"); + tridentEmerald = new ItemSpear(26846,emerald).setUnlocalizedName("npcEmeraldTrident").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcEmeraldTrident"); + tridentCurse = new ItemSpear(26847,emerald).setUnlocalizedName("npcCursedTrident").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcCursedTrident"); + tridentDemonic = new ItemSpear(26847,demonic).setUnlocalizedName("npcDemonicTrident").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcDemonicTrident"); + tridentFrost = new ItemSpear(26847,frost).setUnlocalizedName("npcFrostTrident").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcFrostTrident"); + tridentMithril = new ItemSpear(26847,mithril).setUnlocalizedName("npcMithrilTrident").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcMithrilTrident"); + + spellNature = new ItemNpcInterface(26930).setUnlocalizedName("npcNatureSpell").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcNatureSpell"); + spellArcane = new ItemNpcInterface(26931).setUnlocalizedName("npcArcaneSpell").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcArcaneSpell"); + spellLightning = new ItemNpcInterface(26932).setUnlocalizedName("npcLightningSpell").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcLightningSpell"); + spellIce = new ItemNpcInterface(26933).setUnlocalizedName("npcIceSpell").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcIceSpell"); + spellFire = new ItemNpcInterface(26934).setUnlocalizedName("npcFireSpell").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcFireSpell"); + spellDark = new ItemNpcInterface(26935).setUnlocalizedName("npcDarkSpell").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcDarkSpell"); + spellHoly = new ItemNpcInterface(26936).setUnlocalizedName("npcHolySpell").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcHolySpell"); + + orb = new ItemOrb(26937).setUnlocalizedName("npcOrb").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcOrb"); + mana = new ItemNpcInterface(26938).setUnlocalizedName("npcMana").setCreativeTab(CustomItems.tabWeapon).setTextureName("customnpcs:npcMana"); + Item brokenOrb = new ItemOrb(26939).setUnlocalizedName("npcBrokenOrb").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcBrokenOrb"); + + kunai = new ItemKunai(26910,ToolMaterial.IRON).setUnlocalizedName("npcKunai").setMaxStackSize(1).setFull3D().setTextureName("customnpcs:npcKunai"); + Item kunai = new ItemKunaiReversed(26911,ToolMaterial.IRON).setUnlocalizedName("npcReverseKunai").setMaxStackSize(1).setFull3D().setTextureName("customnpcs:npcReverseKunai"); + kunai = new ItemThrowingShuriken(26912).setRotating().setDropItem().setUnlocalizedName("npcShuriken").setFull3D().setTextureName("customnpcs:npcShuriken"); + shuriken = new ItemThrowingWeapon(26913).setDamage(4).setRotating().setDropItem().setUnlocalizedName("npcGiantShuriken").setFull3D().setTextureName("customnpcs:npcGiantShuriken"); + Item katana = new ItemNpcWeaponInterface(26914,ToolMaterial.IRON).setUnlocalizedName("npcKatana").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcKatana"); + Item knive = new ItemDagger(26915,ToolMaterial.IRON).setUnlocalizedName("npcKukri").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcKukri"); + + swordBronze = new ItemNpcWeaponInterface(bronze).setUnlocalizedName("npcBronzeSword").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcBronzeSword"); + swordEmerald = new ItemNpcWeaponInterface(emerald).setUnlocalizedName("npcEmeraldSword").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcEmeraldSword"); + swordDemonic = new ItemNpcWeaponInterface(demonic).setUnlocalizedName("npcDemonicSword").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcDemonicSword"); + swordFrost = new ItemNpcWeaponInterface(frost).setUnlocalizedName("npcFrostSword").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcFrostSword"); + swordMithril = new ItemNpcWeaponInterface(mithril).setUnlocalizedName("npcMithrilSword").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcMithrilSword"); + + Item golf = new ItemSpear(26800,ToolMaterial.IRON).setUnlocalizedName("npcGolfClub").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcGolfClub"); + Item magicwand = new ItemWand(26801).setUnlocalizedName("npcMagicWand").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcMagicWand"); + Item chickenSword = new ItemNpcInterface(26802).setUnlocalizedName("npcChickenSword").setFull3D().setMaxStackSize(1).setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcChickenSword"); + Item handcuffs = new ItemNpcInterface(26803).setUnlocalizedName("npcHandCuffs").setFull3D().setMaxStackSize(1).setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcHandCuffs"); + Item hammer = new ItemNpcWeaponInterface(26804,ToolMaterial.STONE).setUnlocalizedName("npcHammer").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcHammer"); + Item baseballbat = new ItemNpcWeaponInterface(26805,ToolMaterial.IRON).setUnlocalizedName("npcBaseballBat").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcBaseballBat"); + Item leadpipe = new ItemNpcWeaponInterface(26806,ToolMaterial.IRON).setUnlocalizedName("npcLeadPipe").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcLeadPipe"); + Item cleaver = new ItemNpcWeaponInterface(26807,ToolMaterial.IRON).setUnlocalizedName("npcCleaver").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcCleaver"); + Item saber = new ItemNpcWeaponInterface(26808,ToolMaterial.IRON).setUnlocalizedName("npcSaber").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcSaber"); + Item hockey = new ItemSpear(26809,ToolMaterial.IRON).setUnlocalizedName("npcHockeyStick").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcHockeyStick"); + hammer = new ItemSpear(26810,ToolMaterial.IRON).setUnlocalizedName("npcSledgeHammer").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcSledgeHammer"); + Item bottle = new ItemNpcWeaponInterface(26811,ToolMaterial.IRON).setUnlocalizedName("npcBrokenBottle").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcBrokenBottle"); + knive = new ItemDagger(26812,ToolMaterial.STONE).setUnlocalizedName("npcCombatKnive").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcCombatKnive"); + Item lighter = new ItemFlintAndSteel().setUnlocalizedName("npcLighter").setMaxStackSize(1).setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcLighter"); + Item macuahuitl = new ItemNpcWeaponInterface(26714,ToolMaterial.IRON).setUnlocalizedName("npcMacuahuitl").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcMacuahuitl"); + Item bowstaff = new ItemGlaive(26715,ToolMaterial.IRON).setUnlocalizedName("npcBoStaff").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcBoStaff"); + Item sai = new ItemDagger(26757,ToolMaterial.IRON).setUnlocalizedName("npcSaiBlade").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcSaiBlade"); + Item slingshot = new ItemSlingshot(26767).setUnlocalizedName("npcSlingshot").setFull3D().setTextureName("customnpcs:npcSlingshot"); + Item musket = new ItemMusket(26758).setUnlocalizedName("npcMusket").setFull3D().setTextureName("customnpcs:npcMusket").setMaxStackSize(1); + Item leaf = new ItemLeafBlade(26758,ToolMaterial.IRON).setUnlocalizedName("npcLeafBlade").setFull3D().setTextureName("customnpcs:npcLeafBlade").setMaxStackSize(1); + + Item crossbow = new ItemCrossbow(26768).setUnlocalizedName("npcCrossbow").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcCrossbow"); + crossbowBolt = new ItemBullet(26769,EnumNpcToolMaterial.WOOD).setUnlocalizedName("npcCrossBolt").setMaxStackSize(64).setTextureName("customnpcs:npcCrossBolt"); + + Item batton = new ItemNpcWeaponInterface(26814,ToolMaterial.STONE).setUnlocalizedName("npcBatton").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcBatton"); + Item chainsaw = new ItemGunChainsaw(26815,ToolMaterial.EMERALD).setUnlocalizedName("npcGunChainsaw").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcGunChainsaw"); + Item rapier = new ItemNpcWeaponInterface(26816,ToolMaterial.IRON).setUnlocalizedName("npcRapier").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcRapier"); + Item crowbar = new ItemNpcWeaponInterface(26817,ToolMaterial.IRON).setUnlocalizedName("npcCrowbar").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcCrowbar"); + Item pipewrench = new ItemNpcWeaponInterface(26818,ToolMaterial.IRON).setUnlocalizedName("npcPipeWrench").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcPipeWrench"); + Item swiss = new ItemDagger(26819,ToolMaterial.IRON).setUnlocalizedName("npcSwissArmyKnife").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcSwissArmyKnife"); + Item wrench = new ItemNpcWeaponInterface(26836,ToolMaterial.IRON).setUnlocalizedName("npcWrench").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcWrench"); + excalibur = new ItemExcalibur(26799,ToolMaterial.EMERALD).setUnlocalizedName("npcExcalibur").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcExcalibur"); + + Item shield = new ItemShield(26729,EnumNpcToolMaterial.WOOD).setUnlocalizedName("npcWoodenShield").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcWoodenShield"); + shield = new ItemShield(26730,EnumNpcToolMaterial.STONE).setUnlocalizedName("npcStoneShield").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcStoneShield"); + shield = new ItemShield(26736,EnumNpcToolMaterial.IRON).setUnlocalizedName("npcIronShield").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcIronShield"); + shield = new ItemShield(26737,EnumNpcToolMaterial.GOLD).setUnlocalizedName("npcGoldenShield").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcGoldenShield"); + shield = new ItemShield(26738,EnumNpcToolMaterial.DIA).setUnlocalizedName("npcDiaShield").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcDiaShield"); + shield = new ItemShield(26739,EnumNpcToolMaterial.BRONZE).setUnlocalizedName("npcBronzeShield").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcBronzeShield"); + shield = new ItemShield(26728,EnumNpcToolMaterial.EMERALD).setUnlocalizedName("npcEmeraldShield").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcEmeraldShield"); + shield = new ItemShield(26739,EnumNpcToolMaterial.DEMONIC).setUnlocalizedName("npcDemonicShield").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcDemonicShield"); + shield = new ItemRotatedShield(26739,EnumNpcToolMaterial.FROST).setUnlocalizedName("npcFrostShield").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcFrostShield"); + shield = new ItemRotatedShield(26739,EnumNpcToolMaterial.MITHRIL).setUnlocalizedName("npcMithrilShield").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcMithrilShield"); + + shield = new ItemRotatedShield(26740,EnumNpcToolMaterial.WOOD).setUnlocalizedName("npcFullWoodenShield").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcFullWoodenShield"); + shield = new ItemRotatedShield(26741,EnumNpcToolMaterial.STONE).setUnlocalizedName("npcFullStoneShield").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcFullStoneShield"); + shield = new ItemRotatedShield(26742,EnumNpcToolMaterial.IRON).setUnlocalizedName("npcFullIronShield").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcFullIronShield"); + shield = new ItemRotatedShield(26743,EnumNpcToolMaterial.GOLD).setUnlocalizedName("npcFullGoldenShield").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcFullGoldenShield"); + shield = new ItemRotatedShield(26744,EnumNpcToolMaterial.DIA).setUnlocalizedName("npcFullDiaShield").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcFullDiaShield"); + shield = new ItemRotatedShield(26745,EnumNpcToolMaterial.BRONZE).setUnlocalizedName("npcFullBronzeShield").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcFullBronzeShield"); + shield = new ItemRotatedShield(26727,EnumNpcToolMaterial.EMERALD).setUnlocalizedName("npcFullEmeraldShield").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcFullEmeraldShield"); + + shield = new ItemShield(26746,EnumNpcToolMaterial.IRON).setUnlocalizedName("npcHeaterShield").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcHeaterShield"); + shield = new ItemShield(26747,EnumNpcToolMaterial.IRON).setUnlocalizedName("npcCryscentShield").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcCryscentShield"); + shield = new ItemShield(26748,EnumNpcToolMaterial.IRON).setUnlocalizedName("npcScutumShield").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcScutumShield"); + shield = new ItemRotatedShield(26749,EnumNpcToolMaterial.IRON).setUnlocalizedName("npcTowerShield").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcTowerShield"); + + Item spear = new ItemSpear(26750,ToolMaterial.WOOD).setUnlocalizedName("npcWoodenSpear").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcWoodenSpear"); + spear = new ItemSpear(26751,ToolMaterial.STONE).setUnlocalizedName("npcStoneSpear").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcStoneSpear"); + spear = new ItemSpear(26752,ToolMaterial.IRON).setUnlocalizedName("npcIronSpear").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcIronSpear"); + spear = new ItemSpear(26753,ToolMaterial.GOLD).setUnlocalizedName("npcGoldenSpear").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcGoldenSpear"); + spear = new ItemSpear(26754,ToolMaterial.EMERALD).setUnlocalizedName("npcDiamondSpear").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcDiamondSpear"); + spear = new ItemSpear(26755,bronze).setUnlocalizedName("npcBronzeSpear").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcBronzeSpear"); + spear = new ItemSpear(26756,emerald).setUnlocalizedName("npcEmeraldSpear").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcEmeraldSpear"); + spear = new ItemSpear(26756,demonic).setUnlocalizedName("npcDemonicSpear").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcDemonicSpear"); + spear = new ItemSpear(26756,frost).setUnlocalizedName("npcFrostSpear").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcFrostSpear"); + spear = new ItemSpear(26756,mithril).setUnlocalizedName("npcMithrilSpear").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcMithrilSpear"); + + halberdWood = new ItemSpear(26750,ToolMaterial.WOOD).setUnlocalizedName("npcWoodenHalberd").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcWoodenHalberd"); + halberdStone = new ItemSpear(26751,ToolMaterial.STONE).setUnlocalizedName("npcStoneHalberd").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcStoneHalberd"); + halberdIron = new ItemSpear(26752,ToolMaterial.IRON).setUnlocalizedName("npcIronHalberd").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcIronHalberd"); + halberdGold = new ItemSpear(26753,ToolMaterial.GOLD).setUnlocalizedName("npcGoldenHalberd").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcGoldenHalberd"); + halberdDiamond = new ItemSpear(26754,ToolMaterial.EMERALD).setUnlocalizedName("npcDiamondHalberd").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcDiamondHalberd"); + halberdBronze = new ItemSpear(26755,bronze).setUnlocalizedName("npcBronzeHalberd").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcBronzeHalberd"); + halberdEmerald = new ItemSpear(26756,emerald).setUnlocalizedName("npcEmeraldHalberd").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcEmeraldHalberd"); + halberdDemonic = new ItemSpear(26756,demonic).setUnlocalizedName("npcDemonicHalberd").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcDemonicHalberd"); + halberdFrost = new ItemSpear(26756,frost).setUnlocalizedName("npcFrostHalberd").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcFrostHalberd"); + halberdMithril = new ItemSpear(26756,mithril).setUnlocalizedName("npcMithrilHalberd").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcMithrilHalberd"); + + battleAxeWood = new ItemBattleAxe(26760,ToolMaterial.WOOD).setUnlocalizedName("npcWoodenBattleAxe").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcWoodenBattleAxe"); + battleAxeStone = new ItemBattleAxe(26761,ToolMaterial.STONE).setUnlocalizedName("npcStoneBattleAxe").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcStoneBattleAxe"); + battleAxeIron = new ItemBattleAxe(26762,ToolMaterial.IRON).setUnlocalizedName("npcIronBattleAxe").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcIronBattleAxe"); + battleAxeGold = new ItemBattleAxe(26763,ToolMaterial.GOLD).setUnlocalizedName("npcGoldenBattleAxe").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcGoldenBattleAxe"); + battleAxeDiamond = new ItemBattleAxe(26764,ToolMaterial.EMERALD).setUnlocalizedName("npcDiamondBattleAxe").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcDiamondBattleAxe"); + battleAxeBronze = new ItemBattleAxe(26765,bronze).setUnlocalizedName("npcBronzeBattleAxe").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcBronzeBattleAxe"); + battleAxeEmerald = new ItemBattleAxe(26766,emerald).setUnlocalizedName("npcEmeraldBattleAxe").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcEmeraldBattleAxe"); + battleAxeDemonic = new ItemBattleAxe(26766,demonic).setUnlocalizedName("npcDemonicBattleAxe").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcDemonicBattleAxe"); + battleAxeFrost = new ItemBattleAxe(26766,frost).setUnlocalizedName("npcFrostBattleAxe").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcFrostBattleAxe"); + battleAxeMithril = new ItemBattleAxe(26766,mithril).setUnlocalizedName("npcMithrilBattleAxe").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcMithrilBattleAxe"); + + Item warhammer = new ItemWarhammer(26760,ToolMaterial.WOOD).setUnlocalizedName("npcWoodenWarhammer").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcWoodenWarhammer"); + warhammer = new ItemWarhammer(26761,ToolMaterial.STONE).setUnlocalizedName("npcStoneWarhammer").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcStoneWarhammer"); + warhammer = new ItemWarhammer(26762,ToolMaterial.IRON).setUnlocalizedName("npcIronWarhammer").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcIronWarhammer"); + warhammer = new ItemWarhammer(26763,ToolMaterial.GOLD).setUnlocalizedName("npcGoldenWarhammer").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcGoldenWarhammer"); + warhammer = new ItemWarhammer(26764,ToolMaterial.EMERALD).setUnlocalizedName("npcDiamondWarhammer").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcDiamondWarhammer"); + warhammer = new ItemWarhammer(26765,bronze).setUnlocalizedName("npcBronzeWarhammer").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcBronzeWarhammer"); + warhammer = new ItemWarhammer(26766,emerald).setUnlocalizedName("npcEmeraldWarhammer").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcEmeraldWarhammer"); + warhammer = new ItemWarhammer(26766,demonic).setUnlocalizedName("npcDemonicWarhammer").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcDemonicWarhammer"); + warhammer = new ItemWarhammer(26766,frost).setUnlocalizedName("npcFrostWarhammer").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcFrostWarhammer"); + warhammer = new ItemWarhammer(26766,mithril).setUnlocalizedName("npcMithrilWarhammer").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcMithrilWarhammer"); + + Item mace = new ItemNpcWeaponInterface(26770,ToolMaterial.WOOD).setUnlocalizedName("npcWoodenMace").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcWoodenMace"); + mace = new ItemNpcWeaponInterface(26771,ToolMaterial.STONE).setUnlocalizedName("npcStoneMace").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcStoneMace"); + mace = new ItemNpcWeaponInterface(26772,ToolMaterial.IRON).setUnlocalizedName("npcIronMace").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcIronMace"); + mace = new ItemNpcWeaponInterface(26773,ToolMaterial.GOLD).setUnlocalizedName("npcGoldenMace").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcGoldenMace"); + mace = new ItemNpcWeaponInterface(26774,ToolMaterial.EMERALD).setUnlocalizedName("npcDiamondMace").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcDiamondMace"); + mace = new ItemNpcWeaponInterface(26775,bronze).setUnlocalizedName("npcBronzeMace").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcBronzeMace"); + mace = new ItemNpcWeaponInterface(26776,emerald).setUnlocalizedName("npcEmeraldMace").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcEmeraldMace"); + mace = new ItemNpcWeaponInterface(26776,demonic).setUnlocalizedName("npcDemonicMace").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcDemonicMace"); + mace = new ItemNpcWeaponInterface(26776,frost).setUnlocalizedName("npcFrostMace").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcFrostMace"); + mace = new ItemNpcWeaponInterface(26776,mithril).setUnlocalizedName("npcMithrilMace").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcMithrilMace"); + + Item dagger = new ItemDagger(26700,ToolMaterial.WOOD).setUnlocalizedName("npcWoodenDagger").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcWoodenDagger"); + dagger = new ItemDaggerReversed(26701, (ItemDagger) dagger, ToolMaterial.WOOD).setUnlocalizedName("npcWoodenReversedDagger").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcWoodenDagger"); + dagger = new ItemDagger(26702,ToolMaterial.STONE).setUnlocalizedName("npcStoneDagger").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcStoneDagger"); + dagger = new ItemDaggerReversed(26703, (ItemDagger) dagger,ToolMaterial.STONE).setUnlocalizedName("npcStoneReversedDagger").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcStoneDagger"); + dagger = new ItemDagger(26704,ToolMaterial.IRON).setUnlocalizedName("npcIronDagger").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcIronDagger"); + dagger = new ItemDaggerReversed(26705, (ItemDagger) dagger,ToolMaterial.IRON).setUnlocalizedName("npcIronReversedDagger").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcIronDagger"); + dagger = new ItemDagger(26706,ToolMaterial.GOLD).setUnlocalizedName("npcGoldenDagger").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcGoldenDagger"); + dagger = new ItemDaggerReversed(26707, (ItemDagger) dagger,ToolMaterial.GOLD).setUnlocalizedName("npcGoldenReversedDagger").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcGoldenDagger"); + dagger = new ItemDagger(26708,ToolMaterial.EMERALD).setUnlocalizedName("npcDiamondDagger").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcDiamondDagger"); + dagger = new ItemDaggerReversed(26709, (ItemDagger) dagger,ToolMaterial.EMERALD).setUnlocalizedName("npcDiamondReversedDagger").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcDiamondDagger"); + dagger = new ItemDagger(26710,bronze).setUnlocalizedName("npcBronzeDagger").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcBronzeDagger"); + dagger = new ItemDaggerReversed(26711, (ItemDagger) dagger,bronze).setUnlocalizedName("npcBronzeReversedDagger").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcBronzeDagger"); + dagger = new ItemDagger(26712,emerald).setUnlocalizedName("npcEmeraldDagger").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcEmeraldDagger"); + dagger = new ItemDaggerReversed(26713, (ItemDagger) dagger,emerald).setUnlocalizedName("npcEmeraldReversedDagger").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcEmeraldDagger"); + dagger = new ItemDagger(26712,demonic).setUnlocalizedName("npcDemonicDagger").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcDemonicDagger"); + dagger = new ItemDaggerReversed(26713, (ItemDagger) dagger,demonic).setUnlocalizedName("npcDemonicReversedDagger").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcDemonicDagger"); + dagger = new ItemDagger(26712,frost).setUnlocalizedName("npcFrostDagger").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcFrostDagger"); + dagger = new ItemDaggerReversed(26713, (ItemDagger) dagger,frost).setUnlocalizedName("npcFrostReversedDagger").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcFrostDagger"); + dagger = new ItemDagger(26712,mithril).setUnlocalizedName("npcMithrilDagger").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcMithrilDagger"); + dagger = new ItemDaggerReversed(26713, (ItemDagger) dagger,frost).setUnlocalizedName("npcMithrilReversedDagger").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcMithrilDagger"); + + Item claw = new ItemClaw(26850,ToolMaterial.IRON).setUnlocalizedName("npcNinjaClaw").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcNinjaClaw"); + claw = new ItemClaw(26851,ToolMaterial.IRON).setUnlocalizedName("npcSteelClaw").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcSteelClaw"); + claw = new ItemClaw(26852,ToolMaterial.IRON).setUnlocalizedName("npcBearClaw").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcBearClaw"); + claw = new ItemClaw(26853,ToolMaterial.IRON).setUnlocalizedName("npcKatar").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcKatar"); + + staffWood = new ItemStaff(26777,EnumNpcToolMaterial.WOOD).setUnlocalizedName("npcWoodenStaff").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcWoodenStaff"); + staffStone = new ItemStaff(26778,EnumNpcToolMaterial.STONE).setUnlocalizedName("npcStoneStaff").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcStoneStaff"); + staffIron = new ItemStaff(26779,EnumNpcToolMaterial.IRON).setUnlocalizedName("npcIronStaff").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcIronStaff"); + staffGold = new ItemStaff(26780,EnumNpcToolMaterial.GOLD).setUnlocalizedName("npcGoldenStaff").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcGoldenStaff"); + staffDiamond = new ItemStaff(26781,EnumNpcToolMaterial.DIA).setUnlocalizedName("npcDiamondStaff").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcDiamondStaff"); + staffBronze = new ItemStaff(26782,EnumNpcToolMaterial.BRONZE).setUnlocalizedName("npcBronzeStaff").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcBronzeStaff"); + staffEmerald = new ItemStaff(26783,EnumNpcToolMaterial.EMERALD).setUnlocalizedName("npcEmeraldStaff").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcEmeraldStaff"); + staffDemonic = new ItemStaff(26783,EnumNpcToolMaterial.DEMONIC).setUnlocalizedName("npcDemonicStaff").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcDemonicStaff"); + staffFrost = new ItemStaff(26783,EnumNpcToolMaterial.FROST).setUnlocalizedName("npcFrostStaff").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcFrostStaff"); + staffMithril = new ItemStaff(26783,EnumNpcToolMaterial.MITHRIL).setUnlocalizedName("npcMithrilStaff").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcMithrilStaff"); + staffElemental = new ItemElementalStaff(26784,EnumNpcToolMaterial.IRON).setUnlocalizedName("npcElementalStaff").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcElementalStaff"); + + Item scythe = new ItemScythe(26785,ToolMaterial.WOOD).setUnlocalizedName("npcWoodenScythe").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcWoodenScythe"); + scythe = new ItemScythe(26786,ToolMaterial.STONE).setUnlocalizedName("npcStoneScythe").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcStoneScythe"); + scythe = new ItemScythe(26787,ToolMaterial.IRON).setUnlocalizedName("npcIronScythe").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcIronScythe"); + scythe = new ItemScythe(26788,ToolMaterial.GOLD).setUnlocalizedName("npcGoldenScythe").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcGoldenScythe"); + scythe = new ItemScythe(26789,ToolMaterial.EMERALD).setUnlocalizedName("npcDiamondScythe").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcDiamondScythe"); + scythe = new ItemScythe(26798,emerald).setUnlocalizedName("npcEmeraldScythe").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcEmeraldScythe"); + scythe = new ItemScythe(26797,bronze).setUnlocalizedName("npcBronzeScythe").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcBronzeScythe"); + scythe = new ItemScythe(26797,demonic).setUnlocalizedName("npcDemonicScythe").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcDemonicScythe"); + scythe = new ItemScythe(26797,frost).setUnlocalizedName("npcFrostScythe").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcFrostScythe"); + scythe = new ItemScythe(26797,mithril).setUnlocalizedName("npcMithrilScythe").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcMithrilScythe"); + + glaiveWood = new ItemGlaive(26790,ToolMaterial.WOOD).setUnlocalizedName("npcWoodenGlaive").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcWoodenGlaive"); + glaiveStone = new ItemGlaive(26791,ToolMaterial.STONE).setUnlocalizedName("npcStoneGlaive").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcStoneGlaive"); + glaiveIron = new ItemGlaive(26792,ToolMaterial.IRON).setUnlocalizedName("npcIronGlaive").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcIronGlaive"); + glaiveGold = new ItemGlaive(26793,ToolMaterial.GOLD).setUnlocalizedName("npcGoldenGlaive").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcGoldenGlaive"); + glaiveDiamond = new ItemGlaive(26794,ToolMaterial.EMERALD).setUnlocalizedName("npcDiamondGlaive").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcDiamondGlaive"); + glaiveBronze = new ItemGlaive(26795,bronze).setUnlocalizedName("npcBronzeGlaive").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcBronzeGlaive"); + glaiveEmerald = new ItemGlaive(26796,emerald).setUnlocalizedName("npcEmeraldGlaive").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcEmeraldGlaive"); + glaiveDemonic = new ItemGlaive(26796,demonic).setUnlocalizedName("npcDemonicGlaive").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcDemonicGlaive"); + glaiveFrost = new ItemGlaive(26796,frost).setUnlocalizedName("npcFrostGlaive").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcFrostGlaive"); + glaiveMithril = new ItemGlaive(26796,mithril).setUnlocalizedName("npcMithrilGlaive").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcMithrilGlaive"); + + new ItemBroadSword(ToolMaterial.WOOD).setUnlocalizedName("npcWoodenBroadsword").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcWoodenBroadsword"); + new ItemBroadSword(ToolMaterial.STONE).setUnlocalizedName("npcStoneBroadsword").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcStoneBroadsword"); + new ItemBroadSword(ToolMaterial.IRON).setUnlocalizedName("npcIronBroadsword").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcIronBroadsword"); + new ItemBroadSword(ToolMaterial.GOLD).setUnlocalizedName("npcGoldenBroadsword").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcGoldenBroadsword"); + new ItemBroadSword(ToolMaterial.EMERALD).setUnlocalizedName("npcDiamondBroadsword").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcDiamondBroadsword"); + new ItemBroadSword(bronze).setUnlocalizedName("npcBronzeBroadsword").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcBronzeBroadsword"); + new ItemBroadSword(emerald).setUnlocalizedName("npcEmeraldBroadsword").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcEmeraldBroadsword"); + new ItemBroadSword(demonic).setUnlocalizedName("npcDemonicBroadsword").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcDemonicBroadsword"); + new ItemBroadSword(frost).setUnlocalizedName("npcFrostBroadsword").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcFrostBroadsword"); + new ItemBroadSword(mithril).setUnlocalizedName("npcMithrilBroadsword").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcMithrilBroadsword"); + + ItemArmor.ArmorMaterial armorMithril = EnumHelper.addArmorMaterial("MITHRIL", 40, new int[]{3, 8, 6, 3}, 20); + ItemArmor.ArmorMaterial armorBronze = EnumHelper.addArmorMaterial("BRONZE", 7, new int[]{2, 6, 5, 2}, 20); + ItemArmor.ArmorMaterial armorEmerald = EnumHelper.addArmorMaterial("EMERALD", 35, new int[]{5, 7, 4, 5}, 5); + + Item cowarmor = new ItemNpcArmor(26860, ArmorMaterial.CHAIN,0,"cowleather").setUnlocalizedName("npcCowleatherHead").setMaxStackSize(1).setTextureName("customnpcs:npcCowleatherHead"); + Item armor = new ItemNpcArmor(26861,ArmorMaterial.CHAIN,1,"cowleather").setUnlocalizedName("npcCowleatherChest").setMaxStackSize(1).setTextureName("customnpcs:npcCowleatherChest"); + armor = new ItemNpcArmor(26862,ArmorMaterial.CHAIN,2,"cowleather").setUnlocalizedName("npcCowleatherLegs").setMaxStackSize(1).setTextureName("customnpcs:npcCowleatherLegs"); + armor = new ItemNpcArmor(26863,ArmorMaterial.CHAIN,3,"cowleather").setUnlocalizedName("npcCowleatherBoots").setMaxStackSize(1).setTextureName("customnpcs:npcCowleatherBoots"); + + armor = new ItemNpcArmor(26864,ArmorMaterial.IRON,0,"nanorum").setUnlocalizedName("npcNanorumHead").setMaxStackSize(1).setTextureName("customnpcs:npcNanorumHead"); + armor = new ItemNpcArmor(26865,ArmorMaterial.IRON,1,"nanorum").setUnlocalizedName("npcNanorumChest").setMaxStackSize(1).setTextureName("customnpcs:npcNanorumChest"); + armor = new ItemNpcArmor(26866,ArmorMaterial.IRON,2,"nanorum").setUnlocalizedName("npcNanorumLegs").setMaxStackSize(1).setTextureName("customnpcs:npcNanorumLegs"); + armor = new ItemNpcArmor(26867,ArmorMaterial.IRON,3,"nanorum").setUnlocalizedName("npcNanorumBoots").setMaxStackSize(1).setTextureName("customnpcs:npcNanorumBoots"); + + armor = new ItemNpcArmor(26868,ArmorMaterial.IRON,0,"tactical").setUnlocalizedName("npcTacticalHead").setMaxStackSize(1).setTextureName("customnpcs:npcTacticalHead"); + armor = new ItemNpcArmor(26869,ArmorMaterial.IRON,1,"tactical").setUnlocalizedName("npcTacticalChest").setMaxStackSize(1).setTextureName("customnpcs:npcTacticalChest"); + + armor = new ItemNpcArmor(26919,ArmorMaterial.IRON,0,"fullcloth").setUnlocalizedName("npcFullLeatherHead").setMaxStackSize(1).setTextureName("customnpcs:npcFullLeatherHead"); + armor = new ItemNpcArmor(26920,ArmorMaterial.IRON,1,"fullcloth").setUnlocalizedName("npcFullLeatherChest").setMaxStackSize(1).setTextureName("customnpcs:npcFullLeatherChest"); + + armor = new ItemNpcArmor(26870,ArmorMaterial.IRON,0,"fulliron").setUnlocalizedName("npcFullIronHead").setMaxStackSize(1).setTextureName("customnpcs:npcFullIronHead"); + armor = new ItemNpcArmor(26871,ArmorMaterial.IRON,1,"fulliron").setUnlocalizedName("npcFullIronChest").setMaxStackSize(1).setTextureName("customnpcs:npcFullIronChest"); + + armor = new ItemNpcArmor(26872,ArmorMaterial.GOLD,0,"fullgold").setUnlocalizedName("npcFullGoldHead").setMaxStackSize(1).setTextureName("customnpcs:npcFullGoldHead"); + armor = new ItemNpcArmor(26873,ArmorMaterial.GOLD,1,"fullgold").setUnlocalizedName("npcFullGoldChest").setMaxStackSize(1).setTextureName("customnpcs:npcFullGoldChest"); + + armor = new ItemNpcArmor(26874,ArmorMaterial.DIAMOND,0,"fulldiamond").setUnlocalizedName("npcFullDiamondHead").setMaxStackSize(1).setTextureName("customnpcs:npcFullDiamondHead"); + armor = new ItemNpcArmor(26875,ArmorMaterial.DIAMOND,1,"fulldiamond").setUnlocalizedName("npcFullDiamondChest").setMaxStackSize(1).setTextureName("customnpcs:npcFullDiamondChest"); + + armor = new ItemNpcArmor(26876, armorBronze,0,"fullbronze").setUnlocalizedName("npcFullBronzeHead").setMaxStackSize(1).setTextureName("customnpcs:npcFullBronzeHead"); + armor = new ItemNpcArmor(26877, armorBronze,1,"fullbronze").setUnlocalizedName("npcFullBronzeChest").setMaxStackSize(1).setTextureName("customnpcs:npcFullBronzeChest"); + armor = new ItemNpcArmor(26878, armorBronze,2,"fullbronze").setUnlocalizedName("npcFullBronzeLeggings").setMaxStackSize(1).setTextureName("customnpcs:npcFullBronzeLeggings"); + armor = new ItemNpcArmor(26879, armorBronze,3,"fullbronze").setUnlocalizedName("npcFullBronzeBoots").setMaxStackSize(1).setTextureName("customnpcs:npcFullBronzeBoots"); + + armor = new ItemNpcArmor(26921, armorEmerald,0,"fullemerald").setUnlocalizedName("npcFullEmeraldHead").setMaxStackSize(1).setTextureName("customnpcs:npcFullEmeraldHead"); + armor = new ItemNpcArmor(26922, armorEmerald,1,"fullemerald").setUnlocalizedName("npcFullEmeraldChest").setMaxStackSize(1).setTextureName("customnpcs:npcFullEmeraldChest"); + armor = new ItemNpcArmor(26923, armorEmerald,2,"fullemerald").setUnlocalizedName("npcFullEmeraldLeggings").setMaxStackSize(1).setTextureName("customnpcs:npcFullEmeraldLeggings"); + armor = new ItemNpcArmor(26924, armorEmerald,3,"fullemerald").setUnlocalizedName("npcFullEmeraldBoots").setMaxStackSize(1).setTextureName("customnpcs:npcFullEmeraldBoots"); + + armor = new ItemNpcArmor(26880,ArmorMaterial.CLOTH,0,"fullwood").setUnlocalizedName("npcFullWoodenHead").setMaxStackSize(1).setTextureName("customnpcs:npcFullWoodenHead"); + armor = new ItemNpcArmor(26881,ArmorMaterial.CLOTH,1,"fullwood").setUnlocalizedName("npcFullWoodenChest").setMaxStackSize(1).setTextureName("customnpcs:npcFullWoodenChest"); + armor = new ItemNpcArmor(26882,ArmorMaterial.CLOTH,2,"fullwood").setUnlocalizedName("npcFullWoodenLeggings").setMaxStackSize(1).setTextureName("customnpcs:npcFullWoodenLeggings"); + armor = new ItemNpcArmor(26883,ArmorMaterial.CLOTH,3,"fullwood").setUnlocalizedName("npcFullWoodenBoots").setMaxStackSize(1).setTextureName("customnpcs:npcFullWoodenBoots"); + + armor = new ItemNpcArmor(26884,ArmorMaterial.CHAIN,1,"tuxido").setUnlocalizedName("npcTuxedoChest").setMaxStackSize(1).setTextureName("customnpcs:npcTuxedoChest"); + armor = new ItemNpcArmor(26885,ArmorMaterial.CHAIN,2,"tuxido").setUnlocalizedName("npcTuxedoPants").setMaxStackSize(1).setTextureName("customnpcs:npcTuxedoPants"); + armor = new ItemNpcArmor(26886,ArmorMaterial.CHAIN,3,"tuxido").setUnlocalizedName("npcTuxedoBottom").setMaxStackSize(1).setTextureName("customnpcs:npcTuxedoBottom"); + + armor = new ItemNpcArmor(26887,ArmorMaterial.CHAIN,0,"wizard").setUnlocalizedName("npcWizardHead").setMaxStackSize(1).setTextureName("customnpcs:npcWizardHead"); + armor = new ItemNpcArmor(26888,ArmorMaterial.CHAIN,1,"wizard").setUnlocalizedName("npcWizardChest").setMaxStackSize(1).setTextureName("customnpcs:npcWizardChest"); + armor = new ItemNpcArmor(26889,ArmorMaterial.CHAIN,2,"wizard").setUnlocalizedName("npcWizardPants").setMaxStackSize(1).setTextureName("customnpcs:npcWizardPants"); + + armor = new ItemNpcArmor(26890,ArmorMaterial.IRON,0,"assassin").setUnlocalizedName("npcAssassinHead").setMaxStackSize(1).setTextureName("customnpcs:npcAssassinHead"); + armor = new ItemNpcArmor(26891,ArmorMaterial.IRON,1,"assassin").setUnlocalizedName("npcAssassinChest").setMaxStackSize(1).setTextureName("customnpcs:npcAssassinChest"); + armor = new ItemNpcArmor(26892,ArmorMaterial.IRON,2,"assassin").setUnlocalizedName("npcAssassinLeggings").setMaxStackSize(1).setTextureName("customnpcs:npcAssassinLeggings"); + armor = new ItemNpcArmor(26893,ArmorMaterial.IRON,3,"assassin").setUnlocalizedName("npcAssassinBoots").setMaxStackSize(1).setTextureName("customnpcs:npcAssassinBoots"); + + armor = new ItemNpcArmor(26894,ArmorMaterial.IRON,0,"soldier").setUnlocalizedName("npcSoldierHead").setMaxStackSize(1).setTextureName("customnpcs:npcSoldierHead"); + armor = new ItemNpcArmor(26895,ArmorMaterial.IRON,1,"soldier").setUnlocalizedName("npcSoldierChest").setMaxStackSize(1).setTextureName("customnpcs:npcSoldierChest"); + armor = new ItemNpcArmor(26896,ArmorMaterial.IRON,2,"soldier").setUnlocalizedName("npcSoldierLegs").setMaxStackSize(1).setTextureName("customnpcs:npcSoldierLegs"); + armor = new ItemNpcArmor(26897,ArmorMaterial.IRON,3,"soldier").setUnlocalizedName("npcSoldierBottom").setMaxStackSize(1).setTextureName("customnpcs:npcSoldierBottom"); + + armor = new ItemNpcArmor(26898,ArmorMaterial.DIAMOND,0,"x407").setUnlocalizedName("npcX407Head").setMaxStackSize(1).setTextureName("customnpcs:npcX407Head"); + armor = new ItemNpcArmor(26899,ArmorMaterial.DIAMOND,1,"x407").setUnlocalizedName("npcX407Chest").setMaxStackSize(1).setTextureName("customnpcs:npcX407Chest"); + armor = new ItemNpcArmor(26900,ArmorMaterial.DIAMOND,2,"x407").setUnlocalizedName("npcX407Legs").setMaxStackSize(1).setTextureName("customnpcs:npcX407Legs"); + armor = new ItemNpcArmor(26901,ArmorMaterial.DIAMOND,3,"x407").setUnlocalizedName("npcX407Boots").setMaxStackSize(1).setTextureName("customnpcs:npcX407Boots"); + + armor = new ItemNpcArmor(26898,armorMithril,0,"mithril").setUnlocalizedName("npcMithrilHead").setMaxStackSize(1).setTextureName("customnpcs:npcMithrilHead"); + armor = new ItemNpcArmor(26899,armorMithril,1,"mithril").setUnlocalizedName("npcMithrilChest").setMaxStackSize(1).setTextureName("customnpcs:npcMithrilChest"); + armor = new ItemNpcArmor(26900,armorMithril,2,"mithril").setUnlocalizedName("npcMithrilLegs").setMaxStackSize(1).setTextureName("customnpcs:npcMithrilLegs"); + armor = new ItemNpcArmor(26901,armorMithril,3,"mithril").setUnlocalizedName("npcMithrilBoots").setMaxStackSize(1).setTextureName("customnpcs:npcMithrilBoots"); + + armor = new ItemNpcArmor(26898,ArmorMaterial.DIAMOND,0,"demonic").setUnlocalizedName("npcDemonicHead").setMaxStackSize(1).setTextureName("customnpcs:npcDemonicHead"); + armor = new ItemNpcArmor(26899,ArmorMaterial.DIAMOND,1,"demonic").setUnlocalizedName("npcDemonicChest").setMaxStackSize(1).setTextureName("customnpcs:npcDemonicChest"); + armor = new ItemNpcArmor(26900,ArmorMaterial.DIAMOND,2,"demonic").setUnlocalizedName("npcDemonicLegs").setMaxStackSize(1).setTextureName("customnpcs:npcDemonicLegs"); + armor = new ItemNpcArmor(26901,ArmorMaterial.DIAMOND,3,"demonic").setUnlocalizedName("npcDemonicBoots").setMaxStackSize(1).setTextureName("customnpcs:npcDemonicBoots"); + + armor = new ItemNpcArmor(26902,ArmorMaterial.GOLD,0,"commissar").setUnlocalizedName("npcCommissarHead").setMaxStackSize(1).setTextureName("customnpcs:npcCommissarHead"); + armor = new ItemNpcArmor(26903,ArmorMaterial.GOLD,1,"commissar").setUnlocalizedName("npcCommissarChest").setMaxStackSize(1).setTextureName("customnpcs:npcCommissarChest"); + armor = new ItemNpcArmor(26904,ArmorMaterial.GOLD,2,"commissar").setUnlocalizedName("npcCommissarLegs").setMaxStackSize(1).setTextureName("customnpcs:npcCommissarLegs"); + armor = new ItemNpcArmor(26905,ArmorMaterial.GOLD,3,"commissar").setUnlocalizedName("npcCommissarBottom").setMaxStackSize(1).setTextureName("customnpcs:npcCommissarBottom"); + + armor = new ItemNpcArmor(26906,ArmorMaterial.IRON,0,"infantry").setUnlocalizedName("npcInfantryHelmet").setMaxStackSize(1).setTextureName("customnpcs:npcInfantryHelmet"); + armor = new ItemNpcArmor(26907,ArmorMaterial.DIAMOND,1,"officer").setUnlocalizedName("npcOfficerChest").setMaxStackSize(1).setTextureName("customnpcs:npcOfficerChest"); + + armor = new ItemNpcArmor(26908,ArmorMaterial.DIAMOND,0,"crown1").setUnlocalizedName("npcCrown2").setMaxStackSize(1).setTextureName("customnpcs:npcCrown2"); + armor = new ItemNpcArmor(26909,ArmorMaterial.DIAMOND,0,"crown2").setUnlocalizedName("npcCrown").setMaxStackSize(1).setTextureName("customnpcs:npcCrown"); + armor = new ItemNpcArmorColorable(26909,ArmorMaterial.CLOTH,0,"papercrown").setUnlocalizedName("npcPaperCrown").setMaxStackSize(1).setTextureName("customnpcs:npcPaperCrown"); + + armor = new ItemNpcArmor(26916,ArmorMaterial.IRON,0,"ninja").setUnlocalizedName("npcNinjaHead").setMaxStackSize(1).setTextureName("customnpcs:npcNinjaHead"); + armor = new ItemNpcArmor(26917,ArmorMaterial.IRON,1,"ninja").setUnlocalizedName("npcNinjaChest").setMaxStackSize(1).setTextureName("customnpcs:npcNinjaChest"); + armor = new ItemNpcArmor(26918,ArmorMaterial.IRON,2,"ninja").setUnlocalizedName("npcNinjaPants").setMaxStackSize(1).setTextureName("customnpcs:npcNinjaPants"); + + armor = new ItemSkirt(ArmorMaterial.CHAIN,"textures/models/armor/chainmail_layer_2.png").setUnlocalizedName("npcChainSkirt").setTextureName("customnpcs:npcChainSkirt"); + armor = new ItemSkirt(ArmorMaterial.CLOTH,"textures/models/armor/leather_layer_2.png").setUnlocalizedName("npcLeatherSkirt").setTextureName("customnpcs:npcLeatherSkirt"); + armor = new ItemSkirt(ArmorMaterial.GOLD,"textures/models/armor/gold_layer_2.png").setUnlocalizedName("npcGoldSkirt").setTextureName("customnpcs:npcGoldSkirt"); + armor = new ItemSkirt(ArmorMaterial.IRON,"textures/models/armor/iron_layer_2.png").setUnlocalizedName("npcIronSkirt").setTextureName("customnpcs:npcIronSkirt"); + armor = new ItemSkirt(ArmorMaterial.DIAMOND,"textures/models/armor/diamond_layer_2.png").setUnlocalizedName("npcDiamondSkirt").setTextureName("customnpcs:npcDiamondSkirt"); + armor = new ItemSkirt(armorEmerald,"customnpcs:textures/armor/fullemerald_2.png").setUnlocalizedName("npcEmeraldSkirt").setTextureName("customnpcs:npcEmeraldSkirt"); + armor = new ItemSkirt(armorBronze,"customnpcs:textures/armor/fullbronze_2.png").setUnlocalizedName("npcBronzeSkirt").setTextureName("customnpcs:npcBronzeSkirt"); + armor = new ItemSkirt(ArmorMaterial.DIAMOND,"customnpcs:textures/armor/demonic_2.png").setUnlocalizedName("npcDemonicSkirt").setTextureName("customnpcs:npcDemonicSkirt"); + armor = new ItemSkirt(armorMithril,"customnpcs:textures/armor/mithril_2.png").setUnlocalizedName("npcMithrilSkirt").setTextureName("customnpcs:npcMithrilSkirt"); + + + coinWood = new ItemNpcInterface(26717).setUnlocalizedName("npcCoinWooden").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcCoinWooden"); + coinStone = new ItemNpcInterface(26718).setUnlocalizedName("npcCoinStone").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcCoinStone"); + coinBronze = new ItemNpcInterface(26719).setUnlocalizedName("npcCoinBronze").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcCoinBronze"); + coinIron = new ItemNpcInterface(26720).setUnlocalizedName("npcCoinIron").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcCoinIron"); + coinGold = new ItemNpcInterface(26721).setUnlocalizedName("npcCoinGold").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcCoinGold"); + coinDiamond = new ItemNpcInterface(26722).setUnlocalizedName("npcCoinDiamond").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcCoinDiamond"); + coinEmerald = new ItemNpcInterface(26723).setUnlocalizedName("npcCoinEmerald").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcCoinEmerald"); + Item quest = new ItemNpcInterface().setUnlocalizedName("npcAncientCoin").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcAncientCoin"); + + letter = new ItemNpcInterface(26950).setUnlocalizedName("npcLetter").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcLetter"); + quest = new ItemNpcInterface(26951).setUnlocalizedName("npcPlans").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcPlans"); + satchel = new ItemNpcInterface(26952).setUnlocalizedName("npcSatchel").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcSatchel"); + bag = new ItemNpcInterface(26953).setUnlocalizedName("npcBag").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcBag"); + + quest = new ItemNpcInterface(26954).setUnlocalizedName("npcCrystal").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcCrystal"); + quest = new ItemNpcInterface(26955).setUnlocalizedName("npcSeveredEar").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcSeveredEar"); + quest = new ItemNpcInterface(26956).setUnlocalizedName("npcPhone").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcPhone"); + + quest = new ItemNpcArmor(26957,ArmorMaterial.IRON,0,"mask").setMaxStackSize(64).setUnlocalizedName("npcBanditMask").setCreativeTab(CustomItems.tabArmor).setTextureName("customnpcs:npcBanditMask"); + quest = new ItemNpcInterface(26958).setUnlocalizedName("npcBrokenArrow").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcBrokenArrow"); + quest = new ItemNpcInterface(26959).setUnlocalizedName("npcEarthElement").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcEarthElement"); + quest = new ItemNpcInterface(26960).setUnlocalizedName("npcWaterElement").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcWaterElement"); + quest = new ItemNpcInterface(26961).setUnlocalizedName("npcFireElement").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcFireElement"); + quest = new ItemNpcInterface(26962).setUnlocalizedName("npcAirElement").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcAirElement"); + + quest = new ItemNpcInterface(26963).setUnlocalizedName("npcCarKey").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcCarKey"); + quest = new ItemNpcInterface(26964).setUnlocalizedName("npcKey").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcKey"); + quest = new ItemNpcInterface(26965).setUnlocalizedName("npcKey2").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcKey2"); + quest = new ItemNpcInterface(26966).setUnlocalizedName("npcPendant").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcPendant"); + quest = new ItemNpcInterface(26967).setUnlocalizedName("npcBlueprint").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcBlueprint"); + quest = new ItemNpcInterface(26968).setUnlocalizedName("npcRing").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcRing"); + quest = new ItemNpcInterface(26969).setUnlocalizedName("npcSkull").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcSkull"); + + Item sapphire = new ItemNpcInterface(26970).setUnlocalizedName("npcSaphire").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcSaphire"); + Item ruby = new ItemNpcInterface(26971).setUnlocalizedName("npcRuby").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcRuby"); + Item amethyst = new ItemNpcInterface(26972).setUnlocalizedName("npcAmethyst").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcAmethyst"); + + OreDictionary.registerOre("gemSaphire", sapphire); + OreDictionary.registerOre("gemRuby", ruby); + OreDictionary.registerOre("gemAmethyst", amethyst); + + bronze_ingot = new ItemNpcInterface(26973).setUnlocalizedName("npcBronzeIngot").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcBronzeIngot"); + demonic_ingot = new ItemNpcInterface(26973).setUnlocalizedName("npcDemonicIngot").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcDemonicIngot"); + mithril_ingot = new ItemNpcInterface(26973).setUnlocalizedName("npcMithrilIngot").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcMithrilIngot"); + + armorMithril.customCraftingMaterial = mithril_ingot; + + bronze.customCraftingMaterial = bronze_ingot; + emerald.customCraftingMaterial = Items.emerald; + demonic.customCraftingMaterial = demonic_ingot; + frost.customCraftingMaterial = Item.getItemFromBlock(Blocks.ice); + mithril.customCraftingMaterial = mithril_ingot; + + OreDictionary.registerOre("ingotBronze", bronze_ingot); + OreDictionary.registerOre("ingotDemonic", demonic_ingot); + OreDictionary.registerOre("ingotMithril", mithril_ingot); + + quest = new ItemNpcInterface().setUnlocalizedName("npcAncientScroll").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcAncientScroll"); + quest = new ItemNpcInterface().setUnlocalizedName("npcArtifact").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcArtifact"); + quest = new ItemNpcInterface().setUnlocalizedName("npcLocket").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcLocket"); + quest = new ItemNpcInterface().setUnlocalizedName("npcSilk").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcSilk"); + quest = new ItemNpcInterface().setUnlocalizedName("npcStatuette").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcStatuette"); + quest = new ItemNpcInterface().setUnlocalizedName("npcTablet").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcTablet"); + + quest = new ItemNpcInterface().setUnlocalizedName("npcHeart").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcHeart"); + quest = new ItemNpcInterface().setUnlocalizedName("npcMoney").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcMoney"); + quest = new ItemNpcInterface().setUnlocalizedName("npcNecklace").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcNecklace"); + quest = new ItemNpcInterface().setUnlocalizedName("npcUsbStick").setCreativeTab(CustomItems.tabMisc).setTextureName("customnpcs:npcUsbStick"); + + tabArmor.item = cowarmor; + tabWeapon.item = CustomItems.shuriken; + tabMisc.item = CustomItems.coinGold; + tabBlocks.item = Item.getItemFromBlock(couchWool); + tabBlocks.meta = 1; + } + + tab.item = wand; + } +} diff --git a/src/main/java/noppes/npcs/CustomNpcs.java b/src/main/java/noppes/npcs/CustomNpcs.java new file mode 100644 index 000000000..e17cdc72c --- /dev/null +++ b/src/main/java/noppes/npcs/CustomNpcs.java @@ -0,0 +1,302 @@ +package noppes.npcs; + +import java.io.File; +import java.util.Set; + +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.Mod; +import cpw.mods.fml.common.Mod.EventHandler; +import cpw.mods.fml.common.SidedProxy; +import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import cpw.mods.fml.common.event.FMLServerAboutToStartEvent; +import cpw.mods.fml.common.event.FMLServerStartedEvent; +import cpw.mods.fml.common.event.FMLServerStartingEvent; +import cpw.mods.fml.common.event.FMLServerStoppedEvent; +import cpw.mods.fml.common.network.FMLEventChannel; +import cpw.mods.fml.common.network.NetworkRegistry; +import cpw.mods.fml.common.registry.EntityRegistry; +import foxz.command.CommandNoppes; +import net.minecraft.block.Block; +import net.minecraft.block.BlockIce; +import net.minecraft.block.BlockLeavesBase; +import net.minecraft.block.BlockVine; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityList; +import net.minecraft.server.MinecraftServer; +import net.minecraftforge.common.ForgeChunkManager; +import net.minecraftforge.common.MinecraftForge; +import noppes.npcs.config.ConfigLoader; +import noppes.npcs.config.ConfigProp; +import noppes.npcs.controllers.BankController; +import noppes.npcs.controllers.ChunkController; +import noppes.npcs.controllers.DialogController; +import noppes.npcs.controllers.FactionController; +import noppes.npcs.controllers.GlobalDataController; +import noppes.npcs.controllers.LinkedNpcController; +import noppes.npcs.controllers.PixelmonHelper; +import noppes.npcs.controllers.PlayerDataController; +import noppes.npcs.controllers.QuestController; +import noppes.npcs.controllers.RecipeController; +import noppes.npcs.controllers.ScriptController; +import noppes.npcs.controllers.ServerCloneController; +import noppes.npcs.controllers.SpawnController; +import noppes.npcs.controllers.TransportController; +import noppes.npcs.enchants.EnchantInterface; +import noppes.npcs.entity.EntityChairMount; +import noppes.npcs.entity.EntityCustomNpc; +import noppes.npcs.entity.EntityMagicProjectile; +import noppes.npcs.entity.EntityNPCGolem; +import noppes.npcs.entity.EntityNpcCrystal; +import noppes.npcs.entity.EntityNpcDragon; +import noppes.npcs.entity.EntityNpcPony; +import noppes.npcs.entity.EntityNpcSlime; +import noppes.npcs.entity.EntityProjectile; +import noppes.npcs.entity.old.EntityNPCDwarfFemale; +import noppes.npcs.entity.old.EntityNPCDwarfMale; +import noppes.npcs.entity.old.EntityNPCElfFemale; +import noppes.npcs.entity.old.EntityNPCElfMale; +import noppes.npcs.entity.old.EntityNPCEnderman; +import noppes.npcs.entity.old.EntityNPCFurryFemale; +import noppes.npcs.entity.old.EntityNPCFurryMale; +import noppes.npcs.entity.old.EntityNPCHumanFemale; +import noppes.npcs.entity.old.EntityNPCHumanMale; +import noppes.npcs.entity.old.EntityNPCOrcFemale; +import noppes.npcs.entity.old.EntityNPCOrcMale; +import noppes.npcs.entity.old.EntityNPCVillager; +import noppes.npcs.entity.old.EntityNpcEnderchibi; +import noppes.npcs.entity.old.EntityNpcMonsterFemale; +import noppes.npcs.entity.old.EntityNpcMonsterMale; +import noppes.npcs.entity.old.EntityNpcNagaFemale; +import noppes.npcs.entity.old.EntityNpcNagaMale; +import noppes.npcs.entity.old.EntityNpcSkeleton; + +@Mod(modid = "customnpcs", name = "CustomNpcs", version = "1.7.10d") +public class CustomNpcs { + + @ConfigProp(info = "Disable Chat Bubbles") + public static boolean EnableChatBubbles = true; + + private static int NewEntityStartId = 0; + + @ConfigProp(info = "Navigation search range for NPCs. Not recommended to increase if you have a slow pc or on a server") + public static int NpcNavRange = 32; + + @ConfigProp(info = "Set to true if you want the dialog command option to be able to use op commands like tp etc") + public static boolean NpcUseOpCommands = false; + + @ConfigProp + public static boolean InventoryGuiEnabled = true; + + @ConfigProp + public static boolean DisableExtraItems = false; + @ConfigProp + public static boolean DisableExtraBlock = false; + + public static long ticks; + + @SidedProxy(clientSide = "noppes.npcs.client.ClientProxy", serverSide = "noppes.npcs.CommonProxy") + public static CommonProxy proxy; + + @ConfigProp(info = "Enables CustomNpcs startup update message") + public static boolean EnableUpdateChecker = true; + + public static CustomNpcs instance; + + public static boolean FreezeNPCs = false; + + @ConfigProp(info = "Only ops can create and edit npcs") + public static boolean OpsOnly = false; + + @ConfigProp(info = "Default interact line. Leave empty to not have one") + public static String DefaultInteractLine = "Hello @p"; + + @ConfigProp + public static boolean DisableEnchants = false; + @ConfigProp(info = "Start Id for enchants. IDs can only range from 0-256") + public static int EnchantStartId = 100; + + @ConfigProp(info = "Number of chunk loading npcs that can be active at the same time") + public static int ChuckLoaders = 20; + + public static File Dir; + + @ConfigProp(info = "Set to false if you want to disable guns") + public static boolean GunsEnabled = true; + + @ConfigProp(info = "Enables leaves decay") + public static boolean LeavesDecayEnabled = true; + + @ConfigProp(info = "Enables Vine Growth") + public static boolean VineGrowthEnabled = true; + + @ConfigProp(info = "Enables Ice Melting") + public static boolean IceMeltsEnabled = true; + + @ConfigProp(info = "Normal players can use soulstone on animals") + public static boolean SoulStoneAnimals = true; + + @ConfigProp(info = "Normal players can use soulstone on all npcs") + public static boolean SoulStoneNPCs = false; + + @ConfigProp(info="When set to Minecraft it will use minecrafts font, when Default it will use OpenSans. Can only use fonts installed on your PC") + public static String FontType = "Default"; + + @ConfigProp(info="Font size for custom fonts (doesn't work with minecrafts font)") + public static int FontSize = 18; + + public static FMLEventChannel Channel; + public static FMLEventChannel ChannelPlayer; + + public static ConfigLoader Config; + + public CustomNpcs() { + instance = this; + } + + @EventHandler + public void load(FMLPreInitializationEvent ev) { + Channel = NetworkRegistry.INSTANCE.newEventDrivenChannel("CustomNPCs"); + ChannelPlayer = NetworkRegistry.INSTANCE.newEventDrivenChannel("CustomNPCsPlayer"); + + MinecraftServer server = MinecraftServer.getServer(); + String dir = ""; + if (server != null) { + dir = new File(".").getAbsolutePath(); + } else { + dir = Minecraft.getMinecraft().mcDataDir.getAbsolutePath(); + } + Dir = new File(dir, "customnpcs"); + Dir.mkdir(); + + Config = new ConfigLoader(this.getClass(), new File(dir, "config"), "CustomNpcs"); + Config.loadConfig(); + + if (NpcNavRange < 16) { + NpcNavRange = 16; + } + EnchantInterface.load(); + CustomItems.load(); + + proxy.load(); + NetworkRegistry.INSTANCE.registerGuiHandler(this, proxy); + + MinecraftForge.EVENT_BUS.register(new ServerEventsHandler()); + MinecraftForge.EVENT_BUS.register(new ScriptController()); + + FMLCommonHandler.instance().bus().register(new ServerTickHandler()); + + registerNpc(EntityNPCHumanMale.class, "npchumanmale"); + registerNpc(EntityNPCVillager.class, "npcvillager"); + registerNpc(EntityNpcPony.class, "npcpony"); + registerNpc(EntityNPCHumanFemale.class, "npchumanfemale"); + registerNpc(EntityNPCDwarfMale.class, "npcdwarfmale"); + registerNpc(EntityNPCFurryMale.class, "npcfurrymale"); + registerNpc(EntityNpcMonsterMale.class, "npczombiemale"); + registerNpc(EntityNpcMonsterFemale.class, "npczombiefemale"); + registerNpc(EntityNpcSkeleton.class, "npcskeleton"); + registerNpc(EntityNPCDwarfFemale.class, "npcdwarffemale"); + registerNpc(EntityNPCFurryFemale.class, "npcfurryfemale"); + registerNpc(EntityNPCOrcMale.class, "npcorcfmale"); + registerNpc(EntityNPCOrcFemale.class, "npcorcfemale"); + registerNpc(EntityNPCElfMale.class, "npcelfmale"); + registerNpc(EntityNPCElfFemale.class, "npcelffemale"); + registerNpc(EntityNpcCrystal.class, "npccrystal"); + registerNpc(EntityNpcEnderchibi.class, "npcenderchibi"); + registerNpc(EntityNpcNagaMale.class, "npcnagamale"); + registerNpc(EntityNpcNagaFemale.class, "npcnagafemale"); + registerNpc(EntityNpcSlime.class, "NpcSlime"); + registerNpc(EntityNpcDragon.class, "NpcDragon"); + registerNpc(EntityNPCEnderman.class, "npcEnderman"); + registerNpc(EntityNPCGolem.class, "npcGolem"); + registerNpc(EntityCustomNpc.class, "CustomNpc"); + + registerNewEntity(EntityChairMount.class, "CustomNpcChairMount", 64, 10, false); + registerNewEntity(EntityProjectile.class, "throwableitem", 64, 3, true); + registerNewEntity(EntityMagicProjectile.class, "magicprojectile", 64, 3, true); + + new RecipeController(); + + ForgeChunkManager.setForcedChunkLoadingCallback(this, new ChunkController()); + + new CustomNpcsPermissions(); + + PixelmonHelper.load(); + } + + @EventHandler + public void setAboutToStart(FMLServerAboutToStartEvent event) { + ChunkController.instance.clear(); + new QuestController(); + new PlayerDataController(); + new FactionController(); + new TransportController(); + new GlobalDataController(); + new SpawnController(); + new LinkedNpcController(); + ScriptController.Instance.loadStoredData(); + ScriptController.HasStart = false; + + Set names = Block.blockRegistry.getKeys(); + for(String name : names){ + Block block = (Block) Block.blockRegistry.getObject(name); + if(block instanceof BlockLeavesBase){ + block.setTickRandomly(LeavesDecayEnabled); + } + if(block instanceof BlockVine){ + block.setTickRandomly(VineGrowthEnabled); + } + if(block instanceof BlockIce){ + block.setTickRandomly(IceMeltsEnabled); + } + } + } + + //Loading items in the about to start event was corrupting items with a damage value + @EventHandler + public void started(FMLServerStartedEvent event) { + RecipeController.instance.load(); + new DialogController(); + new BankController(); + QuestController.instance.load(); + ScriptController.HasStart = true; + ServerCloneController.Instance = new ServerCloneController(); + } + + @EventHandler + public void stopped(FMLServerStoppedEvent event){ + ServerCloneController.Instance = null; + } + + @EventHandler + public void serverstart(FMLServerStartingEvent event) { + event.registerServerCommand(new CommandNoppes()); + } + + private void registerNpc(Class cl, String name) { + EntityRegistry.registerModEntity(cl, name, NewEntityStartId++, this, 64, 3, true); + EntityList.stringToClassMapping.put(name, cl); + } + + private void registerNewEntity(Class cl, String name, int range, int update, boolean velocity) { + EntityRegistry.registerModEntity(cl, name, NewEntityStartId++, this, range, update, velocity); + } + + + public static File getWorldSaveDirectory() { + MinecraftServer server = MinecraftServer.getServer(); + File saves = new File("."); + if (server != null && !server.isDedicatedServer()) { + saves = new File(Minecraft.getMinecraft().mcDataDir, "saves"); + } + if (server != null) { + File savedir = new File(new File(saves, server.getFolderName()), "customnpcs"); + if (!savedir.exists()) { + savedir.mkdir(); + } + return savedir; + } + return null; + } + +} diff --git a/src/main/java/noppes/npcs/CustomNpcsPermissions.java b/src/main/java/noppes/npcs/CustomNpcsPermissions.java new file mode 100644 index 000000000..3111ae031 --- /dev/null +++ b/src/main/java/noppes/npcs/CustomNpcsPermissions.java @@ -0,0 +1,119 @@ +package noppes.npcs; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.logging.Logger; + +import org.apache.logging.log4j.LogManager; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import noppes.npcs.CustomNpcsPermissions.Permission; +import noppes.npcs.constants.EnumPacketServer; + + +public class CustomNpcsPermissions{ + public static final Permission NPC_DELETE = new Permission("customnpcs.npc.delete"); + public static final Permission NPC_CREATE = new Permission("customnpcs.npc.create"); + public static final Permission NPC_GUI = new Permission("customnpcs.npc.gui"); + public static final Permission NPC_FREEZE = new Permission("customnpcs.npc.freeze"); + public static final Permission NPC_RESET = new Permission("customnpcs.npc.reset"); + public static final Permission NPC_AI = new Permission("customnpcs.npc.ai"); + public static final Permission NPC_ADVANCED = new Permission("customnpcs.npc.advanced"); + public static final Permission NPC_DISPLAY = new Permission("customnpcs.npc.display"); + public static final Permission NPC_INVENTORY = new Permission("customnpcs.npc.inventory"); + public static final Permission NPC_STATS = new Permission("customnpcs.npc.stats"); + public static final Permission NPC_CLONE = new Permission("customnpcs.npc.clone"); + + public static final Permission GLOBAL_LINKED = new Permission("customnpcs.global.linked"); + public static final Permission GLOBAL_PLAYERDATA = new Permission("customnpcs.global.playerdata"); + public static final Permission GLOBAL_BANK = new Permission("customnpcs.global.bank"); + public static final Permission GLOBAL_DIALOG = new Permission("customnpcs.global.dialog"); + public static final Permission GLOBAL_QUEST = new Permission("customnpcs.global.quest"); + public static final Permission GLOBAL_FACTION = new Permission("customnpcs.global.faction"); + public static final Permission GLOBAL_TRANSPORT = new Permission("customnpcs.global.transport"); + public static final Permission GLOBAL_RECIPE = new Permission("customnpcs.global.recipe"); + public static final Permission GLOBAL_NATURALSPAWN = new Permission("customnpcs.global.naturalspawn"); + + public static final Permission SPAWNER_MOB = new Permission("customnpcs.spawner.mob"); + public static final Permission SPAWNER_CREATE = new Permission("customnpcs.spawner.create"); + + public static final Permission TOOL_MOUNTER = new Permission("customnpcs.tool.mounter"); + public static final Permission TOOL_PATHER = new Permission("customnpcs.tool.pather"); + public static final Permission TOOL_SCRIPTER = new Permission("customnpcs.tool.scripter"); + + public static final Permission EDIT_VILLAGER = new Permission("customnpcs.edit.villager"); + public static final Permission EDIT_BLOCKS = new Permission("customnpcs.edit.blocks"); + + public static final Permission SOULSTONE_ALL = new Permission("customnpcs.soulstone.all"); + + public static CustomNpcsPermissions Instance; + private Class bukkit; + private Method getPlayer; + private Method hasPermission; + + public CustomNpcsPermissions(){ + Instance = this; + try { + bukkit = Class.forName("org.bukkit.Bukkit"); + getPlayer = bukkit.getMethod("getPlayer", String.class); + hasPermission = Class.forName("org.bukkit.entity.Player").getMethod("hasPermission", String.class); + LogManager.getLogger(CustomNpcs.class).info("Bukkit permissions enabled"); + LogManager.getLogger(CustomNpcs.class).info("Permissions available:"); + Collections.sort(Permission.permissions, String.CASE_INSENSITIVE_ORDER); + for(String p : Permission.permissions){ + LogManager.getLogger(CustomNpcs.class).info(p); + } + } catch (ClassNotFoundException e) { + // bukkit/mcpc+ is not loaded + } catch (NoSuchMethodException e) { + e.printStackTrace(); + } catch (SecurityException e) { + e.printStackTrace(); + } + } + + public static boolean hasPermission(EntityPlayer player, Permission permission){ + if(Instance.bukkit != null){ + return Instance.bukkitPermission(player.getCommandSenderName(), permission.name); + } + return true; + } + + private boolean bukkitPermission(String username, String permission) { + try { + Object player = getPlayer.invoke(null, username); + return (Boolean) hasPermission.invoke(player, permission); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } catch (IllegalArgumentException e) { + e.printStackTrace(); + } catch (InvocationTargetException e) { + e.printStackTrace(); + } + return false; + } + public static class Permission{ + private static final List permissions = new ArrayList(); + public String name; + public Permission(String name){ + this.name = name; + if(!permissions.contains(name)) + permissions.add(name); + } + } + public static boolean hasPermissionString(EntityPlayerMP player, String permission) { + if(Instance.bukkit != null){ + return Instance.bukkitPermission(player.getCommandSenderName(), permission); + } + return true; + } + + public static boolean enabled() { + return Instance.bukkit != null; + } +} diff --git a/src/main/java/noppes/npcs/CustomTeleporter.java b/src/main/java/noppes/npcs/CustomTeleporter.java new file mode 100644 index 000000000..5800ad606 --- /dev/null +++ b/src/main/java/noppes/npcs/CustomTeleporter.java @@ -0,0 +1,18 @@ +package noppes.npcs; + +import net.minecraft.entity.Entity; +import net.minecraft.world.Teleporter; +import net.minecraft.world.WorldServer; + +public class CustomTeleporter extends Teleporter{ + + public CustomTeleporter(WorldServer par1WorldServer) { + super(par1WorldServer); + } + + @Override + public void placeInPortal(Entity par1Entity, double par2, double par4, double par6, float par8) + { + + } +} diff --git a/src/main/java/noppes/npcs/DataAI.java b/src/main/java/noppes/npcs/DataAI.java new file mode 100644 index 000000000..cb1b58a45 --- /dev/null +++ b/src/main/java/noppes/npcs/DataAI.java @@ -0,0 +1,234 @@ +package noppes.npcs; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.MathHelper; +import noppes.npcs.constants.EnumAnimation; +import noppes.npcs.constants.EnumMovingType; +import noppes.npcs.constants.EnumNavType; +import noppes.npcs.constants.EnumStandingType; +import noppes.npcs.entity.EntityNPCInterface; + +public class DataAI { + private EntityNPCInterface npc; + + public int onAttack = 0; //0:fight 1:panic 2:retreat 3:nothing + public int doorInteract = 2; + public int findShelter = 2; + public int distanceToMelee = 4; + public int canFireIndirect = 0; + public boolean canSwim = true; + public boolean reactsToFire = false; + public boolean avoidsWater = false; + public boolean avoidsSun = false; + public boolean returnToStart = true; + public boolean directLOS = true; + public boolean canLeap = false; + public boolean canSprint = false; + public boolean stopAndInteract = true; + public EnumNavType tacticalVariant = EnumNavType.Default; + public int useRangeMelee = 0; + public int tacticalRadius = 8; + + public EnumAnimation animationType = EnumAnimation.NONE; + public EnumStandingType standingType = EnumStandingType.RotateBody; + public EnumMovingType movingType = EnumMovingType.Standing; + public boolean npcInteracting = true; + + public int orientation = 0; + public float bodyOffsetX = 5, bodyOffsetY = 5, bodyOffsetZ = 5; + public int walkingRange = 10; + private int moveSpeed = 5; + + private List movingPath = new ArrayList(); + public int[] startPos; + public int movingPos = 0; + public int movingPattern = 0; // 0:Looping 1:Backtracking + + public boolean movingPause = true; + + public boolean ignoreCobweb = false; + + public DataAI(EntityNPCInterface npc){ + this.npc = npc; + } + + public void readToNBT(NBTTagCompound compound) { + canSwim = compound.getBoolean("CanSwim"); + reactsToFire = compound.getBoolean("ReactsToFire"); + avoidsWater = compound.getBoolean("AvoidsWater"); + avoidsSun = compound.getBoolean("AvoidsSun"); + returnToStart = compound.getBoolean("ReturnToStart"); + onAttack = compound.getInteger("OnAttack"); + doorInteract = compound.getInteger("DoorInteract"); + findShelter = compound.getInteger("FindShelter"); + directLOS = compound.getBoolean("DirectLOS"); + canLeap = compound.getBoolean("CanLeap"); + canSprint = compound.getBoolean("CanSprint"); + canFireIndirect = compound.getInteger("FireIndirect"); + useRangeMelee = compound.getInteger("RangeAndMelee"); + distanceToMelee = compound.getInteger("DistanceToMelee"); + tacticalRadius = compound.getInteger("TacticalRadius"); + movingPause = compound.getBoolean("MovingPause"); + ignoreCobweb = compound.getBoolean("IgnoreCobweb"); + npcInteracting = compound.getBoolean("npcInteracting"); + stopAndInteract = compound.getBoolean("stopAndInteract"); + + + animationType = EnumAnimation.values()[compound.getInteger("MoveState") % EnumAnimation.values().length]; + standingType = EnumStandingType.values()[compound.getInteger("StandingState") % EnumStandingType.values().length]; + movingType = EnumMovingType.values()[compound.getInteger("MovingState") % EnumMovingType.values().length]; + tacticalVariant = EnumNavType.values()[compound.getInteger("TacticalVariant") % EnumNavType.values().length]; + + orientation = compound.getInteger("Orientation"); + bodyOffsetY = compound.getFloat("PositionOffsetY"); + bodyOffsetZ = compound.getFloat("PositionOffsetZ"); + bodyOffsetX = compound.getFloat("PositionOffsetX"); + walkingRange = compound.getInteger("WalkingRange"); + setWalkingSpeed(compound.getInteger("MoveSpeed")); + + setMovingPath(NBTTags.getIntegerArraySet(compound.getTagList("MovingPathNew",10))); + movingPos = compound.getInteger("MovingPos"); + movingPattern = compound.getInteger("MovingPatern"); + + startPos = compound.getIntArray("StartPosNew"); + if (startPos == null || startPos.length != 3){ + startPos = new int[] { + MathHelper.floor_double(npc.posX), + MathHelper.floor_double(npc.posY), + MathHelper.floor_double(npc.posZ) }; + } + } + + public NBTTagCompound writeToNBT(NBTTagCompound compound) { + compound.setBoolean("CanSwim", canSwim); + compound.setBoolean("ReactsToFire", reactsToFire); + compound.setBoolean("AvoidsWater", avoidsWater ); + compound.setBoolean("AvoidsSun", avoidsSun); + compound.setBoolean("ReturnToStart", returnToStart); + compound.setInteger("OnAttack", onAttack); + compound.setInteger("DoorInteract", doorInteract); + compound.setInteger("FindShelter", findShelter); + compound.setBoolean("DirectLOS", directLOS); + compound.setBoolean("CanLeap", canLeap); + compound.setBoolean("CanSprint", canSprint); + compound.setInteger("FireIndirect", canFireIndirect); + compound.setInteger("RangeAndMelee", useRangeMelee); + compound.setInteger("DistanceToMelee", distanceToMelee); + compound.setInteger("TacticalRadius", tacticalRadius); + compound.setBoolean("MovingPause", movingPause); + compound.setBoolean("IgnoreCobweb", ignoreCobweb); + compound.setBoolean("npcInteracting", npcInteracting); + compound.setBoolean("stopAndInteract", stopAndInteract); + + compound.setInteger("MoveState", animationType.ordinal()); + compound.setInteger("StandingState", standingType.ordinal()); + compound.setInteger("MovingState", movingType.ordinal()); + compound.setInteger("TacticalVariant", tacticalVariant.ordinal()); + + compound.setInteger("Orientation", orientation); + compound.setFloat("PositionOffsetX", bodyOffsetX); + compound.setFloat("PositionOffsetY", bodyOffsetY); + compound.setFloat("PositionOffsetZ", bodyOffsetZ); + compound.setInteger("WalkingRange", walkingRange); + compound.setInteger("MoveSpeed", moveSpeed); + + compound.setTag("MovingPathNew", NBTTags.nbtIntegerArraySet(movingPath)); + compound.setInteger("MovingPos", movingPos); + compound.setInteger("MovingPatern", movingPattern); + + npc.setAvoidWater(avoidsWater); + + compound.setIntArray("StartPosNew", npc.getStartPos()); + + return compound; + } + + public List getMovingPath() { + if(movingPath.isEmpty() && startPos != null) + movingPath.add(startPos); + return movingPath; + } + + public void setMovingPath(List list) { + movingPath = list; + if(!movingPath.isEmpty()) + startPos = movingPath.get(0); + } + + public int[] getCurrentMovingPath(){ + List list = getMovingPath(); + if(list.size() == 1){ + movingPos = 0; + } + else if(movingPos >= list.size()){ + if(movingPattern == 0) + movingPos = 0; + else{ + int size = list.size() * 2 - 2; + if(movingPos >= size){ + movingPos = 0; + } + else if(movingPos >= list.size()){ + return list.get(list.size() - (movingPos % list.size()) - 2); + } + } + } + + + return list.get(movingPos); + } + + public void incrementMovingPath(){ + List list = getMovingPath(); + if(list.size() == 1){ + movingPos = 0; + } + else if(movingPattern == 0){ + movingPos++; + movingPos = movingPos % list.size(); + } + else if(movingPattern == 1){ + movingPos++; + int size = list.size() * 2 - 2; + movingPos = movingPos % size; + } + } + + + public void decreaseMovingPath() { + List list = getMovingPath(); + if(list.size() == 1){ + movingPos = 0; + } + else if(movingPattern == 0){ + movingPos--; + if(movingPos < 0) + movingPos += list.size(); + } + else if(movingPattern == 1){ + movingPos--; + if(movingPos < 0){ + int size = list.size() * 2 - 2; + movingPos += size; + } + } + } + + public double getDistanceSqToPathPoint() { + int[] pos = getCurrentMovingPath(); + return npc.getDistanceSq(pos[0] + 0.5, pos[1], pos[2] + 0.5); + } + + public void setWalkingSpeed(int speed){ + this.moveSpeed = speed; + npc.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(npc.getSpeed()); + } + + public int getWalkingSpeed(){ + return this.moveSpeed; + } +} diff --git a/src/main/java/noppes/npcs/DataAdvanced.java b/src/main/java/noppes/npcs/DataAdvanced.java new file mode 100644 index 000000000..e95962f0e --- /dev/null +++ b/src/main/java/noppes/npcs/DataAdvanced.java @@ -0,0 +1,215 @@ +package noppes.npcs; + +import java.util.HashMap; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import noppes.npcs.constants.EnumJobType; +import noppes.npcs.constants.EnumRoleType; +import noppes.npcs.controllers.DialogOption; +import noppes.npcs.controllers.FactionOptions; +import noppes.npcs.controllers.Line; +import noppes.npcs.controllers.Lines; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.JobBard; +import noppes.npcs.roles.JobChunkLoader; +import noppes.npcs.roles.JobConversation; +import noppes.npcs.roles.JobFollower; +import noppes.npcs.roles.JobGuard; +import noppes.npcs.roles.JobHealer; +import noppes.npcs.roles.JobItemGiver; +import noppes.npcs.roles.JobPuppet; +import noppes.npcs.roles.JobSpawner; +import noppes.npcs.roles.RoleBank; +import noppes.npcs.roles.RoleCompanion; +import noppes.npcs.roles.RoleFollower; +import noppes.npcs.roles.RolePostman; +import noppes.npcs.roles.RoleTrader; +import noppes.npcs.roles.RoleTransporter; + +public class DataAdvanced { + + public Lines interactLines = new Lines(); + public Lines worldLines = new Lines(); + public Lines attackLines = new Lines(); + public Lines killedLines = new Lines(); + public Lines killLines = new Lines(); + + public boolean orderedLines = false; + + public String idleSound = ""; + public String angrySound = ""; + public String hurtSound = "minecraft:game.player.hurt"; + public String deathSound = "minecraft:game.player.hurt"; + public String stepSound = ""; + + private EntityNPCInterface npc; + public FactionOptions factions = new FactionOptions(); + + public EnumRoleType role = EnumRoleType.None; + public EnumJobType job = EnumJobType.None; + + public boolean attackOtherFactions = false; + public boolean defendFaction = false; + public boolean disablePitch = false; + + public DataAdvanced(EntityNPCInterface npc) { + this.npc = npc; + } + + public NBTTagCompound writeToNBT(NBTTagCompound compound) { + compound.setTag("NpcLines", worldLines.writeToNBT()); + compound.setTag("NpcKilledLines", killedLines.writeToNBT()); + compound.setTag("NpcInteractLines", interactLines.writeToNBT()); + compound.setTag("NpcAttackLines", attackLines.writeToNBT()); + compound.setTag("NpcKillLines", killLines.writeToNBT()); + + compound.setString("NpcIdleSound", idleSound); + compound.setString("NpcAngrySound", angrySound); + compound.setString("NpcHurtSound", hurtSound); + compound.setString("NpcDeathSound", deathSound); + compound.setString("NpcStepSound", stepSound); + + compound.setBoolean("OrderedLines", orderedLines); + + compound.setInteger("FactionID", npc.getFaction().id); + compound.setBoolean("AttackOtherFactions", attackOtherFactions); + compound.setBoolean("DefendFaction", defendFaction); + compound.setBoolean("DisablePitch", disablePitch); + + compound.setInteger("Role", role.ordinal()); + compound.setInteger("NpcJob", job.ordinal()); + compound.setTag("FactionPoints", factions.writeToNBT(new NBTTagCompound())); + + compound.setTag("NPCDialogOptions", nbtDialogs(npc.dialogs)); + + return compound; + } + + public void readToNBT(NBTTagCompound compound) { + interactLines.readNBT(compound.getCompoundTag("NpcInteractLines")); + worldLines.readNBT(compound.getCompoundTag("NpcLines")); + attackLines.readNBT(compound.getCompoundTag("NpcAttackLines")); + killedLines.readNBT(compound.getCompoundTag("NpcKilledLines")); + killLines.readNBT(compound.getCompoundTag("NpcKillLines")); + + idleSound = compound.getString("NpcIdleSound"); + angrySound = compound.getString("NpcAngrySound"); + hurtSound = compound.getString("NpcHurtSound"); + deathSound = compound.getString("NpcDeathSound"); + stepSound = compound.getString("NpcStepSound"); + + orderedLines = compound.getBoolean("OrderedLines"); + + npc.setFaction(compound.getInteger("FactionID")); + npc.faction = npc.getFaction(); + attackOtherFactions = compound.getBoolean("AttackOtherFactions"); + defendFaction = compound.getBoolean("DefendFaction"); + disablePitch = compound.getBoolean("DisablePitch"); + + setRole(compound.getInteger("Role")); + setJob(compound.getInteger("NpcJob")); + + factions.readFromNBT(compound.getCompoundTag("FactionPoints")); + + npc.dialogs = getDialogs(compound.getTagList("NPCDialogOptions", 10)); + } + + private HashMap getDialogs(NBTTagList tagList) { + HashMap map = new HashMap(); + for (int i = 0; i < tagList.tagCount(); i++) { + NBTTagCompound nbttagcompound = tagList.getCompoundTagAt(i); + int slot = nbttagcompound.getInteger("DialogSlot"); + DialogOption option = new DialogOption(); + option.readNBT(nbttagcompound.getCompoundTag("NPCDialog")); + map.put(slot, option); + + } + return map; + } + + + private NBTTagList nbtDialogs(HashMap dialogs2) { + NBTTagList nbttaglist = new NBTTagList(); + for (int slot : dialogs2.keySet()) { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setInteger("DialogSlot", slot); + nbttagcompound.setTag("NPCDialog", dialogs2.get(slot) + .writeNBT()); + nbttaglist.appendTag(nbttagcompound); + } + return nbttaglist; + } + + public Line getInteractLine() { + return interactLines.getLine(!orderedLines); + } + + public Line getAttackLine() { + return attackLines.getLine(!orderedLines); + } + + public Line getKilledLine() { + return killedLines.getLine(!orderedLines); + } + + public Line getKillLine() { + return killLines.getLine(!orderedLines); + } + + public Line getWorldLine() { + return worldLines.getLine(!orderedLines); + } + + public void setRole(int i) { + if (EnumRoleType.values().length <= i) { + i -= 2; + } + role = EnumRoleType.values()[i]; + if(role == EnumRoleType.None) + npc.roleInterface = null; + else if(role == EnumRoleType.Bank && !(npc.roleInterface instanceof RoleBank)) + npc.roleInterface = new RoleBank(npc); + else if(role == EnumRoleType.Follower && !(npc.roleInterface instanceof RoleFollower)) + npc.roleInterface = new RoleFollower(npc); + else if(role == EnumRoleType.Postman && !(npc.roleInterface instanceof RolePostman)) + npc.roleInterface = new RolePostman(npc); + else if(role == EnumRoleType.Trader && !(npc.roleInterface instanceof RoleTrader)) + npc.roleInterface = new RoleTrader(npc); + else if(role == EnumRoleType.Transporter && !(npc.roleInterface instanceof RoleTransporter)) + npc.roleInterface = new RoleTransporter(npc); + else if(role == EnumRoleType.Companion && !(npc.roleInterface instanceof RoleCompanion)) + npc.roleInterface = new RoleCompanion(npc); + } + + public void setJob(int i) { + if(npc.jobInterface != null && !npc.worldObj.isRemote) + npc.jobInterface.reset(); + + job = EnumJobType.values()[i % EnumJobType.values().length]; + if (job == EnumJobType.None) + npc.jobInterface = null; + else if (job == EnumJobType.Bard && !(npc.jobInterface instanceof JobBard)) + npc.jobInterface = new JobBard(npc); + else if (job == EnumJobType.Healer && !(npc.jobInterface instanceof JobHealer)) + npc.jobInterface = new JobHealer(npc); + else if (job == EnumJobType.Guard && !(npc.jobInterface instanceof JobGuard)) + npc.jobInterface = new JobGuard(npc); + else if (job == EnumJobType.ItemGiver && !(npc.jobInterface instanceof JobItemGiver)) + npc.jobInterface = new JobItemGiver(npc); + else if (job == EnumJobType.Follower && !(npc.jobInterface instanceof JobFollower)) + npc.jobInterface = new JobFollower(npc); + else if (job == EnumJobType.Spawner && !(npc.jobInterface instanceof JobSpawner)) + npc.jobInterface = new JobSpawner(npc); + else if (job == EnumJobType.Conversation && !(npc.jobInterface instanceof JobConversation)) + npc.jobInterface = new JobConversation(npc); + else if (job == EnumJobType.ChunkLoader && !(npc.jobInterface instanceof JobChunkLoader)) + npc.jobInterface = new JobChunkLoader(npc); + else if (job == EnumJobType.Puppet && !(npc.jobInterface instanceof JobPuppet)) + npc.jobInterface = new JobPuppet(npc); + } + + public boolean hasWorldLines() { + return !worldLines.isEmpty(); + } +} diff --git a/src/main/java/noppes/npcs/DataDisplay.java b/src/main/java/noppes/npcs/DataDisplay.java new file mode 100644 index 000000000..15780845a --- /dev/null +++ b/src/main/java/noppes/npcs/DataDisplay.java @@ -0,0 +1,155 @@ +package noppes.npcs; + +import java.util.Random; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTUtil; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.StringUtils; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.util.ValueUtil; + +import com.google.common.collect.Iterables; +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.properties.Property; + +public class DataDisplay { + EntityNPCInterface npc; + + public String name; + public String title = ""; + + public byte skinType = 0; //0:normal, 1:player, 2:url + public String url = ""; + public GameProfile playerProfile; + public String texture = "customnpcs:textures/entity/humanmale/Steve.png";; + public String cloakTexture = ""; + public String glowTexture = ""; + + public int visible = 0;//0:visible 1:Invisible 2:semi-invisible + + public int modelSize = 5; + + public int showName = 0; + + public boolean disableLivingAnimation = false; + + public byte showBossBar = 0; + + public DataDisplay(EntityNPCInterface npc){ + this.npc = npc; + String[] names = { "Noppes", "Noppes", "Noppes", "Noppes", "Atesson", + "Rothcersul", "Achdranys", "Pegato", "Chald", "Gareld", + "Nalworche", "Ineald", "Tia'kim", "Torerod", "Turturdar", + "Ranler", "Dyntan", "Oldrake", "Gharis", "Elmn", "Tanal", + "Waran-ess", "Ach-aldhat", "Athi", "Itageray", "Tasr", + "Ightech", "Gakih", "Adkal", "Qua'an", "Sieq", "Urnp", "Rods", + "Vorbani", "Smaik", "Fian", "Hir", "Ristai", "Kineth", "Naif", + "Issraya", "Arisotura", "Honf", "Rilfom", "Estz", "Ghatroth", + "Yosil", "Darage", "Aldny", "Tyltran", "Armos", "Loxiku", + "Burhat", "Tinlt", "Ightyd", "Mia", + "Ken", "Karla", "Lily", "Carina", "Daniel", "Slater", "Zidane", "Valentine", "Eirina", + "Carnow", "Grave", "Shadow", "Drakken", "Kaoz", "Silk", "Drake", "Oldam", "Lynxx", "Lenyx", + "Winter", "Seth", "Apolitho", "Amethyst", "Ankin", "Seinkan", "Ayumu", "Sakamoto", "Divina", + "Div", "Magia", "Magnus", "Tiakono", "Ruin", "Hailinx", "Ethan", "Wate", "Carter", "William", + "Brion", "Sparrow", "Basrrelen", "Gyaku", "Claire", "Crowfeather", "Blackwell", "Raven", "Farcri", + "Lucas", "Bangheart", "Kamoku", "Kyoukan", "Blaze", "Benjamin", "Larianne", "Kakaragon", + "Melancholy", "Epodyno", "Thanato", "Mika", "Dacks", "Ylander", "Neve", "Meadow", "Cuero", + "Embrera", "Eldamore", "Faolan", "Chim", "Nasu", "Kathrine", "Ariel", "Arei", "Demytrix", + "Kora", "Ava", "Larson", "Leonardo", "Wyrl", "Sakiama", "Lambton", "Kederath", "Malus", "Riplette", + "Andern", "Ezall", "Lucien", "Droco", "Cray", "Tymen", "Zenix", "Entranger", + "Saenorath", "Chris", "Christine", "Marble", "Mable", "Ross", "Rose", "Xalgan ", "Kennet" + }; + name = names[new Random().nextInt(names.length)]; + } + + public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) { + nbttagcompound.setString("Name", name); + nbttagcompound.setString("Title", title); + nbttagcompound.setString("SkinUrl", url); + nbttagcompound.setString("Texture", texture); + nbttagcompound.setString("CloakTexture", cloakTexture); + nbttagcompound.setString("GlowTexture", glowTexture); + nbttagcompound.setByte("UsingSkinUrl", skinType); + + if (this.playerProfile != null) + { + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + NBTUtil.func_152460_a(nbttagcompound1, this.playerProfile); + nbttagcompound.setTag("SkinUsername", nbttagcompound1); + } + + nbttagcompound.setInteger("Size", modelSize); + + nbttagcompound.setInteger("ShowName", showName); + nbttagcompound.setInteger("NpcVisible", visible); + + nbttagcompound.setBoolean("NoLivingAnimation", disableLivingAnimation); + nbttagcompound.setByte("BossBar", showBossBar); + + return nbttagcompound; + } + public void readToNBT(NBTTagCompound nbttagcompound) { + name = nbttagcompound.getString("Name"); + title = nbttagcompound.getString("Title"); + + url = nbttagcompound.getString("SkinUrl"); + int prevSkinType = skinType; + skinType = nbttagcompound.getByte("UsingSkinUrl"); + + this.playerProfile = null; + if(skinType == 1){ + if (nbttagcompound.hasKey("SkinUsername", 10)){ + this.playerProfile = NBTUtil.func_152459_a(nbttagcompound.getCompoundTag("SkinUsername")); + } + else if (nbttagcompound.hasKey("SkinUsername", 8) && !StringUtils.isNullOrEmpty(nbttagcompound.getString("SkinUsername"))){ + this.playerProfile = new GameProfile(null, nbttagcompound.getString("SkinUsername")); + } + this.loadProfile(); + } + + String prevTexture = texture; + + texture = nbttagcompound.getString("Texture"); + cloakTexture = nbttagcompound.getString("CloakTexture"); + glowTexture = nbttagcompound.getString("GlowTexture"); + + modelSize = ValueUtil.CorrectInt(nbttagcompound.getInteger("Size"), 1, 30); + + showName = nbttagcompound.getInteger("ShowName"); + visible = nbttagcompound.getInteger("NpcVisible"); + + disableLivingAnimation = nbttagcompound.getBoolean("NoLivingAnimation"); + showBossBar = nbttagcompound.getByte("BossBar"); + + if(prevSkinType != skinType || !texture.equals(prevTexture)) + npc.textureLocation = null; + npc.textureGlowLocation = null; + npc.textureCloakLocation = null; + npc.updateHitbox(); + } + + public void loadProfile(){ + if (this.playerProfile != null && !StringUtils.isNullOrEmpty(this.playerProfile.getName()) && MinecraftServer.getServer() != null){ + if (!this.playerProfile.isComplete() || !this.playerProfile.getProperties().containsKey("textures")){ + GameProfile gameprofile = MinecraftServer.getServer().func_152358_ax().func_152655_a(this.playerProfile.getName()); + + if (gameprofile != null){ + Property property = (Property)Iterables.getFirst(gameprofile.getProperties().get("textures"), (Object)null); + + if (property == null){ + gameprofile = MinecraftServer.getServer().func_147130_as().fillProfileProperties(gameprofile, false); + } + + this.playerProfile = gameprofile; + } + } + } + } + + public boolean showName() { + if(npc.isKilled()) + return false; + return showName == 0 || (showName == 2 && npc.isAttacking()); + } +} diff --git a/src/main/java/noppes/npcs/DataInventory.java b/src/main/java/noppes/npcs/DataInventory.java new file mode 100644 index 000000000..4f96b2f01 --- /dev/null +++ b/src/main/java/noppes/npcs/DataInventory.java @@ -0,0 +1,331 @@ +package noppes.npcs; + +import java.util.ArrayList; +import java.util.HashMap; + +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.item.EntityXPOrb; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MathHelper; +import noppes.npcs.entity.EntityNPCInterface; + +public class DataInventory implements IInventory{ + public HashMap items = new HashMap(); + public HashMap dropchance = new HashMap(); + public HashMap weapons = new HashMap(); + public HashMap armor = new HashMap(); + + public int minExp = 0; + public int maxExp = 0; + + public int lootMode = 0; + + private EntityNPCInterface npc; + + public DataInventory(EntityNPCInterface npc){ + this.npc = npc; + } + public NBTTagCompound writeEntityToNBT(NBTTagCompound nbttagcompound){ + nbttagcompound.setInteger("MinExp", minExp); + nbttagcompound.setInteger("MaxExp", maxExp); + nbttagcompound.setTag("NpcInv", NBTTags.nbtItemStackList(items)); + nbttagcompound.setTag("Armor", NBTTags.nbtItemStackList(getArmor())); + nbttagcompound.setTag("Weapons", NBTTags.nbtItemStackList(getWeapons())); + nbttagcompound.setTag("DropChance", NBTTags.nbtIntegerIntegerMap(dropchance)); + nbttagcompound.setInteger("LootMode", lootMode); + + return nbttagcompound; + } + public void readEntityFromNBT(NBTTagCompound nbttagcompound){ + minExp = nbttagcompound.getInteger("MinExp"); + maxExp = nbttagcompound.getInteger("MaxExp"); + items = NBTTags.getItemStackList(nbttagcompound.getTagList("NpcInv", 10)); + setArmor(NBTTags.getItemStackList(nbttagcompound.getTagList("Armor", 10))); + setWeapons(NBTTags.getItemStackList(nbttagcompound.getTagList("Weapons", 10))); + dropchance = NBTTags.getIntegerIntegerMap(nbttagcompound.getTagList("DropChance", 10)); + lootMode = nbttagcompound.getInteger("LootMode"); + } + public HashMap getWeapons() { + return weapons; + } + public void setWeapons(HashMap list) { + weapons = list; + } + public HashMap getArmor() { + return armor; + } + public void setArmor(HashMap list) { + armor = list; + } + public ItemStack getWeapon(){ + return weapons.get(0); + } + public void setWeapon(ItemStack item){ + weapons.put(0, item); + } + public ItemStack getProjectile(){ + return weapons.get(1); + } + public void setProjectile(ItemStack item){ + weapons.put(1, item); + } + public ItemStack getOffHand(){ + return weapons.get(2); + } + public void setOffHand(ItemStack item){ + weapons.put(2, item); + } + + public void dropStuff(Entity entity, DamageSource damagesource) { + ArrayList list = new ArrayList(); + for (int i : items.keySet()) { + ItemStack item = items.get(i); + if(item == null) + continue; + int dchance = 100; + if(dropchance.containsKey(i)) + dchance = dropchance.get(i); + int chance = npc.worldObj.rand.nextInt(100) + dchance; + if(chance >= 100){ + EntityItem e = getEntityItem(item.copy()); + if(e != null) + list.add(e); + } + } + + int enchant = 0; + if (damagesource.getEntity() instanceof EntityPlayer){ + enchant = EnchantmentHelper.getLootingModifier((EntityLivingBase)damagesource.getEntity()); + } + + if (!net.minecraftforge.common.ForgeHooks.onLivingDrops(npc, damagesource, list, enchant, true, 0)){ + for (EntityItem item : list){ + if(lootMode == 1 && entity instanceof EntityPlayer){ + EntityPlayer player = (EntityPlayer)entity; + item.delayBeforeCanPickup = 2; + npc.worldObj.spawnEntityInWorld(item); + ItemStack stack = item.getEntityItem(); + int i = stack.stackSize; + + if (player.inventory.addItemStackToInventory(stack)) { + npc.worldObj.playSoundAtEntity(item, + "random.pop", + 0.2F, + ((npc.getRNG().nextFloat() - npc.getRNG().nextFloat()) * 0.7F + 1.0F) * 2.0F); + player.onItemPickup(item, i); + + if (stack.stackSize <= 0) { + item.setDead(); + } + } + } + else + npc.worldObj.spawnEntityInWorld(item); + } + } + + int var1 = minExp; + if (maxExp - minExp > 0) + var1 += npc.worldObj.rand.nextInt(maxExp - minExp); + + while (var1 > 0){ + int var2 = EntityXPOrb.getXPSplit(var1); + var1 -= var2; + if(lootMode == 1 && entity instanceof EntityPlayer){ + npc.worldObj.spawnEntityInWorld(new EntityXPOrb(entity.worldObj, entity.posX, entity.posY, entity.posZ, var2)); + } + else{ + npc.worldObj.spawnEntityInWorld(new EntityXPOrb(npc.worldObj, npc.posX, npc.posY, npc.posZ, var2)); + } + } + + } + + public EntityItem getEntityItem(ItemStack itemstack) { + if (itemstack == null) { + return null; + } + EntityItem entityitem = new EntityItem(npc.worldObj, npc.posX, + (npc.posY - 0.30000001192092896D) + (double) npc.getEyeHeight(), npc.posZ, + itemstack); + entityitem.delayBeforeCanPickup = 40; + + float f2 = npc.getRNG().nextFloat() * 0.5F; + float f4 = npc.getRNG().nextFloat() * 3.141593F * 2.0F; + entityitem.motionX = -MathHelper.sin(f4) * f2; + entityitem.motionZ = MathHelper.cos(f4) * f2; + entityitem.motionY = 0.20000000298023224D; + + return entityitem; + } + + public ItemStack armorItemInSlot(int i) { + return getArmor().get(i); + } + @Override + public int getSizeInventory() { + // TODO Auto-generated method stub + return 15; + } + @Override + public ItemStack getStackInSlot(int i) { + if(i < 4) + return armorItemInSlot(i); + else if(i < 7) + return getWeapons().get(i-4); + else + return items.get(i-7); + } + @Override + public ItemStack decrStackSize(int par1, int par2) { + int i =0; + HashMap var3; + + if (par1 >= 7) + { + var3 = items; + par1 -= 7; + } + else if (par1 >= 4) + { + var3 = getWeapons(); + par1 -= 4; + i = 1; + } + else{ + var3 = getArmor(); + i = 2; + } + + ItemStack var4 = null; + if (var3.get(par1) != null) + { + + if (var3.get(par1).stackSize <= par2) + { + var4 = var3.get(par1); + var3.put(par1,null); + } + else + { + var4 = var3.get(par1).splitStack(par2); + + if (var3.get(par1).stackSize == 0) + { + var3.put(par1,null); + } + } + } + if(i == 1) + setWeapons(var3); + if(i == 2) + setArmor(var3); + return var4; + } + @Override + public ItemStack getStackInSlotOnClosing(int par1) { + int i = 0; + HashMap var2;; + + if (par1 >= 7) + { + var2 = items; + par1 -= 7; + } + else if (par1 >= 4) + { + var2 = getWeapons(); + par1 -= 4; + i = 1; + } + else{ + var2 = getArmor(); + i = 2; + } + + if (var2.get(par1) != null) + { + ItemStack var3 = var2.get(par1); + var2.put(par1,null); + if(i == 1) + setWeapons(var2); + if(i == 2) + setArmor(var2); + return var3; + } + else + { + return null; + } + } + @Override + public void setInventorySlotContents(int par1, ItemStack par2ItemStack) + { + int i = 0; + HashMap var3; + + if (par1 >= 7) + { + var3 = items; + par1 -= 7; + } + else if (par1 >= 4) + { + var3 = getWeapons(); + par1 -= 4; + i = 1; + } + else{ + var3 = getArmor(); + i = 2; + } + + var3.put(par1,par2ItemStack); + if(i == 1) + setWeapons(var3); + if(i == 2) + setArmor(var3); + } + @Override + public int getInventoryStackLimit() { + return 64; + } + @Override + public boolean isUseableByPlayer(EntityPlayer var1) { + return true; + } + @Override + public boolean isItemValidForSlot(int i, ItemStack itemstack) { + return true; + } + @Override + public String getInventoryName() { + return "NPC Inventory"; + } + @Override + public boolean hasCustomInventoryName() { + return true; + } + @Override + public void markDirty() { + // TODO Auto-generated method stub + + } + @Override + public void openInventory() { + // TODO Auto-generated method stub + + } + @Override + public void closeInventory() { + // TODO Auto-generated method stub + + } +} diff --git a/src/main/java/noppes/npcs/DataScript.java b/src/main/java/noppes/npcs/DataScript.java new file mode 100644 index 000000000..d36b0be7c --- /dev/null +++ b/src/main/java/noppes/npcs/DataScript.java @@ -0,0 +1,149 @@ +package noppes.npcs; + +import java.util.HashMap; +import java.util.Map; + +import javax.script.ScriptEngine; + +import net.minecraft.entity.Entity; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.world.World; +import net.minecraft.world.WorldServer; +import noppes.npcs.constants.EnumScriptType; +import noppes.npcs.controllers.ScriptContainer; +import noppes.npcs.controllers.ScriptController; +import noppes.npcs.entity.EntityCustomNpc; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.scripted.ScriptEvent; +import noppes.npcs.scripted.ScriptNpc; +import noppes.npcs.scripted.ScriptWorld; +import noppes.npcs.scripted.constants.EntityType; +import noppes.npcs.scripted.constants.JobType; +import noppes.npcs.scripted.constants.RoleType; + +public class DataScript { + public Map scripts = new HashMap(); + private final static EntityType entities = new EntityType(); + private final static JobType jobs = new JobType(); + private final static RoleType roles = new RoleType(); + + public String scriptLanguage = "ECMAScript"; + private EntityNPCInterface npc; + public boolean enabled = false; + + public ScriptNpc dummyNpc; + public ScriptWorld dummyWorld; + public boolean clientNeedsUpdate = false; + public boolean aiNeedsUpdate = false; + public boolean hasInited = false; + + public DataScript(EntityNPCInterface npc) { + this.npc = npc; + if(npc instanceof EntityCustomNpc) + dummyNpc = new ScriptNpc((EntityCustomNpc) npc); + if(npc.worldObj instanceof WorldServer) + dummyWorld = new ScriptWorld((WorldServer) npc.worldObj); + } + + public void readFromNBT(NBTTagCompound compound) { + scripts = readScript(compound.getTagList("ScriptsContainers", 10)); + scriptLanguage = compound.getString("ScriptLanguage"); + enabled = compound.getBoolean("ScriptEnabled"); + } + + public NBTTagCompound writeToNBT(NBTTagCompound compound) { + compound.setTag("ScriptsContainers", writeScript(scripts)); + compound.setString("ScriptLanguage", scriptLanguage); + compound.setBoolean("ScriptEnabled", enabled); + return compound; + } + + private Map readScript(NBTTagList list){ + Map scripts = new HashMap(); + for(int i = 0; i < list.tagCount(); i++){ + NBTTagCompound compoundd = list.getCompoundTagAt(i); + ScriptContainer script = new ScriptContainer(); + script.readFromNBT(compoundd); + if(script.hasCode() || npc.isRemote()) + scripts.put(compoundd.getInteger("Type"), script); + } + return scripts; + } + + private NBTTagList writeScript(Map scripts){ + NBTTagList list = new NBTTagList(); + for(Integer type : scripts.keySet()){ + NBTTagCompound compoundd = new NBTTagCompound(); + compoundd.setInteger("Type", type); + ScriptContainer script = scripts.get(type); + script.writeToNBT(compoundd); + list.appendTag(compoundd); + } + return list; + } + + public boolean callScript(EnumScriptType type, Object... obs){ + if(aiNeedsUpdate){ + npc.updateAI = true; + aiNeedsUpdate = false; + } + if(clientNeedsUpdate){ + npc.updateClient = true; + clientNeedsUpdate = false; + } + if(!isEnabled()) + return false; + if(!hasInited){ + hasInited = true; + callScript(EnumScriptType.INIT); + } + ScriptContainer script = scripts.get(type.ordinal()); + if(script == null || script.errored || !script.hasCode()) + return false; + script.setEngine(scriptLanguage); + if(script.engine == null) + return false; + for(int i = 0; i + 1 < obs.length; i += 2){ + Object ob = obs[i + 1]; + if(ob instanceof Entity) + ob = ScriptController.Instance.getScriptForEntity((Entity)ob); + script.engine.put(obs[i].toString(), ob); + } + + return callScript(script); + } + + public boolean isEnabled(){ + return enabled && ScriptController.HasStart && !npc.worldObj.isRemote && !scripts.isEmpty(); + } + + private boolean callScript(ScriptContainer script){ + ScriptEngine engine = script.engine; + engine.put("npc", dummyNpc); + engine.put("world", dummyWorld); + ScriptEvent result = (ScriptEvent) engine.get("event"); + if(result == null) + engine.put("event", result = new ScriptEvent()); + engine.put("EntityType", entities); + engine.put("RoleType", roles); + engine.put("JobType", jobs); + script.run(engine); + + if(clientNeedsUpdate){ + npc.updateClient = true; + clientNeedsUpdate = false; + } + if(aiNeedsUpdate){ + npc.updateAI = true; + aiNeedsUpdate = false; + } + return result.isCancelled(); + } + + public void setWorld(World world) { + if(world instanceof WorldServer) + dummyWorld = new ScriptWorld((WorldServer) world); + } + +} diff --git a/src/main/java/noppes/npcs/DataStats.java b/src/main/java/noppes/npcs/DataStats.java new file mode 100644 index 000000000..f011ee324 --- /dev/null +++ b/src/main/java/noppes/npcs/DataStats.java @@ -0,0 +1,183 @@ +package noppes.npcs; + +import net.minecraft.entity.EnumCreatureAttribute; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.constants.EnumParticleType; +import noppes.npcs.constants.EnumPotionType; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.util.ValueUtil; + +public class DataStats { + + private int attackStrength = 5; + public int attackSpeed = 20, attackRange = 2, knockback = 0; + public int minDelay = 20, maxDelay = 40, rangedRange = 15, fireRate = 5, burstCount = 1, shotCount = 1, accuracy = 60; + public int aggroRange = 16; + + public EnumPotionType potionType = EnumPotionType.None; + public int potionDuration = 5; //20 = 1 second + public int potionAmp = 0; + + public int maxHealth = 20; + public int respawnTime = 20; + public int spawnCycle = 0; + public boolean hideKilledBody = false; + public boolean canDespawn = false; + + public Resistances resistances = new Resistances(); + + public boolean immuneToFire = false; + public boolean potionImmune = false; + public boolean canDrown = true; + public boolean burnInSun = false; + public boolean noFallDamage = false; + public int healthRegen = 1; + public int combatRegen = 0; + + public int pDamage = 4, pImpact = 0, pSize = 5, pSpeed = 10, pArea = 0, pDur = 5; + public boolean pPhysics = true, pXlr8 = false, pGlows = false, pExplode = false; + public boolean pRender3D = false, pSpin = false, pStick = false; + public EnumPotionType pEffect = EnumPotionType.None; + public EnumParticleType pTrail = EnumParticleType.None; + public int pEffAmp = 0; + public String fireSound = "random.bow"; + public boolean aimWhileShooting = false; + + public EnumCreatureAttribute creatureType = EnumCreatureAttribute.UNDEFINED; + + private EntityNPCInterface npc; + public boolean attackInvisible = false; + + public DataStats(EntityNPCInterface npc){ + this.npc = npc; + } + public NBTTagCompound writeToNBT(NBTTagCompound compound) + { + compound.setTag("Resistances", resistances.writeToNBT()); + compound.setInteger("MaxHealth", maxHealth); + compound.setInteger("AggroRange", aggroRange); + compound.setBoolean("HideBodyWhenKilled", hideKilledBody); + compound.setInteger("RespawnTime", respawnTime); + compound.setInteger("SpawnCycle", spawnCycle); + compound.setInteger("CreatureType", creatureType.ordinal()); + compound.setInteger("HealthRegen", healthRegen); + compound.setInteger("CombatRegen", combatRegen); + + compound.setInteger("AttackStrenght", attackStrength); + compound.setInteger("AttackRange", attackRange); + compound.setInteger("AttackSpeed", attackSpeed); + compound.setInteger("KnockBack", knockback); + compound.setInteger("PotionEffect", potionType.ordinal()); + compound.setInteger("PotionDuration", potionDuration); + compound.setInteger("PotionAmp", potionAmp); + + compound.setInteger("MaxFiringRange", rangedRange); + compound.setInteger("FireRate", fireRate); + compound.setInteger("minDelay", minDelay); + compound.setInteger("maxDelay", maxDelay); + compound.setInteger("BurstCount", burstCount); + compound.setInteger("ShotCount", shotCount); + compound.setInteger("Accuracy", accuracy); + + compound.setInteger("pDamage", pDamage); + compound.setInteger("pImpact", pImpact); + compound.setInteger("pSize", pSize); + compound.setInteger("pSpeed", pSpeed); + compound.setInteger("pArea", pArea); + compound.setInteger("pDur", pDur); + compound.setBoolean("pPhysics", pPhysics); + compound.setBoolean("pXlr8", pXlr8); + compound.setBoolean("pGlows", pGlows); + compound.setBoolean("pExplode", pExplode); + compound.setBoolean("pRender3D", pRender3D); + compound.setBoolean("pSpin", pSpin); + compound.setBoolean("pStick", pStick); + compound.setInteger("pEffect", pEffect.ordinal()); + compound.setInteger("pTrail", pTrail.ordinal()); + compound.setInteger("pEffAmp", pEffAmp); + compound.setString("FiringSound", fireSound); + compound.setBoolean("AimWhileShooting", aimWhileShooting); + + compound.setBoolean("ImmuneToFire", immuneToFire); + compound.setBoolean("PotionImmune", potionImmune); + compound.setBoolean("CanDrown", canDrown); + compound.setBoolean("BurnInSun", burnInSun); + compound.setBoolean("NoFallDamage", noFallDamage); + compound.setBoolean("CanDespawn", canDespawn); + compound.setBoolean("AttackInvisible", attackInvisible); + + return compound; + } + + public void readToNBT(NBTTagCompound compound) + { + resistances.readToNBT(compound.getCompoundTag("Resistances")); + setMaxHealth(compound.getInteger("MaxHealth")); + hideKilledBody = compound.getBoolean("HideBodyWhenKilled"); + aggroRange = compound.getInteger("AggroRange"); + respawnTime = compound.getInteger("RespawnTime"); + spawnCycle = compound.getInteger("SpawnCycle"); + creatureType = EnumCreatureAttribute.values()[compound.getInteger("CreatureType") % EnumPotionType.values().length]; + healthRegen = compound.getInteger("HealthRegen"); + combatRegen = compound.getInteger("CombatRegen"); + + setAttackStrength(compound.getInteger("AttackStrenght")); + attackSpeed = compound.getInteger("AttackSpeed"); + attackRange = compound.getInteger("AttackRange"); + knockback = compound.getInteger("KnockBack"); + potionType = EnumPotionType.values()[compound.getInteger("PotionEffect") % EnumPotionType.values().length]; + potionDuration = compound.getInteger("PotionDuration"); + potionAmp = compound.getInteger("PotionAmp"); + + rangedRange = compound.getInteger("MaxFiringRange"); + fireRate = compound.getInteger("FireRate"); + minDelay = ValueUtil.CorrectInt(compound.getInteger("minDelay"), 1, 9999); + maxDelay = ValueUtil.CorrectInt(compound.getInteger("maxDelay"), 1, 9999); + burstCount = compound.getInteger("BurstCount"); + shotCount = ValueUtil.CorrectInt(compound.getInteger("ShotCount"), 1, 10); + accuracy = compound.getInteger("Accuracy"); + + pDamage = compound.getInteger("pDamage"); + pImpact = compound.getInteger("pImpact"); + pSize = compound.getInteger("pSize"); + pSpeed = compound.getInteger("pSpeed"); + pArea = compound.getInteger("pArea"); + pDur = compound.getInteger("pDur"); + pPhysics = compound.getBoolean("pPhysics"); + pXlr8 = compound.getBoolean("pXlr8"); + pGlows = compound.getBoolean("pGlows"); + pExplode = compound.getBoolean("pExplode"); + pRender3D = compound.getBoolean("pRender3D"); + pSpin = compound.getBoolean("pSpin"); + pStick = compound.getBoolean("pStick"); + pEffect = EnumPotionType.values()[compound.getInteger("pEffect") % EnumPotionType.values().length]; + pTrail = EnumParticleType.values()[compound.getInteger("pTrail") % EnumParticleType.values().length]; + pEffAmp = compound.getInteger("pEffAmp"); + fireSound = compound.getString("FiringSound"); + aimWhileShooting = compound.getBoolean("AimWhileShooting"); + + immuneToFire = compound.getBoolean("ImmuneToFire"); + potionImmune = compound.getBoolean("PotionImmune"); + canDrown = compound.getBoolean("CanDrown"); + burnInSun = compound.getBoolean("BurnInSun"); + noFallDamage = compound.getBoolean("NoFallDamage"); + canDespawn = compound.getBoolean("CanDespawn"); + attackInvisible = compound.getBoolean("AttackInvisible"); + + npc.setImmuneToFire(immuneToFire); + } + + public int getAttackStrength(){ + return attackStrength; + } + public void setAttackStrength(int strength){ + attackStrength = strength; + npc.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(attackStrength); + } + + public void setMaxHealth(int maxHealth) { + this.maxHealth = maxHealth; + npc.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(maxHealth); + } +} diff --git a/src/main/java/noppes/npcs/IChatMessages.java b/src/main/java/noppes/npcs/IChatMessages.java new file mode 100644 index 000000000..736090e71 --- /dev/null +++ b/src/main/java/noppes/npcs/IChatMessages.java @@ -0,0 +1,10 @@ +package noppes.npcs; + +import noppes.npcs.entity.EntityNPCInterface; + +public interface IChatMessages { + + public void addMessage(String message, EntityNPCInterface npc); + public void renderMessages(double par3, double par5, double par7, float scale); + +} diff --git a/src/main/java/noppes/npcs/ICompatibilty.java b/src/main/java/noppes/npcs/ICompatibilty.java new file mode 100644 index 000000000..7c34a739b --- /dev/null +++ b/src/main/java/noppes/npcs/ICompatibilty.java @@ -0,0 +1,9 @@ +package noppes.npcs; + +import net.minecraft.nbt.NBTTagCompound; + +public interface ICompatibilty { + public int getVersion(); + public void setVersion(int version); + public NBTTagCompound writeToNBT(NBTTagCompound compound); +} diff --git a/src/main/java/noppes/npcs/LogWriter.java b/src/main/java/noppes/npcs/LogWriter.java new file mode 100644 index 000000000..cc7673280 --- /dev/null +++ b/src/main/java/noppes/npcs/LogWriter.java @@ -0,0 +1,101 @@ +package noppes.npcs; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.logging.ConsoleHandler; +import java.util.logging.Formatter; +import java.util.logging.Handler; +import java.util.logging.Level; +import java.util.logging.LogRecord; +import java.util.logging.Logger; +import java.util.logging.StreamHandler; + +public class LogWriter { + private final static String name = "CustomNPCs"; + private final static Logger logger = Logger.getLogger(name); + private final static SimpleDateFormat dateformat = new SimpleDateFormat("HH:mm:ss"); + private static Handler handler; + static { + try { + File dir = new File("logs"); + if(!dir.exists()) + dir.mkdir(); + File file = new File(dir, name + "-latest.log"); + File lock = new File(dir, name + "-latest.log.lck"); + File file1 = new File(dir, name + "-1.log"); + File file2 = new File(dir, name + "-2.log"); + File file3 = new File(dir, name + "-3.log"); + + if(lock.exists()) + lock.delete(); + + if(file3.exists()) + file3.delete(); + if(file2.exists()) + file2.renameTo(file3); + if(file1.exists()) + file1.renameTo(file2); + if(file.exists()) + file.renameTo(file1); + + handler = new StreamHandler(new FileOutputStream(file), new Formatter() { + @Override + public String format(LogRecord record) { + StackTraceElement element = Thread.currentThread().getStackTrace()[8]; + String line = "[" + element.getClassName() + ":" + element.getLineNumber() + "] "; + String time = "[" + dateformat.format(new Date(record.getMillis())) + "][" + record.getLevel() + "]" + line; + if(record.getThrown() != null){ + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + record.getThrown().printStackTrace(pw); + return time + sw.toString(); + } + return time + record.getMessage() + System.getProperty("line.separator"); + } + }); + handler.setLevel(Level.ALL); + logger.addHandler(handler); + logger.setUseParentHandlers(false); + Handler consoleHandler = new ConsoleHandler(); + consoleHandler.setFormatter(handler.getFormatter()); + consoleHandler.setLevel(Level.ALL); + logger.addHandler(consoleHandler); + + logger.setLevel(Level.ALL); + info(new Date().toString()); + } catch (SecurityException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public static void info(Object msg) { + logger.log(Level.FINE, msg.toString()); + handler.flush(); + } + + public static void error(Object msg) { + logger.log(Level.SEVERE, msg.toString()); + handler.flush(); + } + + public static void error(Object msg, Exception e) { + logger.log(Level.SEVERE, msg.toString()); + logger.log(Level.SEVERE, e.getMessage(), e); + handler.flush(); + } + + public static void except(Exception e) { + logger.log(Level.SEVERE, e.getMessage(), e); + handler.flush(); + } +} diff --git a/src/main/java/noppes/npcs/ModelData.java b/src/main/java/noppes/npcs/ModelData.java new file mode 100644 index 000000000..90eb41025 --- /dev/null +++ b/src/main/java/noppes/npcs/ModelData.java @@ -0,0 +1,45 @@ +package noppes.npcs; + +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.world.World; +import noppes.npcs.controllers.PixelmonHelper; +import noppes.npcs.entity.EntityNPCInterface; + +public class ModelData extends ModelDataShared{ + + public EntityLivingBase getEntity(EntityNPCInterface npc){ + if(entityClass == null) + return null; + if(entity == null){ + try { + entity = entityClass.getConstructor(new Class[] {World.class}).newInstance(new Object[] {npc.worldObj}); + + entity.readEntityFromNBT(extra); + + if(entity instanceof EntityLiving){ + EntityLiving living = (EntityLiving)entity; + living.setCurrentItemOrArmor(0, npc.getHeldItem() != null?npc.getHeldItem():npc.getOffHand()); + living.setCurrentItemOrArmor(1, npc.inventory.armorItemInSlot(3)); + living.setCurrentItemOrArmor(2, npc.inventory.armorItemInSlot(2)); + living.setCurrentItemOrArmor(3, npc.inventory.armorItemInSlot(1)); + living.setCurrentItemOrArmor(4, npc.inventory.armorItemInSlot(0)); + } + if(PixelmonHelper.isPixelmon(entity) && npc.worldObj.isRemote){ + if(extra.hasKey("Name")) + PixelmonHelper.setName(entity, extra.getString("Name")); + else + PixelmonHelper.setName(entity, "Abra"); + } + } catch (Exception e) { + } + } + return entity; + } + + public ModelData copy(){ + ModelData data = new ModelData(); + data.readFromNBT(this.writeToNBT()); + return data; + } +} diff --git a/src/main/java/noppes/npcs/ModelDataShared.java b/src/main/java/noppes/npcs/ModelDataShared.java new file mode 100644 index 000000000..63830d4c9 --- /dev/null +++ b/src/main/java/noppes/npcs/ModelDataShared.java @@ -0,0 +1,151 @@ +package noppes.npcs; + +import java.util.HashMap; + +import net.minecraft.entity.EntityAgeable; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.passive.EntityBat; +import net.minecraft.entity.passive.EntityHorse; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.world.World; + + +public class ModelDataShared{ + public ModelPartConfig arms = new ModelPartConfig(); + public ModelPartConfig body = new ModelPartConfig(); + public ModelPartConfig legs = new ModelPartConfig(); + public ModelPartConfig head = new ModelPartConfig(); + + public ModelPartData legParts = new ModelPartData(); + + public Class entityClass; + public EntityLivingBase entity; + + public NBTTagCompound extra = new NBTTagCompound(); + + private HashMap parts = new HashMap(); + public byte breasts = 0; + + public byte headwear = 2; + + public NBTTagCompound writeToNBT(){ + NBTTagCompound compound = new NBTTagCompound(); + + if(entityClass != null) + compound.setString("EntityClass", entityClass.getCanonicalName()); + + compound.setTag("ArmsConfig", arms.writeToNBT()); + compound.setTag("BodyConfig", body.writeToNBT()); + compound.setTag("LegsConfig", legs.writeToNBT()); + compound.setTag("HeadConfig", head.writeToNBT()); + + compound.setTag("LegParts", legParts.writeToNBT()); + + compound.setByte("Headwear", headwear); + compound.setByte("Breasts", breasts); + compound.setTag("ExtraData", extra); + + NBTTagList list = new NBTTagList(); + for(String name : parts.keySet()){ + NBTTagCompound item = parts.get(name).writeToNBT(); + item.setString("PartName", name); + list.appendTag(item); + } + compound.setTag("Parts", list); + + return compound; + } + + public void readFromNBT(NBTTagCompound compound){ + setEntityClass(compound.getString("EntityClass")); + + arms.readFromNBT(compound.getCompoundTag("ArmsConfig")); + body.readFromNBT(compound.getCompoundTag("BodyConfig")); + legs.readFromNBT(compound.getCompoundTag("LegsConfig")); + head.readFromNBT(compound.getCompoundTag("HeadConfig")); + + legParts.readFromNBT(compound.getCompoundTag("LegParts")); + + headwear = compound.getByte("Headwear"); + breasts = compound.getByte("Breasts"); + extra = compound.getCompoundTag("ExtraData"); + + HashMap parts = new HashMap(); + NBTTagList list = compound.getTagList("Parts", 10); + for (int i = 0; i < list.tagCount(); i++) { + NBTTagCompound item = list.getCompoundTagAt(i); + ModelPartData part = new ModelPartData(); + part.readFromNBT(item); + parts.put(item.getString("PartName"), part); + } + this.parts = parts; + + } + + private void setEntityClass(String string) { + entityClass = null; + entity = null; + try { + Class cls = Class.forName(string); + if (EntityLivingBase.class.isAssignableFrom(cls)) + entityClass = cls.asSubclass(EntityLivingBase.class); + + } catch (ClassNotFoundException e) { + + } + } + + public void setEntityClass(Class entityClass){ + this.entityClass = entityClass; + entity = null; + extra = new NBTTagCompound(); + if(entityClass == EntityHorse.class) + extra.setInteger("Type", -1); + } + + public Class getEntityClass(){ + return entityClass; + } + + public float offsetY() { + if(entity == null) + return -getBodyY(); + return entity.height - 1.8f; + } + + public void clearEntity() { + entity = null; + } + + + public ModelPartData getPartData(String type){ + return parts.get(type); + } + + public void removePart(String type) { + parts.remove(type); + } + + public ModelPartData getOrCreatePart(String type) { + ModelPartData part = parts.get(type); + if(part == null) + parts.put(type, part = new ModelPartData()); + return part; + } + + public float getBodyY(){ + if(legParts.type == 3) + return (0.9f - body.scaleY) * 0.75f + getLegsY(); + if(legParts.type == 3) + return (0.5f - body.scaleY) * 0.75f + getLegsY(); + return (1 - body.scaleY) * 0.75f + getLegsY(); + } + + public float getLegsY() { + if(legParts.type == 3) + return (0.87f - legs.scaleY) * 1f; + return (1 - legs.scaleY) * 0.75f; + } +} diff --git a/src/main/java/noppes/npcs/ModelPartConfig.java b/src/main/java/noppes/npcs/ModelPartConfig.java new file mode 100644 index 000000000..566158e27 --- /dev/null +++ b/src/main/java/noppes/npcs/ModelPartConfig.java @@ -0,0 +1,47 @@ +package noppes.npcs; + +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.util.ValueUtil; + +public class ModelPartConfig { + public float scaleX = 1, scaleY = 1, scaleZ = 1; + public float transX = 0, transY = 0, transZ = 0; + + + public NBTTagCompound writeToNBT(){ + NBTTagCompound compound = new NBTTagCompound(); + compound.setFloat("ScaleX", scaleX); + compound.setFloat("ScaleY", scaleY); + compound.setFloat("ScaleZ", scaleZ); + + compound.setFloat("TransX", transX); + compound.setFloat("TransY", transY); + compound.setFloat("TransZ", transZ); + return compound; + } + + public void readFromNBT(NBTTagCompound compound){ + scaleX = ValueUtil.correctFloat(compound.getFloat("ScaleX"), 0.5f, 1.5f); + scaleY = ValueUtil.correctFloat(compound.getFloat("ScaleY"), 0.5f, 1.5f); + scaleZ = ValueUtil.correctFloat(compound.getFloat("ScaleZ"), 0.5f, 1.5f); + + transX = compound.getFloat("TransX"); + transY = compound.getFloat("TransY"); + transZ = compound.getFloat("TransZ"); + } + + public String toString(){ + return "ScaleX: " + scaleX + " - ScaleY: " + scaleY + " - ScaleZ: " + scaleZ; + } + + public void setScale(float x, float y, float z) { + scaleX = x; + scaleY = y; + scaleZ = z; + } + public void setScale(float x, float y) { + scaleZ = scaleX = x; + scaleY = y; + } + +} diff --git a/src/main/java/noppes/npcs/ModelPartData.java b/src/main/java/noppes/npcs/ModelPartData.java new file mode 100644 index 000000000..fd3cf2bc3 --- /dev/null +++ b/src/main/java/noppes/npcs/ModelPartData.java @@ -0,0 +1,75 @@ +package noppes.npcs; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ResourceLocation; + +public class ModelPartData { + public int color = 0xFFFFFF; + public String texture; + public byte type = 0; + public boolean playerTexture; + + private ResourceLocation location; + + public ModelPartData(){ + playerTexture = true; + } + + public ModelPartData(String texture) { + this.texture = texture; + playerTexture = false; + } + + public NBTTagCompound writeToNBT(){ + NBTTagCompound compound = new NBTTagCompound(); + compound.setByte("Type", type); + compound.setInteger("Color", color); + if(texture != null && !texture.isEmpty()) + compound.setString("Texture", texture); + compound.setBoolean("PlayerTexture", playerTexture); + return compound; + } + + public void readFromNBT(NBTTagCompound compound){ + type = compound.getByte("Type"); + color = compound.getInteger("Color"); + texture = compound.getString("Texture"); + playerTexture = compound.getBoolean("PlayerTexture"); + location = null; + } + + public ResourceLocation getResource(){ + if(texture.isEmpty()) + return null; + if(location != null) + return location; + location = new ResourceLocation(texture); + return location; + } + + public void setTexture(String texture, int type) { + this.type = (byte) type; + this.location = null; + if(texture.isEmpty()){ + playerTexture = true; + this.texture = texture; + } + else{ + this.texture = "moreplayermodels:textures/"+ texture + ".png"; + playerTexture = false; + } + } + + public String toString(){ + return "Color: " + color + " Type: " + type; + } + + public String getColor() { + String str = Integer.toHexString(color); + + while(str.length() < 6) + str = "0" + str; + + return str; + } +} diff --git a/src/main/java/noppes/npcs/NBTTags.java b/src/main/java/noppes/npcs/NBTTags.java new file mode 100644 index 000000000..87fc9826a --- /dev/null +++ b/src/main/java/noppes/npcs/NBTTags.java @@ -0,0 +1,386 @@ +package noppes.npcs; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.Vector; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagDouble; +import net.minecraft.nbt.NBTTagInt; +import net.minecraft.nbt.NBTTagList; + +public class NBTTags { + + public static HashMap getItemStackList( + NBTTagList tagList) { + HashMap list = new HashMap(); + for(int i = 0; i < tagList.tagCount(); i++) + { + NBTTagCompound nbttagcompound = tagList.getCompoundTagAt(i); + try{ + list.put(nbttagcompound.getByte("Slot") & 0xff, NoppesUtilServer.readItem(nbttagcompound)); + } + catch(ClassCastException e){ + list.put(nbttagcompound.getInteger("Slot"), NoppesUtilServer.readItem(nbttagcompound)); + } + } + return list; + } + + public static ItemStack[] getItemStackArray( + NBTTagList tagList) { + ItemStack[] list = new ItemStack[tagList.tagCount()]; + for(int i = 0; i < tagList.tagCount(); i++) + { + NBTTagCompound nbttagcompound = tagList.getCompoundTagAt(i); + list[nbttagcompound.getByte("Slot") & 0xff] = NoppesUtilServer.readItem(nbttagcompound); + } + return list; + } + + public static ArrayList getIntegerArraySet(NBTTagList tagList) { + ArrayList set = new ArrayList(); + for(int i = 0; i < tagList.tagCount(); i++) + { + NBTTagCompound compound = tagList.getCompoundTagAt(i); + set.add(compound.getIntArray("Array")); + } + return set; + } + + public static HashMap getBooleanList(NBTTagList tagList) { + HashMap list = new HashMap(); + for(int i = 0; i < tagList.tagCount(); i++) + { + NBTTagCompound nbttagcompound = tagList.getCompoundTagAt(i); + list.put(nbttagcompound.getInteger("Slot"), nbttagcompound.getBoolean("Boolean")); + } + return list; + } + + public static HashMap getIntegerIntegerMap( + NBTTagList tagList) { + HashMap list = new HashMap(); + for(int i = 0; i < tagList.tagCount(); i++) + { + NBTTagCompound nbttagcompound = tagList.getCompoundTagAt(i); + list.put(nbttagcompound.getInteger("Slot"), nbttagcompound.getInteger("Integer")); + } + return list; + } + + public static HashMap getIntegerLongMap( + NBTTagList tagList) { + HashMap list = new HashMap(); + for(int i = 0; i < tagList.tagCount(); i++) + { + NBTTagCompound nbttagcompound = tagList.getCompoundTagAt(i); + list.put(nbttagcompound.getInteger("Slot"), nbttagcompound.getLong("Long")); + } + return list; + } + + public static HashSet getIntegerSet(NBTTagList tagList) { + HashSet list = new HashSet(); + for(int i = 0; i < tagList.tagCount(); i++) + { + NBTTagCompound nbttagcompound = tagList.getCompoundTagAt(i); + list.add(nbttagcompound.getInteger("Integer")); + } + return list; + } + + public static HashMap getStringStringMap(NBTTagList tagList) { + HashMap list = new HashMap(); + for(int i = 0; i < tagList.tagCount(); i++) + { + NBTTagCompound nbttagcompound = tagList.getCompoundTagAt(i); + list.put(nbttagcompound.getString("Slot"), nbttagcompound.getString("Value")); + } + return list; + } + + public static HashMap getIntegerStringMap(NBTTagList tagList) { + HashMap list = new HashMap(); + for(int i = 0; i < tagList.tagCount(); i++) + { + NBTTagCompound nbttagcompound = tagList.getCompoundTagAt(i); + list.put(nbttagcompound.getInteger("Slot"), nbttagcompound.getString("Value")); + } + return list; + } + + public static HashMap getStringIntegerMap(NBTTagList tagList) { + HashMap list = new HashMap(); + for(int i = 0; i < tagList.tagCount(); i++) + { + NBTTagCompound nbttagcompound = tagList.getCompoundTagAt(i); + list.put(nbttagcompound.getString("Slot"), nbttagcompound.getInteger("Value")); + } + return list; + } + public static HashMap> getVectorMap(NBTTagList tagList) { + HashMap> map = new HashMap>(); + for(int i = 0; i < tagList.tagCount(); i++) + { + Vector values = new Vector(); + NBTTagCompound nbttagcompound = tagList.getCompoundTagAt(i); + NBTTagList list = nbttagcompound.getTagList("Values", 10); + for(int j = 0; j < list.tagCount(); j++) + { + NBTTagCompound value = list.getCompoundTagAt(j); + values.add(value.getString("Value")); + } + + map.put(nbttagcompound.getString("Key"), values); + } + return map; + } + + + public static List getStringList(NBTTagList tagList) { + List list = new ArrayList(); + for (int i = 0; i < tagList.tagCount(); i++) { + NBTTagCompound nbttagcompound = tagList.getCompoundTagAt(i); + String line = nbttagcompound.getString("Line"); + list.add(line); + } + return list; + } + + public static String[] getStringArray(NBTTagList tagList, int size) { + String[] arr = new String[size]; + for (int i = 0; i < tagList.tagCount(); i++) { + NBTTagCompound nbttagcompound = tagList.getCompoundTagAt(i); + String line = nbttagcompound.getString("Value"); + int slot = nbttagcompound.getInteger("Slot"); + arr[slot] = line; + } + return arr; + } + + public static NBTTagList nbtIntegerArraySet(List set) { + NBTTagList nbttaglist = new NBTTagList(); + if(set == null) + return nbttaglist; + for(int[] arr : set) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setIntArray("Array", arr); + nbttaglist.appendTag(nbttagcompound); + } + return nbttaglist; + } + + public static NBTTagList nbtItemStackList(HashMapinventory) { + NBTTagList nbttaglist = new NBTTagList(); + if(inventory == null) + return nbttaglist; + for(int slot : inventory.keySet()) + { + ItemStack item = inventory.get(slot); + if(item == null) + continue; + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setByte("Slot", (byte)slot); + + NoppesUtilServer.writeItem(item, nbttagcompound); + + nbttaglist.appendTag(nbttagcompound); + } + return nbttaglist; + } + + public static NBTTagList nbtItemStackArray(ItemStack[] inventory) { + NBTTagList nbttaglist = new NBTTagList(); + if(inventory == null) + return nbttaglist; + for(int slot = 0 ; slot < inventory.length; slot++) + { + ItemStack item = inventory[slot]; + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setByte("Slot", (byte)slot); + + if(item != null) + NoppesUtilServer.writeItem(item, nbttagcompound); + + nbttaglist.appendTag(nbttagcompound); + } + return nbttaglist; + } + + public static NBTTagList nbtBooleanList(HashMap updatedSlots) { + NBTTagList nbttaglist = new NBTTagList(); + if(updatedSlots == null) + return nbttaglist; + HashMap inventory2 = updatedSlots; + for(Integer slot : inventory2.keySet()) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setInteger("Slot", slot); + nbttagcompound.setBoolean("Boolean", inventory2.get(slot)); + + nbttaglist.appendTag(nbttagcompound); + } + return nbttaglist; + } + + public static NBTTagList nbtIntegerIntegerMap(HashMap lines) { + NBTTagList nbttaglist = new NBTTagList(); + if(lines == null) + return nbttaglist; + for (int slot : lines.keySet()) { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setInteger("Slot", slot); + nbttagcompound.setInteger("Integer", lines.get(slot)); + nbttaglist.appendTag(nbttagcompound); + } + return nbttaglist; + } + + public static NBTTagList nbtIntegerLongMap(HashMap lines) { + NBTTagList nbttaglist = new NBTTagList(); + if(lines == null) + return nbttaglist; + for (int slot : lines.keySet()) { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setInteger("Slot", slot); + nbttagcompound.setLong("Long", lines.get(slot)); + nbttaglist.appendTag(nbttagcompound); + } + return nbttaglist; + } + + public static NBTTagList nbtIntegerSet(HashSet set) { + NBTTagList nbttaglist = new NBTTagList(); + if(set == null) + return nbttaglist; + for (int slot : set) { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setInteger("Integer", slot); + nbttaglist.appendTag(nbttagcompound); + } + return nbttaglist; + } + + public static NBTTagList nbtVectorMap(HashMap> map) { + NBTTagList list = new NBTTagList(); + if(map == null) + return list; + for(String key : map.keySet()){ + NBTTagCompound compound = new NBTTagCompound(); + compound.setString("Key", key); + NBTTagList values = new NBTTagList(); + for(String value : map.get(key)){ + NBTTagCompound comp = new NBTTagCompound(); + comp.setString("Value", value); + values.appendTag(comp); + } + compound.setTag("Values", values); + list.appendTag(compound); + } + return list; + } + + public static NBTTagList nbtStringStringMap(HashMap map) { + NBTTagList nbttaglist = new NBTTagList(); + if(map == null) + return nbttaglist; + for(String slot : map.keySet()) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setString("Slot", slot); + nbttagcompound.setString("Value", map.get(slot)); + + nbttaglist.appendTag(nbttagcompound); + } + return nbttaglist; + } + + public static NBTTagList nbtStringIntegerMap(HashMap map) { + NBTTagList nbttaglist = new NBTTagList(); + if(map == null) + return nbttaglist; + for(String slot : map.keySet()) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setString("Slot", slot); + nbttagcompound.setInteger("Value", map.get(slot)); + + nbttaglist.appendTag(nbttagcompound); + } + return nbttaglist; + } + + public static NBTBase nbtIntegerStringMap(HashMap map) { + NBTTagList nbttaglist = new NBTTagList(); + if(map == null) + return nbttaglist; + for(int slot : map.keySet()) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setInteger("Slot", slot); + nbttagcompound.setString("Value", map.get(slot)); + + nbttaglist.appendTag(nbttagcompound); + } + return nbttaglist; + } + + public static NBTTagList nbtStringArray(String[] list) { + NBTTagList nbttaglist = new NBTTagList(); + if(list == null) + return nbttaglist; + for(int i = 0; i < list.length; i++){ + if(list[i] == null) + continue; + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setString("Value", list[i]); + nbttagcompound.setInteger("Slot", i); + nbttaglist.appendTag(nbttagcompound); + } + return nbttaglist; + } + + public static NBTTagList nbtStringList(List list) { + NBTTagList nbttaglist = new NBTTagList(); + for (String s : list) { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setString("Line", s); + nbttaglist.appendTag(nbttagcompound); + } + return nbttaglist; + } + + public static NBTTagList nbtDoubleList(double ... par1ArrayOfDouble){ + NBTTagList nbttaglist = new NBTTagList(); + double[] adouble = par1ArrayOfDouble; + int i = par1ArrayOfDouble.length; + + for (int j = 0; j < i; ++j) + { + double d1 = adouble[j]; + nbttaglist.appendTag(new NBTTagDouble(d1)); + } + + return nbttaglist; + } + + public static NBTTagCompound NBTMerge(NBTTagCompound data, NBTTagCompound merge) { + NBTTagCompound compound = (NBTTagCompound) data.copy(); + Set names = merge.func_150296_c(); + for(String name : names){ + NBTBase base = merge.getTag(name); + if(base.getId() == 10) + base = NBTMerge(compound.getCompoundTag(name), (NBTTagCompound) base); + compound.setTag(name, base); + } + return compound; + } + +} diff --git a/src/main/java/noppes/npcs/NPCSpawning.java b/src/main/java/noppes/npcs/NPCSpawning.java new file mode 100644 index 000000000..c1fb610d2 --- /dev/null +++ b/src/main/java/noppes/npcs/NPCSpawning.java @@ -0,0 +1,190 @@ +package noppes.npcs; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.Random; +import java.util.Set; + +import com.google.common.collect.Sets; + +import cpw.mods.fml.common.eventhandler.Event.Result; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityList; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EnumCreatureType; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.MathHelper; +import net.minecraft.world.ChunkCoordIntPair; +import net.minecraft.world.ChunkPosition; +import net.minecraft.world.World; +import net.minecraft.world.WorldServer; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.chunk.Chunk; +import net.minecraftforge.event.ForgeEventFactory; +import noppes.npcs.controllers.SpawnController; +import noppes.npcs.controllers.SpawnData; +import noppes.npcs.entity.EntityCustomNpc; +import noppes.npcs.entity.EntityNPCInterface; + +public class NPCSpawning { + private static Set eligibleChunksForSpawning = Sets.newHashSet(); + + public static void findChunksForSpawning(WorldServer world){ + if(SpawnController.instance.data.isEmpty() || world.getWorldInfo().getWorldTotalTime() % 400L != 0L) + return; + eligibleChunksForSpawning.clear(); + for (int i = 0; i < world.playerEntities.size(); ++i){ + EntityPlayer entityplayer = (EntityPlayer)world.playerEntities.get(i); + int j = MathHelper.floor_double(entityplayer.posX / 16.0D); + int k = MathHelper.floor_double(entityplayer.posZ / 16.0D); + byte size = 7; + + for (int x = -size; x <= size; ++x){ + for (int z = -size; z <= size; ++z){ + ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(x + j, z + k); + if (!eligibleChunksForSpawning.contains(chunkcoordintpair)){ + eligibleChunksForSpawning.add(chunkcoordintpair); + } + } + } + } + if (countNPCs(world) > eligibleChunksForSpawning.size()){ + return; + } + ArrayList tmp = new ArrayList(eligibleChunksForSpawning); + Collections.shuffle(tmp); + Iterator iterator = tmp.iterator(); + + while (iterator.hasNext()){ + ChunkCoordIntPair chunkcoordintpair1 = iterator.next(); + + ChunkPosition chunkposition = getChunk(world, chunkcoordintpair1.chunkXPos, chunkcoordintpair1.chunkZPos); + int j1 = chunkposition.chunkPosX; + int k1 = chunkposition.chunkPosY; + int l1 = chunkposition.chunkPosZ; + + for(int i = 0; i < 3; i++){ + int x = j1; + int y = k1; + int z = l1; + byte b1 = 6; + + x += world.rand.nextInt(b1) - world.rand.nextInt(b1); + y += world.rand.nextInt(1) - world.rand.nextInt(1); + z += world.rand.nextInt(b1) - world.rand.nextInt(b1); + + + + Block block = world.getBlock(x, y, z); + + String name = world.getBiomeGenForCoords(x, z).biomeName; + SpawnData data = SpawnController.instance.getRandomSpawnData(name, block.getMaterial() == Material.air); + if (data == null || !canCreatureTypeSpawnAtLocation(data, world, x, y, z) || world.getClosestPlayer(x, y, z, 24.0D) != null) + continue; + + spawnData(data, world, x, y, z); + } + } + } + + public static int countNPCs(World world){ + int count = 0; + List list = world.loadedEntityList; + for (Entity entity : list){ + if (entity instanceof EntityNPCInterface){ + count++; + } + } + return count; + } + + protected static ChunkPosition getChunk(World world, int x, int z){ + Chunk chunk = world.getChunkFromChunkCoords(x, z); + int k = x * 16 + world.rand.nextInt(16); + int l = z * 16 + world.rand.nextInt(16); + int i1 = world.rand.nextInt(chunk == null ? world.getActualHeight() : chunk.getTopFilledSegment() + 16 - 1); + return new ChunkPosition(k, i1, l); + } + + public static void performWorldGenSpawning(World world, int x, int z, Random rand){ + BiomeGenBase biome = world.getBiomeGenForCoords(x + 8, z + 8); + while (rand.nextFloat() < biome.getSpawningChance()){ + SpawnData data = SpawnController.instance.getRandomSpawnData(biome.biomeName, true); + if(data == null) + continue; + + int size = 16; + + int j1 = x + rand.nextInt(size); + int k1 = z + rand.nextInt(size); + int l1 = j1; + int i2 = k1; + + for (int k2 = 0; k2 < 4; ++k2){ + int l2 = world.getTopSolidOrLiquidBlock(j1, k1); + + if (!canCreatureTypeSpawnAtLocation(data, world, j1, l2, k1)){ + j1 += rand.nextInt(5) - rand.nextInt(5); + + for (k1 += rand.nextInt(5) - rand.nextInt(5); j1 < x || j1 >= x + size || k1 < z || k1 >= z + size; k1 = i2 + rand.nextInt(5) - rand.nextInt(5)) + { + j1 = l1 + rand.nextInt(5) - rand.nextInt(5); + } + } + else if(spawnData(data, world, j1, l2, k1)) + break; + + } + } + } + + private static boolean spawnData(SpawnData data, World world, int x, int y, int z){ + EntityLiving entityliving; + + try{ + Entity entity = EntityList.createEntityFromNBT(data.compound1, world); + if(entity == null || !(entity instanceof EntityLiving)) + return false; + entityliving = (EntityLiving) entity; + + if(entity instanceof EntityCustomNpc){ + EntityCustomNpc npc = (EntityCustomNpc) entity; + npc.stats.spawnCycle = 3; + npc.ai.returnToStart = false; + npc.ai.startPos = new int[]{x,y, z}; + } + entity.setLocationAndAngles(x + 0.5, y, z + 0.5, world.rand.nextFloat() * 360.0F, 0.0F); + } + catch (Exception exception){ + exception.printStackTrace(); + return false; + } + + Result canSpawn = ForgeEventFactory.canEntitySpawn(entityliving, world, x + 0.5f, y, z + 0.5f); + if (canSpawn == Result.DENY || (canSpawn == Result.DEFAULT && !entityliving.getCanSpawnHere())) + return false; + + world.spawnEntityInWorld(entityliving); + + return true; + } + + public static boolean canCreatureTypeSpawnAtLocation(SpawnData data, World world, int x, int y, int z){ + if (data.liquid){ + return world.getBlock(x, y, z).getMaterial().isLiquid() && world.getBlock(x, y - 1, z).getMaterial().isLiquid() && !world.getBlock(x, y + 1, z).isNormalCube(); + } + else if (!World.doesBlockHaveSolidTopSurface(world, x, y - 1, z)){ + return false; + } + else{ + Block block = world.getBlock(x, y - 1, z); + boolean spawnBlock = block.canCreatureSpawn(EnumCreatureType.creature, world, x, y - 1, z); + return spawnBlock && !world.getBlock(x, y, z).isNormalCube() && !world.getBlock(x, y, z).getMaterial().isLiquid() && !world.getBlock(x, y + 1, z).isNormalCube(); + } + } +} + diff --git a/src/main/java/noppes/npcs/NoppesStringUtils.java b/src/main/java/noppes/npcs/NoppesStringUtils.java new file mode 100644 index 000000000..91099f252 --- /dev/null +++ b/src/main/java/noppes/npcs/NoppesStringUtils.java @@ -0,0 +1,86 @@ +package noppes.npcs; + +import java.awt.Toolkit; +import java.awt.datatransfer.Clipboard; +import java.awt.datatransfer.ClipboardOwner; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.StringSelection; +import java.awt.datatransfer.Transferable; +import java.awt.datatransfer.UnsupportedFlavorException; +import java.io.IOException; +import java.util.Arrays; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.StatCollector; +import noppes.npcs.entity.EntityNPCInterface; + +public class NoppesStringUtils { + + final static int[] illegalChars = {34, 60, 62, 124, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 58, 42, 63, 92, 47}; + static { + Arrays.sort(illegalChars); + } + public static String cleanFileName(String badFileName) { + StringBuilder cleanName = new StringBuilder(); + for (int i = 0; i < badFileName.length(); i++) { + int c = (int)badFileName.charAt(i); + if (Arrays.binarySearch(illegalChars, c) < 0) { + cleanName.append((char)c); + } + } + return cleanName.toString(); + } + + public static String formatText(String text, Object... obs) { + for(Object ob : obs){ + if(ob instanceof EntityPlayer){ + String username = ((EntityPlayer)ob).getDisplayName(); + text = text.replace("{player}", username); + text = text.replace("@p", username); + } + else if(ob instanceof EntityNPCInterface) + text = text.replace("@npc", ((EntityNPCInterface)ob).getCommandSenderName()); + + } + text = text.replace("&", Character.toChars(167)[0] + ""); + return text; + } + + public static void setClipboardContents(String aString) { + StringSelection stringSelection = new StringSelection(aString); + Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); + clipboard.setContents(stringSelection, new ClipboardOwner() { + @Override + public void lostOwnership(Clipboard arg0, Transferable arg1) { + + } + }); + } + + public static String getClipboardContents() { + String result = ""; + Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); + Transferable contents = clipboard.getContents(null); + boolean hasTransferableText = contents != null && contents.isDataFlavorSupported(DataFlavor.stringFlavor); + if (hasTransferableText) { + try { + result = (String) contents.getTransferData(DataFlavor.stringFlavor); + } catch (UnsupportedFlavorException ex) { + System.err.println(ex); + ex.printStackTrace(); + } catch (IOException ex) { + System.err.println(ex); + ex.printStackTrace(); + } + } + return result; + } + + public static String translate(Object... arr) { + String s = ""; + for(Object str : arr){ + s += StatCollector.translateToLocal(str.toString()); + } + return s; + } +} diff --git a/src/main/java/noppes/npcs/NoppesUtilPlayer.java b/src/main/java/noppes/npcs/NoppesUtilPlayer.java new file mode 100644 index 000000000..984bd717e --- /dev/null +++ b/src/main/java/noppes/npcs/NoppesUtilPlayer.java @@ -0,0 +1,379 @@ +package noppes.npcs; + +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.ChatComponentText; +import net.minecraft.world.WorldServer; +import net.minecraftforge.oredict.OreDictionary; +import noppes.npcs.constants.EnumOptionType; +import noppes.npcs.constants.EnumPacketClient; +import noppes.npcs.constants.EnumPlayerPacket; +import noppes.npcs.constants.EnumRoleType; +import noppes.npcs.constants.EnumScriptType; +import noppes.npcs.containers.ContainerNPCBankInterface; +import noppes.npcs.containers.ContainerNPCFollower; +import noppes.npcs.containers.ContainerNPCFollowerHire; +import noppes.npcs.controllers.Bank; +import noppes.npcs.controllers.BankController; +import noppes.npcs.controllers.BankData; +import noppes.npcs.controllers.Dialog; +import noppes.npcs.controllers.DialogController; +import noppes.npcs.controllers.DialogOption; +import noppes.npcs.controllers.Line; +import noppes.npcs.controllers.PlayerBankData; +import noppes.npcs.controllers.PlayerDataController; +import noppes.npcs.controllers.PlayerQuestController; +import noppes.npcs.controllers.PlayerQuestData; +import noppes.npcs.controllers.PlayerTransportData; +import noppes.npcs.controllers.QuestData; +import noppes.npcs.controllers.TransportController; +import noppes.npcs.controllers.TransportLocation; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.RoleFollower; +import cpw.mods.fml.common.network.internal.FMLProxyPacket; + +public class NoppesUtilPlayer { + + public static void changeFollowerState(EntityPlayerMP player, EntityNPCInterface npc) { + if(npc.advanced.role != EnumRoleType.Follower) + return; + + RoleFollower role = (RoleFollower) npc.roleInterface; + EntityPlayer owner = role.owner; + if(owner == null || !owner.getCommandSenderName().equals(player.getCommandSenderName())) + return; + + role.isFollowing = !role.isFollowing; + } + public static void hireFollower(EntityPlayerMP player, EntityNPCInterface npc) { + if(npc.advanced.role != EnumRoleType.Follower) + return; + Container con = player.openContainer; + if(con == null || !(con instanceof ContainerNPCFollowerHire)) + return; + + ContainerNPCFollowerHire container = (ContainerNPCFollowerHire) con; + RoleFollower role = (RoleFollower) npc.roleInterface; + followerBuy(role, container.currencyMatrix, player, npc); + } + public static void extendFollower(EntityPlayerMP player, EntityNPCInterface npc) { + if(npc.advanced.role != EnumRoleType.Follower) + return; + Container con = player.openContainer; + if(con == null || !(con instanceof ContainerNPCFollower)) + return; + + ContainerNPCFollower container = (ContainerNPCFollower) con; + RoleFollower role = (RoleFollower) npc.roleInterface; + followerBuy(role, container.currencyMatrix, player, npc); + } + public static void transport(EntityPlayerMP player, EntityNPCInterface npc, String location){ + TransportLocation loc = TransportController.getInstance().getTransport(location); + PlayerTransportData playerdata = PlayerDataController.instance.getPlayerData(player).transportData; + + if(loc == null || !loc.isDefault() && !playerdata.transports.contains(loc.id)) + return; + + teleportPlayer(player, loc.posX, loc.posY, loc.posZ, loc.dimension); + } + + public static void teleportPlayer(EntityPlayerMP player, double posX, double posY, double posZ, int dimension){ + if(player.dimension != dimension){ + int dim = player.dimension; + MinecraftServer server = MinecraftServer.getServer(); + WorldServer wor = server.worldServerForDimension(dimension); + if(wor == null){ + player.addChatMessage(new ChatComponentText("Broken transporter. Dimenion does not exist")); + return; + } + player.setLocationAndAngles(posX, posY, posZ, player.rotationYaw, player.rotationPitch); + server.getConfigurationManager().transferPlayerToDimension(player, dimension, new CustomTeleporter(wor)); + player.playerNetServerHandler.setPlayerLocation(posX, posY, posZ, player.rotationYaw, player.rotationPitch); + + if(!wor.playerEntities.contains(player)) + wor.spawnEntityInWorld(player); + } + else{ + player.playerNetServerHandler.setPlayerLocation(posX, posY, posZ, player.rotationYaw, player.rotationPitch); + } + player.worldObj.updateEntityWithOptionalForce(player, false); + } + + private static void followerBuy(RoleFollower role,IInventory currencyInv,EntityPlayerMP player, EntityNPCInterface npc){ + ItemStack currency = currencyInv.getStackInSlot(0); + if(currency == null) + return; + HashMap cd = new HashMap(); + for(int i : role.inventory.items.keySet()){ + ItemStack is = role.inventory.items.get(i); + if(is == null || is.getItem() != currency.getItem() || is.getHasSubtypes() && is.getItemDamage() != currency.getItemDamage()) + continue; + int days = 1; + if(role.rates.containsKey(i)) + days = role.rates.get(i); + + cd.put(is,days); + } + if(cd.size() == 0) + return; + int stackSize = currency.stackSize; + int days = 0; + + int possibleDays = 0; + int possibleSize = stackSize; + while(true){ + for(ItemStack item : cd.keySet()){ + int rDays = cd.get(item); + int rValue = item.stackSize; + if(rValue > stackSize) + continue; + int newStackSize = stackSize % rValue; + int size = stackSize - newStackSize; + int posDays = (size / rValue) * rDays; + if(possibleDays <= posDays){ + possibleDays = posDays; + possibleSize = newStackSize; + } + } + if(stackSize == possibleSize) + break; + stackSize = possibleSize; + days += possibleDays; + possibleDays = 0; + } + if(days == 0) + return; + if(stackSize <= 0) + currencyInv.setInventorySlotContents(0, null); + else + currency = currency.splitStack(stackSize); + + npc.say(player, new Line(NoppesStringUtils.formatText(role.dialogHire.replace("{days}", days+""), player, npc))); + role.setOwner(player); + role.addDays(days); + } + + public static void bankUpgrade(EntityPlayerMP player, EntityNPCInterface npc) { + if(npc.advanced.role != EnumRoleType.Bank) + return; + Container con = player.openContainer; + if(con == null || !(con instanceof ContainerNPCBankInterface)) + return; + + ContainerNPCBankInterface container = (ContainerNPCBankInterface) con; + Bank bank = BankController.getInstance().getBank(container.bankid); + ItemStack item = bank.upgradeInventory.getStackInSlot(container.slot); + if(item == null) + return; + + int price = item.stackSize; + ItemStack currency = container.currencyMatrix.getStackInSlot(0); + if(currency == null || price > currency.stackSize) + return; + if(currency.stackSize - price == 0) + container.currencyMatrix.setInventorySlotContents(0, null); + else + currency = currency.splitStack(price); + player.closeContainer(); + PlayerBankData data = PlayerDataController.instance.getBankData(player,bank.id); + BankData bankData = data.getBank(bank.id); + bankData.upgradedSlots.put(container.slot, true); + + bankData.openBankGui(player, npc, bank.id, container.slot); + } + public static void bankUnlock(EntityPlayerMP player, EntityNPCInterface npc) { + if(npc.advanced.role != EnumRoleType.Bank) + return; + Container con = player.openContainer; + if(con == null || !(con instanceof ContainerNPCBankInterface)) + return; + ContainerNPCBankInterface container = (ContainerNPCBankInterface) con; + Bank bank = BankController.getInstance().getBank(container.bankid); + + ItemStack item = bank.currencyInventory.getStackInSlot(container.slot); + if(item == null) + return; + + int price = item.stackSize; + ItemStack currency = container.currencyMatrix.getStackInSlot(0); + if(currency == null || price > currency.stackSize) + return; + if(currency.stackSize - price == 0) + container.currencyMatrix.setInventorySlotContents(0, null); + else + currency = currency.splitStack(price); + player.closeContainer(); + PlayerBankData data = PlayerDataController.instance.getBankData(player,bank.id); + BankData bankData = data.getBank(bank.id); + if(bankData.unlockedSlots + 1 <= bank.maxSlots) + bankData.unlockedSlots++; + + bankData.openBankGui(player, npc, bank.id, container.slot); + } + public static void sendData(EnumPlayerPacket enu, Object... obs) { + ByteBuf buffer = Unpooled.buffer(); + try { + if(!Server.fillBuffer(buffer, enu, obs)) + return; + CustomNpcs.ChannelPlayer.sendToServer(new FMLProxyPacket(buffer,"CustomNPCsPlayer")); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public static void dialogSelected(int dialogId, int optionId, EntityPlayerMP player, EntityNPCInterface npc) { + Dialog dialog = DialogController.instance.dialogs.get(dialogId); + if(dialog == null) + return; + npc.script.callScript(EnumScriptType.DIALOG_OPTION, "player", player, "dialog", dialogId, "option", optionId + 1); + + if(!dialog.hasDialogs(player) && !dialog.hasOtherOptions()) + return; + DialogOption option = dialog.options.get(optionId); + if(option == null || option.optionType == EnumOptionType.DialogOption && (!option.isAvailable(player) || !option.hasDialog()) || option.optionType == EnumOptionType.Disabled || option.optionType == EnumOptionType.QuitOption) + return; + if(option.optionType == EnumOptionType.RoleOption){ + if(npc.roleInterface != null) + npc.roleInterface.interact(player); + else + Server.sendData(player, EnumPacketClient.GUI_CLOSE); + } + else if(option.optionType == EnumOptionType.DialogOption){ + NoppesUtilServer.openDialog(player, npc, option.getDialog()); + } + else if(option.optionType == EnumOptionType.CommandBlock){ + Server.sendData(player, EnumPacketClient.GUI_CLOSE); + NoppesUtilServer.runCommand(player, npc.getCommandSenderName(), option.command); + } + else + Server.sendData(player, EnumPacketClient.GUI_CLOSE); + } + public static void sendQuestLogData(EntityPlayerMP player) { + if(!PlayerQuestController.hasActiveQuests(player)){ + return; + } + QuestLogData data = new QuestLogData(); + data.setData(player); + Server.sendData(player, EnumPacketClient.GUI_DATA, data.writeNBT()); + } + public static void questCompletion(EntityPlayerMP player, int questId) { + PlayerQuestData playerdata = PlayerDataController.instance.getPlayerData(player).questData; + QuestData data = playerdata.activeQuests.get(questId); + if(data == null) + return; + + if(!data.quest.questInterface.isCompleted(player)) + return; + + + data.quest.questInterface.handleComplete(player); + if(data.quest.rewardExp > 0){ + player.worldObj.playSoundAtEntity(player, "random.orb", 0.1F, 0.5F * ((player.worldObj.rand.nextFloat() - player.worldObj.rand.nextFloat()) * 0.7F + 1.8F)); + + player.addExperience(data.quest.rewardExp); + } + data.quest.factionOptions.addPoints(player); + if(data.quest.mail.isValid()){ + PlayerDataController.instance.addPlayerMessage(player.getCommandSenderName(), data.quest.mail); + } + if(!data.quest.randomReward){ + for(ItemStack item : data.quest.rewardItems.items.values()){ + NoppesUtilServer.GivePlayerItem(player, player, item); + } + } + else{ + List list = new ArrayList(); + for(ItemStack item : data.quest.rewardItems.items.values()){ + if(item != null && item.getItem() != null) + list.add(item); + } + if(!list.isEmpty()){ + NoppesUtilServer.GivePlayerItem(player, player, list.get(player.getRNG().nextInt(list.size()))); + } + } + if(!data.quest.command.isEmpty()){ + NoppesUtilServer.runCommand(player, "QuestCompletion", data.quest.command); + } + PlayerQuestController.setQuestFinished(data.quest, player); + if(data.quest.hasNewQuest()) PlayerQuestController.addActiveQuest(data.quest.getNextQuest(), player); + } + + public static boolean compareItems(ItemStack item, ItemStack item2, boolean ignoreDamage, boolean ignoreNBT){ + if (item2 == null || item == null){ + return false; + } + boolean oreMatched = false; + OreDictionary.itemMatches(item, item2, false); + int[] ids = OreDictionary.getOreIDs(item); + if(ids.length > 0){ + for(int id : ids){ + boolean match1 = false, match2 = false; + for(ItemStack is : OreDictionary.getOres(id)){ + if(compareItemDetails(item, is, ignoreDamage, ignoreNBT)){ + match1 = true; + } + if(compareItemDetails(item2, is, ignoreDamage, ignoreNBT)){ + match2 = true; + } + } + if(match1 && match2) + return true; + } + } + return compareItemDetails(item, item2, ignoreDamage, ignoreNBT); + } + private static boolean compareItemDetails(ItemStack item, ItemStack item2, boolean ignoreDamage, boolean ignoreNBT){ + if (item.getItem() != item2.getItem() ){ + return false; + } + if (!ignoreDamage && item.getItemDamage() != -1 && item.getItemDamage() != item2.getItemDamage()){ + return false; + } + if(!ignoreNBT && item.stackTagCompound != null && (item2.stackTagCompound == null || !item.stackTagCompound.equals(item2.stackTagCompound))){ + return false; + } + if(!ignoreNBT && item2.stackTagCompound != null && item.stackTagCompound == null){ + return false; + } + return true; + } + public static boolean compareItems(EntityPlayer player, ItemStack item, boolean ignoreDamage, boolean ignoreNBT){ + int size = 0; + for(ItemStack is : player.inventory.mainInventory){ + if(is != null && compareItems(item, is, ignoreDamage, ignoreNBT)) + size += is.stackSize; + } + return size >= item.stackSize; + } + public static void consumeItem(EntityPlayer player, ItemStack item, boolean ignoreDamage, boolean ignoreNBT) { + if(item == null) + return; + int size = item.stackSize; + for(int i = 0; i < player.inventory.mainInventory.length; i++){ + ItemStack is = player.inventory.mainInventory[i]; + if(is == null || !compareItems(item, is, ignoreDamage, ignoreNBT)) + continue; + if(size >= is.stackSize){ + size -= is.stackSize; + player.inventory.mainInventory[i] = null; + } + else{ + player.inventory.mainInventory[i].splitStack(size); + break; + } + } + } + +} diff --git a/src/main/java/noppes/npcs/NoppesUtilServer.java b/src/main/java/noppes/npcs/NoppesUtilServer.java new file mode 100644 index 000000000..237f62357 --- /dev/null +++ b/src/main/java/noppes/npcs/NoppesUtilServer.java @@ -0,0 +1,661 @@ +package noppes.npcs; + +import io.netty.buffer.ByteBuf; + +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import java.io.File; +import java.io.IOException; +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.zip.GZIPOutputStream; + +import net.minecraft.command.server.CommandBlockLogic; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityList; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.server.MinecraftServer; +import net.minecraft.tileentity.MobSpawnerBaseLogic; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityCommandBlock; +import net.minecraft.tileentity.TileEntityMobSpawner; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; +import noppes.npcs.constants.EnumGuiType; +import noppes.npcs.constants.EnumPacketClient; +import noppes.npcs.constants.EnumPlayerData; +import noppes.npcs.constants.EnumRoleType; +import noppes.npcs.constants.EnumScriptType; +import noppes.npcs.containers.ContainerManageBanks; +import noppes.npcs.containers.ContainerManageRecipes; +import noppes.npcs.controllers.Bank; +import noppes.npcs.controllers.BankController; +import noppes.npcs.controllers.Dialog; +import noppes.npcs.controllers.DialogCategory; +import noppes.npcs.controllers.DialogController; +import noppes.npcs.controllers.DialogOption; +import noppes.npcs.controllers.Faction; +import noppes.npcs.controllers.FactionController; +import noppes.npcs.controllers.PlayerBankData; +import noppes.npcs.controllers.PlayerData; +import noppes.npcs.controllers.PlayerDataController; +import noppes.npcs.controllers.PlayerDialogData; +import noppes.npcs.controllers.PlayerFactionData; +import noppes.npcs.controllers.PlayerQuestController; +import noppes.npcs.controllers.PlayerQuestData; +import noppes.npcs.controllers.PlayerTransportData; +import noppes.npcs.controllers.Quest; +import noppes.npcs.controllers.QuestCategory; +import noppes.npcs.controllers.QuestController; +import noppes.npcs.controllers.RecipeCarpentry; +import noppes.npcs.controllers.RecipeController; +import noppes.npcs.controllers.ServerCloneController; +import noppes.npcs.controllers.TransportCategory; +import noppes.npcs.controllers.TransportController; +import noppes.npcs.controllers.TransportLocation; +import noppes.npcs.entity.EntityDialogNpc; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.RoleTransporter; +import noppes.npcs.scripted.ScriptEventDialog; + +public class NoppesUtilServer { + private static HashMap editingQuests = new HashMap(); + + public static void setEditingNpc(EntityPlayer player, EntityNPCInterface npc){ + PlayerData data = PlayerDataController.instance.getPlayerData(player); + data.editingNpc = npc; + if(npc != null) + Server.sendData((EntityPlayerMP)player, EnumPacketClient.EDIT_NPC, npc.getEntityId()); + } + public static EntityNPCInterface getEditingNpc(EntityPlayer player){ + PlayerData data = PlayerDataController.instance.getPlayerData(player); + return data.editingNpc; + } + + public static void setEditingQuest(EntityPlayer player, Quest quest) { + editingQuests.put(player.getCommandSenderName(), quest); + } + public static Quest getEditingQuest(EntityPlayer player){ + return editingQuests.get(player.getCommandSenderName()); + } + + public static void sendRoleData(EntityPlayer player, EntityNPCInterface npc){ + if(npc.advanced.role == EnumRoleType.None) + return; + NBTTagCompound comp = new NBTTagCompound(); + npc.roleInterface.writeToNBT(comp); + comp.setInteger("EntityId", npc.getEntityId()); + comp.setInteger("Role", npc.advanced.role.ordinal()); + Server.sendData((EntityPlayerMP)player, EnumPacketClient.ROLE, comp); + } + + public static void sendFactionDataAll(EntityPlayerMP player) { + Map map = new HashMap(); + for(Faction faction : FactionController.getInstance().factions.values()){ + map.put(faction.name, faction.id); + } + sendScrollData(player, map); + } + + public static void sendBankDataAll(EntityPlayerMP player) { + Map map = new HashMap(); + for(Bank bank : BankController.getInstance().banks.values()){ + map.put(bank.name, bank.id); + } + sendScrollData(player, map); + } + + public static NBTTagCompound writeItem(ItemStack item, NBTTagCompound nbt){ + String resourcelocation = Item.itemRegistry.getNameForObject(item.getItem()); + nbt.setString("id", resourcelocation == null ? "minecraft:air" : resourcelocation.toString()); + nbt.setByte("Count", (byte)item.stackSize); + nbt.setShort("Damage", (short)item.getItemDamage()); + + if (item.stackTagCompound != null){ + nbt.setTag("tag", item.stackTagCompound); + } + + return nbt; + } + + public static ItemStack readItem(NBTTagCompound nbt){ + Item item; + if (nbt.hasKey("id", 8)){ + item = getByNameOrId(nbt.getString("id")); + } + else{ + item = Item.getItemById(nbt.getShort("id")); + } + if(item == null) + return null; + ItemStack itemstack = new ItemStack(item); + + itemstack.stackSize = nbt.getByte("Count"); + itemstack.setItemDamage(nbt.getShort("Damage")); + + if (itemstack.getItemDamage() < 0){ + itemstack.setItemDamage(0); + } + + if (nbt.hasKey("tag", 10)){ + itemstack.stackTagCompound = nbt.getCompoundTag("tag"); + } + return itemstack; + } + + public static Item getByNameOrId(String id) + { + Item item = (Item)Item.itemRegistry.getObject(id); + + if (item == null) + { + try + { + return Item.getItemById(Integer.parseInt(id)); + } + catch (NumberFormatException numberformatexception) + { + ; + } + } + + return item; + } + + public static void openDialog(EntityPlayer player, EntityNPCInterface npc, Dialog dia){ + Dialog dialog = dia.copy(player); + if(npc instanceof EntityDialogNpc){ + dialog.hideNPC = true; + Server.sendData((EntityPlayerMP)player, EnumPacketClient.DIALOG_DUMMY, npc.getCommandSenderName(), dialog.writeToNBT(new NBTTagCompound())); + } + else + Server.sendData((EntityPlayerMP)player, EnumPacketClient.DIALOG, npc.getEntityId(), dialog.writeToNBT(new NBTTagCompound())); + dia.factionOptions.addPoints(player); + if(dialog.hasQuest()) + PlayerQuestController.addActiveQuest(dialog.getQuest(),player); + if(!dialog.command.isEmpty()){ + runCommand(player, npc.getCommandSenderName(), dialog.command); + } + if(dialog.mail.isValid()) + PlayerDataController.instance.addPlayerMessage(player.getCommandSenderName(), dialog.mail); + PlayerDialogData data = PlayerDataController.instance.getPlayerData(player).dialogData; + if(!data.dialogsRead.contains(dialog.id)) + data.dialogsRead.add(dialog.id); + setEditingNpc(player, npc); + npc.script.callScript(EnumScriptType.DIALOG, "event", new ScriptEventDialog(), "player", player, "dialog", dialog.id); + } + public static void runCommand(EntityPlayer player, String name, String command){ + runCommand(player, name, command, player); + } + + public static void runCommand(EntityLivingBase executer, String name, String command, EntityPlayer player){ + if(player != null) + command = command.replace("@dp", player.getCommandSenderName()); + command = command.replace("@npc", name); + TileEntityCommandBlock tile = new TileEntityCommandBlock(); + tile.setWorldObj(executer.worldObj); + tile.xCoord = MathHelper.floor_double(executer.posX); + tile.yCoord = MathHelper.floor_double(executer.posY); + tile.zCoord = MathHelper.floor_double(executer.posZ); + + CommandBlockLogic logic = tile.func_145993_a(); + logic.func_145752_a(command); + logic.func_145754_b("@"+name); + logic.func_145755_a(executer.worldObj); + } + + public static void consumeItemStack(int i, EntityPlayer player){ + ItemStack item = player.inventory.getCurrentItem(); + if(player.capabilities.isCreativeMode || item == null) + return; + + --item.stackSize; + if (item.stackSize <= 0) + player.destroyCurrentEquippedItem(); + } + + public static DataOutputStream getDataOutputStream(ByteArrayOutputStream stream) throws IOException{ + return new DataOutputStream(new GZIPOutputStream(stream)); + } + public static void sendOpenGui(EntityPlayer player, + EnumGuiType gui, EntityNPCInterface npc) { + sendOpenGui(player, gui, npc, 0, 0, 0); + } + public static void sendOpenGui(EntityPlayer player, + EnumGuiType gui, EntityNPCInterface npc, int i, int j, int k) { + if(!(player instanceof EntityPlayerMP)) + return; + + setEditingNpc(player, npc); + sendExtraData(player, npc,gui, i, j, k); + if(CustomNpcs.proxy.getServerGuiElement(gui.ordinal(), player, player.worldObj, i, j, k) != null){ + player.openGui(CustomNpcs.instance, gui.ordinal(), player.worldObj, i, j, k); + return; + } + else{ + Server.sendData((EntityPlayerMP)player, EnumPacketClient.GUI, gui.ordinal(), i, j, k); + } + ArrayList list = getScrollData(player, gui, npc); + if(list == null || list.isEmpty()) + return; + + Server.sendData((EntityPlayerMP)player, EnumPacketClient.SCROLL_LIST, list); + } + + + private static void sendExtraData(EntityPlayer player, EntityNPCInterface npc, EnumGuiType gui, int i, int j, int k) { + if(gui == EnumGuiType.PlayerFollower || gui == EnumGuiType.PlayerFollowerHire || gui == EnumGuiType.PlayerTrader || gui == EnumGuiType.PlayerTransporter){ + sendRoleData(player, npc); + } + } + + private static ArrayList getScrollData(EntityPlayer player, EnumGuiType gui, EntityNPCInterface npc) { + if(gui == EnumGuiType.PlayerTransporter){ + RoleTransporter role = (RoleTransporter) npc.roleInterface; + ArrayList list = new ArrayList(); + TransportLocation location = role.getLocation(); + String name = role.getLocation().name; + for(TransportLocation loc: location.category.getDefaultLocations()){ + if(!list.contains(loc.name)){ + list.add(loc.name); + } + } + PlayerTransportData playerdata = PlayerDataController.instance.getPlayerData(player).transportData; + for(int i : playerdata.transports){ + TransportLocation loc = TransportController.getInstance().getTransport(i); + if(loc != null && location.category.locations.containsKey(loc.id)){ + if(!list.contains(loc.name)){ + list.add(loc.name); + } + } + } + list.remove(name); + return list; + } + return null; + } + public static void spawnParticle(Entity entity,String particle,int dimension){ + Server.sendAssociatedData(entity, EnumPacketClient.PARTICLE, entity.posX, entity.posY, entity.posZ, entity.height, entity.width, entity.yOffset, particle); + } + + + public static void deleteNpc(EntityNPCInterface npc,EntityPlayer player) { + Server.sendAssociatedData(npc, EnumPacketClient.DELETE_NPC, npc.getEntityId()); + } + + public static void createMobSpawner(int x, int y, int z, NBTTagCompound comp, EntityPlayer player) { + comp.removeTag("Pos"); + ServerCloneController.Instance.cleanTags(comp); + + if(comp.getString("id").equalsIgnoreCase("entityhorse")){ + player.addChatMessage(new ChatComponentTranslation("Currently you cant create horse spawner, its a minecraft bug")); + return; + } + + player.worldObj.setBlock(x, y, z, Blocks.mob_spawner); //setBlock + TileEntityMobSpawner tile = (TileEntityMobSpawner) player.worldObj.getTileEntity(x, y, z); + MobSpawnerBaseLogic logic = tile.func_145881_a(); + + logic.setRandomEntity(logic.new WeightedRandomMinecart(comp, comp.getString("id"))); + } + + public static void sendQuestCategoryData(EntityPlayerMP player) { + Map map = new HashMap(); + for(QuestCategory category : QuestController.instance.categories.values()){ + map.put(category.title, category.id); + } + sendScrollData(player, map); + } + + public static void sendPlayerData(EnumPlayerData type, EntityPlayerMP player, String name) throws IOException { + Map map = new HashMap(); + + if(type == EnumPlayerData.Players){ + File loc = PlayerDataController.instance.getSaveDir(); + for(String username : PlayerDataController.instance.getUsernameData().keySet()){ + map.put(username, 0); + } + } + else{ + PlayerData playerdata = PlayerDataController.instance.getDataFromUsername(name); + if(type == EnumPlayerData.Dialog){ + PlayerDialogData data = playerdata.dialogData; + + for(int questId : data.dialogsRead){ + Dialog dialog = DialogController.instance.dialogs.get(questId); + if(dialog == null) + continue; + map.put(dialog.category.title + ": " + dialog.title,questId); + } + } + else if(type == EnumPlayerData.Quest){ + PlayerQuestData data = playerdata.questData; + + for(int questId : data.activeQuests.keySet()){ + Quest quest = QuestController.instance.quests.get(questId); + if(quest == null) + continue; + map.put(quest.category.title + ": " + quest.title + "(Active quest)",questId); + } + for(int questId : data.finishedQuests.keySet()){ + Quest quest = QuestController.instance.quests.get(questId); + if(quest == null) + continue; + map.put(quest.category.title + ": " + quest.title + "(Finished quest)",questId); + } + } + else if(type == EnumPlayerData.Transport){ + PlayerTransportData data = playerdata.transportData; + + for(int questId : data.transports){ + TransportLocation location = TransportController.getInstance().getTransport(questId); + if(location == null) + continue; + map.put(location.category.title + ": " + location.name,questId); + } + } + else if(type == EnumPlayerData.Bank){ + PlayerBankData data = playerdata.bankData; + + for(int bankId : data.banks.keySet()){ + Bank bank = BankController.getInstance().banks.get(bankId); + if(bank == null) + continue; + map.put(bank.name,bankId); + } + } + else if(type == EnumPlayerData.Factions){ + PlayerFactionData data = playerdata.factionData; + for(int factionId : data.factionData.keySet()){ + Faction faction = FactionController.getInstance().factions.get(factionId); + if(faction == null) + continue; + map.put(faction.name + "(" + data.getFactionPoints(factionId) + ")" ,factionId); + } + } + } + + NoppesUtilServer.sendScrollData(player, map); + } + + public static void removePlayerData(ByteBuf buffer, EntityPlayerMP player) throws IOException { + int id = buffer.readInt(); + if(EnumPlayerData.values().length <= id) + return; + String name = Server.readString(buffer); + EnumPlayerData type = EnumPlayerData.values()[id]; + EntityPlayer pl = MinecraftServer.getServer().getConfigurationManager().func_152612_a(name); + PlayerData playerdata = null; + if(pl == null) + playerdata = PlayerDataController.instance.getDataFromUsername(name); + else + playerdata = PlayerDataController.instance.getPlayerData(pl); + + if(type == EnumPlayerData.Players){ + File file = new File(PlayerDataController.instance.getSaveDir(), playerdata.uuid + ".json"); + if(file.exists()) + file.delete(); + if(pl != null){ + playerdata.setNBT(new NBTTagCompound()); + sendPlayerData(type, player, name); + playerdata.saveNBTData(null); + return; + } + } + if(type == EnumPlayerData.Quest){ + PlayerQuestData data = playerdata.questData; + int questId = buffer.readInt(); + data.activeQuests.remove(questId); + data.finishedQuests.remove(questId); + playerdata.saveNBTData(null); + } + if(type == EnumPlayerData.Dialog){ + PlayerDialogData data = playerdata.dialogData; + data.dialogsRead.remove(buffer.readInt()); + playerdata.saveNBTData(null); + } + if(type == EnumPlayerData.Transport){ + PlayerTransportData data = playerdata.transportData; + data.transports.remove(buffer.readInt()); + playerdata.saveNBTData(null); + } + if(type == EnumPlayerData.Bank){ + PlayerBankData data = playerdata.bankData; + data.banks.remove(buffer.readInt()); + playerdata.saveNBTData(null); + } + if(type == EnumPlayerData.Factions){ + PlayerFactionData data = playerdata.factionData; + data.factionData.remove(buffer.readInt()); + playerdata.saveNBTData(null); + } + sendPlayerData(type, player, name); + } + + public static void sendRecipeData(EntityPlayerMP player, int size) { + HashMap map = new HashMap(); + if(size == 3){ + for(RecipeCarpentry recipe : RecipeController.instance.globalRecipes.values()){ + map.put(recipe.name, recipe.id); + } + } + else{ + for(RecipeCarpentry recipe : RecipeController.instance.anvilRecipes.values()){ + map.put(recipe.name, recipe.id); + } + } + sendScrollData(player, map); + } + public static void sendScrollData(EntityPlayerMP player, Map map){ + Map send = new HashMap(); + for(String key : map.keySet()){ + send.put(key, map.get(key)); + if(send.size() == 100){ + Server.sendData(player, EnumPacketClient.SCROLL_DATA_PART, send); + send = new HashMap(); + } + } + Server.sendData(player, EnumPacketClient.SCROLL_DATA, send); + } + + public static void sendDialogData(EntityPlayerMP player, DialogCategory category) { + if(category == null) + return; + HashMap map = new HashMap(); + for(Dialog dialog : category.dialogs.values()){ + map.put(dialog.title, dialog.id); + } + sendScrollData(player, map); + } + + public static void sendQuestData(EntityPlayerMP player, QuestCategory category) { + if(category == null) + return; + HashMap map = new HashMap(); + for(Quest quest : category.quests.values()){ + map.put(quest.title, quest.id); + } + sendScrollData(player, map); + } + + public static void sendTransportCategoryData(EntityPlayerMP player) { + HashMap map = new HashMap(); + for(TransportCategory category : TransportController.getInstance().categories.values()){ + map.put(category.title, category.id); + } + sendScrollData(player, map); + } + + public static void sendTransportData(EntityPlayerMP player, int categoryid) { + TransportCategory category = TransportController.getInstance().categories.get(categoryid); + if(category == null) + return; + HashMap map = new HashMap(); + for(TransportLocation transport : category.locations.values()){ + map.put(transport.name, transport.id); + } + sendScrollData(player, map); + } + + + public static void sendNpcDialogs(EntityPlayer player) { + EntityNPCInterface npc = getEditingNpc(player); + if(npc == null) + return; + for(int pos : npc.dialogs.keySet()){ + DialogOption option = npc.dialogs.get(pos); + if(option == null || !option.hasDialog()) + continue; + + NBTTagCompound compound = option.writeNBT(); + compound.setInteger("Position", pos); + Server.sendData((EntityPlayerMP)player, EnumPacketClient.GUI_DATA, compound); + + } + } + + public static DialogOption setNpcDialog(int slot, int dialogId, EntityPlayer player) throws IOException { + EntityNPCInterface npc = getEditingNpc(player); + if(npc == null) + return null; + if(!npc.dialogs.containsKey(slot)) + npc.dialogs.put(slot, new DialogOption()); + + DialogOption option = npc.dialogs.get(slot); + option.dialogId = dialogId; + if(option.hasDialog()) + option.title = option.getDialog().title; + + return option; + } + + public static void saveTileEntity(EntityPlayerMP 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); + if(tile != null) + tile.readFromNBT(compound); + + } + + public static void setRecipeGui(EntityPlayerMP player, RecipeCarpentry recipe){ + if(recipe == null) + return; + if(!(player.openContainer instanceof ContainerManageRecipes)) + return; + + ContainerManageRecipes container = (ContainerManageRecipes) player.openContainer; + container.setRecipe(recipe); + + Server.sendData(player, EnumPacketClient.GUI_DATA, recipe.writeNBT()); + } + + public static void sendBank(EntityPlayerMP player,Bank bank) { + NBTTagCompound compound = new NBTTagCompound(); + bank.writeEntityToNBT(compound); + Server.sendData(player, EnumPacketClient.GUI_DATA, compound); + + if(player.openContainer instanceof ContainerManageBanks){ + ((ContainerManageBanks)player.openContainer).setBank(bank); + } + player.sendContainerAndContentsToPlayer(player.openContainer, player.openContainer.getInventory()); + } + + public static void sendNearbyNpcs(EntityPlayerMP player) { + List npcs = player.worldObj.getEntitiesWithinAABB(EntityNPCInterface.class, player.boundingBox.expand(120, 120, 120)); + HashMap map = new HashMap(); + for(EntityNPCInterface npc : npcs){ + if(npc.isDead) + continue; + float distance = player.getDistanceToEntity(npc); + DecimalFormat df = new DecimalFormat("#.#"); + String s = df.format(distance); + if(distance < 10) + s = "0" + s; + map.put(s + " : " + npc.display.name, npc.getEntityId()); + } + + sendScrollData(player, map); + } + + public static void sendGuiError(EntityPlayer player, int i) { + Server.sendData((EntityPlayerMP)player, EnumPacketClient.GUI_ERROR, i, new NBTTagCompound()); + } + + public static void sendGuiClose(EntityPlayerMP player, int i, NBTTagCompound comp) { + if(player.openContainer != player.inventoryContainer){ + player.openContainer = player.inventoryContainer; + } + Server.sendData(player, EnumPacketClient.GUI_CLOSE, i, comp); + } + + public static Entity spawnClone(NBTTagCompound compound, int x, int y, + int z, World worldObj) { + ServerCloneController.Instance.cleanTags(compound); + compound.setTag("Pos", NBTTags.nbtDoubleList(x + 0.5, y + 1, z + 0.5)); + Entity entity = EntityList.createEntityFromNBT(compound, worldObj); + if(entity == null){ + return null; + } + if(entity instanceof EntityNPCInterface){ + EntityNPCInterface npc = (EntityNPCInterface) entity; + npc.ai.startPos = new int[]{MathHelper.floor_double(npc.posX),MathHelper.floor_double(npc.posY),MathHelper.floor_double(npc.posZ)}; + } + worldObj.spawnEntityInWorld(entity); + return entity; + } + public static boolean isOp(EntityPlayer player) { + return MinecraftServer.getServer().getConfigurationManager().func_152596_g(player.getGameProfile()); + } + + + public static void GivePlayerItem(Entity entity, EntityPlayer player, ItemStack item) { + if (entity.worldObj.isRemote || item == null) { + return; + } + item = item.copy(); + float f = 0.7F; + double d = (double) (entity.worldObj.rand.nextFloat() * f) + (double) (1.0F - f); + double d1 = (double) (entity.worldObj.rand.nextFloat() * f) + (double) (1.0F - f); + double d2 = (double) (entity.worldObj.rand.nextFloat() * f) + (double) (1.0F - f); + EntityItem entityitem = new EntityItem(entity.worldObj, entity.posX + d, entity.posY + d1, entity.posZ + d2, + item); + entityitem.delayBeforeCanPickup = 2; + entity.worldObj.spawnEntityInWorld(entityitem); + + int i = item.stackSize; + + if (player.inventory.addItemStackToInventory(item)) { + entity.worldObj.playSoundAtEntity(entityitem, "random.pop", 0.2F, + ((entity.worldObj.rand.nextFloat() - entity.worldObj.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); + player.onItemPickup(entityitem, i); + + if (item.stackSize <= 0) { + entityitem.setDead(); + } + } + } + public static EntityPlayer getPlayer(UUID id) { + List list = MinecraftServer.getServer().getConfigurationManager().playerEntityList; + for(EntityPlayer player : list){ + if(id.equals(player.getUniqueID())) + return player; + } + return null; + } +} diff --git a/src/main/java/noppes/npcs/NpcDamageSource.java b/src/main/java/noppes/npcs/NpcDamageSource.java new file mode 100644 index 000000000..6a69adcf9 --- /dev/null +++ b/src/main/java/noppes/npcs/NpcDamageSource.java @@ -0,0 +1,17 @@ +package noppes.npcs; + +import net.minecraft.entity.Entity; +import net.minecraft.util.EntityDamageSource; + +public class NpcDamageSource extends EntityDamageSource{ + + public NpcDamageSource(String par1Str, Entity par2Entity) { + super(par1Str, par2Entity); + } + + @Override + public boolean isDifficultyScaled() + { + return false; + } +} diff --git a/src/main/java/noppes/npcs/NpcDamageSourceInderect.java b/src/main/java/noppes/npcs/NpcDamageSourceInderect.java new file mode 100644 index 000000000..702d85d26 --- /dev/null +++ b/src/main/java/noppes/npcs/NpcDamageSourceInderect.java @@ -0,0 +1,17 @@ +package noppes.npcs; + +import net.minecraft.entity.Entity; +import net.minecraft.util.EntityDamageSourceIndirect; + +public class NpcDamageSourceInderect extends EntityDamageSourceIndirect{ + + public NpcDamageSourceInderect(String par1Str, Entity par2Entity, Entity par3Entity) { + super(par1Str, par2Entity, par3Entity); + } + + @Override + public boolean isDifficultyScaled() + { + return false; + } +} diff --git a/src/main/java/noppes/npcs/NpcMiscInventory.java b/src/main/java/noppes/npcs/NpcMiscInventory.java new file mode 100644 index 000000000..4636af202 --- /dev/null +++ b/src/main/java/noppes/npcs/NpcMiscInventory.java @@ -0,0 +1,174 @@ +package noppes.npcs; + +import java.util.HashMap; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +public class NpcMiscInventory implements IInventory { + public HashMap items = new HashMap(); + public int stackLimit = 64; + + private int size; + + public NpcMiscInventory(int size){ + this.size = size; + } + + public NBTTagCompound getToNBT(){ + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setTag("NpcMiscInv", NBTTags.nbtItemStackList(items)); + return nbttagcompound; + } + public void setFromNBT(NBTTagCompound nbttagcompound){ + items = NBTTags.getItemStackList(nbttagcompound.getTagList("NpcMiscInv", 10)); + } + @Override + public int getSizeInventory() { + return size; + } + + @Override + public ItemStack getStackInSlot(int var1) { + return items.get(var1); + } + + @Override + public ItemStack decrStackSize(int par1, int par2) { + if (items.get(par1) == null) + return null; + + ItemStack var4 = null; + if (items.get(par1).stackSize <= par2){ + var4 = items.get(par1); + items.put(par1,null); + } + else{ + var4 = items.get(par1).splitStack(par2); + + if (items.get(par1).stackSize == 0){ + items.put(par1,null); + } + } + + return var4; + } + + + public boolean decrStackSize(ItemStack eating, int decrease) { + for(int slot : items.keySet()){ + ItemStack item = items.get(slot); + if(items != null && eating == item && item.stackSize >= decrease){ + item.splitStack(decrease); + if(item.stackSize <= 0) + items.put(slot, null); + return true; + } + } + return false; + } + + @Override + public ItemStack getStackInSlotOnClosing(int var1) { + if (items.get(var1) != null) + { + ItemStack var3 = items.get(var1); + items.put(var1,null); + return var3; + } + return null; + } + + @Override + public void setInventorySlotContents(int var1, ItemStack var2) { + if(var1 >= getSizeInventory()) + return; + items.put(var1,var2); + } + + @Override + public int getInventoryStackLimit() { + return stackLimit; + } + + + @Override + public boolean isUseableByPlayer(EntityPlayer var1) { + return true; + } + + @Override + public boolean isItemValidForSlot(int i, ItemStack itemstack) { + return true; + } + + @Override + public String getInventoryName() { + return "Npc Misc Inventory"; + } + + @Override + public boolean hasCustomInventoryName() { + return true; + } + + @Override + public void markDirty() { + + } + @Override + public void openInventory() { + + } + @Override + public void closeInventory() { + + } + public boolean addItemStack(ItemStack item) { + ItemStack mergable; + boolean merged = false; + while((mergable = getMergableItem(item)) != null && mergable.stackSize > 0){ + int size = mergable.getMaxStackSize() - mergable.stackSize; + if(size > item.stackSize){ + mergable.stackSize = mergable.getMaxStackSize(); + item.stackSize -= size; + merged = true; + } + else{ + mergable.stackSize += item.stackSize; + item.stackSize = 0; + } + } + if(item.stackSize <= 0) + return true; + int slot = firstFreeSlot(); + if(slot >= 0){ + items.put(slot, item.copy()); + item.stackSize = 0; + return true; + } + return merged; + } + + public ItemStack getMergableItem(ItemStack item){ + for(ItemStack is : items.values()){ + if(NoppesUtilPlayer.compareItems(item, is, false, false) && is.stackSize < is.getMaxStackSize()){ + return is; + } + } + return null; + } + + public int firstFreeSlot(){ + for(int i = 0; i < getSizeInventory(); i++){ + if(items.get(i) == null) + return i; + } + return -1; + } + public void setSize(int i) { + size = i; + } +} diff --git a/src/main/java/noppes/npcs/PacketHandlerPlayer.java b/src/main/java/noppes/npcs/PacketHandlerPlayer.java new file mode 100644 index 000000000..63053e684 --- /dev/null +++ b/src/main/java/noppes/npcs/PacketHandlerPlayer.java @@ -0,0 +1,255 @@ +package noppes.npcs; + +import io.netty.buffer.ByteBuf; + +import java.io.IOException; +import java.util.Iterator; + +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.init.Items; +import net.minecraft.item.ItemEditableBook; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemWritableBook; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagString; +import net.minecraft.network.NetHandlerPlayServer; +import net.minecraft.tileentity.TileEntity; +import noppes.npcs.blocks.tiles.TileBigSign; +import noppes.npcs.blocks.tiles.TileBook; +import noppes.npcs.constants.EnumCompanionTalent; +import noppes.npcs.constants.EnumGuiType; +import noppes.npcs.constants.EnumPacketClient; +import noppes.npcs.constants.EnumPlayerPacket; +import noppes.npcs.constants.EnumRoleType; +import noppes.npcs.containers.ContainerMail; +import noppes.npcs.controllers.BankData; +import noppes.npcs.controllers.PlayerDataController; +import noppes.npcs.controllers.PlayerFactionData; +import noppes.npcs.controllers.PlayerMail; +import noppes.npcs.controllers.PlayerMailData; +import noppes.npcs.controllers.PlayerQuestController; +import noppes.npcs.controllers.PlayerQuestData; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.RoleCompanion; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.network.FMLNetworkEvent.ServerCustomPacketEvent; + +public class PacketHandlerPlayer{ + + @SubscribeEvent + public void onServerPacket(ServerCustomPacketEvent event) { + EntityPlayerMP player = ((NetHandlerPlayServer)event.handler).playerEntity; + ByteBuf buffer = event.packet.payload(); + try { + player(buffer, player, EnumPlayerPacket.values()[buffer.readInt()]); + } catch (IOException e) { + LogWriter.except(e); + } + } + + private void player(ByteBuf buffer, EntityPlayerMP player, EnumPlayerPacket type) throws IOException { + if(type == EnumPlayerPacket.CompanionTalentExp){ + EntityNPCInterface npc = NoppesUtilServer.getEditingNpc(player); + if(npc == null || npc.advanced.role != EnumRoleType.Companion || player != npc.getOwner()) + return; + int id = buffer.readInt(); + int exp = buffer.readInt(); + RoleCompanion role = (RoleCompanion) npc.roleInterface; + if(exp <= 0 || !role.canAddExp(-exp) || id < 0 || id >= EnumCompanionTalent.values().length) //should never happen unless hacking + return; + EnumCompanionTalent talent = EnumCompanionTalent.values()[id]; + role.addExp(-exp); + role.addTalentExp(talent, exp); + } + else if(type == EnumPlayerPacket.CompanionOpenInv){ + EntityNPCInterface npc = NoppesUtilServer.getEditingNpc(player); + if(npc == null || npc.advanced.role != EnumRoleType.Companion || player != npc.getOwner()) + return; + NoppesUtilServer.sendOpenGui(player, EnumGuiType.CompanionInv, npc); + } + else if(type == EnumPlayerPacket.FollowerHire){ + EntityNPCInterface npc = NoppesUtilServer.getEditingNpc(player); + if(npc == null || npc.advanced.role != EnumRoleType.Follower) + return; + NoppesUtilPlayer.hireFollower(player,npc); + } + else if(type == EnumPlayerPacket.FollowerExtend){ + EntityNPCInterface npc = NoppesUtilServer.getEditingNpc(player); + if(npc == null || npc.advanced.role != EnumRoleType.Follower) + return; + NoppesUtilPlayer.extendFollower(player,npc); + Server.sendData(player, EnumPacketClient.GUI_DATA, npc.roleInterface.writeToNBT(new NBTTagCompound())); + } + else if(type == EnumPlayerPacket.FollowerState){ + EntityNPCInterface npc = NoppesUtilServer.getEditingNpc(player); + if(npc == null || npc.advanced.role != EnumRoleType.Follower) + return; + NoppesUtilPlayer.changeFollowerState(player,npc); + Server.sendData(player, EnumPacketClient.GUI_DATA, npc.roleInterface.writeToNBT(new NBTTagCompound())); + } + else if(type == EnumPlayerPacket.RoleGet){ + EntityNPCInterface npc = NoppesUtilServer.getEditingNpc(player); + if(npc == null || npc.advanced.role == EnumRoleType.None) + return; + Server.sendData(player, EnumPacketClient.GUI_DATA, npc.roleInterface.writeToNBT(new NBTTagCompound())); + } + else if(type == EnumPlayerPacket.Transport){ + EntityNPCInterface npc = NoppesUtilServer.getEditingNpc(player); + if(npc == null || npc.advanced.role != EnumRoleType.Transporter) + return; + NoppesUtilPlayer.transport(player, npc, Server.readString(buffer)); + } + else if(type == EnumPlayerPacket.BankUpgrade){ + EntityNPCInterface npc = NoppesUtilServer.getEditingNpc(player); + if(npc == null || npc.advanced.role != EnumRoleType.Bank) + return; + NoppesUtilPlayer.bankUpgrade(player, npc); + } + else if(type == EnumPlayerPacket.BankUnlock){ + EntityNPCInterface npc = NoppesUtilServer.getEditingNpc(player); + if(npc == null || npc.advanced.role != EnumRoleType.Bank) + return; + NoppesUtilPlayer.bankUnlock(player, npc); + } + else if(type == EnumPlayerPacket.BankSlotOpen){ + EntityNPCInterface npc = NoppesUtilServer.getEditingNpc(player); + if(npc == null || npc.advanced.role != EnumRoleType.Bank) + return; + int slot = buffer.readInt(); + int bankId = buffer.readInt(); + BankData data = PlayerDataController.instance.getBankData(player,bankId).getBankOrDefault(bankId); + data.openBankGui(player, npc, bankId, slot); + } + else if(type == EnumPlayerPacket.Dialog){ + EntityNPCInterface npc = NoppesUtilServer.getEditingNpc(player); + if(npc == null) + return; + NoppesUtilPlayer.dialogSelected(buffer.readInt(),buffer.readInt(),player,npc); + } + else if(type == EnumPlayerPacket.CheckQuestCompletion){ + PlayerQuestData playerdata = PlayerDataController.instance.getPlayerData(player).questData; + playerdata.checkQuestCompletion(player,null); + } + else if(type == EnumPlayerPacket.QuestLog){ + NoppesUtilPlayer.sendQuestLogData(player); + } + else if(type == EnumPlayerPacket.QuestCompletion){ + NoppesUtilPlayer.questCompletion(player,buffer.readInt()); + } + else if(type == EnumPlayerPacket.FactionsGet){ + PlayerFactionData data = PlayerDataController.instance.getPlayerData(player).factionData; + Server.sendData(player, EnumPacketClient.GUI_DATA, data.getPlayerGuiData()); + } + else if(type == EnumPlayerPacket.MailGet){ + PlayerMailData data = PlayerDataController.instance.getPlayerData(player).mailData; + Server.sendData(player, EnumPacketClient.GUI_DATA, data.saveNBTData(new NBTTagCompound())); + } + else if(type == EnumPlayerPacket.MailDelete){ + long time = buffer.readLong(); + String username = Server.readString(buffer); + PlayerMailData data = PlayerDataController.instance.getPlayerData(player).mailData; + + Iterator it = data.playermail.iterator(); + while(it.hasNext()){ + PlayerMail mail = it.next(); + if(mail.time == time && mail.sender.equals(username)){ + it.remove(); + } + } + Server.sendData(player, EnumPacketClient.GUI_DATA, data.saveNBTData(new NBTTagCompound())); + } + else if(type == EnumPlayerPacket.MailSend){ + if(!(player.openContainer instanceof ContainerMail)) + return; + String username = PlayerDataController.instance.hasPlayer(Server.readString(buffer)); + if(username.isEmpty()){ + NoppesUtilServer.sendGuiError(player, 0); + return; + } + + PlayerMail mail = new PlayerMail(); + //String s = player.func_145748_c_().getFormattedText(); + String s = player.getDisplayName(); + if(!s.equals(player.getCommandSenderName())) + s += "(" + player.getCommandSenderName() + ")"; + mail.readNBT(Server.readNBT(buffer)); + mail.sender = s; + mail.items = ((ContainerMail)player.openContainer).mail.items; + + if(mail.subject.isEmpty()){ + NoppesUtilServer.sendGuiError(player, 1); + return; + } + PlayerDataController.instance.addPlayerMessage(username, mail); + + NBTTagCompound comp = new NBTTagCompound(); + comp.setString("username", username); + NoppesUtilServer.sendGuiClose(player, 1,comp); + } + else if(type == EnumPlayerPacket.MailboxOpenMail){ + long time = buffer.readLong(); + String username = Server.readString(buffer); + player.closeContainer(); + PlayerMailData data = PlayerDataController.instance.getPlayerData(player).mailData; + + Iterator it = data.playermail.iterator(); + while(it.hasNext()){ + PlayerMail mail = it.next(); + if(mail.time == time && mail.sender.equals(username)){ + ContainerMail.staticmail = mail; + player.openGui(CustomNpcs.instance, EnumGuiType.PlayerMailman.ordinal(), player.worldObj, 0, 0, 0); + break; + } + } + } + else if(type == EnumPlayerPacket.MailRead){ + long time = buffer.readLong(); + String username = Server.readString(buffer); + PlayerMailData data = PlayerDataController.instance.getPlayerData(player).mailData; + + Iterator it = data.playermail.iterator(); + while(it.hasNext()){ + PlayerMail mail = it.next(); + if(mail.time == time && mail.sender.equals(username)){ + mail.beenRead = true; + if(mail.hasQuest()) + PlayerQuestController.addActiveQuest(mail.getQuest(), player); + } + } + } + else if(type == EnumPlayerPacket.SignSave){ + int x = buffer.readInt(), y = buffer.readInt(), z = buffer.readInt(); + TileEntity tile = player.worldObj.getTileEntity(x, y, z); + if(tile == null || !(tile instanceof TileBigSign)) + return; + TileBigSign sign = (TileBigSign) tile; + if(sign.canEdit){ + sign.setText(Server.readString(buffer)); + sign.canEdit = false; + player.worldObj.markBlockForUpdate(x, y, z); + } + } + else if(type == EnumPlayerPacket.SaveBook){ + int x = buffer.readInt(), y = buffer.readInt(), z = buffer.readInt(); + TileEntity tileentity = player.worldObj.getTileEntity(x, y, z); + if(!(tileentity instanceof TileBook)) + return; + TileBook tile = (TileBook) tileentity; + if(tile.book.getItem() == Items.written_book) + return; + boolean sign = buffer.readBoolean(); + ItemStack book = ItemStack.loadItemStackFromNBT(Server.readNBT(buffer)); + if(book == null) + return; + if(book.getItem() == Items.writable_book && !sign && ItemWritableBook.func_150930_a(book.getTagCompound())){ + tile.book.setTagInfo("pages", book.getTagCompound().getTagList("pages", 8)); + } + if(book.getItem() == Items.written_book && sign && ItemEditableBook.validBookTagContents(book.getTagCompound())){ + tile.book.setTagInfo("author", new NBTTagString(player.getCommandSenderName())); + tile.book.setTagInfo("title", new NBTTagString(book.getTagCompound().getString("title"))); + tile.book.setTagInfo("pages", book.getTagCompound().getTagList("pages", 8)); + tile.book.func_150996_a(Items.written_book); + } + } + } +} diff --git a/src/main/java/noppes/npcs/PacketHandlerServer.java b/src/main/java/noppes/npcs/PacketHandlerServer.java new file mode 100644 index 000000000..490c567a7 --- /dev/null +++ b/src/main/java/noppes/npcs/PacketHandlerServer.java @@ -0,0 +1,788 @@ +package noppes.npcs; + +import foxz.utils.Market; +import io.netty.buffer.ByteBuf; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Set; + +import net.minecraft.client.Minecraft; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityList; +import net.minecraft.entity.passive.EntityVillager; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.nbt.NBTTagString; +import net.minecraft.network.NetHandlerPlayServer; +import net.minecraft.network.PacketBuffer; +import net.minecraft.server.MinecraftServer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.village.MerchantRecipeList; +import net.minecraft.world.WorldProvider; +import net.minecraft.world.WorldServer; +import net.minecraftforge.common.DimensionManager; +import noppes.npcs.constants.EnumCompanionStage; +import noppes.npcs.constants.EnumGuiType; +import noppes.npcs.constants.EnumJobType; +import noppes.npcs.constants.EnumPacketClient; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.constants.EnumPlayerData; +import noppes.npcs.constants.EnumRoleType; +import noppes.npcs.containers.ContainerMail; +import noppes.npcs.controllers.Bank; +import noppes.npcs.controllers.BankController; +import noppes.npcs.controllers.Dialog; +import noppes.npcs.controllers.DialogCategory; +import noppes.npcs.controllers.DialogController; +import noppes.npcs.controllers.DialogOption; +import noppes.npcs.controllers.Faction; +import noppes.npcs.controllers.FactionController; +import noppes.npcs.controllers.LinkedNpcController; +import noppes.npcs.controllers.LinkedNpcController.LinkedData; +import noppes.npcs.controllers.PlayerData; +import noppes.npcs.controllers.PlayerDataController; +import noppes.npcs.controllers.PlayerMail; +import noppes.npcs.controllers.Quest; +import noppes.npcs.controllers.QuestCategory; +import noppes.npcs.controllers.QuestController; +import noppes.npcs.controllers.RecipeCarpentry; +import noppes.npcs.controllers.RecipeController; +import noppes.npcs.controllers.ScriptController; +import noppes.npcs.controllers.ServerCloneController; +import noppes.npcs.controllers.SpawnController; +import noppes.npcs.controllers.SpawnData; +import noppes.npcs.controllers.TransportController; +import noppes.npcs.controllers.TransportLocation; +import noppes.npcs.entity.EntityCustomNpc; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.JobSpawner; +import noppes.npcs.roles.RoleCompanion; +import noppes.npcs.roles.RoleTrader; +import noppes.npcs.roles.RoleTransporter; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.network.FMLNetworkEvent.ServerCustomPacketEvent; + +public class PacketHandlerServer{ + + @SubscribeEvent + public void onServerPacket(ServerCustomPacketEvent event) { + EntityPlayerMP player = ((NetHandlerPlayServer)event.handler).playerEntity; + if(CustomNpcs.OpsOnly && !NoppesUtilServer.isOp(player)){ + warn(player, "tried to use custom npcs without being an op"); + return; + } + ByteBuf buffer = event.packet.payload(); + EnumPacketServer type = null; + try { + type = EnumPacketServer.values()[buffer.readInt()]; + + ItemStack item = player.inventory.getCurrentItem(); + + EntityNPCInterface npc = NoppesUtilServer.getEditingNpc(player); + if(type.needsNpc && npc == null){ + + } + else if(type.hasPermission() && !CustomNpcsPermissions.Instance.hasPermission(player, type.permission)){ + //player doesnt have permission todo this + } + else if(item == null ) + warn(player, "tried to use custom npcs without a tool in hand, probably a hacker"); + else if(item.getItem() == CustomItems.wand) + wandPackets(type, buffer, player, npc); + else if(item.getItem() == CustomItems.moving) + movingPackets(type, buffer, player, npc); + else if(item.getItem() == CustomItems.mount) + mountPackets(type, buffer, player); + else if(item.getItem() == CustomItems.cloner) + clonePackets(type, buffer, player); + else if(item.getItem() == CustomItems.teleporter) + featherPackets(type, buffer, player); + else if(item.getItem() == CustomItems.scripter) + scriptPackets(type, buffer, player, npc); + else if(item.getItem() == Item.getItemFromBlock(CustomItems.waypoint) || item.getItem() == Item.getItemFromBlock(CustomItems.border) || item.getItem() == Item.getItemFromBlock(CustomItems.redstoneBlock)) + blockPackets(type, buffer, player); + } catch (Exception e) { + LogWriter.error("Error with EnumPacketServer." + type, e); + } + } + + private void scriptPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player, EntityNPCInterface npc) throws Exception { + if(type == EnumPacketServer.ScriptDataSave){ + npc.script.readFromNBT(Server.readNBT(buffer)); + npc.updateAI = true; + npc.script.hasInited = false; + } + else if(type == EnumPacketServer.ScriptDataGet){ + NBTTagCompound compound = npc.script.writeToNBT(new NBTTagCompound()); + compound.setTag("Languages", ScriptController.Instance.nbtLanguages()); + Server.sendData(player, EnumPacketClient.GUI_DATA, compound); + } + } + + private void featherPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player) throws IOException { + if(type == EnumPacketServer.DimensionsGet){ + HashMap map = new HashMap(); + for(int id : DimensionManager.getStaticDimensionIDs()){ + WorldProvider provider = DimensionManager.createProviderFor(id); + map.put(provider.getDimensionName(), id); + } + NoppesUtilServer.sendScrollData(player, map); + } + else if(type == EnumPacketServer.DimensionTeleport){ + int dimension = buffer.readInt(); + WorldServer world = MinecraftServer.getServer().worldServerForDimension(dimension); + ChunkCoordinates coords = world.getEntrancePortalLocation(); + if(coords == null){ + coords = world.getSpawnPoint(); + if(!world.isAirBlock(coords.posX, coords.posY, coords.posZ)) + coords.posY = world.getTopSolidOrLiquidBlock(coords.posX, coords.posZ); + else{ + while(world.isAirBlock(coords.posX, coords.posY - 1, coords.posZ) && coords.posY > 0){ + coords.posY--; + } + if(coords.posY == 0) + coords.posY = world.getTopSolidOrLiquidBlock(coords.posX, coords.posZ); + } + } + NoppesUtilPlayer.teleportPlayer(player, coords.posX, coords.posY, coords.posZ, dimension); + } + } + + private void movingPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player, EntityNPCInterface npc) throws IOException { + if(type == EnumPacketServer.MovingPathGet){ + Server.sendData(player, EnumPacketClient.GUI_DATA, npc.ai.writeToNBT(new NBTTagCompound())); + } + else if(type == EnumPacketServer.MovingPathSave){ + npc.ai.setMovingPath(NBTTags.getIntegerArraySet(Server.readNBT(buffer).getTagList("MovingPathNew",10))); + } + } + + private void blockPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player) throws IOException { + if (type == EnumPacketServer.SaveTileEntity) { + NoppesUtilServer.saveTileEntity(player, Server.readNBT(buffer)); + } + else if(type == EnumPacketServer.GetTileEntity){ + TileEntity tile = player.worldObj.getTileEntity(buffer.readInt(), buffer.readInt(), buffer.readInt()); + NBTTagCompound compound = new NBTTagCompound(); + tile.writeToNBT(compound); + Server.sendData(player, EnumPacketClient.GUI_DATA, compound); + } + else if(type == EnumPacketServer.DialogCategoriesGet){ + NoppesUtilServer.sendScrollData(player, DialogController.instance.getScroll()); + } + else if(type == EnumPacketServer.DialogsGetFromDialog){ + Dialog dialog = DialogController.instance.dialogs.get(buffer.readInt()); + if(dialog == null) + return; + NoppesUtilServer.sendDialogData(player,dialog.category); + } + else if(type == EnumPacketServer.DialogsGet){ + NoppesUtilServer.sendDialogData(player,DialogController.instance.categories.get(buffer.readInt())); + } + else if(type == EnumPacketServer.QuestsGetFromQuest){ + Quest quest = QuestController.instance.quests.get(buffer.readInt()); + if(quest == null) + return; + NoppesUtilServer.sendQuestData(player,quest.category); + } + else if(type == EnumPacketServer.QuestCategoriesGet){ + NoppesUtilServer.sendQuestCategoryData(player); + } + else if(type == EnumPacketServer.QuestsGet){ + QuestCategory category = QuestController.instance.categories.get(buffer.readInt()); + NoppesUtilServer.sendQuestData(player,category); + } + else if(type == EnumPacketServer.FactionsGet){ + NoppesUtilServer.sendFactionDataAll(player); + } + else if(type == EnumPacketServer.DialogGet){ + Dialog dialog = DialogController.instance.dialogs.get(buffer.readInt()); + if(dialog != null){ + NBTTagCompound compound = dialog.writeToNBT(new NBTTagCompound()); + Quest quest = QuestController.instance.quests.get(dialog.quest); + if(quest != null) + compound.setString("DialogQuestName", quest.title); + Server.sendData(player, EnumPacketClient.GUI_DATA, compound); + } + } + else if(type == EnumPacketServer.QuestGet){ + Quest quest = QuestController.instance.quests.get(buffer.readInt()); + if(quest != null){ + NBTTagCompound compound = new NBTTagCompound(); + if(quest.hasNewQuest()) + compound.setString("NextQuestTitle", quest.getNextQuest().title); + Server.sendData(player, EnumPacketClient.GUI_DATA, quest.writeToNBT(compound)); + } + } + else if(type == EnumPacketServer.FactionGet){ + NBTTagCompound compound = new NBTTagCompound(); + Faction faction = FactionController.getInstance().getFaction(buffer.readInt()); + faction.writeNBT(compound); + Server.sendData(player, EnumPacketClient.GUI_DATA, compound); + } + } + + private void wandPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player, EntityNPCInterface npc) throws IOException{ + if(type == EnumPacketServer.Delete){ + npc.delete(); + NoppesUtilServer.deleteNpc(npc,player); + } + else if(type == EnumPacketServer.LinkedAdd){ + LinkedNpcController.Instance.addData(Server.readString(buffer)); + + List list = new ArrayList(); + for(LinkedData data : LinkedNpcController.Instance.list) + list.add(data.name); + Server.sendData((EntityPlayerMP)player, EnumPacketClient.SCROLL_LIST, list); + } + else if(type == EnumPacketServer.LinkedRemove){ + LinkedNpcController.Instance.removeData(Server.readString(buffer)); + + List list = new ArrayList(); + for(LinkedData data : LinkedNpcController.Instance.list) + list.add(data.name); + Server.sendData((EntityPlayerMP)player, EnumPacketClient.SCROLL_LIST, list); + } + else if(type == EnumPacketServer.LinkedGetAll){ + List list = new ArrayList(); + for(LinkedData data : LinkedNpcController.Instance.list) + list.add(data.name); + Server.sendData(player, EnumPacketClient.SCROLL_LIST, list); + if(npc != null) + Server.sendData(player, EnumPacketClient.SCROLL_SELECTED, npc.linkedName); + } + else if(type == EnumPacketServer.LinkedSet){ + npc.linkedName = Server.readString(buffer); + LinkedNpcController.Instance.loadNpcData(npc); + } + else if(type == EnumPacketServer.NpcMenuClose){ + npc.reset(); + if(npc.linkedData != null) + LinkedNpcController.Instance.saveNpcData(npc); + NoppesUtilServer.setEditingNpc(player, null); + } + else if(type == EnumPacketServer.BanksGet){ + NoppesUtilServer.sendBankDataAll(player); + } + else if(type == EnumPacketServer.BankGet){ + Bank bank = BankController.getInstance().getBank(buffer.readInt()); + NoppesUtilServer.sendBank(player,bank); + } + else if(type == EnumPacketServer.BankSave){ + Bank bank = new Bank(); + bank.readEntityFromNBT(Server.readNBT(buffer)); + BankController.getInstance().saveBank(bank); + NoppesUtilServer.sendBankDataAll(player); + NoppesUtilServer.sendBank(player,bank); + } + else if(type == EnumPacketServer.BankRemove){ + BankController.getInstance().removeBank(buffer.readInt()); + NoppesUtilServer.sendBankDataAll(player); + NoppesUtilServer.sendBank(player,new Bank()); + } + else if(type == EnumPacketServer.RemoteMainMenu){ + Entity entity = player.worldObj.getEntityByID(buffer.readInt()); + if(entity == null || !(entity instanceof EntityNPCInterface)) + return; + NoppesUtilServer.sendOpenGui(player, EnumGuiType.MainMenuDisplay, (EntityNPCInterface) entity); + } + else if(type == EnumPacketServer.RemoteDelete){ + Entity entity = player.worldObj.getEntityByID(buffer.readInt()); + if(entity == null || !(entity instanceof EntityNPCInterface)) + return; + npc = (EntityNPCInterface) entity; + npc.delete(); + NoppesUtilServer.deleteNpc(npc,player); + NoppesUtilServer.sendNearbyNpcs(player); + } + else if(type == EnumPacketServer.RemoteNpcsGet){ + NoppesUtilServer.sendNearbyNpcs(player); + Server.sendData(player, EnumPacketClient.SCROLL_SELECTED, CustomNpcs.FreezeNPCs?"Unfreeze Npcs":"Freeze Npcs"); + } + else if(type == EnumPacketServer.RemoteFreeze){ + CustomNpcs.FreezeNPCs = !CustomNpcs.FreezeNPCs; + Server.sendData(player, EnumPacketClient.SCROLL_SELECTED, CustomNpcs.FreezeNPCs?"Unfreeze Npcs":"Freeze Npcs"); + } + else if(type == EnumPacketServer.RemoteReset){ + Entity entity = player.worldObj.getEntityByID(buffer.readInt()); + if(entity == null || !(entity instanceof EntityNPCInterface)) + return; + npc = (EntityNPCInterface) entity; + npc.reset(); + } + else if(type == EnumPacketServer.RemoteTpToNpc){ + Entity entity = player.worldObj.getEntityByID(buffer.readInt()); + if(entity == null || !(entity instanceof EntityNPCInterface)) + return; + npc = (EntityNPCInterface) entity; + player.playerNetServerHandler.setPlayerLocation(npc.posX, npc.posY, npc.posZ, 0, 0); + } + else if(type == EnumPacketServer.Gui){ + EnumGuiType gui = EnumGuiType.values()[buffer.readInt()]; + int i = buffer.readInt(); + int j = buffer.readInt(); + int k = buffer.readInt(); + NoppesUtilServer.sendOpenGui(player, gui, npc, i, j, k); + } + else if(type == EnumPacketServer.RecipesGet){ + NoppesUtilServer.sendRecipeData(player,buffer.readInt()); + } + else if(type == EnumPacketServer.RecipeGet){ + RecipeCarpentry recipe = RecipeController.instance.getRecipe(buffer.readInt()); + NoppesUtilServer.setRecipeGui(player,recipe); + } + else if(type == EnumPacketServer.RecipeRemove){ + RecipeCarpentry recipe = RecipeController.instance.removeRecipe(buffer.readInt()); + NoppesUtilServer.sendRecipeData(player, recipe.isGlobal?3:4); + NoppesUtilServer.setRecipeGui(player,new RecipeCarpentry("")); + } + else if(type == EnumPacketServer.RecipeSave){ + RecipeCarpentry recipe = RecipeController.instance.saveRecipe(Server.readNBT(buffer)); + NoppesUtilServer.sendRecipeData(player, recipe.isGlobal?3:4); + NoppesUtilServer.setRecipeGui(player,recipe); + } + else if(type == EnumPacketServer.NaturalSpawnGetAll){ + NoppesUtilServer.sendScrollData(player, SpawnController.instance.getScroll()); + } + else if(type == EnumPacketServer.NaturalSpawnGet){ + SpawnData spawn = SpawnController.instance.getSpawnData(buffer.readInt()); + if(spawn != null){ + Server.sendData(player, EnumPacketClient.GUI_DATA, spawn.writeNBT(new NBTTagCompound())); + } + } + else if(type == EnumPacketServer.NaturalSpawnSave){ + SpawnData data = new SpawnData(); + data.readNBT(Server.readNBT(buffer)); + SpawnController.instance.saveSpawnData(data); + + NoppesUtilServer.sendScrollData(player, SpawnController.instance.getScroll()); + } + else if(type == EnumPacketServer.NaturalSpawnRemove){ + SpawnController.instance.removeSpawnData(buffer.readInt()); + NoppesUtilServer.sendScrollData(player, SpawnController.instance.getScroll()); + } + else if(type == EnumPacketServer.DialogCategorySave){ + DialogCategory category = new DialogCategory(); + category.readNBT(Server.readNBT(buffer)); + DialogController.instance.saveCategory(category); + NoppesUtilServer.sendScrollData(player, DialogController.instance.getScroll()); + } + else if(type == EnumPacketServer.DialogCategoryRemove){ + DialogController.instance.removeCategory(buffer.readInt()); + NoppesUtilServer.sendScrollData(player, DialogController.instance.getScroll()); + } + else if(type == EnumPacketServer.DialogCategoryGet){ + DialogCategory category = DialogController.instance.categories.get(buffer.readInt()); + if(category != null){ + NBTTagCompound comp = category.writeNBT(new NBTTagCompound()); + comp.removeTag("Dialogs"); + Server.sendData(player, EnumPacketClient.GUI_DATA, comp); + } + } + else if(type == EnumPacketServer.DialogSave){ + int category = buffer.readInt(); + Dialog dialog = new Dialog(); + dialog.readNBT(Server.readNBT(buffer)); + DialogController.instance.saveDialog(category,dialog); + if(dialog.category != null) + NoppesUtilServer.sendDialogData(player,dialog.category); + } + else if(type == EnumPacketServer.QuestOpenGui){ + Quest quest = new Quest(); + int gui = buffer.readInt(); + quest.readNBT(Server.readNBT(buffer)); + NoppesUtilServer.setEditingQuest(player,quest); + player.openGui(CustomNpcs.instance, gui , player.worldObj, 0, 0, 0); + } + else if(type == EnumPacketServer.DialogRemove){ + Dialog dialog = DialogController.instance.dialogs.get(buffer.readInt()); + if(dialog != null && dialog.category != null){ + DialogController.instance.removeDialog(dialog); + NoppesUtilServer.sendDialogData(player,dialog.category); + } + } + else if(type == EnumPacketServer.DialogNpcGet){ + NoppesUtilServer.sendNpcDialogs(player); + } + else if(type == EnumPacketServer.DialogNpcSet){ + int slot = buffer.readInt(); + int dialog = buffer.readInt(); + DialogOption option = NoppesUtilServer.setNpcDialog(slot,dialog,player); + if(option != null && option.hasDialog()){ + NBTTagCompound compound = option.writeNBT(); + compound.setInteger("Position", slot); + Server.sendData(player, EnumPacketClient.GUI_DATA, compound); + } + } + else if(type == EnumPacketServer.DialogNpcRemove){ + npc.dialogs.remove(buffer.readInt()); + } + else if(type == EnumPacketServer.QuestCategoryGet){ + QuestCategory category = QuestController.instance.categories.get(buffer.readInt()); + if(category != null){ + NBTTagCompound comp = category.writeNBT(new NBTTagCompound()); + comp.removeTag("Dialogs"); + Server.sendData(player, EnumPacketClient.GUI_DATA, comp); + } + } + else if(type == EnumPacketServer.QuestCategorySave){ + QuestCategory category = new QuestCategory(); + category.readNBT(Server.readNBT(buffer)); + QuestController.instance.saveCategory(category); + NoppesUtilServer.sendQuestCategoryData(player); + } + else if(type == EnumPacketServer.QuestCategoryRemove){ + QuestController.instance.removeCategory(buffer.readInt()); + NoppesUtilServer.sendQuestCategoryData(player); + } + else if(type == EnumPacketServer.QuestSave){ + int category = buffer.readInt(); + Quest quest = new Quest(); + quest.readNBT(Server.readNBT(buffer)); + QuestController.instance.saveQuest(category, quest); + if(quest.category != null) + NoppesUtilServer.sendQuestData(player,quest.category); + } + else if(type == EnumPacketServer.QuestDialogGetTitle){ + Dialog quest = DialogController.instance.dialogs.get(buffer.readInt()); + Dialog quest2 = DialogController.instance.dialogs.get(buffer.readInt()); + Dialog quest3 = DialogController.instance.dialogs.get(buffer.readInt()); + NBTTagCompound compound = new NBTTagCompound(); + if(quest != null) + compound.setString("1", quest.title); + if(quest2 != null) + compound.setString("2", quest2.title); + if(quest3 != null) + compound.setString("3", quest3.title); + Server.sendData(player, EnumPacketClient.GUI_DATA, compound); + } + else if(type == EnumPacketServer.QuestRemove){ + Quest quest = QuestController.instance.quests.get(buffer.readInt()); + if(quest != null){ + QuestController.instance.removeQuest(quest); + NoppesUtilServer.sendQuestData(player,quest.category); + } + } + else if(type == EnumPacketServer.TransportCategoriesGet){ + NoppesUtilServer.sendTransportCategoryData(player); + } + else if(type == EnumPacketServer.TransportCategorySave){ + TransportController.getInstance().saveCategory(Server.readString(buffer), buffer.readInt()); + } + else if(type == EnumPacketServer.TransportCategoryRemove){ + TransportController.getInstance().removeCategory(buffer.readInt()); + NoppesUtilServer.sendTransportCategoryData(player); + } + else if(type == EnumPacketServer.TransportRemove){ + int id = buffer.readInt(); + TransportLocation loc = TransportController.getInstance().removeLocation(id); + if(loc != null) + NoppesUtilServer.sendTransportData(player,loc.category.id); + } + else if(type == EnumPacketServer.TransportsGet){ + NoppesUtilServer.sendTransportData(player,buffer.readInt()); + } + else if(type == EnumPacketServer.TransportSave){ + int cat = buffer.readInt(); + TransportLocation location = TransportController.getInstance().saveLocation(cat,Server.readNBT(buffer),player, npc); + if(location != null){ + if(npc.advanced.role != EnumRoleType.Transporter) + return; + RoleTransporter role = (RoleTransporter) npc.roleInterface; + role.setTransport(location); + } + } + else if(type == EnumPacketServer.TransportGetLocation){ + if(npc.advanced.role != EnumRoleType.Transporter) + return; + RoleTransporter role = (RoleTransporter) npc.roleInterface; + if(role.hasTransport()){ + Server.sendData(player,EnumPacketClient.GUI_DATA,role.getLocation().writeNBT()); + Server.sendData(player, EnumPacketClient.SCROLL_SELECTED,role.getLocation().category.title); + } + } + else if(type == EnumPacketServer.FactionSet){ + npc.setFaction(buffer.readInt()); + } + else if(type == EnumPacketServer.FactionSave){ + Faction faction = new Faction(); + faction.readNBT(Server.readNBT(buffer)); + FactionController.getInstance().saveFaction(faction); + NoppesUtilServer.sendFactionDataAll(player); + NBTTagCompound compound = new NBTTagCompound(); + faction.writeNBT(compound); + Server.sendData(player, EnumPacketClient.GUI_DATA, compound); + } + else if(type == EnumPacketServer.FactionRemove){ + FactionController.getInstance().removeFaction(buffer.readInt()); + NoppesUtilServer.sendFactionDataAll(player); + NBTTagCompound compound = new NBTTagCompound(); + (new Faction()).writeNBT(compound); + Server.sendData(player, EnumPacketClient.GUI_DATA, compound); + } + else if(type == EnumPacketServer.PlayerDataGet){ + int id = buffer.readInt(); + if(EnumPlayerData.values().length <= id) + return; + String name = null; + EnumPlayerData datatype = EnumPlayerData.values()[id]; + if(datatype != EnumPlayerData.Players) + name = Server.readString(buffer); + NoppesUtilServer.sendPlayerData(datatype,player,name); + } + else if(type == EnumPacketServer.PlayerDataRemove){ + NoppesUtilServer.removePlayerData(buffer,player); + } + else if(type == EnumPacketServer.MainmenuDisplayGet){ + Server.sendData(player, EnumPacketClient.GUI_DATA, npc.display.writeToNBT(new NBTTagCompound())); + } + else if(type == EnumPacketServer.MainmenuDisplaySave){ + npc.display.readToNBT(Server.readNBT(buffer)); + npc.updateClient = true; + } + else if(type == EnumPacketServer.MainmenuStatsGet){ + Server.sendData(player, EnumPacketClient.GUI_DATA, npc.stats.writeToNBT(new NBTTagCompound())); + } + else if(type == EnumPacketServer.MainmenuStatsSave){ + npc.stats.readToNBT(Server.readNBT(buffer)); + npc.updateClient = true; + } + else if(type == EnumPacketServer.MainmenuInvGet){ + Server.sendData(player, EnumPacketClient.GUI_DATA, npc.inventory.writeEntityToNBT(new NBTTagCompound())); + } + else if(type == EnumPacketServer.MainmenuInvSave){ + npc.inventory.readEntityFromNBT(Server.readNBT(buffer)); + npc.updateAI = true; + npc.updateClient = true; + } + else if(type == EnumPacketServer.MainmenuAIGet){ + Server.sendData(player, EnumPacketClient.GUI_DATA, npc.ai.writeToNBT(new NBTTagCompound())); + } + else if(type == EnumPacketServer.MainmenuAISave){ + npc.ai.readToNBT(Server.readNBT(buffer)); + npc.setHealth(npc.getMaxHealth()); + npc.updateAI = true; + npc.updateClient = true; + } + else if(type == EnumPacketServer.MainmenuAdvancedGet){ + Server.sendData(player, EnumPacketClient.GUI_DATA, npc.advanced.writeToNBT(new NBTTagCompound())); + } + else if(type == EnumPacketServer.MainmenuAdvancedSave){ + npc.advanced.readToNBT(Server.readNBT(buffer)); + npc.updateAI = true; + npc.updateClient = true; + } + else if(type == EnumPacketServer.JobSave){ + NBTTagCompound original = npc.jobInterface.writeToNBT(new NBTTagCompound()); + NBTTagCompound compound = Server.readNBT(buffer); + Set names = compound.func_150296_c(); + for(String name : names) + original.setTag(name, compound.getTag(name)); + npc.jobInterface.readFromNBT(original); + npc.updateClient = true; + } + else if(type == EnumPacketServer.JobGet){ + if(npc.jobInterface == null) + return; + NBTTagCompound compound = new NBTTagCompound(); + compound.setBoolean("JobData", true); + npc.jobInterface.writeToNBT(compound); + + if(npc.advanced.job == EnumJobType.Spawner) + ((JobSpawner)npc.jobInterface).cleanCompound(compound); + + Server.sendData(player, EnumPacketClient.GUI_DATA, compound); + + if(npc.advanced.job == EnumJobType.Spawner) + Server.sendData(player, EnumPacketClient.GUI_DATA, ((JobSpawner)npc.jobInterface).getTitles()); + } + else if(type == EnumPacketServer.JobSpawnerAdd){ + if(npc.advanced.job != EnumJobType.Spawner) + return; + JobSpawner job = (JobSpawner) npc.jobInterface; + if(buffer.readBoolean()){ + NBTTagCompound compound = ServerCloneController.Instance.getCloneData(null, Server.readString(buffer), buffer.readInt()); + + job.setJobCompound(buffer.readInt(), compound); + } + else{ + job.setJobCompound(buffer.readInt(), Server.readNBT(buffer)); + } + Server.sendData(player, EnumPacketClient.GUI_DATA, job.getTitles()); + } + else if(type == EnumPacketServer.RoleCompanionUpdate){ + if(npc.advanced.role != EnumRoleType.Companion) + return; + ((RoleCompanion)npc.roleInterface).matureTo(EnumCompanionStage.values()[buffer.readInt()]); + npc.updateClient = true; + } + else if(type == EnumPacketServer.JobSpawnerRemove){ + if(npc.advanced.job != EnumJobType.Spawner) + return; + } + else if(type == EnumPacketServer.RoleSave){ + npc.roleInterface.readFromNBT(Server.readNBT(buffer)); + npc.updateClient = true; + } + else if(type == EnumPacketServer.RoleGet){ + if(npc.roleInterface == null) + return; + NBTTagCompound compound = new NBTTagCompound(); + compound.setBoolean("RoleData", true); + Server.sendData(player, EnumPacketClient.GUI_DATA, npc.roleInterface.writeToNBT(compound)); + } + else if(type == EnumPacketServer.MerchantUpdate){ + Entity entity = player.worldObj.getEntityByID(buffer.readInt()); + if(entity == null || !(entity instanceof EntityVillager)) + return; + MerchantRecipeList list = MerchantRecipeList.func_151390_b(new PacketBuffer(buffer)); + ((EntityVillager)entity).setRecipes(list); + } + else if(type == EnumPacketServer.ModelDataSave){ + if(npc instanceof EntityCustomNpc) + ((EntityCustomNpc)npc).modelData.readFromNBT(Server.readNBT(buffer)); + } + else if(type == EnumPacketServer.MailOpenSetup){ + PlayerMail mail = new PlayerMail(); + mail.readNBT(Server.readNBT(buffer)); + ContainerMail.staticmail = mail; + player.openGui(CustomNpcs.instance, EnumGuiType.PlayerMailman.ordinal(), player.worldObj, 1, 0, 0); + } + else if(type == EnumPacketServer.TransformSave){ + boolean isValid = npc.transform.isValid(); + npc.transform.readOptions(Server.readNBT(buffer)); + if(isValid != npc.transform.isValid()) + npc.updateAI = true; + } + else if(type == EnumPacketServer.TransformGet){ + Server.sendData(player, EnumPacketClient.GUI_DATA, npc.transform.writeOptions(new NBTTagCompound())); + } + else if(type == EnumPacketServer.TransformLoad){ + if(npc.transform.isValid()) + npc.transform.transform(buffer.readBoolean()); + } + else if(type == EnumPacketServer.TraderMarketSave){ + String market = Server.readString(buffer); + boolean bo = buffer.readBoolean(); + if(npc.roleInterface instanceof RoleTrader){ + if(bo) + Market.setMarket(npc, market); + else + Market.save((RoleTrader)npc.roleInterface, market); + //NoppesUtilServer.sendRoleData(player, npc); + } + } + else + blockPackets(type, buffer, player); + + } + private void mountPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player) throws IOException{ + if(type == EnumPacketServer.SpawnRider){ + Entity entity = EntityList.createEntityFromNBT(Server.readNBT(buffer), player.worldObj); + player.worldObj.spawnEntityInWorld(entity); + entity.mountEntity(ServerEventsHandler.mounted); + } + else if(type == EnumPacketServer.PlayerRider){ + player.mountEntity(ServerEventsHandler.mounted); + } + else if(type == EnumPacketServer.CloneList){ + NBTTagList list = new NBTTagList(); + + for(String name : ServerCloneController.Instance.getClones(buffer.readInt())) + list.appendTag(new NBTTagString(name)); + + NBTTagCompound compound = new NBTTagCompound(); + compound.setTag("List", list); + + Server.sendData(player, EnumPacketClient.GUI_DATA, compound); + } + else + warn(player,"tried todo something with the wrong tool, probably a hacker"); + } + + private void clonePackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player) throws IOException { + if(type == EnumPacketServer.SpawnMob){ + boolean server = buffer.readBoolean(); + int x = buffer.readInt(); + int y = buffer.readInt(); + int z = buffer.readInt(); + NBTTagCompound compound; + if(server) + compound = ServerCloneController.Instance.getCloneData(player, Server.readString(buffer), buffer.readInt()); + else + compound = Server.readNBT(buffer); + if(compound == null) + return; + Entity entity = NoppesUtilServer.spawnClone(compound, x, y, z, player.worldObj); + if(entity == null){ + player.addChatMessage(new ChatComponentText("Failed to create an entity out of your clone")); + return; + } + } + else if(type == EnumPacketServer.MobSpawner){ + boolean server = buffer.readBoolean(); + int x = buffer.readInt(); + int y = buffer.readInt(); + int z = buffer.readInt(); + NBTTagCompound compound; + if(server) + compound = ServerCloneController.Instance.getCloneData(player, Server.readString(buffer), buffer.readInt()); + else + compound = Server.readNBT(buffer); + if(compound != null) + NoppesUtilServer.createMobSpawner(x, y, z, compound, player); + } + else if(type == EnumPacketServer.ClonePreSave){ + boolean bo = ServerCloneController.Instance.getCloneData(null, Server.readString(buffer), buffer.readInt()) != null; + NBTTagCompound compound = new NBTTagCompound(); + compound.setBoolean("NameExists", bo); + Server.sendData(player, EnumPacketClient.GUI_DATA, compound); + } + else if(type == EnumPacketServer.CloneSave){ + PlayerData data = PlayerDataController.instance.getPlayerData(player); + if(data.cloned == null) + return; + ServerCloneController.Instance.addClone(data.cloned, Server.readString(buffer), buffer.readInt()); + } + else if(type == EnumPacketServer.CloneRemove){ + int tab = buffer.readInt(); + ServerCloneController.Instance.removeClone(Server.readString(buffer), tab); + + NBTTagList list = new NBTTagList(); + + for(String name : ServerCloneController.Instance.getClones(tab)) + list.appendTag(new NBTTagString(name)); + + NBTTagCompound compound = new NBTTagCompound(); + compound.setTag("List", list); + + Server.sendData(player, EnumPacketClient.GUI_DATA, compound); + } + else if(type == EnumPacketServer.CloneList){ + NBTTagList list = new NBTTagList(); + + for(String name : ServerCloneController.Instance.getClones(buffer.readInt())) + list.appendTag(new NBTTagString(name)); + + NBTTagCompound compound = new NBTTagCompound(); + compound.setTag("List", list); + + Server.sendData(player, EnumPacketClient.GUI_DATA, compound); + } + else + warn(player,"tried todo something with the wrong tool, probably a hacker"); + } + + private void warn(EntityPlayer player, String warning){ + MinecraftServer.getServer().logWarning(player.getCommandSenderName() + ": " + warning); + } +} diff --git a/src/main/java/noppes/npcs/QuestLogData.java b/src/main/java/noppes/npcs/QuestLogData.java new file mode 100644 index 000000000..19d59f88f --- /dev/null +++ b/src/main/java/noppes/npcs/QuestLogData.java @@ -0,0 +1,69 @@ +package noppes.npcs; + +import java.util.HashMap; +import java.util.Vector; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.constants.EnumQuestCompletion; +import noppes.npcs.controllers.PlayerQuestController; +import noppes.npcs.controllers.Quest; + +public class QuestLogData { + public HashMap> categories = new HashMap>(); + public String selectedQuest = ""; + public String selectedCategory = ""; + public HashMap questText = new HashMap(); + public HashMap> questStatus = new HashMap>(); + public HashMap finish = new HashMap(); + + public NBTTagCompound writeNBT(){ + NBTTagCompound compound = new NBTTagCompound(); + compound.setTag("Categories", NBTTags.nbtVectorMap(categories)); + compound.setTag("Logs", NBTTags.nbtStringStringMap(questText)); + compound.setTag("Status", NBTTags.nbtVectorMap(questStatus)); + compound.setTag("QuestFinisher", NBTTags.nbtStringStringMap(finish)); + return compound; + } + + public void readNBT(NBTTagCompound compound){ + categories = NBTTags.getVectorMap(compound.getTagList("Categories", 10)); + questText = NBTTags.getStringStringMap(compound.getTagList("Logs", 10)); + questStatus = NBTTags.getVectorMap(compound.getTagList("Status", 10)); + finish = NBTTags.getStringStringMap(compound.getTagList("QuestFinisher", 10)); + + } + public void setData(EntityPlayer player){ + + for(Quest quest : PlayerQuestController.getActiveQuests(player)) + { + String category = quest.category.title; + if(!categories.containsKey(category)) + categories.put(category, new Vector()); + Vector list = categories.get(category); + list.add(quest.title); + + questText.put(category + ":" + quest.title, quest.logText); + + questStatus.put(category + ":" + quest.title, quest.questInterface.getQuestLogStatus(player)); + if(quest.completion == EnumQuestCompletion.Npc && quest.questInterface.isCompleted(player)) + finish.put(category + ":" + quest.title, quest.completerNpc); + } + } + + public boolean hasSelectedQuest() { + return !selectedQuest.isEmpty(); + } + + public String getQuestText() { + return questText.get(selectedCategory + ":" + selectedQuest); + } + + public Vector getQuestStatus() { + return questStatus.get(selectedCategory + ":" + selectedQuest); + } + + public String getComplete() { + return finish.get(selectedCategory + ":" + selectedQuest); + } +} diff --git a/src/main/java/noppes/npcs/Resistances.java b/src/main/java/noppes/npcs/Resistances.java new file mode 100644 index 000000000..ff0cde972 --- /dev/null +++ b/src/main/java/noppes/npcs/Resistances.java @@ -0,0 +1,43 @@ +package noppes.npcs; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.DamageSource; + +public class Resistances { + + public float knockback = 1f; + public float arrow = 1f; + public float playermelee = 1f; + public float explosion = 1f; + + public NBTTagCompound writeToNBT() { + NBTTagCompound compound = new NBTTagCompound(); + compound.setFloat("Knockback", knockback); + compound.setFloat("Arrow", arrow); + compound.setFloat("Melee", playermelee); + compound.setFloat("Explosion", explosion); + return compound; + } + + public void readToNBT(NBTTagCompound compound) { + knockback = compound.getFloat("Knockback"); + arrow = compound.getFloat("Arrow"); + playermelee = compound.getFloat("Melee"); + explosion = compound.getFloat("Explosion"); + } + + public float applyResistance(DamageSource source, float damage) { + if(source.damageType.equals("arrow") || source.damageType.equals("thrown")){ + damage *= (2 - arrow); + } + else if(source.damageType.equals("player") || source.damageType.equals("mob")){ + damage *= (2 - playermelee); + } + else if(source.damageType.equals("explosion") || source.damageType.equals("explosion.player")){ + damage *= (2 - explosion); + } + + return damage; + } + +} diff --git a/src/main/java/noppes/npcs/Server.java b/src/main/java/noppes/npcs/Server.java new file mode 100644 index 000000000..900b1c968 --- /dev/null +++ b/src/main/java/noppes/npcs/Server.java @@ -0,0 +1,137 @@ +package noppes.npcs; + +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; + +import java.io.EOFException; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +import com.google.common.base.Charsets; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.nbt.CompressedStreamTools; +import net.minecraft.nbt.NBTSizeTracker; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.PacketBuffer; +import net.minecraft.village.MerchantRecipeList; +import noppes.npcs.constants.EnumPacketClient; +import cpw.mods.fml.common.network.ByteBufUtils; +import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; +import cpw.mods.fml.common.network.internal.FMLProxyPacket; + +public class Server { + + public static boolean sendData(EntityPlayerMP player, EnumPacketClient enu, Object... obs) { + ByteBuf buffer = Unpooled.buffer(); + try { + if(!fillBuffer(buffer, enu, obs)) + return false; + CustomNpcs.Channel.sendTo(new FMLProxyPacket(buffer, "CustomNPCs"), player); + } catch (IOException e) { + e.printStackTrace(); + } + return true; + } + + public static void sendAssociatedData(Entity entity, EnumPacketClient enu, Object... obs) { + ByteBuf buffer = Unpooled.buffer(); + try { + if(!fillBuffer(buffer, enu, obs)) + return; + TargetPoint point = new TargetPoint(entity.dimension, entity.posX, entity.posY, entity.posZ, 60); + CustomNpcs.Channel.sendToAllAround(new FMLProxyPacket(buffer,"CustomNPCs"), point); + } catch (IOException e) { + e.printStackTrace(); + } + } + public static void sendToAll(EnumPacketClient enu, Object... obs) { + ByteBuf buffer = Unpooled.buffer(); + try { + if(!fillBuffer(buffer, enu, obs)) + return; + CustomNpcs.Channel.sendToAll(new FMLProxyPacket(buffer,"CustomNPCs")); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public static boolean fillBuffer(ByteBuf buffer, Enum enu, Object... obs) throws IOException{ + buffer.writeInt(enu.ordinal()); + for(Object ob : obs){ + if(ob == null) + continue; + if(ob instanceof Map){ + Map map = (Map) ob; + + buffer.writeInt(map.size()); + for(String key : map.keySet()){ + int value = map.get(key); + buffer.writeInt(value); + writeString(buffer, key); + } + } + else if(ob instanceof MerchantRecipeList) + ((MerchantRecipeList)ob).func_151391_a(new PacketBuffer(buffer)); + else if(ob instanceof List){ + List list = (List) ob; + buffer.writeInt(list.size()); + for(String s : list) + writeString(buffer, s); + } + else if(ob instanceof Enum) + buffer.writeInt(((Enum) ob).ordinal()); + else if(ob instanceof Integer) + buffer.writeInt((Integer) ob); + else if(ob instanceof Boolean) + buffer.writeBoolean((Boolean) ob); + else if(ob instanceof String) + writeString(buffer, (String) ob); + else if(ob instanceof Float) + buffer.writeFloat((Float) ob); + else if(ob instanceof Long) + buffer.writeLong((Long) ob); + else if(ob instanceof Double) + buffer.writeDouble((Double) ob); + else if(ob instanceof NBTTagCompound) + writeNBT(buffer, (NBTTagCompound) ob); + } + if(buffer.array().length >= 32767){ + LogWriter.error("Packet " + enu + " was too big to be send"); + return false; + } + return true; + } + + public static void writeNBT(ByteBuf buffer, NBTTagCompound compound) throws IOException { + byte[] bytes = CompressedStreamTools.compress(compound); + buffer.writeShort((short)bytes.length); + buffer.writeBytes(bytes); + } + + public static NBTTagCompound readNBT(ByteBuf buffer) throws IOException { + byte[] bytes = new byte[buffer.readShort()]; + buffer.readBytes(bytes); + return CompressedStreamTools.func_152457_a(bytes, new NBTSizeTracker(2097152L)); + } + + public static void writeString(ByteBuf buffer, String s){ + byte[] bytes = s.getBytes(Charsets.UTF_8); + buffer.writeShort((short)bytes.length); + buffer.writeBytes(bytes); + } + + public static String readString(ByteBuf buffer){ + try{ + byte[] bytes = new byte[buffer.readShort()]; + buffer.readBytes(bytes); + return new String(bytes, Charsets.UTF_8); + } + catch(IndexOutOfBoundsException ex){ + return null; + } + } + +} diff --git a/src/main/java/noppes/npcs/ServerEventsHandler.java b/src/main/java/noppes/npcs/ServerEventsHandler.java new file mode 100644 index 000000000..dec8576dc --- /dev/null +++ b/src/main/java/noppes/npcs/ServerEventsHandler.java @@ -0,0 +1,357 @@ +package noppes.npcs; + +import java.util.HashMap; +import java.util.List; + +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityList; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.passive.EntityVillager; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.MathHelper; +import net.minecraft.util.StatCollector; +import net.minecraft.village.MerchantRecipeList; +import net.minecraftforge.event.entity.EntityJoinWorldEvent; +import net.minecraftforge.event.entity.living.LivingDeathEvent; +import net.minecraftforge.event.entity.living.LivingHurtEvent; +import net.minecraftforge.event.entity.player.EntityInteractEvent; +import net.minecraftforge.event.entity.player.EntityItemPickupEvent; +import net.minecraftforge.event.entity.player.PlayerInteractEvent; +import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action; +import net.minecraftforge.event.terraingen.PopulateChunkEvent; +import noppes.npcs.blocks.tiles.TileBanner; +import noppes.npcs.constants.EnumGuiType; +import noppes.npcs.constants.EnumPacketClient; +import noppes.npcs.constants.EnumQuestType; +import noppes.npcs.constants.EnumRoleType; +import noppes.npcs.constants.EnumScriptType; +import noppes.npcs.controllers.Line; +import noppes.npcs.controllers.PlayerData; +import noppes.npcs.controllers.PlayerDataController; +import noppes.npcs.controllers.PlayerQuestData; +import noppes.npcs.controllers.QuestData; +import noppes.npcs.controllers.RecipeCarpentry; +import noppes.npcs.controllers.RecipeController; +import noppes.npcs.controllers.ServerCloneController; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.items.ItemExcalibur; +import noppes.npcs.items.ItemShield; +import noppes.npcs.items.ItemSoulstoneEmpty; +import noppes.npcs.quests.QuestKill; +import noppes.npcs.roles.RoleFollower; + +public class ServerEventsHandler { + + public static EntityVillager Merchant; + public static Entity mounted; + +// private HashMap exps = new HashMap(); +// +// @SubscribeEvent +// public void onUpdate(LivingUpdateEvent event){ +// if(!(event.entityLiving instanceof EntityPlayer)) +// return; +// EntityPlayer player = (EntityPlayer) event.entityLiving; +// if(exps.containsKey(player.getCommandSenderName())){ +// int prevExp = exps.get(player.getCommandSenderName()); +// if(prevExp > player.experienceTotal){ +// player.addChatMessage(new ChatComponentText("Omg exp was gotten:" + (player.experienceTotal - prevExp))); +// } +// else if(prevExp < player.experienceTotal){ +// player.addChatMessage(new ChatComponentText("Omg exp was lost:" + (prevExp - player.experienceTotal))); +// } +// } +// exps.put(player.getCommandSenderName(), player.experienceTotal); +// } + + @SubscribeEvent + public void invoke(EntityInteractEvent event) { + ItemStack item = event.entityPlayer.getCurrentEquippedItem(); + if(item == null) + return; + boolean isRemote = event.entityPlayer.worldObj.isRemote; + boolean npcInteracted = event.target instanceof EntityNPCInterface; + + if(!isRemote && CustomNpcs.OpsOnly && !MinecraftServer.getServer().getConfigurationManager().func_152596_g(event.entityPlayer.getGameProfile())){ + return; + } + + if(!isRemote && item.getItem() == CustomItems.soulstoneEmpty && event.target instanceof EntityLivingBase) { + ((ItemSoulstoneEmpty)item.getItem()).store((EntityLivingBase)event.target, item, event.entityPlayer); + } + + if(item.getItem() == CustomItems.wand && npcInteracted && !isRemote){ + if (!CustomNpcsPermissions.Instance.hasPermission(event.entityPlayer, CustomNpcsPermissions.NPC_GUI)){ + return; + } + event.setCanceled(true); + NoppesUtilServer.sendOpenGui(event.entityPlayer, EnumGuiType.MainMenuDisplay, (EntityNPCInterface) event.target); + } + else if(item.getItem() == CustomItems.cloner && !isRemote && !(event.target instanceof EntityPlayer)){ + NBTTagCompound compound = new NBTTagCompound(); + if(!event.target.writeToNBTOptional(compound)) + return; + PlayerData data = PlayerDataController.instance.getPlayerData(event.entityPlayer); + ServerCloneController.Instance.cleanTags(compound); + if(!Server.sendData((EntityPlayerMP)event.entityPlayer, EnumPacketClient.CLONE, compound)) + event.entityPlayer.addChatMessage(new ChatComponentText("Entity too big to clone")); + data.cloned = compound; + event.setCanceled(true); + } + else if(item.getItem() == CustomItems.scripter && !isRemote && npcInteracted){ + if(!CustomNpcsPermissions.Instance.hasPermission(event.entityPlayer, CustomNpcsPermissions.NPC_GUI)) + return; + NoppesUtilServer.setEditingNpc(event.entityPlayer, (EntityNPCInterface)event.target); + event.setCanceled(true); + Server.sendData((EntityPlayerMP)event.entityPlayer, EnumPacketClient.GUI, EnumGuiType.Script.ordinal()); + } + else if(item.getItem() == CustomItems.mount){ + if(!CustomNpcsPermissions.Instance.hasPermission(event.entityPlayer, CustomNpcsPermissions.TOOL_MOUNTER)) + return; + event.setCanceled(true); + mounted = event.target; + if(isRemote) + CustomNpcs.proxy.openGui(MathHelper.floor_double(mounted.posX), MathHelper.floor_double(mounted.posY), MathHelper.floor_double(mounted.posZ), EnumGuiType.MobSpawnerMounter, event.entityPlayer); + } + else if(item.getItem() == CustomItems.wand && event.target instanceof EntityVillager){ + if(!CustomNpcsPermissions.Instance.hasPermission(event.entityPlayer, CustomNpcsPermissions.EDIT_VILLAGER)) + return; + event.setCanceled(true); + Merchant = (EntityVillager)event.target; + + if(!isRemote){ + EntityPlayerMP player = (EntityPlayerMP) event.entityPlayer; + player.openGui(CustomNpcs.instance, EnumGuiType.MerchantAdd.ordinal(), player.worldObj, 0, 0, 0); + MerchantRecipeList merchantrecipelist = Merchant.getRecipes(player); + + if (merchantrecipelist != null) + { + Server.sendData(player, EnumPacketClient.VILLAGER_LIST, merchantrecipelist); + } + } + } + + } + + @SubscribeEvent + public void invoke(LivingHurtEvent event) { + if(!(event.entityLiving instanceof EntityPlayer)) + return; + + EntityPlayer player = (EntityPlayer) event.entityLiving; + if(event.source.isUnblockable() || event.source.isFireDamage()) + return; + if(!player.isBlocking()) + return; + ItemStack item = player.getCurrentEquippedItem(); + if(item == null || !(item.getItem() instanceof ItemShield)) + return; + if(((ItemShield)item.getItem()).material.getDamageVsEntity() < player.getRNG().nextInt(9)) + return; + float damage = item.getItemDamage() + event.ammount; + + item.damageItem((int) event.ammount, player); + + if(damage > item.getMaxDamage()) + event.ammount = damage - item.getMaxDamage(); + else{ + event.ammount = 0; + event.setCanceled(true); + } + } + + @SubscribeEvent + public void invoke(PlayerInteractEvent event) { + EntityPlayer player = event.entityPlayer; + Block block = player.worldObj.getBlock(event.x, event.y, event.z); + if(event.action == Action.LEFT_CLICK_BLOCK && player.getHeldItem() != null && player.getHeldItem().getItem() == CustomItems.teleporter){ + event.setCanceled(true); + } + + if(block == Blocks.crafting_table && event.action == Action.RIGHT_CLICK_BLOCK && !player.worldObj.isRemote){ + RecipeController controller = RecipeController.instance; + NBTTagList list = new NBTTagList(); + int i = 0; + for(RecipeCarpentry recipe : controller.globalRecipes.values()){ + list.appendTag(recipe.writeNBT()); + i++; + if(i % 10 == 0){ + NBTTagCompound compound = new NBTTagCompound(); + compound.setTag("recipes", list); + Server.sendData((EntityPlayerMP)player, EnumPacketClient.SYNCRECIPES_ADD, compound); + list = new NBTTagList(); + } + } + + if(i % 10 != 0){ + NBTTagCompound compound = new NBTTagCompound(); + compound.setTag("recipes", list); + Server.sendData((EntityPlayerMP)player, EnumPacketClient.SYNCRECIPES_ADD, compound); + } + Server.sendData((EntityPlayerMP)player, EnumPacketClient.SYNCRECIPES_WORKBENCH); + } + if(block == CustomItems.carpentyBench && event.action == Action.RIGHT_CLICK_BLOCK && !player.worldObj.isRemote){ + RecipeController controller = RecipeController.instance; + NBTTagList list = new NBTTagList(); + int i = 0; + for(RecipeCarpentry recipe : controller.anvilRecipes.values()){ + list.appendTag(recipe.writeNBT()); + i++; + if(i % 10 == 0){ + NBTTagCompound compound = new NBTTagCompound(); + compound.setTag("recipes", list); + Server.sendData((EntityPlayerMP)player, EnumPacketClient.SYNCRECIPES_ADD, compound); + list = new NBTTagList(); + } + } + + if(i % 10 != 0){ + NBTTagCompound compound = new NBTTagCompound(); + compound.setTag("recipes", list); + Server.sendData((EntityPlayerMP)player, EnumPacketClient.SYNCRECIPES_ADD, compound); + } + Server.sendData((EntityPlayerMP)player, EnumPacketClient.SYNCRECIPES_CARPENTRYBENCH); + } + if((block == CustomItems.banner || block == CustomItems.wallBanner || block == CustomItems.sign) && event.action == Action.RIGHT_CLICK_BLOCK){ + ItemStack item = player.inventory.getCurrentItem(); + if(item == null || item.getItem() == null) + return; + int y = event.y; + int meta = player.worldObj.getBlockMetadata(event.x, event.y, event.z); + if(meta >= 7) + y--; + TileBanner tile = (TileBanner)player.worldObj.getTileEntity(event.x, y, event.z); + if(!tile.canEdit()){ + if(item.getItem() == CustomItems.wand && CustomNpcsPermissions.hasPermission(player, CustomNpcsPermissions.EDIT_BLOCKS)){ + tile.time = System.currentTimeMillis(); + if(player.worldObj.isRemote) + player.addChatComponentMessage(new ChatComponentTranslation("availability.editIcon")); + } + return; + } + + if(!player.worldObj.isRemote){ + tile.icon = item.copy(); + player.worldObj.markBlockForUpdate(event.x, y, event.z); + event.setCanceled(true); + } + + } + } + + @SubscribeEvent + public void invoke(LivingDeathEvent event) { + if(event.entityLiving.worldObj.isRemote) + return; + if(event.source.getEntity() != null){ + if(event.source.getEntity() instanceof EntityPlayer){ + doExcalibur((EntityPlayer) event.source.getEntity(),event.entityLiving); + } + + if(event.source.getEntity() instanceof EntityNPCInterface && event.entityLiving != null){ + EntityNPCInterface npc = (EntityNPCInterface) event.source.getEntity(); + Line line = npc.advanced.getKillLine(); + if(line != null) + npc.saySurrounding(line.formatTarget(event.entityLiving)); + + npc.script.callScript(EnumScriptType.KILLS, "target", event.entityLiving); + } + + EntityPlayer player = null; + if(event.source.getEntity() instanceof EntityPlayer) + player = (EntityPlayer) event.source.getEntity(); + else if(event.source.getEntity() instanceof EntityNPCInterface && ((EntityNPCInterface)event.source.getEntity()).advanced.role == EnumRoleType.Follower) + player = ((RoleFollower)((EntityNPCInterface)event.source.getEntity()).roleInterface).owner; + if(player != null){ + doQuest(player, event.entityLiving, true); + + if(event.entityLiving instanceof EntityNPCInterface) + doFactionPoints(player, (EntityNPCInterface)event.entityLiving); + } + } + if(event.entityLiving instanceof EntityPlayer){ + PlayerData data = PlayerDataController.instance.getPlayerData((EntityPlayer)event.entityLiving); + data.saveNBTData(null); + } + } + + private void doExcalibur(EntityPlayer player, EntityLivingBase entity) { + ItemStack item = player.getCurrentEquippedItem(); + if(item == null || item.getItem() != CustomItems.excalibur) + return; + Server.sendData((EntityPlayerMP)player, EnumPacketClient.PLAY_MUSIC, "customnpcs:songs.excalibur"); + player.addChatMessage(new ChatComponentTranslation("<" + StatCollector.translateToLocal(item.getItem().getUnlocalizedName() + ".name") + "> " + ItemExcalibur.quotes[player.getRNG().nextInt(ItemExcalibur.quotes.length)])); + } + + private void doFactionPoints(EntityPlayer player, EntityNPCInterface npc) { + npc.advanced.factions.addPoints(player); + } + + private void doQuest(EntityPlayer player, EntityLivingBase entity, boolean all) { + PlayerQuestData playerdata = PlayerDataController.instance.getPlayerData(player).questData; + boolean change = false; + String entityName = EntityList.getEntityString(entity); + + for(QuestData data : playerdata.activeQuests.values()){ + if(data.quest.type != EnumQuestType.Kill && data.quest.type != EnumQuestType.AreaKill) + continue; + if(data.quest.type == EnumQuestType.AreaKill && all){ + List list = player.worldObj.getEntitiesWithinAABB(EntityPlayer.class, entity.boundingBox.expand(10, 10, 10)); + for(EntityPlayer pl : list) + if(pl != player) + doQuest(pl, entity, false); + + } + String name = entityName; + QuestKill quest = (QuestKill) data.quest.questInterface; + if(quest.targets.containsKey(entity.getCommandSenderName())) + name = entity.getCommandSenderName(); + else if(!quest.targets.containsKey(name)) + continue; + HashMap killed = quest.getKilled(data); + if(killed.containsKey(name) && killed.get(name) >= quest.targets.get(name)) + continue; + int amount = 0; + if(killed.containsKey(name)) + amount = killed.get(name); + killed.put(name, amount + 1); + quest.setKilled(data, killed); + change = true; + } + if(!change) + return; + + playerdata.checkQuestCompletion(player,EnumQuestType.Kill); + } + + @SubscribeEvent + public void pickUp(EntityItemPickupEvent event){ + if(event.entityPlayer.worldObj.isRemote) + return; + PlayerQuestData playerdata = PlayerDataController.instance.getPlayerData(event.entityPlayer).questData; + playerdata.checkQuestCompletion(event.entityPlayer, EnumQuestType.Item); + } + + @SubscribeEvent + public void world(EntityJoinWorldEvent event){ + if(event.world.isRemote || !(event.entity instanceof EntityPlayer)) + return; + PlayerData data = PlayerDataController.instance.getPlayerData((EntityPlayer) event.entity); + data.updateCompanion(event.world); + } + + @SubscribeEvent + public void populateChunk(PopulateChunkEvent.Post event){ + NPCSpawning.performWorldGenSpawning(event.world, event.chunkX, event.chunkZ, event.rand); + } +} diff --git a/src/main/java/noppes/npcs/ServerTickHandler.java b/src/main/java/noppes/npcs/ServerTickHandler.java new file mode 100644 index 000000000..e379460fd --- /dev/null +++ b/src/main/java/noppes/npcs/ServerTickHandler.java @@ -0,0 +1,46 @@ +package noppes.npcs; + +import java.net.InetAddress; +import java.net.UnknownHostException; + +import net.minecraft.server.MinecraftServer; +import net.minecraft.world.WorldServer; +import noppes.npcs.client.AnalyticsTracking; +import noppes.npcs.controllers.SpawnController; +import noppes.npcs.entity.EntityNPCInterface; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.gameevent.PlayerEvent; +import cpw.mods.fml.common.gameevent.TickEvent; +import cpw.mods.fml.common.gameevent.TickEvent.Phase; + +public class ServerTickHandler { + @SubscribeEvent + public void onServerTick(TickEvent.WorldTickEvent event){ + if(event.phase == Phase.START){ + NPCSpawning.findChunksForSpawning((WorldServer) event.world); + } + } + + private String serverName = null; + + @SubscribeEvent + public void playerLogin(PlayerEvent.PlayerLoggedInEvent event){ + if(serverName == null){ + String e = "local"; + MinecraftServer server = MinecraftServer.getServer(); + if(server.isDedicatedServer()){ + try { + e = InetAddress.getByName(server.getServerHostname()).getCanonicalHostName(); + } catch (UnknownHostException e1) { + e = MinecraftServer.getServer().getServerHostname(); + } + if(server.getPort() != 25565) + e += ":" + server.getPort(); + } + if(e == null || e.startsWith("192.168") || e.contains("127.0.0.1") || e.startsWith("localhost")) + e = "local"; + serverName = e; + } + AnalyticsTracking.sendData(event.player, "join", serverName); + } +} diff --git a/src/main/java/noppes/npcs/TextBlock.java b/src/main/java/noppes/npcs/TextBlock.java new file mode 100644 index 000000000..ed6c2b7cf --- /dev/null +++ b/src/main/java/noppes/npcs/TextBlock.java @@ -0,0 +1,10 @@ +package noppes.npcs; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.util.IChatComponent; + +public class TextBlock { + public List lines = new ArrayList(); +} diff --git a/src/main/java/noppes/npcs/VersionCompatibility.java b/src/main/java/noppes/npcs/VersionCompatibility.java new file mode 100644 index 000000000..a1f935240 --- /dev/null +++ b/src/main/java/noppes/npcs/VersionCompatibility.java @@ -0,0 +1,112 @@ +package noppes.npcs; + +import java.util.Collection; +import java.util.List; + +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagInt; +import net.minecraft.nbt.NBTTagList; +import noppes.npcs.controllers.Line; +import noppes.npcs.controllers.Lines; +import noppes.npcs.entity.EntityNPCInterface; + +public class VersionCompatibility { + public static int ModRev = 16; + + public static void CheckNpcCompatibility(EntityNPCInterface npc, NBTTagCompound compound){ + if(npc.npcVersion == ModRev) + return; + if(npc.npcVersion < 12){ + CompatabilityFix(compound, npc.advanced.writeToNBT(new NBTTagCompound())); + CompatabilityFix(compound, npc.ai.writeToNBT(new NBTTagCompound())); + CompatabilityFix(compound, npc.stats.writeToNBT(new NBTTagCompound())); + CompatabilityFix(compound, npc.display.writeToNBT(new NBTTagCompound())); + CompatabilityFix(compound, npc.inventory.writeEntityToNBT(new NBTTagCompound())); + } + if(npc.npcVersion < 5){ + String texture = compound.getString("Texture"); + texture = texture.replace("/mob/customnpcs/", "customnpcs:textures/entity/"); + texture = texture.replace("/mob/", "customnpcs:textures/entity/"); + compound.setString("Texture", texture); + } + if(npc.npcVersion < 6 && compound.getTag("NpcInteractLines") instanceof NBTTagList){ + List interactLines = NBTTags.getStringList(compound.getTagList("NpcInteractLines", 10)); + Lines lines = new Lines(); + for(int i = 0; i < interactLines.size(); i++){ + Line line = new Line(); + line.text = (String) interactLines.toArray()[i]; + lines.lines.put(i, line); + } + compound.setTag("NpcInteractLines", lines.writeToNBT()); + + List worldLines = NBTTags.getStringList(compound.getTagList("NpcLines", 10)); + lines = new Lines(); + for(int i = 0; i < worldLines.size(); i++){ + Line line = new Line(); + line.text = (String) worldLines.toArray()[i]; + lines.lines.put(i, line); + } + compound.setTag("NpcLines", lines.writeToNBT()); + + List attackLines = NBTTags.getStringList(compound.getTagList("NpcAttackLines", 10)); + lines = new Lines(); + for(int i = 0; i < attackLines.size(); i++){ + Line line = new Line(); + line.text = (String) attackLines.toArray()[i]; + lines.lines.put(i, line); + } + compound.setTag("NpcAttackLines", lines.writeToNBT()); + + List killedLines = NBTTags.getStringList(compound.getTagList("NpcKilledLines", 10)); + lines = new Lines(); + for(int i = 0; i < killedLines.size(); i++){ + Line line = new Line(); + line.text = (String) killedLines.toArray()[i]; + lines.lines.put(i, line); + } + compound.setTag("NpcKilledLines", lines.writeToNBT()); + + } + if(npc.npcVersion == 12){ + NBTTagList list = compound.getTagList("StartPos", 3); + if(list.tagCount() == 3){ + int z = ((NBTTagInt) list.removeTag(2)).func_150287_d(); + int y = ((NBTTagInt) list.removeTag(1)).func_150287_d(); + int x = ((NBTTagInt) list.removeTag(0)).func_150287_d(); + + compound.setIntArray("StartPosNew", new int[]{x,y,z}); + } + } + if(npc.npcVersion == 13){ + boolean bo = compound.getBoolean("HealthRegen"); + compound.setInteger("HealthRegen", bo?1:0); + NBTTagCompound comp = compound.getCompoundTag("TransformStats"); + bo = comp.getBoolean("HealthRegen"); + comp.setInteger("HealthRegen", bo?1:0); + compound.setTag("TransformStats", comp); + + } + npc.npcVersion = ModRev; + } + public static void CheckAvailabilityCompatibility(ICompatibilty compatibilty, NBTTagCompound compound){ + if(compatibilty.getVersion() == ModRev) + return; + CompatabilityFix(compound, compatibilty.writeToNBT(new NBTTagCompound())); + + compatibilty.setVersion(ModRev); + } + private static void CompatabilityFix(NBTTagCompound compound, + NBTTagCompound check) { + Collection tags = check.func_150296_c(); + for(String name : tags){ + NBTBase nbt = check.getTag(name); + if(!compound.hasKey(name)){ + compound.setTag(name, nbt); + } + else if(nbt instanceof NBTTagCompound && compound.getTag(name) instanceof NBTTagCompound){ + CompatabilityFix(compound.getCompoundTag(name), (NBTTagCompound)nbt); + } + } + } +} diff --git a/src/main/java/noppes/npcs/ai/EntityAIAmbushTarget.java b/src/main/java/noppes/npcs/ai/EntityAIAmbushTarget.java new file mode 100644 index 000000000..d65952e67 --- /dev/null +++ b/src/main/java/noppes/npcs/ai/EntityAIAmbushTarget.java @@ -0,0 +1,162 @@ +package noppes.npcs.ai; + +import java.util.Random; + +import net.minecraft.entity.EntityCreature; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.ai.EntityAIBase; +import net.minecraft.pathfinding.PathEntity; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; +import noppes.npcs.constants.AiMutex; +import noppes.npcs.entity.EntityNPCInterface; + +public class EntityAIAmbushTarget extends EntityAIBase +{ + private EntityNPCInterface theEntity; + private EntityLivingBase targetEntity; + private double shelterX; + private double shelterY; + private double shelterZ; + private double movementSpeed; + private double distance; + private int delay = 0; + private World theWorld; + private int tick; + private boolean attackFromBehind; + + public EntityAIAmbushTarget(EntityNPCInterface par1EntityCreature, double par2, double par3, boolean par4) + { + this.theEntity = par1EntityCreature; + this.movementSpeed = par2; + this.theWorld = par1EntityCreature.worldObj; + this.distance = par3 * par3; + this.attackFromBehind = par4; + this.setMutexBits(AiMutex.PASSIVE + AiMutex.LOOK); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + this.targetEntity = this.theEntity.getAttackTarget(); + + if (this.targetEntity == null) + { + return false; + } + else if (this.targetEntity.getDistanceSqToEntity(this.theEntity) < this.distance || !this.theEntity.canSee(targetEntity)) + { + return false; + } + else if (delay > 0) + { + delay--; + return false; + } + else + { + Vec3 vec3 = this.findHidingSpot(); + + if (vec3 == null) + { + return false; + } + else + { + this.shelterX = vec3.xCoord; + this.shelterY = vec3.yCoord; + this.shelterZ = vec3.zCoord; + return true; + } + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + boolean shouldHide = this.targetEntity.getDistanceSqToEntity(this.theEntity) > this.distance; + boolean isSeen = this.theEntity.canSee(targetEntity); + return (!this.theEntity.getNavigator().noPath() && shouldHide) || (!isSeen && (shouldHide || this.theEntity.ai.directLOS)); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.theEntity.getNavigator().tryMoveToXYZ(this.shelterX, this.shelterY, this.shelterZ, this.movementSpeed); + } + + /** + * Resets the task + */ + public void resetTask() + { + this.theEntity.getNavigator().clearPathEntity(); + if (this.theEntity.getAttackTarget() == null && this.targetEntity != null) + { + this.theEntity.setAttackTarget(targetEntity); + } + if (this.targetEntity.getDistanceSqToEntity(this.theEntity) < this.distance) + { + this.delay = 60; + } + } + + /** + * Updates the task + */ + public void updateTask() + { + this.theEntity.getLookHelper().setLookPositionWithEntity(targetEntity, 30.0F, 30.0F); + } + + private Vec3 findHidingSpot() + { + Random random = this.theEntity.getRNG(); + Vec3 idealPos = null; + + for (int i = 1; i <= 8; i++) + { + for (int y = -2; y <= 2; y++) + { + for (int x = -i; x <= i; x++) + { + for (int z = -i; z <= i; z++) + { + double j = MathHelper.floor_double(this.theEntity.posX + x) + 0.5D; + double k = MathHelper.floor_double(this.theEntity.boundingBox.minY + y); + double l = MathHelper.floor_double(this.theEntity.posZ + z) + 0.5D; + + if (this.theWorld.getBlock((int)j, (int)k, (int)l).isOpaqueCube() && !this.theWorld.getBlock((int)j, (int)k + 1, (int)l).isOpaqueCube() && !this.theWorld.getBlock((int)j, (int)k + 2, (int)l).isOpaqueCube()) + { + Vec3 vec1 = Vec3.createVectorHelper(this.targetEntity.posX, this.targetEntity.posY + (double)this.targetEntity.getEyeHeight(), this.targetEntity.posZ); + Vec3 vec2 = Vec3.createVectorHelper(j, k + (double)this.theEntity.getEyeHeight(), l); + MovingObjectPosition movingobjectposition = this.theWorld.rayTraceBlocks(vec1, vec2); + if (movingobjectposition != null) + { + if (this.shelterX != j && this.shelterY != k && this.shelterZ != l) + { + idealPos = Vec3.createVectorHelper(j, k, l); + } + } + } + } + } + } + + if (idealPos != null) + { + return idealPos; + } + } + delay = 60; + return null; + } +} diff --git a/src/main/java/noppes/npcs/ai/EntityAIAnimation.java b/src/main/java/noppes/npcs/ai/EntityAIAnimation.java new file mode 100644 index 000000000..cd56f70ec --- /dev/null +++ b/src/main/java/noppes/npcs/ai/EntityAIAnimation.java @@ -0,0 +1,68 @@ +package noppes.npcs.ai; + +import net.minecraft.entity.ai.EntityAIBase; +import noppes.npcs.constants.AiMutex; +import noppes.npcs.constants.EnumAnimation; +import noppes.npcs.constants.EnumMovingType; +import noppes.npcs.entity.EntityNPCInterface; + +public class EntityAIAnimation extends EntityAIBase +{ + private EntityNPCInterface npc; + + private boolean isAttacking = false; + private boolean isDead = false; + private boolean isAtStartpoint = false; + private boolean hasPath = false; + private int tick = 4; + + public EntityAIAnimation(EntityNPCInterface npc){ + this.npc = npc; + } + + @Override + public boolean shouldExecute(){ + isDead = !npc.isEntityAlive(); + if(isDead) + return npc.currentAnimation != EnumAnimation.LYING; + + if(npc.stats.aimWhileShooting && npc.isAttacking()) + return npc.currentAnimation != EnumAnimation.AIMING; + if(npc.ai.animationType == EnumAnimation.NONE) + return npc.currentAnimation != EnumAnimation.NONE; + isAttacking = npc.isAttacking(); + if(npc.ai.returnToStart) + isAtStartpoint = npc.isVeryNearAssignedPlace(); + hasPath = !npc.getNavigator().noPath(); + + if(npc.ai.movingType == EnumMovingType.Standing && hasNavigation() && npc.currentAnimation.getWalkingAnimation() == 0){ + return npc.currentAnimation != EnumAnimation.NONE; + } + + return npc.currentAnimation != npc.ai.animationType; + } + + @Override + public void updateTask(){ + if(npc.stats.aimWhileShooting && npc.isAttacking()){ + setAnimation(EnumAnimation.AIMING); + return; + } + EnumAnimation type = npc.ai.animationType; + if(isDead) + type = EnumAnimation.LYING; + else if(npc.ai.movingType == EnumMovingType.Standing && npc.ai.animationType.getWalkingAnimation() == 0 && hasNavigation()) + type = EnumAnimation.NONE; + setAnimation(type); + } + + private void setAnimation(EnumAnimation animation){ + npc.setCurrentAnimation(animation); + npc.updateHitbox(); + npc.setPosition(npc.posX, npc.posY, npc.posZ); + } + + private boolean hasNavigation() { + return (isAttacking || npc.ai.returnToStart && !isAtStartpoint && !npc.isFollower() || hasPath); + } +} diff --git a/src/main/java/noppes/npcs/ai/EntityAIAttackTarget.java b/src/main/java/noppes/npcs/ai/EntityAIAttackTarget.java new file mode 100644 index 000000000..b5859e296 --- /dev/null +++ b/src/main/java/noppes/npcs/ai/EntityAIAttackTarget.java @@ -0,0 +1,141 @@ +package noppes.npcs.ai; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.ai.EntityAIBase; +import net.minecraft.pathfinding.PathEntity; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import noppes.npcs.constants.AiMutex; +import noppes.npcs.entity.EntityNPCInterface; + +public class EntityAIAttackTarget extends EntityAIBase +{ + World worldObj; + EntityNPCInterface attacker; + EntityLivingBase entityTarget; + + /** + * An amount of decrementing ticks that allows the entity to attack once the tick reaches 0. + */ + int attackTick; + + /** The PathEntity of our entity. */ + PathEntity entityPathEntity; + private int field_75445_i; + private boolean navOverride = false; + + public EntityAIAttackTarget(EntityNPCInterface par1EntityLiving){ + this.attackTick = 0; + this.attacker = par1EntityLiving; + this.worldObj = par1EntityLiving.worldObj; + this.setMutexBits(this.navOverride ? AiMutex.PATHING : AiMutex.LOOK + AiMutex.PASSIVE); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute(){ + EntityLivingBase entitylivingbase = this.attacker.getAttackTarget(); + + if (entitylivingbase == null){ + return false; + } + else if (!entitylivingbase.isEntityAlive()){ + return false; + } + else if (this.attacker.inventory.getProjectile() != null && this.attacker.ai.useRangeMelee == 0){ + return false; + } + + double var2 = this.attacker.getDistanceSq(entitylivingbase.posX, entitylivingbase.boundingBox.minY, entitylivingbase.posZ); + double var3 = this.attacker.ai.distanceToMelee * this.attacker.ai.distanceToMelee; + + if (this.attacker.ai.useRangeMelee == 1 && var2 > var3){ + return false; + } + else{ + this.entityTarget = entitylivingbase; + this.entityPathEntity = this.attacker.getNavigator().getPathToEntityLiving(entitylivingbase); + return this.entityPathEntity != null; + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + this.entityTarget = this.attacker.getAttackTarget(); + + if(entityTarget == null || !entityTarget.isEntityAlive()) + return false; + if(attacker.getDistanceToEntity(entityTarget) > attacker.stats.aggroRange) + return false; + if (this.attacker.ai.useRangeMelee == 1 && attacker.getDistanceSqToEntity(entityTarget) > (this.attacker.ai.distanceToMelee * this.attacker.ai.distanceToMelee)) + return false; + + return this.attacker.isWithinHomeDistance(MathHelper.floor_double(entityTarget.posX), MathHelper.floor_double(entityTarget.posY), MathHelper.floor_double(entityTarget.posZ)); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting(){ + if(!navOverride) + this.attacker.getNavigator().setPath(this.entityPathEntity, 1.3D); + this.field_75445_i = 0; + if (this.attacker.getRangedTask() != null && this.attacker.ai.useRangeMelee == 2) + { + this.attacker.getRangedTask().navOverride(true); + } + } + + /** + * Resets the task + */ + public void resetTask() + { + this.entityPathEntity = null; + this.entityTarget = null; + this.attacker.setAttackTarget(null); + this.attacker.getNavigator().clearPathEntity(); + if (this.attacker.getRangedTask() != null && this.attacker.ai.useRangeMelee == 2) + { + this.attacker.getRangedTask().navOverride(false); + } + } + + /** + * Updates the task + */ + public void updateTask() + { + this.attacker.getLookHelper().setLookPositionWithEntity(this.entityTarget, 30.0F, 30.0F); + if (!navOverride && --this.field_75445_i <= 0) + { + this.field_75445_i = 4 + this.attacker.getRNG().nextInt(7); + this.attacker.getNavigator().tryMoveToEntityLiving(this.entityTarget, 1.3f); + } + + this.attackTick = Math.max(this.attackTick - 1, 0); + double distance = this.attacker.getDistanceSq(this.entityTarget.posX, this.entityTarget.boundingBox.minY, this.entityTarget.posZ); + double range = attacker.stats.attackRange * attacker.stats.attackRange + entityTarget.width; + double minRange = this.attacker.width * 2.0F * this.attacker.width * 2.0F + entityTarget.width; + if(minRange > range) + range = minRange; + if (distance <= range && (attacker.canSee(this.entityTarget) || distance < minRange)) + { + if (this.attackTick <= 0) + { + this.attackTick = this.attacker.stats.attackSpeed; + this.attacker.swingItem(); + this.attacker.attackEntityAsMob(this.entityTarget); + } + } + } + + public void navOverride(boolean nav){ + this.navOverride = nav; + this.setMutexBits(this.navOverride ? AiMutex.PATHING : AiMutex.LOOK + AiMutex.PASSIVE); + } +} diff --git a/src/main/java/noppes/npcs/ai/EntityAIAvoidTarget.java b/src/main/java/noppes/npcs/ai/EntityAIAvoidTarget.java new file mode 100644 index 000000000..7f711ce95 --- /dev/null +++ b/src/main/java/noppes/npcs/ai/EntityAIAvoidTarget.java @@ -0,0 +1,158 @@ +package noppes.npcs.ai; + +import java.util.List; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.ai.EntityAIBase; +import net.minecraft.entity.ai.RandomPositionGenerator; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.pathfinding.PathEntity; +import net.minecraft.pathfinding.PathNavigate; +import net.minecraft.util.Vec3; +import noppes.npcs.constants.AiMutex; +import noppes.npcs.constants.EnumNavType; +import noppes.npcs.entity.EntityNPCInterface; + +public class EntityAIAvoidTarget extends EntityAIBase +{ + /** The entity we are attached to */ + private EntityNPCInterface theEntity; + private Entity closestLivingEntity; + private float distanceFromEntity; + + private float health; + + /** The PathEntity of our entity */ + private PathEntity entityPathEntity; + + /** The PathNavigate of our entity */ + private PathNavigate entityPathNavigate; + + /** The class of the entity we should avoid */ + private Class targetEntityClass; + + public EntityAIAvoidTarget(EntityNPCInterface par1EntityNPC) + { + this.theEntity = par1EntityNPC; + this.distanceFromEntity = this.theEntity.stats.aggroRange; + this.health = this.theEntity.getHealth(); + this.entityPathNavigate = par1EntityNPC.getNavigator(); + this.setMutexBits(AiMutex.PASSIVE + AiMutex.LOOK); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + EntityLivingBase target = this.theEntity.getAttackTarget(); + + if (target == null) + { + return false; + } + + targetEntityClass = target.getClass(); + + if (this.targetEntityClass == EntityPlayer.class) + { + this.closestLivingEntity = this.theEntity.worldObj.getClosestPlayerToEntity(this.theEntity, (double)this.distanceFromEntity); + + if (this.closestLivingEntity == null) + { + return false; + } + } + else + { + List var1 = this.theEntity.worldObj.getEntitiesWithinAABB(this.targetEntityClass, this.theEntity.boundingBox.expand((double)this.distanceFromEntity, 3.0D, (double)this.distanceFromEntity)); + + if (var1.isEmpty()) + { + return false; + } + + this.closestLivingEntity = (Entity)var1.get(0); + } + + if (!this.theEntity.getEntitySenses().canSee(this.closestLivingEntity) && this.theEntity.ai.directLOS) + { + return false; + } + else + { + Vec3 var2 = RandomPositionGeneratorAlt.findRandomTargetBlockAwayFrom(this.theEntity, 16, 7, Vec3.createVectorHelper(this.closestLivingEntity.posX, this.closestLivingEntity.posY, this.closestLivingEntity.posZ)); + + boolean var3 = this.theEntity.inventory.getProjectile() == null || this.theEntity.ai.useRangeMelee == 2; + + boolean var4 = var3 ? this.health == this.theEntity.getHealth() : this.theEntity.getRangedTask() != null && !this.theEntity.getRangedTask().hasFired(); + + if (var2 == null) + { + return false; + } + else if (this.closestLivingEntity.getDistanceSq(var2.xCoord, var2.yCoord, var2.zCoord) < this.closestLivingEntity.getDistanceSqToEntity(this.theEntity)) + { + return false; + } + else if (this.theEntity.ai.tacticalVariant == EnumNavType.HitNRun && var4) + { + return false; + } + else + { + this.entityPathEntity = this.entityPathNavigate.getPathToXYZ(var2.xCoord, var2.yCoord, var2.zCoord); + return this.entityPathEntity == null ? false : this.entityPathEntity.isDestinationSame(var2); + } + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return !this.entityPathNavigate.noPath(); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.entityPathNavigate.setPath(this.entityPathEntity, 1.0D); + } + + /** + * Resets the task + */ + public void resetTask() + { + this.closestLivingEntity = null; + this.theEntity.setAttackTarget(null); + } + + /** + * Updates the task + */ + public void updateTask() + { + if (this.theEntity.getDistanceSqToEntity(this.closestLivingEntity) < 49.0D) + { + this.theEntity.getNavigator().setSpeed(1.2D); + } + else + { + this.theEntity.getNavigator().setSpeed(1.0D); + } + if (this.theEntity.ai.tacticalVariant == EnumNavType.HitNRun) + { + float dist = this.theEntity.getDistanceToEntity(this.closestLivingEntity); + if (dist > this.distanceFromEntity || dist < this.theEntity.ai.tacticalRadius) + { + this.health = this.theEntity.getHealth(); + } + } + } +} \ No newline at end of file diff --git a/src/main/java/noppes/npcs/ai/EntityAIBustDoor.java b/src/main/java/noppes/npcs/ai/EntityAIBustDoor.java new file mode 100644 index 000000000..bb70645dd --- /dev/null +++ b/src/main/java/noppes/npcs/ai/EntityAIBustDoor.java @@ -0,0 +1,81 @@ +package noppes.npcs.ai; + +import net.minecraft.block.Block; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.ai.EntityAIDoorInteract; +import net.minecraft.init.Blocks; + +public class EntityAIBustDoor extends EntityAIDoorInteract +{ + private int breakingTime; + private int field_75358_j = -1; + + public EntityAIBustDoor(EntityLiving par1EntityLiving){ + super(par1EntityLiving); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + return !super.shouldExecute() ? false : (!this.theEntity.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing") ? false : !this.field_151504_e.func_150015_f(this.theEntity.worldObj, this.entityPosX, this.entityPosY, this.entityPosZ)); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + super.startExecuting(); + this.breakingTime = 0; + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + double var1 = this.theEntity.getDistanceSq((double)this.entityPosX, (double)this.entityPosY, (double)this.entityPosZ); + return this.breakingTime <= 240 && !this.field_151504_e.func_150015_f(this.theEntity.worldObj, this.entityPosX, this.entityPosY, this.entityPosZ) && var1 < 4.0D; + } + + /** + * Resets the task + */ + public void resetTask() + { + super.resetTask(); + this.theEntity.worldObj.destroyBlockInWorldPartially(this.theEntity.getEntityId(), this.entityPosX, this.entityPosY, this.entityPosZ, -1); + } + + /** + * Updates the task + */ + public void updateTask() + { + super.updateTask(); + + if (this.theEntity.getRNG().nextInt(20) == 0) + { + this.theEntity.worldObj.playAuxSFX(1010, this.entityPosX, this.entityPosY, this.entityPosZ, 0); + this.theEntity.swingItem(); + } + + ++this.breakingTime; + int var1 = (int)((float)this.breakingTime / 240.0F * 10.0F); + + if (var1 != this.field_75358_j) + { + this.theEntity.worldObj.destroyBlockInWorldPartially(this.theEntity.getEntityId(), this.entityPosX, this.entityPosY, this.entityPosZ, var1); + this.field_75358_j = var1; + } + + if (this.breakingTime == 240) + { + this.theEntity.worldObj.setBlock(this.entityPosX, this.entityPosY, this.entityPosZ, Blocks.air); + this.theEntity.worldObj.playAuxSFX(1012, this.entityPosX, this.entityPosY, this.entityPosZ, 0); + this.theEntity.worldObj.playAuxSFX(2001, this.entityPosX, this.entityPosY, this.entityPosZ, Block.getIdFromBlock(this.field_151504_e)); + } + } +} diff --git a/src/main/java/noppes/npcs/ai/EntityAIDodgeShoot.java b/src/main/java/noppes/npcs/ai/EntityAIDodgeShoot.java new file mode 100644 index 000000000..3a280b339 --- /dev/null +++ b/src/main/java/noppes/npcs/ai/EntityAIDodgeShoot.java @@ -0,0 +1,85 @@ +package noppes.npcs.ai; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.ai.EntityAIBase; +import net.minecraft.entity.ai.RandomPositionGenerator; +import net.minecraft.util.Vec3; +import noppes.npcs.constants.AiMutex; +import noppes.npcs.entity.EntityNPCInterface; + +public class EntityAIDodgeShoot extends EntityAIBase +{ + private EntityNPCInterface entity; + private double xPosition; + private double yPosition; + private double zPosition; + + public EntityAIDodgeShoot(EntityNPCInterface par1EntityNPCInterface) + { + this.entity = par1EntityNPCInterface; + this.setMutexBits(AiMutex.PASSIVE); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + EntityLivingBase var1 = this.entity.getAttackTarget(); + + if (var1 == null || !var1.isEntityAlive()) + { + return false; + } + if (this.entity.inventory.getProjectile() == null) + { + return false; + } + else if (this.entity.getRangedTask() == null) + { + return false; + } + else + { + + Vec3 vec = this.entity.getRangedTask().hasFired() ? RandomPositionGeneratorAlt.findRandomTarget(this.entity, 4, 1) : null; + + if (vec == null) + { + return false; + } + else + { + this.xPosition = vec.xCoord; + this.yPosition = vec.yCoord; + this.zPosition = vec.zCoord; + return true; + } + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return !this.entity.getNavigator().noPath(); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.entity.getNavigator().tryMoveToXYZ(this.xPosition, this.yPosition, this.zPosition, 1.2D); + } + + /** + * Updates the task + */ + public void updateTask() + { + if (this.entity.getAttackTarget() != null) + this.entity.getLookHelper().setLookPositionWithEntity(this.entity.getAttackTarget(), 30.0F, 30.0F); + } +} diff --git a/src/main/java/noppes/npcs/ai/EntityAIFindShade.java b/src/main/java/noppes/npcs/ai/EntityAIFindShade.java new file mode 100644 index 000000000..ebd29793b --- /dev/null +++ b/src/main/java/noppes/npcs/ai/EntityAIFindShade.java @@ -0,0 +1,93 @@ +package noppes.npcs.ai; + +import java.util.Random; + +import net.minecraft.entity.EntityCreature; +import net.minecraft.entity.ai.EntityAIBase; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; +import noppes.npcs.constants.AiMutex; + +public class EntityAIFindShade extends EntityAIBase +{ + private EntityCreature theCreature; + private double shelterX; + private double shelterY; + private double shelterZ; + private World theWorld; + + public EntityAIFindShade(EntityCreature par1EntityCreature) + { + this.theCreature = par1EntityCreature; + this.theWorld = par1EntityCreature.worldObj; + this.setMutexBits(AiMutex.PASSIVE); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (!this.theWorld.isDaytime()) + { + return false; + } + else if (!this.theWorld.canBlockSeeTheSky(MathHelper.floor_double(this.theCreature.posX), (int)this.theCreature.boundingBox.minY, MathHelper.floor_double(this.theCreature.posZ))) + { + return false; + } + else + { + Vec3 var1 = this.findPossibleShelter(); + + if (var1 == null) + { + return false; + } + else + { + this.shelterX = var1.xCoord; + this.shelterY = var1.yCoord; + this.shelterZ = var1.zCoord; + return true; + } + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return !this.theCreature.getNavigator().noPath(); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.theCreature.getNavigator().tryMoveToXYZ(this.shelterX, this.shelterY, this.shelterZ, 1.0D); + } + + private Vec3 findPossibleShelter() + { + Random var1 = this.theCreature.getRNG(); + + for (int var2 = 0; var2 < 10; ++var2) + { + int var3 = MathHelper.floor_double(this.theCreature.posX + (double)var1.nextInt(20) - 10.0D); + int var4 = MathHelper.floor_double(this.theCreature.boundingBox.minY + (double)var1.nextInt(6) - 3.0D); + int var5 = MathHelper.floor_double(this.theCreature.posZ + (double)var1.nextInt(20) - 10.0D); + + float light = this.theWorld.getLightBrightness(var3, var4, var5) - 0.5F; + if (!this.theWorld.canBlockSeeTheSky(var3, var4, var5) && light < 0.0F) + { + return Vec3.createVectorHelper((double)var3, (double)var4, (double)var5); + } + } + + return null; + } +} diff --git a/src/main/java/noppes/npcs/ai/EntityAIFollow.java b/src/main/java/noppes/npcs/ai/EntityAIFollow.java new file mode 100644 index 000000000..e30634e08 --- /dev/null +++ b/src/main/java/noppes/npcs/ai/EntityAIFollow.java @@ -0,0 +1,88 @@ +package noppes.npcs.ai; + +import net.minecraft.entity.EntityCreature; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.ai.EntityAIBase; +import net.minecraft.entity.ai.RandomPositionGenerator; +import net.minecraft.pathfinding.PathEntity; +import net.minecraft.pathfinding.PathPoint; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; +import noppes.npcs.constants.AiMutex; +import noppes.npcs.constants.EnumAnimation; +import noppes.npcs.entity.EntityNPCInterface; + +public class EntityAIFollow extends EntityAIBase +{ + private EntityNPCInterface npc; + private EntityLivingBase owner; + private double distance; + public int updateTick = 0; + + public EntityAIFollow(EntityNPCInterface npc){ + this.npc = npc; + this.setMutexBits(AiMutex.PASSIVE + AiMutex.LOOK); + } + + @Override + public boolean shouldExecute(){ + if(!excute()) + return false; + return distance > npc.followRange(); + } + + public boolean excute(){ + if(!npc.isEntityAlive() || !npc.isFollower() || npc.isAttacking() || (owner = npc.getOwner()) == null || npc.ai.animationType == EnumAnimation.SITTING) + return false; + distance = npc.getDistanceSqToEntity(owner); + return true; + } + + @Override + public void startExecuting(){ + updateTick = 10; + } + + @Override + public boolean continueExecuting(){ + return !this.npc.getNavigator().noPath() && distance > 4 && excute(); + } + @Override + public void resetTask(){ + this.owner = null; + this.npc.getNavigator().clearPathEntity(); + } + + @Override + public void updateTask(){ + updateTick++; + if(updateTick < 10) + return; + updateTick = 0; + this.npc.getLookHelper().setLookPositionWithEntity(owner, 10.0F, (float)this.npc.getVerticalFaceSpeed()); + + double speed = 1 + distance / 150; + if(speed > 3) + speed = 3; + if (this.npc.getNavigator().tryMoveToEntityLiving(owner, speed) || distance < 225.0D) + return; + + int i = MathHelper.floor_double(this.owner.posX) - 2; + int j = MathHelper.floor_double(this.owner.posZ) - 2; + int k = MathHelper.floor_double(this.owner.boundingBox.minY); + + for (int l = 0; l <= 4; ++l) + { + for (int i1 = 0; i1 <= 4; ++i1) + { + if ((l < 1 || i1 < 1 || l > 3 || i1 > 3) && World.doesBlockHaveSolidTopSurface(npc.worldObj, i + l, k - 1, j + i1) && !npc.worldObj.getBlock(i + l, k, j + i1).isNormalCube() && !npc.worldObj.getBlock(i + l, k + 1, j + i1).isNormalCube()) + { + this.npc.setLocationAndAngles((double)((float)(i + l) + 0.5F), (double)k, (double)((float)(j + i1) + 0.5F), this.npc.rotationYaw, this.npc.rotationPitch); + this.npc.getNavigator().clearPathEntity(); + return; + } + } + } + } +} diff --git a/src/main/java/noppes/npcs/ai/EntityAIJob.java b/src/main/java/noppes/npcs/ai/EntityAIJob.java new file mode 100644 index 000000000..9badc98d4 --- /dev/null +++ b/src/main/java/noppes/npcs/ai/EntityAIJob.java @@ -0,0 +1,42 @@ +package noppes.npcs.ai; + +import net.minecraft.entity.ai.EntityAIBase; +import noppes.npcs.entity.EntityNPCInterface; + +public class EntityAIJob extends EntityAIBase { + + private EntityNPCInterface npc; + public EntityAIJob(EntityNPCInterface npc){ + this.npc = npc; + } + + @Override + public boolean shouldExecute() { + if(npc.isKilled() || npc.jobInterface == null) + return false; + return npc.jobInterface.aiShouldExecute(); + } + + public void startExecuting() + { + npc.jobInterface.aiStartExecuting(); + } + + @Override + public boolean continueExecuting() + { + if(npc.isKilled() || npc.jobInterface == null) + return false; + return npc.jobInterface.aiContinueExecute(); + } + + public void updateTask() + { + npc.jobInterface.aiUpdateTask(); + } + + public void resetTask() { + if(npc.jobInterface != null) + npc.jobInterface.resetTask(); + } +} diff --git a/src/main/java/noppes/npcs/ai/EntityAILook.java b/src/main/java/noppes/npcs/ai/EntityAILook.java new file mode 100644 index 000000000..00575ed7b --- /dev/null +++ b/src/main/java/noppes/npcs/ai/EntityAILook.java @@ -0,0 +1,100 @@ +package noppes.npcs.ai; + +import java.util.Iterator; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.ai.EntityAIBase; +import net.minecraft.entity.player.EntityPlayer; +import noppes.npcs.constants.AiMutex; +import noppes.npcs.constants.EnumStandingType; +import noppes.npcs.entity.EntityNPCInterface; + +public class EntityAILook extends EntityAIBase{ + private final EntityNPCInterface npc; + private int idle = 0; + private double lookX; + private double lookZ; + boolean rotatebody; + + public EntityAILook(EntityNPCInterface npc){ + this.npc = npc; + this.setMutexBits(AiMutex.LOOK); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + @Override + public boolean shouldExecute(){ + return !npc.isAttacking() && npc.getNavigator().noPath() && !npc.isPlayerSleeping() && npc.isEntityAlive(); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + @Override + public void startExecuting(){ + rotatebody = npc.ai.standingType == EnumStandingType.RotateBody || npc.ai.standingType == EnumStandingType.HeadRotation; + } + + /** + * Resets the task + */ + @Override + public void resetTask(){ + rotatebody = false; + } + + /** + * Updates the task + */ + @Override + public void updateTask(){ + if(npc.ai.standingType == EnumStandingType.Stalking){ + EntityPlayer player = npc.worldObj.getClosestPlayerToEntity(npc, 16); + if(player == null) + rotatebody = true; + else + npc.getLookHelper().setLookPositionWithEntity(player, 10F, npc.getVerticalFaceSpeed()); + } + if(npc.isInteracting()){ + Iterator ita = npc.interactingEntities.iterator(); + EntityLivingBase closest = null; + double closestDistance = 12; + while(ita.hasNext()){ + EntityLivingBase entity = ita.next(); + double distance = entity.getDistanceSqToEntity(npc); + if(distance < closestDistance){ + closestDistance = entity.getDistanceSqToEntity(npc); + closest = entity; + } + else if(distance > 12) + ita.remove(); + } + if(closest != null){ + npc.getLookHelper().setLookPositionWithEntity(closest, 10F, npc.getVerticalFaceSpeed()); + return; + } + + } + + if(rotatebody){ + if(idle == 0 && npc.getRNG().nextFloat() < 0.02F){ + double var1 = (Math.PI * 2D) * this.npc.getRNG().nextDouble(); + if(npc.ai.standingType == EnumStandingType.HeadRotation) + var1 = Math.PI / 180 * npc.ai.orientation + Math.PI * 0.2 + Math.PI * 0.6 * this.npc.getRNG().nextDouble(); + this.lookX = Math.cos(var1); + this.lookZ = Math.sin(var1); + this.idle = 20 + this.npc.getRNG().nextInt(20); + } + if(idle > 0){ + idle--; + npc.getLookHelper().setLookPosition(npc.posX + lookX, npc.posY + npc.getEyeHeight(), npc.posZ + lookZ, 10F, npc.getVerticalFaceSpeed()); + } + } + + if(npc.ai.standingType == EnumStandingType.NoRotation){ + npc.rotationYawHead = npc.rotationYaw = npc.renderYawOffset = npc.ai.orientation; + } + } +} diff --git a/src/main/java/noppes/npcs/ai/EntityAIMoveIndoors.java b/src/main/java/noppes/npcs/ai/EntityAIMoveIndoors.java new file mode 100644 index 000000000..f8cfe51cf --- /dev/null +++ b/src/main/java/noppes/npcs/ai/EntityAIMoveIndoors.java @@ -0,0 +1,99 @@ +package noppes.npcs.ai; + +import java.util.Random; + +import net.minecraft.entity.EntityCreature; +import net.minecraft.entity.ai.EntityAIBase; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; +import noppes.npcs.constants.AiMutex; + +public class EntityAIMoveIndoors extends EntityAIBase +{ + private EntityCreature theCreature; + private double shelterX; + private double shelterY; + private double shelterZ; + private World theWorld; + + public EntityAIMoveIndoors(EntityCreature par1EntityCreature) + { + this.theCreature = par1EntityCreature; + this.theWorld = par1EntityCreature.worldObj; + this.setMutexBits(AiMutex.PASSIVE); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + + int x = MathHelper.floor_double(this.theCreature.posX); + int y = (int)this.theCreature.boundingBox.minY; + int z = MathHelper.floor_double(this.theCreature.posZ); + if ((!this.theCreature.worldObj.isDaytime() || this.theCreature.worldObj.isRaining()) && !this.theCreature.worldObj.provider.hasNoSky) + { + if (!this.theWorld.canBlockSeeTheSky(x, y, z) && this.theWorld.getFullBlockLightValue(x, y, z) > 8) + { + return false; + } + else + { + Vec3 var1 = this.findPossibleShelter(); + + if (var1 == null) + { + return false; + } + else + { + this.shelterX = var1.xCoord; + this.shelterY = var1.yCoord; + this.shelterZ = var1.zCoord; + return true; + } + } + } + else + { + return false; + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return !this.theCreature.getNavigator().noPath(); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.theCreature.getNavigator().tryMoveToXYZ(this.shelterX, this.shelterY, this.shelterZ, 1.0D); + } + + private Vec3 findPossibleShelter() + { + Random var1 = this.theCreature.getRNG(); + + for (int var2 = 0; var2 < 10; ++var2) + { + int var3 = MathHelper.floor_double(this.theCreature.posX + (double)var1.nextInt(20) - 10.0D); + int var4 = MathHelper.floor_double(this.theCreature.boundingBox.minY + (double)var1.nextInt(6) - 3.0D); + int var5 = MathHelper.floor_double(this.theCreature.posZ + (double)var1.nextInt(20) - 10.0D); + + if (!this.theWorld.canBlockSeeTheSky(var3, var4, var5) && this.theWorld.getFullBlockLightValue(var3, var4, var5) > 8) + { + return Vec3.createVectorHelper((double)var3, (double)var4, (double)var5); + } + } + + return null; + } +} diff --git a/src/main/java/noppes/npcs/ai/EntityAIMovingPath.java b/src/main/java/noppes/npcs/ai/EntityAIMovingPath.java new file mode 100644 index 000000000..0d5e8ef9e --- /dev/null +++ b/src/main/java/noppes/npcs/ai/EntityAIMovingPath.java @@ -0,0 +1,57 @@ +package noppes.npcs.ai; + +import java.util.List; + +import net.minecraft.entity.ai.EntityAIBase; +import noppes.npcs.constants.AiMutex; +import noppes.npcs.constants.EnumMovingType; +import noppes.npcs.entity.EntityNPCInterface; + +public class EntityAIMovingPath extends EntityAIBase +{ + private EntityNPCInterface npc; + private int[] pos; + + public EntityAIMovingPath(EntityNPCInterface par1EntityNPCInterface){ + this.npc = par1EntityNPCInterface; + this.setMutexBits(AiMutex.PASSIVE); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + @Override + public boolean shouldExecute(){ + if (npc.isAttacking() || npc.isInteracting() || npc.getRNG().nextInt(40) != 0 && npc.ai.movingPause || !npc.getNavigator().noPath() || npc.isInteracting()) + return false; + + List list = npc.ai.getMovingPath(); + if(list.size() < 2) + return false; + + npc.ai.incrementMovingPath(); + pos = npc.ai.getCurrentMovingPath(); + + return true; + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + @Override + public boolean continueExecuting(){ + if(npc.isAttacking() || npc.isInteracting()){ + npc.ai.decreaseMovingPath(); + return false; + } + return !this.npc.getNavigator().noPath(); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + @Override + public void startExecuting(){ + this.npc.getNavigator().tryMoveToXYZ(pos[0] + 0.5, pos[1], pos[2] + 0.5, 1.0D); + } +} diff --git a/src/main/java/noppes/npcs/ai/EntityAIOrbitTarget.java b/src/main/java/noppes/npcs/ai/EntityAIOrbitTarget.java new file mode 100644 index 000000000..058649b6a --- /dev/null +++ b/src/main/java/noppes/npcs/ai/EntityAIOrbitTarget.java @@ -0,0 +1,137 @@ +package noppes.npcs.ai; + +import java.util.Iterator; +import java.util.List; +import java.util.Random; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityCreature; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.ai.EntityAIBase; +import net.minecraft.entity.monster.EntityPigZombie; +import net.minecraft.entity.monster.EntityZombie; +import net.minecraft.entity.passive.EntityVillager; +import net.minecraft.pathfinding.PathEntity; +import net.minecraft.pathfinding.PathPoint; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; +import noppes.npcs.constants.AiMutex; +import noppes.npcs.entity.EntityNPCInterface; + +public class EntityAIOrbitTarget extends EntityAIBase +{ + private EntityNPCInterface theEntity; + private EntityLivingBase targetEntity; + private double movePosX; + private double movePosY; + private double movePosZ; + private double speed; + private float distance; + private int delay = 0; + private float angle = 0; + private int direction = 1; + private float targetDistance; + private boolean decay; + private boolean canNavigate = true; + private float decayRate = 1.0F; + private int tick = 0; + + public EntityAIOrbitTarget(EntityNPCInterface par1EntityCreature, double par2, float par4, boolean par5) + { + this.theEntity = par1EntityCreature; + this.speed = par2; + this.distance = par4; + this.decay = par5; + this.setMutexBits(AiMutex.PASSIVE + AiMutex.LOOK); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (--delay > 0) + { + return false; + } + + this.targetEntity = this.theEntity.getAttackTarget(); + + if (this.targetEntity == null) + { + return false; + } + else + { + double d0 = this.theEntity.getDistanceToEntity(this.targetEntity); + return d0 >= this.distance / 2.0F && (this.theEntity.inventory.getProjectile() == null ? d0 <= this.distance : true); + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + double d0 = this.targetEntity.getDistanceToEntity(this.theEntity); + return this.targetEntity.isEntityAlive() && d0 >= this.distance / 2.0F && d0 <= this.distance * 1.5F && !this.theEntity.isInWater() && this.canNavigate; + } + + /** + * Resets the task + */ + public void resetTask() + { + this.theEntity.getNavigator().clearPathEntity(); + this.delay = 60; + if (this.theEntity.getRangedTask() != null){ + this.theEntity.getRangedTask().navOverride(false); + } + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.canNavigate = true; + Random random = this.theEntity.getRNG(); + this.direction = random.nextInt(10) > 5 ? 1 : -1; + this.decayRate = random.nextFloat() + (this.distance / 16.0F); + this.targetDistance = this.theEntity.getDistanceToEntity(this.targetEntity); + double d0 = this.theEntity.posX - this.targetEntity.posX; + double d1 = this.theEntity.posZ - this.targetEntity.posZ; + this.angle = (float) (Math.atan2(d1, d0) * 180.0F / Math.PI); + if (this.theEntity.getRangedTask() != null){ + this.theEntity.getRangedTask().navOverride(true); + } + } + + /** + * Updates the task + */ + public void updateTask() + { + this.theEntity.getLookHelper().setLookPositionWithEntity(targetEntity, 30.0F, 30.0F); + if (this.theEntity.getNavigator().noPath() && this.tick >= 0) + { + if (this.theEntity.onGround && !this.theEntity.isInWater()) + { + double d0 = this.targetDistance * (double)(MathHelper.cos(angle / 180.0F * (float)Math.PI)); + double d1 = this.targetDistance * (double)(MathHelper.sin(angle / 180.0F * (float)Math.PI)); + this.movePosX = this.targetEntity.posX + d0; + this.movePosY = this.targetEntity.boundingBox.maxY; + this.movePosZ = this.targetEntity.posZ + d1; + this.theEntity.getNavigator().tryMoveToXYZ(this.movePosX, this.movePosY, this.movePosZ, this.speed); + this.angle += 15.0F * this.direction; + this.tick = MathHelper.ceiling_double_int(this.theEntity.getDistance(this.movePosX, this.movePosY, this.movePosZ) / (this.theEntity.getSpeed() / 20.0F)); + if (this.decay) + { + this.targetDistance -=decayRate; + } + } + } + if (this.tick >= 0) this.tick--; + } + +} diff --git a/src/main/java/noppes/npcs/ai/EntityAIPanic.java b/src/main/java/noppes/npcs/ai/EntityAIPanic.java new file mode 100644 index 000000000..556e99abc --- /dev/null +++ b/src/main/java/noppes/npcs/ai/EntityAIPanic.java @@ -0,0 +1,62 @@ +package noppes.npcs.ai; + +import net.minecraft.entity.EntityCreature; +import net.minecraft.entity.ai.EntityAIBase; +import net.minecraft.entity.ai.RandomPositionGenerator; +import net.minecraft.util.Vec3; +import noppes.npcs.constants.AiMutex; + +public class EntityAIPanic extends EntityAIBase +{ + private EntityCreature theEntityCreature; + private float speed; + private double randPosX; + private double randPosY; + private double randPosZ; + + public EntityAIPanic(EntityCreature par1EntityCreature, float par2) + { + this.theEntityCreature = par1EntityCreature; + this.speed = par2; + this.setMutexBits(AiMutex.PASSIVE); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute(){ + if (this.theEntityCreature.getAttackTarget() == null && !this.theEntityCreature.isBurning()){ + return false; + } + else + { + Vec3 var1 = RandomPositionGeneratorAlt.findRandomTarget(this.theEntityCreature, 5, 4); + + if (var1 == null){ + return false; + } + else{ + this.randPosX = var1.xCoord; + this.randPosY = var1.yCoord; + this.randPosZ = var1.zCoord; + return true; + } + } + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting(){ + this.theEntityCreature.getNavigator().tryMoveToXYZ(this.randPosX, this.randPosY, this.randPosZ, this.speed); + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting(){ + if(this.theEntityCreature.getAttackTarget() == null) + return false; + return !this.theEntityCreature.getNavigator().noPath(); + } +} \ No newline at end of file diff --git a/src/main/java/noppes/npcs/ai/EntityAIRangedAttack.java b/src/main/java/noppes/npcs/ai/EntityAIRangedAttack.java new file mode 100644 index 000000000..3553c2287 --- /dev/null +++ b/src/main/java/noppes/npcs/ai/EntityAIRangedAttack.java @@ -0,0 +1,172 @@ +package noppes.npcs.ai; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.IRangedAttackMob; +import net.minecraft.entity.ai.EntityAIBase; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; +import noppes.npcs.constants.AiMutex; +import noppes.npcs.constants.EnumAnimation; +import noppes.npcs.constants.EnumNavType; +import noppes.npcs.entity.EntityNPCInterface; + +public class EntityAIRangedAttack extends EntityAIBase +{ + /** The entity the AI instance has been applied to */ + private final EntityNPCInterface entityHost; + + /** + * The entity (as a RangedAttackMob) the AI instance has been applied to. + */ + private final IRangedAttackMob rangedAttackEntityHost; + private EntityLivingBase attackTarget; + + /** + * A decrementing tick that spawns a ranged attack once this value reaches 0. It is then set back to the + * maxRangedAttackTime. + */ + private int rangedAttackTime = 0; + private int field_75318_f = 0; + private int field_70846_g = 0; + private int attackTick = 0; + private boolean hasFired = false; + private boolean navOverride = false; + + public EntityAIRangedAttack(IRangedAttackMob par1IRangedAttackMob) + { + if (!(par1IRangedAttackMob instanceof EntityLivingBase)) + { + throw new IllegalArgumentException("ArrowAttackGoal requires Mob implements RangedAttackMob"); + } + else + { + this.rangedAttackEntityHost = par1IRangedAttackMob; + this.entityHost = (EntityNPCInterface)par1IRangedAttackMob; + this.rangedAttackTime = this.entityHost.stats.minDelay / 2; + this.setMutexBits(this.navOverride ? AiMutex.PATHING : AiMutex.LOOK + AiMutex.PASSIVE); + } + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + EntityLivingBase var1 = this.entityHost.getAttackTarget(); + + if (var1 == null || !var1.isEntityAlive()) return false; + + if(entityHost.getDistanceToEntity(var1) > entityHost.stats.aggroRange) return false; + + if (this.entityHost.inventory.getProjectile() == null) return false; + + double var2 = this.entityHost.getDistanceSq(var1.posX, var1.boundingBox.minY, var1.posZ); + double var3 = this.entityHost.ai.distanceToMelee * this.entityHost.ai.distanceToMelee; + + if (this.entityHost.ai.useRangeMelee >= 1 && var2 <= var3) return false; + + else + { + this.attackTarget = var1; + return true; + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return this.shouldExecute() || !this.entityHost.getNavigator().noPath(); + } + + /** + * Resets the task + */ + public void resetTask() + { + this.attackTarget = null; + this.entityHost.setAttackTarget(null); + this.entityHost.getNavigator().clearPathEntity(); + this.field_75318_f = 0; + this.hasFired = false; + this.rangedAttackTime = this.entityHost.stats.minDelay / 2; + } + + /** + * Updates the task + */ + public void updateTask() + { + this.entityHost.getLookHelper().setLookPositionWithEntity(this.attackTarget, 30.0F, 30.0F); + double var1 = this.entityHost.getDistanceSq(this.attackTarget.posX, this.attackTarget.boundingBox.minY, this.attackTarget.posZ); + float field_82642_h = this.entityHost.stats.rangedRange * this.entityHost.stats.rangedRange; + + if (!navOverride && this.entityHost.ai.directLOS) + { + if (this.entityHost.getEntitySenses().canSee(this.attackTarget)) + { + ++this.field_75318_f; + } + else + { + this.field_75318_f = 0; + } + int v = this.entityHost.ai.tacticalVariant == EnumNavType.Default ? 20 : 5; + if (var1 <= (double)field_82642_h && this.field_75318_f >= v) + { + this.entityHost.getNavigator().clearPathEntity(); + } + else + { + this.entityHost.getNavigator().tryMoveToEntityLiving(this.attackTarget, 1.0D); + } + } + + this.rangedAttackTime = Math.max(this.rangedAttackTime - 1, 0); + + if (this.rangedAttackTime <= 0) + { + if (var1 <= (double)field_82642_h && (this.entityHost.getEntitySenses().canSee(this.attackTarget) || this.entityHost.ai.canFireIndirect == 2)) + { + if (this.field_70846_g++ <= this.entityHost.stats.burstCount) + { + this.rangedAttackTime = this.entityHost.stats.fireRate; + } + else + { + this.field_70846_g = 0; + this.hasFired = true; + this.rangedAttackTime = (this.entityHost.stats.maxDelay - MathHelper.floor_float(this.entityHost.getRNG().nextFloat() * (this.entityHost.stats.maxDelay - this.entityHost.stats.minDelay))); + } + + if (this.field_70846_g > 1) + { + boolean indirect = false; + + switch(this.entityHost.ai.canFireIndirect) + { + case 1 : indirect = var1 > (double)field_82642_h / 2; break; + case 2 : indirect = !this.entityHost.getEntitySenses().canSee(this.attackTarget); + } + + this.rangedAttackEntityHost.attackEntityWithRangedAttack(this.attackTarget, indirect ? 1 : 0); + if (this.entityHost.currentAnimation != EnumAnimation.AIMING) + { + this.entityHost.swingItem(); + } + } + } + } + } + + public boolean hasFired() + { + return this.hasFired; + } + + public void navOverride(boolean nav){ + this.navOverride = nav; + this.setMutexBits(this.navOverride ? AiMutex.PATHING : AiMutex.LOOK + AiMutex.PASSIVE); + } +} \ No newline at end of file diff --git a/src/main/java/noppes/npcs/ai/EntityAIReturn.java b/src/main/java/noppes/npcs/ai/EntityAIReturn.java new file mode 100644 index 000000000..6bf891e5a --- /dev/null +++ b/src/main/java/noppes/npcs/ai/EntityAIReturn.java @@ -0,0 +1,152 @@ +package noppes.npcs.ai; + +import net.minecraft.entity.ai.EntityAIBase; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; +import noppes.npcs.CustomNpcs; +import noppes.npcs.constants.EnumMovingType; +import noppes.npcs.entity.EntityNPCInterface; + +public class EntityAIReturn extends EntityAIBase +{ + public static final int MaxTotalTicks = 600; + private final EntityNPCInterface npc; + private int stuckTicks = 0; + private int totalTicks = 0; + private double endPosX; + private double endPosY; + private double endPosZ; + private boolean wasAttacked = false; + private double[] preAttackPos; + private int stuckCount = 0; + + public EntityAIReturn(EntityNPCInterface npc) + { + this.npc = npc; + this.setMutexBits(1); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute(){ + if(npc.hasOwner() || !npc.ai.returnToStart || npc.isKilled() || !npc.getNavigator().noPath() || npc.isInteracting()){ + return false; + } + + if (npc.ai.findShelter == 0 && (!npc.worldObj.isDaytime() || npc.worldObj.isRaining()) && !npc.worldObj.provider.hasNoSky){ + if (npc.worldObj.canBlockSeeTheSky((int)npc.getStartXPos(), (int)npc.getStartYPos(), (int)npc.getStartZPos()) || npc.worldObj.getFullBlockLightValue((int)npc.getStartXPos(), (int)npc.getStartYPos(), (int)npc.getStartZPos()) <= 8){ + return false; + } + } + else if (npc.ai.findShelter == 1 && npc.worldObj.isDaytime()){ + if (npc.worldObj.canBlockSeeTheSky((int)npc.getStartXPos(), (int)npc.getStartYPos(), (int)npc.getStartZPos())){ + return false; + } + } + + if(npc.isAttacking()){ + if(!wasAttacked){ + wasAttacked = true; + preAttackPos = new double[]{npc.posX, npc.posY, npc.posZ}; + } + return false; + } + if(!npc.isAttacking() && wasAttacked){ + return true; + } + + if(npc.ai.movingType == EnumMovingType.MovingPath && npc.ai.getDistanceSqToPathPoint() < CustomNpcs.NpcNavRange * CustomNpcs.NpcNavRange) + return false; + + if(npc.ai.movingType == EnumMovingType.Wandering) + return this.npc.getDistanceSq(npc.getStartXPos(), npc.getStartYPos(), npc.getStartZPos()) > npc.ai.walkingRange * npc.ai.walkingRange; + + if(npc.ai.movingType == EnumMovingType.Standing) + return !this.npc.isVeryNearAssignedPlace(); + + return false; + } + public boolean continueExecuting(){ + return !npc.isFollower() && !npc.isKilled() && !npc.isAttacking() && !npc.isVeryNearAssignedPlace() && totalTicks <= MaxTotalTicks && !npc.isInteracting(); + } + + public void updateTask(){ + totalTicks++; + if(totalTicks > MaxTotalTicks){ + npc.setPosition(endPosX, endPosY, endPosZ); + npc.getNavigator().clearPathEntity(); + return; + } + + if(stuckTicks > 0){ + stuckTicks--; + } + else if(npc.getNavigator().noPath()){ + stuckCount++; + stuckTicks = 10; + if(totalTicks > 30 && wasAttacked && isTooFar() || stuckCount > 5 ){ + npc.setPosition(endPosX, endPosY, endPosZ); + npc.getNavigator().clearPathEntity(); + } + else + navigate(stuckCount % 2 == 1); + } + else{ + stuckCount = 0; + } + } + private boolean isTooFar(){ + int allowedDistance = npc.stats.aggroRange * 2; + if(npc.ai.movingType == EnumMovingType.Wandering) + allowedDistance += npc.ai.walkingRange; + return npc.getDistanceSq(endPosX, endPosY, endPosZ) > allowedDistance * allowedDistance; + } + + public void startExecuting() + { + stuckTicks = 0; + totalTicks = 0; + stuckCount = 0; + navigate(false); + } + private void navigate(boolean towards) { + if(!wasAttacked){ + endPosX = npc.getStartXPos(); + endPosY = npc.getStartYPos(); + endPosZ = npc.getStartZPos(); + } + else{ + endPosX = preAttackPos[0]; + endPosY = preAttackPos[1]; + endPosZ = preAttackPos[2]; + } + double posX = endPosX; + double posY = endPosY; + double posZ = endPosZ; + double range = npc.getDistance(posX, posY, posZ); + if(range > CustomNpcs.NpcNavRange || towards){ + int distance = (int) range; + if(distance > CustomNpcs.NpcNavRange) + distance = CustomNpcs.NpcNavRange / 2; + else + distance /= 2; + if(distance > 2){ + Vec3 start = Vec3.createVectorHelper(posX, posY, posZ); + Vec3 pos = RandomPositionGeneratorAlt.findRandomTargetBlockTowards(npc, distance,distance /2 > 7? 7:distance/2, start); + if(pos != null){ + posX = pos.xCoord; + posY = pos.yCoord; + posZ = pos.zCoord; + } + } + } + npc.getNavigator().clearPathEntity(); + npc.getNavigator().tryMoveToXYZ(posX, posY, posZ, 1); + } + + public void resetTask(){ + wasAttacked = false; + this.npc.getNavigator().clearPathEntity(); + } +} diff --git a/src/main/java/noppes/npcs/ai/EntityAIRole.java b/src/main/java/noppes/npcs/ai/EntityAIRole.java new file mode 100644 index 000000000..8758580e5 --- /dev/null +++ b/src/main/java/noppes/npcs/ai/EntityAIRole.java @@ -0,0 +1,37 @@ +package noppes.npcs.ai; + +import net.minecraft.entity.ai.EntityAIBase; +import noppes.npcs.entity.EntityNPCInterface; + +public class EntityAIRole extends EntityAIBase { + + private EntityNPCInterface npc; + public EntityAIRole(EntityNPCInterface npc){ + this.npc = npc; + } + + @Override + public boolean shouldExecute() { + if(npc.isKilled() || npc.roleInterface == null) + return false; + return npc.roleInterface.aiShouldExecute(); + } + + public void startExecuting() + { + npc.roleInterface.aiStartExecuting(); + } + + @Override + public boolean continueExecuting() + { + if(npc.isKilled() || npc.roleInterface == null) + return false; + return npc.roleInterface.aiContinueExecute(); + } + + public void updateTask(){ + if(npc.roleInterface != null) + npc.roleInterface.aiUpdateTask(); + } +} diff --git a/src/main/java/noppes/npcs/ai/EntityAISprintToTarget.java b/src/main/java/noppes/npcs/ai/EntityAISprintToTarget.java new file mode 100644 index 000000000..b2bf7dfd0 --- /dev/null +++ b/src/main/java/noppes/npcs/ai/EntityAISprintToTarget.java @@ -0,0 +1,71 @@ +package noppes.npcs.ai; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.ai.EntityAIBase; +import noppes.npcs.constants.AiMutex; +import noppes.npcs.entity.EntityNPCInterface; + +public class EntityAISprintToTarget extends EntityAIBase +{ + /** The entity that is leaping. */ + EntityNPCInterface runner; + + /** The entity that the leaper is leaping towards. */ + EntityLivingBase runTarget; + + public EntityAISprintToTarget(EntityNPCInterface par1EntityLiving) + { + this.runner = par1EntityLiving; + this.setMutexBits(AiMutex.PASSIVE + AiMutex.PATHING); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + this.runTarget = this.runner.getAttackTarget(); + + if (this.runTarget == null) + { + return false; + } + else if (this.runner.getNavigator().noPath()) + { + return false; + } + else + { + switch(this.runner.ai.onAttack) + { + case 0 : return this.runner.getDistanceSqToEntity(this.runTarget) >= 64.0D ? (!this.runner.onGround ? false : true) : false; + case 2 : return this.runner.getDistanceSqToEntity(this.runTarget) <= 49.0D ? (!this.runner.onGround ? false : true) : false; + default : return false; + } + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return this.runner.isEntityAlive() && this.runner.onGround && this.runner.hurtTime <= 0 && (this.runner.motionX != 0.0D && this.runner.motionZ != 0.0D); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.runner.setSprinting(true); + } + + /** + * Resets the task + */ + public void resetTask() + { + this.runner.setSprinting(false); + } +} diff --git a/src/main/java/noppes/npcs/ai/EntityAIStalkTarget.java b/src/main/java/noppes/npcs/ai/EntityAIStalkTarget.java new file mode 100644 index 000000000..6017fd8f4 --- /dev/null +++ b/src/main/java/noppes/npcs/ai/EntityAIStalkTarget.java @@ -0,0 +1,212 @@ +package noppes.npcs.ai; + +import java.util.Random; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.ai.EntityAIBase; +import net.minecraft.init.Blocks; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; +import noppes.npcs.constants.AiMutex; +import noppes.npcs.constants.EnumNavType; +import noppes.npcs.entity.EntityNPCInterface; + +public class EntityAIStalkTarget extends EntityAIBase +{ + private EntityNPCInterface theEntity; + private EntityLivingBase targetEntity; + private Vec3 movePosition; + private double distance; + private boolean overRide; + private World theWorld; + private int delay; + private int tick = 0; + + public EntityAIStalkTarget(EntityNPCInterface par1EntityCreature, double par2) + { + this.theEntity = par1EntityCreature; + this.theWorld = par1EntityCreature.worldObj; + this.distance = par2 * par2; + this.overRide = false; + this.delay = 0; + this.setMutexBits(AiMutex.PASSIVE + AiMutex.LOOK); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + this.targetEntity = this.theEntity.getAttackTarget(); + + if (this.targetEntity == null) + { + return false; + } + else if (this.tick > 0) + { + this.tick--; + return false; + } + else + { + return this.targetEntity.getDistanceSqToEntity(this.theEntity) > this.distance; + } + } + + /** + * Resets the task + */ + public void resetTask() + { + this.theEntity.getNavigator().clearPathEntity(); + if (this.theEntity.getAttackTarget() == null && this.targetEntity != null) + { + this.theEntity.setAttackTarget(targetEntity); + } + + if (this.theEntity.getRangedTask() != null) + { + this.theEntity.getRangedTask().navOverride(false); + } + } + + public void startExecuting() + { + if (this.theEntity.getRangedTask() != null) + { + this.theEntity.getRangedTask().navOverride(true); + } + } + + /** + * Updates the task + */ + public void updateTask() + { + this.theEntity.getLookHelper().setLookPositionWithEntity(targetEntity, 30.0F, 30.0F); + + if (this.theEntity.getNavigator().noPath() || this.overRide) + { + if (this.isLookingAway()) + { + this.movePosition = this.stalkTarget(); + if (this.movePosition != null) + { + this.theEntity.getNavigator().tryMoveToXYZ(this.movePosition.xCoord, this.movePosition.yCoord, this.movePosition.zCoord, 1.0D); + this.overRide = false; + } + else + { + this.tick = 100; + } + + } + else if (this.theEntity.canSee(targetEntity)) + { + this.movePosition = this.hideFromTarget(); + if (this.movePosition != null) + { + this.theEntity.getNavigator().tryMoveToXYZ(this.movePosition.xCoord, this.movePosition.yCoord, this.movePosition.zCoord, 1.33D); + this.overRide = false; + } + else + { + this.tick = 100; + } + } + } + + if (this.delay > 0) this.delay--; + + if (!this.isLookingAway() && this.theEntity.canSee(targetEntity) && this.delay == 0) + { + this.overRide = true; + this.delay = 60; + } + + } + + private Vec3 hideFromTarget() + { + Vec3 vec; + for (int i = 1; i <= 8; i++) + { + vec = findSecludedXYZ(i, false); + if (vec != null) { + return vec; + } + } + return null; + } + + private Vec3 stalkTarget() + { + Vec3 vec; + for (int i = 8; i >= 1; i--) + { + vec = findSecludedXYZ(i, true); + if (vec != null) { + return vec; + } + } + return null; + } + + private Vec3 findSecludedXYZ(int radius, boolean nearest) + { + Vec3 idealPos = null; + boolean weight; + double dist = this.targetEntity.getDistanceSqToEntity(this.theEntity); + double u = 0, v = 0, w = 0; + + if (this.movePosition != null) + { + u = this.movePosition.xCoord; + v = this.movePosition.yCoord; + w = this.movePosition.zCoord; + } + + for (int y = -2; y <= 2; y++) + { + for (int x = -radius; x <= radius; x++) + { + for (int z = -radius; z <= radius; z++) + { + double j = MathHelper.floor_double(this.theEntity.posX + x) + 0.5D; + double k = MathHelper.floor_double(this.theEntity.boundingBox.minY + y); + double l = MathHelper.floor_double(this.theEntity.posZ + z) + 0.5D; + + if (this.theWorld.getBlock((int)j, (int)k, (int)l).isOpaqueCube() && !this.theWorld.getBlock((int)j, (int)k + 1, (int)l).isOpaqueCube() && !this.theWorld.getBlock((int)j, (int)k + 2, (int)l).isOpaqueCube()) + { + Vec3 vec1 = Vec3.createVectorHelper(this.targetEntity.posX, this.targetEntity.posY + (double)this.targetEntity.getEyeHeight(), this.targetEntity.posZ); + Vec3 vec2 = Vec3.createVectorHelper(j, k + (double)this.theEntity.getEyeHeight(), l); + MovingObjectPosition movingobjectposition = this.theWorld.rayTraceBlocks(vec1, vec2); + if (movingobjectposition != null) + { + weight = nearest ? this.targetEntity.getDistanceSq(j, k, l) <= dist : true; + if (weight && (j != u || k != v || l != w)) + { + idealPos = Vec3.createVectorHelper(j, k, l); + if (nearest) dist = this.targetEntity.getDistanceSq(j, k, l); + } + } + } + } + } + } + return idealPos; + } + + private boolean isLookingAway() + { + Vec3 vec3 = this.targetEntity.getLook(1.0F).normalize(); + Vec3 vec31 = Vec3.createVectorHelper(this.theEntity.posX - this.targetEntity.posX, this.theEntity.boundingBox.minY + (double)(this.theEntity.height / 2.0F) - (this.targetEntity.posY + (double)this.targetEntity.getEyeHeight()), this.theEntity.posZ - this.targetEntity.posZ); + double d0 = vec31.lengthVector(); + vec31 = vec31.normalize(); + double d1 = vec3.dotProduct(vec31); + return d1 < 0.6; + } +} \ No newline at end of file diff --git a/src/main/java/noppes/npcs/ai/EntityAITransform.java b/src/main/java/noppes/npcs/ai/EntityAITransform.java new file mode 100644 index 000000000..71af3232e --- /dev/null +++ b/src/main/java/noppes/npcs/ai/EntityAITransform.java @@ -0,0 +1,31 @@ +package noppes.npcs.ai; + +import net.minecraft.entity.ai.EntityAIBase; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.NoppesStringUtils; +import noppes.npcs.NoppesUtilServer; +import noppes.npcs.Server; +import noppes.npcs.constants.AiMutex; +import noppes.npcs.constants.EnumPacketClient; +import noppes.npcs.entity.EntityNPCInterface; + +public class EntityAITransform extends EntityAIBase { + + private EntityNPCInterface npc; + public EntityAITransform(EntityNPCInterface npc){ + this.npc = npc; + setMutexBits(AiMutex.PASSIVE); + } + + @Override + public boolean shouldExecute() { + if(npc.isKilled() || npc.isAttacking() || npc.transform.editingModus) + return false; + + return npc.worldObj.getWorldTime() % 24000 < 12000?npc.transform.isActive:!npc.transform.isActive; + } + + public void startExecuting(){ + npc.transform.transform(!npc.transform.isActive); + } +} diff --git a/src/main/java/noppes/npcs/ai/EntityAIWander.java b/src/main/java/noppes/npcs/ai/EntityAIWander.java new file mode 100644 index 000000000..f43cec6d1 --- /dev/null +++ b/src/main/java/noppes/npcs/ai/EntityAIWander.java @@ -0,0 +1,127 @@ +package noppes.npcs.ai; + +import java.util.Iterator; +import java.util.List; + +import net.minecraft.command.IEntitySelector; +import net.minecraft.entity.ai.EntityAIBase; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; +import noppes.npcs.CustomNpcs; +import noppes.npcs.ai.selector.NPCInteractSelector; +import noppes.npcs.constants.AiMutex; +import noppes.npcs.controllers.Line; +import noppes.npcs.entity.EntityNPCInterface; + +public class EntityAIWander extends EntityAIBase +{ + private EntityNPCInterface entity; + public final IEntitySelector selector; + private double xPosition; + private double yPosition; + private double zPosition; + private EntityNPCInterface nearbyNPC; + + public EntityAIWander(EntityNPCInterface npc){ + this.entity = npc; + this.setMutexBits(AiMutex.PASSIVE); + selector = new NPCInteractSelector(npc); + } + + @Override + public boolean shouldExecute(){ + if (this.entity.getAge() >= 100 || !entity.getNavigator().noPath() || entity.isInteracting() || this.entity.getRNG().nextInt(80) != 0){ + return false; + } + if(entity.ai.npcInteracting && entity.getRNG().nextInt(4) == 1) + nearbyNPC = getNearbyNPC(); + + if(nearbyNPC != null){ + this.xPosition = MathHelper.floor_double(nearbyNPC.posX); + this.yPosition = MathHelper.floor_double(nearbyNPC.posY); + this.zPosition = MathHelper.floor_double(nearbyNPC.posZ); + nearbyNPC.addInteract(entity); + } + else{ + Vec3 vec = getVec(); + if (vec == null){ + return false; + } + else{ + this.xPosition = vec.xCoord; + this.yPosition = vec.yCoord; + this.zPosition = vec.zCoord; + } + } + return true; + } + + @Override + public void updateTask() { + if(nearbyNPC != null){ + nearbyNPC.getNavigator().clearPathEntity(); + } + } + private EntityNPCInterface getNearbyNPC() { + List list = entity.worldObj.getEntitiesWithinAABBExcludingEntity(entity, entity.boundingBox.expand(entity.ai.walkingRange, entity.ai.walkingRange > 7?7:entity.ai.walkingRange, entity.ai.walkingRange), selector); + Iterator ita = list.iterator(); + while(ita.hasNext()){ + EntityNPCInterface npc = ita.next(); + if(!npc.ai.stopAndInteract || npc.isAttacking() || !npc.isEntityAlive() || entity.faction.isAggressiveToNpc(npc)) + ita.remove(); + } + + if(list.isEmpty()) + return null; + + return list.get(entity.getRNG().nextInt(list.size())); + } + + private Vec3 getVec(){ + if(entity.ai.walkingRange > 0){ + double distance = this.entity.getDistanceSq(this.entity.getStartXPos(), this.entity.getStartYPos(), this.entity.getStartZPos()); + int range = (int) MathHelper.sqrt_double(this.entity.ai.walkingRange * this.entity.ai.walkingRange - distance); + if(range > CustomNpcs.NpcNavRange) + range = CustomNpcs.NpcNavRange; + if(range < 3){ + range = this.entity.ai.walkingRange; + if(range > CustomNpcs.NpcNavRange) + range = CustomNpcs.NpcNavRange; + Vec3 start = Vec3.createVectorHelper(this.entity.getStartXPos(), this.entity.getStartYPos(), this.entity.getStartZPos()); + return RandomPositionGeneratorAlt.findRandomTargetBlockTowards(this.entity, range / 2, range / 2 > 7?7:range / 2, start); + } + else{ + return RandomPositionGeneratorAlt.findRandomTarget(this.entity, range, range / 2 > 7?7:range / 2); + } + } + return RandomPositionGeneratorAlt.findRandomTarget(this.entity, CustomNpcs.NpcNavRange, 7); + } + + @Override + public boolean continueExecuting(){ + if(nearbyNPC != null && (!selector.isEntityApplicable(nearbyNPC) || entity.getDistanceSqToEntity(nearbyNPC) < entity.width * 1.5)) + return false; + return !this.entity.getNavigator().noPath() && this.entity.isEntityAlive() && !entity.isInteracting(); + } + + @Override + public void startExecuting(){ + this.entity.getNavigator().tryMoveToXYZ(this.xPosition, this.yPosition, this.zPosition, 1); + } + + @Override + public void resetTask() { + if(nearbyNPC != null && entity.getDistanceSqToEntity(nearbyNPC) < 12){ + Line line = new Line("........."); + line.hideText = true; + if(entity.getRNG().nextBoolean()) + entity.saySurrounding(line); + else + nearbyNPC.saySurrounding(line); + + entity.addInteract(nearbyNPC); + nearbyNPC.addInteract(entity); + } + nearbyNPC = null; + } +} diff --git a/src/main/java/noppes/npcs/ai/EntityAIWatchClosest.java b/src/main/java/noppes/npcs/ai/EntityAIWatchClosest.java new file mode 100644 index 000000000..ae83cd1fc --- /dev/null +++ b/src/main/java/noppes/npcs/ai/EntityAIWatchClosest.java @@ -0,0 +1,95 @@ +package noppes.npcs.ai; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.ai.EntityAIBase; +import net.minecraft.entity.player.EntityPlayer; +import noppes.npcs.constants.AiMutex; +import noppes.npcs.entity.EntityNPCInterface; + +public class EntityAIWatchClosest extends EntityAIBase +{ + private EntityNPCInterface theWatcher; + + /** The closest entity which is being watched by this one. */ + protected Entity closestEntity; + private float field_75333_c; + private int lookTime; + private float field_75331_e; + private Class watchedClass; + + public EntityAIWatchClosest(EntityNPCInterface par1EntityLiving, Class par2Class, float par3){ + this.theWatcher = par1EntityLiving; + this.watchedClass = par2Class; + this.field_75333_c = par3; + this.field_75331_e = 0.002F; + this.setMutexBits(AiMutex.LOOK); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + @Override + public boolean shouldExecute(){ + if (this.theWatcher.getRNG().nextFloat() >= this.field_75331_e || theWatcher.isInteracting()){ + return false; + } + else{ + if (this.theWatcher.getAttackTarget() != null) + { + this.closestEntity = this.theWatcher.getAttackTarget(); + } + + if (this.watchedClass == EntityPlayer.class) + { + this.closestEntity = this.theWatcher.worldObj.getClosestPlayerToEntity(this.theWatcher, (double)this.field_75333_c); + } + else + { + this.closestEntity = this.theWatcher.worldObj.findNearestEntityWithinAABB(this.watchedClass, this.theWatcher.boundingBox.expand((double)this.field_75333_c, 3.0D, (double)this.field_75333_c), this.theWatcher); + if (this.closestEntity != null) + { + return this.theWatcher.canSee(this.closestEntity); + } + } + + return this.closestEntity != null; + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + @Override + public boolean continueExecuting() + { + if(theWatcher.isInteracting() || theWatcher.isAttacking() || !this.closestEntity.isEntityAlive() || !theWatcher.isEntityAlive()) + return false; + return this.theWatcher.getDistanceSqToEntity(this.closestEntity) > (double)(this.field_75333_c * this.field_75333_c) ? false : this.lookTime > 0; + } + + /** + * Execute a one shot task or start executing a continuous task + */ + @Override + public void startExecuting(){ + this.lookTime = 60 + this.theWatcher.getRNG().nextInt(60); + } + + /** + * Resets the task + */ + @Override + public void resetTask(){ + this.closestEntity = null; + } + + /** + * Updates the task + */ + @Override + public void updateTask() + { + this.theWatcher.getLookHelper().setLookPosition(this.closestEntity.posX, this.closestEntity.posY + (double)this.closestEntity.getEyeHeight(), this.closestEntity.posZ, 10.0F, (float)this.theWatcher.getVerticalFaceSpeed()); + --this.lookTime; + } +} diff --git a/src/main/java/noppes/npcs/ai/EntityAIWaterNav.java b/src/main/java/noppes/npcs/ai/EntityAIWaterNav.java new file mode 100644 index 000000000..42e34b43e --- /dev/null +++ b/src/main/java/noppes/npcs/ai/EntityAIWaterNav.java @@ -0,0 +1,46 @@ +package noppes.npcs.ai; + +import net.minecraft.entity.ai.EntityAIBase; +import noppes.npcs.entity.EntityNPCInterface; + +public class EntityAIWaterNav extends EntityAIBase +{ + private EntityNPCInterface theEntity; + + public EntityAIWaterNav(EntityNPCInterface par1EntityNPCInterface) + { + this.theEntity = par1EntityNPCInterface; + par1EntityNPCInterface.getNavigator().setCanSwim(true); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (this.theEntity.isInWater() || this.theEntity.handleLavaMovement()) + { + if (this.theEntity.ai.canSwim) + { + return true; + } + else if (this.theEntity.isCollidedHorizontally) + { + return true; + } + + } + return false; + } + + /** + * Updates the task + */ + public void updateTask() + { + if (this.theEntity.getRNG().nextFloat() < 0.8F) + { + this.theEntity.getJumpHelper().setJumping(); + } + } +} diff --git a/src/main/java/noppes/npcs/ai/EntityAIWorldLines.java b/src/main/java/noppes/npcs/ai/EntityAIWorldLines.java new file mode 100644 index 000000000..7b6b5e132 --- /dev/null +++ b/src/main/java/noppes/npcs/ai/EntityAIWorldLines.java @@ -0,0 +1,25 @@ +package noppes.npcs.ai; + +import net.minecraft.entity.ai.EntityAIBase; +import noppes.npcs.constants.AiMutex; +import noppes.npcs.entity.EntityNPCInterface; + +public class EntityAIWorldLines extends EntityAIBase { + + private EntityNPCInterface npc; + public EntityAIWorldLines(EntityNPCInterface npc){ + this.npc = npc; + this.setMutexBits(AiMutex.PASSIVE); + } + + @Override + public boolean shouldExecute() { + return !npc.isAttacking() && !npc.isKilled() && npc.advanced.hasWorldLines() && npc.getRNG().nextInt(1900) == 1; + } + + public void startExecuting() + { + npc.saySurrounding(npc.advanced.getWorldLine()); + } + +} diff --git a/src/main/java/noppes/npcs/ai/EntityAIZigZagTarget.java b/src/main/java/noppes/npcs/ai/EntityAIZigZagTarget.java new file mode 100644 index 000000000..6636ce80e --- /dev/null +++ b/src/main/java/noppes/npcs/ai/EntityAIZigZagTarget.java @@ -0,0 +1,104 @@ +package noppes.npcs.ai; + +import net.minecraft.entity.EntityCreature; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.ai.EntityAIBase; +import net.minecraft.entity.ai.RandomPositionGenerator; +import net.minecraft.pathfinding.PathEntity; +import net.minecraft.pathfinding.PathPoint; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; +import noppes.npcs.constants.AiMutex; + +public class EntityAIZigZagTarget extends EntityAIBase +{ + private EntityCreature theEntity; + private EntityLivingBase targetEntity; + private double movePosX; + private double movePosY; + private double movePosZ; + private int entityPosX; + private int entityPosY; + private int entityPosZ; + private double field_75425_f; + private float field_75426_g; + + public EntityAIZigZagTarget(EntityCreature par1EntityCreature, double par2, float par4) + { + this.theEntity = par1EntityCreature; + this.field_75425_f = par2; + this.field_75426_g = par4; + this.setMutexBits(AiMutex.PASSIVE + AiMutex.LOOK); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + this.targetEntity = this.theEntity.getAttackTarget(); + + if (this.targetEntity == null) + { + return false; + } + else if (this.targetEntity.getDistanceSqToEntity(this.theEntity) < (double)(this.field_75426_g * this.field_75426_g)) + { + return false; + } + else + { + PathEntity pathentity = this.theEntity.getNavigator().getPathToEntityLiving(targetEntity); + + if (pathentity != null) + { + if (pathentity.getCurrentPathLength() >= this.field_75426_g) + { + PathPoint pathpoint = pathentity.getPathPointFromIndex(MathHelper.floor_double(this.field_75426_g / 2.0D)); + this.entityPosX = pathpoint.xCoord; + this.entityPosY = pathpoint.yCoord; + this.entityPosZ = pathpoint.zCoord; + + Vec3 vec3 = RandomPositionGeneratorAlt.findRandomTargetBlockTowards(this.theEntity, (int)field_75426_g, 3, Vec3.createVectorHelper(this.entityPosX, this.entityPosY, this.entityPosZ)); + + if (vec3 != null) + { + if (this.targetEntity.getDistanceSq(vec3.xCoord, vec3.yCoord, vec3.zCoord) < this.targetEntity.getDistanceSq(entityPosX, entityPosY, entityPosZ)) +// if (this.theEntity.getDistanceSq(vec3.xCoord, vec3.yCoord, vec3.zCoord) > field_75426_g * field_75426_g && this.targetEntity.getDistanceSq(vec3.xCoord, vec3.yCoord, vec3.zCoord) < this.targetEntity.getDistanceSq(entityPosX, entityPosY, entityPosZ)) + { + this.movePosX = vec3.xCoord; + this.movePosY = vec3.yCoord; + this.movePosZ = vec3.zCoord; + return true; + } + } + } + } + } + return false; + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return !this.theEntity.getNavigator().noPath() && this.targetEntity.isEntityAlive() && this.targetEntity.getDistanceSqToEntity(this.theEntity) > (double)(this.field_75426_g * this.field_75426_g); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.theEntity.getNavigator().tryMoveToXYZ(this.movePosX, this.movePosY, this.movePosZ, this.field_75425_f); + } + + /** + * Updates the task + */ + public void updateTask() + { + this.theEntity.getLookHelper().setLookPositionWithEntity(targetEntity, 30.0F, 30.0F); + } +} diff --git a/src/main/java/noppes/npcs/ai/RandomPositionGeneratorAlt.java b/src/main/java/noppes/npcs/ai/RandomPositionGeneratorAlt.java new file mode 100644 index 000000000..44d6668ca --- /dev/null +++ b/src/main/java/noppes/npcs/ai/RandomPositionGeneratorAlt.java @@ -0,0 +1,130 @@ +package noppes.npcs.ai; + +import java.util.Random; +import net.minecraft.entity.EntityCreature; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; + +public class RandomPositionGeneratorAlt +{ + /** + * used to store a driection when the user passes a point to move towards or away from. WARNING: NEVER THREAD SAFE. + * MULTIPLE findTowards and findAway calls, will share this var + */ + private static Vec3 staticVector = Vec3.createVectorHelper(0.0D, 0.0D, 0.0D); + + /** + * finds a random target within par1(x,z) and par2 (y) blocks + */ + public static Vec3 findRandomTarget(EntityCreature par0EntityCreature, int par1, int par2) + { + /** + * searches 10 blocks at random in a within par1(x,z) and par2 (y) distance, ignores those not in the direction + * of par3Vec3, then points to the tile for which creature.getBlockPathWeight returns the highest number + */ + return findRandomTargetBlock(par0EntityCreature, par1, par2, (Vec3)null); + } + + /** + * finds a random target within par1(x,z) and par2 (y) blocks in the direction of the point par3 + */ + public static Vec3 findRandomTargetBlockTowards(EntityCreature par0EntityCreature, int par1, int par2, Vec3 par3Vec3) + { + staticVector.xCoord = par3Vec3.xCoord - par0EntityCreature.posX; + staticVector.yCoord = par3Vec3.yCoord - par0EntityCreature.posY; + staticVector.zCoord = par3Vec3.zCoord - par0EntityCreature.posZ; + /** + * searches 10 blocks at random in a within par1(x,z) and par2 (y) distance, ignores those not in the direction + * of par3Vec3, then points to the tile for which creature.getBlockPathWeight returns the highest number + */ + return findRandomTargetBlock(par0EntityCreature, par1, par2, staticVector); + } + + /** + * finds a random target within par1(x,z) and par2 (y) blocks in the reverse direction of the point par3 + */ + public static Vec3 findRandomTargetBlockAwayFrom(EntityCreature par0EntityCreature, int par1, int par2, Vec3 par3Vec3) + { + staticVector.xCoord = par0EntityCreature.posX - par3Vec3.xCoord; + staticVector.yCoord = par0EntityCreature.posY - par3Vec3.yCoord; + staticVector.zCoord = par0EntityCreature.posZ - par3Vec3.zCoord; + /** + * searches 10 blocks at random in a within par1(x,z) and par2 (y) distance, ignores those not in the direction + * of par3Vec3, then points to the tile for which creature.getBlockPathWeight returns the highest number + */ + return findRandomTargetBlock(par0EntityCreature, par1, par2, staticVector); + } + + /** + * searches 10 blocks at random in a within par1(x,z) and par2 (y) distance, ignores those not in the direction of + * par3Vec3, then points to the tile for which creature.getBlockPathWeight returns the highest number + */ + private static Vec3 findRandomTargetBlock(EntityCreature par0EntityCreature, int par1, int par2, Vec3 par3Vec3) + { + if(par1 <= 0) + par1 = 1; + if(par2 <= 0) + par2 = 1; + Random random = par0EntityCreature.getRNG(); + boolean flag = false; + int k = 0; + int l = 0; + int i1 = 0; + float f = -99999.0F; + boolean flag1; + + if (par0EntityCreature.hasHome()) + { + double d0 = (double)(par0EntityCreature.getHomePosition().getDistanceSquared(MathHelper.floor_double(par0EntityCreature.posX), MathHelper.floor_double(par0EntityCreature.posY), MathHelper.floor_double(par0EntityCreature.posZ)) + 4.0F); + double d1 = (double)(par0EntityCreature.func_110174_bM() + (float)par1); + flag1 = d0 < d1 * d1; + } + else + { + flag1 = false; + } + + for (int l1 = 0; l1 < 10; ++l1) + { + int j1 = random.nextInt(2 * par1) - par1; + int i2 = random.nextInt(2 * par2) - par2; + int k1 = random.nextInt(2 * par1) - par1; + + if (par3Vec3 == null || (double)j1 * par3Vec3.xCoord + (double)k1 * par3Vec3.zCoord >= 0.0D) + { + if(random.nextBoolean()){ + j1 += MathHelper.floor_double(par0EntityCreature.posX); + i2 += MathHelper.floor_double(par0EntityCreature.posY); + k1 += MathHelper.floor_double(par0EntityCreature.posZ); + } + else{ + j1 += MathHelper.ceiling_double_int(par0EntityCreature.posX); + i2 += MathHelper.ceiling_double_int(par0EntityCreature.posY); + k1 += MathHelper.ceiling_double_int(par0EntityCreature.posZ); + } + if (!flag1 || par0EntityCreature.isWithinHomeDistance(j1, i2, k1)) + { + float f1 = par0EntityCreature.getBlockPathWeight(j1, i2, k1); + + if (f1 > f) + { + f = f1; + k = j1; + l = i2; + i1 = k1; + flag = true; + } + } + } + } + + if (flag) + { + return Vec3.createVectorHelper((double)k, (double)l, (double)i1); + } + else + { + return null; + } + } +} \ No newline at end of file diff --git a/src/main/java/noppes/npcs/ai/selector/NPCAttackSelector.java b/src/main/java/noppes/npcs/ai/selector/NPCAttackSelector.java new file mode 100644 index 000000000..5562d3ab0 --- /dev/null +++ b/src/main/java/noppes/npcs/ai/selector/NPCAttackSelector.java @@ -0,0 +1,83 @@ +package noppes.npcs.ai.selector; + +import java.util.List; + +import net.minecraft.command.IEntitySelector; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.potion.Potion; +import noppes.npcs.CustomNpcs; +import noppes.npcs.constants.EnumCompanionJobs; +import noppes.npcs.constants.EnumJobType; +import noppes.npcs.constants.EnumMovingType; +import noppes.npcs.constants.EnumRoleType; +import noppes.npcs.controllers.PixelmonHelper; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.JobGuard; +import noppes.npcs.roles.RoleCompanion; +import noppes.npcs.roles.companion.CompanionGuard; + +public class NPCAttackSelector implements IEntitySelector +{ + private EntityNPCInterface npc; + + public NPCAttackSelector(EntityNPCInterface npc){ + this.npc = npc; + } + /** + * Return whether the specified entity is applicable to this filter. + */ + @Override + public boolean isEntityApplicable(Entity entity){ + if(!entity.isEntityAlive() || entity == npc || npc.getDistanceToEntity(entity) > npc.stats.aggroRange || !(entity instanceof EntityLivingBase) || ((EntityLivingBase)entity).getHealth() < 1) + return false; + if (this.npc.ai.directLOS && !this.npc.getEntitySenses().canSee(entity)) + return false; + + if(!npc.stats.attackInvisible &&((EntityLivingBase)entity).isPotionActive(Potion.invisibility) && npc.getDistanceSqToEntity(entity) < 9) + return false; + + //prevent the npc from going on an endless killing spree + if(!npc.isFollower() && npc.ai.returnToStart){ + int allowedDistance = npc.stats.aggroRange * 2; + if(npc.ai.movingType == EnumMovingType.Wandering) + allowedDistance += npc.ai.walkingRange; + double distance = entity.getDistanceSq(npc.getStartXPos(), npc.getStartYPos(), npc.getStartZPos()); + if(npc.ai.movingType == EnumMovingType.MovingPath){ + int[] arr = npc.ai.getCurrentMovingPath(); + distance = entity.getDistanceSq(arr[0], arr[1], arr[2]); + } + + if(distance > allowedDistance * allowedDistance) + return false; + } + + if(npc.advanced.job == EnumJobType.Guard && ((JobGuard)npc.jobInterface).isEntityApplicable(entity)) + return true; + + if(npc.advanced.role == EnumRoleType.Companion){ + RoleCompanion role = (RoleCompanion)npc.roleInterface; + if(role.job == EnumCompanionJobs.GUARD && ((CompanionGuard)role.jobInterface).isEntityApplicable(entity)) + return true; + } + if(entity instanceof EntityPlayerMP){ + if(npc.faction.isAggressiveToPlayer((EntityPlayer) entity)){ + if(PixelmonHelper.Enabled && npc.advanced.job == EnumJobType.Spawner) + return PixelmonHelper.canBattle((EntityPlayerMP)entity, npc); + return !((EntityPlayerMP)entity).capabilities.disableDamage; + } + return false; + } + + if(entity instanceof EntityNPCInterface){ + if(((EntityNPCInterface)entity).isKilled()) + return false; + if(npc.advanced.attackOtherFactions) + return npc.faction.isAggressiveToNpc((EntityNPCInterface)entity); + } + + return false; + } +} diff --git a/src/main/java/noppes/npcs/ai/selector/NPCInteractSelector.java b/src/main/java/noppes/npcs/ai/selector/NPCInteractSelector.java new file mode 100644 index 000000000..5b4387b5f --- /dev/null +++ b/src/main/java/noppes/npcs/ai/selector/NPCInteractSelector.java @@ -0,0 +1,22 @@ +package noppes.npcs.ai.selector; + +import net.minecraft.command.IEntitySelector; +import net.minecraft.entity.Entity; +import noppes.npcs.entity.EntityNPCInterface; + +public class NPCInteractSelector implements IEntitySelector { + private EntityNPCInterface npc; + public NPCInteractSelector(EntityNPCInterface npc){ + this.npc = npc; + } + @Override + public boolean isEntityApplicable(Entity entity) { + if(entity == npc || !(entity instanceof EntityNPCInterface) || !npc.isEntityAlive()) + return false; + EntityNPCInterface selected = (EntityNPCInterface) entity; + if(selected.isAttacking() || npc.getFaction().isAggressiveToNpc(selected) || !npc.ai.stopAndInteract) + return false; + return true; + } + +} diff --git a/src/main/java/noppes/npcs/ai/target/EntityAIClearTarget.java b/src/main/java/noppes/npcs/ai/target/EntityAIClearTarget.java new file mode 100644 index 000000000..8ac336592 --- /dev/null +++ b/src/main/java/noppes/npcs/ai/target/EntityAIClearTarget.java @@ -0,0 +1,49 @@ +package noppes.npcs.ai.target; + +import java.util.Collections; +import java.util.List; + +import net.minecraft.command.IEntitySelector; +import net.minecraft.entity.EntityCreature; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.ai.EntityAINearestAttackableTarget; +import net.minecraft.entity.ai.EntityAITarget; +import net.minecraft.entity.monster.EntityMob; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.MathHelper; +import noppes.npcs.entity.EntityNPCInterface; + +public class EntityAIClearTarget extends EntityAITarget +{ + private EntityNPCInterface npc; + private EntityLivingBase target; + public EntityAIClearTarget(EntityNPCInterface npc){ + super(npc, false); + this.npc = npc; + } + + @Override + public boolean shouldExecute(){ + target = taskOwner.getAttackTarget(); + if (target == null) + return false; + + if(target instanceof EntityPlayer && ((EntityPlayer)target).capabilities.disableDamage) + return true; + + int distance = npc.stats.aggroRange * 2 * npc.stats.aggroRange; + if(npc.getOwner() != null && npc.getDistanceSqToEntity(npc.getOwner()) > distance){ + return true; + } + + return npc.getDistanceSqToEntity(target) > distance; + } + + @Override + public void startExecuting(){ + this.taskOwner.setAttackTarget(null); + if(target == taskOwner.getAITarget()) + this.taskOwner.setRevengeTarget(null); + super.startExecuting(); + } +} diff --git a/src/main/java/noppes/npcs/ai/target/EntityAIClosestTarget.java b/src/main/java/noppes/npcs/ai/target/EntityAIClosestTarget.java new file mode 100644 index 000000000..6bf82b4b3 --- /dev/null +++ b/src/main/java/noppes/npcs/ai/target/EntityAIClosestTarget.java @@ -0,0 +1,87 @@ +package noppes.npcs.ai.target; + +import java.util.Collections; +import java.util.List; + +import net.minecraft.command.IEntitySelector; +import net.minecraft.entity.EntityCreature; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.ai.EntityAINearestAttackableTarget; +import net.minecraft.entity.ai.EntityAITarget; +import net.minecraft.entity.monster.EntityMob; +import net.minecraft.util.MathHelper; + +public class EntityAIClosestTarget extends EntityAITarget +{ + private final Class targetClass; + private final int targetChance; + + /** Instance of EntityAINearestAttackableTargetSorter. */ + private final EntityAINearestAttackableTarget.Sorter theNearestAttackableTargetSorter; + private final IEntitySelector field_82643_g; + private EntityLivingBase targetEntity; + + public EntityAIClosestTarget(EntityCreature par1EntityCreature, Class par2Class, int par3, boolean par4) + { + this(par1EntityCreature, par2Class, par3, par4, false); + } + + public EntityAIClosestTarget(EntityCreature par1EntityCreature, Class par2Class, int par3, boolean par4, boolean par5) + { + this(par1EntityCreature, par2Class, par3, par4, par5, (IEntitySelector)null); + } + + public EntityAIClosestTarget(EntityCreature par1EntityCreature, Class par2Class, int par3, boolean par4, boolean par5, IEntitySelector par6IEntitySelector) + { + super(par1EntityCreature, par4, par5); + this.targetClass = par2Class; + this.targetChance = par3; + this.theNearestAttackableTargetSorter = new EntityAINearestAttackableTarget.Sorter(par1EntityCreature); + this.setMutexBits(1); + this.field_82643_g = par6IEntitySelector; + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (this.targetChance > 0 && this.taskOwner.getRNG().nextInt(this.targetChance) != 0) + { + return false; + } + else + { + double d0 = this.getTargetDistance(); + List list = this.taskOwner.worldObj.selectEntitiesWithinAABB(this.targetClass, this.taskOwner.boundingBox.expand(d0, MathHelper.ceiling_double_int(d0 / 2.0D), d0), this.field_82643_g); + Collections.sort(list, this.theNearestAttackableTargetSorter); + + if (list.isEmpty()) + { + return false; + } + else + { + this.targetEntity = (EntityLivingBase)list.get(0); + return true; + } + } + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.taskOwner.setAttackTarget(this.targetEntity); + if (this.targetEntity instanceof EntityMob) + { + if (((EntityMob) this.targetEntity).getAttackTarget() == null) + { + ((EntityMob)this.targetEntity).setAttackTarget(this.taskOwner); + ((EntityMob)this.targetEntity).setTarget(this.taskOwner); + } + } + super.startExecuting(); + } +} diff --git a/src/main/java/noppes/npcs/ai/target/EntityAIOwnerHurtByTarget.java b/src/main/java/noppes/npcs/ai/target/EntityAIOwnerHurtByTarget.java new file mode 100644 index 000000000..5c5fa5a3a --- /dev/null +++ b/src/main/java/noppes/npcs/ai/target/EntityAIOwnerHurtByTarget.java @@ -0,0 +1,55 @@ +package noppes.npcs.ai.target; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.ai.EntityAITarget; +import net.minecraft.entity.passive.EntityTameable; +import noppes.npcs.constants.AiMutex; +import noppes.npcs.entity.EntityNPCInterface; + +public class EntityAIOwnerHurtByTarget extends EntityAITarget +{ + EntityNPCInterface npc; + EntityLivingBase theOwnerAttacker; + private int field_142051_e; + + public EntityAIOwnerHurtByTarget(EntityNPCInterface npc){ + super(npc, false); + this.npc = npc; + this.setMutexBits(AiMutex.PASSIVE); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute(){ + if (!this.npc.isFollower() || !(npc.roleInterface != null && npc.roleInterface.defendOwner())){ + return false; + } + else{ + EntityLivingBase entitylivingbase = this.npc.getOwner(); + + if (entitylivingbase == null){ + return false; + } + else{ + this.theOwnerAttacker = entitylivingbase.getAITarget(); + int i = entitylivingbase.func_142015_aE(); + return i != this.field_142051_e && this.isSuitableTarget(this.theOwnerAttacker, false); + } + } + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting(){ + this.taskOwner.setAttackTarget(this.theOwnerAttacker); + EntityLivingBase entitylivingbase = this.npc.getOwner(); + + if (entitylivingbase != null){ + this.field_142051_e = entitylivingbase.func_142015_aE(); + } + + super.startExecuting(); + } +} \ No newline at end of file diff --git a/src/main/java/noppes/npcs/ai/target/EntityAIOwnerHurtTarget.java b/src/main/java/noppes/npcs/ai/target/EntityAIOwnerHurtTarget.java new file mode 100644 index 000000000..63d11e71c --- /dev/null +++ b/src/main/java/noppes/npcs/ai/target/EntityAIOwnerHurtTarget.java @@ -0,0 +1,63 @@ +package noppes.npcs.ai.target; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.ai.EntityAITarget; +import net.minecraft.entity.passive.EntityTameable; +import noppes.npcs.constants.AiMutex; +import noppes.npcs.entity.EntityNPCInterface; + +public class EntityAIOwnerHurtTarget extends EntityAITarget +{ + EntityNPCInterface npc; + EntityLivingBase theTarget; + private int field_142050_e; + + public EntityAIOwnerHurtTarget(EntityNPCInterface npc) + { + super(npc, false); + this.npc = npc; + this.setMutexBits(AiMutex.PASSIVE); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (!this.npc.isFollower() || !(npc.roleInterface != null && npc.roleInterface.defendOwner())) + { + return false; + } + else + { + EntityLivingBase entitylivingbase = this.npc.getOwner(); + + if (entitylivingbase == null) + { + return false; + } + else + { + this.theTarget = entitylivingbase.getLastAttacker(); + int i = entitylivingbase.getLastAttackerTime(); + return i != this.field_142050_e && this.isSuitableTarget(this.theTarget, false); + } + } + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.taskOwner.setAttackTarget(this.theTarget); + EntityLivingBase entitylivingbase = this.npc.getOwner(); + + if (entitylivingbase != null) + { + this.field_142050_e = entitylivingbase.getLastAttackerTime(); + } + + super.startExecuting(); + } +} \ No newline at end of file diff --git a/src/main/java/noppes/npcs/blocks/BlockBanner.java b/src/main/java/noppes/npcs/blocks/BlockBanner.java new file mode 100644 index 000000000..377e5f42d --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/BlockBanner.java @@ -0,0 +1,157 @@ +package noppes.npcs.blocks; + +import java.util.List; + +import net.minecraft.block.BlockColored; +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.IIcon; +import net.minecraft.util.MathHelper; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import noppes.npcs.NoppesUtilServer; +import noppes.npcs.blocks.tiles.TileBanner; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class BlockBanner extends BlockContainer{ + + public int renderId = -1; + + public BlockBanner() { + super(Material.rock); + setBlockBounds(0, 0, 0, 1, 2, 1); + } + @Override + public boolean onBlockActivated(World par1World, int i, int j, int k, EntityPlayer player, int par6, float par7, float par8, float par9){ + ItemStack item = player.inventory.getCurrentItem(); + if(item == null) + return false; + int meta = par1World.getBlockMetadata(i, j, k); + if(meta >= 7) + j--; + TileBanner tile = (TileBanner) par1World.getTileEntity(i, j, k); + if(tile.canEdit()) + return true; + else if(item.getItem() != Items.dye) + return false; + + int color = BlockColored.func_150031_c(item.getItemDamage()); + if(tile.color != color){ + NoppesUtilServer.consumeItemStack(1, player); + tile.color = color; + par1World.markBlockForUpdate(i, j, k); + } + return true; + } + @Override + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List){ + par3List.add(new ItemStack(par1, 1, 0)); + par3List.add(new ItemStack(par1, 1, 1)); + par3List.add(new ItemStack(par1, 1, 2)); + par3List.add(new ItemStack(par1, 1, 3)); + par3List.add(new ItemStack(par1, 1, 4)); + } + + @Override + public int damageDropped(int par1) + { + return par1 % 7; + } + + @Override + public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z){ + int meta = world.getBlockMetadata(x, y, z); + if(meta >= 7) + setBlockBounds(0, -1, 0, 1, 1, 1); + else + setBlockBounds(0, 0, 0, 1, 2, 1); + } + + @Override + public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) + { + if(!par1World.isAirBlock(par2, par3 + 1, par4)){ + par1World.setBlockToAir(par2, par3, par4); + } + else{ + + int l = MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + l %= 4; + + TileBanner tile = (TileBanner) par1World.getTileEntity(par2, par3, par4); + tile.rotation = l; + tile.color = 15 - par6ItemStack.getItemDamage(); + tile.time = System.currentTimeMillis(); + + par1World.setBlockMetadataWithNotify(par2, par3, par4, par6ItemStack.getItemDamage() , 2); + par1World.setBlock(par2, par3 + 1, par4, this, par6ItemStack.getItemDamage() + 7, 2); + + if(par5EntityLivingBase instanceof EntityPlayer && par1World.isRemote) + ((EntityPlayer)par5EntityLivingBase).addChatComponentMessage(new ChatComponentTranslation("availability.editIcon")); + } + } + + @Override + public boolean isOpaqueCube(){ + return false; + } + + @Override + public boolean renderAsNormalBlock(){ + return false; + } + @Override + public int getRenderType(){ + return renderId; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister par1IconRegister) + { + + } + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int p_149691_1_, int meta) + { + meta %= 7; + if(meta == 1) + return Blocks.stone.getIcon(p_149691_1_, 0); + else if(meta == 2) + return Blocks.iron_block.getIcon(p_149691_1_, 0); + else if(meta == 3) + return Blocks.gold_block.getIcon(p_149691_1_, 0); + else if(meta == 4) + return Blocks.diamond_block.getIcon(p_149691_1_, 0); + return Blocks.planks.getIcon(p_149691_1_, 0); + } + + @Override + public TileEntity createNewTileEntity(World var1, int var2) { + if(var2 < 7) + return new TileBanner(); + return null; + } + + @Override + public void onBlockHarvested(World p_149681_1_, int p_149681_2_, int p_149681_3_, int p_149681_4_, int p_149681_5_, EntityPlayer p_149681_6_) + { + if (p_149681_5_ >= 7 && p_149681_1_.getBlock(p_149681_2_, p_149681_3_ - 1, p_149681_4_) == this) + p_149681_1_.setBlockToAir(p_149681_2_, p_149681_3_ - 1, p_149681_4_); + + else if (p_149681_5_ < 7 && p_149681_1_.getBlock(p_149681_2_, p_149681_3_ + 1, p_149681_4_) == this) + p_149681_1_.setBlockToAir(p_149681_2_, p_149681_3_ + 1, p_149681_4_); + } +} diff --git a/src/main/java/noppes/npcs/blocks/BlockBarrel.java b/src/main/java/noppes/npcs/blocks/BlockBarrel.java new file mode 100644 index 000000000..859e342c1 --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/BlockBarrel.java @@ -0,0 +1,76 @@ +package noppes.npcs.blocks; + +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import noppes.npcs.CustomNpcs; +import noppes.npcs.blocks.tiles.TileBarrel; +import noppes.npcs.blocks.tiles.TileNpcContainer; +import noppes.npcs.constants.EnumGuiType; + +public class BlockBarrel extends BlockRotated{ + + public BlockBarrel() { + super(Blocks.planks); + } + + @Override + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List){ + par3List.add(new ItemStack(par1, 1, 0)); + par3List.add(new ItemStack(par1, 1, 1)); + par3List.add(new ItemStack(par1, 1, 2)); + par3List.add(new ItemStack(par1, 1, 3)); + par3List.add(new ItemStack(par1, 1, 4)); + par3List.add(new ItemStack(par1, 1, 5)); + } + + @Override + public int damageDropped(int par1){ + return par1; + } + + public int maxRotation(){ + return 8; + } + + @Override + public boolean onBlockActivated(World par1World, int i, int j, int k, EntityPlayer player, int par6, float par7, float par8, float par9){ + if(par1World.isRemote) + return true; + + par1World.playSoundEffect(i, j + 0.5D, k, "random.chestopen", 0.5F, par1World.rand.nextFloat() * 0.1F + 0.9F); + player.openGui(CustomNpcs.instance, EnumGuiType.Crate.ordinal(), par1World, i, j, k); + return true; + } + + + @Override + public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack){ + super.onBlockPlacedBy(par1World, par2, par3, par4, par5EntityLivingBase, par6ItemStack); + + par1World.setBlockMetadataWithNotify(par2, par3, par4, par6ItemStack.getItemDamage() , 2); + } + + @Override + public TileEntity createNewTileEntity(World var1, int var2) { + return new TileBarrel(); + } + @Override + public void breakBlock(World world, int x, int y, int z, Block block, int p_149749_6_){ + TileNpcContainer tile = (TileNpcContainer)world.getTileEntity(x, y, z); + if (tile == null) + return; + tile.dropItems(world, x, y, z); + + world.func_147453_f(x, y, z, block); + super.breakBlock(world, x, y, z, block, p_149749_6_); + } +} diff --git a/src/main/java/noppes/npcs/blocks/BlockBeam.java b/src/main/java/noppes/npcs/blocks/BlockBeam.java new file mode 100644 index 000000000..77ba6fc8a --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/BlockBeam.java @@ -0,0 +1,70 @@ +package noppes.npcs.blocks; + +import java.util.List; + +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import noppes.npcs.blocks.tiles.TileBeam; +import noppes.npcs.blocks.tiles.TileColorable; + +public class BlockBeam extends BlockRotated{ + + public BlockBeam() { + super(Blocks.planks); + } + + @Override + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List){ + par3List.add(new ItemStack(par1, 1, 0)); + par3List.add(new ItemStack(par1, 1, 1)); + par3List.add(new ItemStack(par1, 1, 2)); + par3List.add(new ItemStack(par1, 1, 3)); + par3List.add(new ItemStack(par1, 1, 4)); + par3List.add(new ItemStack(par1, 1, 5)); + } + + @Override + public int damageDropped(int par1){ + return par1; + } + @Override + public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z){ + TileEntity tileentity = world.getTileEntity(x, y, z); + if(!(tileentity instanceof TileColorable)){ + super.setBlockBoundsBasedOnState(world, x, y, z); + return; + } + TileColorable tile = (TileColorable) tileentity; + if(tile.rotation == 0){ + setBlockBounds(0.33f, 0.33f, 0.25f, 0.67f, 0.67f, 1f ); + } + else if(tile.rotation == 2){ + setBlockBounds(0.33f, 0.33f, 0, 0.67f, 0.67f, 0.75f ); + } + else if(tile.rotation == 3){ + setBlockBounds(0.25f, 0.33f, 0.33f, 1f, 0.67f, 0.67f ); + } + else if(tile.rotation == 1){ + setBlockBounds(0, 0.33f, 0.33f, 0.75f, 0.67f, 0.67f ); + } + } + + @Override + public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack){ + super.onBlockPlacedBy(par1World, par2, par3, par4, par5EntityLivingBase, par6ItemStack); + par1World.setBlockMetadataWithNotify(par2, par3, par4, par6ItemStack.getItemDamage() , 2); + } + + + @Override + public TileEntity createNewTileEntity(World var1, int var2) { + return new TileBeam(); + } + +} diff --git a/src/main/java/noppes/npcs/blocks/BlockBigSign.java b/src/main/java/noppes/npcs/blocks/BlockBigSign.java new file mode 100644 index 000000000..406911f73 --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/BlockBigSign.java @@ -0,0 +1,130 @@ +package noppes.npcs.blocks; + +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.IIcon; +import net.minecraft.util.MathHelper; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import noppes.npcs.CustomItems; +import noppes.npcs.CustomNpcs; +import noppes.npcs.CustomNpcsPermissions; +import noppes.npcs.NoppesUtilServer; +import noppes.npcs.Server; +import noppes.npcs.blocks.tiles.TileBigSign; +import noppes.npcs.blocks.tiles.TileColorable; +import noppes.npcs.constants.EnumGuiType; +import noppes.npcs.constants.EnumPacketClient; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class BlockBigSign extends BlockContainer{ + + public int renderId = -1; + + public BlockBigSign() { + super(Material.wood); + } + + @Override + public int damageDropped(int par1){ + return par1; + } + + public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_){ + return null; + } + @Override + public boolean onBlockActivated(World par1World, int i, int j, int k, EntityPlayer player, int par6, float par7, float par8, float par9){ + if(par1World.isRemote) + return false; + ItemStack currentItem = player.inventory.getCurrentItem(); + if (currentItem != null && currentItem.getItem() == CustomItems.wand && CustomNpcsPermissions.hasPermission(player, CustomNpcsPermissions.EDIT_BLOCKS)) { + TileBigSign tile = (TileBigSign) par1World.getTileEntity(i, j, k); + tile.canEdit = true; + NoppesUtilServer.sendOpenGui(player, EnumGuiType.BigSign, null, i, j, k); + return true; + } + return false; + } + @Override + public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack){ + int l = MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + l %= 4; + + TileBigSign tile = (TileBigSign) par1World.getTileEntity(par2, par3, par4); + tile.rotation = l; + + par1World.setBlockMetadataWithNotify(par2, par3, par4, par6ItemStack.getItemDamage() , 2); + + if(par5EntityLivingBase instanceof EntityPlayer && par1World.isRemote){ + CustomNpcs.proxy.openGui(par2, par3, par4, EnumGuiType.BigSign, (EntityPlayer) par5EntityLivingBase); + } + } + + @Override + public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z){ + TileEntity tileentity = world.getTileEntity(x, y, z); + if(!(tileentity instanceof TileColorable)){ + super.setBlockBoundsBasedOnState(world, x, y, z); + return; + } + TileColorable tile = (TileColorable) tileentity; + int meta = tile.getBlockMetadata(); + float xStart = 0; + float zStart = 0; + float xEnd = 1; + float zEnd = 1; + if(tile.rotation == 0) + zStart = 0.87f; + else if(tile.rotation == 2) + zEnd = 0.13f; + else if(tile.rotation == 3) + xStart = 0.87f; + else if(tile.rotation == 1) + xEnd = 0.13f; + setBlockBounds(xStart, 0, zStart, xEnd, 1, zEnd); + } + + @Override + public boolean isOpaqueCube(){ + return false; + } + + @Override + public boolean renderAsNormalBlock(){ + return false; + } + @Override + public int getRenderType(){ + return renderId; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister par1IconRegister) + { + + } + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int p_149691_1_, int meta) + { + return Blocks.planks.getIcon(p_149691_1_, meta); + } + + @Override + public TileEntity createNewTileEntity(World var1, int var2) { + return new TileBigSign(); + } +} + diff --git a/src/main/java/noppes/npcs/blocks/BlockBlood.java b/src/main/java/noppes/npcs/blocks/BlockBlood.java new file mode 100644 index 000000000..3da0a7ff3 --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/BlockBlood.java @@ -0,0 +1,101 @@ +package noppes.npcs.blocks; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockEnchantmentTable; +import net.minecraft.block.BlockFence; +import net.minecraft.block.BlockFenceGate; +import net.minecraft.block.BlockFurnace; +import net.minecraft.block.BlockGlowstone; +import net.minecraft.block.BlockSapling; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.IIcon; +import net.minecraft.util.MathHelper; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import noppes.npcs.CustomItems; +import cpw.mods.fml.client.registry.RenderingRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class BlockBlood extends Block{ + + @SideOnly(Side.CLIENT) + private IIcon blockIcon2; + @SideOnly(Side.CLIENT) + private IIcon blockIcon3; + + private final int renderId = RenderingRegistry.getNextAvailableRenderId(); + + public BlockBlood(){ + super(Material.rock); + this.setBlockUnbreakable(); + setCreativeTab(CustomItems.tabMisc); + setBlockBounds(0.01f, 0.01f, 0.01f, 0.99f, 0.99f, 0.99f); + this.setLightLevel(0.08f); + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int metadata){ + metadata += side; + if(metadata % 3 == 1) + return blockIcon2; + if(metadata % 3 == 2) + return blockIcon3; + return this.blockIcon; + } + + @Override + public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k){ + return null; + } + + @Override + public AxisAlignedBB getSelectedBoundingBoxFromPool(World par1World, int par2, int par3, int par4){ + return AxisAlignedBB.getBoundingBox(par2, par3, par4 , par2, par3, par4 ); + } + + @Override + public boolean renderAsNormalBlock(){ + return false; + } + + @SideOnly(Side.CLIENT) + @Override + public void registerBlockIcons(IIconRegister par1IconRegister){ + this.blockIcon = par1IconRegister.registerIcon(this.getTextureName()); + this.blockIcon2 = par1IconRegister.registerIcon(getTextureName() + "2"); + this.blockIcon3 = par1IconRegister.registerIcon(getTextureName() + "3"); + } + + @Override + public boolean shouldSideBeRendered(IBlockAccess world, int par2, int par3, int par4, int par5){ + Block block = world.getBlock(par2, par3, par4); + return block != Blocks.air && block.renderAsNormalBlock(); //only render the side if a block is adjacent + } + + @Override + public boolean isOpaqueCube(){ + return false; + } + + @Override + public int getRenderBlockPass(){ + return 1; + } + + @Override + public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLiving, ItemStack item){ + int var6 = MathHelper.floor_double((double)(par5EntityLiving.rotationYaw / 90.0F) + 0.5D) & 3; + par1World.setBlockMetadataWithNotify(par2, par3, par4, var6, 2); //add metadata based on player rotation + } + + public int getRenderType(){ + return renderId; + } +} diff --git a/src/main/java/noppes/npcs/blocks/BlockBook.java b/src/main/java/noppes/npcs/blocks/BlockBook.java new file mode 100644 index 000000000..f9b8b1bba --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/BlockBook.java @@ -0,0 +1,48 @@ +package noppes.npcs.blocks; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import noppes.npcs.CustomItems; +import noppes.npcs.CustomNpcsPermissions; +import noppes.npcs.Server; +import noppes.npcs.blocks.tiles.TileBook; +import noppes.npcs.constants.EnumPacketClient; + +public class BlockBook extends BlockRotated{ + + public BlockBook() { + super(Blocks.planks); + setBlockBounds(0, 0, 0, 1, 0.2f, 1); + } + + @Override + public boolean onBlockActivated(World par1World, int i, int j, int k, EntityPlayer player, int par6, float par7, float par8, float par9){ + if(par1World.isRemote) + return true; + TileEntity tile = par1World.getTileEntity(i, j, k); + if(!(tile instanceof TileBook)) + return false; + ItemStack currentItem = player.inventory.getCurrentItem(); + if (currentItem != null && currentItem.getItem() == CustomItems.wand && CustomNpcsPermissions.hasPermission(player, CustomNpcsPermissions.EDIT_BLOCKS)) { + ((TileBook)tile).book.func_150996_a(Items.writable_book); + } + Server.sendData((EntityPlayerMP)player, EnumPacketClient.OPEN_BOOK, i, j, k, ((TileBook)tile).book.writeToNBT(new NBTTagCompound())); + return true; + } + + @Override + public String getUnlocalizedName(){ + return "item.book"; + } + + @Override + public TileEntity createNewTileEntity(World var1, int var2) { + return new TileBook(); + } +} diff --git a/src/main/java/noppes/npcs/blocks/BlockBorder.java b/src/main/java/noppes/npcs/blocks/BlockBorder.java new file mode 100644 index 000000000..71d5655ec --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/BlockBorder.java @@ -0,0 +1,109 @@ +package noppes.npcs.blocks; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.Block; +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.IIcon; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import noppes.npcs.CustomItems; +import noppes.npcs.CustomNpcs; +import noppes.npcs.Server; +import noppes.npcs.blocks.tiles.TileBorder; +import noppes.npcs.constants.EnumGuiType; +import noppes.npcs.constants.EnumPacketServer; + +public class BlockBorder extends BlockContainer{ + public int renderId = -1; + + public BlockBorder() { + super(Material.rock); + setBlockUnbreakable(); + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int meta) + { + if(side == 1){ + return this.blockIcon; + } + return Blocks.iron_block.getIcon(side, meta); + } + @Override + public boolean onBlockActivated(World par1World, int i, int j, int k, EntityPlayer player, int par6, float par7, float par8, float par9) + { + ItemStack currentItem = player.inventory.getCurrentItem(); + if (currentItem != null && currentItem.getItem() == CustomItems.wand) { + CustomNpcs.proxy.openGui(i, j, k, EnumGuiType.Border, player); + return true; + } + return false; + } + + @Override + public void onBlockPlacedBy(World par1World, int x, int y, int z, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack){ + int l = MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + l %= 4; + + TileBorder tile = (TileBorder) par1World.getTileEntity(x, y, z); + + TileBorder adjacent = getTile(par1World, x - 1, y, z); + if(adjacent == null) + adjacent = getTile(par1World, x, y, z - 1); + if(adjacent == null) + adjacent = getTile(par1World, x, y, z + 1); + if(adjacent == null) + adjacent = getTile(par1World, x + 1, y, z); + + if(adjacent != null){ + NBTTagCompound compound = new NBTTagCompound(); + adjacent.writeExtraNBT(compound); + tile.readExtraNBT(compound); + } + + tile.rotation = l; + + if(par5EntityLivingBase instanceof EntityPlayer && par1World.isRemote){ + CustomNpcs.proxy.openGui(x, y, z, EnumGuiType.Border, (EntityPlayer) par5EntityLivingBase); + } + } + + private TileBorder getTile(World world, int x, int y, int z){ + TileEntity tile = world.getTileEntity(x, y, z); + if(tile != null && tile instanceof TileBorder) + return (TileBorder) tile; + return null; + } + + @Override + public int getRenderType(){ + return renderId; + } + + @Override + public boolean isOpaqueCube(){ + return false; + } + + @Override + public boolean renderAsNormalBlock(){ + return false; + } + + @Override + public TileEntity createNewTileEntity(World var1, int var2) { + return new TileBorder(); + } +} diff --git a/src/main/java/noppes/npcs/blocks/BlockCampfire.java b/src/main/java/noppes/npcs/blocks/BlockCampfire.java new file mode 100644 index 000000000..243dc4282 --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/BlockCampfire.java @@ -0,0 +1,103 @@ +package noppes.npcs.blocks; + +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import noppes.npcs.CustomItems; +import noppes.npcs.CustomNpcs; +import noppes.npcs.NoppesUtilServer; +import noppes.npcs.blocks.tiles.TileCampfire; + +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class BlockCampfire extends BlockLightable{ + + public BlockCampfire(boolean lit) { + super(Blocks.cobblestone, lit); + setBlockBounds(0, 0, 0, 1, 0.5f, 1); + if(lit) + setLightLevel(0.9375F); + } + + @Override + public TileEntity createNewTileEntity(World var1, int var2) { + return new TileCampfire(); + } + + @Override + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){ + ItemStack item = player.inventory.getCurrentItem(); + if(item == null) + return true; + int meta = world.getBlockMetadata(x, y, z); + + if((item.getItem() == Items.flint || item.getItem() == Items.flint_and_steel) && unlitBlock() == this){ + if(world.rand.nextInt(3) == 0 && !world.isRemote) + super.onBlockActivated(world, x, y, z, player, par6, par7, par8, par9); + CustomNpcs.proxy.spawnParticle("largesmoke", x + 0.5f, y + 0.5f, z + 0.5f, 0.0D, 0.0D, 0.0D, 2); + if(item.getItem() == Items.flint) + NoppesUtilServer.consumeItemStack(1, player); + else + item.damageItem(1, player); + return true; + } + + if(item.getItem() == Item.getItemFromBlock(Blocks.sand) && litBlock() == this){ + super.onBlockActivated(world, x, y, z, player, par6, par7, par8, par9); + } + + return true; + } + + @Override + public int maxRotation(){ + return 8; + } + + @Override + @SideOnly(Side.CLIENT) + public void randomDisplayTick(World world, int x, int y, int z, Random random){ + int meta = world.getBlockMetadata(x, y, z); + if(meta == 1) + return; + + if(random.nextInt(36) == 0){ + world.playSound(x + 0.5F, y + 0.5F, z + 0.5F, "fire.fire", 1.0F + random.nextFloat(), 0.3F + random.nextFloat() * 0.7f , false); + } + + TileCampfire tile = (TileCampfire) world.getTileEntity(x, y, z); + + float xOffset = 0.5f, yOffset = 0.7f, zOffset = 0.5f; + + double d0 = (double)((float)x + xOffset); + double d1 = (double)((float)y + yOffset); + double d2 = (double)((float)z + zOffset); + + GL11.glPushMatrix(); + + CustomNpcs.proxy.spawnParticle("largesmoke", d0, d1, d2, 0.0D, 0.0D, 0.0D, 2); + CustomNpcs.proxy.spawnParticle("flame", d0, d1, d2, 0.0D, 0.0D, 0.0D, 4); + + GL11.glPopMatrix(); + } + + @Override + public Block unlitBlock() { + return CustomItems.campfire_unlit; + } + + @Override + public Block litBlock() { + return CustomItems.campfire; + } +} diff --git a/src/main/java/noppes/npcs/blocks/BlockCandle.java b/src/main/java/noppes/npcs/blocks/BlockCandle.java new file mode 100644 index 000000000..63f77b17b --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/BlockCandle.java @@ -0,0 +1,163 @@ +package noppes.npcs.blocks; + +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import noppes.npcs.CustomItems; +import noppes.npcs.blocks.tiles.TileCandle; +import noppes.npcs.blocks.tiles.TileColorable; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class BlockCandle extends BlockLightable{ + + public BlockCandle(boolean lit) { + super(Blocks.planks, lit); + setBlockBounds(0.3f, 0, 0.3f, 0.7f, 0.5f, 0.7f); + } + + @Override + public int maxRotation(){ + return 8; + } + + @Override + public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z){ + TileEntity tileentity = world.getTileEntity(x, y, z); + if(!(tileentity instanceof TileColorable)){ + super.setBlockBoundsBasedOnState(world, x, y, z); + return; + } + TileColorable tile = (TileColorable) tileentity; + if(tile.color == 2){ + float xOffset = 0; + float yOffset = 0; + if(tile.rotation == 0) + yOffset = 0.2f; + else if(tile.rotation == 4) + yOffset = -0.2f; + else if(tile.rotation == 6) + xOffset = 0.2f; + else if(tile.rotation == 2) + xOffset = -0.2f; + + setBlockBounds(0.2f + xOffset, 0.4f, 0.2f + yOffset, 0.8f + xOffset, 0.9f, 0.8f + yOffset); + } + else if(tile.color == 1) + setBlockBounds(0.1f, 0.1f, 0.1f, 0.9f, 0.8f, 0.9f); + else + setBlockBounds(0.3f, 0, 0.3f, 0.7f, 0.5f, 0.7f); + + } + + + @Override + public int onBlockPlaced(World world, int x, int y, int z, int side, float p_149660_6_, float p_149660_7_, float p_149660_8_, int meta){ + return side; + } + + @Override + public void onPostBlockPlaced(World world, int x, int y, int z, int meta) { + TileCandle tile = (TileCandle) world.getTileEntity(x, y, z); + if(meta == 1) + tile.color = 0; + else if(meta == 0) + tile.color = 1; + else{ + tile.color = 2; + if(meta == 2) + tile.rotation = 0; + else if(meta == 3) + tile.rotation = 4; + else if(meta == 4) + tile.rotation = 6; + else if(meta == 5) + tile.rotation = 2; + } + world.setBlockMetadataWithNotify(x, y, z, 0, 4); + } + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int p_149691_1_, int meta){ + return Blocks.soul_sand.getIcon(p_149691_1_, meta); + } + + @Override + public TileEntity createNewTileEntity(World var1, int var2) { + return new TileCandle(); + } + + @SideOnly(Side.CLIENT) + public void randomDisplayTick(World world, int x, int y, int z, Random p_149734_5_){ + if(this == unlitBlock()) + return; + TileCandle tile = (TileCandle) world.getTileEntity(x, y, z); + + if(tile.color == 1){ + if(tile.rotation % 2 == 0){ + world.spawnParticle("smoke", x + 0.5f, y + 0.66f, z + 0.13f, 0.0D, 0.0D, 0.0D); + world.spawnParticle("flame", x + 0.5f, y + 0.65f, z + 0.13f, 0.0D, 0.0D, 0.0D); + + world.spawnParticle("smoke", x + 0.5f, y + 0.66f, z + 0.87f, 0.0D, 0.0D, 0.0D); + world.spawnParticle("flame", x + 0.5f, y + 0.65f, z + 0.87f, 0.0D, 0.0D, 0.0D); + + world.spawnParticle("smoke", x + 0.13f, y + 0.66f, z + 0.5f, 0.0D, 0.0D, 0.0D); + world.spawnParticle("flame", x + 0.13f, y + 0.65f, z + 0.5f, 0.0D, 0.0D, 0.0D); + + world.spawnParticle("smoke", x + 0.87f, y + 0.66f, z + 0.5f, 0.0D, 0.0D, 0.0D); + world.spawnParticle("flame", x + 0.87f, y + 0.65f, z + 0.5f, 0.0D, 0.0D, 0.0D); + } + else{ + world.spawnParticle("smoke", x + 0.24f, y + 0.66f, z + 0.24f, 0.0D, 0.0D, 0.0D); + world.spawnParticle("flame", x + 0.24f, y + 0.65f, z + 0.24f, 0.0D, 0.0D, 0.0D); + + world.spawnParticle("smoke", x + 0.76f, y + 0.66f, z + 0.76f, 0.0D, 0.0D, 0.0D); + world.spawnParticle("flame", x + 0.76f, y + 0.65f, z + 0.76f, 0.0D, 0.0D, 0.0D); + + world.spawnParticle("smoke", x + 0.24f, y + 0.66f, z + 0.76f, 0.0D, 0.0D, 0.0D); + world.spawnParticle("flame", x + 0.24f, y + 0.65f, z + 0.76f, 0.0D, 0.0D, 0.0D); + + world.spawnParticle("smoke", x + 0.76f, y + 0.66f, z + 0.24f, 0.0D, 0.0D, 0.0D); + world.spawnParticle("flame", x + 0.76f, y + 0.65f, z + 0.24f, 0.0D, 0.0D, 0.0D); + } + + } + else{ + float xOffset = 0.5f, yOffset = 0.45f, zOffset = 0.5f; + + if(tile.color == 2){ + yOffset = 1.05f; + if(tile.rotation == 0) + zOffset += 0.12f; + if(tile.rotation == 4) + zOffset -= 0.12f; + if(tile.rotation == 6) + xOffset += 0.12f; + if(tile.rotation == 2) + xOffset -= 0.12f; + } + double d0 = (double)((float)x + xOffset); + double d1 = (double)((float)y + yOffset); + double d2 = (double)((float)z + zOffset); + + world.spawnParticle("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D); + world.spawnParticle("flame", d0, d1, d2, 0.0D, 0.0D, 0.0D); + } + } + + @Override + public Block unlitBlock() { + return CustomItems.candle_unlit; + } + + @Override + public Block litBlock() { + return CustomItems.candle; + } +} diff --git a/src/main/java/noppes/npcs/blocks/BlockCarpentryBench.java b/src/main/java/noppes/npcs/blocks/BlockCarpentryBench.java new file mode 100644 index 000000000..28090a57b --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/BlockCarpentryBench.java @@ -0,0 +1,88 @@ +package noppes.npcs.blocks; + +import java.util.List; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import noppes.npcs.CustomItems; +import noppes.npcs.CustomNpcs; +import noppes.npcs.blocks.tiles.TileBlockAnvil; +import noppes.npcs.constants.EnumGuiType; + +public class BlockCarpentryBench extends BlockContainer +{ + public int renderId = -1; + public BlockCarpentryBench() + { + super(Material.wood); + } + + @Override + public boolean onBlockActivated(World par1World, int i, int j, int k, EntityPlayer player, int par6, float par7, float par8, float par9) + {//onBlockActivated + if(!par1World.isRemote){ + player.openGui(CustomNpcs.instance, EnumGuiType.PlayerAnvil.ordinal(), par1World, i, j, k); + } + return true; + } + + @Override + public boolean isOpaqueCube()//isOpaqueCube + { + return false; + } + @Override + public int getRenderType()//getRenderType + { + return renderId; + } + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + @Override + public boolean renderAsNormalBlock()//renderAsNormalBlock + { + return false; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister par1IconRegister) + { + + } + @Override + public int damageDropped(int par1) + { + return par1/4; + } + + @Override + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List){ + par3List.add(new ItemStack(par1, 1, 0)); + par3List.add(new ItemStack(par1, 1, 1)); + } + + @Override + public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLiving, ItemStack item) + { + int var6 = MathHelper.floor_double((double)(par5EntityLiving.rotationYaw / 90.0F) + 0.5D) & 3; + par1World.setBlockMetadataWithNotify(par2, par3, par4, var6 + item.getItemDamage() * 4, 2); + } + + @Override + public TileEntity createNewTileEntity(World var1, int var2) { + return new TileBlockAnvil(); + } +} diff --git a/src/main/java/noppes/npcs/blocks/BlockChair.java b/src/main/java/noppes/npcs/blocks/BlockChair.java new file mode 100644 index 000000000..c6cc0a4e8 --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/BlockChair.java @@ -0,0 +1,87 @@ +package noppes.npcs.blocks; + +import java.util.List; + +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.IIcon; +import net.minecraft.util.MathHelper; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import noppes.npcs.blocks.tiles.TileChair; +import noppes.npcs.blocks.tiles.TileColorable; +import noppes.npcs.entity.EntityChairMount; +import noppes.npcs.entity.EntityCustomNpc; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class BlockChair extends BlockRotated{ + + public BlockChair() { + super(Blocks.planks); + setBlockBounds(0.1f, 0, 0.1f, 0.9f, 1, 0.9f); + } + + @Override + public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack){ + super.onBlockPlacedBy(par1World, par2, par3, par4, par5EntityLivingBase, par6ItemStack); + par1World.setBlockMetadataWithNotify(par2, par3, par4, par6ItemStack.getItemDamage() , 2); + } + + @Override + public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int x, int y, int z){ + return AxisAlignedBB.getBoundingBox(x + 0.1f, y, z + 0.1f, x + 0.9f, y + 0.5f, z + 0.9f); + } + + @Override + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List){ + par3List.add(new ItemStack(par1, 1, 0)); + par3List.add(new ItemStack(par1, 1, 1)); + par3List.add(new ItemStack(par1, 1, 2)); + par3List.add(new ItemStack(par1, 1, 3)); + par3List.add(new ItemStack(par1, 1, 4)); + par3List.add(new ItemStack(par1, 1, 5)); + } + + @Override + public int damageDropped(int par1){ + return par1; + } + + @Override + public TileEntity createNewTileEntity(World var1, int var2) { + return new TileChair(); + } + + @Override + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_){ + return MountBlock(world, x, y, z, player); + } + + public static boolean MountBlock(World world, int x, int y, int z, EntityPlayer player){ + if(world.isRemote) + return true; + List list = world.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1)); + for(Entity entity : list){ + if(entity instanceof EntityChairMount || entity instanceof EntityCustomNpc) + return false; + } + EntityChairMount mount = new EntityChairMount(world); + mount.setPosition(x + 0.5f, y, z + 0.5); + player.mountEntity(mount); + world.spawnEntityInWorld(mount); + player.mountEntity(mount); + return true; + } +} diff --git a/src/main/java/noppes/npcs/blocks/BlockCouchWood.java b/src/main/java/noppes/npcs/blocks/BlockCouchWood.java new file mode 100644 index 000000000..3458a19b6 --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/BlockCouchWood.java @@ -0,0 +1,166 @@ +package noppes.npcs.blocks; + +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockColored; +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.IIcon; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import noppes.npcs.NoppesUtilServer; +import noppes.npcs.blocks.tiles.TileColorable; +import noppes.npcs.blocks.tiles.TileCouchWood; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class BlockCouchWood extends BlockContainer{ + + public int renderId = -1; + + public BlockCouchWood() { + super(Material.wood); + } + @Override + public boolean onBlockActivated(World par1World, int i, int j, int k, EntityPlayer player, int par6, float par7, float par8, float par9){ + ItemStack item = player.inventory.getCurrentItem(); + if(item == null || item.getItem() != Items.dye) + return BlockChair.MountBlock(par1World, i, j, k, player); + int meta = par1World.getBlockMetadata(i, j, k); + if(meta >= 7) + j--; + TileColorable tile = (TileColorable) par1World.getTileEntity(i, j, k); + int color = BlockColored.func_150031_c(item.getItemDamage()); + if(tile.color != color){ + NoppesUtilServer.consumeItemStack(1, player); + tile.color = color; + par1World.markBlockForUpdate(i, j, k); + } + return true; + } + + @Override + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List){ + par3List.add(new ItemStack(par1, 1, 0)); + par3List.add(new ItemStack(par1, 1, 1)); + par3List.add(new ItemStack(par1, 1, 2)); + par3List.add(new ItemStack(par1, 1, 3)); + par3List.add(new ItemStack(par1, 1, 4)); + par3List.add(new ItemStack(par1, 1, 5)); + } + + @Override + public int damageDropped(int par1) + { + return par1; + } + public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int x, int y, int z){ + return AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 0.5, z + 1); + } + + @Override + public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) + { + int l = MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + l %= 4; + TileCouchWood tile = (TileCouchWood) par1World.getTileEntity(par2, par3, par4); + tile.rotation = l; + tile.color = 15 - par6ItemStack.getItemDamage(); + + par1World.setBlockMetadataWithNotify(par2, par3, par4, par6ItemStack.getItemDamage(), 2); + updateModel(par1World, par2, par3, par4, tile); + onNeighborBlockChange(par1World, par2 + 1, par3, par4, this); + onNeighborBlockChange(par1World, par2 - 1, par3, par4, this); + onNeighborBlockChange(par1World, par2, par3, par4 + 1, this); + onNeighborBlockChange(par1World, par2, par3, par4 - 1, this); + updateModel(par1World, par2, par3, par4, tile); + par1World.markBlockForUpdate(par2, par3, par4); + } + + @Override + public void onNeighborBlockChange(World worldObj, int x, int y, int z, Block block) { + if(worldObj.isRemote || block != this) + return; + TileEntity tile = worldObj.getTileEntity(x, y, z); + if(tile == null || !(tile instanceof TileCouchWood)) + return; + updateModel(worldObj, x, y, z, (TileCouchWood) tile); + worldObj.markBlockForUpdate(x, y, z); + } + + private void updateModel(World world, int x, int y, int z, TileCouchWood tile){ + if(world.isRemote) + return; + int meta = tile.getBlockMetadata(); + if(tile.rotation == 0){ + tile.hasLeft = compareTiles(tile, x - 1, y, z, world, meta); + tile.hasRight = compareTiles(tile, x + 1, y, z, world, meta); + } + else if(tile.rotation == 2){ + tile.hasLeft = compareTiles(tile, x + 1, y, z, world, meta); + tile.hasRight = compareTiles(tile, x - 1, y, z, world, meta); + } + else if(tile.rotation == 1){ + tile.hasLeft = compareTiles(tile, x, y, z - 1, world, meta); + tile.hasRight = compareTiles(tile, x, y, z + 1, world, meta); + } + else if(tile.rotation == 3){ + tile.hasLeft = compareTiles(tile, x, y, z + 1, world, meta); + tile.hasRight = compareTiles(tile, x, y, z - 1, world, meta); + } + } + private boolean compareTiles(TileCouchWood tile, int x, int y, int z, World world, int meta){ + int meta2 = world.getBlockMetadata(x, y, z); + if(meta2 != meta) + return false; + TileEntity tile2 = world.getTileEntity(x, y, z); + if(tile2 == null || !(tile2 instanceof TileCouchWood)) + return false; + TileCouchWood couch = (TileCouchWood) tile2; + return tile.rotation == couch.rotation; + } + + @Override + public boolean isOpaqueCube(){ + return false; + } + + @Override + public boolean renderAsNormalBlock(){ + return false; + } + @Override + public int getRenderType(){ + return renderId; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister par1IconRegister) + { + + } + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int p_149691_1_, int meta) + { + return Blocks.planks.getIcon(p_149691_1_, meta); + } + + @Override + public TileEntity createNewTileEntity(World var1, int var2) { + return new TileCouchWood(); + } + +} diff --git a/src/main/java/noppes/npcs/blocks/BlockCouchWool.java b/src/main/java/noppes/npcs/blocks/BlockCouchWool.java new file mode 100644 index 000000000..8e5c86b8b --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/BlockCouchWool.java @@ -0,0 +1,190 @@ +package noppes.npcs.blocks; + +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockColored; +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.IIcon; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import noppes.npcs.NoppesUtilServer; +import noppes.npcs.blocks.tiles.TileColorable; +import noppes.npcs.blocks.tiles.TileCouchWool; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class BlockCouchWool extends BlockContainer{ + + public int renderId = -1; + + public BlockCouchWool() { + super(Material.wood); + } + @Override + public boolean onBlockActivated(World par1World, int i, int j, int k, EntityPlayer player, int par6, float par7, float par8, float par9){ + ItemStack item = player.inventory.getCurrentItem(); + if(item == null || item.getItem() != Items.dye) + return BlockChair.MountBlock(par1World, i, j, k, player); + int meta = par1World.getBlockMetadata(i, j, k); + if(meta >= 7) + j--; + TileColorable tile = (TileColorable) par1World.getTileEntity(i, j, k); + int color = BlockColored.func_150031_c(item.getItemDamage()); + if(tile.color != color){ + NoppesUtilServer.consumeItemStack(1, player); + tile.color = color; + par1World.markBlockForUpdate(i, j, k); + } + return true; + } + + @Override + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List){ + par3List.add(new ItemStack(par1, 1, 0)); + par3List.add(new ItemStack(par1, 1, 1)); + par3List.add(new ItemStack(par1, 1, 2)); + par3List.add(new ItemStack(par1, 1, 3)); + par3List.add(new ItemStack(par1, 1, 4)); + par3List.add(new ItemStack(par1, 1, 5)); + } + + @Override + public int damageDropped(int par1) + { + return par1; + } + public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int x, int y, int z){ + return AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 0.5, z + 1); + } + + @Override + public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) + { + int l = MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + l %= 4; + TileCouchWool tile = (TileCouchWool) par1World.getTileEntity(par2, par3, par4); + tile.rotation = l; + tile.color = 15 - par6ItemStack.getItemDamage(); + + par1World.setBlockMetadataWithNotify(par2, par3, par4, par6ItemStack.getItemDamage(), 2); + updateModel(par1World, par2, par3, par4, tile); + onNeighborBlockChange(par1World, par2 + 1, par3, par4, this); + onNeighborBlockChange(par1World, par2 - 1, par3, par4, this); + onNeighborBlockChange(par1World, par2, par3, par4 + 1, this); + onNeighborBlockChange(par1World, par2, par3, par4 - 1, this); + updateModel(par1World, par2, par3, par4, tile); + par1World.markBlockForUpdate(par2, par3, par4); + } + + @Override + public void onNeighborBlockChange(World worldObj, int x, int y, int z, Block block) { + if(worldObj.isRemote || block != this) + return; + TileEntity tile = worldObj.getTileEntity(x, y, z); + if(tile == null || !(tile instanceof TileCouchWool)) + return; + updateModel(worldObj, x, y, z, (TileCouchWool) tile); + worldObj.markBlockForUpdate(x, y, z); + } + + private void updateModel(World world, int x, int y, int z, TileCouchWool tile){ + if(world.isRemote) + return; + int meta = tile.getBlockMetadata(); + if(tile.rotation == 0){ + tile.hasCornerLeft = compareCornerTiles(tile, x, y, z - 1, world, meta, true); + tile.hasCornerRight = compareCornerTiles(tile, x, y, z - 1, world, meta, false); + tile.hasLeft = compareTiles(tile, x - 1, y, z, world, meta); + tile.hasRight = compareTiles(tile, x + 1, y, z, world, meta); + } + else if(tile.rotation == 2){ + tile.hasCornerLeft = compareCornerTiles(tile, x, y, z + 1, world, meta, true); + tile.hasCornerRight = compareCornerTiles(tile, x, y, z + 1, world, meta, false); + tile.hasLeft = compareTiles(tile, x + 1, y, z, world, meta); + tile.hasRight = compareTiles(tile, x - 1, y, z, world, meta); + } + else if(tile.rotation == 1){ + tile.hasCornerLeft = compareCornerTiles(tile, x + 1, y, z, world, meta, true); + tile.hasCornerRight = compareCornerTiles(tile, x + 1, y, z, world, meta, false); + tile.hasLeft = compareTiles(tile, x, y, z - 1, world, meta); + tile.hasRight = compareTiles(tile, x, y, z + 1, world, meta); + } + else if(tile.rotation == 3){ + tile.hasCornerLeft = compareCornerTiles(tile, x - 1, y, z, world, meta, true); + tile.hasCornerRight = compareCornerTiles(tile, x - 1, y, z, world, meta, false); + tile.hasLeft = compareTiles(tile, x, y, z + 1, world, meta); + tile.hasRight = compareTiles(tile, x, y, z - 1, world, meta); + } + } + private boolean compareCornerTiles(TileCouchWool tile, int x, int y, int z, World world, int meta, boolean isLeft){ + int meta2 = world.getBlockMetadata(x, y, z); + if(meta2 != meta) + return false; + TileEntity tile2 = world.getTileEntity(x , y, z); + int rotation = (tile.rotation + (!isLeft?1:3)) % 4; + return tile2 != null & tile2 instanceof TileCouchWool && ((TileCouchWool)tile2).rotation == rotation; + } + private boolean compareTiles(TileCouchWool tile, int x, int y, int z, World world, int meta){ + int meta2 = world.getBlockMetadata(x, y, z); + if(meta2 != meta) + return false; + TileEntity tile2 = world.getTileEntity(x, y, z); + if(tile2 == null || !(tile2 instanceof TileCouchWool)) + return false; + TileCouchWool couch = (TileCouchWool) tile2; + int rotation = couch.rotation; + if(tile.rotation == rotation) + return true; + if(couch.hasCornerLeft) + rotation += 3; + else if(couch.hasCornerRight) + rotation += 1; + rotation %= 4; + return tile.rotation == rotation; + } + + @Override + public boolean isOpaqueCube(){ + return false; + } + + @Override + public boolean renderAsNormalBlock(){ + return false; + } + @Override + public int getRenderType(){ + return renderId; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister par1IconRegister) + { + + } + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int p_149691_1_, int meta) + { + return Blocks.planks.getIcon(p_149691_1_, meta); + } + + @Override + public TileEntity createNewTileEntity(World var1, int var2) { + return new TileCouchWool(); + } + +} diff --git a/src/main/java/noppes/npcs/blocks/BlockCrate.java b/src/main/java/noppes/npcs/blocks/BlockCrate.java new file mode 100644 index 000000000..04a072d4f --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/BlockCrate.java @@ -0,0 +1,71 @@ +package noppes.npcs.blocks; + +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import noppes.npcs.CustomNpcs; +import noppes.npcs.blocks.tiles.TileCrate; +import noppes.npcs.blocks.tiles.TileNpcContainer; +import noppes.npcs.constants.EnumGuiType; + +public class BlockCrate extends BlockRotated{ + + public BlockCrate() { + super(Blocks.planks); + //setBlockBounds(0f, 0, 0f, 1f, 0.75f, 1f); + } + @Override + public boolean onBlockActivated(World par1World, int i, int j, int k, EntityPlayer player, int par6, float par7, float par8, float par9){ + if(par1World.isRemote) + return true; + + par1World.playSoundEffect(i, j + 0.5D, k, "random.chestopen", 0.5F, par1World.rand.nextFloat() * 0.1F + 0.9F); + player.openGui(CustomNpcs.instance, EnumGuiType.Crate.ordinal(), par1World, i, j, k); + return true; + } + @Override + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List){ + par3List.add(new ItemStack(par1, 1, 0)); + par3List.add(new ItemStack(par1, 1, 1)); + par3List.add(new ItemStack(par1, 1, 2)); + par3List.add(new ItemStack(par1, 1, 3)); + par3List.add(new ItemStack(par1, 1, 4)); + par3List.add(new ItemStack(par1, 1, 5)); + } + + @Override + public int damageDropped(int par1){ + return par1; + } + + + @Override + public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack){ + super.onBlockPlacedBy(par1World, par2, par3, par4, par5EntityLivingBase, par6ItemStack); + par1World.setBlockMetadataWithNotify(par2, par3, par4, par6ItemStack.getItemDamage() , 2); + } + + @Override + public TileEntity createNewTileEntity(World var1, int var2) { + return new TileCrate(); + } + + @Override + public void breakBlock(World world, int x, int y, int z, Block block, int p_149749_6_){ + TileNpcContainer tile = (TileNpcContainer)world.getTileEntity(x, y, z); + if (tile == null) + return; + tile.dropItems(world, x, y, z); + + world.func_147453_f(x, y, z, block); + super.breakBlock(world, x, y, z, block, p_149749_6_); + } +} diff --git a/src/main/java/noppes/npcs/blocks/BlockCrystal.java b/src/main/java/noppes/npcs/blocks/BlockCrystal.java new file mode 100644 index 000000000..4e61724df --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/BlockCrystal.java @@ -0,0 +1,71 @@ +package noppes.npcs.blocks; + +import java.util.List; + +import cpw.mods.fml.client.registry.RenderingRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.Block; +import net.minecraft.block.BlockBreakable; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.world.IBlockAccess; + +public class BlockCrystal extends BlockBreakable{ + + public BlockCrystal() { + super("customnpcs:npcCrystal",Material.glass, false); + setLightLevel(0.8f); + } + + @Override + public boolean isOpaqueCube(){ + return false; + } + + @Override + public boolean renderAsNormalBlock(){ + return false; + } + + @Override + public int getRenderBlockPass(){ + return 1; + } + + @Override + public int damageDropped(int meta){ + return meta; + } + + @Override + @SideOnly(Side.CLIENT) + public void getSubBlocks(Item item, CreativeTabs tab, List list){ + for (int i = 0; i < 16; ++i){ + list.add(new ItemStack(item, 1, i)); + } + } + + @Override + @SideOnly(Side.CLIENT) + public int colorMultiplier(IBlockAccess world, int x, int y, int z){ + return getRenderColor(world.getBlockMetadata(x, y, z)); + } + + @Override + @SideOnly(Side.CLIENT) + public int getRenderColor(int meta){ + return MapColor.getMapColorForBlockColored(meta).colorValue; + } + + public MapColor getMapColor(int p_149728_1_){ + return MapColor.getMapColorForBlockColored(p_149728_1_); + } + @Override + public String getUnlocalizedName(){ + return "item.npcCrystal"; + } +} diff --git a/src/main/java/noppes/npcs/blocks/BlockLamp.java b/src/main/java/noppes/npcs/blocks/BlockLamp.java new file mode 100644 index 000000000..408be61c4 --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/BlockLamp.java @@ -0,0 +1,101 @@ +package noppes.npcs.blocks; + +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import noppes.npcs.CustomItems; +import noppes.npcs.blocks.tiles.TileColorable; +import noppes.npcs.blocks.tiles.TileLamp; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class BlockLamp extends BlockLightable{ + + public BlockLamp(boolean lit) { + super(Blocks.planks, lit); + setBlockBounds(0.3f, 0, 0.3f, 0.7f, 0.6f, 0.7f); + } + + @Override + public int maxRotation(){ + return 8; + } + + @Override + public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z){ + TileEntity tileentity = world.getTileEntity(x, y, z); + if(!(tileentity instanceof TileColorable)){ + super.setBlockBoundsBasedOnState(world, x, y, z); + return; + } + TileColorable tile = (TileColorable) tileentity; + if(tile.color == 2){ + float xOffset = 0; + float yOffset = 0; + if(tile.rotation == 0) + yOffset = 0.2f; + else if(tile.rotation == 4) + yOffset = -0.2f; + else if(tile.rotation == 6) + xOffset = 0.2f; + else if(tile.rotation == 2) + xOffset = -0.2f; + + setBlockBounds(0.3f + xOffset, 0.2f, 0.3f + yOffset, 0.7f + xOffset, 0.7f, 0.7f + yOffset); + } + else + setBlockBounds(0.3f, 0, 0.3f, 0.7f, 0.6f, 0.7f); + + } + + @Override + public int onBlockPlaced(World world, int x, int y, int z, int side, float p_149660_6_, float p_149660_7_, float p_149660_8_, int meta){ + return side; + } + + @Override + public void onPostBlockPlaced(World world, int x, int y, int z, int meta) { + TileLamp tile = (TileLamp) world.getTileEntity(x, y, z); + if(meta == 1) + tile.color = 0; + else if(meta == 0) + tile.color = 1; + else{ + tile.color = 2; + if(meta == 2) + tile.rotation = 0; + else if(meta == 3) + tile.rotation = 4; + else if(meta == 4) + tile.rotation = 6; + else if(meta == 5) + tile.rotation = 2; + } + world.setBlockMetadataWithNotify(x, y, z, 0, 4); + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int p_149691_1_, int meta){ + return Blocks.soul_sand.getIcon(p_149691_1_, meta); + } + + @Override + public TileEntity createNewTileEntity(World var1, int var2) { + return new TileLamp(); + } + + @Override + public Block unlitBlock() { + return CustomItems.lamp_unlit; + } + + @Override + public Block litBlock() { + return CustomItems.lamp; + } +} diff --git a/src/main/java/noppes/npcs/blocks/BlockLightable.java b/src/main/java/noppes/npcs/blocks/BlockLightable.java new file mode 100644 index 000000000..e0f065da3 --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/BlockLightable.java @@ -0,0 +1,56 @@ +package noppes.npcs.blocks; + +import java.util.Random; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +public abstract class BlockLightable extends BlockRotated{ + + protected BlockLightable(Block block, boolean lit) { + super(block); + + if (lit) + this.setLightLevel(1.0F); + } + + public abstract Block unlitBlock(); + public abstract Block litBlock(); + + + @Override + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){ + TileEntity tile = world.getTileEntity(x, y, z); + if(litBlock() == this) + world.setBlock(x, y, z, unlitBlock(), world.getBlockMetadata(x, y, z), 2); + else + world.setBlock(x, y, z, litBlock(), world.getBlockMetadata(x, y, z), 2); + tile.validate(); + world.setTileEntity(x, y, z, tile); + return true; + } + + @Override + public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_){ + return Item.getItemFromBlock(litBlock()); + } + + @Override + @SideOnly(Side.CLIENT) + public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_){ + return Item.getItemFromBlock(litBlock()); + } + + @Override + protected ItemStack createStackedBlock(int p_149644_1_){ + return new ItemStack(litBlock()); + } + +} diff --git a/src/main/java/noppes/npcs/blocks/BlockMailbox.java b/src/main/java/noppes/npcs/blocks/BlockMailbox.java new file mode 100644 index 000000000..726fce7bf --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/BlockMailbox.java @@ -0,0 +1,104 @@ +package noppes.npcs.blocks; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import noppes.npcs.Server; +import noppes.npcs.blocks.tiles.TileMailbox; +import noppes.npcs.constants.EnumGuiType; +import noppes.npcs.constants.EnumPacketClient; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class BlockMailbox extends BlockContainer{ + + public int renderId = -1; + + public BlockMailbox() { + super(Material.iron); + } + + @Override + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) + { + par3List.add(new ItemStack(par1, 1, 0)); + par3List.add(new ItemStack(par1, 1, 1)); + } + + @Override + public boolean onBlockActivated(World par1World, int i, int j, int k, EntityPlayer player, int par6, float par7, float par8, float par9){ + if(!par1World.isRemote){ + Server.sendData((EntityPlayerMP)player, EnumPacketClient.GUI, EnumGuiType.PlayerMailbox, i, j, k); + } + return true; + } + + @Override + public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) + { + ArrayList ret = new ArrayList(); + int damage = this.getDamageValue(world, x, y, z); + ret.add(new ItemStack(this, 1, damage)); + return ret; + } + + @Override + public int damageDropped(int par1) + { + return par1 >> 2; + } + + @Override + public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) + { + int l = MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + l %= 4; + + par1World.setBlockMetadataWithNotify(par2, par3, par4, l | par6ItemStack.getItemDamage() << 2, 2); + } + + @Override + public boolean isOpaqueCube(){ + return false; + } + + @Override + public boolean renderAsNormalBlock(){ + return false; + } + @Override + public int getRenderType(){ + return renderId; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister par1IconRegister) + { + + } + @SideOnly(Side.CLIENT) + public IIcon getIcon(int p_149691_1_, int p_149691_2_) + { + return Blocks.soul_sand.getBlockTextureFromSide(p_149691_1_); + } + + @Override + public TileEntity createNewTileEntity(World var1, int var2) { + return new TileMailbox(); + } +} diff --git a/src/main/java/noppes/npcs/blocks/BlockNpcRedstone.java b/src/main/java/noppes/npcs/blocks/BlockNpcRedstone.java new file mode 100644 index 000000000..7b1b2523f --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/BlockNpcRedstone.java @@ -0,0 +1,95 @@ +package noppes.npcs.blocks; + +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import noppes.npcs.CustomItems; +import noppes.npcs.CustomNpcs; +import noppes.npcs.CustomNpcsPermissions; +import noppes.npcs.Server; +import noppes.npcs.blocks.tiles.TileRedstoneBlock; +import noppes.npcs.constants.EnumGuiType; +import noppes.npcs.constants.EnumPacketClient; + +public class BlockNpcRedstone extends BlockContainer{ + public BlockNpcRedstone(){ + super(Material.rock); + } + + @Override + public boolean onBlockActivated(World par1World, int i, int j, int k, EntityPlayer player, int par6, float par7, float par8, float par9){ + if(par1World.isRemote) + return false; + ItemStack currentItem = player.inventory.getCurrentItem(); + if (currentItem != null && currentItem.getItem() == CustomItems.wand && CustomNpcsPermissions.hasPermission(player, CustomNpcsPermissions.EDIT_BLOCKS)) { + TileEntity tile = par1World.getTileEntity(i, j, k); + NBTTagCompound compound = new NBTTagCompound(); + tile.writeToNBT(compound); + Server.sendData((EntityPlayerMP)player, EnumPacketClient.GUI_REDSTONE, compound); + return true; + } + return false; + } + + @Override + public void onBlockAdded(World par1World, int par2, int par3, int par4){ + par1World.notifyBlocksOfNeighborChange(par2, par3, par4, this); + par1World.notifyBlocksOfNeighborChange(par2, par3 - 1, par4, this); + par1World.notifyBlocksOfNeighborChange(par2, par3 + 1, par4, this); + par1World.notifyBlocksOfNeighborChange(par2 - 1, par3, par4, this); + par1World.notifyBlocksOfNeighborChange(par2 + 1, par3, par4, this); + par1World.notifyBlocksOfNeighborChange(par2, par3, par4 - 1, this); + par1World.notifyBlocksOfNeighborChange(par2, par3, par4 + 1, this); + } + + @Override + public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityliving, ItemStack item){ + if(entityliving instanceof EntityPlayer && world.isRemote){ + CustomNpcs.proxy.openGui(i, j, k, EnumGuiType.RedstoneBlock, (EntityPlayer) entityliving); + } + } + + @Override + public void onBlockDestroyedByPlayer(World par1World, int par2, int par3, int par4, int par5) { + onBlockAdded(par1World, par2, par3, par4); + } + + @Override + public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4){ + if(isActivated(par1IBlockAccess, par2, par3, par4) > 0) + return 0xFF6B68; + else + return super.colorMultiplier(par1IBlockAccess, par2, par3, par4); + } + + @Override + public int isProvidingWeakPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5){ + return isActivated(par1IBlockAccess, par2, par3, par4); + } + + @Override + public int isProvidingStrongPower(IBlockAccess par1World, int par2, int par3, int par4, int par5){ + return isActivated(par1World, par2, par3, par4); + } + + @Override + public boolean canProvidePower(){ + return true; + } + + public int isActivated(IBlockAccess par1IBlockAccess, int par2, int par3, int par4){ + return par1IBlockAccess.getBlockMetadata(par2, par3, par4) == 1?15 : 0; + } + + @Override + public TileEntity createNewTileEntity(World var1, int var2) { + return new TileRedstoneBlock(); + } +} diff --git a/src/main/java/noppes/npcs/blocks/BlockPedestal.java b/src/main/java/noppes/npcs/blocks/BlockPedestal.java new file mode 100644 index 000000000..68c401f18 --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/BlockPedestal.java @@ -0,0 +1,123 @@ +package noppes.npcs.blocks; + +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemSword; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import noppes.npcs.blocks.tiles.TileColorable; +import noppes.npcs.blocks.tiles.TileNpcContainer; +import noppes.npcs.blocks.tiles.TilePedestal; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class BlockPedestal extends BlockTrigger{ + + public BlockPedestal() { + super(Blocks.stone); + } + + @Override + public boolean onBlockActivated(World par1World, int i, int j, int k, EntityPlayer player, int side, float hitX, float hitY, float hitZ){ + if(par1World.isRemote) + return true; + + TilePedestal tile = (TilePedestal) par1World.getTileEntity(i, j, k); + + ItemStack item = player.getCurrentEquippedItem(); + ItemStack weapon = tile.getStackInSlot(0); + if(item == null && weapon != null){ + tile.setInventorySlotContents(0, null); + player.inventory.setInventorySlotContents(player.inventory.currentItem, weapon); + par1World.markBlockForUpdate(i, j, k); + updateSurrounding(par1World, i, j, k); + } + else if(item == null || item.getItem() == null || !(item.getItem() instanceof ItemSword)) + return true; + else if(item != null && weapon == null){ + tile.setInventorySlotContents(0, item); + player.inventory.setInventorySlotContents(player.inventory.currentItem, null); + par1World.markBlockForUpdate(i, j, k); + updateSurrounding(par1World, i, j, k); + } + return true; + } + + @Override + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List){ + par3List.add(new ItemStack(par1, 1, 0)); + par3List.add(new ItemStack(par1, 1, 1)); + par3List.add(new ItemStack(par1, 1, 2)); + par3List.add(new ItemStack(par1, 1, 3)); + par3List.add(new ItemStack(par1, 1, 4)); + } + + @Override + public int damageDropped(int par1){ + return par1; + } + @Override + public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z){ + TileEntity tileentity = world.getTileEntity(x, y, z); + if(!(tileentity instanceof TileColorable)){ + super.setBlockBoundsBasedOnState(world, x, y, z); + return; + } + TileColorable tile = (TileColorable) tileentity; + if(tile.rotation % 2 == 0){ + setBlockBounds(0f, 0, 0.2f, 1, 0.5f, 0.8f ); + } + else{ + setBlockBounds(0.2f, 0, 0, 0.8f, 0.5f, 1 ); + } + } + + @Override + public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack){ + super.onBlockPlacedBy(par1World, par2, par3, par4, par5EntityLivingBase, par6ItemStack); + par1World.setBlockMetadataWithNotify(par2, par3, par4, par6ItemStack.getItemDamage() , 2); + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int p_149691_1_, int meta) + { + meta %= 7; + if(meta == 1) + return Blocks.stone.getIcon(p_149691_1_, 0); + else if(meta == 2) + return Blocks.iron_block.getIcon(p_149691_1_, 0); + else if(meta == 3) + return Blocks.gold_block.getIcon(p_149691_1_, 0); + else if(meta == 4) + return Blocks.diamond_block.getIcon(p_149691_1_, 0); + return Blocks.planks.getIcon(p_149691_1_, 0); + } + + + @Override + public TileEntity createNewTileEntity(World var1, int var2) { + return new TilePedestal(); + } + + @Override + public void breakBlock(World world, int x, int y, int z, Block block, int p_149749_6_){ + TileNpcContainer tile = (TileNpcContainer)world.getTileEntity(x, y, z); + if (tile == null) + return; + tile.dropItems(world, x, y, z); + + world.func_147453_f(x, y, z, block); + + super.breakBlock(world, x, y, z, block, p_149749_6_); + } +} diff --git a/src/main/java/noppes/npcs/blocks/BlockPlaceholder.java b/src/main/java/noppes/npcs/blocks/BlockPlaceholder.java new file mode 100644 index 000000000..427a3178a --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/BlockPlaceholder.java @@ -0,0 +1,59 @@ +package noppes.npcs.blocks; + +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class BlockPlaceholder extends Block{ + + private IIcon[] icons = new IIcon[16]; + + public BlockPlaceholder() { + super(Material.rock); + } + + @Override + public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack){ + super.onBlockPlacedBy(par1World, par2, par3, par4, par5EntityLivingBase, par6ItemStack); + par1World.setBlockMetadataWithNotify(par2, par3, par4, par6ItemStack.getItemDamage() , 2); + } + + @Override + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List){ + for(int i = 0; i < 16; i++) + par3List.add(new ItemStack(par1, 1, i)); + } + + @Override + public int damageDropped(int par1){ + return par1; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister par1IconRegister){ + for(int i = 0; i < 16; i++){ + icons[i] = par1IconRegister.registerIcon("customnpcs:placeholder_" + i); + } + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int p_149691_1_, int meta) + { + if(meta < icons.length) + return icons[meta]; + return icons[0]; + } + +} diff --git a/src/main/java/noppes/npcs/blocks/BlockRotated.java b/src/main/java/noppes/npcs/blocks/BlockRotated.java new file mode 100644 index 000000000..ea67ccb31 --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/BlockRotated.java @@ -0,0 +1,75 @@ +package noppes.npcs.blocks; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockContainer; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.IIcon; +import net.minecraft.util.MathHelper; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import noppes.npcs.blocks.tiles.TileColorable; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public abstract class BlockRotated extends BlockContainer{ + private Block block; + protected BlockRotated(Block block) { + super(block.getMaterial()); + this.block = block; + } + + public int renderId = -1; + + @Override + public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack){ + int l = MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * maxRotation() / 360.0F) + 0.5D) & (maxRotation() - 1); + l %= maxRotation(); + + TileColorable tile = (TileColorable) par1World.getTileEntity(par2, par3, par4); + tile.rotation = l; + } + + public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z){ + setBlockBoundsBasedOnState(world, x, y, z); + return super.getCollisionBoundingBoxFromPool(world, x, y, z); + } + + public int maxRotation(){ + return 4; + } + + @Override + public boolean isOpaqueCube(){ + return false; + } + + @Override + public boolean renderAsNormalBlock(){ + return false; + } + @Override + public int getRenderType(){ + return renderId; + } + @Override + public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side){ + return true; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister par1IconRegister) + { + + } + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int p_149691_1_, int meta){ + return block.getIcon(p_149691_1_, meta); + } + +} diff --git a/src/main/java/noppes/npcs/blocks/BlockShelf.java b/src/main/java/noppes/npcs/blocks/BlockShelf.java new file mode 100644 index 000000000..5b2e91b3e --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/BlockShelf.java @@ -0,0 +1,77 @@ +package noppes.npcs.blocks; + +import java.util.List; + +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import noppes.npcs.blocks.tiles.TileColorable; +import noppes.npcs.blocks.tiles.TileShelf; + +public class BlockShelf extends BlockRotated{ + + public BlockShelf() { + super(Blocks.planks); + } + + @Override + public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack){ + super.onBlockPlacedBy(par1World, par2, par3, par4, par5EntityLivingBase, par6ItemStack); + par1World.setBlockMetadataWithNotify(par2, par3, par4, par6ItemStack.getItemDamage() , 2); + } + + @Override + public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int x, int y, int z){ + setBlockBoundsBasedOnState(p_149668_1_, x, y, z); + return AxisAlignedBB.getBoundingBox(x + minX, y + 0.9f, z + minZ, x + maxX, y + 1, z + maxZ); + } + + @Override + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List){ + par3List.add(new ItemStack(par1, 1, 0)); + par3List.add(new ItemStack(par1, 1, 1)); + par3List.add(new ItemStack(par1, 1, 2)); + par3List.add(new ItemStack(par1, 1, 3)); + par3List.add(new ItemStack(par1, 1, 4)); + par3List.add(new ItemStack(par1, 1, 5)); + } + @Override + public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z){ + TileEntity tileentity = world.getTileEntity(x, y, z); + if(!(tileentity instanceof TileColorable)){ + super.setBlockBoundsBasedOnState(world, x, y, z); + return; + } + TileColorable tile = (TileColorable) tileentity; + float xStart = 0; + float zStart = 0; + float xEnd = 1; + float zEnd = 1; + if(tile.rotation == 0) + zStart = 0.3f; + else if(tile.rotation == 2) + zEnd = 0.7f; + else if(tile.rotation == 3) + xStart = 0.3f; + else if(tile.rotation == 1) + xEnd = 0.7f; + setBlockBounds(xStart, 0.44f, zStart, xEnd, 1, zEnd); + } + + @Override + public int damageDropped(int par1){ + return par1; + } + + @Override + public TileEntity createNewTileEntity(World var1, int var2) { + return new TileShelf(); + } + +} diff --git a/src/main/java/noppes/npcs/blocks/BlockSign.java b/src/main/java/noppes/npcs/blocks/BlockSign.java new file mode 100644 index 000000000..cc42b1976 --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/BlockSign.java @@ -0,0 +1,78 @@ +package noppes.npcs.blocks; + +import java.util.List; + +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.MathHelper; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import noppes.npcs.blocks.tiles.TileBanner; +import noppes.npcs.blocks.tiles.TileColorable; +import noppes.npcs.blocks.tiles.TileSign; + +public class BlockSign extends BlockRotated{ + + public BlockSign() { + super(Blocks.planks); + } + + @Override + public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) + { + int l = MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + l %= 4; + TileSign tile = (TileSign) par1World.getTileEntity(par2, par3, par4); + tile.rotation = l; + tile.time = System.currentTimeMillis(); + par1World.setBlockMetadataWithNotify(par2, par3, par4, par6ItemStack.getItemDamage() , 2); + if(par5EntityLivingBase instanceof EntityPlayer && par1World.isRemote) + ((EntityPlayer)par5EntityLivingBase).addChatComponentMessage(new ChatComponentTranslation("availability.editIcon")); + } + + @Override + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ){ + TileBanner tile = (TileBanner) world.getTileEntity(x, y, z); + return tile.canEdit(); + } + + @Override + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List){ + par3List.add(new ItemStack(par1, 1, 0)); + par3List.add(new ItemStack(par1, 1, 1)); + par3List.add(new ItemStack(par1, 1, 2)); + par3List.add(new ItemStack(par1, 1, 3)); + par3List.add(new ItemStack(par1, 1, 4)); + par3List.add(new ItemStack(par1, 1, 5)); + } + + @Override + public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z){ + TileEntity tileentity = world.getTileEntity(x, y, z); + if(!(tileentity instanceof TileColorable)){ + super.setBlockBoundsBasedOnState(world, x, y, z); + return; + } + TileColorable tile = (TileColorable) tileentity; + if(tile.rotation % 2 == 1) + setBlockBounds(0, 0.3f, 0.3f, 1, 1, 0.7f); + else + setBlockBounds(0.3f, 0.3f, 0, 0.7f, 1, 1); + } + + @Override + public int damageDropped(int par1){ + return par1; + } + + @Override + public TileEntity createNewTileEntity(World var1, int var2) { + return new TileSign(); + } +} diff --git a/src/main/java/noppes/npcs/blocks/BlockStool.java b/src/main/java/noppes/npcs/blocks/BlockStool.java new file mode 100644 index 000000000..49e2dfd83 --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/BlockStool.java @@ -0,0 +1,106 @@ +package noppes.npcs.blocks; + +import java.util.List; + +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.IIcon; +import net.minecraft.util.MathHelper; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import noppes.npcs.blocks.tiles.TileColorable; +import noppes.npcs.blocks.tiles.TileStool; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class BlockStool extends BlockContainer{ + + public int renderId = -1; + + public BlockStool() { + super(Material.wood); + setBlockBounds(0.1f, 0, 0.1f, 0.9f, 0.6f, 0.9f); + } + + @Override + public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int x, int y, int z){ + return AxisAlignedBB.getBoundingBox(x + 0.1f, y, z + 0.1f, x + 0.9f, y + 0.5f, z + 0.9f); + } + + @Override + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List){ + par3List.add(new ItemStack(par1, 1, 0)); + par3List.add(new ItemStack(par1, 1, 1)); + par3List.add(new ItemStack(par1, 1, 2)); + par3List.add(new ItemStack(par1, 1, 3)); + par3List.add(new ItemStack(par1, 1, 4)); + par3List.add(new ItemStack(par1, 1, 5)); + } + + @Override + public int damageDropped(int par1) + { + return par1; + } + + @Override + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_){ + return BlockChair.MountBlock(world, x, y, z, player); + } + + @Override + public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack){ + int l = MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + l %= 4; + + TileColorable tile = (TileColorable) par1World.getTileEntity(par2, par3, par4); + tile.rotation = l; + + par1World.setBlockMetadataWithNotify(par2, par3, par4, par6ItemStack.getItemDamage() , 2); + + } + + @Override + public boolean isOpaqueCube(){ + return false; + } + + @Override + public boolean renderAsNormalBlock(){ + return false; + } + @Override + public int getRenderType(){ + return renderId; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister par1IconRegister) + { + + } + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int p_149691_1_, int meta) + { + return Blocks.planks.getIcon(p_149691_1_, meta); + } + + @Override + public TileEntity createNewTileEntity(World var1, int var2) { + return new TileStool(); + } + +} diff --git a/src/main/java/noppes/npcs/blocks/BlockTable.java b/src/main/java/noppes/npcs/blocks/BlockTable.java new file mode 100644 index 000000000..be4f5bc7b --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/BlockTable.java @@ -0,0 +1,61 @@ +package noppes.npcs.blocks; + +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockContainer; +import net.minecraft.block.BlockSlab; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.util.MathHelper; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import noppes.npcs.CustomNpcs; +import noppes.npcs.blocks.tiles.TileColorable; +import noppes.npcs.blocks.tiles.TileTable; +import noppes.npcs.constants.EnumGuiType; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class BlockTable extends BlockRotated{ + + public BlockTable() { + super(Blocks.planks); + this.setLightOpacity(-1); + } + + @Override + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List){ + par3List.add(new ItemStack(par1, 1, 0)); + par3List.add(new ItemStack(par1, 1, 1)); + par3List.add(new ItemStack(par1, 1, 2)); + par3List.add(new ItemStack(par1, 1, 3)); + par3List.add(new ItemStack(par1, 1, 4)); + par3List.add(new ItemStack(par1, 1, 5)); + } + + @Override + public int damageDropped(int par1){ + return par1; + } + + + @Override + public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack){ + super.onBlockPlacedBy(par1World, par2, par3, par4, par5EntityLivingBase, par6ItemStack); + par1World.setBlockMetadataWithNotify(par2, par3, par4, par6ItemStack.getItemDamage() , 2); + } + + @Override + public TileEntity createNewTileEntity(World var1, int var2) { + return new TileTable(); + } +} diff --git a/src/main/java/noppes/npcs/blocks/BlockTallLamp.java b/src/main/java/noppes/npcs/blocks/BlockTallLamp.java new file mode 100644 index 000000000..a1ed8e86e --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/BlockTallLamp.java @@ -0,0 +1,157 @@ +package noppes.npcs.blocks; + +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockColored; +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.IIcon; +import net.minecraft.util.MathHelper; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import noppes.npcs.NoppesUtilServer; +import noppes.npcs.blocks.tiles.TileColorable; +import noppes.npcs.blocks.tiles.TileTallLamp; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class BlockTallLamp extends BlockContainer{ + + public int renderId = -1; + + public BlockTallLamp() { + super(Material.wood); + setBlockBounds(0, 0, 0, 1, 2, 1); + setLightLevel(1); + } + @Override + public boolean onBlockActivated(World par1World, int i, int j, int k, EntityPlayer player, int par6, float par7, float par8, float par9){ + ItemStack item = player.inventory.getCurrentItem(); + if(item == null || item.getItem() != Items.dye) + return false; + int meta = par1World.getBlockMetadata(i, j, k); + if(meta >= 7) + j--; + TileColorable tile = (TileColorable) par1World.getTileEntity(i, j, k); + int color = BlockColored.func_150031_c(item.getItemDamage()); + if(tile.color != color){ + NoppesUtilServer.consumeItemStack(1, player); + tile.color = color; + par1World.markBlockForUpdate(i, j, k); + } + return true; + } + public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z){ + setBlockBoundsBasedOnState(world, x, y, z); + return super.getCollisionBoundingBoxFromPool(world, x, y, z); + } + + @Override + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List){ + par3List.add(new ItemStack(par1, 1, 0)); + par3List.add(new ItemStack(par1, 1, 1)); + par3List.add(new ItemStack(par1, 1, 2)); + par3List.add(new ItemStack(par1, 1, 3)); + par3List.add(new ItemStack(par1, 1, 4)); + } + + @Override + public int damageDropped(int par1){ + return par1 % 7; + } + + @Override + public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) + { + if(!par1World.isAirBlock(par2, par3 + 1, par4)){ + par1World.setBlockToAir(par2, par3, par4); + } + else{ + + int l = MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + l %= 4; + + TileColorable tile = (TileColorable) par1World.getTileEntity(par2, par3, par4); + tile.rotation = l; + tile.color = 15 - par6ItemStack.getItemDamage(); + + par1World.setBlockMetadataWithNotify(par2, par3, par4, par6ItemStack.getItemDamage() , 2); + par1World.setBlock(par2, par3 + 1, par4, this, par6ItemStack.getItemDamage() + 7, 2); + } + } + + @Override + public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z){ + int meta = world.getBlockMetadata(x, y, z); + if(meta >= 7) + setBlockBounds(0, -1, 0, 1, 1, 1); + else + setBlockBounds(0, 0, 0, 1, 2, 1); + } + + @Override + public boolean isOpaqueCube(){ + return false; + } + + @Override + public boolean renderAsNormalBlock(){ + return false; + } + @Override + public int getRenderType(){ + return renderId; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister par1IconRegister) + { + + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int p_149691_1_, int meta) + { + meta %= 7; + if(meta == 1) + return Blocks.stone.getIcon(p_149691_1_, 0); + else if(meta == 2) + return Blocks.iron_block.getIcon(p_149691_1_, 0); + else if(meta == 3) + return Blocks.gold_block.getIcon(p_149691_1_, 0); + else if(meta == 4) + return Blocks.diamond_block.getIcon(p_149691_1_, 0); + return Blocks.planks.getIcon(p_149691_1_, 0); + } + + @Override + public TileEntity createNewTileEntity(World var1, int var2) { + if(var2 < 7) + return new TileTallLamp(); + else + return null; + } + + @Override + public void onBlockHarvested(World p_149681_1_, int p_149681_2_, int p_149681_3_, int p_149681_4_, int p_149681_5_, EntityPlayer p_149681_6_) + { + if (p_149681_5_ >= 7 && p_149681_1_.getBlock(p_149681_2_, p_149681_3_ - 1, p_149681_4_) == this) + p_149681_1_.setBlockToAir(p_149681_2_, p_149681_3_ - 1, p_149681_4_); + + else if (p_149681_5_ < 7 && p_149681_1_.getBlock(p_149681_2_, p_149681_3_ + 1, p_149681_4_) == this) + p_149681_1_.setBlockToAir(p_149681_2_, p_149681_3_ + 1, p_149681_4_); + } +} diff --git a/src/main/java/noppes/npcs/blocks/BlockTombstone.java b/src/main/java/noppes/npcs/blocks/BlockTombstone.java new file mode 100644 index 000000000..db6191adb --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/BlockTombstone.java @@ -0,0 +1,131 @@ +package noppes.npcs.blocks; + +import java.util.List; + +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.IIcon; +import net.minecraft.util.MathHelper; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import noppes.npcs.CustomItems; +import noppes.npcs.CustomNpcs; +import noppes.npcs.CustomNpcsPermissions; +import noppes.npcs.NoppesUtilServer; +import noppes.npcs.blocks.tiles.TileBigSign; +import noppes.npcs.blocks.tiles.TileColorable; +import noppes.npcs.blocks.tiles.TileTombstone; +import noppes.npcs.constants.EnumGuiType; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class BlockTombstone extends BlockContainer{ + + public int renderId = -1; + + public BlockTombstone() { + super(Material.rock); + } + + @Override + public int damageDropped(int par1){ + return par1; + } + + + @Override + public boolean onBlockActivated(World par1World, int i, int j, int k, EntityPlayer player, int par6, float par7, float par8, float par9){ + if(par1World.isRemote) + return false; + ItemStack currentItem = player.inventory.getCurrentItem(); + if (currentItem != null && currentItem.getItem() == CustomItems.wand && CustomNpcsPermissions.hasPermission(player, CustomNpcsPermissions.EDIT_BLOCKS)) { + TileBigSign tile = (TileBigSign) par1World.getTileEntity(i, j, k); + if(tile.getBlockMetadata() >= 2) + return false; + tile.canEdit = true; + NoppesUtilServer.sendOpenGui(player, EnumGuiType.BigSign, null, i, j, k); + return true; + } + return false; + } + @Override + public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack){ + int l = MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + l %= 4; + + TileBigSign tile = (TileBigSign) par1World.getTileEntity(par2, par3, par4); + tile.rotation = l; + + par1World.setBlockMetadataWithNotify(par2, par3, par4, par6ItemStack.getItemDamage() , 2); + + if(par5EntityLivingBase instanceof EntityPlayer && par1World.isRemote && par6ItemStack.getItemDamage() < 2){ + CustomNpcs.proxy.openGui(par2, par3, par4, EnumGuiType.BigSign, (EntityPlayer) par5EntityLivingBase); + } + } + public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z){ + setBlockBoundsBasedOnState(world, x, y, z); + return super.getCollisionBoundingBoxFromPool(world, x, y, z); + } + + @Override + public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z){ + TileEntity tileentity = world.getTileEntity(x, y, z); + if(!(tileentity instanceof TileColorable)){ + super.setBlockBoundsBasedOnState(world, x, y, z); + return; + } + TileColorable tile = (TileColorable) tileentity; + if(tile.rotation % 2 == 0) + setBlockBounds(0, 0, 0.3f, 1, 1, 0.7f); + else + setBlockBounds(0.3f, 0, 0, 0.7f, 1, 1); + } + + @Override + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List){ + par3List.add(new ItemStack(par1, 1, 0)); + par3List.add(new ItemStack(par1, 1, 1)); + par3List.add(new ItemStack(par1, 1, 2)); + } + + @Override + public boolean isOpaqueCube(){ + return false; + } + + @Override + public boolean renderAsNormalBlock(){ + return false; + } + @Override + public int getRenderType(){ + return renderId; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister par1IconRegister) + { + + } + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int p_149691_1_, int meta) + { + return Blocks.stone.getIcon(p_149691_1_, meta); + } + + @Override + public TileEntity createNewTileEntity(World var1, int var2) { + return new TileTombstone(); + } +} diff --git a/src/main/java/noppes/npcs/blocks/BlockTrigger.java b/src/main/java/noppes/npcs/blocks/BlockTrigger.java new file mode 100644 index 000000000..8d7e0c6ce --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/BlockTrigger.java @@ -0,0 +1,44 @@ +package noppes.npcs.blocks; + +import net.minecraft.block.Block; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityChest; +import net.minecraft.util.MathHelper; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import noppes.npcs.blocks.tiles.TileColorable; + +public abstract class BlockTrigger extends BlockRotated{ + + protected BlockTrigger(Block block) { + super(block); + } + + @Override + public boolean canProvidePower(){ + return true; + } + + @Override + public int isProvidingStrongPower(IBlockAccess world, int x, int y, int z, int p_149748_5_){ + return this.isProvidingWeakPower(world, x, y, z, p_149748_5_); + } + + @Override + public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int p_149709_5_){ + TileColorable tile = (TileColorable)world.getTileEntity(x, y, z); + if(tile != null) + return tile.powerProvided(); + return 0; + } + + public void updateSurrounding(World par1World, int par2, int par3, int par4){ + par1World.notifyBlocksOfNeighborChange(par2, par3, par4, this); + par1World.notifyBlocksOfNeighborChange(par2, par3 - 1, par4, this); + par1World.notifyBlocksOfNeighborChange(par2, par3 + 1, par4, this); + par1World.notifyBlocksOfNeighborChange(par2 - 1, par3, par4, this); + par1World.notifyBlocksOfNeighborChange(par2 + 1, par3, par4, this); + par1World.notifyBlocksOfNeighborChange(par2, par3, par4 - 1, this); + par1World.notifyBlocksOfNeighborChange(par2, par3, par4 + 1, this); + } +} diff --git a/src/main/java/noppes/npcs/blocks/BlockWallBanner.java b/src/main/java/noppes/npcs/blocks/BlockWallBanner.java new file mode 100644 index 000000000..ab4aeb5c2 --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/BlockWallBanner.java @@ -0,0 +1,131 @@ +package noppes.npcs.blocks; + +import java.util.List; + +import net.minecraft.block.BlockColored; +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.IIcon; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import noppes.npcs.NoppesUtilServer; +import noppes.npcs.blocks.tiles.TileWallBanner; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class BlockWallBanner extends BlockContainer{ + + public int renderId = -1; + + public BlockWallBanner() { + super(Material.rock); + } + @Override + public boolean onBlockActivated(World par1World, int i, int j, int k, EntityPlayer player, int par6, float par7, float par8, float par9){ + ItemStack item = player.inventory.getCurrentItem(); + if(item == null) + return false; + TileWallBanner tile = (TileWallBanner) par1World.getTileEntity(i, j, k); + if(tile.canEdit()) + return true; + else if(item.getItem() != Items.dye) + return false; + + int color = BlockColored.func_150031_c(item.getItemDamage()); + if(tile.color != color){ + NoppesUtilServer.consumeItemStack(1, player); + tile.color = color; + par1World.markBlockForUpdate(i, j, k); + } + return true; + } + + @Override + public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) + { + int l = MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + l %= 4; + TileWallBanner tile = (TileWallBanner) par1World.getTileEntity(par2, par3, par4); + tile.rotation = l; + tile.color = 15 - par6ItemStack.getItemDamage(); + tile.time = System.currentTimeMillis(); + + par1World.setBlockMetadataWithNotify(par2, par3, par4, par6ItemStack.getItemDamage(), 2); + + if(par5EntityLivingBase instanceof EntityPlayer && par1World.isRemote) + ((EntityPlayer)par5EntityLivingBase).addChatComponentMessage(new ChatComponentTranslation("availability.editIcon")); + } + + public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) + { + return null; + } + + @Override + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List){ + par3List.add(new ItemStack(par1, 1, 0)); + par3List.add(new ItemStack(par1, 1, 1)); + par3List.add(new ItemStack(par1, 1, 2)); + par3List.add(new ItemStack(par1, 1, 3)); + par3List.add(new ItemStack(par1, 1, 4)); + } + + + @Override + public int damageDropped(int par1) + { + return par1; + } + + @Override + public boolean isOpaqueCube(){ + return false; + } + + @Override + public boolean renderAsNormalBlock(){ + return false; + } + @Override + public int getRenderType(){ + return renderId; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister par1IconRegister) + { + + } + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int p_149691_1_, int meta) + { + meta %= 7; + if(meta == 1) + return Blocks.stone.getIcon(p_149691_1_, 0); + else if(meta == 2) + return Blocks.iron_block.getIcon(p_149691_1_, 0); + else if(meta == 3) + return Blocks.gold_block.getIcon(p_149691_1_, 0); + else if(meta == 4) + return Blocks.diamond_block.getIcon(p_149691_1_, 0); + return Blocks.planks.getIcon(p_149691_1_, 0); + } + + @Override + public TileEntity createNewTileEntity(World var1, int var2) { + return new TileWallBanner(); + } +} diff --git a/src/main/java/noppes/npcs/blocks/BlockWaypoint.java b/src/main/java/noppes/npcs/blocks/BlockWaypoint.java new file mode 100644 index 000000000..1f0f383f9 --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/BlockWaypoint.java @@ -0,0 +1,55 @@ +package noppes.npcs.blocks; + +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import noppes.npcs.CustomItems; +import noppes.npcs.CustomNpcs; +import noppes.npcs.CustomNpcsPermissions; +import noppes.npcs.Server; +import noppes.npcs.blocks.tiles.TileWaypoint; +import noppes.npcs.constants.EnumGuiType; +import noppes.npcs.constants.EnumPacketClient; + +public class BlockWaypoint extends BlockContainer{ + + public BlockWaypoint() { + super(Material.iron); + this.setCreativeTab(CustomItems.tab); + } + + @Override + public boolean onBlockActivated(World par1World, int i, int j, int k, EntityPlayer player, int par6, float par7, float par8, float par9) + { + if(par1World.isRemote) + return false; + ItemStack currentItem = player.inventory.getCurrentItem(); + if (currentItem != null && currentItem.getItem() == CustomItems.wand && CustomNpcsPermissions.hasPermission(player, CustomNpcsPermissions.EDIT_BLOCKS)) { + TileEntity tile = par1World.getTileEntity(i, j, k); + NBTTagCompound compound = new NBTTagCompound(); + tile.writeToNBT(compound); + Server.sendData((EntityPlayerMP)player, EnumPacketClient.GUI_WAYPOINT, compound); + return true; + } + return false; + } + + @Override + public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityliving, ItemStack item){ + if(entityliving instanceof EntityPlayer && world.isRemote){ + CustomNpcs.proxy.openGui(i, j, k, EnumGuiType.Waypoint, (EntityPlayer) entityliving); + } + } + + @Override + public TileEntity createNewTileEntity(World var1, int var2) { + return new TileWaypoint(); + } + +} diff --git a/src/main/java/noppes/npcs/blocks/BlockWeaponRack.java b/src/main/java/noppes/npcs/blocks/BlockWeaponRack.java new file mode 100644 index 000000000..02005f5f9 --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/BlockWeaponRack.java @@ -0,0 +1,166 @@ +package noppes.npcs.blocks; + +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.IIcon; +import net.minecraft.util.MathHelper; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import noppes.npcs.CustomNpcs; +import noppes.npcs.blocks.tiles.TileColorable; +import noppes.npcs.blocks.tiles.TileNpcContainer; +import noppes.npcs.blocks.tiles.TileWeaponRack; +import noppes.npcs.constants.EnumGuiType; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class BlockWeaponRack extends BlockTrigger{ + + public BlockWeaponRack() { + super(Blocks.planks); + } + @Override + public boolean onBlockActivated(World par1World, int i, int j, int k, EntityPlayer player, int side, float hitX, float hitY, float hitZ){ + if(par1World.isRemote) + return true; + int meta = par1World.getBlockMetadata(i, j, k); + if(meta >= 7) + j--; + TileWeaponRack tile = (TileWeaponRack) par1World.getTileEntity(i, j, k); + float hit = hitX; + if(tile.rotation == 2) + hit = 1 - hitX; + if(tile.rotation == 3) + hit = 1 - hitZ; + if(tile.rotation == 1) + hit = hitZ; + + int selected = 2 - (int) (hit / 0.34); + ItemStack item = player.getCurrentEquippedItem(); + ItemStack weapon = tile.getStackInSlot(selected); + if(item == null && weapon != null){ + tile.setInventorySlotContents(selected, null); + player.inventory.setInventorySlotContents(player.inventory.currentItem, weapon); + par1World.markBlockForUpdate(i, j, k); + updateSurrounding(par1World, i, j, k); + } + else if(item == null || item.getItem() == null || item.getItem() instanceof ItemBlock) + return true; + else if(item != null && weapon == null){ + tile.setInventorySlotContents(selected, item); + player.inventory.setInventorySlotContents(player.inventory.currentItem, null); + par1World.markBlockForUpdate(i, j, k); + updateSurrounding(par1World, i, j, k); + } + return true; + } + @Override + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List){ + par3List.add(new ItemStack(par1, 1, 0)); + par3List.add(new ItemStack(par1, 1, 1)); + par3List.add(new ItemStack(par1, 1, 2)); + par3List.add(new ItemStack(par1, 1, 3)); + par3List.add(new ItemStack(par1, 1, 4)); + par3List.add(new ItemStack(par1, 1, 5)); + } + + @Override + public int damageDropped(int par1){ + return par1 % 7; + } + + + @Override + public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack){ + if(!par1World.isAirBlock(par2, par3 + 1, par4)){ + par1World.setBlockToAir(par2, par3, par4); + } + else{ + int l = MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + l %= 4; + + TileColorable tile = (TileColorable) par1World.getTileEntity(par2, par3, par4); + tile.rotation = l; + + par1World.setBlockMetadataWithNotify(par2, par3, par4, par6ItemStack.getItemDamage() , 2); + par1World.setBlock(par2, par3 + 1, par4, this, par6ItemStack.getItemDamage() + 7, 2); + } + + } + public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z){ + setBlockBoundsBasedOnState(world, x, y, z); + return super.getCollisionBoundingBoxFromPool(world, x, y, z); + } + + @Override + public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z){ + int meta = world.getBlockMetadata(x, y, z); + if(meta >= 7) + y--; + TileEntity tileentity = world.getTileEntity(x, y, z); + if(!(tileentity instanceof TileColorable)){ + super.setBlockBoundsBasedOnState(world, x, y, z); + return; + } + TileColorable tile = (TileColorable) tileentity; + float xStart = 0; + float zStart = 0; + float xEnd = 1; + float zEnd = 1; + if(tile.rotation == 0) + zStart = 0.7f; + else if(tile.rotation == 2) + zEnd = 0.3f; + else if(tile.rotation == 3) + xStart = 0.7f; + else if(tile.rotation == 1) + xEnd = 0.3f; + if(meta >= 7) + setBlockBounds(xStart, -1, zStart, xEnd, 0.8f, zEnd); + else + setBlockBounds(xStart, 0, zStart, xEnd, 1.8f, zEnd); + } + + @Override + public TileEntity createNewTileEntity(World var1, int var2) { + if(var2 < 7) + return new TileWeaponRack(); + else + return null; + } + + @Override + public void onBlockHarvested(World p_149681_1_, int p_149681_2_, int p_149681_3_, int p_149681_4_, int p_149681_5_, EntityPlayer p_149681_6_) + { + if (p_149681_5_ >= 7 && p_149681_1_.getBlock(p_149681_2_, p_149681_3_ - 1, p_149681_4_) == this) + p_149681_1_.setBlockToAir(p_149681_2_, p_149681_3_ - 1, p_149681_4_); + + else if (p_149681_5_ < 7 && p_149681_1_.getBlock(p_149681_2_, p_149681_3_ + 1, p_149681_4_) == this) + p_149681_1_.setBlockToAir(p_149681_2_, p_149681_3_ + 1, p_149681_4_); + } + + @Override + public void breakBlock(World world, int x, int y, int z, Block block, int p_149749_6_){ + TileNpcContainer tile = (TileNpcContainer)world.getTileEntity(x, y, z); + if (tile == null) + return; + tile.dropItems(world, x, y, z); + + world.func_147453_f(x, y, z, block); + + super.breakBlock(world, x, y, z, block, p_149749_6_); + } +} diff --git a/src/main/java/noppes/npcs/blocks/tiles/TileBanner.java b/src/main/java/noppes/npcs/blocks/tiles/TileBanner.java new file mode 100644 index 000000000..4ff61924f --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/tiles/TileBanner.java @@ -0,0 +1,35 @@ +package noppes.npcs.blocks.tiles; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; + +public class TileBanner extends TileColorable { + + public ItemStack icon; + public long time = 0; + + public void readFromNBT(NBTTagCompound compound){ + super.readFromNBT(compound); + icon = ItemStack.loadItemStackFromNBT(compound.getCompoundTag("BannerIcon")); + } + + public void writeToNBT(NBTTagCompound compound){ + super.writeToNBT(compound); + if(icon != null) + compound.setTag("BannerIcon", icon.writeToNBT(new NBTTagCompound())); + } + + @Override + public AxisAlignedBB getRenderBoundingBox(){ + return AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 2, zCoord + 1); + } + + public boolean canEdit(){ + return System.currentTimeMillis() - time < 10000; + } +} diff --git a/src/main/java/noppes/npcs/blocks/tiles/TileBarrel.java b/src/main/java/noppes/npcs/blocks/tiles/TileBarrel.java new file mode 100644 index 000000000..c286ea239 --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/tiles/TileBarrel.java @@ -0,0 +1,11 @@ +package noppes.npcs.blocks.tiles; + + + +public class TileBarrel extends TileNpcContainer{ + + @Override + public String getName() { + return "tile.npcBarrel.name"; + } +} diff --git a/src/main/java/noppes/npcs/blocks/tiles/TileBeam.java b/src/main/java/noppes/npcs/blocks/tiles/TileBeam.java new file mode 100644 index 000000000..e80281ec2 --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/tiles/TileBeam.java @@ -0,0 +1,8 @@ +package noppes.npcs.blocks.tiles; + +import net.minecraft.util.AxisAlignedBB; + + +public class TileBeam extends TileColorable { + +} diff --git a/src/main/java/noppes/npcs/blocks/tiles/TileBigSign.java b/src/main/java/noppes/npcs/blocks/tiles/TileBigSign.java new file mode 100644 index 000000000..288f1fd7a --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/tiles/TileBigSign.java @@ -0,0 +1,63 @@ +package noppes.npcs.blocks.tiles; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.IChatComponent; +import noppes.npcs.TextBlock; + +public class TileBigSign extends TileEntity { + + public int rotation; + public boolean canEdit = true; + public boolean hasChanged = true; + + private String signText = ""; + public TextBlock block; + + public void readFromNBT(NBTTagCompound compound){ + super.readFromNBT(compound); + rotation = compound.getInteger("SignRotation"); + setText(compound.getString("SignText")); + } + + public void writeToNBT(NBTTagCompound compound){ + super.writeToNBT(compound); + compound.setInteger("SignRotation", rotation); + compound.setString("SignText", signText); + } + + public boolean canUpdate(){ + return false; + } + + public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt){ + NBTTagCompound compound = pkt.func_148857_g(); + readFromNBT(compound); + } + + public void setText(String text){ + this.signText = text; + hasChanged = true; + } + + public String getText(){ + return signText; + } + + @Override + public Packet getDescriptionPacket(){ + NBTTagCompound compound = new NBTTagCompound(); + writeToNBT(compound); + S35PacketUpdateTileEntity packet = new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0, compound); + return packet; + } +} + diff --git a/src/main/java/noppes/npcs/blocks/tiles/TileBlockAnvil.java b/src/main/java/noppes/npcs/blocks/tiles/TileBlockAnvil.java new file mode 100644 index 000000000..a6b5fbf9a --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/tiles/TileBlockAnvil.java @@ -0,0 +1,32 @@ +package noppes.npcs.blocks.tiles; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; + +public class TileBlockAnvil extends TileEntity { + + public TileBlockAnvil(){ + + } + + public boolean canUpdate(){ + return false; + } + +// @Override +// public void updateEntity(){ +// +// } + +// @Override +// public void readFromNBT(NBTTagCompound par1NBTTagCompound) +// { +// super.readFromNBT(par1NBTTagCompound); +// } +// +// @Override +// public void writeToNBT(NBTTagCompound par1NBTTagCompound) +// { +// super.writeToNBT(par1NBTTagCompound); +// } +} diff --git a/src/main/java/noppes/npcs/blocks/tiles/TileBook.java b/src/main/java/noppes/npcs/blocks/tiles/TileBook.java new file mode 100644 index 000000000..8f0a084bd --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/tiles/TileBook.java @@ -0,0 +1,21 @@ +package noppes.npcs.blocks.tiles; + +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + + +public class TileBook extends TileColorable { + public ItemStack book = new ItemStack(Items.writable_book); + public void readFromNBT(NBTTagCompound compound){ + super.readFromNBT(compound); + book = ItemStack.loadItemStackFromNBT(compound.getCompoundTag("Items")); + if(book == null) + book = new ItemStack(Items.writable_book); + } + + public void writeToNBT(NBTTagCompound compound){ + super.writeToNBT(compound); + compound.setTag("Items", book.writeToNBT(new NBTTagCompound())); + } +} diff --git a/src/main/java/noppes/npcs/blocks/tiles/TileBorder.java b/src/main/java/noppes/npcs/blocks/tiles/TileBorder.java new file mode 100644 index 000000000..9012a168f --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/tiles/TileBorder.java @@ -0,0 +1,114 @@ +package noppes.npcs.blocks.tiles; + +import java.util.List; + +import net.minecraft.command.IEntitySelector; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityEnderPearl; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.ChatComponentTranslation; +import noppes.npcs.controllers.Availability; + +public class TileBorder extends TileEntity implements IEntitySelector{ + public Availability availability = new Availability(); + public AxisAlignedBB boundingbox; + public int rotation = 0; + public int height = 10; + public String message = "availability.areaNotAvailble"; + + @Override + public void readFromNBT(NBTTagCompound compound){ + super.readFromNBT(compound); + readExtraNBT(compound); + } + + public void readExtraNBT(NBTTagCompound compound){ + availability.readFromNBT(compound.getCompoundTag("BorderAvailability")); + rotation = compound.getInteger("BorderRotation"); + height = compound.getInteger("BorderHeight"); + message = compound.getString("BorderMessage"); + } + + @Override + public void writeToNBT(NBTTagCompound compound){ + super.writeToNBT(compound); + writeExtraNBT(compound); + } + + public void writeExtraNBT(NBTTagCompound compound){ + compound.setTag("BorderAvailability", availability.writeToNBT(new NBTTagCompound())); + compound.setInteger("BorderRotation", rotation); + compound.setInteger("BorderHeight", height); + compound.setString("BorderMessage", message); + } + + @Override + public void updateEntity() { + if(worldObj.isRemote) + return; + AxisAlignedBB box = AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + height + 1, zCoord + 1); + List list = worldObj.selectEntitiesWithinAABB(Entity.class, box, this); + for(Entity entity : list){ + if(entity instanceof EntityEnderPearl){ + EntityEnderPearl pearl = (EntityEnderPearl) entity; + if(pearl.getThrower() instanceof EntityPlayer && !availability.isAvailable((EntityPlayer)pearl.getThrower())) + entity.isDead = true; + continue; + } + EntityPlayer player = (EntityPlayer) entity; + if(availability.isAvailable(player)) + continue; + int posX = this.xCoord; + int posZ = this.zCoord; + int posY = this.yCoord; + if(rotation == 0){ + posZ--; + } + else if(rotation == 2){ + posZ++; + } + else if(rotation == 1){ + posX++; + } + else if(rotation == 3){ + posX--; + } + while(!worldObj.isAirBlock(posX, posY, posZ)){ + posY++; + } + player.setPositionAndUpdate(posX + 0.5, posY, posZ + 0.5); + if(!message.isEmpty()) + player.addChatComponentMessage(new ChatComponentTranslation(message)); + } + } + public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt){ + NBTTagCompound compound = pkt.func_148857_g(); + rotation = compound.getInteger("Rotation"); + } + + @Override + public Packet getDescriptionPacket(){ + NBTTagCompound compound = new NBTTagCompound(); + compound.setInteger("Rotation", rotation); + S35PacketUpdateTileEntity packet = new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0, compound); + return packet; + + } + + @Override + public boolean canUpdate(){ + return true; + } + + @Override + public boolean isEntityApplicable(Entity var1) { + return var1 instanceof EntityPlayerMP || var1 instanceof EntityEnderPearl; + } +} diff --git a/src/main/java/noppes/npcs/blocks/tiles/TileCampfire.java b/src/main/java/noppes/npcs/blocks/tiles/TileCampfire.java new file mode 100644 index 000000000..178bc5d3d --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/tiles/TileCampfire.java @@ -0,0 +1,7 @@ +package noppes.npcs.blocks.tiles; + + + +public class TileCampfire extends TileColorable { + +} diff --git a/src/main/java/noppes/npcs/blocks/tiles/TileCandle.java b/src/main/java/noppes/npcs/blocks/tiles/TileCandle.java new file mode 100644 index 000000000..21a4c25ae --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/tiles/TileCandle.java @@ -0,0 +1,8 @@ +package noppes.npcs.blocks.tiles; + +import net.minecraft.util.AxisAlignedBB; + + +public class TileCandle extends TileLamp { + +} diff --git a/src/main/java/noppes/npcs/blocks/tiles/TileChair.java b/src/main/java/noppes/npcs/blocks/tiles/TileChair.java new file mode 100644 index 000000000..07cf176a4 --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/tiles/TileChair.java @@ -0,0 +1,8 @@ +package noppes.npcs.blocks.tiles; + +import net.minecraft.util.AxisAlignedBB; + + +public class TileChair extends TileColorable { + +} diff --git a/src/main/java/noppes/npcs/blocks/tiles/TileColorable.java b/src/main/java/noppes/npcs/blocks/tiles/TileColorable.java new file mode 100644 index 000000000..6e5783b33 --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/tiles/TileColorable.java @@ -0,0 +1,54 @@ +package noppes.npcs.blocks.tiles; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; + +public class TileColorable extends TileEntity { + + public int color = 14; + public int rotation; + + public void readFromNBT(NBTTagCompound compound){ + super.readFromNBT(compound); + color = compound.getInteger("BannerColor"); + rotation = compound.getInteger("BannerRotation"); + } + + public void writeToNBT(NBTTagCompound compound){ + super.writeToNBT(compound); + compound.setInteger("BannerColor", color); + compound.setInteger("BannerRotation", rotation); + } + + public boolean canUpdate(){ + return false; + } + + public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt){ + NBTTagCompound compound = pkt.func_148857_g(); + readFromNBT(compound); + } + + @Override + public Packet getDescriptionPacket(){ + NBTTagCompound compound = new NBTTagCompound(); + writeToNBT(compound); + compound.removeTag("Items"); + S35PacketUpdateTileEntity packet = new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0, compound); + return packet; + } + + @Override + public AxisAlignedBB getRenderBoundingBox(){ + return AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1); + } + + public int powerProvided(){ + return 0; + } +} diff --git a/src/main/java/noppes/npcs/blocks/tiles/TileCouchWood.java b/src/main/java/noppes/npcs/blocks/tiles/TileCouchWood.java new file mode 100644 index 000000000..452961139 --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/tiles/TileCouchWood.java @@ -0,0 +1,22 @@ +package noppes.npcs.blocks.tiles; + +import net.minecraft.nbt.NBTTagCompound; + + +public class TileCouchWood extends TileColorable { + public boolean hasLeft = false; + public boolean hasRight = false; + + + public void readFromNBT(NBTTagCompound compound){ + super.readFromNBT(compound); + hasLeft = compound.getBoolean("CouchLeft"); + hasRight = compound.getBoolean("CouchRight"); + } + + public void writeToNBT(NBTTagCompound compound){ + super.writeToNBT(compound); + compound.setBoolean("CouchLeft", hasLeft); + compound.setBoolean("CouchRight", hasRight); + } +} diff --git a/src/main/java/noppes/npcs/blocks/tiles/TileCouchWool.java b/src/main/java/noppes/npcs/blocks/tiles/TileCouchWool.java new file mode 100644 index 000000000..417c1df15 --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/tiles/TileCouchWool.java @@ -0,0 +1,29 @@ +package noppes.npcs.blocks.tiles; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; + + +public class TileCouchWool extends TileColorable { + public boolean hasLeft = false; + public boolean hasRight = false; + public boolean hasCornerLeft = false; + public boolean hasCornerRight = false; + + + public void readFromNBT(NBTTagCompound compound){ + super.readFromNBT(compound); + hasLeft = compound.getBoolean("CouchLeft"); + hasRight = compound.getBoolean("CouchRight"); + hasCornerLeft = compound.getBoolean("CouchCornerLeft"); + hasCornerRight = compound.getBoolean("CouchCornerRight"); + } + + public void writeToNBT(NBTTagCompound compound){ + super.writeToNBT(compound); + compound.setBoolean("CouchLeft", hasLeft); + compound.setBoolean("CouchRight", hasRight); + compound.setBoolean("CouchCornerLeft", hasCornerLeft); + compound.setBoolean("CouchCornerRight", hasCornerRight); + } +} diff --git a/src/main/java/noppes/npcs/blocks/tiles/TileCrate.java b/src/main/java/noppes/npcs/blocks/tiles/TileCrate.java new file mode 100644 index 000000000..3aba46c46 --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/tiles/TileCrate.java @@ -0,0 +1,18 @@ +package noppes.npcs.blocks.tiles; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.world.World; + + +public class TileCrate extends TileNpcContainer{ + + @Override + public String getName() { + return "tile.npcCrate.name"; + } + +} diff --git a/src/main/java/noppes/npcs/blocks/tiles/TileLamp.java b/src/main/java/noppes/npcs/blocks/tiles/TileLamp.java new file mode 100644 index 000000000..2bbecfd12 --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/tiles/TileLamp.java @@ -0,0 +1,7 @@ +package noppes.npcs.blocks.tiles; + + + +public class TileLamp extends TileColorable { + +} diff --git a/src/main/java/noppes/npcs/blocks/tiles/TileMailbox.java b/src/main/java/noppes/npcs/blocks/tiles/TileMailbox.java new file mode 100644 index 000000000..3f25e0bbc --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/tiles/TileMailbox.java @@ -0,0 +1,11 @@ +package noppes.npcs.blocks.tiles; + +import net.minecraft.tileentity.TileEntity; + +public class TileMailbox extends TileEntity { + + + public boolean canUpdate(){ + return false; + } +} diff --git a/src/main/java/noppes/npcs/blocks/tiles/TileNpcContainer.java b/src/main/java/noppes/npcs/blocks/tiles/TileNpcContainer.java new file mode 100644 index 000000000..7e32f2483 --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/tiles/TileNpcContainer.java @@ -0,0 +1,222 @@ +package noppes.npcs.blocks.tiles; + +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.world.World; + + +public abstract class TileNpcContainer extends TileColorable implements IInventory { + private ItemStack[] chestContents; + public String customName = ""; + public int playerUsing = 0; + + public TileNpcContainer(){ + chestContents = new ItemStack[getSizeInventory()]; + } + + @Override + public void readFromNBT(NBTTagCompound compound) + { + super.readFromNBT(compound); + NBTTagList nbttaglist = compound.getTagList("Items", 10); + this.chestContents = new ItemStack[this.getSizeInventory()]; + + if (compound.hasKey("CustomName", 8)) + { + this.customName = compound.getString("CustomName"); + } + + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { + NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); + int j = nbttagcompound1.getByte("Slot") & 255; + + if (j >= 0 && j < this.chestContents.length) + { + this.chestContents[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1); + } + } + } + + @Override + public void writeToNBT(NBTTagCompound compound) + { + super.writeToNBT(compound); + NBTTagList nbttaglist = new NBTTagList(); + + for (int i = 0; i < this.chestContents.length; ++i) + { + if (this.chestContents[i] != null) + { + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + nbttagcompound1.setByte("Slot", (byte)i); + this.chestContents[i].writeToNBT(nbttagcompound1); + nbttaglist.appendTag(nbttagcompound1); + } + } + + compound.setTag("Items", nbttaglist); + + if (this.hasCustomInventoryName()) + { + compound.setString("CustomName", this.customName); + } + } + + public boolean receiveClientEvent(int p_145842_1_, int p_145842_2_) + { + if (p_145842_1_ == 1) + { + this.playerUsing = p_145842_2_; + return true; + } + else + { + return super.receiveClientEvent(p_145842_1_, p_145842_2_); + } + } + + @Override + public int getSizeInventory() { + return 54; + } + + @Override + public ItemStack getStackInSlot(int var1) { + return this.chestContents[var1]; + } + + @Override + public ItemStack decrStackSize(int par1, int par2) { + if (this.chestContents[par1] != null) + { + ItemStack itemstack; + + if (this.chestContents[par1].stackSize <= par2) + { + itemstack = this.chestContents[par1]; + this.chestContents[par1] = null; + this.markDirty(); + return itemstack; + } + else + { + itemstack = this.chestContents[par1].splitStack(par2); + + if (this.chestContents[par1].stackSize == 0) + { + this.chestContents[par1] = null; + } + + this.markDirty(); + return itemstack; + } + } + else + { + return null; + } + } + + @Override + public ItemStack getStackInSlotOnClosing(int par1) { + if (this.chestContents[par1] != null) + { + ItemStack itemstack = this.chestContents[par1]; + this.chestContents[par1] = null; + return itemstack; + } + else + { + return null; + } + } + + @Override + public void setInventorySlotContents(int par1, ItemStack par2ItemStack) { + this.chestContents[par1] = par2ItemStack; + + if (par2ItemStack != null && par2ItemStack.stackSize > this.getInventoryStackLimit()) + { + par2ItemStack.stackSize = this.getInventoryStackLimit(); + } + + this.markDirty(); + } + + @Override + public String getInventoryName() { + return hasCustomInventoryName()?customName:getName(); + } + + public abstract String getName(); + + @Override + public boolean hasCustomInventoryName() { + return !customName.isEmpty(); + } + + @Override + public int getInventoryStackLimit() { + return 64; + } + + @Override + public boolean isUseableByPlayer(EntityPlayer player) { + return player.isDead || this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : player.getDistanceSq((double)this.xCoord + 0.5D, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D) <= 64.0D; + } + + @Override + public void openInventory() { + playerUsing++; + } + + @Override + public void closeInventory() { + playerUsing--; + } + + @Override + public boolean isItemValidForSlot(int var1, ItemStack var2) { + return true; + } + + public void dropItems(World world, int x, int y, int z) { + for (int i1 = 0; i1 < this.getSizeInventory(); ++i1){ + ItemStack itemstack = this.getStackInSlot(i1); + if (itemstack == null) + continue; + + float f = world.rand.nextFloat() * 0.8F + 0.1F; + float f1 = world.rand.nextFloat() * 0.8F + 0.1F; + EntityItem entityitem; + + for (float f2 = world.rand.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; world.spawnEntityInWorld(entityitem)){ + int j1 = world.rand.nextInt(21) + 10; + + if (j1 > itemstack.stackSize){ + j1 = itemstack.stackSize; + } + + itemstack.stackSize -= j1; + entityitem = new EntityItem(world, (double)((float)x + f), (double)((float)y + f1), (double)((float)z + f2), new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + float f3 = 0.05F; + entityitem.motionX = (double)((float)world.rand.nextGaussian() * f3); + entityitem.motionY = (double)((float)world.rand.nextGaussian() * f3 + 0.2F); + entityitem.motionZ = (double)((float)world.rand.nextGaussian() * f3); + + if (itemstack.hasTagCompound()){ + entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy()); + } + + } + } + + } + + +} diff --git a/src/main/java/noppes/npcs/blocks/tiles/TilePedestal.java b/src/main/java/noppes/npcs/blocks/tiles/TilePedestal.java new file mode 100644 index 000000000..2e029cdf8 --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/tiles/TilePedestal.java @@ -0,0 +1,37 @@ +package noppes.npcs.blocks.tiles; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.util.AxisAlignedBB; + + +public class TilePedestal extends TileNpcContainer { + + @Override + public String getName() { + return "tile.npcPedestal.name"; + } + + @Override + public int getSizeInventory() { + return 1; + } + + @Override + public AxisAlignedBB getRenderBoundingBox(){ + return AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 2, zCoord + 1); + } + + @Override + public Packet getDescriptionPacket(){ + NBTTagCompound compound = new NBTTagCompound(); + writeToNBT(compound); + S35PacketUpdateTileEntity packet = new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0, compound); + return packet; + } + + public int powerProvided(){ + return getStackInSlot(0) == null?0:15; + } +} diff --git a/src/main/java/noppes/npcs/blocks/tiles/TileRedstoneBlock.java b/src/main/java/noppes/npcs/blocks/tiles/TileRedstoneBlock.java new file mode 100644 index 000000000..6bd1ed8c9 --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/tiles/TileRedstoneBlock.java @@ -0,0 +1,140 @@ +package noppes.npcs.blocks.tiles; + +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import noppes.npcs.CustomNpcs; +import noppes.npcs.blocks.BlockNpcRedstone; +import noppes.npcs.controllers.Availability; + +public class TileRedstoneBlock extends TileEntity { + public int onRange = 6; + public int offRange = 10; + + public int onRangeX = 6; + public int onRangeY = 6; + public int onRangeZ = 6; + + public int offRangeX = 10; + public int offRangeY = 10; + public int offRangeZ = 10; + + public boolean isDetailed = false; + + public Availability availability = new Availability(); + + public boolean isActivated = false; + + private int ticks = 10; + + @Override + public void updateEntity(){ + if(this.worldObj.isRemote) + return; + ticks--; + if(ticks > 0) + return; + ticks = 20; + Block block = worldObj.getBlock(this.xCoord, this.yCoord, this.zCoord); + if(block == null || block instanceof BlockNpcRedstone == false){ + return; + } + + if(CustomNpcs.FreezeNPCs){ + if(isActivated) + setActive(block,false); + return; + } + if(!isActivated){ + int x = isDetailed?onRangeX:onRange; + int y = isDetailed?onRangeY:onRange; + int z = isDetailed?onRangeZ:onRange; + List list = getPlayerList(x,y,z); + if(list.isEmpty()) + return; + for(EntityPlayer player : list){ + if(availability.isAvailable(player)){ + setActive(block,true); + return; + } + } + } + else{ + int x = isDetailed?offRangeX:offRange; + int y = isDetailed?offRangeY:offRange; + int z = isDetailed?offRangeZ:offRange; + List list = getPlayerList(x,y,z); + for(EntityPlayer player : list){ + if(availability.isAvailable(player)) + return; + } + setActive(block,false); + } + + } + private void setActive(Block block, boolean bo){ + isActivated = bo; + worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, isActivated?1:0,2); + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + block.onBlockAdded(worldObj, xCoord, yCoord, zCoord); + } + private List getPlayerList(int x, int y, int z){ + return worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1).expand(x, y, z)); + } + + @Override + public void readFromNBT(NBTTagCompound compound){ + super.readFromNBT(compound); + onRange = compound.getInteger("BlockOnRange"); + offRange = compound.getInteger("BlockOffRange"); + + isDetailed = compound.getBoolean("BlockIsDetailed"); + if(compound.hasKey("BlockOnRangeX")){ + isDetailed = true; + onRangeX = compound.getInteger("BlockOnRangeX"); + onRangeY = compound.getInteger("BlockOnRangeY"); + onRangeZ = compound.getInteger("BlockOnRangeZ"); + + offRangeX = compound.getInteger("BlockOffRangeX"); + offRangeY = compound.getInteger("BlockOffRangeY"); + offRangeZ = compound.getInteger("BlockOffRangeZ"); + } + + isActivated = compound.getBoolean("BlockActivated"); + + availability.readFromNBT(compound); + + if(worldObj != null) + setActive(getBlockType(), isActivated); + } + + @Override + public void writeToNBT(NBTTagCompound compound){ + super.writeToNBT(compound); + compound.setInteger("BlockOnRange", onRange); + compound.setInteger("BlockOffRange", offRange); + compound.setBoolean("BlockActivated", isActivated); + compound.setBoolean("BlockIsDetailed", isDetailed); + + if(isDetailed){ + compound.setInteger("BlockOnRangeX", onRangeX); + compound.setInteger("BlockOnRangeY", onRangeY); + compound.setInteger("BlockOnRangeZ", onRangeZ); + + compound.setInteger("BlockOffRangeX", offRangeX); + compound.setInteger("BlockOffRangeY", offRangeY); + compound.setInteger("BlockOffRangeZ", offRangeZ); + } + + + availability.writeToNBT(compound); + } + + public boolean canUpdate(){ + return true; + } +} diff --git a/src/main/java/noppes/npcs/blocks/tiles/TileShelf.java b/src/main/java/noppes/npcs/blocks/tiles/TileShelf.java new file mode 100644 index 000000000..1c74928f3 --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/tiles/TileShelf.java @@ -0,0 +1,8 @@ +package noppes.npcs.blocks.tiles; + +import net.minecraft.util.AxisAlignedBB; + + +public class TileShelf extends TileColorable { + +} diff --git a/src/main/java/noppes/npcs/blocks/tiles/TileSign.java b/src/main/java/noppes/npcs/blocks/tiles/TileSign.java new file mode 100644 index 000000000..5ad87a198 --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/tiles/TileSign.java @@ -0,0 +1,9 @@ +package noppes.npcs.blocks.tiles; + +import net.minecraft.util.AxisAlignedBB; + + +public class TileSign extends TileBanner { + + +} diff --git a/src/main/java/noppes/npcs/blocks/tiles/TileStool.java b/src/main/java/noppes/npcs/blocks/tiles/TileStool.java new file mode 100644 index 000000000..c6576a793 --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/tiles/TileStool.java @@ -0,0 +1,8 @@ +package noppes.npcs.blocks.tiles; + +import net.minecraft.util.AxisAlignedBB; + + +public class TileStool extends TileColorable { + +} diff --git a/src/main/java/noppes/npcs/blocks/tiles/TileTable.java b/src/main/java/noppes/npcs/blocks/tiles/TileTable.java new file mode 100644 index 000000000..fbd72ae0a --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/tiles/TileTable.java @@ -0,0 +1,8 @@ +package noppes.npcs.blocks.tiles; + + + +public class TileTable extends TileColorable{ + + +} diff --git a/src/main/java/noppes/npcs/blocks/tiles/TileTallLamp.java b/src/main/java/noppes/npcs/blocks/tiles/TileTallLamp.java new file mode 100644 index 000000000..c2d4e733f --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/tiles/TileTallLamp.java @@ -0,0 +1,12 @@ +package noppes.npcs.blocks.tiles; + +import net.minecraft.util.AxisAlignedBB; + + +public class TileTallLamp extends TileColorable { + + @Override + public AxisAlignedBB getRenderBoundingBox(){ + return AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 2, zCoord + 1); + } +} diff --git a/src/main/java/noppes/npcs/blocks/tiles/TileTombstone.java b/src/main/java/noppes/npcs/blocks/tiles/TileTombstone.java new file mode 100644 index 000000000..3ff3e4902 --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/tiles/TileTombstone.java @@ -0,0 +1,9 @@ +package noppes.npcs.blocks.tiles; + +import noppes.npcs.TextBlock; + + + +public class TileTombstone extends TileBigSign{ + +} diff --git a/src/main/java/noppes/npcs/blocks/tiles/TileWallBanner.java b/src/main/java/noppes/npcs/blocks/tiles/TileWallBanner.java new file mode 100644 index 000000000..030289604 --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/tiles/TileWallBanner.java @@ -0,0 +1,13 @@ +package noppes.npcs.blocks.tiles; + +import net.minecraft.util.AxisAlignedBB; + + +public class TileWallBanner extends TileBanner { + + @Override + public AxisAlignedBB getRenderBoundingBox(){ + return AxisAlignedBB.getBoundingBox(xCoord, yCoord - 1, zCoord, xCoord + 1, yCoord + 1, zCoord + 1); + } + +} diff --git a/src/main/java/noppes/npcs/blocks/tiles/TileWaypoint.java b/src/main/java/noppes/npcs/blocks/tiles/TileWaypoint.java new file mode 100644 index 000000000..564a3f94b --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/tiles/TileWaypoint.java @@ -0,0 +1,80 @@ +package noppes.npcs.blocks.tiles; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.StatCollector; +import noppes.npcs.constants.EnumQuestType; +import noppes.npcs.controllers.PlayerDataController; +import noppes.npcs.controllers.PlayerQuestData; +import noppes.npcs.controllers.QuestData; +import noppes.npcs.quests.QuestLocation; + +public class TileWaypoint extends TileEntity { + + public String name = ""; + + private int ticks = 10; + private List recentlyChecked = new ArrayList(); + private List toCheck; + public int range = 10; + + @Override + public void updateEntity(){ + if(worldObj.isRemote || name.isEmpty()) + return; + ticks--; + if(ticks > 0) + return; + ticks = 10; + + toCheck = getPlayerList(range, range, range); + toCheck.removeAll(recentlyChecked); + + List listMax = getPlayerList(range + 10, range + 10, range + 10); + recentlyChecked.retainAll(listMax); + recentlyChecked.addAll(toCheck); + + if(toCheck.isEmpty()) + return; + for(EntityPlayer player : toCheck){ + PlayerQuestData playerdata = PlayerDataController.instance.getPlayerData(player).questData; + for(QuestData data : playerdata.activeQuests.values()){ + if(data.quest.type != EnumQuestType.Location) + continue; + QuestLocation quest = (QuestLocation) data.quest.questInterface; + if(quest.setFound(data, name)){ + player.addChatMessage(new ChatComponentTranslation(name + " " + StatCollector.translateToLocal("quest.found"))); + + playerdata.checkQuestCompletion(player, EnumQuestType.Location); + } + } + } + } + + private List getPlayerList(int x, int y, int z){ + return worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1).expand(x, y, z)); + } + + @Override + public void readFromNBT(NBTTagCompound compound) { + super.readFromNBT(compound); + name = compound.getString("LocationName"); + range = compound.getInteger("LocationRange"); + if(range < 2) + range = 2; + } + + @Override + public void writeToNBT(NBTTagCompound compound) { + super.writeToNBT(compound); + if(!name.isEmpty()) + compound.setString("LocationName", name); + compound.setInteger("LocationRange", range); + } +} diff --git a/src/main/java/noppes/npcs/blocks/tiles/TileWeaponRack.java b/src/main/java/noppes/npcs/blocks/tiles/TileWeaponRack.java new file mode 100644 index 000000000..ef157881d --- /dev/null +++ b/src/main/java/noppes/npcs/blocks/tiles/TileWeaponRack.java @@ -0,0 +1,48 @@ +package noppes.npcs.blocks.tiles; + +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.util.AxisAlignedBB; + + +public class TileWeaponRack extends TileNpcContainer { + + @Override + public boolean isItemValidForSlot(int var1, ItemStack itemstack) { + if(itemstack != null && itemstack.getItem() instanceof ItemBlock) + return false; + return super.isItemValidForSlot(var1, itemstack); + } + @Override + public int getSizeInventory() { + return 3; + } + + @Override + public AxisAlignedBB getRenderBoundingBox(){ + return AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 2, zCoord + 1); + } + @Override + public String getName() { + return "tile.npcWeaponRack.name"; + } + + @Override + public Packet getDescriptionPacket(){ + NBTTagCompound compound = new NBTTagCompound(); + writeToNBT(compound); + S35PacketUpdateTileEntity packet = new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0, compound); + return packet; + } + public int powerProvided(){ + int power = 0; + for(int i = 0; i < 3; i++){ + if(getStackInSlot(i) != null) + power += 5; + } + return power; + } +} diff --git a/src/main/java/noppes/npcs/client/AnalyticsTracking.java b/src/main/java/noppes/npcs/client/AnalyticsTracking.java new file mode 100644 index 000000000..dc6004b6f --- /dev/null +++ b/src/main/java/noppes/npcs/client/AnalyticsTracking.java @@ -0,0 +1,54 @@ +package noppes.npcs.client; + +import java.io.IOException; +import java.io.OutputStream; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.UUID; + +import net.minecraft.entity.player.EntityPlayer; + +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"; + + 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(); + } + +} diff --git a/src/main/java/noppes/npcs/client/AssetsBrowser.java b/src/main/java/noppes/npcs/client/AssetsBrowser.java new file mode 100644 index 000000000..0501829dd --- /dev/null +++ b/src/main/java/noppes/npcs/client/AssetsBrowser.java @@ -0,0 +1,193 @@ +package noppes.npcs.client; + +import java.io.File; +import java.util.Enumeration; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.AbstractResourcePack; +import net.minecraft.client.resources.FallbackResourceManager; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.client.resources.IResourcePack; +import net.minecraft.client.resources.NPCResourceHelper; +import net.minecraft.client.resources.ResourcePackRepository; +import net.minecraft.client.resources.SimpleReloadableResourceManager; + +import org.apache.commons.lang3.StringUtils; + +import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.ModContainer; +import cpw.mods.fml.common.ObfuscationReflectionHelper; + +public class AssetsBrowser { + public boolean isRoot; + private int depth; + private String folder; + public HashSet folders = new HashSet(); + public HashSet files = new HashSet(); + 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; + } + + private void getFiles() { + folders.clear(); + files.clear(); + + ResourcePackRepository repos = Minecraft.getMinecraft().getResourcePackRepository(); + SimpleReloadableResourceManager simplemanager = (SimpleReloadableResourceManager) Minecraft.getMinecraft().getResourceManager(); + + Map map = ObfuscationReflectionHelper.getPrivateValue(SimpleReloadableResourceManager.class, simplemanager, 2); + HashSet set = new HashSet(); + for(String name: map.keySet()){ + if(!(map.get(name) instanceof FallbackResourceManager)) + continue; + FallbackResourceManager manager = (FallbackResourceManager) map.get(name); + List 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 (ModContainer mod : Loader.instance().getModList()) { + if(mod.getSource().exists()) + progressFile(mod.getSource()); + } +// List list = repos.getRepositoryEntries(); +// System.out.println(repos.rprDefaultResourcePack); +// for(ResourcePackRepository.Entry entry : list) { +// System.out.println(entry.getResourcePack()); +// File file = new File(repos.getDirResourcepacks(),entry.getResourcePackName()); +// if(file.exists()){ +// progressFile(file); +// } +// checkFolder(new File(CustomNpcs.Dir,"assets"),CustomNpcs.Dir.getAbsolutePath().length()); +// } +// File file = new File(repos.getDirResourcepacks(),repos.getResourcePackName()); +// if(file.exists()){ +// 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 entries = zip.entries(); + while(entries.hasMoreElements()){ + ZipEntry zipentry = entries.nextElement(); + String entryName = zipentry.getName(); + checkFile(entryName); + + } + zip.close(); + } + else if(file.isDirectory()){ + int length = file.getAbsolutePath().length(); + checkFolder(file,length); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + 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]); + } + 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; + } + + 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; + } +} diff --git a/src/main/java/noppes/npcs/client/Client.java b/src/main/java/noppes/npcs/client/Client.java new file mode 100644 index 000000000..7d57987b3 --- /dev/null +++ b/src/main/java/noppes/npcs/client/Client.java @@ -0,0 +1,25 @@ +package noppes.npcs.client; + +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; + +import java.io.IOException; + +import noppes.npcs.CustomNpcs; +import noppes.npcs.Server; +import noppes.npcs.constants.EnumPacketServer; +import cpw.mods.fml.common.network.internal.FMLProxyPacket; + +public class Client { + + public static void sendData(EnumPacketServer enu, Object... obs) { + ByteBuf buffer = Unpooled.buffer(); + try { + if(!Server.fillBuffer(buffer, enu, obs)) + return; + CustomNpcs.Channel.sendToServer(new FMLProxyPacket(buffer, "CustomNPCs")); + } catch (IOException e) { + e.printStackTrace(); + } + } +} diff --git a/src/main/java/noppes/npcs/client/ClientEventHandler.java b/src/main/java/noppes/npcs/client/ClientEventHandler.java new file mode 100644 index 000000000..919318be6 --- /dev/null +++ b/src/main/java/noppes/npcs/client/ClientEventHandler.java @@ -0,0 +1,5 @@ +package noppes.npcs.client; + +public class ClientEventHandler { + +} diff --git a/src/main/java/noppes/npcs/client/ClientProxy.java b/src/main/java/noppes/npcs/client/ClientProxy.java new file mode 100644 index 000000000..ed09acadb --- /dev/null +++ b/src/main/java/noppes/npcs/client/ClientProxy.java @@ -0,0 +1,640 @@ +package noppes.npcs.client; + + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.util.Random; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.model.ModelBiped; +import net.minecraft.client.particle.EntityFX; +import net.minecraft.client.particle.EntityFlameFX; +import net.minecraft.client.particle.EntitySmokeFX; +import net.minecraft.client.renderer.RenderGlobal; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.resources.IReloadableResourceManager; +import net.minecraft.client.settings.KeyBinding; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.item.Item; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ReportedException; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; +import net.minecraftforge.client.MinecraftForgeClient; +import net.minecraftforge.common.MinecraftForge; +import noppes.npcs.CommonProxy; +import noppes.npcs.CustomNpcs; +import noppes.npcs.LogWriter; +import noppes.npcs.ModelData; +import noppes.npcs.ModelPartData; +import noppes.npcs.PacketHandlerPlayer; +import noppes.npcs.blocks.tiles.TileBanner; +import noppes.npcs.blocks.tiles.TileBarrel; +import noppes.npcs.blocks.tiles.TileBeam; +import noppes.npcs.blocks.tiles.TileBigSign; +import noppes.npcs.blocks.tiles.TileBlockAnvil; +import noppes.npcs.blocks.tiles.TileBook; +import noppes.npcs.blocks.tiles.TileCampfire; +import noppes.npcs.blocks.tiles.TileCandle; +import noppes.npcs.blocks.tiles.TileChair; +import noppes.npcs.blocks.tiles.TileCouchWood; +import noppes.npcs.blocks.tiles.TileCouchWool; +import noppes.npcs.blocks.tiles.TileCrate; +import noppes.npcs.blocks.tiles.TileLamp; +import noppes.npcs.blocks.tiles.TileMailbox; +import noppes.npcs.blocks.tiles.TilePedestal; +import noppes.npcs.blocks.tiles.TileShelf; +import noppes.npcs.blocks.tiles.TileSign; +import noppes.npcs.blocks.tiles.TileStool; +import noppes.npcs.blocks.tiles.TileTable; +import noppes.npcs.blocks.tiles.TileTallLamp; +import noppes.npcs.blocks.tiles.TileTombstone; +import noppes.npcs.blocks.tiles.TileWallBanner; +import noppes.npcs.blocks.tiles.TileWeaponRack; +import noppes.npcs.client.controllers.ClientCloneController; +import noppes.npcs.client.controllers.MusicController; +import noppes.npcs.client.controllers.PresetController; +import noppes.npcs.client.fx.EntityElementalStaffFX; +import noppes.npcs.client.fx.EntityEnderFX; +import noppes.npcs.client.fx.EntityRainbowFX; +import noppes.npcs.client.gui.GuiBorderBlock; +import noppes.npcs.client.gui.GuiMerchantAdd; +import noppes.npcs.client.gui.GuiNpcDimension; +import noppes.npcs.client.gui.GuiNpcMobSpawner; +import noppes.npcs.client.gui.GuiNpcMobSpawnerMounter; +import noppes.npcs.client.gui.GuiNpcPather; +import noppes.npcs.client.gui.GuiNpcRedstoneBlock; +import noppes.npcs.client.gui.GuiNpcRemoteEditor; +import noppes.npcs.client.gui.GuiNpcWaypoint; +import noppes.npcs.client.gui.GuiScript; +import noppes.npcs.client.gui.global.GuiNPCManageBanks; +import noppes.npcs.client.gui.global.GuiNPCManageDialogs; +import noppes.npcs.client.gui.global.GuiNPCManageFactions; +import noppes.npcs.client.gui.global.GuiNPCManageLinkedNpc; +import noppes.npcs.client.gui.global.GuiNPCManageQuest; +import noppes.npcs.client.gui.global.GuiNPCManageTransporters; +import noppes.npcs.client.gui.global.GuiNpcManageRecipes; +import noppes.npcs.client.gui.global.GuiNpcQuestReward; +import noppes.npcs.client.gui.mainmenu.GuiNPCGlobalMainMenu; +import noppes.npcs.client.gui.mainmenu.GuiNPCInv; +import noppes.npcs.client.gui.mainmenu.GuiNpcAI; +import noppes.npcs.client.gui.mainmenu.GuiNpcAdvanced; +import noppes.npcs.client.gui.mainmenu.GuiNpcDisplay; +import noppes.npcs.client.gui.mainmenu.GuiNpcStats; +import noppes.npcs.client.gui.player.GuiBigSign; +import noppes.npcs.client.gui.player.GuiCrate; +import noppes.npcs.client.gui.player.GuiMailbox; +import noppes.npcs.client.gui.player.GuiMailmanWrite; +import noppes.npcs.client.gui.player.GuiNPCBankChest; +import noppes.npcs.client.gui.player.GuiNPCTrader; +import noppes.npcs.client.gui.player.GuiNpcCarpentryBench; +import noppes.npcs.client.gui.player.GuiNpcFollower; +import noppes.npcs.client.gui.player.GuiNpcFollowerHire; +import noppes.npcs.client.gui.player.GuiTransportSelection; +import noppes.npcs.client.gui.player.companion.GuiNpcCompanionInv; +import noppes.npcs.client.gui.player.companion.GuiNpcCompanionStats; +import noppes.npcs.client.gui.player.companion.GuiNpcCompanionTalents; +import noppes.npcs.client.gui.questtypes.GuiNpcQuestTypeItem; +import noppes.npcs.client.gui.roles.GuiNpcBankSetup; +import noppes.npcs.client.gui.roles.GuiNpcFollowerSetup; +import noppes.npcs.client.gui.roles.GuiNpcItemGiver; +import noppes.npcs.client.gui.roles.GuiNpcTraderSetup; +import noppes.npcs.client.gui.roles.GuiNpcTransporter; +import noppes.npcs.client.model.ModelNPCGolem; +import noppes.npcs.client.model.ModelNpcCrystal; +import noppes.npcs.client.model.ModelNpcDragon; +import noppes.npcs.client.model.ModelNpcSlime; +import noppes.npcs.client.model.ModelSkirtArmor; +import noppes.npcs.client.renderer.NpcItemRenderer; +import noppes.npcs.client.renderer.RenderCustomNpc; +import noppes.npcs.client.renderer.RenderNPCHumanMale; +import noppes.npcs.client.renderer.RenderNPCPony; +import noppes.npcs.client.renderer.RenderNpcCrystal; +import noppes.npcs.client.renderer.RenderNpcDragon; +import noppes.npcs.client.renderer.RenderNpcSlime; +import noppes.npcs.client.renderer.RenderProjectile; +import noppes.npcs.client.renderer.blocks.BlockBannerRenderer; +import noppes.npcs.client.renderer.blocks.BlockBarrelRenderer; +import noppes.npcs.client.renderer.blocks.BlockBeamRenderer; +import noppes.npcs.client.renderer.blocks.BlockBigSignRenderer; +import noppes.npcs.client.renderer.blocks.BlockBloodRenderer; +import noppes.npcs.client.renderer.blocks.BlockBookRenderer; +import noppes.npcs.client.renderer.blocks.BlockBorderRenderer; +import noppes.npcs.client.renderer.blocks.BlockCampfireRenderer; +import noppes.npcs.client.renderer.blocks.BlockCandleRenderer; +import noppes.npcs.client.renderer.blocks.BlockCarpentryBenchRenderer; +import noppes.npcs.client.renderer.blocks.BlockChairRenderer; +import noppes.npcs.client.renderer.blocks.BlockCouchWoodRenderer; +import noppes.npcs.client.renderer.blocks.BlockCouchWoolRenderer; +import noppes.npcs.client.renderer.blocks.BlockCrateRenderer; +import noppes.npcs.client.renderer.blocks.BlockLampRenderer; +import noppes.npcs.client.renderer.blocks.BlockMailboxRenderer; +import noppes.npcs.client.renderer.blocks.BlockPedestalRenderer; +import noppes.npcs.client.renderer.blocks.BlockShelfRenderer; +import noppes.npcs.client.renderer.blocks.BlockSignRenderer; +import noppes.npcs.client.renderer.blocks.BlockStoolRenderer; +import noppes.npcs.client.renderer.blocks.BlockTableRenderer; +import noppes.npcs.client.renderer.blocks.BlockTallLampRenderer; +import noppes.npcs.client.renderer.blocks.BlockTombstoneRenderer; +import noppes.npcs.client.renderer.blocks.BlockWallBannerRenderer; +import noppes.npcs.client.renderer.blocks.BlockWeaponRackRenderer; +import noppes.npcs.config.StringCache; +import noppes.npcs.constants.EnumGuiType; +import noppes.npcs.containers.ContainerCarpentryBench; +import noppes.npcs.containers.ContainerCrate; +import noppes.npcs.containers.ContainerMail; +import noppes.npcs.containers.ContainerManageBanks; +import noppes.npcs.containers.ContainerManageRecipes; +import noppes.npcs.containers.ContainerNPCBankInterface; +import noppes.npcs.containers.ContainerNPCCompanion; +import noppes.npcs.containers.ContainerNPCFollower; +import noppes.npcs.containers.ContainerNPCFollowerHire; +import noppes.npcs.containers.ContainerNPCFollowerSetup; +import noppes.npcs.containers.ContainerNPCInv; +import noppes.npcs.containers.ContainerNPCTrader; +import noppes.npcs.containers.ContainerNPCTraderSetup; +import noppes.npcs.containers.ContainerNpcItemGiver; +import noppes.npcs.containers.ContainerNpcQuestReward; +import noppes.npcs.containers.ContainerNpcQuestTypeItem; +import noppes.npcs.entity.EntityCustomNpc; +import noppes.npcs.entity.EntityNPCGolem; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.entity.EntityNpcCrystal; +import noppes.npcs.entity.EntityNpcDragon; +import noppes.npcs.entity.EntityNpcPony; +import noppes.npcs.entity.EntityNpcSlime; +import noppes.npcs.entity.EntityProjectile; + +import org.lwjgl.input.Keyboard; + +import tconstruct.client.tabs.InventoryTabFactions; +import tconstruct.client.tabs.InventoryTabQuests; +import tconstruct.client.tabs.InventoryTabVanilla; +import tconstruct.client.tabs.TabRegistry; +import cpw.mods.fml.client.registry.ClientRegistry; +import cpw.mods.fml.client.registry.RenderingRegistry; +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.ObfuscationReflectionHelper; + +public class ClientProxy extends CommonProxy { + public static KeyBinding QuestLog; + + public static FontContainer Font; + + public void load() { + Font = new FontContainer(CustomNpcs.FontType, CustomNpcs.FontSize); + createFolders(); + CustomNpcs.Channel.register(new PacketHandlerClient()); + CustomNpcs.ChannelPlayer.register(new PacketHandlerPlayer()); + new MusicController(); + + 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(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()); + RenderingRegistry.registerBlockHandler(new BlockBorderRenderer()); + + if(!CustomNpcs.DisableExtraBlock){ + ClientRegistry.bindTileEntitySpecialRenderer(TileBanner.class, new BlockBannerRenderer()); + ClientRegistry.bindTileEntitySpecialRenderer(TileWallBanner.class, new BlockWallBannerRenderer()); + ClientRegistry.bindTileEntitySpecialRenderer(TileTallLamp.class, new BlockTallLampRenderer()); + 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 BlockLampRenderer()); + 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()); + } + Minecraft mc = Minecraft.getMinecraft(); + + QuestLog = new KeyBinding("Quest Log", Keyboard.KEY_L, "key.categories.gameplay"); + + ClientRegistry.registerKeyBinding(QuestLog); + mc.gameSettings.loadOptions(); + + new PresetController(CustomNpcs.Dir); + + if(CustomNpcs.EnableUpdateChecker){ + VersionChecker checker = new VersionChecker(); + checker.start(); + } + + ClientCloneController.Instance = new ClientCloneController(); + + MinecraftForge.EVENT_BUS.register(new ClientEventHandler()); + + if(CustomNpcs.InventoryGuiEnabled){ + MinecraftForge.EVENT_BUS.register(new TabRegistry()); + + if (TabRegistry.getTabList().size() < 2){ + TabRegistry.registerTab(new InventoryTabVanilla()); + } + TabRegistry.registerTab(new InventoryTabFactions()); + TabRegistry.registerTab(new InventoryTabQuests()); + } + } + + 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 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(); + + File cache = new File(check,"cache"); + if(!cache.exists()) + cache.mkdir(); + ((IReloadableResourceManager)Minecraft.getMinecraft().getResourceManager()).registerReloadListener(new CustomNpcResourceListener()); + } + + @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); + } + + 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.MainMenuAdvanced) + return new GuiNpcAdvanced(npc); + + 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.MovingPath) + return new GuiNpcPather(npc); + + else if (gui == EnumGuiType.ManageFactions) + return new GuiNPCManageFactions(npc); + + else if (gui == EnumGuiType.ManageLinked) + return new GuiNPCManageLinkedNpc(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.ManageDialogs) + return new GuiNPCManageDialogs(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.MainMenuGlobal) + return new GuiNPCGlobalMainMenu(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.PlayerFollower) + return new GuiNpcFollower(npc, (ContainerNPCFollower) 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.PlayerTransporter) + return new GuiTransportSelection(npc); + + else if(gui == EnumGuiType.Script) + return new GuiScript(npc); + + else if(gui == EnumGuiType.PlayerAnvil) + return new GuiNpcCarpentryBench((ContainerCarpentryBench) 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.SetupTrader) + return new GuiNpcTraderSetup(npc, (ContainerNPCTraderSetup) container); + + else if(gui == EnumGuiType.SetupTransporter) + return new GuiNpcTransporter(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.PlayerMailman) + return new GuiMailmanWrite((ContainerMail) container, x == 1, y == 1); + + else if(gui == EnumGuiType.PlayerMailbox) + return new GuiMailbox(); + + else if(gui == EnumGuiType.MerchantAdd) + return new GuiMerchantAdd(); + + else if(gui == EnumGuiType.Crate) + return new GuiCrate((ContainerCrate)container); + + else if(gui == EnumGuiType.NpcDimensions) + return new GuiNpcDimension(); + + 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.RedstoneBlock) + return new GuiNpcRedstoneBlock(x, y, z); + + else if(gui == EnumGuiType.MobSpawner) + return new GuiNpcMobSpawner(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.Companion) + return new GuiNpcCompanionStats(npc); + + else if (gui == EnumGuiType.CompanionTalent) + return new GuiNpcCompanionTalents(npc); + + else if (gui == EnumGuiType.CompanionInv) + return new GuiNpcCompanionInv(npc, (ContainerNPCCompanion) container); + 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) { + 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); + } + } + + + public static class FontContainer { + private StringCache textFont = null; + public boolean useCustomFont = true; + + 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 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 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 String getName() { + if(!useCustomFont) + return "Minecraft"; + return textFont.usedFont().getFontName(); + } + } +} diff --git a/src/main/java/noppes/npcs/client/ClientTickHandler.java b/src/main/java/noppes/npcs/client/ClientTickHandler.java new file mode 100644 index 000000000..06cd83b1a --- /dev/null +++ b/src/main/java/noppes/npcs/client/ClientTickHandler.java @@ -0,0 +1,55 @@ +package noppes.npcs.client; + +import net.minecraft.client.Minecraft; +import net.minecraft.inventory.ContainerPlayer; +import net.minecraft.world.World; +import noppes.npcs.CustomNpcs; +import noppes.npcs.NoppesUtilPlayer; +import noppes.npcs.client.controllers.MusicController; +import noppes.npcs.client.gui.player.GuiQuestLog; +import noppes.npcs.client.renderer.RenderNPCInterface; +import noppes.npcs.constants.EnumPlayerPacket; +import cpw.mods.fml.common.eventhandler.EventPriority; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.gameevent.InputEvent; +import cpw.mods.fml.common.gameevent.TickEvent; +import cpw.mods.fml.common.gameevent.TickEvent.Phase; + +public class ClientTickHandler{ + + private World prevWorld; + private boolean otherContainer = false; + + @SubscribeEvent(priority = EventPriority.LOWEST) + public void onClientTick(TickEvent.ClientTickEvent event){ + if(event.phase == Phase.END) + return; + Minecraft mc = Minecraft.getMinecraft(); + if(mc.thePlayer != null && mc.thePlayer.openContainer instanceof ContainerPlayer){ + if(otherContainer){ + NoppesUtilPlayer.sendData(EnumPlayerPacket.CheckQuestCompletion); + otherContainer = false; + } + } + else + otherContainer = true; + CustomNpcs.ticks++; + RenderNPCInterface.LastTextureTick++; + if(prevWorld != mc.theWorld){ + prevWorld = mc.theWorld; + MusicController.Instance.stopMusic(); + } + } + + @SubscribeEvent + public void onKey(InputEvent.KeyInputEvent event){ + if(ClientProxy.QuestLog.isPressed()){ + Minecraft mc = Minecraft.getMinecraft(); + if(mc.currentScreen == null) + NoppesUtil.openGUI(mc.thePlayer, new GuiQuestLog(mc.thePlayer)); + else if(mc.currentScreen instanceof GuiQuestLog) + mc.setIngameFocus(); + } + } + +} diff --git a/src/main/java/noppes/npcs/client/CustomNpcResourceListener.java b/src/main/java/noppes/npcs/client/CustomNpcResourceListener.java new file mode 100644 index 000000000..1cc2f1c80 --- /dev/null +++ b/src/main/java/noppes/npcs/client/CustomNpcResourceListener.java @@ -0,0 +1,85 @@ +package noppes.npcs.client; + +import java.awt.Graphics; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; + +import javax.imageio.ImageIO; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.FolderResourcePack; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.client.resources.IResourceManagerReloadListener; +import net.minecraft.client.resources.SimpleReloadableResourceManager; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; +import noppes.npcs.CustomNpcs; +import noppes.npcs.LogWriter; + +public class CustomNpcResourceListener implements + 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; + } + } + } + + + 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); + } + } + +} diff --git a/src/main/java/noppes/npcs/client/EntityUtil.java b/src/main/java/noppes/npcs/client/EntityUtil.java new file mode 100644 index 000000000..8da93fe43 --- /dev/null +++ b/src/main/java/noppes/npcs/client/EntityUtil.java @@ -0,0 +1,103 @@ +package noppes.npcs.client; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.boss.EntityDragon; +import net.minecraft.entity.passive.EntityChicken; +import net.minecraft.entity.player.EntityPlayer; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.entity.EntityNpcPony; + +public class EntityUtil { + + 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.moveForward = copied.moveForward; + entity.moveStrafing = copied.moveStrafing; + + 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.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.renderYawOffset = copied.renderYawOffset; + + 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.swingProgress = copied.swingProgress; + entity.prevSwingProgress = copied.prevSwingProgress; + entity.isSwingInProgress = copied.isSwingInProgress; + entity.swingProgressInt = copied.swingProgressInt; + + entity.ticksExisted = copied.ticksExisted; + + if(entity instanceof EntityPlayer && copied instanceof EntityPlayer){ + EntityPlayer ePlayer = (EntityPlayer) entity; + EntityPlayer cPlayer = (EntityPlayer) copied; + + 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; + } + + 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)); + } + + if(copied instanceof EntityNPCInterface && entity instanceof EntityNPCInterface){ + EntityNPCInterface npc = (EntityNPCInterface) copied; + EntityNPCInterface target = (EntityNPCInterface) entity; + + target.textureLocation = npc.textureLocation; + target.textureGlowLocation = npc.textureGlowLocation; + target.textureCloakLocation = npc.textureCloakLocation; + target.display = npc.display; + target.inventory = npc.inventory; + + target.currentAnimation = npc.currentAnimation; + + target.setDataWatcher(npc.getDataWatcher()); + } + } +} diff --git a/src/main/java/noppes/npcs/client/ImageDownloadAlt.java b/src/main/java/noppes/npcs/client/ImageDownloadAlt.java new file mode 100644 index 000000000..f32e81c3b --- /dev/null +++ b/src/main/java/noppes/npcs/client/ImageDownloadAlt.java @@ -0,0 +1,175 @@ +package noppes.npcs.client; + +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.concurrent.atomic.AtomicInteger; + +import javax.imageio.ImageIO; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.IImageBuffer; +import net.minecraft.client.renderer.texture.SimpleTexture; +import net.minecraft.client.renderer.texture.TextureUtil; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.util.ResourceLocation; + +import org.apache.commons.io.FileUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class ImageDownloadAlt extends SimpleTexture +{ + private static final Logger logger = LogManager.getLogger(); + private static final AtomicInteger threadDownloadCounter = new AtomicInteger(0); + private final File cacheFile; + private final String imageUrl; + private final IImageBuffer imageBuffer; + private BufferedImage bufferedImage; + private Thread imageThread; + private boolean textureUploaded; + + 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) + { + this.deleteGlTexture(); + } + + TextureUtil.uploadTextureImage(super.getGlTextureId(), this.bufferedImage); + this.textureUploaded = true; + } + } + } + + public int getGlTextureId() + { + this.checkTextureUploaded(); + return super.getGlTextureId(); + } + + public void setBufferedImage(BufferedImage p_147641_1_) + { + this.bufferedImage = p_147641_1_; + + if (this.imageBuffer != null) + { + this.imageBuffer.func_152634_a(); + } + } + + 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}); + + try + { + this.bufferedImage = ImageIO.read(this.cacheFile); + + if (this.imageBuffer != null) + { + this.setBufferedImage(this.imageBuffer.parseUserSkin(this.bufferedImage)); + } + } + catch (IOException ioexception) + { + logger.error("Couldn\'t load skin " + this.cacheFile, ioexception); + this.loadTextureFromServer(); + } + } + else + { + this.loadTextureFromServer(); + } + } + } + + protected void loadTextureFromServer() + { + this.imageThread = new Thread("Texture Downloader #" + threadDownloadCounter.incrementAndGet()) + { + private static final String __OBFID = "CL_00001050"; + public void run() + { + HttpURLConnection connection = null; + ImageDownloadAlt.logger.debug("Downloading http texture from {} to {}", new Object[] {ImageDownloadAlt.this.imageUrl, ImageDownloadAlt.this.cacheFile}); + + try + { + connection = (HttpURLConnection)(new URL(ImageDownloadAlt.this.imageUrl)).openConnection(Minecraft.getMinecraft().getProxy()); + connection.setDoInput(true); + connection.setDoOutput(false); + connection.setRequestProperty("Content-Type", "image/png"); + connection.setRequestProperty("Expect", "100-continue"); + //connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 5.1; rv:19.0) Gecko/20100101 Firefox/19.0"); + connection.setRequestProperty("User-Agent", "Mozilla/5.0"); + connection.connect(); + + if (connection.getResponseCode() / 100 != 2) + { + return; + } + + BufferedImage bufferedimage; + + if (ImageDownloadAlt.this.cacheFile != null) + { + FileUtils.copyInputStreamToFile(connection.getInputStream(), ImageDownloadAlt.this.cacheFile); + bufferedimage = ImageIO.read(ImageDownloadAlt.this.cacheFile); + } + else + { + bufferedimage = ImageIO.read(connection.getInputStream()); + } + + if (ImageDownloadAlt.this.imageBuffer != null) + { + bufferedimage = ImageDownloadAlt.this.imageBuffer.parseUserSkin(bufferedimage); + } + + ImageDownloadAlt.this.setBufferedImage(bufferedimage); + } + catch (Exception exception) + { + ImageDownloadAlt.logger.error("Couldn\'t download http texture", exception); + } + finally + { + if (connection != null) + { + connection.disconnect(); + } + } + } + }; + this.imageThread.setDaemon(true); + this.imageThread.start(); + } +} diff --git a/src/main/java/noppes/npcs/client/NoppesUtil.java b/src/main/java/noppes/npcs/client/NoppesUtil.java new file mode 100644 index 000000000..945911008 --- /dev/null +++ b/src/main/java/noppes/npcs/client/NoppesUtil.java @@ -0,0 +1,240 @@ +package noppes.npcs.client; + +import io.netty.buffer.ByteBuf; + +import java.io.File; +import java.io.IOException; +import java.net.URI; +import java.util.HashMap; +import java.util.Random; +import java.util.Vector; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.PositionedSoundRecord; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.Util; +import net.minecraft.world.World; +import noppes.npcs.CustomNpcs; +import noppes.npcs.NoppesUtilPlayer; +import noppes.npcs.Server; +import noppes.npcs.client.gui.player.GuiDialogInteract; +import noppes.npcs.client.gui.player.GuiQuestCompletion; +import noppes.npcs.client.gui.util.GuiContainerNPCInterface; +import noppes.npcs.client.gui.util.GuiNPCInterface; +import noppes.npcs.client.gui.util.IScrollData; +import noppes.npcs.constants.EnumGuiType; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.constants.EnumPlayerPacket; +import noppes.npcs.controllers.Dialog; +import noppes.npcs.controllers.DialogController; +import noppes.npcs.controllers.Quest; +import noppes.npcs.entity.EntityNPCInterface; + +import org.lwjgl.Sys; + +public class NoppesUtil { + + public static void requestOpenGUI(EnumGuiType gui) { + requestOpenGUI(gui, 0, 0, 0); + } + + public static void requestOpenGUI(EnumGuiType gui, int i, int j, int k) { + Client.sendData(EnumPacketServer.Gui, gui.ordinal(), i, j, k); + } + + public static void spawnParticle(ByteBuf buffer) throws IOException{ + double posX = buffer.readDouble(); + double posY = buffer.readDouble(); + double posZ = buffer.readDouble(); + float height = buffer.readFloat(); + float width = buffer.readFloat(); + float yOffset = buffer.readFloat(); + + String particle = Server.readString(buffer); + World worldObj = Minecraft.getMinecraft().theWorld; + + Random rand = worldObj.rand; + if(particle.equals("heal")){ + for (int k = 0; k < 6; k++) + { + worldObj.spawnParticle("instantSpell", posX + (rand.nextDouble() - 0.5D) * (double)width, (posY + rand.nextDouble() * (double)height) - (double)yOffset, posZ + (rand.nextDouble() - 0.5D) * (double)width, 0, 0, 0); + worldObj.spawnParticle("spell", posX + (rand.nextDouble() - 0.5D) * (double)width, (posY + rand.nextDouble() * (double)height) - (double)yOffset, posZ + (rand.nextDouble() - 0.5D) * (double)width, 0, 0, 0); + } + } + } + + public static void 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; + } + + public static void openGUI(EntityPlayer player, Object guiscreen) { + CustomNpcs.proxy.openGui(player, guiscreen); + } + + public static void openFolder(File dir){ + String s = dir.getAbsolutePath(); + + if (Util.getOSType() == Util.EnumOS.OSX) + { + try + { + //logger.info(s); + Runtime.getRuntime().exec(new String[] {"/usr/bin/open", s}); + return; + } + 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}); + + try + { + Runtime.getRuntime().exec(s1); + return; + } + catch (IOException ioexception) + { + //logger.error("Couldn\'t open file", ioexception); + } + } + + boolean flag = false; + + 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) + { + //logger.error("Couldn\'t open link", throwable); + flag = true; + } + + 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 data = new Vector(); + String line; + + try { + int size = buffer.readInt(); + for(int i = 0; i < size; i++){ + data.add(Server.readString(buffer)); + } + } catch (Exception e) { + + } + + ((IScrollData)gui).setData(data,null); + } + + private static HashMap data = new HashMap(); + + public static void addScrollData(ByteBuf buffer) { + try { + int size = buffer.readInt(); + for(int i = 0; i < size; i++){ + int id = buffer.readInt(); + String name = Server.readString(buffer); + data.put(name, id); + } + } catch (Exception e) { + } + } + + public static void setScrollData(ByteBuf buffer) { + GuiScreen gui = Minecraft.getMinecraft().currentScreen; + if(gui == null) + return; + try { + int size = buffer.readInt(); + for(int i = 0; i < size; i++){ + int id = buffer.readInt(); + String name = Server.readString(buffer); + data.put(name, id); + } + } catch (Exception e) { + } + 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(data.keySet()), data); + data = new HashMap(); + } + + public static void guiQuestCompletion(EntityPlayer player, NBTTagCompound read) { + Quest quest = new Quest(); + quest.readNBT(read); + if (!quest.completeText.equals("")) + NoppesUtil.openGUI(player, new GuiQuestCompletion(quest)); + else + NoppesUtilPlayer.sendData(EnumPlayerPacket.QuestCompletion, quest.id); + } + + public static void openDialog(NBTTagCompound compound, EntityNPCInterface npc, EntityPlayer player){ + if(DialogController.instance == null) + DialogController.instance = new DialogController(); + 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"); + + TileEntity tile = player.worldObj.getTileEntity(x, y, z); + tile.readFromNBT(compound); + + 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); + + CustomNpcs.proxy.openGui(x, y, z, EnumGuiType.Waypoint, player); + } + +} diff --git a/src/main/java/noppes/npcs/client/PacketHandlerClient.java b/src/main/java/noppes/npcs/client/PacketHandlerClient.java new file mode 100644 index 000000000..4331b1d43 --- /dev/null +++ b/src/main/java/noppes/npcs/client/PacketHandlerClient.java @@ -0,0 +1,258 @@ +package noppes.npcs.client; + +import io.netty.buffer.ByteBuf; + +import java.io.IOException; +import java.util.HashMap; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.achievement.GuiAchievement; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.network.PacketBuffer; +import net.minecraft.stats.Achievement; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.StatCollector; +import net.minecraft.village.MerchantRecipeList; +import noppes.npcs.CustomNpcs; +import noppes.npcs.NoppesStringUtils; +import noppes.npcs.PacketHandlerServer; +import noppes.npcs.Server; +import noppes.npcs.ServerEventsHandler; +import noppes.npcs.client.ClientProxy.FontContainer; +import noppes.npcs.client.controllers.MusicController; +import noppes.npcs.client.gui.GuiNpcMobSpawnerAdd; +import noppes.npcs.client.gui.player.GuiBook; +import noppes.npcs.client.gui.util.GuiContainerNPCInterface; +import noppes.npcs.client.gui.util.GuiNPCInterface; +import noppes.npcs.client.gui.util.IGuiClose; +import noppes.npcs.client.gui.util.IGuiData; +import noppes.npcs.client.gui.util.IGuiError; +import noppes.npcs.client.gui.util.IScrollData; +import noppes.npcs.constants.EnumGuiType; +import noppes.npcs.constants.EnumPacketClient; +import noppes.npcs.controllers.RecipeCarpentry; +import noppes.npcs.controllers.RecipeController; +import noppes.npcs.entity.EntityDialogNpc; +import noppes.npcs.entity.EntityNPCInterface; +import cpw.mods.fml.common.ObfuscationReflectionHelper; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.network.FMLNetworkEvent.ClientCustomPacketEvent; + +public class PacketHandlerClient extends PacketHandlerServer{ + + @SubscribeEvent + public void onPacketData(ClientCustomPacketEvent event) { + EntityPlayer player = Minecraft.getMinecraft().thePlayer; + ByteBuf buffer = event.packet.payload(); + try { + client(buffer,(EntityPlayer) player,EnumPacketClient.values()[buffer.readInt()]); + } catch (IOException e) { + e.printStackTrace(); + } + } + + private void client(ByteBuf buffer, final EntityPlayer player, EnumPacketClient type) throws IOException{ + if(type == EnumPacketClient.CHATBUBBLE){ + Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(buffer.readInt()); + if(entity == null || !(entity instanceof EntityNPCInterface)) + return; + EntityNPCInterface npc = (EntityNPCInterface) entity; + if(npc.messages == null) + npc.messages = new RenderChatMessages(); + String text = NoppesStringUtils.formatText(Server.readString(buffer), player, npc); + npc.messages.addMessage(text, npc); + + if(buffer.readBoolean()) + player.addChatMessage(new ChatComponentTranslation(npc.getCommandSenderName() + ": " + text)); + } + else if(type == EnumPacketClient.CHAT){ + String message = ""; + String str; + while((str = Server.readString(buffer)) != null && !str.isEmpty()) + message += StatCollector.translateToLocal(str); + + player.addChatMessage(new ChatComponentTranslation(message)); + } + else if(type == EnumPacketClient.MESSAGE){ + String description = StatCollector.translateToLocal(Server.readString(buffer)); + String message = Server.readString(buffer); + Achievement ach = new QuestAchievement(message, description); + Minecraft.getMinecraft().guiAchievement.func_146256_a(ach); + ObfuscationReflectionHelper.setPrivateValue(GuiAchievement.class, Minecraft.getMinecraft().guiAchievement, ach.getDescription(), 4); + } + else if(type == EnumPacketClient.SYNCRECIPES_ADD){ + NBTTagList list = Server.readNBT(buffer).getTagList("recipes", 10); + if(list == null) + return; + for(int i = 0; i < list.tagCount(); i++) + { + RecipeCarpentry recipe = RecipeCarpentry.read(list.getCompoundTagAt(i)); + RecipeController.syncRecipes.put(recipe.id,recipe); + } + + } + else if(type == EnumPacketClient.SYNCRECIPES_WORKBENCH){ + RecipeController.reloadGlobalRecipes(RecipeController.syncRecipes); + RecipeController.syncRecipes = new HashMap(); + } + else if(type == EnumPacketClient.SYNCRECIPES_CARPENTRYBENCH){ + RecipeController.instance.anvilRecipes = RecipeController.syncRecipes; + RecipeController.syncRecipes = new HashMap(); + } + else if(type == EnumPacketClient.DIALOG){ + Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(buffer.readInt()); + if(entity == null || !(entity instanceof EntityNPCInterface)) + return; + NoppesUtil.openDialog(Server.readNBT(buffer), (EntityNPCInterface) entity, player); + } + else if(type == EnumPacketClient.DIALOG_DUMMY){ + EntityDialogNpc npc = new EntityDialogNpc(player.worldObj); + npc.display.name = Server.readString(buffer); + EntityUtil.Copy(player, npc); + NoppesUtil.openDialog(Server.readNBT(buffer), npc, player); + } + else if(type == EnumPacketClient.QUEST_COMPLETION){ + NoppesUtil.guiQuestCompletion(player, Server.readNBT(buffer)); + } + else if(type == EnumPacketClient.EDIT_NPC){ + Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(buffer.readInt()); + if(entity == null || !(entity instanceof EntityNPCInterface)) + return; + NoppesUtil.setLastNpc((EntityNPCInterface) entity); + } + else if(type == EnumPacketClient.PLAY_MUSIC){ + MusicController.Instance.playMusic(Server.readString(buffer), player); + } + else if(type == EnumPacketClient.PLAY_SOUND){ + MusicController.Instance.playSound(Server.readString(buffer),buffer.readFloat(),buffer.readFloat(),buffer.readFloat()); + } + else if(type == EnumPacketClient.UPDATE_NPC){ + NBTTagCompound compound = Server.readNBT(buffer); + Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(compound.getInteger("EntityId")); + if(entity == null || !(entity instanceof EntityNPCInterface)) + return; + ((EntityNPCInterface)entity).readSpawnData(compound); + } + else if(type == EnumPacketClient.ROLE){ + NBTTagCompound compound = Server.readNBT(buffer); + Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(compound.getInteger("EntityId")); + if(entity == null || !(entity instanceof EntityNPCInterface)) + return; + ((EntityNPCInterface)entity).advanced.setRole(compound.getInteger("Role")); + ((EntityNPCInterface)entity).roleInterface.readFromNBT(compound); + NoppesUtil.setLastNpc((EntityNPCInterface) entity); + } + else if(type == EnumPacketClient.GUI){ + EnumGuiType gui = EnumGuiType.values()[buffer.readInt()]; + CustomNpcs.proxy.openGui(NoppesUtil.getLastNpc(), gui, buffer.readInt(), buffer.readInt(), buffer.readInt()); + } + else if(type == EnumPacketClient.PARTICLE){ + NoppesUtil.spawnParticle(buffer); + } + else if(type == EnumPacketClient.DELETE_NPC){ + Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(buffer.readInt()); + if(entity == null || !(entity instanceof EntityNPCInterface)) + return; + ((EntityNPCInterface)entity).delete(); + } + else if(type == EnumPacketClient.SCROLL_LIST){ + NoppesUtil.setScrollList(buffer); + } + else if(type == EnumPacketClient.SCROLL_DATA){ + NoppesUtil.setScrollData(buffer); + } + else if(type == EnumPacketClient.SCROLL_DATA_PART){ + NoppesUtil.addScrollData(buffer); + } + else if(type == EnumPacketClient.SCROLL_SELECTED){ + GuiScreen gui = Minecraft.getMinecraft().currentScreen; + if(gui == null || !(gui instanceof IScrollData)) + return; + String selected = Server.readString(buffer); + + ((IScrollData)gui).setSelected(selected); + } + else if(type == EnumPacketClient.GUI_REDSTONE){ + NoppesUtil.saveRedstoneBlock(player, Server.readNBT(buffer)); + } + else if(type == EnumPacketClient.GUI_WAYPOINT){ + NoppesUtil.saveWayPointBlock(player, Server.readNBT(buffer)); + } + else if(type == EnumPacketClient.CLONE){ + NBTTagCompound compound = Server.readNBT(buffer); + NoppesUtil.openGUI(player, new GuiNpcMobSpawnerAdd(compound)); + } + else if(type == EnumPacketClient.GUI_DATA){ + GuiScreen gui = Minecraft.getMinecraft().currentScreen; + if(gui == null) + return; + + if(gui instanceof GuiNPCInterface && ((GuiNPCInterface)gui).hasSubGui()){ + gui = (GuiScreen) ((GuiNPCInterface)gui).getSubGui(); + } + else if(gui instanceof GuiContainerNPCInterface && ((GuiContainerNPCInterface)gui).hasSubGui()){ + gui = (GuiScreen) ((GuiContainerNPCInterface)gui).getSubGui(); + } + if(gui instanceof IGuiData) + ((IGuiData)gui).setGuiData(Server.readNBT(buffer)); + } + else if(type == EnumPacketClient.GUI_ERROR){ + GuiScreen gui = Minecraft.getMinecraft().currentScreen; + if(gui == null || !(gui instanceof IGuiError)) + return; + + int i = buffer.readInt(); + NBTTagCompound compound = Server.readNBT(buffer); + + ((IGuiError)gui).setError(i, compound); + } + else if(type == EnumPacketClient.GUI_CLOSE){ + GuiScreen gui = Minecraft.getMinecraft().currentScreen; + if(gui == null) + return; + + if(gui instanceof IGuiClose){ + int i = buffer.readInt(); + NBTTagCompound compound = Server.readNBT(buffer); + ((IGuiClose)gui).setClose(i, compound); + } + + Minecraft mc = Minecraft.getMinecraft(); + mc.displayGuiScreen(null); + mc.setIngameFocus(); + } + else if(type == EnumPacketClient.VILLAGER_LIST){ + MerchantRecipeList merchantrecipelist = MerchantRecipeList.func_151390_b(new PacketBuffer(buffer)); + ServerEventsHandler.Merchant.setRecipes(merchantrecipelist); + } + else if(type == EnumPacketClient.OPEN_BOOK){ + int x = buffer.readInt(), y = buffer.readInt(), z = buffer.readInt(); + + NoppesUtil.openGUI(player, new GuiBook(player, ItemStack.loadItemStackFromNBT(Server.readNBT(buffer)), x, y, z)); + } + else if(type == EnumPacketClient.CONFIG){ + int config = buffer.readInt(); + if(config == 0){//Font + String font = Server.readString(buffer); + int size = buffer.readInt(); + if(!font.isEmpty()){ + CustomNpcs.FontType = font; + CustomNpcs.FontSize = size; + ClientProxy.Font = new FontContainer(CustomNpcs.FontType, CustomNpcs.FontSize); + CustomNpcs.Config.updateConfig(); + player.addChatMessage(new ChatComponentTranslation("Font set to %s", ClientProxy.Font.getName())); + } + else + player.addChatMessage(new ChatComponentTranslation("Current font is %s", ClientProxy.Font.getName())); + } + } + } + + + +} diff --git a/src/main/java/noppes/npcs/client/QuestAchievement.java b/src/main/java/noppes/npcs/client/QuestAchievement.java new file mode 100644 index 000000000..d991f6345 --- /dev/null +++ b/src/main/java/noppes/npcs/client/QuestAchievement.java @@ -0,0 +1,28 @@ +package noppes.npcs.client; + +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.stats.Achievement; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.IChatComponent; +import noppes.npcs.CustomItems; + +public class QuestAchievement extends Achievement{ + + private String description; + private String message; + public QuestAchievement(String message, String description) { + super("",message, 0, 0, CustomItems.letter==null?Items.paper:CustomItems.letter, null); + this.description = description; + this.message = message; + } + @Override + public IChatComponent func_150951_e() + { + return new ChatComponentText(message); + } + public String getDescription() + { + return description; + } +} diff --git a/src/main/java/noppes/npcs/client/RenderChatMessages.java b/src/main/java/noppes/npcs/client/RenderChatMessages.java new file mode 100644 index 000000000..4c5dfabd0 --- /dev/null +++ b/src/main/java/noppes/npcs/client/RenderChatMessages.java @@ -0,0 +1,169 @@ +package noppes.npcs.client; + +import java.util.Hashtable; +import java.util.Map; +import java.util.TreeMap; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.MathHelper; +import noppes.npcs.IChatMessages; +import noppes.npcs.CustomNpcs; +import noppes.npcs.entity.EntityNPCInterface; + +import org.lwjgl.opengl.GL11; + +public class RenderChatMessages implements IChatMessages{ + private Map messages = new TreeMap(); + + private int boxLength = 46; + private float scale = 0.5f; + + private String lastMessage = ""; + private long lastMessageTime = 0; + + @Override + public void addMessage(String message, EntityNPCInterface npc){ + if(!CustomNpcs.EnableChatBubbles) + return; + long time = System.currentTimeMillis(); + if(message.equals(lastMessage) && lastMessageTime + 5000 > time){ + return; + } + Map messages = new TreeMap(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; + } + + @Override + public void renderMessages(double par3, double par5, double par7, float textscale){ + Map messages = getMessages(); + if(messages.isEmpty()) + return; + FontRenderer font = Minecraft.getMinecraft().fontRenderer; + float var13 = 1.6F; + float var14 = 0.016666668F * var13; + GL11.glPushMatrix(); + int size = 0; + for(TextBlockClient block : messages.values()) + size += block.lines.size(); + + int textYSize = (int) (size * font.FONT_HEIGHT * scale); + 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); + GL11.glRotatef(RenderManager.instance.playerViewX, 1F, 0.0F, 0.0F); + GL11.glScalef(-var14, -var14, var14); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + RenderHelper.disableStandardItemLighting(); + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glDepthMask(true); + GL11.glEnable(GL11.GL_BLEND); + GL11.glDepthFunc(GL11.GL_LEQUAL); + OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); + GL11.glDisable(GL11.GL_TEXTURE_2D); + + drawRect(-boxLength - 2, -2, boxLength + 2, textYSize + 1, 0xBBFFFFFF, 0.11); + + drawRect(-boxLength - 1, -3, boxLength + 1, -2, 0xFF000000, 0.1); //top + drawRect(-boxLength - 1, textYSize + 2, -1, textYSize + 1, 0xFF000000, 0.1); //bottom1 + drawRect(3, textYSize + 2, boxLength + 1, textYSize + 1, 0xFF000000, 0.1); //bottom2 + drawRect(-boxLength - 3, -1, -boxLength - 2, textYSize, 0xFF000000, 0.1); //left + drawRect(boxLength + 3, -1, boxLength + 2, textYSize, 0xFF000000, 0.1); //right + + drawRect(-boxLength - 2, -2, -boxLength - 1, -1, 0xFF000000, 0.1); + drawRect(boxLength + 2, -2, boxLength + 1, -1, 0xFF000000, 0.1); + drawRect(-boxLength - 2, textYSize + 1, -boxLength - 1, textYSize, 0xFF000000, 0.1); + drawRect(boxLength + 2, textYSize + 1, boxLength + 1, textYSize, 0xFF000000, 0.1); + + drawRect(0, textYSize + 1, 3, textYSize + 4, 0xBBFFFFFF, 0.11); + drawRect(-1, textYSize + 4, 1, textYSize + 5, 0xBBFFFFFF, 0.11); + + drawRect(-1, textYSize + 1, 0, textYSize + 4, 0xFF000000, 0.1); + drawRect(3, textYSize + 1, 4, textYSize + 3, 0xFF000000, 0.1); + drawRect(2, textYSize + 3, 3, textYSize + 4, 0xFF000000, 0.1); + drawRect(1, textYSize + 4, 2, textYSize + 5, 0xFF000000, 0.1); + drawRect(-2, textYSize + 4, -1, textYSize + 5, 0xFF000000, 0.1); + + drawRect(-2, textYSize + 5, 1, textYSize + 6, 0xFF000000, 0.1); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glDepthMask(true); + + GL11.glScalef(scale, scale, scale); + int index = 0; + for(TextBlockClient block : messages.values()){ + for(IChatComponent chat : block.lines){ + String message = chat.getFormattedText(); + font.drawString(message, -font.getStringWidth(message) / 2, index * font.FONT_HEIGHT, 0); + index++; + } + } + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glPopMatrix(); + RenderHelper.enableStandardItemLighting(); + + } + + private void drawRect(int par0, int par1, int par2, int par3, int par4, double par5) + { + int j1; + + if (par0 < par2) + { + j1 = par0; + par0 = par2; + par2 = j1; + } + + 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; + 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.draw(); + } + + private Map getMessages(){ + Map messages = new TreeMap(); + 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; + } +} diff --git a/src/main/java/noppes/npcs/client/TextBlockClient.java b/src/main/java/noppes/npcs/client/TextBlockClient.java new file mode 100644 index 000000000..b5f476bcc --- /dev/null +++ b/src/main/java/noppes/npcs/client/TextBlockClient.java @@ -0,0 +1,80 @@ +package noppes.npcs.client; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.command.ICommandSender; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatStyle; +import noppes.npcs.NoppesStringUtils; +import noppes.npcs.TextBlock; +import noppes.npcs.entity.EntityNPCInterface; + +public class TextBlockClient extends TextBlock{ + private ChatStyle style; + public int color = 0xe0e0e0; + private String name; + private ICommandSender sender; + + public TextBlockClient(ICommandSender sender, String text, int lineWidth, int color, Object... obs) { + this(text, lineWidth, false, obs); + this.color = color; + 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; + + 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); + } +} diff --git a/src/main/java/noppes/npcs/client/TranslateUtil.java b/src/main/java/noppes/npcs/client/TranslateUtil.java new file mode 100644 index 000000000..199e1953b --- /dev/null +++ b/src/main/java/noppes/npcs/client/TranslateUtil.java @@ -0,0 +1,105 @@ +package noppes.npcs.client; + +import java.io.BufferedInputStream; +import java.io.BufferedReader; +import java.io.DataInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.UnsupportedEncodingException; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLConnection; +import java.net.URLEncoder; + +import javax.sound.sampled.AudioInputStream; +import javax.sound.sampled.AudioSystem; +import javax.sound.sampled.Clip; +import javax.sound.sampled.LineUnavailableException; +import javax.sound.sampled.UnsupportedAudioFileException; + +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonParser; + +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"; + + 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(); + + 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; + } + +// public static void PlayAudio(String text){ +// try { +// String urlStr = String.format(AudioUrl, URLEncoder.encode(text,"utf8"), "en"); +// System.out.println(urlStr); +// URL url = new URL(urlStr); +// URLConnection connection = 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"); +// +// InputStream audioSrc = new BufferedInputStream(connection.getInputStream()); +// //DataInputStream read = new DataInputStream(audioSrc); +// AudioInputStream audioIn = AudioSystem.getAudioInputStream(audioSrc); +// Clip clip = AudioSystem.getClip(); +// +// } catch (UnsupportedEncodingException e) { +// e.printStackTrace(); +// } catch (MalformedURLException e) { +// e.printStackTrace(); +// } catch (IOException e) { +// e.printStackTrace(); +// } catch (UnsupportedAudioFileException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } catch (LineUnavailableException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } +// } + + 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(); + } +} diff --git a/src/main/java/noppes/npcs/client/VersionChecker.java b/src/main/java/noppes/npcs/client/VersionChecker.java new file mode 100644 index 000000000..01dbdfdae --- /dev/null +++ b/src/main/java/noppes/npcs/client/VersionChecker.java @@ -0,0 +1,42 @@ +package noppes.npcs.client; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.net.URL; +import java.net.URLConnection; + +import net.minecraft.client.Minecraft; +import net.minecraft.entity.player.EntityPlayer; +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'+ "2CustomNpcs" + '\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(); + } + } + ChatComponentTranslation message = new ChatComponentTranslation(text); + message.getChatStyle().setChatClickEvent(new ClickEvent(Action.OPEN_URL, "http://www.kodevelopment.nl/minecraft/customnpcs/")); + player.addChatMessage(message); + } +} diff --git a/src/main/java/noppes/npcs/client/controllers/ClientCloneController.java b/src/main/java/noppes/npcs/client/controllers/ClientCloneController.java new file mode 100644 index 000000000..75b2bec4c --- /dev/null +++ b/src/main/java/noppes/npcs/client/controllers/ClientCloneController.java @@ -0,0 +1,27 @@ +package noppes.npcs.client.controllers; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import net.minecraft.entity.Entity; +import net.minecraft.nbt.CompressedStreamTools; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import noppes.npcs.CustomNpcs; +import noppes.npcs.controllers.ServerCloneController; + +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; + } +} diff --git a/src/main/java/noppes/npcs/client/controllers/MusicController.java b/src/main/java/noppes/npcs/client/controllers/MusicController.java new file mode 100644 index 000000000..4fb230003 --- /dev/null +++ b/src/main/java/noppes/npcs/client/controllers/MusicController.java @@ -0,0 +1,85 @@ +package noppes.npcs.client.controllers; + +import java.util.Map; + +import cpw.mods.fml.common.ObfuscationReflectionHelper; +import net.minecraft.block.BlockJukebox; +import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.ISound; +import net.minecraft.client.audio.PositionedSoundRecord; +import net.minecraft.client.audio.SoundHandler; +import net.minecraft.client.audio.SoundManager; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemRecord; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; +import noppes.npcs.client.AssetsBrowser; + + +public class MusicController { + //public TreeSet sounds = new TreeSet(); + //public TreeSet music = new TreeSet(); + + public static MusicController Instance; + public PositionedSoundRecord playing; + public ResourceLocation playingResource; + public Entity playingEntity; + + //private SoundPoolEntry musicPool; + + public MusicController(){ + Instance = this; + } + + + public void stopMusic(){ + SoundHandler handler = Minecraft.getMinecraft().getSoundHandler(); + if(playing != null) + handler.stopSound(playing); + handler.stopSounds(); + playingResource = null; + playingEntity = null; + playing = null; + } + + public void playStreaming(String music, Entity entity){ + if(isPlaying(music)){ + return; + } + stopMusic(); + playingEntity = entity; + playingResource = new ResourceLocation(music); + SoundHandler handler = Minecraft.getMinecraft().getSoundHandler(); + playing = PositionedSoundRecord.func_147675_a(playingResource, (float)entity.posX, (float)entity.posY, (float)entity.posZ); + handler.playSound(playing); + } + + public void playMusic(String music, Entity entity) { + if(isPlaying(music)) + return; + stopMusic(); + playingResource = new ResourceLocation(music); + + playingEntity = entity; + + SoundHandler handler = Minecraft.getMinecraft().getSoundHandler(); + playing = PositionedSoundRecord.func_147673_a(playingResource); + handler.playSound(playing); + } + + + public boolean isPlaying(String music) { + ResourceLocation resource = new ResourceLocation(music); + if(playingResource == null || !playingResource.equals(resource)){ + return false; + } + return Minecraft.getMinecraft().getSoundHandler().isSoundPlaying(playing); + } + + public void playSound(String music, float x, float y, float z) { + Minecraft.getMinecraft().theWorld.playSound(x, y, z, music, 1, 1, false); + } +} diff --git a/src/main/java/noppes/npcs/client/controllers/Preset.java b/src/main/java/noppes/npcs/client/controllers/Preset.java new file mode 100644 index 000000000..30b664630 --- /dev/null +++ b/src/main/java/noppes/npcs/client/controllers/Preset.java @@ -0,0 +1,187 @@ +package noppes.npcs.client.controllers; + +import java.util.HashMap; + +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.ModelData; +import noppes.npcs.ModelPartData; + +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 presets){ + ModelData data = new ModelData(); + Preset preset = new Preset(); + preset.name = "Elf Male"; + preset.data = data; + data.legs.setScale(0.85f,1.15f); + data.arms.setScale(0.85f,1.15f); + data.body.setScale(0.85f,1.15f); + data.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.legs.setScale(0.8f,1.05f); + data.arms.setScale(0.8f,1.05f); + data.body.setScale(0.8f,1.05f); + data.head.setScale(0.8f,0.85f); + presets.put("elf female", preset); + + data = new ModelData(); + preset = new Preset(); + preset.name = "Dwarf Male"; + preset.data = data; + data.legs.setScale(1.1f,0.7f, 0.9f); + data.arms.setScale(0.9f,0.7f); + data.body.setScale(1.2f, 0.7f, 1.5f); + data.head.setScale(0.85f,0.85f); + presets.put("dwarf male", preset); + + data = new ModelData(); + preset = new Preset(); + preset.name = "Dwarf Female"; + preset.data = data; + data.breasts = 2; + data.legs.setScale(0.9f,0.65f); + data.arms.setScale(0.9f,0.65f); + data.body.setScale(1f, 0.65f, 1.1f); + data.head.setScale(0.85f,0.85f); + presets.put("dwarf female", preset); + + data = new ModelData(); + preset = new Preset(); + preset.name = "Orc Male"; + preset.data = data; + data.legs.setScale(1.2f,1.05f); + data.arms.setScale(1.2f,1.05f); + data.body.setScale(1.4f, 1.1f, 1.5f); + data.head.setScale(1.2f,1.1f); + presets.put("orc male", preset); + + data = new ModelData(); + preset = new Preset(); + preset.name = "Orc Female"; + preset.data = data; + data.breasts = 2; + data.legs.setScale(1.1f,1); + data.arms.setScale(1.1f,1); + data.body.setScale(1.1f, 1f, 1.25f); + presets.put("orc 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 = "Human Female"; + preset.data = data; + data.breasts = 2; + data.head.setScale(0.95f,0.95f); + data.legs.setScale(0.92f,0.92f); + data.arms.setScale(0.80f,0.92f); + data.body.setScale(0.92f, 0.92f); + presets.put("human 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 = "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.head.setScale(0.95f,0.95f); + data.legs.setScale(0.92f,0.92f); + data.arms.setScale(0.80f,0.92f); + data.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.head.setScale(0.95f,0.95f); + data.legs.setScale(0.92f,0.92f); + data.arms.setScale(0.80f,0.92f); + data.body.setScale(0.92f, 0.92f); + presets.put("wolf female", preset); + + data = new ModelData(); + preset = new Preset(); + preset.name = "Enderchibi"; + preset.data = data; + data.legs.setScale(0.65f,0.75f); + data.arms.setScale(0.50f,1.45f); + ModelPartData part = data.getOrCreatePart("particles"); + part.setTexture("particle/type1", 1); + part.color = 0xFF0000; + presets.put("enderchibi", preset); + } +} diff --git a/src/main/java/noppes/npcs/client/controllers/PresetController.java b/src/main/java/noppes/npcs/client/controllers/PresetController.java new file mode 100644 index 000000000..84e271ee0 --- /dev/null +++ b/src/main/java/noppes/npcs/client/controllers/PresetController.java @@ -0,0 +1,123 @@ +package noppes.npcs.client.controllers; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.util.HashMap; + +import net.minecraft.nbt.CompressedStreamTools; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import noppes.npcs.LogWriter; + +public class PresetController { + + public HashMap presets = new HashMap(); + + private File dir; + public static PresetController instance; + + public PresetController(File dir){ + instance = this; + this.dir = dir; + load(); + } + + public Preset getPreset(String username) { + if(presets.isEmpty()) + load(); + return presets.get(username.toLowerCase()); + } + + public void load(){ + NBTTagCompound compound = loadPreset(); + HashMap presets = new HashMap(); + 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()) + { + file1.delete(); + } + file2.renameTo(file1); + if(file2.exists()) + { + file2.delete(); + } + file.renameTo(file2); + if(file.exists()) + { + file.delete(); + } + } 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 removePreset(String preset) { + if(preset == null) + return; + presets.remove(preset.toLowerCase()); + save(); + } +} diff --git a/src/main/java/noppes/npcs/client/fx/EntityElementalStaffFX.java b/src/main/java/noppes/npcs/client/fx/EntityElementalStaffFX.java new file mode 100644 index 000000000..3eae1f1d1 --- /dev/null +++ b/src/main/java/noppes/npcs/client/fx/EntityElementalStaffFX.java @@ -0,0 +1,73 @@ +// 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 + +package noppes.npcs.client.fx; + +import net.minecraft.client.particle.EntityPortalFX; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.passive.EntitySheep; +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) + { + 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]; + else + 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)); + noClip = false; + } + + 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 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; + + if (this.particleAge++ >= this.particleMaxAge) + { + this.setDead(); + } + } + public void setDead(){ + super.setDead(); + } +} diff --git a/src/main/java/noppes/npcs/client/fx/EntityEnderFX.java b/src/main/java/noppes/npcs/client/fx/EntityEnderFX.java new file mode 100644 index 000000000..685998967 --- /dev/null +++ b/src/main/java/noppes/npcs/client/fx/EntityEnderFX.java @@ -0,0 +1,94 @@ +package noppes.npcs.client.fx; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.particle.EntityPortalFX; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.util.ResourceLocation; +import noppes.npcs.ModelPartData; +import noppes.npcs.client.ClientProxy; +import noppes.npcs.entity.EntityCustomNpc; + +import org.lwjgl.opengl.GL11; + +public class EntityEnderFX extends EntityPortalFX{ + + private float portalParticleScale; + private int particleNumber; + private EntityCustomNpc npc; + private static final ResourceLocation resource = new ResourceLocation("textures/particle/particles.png"); + private final ResourceLocation location; + 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); + + 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; + particleBlue = (data.color & 255) / 255f; + + 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; + else + 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); + } + Tessellator tessellator = Tessellator.instance; + tessellator.draw(); + float scale = ((float)particleAge + par2) / (float)particleMaxAge; + scale = 1.0F - scale; + scale *= scale; + scale = 1.0F - scale; + particleScale = portalParticleScale * scale; + + 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); + + GL11.glColor4f(1, 1, 1, 1.0F); + tessellator.startDrawingQuads(); + tessellator.setBrightness(240); + par1Tessellator.setColorOpaque_F(1, 1, 1); + par1Tessellator.setColorRGBA_F(particleRed, particleGreen, particleBlue, 1); + par1Tessellator.addVertexWithUV(f5 - par3 * f4 - par6 * f4, f6 - par4 * f4, f7 - par5 * f4 - par7 * f4, f1, f3); + par1Tessellator.addVertexWithUV((f5 - par3 * f4) + par6 * f4, f6 + par4 * f4, (f7 - par5 * f4) + par7 * f4, f1, f2); + par1Tessellator.addVertexWithUV(f5 + par3 * f4 + par6 * f4, f6 + par4 * f4, f7 + par5 * f4 + par7 * f4, f, f2); + par1Tessellator.addVertexWithUV((f5 + par3 * f4) - par6 * f4, f6 - par4 * f4, (f7 + par5 * f4) - par7 * f4, f, f3); + + tessellator.draw(); + ClientProxy.bindTexture(resource); + tessellator.startDrawingQuads(); + } + + public int getFXLayer(){ + return 0; + } +} diff --git a/src/main/java/noppes/npcs/client/fx/EntityRainbowFX.java b/src/main/java/noppes/npcs/client/fx/EntityRainbowFX.java new file mode 100644 index 000000000..0050adc96 --- /dev/null +++ b/src/main/java/noppes/npcs/client/fx/EntityRainbowFX.java @@ -0,0 +1,106 @@ +package noppes.npcs.client.fx; + +import net.minecraft.client.particle.EntityFX; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.world.World; + + + +public class EntityRainbowFX extends EntityFX +{ + + public static float colorTable[][] = { + { + 1.0F, 0, 0 + }, + { + 1.0F, 0.5f, 0 + }, + { + 1.0F, 1.0f, 0 + }, + { + 0F, 1.0f, 0 + }, + { + 0F, 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) + { + 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) + { + super(world, d, d1, d2, 0.0D, 0.0D, 0.0D); + motionX *= 0.10000000149011612D; + motionY *= 0.10000000149011612D; + motionZ *= 0.10000000149011612D; + if(f1 == 0.0F) + { + f1 = 1.0F; + } + int i = world.rand.nextInt(colorTable.length); + particleRed = colorTable[i][0]; + particleGreen = colorTable[i][1]; + particleBlue = colorTable[i][2]; + particleScale *= 0.75F; + particleScale *= f; + reddustParticleScale = particleScale; + 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) + { + f6 = 0.0F; + } + if(f6 > 1.0F) + { + f6 = 1.0F; + } + particleScale = reddustParticleScale * f6; + super.renderParticle(tessellator, f, f1, f2, f3, f4, f5); + } + + public void onUpdate() + { + prevPosX = posX; + prevPosY = posY; + prevPosZ = posZ; + if(particleAge++ >= particleMaxAge) + { + setDead(); + } + setParticleTextureIndex(7 - (particleAge * 8) / particleMaxAge); + moveEntity(motionX, motionY, motionZ); + if(posY == prevPosY) + { + motionX *= 1.1000000000000001D; + motionZ *= 1.1000000000000001D; + } + motionX *= 0.95999997854232788D; + motionY *= 0.95999997854232788D; + motionZ *= 0.95999997854232788D; + if(onGround) + { + motionX *= 0.69999998807907104D; + motionZ *= 0.69999998807907104D; + } + } + + float reddustParticleScale; +} diff --git a/src/main/java/noppes/npcs/client/gui/GuiBorderBlock.java b/src/main/java/noppes/npcs/client/gui/GuiBorderBlock.java new file mode 100644 index 000000000..fe5464912 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/GuiBorderBlock.java @@ -0,0 +1,66 @@ +package noppes.npcs.client.gui; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.blocks.tiles.TileBorder; +import noppes.npcs.client.Client; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.gui.util.GuiNPCInterface; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.IGuiData; +import noppes.npcs.constants.EnumPacketServer; + +public class GuiBorderBlock extends GuiNPCInterface implements IGuiData{ + + private TileBorder tile; + + public GuiBorderBlock(int x, int y, int z) { + super(); + tile = (TileBorder) player.worldObj.getTileEntity(x, y, z); + + Client.sendData(EnumPacketServer.GetTileEntity, x, y, z); + } + 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).numbersOnly = 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); + Client.sendData(EnumPacketServer.SaveTileEntity, compound); + } + @Override + public void setGuiData(NBTTagCompound compound) { + tile.readFromNBT(compound); + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/GuiMerchantAdd.java b/src/main/java/noppes/npcs/client/gui/GuiMerchantAdd.java new file mode 100644 index 000000000..a7e24ce76 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/GuiMerchantAdd.java @@ -0,0 +1,309 @@ +package noppes.npcs.client.gui; + +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.IMerchant; +import net.minecraft.inventory.ContainerMerchant; +import net.minecraft.item.ItemStack; +import net.minecraft.network.play.client.C17PacketCustomPayload; +import net.minecraft.util.ResourceLocation; +import net.minecraft.village.MerchantRecipe; +import net.minecraft.village.MerchantRecipeList; +import noppes.npcs.ServerEventsHandler; +import noppes.npcs.client.Client; +import noppes.npcs.client.CustomNpcResourceListener; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.containers.ContainerMerchantAdd; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class GuiMerchantAdd extends GuiContainer +{ + private static final ResourceLocation merchantGuiTextures = new ResourceLocation("textures/gui/container/villager.png"); + + /** Instance of IMerchant interface. */ + private IMerchant theIMerchant; + private MerchantButton nextRecipeButtonIndex; + private MerchantButton previousRecipeButtonIndex; + private int currentRecipeIndex; + private String field_94082_v; + + + 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"); + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + 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.nextRecipeButtonIndex.enabled = false; + this.previousRecipeButtonIndex.enabled = false; + } + + /** + * Draw the foreground layer for the GuiContainer (everything in front of the items) + */ + 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); + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + super.updateScreen(); + Minecraft mc = Minecraft.getMinecraft(); + MerchantRecipeList merchantrecipelist = this.theIMerchant.getRecipes(mc.thePlayer); + + if (merchantrecipelist != null) + { + this.nextRecipeButtonIndex.enabled = this.currentRecipeIndex < merchantrecipelist.size() - 1; + this.previousRecipeButtonIndex.enabled = this.currentRecipeIndex > 0; + } + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + boolean flag = false; + Minecraft mc = Minecraft.getMinecraft(); + + if (par1GuiButton == this.nextRecipeButtonIndex) + { + ++this.currentRecipeIndex; + flag = true; + } + else if (par1GuiButton == this.previousRecipeButtonIndex) + { + --this.currentRecipeIndex; + flag = true; + } + + if(par1GuiButton.id == 4){ + MerchantRecipeList merchantrecipelist = this.theIMerchant.getRecipes(mc.thePlayer); + if(currentRecipeIndex < merchantrecipelist.size()){ + merchantrecipelist.remove(currentRecipeIndex); + if(currentRecipeIndex > 0) + currentRecipeIndex--; + Client.sendData(EnumPacketServer.MerchantUpdate, 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(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); + Client.sendData(EnumPacketServer.MerchantUpdate, ServerEventsHandler.Merchant.getEntityId(), merchantrecipelist); + } + + } + + if (flag) + { + ((ContainerMerchantAdd)this.inventorySlots).setCurrentRecipeIndex(this.currentRecipeIndex); + ByteBuf bytebuf = Unpooled.buffer(); + + try + { + bytebuf.writeInt(this.currentRecipeIndex); + this.mc.getNetHandler().addToSendQueue(new C17PacketCustomPayload("MC|TrSel", bytebuf)); + } + catch (Exception exception) + { + //field_147039_u.error("Couldn\'t send trade info", exception); + } + finally + { + bytebuf.release(); + } + } + } + + /** + * Draw the background layer for the GuiContainer (everything behind the items) + */ + @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); + int k = (this.width - this.xSize) / 2; + int l = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); + MerchantRecipeList merchantrecipelist = this.theIMerchant.getRecipes(mc.thePlayer); + + if (merchantrecipelist != null && !merchantrecipelist.isEmpty()) + { + int i1 = this.currentRecipeIndex; + MerchantRecipe merchantrecipe = (MerchantRecipe)merchantrecipelist.get(i1); + + if (merchantrecipe.isRecipeDisabled()) + { + mc.getTextureManager().bindTexture(merchantGuiTextures); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glDisable(GL11.GL_LIGHTING); + this.drawTexturedModalRect(this.guiLeft + 83, this.guiTop + 21, 212, 0, 28, 21); + this.drawTexturedModalRect(this.guiLeft + 83, this.guiTop + 51, 212, 0, 28, 21); + } + } + } + + /** + * Draws the screen and all the components in it. + */ + @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()) + { + int k = (this.width - this.xSize) / 2; + int l = (this.height - this.ySize) / 2; + int i1 = this.currentRecipeIndex; + MerchantRecipe merchantrecipe = (MerchantRecipe)merchantrecipelist.get(i1); + GL11.glPushMatrix(); + ItemStack itemstack = merchantrecipe.getItemToBuy(); + ItemStack itemstack1 = merchantrecipe.getSecondItemToBuy(); + ItemStack itemstack2 = merchantrecipe.getItemToSell(); + RenderHelper.enableGUIStandardItemLighting(); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glEnable(GL11.GL_COLOR_MATERIAL); + GL11.glEnable(GL11.GL_LIGHTING); + itemRender.zLevel = 100.0F; + 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); + } + + itemRender.renderItemAndEffectIntoGUI(this.fontRendererObj, mc.getTextureManager(), itemstack2, k + 120, l + 24); + itemRender.renderItemOverlayIntoGUI(this.fontRendererObj, mc.getTextureManager(), itemstack2, k + 120, l + 24); + itemRender.zLevel = 0.0F; + GL11.glDisable(GL11.GL_LIGHTING); + + 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)) + { + this.renderToolTip(itemstack1, par1, par2); + } + else if (this.func_146978_c(120, 24, 16, 16, par1, par2)) + { + this.renderToolTip(itemstack2, par1, par2); + } + + GL11.glPopMatrix(); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_DEPTH_TEST); + RenderHelper.enableStandardItemLighting(); + } + } + + /** + * Gets the Instance of IMerchant interface. + */ + public IMerchant getIMerchant() + { + return this.theIMerchant; + } + + static ResourceLocation func_110417_h() + { + return merchantGuiTextures; + } + @SideOnly(Side.CLIENT) + static class MerchantButton extends GuiButton + { + private final boolean field_146157_o; + private static final String __OBFID = "CL_00000763"; + + 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; + + 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); + } + } + } +} diff --git a/src/main/java/noppes/npcs/client/gui/GuiNPCDialogSelection.java b/src/main/java/noppes/npcs/client/gui/GuiNPCDialogSelection.java new file mode 100644 index 000000000..7fdd12e38 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/GuiNPCDialogSelection.java @@ -0,0 +1,122 @@ +package noppes.npcs.client.gui; + +import java.util.HashMap; +import java.util.Vector; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import noppes.npcs.client.Client; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.gui.util.GuiNPCInterface; +import noppes.npcs.client.gui.util.GuiNPCStringSlot; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiSelectionListener; +import noppes.npcs.client.gui.util.IScrollData; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.entity.EntityNPCInterface; + +public class GuiNPCDialogSelection extends GuiNPCInterface implements IScrollData +{ + private GuiNPCStringSlot slot; + private GuiScreen parent; + private HashMap data = new HashMap(); + private int dialog; + private boolean selectCategory = true; + public GuiSelectionListener listener; + public GuiNPCDialogSelection(EntityNPCInterface npc,GuiScreen parent,int dialog) + { + super(npc); + drawDefaultBackground = false; + title = "Select Dialog Category"; + this.parent = parent; + this.dialog = dialog; + + + if(dialog >= 0){ + Client.sendData(EnumPacketServer.DialogsGetFromDialog, dialog); + selectCategory = false; + title = "Select Dialog"; + }else + Client.sendData(EnumPacketServer.DialogCategoriesGet, dialog); + + if(parent instanceof GuiSelectionListener){ + listener = (GuiSelectionListener) parent; + } + } + + public void initGui() + { + super.initGui(); + Vector list = new Vector(); + 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, "mco.template.button.select")); + } + + + 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) + { + if(selectCategory){ + close(); + NoppesUtil.openGUI(player, parent); + }else{ + title = "Select Dialog Category"; + selectCategory = true; + Client.sendData(EnumPacketServer.DialogCategoriesGet, dialog); + } + } + if(id == 4) + { + doubleClicked(); + } + } + public void doubleClicked() { + if(slot.selected == null || slot.selected.isEmpty()) + return; + if(selectCategory){ + selectCategory = false; + title = "Select Dialog"; + Client.sendData(EnumPacketServer.DialogsGet, data.get(slot.selected)); + } + else{ + dialog = data.get(slot.selected); + close(); + NoppesUtil.openGUI(player, parent); + } + + } + public void save() { + if(dialog >= 0){ + if(listener != null) + listener.selected(dialog, slot.selected); + } + } + + @Override + public void setData(Vector list, HashMap data) { + this.data = data; + this.slot.setList(list); + if(dialog >= 0) + for(String name : data.keySet()) + if(data.get(name) == dialog) + slot.selected = name; + } + + @Override + public void setSelected(String selected) { + + } + + +} diff --git a/src/main/java/noppes/npcs/client/gui/GuiNPCFactionSelection.java b/src/main/java/noppes/npcs/client/gui/GuiNPCFactionSelection.java new file mode 100644 index 000000000..5ceb9c005 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/GuiNPCFactionSelection.java @@ -0,0 +1,103 @@ +package noppes.npcs.client.gui; + +import java.util.HashMap; +import java.util.Vector; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import noppes.npcs.client.Client; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.gui.util.GuiNPCInterface; +import noppes.npcs.client.gui.util.GuiNPCStringSlot; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiSelectionListener; +import noppes.npcs.client.gui.util.IScrollData; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.entity.EntityNPCInterface; + + +public class GuiNPCFactionSelection extends GuiNPCInterface implements IScrollData +{ + private GuiNPCStringSlot slot; + private GuiScreen parent; + private HashMap data = new HashMap(); + private int factionId; + public GuiSelectionListener listener; + public GuiNPCFactionSelection(EntityNPCInterface npc,GuiScreen parent,int dialog) + { + super(npc); + drawDefaultBackground = false; + title = "Select Dialog Category"; + this.parent = parent; + this.factionId = dialog; + + Client.sendData(EnumPacketServer.FactionsGet); + + if(parent instanceof GuiSelectionListener){ + listener = (GuiSelectionListener) parent; + } + } + + public void initGui() + { + super.initGui(); + Vector list = new Vector(); + 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, "mco.template.button.select")); + } + + + 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); + } + 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); + } + } + + @Override + public void setData(Vector list, HashMap data) { + 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) { + + } + + +} diff --git a/src/main/java/noppes/npcs/client/gui/GuiNPCLinesEdit.java b/src/main/java/noppes/npcs/client/gui/GuiNPCLinesEdit.java new file mode 100644 index 000000000..d0bb5920b --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/GuiNPCLinesEdit.java @@ -0,0 +1,90 @@ +package noppes.npcs.client.gui; + +import java.util.HashMap; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.client.Client; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.gui.util.GuiNPCInterface2; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.IGuiData; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.controllers.Line; +import noppes.npcs.controllers.Lines; +import noppes.npcs.entity.EntityNPCInterface; + +public class GuiNPCLinesEdit extends GuiNPCInterface2 implements IGuiData +{ + private Lines lines; + private GuiNpcTextField field; + private GuiNpcSoundSelection gui; + + public GuiNPCLinesEdit(EntityNPCInterface npc, Lines lines) + { + super(npc); + this.lines = lines; + Client.sendData(EnumPacketServer.MainmenuAdvancedGet); + } + + public void initGui() + { + super.initGui(); + for(int i = 0; i < 8; i++){ + String text = ""; + String sound = ""; + if(lines.lines.containsKey(i)){ + Line line = lines.lines.get(i); + text = line.text; + sound = line.sound; + } + 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, "mco.template.button.select")); + } + + } + + protected void actionPerformed(GuiButton guibutton) + { + GuiNpcButton button = (GuiNpcButton) guibutton; + field = getTextField(button.id + 8); + NoppesUtil.openGUI(player, gui = new GuiNpcSoundSelection(npc, this, field.getText())); + } + + @Override + public void elementClicked() { + field.setText(gui.getSelected()); + saveLines(); + } + + @Override + public void setGuiData(NBTTagCompound compound) { + npc.advanced.readToNBT(compound); + initGui(); + } + + private void saveLines(){ + HashMap lines = new HashMap(); + for(int i = 0; i < 8; i++){ + GuiNpcTextField tf = getTextField(i); + GuiNpcTextField tf2 = getTextField(i + 8); + if(!tf.isEmpty()){ + Line line = new Line(); + line.text = tf.getText(); + line.sound = tf2.getText(); + lines.put(i, line); + } + + } + this.lines.lines = lines; + } + + public void save() { + saveLines(); + Client.sendData(EnumPacketServer.MainmenuAdvancedSave, npc.advanced.writeToNBT(new NBTTagCompound())); + } + + +} diff --git a/src/main/java/noppes/npcs/client/gui/GuiNPCTextures.java b/src/main/java/noppes/npcs/client/gui/GuiNPCTextures.java new file mode 100644 index 000000000..9c4eedc5f --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/GuiNPCTextures.java @@ -0,0 +1,91 @@ +package noppes.npcs.client.gui; + +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.entity.RenderManager; +import noppes.npcs.entity.EntityNPCInterface; + +import org.lwjgl.opengl.GL11; + +public class GuiNPCTextures extends GuiNpcSelectionInterface +{ + public GuiNPCTextures(EntityNPCInterface npc,GuiScreen parent) + { + super(npc, parent, npc.display.texture); + title = "Select Texture"; + this.parent = parent; + } + + public void initGui() + { + super.initGui(); + int index = npc.display.texture.lastIndexOf("/"); + if(index > 0){ + String asset = npc.display.texture.substring(index + 1); + if(npc.display.texture.equals(assets.getAsset(asset))) + slot.selected = asset; + } + } + + + public void drawScreen(int i, int j, float f) + { + 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(); + GL11.glTranslatef(l + 33, i1 + 131, 50F); + float f1 = (50F * 5) / npc.display.modelSize; + GL11.glScalef(-f1, f1, f1); + GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); + float f2 = npc.renderYawOffset; + 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; + 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; + npc.rotationYawHead = npc.rotationYaw; + 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); + npc.renderYawOffset = f2; + npc.rotationYaw = f3; + npc.rotationPitch = f4; + npc.rotationYawHead = f7; + GL11.glPopMatrix(); + RenderHelper.disableStandardItemLighting(); + GL11.glDisable(32826 /*GL_RESCALE_NORMAL_EXT*/); + + OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); + GL11.glDisable(GL11.GL_TEXTURE_2D); + OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); + + super.drawScreen(i, j, f); + } + @Override + public void elementClicked(){ + if(dataTextures.contains(slot.selected) && slot.selected != null){ + npc.display.texture = assets.getAsset(slot.selected); + npc.textureLocation = null; + } + } + public void save() { + } + + @Override + public String[] getExtension() { + return new String[]{"png"}; + } + + +} diff --git a/src/main/java/noppes/npcs/client/gui/GuiNPCTransportCategoryEdit.java b/src/main/java/noppes/npcs/client/gui/GuiNPCTransportCategoryEdit.java new file mode 100644 index 000000000..247110b02 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/GuiNPCTransportCategoryEdit.java @@ -0,0 +1,71 @@ +package noppes.npcs.client.gui; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import noppes.npcs.client.Client; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.gui.util.GuiNPCInterface; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.entity.EntityNPCInterface; + +public class GuiNPCTransportCategoryEdit extends GuiNPCInterface +{ + 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() + { + super.initGui(); + this.addTextField(new GuiNpcTextField(1, this, this.fontRendererObj, width / 2 - 40, 100, 140, 20, name)); + addLabel(new GuiNpcLabel(1,"Title:", width / 2 - 100+4, 105, 0xffffff)); + + this.addButton(new GuiNpcButton(2, width / 2 - 100, 210,98, 20, "gui.back")); + this.addButton(new GuiNpcButton(3, width / 2 +2, 210,98, 20, "Save")); + } + + + 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); + Client.sendData(EnumPacketServer.TransportCategoriesGet); + } + if(id == 3) + { + save(); + NoppesUtil.openGUI(player, parent); + Client.sendData(EnumPacketServer.TransportCategoriesGet); + } + } + public void save() { + String name = getTextField(1).getText(); + if(name.trim().isEmpty()) + return; + Client.sendData(EnumPacketServer.TransportCategorySave,name,id); + } +// @Override +// public void drawDefaultBackground() +// { +// drawBackground(0); +// } + +} diff --git a/src/main/java/noppes/npcs/client/gui/GuiNpcDimension.java b/src/main/java/noppes/npcs/client/gui/GuiNpcDimension.java new file mode 100644 index 000000000..4904cf24d --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/GuiNpcDimension.java @@ -0,0 +1,99 @@ +package noppes.npcs.client.gui; + +import java.util.HashMap; +import java.util.Vector; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiYesNo; +import net.minecraft.entity.Entity; +import net.minecraft.util.StatCollector; +import noppes.npcs.client.Client; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.gui.util.GuiCustomScroll; +import noppes.npcs.client.gui.util.GuiNPCInterface; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.IScrollData; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.entity.EntityNPCInterface; + +public class GuiNpcDimension extends GuiNPCInterface implements IScrollData{ + + private GuiCustomScroll scroll; + private HashMap data = new HashMap(); + public GuiNpcDimension() { + super(); + xSize = 256; + setBackground("menubg.png"); + Client.sendData(EnumPacketServer.DimensionsGet); + } + public void initGui() + { + super.initGui(); + if(scroll == null){ + scroll = new GuiCustomScroll(this,0); + scroll.setSize(165, 208); + } + scroll.guiLeft = guiLeft + 4; + scroll.guiTop = guiTop + 4; + addScroll(scroll); + + String title = StatCollector.translateToLocal("Dimensions"); + int x = (xSize - this.fontRendererObj.getStringWidth(title)) / 2; + + this.addLabel(new GuiNpcLabel(0, title, guiLeft + x, guiTop - 8)); + + this.addButton(new GuiNpcButton(4, guiLeft + 170, guiTop + 72,82,20, "remote.tp")); + } + + @Override + public void confirmClicked(boolean flag, int i) + { + if(flag){ + Client.sendData(EnumPacketServer.RemoteDelete,data.get(scroll.getSelected())); + } + NoppesUtil.openGUI(player, this); + } + protected void actionPerformed(GuiButton guibutton) + { + int id = guibutton.id; + + if(!data.containsKey(scroll.getSelected())) + return; + + if(id == 4){ + Client.sendData(EnumPacketServer.DimensionTeleport, data.get(scroll.getSelected())); + 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() { + // TODO Auto-generated method stub + + } + @Override + public void setData(Vector list, HashMap data) { + scroll.setList(list); + this.data = data; + } + @Override + public void setSelected(String selected) { + getButton(3).setDisplayText(selected); + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/GuiNpcMobSpawner.java b/src/main/java/noppes/npcs/client/gui/GuiNpcMobSpawner.java new file mode 100644 index 000000000..85817887b --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/GuiNpcMobSpawner.java @@ -0,0 +1,249 @@ +package noppes.npcs.client.gui; + +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityList; +import net.minecraft.entity.EntityLiving; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.world.World; +import noppes.npcs.client.Client; +import noppes.npcs.client.controllers.ClientCloneController; +import noppes.npcs.client.gui.util.GuiCustomScroll; +import noppes.npcs.client.gui.util.GuiMenuSideButton; +import noppes.npcs.client.gui.util.GuiMenuTopButton; +import noppes.npcs.client.gui.util.GuiNPCInterface; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.IGuiData; +import noppes.npcs.constants.EnumPacketServer; + +public class GuiNpcMobSpawner extends GuiNPCInterface implements IGuiData{ + + private GuiCustomScroll scroll; + private int posX,posY,posZ; + + private List list; + + private static int showingClones = 0; + + private static String search = ""; + + private int activeTab = 1; + + public GuiNpcMobSpawner(int i, int j, int k) { + super(); + xSize = 256; + + posX = i; + posY = j; + posZ = k; + + this.closeOnEsc = true; + + setBackground("menubg.png"); + } + public void initGui() + { + super.initGui(); + guiTop += 10; + + if(scroll == null){ + scroll = new GuiCustomScroll(this,0); + scroll.setSize(165, 188); + } + 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)); + + GuiMenuTopButton button; + 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; + addTopButton(button = new GuiMenuTopButton(5, button, "gui.server")); + button.active = showingClones == 2; + + addButton(new GuiNpcButton(1, guiLeft + 170, guiTop + 6, 82, 20, "item.monsterPlacer.name")); + + addButton(new GuiNpcButton(2, guiLeft + 170, guiTop + 100, 82, 20, "spawner.mobspawner")); + + if(showingClones == 0 || showingClones == 2){ + addSideButton(new GuiMenuSideButton(21,guiLeft - 69, this.guiTop + 2, 70,22, "Tab 1")); + addSideButton(new GuiMenuSideButton(22,guiLeft - 69, this.guiTop + 23, 70,22, "Tab 2")); + addSideButton(new GuiMenuSideButton(23,guiLeft - 69, this.guiTop + 44, 70,22, "Tab 3")); + addSideButton(new GuiMenuSideButton(24,guiLeft - 69, this.guiTop + 65, 70,22, "Tab 4")); + addSideButton(new GuiMenuSideButton(25,guiLeft - 69, this.guiTop + 86, 70,22, "Tab 5")); + addSideButton(new GuiMenuSideButton(26,guiLeft - 69, this.guiTop + 107, 70,22, "Tab 6")); + addSideButton(new GuiMenuSideButton(27,guiLeft - 69, this.guiTop + 128, 70,22, "Tab 7")); + addSideButton(new GuiMenuSideButton(28,guiLeft - 69, this.guiTop + 149, 70,22, "Tab 8")); + addSideButton(new GuiMenuSideButton(29,guiLeft - 69, this.guiTop + 170, 70,22, "Tab 9")); + + addButton(new GuiNpcButton(6, guiLeft + 170, guiTop + 30, 82, 20, "gui.remove")); + + getSideButton(20 + activeTab).active = true; + showClones(); + } + else + showEntities(); + } + + private void showEntities() { + Map data = EntityList.stringToClassMapping; + ArrayList list = new ArrayList(); + 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){ + Client.sendData(EnumPacketServer.CloneList, activeTab); + return; + } + + ArrayList list = new ArrayList(); + 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 getSearchList(){ + if(search.isEmpty()) + return new ArrayList(list); + List list = new ArrayList(); + 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; + + 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; + Client.sendData(EnumPacketServer.SpawnMob, true, posX, posY, posZ, sel, activeTab); + close(); + } + else{ + NBTTagCompound compound = getCompound(); + if(compound == null) + return; + Client.sendData(EnumPacketServer.SpawnMob, false, posX, posY, posZ, compound); + close(); + + } + } + if(id == 2){ + if(showingClones == 2){ + String sel = scroll.getSelected(); + if(sel == null) + return; + Client.sendData(EnumPacketServer.MobSpawner, true, posX, posY, posZ, sel, activeTab); + close(); + } + else{ + NBTTagCompound compound = getCompound(); + if(compound == null) + return; + Client.sendData(EnumPacketServer.MobSpawner, false, posX, posY, posZ, compound); + close(); + + } + } + if(id == 3){ + showingClones = 0; + initGui(); + } + if(id == 4){ + showingClones = 1; + initGui(); + } + if(id == 5){ + showingClones = 2; + initGui(); + } + if(id == 6){ + if(scroll.getSelected() != null){ + if(showingClones == 2){ + Client.sendData(EnumPacketServer.CloneRemove, activeTab, scroll.getSelected()); + return; + } + ClientCloneController.Instance.removeClone(scroll.getSelected(), activeTab); + scroll.selected = -1; + initGui(); + } + } + if(id > 20){ + activeTab = id - 20; + initGui(); + } + } + + @Override + public void save() { + // TODO Auto-generated method stub + + } + @Override + public void setGuiData(NBTTagCompound compound) { + NBTTagList nbtlist = compound.getTagList("List", 8); + List list = new ArrayList(); + for(int i = 0; i < nbtlist.tagCount(); i++){ + list.add(nbtlist.getStringTagAt(i)); + } + this.list = list; + scroll.setList(getSearchList()); + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/GuiNpcMobSpawnerAdd.java b/src/main/java/noppes/npcs/client/gui/GuiNpcMobSpawnerAdd.java new file mode 100644 index 000000000..df6e7da50 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/GuiNpcMobSpawnerAdd.java @@ -0,0 +1,108 @@ +package noppes.npcs.client.gui; + +import java.util.ArrayList; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiYesNo; +import net.minecraft.client.gui.GuiYesNoCallback; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityList; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.client.Client; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.controllers.ClientCloneController; +import noppes.npcs.client.gui.util.GuiNPCInterface; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.IGuiData; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.entity.EntityNPCInterface; + +public class GuiNpcMobSpawnerAdd extends GuiNPCInterface implements GuiYesNoCallback, IGuiData{ + + private Entity toClone; + private NBTTagCompound compound; + private static boolean serverSide = false; + private static int tab = 1; + + public GuiNpcMobSpawnerAdd(NBTTagCompound compound){ + this.toClone = EntityList.createEntityFromNBT(compound, Minecraft.getMinecraft().theWorld); + this.compound = compound; + setBackground("menubg.png"); + xSize = 256; + ySize = 216; + + } + @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 GuiNpcButton(2, guiLeft + 40, guiTop + 45, 20, 20, new String[]{"1","2","3","4","5","6","7","8","9"}, tab - 1)); + + addButton(new GuiNpcButton(3, guiLeft + 4, guiTop + 95, new String[]{"Client side", "Server side"}, serverSide?1:0)); + + addButton(new GuiNpcButton(0, guiLeft + 4, guiTop + 70, 80, 20, "gui.save")); + addButton(new GuiNpcButton(1, guiLeft + 86, guiTop + 70, 80, 20, "gui.cancel")); + } + 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 + Client.sendData(EnumPacketServer.ClonePreSave, name, tab); + } + if(id == 1){ + close(); + } + if(id == 2){ + tab = ((GuiNpcButton)guibutton).getValue() + 1; + } + if(id == 3){ + serverSide = ((GuiNpcButton)guibutton).getValue() == 1; + } + } + + @Override + public void confirmClicked(boolean confirm, int id){ + if(confirm){ + String name = getTextField(0).getText(); + if(!serverSide) + ClientCloneController.Instance.addClone(compound, name, tab); + else + Client.sendData(EnumPacketServer.CloneSave, name, tab); + 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); + } + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/GuiNpcMobSpawnerMounter.java b/src/main/java/noppes/npcs/client/gui/GuiNpcMobSpawnerMounter.java new file mode 100644 index 000000000..42882a792 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/GuiNpcMobSpawnerMounter.java @@ -0,0 +1,231 @@ +package noppes.npcs.client.gui; + +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityList; +import net.minecraft.entity.EntityLiving; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagDouble; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.world.World; +import noppes.npcs.client.Client; +import noppes.npcs.client.controllers.ClientCloneController; +import noppes.npcs.client.gui.util.GuiCustomScroll; +import noppes.npcs.client.gui.util.GuiMenuSideButton; +import noppes.npcs.client.gui.util.GuiMenuTopButton; +import noppes.npcs.client.gui.util.GuiNPCInterface; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.IGuiData; +import noppes.npcs.constants.EnumPacketServer; + +public class GuiNpcMobSpawnerMounter extends GuiNPCInterface implements IGuiData{ + + private GuiCustomScroll scroll; + + private int posX,posY,posZ; + + private List list; + + private static int showingClones = 0; + + private static String search = ""; + + private int activeTab = 1; + + public GuiNpcMobSpawnerMounter(int i, int j, int k) { + super(); + xSize = 256; + + posX = i; + posY = j; + posZ = k; + + this.closeOnEsc = true; + + setBackground("menubg.png"); + } + public void initGui() + { + super.initGui(); + guiTop += 10; + + if(scroll == null){ + scroll = new GuiCustomScroll(this,0); + scroll.setSize(165, 188); + } + 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)); + + GuiMenuTopButton button; + 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; + addTopButton(button = new GuiMenuTopButton(5, button, "gui.server")); + button.active = showingClones == 2; + + addButton(new GuiNpcButton(1, guiLeft + 170, guiTop + 6, 82, 20, "spawner.mount")); + + addButton(new GuiNpcButton(2, guiLeft + 170, guiTop + 50, 82, 20, "spawner.mountplayer")); + + if(showingClones == 0 || showingClones == 2){ + addSideButton(new GuiMenuSideButton(21,guiLeft - 69, this.guiTop + 2, 70,22, "Tab 1")); + addSideButton(new GuiMenuSideButton(22,guiLeft - 69, this.guiTop + 23, 70,22, "Tab 2")); + addSideButton(new GuiMenuSideButton(23,guiLeft - 69, this.guiTop + 44, 70,22, "Tab 3")); + addSideButton(new GuiMenuSideButton(24,guiLeft - 69, this.guiTop + 65, 70,22, "Tab 4")); + addSideButton(new GuiMenuSideButton(25,guiLeft - 69, this.guiTop + 86, 70,22, "Tab 5")); + addSideButton(new GuiMenuSideButton(26,guiLeft - 69, this.guiTop + 107, 70,22, "Tab 6")); + addSideButton(new GuiMenuSideButton(27,guiLeft - 69, this.guiTop + 128, 70,22, "Tab 7")); + addSideButton(new GuiMenuSideButton(28,guiLeft - 69, this.guiTop + 149, 70,22, "Tab 8")); + addSideButton(new GuiMenuSideButton(29,guiLeft - 69, this.guiTop + 170, 70,22, "Tab 9")); + + getSideButton(20 + activeTab).active = true; + showClones(); + } + else + showEntities(); + } + private void showEntities() { + Map data = EntityList.stringToClassMapping; + ArrayList list = new ArrayList(); + 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){ + Client.sendData(EnumPacketServer.CloneList, activeTab); + return; + } + + ArrayList list = new ArrayList(); + 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 getSearchList(){ + if(search.isEmpty()) + return new ArrayList(list); + List list = new ArrayList(); + 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; + + 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})); + Client.sendData(EnumPacketServer.SpawnRider, compound); + close(); + } + } + if(id == 2){ + Client.sendData(EnumPacketServer.PlayerRider); + 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) + { + NBTTagList nbttaglist = new NBTTagList(); + double[] adouble = par1ArrayOfDouble; + int i = par1ArrayOfDouble.length; + + for (int j = 0; j < i; ++j) + { + double d1 = adouble[j]; + nbttaglist.appendTag(new NBTTagDouble(d1)); + } + + return nbttaglist; + } + + @Override + public void save() { + // TODO Auto-generated method stub + + } + @Override + public void setGuiData(NBTTagCompound compound) { + NBTTagList nbtlist = compound.getTagList("List", 8); + List list = new ArrayList(); + for(int i = 0; i < nbtlist.tagCount(); i++){ + list.add(nbtlist.getStringTagAt(i)); + } + this.list = list; + scroll.setList(getSearchList()); + } +} diff --git a/src/main/java/noppes/npcs/client/gui/GuiNpcMobSpawnerSelector.java b/src/main/java/noppes/npcs/client/gui/GuiNpcMobSpawnerSelector.java new file mode 100644 index 000000000..98acfd5e8 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/GuiNpcMobSpawnerSelector.java @@ -0,0 +1,167 @@ +package noppes.npcs.client.gui; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagDouble; +import net.minecraft.nbt.NBTTagList; +import noppes.npcs.client.Client; +import noppes.npcs.client.controllers.ClientCloneController; +import noppes.npcs.client.gui.util.GuiCustomScroll; +import noppes.npcs.client.gui.util.GuiMenuSideButton; +import noppes.npcs.client.gui.util.GuiMenuTopButton; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.IGuiData; +import noppes.npcs.client.gui.util.SubGuiInterface; +import noppes.npcs.constants.EnumPacketServer; + +public class GuiNpcMobSpawnerSelector extends SubGuiInterface implements IGuiData{ + + private GuiCustomScroll scroll; + private List list; + + private static String search = ""; + public int activeTab = 1; + public boolean isServer = false; + + public GuiNpcMobSpawnerSelector() { + super(); + xSize = 256; + this.closeOnEsc = true; + setBackground("menubg.png"); + } + + + public void initGui(){ + super.initGui(); + 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); + +// GuiMenuTopButton button; +// addTopButton(button = new GuiMenuTopButton(3,guiLeft + 4, guiTop - 17, "spawner.clones")); +// button.active = !isServer; +// addTopButton(button = new GuiMenuTopButton(4, button, "gui.server")); +// button.active = isServer; + + 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")); + + addSideButton(new GuiMenuSideButton(21,guiLeft - 69, this.guiTop + 2, 70,22, "Tab 1")); + addSideButton(new GuiMenuSideButton(22,guiLeft - 69, this.guiTop + 23, 70,22, "Tab 2")); + addSideButton(new GuiMenuSideButton(23,guiLeft - 69, this.guiTop + 44, 70,22, "Tab 3")); + addSideButton(new GuiMenuSideButton(24,guiLeft - 69, this.guiTop + 65, 70,22, "Tab 4")); + addSideButton(new GuiMenuSideButton(25,guiLeft - 69, this.guiTop + 86, 70,22, "Tab 5")); + addSideButton(new GuiMenuSideButton(26,guiLeft - 69, this.guiTop + 107, 70,22, "Tab 6")); + addSideButton(new GuiMenuSideButton(27,guiLeft - 69, this.guiTop + 128, 70,22, "Tab 7")); + addSideButton(new GuiMenuSideButton(28,guiLeft - 69, this.guiTop + 149, 70,22, "Tab 8")); + addSideButton(new GuiMenuSideButton(29,guiLeft - 69, this.guiTop + 170, 70,22, "Tab 9")); + + getSideButton(20 + activeTab).active = true; + showClones(); + } + + public String getSelected(){ + return scroll.getSelected(); + } + private void showClones() { + + if(isServer){ + Client.sendData(EnumPacketServer.CloneList, activeTab); + return; + } + + ArrayList list = new ArrayList(); + + this.list = new ArrayList(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 getSearchList(){ + if(search.isEmpty()) + return new ArrayList(list); + List list = new ArrayList(); + 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; + + return ClientCloneController.Instance.getCloneData(player, sel, activeTab); + } + + 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) + { + double d1 = adouble[j]; + nbttaglist.appendTag(new NBTTagDouble(d1)); + } + + return nbttaglist; + } + + @Override + public void save() { + // TODO Auto-generated method stub + + } + + + @Override + public void setGuiData(NBTTagCompound compound) { + NBTTagList nbtlist = compound.getTagList("List", 8); + List list = new ArrayList(); + for(int i = 0; i < nbtlist.tagCount(); i++){ + list.add(nbtlist.getStringTagAt(i)); + } + this.list = list; + scroll.setList(getSearchList()); + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/GuiNpcPather.java b/src/main/java/noppes/npcs/client/gui/GuiNpcPather.java new file mode 100644 index 000000000..3d7fe49da --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/GuiNpcPather.java @@ -0,0 +1,126 @@ +package noppes.npcs.client.gui; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.DataAI; +import noppes.npcs.NBTTags; +import noppes.npcs.client.Client; +import noppes.npcs.client.gui.util.GuiCustomScroll; +import noppes.npcs.client.gui.util.GuiNPCInterface; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.IGuiData; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.entity.EntityNPCInterface; + +public class GuiNpcPather extends GuiNPCInterface implements IGuiData{ + + private GuiCustomScroll scroll; + private HashMap data = new HashMap(); + private DataAI ai; + + public GuiNpcPather(EntityNPCInterface npc) { + super(); + drawDefaultBackground = false; + xSize = 176; + title = "Npc Pather"; + setBackground("smallbg.png"); + ai = npc.ai; + Client.sendData(EnumPacketServer.MovingPathGet); + } + @Override + public void initGui() + { + super.initGui(); + scroll = new GuiCustomScroll(this,0); + scroll.setSize(160, 164); + List list = new ArrayList(); + 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")); + } + + protected void actionPerformed(GuiButton guibutton) + { + if(scroll.selected < 0) + return; + + int id = guibutton.id; + if(id == 0){ + List 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 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 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) + { + } + @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() { + NBTTagCompound compound = new NBTTagCompound(); + compound.setTag("MovingPathNew", NBTTags.nbtIntegerArraySet(ai.getMovingPath())); + Client.sendData(EnumPacketServer.MovingPathSave, compound); + } + + @Override + public void setGuiData(NBTTagCompound compound) { + ai.readToNBT(compound); + initGui(); + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/GuiNpcRedstoneBlock.java b/src/main/java/noppes/npcs/client/gui/GuiNpcRedstoneBlock.java new file mode 100644 index 000000000..f48b634f3 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/GuiNpcRedstoneBlock.java @@ -0,0 +1,121 @@ +package noppes.npcs.client.gui; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.StatCollector; +import noppes.npcs.blocks.tiles.TileRedstoneBlock; +import noppes.npcs.client.Client; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.gui.util.GuiNPCInterface; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.constants.EnumPacketServer; + +public class GuiNpcRedstoneBlock extends GuiNPCInterface{ + + private TileRedstoneBlock tile; + + public GuiNpcRedstoneBlock(int x, int y, int z) { + super(); + tile = (TileRedstoneBlock) player.worldObj.getTileEntity(x, y, z); + } + + @Override + public void initGui(){ + super.initGui(); + + this.addButton(new GuiNpcButton(4, guiLeft + 40, guiTop + 20, 120, 20, "availability.options")); + + addLabel(new GuiNpcLabel(11,"gui.detailed", guiLeft+ 40, guiTop + 47, 0xffffff)); + 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).numbersOnly = 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).numbersOnly = 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).numbersOnly = 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).numbersOnly = 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).numbersOnly = 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).numbersOnly = 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).numbersOnly = 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).numbersOnly = 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); + Client.sendData(EnumPacketServer.SaveTileEntity, compound); + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/GuiNpcRemoteEditor.java b/src/main/java/noppes/npcs/client/gui/GuiNpcRemoteEditor.java new file mode 100644 index 000000000..526554a91 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/GuiNpcRemoteEditor.java @@ -0,0 +1,128 @@ +package noppes.npcs.client.gui; + +import java.util.HashMap; +import java.util.Vector; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiYesNo; +import net.minecraft.client.gui.GuiYesNoCallback; +import net.minecraft.entity.Entity; +import net.minecraft.util.StatCollector; +import noppes.npcs.client.Client; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.gui.util.GuiCustomScroll; +import noppes.npcs.client.gui.util.GuiNPCInterface; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.IScrollData; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.entity.EntityNPCInterface; + +public class GuiNpcRemoteEditor extends GuiNPCInterface implements IScrollData, GuiYesNoCallback{ + + private GuiCustomScroll scroll; + private HashMap data = new HashMap(); + public GuiNpcRemoteEditor() { + super(); + xSize = 256; + setBackground("menubg.png"); + Client.sendData(EnumPacketServer.RemoteNpcsGet); + } + public void initGui() + { + super.initGui(); + if(scroll == null){ + scroll = new GuiCustomScroll(this,0); + scroll.setSize(165, 208); + } + scroll.guiLeft = guiLeft + 4; + scroll.guiTop = guiTop + 4; + addScroll(scroll); + + String title = StatCollector.translateToLocal("remote.title"); + int x = (xSize - this.fontRendererObj.getStringWidth(title)) / 2; + + 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(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(3, guiLeft + 170, guiTop + 132,82,20, "remote.freeze")); + } + + @Override + public void confirmClicked(boolean flag, int i){ + if(flag){ + Client.sendData(EnumPacketServer.RemoteDelete,data.get(scroll.getSelected())); + } + NoppesUtil.openGUI(player, this); + } + protected void actionPerformed(GuiButton guibutton) + { + int id = guibutton.id; + if(id == 3){ + Client.sendData(EnumPacketServer.RemoteFreeze); + } + if(id == 5){ + for(int ids : data.values()){ + Client.sendData(EnumPacketServer.RemoteReset, ids); + Entity entity = player.worldObj.getEntityByID(ids); + if(entity != null && entity instanceof EntityNPCInterface) + ((EntityNPCInterface)entity).reset(); + } + } + + if(!data.containsKey(scroll.getSelected())) + return; + + if(id == 0){ + Client.sendData(EnumPacketServer.RemoteMainMenu,data.get(scroll.getSelected())); + } + if(id == 1){ + GuiYesNo guiyesno = new GuiYesNo(this, "Confirm", StatCollector.translateToLocal("gui.delete"), 0); + displayGuiScreen(guiyesno); + } + if(id == 2){ + Client.sendData(EnumPacketServer.RemoteReset,data.get(scroll.getSelected())); + Entity entity = player.worldObj.getEntityByID(data.get(scroll.getSelected())); + if(entity != null && entity instanceof EntityNPCInterface) + ((EntityNPCInterface)entity).reset(); + } + if(id == 4){ + Client.sendData(EnumPacketServer.RemoteTpToNpc,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() { + // TODO Auto-generated method stub + + } + @Override + public void setData(Vector list, HashMap data) { + scroll.setList(list); + this.data = data; + } + @Override + public void setSelected(String selected) { + getButton(3).setDisplayText(selected); + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/GuiNpcSelectionInterface.java b/src/main/java/noppes/npcs/client/gui/GuiNpcSelectionInterface.java new file mode 100644 index 000000000..7f98ca663 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/GuiNpcSelectionInterface.java @@ -0,0 +1,123 @@ +package noppes.npcs.client.gui; + +import java.util.Collections; +import java.util.HashSet; +import java.util.Vector; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.util.StatCollector; +import noppes.npcs.client.AssetsBrowser; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.gui.util.GuiNPCInterface; +import noppes.npcs.client.gui.util.GuiNPCInterface2; +import noppes.npcs.client.gui.util.GuiNPCStringSlot; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.entity.EntityNPCInterface; + +public abstract class GuiNpcSelectionInterface extends GuiNPCInterface{ + public GuiNPCStringSlot slot; + public GuiScreen parent; + + private String up = "..<" + StatCollector.translateToLocal("gui.up") + ">.."; + + private String root = ""; + public AssetsBrowser assets; + private HashSet dataFolder = new HashSet(); + protected HashSet dataTextures = new HashSet(); + + 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(){ + super.initGui(); + dataFolder.clear(); + String ss = "Current Folder: /assets" + root; + addLabel(new GuiNpcLabel(0,ss, width / 2 - (this.fontRendererObj.getStringWidth(ss)/2), 20, 0xffffff)); + Vector list = new Vector(); + 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); + } + 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; + } + + @Override + 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(); + } + } + + @Override + public void save() { + } + + public String getSelected(){ + return assets.getAsset(slot.selected); + } + + public abstract String[] getExtension(); +} diff --git a/src/main/java/noppes/npcs/client/gui/GuiNpcSoundSelection.java b/src/main/java/noppes/npcs/client/gui/GuiNpcSoundSelection.java new file mode 100644 index 000000000..c20ec88a2 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/GuiNpcSoundSelection.java @@ -0,0 +1,137 @@ +package noppes.npcs.client.gui; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Set; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.SoundHandler; +import net.minecraft.client.audio.SoundRegistry; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; +import noppes.npcs.client.controllers.MusicController; +import noppes.npcs.client.gui.util.GuiNPCInterface; +import noppes.npcs.client.gui.util.GuiNPCInterface2; +import noppes.npcs.client.gui.util.GuiNPCStringSlot; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.entity.EntityNPCInterface; +import cpw.mods.fml.common.ObfuscationReflectionHelper; + +public class GuiNpcSoundSelection extends GuiNPCInterface{ + + public GuiNPCStringSlot slot; + private String domain; + private GuiScreen parent; + + private String up = "..<" + StatCollector.translateToLocal("gui.up") + ">.."; + + private HashMap> domains = new HashMap>(); + + public GuiNpcSoundSelection(EntityNPCInterface npc, GuiScreen parent, String sound) + { + super(npc); + SoundHandler handler = Minecraft.getMinecraft().getSoundHandler(); + SoundRegistry registry = ObfuscationReflectionHelper.getPrivateValue(SoundHandler.class, handler, 4); + + Set set = registry.getKeys(); + for(ResourceLocation location : set){ + List list = domains.get(location.getResourceDomain()); + if(list == null) + domains.put(location.getResourceDomain(), list = new ArrayList()); + list.add(location.getResourcePath()); + domains.put(location.getResourceDomain(), list); + } + drawDefaultBackground = false; + this.parent = parent; + } + + public void initGui() + { + super.initGui(); + String ss = "Current domain: " + domain; + if(domain == null) + ss = "Select domain"; + addLabel(new GuiNpcLabel(0,ss, width / 2 - (this.fontRendererObj.getStringWidth(ss)/2), 20, 0xffffff)); + + Collection col = domains.keySet(); + + if(domain != null){ + col = domains.get(domain); + if(!col.contains(up)) + col.add(up); + } + slot = new GuiNPCStringSlot(col, this, false, 18); + slot.registerScrollButtons(4, 5); + if(domain != null){ + this.addButton(new GuiNpcButton(1, width / 2 - 100, height - 27,198, 20, "gui.play")); + this.addButton(new GuiNpcButton(3, width / 2 - 100, height - 50,98, 20, "gui.done")); + } + else + this.addButton(new GuiNpcButton(4, width / 2 - 100, height - 50,98, 20, "gui.open")); + + this.addButton(new GuiNpcButton(2, width / 2 + 2, height - 50,98, 20, "gui.cancel")); + } + + public void drawScreen(int i, int j, float f) + { + slot.drawScreen(i, j, f); + super.drawScreen(i, j, f); + } + + public void doubleClicked() { + if(slot.selected == null || slot.selected.isEmpty()) + return; + if(slot.selected.equals(up)){ + domain = null; + initGui(); + } + else if(domain == null){ + domain = slot.selected; + initGui(); + } + else{ + if(parent instanceof GuiNPCInterface){ + ((GuiNPCInterface)parent).elementClicked(); + } + else if(parent instanceof GuiNPCInterface2){ + ((GuiNPCInterface2)parent).elementClicked(); + } + displayGuiScreen(parent); + } + } + + protected void actionPerformed(GuiButton guibutton) + { + super.actionPerformed(guibutton); + if(guibutton.id == 1){ + MusicController.Instance.stopMusic(); + MusicController.Instance.playSound(getSelected(), (float)player.posX, (float)player.posY, (float)player.posZ); + } + if(guibutton.id == 2){ + displayGuiScreen(parent); + } + if(guibutton.id == 3){ + if(slot.selected == null || slot.selected.equals(up)) + return; + doubleClicked(); + } + if(guibutton.id == 4){ + doubleClicked(); + } + } + public void save() { + + } + + public String getSelected(){ + if(slot.selected == null || slot.selected.isEmpty()) + return ""; + return domain + ":" + slot.selected; + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/GuiNpcTextureCloaks.java b/src/main/java/noppes/npcs/client/gui/GuiNpcTextureCloaks.java new file mode 100644 index 000000000..b706a3858 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/GuiNpcTextureCloaks.java @@ -0,0 +1,91 @@ +package noppes.npcs.client.gui; + +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RenderHelper; +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 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; + } + } + + + public void drawScreen(int i, int j, float f) + { + 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(); + GL11.glTranslatef(l + 33, i1 + 131, 50F); + float f1 = (50F * 5) / npc.display.modelSize; + GL11.glScalef(-f1, f1, f1); + GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); + float f2 = npc.renderYawOffset; + 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; + 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; + npc.rotationYawHead = npc.rotationYaw; + 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); + npc.renderYawOffset = f2; + npc.rotationYaw = f3; + npc.rotationPitch = f4; + npc.rotationYawHead = f7; + GL11.glPopMatrix(); + RenderHelper.disableStandardItemLighting(); + GL11.glDisable(32826 /*GL_RESCALE_NORMAL_EXT*/); + + OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); + GL11.glDisable(GL11.GL_TEXTURE_2D); + OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); + + super.drawScreen(i, j, f); + } + @Override + public void elementClicked(){ + if(dataTextures.contains(slot.selected) && slot.selected != null){ + npc.display.cloakTexture = assets.getAsset(slot.selected); + npc.textureCloakLocation = null; + } + } + + public void save() { + } + + @Override + public String[] getExtension() { + return new String[]{"png"}; + } + + +} diff --git a/src/main/java/noppes/npcs/client/gui/GuiNpcTextureOverlays.java b/src/main/java/noppes/npcs/client/gui/GuiNpcTextureOverlays.java new file mode 100644 index 000000000..d701bc72e --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/GuiNpcTextureOverlays.java @@ -0,0 +1,90 @@ +package noppes.npcs.client.gui; + +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.entity.RenderManager; +import noppes.npcs.entity.EntityNPCInterface; + +import org.lwjgl.opengl.GL11; + +public class GuiNpcTextureOverlays extends GuiNpcSelectionInterface{ + public GuiNpcTextureOverlays(EntityNPCInterface npc,GuiScreen parent){ + super(npc, parent, npc.display.glowTexture.isEmpty()?"customnpcs:textures/overlays/":npc.display.glowTexture); + title = "Select Overlay"; + this.parent = parent; + } + + public void initGui(){ + super.initGui(); + int index = npc.display.glowTexture.lastIndexOf("/"); + if(index > 0){ + String asset = npc.display.glowTexture.substring(index + 1); + if(npc.display.glowTexture.equals(assets.getAsset(asset))) + slot.selected = asset; + } + } + + + public void drawScreen(int i, int j, float f) + { + 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(); + GL11.glTranslatef(l + 33, i1 + 131, 50F); + float f1 = (50F * 5) / npc.display.modelSize; + GL11.glScalef(-f1, f1, f1); + GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); + float f2 = npc.renderYawOffset; + 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; + 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; + npc.rotationYawHead = npc.rotationYaw; + //npc.updateCloak(); + 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); + npc.renderYawOffset = f2; + npc.rotationYaw = f3; + npc.rotationPitch = f4; + npc.rotationYawHead = f7; + GL11.glPopMatrix(); + RenderHelper.disableStandardItemLighting(); + GL11.glDisable(32826 /*GL_RESCALE_NORMAL_EXT*/); + + OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); + GL11.glDisable(GL11.GL_TEXTURE_2D); + OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); + + super.drawScreen(i, j, f); + } + + @Override + public void elementClicked(){ + if(dataTextures.contains(slot.selected) && slot.selected != null){ + npc.display.glowTexture = assets.getAsset(slot.selected); + npc.textureGlowLocation = null; + } + } + + public void save() { + } + + @Override + public String[] getExtension() { + return new String[]{"png"}; + } + + +} diff --git a/src/main/java/noppes/npcs/client/gui/GuiNpcWaypoint.java b/src/main/java/noppes/npcs/client/gui/GuiNpcWaypoint.java new file mode 100644 index 000000000..602292ca0 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/GuiNpcWaypoint.java @@ -0,0 +1,52 @@ +package noppes.npcs.client.gui; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.blocks.tiles.TileWaypoint; +import noppes.npcs.client.Client; +import noppes.npcs.client.gui.util.GuiNPCInterface; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.constants.EnumPacketServer; + +public class GuiNpcWaypoint extends GuiNPCInterface{ + + private TileWaypoint tile; + + public GuiNpcWaypoint(int x, int y, int z) { + super(); + tile = (TileWaypoint) player.worldObj.getTileEntity(x, y, z); + 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).numbersOnly = 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); + Client.sendData(EnumPacketServer.SaveTileEntity, compound); + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/GuiScript.java b/src/main/java/noppes/npcs/client/gui/GuiScript.java new file mode 100644 index 000000000..4d84a3fc6 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/GuiScript.java @@ -0,0 +1,279 @@ +package noppes.npcs.client.gui; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiConfirmOpenLink; +import net.minecraft.client.gui.GuiYesNoCallback; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.server.MinecraftServer; +import noppes.npcs.DataScript; +import noppes.npcs.NoppesStringUtils; +import noppes.npcs.client.Client; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.gui.swing.GuiJTextArea; +import noppes.npcs.client.gui.util.GuiCustomScroll; +import noppes.npcs.client.gui.util.GuiMenuTopButton; +import noppes.npcs.client.gui.util.GuiNPCInterface; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcTextArea; +import noppes.npcs.client.gui.util.ICustomScrollListener; +import noppes.npcs.client.gui.util.IGuiData; +import noppes.npcs.client.gui.util.IJTextAreaListener; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.controllers.ScriptContainer; +import noppes.npcs.controllers.ScriptController; +import noppes.npcs.entity.EntityNPCInterface; + +public class GuiScript extends GuiNPCInterface implements IGuiData, GuiYesNoCallback, ICustomScrollListener, IJTextAreaListener { + public boolean showScript = false; + private int activeTab = 0; + public DataScript script; + public Map> languages = new HashMap>(); + + private static int activeConsole = 0; + + public GuiScript(EntityNPCInterface npc) { + super(npc); + script = npc.script; + drawDefaultBackground = true; + closeOnEsc = true; + xSize = 420; + + setBackground("menubg.png"); + Client.sendData(EnumPacketServer.ScriptDataGet); + } + + public void initGui() { + super.initGui(); + guiTop += 10; + GuiMenuTopButton top; + addTopButton(top = new GuiMenuTopButton(13, guiLeft + 4, guiTop - 17, "script.scripts")); + top.active = showScript; + addTopButton(top = new GuiMenuTopButton(14, top, "gui.settings")); + top.active = !showScript; + addTopButton(new GuiMenuTopButton(15, top, "gui.website")); + + List list = new ArrayList(); + 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"); + + 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.scripts.get(activeTab); + + addTextField(new GuiNpcTextArea(2, this, guiLeft + 74, guiTop + 4, 239, 208, container == null?"":container.script)); + + 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(108, guiLeft + 315, guiTop + 47, 80, 20, "gui.editor")); + + 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")); + + List l = new ArrayList(); + 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(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")); + } + } + + private int getScriptIndex() { + int i = 0; + for(String language : languages.keySet()){ + if(language.equalsIgnoreCase(script.scriptLanguage)) + return i; + i++; + } + return 0; + } + + private String getConsoleText() { + String console = ""; + if(activeConsole == 0){ + for(ScriptContainer container : script.scripts.values()){ + if(!container.console.isEmpty()) + console += container.console + '\n'; + } + } + else{ + ScriptContainer container = script.scripts.get(activeConsole - 1); + if(container != null) + console = container.console; + } + return console; + } + + @Override + public void confirmClicked(boolean flag, int i){ + if(flag) + openLink("http://www.kodevelopment.nl/minecraft/customnpcs/scripting"); + 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, "http://www.kodevelopment.nl/minecraft/customnpcs/scripting", 0, true); + mc.displayGuiScreen(guiyesno); + } + if (guibutton.id == 100) { + NoppesStringUtils.setClipboardContents(getTextField(2).getText()); + } + if (guibutton.id == 101) { + getTextField(2).setText(NoppesStringUtils.getClipboardContents()); + } + if (guibutton.id == 102) { + getTextField(2).setText(""); + if(!showScript){ + if(activeConsole == 0){ + for(ScriptContainer container : script.scripts.values()) + container.console = ""; + } + else{ + ScriptContainer container = script.scripts.get(activeConsole - 1); + if(container != null) + container.console = ""; + } + } + } + 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.scripts.get(activeTab); + if(container == null) + script.scripts.put(activeTab, container = new ScriptContainer()); + setSubGui(new GuiScriptList(languages.get(script.scriptLanguage), container)); + } + if (guibutton.id == 108) { + ScriptContainer container = script.scripts.get(activeTab); + if(container != null){ + setScript(); + this.AWTWindow = new GuiJTextArea(container.script).setListener(this); + } + } + } + + private void setScript(){ + if(showScript){ + ScriptContainer container = script.scripts.get(activeTab); + if(container == null) + script.scripts.put(activeTab, container = new ScriptContainer()); + 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> languages = new HashMap>(); + for(int i = 0; i < data.tagCount(); i++){ + NBTTagCompound comp = data.getCompoundTagAt(i); + List scripts = new ArrayList(); + 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(); + Client.sendData(EnumPacketServer.ScriptDataSave, 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 saveText(String text) { + ScriptContainer container = script.scripts.get(activeTab); + if(container != null) + container.script = text; + initGui(); + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/GuiScriptList.java b/src/main/java/noppes/npcs/client/gui/GuiScriptList.java new file mode 100644 index 000000000..34c121776 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/GuiScriptList.java @@ -0,0 +1,106 @@ +package noppes.npcs.client.gui; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.world.biome.BiomeGenBase; +import noppes.npcs.client.gui.util.GuiCustomScroll; +import noppes.npcs.client.gui.util.GuiNPCInterface; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.SubGuiInterface; +import noppes.npcs.controllers.ScriptContainer; +import noppes.npcs.entity.EntityNPCInterface; + +public class GuiScriptList extends SubGuiInterface{ + private GuiCustomScroll scroll1; + private GuiCustomScroll scroll2; + private ScriptContainer container; + private List scripts; + + public GuiScriptList(List scripts, ScriptContainer container){ + this.container = container; + setBackground("menubg.png"); + xSize = 346; + ySize = 216; + if(scripts == null) + scripts = new ArrayList(); + 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); + } + scroll2.guiLeft = guiLeft + 200; + scroll2.guiTop = guiTop + 14; + this.addScroll(scroll2); + addLabel(new GuiNpcLabel(2, "script.loadedScripts", guiLeft + 200, guiTop + 4)); + List temp = new ArrayList(scripts); + temp.removeAll(container.scripts); + 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(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")); + } + + protected void actionPerformed(GuiButton guibutton){ + GuiNpcButton button = (GuiNpcButton) guibutton; + if(button.id == 1){ + if(scroll1.hasSelected()){ + container.scripts.add(scroll1.getSelected()); + scroll1.selected = -1; + scroll1.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; + scroll1.selected = -1; + initGui(); + } + if(button.id == 4){ + container.scripts.clear(); + scroll1.selected = -1; + scroll1.selected = -1; + initGui(); + } + if(button.id == 66){ + close(); + } + } + @Override + public void save() { + + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/SubGuiColorSelector.java b/src/main/java/noppes/npcs/client/gui/SubGuiColorSelector.java new file mode 100644 index 000000000..2ecc3034f --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/SubGuiColorSelector.java @@ -0,0 +1,137 @@ +package noppes.npcs.client.gui; + +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.io.InputStream; + +import javax.imageio.ImageIO; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.resources.IResource; +import net.minecraft.util.ResourceLocation; +import noppes.npcs.ModelPartData; +import noppes.npcs.client.gui.util.GuiModelInterface; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.ITextfieldListener; +import noppes.npcs.client.gui.util.SubGuiInterface; +import noppes.npcs.entity.EntityCustomNpc; +import noppes.npcs.entity.EntityNPCInterface; + +import org.lwjgl.opengl.GL11; + +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; + + 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); + + 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); + } + } + + @Override + 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); + + 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); + 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) { + + } + } + } + } + + @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); + } +} diff --git a/src/main/java/noppes/npcs/client/gui/SubGuiEditText.java b/src/main/java/noppes/npcs/client/gui/SubGuiEditText.java new file mode 100644 index 000000000..02c4d65b4 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/SubGuiEditText.java @@ -0,0 +1,41 @@ +package noppes.npcs.client.gui; + +import net.minecraft.client.gui.GuiButton; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.ITextfieldListener; +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() { + } +} diff --git a/src/main/java/noppes/npcs/client/gui/SubGuiMailmanSendSetup.java b/src/main/java/noppes/npcs/client/gui/SubGuiMailmanSendSetup.java new file mode 100644 index 000000000..2d065fa7b --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/SubGuiMailmanSendSetup.java @@ -0,0 +1,105 @@ +package noppes.npcs.client.gui; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.client.Client; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.gui.global.GuiNPCQuestSelection; +import noppes.npcs.client.gui.player.GuiMailmanWrite; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.GuiSelectionListener; +import noppes.npcs.client.gui.util.ITextfieldListener; +import noppes.npcs.client.gui.util.SubGuiInterface; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.containers.ContainerMail; +import noppes.npcs.controllers.PlayerMail; + +public class SubGuiMailmanSendSetup extends SubGuiInterface implements ITextfieldListener, GuiSelectionListener{ + + private PlayerMail mail; + private GuiNPCQuestSelection questSelection; + + public SubGuiMailmanSendSetup(PlayerMail mail, GuiScreen parent){ + this.parent = parent; + xSize = 256; + setBackground("menubg.png"); + 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)); + + 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")); + + 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; + } + } + + 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 = parent; + GuiMailmanWrite.mail = mail; + + Client.sendData(EnumPacketServer.MailOpenSetup, mail.writeNBT()); + } + if(id == 3){ + NoppesUtil.openGUI(player, questSelection = new GuiNPCQuestSelection(npc, getParent(), mail.questId)); + questSelection.listener = this; + } + if(id == 4){ + mail.questId = -1; + mail.questTitle = ""; + initGui(); + } + } + + @Override + public void selected(int ob, String name) { + mail.questId = ob; + mail.questTitle = questSelection.getSelected(); + 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(); + } +} diff --git a/src/main/java/noppes/npcs/client/gui/SubGuiNpcAvailability.java b/src/main/java/noppes/npcs/client/gui/SubGuiNpcAvailability.java new file mode 100644 index 000000000..beee1673b --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/SubGuiNpcAvailability.java @@ -0,0 +1,171 @@ +package noppes.npcs.client.gui; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.client.Client; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.gui.global.GuiNPCQuestSelection; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.GuiSelectionListener; +import noppes.npcs.client.gui.util.ITextfieldListener; +import noppes.npcs.client.gui.util.IGuiData; +import noppes.npcs.client.gui.util.SubGuiInterface; +import noppes.npcs.constants.EnumAvailabilityDialog; +import noppes.npcs.constants.EnumAvailabilityFactionType; +import noppes.npcs.constants.EnumAvailabilityQuest; +import noppes.npcs.constants.EnumDayTime; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.controllers.Availability; +import noppes.npcs.controllers.Dialog; +import noppes.npcs.controllers.Faction; +import noppes.npcs.controllers.Quest; + +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 void initGui() + { + super.initGui(); + 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(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(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).numbersOnly = true; + this.getTextField(51).setMinMaxDefault(0, Integer.MAX_VALUE, 0); + + this.addButton(new GuiNpcButton(66, guiLeft + 82, guiTop + 192,98, 20, "gui.done")); + + updateGuiButtons(); + } + + + private void updateGuiButtons() { + if(availabitily.factionId >= 0){ + Client.sendData(EnumPacketServer.FactionGet, availabitily.factionId); + } + if(availabitily.faction2Id >= 0){ + Client.sendData(EnumPacketServer.FactionGet, 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 + 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(); + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/SubGuiNpcAvailabilityDialog.java b/src/main/java/noppes/npcs/client/gui/SubGuiNpcAvailabilityDialog.java new file mode 100644 index 000000000..65814d72d --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/SubGuiNpcAvailabilityDialog.java @@ -0,0 +1,187 @@ +package noppes.npcs.client.gui; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.client.Client; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiSelectionListener; +import noppes.npcs.client.gui.util.IGuiData; +import noppes.npcs.client.gui.util.SubGuiInterface; +import noppes.npcs.constants.EnumAvailabilityDialog; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.controllers.Availability; +import noppes.npcs.controllers.Dialog; + +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; + } + + @Override + public void initGui(){ + super.initGui(); + 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")); + + 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(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")); + + updateGuiButtons(); + } + + + private void updateGuiButtons() { + getButton(10).setDisplayText("availability.selectdialog"); + getButton(11).setDisplayText("availability.selectdialog"); + getButton(12).setDisplayText("availability.selectdialog"); + getButton(13).setDisplayText("availability.selectdialog"); + + if(availabitily.dialogId >= 0){ + Client.sendData(EnumPacketServer.DialogGet, availabitily.dialogId); + } + if(availabitily.dialog2Id >= 0){ + Client.sendData(EnumPacketServer.DialogGet, availabitily.dialog2Id); + } + if(availabitily.dialog3Id >= 0){ + Client.sendData(EnumPacketServer.DialogGet, availabitily.dialog3Id); + } + if(availabitily.dialog4Id >= 0){ + Client.sendData(EnumPacketServer.DialogGet, 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; + GuiNPCDialogSelection gui = new GuiNPCDialogSelection(npc, getParent(), availabitily.dialogId); + gui.listener = this; + NoppesUtil.openGUI(player, gui); + } + if(button.id == 11){ + slot = 2; + GuiNPCDialogSelection gui = new GuiNPCDialogSelection(npc, getParent(), availabitily.dialog2Id); + gui.listener = this; + NoppesUtil.openGUI(player, gui); + } + if(button.id == 12){ + slot = 3; + GuiNPCDialogSelection gui = new GuiNPCDialogSelection(npc, getParent(), availabitily.dialog3Id); + gui.listener = this; + NoppesUtil.openGUI(player, gui); + } + if(button.id == 13){ + slot = 4; + GuiNPCDialogSelection gui = new GuiNPCDialogSelection(npc, getParent(), availabitily.dialog4Id); + gui.listener = this; + NoppesUtil.openGUI(player, gui); + } + 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 + 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); + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/SubGuiNpcAvailabilityQuest.java b/src/main/java/noppes/npcs/client/gui/SubGuiNpcAvailabilityQuest.java new file mode 100644 index 000000000..33094b7d9 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/SubGuiNpcAvailabilityQuest.java @@ -0,0 +1,191 @@ +package noppes.npcs.client.gui; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.client.Client; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.gui.global.GuiNPCQuestSelection; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiSelectionListener; +import noppes.npcs.client.gui.util.IGuiData; +import noppes.npcs.client.gui.util.SubGuiInterface; +import noppes.npcs.constants.EnumAvailabilityQuest; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.controllers.Availability; +import noppes.npcs.controllers.Quest; + +public class SubGuiNpcAvailabilityQuest extends SubGuiInterface implements GuiSelectionListener, IGuiData { + private Availability availabitily; + private boolean selectFaction = false; + private int slot = 0; + + public SubGuiNpcAvailabilityQuest(Availability availabitily){ + this.availabitily = availabitily; + setBackground("menubg.png"); + xSize = 316; + ySize = 216; + closeOnEsc = true; + } + + @Override + public void initGui(){ + super.initGui(); + 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"},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"},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"},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"},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")); + + updateGuiButtons(); + } + + + private void updateGuiButtons() { + getButton(10).setDisplayText("availability.selectquest"); + getButton(11).setDisplayText("availability.selectquest"); + getButton(12).setDisplayText("availability.selectquest"); + getButton(13).setDisplayText("availability.selectquest"); + if(availabitily.questId >= 0){ + Client.sendData(EnumPacketServer.QuestGet, availabitily.questId); + } + if(availabitily.quest2Id >= 0){ + Client.sendData(EnumPacketServer.QuestGet, availabitily.quest2Id); + } + if(availabitily.quest3Id >= 0){ + Client.sendData(EnumPacketServer.QuestGet, availabitily.quest3Id); + } + if(availabitily.quest4Id >= 0){ + Client.sendData(EnumPacketServer.QuestGet, 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; + GuiNPCQuestSelection gui = new GuiNPCQuestSelection(npc, getParent(), availabitily.questId); + gui.listener = this; + NoppesUtil.openGUI(player, gui); + } + if(button.id == 11){ + slot = 2; + GuiNPCQuestSelection gui = new GuiNPCQuestSelection(npc, getParent(), availabitily.quest2Id); + gui.listener = this; + NoppesUtil.openGUI(player, gui); + } + if(button.id == 12){ + slot = 3; + GuiNPCQuestSelection gui = new GuiNPCQuestSelection(npc, getParent(), availabitily.quest3Id); + gui.listener = this; + NoppesUtil.openGUI(player, gui); + } + if(button.id == 13){ + slot = 4; + GuiNPCQuestSelection gui = new GuiNPCQuestSelection(npc, getParent(), availabitily.quest4Id); + gui.listener = this; + NoppesUtil.openGUI(player, gui); + } + + 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 + 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); + + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/SubGuiNpcBiomes.java b/src/main/java/noppes/npcs/client/gui/SubGuiNpcBiomes.java new file mode 100644 index 000000000..e91743ca6 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/SubGuiNpcBiomes.java @@ -0,0 +1,114 @@ +package noppes.npcs.client.gui; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.BiomeGenMutated; +import net.minecraftforge.common.BiomeManager; +import noppes.npcs.DataAI; +import noppes.npcs.client.gui.util.GuiCustomScroll; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.ITextfieldListener; +import noppes.npcs.client.gui.util.SubGuiInterface; +import noppes.npcs.constants.EnumAnimation; +import noppes.npcs.constants.EnumMovingType; +import noppes.npcs.constants.EnumStandingType; +import noppes.npcs.controllers.SpawnData; + +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 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, "spawning.availableBiomes", guiLeft + 4, guiTop + 4)); + + if(scroll2 == null){ + scroll2 = new GuiCustomScroll(this,1); + scroll2.setSize(140, 180); + } + scroll2.guiLeft = guiLeft + 200; + scroll2.guiTop = guiTop + 14; + this.addScroll(scroll2); + addLabel(new GuiNpcLabel(2, "spawning.spawningBiomes", guiLeft + 200, guiTop + 4)); + + List biomes = new ArrayList(); + for (BiomeGenBase base : BiomeGenBase.getBiomeGenArray()) { + if (base != null && base.biomeName != null && !data.biomes.contains(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(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")); + } + + 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; + scroll1.selected = -1; + initGui(); + } + if(button.id == 4){ + data.biomes.clear(); + scroll1.selected = -1; + scroll1.selected = -1; + initGui(); + } + if(button.id == 66){ + close(); + } + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/SubGuiNpcCommand.java b/src/main/java/noppes/npcs/client/gui/SubGuiNpcCommand.java new file mode 100644 index 000000000..28d1217d0 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/SubGuiNpcCommand.java @@ -0,0 +1,54 @@ +package noppes.npcs.client.gui; + +import net.minecraft.client.gui.GuiButton; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.ITextfieldListener; +import noppes.npcs.client.gui.util.SubGuiInterface; + +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 void initGui() + { + super.initGui(); + this.addTextField(new GuiNpcTextField(4, this, this.fontRendererObj, guiLeft + 4, guiTop + 84, 248, 20, command)); + this.getTextField(4).setMaxStringLength(32767); + + this.addLabel(new GuiNpcLabel(4, "advMode.command", guiLeft + 4, guiTop + 110)); + this.addLabel(new GuiNpcLabel(5, "advMode.nearestPlayer", guiLeft + 4, guiTop + 125)); + this.addLabel(new GuiNpcLabel(6, "advMode.randomPlayer", guiLeft + 4, guiTop + 140)); + this.addLabel(new GuiNpcLabel(7, "advMode.allPlayers", guiLeft + 4, guiTop + 155)); + this.addLabel(new GuiNpcLabel(8, "dialog.commandoptionplayer", guiLeft + 4, guiTop + 170)); + + 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(); + } + } + + @Override + public void unFocused(GuiNpcTextField textfield) { + if(textfield.id == 4){ + command = textfield.getText(); + } + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/SubGuiNpcDialogExtra.java b/src/main/java/noppes/npcs/client/gui/SubGuiNpcDialogExtra.java new file mode 100644 index 000000000..df50d234c --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/SubGuiNpcDialogExtra.java @@ -0,0 +1,102 @@ +package noppes.npcs.client.gui; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.client.Client; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcButtonYesNo; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiSelectionListener; +import noppes.npcs.client.gui.util.IGuiData; +import noppes.npcs.client.gui.util.ISubGuiListener; +import noppes.npcs.client.gui.util.SubGuiInterface; +import noppes.npcs.constants.EnumAvailabilityDialog; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.controllers.Availability; +import noppes.npcs.controllers.Dialog; +import noppes.npcs.controllers.PlayerMail; + +public class SubGuiNpcDialogExtra extends SubGuiInterface implements ISubGuiListener +{ + private Dialog dialog; + private int slot = 0; + public GuiScreen parent2; + + public SubGuiNpcDialogExtra(Dialog dialog, GuiScreen parent) + { + this.parent2 = parent; + this.dialog = dialog; + setBackground("menubg.png"); + xSize = 256; + ySize = 216; + closeOnEsc = true; + } + + public void initGui() + { + super.initGui(); + int y = guiTop + 4; + + addButton(new GuiNpcButton(13, guiLeft + 4, y, 164, 20, "mailbox.setup")); + addButton(new GuiNpcButton(14, guiLeft + 170, y, 20, 20, "X")); + if(!dialog.mail.subject.isEmpty()) + getButton(13).setDisplayText(dialog.mail.subject); + + addButton(new GuiNpcButton(10, guiLeft + 120, y += 22, 50, 20, "selectServer.edit")); + addLabel(new GuiNpcLabel(10, "advMode.command", guiLeft + 4, y + 5)); + + addButton(new GuiNpcButtonYesNo(11, guiLeft + 120, y += 22, dialog.hideNPC)); + addLabel(new GuiNpcLabel(11, "dialog.hideNPC", guiLeft + 4, y + 5)); + + addButton(new GuiNpcButtonYesNo(12, guiLeft + 120, y += 22, dialog.showWheel)); + addLabel(new GuiNpcLabel(12, "dialog.showWheel", guiLeft + 4, y + 5)); + + addButton(new GuiNpcButtonYesNo(15, guiLeft + 120, y += 22, dialog.disableEsc)); + addLabel(new GuiNpcLabel(15, "dialog.disableEsc", guiLeft + 4, y + 5)); + + this.addButton(new GuiNpcButton(66, guiLeft + 82, guiTop + 192,98, 20, "gui.done")); + + } + + @Override + protected void actionPerformed(GuiButton guibutton){ + GuiNpcButton button = (GuiNpcButton) guibutton; + + if(button.id == 10){ + setSubGui(new SubGuiNpcCommand(dialog.command)); + } + if(button.id == 11){ + dialog.hideNPC = button.getValue() == 1; + } + if(button.id == 12){ + dialog.showWheel = button.getValue() == 1; + } + if(button.id == 15){ + dialog.disableEsc = button.getValue() == 1; + } + if(button.id == 13){ + setSubGui(new SubGuiMailmanSendSetup(dialog.mail, getParent())); + } + if(button.id == 14){ + dialog.mail = new PlayerMail(); + initGui(); + } + + if(button.id == 66) + { + close(); + if(parent2 != null) + NoppesUtil.openGUI(player, parent2); + } + } + + + @Override + public void subGuiClosed(SubGuiInterface subgui){ + if(subgui instanceof SubGuiNpcCommand){ + dialog.command = ((SubGuiNpcCommand) subgui).command; + } + } +} diff --git a/src/main/java/noppes/npcs/client/gui/SubGuiNpcDialogOption.java b/src/main/java/noppes/npcs/client/gui/SubGuiNpcDialogOption.java new file mode 100644 index 000000000..3b24c9bc7 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/SubGuiNpcDialogOption.java @@ -0,0 +1,129 @@ +package noppes.npcs.client.gui; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.client.Client; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.GuiSelectionListener; +import noppes.npcs.client.gui.util.IGuiData; +import noppes.npcs.client.gui.util.ISubGuiListener; +import noppes.npcs.client.gui.util.ITextfieldListener; +import noppes.npcs.client.gui.util.SubGuiInterface; +import noppes.npcs.constants.EnumOptionType; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.controllers.Dialog; +import noppes.npcs.controllers.DialogOption; + +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; + } + + @Override + public void initGui(){ + super.initGui(); + this.addLabel(new GuiNpcLabel(66, "dialog.editoption", guiLeft, guiTop + 4)); + this.getLabel(66).center(xSize); + + this.addLabel(new GuiNpcLabel(0, "gui.title", guiLeft + 4, guiTop + 20)); + 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; + 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.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())); + + if(option.optionType == EnumOptionType.DialogOption){ + this.addButton(new GuiNpcButton(3, guiLeft + 4, guiTop + 84, "availability.selectdialog")); + if(option.dialogId >= 0) + Client.sendData(EnumPacketServer.DialogGet, option.dialogId); + } + 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(4, "advMode.command", guiLeft + 4, guiTop + 110)); + this.addLabel(new GuiNpcLabel(5, "advMode.nearestPlayer", guiLeft + 4, guiTop + 125)); + this.addLabel(new GuiNpcLabel(6, "advMode.randomPlayer", guiLeft + 4, guiTop + 140)); + this.addLabel(new GuiNpcLabel(7, "advMode.allPlayers", guiLeft + 4, guiTop + 155)); + this.addLabel(new GuiNpcLabel(8, "dialog.commandoptionplayer", guiLeft + 4, guiTop + 170)); + } + + this.addButton(new GuiNpcButton(66, guiLeft + 82, guiTop + 190,98, 20, "gui.done")); + + } + + @Override + 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){ + GuiNPCDialogSelection gui = new GuiNPCDialogSelection(npc, getParent(), option.dialogId); + gui.listener = this; + NoppesUtil.openGUI(player, gui); + } + 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) { + LastColor = option.optionColor = ((SubGuiColorSelector)subgui).color; + initGui(); + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/SubGuiNpcDialogOptions.java b/src/main/java/noppes/npcs/client/gui/SubGuiNpcDialogOptions.java new file mode 100644 index 000000000..ed2cf708b --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/SubGuiNpcDialogOptions.java @@ -0,0 +1,62 @@ +package noppes.npcs.client.gui; + +import net.minecraft.client.gui.GuiButton; +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.EnumOptionType; +import noppes.npcs.controllers.Dialog; +import noppes.npcs.controllers.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 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")); + + } + + 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)); + } + if(id == 66) + { + close(); + } + } +} diff --git a/src/main/java/noppes/npcs/client/gui/SubGuiNpcFactionOptions.java b/src/main/java/noppes/npcs/client/gui/SubGuiNpcFactionOptions.java new file mode 100644 index 000000000..021f43165 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/SubGuiNpcFactionOptions.java @@ -0,0 +1,156 @@ +package noppes.npcs.client.gui; + +import java.util.HashMap; +import java.util.Vector; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.util.StatCollector; +import noppes.npcs.client.Client; +import noppes.npcs.client.gui.util.GuiCustomScroll; +import noppes.npcs.client.gui.util.ICustomScrollListener; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.IScrollData; +import noppes.npcs.client.gui.util.SubGuiInterface; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.controllers.FactionOptions; + +public class SubGuiNpcFactionOptions extends SubGuiInterface implements IScrollData,ICustomScrollListener +{ + private FactionOptions options; + private HashMap data = new HashMap(); + private GuiCustomScroll scrollFactions; + + private int selected = -1; + + public SubGuiNpcFactionOptions(FactionOptions options) + { + this.options = options; + setBackground("menubg.png"); + xSize = 256; + ySize = 216; + closeOnEsc = true; + Client.sendData(EnumPacketServer.FactionsGet); + } + + public void initGui() + { + super.initGui(); + 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)); + + String label = ""; + if(options.decreaseFactionPoints) + label += StatCollector.translateToLocal("gui.decrease"); + else + label += StatCollector.translateToLocal("gui.increase"); + label += " " + options.factionPoints + " " + StatCollector.translateToLocal("faction.points"); + + 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)); + + String label = ""; + if(options.decreaseFaction2Points) + label += StatCollector.translateToLocal("gui.decrease"); + else + label += StatCollector.translateToLocal("gui.increase"); + label += " " + options.faction2Points + " " + StatCollector.translateToLocal("faction.points"); + + 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)); + + addTextField(new GuiNpcTextField(1, this, fontRendererObj, guiLeft + 4, guiTop + 82, 110, 20, "10")); + getTextField(1).numbersOnly = true; + getTextField(1).setMinMaxDefault(1, 100000, 10); + + addButton(new GuiNpcButton(3, guiLeft + 4, guiTop + 104, 60, 20, "gui.add")); + } + + 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; + } + + 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 == 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(); + } + } + + @Override + public void customScrollClicked(int i, int j, int k, + GuiCustomScroll guiCustomScroll) { + selected = data.get(guiCustomScroll.getSelected()); + initGui(); + } + + @Override + public void setData(Vector list, HashMap data) { + GuiCustomScroll scroll = getScroll(0); + String name = scroll.getSelected(); + this.data = data; + scroll.setList(list); + + if(name != null) + scroll.setSelected(name); + + initGui(); + } + + @Override + public void setSelected(String selected) { + + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/SubGuiNpcFactionPoints.java b/src/main/java/noppes/npcs/client/gui/SubGuiNpcFactionPoints.java new file mode 100644 index 000000000..909bb11ab --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/SubGuiNpcFactionPoints.java @@ -0,0 +1,71 @@ +package noppes.npcs.client.gui; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.util.StatCollector; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.ITextfieldListener; +import noppes.npcs.client.gui.util.SubGuiInterface; +import noppes.npcs.controllers.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; + } + + @Override + 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).numbersOnly = 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).numbersOnly = true; + getTextField(4).numbersOnly = 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(); + } + } + + @Override + protected void actionPerformed(GuiButton guibutton){ + int id = guibutton.id; + if(id == 66){ + close(); + } + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/SubGuiNpcMeleeProperties.java b/src/main/java/noppes/npcs/client/gui/SubGuiNpcMeleeProperties.java new file mode 100644 index 000000000..642b0d356 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/SubGuiNpcMeleeProperties.java @@ -0,0 +1,96 @@ +package noppes.npcs.client.gui; + +import net.minecraft.client.gui.GuiButton; +import noppes.npcs.DataStats; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.ITextfieldListener; +import noppes.npcs.client.gui.util.SubGuiInterface; +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 SubGuiNpcMeleeProperties(DataStats stats) + { + this.stats = stats; + setBackground("menubg.png"); + xSize = 256; + ySize = 216; + closeOnEsc = true; + } + + 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, 50, 18, stats.getAttackStrength()+"")); + getTextField(1).numbersOnly = true; + getTextField(1).setMinMaxDefault(0, 99999, 5); + addLabel(new GuiNpcLabel(2,"stats.meleerange", guiLeft + 5, guiTop + 45)); + addTextField(new GuiNpcTextField(2,this, fontRendererObj, guiLeft + 85, guiTop + 40, 50, 18, stats.attackRange+"")); + getTextField(2).numbersOnly = true; + getTextField(2).setMinMaxDefault(1, 30, 2); + addLabel(new GuiNpcLabel(3,"stats.meleespeed", guiLeft + 5, guiTop + 75)); + addTextField(new GuiNpcTextField(3,this, fontRendererObj, guiLeft + 85, guiTop + 70, 50, 18, stats.attackSpeed+"")); + getTextField(3).numbersOnly = true; + getTextField(3).setMinMaxDefault(1, 1000, 20); + + + addLabel(new GuiNpcLabel(4,"enchantment.knockback", guiLeft + 5, guiTop + 105)); + addTextField(new GuiNpcTextField(4,this, fontRendererObj, guiLeft + 85, guiTop + 100, 50, 18, stats.knockback + "")); + getTextField(4).numbersOnly = true; + getTextField(4).setMinMaxDefault(0, 4, 0); + addLabel(new GuiNpcLabel(5,"stats.meleeeffect", guiLeft + 5, guiTop + 135)); + addButton(new GuiNpcButton(5,guiLeft + 85, guiTop + 130, 52, 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, 50, 18, stats.potionDuration + "")); + getTextField(6).numbersOnly = true; + getTextField(6).setMinMaxDefault(1, 99999, 5); + if(stats.potionType != EnumPotionType.Fire) { + addLabel(new GuiNpcLabel(7,"stats.amplify", guiLeft + 5, guiTop + 195)); + addButton(new GuiNpcButton(7,guiLeft + 85, guiTop + 190, 52, 20, new String[]{"gui.no", "gui.yes"} ,stats.potionAmp)); + } + } + addButton(new GuiNpcButton(66, guiLeft + 165, guiTop + 192, 90, 20, "gui.done")); + } + + public void unFocused(GuiNpcTextField textfield) { + if(textfield.id == 1){ + stats.setAttackStrength(textfield.getInteger()); + } + 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(); + } + if(button.id == 7){ + stats.potionAmp = button.getValue(); + } + if(button.id == 66) + { + close(); + } + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/SubGuiNpcMovement.java b/src/main/java/noppes/npcs/client/gui/SubGuiNpcMovement.java new file mode 100644 index 000000000..76e6d1d13 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/SubGuiNpcMovement.java @@ -0,0 +1,171 @@ +package noppes.npcs.client.gui; + +import net.minecraft.client.gui.GuiButton; +import noppes.npcs.DataAI; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.ITextfieldListener; +import noppes.npcs.client.gui.util.SubGuiInterface; +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 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())); + + if(ai.movingType == EnumMovingType.Wandering){ + addTextField(new GuiNpcTextField(4,this, guiLeft + 100, y += 22, 40, 20, ai.walkingRange + "")); + getTextField(4).numbersOnly = true; + getTextField(4).setMinMaxDefault(0, 1000, 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).numbersOnly = 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).numbersOnly = 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).numbersOnly = true; + getTextField(9).setMinMaxDefault(0, 10, 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).numbersOnly = 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).numbersOnly = 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).numbersOnly = true; + getTextField(14).setMinMaxDefault(0, 10, 4); + 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 == 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()); + } + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/SubGuiNpcProjectiles.java b/src/main/java/noppes/npcs/client/gui/SubGuiNpcProjectiles.java new file mode 100644 index 000000000..7b9f6af39 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/SubGuiNpcProjectiles.java @@ -0,0 +1,146 @@ +package noppes.npcs.client.gui; + +import net.minecraft.client.gui.GuiButton; +import noppes.npcs.DataStats; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.ITextfieldListener; +import noppes.npcs.client.gui.util.SubGuiInterface; +import noppes.npcs.constants.EnumAnimation; +import noppes.npcs.constants.EnumPotionType; +import noppes.npcs.constants.EnumParticleType; + +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() + { + super.initGui(); + addLabel(new GuiNpcLabel(1,"enchantment.arrowDamage", guiLeft + 5, guiTop + 15)); + addTextField(new GuiNpcTextField(1,this, fontRendererObj, guiLeft + 45, guiTop + 10, 50, 18, stats.pDamage+"")); + getTextField(1).numbersOnly = true; + getTextField(1).setMinMaxDefault(0, 9999, 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+"")); + getTextField(2).numbersOnly = true; + getTextField(2).setMinMaxDefault(0, 3, 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+"")); + getTextField(3).numbersOnly = true; + getTextField(3).setMinMaxDefault(1, 10, 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+"")); + getTextField(4).numbersOnly = true; + getTextField(4).setMinMaxDefault(1, 50, 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).numbersOnly = true; + getTextField(5).setMinMaxDefault(1, 99999, 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 = textfield.getInteger(); + } + 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(); + } + if(button.id == 1){ + stats.pXlr8 = (button.getValue() == 1); + } + if(button.id == 2){ + stats.pExplode = (button.getValue() == 1); + initGui(); + } + if(button.id == 3){ + stats.pArea = button.getValue(); + } + if(button.id == 4){ + stats.pEffect = EnumPotionType.values()[button.getValue()]; + initGui(); + } + if(button.id == 5){ + stats.pTrail = EnumParticleType.values()[button.getValue()]; + } + if(button.id == 6){ + stats.pGlows = (button.getValue() == 1); + } + if(button.id == 7){ + stats.pRender3D = (button.getValue() == 1); + initGui(); + } + if(button.id == 8){ + stats.pSpin = (button.getValue() == 1); + } + if(button.id == 9){ + stats.pStick = (button.getValue() == 1); + } + if(button.id == 10){ + stats.pEffAmp = button.getValue(); + } + if(button.id == 66) + { + close(); + } + } +} diff --git a/src/main/java/noppes/npcs/client/gui/SubGuiNpcRangeProperties.java b/src/main/java/noppes/npcs/client/gui/SubGuiNpcRangeProperties.java new file mode 100644 index 000000000..2077f34f0 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/SubGuiNpcRangeProperties.java @@ -0,0 +1,133 @@ +package noppes.npcs.client.gui; + +import net.minecraft.client.gui.GuiButton; +import noppes.npcs.DataStats; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcButtonYesNo; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.ITextfieldListener; +import noppes.npcs.client.gui.util.SubGuiInterface; + +public class SubGuiNpcRangeProperties extends SubGuiInterface implements ITextfieldListener +{ + private DataStats stats; + private GuiNpcSoundSelection gui; + + public SubGuiNpcRangeProperties(DataStats stats) + { + this.stats = stats; + setBackground("menubg.png"); + xSize = 256; + ySize = 216; + closeOnEsc = true; + } + + public void initGui(){ + super.initGui(); + int y = guiTop + 4; + addTextField(new GuiNpcTextField(1,this, fontRendererObj, guiLeft + 85, y, 50, 18, stats.accuracy+"")); + addLabel(new GuiNpcLabel(1,"stats.accuracy", guiLeft + 5, y + 5)); + getTextField(1).numbersOnly = true; + getTextField(1).setMinMaxDefault(0, 100, 90); + addTextField(new GuiNpcTextField(2,this, fontRendererObj, guiLeft + 85, y += 22, 50, 18, stats.rangedRange+"")); + addLabel(new GuiNpcLabel(2,"stats.rangedrange", guiLeft + 5, y + 5)); + getTextField(2).numbersOnly = true; + getTextField(2).setMinMaxDefault(1, 64, 2); + addTextField(new GuiNpcTextField(3,this, fontRendererObj, guiLeft + 85, y += 22, 50, 18, stats.minDelay+"")); + addLabel(new GuiNpcLabel(3,"stats.mindelay", guiLeft + 5, y + 5)); + getTextField(3).numbersOnly = true; + getTextField(3).setMinMaxDefault(1, 9999, 20); + addTextField(new GuiNpcTextField(4,this, fontRendererObj, guiLeft + 85, y += 22, 50, 18, stats.maxDelay+"")); + addLabel(new GuiNpcLabel(4,"stats.maxdelay", guiLeft + 5, y + 5)); + getTextField(4).numbersOnly = true; + getTextField(4).setMinMaxDefault(1, 9999, 20); + + addTextField(new GuiNpcTextField(5, this, fontRendererObj, guiLeft + 85, y += 22, 50, 18, stats.fireRate + "")); + addLabel(new GuiNpcLabel(5, "stats.burstspeed", guiLeft + 5, y + 5)); + getTextField(5).numbersOnly = true; + getTextField(5).setMinMaxDefault(0, 30, 0); + addTextField(new GuiNpcTextField(6, this, fontRendererObj, guiLeft + 85, y += 22, 50, 18, stats.burstCount + "")); + addLabel(new GuiNpcLabel(6, "stats.burstcount", guiLeft + 5, y + 5)); + getTextField(6).numbersOnly = true; + getTextField(6).setMinMaxDefault(1, 100, 20); + addTextField(new GuiNpcTextField(7,this, fontRendererObj, guiLeft + 85, 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, "mco.template.button.select")); + addTextField(new GuiNpcTextField(8, this, fontRendererObj, guiLeft + 85, y += 22, 50, 18, stats.shotCount + "")); + addLabel(new GuiNpcLabel(8, "stats.shotcount", guiLeft + 5, y + 5)); + getTextField(8).numbersOnly = true; + getTextField(8).setMinMaxDefault(1, 10, 1); + + 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")); + } + + 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 + public void elementClicked(){ + getTextField(7).setText(gui.getSelected()); + unFocused(getTextField(7)); + } + + @Override + protected void actionPerformed(GuiButton guibutton){ + int id = guibutton.id; + if(id == 7) + { + NoppesUtil.openGUI(player, gui = new GuiNpcSoundSelection(npc, parent, getTextField(7).getText())); + } + if(id == 66) + { + close(); + } + else if(id == 9){ + stats.aimWhileShooting = ((GuiNpcButtonYesNo)guibutton).getBoolean(); + } + } +} diff --git a/src/main/java/noppes/npcs/client/gui/SubGuiNpcResistanceProperties.java b/src/main/java/noppes/npcs/client/gui/SubGuiNpcResistanceProperties.java new file mode 100644 index 000000000..08cd8519e --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/SubGuiNpcResistanceProperties.java @@ -0,0 +1,78 @@ +package noppes.npcs.client.gui; + +import net.minecraft.client.gui.GuiButton; +import noppes.npcs.Resistances; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcSlider; +import noppes.npcs.client.gui.util.ISliderListener; +import noppes.npcs.client.gui.util.SubGuiInterface; + +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() + { + super.initGui(); + addLabel(new GuiNpcLabel(0,"enchantment.knockback", guiLeft + 4, guiTop + 15)); + addSlider(new GuiNpcSlider(this, 0, guiLeft + 94, guiTop + 10, (int)(resistances.knockback * 100 - 100) + "%", resistances.knockback / 2)); + + addLabel(new GuiNpcLabel(1,"item.arrow.name", guiLeft + 4, guiTop + 37)); + addSlider(new GuiNpcSlider(this, 1, guiLeft + 94, guiTop + 32, (int)(resistances.arrow * 100 - 100) + "%", resistances.arrow / 2)); + + addLabel(new GuiNpcLabel(2,"stats.melee", guiLeft + 4, guiTop + 59)); + addSlider(new GuiNpcSlider(this, 2, guiLeft + 94, guiTop + 54, (int)(resistances.playermelee * 100 - 100) + "%", resistances.playermelee / 2)); + + addLabel(new GuiNpcLabel(3,"stats.explosion", guiLeft + 4, guiTop + 81)); + addSlider(new GuiNpcSlider(this, 3, guiLeft + 94, guiTop + 76, (int)(resistances.explosion * 100 - 100) + "%", resistances.explosion / 2)); + + addButton(new GuiNpcButton(66, guiLeft + 190, guiTop + 190, 60, 20, "gui.done")); + } + + protected void actionPerformed(GuiButton guibutton) + { + int id = guibutton.id; + if(id == 66) + { + close(); + } + } + + @Override + public void mouseDragged(GuiNpcSlider slider) { + slider.displayString = (int)(slider.sliderValue * 200 - 100) + "%"; + } + + @Override + public void mousePressed(GuiNpcSlider slider) { + // TODO Auto-generated method stub + + } + + @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; + } + + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/SubGuiNpcRespawn.java b/src/main/java/noppes/npcs/client/gui/SubGuiNpcRespawn.java new file mode 100644 index 000000000..26f28e05f --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/SubGuiNpcRespawn.java @@ -0,0 +1,74 @@ +package noppes.npcs.client.gui; + +import net.minecraft.client.gui.GuiButton; +import noppes.npcs.DataStats; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.ITextfieldListener; +import noppes.npcs.client.gui.util.SubGuiInterface; + +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(){ + 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).numbersOnly = 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(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; + } + 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(); + } + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/SubGuiNpcTextArea.java b/src/main/java/noppes/npcs/client/gui/SubGuiNpcTextArea.java new file mode 100644 index 000000000..047535c31 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/SubGuiNpcTextArea.java @@ -0,0 +1,66 @@ +package noppes.npcs.client.gui; + +import net.minecraft.client.gui.GuiButton; +import noppes.npcs.NoppesStringUtils; +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 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)); + + + 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 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(); + } + } +} diff --git a/src/main/java/noppes/npcs/client/gui/advanced/GuiNPCAdvancedLinkedNpc.java b/src/main/java/noppes/npcs/client/gui/advanced/GuiNPCAdvancedLinkedNpc.java new file mode 100644 index 000000000..1c61e8a52 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/advanced/GuiNPCAdvancedLinkedNpc.java @@ -0,0 +1,95 @@ +package noppes.npcs.client.gui.advanced; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Vector; + +import org.apache.logging.log4j.status.StatusConsoleListener; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.StatCollector; +import noppes.npcs.client.Client; +import noppes.npcs.client.gui.SubGuiEditText; +import noppes.npcs.client.gui.SubGuiMailmanSendSetup; +import noppes.npcs.client.gui.SubGuiNpcCommand; +import noppes.npcs.client.gui.SubGuiNpcFactionOptions; +import noppes.npcs.client.gui.SubGuiNpcTextArea; +import noppes.npcs.client.gui.util.GuiCustomScroll; +import noppes.npcs.client.gui.util.GuiNPCInterface2; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.GuiSelectionListener; +import noppes.npcs.client.gui.util.ICustomScrollListener; +import noppes.npcs.client.gui.util.IGuiData; +import noppes.npcs.client.gui.util.IScrollData; +import noppes.npcs.client.gui.util.ISubGuiListener; +import noppes.npcs.client.gui.util.ITextfieldListener; +import noppes.npcs.client.gui.util.SubGuiInterface; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.controllers.Quest; +import noppes.npcs.controllers.QuestCategory; +import noppes.npcs.entity.EntityNPCInterface; + +public class GuiNPCAdvancedLinkedNpc extends GuiNPCInterface2 implements IScrollData, ICustomScrollListener{ + private GuiCustomScroll scroll; + private List data = new ArrayList(); + + public static GuiScreen Instance; + + public GuiNPCAdvancedLinkedNpc(EntityNPCInterface npc){ + super(npc); + Instance = this; + Client.sendData(EnumPacketServer.LinkedGetAll); + } + + @Override + public void initGui(){ + super.initGui(); + + this.addButton(new GuiNpcButton(1,guiLeft + 358, guiTop + 38, 58, 20, "gui.clear")); + + if(scroll == null){ + scroll = new GuiCustomScroll(this,0); + scroll.setSize(143, 208); + } + scroll.guiLeft = guiLeft + 137; + scroll.guiTop = guiTop + 4; + scroll.setSelected(npc.linkedName); + scroll.setList(data); + this.addScroll(scroll); + } + + @Override + public void buttonEvent(GuiButton button){ + if(button.id == 1){ + Client.sendData(EnumPacketServer.LinkedSet, ""); + } + + } + + @Override + public void setData(Vector list, HashMap data) { + this.data = new ArrayList(list); + initGui(); + } + + @Override + public void setSelected(String selected) { + scroll.setSelected(selected); + } + + @Override + public void save() { + + } + + @Override + public void customScrollClicked(int i, int j, int k, + GuiCustomScroll guiCustomScroll) { + Client.sendData(EnumPacketServer.LinkedSet, guiCustomScroll.getSelected()); + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/advanced/GuiNPCDialogNpcOptions.java b/src/main/java/noppes/npcs/client/gui/advanced/GuiNPCDialogNpcOptions.java new file mode 100644 index 000000000..1eda4f0f5 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/advanced/GuiNPCDialogNpcOptions.java @@ -0,0 +1,94 @@ +package noppes.npcs.client.gui.advanced; + +import java.util.HashMap; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.client.Client; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.gui.GuiNPCDialogSelection; +import noppes.npcs.client.gui.util.GuiNPCInterface2; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiSelectionListener; +import noppes.npcs.client.gui.util.IGuiData; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.controllers.DialogOption; +import noppes.npcs.entity.EntityNPCInterface; + + +public class GuiNPCDialogNpcOptions extends GuiNPCInterface2 implements GuiSelectionListener,IGuiData{ + private GuiScreen parent; + private HashMap data = new HashMap(); + + public GuiNPCDialogNpcOptions(EntityNPCInterface npc, GuiScreen parent) { + super(npc); + this.parent = parent; + this.drawDefaultBackground = true; + Client.sendData(EnumPacketServer.DialogNpcGet); + } + + 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)); + + } + } + + 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 == 1) { + NoppesUtil.openGUI(player, parent); + } + if (id >= 0 && id < 20) { + close(); + selectedSlot = id; + int dialogID = -1; + if(data.containsKey(id)) + dialogID = data.get(id).dialogId; + NoppesUtil.openGUI(player, new GuiNPCDialogSelection(npc, this, dialogID)); + } + if (id >= 20 && id < 40) { + int slot = id - 20; + data.remove(slot); + Client.sendData(EnumPacketServer.DialogNpcRemove,slot); + initGui(); + } + } + + public void save() { + return; + } + + @Override + public void selected(int id, String name) { + Client.sendData(EnumPacketServer.DialogNpcSet, selectedSlot, id); + } + + + @Override + public void setGuiData(NBTTagCompound compound) { + int pos = compound.getInteger("Position"); + + DialogOption dialog = new DialogOption(); + dialog.readNBT(compound); + + data.put(pos, dialog); + initGui(); + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/advanced/GuiNPCFactionSetup.java b/src/main/java/noppes/npcs/client/gui/advanced/GuiNPCFactionSetup.java new file mode 100644 index 000000000..eaa14067a --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/advanced/GuiNPCFactionSetup.java @@ -0,0 +1,104 @@ +package noppes.npcs.client.gui.advanced; + +import java.util.HashMap; +import java.util.Vector; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.client.Client; +import noppes.npcs.client.gui.SubGuiNpcFactionOptions; +import noppes.npcs.client.gui.util.GuiCustomScroll; +import noppes.npcs.client.gui.util.ICustomScrollListener; +import noppes.npcs.client.gui.util.GuiNPCInterface2; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.IScrollData; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.entity.EntityNPCInterface; + +public class GuiNPCFactionSetup extends GuiNPCInterface2 implements IScrollData,ICustomScrollListener +{ + private GuiCustomScroll scrollFactions; + private HashMap data = new HashMap(); + + public GuiNPCFactionSetup(EntityNPCInterface npc) + { + super(npc); + Client.sendData(EnumPacketServer.FactionsGet); + } + + 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.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.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); + scrollFactions.setSize(180, 200); + } + scrollFactions.guiLeft = guiLeft + 200; + scrollFactions.guiTop = guiTop + 4; + this.addScroll(scrollFactions); + } + + @Override + public void buttonEvent(GuiButton guibutton) { + { + 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)); + } + + } + + @Override + public void setData(Vector list, HashMap data) + { + String name = npc.getFaction().name; + this.data = data; + scrollFactions.setList(list); + + if(name != null) + setSelected(name); + } + + public void mouseClicked(int i, int j, int k) + { + super.mouseClicked(i, j, k); + if(k == 0 && scrollFactions != null) + scrollFactions.mouseClicked(i, j, k); + } + + @Override + public void setSelected(String selected) { + scrollFactions.setSelected(selected); + } + + @Override + public void customScrollClicked(int i, int j, int k, GuiCustomScroll guiCustomScroll) { + if(guiCustomScroll.id == 0) + { + Client.sendData(EnumPacketServer.FactionSet, data.get(scrollFactions.getSelected())); + } + } + + public void save() { + Client.sendData(EnumPacketServer.MainmenuAdvancedSave, npc.advanced.writeToNBT(new NBTTagCompound())); + } +} diff --git a/src/main/java/noppes/npcs/client/gui/advanced/GuiNPCLinesMenu.java b/src/main/java/noppes/npcs/client/gui/advanced/GuiNPCLinesMenu.java new file mode 100644 index 000000000..48ab6be4e --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/advanced/GuiNPCLinesMenu.java @@ -0,0 +1,64 @@ +package noppes.npcs.client.gui.advanced; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.client.Client; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.gui.GuiNPCLinesEdit; +import noppes.npcs.client.gui.util.GuiNPCInterface2; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcButtonYesNo; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.entity.EntityNPCInterface; + +public class GuiNPCLinesMenu extends GuiNPCInterface2 { + + public GuiNPCLinesMenu(EntityNPCInterface npc) { + super(npc); + } + + @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.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)); + } + 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 == 5){ + NoppesUtil.openGUI(player, new GuiNPCLinesEdit(npc, npc.advanced.killedLines)); + } + if(id == 6){ + NoppesUtil.openGUI(player, new GuiNPCLinesEdit(npc, npc.advanced.killLines)); + } + if(id == 16){ + npc.advanced.orderedLines = !((GuiNpcButtonYesNo)guibutton).getBoolean(); + } + } + + @Override + public void save() { + Client.sendData(EnumPacketServer.MainmenuAdvancedSave, npc.advanced.writeToNBT(new NBTTagCompound())); + } + + +} diff --git a/src/main/java/noppes/npcs/client/gui/advanced/GuiNPCNightSetup.java b/src/main/java/noppes/npcs/client/gui/advanced/GuiNPCNightSetup.java new file mode 100644 index 000000000..1ea39adab --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/advanced/GuiNPCNightSetup.java @@ -0,0 +1,100 @@ +package noppes.npcs.client.gui.advanced; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.client.Client; +import noppes.npcs.client.gui.util.GuiNPCInterface2; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.IGuiData; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.controllers.TransformData; +import noppes.npcs.entity.EntityNPCInterface; + +public class GuiNPCNightSetup extends GuiNPCInterface2 implements IGuiData +{ + private TransformData data; + + public GuiNPCNightSetup(EntityNPCInterface npc) + { + super(npc); + data = npc.transform; + Client.sendData(EnumPacketServer.TransformGet); + } + + 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.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.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.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.addLabel(new GuiNpcLabel(4, "menu.advanced", guiLeft + 4, guiTop + 113)); + this.addButton(new GuiNpcButton(4, guiLeft + 104, guiTop + 108, 50, 20, new String[]{"gui.no","gui.yes"}, data.hasAdvanced?1:0)); + + this.addLabel(new GuiNpcLabel(5, "role.name", guiLeft + 4, guiTop + 135)); + this.addButton(new GuiNpcButton(5, guiLeft + 104, guiTop + 130, 50, 20, new String[]{"gui.no","gui.yes"}, data.hasRole?1:0)); + + this.addLabel(new GuiNpcLabel(6, "job.name", guiLeft + 4, guiTop + 157)); + this.addButton(new GuiNpcButton(6, guiLeft + 104, guiTop + 152, 50, 20, new String[]{"gui.no","gui.yes"}, data.hasJob?1:0)); + + this.addLabel(new GuiNpcLabel(10, "advanced.editingmode", guiLeft + 170, guiTop + 9)); + this.addButton(new GuiNpcButton(10, guiLeft + 244, guiTop + 4, 50, 20, new String[]{"gui.no","gui.yes"}, data.editingModus?1:0)); + + if(data.editingModus){ + this.addButton(new GuiNpcButton(11, guiLeft + 170, guiTop + 34, "advanced.loadday")); + this.addButton(new GuiNpcButton(12, guiLeft + 170, guiTop + 56, "advanced.loadnight")); + } + } + + @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; + + if(button.id == 10){ + data.editingModus = button.getValue() == 1; + save(); + initGui(); + } + if(button.id == 11){ + Client.sendData(EnumPacketServer.TransformLoad, false); + } + if(button.id == 12){ + Client.sendData(EnumPacketServer.TransformLoad, true); + } + } + + + public void save() { + Client.sendData(EnumPacketServer.TransformSave, data.writeOptions(new NBTTagCompound())); + } + + @Override + public void setGuiData(NBTTagCompound compound) { + data.readOptions(compound); + initGui(); + } +} diff --git a/src/main/java/noppes/npcs/client/gui/advanced/GuiNPCSoundsMenu.java b/src/main/java/noppes/npcs/client/gui/advanced/GuiNPCSoundsMenu.java new file mode 100644 index 000000000..f52f0d72f --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/advanced/GuiNPCSoundsMenu.java @@ -0,0 +1,86 @@ +package noppes.npcs.client.gui.advanced; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.client.Client; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.gui.GuiNpcSoundSelection; +import noppes.npcs.client.gui.util.GuiNPCInterface2; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.ITextfieldListener; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.entity.EntityNPCInterface; + +public class GuiNPCSoundsMenu extends GuiNPCInterface2 implements ITextfieldListener +{ + private GuiNpcSoundSelection gui; + private GuiNpcTextField selectedField; + public GuiNPCSoundsMenu(EntityNPCInterface npc){ + super(npc); + } + + 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)); + 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)); + 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)); + 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)); + 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)); + 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)); + + } + public void buttonEvent(GuiButton button){ + + if(button.id == 6) + npc.advanced.disablePitch =((GuiNpcButton)button).getValue() == 0; + else{ + selectedField = getTextField(button.id); + NoppesUtil.openGUI(player, gui = new GuiNpcSoundSelection(npc, this, 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 elementClicked(){ + selectedField.setText(gui.getSelected()); + unFocused(selectedField); + } + + @Override + public void save() { + Client.sendData(EnumPacketServer.MainmenuAdvancedSave, npc.advanced.writeToNBT(new NBTTagCompound())); + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/global/GuiNPCManageBanks.java b/src/main/java/noppes/npcs/client/gui/global/GuiNPCManageBanks.java new file mode 100644 index 000000000..647177b4f --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/global/GuiNPCManageBanks.java @@ -0,0 +1,225 @@ +package noppes.npcs.client.gui.global; + +import java.util.HashMap; +import java.util.Vector; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.client.Client; +import noppes.npcs.client.CustomNpcResourceListener; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.gui.util.GuiContainerNPCInterface2; +import noppes.npcs.client.gui.util.GuiCustomScroll; +import noppes.npcs.client.gui.util.ICustomScrollListener; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.IGuiData; +import noppes.npcs.client.gui.util.IScrollData; +import noppes.npcs.client.gui.util.ITextfieldListener; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.containers.ContainerManageBanks; +import noppes.npcs.controllers.Bank; +import noppes.npcs.entity.EntityNPCInterface; + +public class GuiNPCManageBanks extends GuiContainerNPCInterface2 implements IScrollData,ICustomScrollListener,ITextfieldListener, IGuiData +{ + private GuiCustomScroll scroll; + private HashMap data = new HashMap(); + private ContainerManageBanks container; + private Bank bank = new Bank(); + private String selected = null; + + public GuiNPCManageBanks(EntityNPCInterface npc,ContainerManageBanks container) + { + super(npc,container); + this.container = container; + drawDefaultBackground = false; + Client.sendData(EnumPacketServer.BanksGet); + setBackground("npcbanksetup.png"); + ySize = 200; + } + + public void initGui() + { + super.initGui(); + + this.addButton(new GuiNpcButton(6,guiLeft + 340, guiTop + 10, 45, 20, "gui.add")); + this.addButton(new GuiNpcButton(7,guiLeft + 340, guiTop + 32, 45, 20, "gui.remove")); + if(scroll == null) + scroll = new GuiCustomScroll(this,0); + scroll.setSize(160, 180); + scroll.guiLeft = guiLeft + 174; + scroll.guiTop = guiTop + 8; + addScroll(scroll); + + for(int i = 0; i < 6; i++){ + int x = guiLeft + 6; + int y = (guiTop + 36) + (i * 22); + addButton(new GuiNpcButton(i, x + 50, y,80, 20, new String[]{"Can Upgrade","Can't Upgrade","Upgraded"},0)); + getButton(i).setEnabled(false); + } + + addTextField(new GuiNpcTextField(0,this, this.fontRendererObj, guiLeft+8, guiTop + 8, 160, 16, "")); + getTextField(0).setMaxStringLength(20); + + addTextField(new GuiNpcTextField(1,this, this.fontRendererObj, guiLeft+10, guiTop + 80, 16, 16, "")); + getTextField(1).numbersOnly = true; + getTextField(1).setMaxStringLength(1); + + addTextField(new GuiNpcTextField(2,this, this.fontRendererObj, guiLeft+10, guiTop + 110, 16, 16, "")); + getTextField(2).numbersOnly = true; + getTextField(2).setMaxStringLength(1); + } + + public void drawScreen(int x, int y, float f) + { + super.drawScreen(x, y, f); + } + @Override + protected void actionPerformed(GuiButton guibutton) + { + GuiNpcButton button = (GuiNpcButton) guibutton; + if(button.id == 6) + { + save(); + scroll.clear(); + String name = "New"; + while(data.containsKey(name)) + name += "_"; + Bank bank = new Bank(); + bank.name = name; + + NBTTagCompound compound = new NBTTagCompound(); + bank.writeEntityToNBT(compound); + Client.sendData(EnumPacketServer.BankSave, compound); + } + else if(button.id == 7) + { + if(data.containsKey(scroll.getSelected())) + Client.sendData(EnumPacketServer.BankRemove, data.get(selected)); + } + else if(button.id >= 0 && button.id < 6) + { + bank.slotTypes.put(button.id, button.getValue()); + } + } + + @Override + protected void drawGuiContainerForegroundLayer(int par1, int par2) + { + fontRendererObj.drawString("Tab Cost", 23, 28, CustomNpcResourceListener.DefaultTextColor); + fontRendererObj.drawString("Upg. Cost", 123, 28, CustomNpcResourceListener.DefaultTextColor); + fontRendererObj.drawString("Start", 6, 70, CustomNpcResourceListener.DefaultTextColor); + fontRendererObj.drawString("Max", 9, 100, CustomNpcResourceListener.DefaultTextColor); + } + + @Override + public void setGuiData(NBTTagCompound compound) { + Bank bank = new Bank(); + bank.readEntityFromNBT(compound); + this.bank = bank; + + if (bank.id == -1) { + getTextField(0).setText(""); + getTextField(1).setText(""); + getTextField(2).setText(""); + + for(int i = 0; i < 6; i++) + { + getButton(i).setDisplay(0); + getButton(i).setEnabled(false); + } + } else { + getTextField(0).setText(bank.name); + getTextField(1).setText(Integer.toString(bank.startSlots)); + getTextField(2).setText(Integer.toString(bank.maxSlots)); + + for(int i = 0; i < 6; i++) + { + int type = 0; + if(bank.slotTypes.containsKey(i)) + type = bank.slotTypes.get(i); + getButton(i).setDisplay(type); + getButton(i).setEnabled(true); + } + } + setSelected(bank.name); + } + + @Override + public void setData(Vector list, HashMap data) { + String name = scroll.getSelected(); + this.data = data; + scroll.setList(list); + + if(name != null) + scroll.setSelected(name); + } + + @Override + public void setSelected(String selected) { + this.selected = selected; + scroll.setSelected(selected); + } + + @Override + public void customScrollClicked(int i, int j, int k, GuiCustomScroll guiCustomScroll) { + if(guiCustomScroll.id == 0) + { + save(); + selected = scroll.getSelected(); + Client.sendData(EnumPacketServer.BankGet, data.get(selected)); + } + } + + @Override + public void save() { + if(selected != null && data.containsKey(selected) && bank != null){ + NBTTagCompound compound = new NBTTagCompound(); + bank.currencyInventory = container.bank.currencyInventory; + bank.upgradeInventory = container.bank.upgradeInventory; + bank.writeEntityToNBT(compound); + Client.sendData(EnumPacketServer.BankSave, compound); + } + } + + @Override + public void unFocused(GuiNpcTextField guiNpcTextField) { + if(bank.id != -1) { + if(guiNpcTextField.id == 0) { + String name = guiNpcTextField.getText(); + if(!name.isEmpty() && !data.containsKey(name)){ + String old = bank.name; + data.remove(bank.name); + bank.name = name; + data.put(bank.name, bank.id); + selected = name; + scroll.replace(old,bank.name); + } + } else if(guiNpcTextField.id == 1 || guiNpcTextField.id == 2) { + int num = 1; + + if(!guiNpcTextField.isEmpty()) + num = guiNpcTextField.getInteger(); + + if(num > 6) + num = 6; + + if(num < 0) + num = 0; + + if(guiNpcTextField.id == 1) { + bank.startSlots = num; + } else if(guiNpcTextField.id == 2) { + bank.maxSlots = num; + } + + if(bank.startSlots > bank.maxSlots) + bank.maxSlots = bank.startSlots; + + guiNpcTextField.setText(Integer.toString(num)); + } + } + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/global/GuiNPCManageDialogs.java b/src/main/java/noppes/npcs/client/gui/global/GuiNPCManageDialogs.java new file mode 100644 index 000000000..6594864e2 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/global/GuiNPCManageDialogs.java @@ -0,0 +1,307 @@ +package noppes.npcs.client.gui.global; + +import java.util.HashMap; +import java.util.Vector; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.client.Client; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.gui.GuiNpcSoundSelection; +import noppes.npcs.client.gui.SubGuiMailmanSendSetup; +import noppes.npcs.client.gui.SubGuiNpcAvailability; +import noppes.npcs.client.gui.SubGuiNpcCommand; +import noppes.npcs.client.gui.SubGuiNpcDialogExtra; +import noppes.npcs.client.gui.SubGuiNpcDialogOption; +import noppes.npcs.client.gui.SubGuiNpcDialogOptions; +import noppes.npcs.client.gui.SubGuiNpcFactionOptions; +import noppes.npcs.client.gui.SubGuiNpcTextArea; +import noppes.npcs.client.gui.util.GuiCustomScroll; +import noppes.npcs.client.gui.util.ICustomScrollListener; +import noppes.npcs.client.gui.util.GuiNPCInterface2; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.GuiSelectionListener; +import noppes.npcs.client.gui.util.IGuiData; +import noppes.npcs.client.gui.util.IScrollData; +import noppes.npcs.client.gui.util.ISubGuiListener; +import noppes.npcs.client.gui.util.ITextfieldListener; +import noppes.npcs.client.gui.util.SubGuiInterface; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.controllers.Dialog; +import noppes.npcs.controllers.DialogCategory; +import noppes.npcs.controllers.PlayerMail; +import noppes.npcs.entity.EntityNPCInterface; + +public class GuiNPCManageDialogs extends GuiNPCInterface2 implements IScrollData, ISubGuiListener, GuiSelectionListener,ICustomScrollListener,ITextfieldListener, IGuiData +{ + private GuiCustomScroll scroll; + private HashMap data = new HashMap(); + private Dialog dialog = new Dialog(); + private DialogCategory category = new DialogCategory(); + private boolean categorySelection = true; + + private GuiNpcSoundSelection gui; + + public GuiNPCManageDialogs(EntityNPCInterface npc) + { + super(npc); + Client.sendData(EnumPacketServer.DialogCategoriesGet); + } + + public void initGui() + { + super.initGui(); + this.addButton(new GuiNpcButton(0,guiLeft + 358, guiTop + 8, 58, 20,categorySelection?"dialog.dialogs":"gui.categories")); + + this.addButton(new GuiNpcButton(1,guiLeft + 358, guiTop + 38, 58, 20, "gui.add")); + this.addButton(new GuiNpcButton(2,guiLeft + 358, guiTop + 61, 58, 20, "gui.remove")); + + if(scroll == null){ + scroll = new GuiCustomScroll(this,0); + scroll.setSize(143, 208); + } + scroll.guiLeft = guiLeft + 214; + scroll.guiTop = guiTop + 4; + this.addScroll(scroll); + + if(categorySelection && category.id >= 0) + categoryGuiInit(); + if(!categorySelection && dialog.id >= 0) + dialogGuiInit(); + } + + private void dialogGuiInit() { + addLabel(new GuiNpcLabel(1,"gui.title", guiLeft + 4, guiTop + 8)); + addTextField(new GuiNpcTextField(1, this, this.fontRendererObj, guiLeft + 36, guiTop + 3, 140, 20, dialog.title)); + + addLabel(new GuiNpcLabel(0,"ID", guiLeft + 178, guiTop + 4)); + addLabel(new GuiNpcLabel(2, dialog.id + "", guiLeft + 178, guiTop + 14)); + + + addLabel(new GuiNpcLabel(3, "dialog.dialogtext", guiLeft + 4, guiTop + 30)); + addButton(new GuiNpcButton(3, guiLeft + 120, guiTop + 25, 50, 20, "selectServer.edit")); + + addLabel(new GuiNpcLabel(4, "availability.options", guiLeft + 4, guiTop + 51)); + addButton(new GuiNpcButton(4, guiLeft + 120, guiTop + 46, 50, 20, "selectServer.edit")); + + addLabel(new GuiNpcLabel(5, "faction.options", guiLeft + 4, guiTop + 72)); + addButton(new GuiNpcButton(5, guiLeft + 120, guiTop + 67, 50, 20, "selectServer.edit")); + + addLabel(new GuiNpcLabel(6, "dialog.options", guiLeft + 4, guiTop + 93)); + addButton(new GuiNpcButton(6, guiLeft + 120, guiTop + 89, 50, 20, "selectServer.edit")); + + addButton(new GuiNpcButton(7, guiLeft + 4, guiTop + 114, 144, 20, "availability.selectquest")); + addButton(new GuiNpcButton(8, guiLeft + 150, guiTop + 114, 20, 20, "X")); + + addLabel(new GuiNpcLabel(9, "gui.selectSound", guiLeft + 4, guiTop + 138)); + addTextField(new GuiNpcTextField(2, this, fontRendererObj, guiLeft + 4, guiTop + 148, 144, 20, dialog.sound)); + addButton(new GuiNpcButton(9, guiLeft + 150, guiTop + 148, 60, 20, "mco.template.button.select")); + + addButton(new GuiNpcButton(10, guiLeft + 4, guiTop + 172, 120, 20, "gui.showmore")); + } + + private void categoryGuiInit() { + addTextField(new GuiNpcTextField(0,this, this.fontRendererObj, guiLeft+8, guiTop + 8, 160, 16, category.title)); + } + + @Override + public void elementClicked() { + getTextField(2).setText(gui.getSelected()); + unFocused(getTextField(2)); + } + + public void buttonEvent(GuiButton guibutton) + { + int id = guibutton.id; + if(id == 0){ + save(); + if(categorySelection){ + if(category.id < 0) + return; + dialog = new Dialog(); + Client.sendData(EnumPacketServer.DialogsGet, category.id); + } + else if(!categorySelection){ + dialog = new Dialog(); + category = new DialogCategory(); + Client.sendData(EnumPacketServer.DialogCategoriesGet); + } + categorySelection = !categorySelection; + getButton(0).setEnabled(false); + scroll.clear(); + data.clear(); + } + if(id == 1){ + save(); + String name = "New"; + while(data.containsKey(name)) + name += "_"; + if(categorySelection){ + DialogCategory category = new DialogCategory(); + category.title = name; + Client.sendData(EnumPacketServer.DialogCategorySave, category.writeNBT(new NBTTagCompound())); + } + else{ + Dialog dialog = new Dialog(); + dialog.title = name; + Client.sendData(EnumPacketServer.DialogSave, category.id, dialog.writeToNBT(new NBTTagCompound())); + } + } + if(id == 2){ + if(data.containsKey(scroll.getSelected())) { + if(categorySelection){ + Client.sendData(EnumPacketServer.DialogCategoryRemove, category.id); + category = new DialogCategory(); + } + else{ + Client.sendData(EnumPacketServer.DialogRemove, dialog.id); + dialog = new Dialog(); + } + scroll.clear(); + } + } + 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){ + NoppesUtil.openGUI(player, new GuiNPCQuestSelection(npc, this, dialog.quest)); + } + if(id == 8 && dialog.id >= 0){ + dialog.quest = -1; + initGui(); + } + if(id == 9 && dialog.id >= 0){ + NoppesUtil.openGUI(player, gui = new GuiNpcSoundSelection(npc, this, getTextField(2).getText())); + } + if(id == 10){ + setSubGui(new SubGuiNpcDialogExtra(dialog, this)); + } + } + + @Override + public void unFocused(GuiNpcTextField guiNpcTextField) { + if(guiNpcTextField.id == 0) { + if(category.id < 0) + guiNpcTextField.setText(""); + else{ + String name = guiNpcTextField.getText(); + if(name.isEmpty() || data.containsKey(name)){ + guiNpcTextField.setText(category.title); + } + else if(categorySelection && category.id >= 0){ + String old = category.title; + data.remove(category.title); + category.title = name; + data.put(category.title, category.id); + scroll.replace(old,category.title); + } + } + } + if(guiNpcTextField.id == 1) { + if(dialog.id < 0) + guiNpcTextField.setText(""); + else{ + String name = guiNpcTextField.getText(); + if(name.isEmpty() || data.containsKey(name)){ + guiNpcTextField.setText(dialog.title); + } + else if(!categorySelection && dialog.id >= 0){ + String old = dialog.title; + data.remove(old); + dialog.title = name; + data.put(dialog.title, dialog.id); + scroll.replace(old,dialog.title); + } + } + } + if(guiNpcTextField.id == 2) { + dialog.sound = guiNpcTextField.getText(); + } + + } + + @Override + public void setGuiData(NBTTagCompound compound) { + if(categorySelection){ + category.readNBT(compound); + setSelected(category.title); + initGui(); + } + else{ + dialog.readNBT(compound); + setSelected(dialog.title); + initGui(); + if(compound.hasKey("DialogQuestName")) + getButton(7).setDisplayText(compound.getString("DialogQuestName")); + } + } + + @Override + public void subGuiClosed(SubGuiInterface subgui){ + if(subgui instanceof SubGuiNpcTextArea){ + SubGuiNpcTextArea gui = (SubGuiNpcTextArea) subgui; + dialog.text = gui.text; + } + } + + @Override + public void setData(Vector list, HashMap data) { + getButton(0).setEnabled(true); + String name = scroll.getSelected(); + this.data = data; + scroll.setList(list); + + if(name != null) + scroll.setSelected(name); + initGui(); + } + + @Override + public void setSelected(String selected) { + + } + + @Override + public void selected(int ob, String name) { + dialog.quest = ob; + Client.sendData(EnumPacketServer.DialogSave, category.id, dialog.writeToNBT(new NBTTagCompound())); + Client.sendData(EnumPacketServer.DialogGet, dialog.id); + } + @Override + public void customScrollClicked(int i, int j, int k, GuiCustomScroll guiCustomScroll) { + if(guiCustomScroll.id == 0) + { + save(); + String selected = scroll.getSelected(); + if(categorySelection){ + category = new DialogCategory(); + Client.sendData(EnumPacketServer.DialogCategoryGet, data.get(selected)); + } + else{ + dialog = new Dialog(); + Client.sendData(EnumPacketServer.DialogGet, data.get(selected)); + } + + } + } + + public void save() { + GuiNpcTextField.unfocus(); + if(!categorySelection && dialog.id >= 0) + Client.sendData(EnumPacketServer.DialogSave, category.id, dialog.writeToNBT(new NBTTagCompound())); + else if(categorySelection && category.id >= 0) + Client.sendData(EnumPacketServer.DialogCategorySave, category.writeNBT(new NBTTagCompound())); + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/global/GuiNPCManageFactions.java b/src/main/java/noppes/npcs/client/gui/global/GuiNPCManageFactions.java new file mode 100644 index 000000000..b1dac2e2f --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/global/GuiNPCManageFactions.java @@ -0,0 +1,231 @@ +package noppes.npcs.client.gui.global; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Vector; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.client.Client; +import noppes.npcs.client.gui.SubGuiColorSelector; +import noppes.npcs.client.gui.SubGuiNpcFactionPoints; +import noppes.npcs.client.gui.util.GuiCustomScroll; +import noppes.npcs.client.gui.util.ICustomScrollListener; +import noppes.npcs.client.gui.util.GuiNPCInterface2; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.IGuiData; +import noppes.npcs.client.gui.util.IScrollData; +import noppes.npcs.client.gui.util.ISubGuiListener; +import noppes.npcs.client.gui.util.ITextfieldListener; +import noppes.npcs.client.gui.util.SubGuiInterface; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.controllers.Faction; +import noppes.npcs.entity.EntityNPCInterface; + +public class GuiNPCManageFactions extends GuiNPCInterface2 implements IScrollData,ICustomScrollListener,ITextfieldListener, IGuiData, ISubGuiListener +{ + private GuiCustomScroll scrollFactions; + private HashMap data = new HashMap(); + private Faction faction = new Faction(); + private String selected = null; + + public GuiNPCManageFactions(EntityNPCInterface npc) + { + super(npc); + Client.sendData(EnumPacketServer.FactionsGet); + } + + public void initGui() + { + super.initGui(); + + this.addButton(new GuiNpcButton(0,guiLeft + 368, guiTop + 8, 45, 20, "gui.add")); + this.addButton(new GuiNpcButton(1,guiLeft + 368, guiTop + 32, 45, 20, "gui.remove")); + + if(scrollFactions == null){ + scrollFactions = new GuiCustomScroll(this,0); + scrollFactions.setSize(143, 208); + } + scrollFactions.guiLeft = guiLeft + 220; + scrollFactions.guiTop = guiTop + 4; + addScroll(scrollFactions); + + if (faction.id == -1) + return; + + this.addTextField(new GuiNpcTextField(0, this, guiLeft + 40, guiTop + 4, 136, 20, faction.name)); + getTextField(0).setMaxStringLength(20); + addLabel(new GuiNpcLabel(0,"gui.name", guiLeft + 8, guiTop + 9)); + + addLabel(new GuiNpcLabel(10,"ID", guiLeft + 178, guiTop + 4)); + addLabel(new GuiNpcLabel(11, faction.id + "", guiLeft + 178, guiTop + 14)); + + String color = Integer.toHexString(faction.color); + while(color.length() < 6) + color = "0" + color; + addButton(new GuiNpcButton(10, guiLeft + 40, guiTop + 26, 60, 20, color)); + addLabel(new GuiNpcLabel(1,"gui.color", guiLeft + 8, guiTop + 31)); + getButton(10).setTextColor(faction.color); + + addLabel(new GuiNpcLabel(2,"faction.points", guiLeft + 8, guiTop + 53)); + this.addButton(new GuiNpcButton(2,guiLeft + 100, guiTop + 48, 45, 20, "selectServer.edit")); + + addLabel(new GuiNpcLabel(3,"faction.hidden", guiLeft + 8, guiTop + 75)); + this.addButton(new GuiNpcButton(3,guiLeft + 100, guiTop + 70, 45, 20, new String[]{"gui.no","gui.yes"},faction.hideFaction?1:0)); + + + addLabel(new GuiNpcLabel(4,"faction.attacked", guiLeft + 8, guiTop + 97)); + this.addButton(new GuiNpcButton(4,guiLeft + 100, guiTop + 92, 45, 20, new String[]{"gui.no","gui.yes"},faction.getsAttacked?1:0)); + + addLabel(new GuiNpcLabel(6,"faction.hostiles", guiLeft + 8, guiTop + 145)); + + ArrayList hostileList = new ArrayList(scrollFactions.getList()); + hostileList.remove(faction.name); + + HashSet set = new HashSet(); + for(String s : data.keySet()){ + if(!s.equals(faction.name) && faction.attackFactions.contains(data.get(s))) + set.add(s); + } + + GuiCustomScroll scrollHostileFactions = new GuiCustomScroll(this,1,true); + scrollHostileFactions.setSize(163, 58); + scrollHostileFactions.guiLeft = guiLeft + 4; + scrollHostileFactions.guiTop = guiTop + 154; + scrollHostileFactions.setList(hostileList); + scrollHostileFactions.setSelectedList(set); + addScroll(scrollHostileFactions); + } + + @Override + protected void actionPerformed(GuiButton guibutton){ + GuiNpcButton button = (GuiNpcButton) guibutton; + if(button.id == 0){ + save(); + String name = "New"; + while(data.containsKey(name)) + name += "_"; + Faction faction = new Faction(-1, name, 0x00FF00, 1000); + + NBTTagCompound compound = new NBTTagCompound(); + faction.writeNBT(compound); + Client.sendData(EnumPacketServer.FactionSave, compound); + } + if(button.id == 1){ + if(data.containsKey(scrollFactions.getSelected())) { + Client.sendData(EnumPacketServer.FactionRemove, data.get(selected)); + scrollFactions.clear(); + faction = new Faction(); + initGui(); + } + } + if(button.id == 2){ + this.setSubGui(new SubGuiNpcFactionPoints(faction)); + } + if(button.id == 3){ + faction.hideFaction = button.getValue() == 1; + } + if(button.id == 4){ + faction.getsAttacked = button.getValue() == 1; + } + if(button.id == 10){ + this.setSubGui(new SubGuiColorSelector(faction.color)); + } + } + + @Override + public void setGuiData(NBTTagCompound compound) { + this.faction = new Faction(); + faction.readNBT(compound); + + setSelected(faction.name); + initGui(); + } + + + @Override + public void setData(Vector list, HashMap data) { + String name = scrollFactions.getSelected(); + this.data = data; + scrollFactions.setList(list); + + if(name != null) + scrollFactions.setSelected(name); + } + + @Override + public void setSelected(String selected) { + this.selected = selected; + scrollFactions.setSelected(selected); + } + + @Override + public void customScrollClicked(int i, int j, int k, GuiCustomScroll guiCustomScroll) { + if(guiCustomScroll.id == 0) + { + save(); + selected = scrollFactions.getSelected(); + Client.sendData(EnumPacketServer.FactionGet, data.get(selected)); + } + else if(guiCustomScroll.id == 1) + { + HashSet set = new HashSet(); + for(String s : guiCustomScroll.getSelectedList()){ + if(data.containsKey(s)) + set.add(data.get(s)); + } + faction.attackFactions = set; + save(); + } + } + + public void save() { + if(selected != null && data.containsKey(selected) && faction != null){ + NBTTagCompound compound = new NBTTagCompound(); + faction.writeNBT(compound); + + Client.sendData(EnumPacketServer.FactionSave, compound); + } + } + + @Override + public void unFocused(GuiNpcTextField guiNpcTextField) { + if(faction.id == -1) + return; + + if(guiNpcTextField.id == 0) { + String name = guiNpcTextField.getText(); + if(!name.isEmpty() && !data.containsKey(name)){ + String old = faction.name; + data.remove(faction.name); + faction.name = name; + data.put(faction.name, faction.id); + selected = name; + scrollFactions.replace(old,faction.name); + } + } else if(guiNpcTextField.id == 1) { + int color = 0; + try{ + color = Integer.parseInt(guiNpcTextField.getText(),16); + } + catch(NumberFormatException e){ + color = 0; + } + faction.color = color; + guiNpcTextField.setTextColor(faction.color); + } + + } + + @Override + public void subGuiClosed(SubGuiInterface subgui) { + if(subgui instanceof SubGuiColorSelector){ + faction.color = ((SubGuiColorSelector)subgui).color; + initGui(); + } + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/global/GuiNPCManageLinkedNpc.java b/src/main/java/noppes/npcs/client/gui/global/GuiNPCManageLinkedNpc.java new file mode 100644 index 000000000..447985566 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/global/GuiNPCManageLinkedNpc.java @@ -0,0 +1,101 @@ +package noppes.npcs.client.gui.global; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Vector; + +import org.apache.logging.log4j.status.StatusConsoleListener; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.StatCollector; +import noppes.npcs.client.Client; +import noppes.npcs.client.gui.SubGuiEditText; +import noppes.npcs.client.gui.SubGuiMailmanSendSetup; +import noppes.npcs.client.gui.SubGuiNpcCommand; +import noppes.npcs.client.gui.SubGuiNpcFactionOptions; +import noppes.npcs.client.gui.SubGuiNpcTextArea; +import noppes.npcs.client.gui.util.GuiCustomScroll; +import noppes.npcs.client.gui.util.GuiNPCInterface2; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.GuiSelectionListener; +import noppes.npcs.client.gui.util.ICustomScrollListener; +import noppes.npcs.client.gui.util.IGuiData; +import noppes.npcs.client.gui.util.IScrollData; +import noppes.npcs.client.gui.util.ISubGuiListener; +import noppes.npcs.client.gui.util.ITextfieldListener; +import noppes.npcs.client.gui.util.SubGuiInterface; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.controllers.Quest; +import noppes.npcs.controllers.QuestCategory; +import noppes.npcs.entity.EntityNPCInterface; + +public class GuiNPCManageLinkedNpc extends GuiNPCInterface2 implements IScrollData, ISubGuiListener{ + private GuiCustomScroll scroll; + private List data = new ArrayList(); + + public static GuiScreen Instance; + + public GuiNPCManageLinkedNpc(EntityNPCInterface npc){ + super(npc); + Instance = this; + Client.sendData(EnumPacketServer.LinkedGetAll); + } + + @Override + public void initGui(){ + super.initGui(); + + this.addButton(new GuiNpcButton(1,guiLeft + 358, guiTop + 38, 58, 20, "gui.add")); + this.addButton(new GuiNpcButton(2,guiLeft + 358, guiTop + 61, 58, 20, "gui.remove")); + + if(scroll == null){ + scroll = new GuiCustomScroll(this,0); + scroll.setSize(143, 208); + } + scroll.guiLeft = guiLeft + 214; + scroll.guiTop = guiTop + 4; + scroll.setList(data); + this.addScroll(scroll); + } + + @Override + public void buttonEvent(GuiButton button){ + if(button.id == 1){ + save(); + setSubGui(new SubGuiEditText("New")); + } + if(button.id == 2){ + if(scroll.hasSelected()) + Client.sendData(EnumPacketServer.LinkedRemove, scroll.getSelected()); + } + + } + + @Override + public void subGuiClosed(SubGuiInterface subgui) { + if(!((SubGuiEditText)subgui).cancelled){ + Client.sendData(EnumPacketServer.LinkedAdd, ((SubGuiEditText)subgui).text); + } + } + + @Override + public void setData(Vector list, HashMap data) { + this.data = new ArrayList(list); + initGui(); + } + + @Override + public void setSelected(String selected) { + + } + + @Override + public void save() { + + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/global/GuiNPCManageQuest.java b/src/main/java/noppes/npcs/client/gui/global/GuiNPCManageQuest.java new file mode 100644 index 000000000..07c1f94bc --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/global/GuiNPCManageQuest.java @@ -0,0 +1,356 @@ +package noppes.npcs.client.gui.global; + +import java.util.HashMap; +import java.util.Vector; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.client.Client; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.gui.SubGuiMailmanSendSetup; +import noppes.npcs.client.gui.SubGuiNpcCommand; +import noppes.npcs.client.gui.SubGuiNpcFactionOptions; +import noppes.npcs.client.gui.SubGuiNpcTextArea; +import noppes.npcs.client.gui.questtypes.GuiNpcQuestTypeDialog; +import noppes.npcs.client.gui.questtypes.GuiNpcQuestTypeKill; +import noppes.npcs.client.gui.questtypes.GuiNpcQuestTypeLocation; +import noppes.npcs.client.gui.util.GuiCustomScroll; +import noppes.npcs.client.gui.util.ICustomScrollListener; +import noppes.npcs.client.gui.util.GuiNPCInterface2; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.GuiSelectionListener; +import noppes.npcs.client.gui.util.IGuiData; +import noppes.npcs.client.gui.util.IScrollData; +import noppes.npcs.client.gui.util.ISubGuiListener; +import noppes.npcs.client.gui.util.ITextfieldListener; +import noppes.npcs.client.gui.util.SubGuiInterface; +import noppes.npcs.constants.EnumGuiType; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.constants.EnumQuestCompletion; +import noppes.npcs.constants.EnumQuestRepeat; +import noppes.npcs.constants.EnumQuestType; +import noppes.npcs.controllers.PlayerMail; +import noppes.npcs.controllers.Quest; +import noppes.npcs.controllers.QuestCategory; +import noppes.npcs.entity.EntityNPCInterface; + +public class GuiNPCManageQuest extends GuiNPCInterface2 implements IScrollData, ISubGuiListener, GuiSelectionListener,ICustomScrollListener,ITextfieldListener, IGuiData +{ + private GuiCustomScroll scroll; + private HashMap data = new HashMap(); + public static Quest quest = new Quest(); + private QuestCategory category = new QuestCategory(); + private boolean categorySelection = true; + private boolean questlogTA = false; + + public static GuiScreen Instance; + + public GuiNPCManageQuest(EntityNPCInterface npc) + { + super(npc); + Instance = this; + Client.sendData(EnumPacketServer.QuestCategoriesGet); + } + + public void initGui() + { + super.initGui(); + this.addButton(new GuiNpcButton(0,guiLeft + 358, guiTop + 8, 58, 20,categorySelection?"quest.quests":"gui.categories")); + + this.addButton(new GuiNpcButton(1,guiLeft + 358, guiTop + 38, 58, 20, "gui.add")); + this.addButton(new GuiNpcButton(2,guiLeft + 358, guiTop + 61, 58, 20, "gui.remove")); + + if(scroll == null){ + scroll = new GuiCustomScroll(this,0); + scroll.setSize(143, 208); + } + scroll.guiLeft = guiLeft + 214; + scroll.guiTop = guiTop + 4; + this.addScroll(scroll); + + if(categorySelection && category.id >= 0) + categoryGuiInit(); + if(!categorySelection && quest.id >= 0) + dialogGuiInit(); + + } + + private void dialogGuiInit() { + addLabel(new GuiNpcLabel(1,"gui.title", guiLeft + 4, guiTop + 8)); + addTextField(new GuiNpcTextField(1, this, this.fontRendererObj, guiLeft + 36 , guiTop + 3, 140, 20, quest.title)); + + addLabel(new GuiNpcLabel(0,"ID", guiLeft + 178, guiTop + 4)); + addLabel(new GuiNpcLabel(2, quest.id + "", guiLeft + 178, guiTop + 14)); + + addLabel(new GuiNpcLabel(3, "quest.completedtext", guiLeft + 4, guiTop + 30)); + addButton(new GuiNpcButton(3, guiLeft + 120, guiTop + 25, 50, 20, "selectServer.edit")); + + addLabel(new GuiNpcLabel(4, "quest.questlogtext", guiLeft + 4, guiTop + 51)); + addButton(new GuiNpcButton(4, guiLeft + 120, guiTop + 46, 50, 20, "selectServer.edit")); + + addLabel(new GuiNpcLabel(5, "quest.reward", guiLeft + 4, guiTop + 72)); + addButton(new GuiNpcButton(5, guiLeft + 120, guiTop + 67, 50, 20, "selectServer.edit")); + + addLabel(new GuiNpcLabel(6, "gui.type", guiLeft + 4, guiTop + 93)); + addButton(new GuiNpcButton(6, guiLeft + 90, guiTop + 88, 70, 20, new String[]{"quest.item","quest.dialog","quest.kill","quest.location","quest.areakill"},quest.type.ordinal())); + addButton(new GuiNpcButton(7, guiLeft + 162, guiTop + 88,50, 20, "selectServer.edit")); + + + addLabel(new GuiNpcLabel(8, "quest.repeatable", guiLeft + 4, guiTop + 114)); + this.addButton(new GuiNpcButton(8, guiLeft + 110, guiTop + 109,70, 20, new String[]{"gui.no","gui.yes","quest.mcdaily","quest.mcweekly","quest.rldaily","quest.rlweekly"}, quest.repeat.ordinal())); + + this.addButton(new GuiNpcButton(9, guiLeft + 4, guiTop + 131,90, 20, new String[]{"quest.npc","quest.instant"},quest.completion.ordinal())); + + if(quest.completerNpc.isEmpty()) + quest.completerNpc = npc.display.name; + + this.addTextField(new GuiNpcTextField(2,this, this.fontRendererObj, guiLeft + 96, guiTop + 131, 114, 20, quest.completerNpc)); + this.getTextField(2).enabled = quest.completion == EnumQuestCompletion.Npc; + + addLabel(new GuiNpcLabel(10, "menu.advanced", guiLeft + 4, guiTop + 158)); + addButton(new GuiNpcButton(10, guiLeft + 120, guiTop + 153, 50, 20, "selectServer.edit")); + + } + + private void categoryGuiInit() { + addTextField(new GuiNpcTextField(0,this, this.fontRendererObj, guiLeft+8, guiTop + 8, 160, 16, category.title)); + } + + public void buttonEvent(GuiButton guibutton) + { + GuiNpcButton button = (GuiNpcButton) guibutton; + if(button.id == 0) + { + save(); + if(categorySelection){ + if(category.id < 0) + return; + quest = new Quest(); + Client.sendData(EnumPacketServer.QuestsGet, category.id); + } + else if(!categorySelection){ + quest = new Quest(); + category = new QuestCategory(); + Client.sendData(EnumPacketServer.QuestCategoriesGet); + } + categorySelection = !categorySelection; + getButton(0).setEnabled(false); + scroll.clear(); + data.clear(); + } + if(button.id == 1) + { + save(); + String name = "New"; + while(data.containsKey(name)) + name += "_"; + if(categorySelection){ + QuestCategory category = new QuestCategory(); + category.title = name; + Client.sendData(EnumPacketServer.QuestCategorySave, category.writeNBT(new NBTTagCompound())); + } + else{ + Quest quest = new Quest(); + quest.title = name; + Client.sendData(EnumPacketServer.QuestSave, category.id, quest.writeToNBT(new NBTTagCompound())); + } + } + if(button.id == 2) + { + if(data.containsKey(scroll.getSelected())) { + if(categorySelection){ + Client.sendData(EnumPacketServer.QuestCategoryRemove, category.id); + category = new QuestCategory(); + } + else{ + Client.sendData(EnumPacketServer.QuestRemove, quest.id); + quest = new Quest(); + } + scroll.clear(); + } + } + 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){ + Client.sendData(EnumPacketServer.QuestOpenGui, 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) + Client.sendData(EnumPacketServer.QuestOpenGui, EnumGuiType.QuestItem, quest.writeToNBT(new NBTTagCompound())); + + 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.Location) + setSubGui(new GuiNpcQuestTypeLocation(npc, quest, this)); + + if(quest.type == EnumQuestType.AreaKill) + setSubGui(new GuiNpcQuestTypeKill(npc, quest, this)); + } + if(button.id == 8) + { + quest.repeat = EnumQuestRepeat.values()[button.getValue()]; + } + if(button.id == 9) + { + quest.completion = EnumQuestCompletion.values()[button.getValue()]; + this.getTextField(2).enabled = quest.completion == EnumQuestCompletion.Npc; + } + if(button.id == 10) + { + setSubGui(new SubGuiNpcQuestAdvanced(quest, this)); + } + + } + + @Override + public void unFocused(GuiNpcTextField guiNpcTextField) { + if(guiNpcTextField.id == 0) { + if(category.id < 0) + guiNpcTextField.setText(""); + else{ + String name = guiNpcTextField.getText(); + if(name.isEmpty() || data.containsKey(name)){ + guiNpcTextField.setText(category.title); + } + else if(categorySelection && category.id >= 0){ + String old = category.title; + data.remove(category.title); + category.title = name; + data.put(category.title, category.id); + scroll.replace(old,category.title); + } + } + } + if(guiNpcTextField.id == 1) { + if(quest.id < 0) + guiNpcTextField.setText(""); + else{ + String name = guiNpcTextField.getText(); + if(name.isEmpty() || data.containsKey(name)){ + guiNpcTextField.setText(quest.title); + } + else if(!categorySelection && quest.id >= 0){ + String old = quest.title; + data.remove(old); + quest.title = name; + data.put(quest.title, quest.id); + scroll.replace(old, quest.title); + } + } + } + if(guiNpcTextField.id == 2){ + quest.completerNpc = guiNpcTextField.getText(); + } + + } + + @Override + public void setGuiData(NBTTagCompound compound) { + if(categorySelection){ + category.readNBT(compound); + setSelected(category.title); + initGui(); + } + else{ + quest.readNBT(compound); + setSelected(quest.title); + initGui(); + } + } + + @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 SubGuiNpcFactionOptions || subgui instanceof SubGuiMailmanSendSetup){ + setSubGui(new SubGuiNpcQuestAdvanced(quest, this)); + } + else if(subgui instanceof SubGuiNpcCommand){ + SubGuiNpcCommand sub = (SubGuiNpcCommand) subgui; + quest.command = sub.command; + setSubGui(new SubGuiNpcQuestAdvanced(quest, this)); + } + else{ + initGui(); + } + } + + @Override + public void setData(Vector list, HashMap data) { + getButton(0).setEnabled(true); + String name = scroll.getSelected(); + this.data = data; + scroll.setList(list); + + if(name != null) + scroll.setSelected(name); + initGui(); + } + + @Override + public void selected(int id, String name) { + quest.nextQuestid = id; + quest.nextQuestTitle = name; + } + + @Override + public void customScrollClicked(int i, int j, int k, GuiCustomScroll guiCustomScroll) { + if(guiCustomScroll.id == 0) + { + save(); + String selected = scroll.getSelected(); + if(categorySelection){ + category = new QuestCategory(); + Client.sendData(EnumPacketServer.QuestCategoryGet, data.get(selected)); + } + else{ + quest = new Quest(); + Client.sendData(EnumPacketServer.QuestGet, data.get(selected)); + } + + } + } + + @Override + public void close(){ + super.close(); + quest = new Quest(); + } + + @Override + public void save() { + GuiNpcTextField.unfocus(); + if(!categorySelection && quest.id >= 0) + Client.sendData(EnumPacketServer.QuestSave, category.id, quest.writeToNBT(new NBTTagCompound())); + else if(categorySelection && category.id >= 0) + Client.sendData(EnumPacketServer.QuestCategorySave, category.writeNBT(new NBTTagCompound())); + } + + @Override + public void setSelected(String selected) { + + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/global/GuiNPCManageTransporters.java b/src/main/java/noppes/npcs/client/gui/global/GuiNPCManageTransporters.java new file mode 100644 index 000000000..5d613744a --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/global/GuiNPCManageTransporters.java @@ -0,0 +1,136 @@ +package noppes.npcs.client.gui.global; + +import java.util.HashMap; +import java.util.Vector; + +import net.minecraft.client.gui.GuiButton; +import noppes.npcs.client.Client; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.gui.GuiNPCTransportCategoryEdit; +import noppes.npcs.client.gui.mainmenu.GuiNPCGlobalMainMenu; +import noppes.npcs.client.gui.util.GuiNPCInterface; +import noppes.npcs.client.gui.util.GuiNPCStringSlot; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.IScrollData; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.entity.EntityNPCInterface; + + +public class GuiNPCManageTransporters extends GuiNPCInterface implements IScrollData +{ + private GuiNPCStringSlot slot; + private HashMap data; + private boolean selectCategory = true; + public GuiNPCManageTransporters(EntityNPCInterface npc) + { + super(npc); + Client.sendData(EnumPacketServer.TransportCategoriesGet); + drawDefaultBackground = false; + title = "Transport Categories"; + data = new HashMap(); + } + + public void initGui() + { + super.initGui(); + Vector list = new Vector(); + slot = new GuiNPCStringSlot(list,this,false,18); + slot.registerScrollButtons(4, 5); + + + this.addButton(new GuiNpcButton(0,width / 2 - 100, height - 52, 65, 20, "gui.add")); + this.addButton(new GuiNpcButton(1,width / 2 - 33 , height - 52, 65, 20, "selectServer.edit")); + getButton(0).setEnabled(selectCategory); + getButton(1).setEnabled(selectCategory); + this.addButton(new GuiNpcButton(3, width / 2 + 33, height - 52,65, 20, "gui.remove")); + this.addButton(new GuiNpcButton(2, width / 2 -100, height - 31,98, 20, "gui.open")); + getButton(2).setEnabled(selectCategory); + this.addButton(new GuiNpcButton(4, width / 2 + 2, height - 31,98, 20, "gui.back")); + } + + + 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 == 0) + { + if(selectCategory){ + NoppesUtil.openGUI(player, new GuiNPCTransportCategoryEdit(npc, this, "", -1)); + }else{ + + } + } + if(id == 1) + { + if(slot.selected == null || slot.selected.isEmpty()) + return; + if(selectCategory){ + NoppesUtil.openGUI(player, new GuiNPCTransportCategoryEdit(npc, this,slot.selected, data.get(slot.selected))); + }else{ + + } + } + if(id == 4) + { + if(selectCategory){ + close(); + NoppesUtil.openGUI(player, new GuiNPCGlobalMainMenu(npc)); + }else{ + title = "Transport Categories"; + selectCategory = true; + Client.sendData(EnumPacketServer.TransportCategoriesGet); + initGui(); + } + } + if(id == 3) + { + if(slot.selected == null || slot.selected.isEmpty()) + return; + save(); + if(selectCategory){ + Client.sendData(EnumPacketServer.TransportCategoryRemove,data.get(slot.selected)); + } + else{ + Client.sendData(EnumPacketServer.TransportRemove,data.get(slot.selected)); + } + initGui(); + } + if(id == 2) + { + doubleClicked(); + } + } + public void doubleClicked() { + if(slot.selected == null || slot.selected.isEmpty()) + return; + if(selectCategory){ + selectCategory = false; + title = "TransportLocations"; + Client.sendData(EnumPacketServer.TransportsGet,data.get(slot.selected)); + initGui(); + } + + } + public void save() { + } + + @Override + public void setData(Vector list, HashMap data) { + this.data = data; + slot.setList(list); + } + + @Override + public void setSelected(String selected) { + // TODO Auto-generated method stub + + } + + +} diff --git a/src/main/java/noppes/npcs/client/gui/global/GuiNPCQuestSelection.java b/src/main/java/noppes/npcs/client/gui/global/GuiNPCQuestSelection.java new file mode 100644 index 000000000..ca95d5ebf --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/global/GuiNPCQuestSelection.java @@ -0,0 +1,129 @@ +package noppes.npcs.client.gui.global; + +import java.util.HashMap; +import java.util.Vector; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import noppes.npcs.client.Client; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.gui.util.GuiNPCInterface; +import noppes.npcs.client.gui.util.GuiNPCStringSlot; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiSelectionListener; +import noppes.npcs.client.gui.util.IScrollData; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.entity.EntityNPCInterface; + +public class GuiNPCQuestSelection extends GuiNPCInterface implements IScrollData +{ + private GuiNPCStringSlot slot; + private GuiScreen parent; + private HashMap data; + private boolean selectCategory = true; + public GuiSelectionListener listener; + private int quest; + + public GuiNPCQuestSelection(EntityNPCInterface npc,GuiScreen parent,int quest) + { + super(npc); + drawDefaultBackground = false; + title = "Select Quest Category"; + this.parent = parent; + data = new HashMap(); + this.quest = quest; + + if(quest >= 0){ + Client.sendData(EnumPacketServer.QuestsGetFromQuest, quest); + selectCategory = false; + title = "Select Dialog"; + }else + Client.sendData(EnumPacketServer.QuestCategoriesGet, quest); + + if(parent instanceof GuiSelectionListener) + listener = (GuiSelectionListener) parent; + } + + public void initGui() + { + super.initGui(); + Vector list = new Vector(); + + 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, "mco.template.button.select")); + } + + + 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) + { + if(selectCategory){ + close(); + NoppesUtil.openGUI(player, parent); + }else{ + title = "Select Dialog Category"; + selectCategory = true; + Client.sendData(EnumPacketServer.QuestCategoriesGet, quest); + } + } + if(id == 4) + { + if(slot.selected == null || slot.selected.isEmpty()) + return; + doubleClicked(); + } + } + public String getSelected(){ + return slot.selected; + } + public void doubleClicked() { + if(slot.selected == null || slot.selected.isEmpty()) + return; + if(selectCategory){ + selectCategory = false; + title = "Select Quest"; + Client.sendData(EnumPacketServer.QuestsGet, data.get(slot.selected)); + } + else{ + quest = data.get(slot.selected); + close(); + NoppesUtil.openGUI(player, parent); + } + + } + public void save() { + if(quest >= 0){ + if(listener != null){ + listener.selected(quest, slot.selected); + } + } + } + + @Override + public void setData(Vector list, HashMap data) { + this.data = data; + this.slot.setList(list); + if(quest >= 0) + for(String name : data.keySet()) + if(data.get(name) == quest) + slot.selected = name; + } + + @Override + public void setSelected(String selected) { + + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/global/GuiNpcManagePlayerData.java b/src/main/java/noppes/npcs/client/gui/global/GuiNpcManagePlayerData.java new file mode 100644 index 000000000..018f32e6a --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/global/GuiNpcManagePlayerData.java @@ -0,0 +1,165 @@ +package noppes.npcs.client.gui.global; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Vector; + +import net.minecraft.client.gui.GuiButton; +import noppes.npcs.client.Client; +import noppes.npcs.client.gui.util.GuiCustomScroll; +import noppes.npcs.client.gui.util.ICustomScrollListener; +import noppes.npcs.client.gui.util.GuiNPCInterface2; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.IScrollData; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.constants.EnumPlayerData; +import noppes.npcs.entity.EntityNPCInterface; + +public class GuiNpcManagePlayerData extends GuiNPCInterface2 implements IScrollData,ICustomScrollListener +{ + private GuiCustomScroll scroll; + private String selectedPlayer = null; + private String selected = null; + private HashMap data = new HashMap(); + private EnumPlayerData selection = EnumPlayerData.Players; + private String search = ""; + + public GuiNpcManagePlayerData(EntityNPCInterface npc,GuiNPCInterface2 parent) + { + super(npc); + Client.sendData(EnumPacketServer.PlayerDataGet,selection); + } + + public void initGui() + { + super.initGui(); + scroll = new GuiCustomScroll(this,0); + scroll.setSize(190, 175); + scroll.guiLeft = guiLeft + 4; + scroll.guiTop = guiTop + 16; + addScroll(scroll); + + addLabel(new GuiNpcLabel(0,"All Players", guiLeft + 10, guiTop + 6)); + + this.addButton(new GuiNpcButton(0, guiLeft + 200, guiTop + 10,98, 20, "selectWorld.deleteButton")); + this.addButton(new GuiNpcButton(1, guiLeft + 200, guiTop + 32,98, 20, "Players")); + this.addButton(new GuiNpcButton(2, guiLeft + 200, guiTop + 54,98, 20, "Quest Data")); + this.addButton(new GuiNpcButton(3, guiLeft + 200, guiTop + 76,98, 20, "Dialog Data")); + this.addButton(new GuiNpcButton(4, guiLeft + 200, guiTop + 98,98, 20, "Transport Data")); + this.addButton(new GuiNpcButton(5, guiLeft + 200, guiTop + 120,98, 20, "Bank Data")); + this.addButton(new GuiNpcButton(6, guiLeft + 200, guiTop + 142,98, 20, "Faction Data")); + + addTextField(new GuiNpcTextField(0, this, fontRendererObj, guiLeft + 4, guiTop + 193, 190, 20, search)); + getTextField(0).enabled = selection == EnumPlayerData.Players; + + initButtons(); + } + + public void initButtons(){ + getButton(1).setEnabled(selection != EnumPlayerData.Players); + getButton(2).setEnabled(selection != EnumPlayerData.Quest); + getButton(3).setEnabled(selection != EnumPlayerData.Dialog); + getButton(4).setEnabled(selection != EnumPlayerData.Transport); + getButton(5).setEnabled(selection != EnumPlayerData.Bank); + getButton(6).setEnabled(selection != EnumPlayerData.Factions); + + if(selection == EnumPlayerData.Players) + getLabel(0).label = "All Players"; + else + getLabel(0).label = "Selected player: " + selectedPlayer; + } + public void drawScreen(int i, int j, float f) + { + super.drawScreen(i, j, f); + scroll.drawScreen(i, j, f); + } + + public void mouseClicked(int i, int j, int k) + { + super.mouseClicked(i, j, k); + if(k == 0 && scroll != null) + scroll.mouseClicked(i, j, k); + } + + public void keyTyped(char c, int i) + { + super.keyTyped(c, i); + + if(selection != EnumPlayerData.Players) + return; + + if(search.equals(getTextField(0).getText())) + return; + search = getTextField(0).getText().toLowerCase(); + scroll.setList(getSearchList()); + } + private List getSearchList(){ + if(search.isEmpty() || selection != EnumPlayerData.Players) + return new ArrayList(this.data.keySet()); + List list = new ArrayList(); + for(String name : data.keySet()){ + if(name.toLowerCase().contains(search)) + list.add(name); + } + return list; + } + + protected void actionPerformed(GuiButton guibutton) + { + int id = guibutton.id; + if(id == 0) + { + if(selected != null){ + if(selection == EnumPlayerData.Players) + Client.sendData(EnumPacketServer.PlayerDataRemove, selection,selectedPlayer,selected); + else + Client.sendData(EnumPacketServer.PlayerDataRemove, selection,selectedPlayer,data.get(selected)); + data.clear(); + } + selected = null; + } + if(id >= 1 && id <= 6) + { + if(selectedPlayer == null && id != 1) + return; + selection = EnumPlayerData.values()[id - 1]; + initButtons(); + scroll.clear(); + data.clear(); + Client.sendData(EnumPacketServer.PlayerDataGet, selection, selectedPlayer); + selected = null; + } + } + + @Override + public void save() { + } + + @Override + public void setData(Vector list, HashMap data) { + this.data.putAll(data); + + scroll.setList(getSearchList()); + + if(selection == EnumPlayerData.Players && selectedPlayer != null){ + scroll.setSelected(selectedPlayer); + selected = selectedPlayer; + } + } + + @Override + public void setSelected(String selected) { + } + + @Override + public void customScrollClicked(int i, int j, int k, GuiCustomScroll guiCustomScroll) { + selected = guiCustomScroll.getSelected(); + if(selection == EnumPlayerData.Players) + selectedPlayer = selected; + } + + +} diff --git a/src/main/java/noppes/npcs/client/gui/global/GuiNpcManageRecipes.java b/src/main/java/noppes/npcs/client/gui/global/GuiNpcManageRecipes.java new file mode 100644 index 000000000..dc598c01a --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/global/GuiNpcManageRecipes.java @@ -0,0 +1,185 @@ +package noppes.npcs.client.gui.global; + +import java.util.HashMap; +import java.util.Vector; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ResourceLocation; +import noppes.npcs.client.Client; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.gui.util.GuiContainerNPCInterface2; +import noppes.npcs.client.gui.util.GuiCustomScroll; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcButtonYesNo; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.ICustomScrollListener; +import noppes.npcs.client.gui.util.IGuiData; +import noppes.npcs.client.gui.util.IScrollData; +import noppes.npcs.client.gui.util.ITextfieldListener; +import noppes.npcs.constants.EnumGuiType; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.containers.ContainerManageRecipes; +import noppes.npcs.controllers.RecipeCarpentry; +import noppes.npcs.entity.EntityNPCInterface; + +import org.lwjgl.opengl.GL11; + +public class GuiNpcManageRecipes extends GuiContainerNPCInterface2 implements IScrollData, IGuiData, ICustomScrollListener,ITextfieldListener{ + private GuiCustomScroll scroll; + private HashMap data = new HashMap(); + private ContainerManageRecipes container; + private String selected = null; + private ResourceLocation slot; + + public GuiNpcManageRecipes(EntityNPCInterface npc,ContainerManageRecipes container){ + super(npc,container); + this.container = container; + drawDefaultBackground = false; + Client.sendData(EnumPacketServer.RecipesGet,container.width); + setBackground("inventorymenu.png"); + slot = getResource("slot.png"); + ySize = 200; + } + + @Override + public void initGui(){ + super.initGui(); + + if(scroll == null) + scroll = new GuiCustomScroll(this,0); + scroll.setSize(130, 180); + scroll.guiLeft = guiLeft + 172; + scroll.guiTop = guiTop + 8; + addScroll(scroll); + + this.addButton(new GuiNpcButton(0,guiLeft + 306, guiTop + 10, 84, 20, "menu.global")); + this.addButton(new GuiNpcButton(1,guiLeft + 306, guiTop + 32, 84, 20, "tile.npcCarpentyBench.name")); + this.getButton(0).setEnabled(container.width == 4); + this.getButton(1).setEnabled(container.width == 3); + + this.addButton(new GuiNpcButton(3,guiLeft + 306, guiTop + 60, 84, 20, "gui.add")); + this.addButton(new GuiNpcButton(4,guiLeft + 306, guiTop + 82, 84, 20, "gui.remove")); + + + this.addLabel(new GuiNpcLabel(0, "gui.ignoreDamage", guiLeft + 86, guiTop + 32)); + this.addButton(new GuiNpcButtonYesNo(5,guiLeft + 114, guiTop + 40, 50, 20, container.recipe.ignoreDamage)); + + this.addLabel(new GuiNpcLabel(1, "gui.ignoreNBT", guiLeft + 86, guiTop + 82)); + this.addButton(new GuiNpcButtonYesNo(6,guiLeft + 114, guiTop + 90, 50, 20, container.recipe.ignoreNBT)); + + this.addTextField(new GuiNpcTextField(0, this, fontRendererObj, guiLeft + 8, guiTop + 8, 160, 20, container.recipe.name)); + this.getTextField(0).enabled = false; + this.getButton(5).setEnabled(false); + this.getButton(6).setEnabled(false); + } + + @Override + protected void actionPerformed(GuiButton guibutton){ + GuiNpcButton button = (GuiNpcButton) guibutton; + if(button.id == 0){ + save(); + NoppesUtil.requestOpenGUI(EnumGuiType.ManageRecipes,3,0,0); + } + if(button.id == 1){ + save(); + NoppesUtil.requestOpenGUI(EnumGuiType.ManageRecipes,4,0,0); + } + if(button.id == 3){ + save(); + scroll.clear(); + String name = "New"; + while(data.containsKey(name)) + name += "_"; + RecipeCarpentry recipe = new RecipeCarpentry(name); + recipe.isGlobal = container.width == 3; + Client.sendData(EnumPacketServer.RecipeSave,recipe.writeNBT()); + } + if(button.id == 4){ + if(data.containsKey(scroll.getSelected())){ + Client.sendData(EnumPacketServer.RecipeRemove, data.get(scroll.getSelected())); + scroll.clear(); + } + } + if(button.id == 5){ + container.recipe.ignoreDamage = button.getValue() == 1; + } + if(button.id == 6){ + container.recipe.ignoreNBT = button.getValue() == 1; + } + } + @Override + public void setGuiData(NBTTagCompound compound) { + RecipeCarpentry recipe = RecipeCarpentry.read(compound); + getTextField(0).setText(recipe.name); + container.setRecipe(recipe); + this.getTextField(0).enabled = true; + this.getButton(5).setEnabled(true); + this.getButton(5).setDisplay(recipe.ignoreDamage?1:0); + this.getButton(6).setEnabled(true); + this.getButton(6).setDisplay(recipe.ignoreNBT?1:0); + setSelected(recipe.name); + } + + @Override + protected void drawGuiContainerBackgroundLayer(float f, int x, int y){ + super.drawGuiContainerBackgroundLayer(f, x, y); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + mc.renderEngine.bindTexture(slot); + + for(int i = 0; i < container.width;i++){ + for(int j = 0; j < container.width;j++){ + drawTexturedModalRect(guiLeft + i*18 + 7, guiTop + j*18 + 34, 0, 0, 18, 18); + } + } + drawTexturedModalRect(guiLeft + 86, guiTop + 60, 0, 0, 18, 18); + } + @Override + public void setData(Vector list, HashMap data) { + String name = scroll.getSelected(); + this.data = data; + scroll.setList(list); + + this.getTextField(0).enabled = name != null; + this.getButton(5).setEnabled(name != null); + + if(name != null) + scroll.setSelected(name); + } + + @Override + public void setSelected(String selected) { + this.selected = selected; + scroll.setSelected(selected); + } + + @Override + public void customScrollClicked(int i, int j, int k, GuiCustomScroll guiCustomScroll) { + save(); + selected = scroll.getSelected(); + Client.sendData(EnumPacketServer.RecipeGet, data.get(selected)); + } + + @Override + public void save() { + GuiNpcTextField.unfocus(); + if(selected != null && data.containsKey(selected)){ + container.saveRecipe(); + Client.sendData(EnumPacketServer.RecipeSave, container.recipe.writeNBT()); + } + } + + @Override + public void unFocused(GuiNpcTextField guiNpcTextField) { + String name = guiNpcTextField.getText(); + if(!name.isEmpty() && !data.containsKey(name)){ + String old = container.recipe.name; + data.remove(container.recipe.name); + container.recipe.name = name; + data.put(container.recipe.name, container.recipe.id); + selected = name; + scroll.replace(old,container.recipe.name); + } + } +} diff --git a/src/main/java/noppes/npcs/client/gui/global/GuiNpcNaturalSpawns.java b/src/main/java/noppes/npcs/client/gui/global/GuiNpcNaturalSpawns.java new file mode 100644 index 000000000..33f896870 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/global/GuiNpcNaturalSpawns.java @@ -0,0 +1,196 @@ +package noppes.npcs.client.gui.global; + +import java.util.HashMap; +import java.util.Vector; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.StatCollector; +import noppes.npcs.client.Client; +import noppes.npcs.client.gui.GuiNpcMobSpawnerSelector; +import noppes.npcs.client.gui.SubGuiNpcBiomes; +import noppes.npcs.client.gui.util.GuiCustomScroll; +import noppes.npcs.client.gui.util.GuiNPCInterface2; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcSlider; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.ICustomScrollListener; +import noppes.npcs.client.gui.util.IGuiData; +import noppes.npcs.client.gui.util.IScrollData; +import noppes.npcs.client.gui.util.ISliderListener; +import noppes.npcs.client.gui.util.ITextfieldListener; +import noppes.npcs.client.gui.util.SubGuiInterface; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.controllers.SpawnData; +import noppes.npcs.entity.EntityNPCInterface; + +public class GuiNpcNaturalSpawns extends GuiNPCInterface2 implements IGuiData, IScrollData, ITextfieldListener, ICustomScrollListener, ISliderListener{ + + private GuiCustomScroll scroll; + private HashMap data = new HashMap(); + + private SpawnData spawn = new SpawnData(); + + public GuiNpcNaturalSpawns(EntityNPCInterface npc) { + super(npc); + Client.sendData(EnumPacketServer.NaturalSpawnGetAll); + } + + @Override + public void initGui(){ + super.initGui(); + if(scroll == null){ + scroll = new GuiCustomScroll(this,0); + scroll.setSize(143, 208); + } + scroll.guiLeft = guiLeft + 214; + scroll.guiTop = guiTop + 4; + this.addScroll(scroll); + + this.addButton(new GuiNpcButton(1,guiLeft + 358, guiTop + 38, 58, 20, "gui.add")); + this.addButton(new GuiNpcButton(2,guiLeft + 358, guiTop + 61, 58, 20, "gui.remove")); + + if(spawn.id >= 0) + showSpawn(); + + } + + private void showSpawn() { + addLabel(new GuiNpcLabel(1,"gui.title", guiLeft + 4, guiTop + 8)); + addTextField(new GuiNpcTextField(1, this, this.fontRendererObj, guiLeft + 60, guiTop + 3, 140, 20, spawn.name)); + + addLabel(new GuiNpcLabel(3,"spawning.biomes", guiLeft + 4, guiTop + 30)); + addButton(new GuiNpcButton(3, guiLeft + 120, guiTop + 25, 50, 20, "selectServer.edit")); + + addSlider(new GuiNpcSlider(this, 4, guiLeft + 4, guiTop + 47, 180, 20, (float)spawn.itemWeight / 100)); + + int y = guiTop + 70; + this.addButton(new GuiNpcButton(25, guiLeft + 14, y,20,20, "X")); + addLabel(new GuiNpcLabel(5, "1:", guiLeft + 4, y + 5)); + this.addButton(new GuiNpcButton(5, guiLeft + 36, y, 170, 20, getTitle(spawn.compound1))); + } + private String getTitle(NBTTagCompound compound) { + if(compound != null && compound.hasKey("ClonedName")) + return compound.getString("ClonedName"); + + return "gui.selectnpc"; + } + + @Override + public void buttonEvent(GuiButton guibutton){ + int id = guibutton.id; + if(id == 1){ + save(); + String name = "New"; + while(data.containsKey(name)) + name += "_"; + + SpawnData spawn = new SpawnData(); + spawn.name = name; + Client.sendData(EnumPacketServer.NaturalSpawnSave, spawn.writeNBT(new NBTTagCompound())); + + } + if(id == 2){ + if(data.containsKey(scroll.getSelected())) { + Client.sendData(EnumPacketServer.NaturalSpawnRemove, spawn.id); + spawn = new SpawnData(); + scroll.clear(); + } + } + if(id == 3){ + setSubGui(new SubGuiNpcBiomes(spawn)); + } + if(id == 5){ + setSubGui(new GuiNpcMobSpawnerSelector()); + } + if(id == 25){ + spawn.compound1 = new NBTTagCompound(); + initGui(); + } + } + + + @Override + public void unFocused(GuiNpcTextField guiNpcTextField) { + String name = guiNpcTextField.getText(); + if(name.isEmpty() || data.containsKey(name)){ + guiNpcTextField.setText(spawn.name); + } + else{ + String old = spawn.name; + data.remove(old); + spawn.name = name; + data.put(spawn.name, spawn.id); + scroll.replace(old, spawn.name); + } + } + + @Override + public void setData(Vector list, HashMap data) { + String name = scroll.getSelected(); + this.data = data; + scroll.setList(list); + + if(name != null) + scroll.setSelected(name); + initGui(); + } + + @Override + public void customScrollClicked(int i, int j, int k, GuiCustomScroll guiCustomScroll) { + if(guiCustomScroll.id == 0){ + save(); + String selected = scroll.getSelected(); + spawn = new SpawnData(); + Client.sendData(EnumPacketServer.NaturalSpawnGet, data.get(selected)); + } + } + + @Override + public void save() { + GuiNpcTextField.unfocus(); + if(spawn.id >= 0) + Client.sendData(EnumPacketServer.NaturalSpawnSave, spawn.writeNBT(new NBTTagCompound())); + } + + @Override + public void setSelected(String selected) { + + } + + public void closeSubGui(SubGuiInterface gui) { + super.closeSubGui(gui); + if(gui instanceof GuiNpcMobSpawnerSelector){ + GuiNpcMobSpawnerSelector selector = (GuiNpcMobSpawnerSelector) gui; + NBTTagCompound compound = selector.getCompound(); + if(compound != null) + spawn.compound1 = compound; + initGui(); + } + } + + @Override + public void setGuiData(NBTTagCompound compound) { + spawn.readNBT(compound); + setSelected(spawn.name); + initGui(); + } + + @Override + public void mouseDragged(GuiNpcSlider guiNpcSlider) { + guiNpcSlider.displayString = StatCollector.translateToLocal("spawning.weightedChance") + ": " + (int) (guiNpcSlider.sliderValue * 100); + } + + @Override + public void mousePressed(GuiNpcSlider guiNpcSlider) { + // TODO Auto-generated method stub + + } + + @Override + public void mouseReleased(GuiNpcSlider guiNpcSlider) { + spawn.itemWeight = (int) (guiNpcSlider.sliderValue * 100); + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/global/GuiNpcQuestReward.java b/src/main/java/noppes/npcs/client/gui/global/GuiNpcQuestReward.java new file mode 100644 index 000000000..545efde11 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/global/GuiNpcQuestReward.java @@ -0,0 +1,70 @@ +package noppes.npcs.client.gui.global; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.util.ResourceLocation; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.gui.util.GuiContainerNPCInterface; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.ITextfieldListener; +import noppes.npcs.containers.ContainerNpcQuestReward; +import noppes.npcs.controllers.Quest; +import noppes.npcs.entity.EntityNPCInterface; + +import org.lwjgl.opengl.GL11; + +public class GuiNpcQuestReward extends GuiContainerNPCInterface implements ITextfieldListener +{ + private Quest quest; + private ResourceLocation resource; + public GuiNpcQuestReward(EntityNPCInterface npc,ContainerNpcQuestReward container){ + super(npc,container); + this.quest = GuiNPCManageQuest.quest; + resource = getResource("questreward.png"); + } + public void initGui(){ + super.initGui(); + addLabel(new GuiNpcLabel(0,"quest.randomitem", guiLeft + 4, guiTop + 4)); + addButton(new GuiNpcButton(0, guiLeft + 4, guiTop + 14, 60, 20, new String[]{"gui.no", "gui.yes"}, quest.randomReward?1:0)); + + addButton(new GuiNpcButton(5, guiLeft, guiTop+ ySize, 98, 20, "gui.back")); + + addLabel(new GuiNpcLabel(1, "quest.exp", guiLeft + 4, guiTop + 45)); + addTextField(new GuiNpcTextField(0, this, this.fontRendererObj, guiLeft + 4, guiTop + 55, 60, 20, quest.rewardExp + "")); + getTextField(0).numbersOnly = true; + getTextField(0).setMinMaxDefault(0, 99999, 0); + } + + public void actionPerformed(GuiButton guibutton){ + int id = guibutton.id; + if(id == 5){ + NoppesUtil.openGUI(player,GuiNPCManageQuest.Instance); + } + if(id == 0){ + quest.randomReward = ((GuiNpcButton)guibutton).getValue() == 1; + } + } + + public void onGuiClosed(){ + } + + protected void drawGuiContainerBackgroundLayer(float f, int i, int j){ + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + mc.renderEngine.bindTexture(resource); + int l = (width - xSize) / 2; + int i1 = (height - ySize) / 2; + drawTexturedModalRect(l, i1, 0, 0, xSize, ySize); + super.drawGuiContainerBackgroundLayer(f, i, j); + } + + @Override + public void save() { + + } + + @Override + public void unFocused(GuiNpcTextField textfield) { + quest.rewardExp = textfield.getInteger(); + } +} diff --git a/src/main/java/noppes/npcs/client/gui/global/SubGuiNpcQuestAdvanced.java b/src/main/java/noppes/npcs/client/gui/global/SubGuiNpcQuestAdvanced.java new file mode 100644 index 000000000..ed4b9616d --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/global/SubGuiNpcQuestAdvanced.java @@ -0,0 +1,89 @@ +package noppes.npcs.client.gui.global; + +import net.minecraft.client.gui.GuiButton; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.gui.SubGuiMailmanSendSetup; +import noppes.npcs.client.gui.SubGuiNpcCommand; +import noppes.npcs.client.gui.SubGuiNpcFactionOptions; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.ITextfieldListener; +import noppes.npcs.client.gui.util.SubGuiInterface; +import noppes.npcs.constants.EnumAnimation; +import noppes.npcs.constants.EnumMovingType; +import noppes.npcs.constants.EnumStandingType; +import noppes.npcs.controllers.PlayerMail; +import noppes.npcs.controllers.Quest; + +public class SubGuiNpcQuestAdvanced extends SubGuiInterface implements ITextfieldListener +{ + private Quest quest; + private GuiNPCManageQuest parent; + + public SubGuiNpcQuestAdvanced(Quest quest, GuiNPCManageQuest parent){ + this.quest = quest; + this.parent = parent; + setBackground("menubg.png"); + xSize = 256; + ySize = 216; + closeOnEsc = true; + } + + public void initGui(){ + super.initGui(); + addLabel(new GuiNpcLabel(10, "faction.options", guiLeft + 4, guiTop + 17)); + addButton(new GuiNpcButton(10, guiLeft + 120, guiTop + 12, 50, 20, "selectServer.edit")); + + addButton(new GuiNpcButton(13, guiLeft + 4, guiTop + 35, 164, 20, "mailbox.setup")); + addButton(new GuiNpcButton(14, guiLeft + 170, guiTop + 35, 20, 20, "X")); + if(!quest.mail.subject.isEmpty()) + getButton(13).setDisplayText(quest.mail.subject); + + addButton(new GuiNpcButton(11, guiLeft + 4, guiTop + 58, 164, 20, "quest.next")); + addButton(new GuiNpcButton(12, guiLeft + 170, guiTop + 58, 20, 20, "X")); + if(!quest.nextQuestTitle.isEmpty()) + getButton(11).setDisplayText(quest.nextQuestTitle); + + addLabel(new GuiNpcLabel(9, "advMode.command", guiLeft + 4, guiTop + 86)); + addButton(new GuiNpcButton(9, guiLeft + 120, guiTop + 81, 50, 20, "selectServer.edit")); + + addButton(new GuiNpcButton(66, guiLeft + 190, guiTop + 190, 60, 20, "gui.done")); + } + + protected void actionPerformed(GuiButton guibutton){ + GuiNpcButton button = (GuiNpcButton) guibutton; + if(button.id == 9){ + parent.setSubGui(new SubGuiNpcCommand(quest.command)); + } + if(button.id == 10) + { + parent.setSubGui(new SubGuiNpcFactionOptions(quest.factionOptions)); + } + + if(button.id == 11 && quest.id >= 0){ + NoppesUtil.openGUI(player, new GuiNPCQuestSelection(npc, getParent(), quest.nextQuestid)); + } + + if(button.id == 12 && quest.id >= 0){ + quest.nextQuestid = -1; + initGui(); + } + if(button.id == 13){ + parent.setSubGui(new SubGuiMailmanSendSetup(quest.mail, getParent())); + } + if(button.id == 14){ + quest.mail = new PlayerMail(); + initGui(); + } + if(button.id == 66){ + close(); + } + } + + @Override + public void unFocused(GuiNpcTextField textfield) { + + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/mainmenu/GuiNPCGlobalMainMenu.java b/src/main/java/noppes/npcs/client/gui/mainmenu/GuiNPCGlobalMainMenu.java new file mode 100644 index 000000000..aa246d9c2 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/mainmenu/GuiNPCGlobalMainMenu.java @@ -0,0 +1,72 @@ +package noppes.npcs.client.gui.mainmenu; + +import net.minecraft.client.gui.GuiButton; +import noppes.npcs.NoppesStringUtils; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.gui.advanced.GuiNPCLinesMenu; +import noppes.npcs.client.gui.global.GuiNPCManageLinkedNpc; +import noppes.npcs.client.gui.global.GuiNpcManagePlayerData; +import noppes.npcs.client.gui.global.GuiNpcNaturalSpawns; +import noppes.npcs.client.gui.util.GuiNPCInterface2; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.constants.EnumGuiType; +import noppes.npcs.entity.EntityNPCInterface; + +public class GuiNPCGlobalMainMenu extends GuiNPCInterface2{ + public GuiNPCGlobalMainMenu(EntityNPCInterface npc){ + super(npc,5); + } + + @Override + public void initGui(){ + super.initGui(); + int y = guiTop + 10; + this.addButton(new GuiNpcButton(2, guiLeft + 85, y, "global.banks")); + this.addButton(new GuiNpcButton(3, guiLeft + 85, y += 22, "menu.factions")); + this.addButton(new GuiNpcButton(4, guiLeft + 85, y += 22, "dialog.dialogs")); + this.addButton(new GuiNpcButton(11, guiLeft + 85, y += 22, "quest.quests")); + this.addButton(new GuiNpcButton(12, guiLeft + 85, y += 22, "global.transport")); + this.addButton(new GuiNpcButton(13, guiLeft + 85, y += 22, "global.playerdata")); + this.addButton(new GuiNpcButton(14, guiLeft + 85, y += 22, "global.recipes")); + this.addButton(new GuiNpcButton(15, guiLeft + 85, y += 22, NoppesStringUtils.translate("global.naturalspawn", "(WIP)"))); + this.addButton(new GuiNpcButton(16, guiLeft + 85, y += 22, "global.linked")); + + } + + @Override + protected void actionPerformed(GuiButton guibutton) { + int id = guibutton.id; + if (id == 11) { + NoppesUtil.requestOpenGUI(EnumGuiType.ManageQuests); + } + if (id == 2) { + NoppesUtil.requestOpenGUI(EnumGuiType.ManageBanks); + } + if (id == 3) { + NoppesUtil.requestOpenGUI(EnumGuiType.ManageFactions); + } + if (id == 4) { + NoppesUtil.requestOpenGUI(EnumGuiType.ManageDialogs); + } + if (id == 12) { + NoppesUtil.requestOpenGUI(EnumGuiType.ManageTransport); + } + if (id == 13) { + NoppesUtil.openGUI(player, new GuiNpcManagePlayerData(npc, this)); + } + if (id == 14) { + NoppesUtil.requestOpenGUI(EnumGuiType.ManageRecipes, 4, 0, 0); + } + if (id == 15) { + NoppesUtil.openGUI(player, new GuiNpcNaturalSpawns(npc)); + } + if (id == 16) { + NoppesUtil.requestOpenGUI(EnumGuiType.ManageLinked); + } + } + @Override + public void save() { + } + + +} diff --git a/src/main/java/noppes/npcs/client/gui/mainmenu/GuiNPCInv.java b/src/main/java/noppes/npcs/client/gui/mainmenu/GuiNPCInv.java new file mode 100644 index 000000000..f18b87dae --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/mainmenu/GuiNPCInv.java @@ -0,0 +1,167 @@ +package noppes.npcs.client.gui.mainmenu; + +import java.util.HashMap; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.inventory.Slot; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; +import noppes.npcs.client.Client; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.gui.util.GuiContainerNPCInterface2; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcSlider; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.IGuiData; +import noppes.npcs.client.gui.util.ISliderListener; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.containers.ContainerNPCInv; +import noppes.npcs.entity.EntityNPCInterface; + +import org.lwjgl.opengl.GL11; + +public class GuiNPCInv extends GuiContainerNPCInterface2 implements ISliderListener, IGuiData +{ + private HashMap chances = new HashMap(); + private ContainerNPCInv container; + private ResourceLocation slot; + public GuiNPCInv(EntityNPCInterface npc,ContainerNPCInv container) + { + super(npc,container,3); + this.setBackground("npcinv.png"); + this.container = container; + ySize = 200; + slot = getResource("slot.png"); + Client.sendData(EnumPacketServer.MainmenuInvGet); + } + + public void initGui() + { + super.initGui(); + addLabel(new GuiNpcLabel(0,"inv.minExp", guiLeft + 118, guiTop + 18)); + addTextField(new GuiNpcTextField(0,this, fontRendererObj, guiLeft + 108, guiTop + 29, 60, 20, npc.inventory.minExp + "")); + getTextField(0).numbersOnly = true; + getTextField(0).setMinMaxDefault(0, Short.MAX_VALUE, 0); + + addLabel(new GuiNpcLabel(1,"inv.maxExp", guiLeft + 118, guiTop + 52)); + addTextField(new GuiNpcTextField(1,this, fontRendererObj, guiLeft + 108, guiTop + 63, 60, 20, npc.inventory.maxExp + "")); + getTextField(1).numbersOnly = true; + getTextField(1).setMinMaxDefault(0, Short.MAX_VALUE, 0); + + addButton(new GuiNpcButton(10, guiLeft + 88, guiTop + 88, 80, 20, new String[]{"stats.normal", "inv.auto"}, npc.inventory.lootMode)); + + addLabel(new GuiNpcLabel(2,"inv.npcInventory", guiLeft + 191, guiTop + 5)); + addLabel(new GuiNpcLabel(3,"inv.inventory", guiLeft + 8, guiTop + 101)); + + for(int i = 0; i < 9; i++){ + int chance = 100; + if(npc.inventory.dropchance.containsKey(i)){ + chance = npc.inventory.dropchance.get(i); + } + if(chance <= 0 || chance > 100) + chance = 100; + chances.put(i, chance); + GuiNpcSlider slider = new GuiNpcSlider(this, i, guiLeft + 211, guiTop + 14 + i * 21, ((float)chance)/100); + addSlider(slider); + } + } + + @Override + protected void actionPerformed(GuiButton guibutton) { + if(guibutton.id == 10){ + npc.inventory.lootMode = ((GuiNpcButton)guibutton).getValue(); + } + } + + protected void drawGuiContainerBackgroundLayer(float f, int i, int j) + { + super.drawGuiContainerBackgroundLayer(f, i, j); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + mc.renderEngine.bindTexture(slot); + + for(int id = 4; id <= 6;id++){ + Slot slot = container.getSlot(id); + if(slot.getHasStack()) + drawTexturedModalRect(guiLeft + slot.xDisplayPosition - 1, guiTop + slot.yDisplayPosition -1, 0, 0, 18, 18); + } + } + public void drawScreen(int i, int j, float f) + { + int showname = npc.display.showName; + npc.display.showName = 1; + int l = guiLeft + 20; //(width/2)-180; + int i1 = (height/2) - 145; + GL11.glEnable(32826 /*GL_RESCALE_NORMAL_EXT*/); + GL11.glEnable(2903 /*GL_COLOR_MATERIAL*/); + GL11.glPushMatrix(); + GL11.glTranslatef(l + 33, i1 + 131, 50F); + float f1 = (50F * 3) / npc.display.modelSize; + GL11.glScalef(-f1, f1, f1); + GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); + float f2 = npc.renderYawOffset; + 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; + 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; + npc.rotationYawHead = npc.rotationYaw; + //npc.updateCloak(); + 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); + npc.renderYawOffset = f2; + npc.rotationYaw = f3; + npc.rotationPitch = f4; + npc.rotationYawHead = f7; + GL11.glPopMatrix(); + RenderHelper.disableStandardItemLighting(); + GL11.glDisable(32826 /*GL_RESCALE_NORMAL_EXT*/); + + OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); + GL11.glDisable(GL11.GL_TEXTURE_2D); + OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); + npc.display.showName = showname; + + super.drawScreen(i, j, f); + } + + @Override + public void save() { + npc.inventory.dropchance = chances; + npc.inventory.minExp = getTextField(0).getInteger(); + npc.inventory.maxExp = getTextField(1).getInteger(); + Client.sendData(EnumPacketServer.MainmenuInvSave, npc.inventory.writeEntityToNBT(new NBTTagCompound())); + } + + @Override + public void setGuiData(NBTTagCompound compound) { + npc.inventory.readEntityFromNBT(compound); + initGui(); + } + + @Override + public void mouseDragged(GuiNpcSlider guiNpcSlider) { + guiNpcSlider.displayString = StatCollector.translateToLocal("inv.dropChance") + ": " + (int) (guiNpcSlider.sliderValue * 100) + "%"; + } + + @Override + public void mousePressed(GuiNpcSlider guiNpcSlider) { + } + + @Override + public void mouseReleased(GuiNpcSlider guiNpcSlider) { + chances.put(guiNpcSlider.id, (int) (guiNpcSlider.sliderValue * 100)); + } +} diff --git a/src/main/java/noppes/npcs/client/gui/mainmenu/GuiNpcAI.java b/src/main/java/noppes/npcs/client/gui/mainmenu/GuiNpcAI.java new file mode 100644 index 000000000..10e367774 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/mainmenu/GuiNpcAI.java @@ -0,0 +1,163 @@ +package noppes.npcs.client.gui.mainmenu; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.DataAI; +import noppes.npcs.client.Client; +import noppes.npcs.client.gui.SubGuiNpcMovement; +import noppes.npcs.client.gui.util.GuiNPCInterface2; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.IGuiData; +import noppes.npcs.client.gui.util.ITextfieldListener; +import noppes.npcs.constants.EnumNavType; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.entity.EntityNPCInterface; + +public class GuiNpcAI extends GuiNPCInterface2 implements ITextfieldListener, IGuiData{ + private DataAI ai; + public GuiNpcAI(EntityNPCInterface npc) { + super(npc,6); + ai = npc.ai; + Client.sendData(EnumPacketServer.MainmenuAIGet); + } + + public void initGui() + { + super.initGui(); + addLabel(new GuiNpcLabel(0,"ai.enemyresponse", guiLeft + 5, guiTop + 17)); + addButton(new GuiNpcButton(0,guiLeft + 86, guiTop + 10, 60, 20, new String[]{"gui.retaliate","gui.panic","gui.retreat","gui.nothing"} ,npc.ai.onAttack)); + addLabel(new GuiNpcLabel(1,"ai.door", guiLeft + 5, guiTop + 40)); + addButton(new GuiNpcButton(1,guiLeft + 86, guiTop + 35, 60, 20, new String[]{"gui.break","gui.open","gui.disabled"} ,npc.ai.doorInteract)); + addLabel(new GuiNpcLabel(12,"ai.swim", guiLeft + 5, guiTop + 65)); + addButton(new GuiNpcButton(7,guiLeft + 86, guiTop + 60, 60, 20, new String[]{"gui.no", "gui.yes"} ,npc.ai.canSwim ? 1:0)); + addLabel(new GuiNpcLabel(13,"ai.shelter", guiLeft + 5, guiTop + 90)); + addButton(new GuiNpcButton(9,guiLeft + 86, guiTop + 85, 60, 20, new String[]{"gui.darkness","gui.sunlight","gui.disabled"} ,npc.ai.findShelter)); + addLabel(new GuiNpcLabel(14,"ai.clearlos", guiLeft + 5, guiTop + 115)); + addButton(new GuiNpcButton(10,guiLeft + 86, guiTop + 110, 60, 20, new String[]{"gui.no", "gui.yes"} ,npc.ai.directLOS ? 1:0)); + addLabel(new GuiNpcLabel(18,"ai.sprint", guiLeft + 5, guiTop + 140)); + addButton(new GuiNpcButton(16,guiLeft + 86, guiTop + 135, 60, 20, new String[]{"gui.no", "gui.yes"} ,npc.ai.canSprint ? 1:0)); + + addLabel(new GuiNpcLabel(10,"ai.avoidwater", guiLeft + 150, guiTop + 17)); + addButton(new GuiNpcButton(5, guiLeft + 230, guiTop + 10, 60, 20, new String[]{"gui.no","gui.yes"} ,npc.ai.avoidsWater ? 1:0)); + addLabel(new GuiNpcLabel(11,"ai.return", guiLeft + 150, guiTop + 40)); + addButton(new GuiNpcButton(6, guiLeft + 230, guiTop + 35, 60, 20, new String[]{"gui.no","gui.yes"} ,npc.ai.returnToStart ? 1:0)); + addLabel(new GuiNpcLabel(17,"ai.leapattarget", guiLeft + 150, guiTop + 65)); + addButton(new GuiNpcButton(15,guiLeft + 230, guiTop + 60, 60, 20, new String[]{"gui.no", "gui.yes"} ,npc.ai.canLeap ? 1:0)); + addLabel(new GuiNpcLabel(15, "ai.indirect", guiLeft + 150, guiTop + 90)); + addButton(new GuiNpcButton(13, guiLeft + 230, guiTop + 85, 60, 20, new String[]{"gui.no", "gui.whendistant", "gui.whenhidden"}, ai.canFireIndirect)); + addLabel(new GuiNpcLabel(16, "ai.rangemelee", guiLeft + 150, guiTop + 115)); + addButton(new GuiNpcButton(14, guiLeft + 230, guiTop + 110, 60, 20, new String[]{npc.inventory.getProjectile() == null?"gui.no":"gui.always", "gui.untilclose","gui.whenavailable"} ,ai.useRangeMelee)); + if (ai.useRangeMelee >= 1){ + addLabel(new GuiNpcLabel(20,"gui.minrange", guiLeft + 300, guiTop + 115)); + addTextField(new GuiNpcTextField(6,this, fontRendererObj, guiLeft + 380, guiTop + 110, 30, 20, ai.distanceToMelee + "")); + getTextField(6).numbersOnly = true; + getTextField(6).setMinMaxDefault(1, npc.stats.aggroRange, 5); + } + addLabel(new GuiNpcLabel(19,"ai.tacticalvariant", guiLeft + 150, guiTop + 140)); + addButton(new GuiNpcButton(17 ,guiLeft + 230, guiTop + 135, 60, 20, EnumNavType.names(), ai.tacticalVariant.ordinal())); + if (ai.tacticalVariant != EnumNavType.Default && ai.tacticalVariant != EnumNavType.None) + { + String label = ""; + switch(ai.tacticalVariant) + { + case Surround : label = "gui.orbitdistance" ; break; + case HitNRun : label = "gui.fightifthisclose" ; break; + case Ambush : label = "gui.ambushdistance"; break; + case Stalk : label = "gui.ambushdistance"; break; + default : label = "gui.engagedistance"; + } + addLabel(new GuiNpcLabel(21, label, guiLeft + 300, guiTop + 140)); + addTextField(new GuiNpcTextField(3,this, fontRendererObj, guiLeft + 380, guiTop + 135, 30, 20, ai.tacticalRadius + "")); + getTextField(3).numbersOnly = true; + getTextField(3).setMinMaxDefault(1, npc.stats.aggroRange, 5); + } + + addLabel(new GuiNpcLabel(22,"ai.cobwebAffected", guiLeft + 150, guiTop + 165)); + addButton(new GuiNpcButton(22 ,guiLeft + 230, guiTop + 160, 60, 20, new String[]{"gui.no", "gui.yes"}, npc.ai.ignoreCobweb ? 0:1)); + + getButton(17).setEnabled(this.ai.onAttack == 0); + getButton(15).setEnabled(this.ai.onAttack == 0); + getButton(13).setEnabled(this.npc.inventory.getProjectile() != null); + getButton(14).setEnabled(this.npc.inventory.getProjectile() != null); + getButton(10).setEnabled(ai.tacticalVariant != EnumNavType.Stalk || ai.tacticalVariant != EnumNavType.None); + + addLabel(new GuiNpcLabel(2,"ai.movement", guiLeft + 4, guiTop + 165)); + addButton(new GuiNpcButton(2, guiLeft + 86, guiTop + 160, 60, 20, "selectServer.edit")); + } + + @Override + public void unFocused(GuiNpcTextField textfield){ + if(textfield.id == 3){ + ai.tacticalRadius = textfield.getInteger(); + } + if(textfield.id == 6){ + ai.distanceToMelee = textfield.getInteger(); + } + } + + @Override + protected void actionPerformed(GuiButton guibutton) + { + GuiNpcButton button = (GuiNpcButton) guibutton; + if(button.id == 0){ + ai.onAttack = button.getValue(); + initGui(); + } + else if(button.id == 1){ + ai.doorInteract = button.getValue(); + } + else if(button.id == 2){ + setSubGui(new SubGuiNpcMovement(ai)); + } + else if (button.id == 5) { + npc.setAvoidWater(button.getValue() == 1); + } + else if (button.id == 6) { + ai.returnToStart = (button.getValue() == 1); + } + else if (button.id == 7) { + ai.canSwim = (button.getValue() == 1); + } + else if(button.id == 9){ + ai.findShelter = button.getValue(); + } + else if (button.id == 10) { + ai.directLOS = (button.getValue() == 1); + } + else if (button.id == 13) { + ai.canFireIndirect = button.getValue(); + } + else if (button.id == 14) { + ai.useRangeMelee = button.getValue(); + initGui(); + } + else if (button.id == 15) { + ai.canLeap = (button.getValue() == 1); + } + else if (button.id == 16) { + ai.canSprint = (button.getValue() == 1); + } + else if (button.id == 17) { + ai.tacticalVariant = EnumNavType.values()[button.getValue()]; + ai.directLOS = EnumNavType.values()[button.getValue()] == EnumNavType.Stalk ? false : this.ai.directLOS; + initGui(); + } + else if (button.id == 22) { + ai.ignoreCobweb = (button.getValue() == 0); + } + } + + @Override + public void save() { + Client.sendData(EnumPacketServer.MainmenuAISave, ai.writeToNBT(new NBTTagCompound())); + } + + @Override + public void setGuiData(NBTTagCompound compound) { + ai.readToNBT(compound); + initGui(); + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/mainmenu/GuiNpcAdvanced.java b/src/main/java/noppes/npcs/client/gui/mainmenu/GuiNpcAdvanced.java new file mode 100644 index 000000000..2b7b91093 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/mainmenu/GuiNpcAdvanced.java @@ -0,0 +1,164 @@ +package noppes.npcs.client.gui.mainmenu; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.NoppesStringUtils; +import noppes.npcs.client.Client; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.gui.advanced.GuiNPCAdvancedLinkedNpc; +import noppes.npcs.client.gui.advanced.GuiNPCDialogNpcOptions; +import noppes.npcs.client.gui.advanced.GuiNPCFactionSetup; +import noppes.npcs.client.gui.advanced.GuiNPCLinesMenu; +import noppes.npcs.client.gui.advanced.GuiNPCNightSetup; +import noppes.npcs.client.gui.advanced.GuiNPCSoundsMenu; +import noppes.npcs.client.gui.roles.GuiNpcBard; +import noppes.npcs.client.gui.roles.GuiNpcCompanion; +import noppes.npcs.client.gui.roles.GuiNpcConversation; +import noppes.npcs.client.gui.roles.GuiNpcFollowerJob; +import noppes.npcs.client.gui.roles.GuiNpcGuard; +import noppes.npcs.client.gui.roles.GuiNpcHealer; +import noppes.npcs.client.gui.roles.GuiNpcPuppet; +import noppes.npcs.client.gui.roles.GuiNpcSpawner; +import noppes.npcs.client.gui.roles.GuiNpcTransporter; +import noppes.npcs.client.gui.util.GuiNPCInterface2; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.IGuiData; +import noppes.npcs.constants.EnumGuiType; +import noppes.npcs.constants.EnumJobType; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.constants.EnumRoleType; +import noppes.npcs.entity.EntityCustomNpc; +import noppes.npcs.entity.EntityNPCInterface; + +public class GuiNpcAdvanced extends GuiNPCInterface2 implements IGuiData +{ + private boolean hasChanges = false; + public GuiNpcAdvanced(EntityNPCInterface npc) + { + super(npc, 4); + Client.sendData(EnumPacketServer.MainmenuAdvancedGet); + } + @Override + public void initGui(){ + super.initGui(); + this.addButton(new GuiNpcButton(3, guiLeft + 85 + 160, guiTop + 20, 52, 20, "selectServer.edit")); + this.addButton(new GuiNpcButton(8, guiLeft + 85, guiTop + 20,155,20, new String[]{"role.none","role.trader","role.follower","role.bank","role.transporter", "role.mailman", NoppesStringUtils.translate("role.companion", "(WIP)")},npc.advanced.role.ordinal())); + getButton(3).setEnabled(npc.advanced.role != EnumRoleType.None && npc.advanced.role != EnumRoleType.Postman); + + this.addButton(new GuiNpcButton(4, guiLeft + 85 + 160, guiTop + 43, 52, 20, "selectServer.edit")); + this.addButton(new GuiNpcButton(5, guiLeft + 85, guiTop + 43,155,20, new String[]{"job.none","job.bard","job.healer","job.guard","job.itemgiver","role.follower", "job.spawner", "job.conversation", "job.chunkloader", "job.puppet"},npc.advanced.job.ordinal())); + + getButton(4).setEnabled(npc.advanced.job != EnumJobType.None && npc.advanced.job != EnumJobType.ChunkLoader); + + this.addButton(new GuiNpcButton(7, guiLeft + 85, guiTop + 66, 214, 20, "advanced.lines")); + this.addButton(new GuiNpcButton(9, guiLeft + 85, guiTop + 89, 214, 20, "menu.factions")); + this.addButton(new GuiNpcButton(10, guiLeft + 85, guiTop + 112, 214, 20, "dialog.dialogs")); + this.addButton(new GuiNpcButton(11, guiLeft + 85, guiTop + 135, 214, 20, "advanced.sounds")); + this.addButton(new GuiNpcButton(12, guiLeft + 85, guiTop + 158, 214, 20, "advanced.night")); + this.addButton(new GuiNpcButton(13, guiLeft + 85, guiTop + 181, 214, 20, "global.linked")); + + } + + @Override + protected void actionPerformed(GuiButton guibutton) { + GuiNpcButton button = (GuiNpcButton) guibutton; + if (button.id == 3) { + save(); + Client.sendData(EnumPacketServer.RoleGet); + } + if(button.id == 8){ + hasChanges = true; + npc.advanced.setRole(button.getValue()); + + getButton(3).setEnabled(npc.advanced.role != EnumRoleType.None && npc.advanced.role != EnumRoleType.Postman); + } + if(button.id == 4){ + save(); + Client.sendData(EnumPacketServer.JobGet); + } + if(button.id == 5){ + hasChanges = true; + npc.advanced.setJob(button.getValue()); + + getButton(4).setEnabled(npc.advanced.job != EnumJobType.None && npc.advanced.job != EnumJobType.ChunkLoader); + } + if(button.id == 9){ + save(); + NoppesUtil.openGUI(player, new GuiNPCFactionSetup(npc)); + } + if(button.id == 10){ + save(); + NoppesUtil.openGUI(player, new GuiNPCDialogNpcOptions(npc,this)); + } + if(button.id == 11){ + save(); + NoppesUtil.openGUI(player, new GuiNPCSoundsMenu(npc)); + } + if (button.id == 7) { + save(); + NoppesUtil.openGUI(player, new GuiNPCLinesMenu(npc)); + } + if(button.id == 12){ + save(); + NoppesUtil.openGUI(player, new GuiNPCNightSetup(npc)); + } + if(button.id == 13){ + save(); + NoppesUtil.openGUI(player, new GuiNPCAdvancedLinkedNpc(npc)); + } + } + + @Override + public void setGuiData(NBTTagCompound compound) { + if(compound.hasKey("RoleData")){ + if(npc.roleInterface != null) + npc.roleInterface.readFromNBT(compound); + + if(npc.advanced.role == EnumRoleType.Trader) + NoppesUtil.requestOpenGUI(EnumGuiType.SetupTrader); + else if(npc.advanced.role == EnumRoleType.Follower) + NoppesUtil.requestOpenGUI(EnumGuiType.SetupFollower); + else if(npc.advanced.role == EnumRoleType.Bank) + NoppesUtil.requestOpenGUI(EnumGuiType.SetupBank); + else if(npc.advanced.role == EnumRoleType.Transporter) + displayGuiScreen(new GuiNpcTransporter(npc)); + else if(npc.advanced.role == EnumRoleType.Companion) + displayGuiScreen(new GuiNpcCompanion(npc)); + } + else if(compound.hasKey("JobData")){ + if(npc.jobInterface != null) + npc.jobInterface.readFromNBT(compound); + + if(npc.advanced.job == EnumJobType.Bard) + NoppesUtil.openGUI(player, new GuiNpcBard(npc)); + else if(npc.advanced.job == EnumJobType.Healer) + NoppesUtil.openGUI(player, new GuiNpcHealer(npc)); + else if(npc.advanced.job == EnumJobType.Guard) + NoppesUtil.openGUI(player, new GuiNpcGuard(npc)); + else if(npc.advanced.job == EnumJobType.ItemGiver) + NoppesUtil.requestOpenGUI(EnumGuiType.SetupItemGiver); + else if(npc.advanced.job == EnumJobType.Follower) + NoppesUtil.openGUI(player, new GuiNpcFollowerJob(npc)); + else if(npc.advanced.job == EnumJobType.Spawner) + NoppesUtil.openGUI(player, new GuiNpcSpawner(npc)); + else if(npc.advanced.job == EnumJobType.Conversation) + NoppesUtil.openGUI(player, new GuiNpcConversation(npc)); + else if(npc.advanced.job == EnumJobType.Puppet) + NoppesUtil.openGUI(player, new GuiNpcPuppet(this,(EntityCustomNpc) npc)); + } + else{ + npc.advanced.readToNBT(compound); + initGui(); + } + } + + @Override + public void save() { + if(hasChanges){ + Client.sendData(EnumPacketServer.MainmenuAdvancedSave, npc.advanced.writeToNBT(new NBTTagCompound())); + hasChanges = false; + } + } + + +} diff --git a/src/main/java/noppes/npcs/client/gui/mainmenu/GuiNpcDisplay.java b/src/main/java/noppes/npcs/client/gui/mainmenu/GuiNpcDisplay.java new file mode 100644 index 000000000..ccf93aaee --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/mainmenu/GuiNpcDisplay.java @@ -0,0 +1,177 @@ +package noppes.npcs.client.gui.mainmenu; + +import com.mojang.authlib.GameProfile; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.DataDisplay; +import noppes.npcs.client.Client; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.gui.GuiNPCTextures; +import noppes.npcs.client.gui.GuiNpcTextureCloaks; +import noppes.npcs.client.gui.GuiNpcTextureOverlays; +import noppes.npcs.client.gui.model.GuiCreationScreen; +import noppes.npcs.client.gui.util.GuiHoverText; +import noppes.npcs.client.gui.util.GuiNPCInterface2; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.IGuiData; +import noppes.npcs.client.gui.util.ITextfieldListener; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.entity.EntityCustomNpc; +import noppes.npcs.entity.EntityNPCInterface; + +public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListener, IGuiData{ + + private DataDisplay display; + + public GuiNpcDisplay(EntityNPCInterface npc) { + super(npc,1); + display = npc.display; + Client.sendData(EnumPacketServer.MainmenuDisplayGet); + } + + public void initGui(){ + super.initGui(); + int y = guiTop + 4; + addLabel(new GuiNpcLabel(0,"gui.name", guiLeft + 5, y + 5)); + addTextField(new GuiNpcTextField(0,this, fontRendererObj, guiLeft + 50, y, 200, 20, display.name)); + this.addButton(new GuiNpcButton(0, guiLeft + 253, y , 110, 20, new String[]{"display.show","display.hide","display.showAttacking"} ,display.showName)); + + y+=23; + addLabel(new GuiNpcLabel(11,"gui.title", guiLeft + 5, y + 5)); + addTextField(new GuiNpcTextField(11,this, fontRendererObj, guiLeft + 50, y, 200, 20, display.title)); + + y+=23; + addLabel(new GuiNpcLabel(1,"display.model", guiLeft + 5, y + 5)); + this.addButton(new GuiNpcButton(1, guiLeft + 50, y,110,20, "selectServer.edit")); + addLabel(new GuiNpcLabel(2,"display.size", guiLeft + 175, y + 5)); + addTextField(new GuiNpcTextField(2,this, fontRendererObj, guiLeft + 203, y, 40, 20, display.modelSize + "")); + getTextField(2).numbersOnly = true; + getTextField(2).setMinMaxDefault(1, 30, 5); + addLabel(new GuiNpcLabel(3,"(1-30)", guiLeft + 246 , y + 5)); + + y+=23; + addLabel(new GuiNpcLabel(4,"display.texture", guiLeft + 5, y + 5)); + addTextField(new GuiNpcTextField(3,this, fontRendererObj, guiLeft + 80, y, 200, 20, display.skinType == 0?display.texture:display.url)); + this.addButton(new GuiNpcButton(3, guiLeft + 325, y, 38, 20, "mco.template.button.select")); + this.addButton(new GuiNpcButton(2, guiLeft + 283, y, 40, 20, new String[]{"display.texture","display.player", "display.url"},display.skinType)); + getButton(3).setEnabled(display.skinType == 0); + if(display.skinType == 1 && display.playerProfile != null) + getTextField(3).setText(display.playerProfile.getName()); + + y+=23; + addLabel(new GuiNpcLabel(8,"display.cape", guiLeft + 5, y + 5)); + addTextField(new GuiNpcTextField(8,this, fontRendererObj, guiLeft + 80, y, 200, 20, display.cloakTexture)); + this.addButton(new GuiNpcButton(8, guiLeft + 283, y, 80, 20, "display.selectTexture")); + + y+=23; + addLabel(new GuiNpcLabel(9,"display.overlay", guiLeft + 5, y + 5)); + addTextField(new GuiNpcTextField(9,this, fontRendererObj, guiLeft + 80, y, 200, 20, display.glowTexture)); + this.addButton(new GuiNpcButton(9, guiLeft + 283, y, 80, 20, "display.selectTexture")); + + y+=23; + addLabel(new GuiNpcLabel(5,"display.livingAnimation", guiLeft + 5, y + 5)); + this.addButton(new GuiNpcButton(5, guiLeft + 120, y, 50, 20, new String[]{"gui.yes","gui.no"},display.disableLivingAnimation?1:0)); + + y+=23; + addLabel(new GuiNpcLabel(7,"display.visible", guiLeft + 5, y + 5)); + this.addButton(new GuiNpcButton(7, guiLeft + 120, y, 50, 20, new String[]{"gui.yes","gui.no","gui.partly"}, display.visible)); + + y+=23; + addLabel(new GuiNpcLabel(10,"display.bossbar", guiLeft + 5, y + 5)); + this.addButton(new GuiNpcButton(10, guiLeft + 120, y, 110, 20, new String[]{"display.hide","display.show","display.showAttacking"}, display.showBossBar)); + + //addExtra(new GuiHoverText(0, "testing", guiLeft, guiTop)); + } + + @Override + public void unFocused(GuiNpcTextField textfield){ + if(textfield.id == 0){ + if(!textfield.isEmpty()) + display.name = textfield.getText(); + else + textfield.setText(display.name); + } + else if(textfield.id == 2){ + display.modelSize = textfield.getInteger(); + } + else if(textfield.id == 3){ + if(display.skinType == 2) + display.url = textfield.getText(); + else if(display.skinType == 1){ + if(!textfield.isEmpty()){ + display.playerProfile = new GameProfile(null, textfield.getText()); + } + else + display.playerProfile = null; + } + else + display.texture = textfield.getText(); + } + else if(textfield.id == 8){ + npc.textureCloakLocation = null; + display.cloakTexture = textfield.getText(); + } + else if(textfield.id == 9){ + npc.textureGlowLocation = null; + display.glowTexture = textfield.getText(); + } + else if(textfield.id == 11){ + display.title = textfield.getText(); + } + } + protected void actionPerformed(GuiButton guibutton){ + GuiNpcButton button = (GuiNpcButton) guibutton; + if(button.id == 0){ + display.showName = button.getValue(); + } + if(button.id == 1){ + NoppesUtil.openGUI(player, new GuiCreationScreen(this, (EntityCustomNpc) npc)); + //NoppesUtil.openGUI(player, new GuiNpcModelSelection(npc,this)); + } + if(button.id == 2){ + display.skinType = (byte) button.getValue(); + display.url = ""; + display.playerProfile = null; + initGui(); + } + else if(button.id == 3){ + NoppesUtil.openGUI(player, new GuiNPCTextures(npc, this)); + } + else if(button.id == 5){ + display.disableLivingAnimation = button.getValue() == 1; + } + else if(button.id == 7){ + display.visible = button.getValue(); + } + else if(button.id == 8){ + NoppesUtil.openGUI(player, new GuiNpcTextureCloaks(npc, this)); + } + else if(button.id == 9){ + NoppesUtil.openGUI(player, new GuiNpcTextureOverlays(npc, this)); + } + else if(button.id == 10){ + display.showBossBar = (byte)button.getValue(); + } + } + + @Override + public void save() { + if(display.skinType == 1) + display.loadProfile(); + npc.textureLocation = null; + mc.renderGlobal.onEntityDestroy(npc); + mc.renderGlobal.onEntityCreate(npc); + Client.sendData(EnumPacketServer.MainmenuDisplaySave, display.writeToNBT(new NBTTagCompound())); + + } + + @Override + public void setGuiData(NBTTagCompound compound) { + display.readToNBT(compound); + initGui(); + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/mainmenu/GuiNpcStats.java b/src/main/java/noppes/npcs/client/gui/mainmenu/GuiNpcStats.java new file mode 100644 index 000000000..dd4cb0f3e --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/mainmenu/GuiNpcStats.java @@ -0,0 +1,148 @@ +package noppes.npcs.client.gui.mainmenu; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.entity.EnumCreatureAttribute; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.DataStats; +import noppes.npcs.client.Client; +import noppes.npcs.client.gui.SubGuiNpcMeleeProperties; +import noppes.npcs.client.gui.SubGuiNpcProjectiles; +import noppes.npcs.client.gui.SubGuiNpcRangeProperties; +import noppes.npcs.client.gui.SubGuiNpcResistanceProperties; +import noppes.npcs.client.gui.SubGuiNpcRespawn; +import noppes.npcs.client.gui.util.GuiNPCInterface2; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcButtonYesNo; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.IGuiData; +import noppes.npcs.client.gui.util.ITextfieldListener; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.entity.EntityNPCInterface; + +public class GuiNpcStats extends GuiNPCInterface2 implements ITextfieldListener, IGuiData{ + private DataStats stats; + public GuiNpcStats(EntityNPCInterface npc) { + super(npc,2); + stats = npc.stats; + Client.sendData(EnumPacketServer.MainmenuStatsGet); + } + + @Override + public void initGui(){ + super.initGui(); + int y = guiTop + 10; + addLabel(new GuiNpcLabel(0,"stats.health", guiLeft + 5, y + 5)); + addTextField(new GuiNpcTextField(0,this, guiLeft + 85, y, 50, 18, stats.maxHealth+"")); + getTextField(0).numbersOnly = true; + getTextField(0).setMinMaxDefault(1, Integer.MAX_VALUE, 20); + addLabel(new GuiNpcLabel(1,"stats.aggro", guiLeft + 140, y + 5)); + addTextField(new GuiNpcTextField(1, this, fontRendererObj, guiLeft + 220, y, 50, 18, stats.aggroRange+"")); + getTextField(1).numbersOnly = true; + getTextField(1).setMinMaxDefault(1, 64, 2); + addLabel(new GuiNpcLabel(34,"stats.creaturetype", guiLeft + 275, y + 5)); + addButton(new GuiNpcButton(8,guiLeft + 355, y, 56, 20, new String[]{"stats.normal","stats.undead","stats.arthropod"} ,stats.creatureType.ordinal())); + + addButton(new GuiNpcButton(0,guiLeft + 82, y+=22, 56, 20, "selectServer.edit")); + addLabel(new GuiNpcLabel(2,"stats.respawn", guiLeft + 5, y + 5)); + + + this.addButton(new GuiNpcButton(2, guiLeft + 82, y+=22, 56, 20, "selectServer.edit")); + addLabel(new GuiNpcLabel(5,"stats.meleeproperties", guiLeft + 5, y + 5)); + this.addButton(new GuiNpcButton(3, guiLeft + 82, y+=22, 56, 20, "selectServer.edit")); + addLabel(new GuiNpcLabel(6,"stats.rangedproperties", guiLeft + 5, y + 5)); + this.addButton(new GuiNpcButton(9, guiLeft + 217, y, 56, 20, "selectServer.edit")); + addLabel(new GuiNpcLabel(7,"stats.projectileproperties", guiLeft + 140, y + 5)); + + this.addButton(new GuiNpcButton(15, guiLeft + 82, y+=34, 56, 20, "selectServer.edit")); + addLabel(new GuiNpcLabel(15,"potion.resistance", guiLeft + 5, y + 5)); + + + addButton(new GuiNpcButton(4,guiLeft + 82, y+=34, 56, 20, new String[]{"gui.no","gui.yes"} ,npc.isImmuneToFire()? 1:0)); + addLabel(new GuiNpcLabel(10,"stats.fireimmune", guiLeft + 5, y + 5)); + addButton(new GuiNpcButton(5,guiLeft + 217, y, 56, 20, new String[]{"gui.no","gui.yes"} ,stats.canDrown? 1:0)); + addLabel(new GuiNpcLabel(11,"stats.candrown", guiLeft + 140, y + 5)); + addTextField(new GuiNpcTextField(14, this, guiLeft + 355, y, 56, 20, stats.healthRegen + "").setNumbersOnly()); + addLabel(new GuiNpcLabel(14,"stats.regenhealth", guiLeft + 275, y + 5)); + + addTextField(new GuiNpcTextField(16, this, guiLeft + 355, y+=22, 56, 20, stats.combatRegen + "").setNumbersOnly()); + addLabel(new GuiNpcLabel(16,"stats.combatregen", guiLeft + 275, y + 5)); + addButton(new GuiNpcButton(6,guiLeft + 82, y, 56, 20, new String[]{"gui.no","gui.yes"} ,stats.burnInSun? 1:0)); + addLabel(new GuiNpcLabel(12,"stats.burninsun", guiLeft + 5, y + 5)); + addButton(new GuiNpcButton(7,guiLeft + 217, y, 56, 20, new String[]{"gui.no","gui.yes"} ,stats.noFallDamage? 1:0)); + addLabel(new GuiNpcLabel(13,"stats.nofalldamage", guiLeft + 140, y + 5)); + + addButton(new GuiNpcButtonYesNo(17, guiLeft + 82, y+=22, 56, 20, stats.potionImmune)); + addLabel(new GuiNpcLabel(17,"stats.potionImmune", guiLeft + 5, y + 5)); + addButton(new GuiNpcButtonYesNo(18, guiLeft + 217, y, 56, 20, stats.attackInvisible)); + addLabel(new GuiNpcLabel(18,"stats.attackInvisible", guiLeft + 140, y + 5)); + } + + @Override + public void unFocused(GuiNpcTextField textfield){ + if(textfield.id == 0){ + stats.maxHealth = textfield.getInteger(); + npc.heal(stats.maxHealth); + } + else if(textfield.id == 1){ + stats.aggroRange = textfield.getInteger(); + } + else if(textfield.id == 14){ + stats.healthRegen = textfield.getInteger(); + } + else if(textfield.id == 16){ + stats.combatRegen = textfield.getInteger(); + } + } + + @Override + protected void actionPerformed(GuiButton guibutton){ + GuiNpcButton button = (GuiNpcButton) guibutton; + if (button.id == 0){ + setSubGui(new SubGuiNpcRespawn(this.stats)); + } + else if (button.id == 2){ + setSubGui(new SubGuiNpcMeleeProperties(this.stats)); + } + else if (button.id == 3){ + setSubGui(new SubGuiNpcRangeProperties(this.stats)); + } + else if(button.id == 4){ + npc.setImmuneToFire(button.getValue() == 1); + } + else if(button.id == 5){ + stats.canDrown = button.getValue() == 1; + } + else if(button.id == 6){ + stats.burnInSun = button.getValue() == 1; + } + else if(button.id == 7){ + stats.noFallDamage = button.getValue() == 1; + } + else if (button.id == 8) { + stats.creatureType = EnumCreatureAttribute.values()[button.getValue()]; + } + else if (button.id == 9) { + setSubGui(new SubGuiNpcProjectiles(this.stats)); + } + else if (button.id == 15) { + setSubGui(new SubGuiNpcResistanceProperties(this.stats.resistances)); + } + else if (button.id == 17) { + stats.potionImmune = ((GuiNpcButtonYesNo)guibutton).getBoolean(); + } + else if (button.id == 18) { + stats.potionImmune = ((GuiNpcButtonYesNo)guibutton).getBoolean(); + } + } + @Override + public void save() { + Client.sendData(EnumPacketServer.MainmenuStatsSave, stats.writeToNBT(new NBTTagCompound())); + } + + @Override + public void setGuiData(NBTTagCompound compound) { + stats.readToNBT(compound); + initGui(); + } +} diff --git a/src/main/java/noppes/npcs/client/gui/model/GuiCreationScreen.java b/src/main/java/noppes/npcs/client/gui/model/GuiCreationScreen.java new file mode 100644 index 000000000..32bce96c3 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/model/GuiCreationScreen.java @@ -0,0 +1,340 @@ +package noppes.npcs.client.gui.model; + +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.renderer.entity.NPCRendererHelper; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.client.renderer.entity.RendererLivingEntity; +import net.minecraft.entity.EntityList; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTTagByte; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import noppes.npcs.client.Client; +import noppes.npcs.client.gui.util.GuiCustomScroll; +import noppes.npcs.client.gui.util.GuiModelInterface; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.ICustomScrollListener; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.controllers.PixelmonHelper; +import noppes.npcs.entity.EntityCustomNpc; +import noppes.npcs.entity.EntityFakeLiving; +import noppes.npcs.entity.EntityNPCInterface; + +public class GuiCreationScreen extends GuiModelInterface implements ICustomScrollListener{ + + public HashMap> data = new HashMap>(); + private List list; + private final String[] ignoredTags = {"CanBreakDoors", "Bred", "PlayerCreated", "Tame", "HasReproduced"}; + + private GuiNpcButton prev,next; + + private GuiScreen parent; + + private HashMap mapped = new HashMap(); + + public GuiCreationScreen(GuiScreen parent, EntityCustomNpc npc){ + super(npc); + this.parent = parent; + Map mapping = EntityList.stringToClassMapping; + for(Object name : mapping.keySet()){ + Class c = (Class) mapping.get(name); + try { + if(!EntityCustomNpc.class.isAssignableFrom(c) && EntityLiving.class.isAssignableFrom(c) && c.getConstructor(new Class[] {World.class}) != null && !Modifier.isAbstract(c.getModifiers())){ + if(RenderManager.instance.getEntityClassRenderObject(c) instanceof RendererLivingEntity) + data.put(name.toString(),c.asSubclass(EntityLivingBase.class)); + } + } catch (SecurityException e) { + e.printStackTrace(); + } catch (NoSuchMethodException e) { + } + } + list = new ArrayList(data.keySet()); + Collections.sort(list,String.CASE_INSENSITIVE_ORDER); + } + + @Override + public void initGui() { + EntityLivingBase entity = (EntityLivingBase) playerdata.getEntity(npc); + xOffset = entity == null?0:50; + super.initGui(); + + String title = "CustomNPC"; + if(entity != null) + title = (String) EntityList.classToStringMapping.get(playerdata.getEntityClass()); + this.addButton(new GuiNpcButton(1, guiLeft + 140, guiTop, 100, 20, title)); + + this.addButton(prev = new GuiNpcButton(0, guiLeft + 118, guiTop, 20, 20, "<")); + this.addButton(next = new GuiNpcButton(2, guiLeft + 242, guiTop, 20, 20, ">")); + prev.enabled = getCurrentEntityIndex() >= 0; + next.enabled = getCurrentEntityIndex() < list.size() - 1; + + if(entity == null){ + showPlayerButtons(); + } + else if(PixelmonHelper.isPixelmon(entity)){ + showPixelmonMenu(entity); + } + else{ + showEntityButtons(entity); + } + } + + private void showPlayerButtons() { + int y = guiTop ; + + addButton(new GuiNpcButton(8, guiLeft + 4, y += 22, 96, 20, "model.scale")); + + addButton(new GuiNpcButton(4, guiLeft + 50, y += 22, 50, 20, "selectServer.edit")); + addLabel(new GuiNpcLabel(1, "Head", guiLeft, y + 5, 0xFFFFFF)); + + addButton(new GuiNpcButton(5, guiLeft + 50, y += 22, 50, 20, "selectServer.edit")); + addLabel(new GuiNpcLabel(2, "Body", guiLeft, y + 5, 0xFFFFFF)); + + addButton(new GuiNpcButton(6, guiLeft + 50, y += 22, 50, 20, "selectServer.edit")); + addLabel(new GuiNpcLabel(3, "Arms", guiLeft, y + 5, 0xFFFFFF)); + + addButton(new GuiNpcButton(7, guiLeft + 50, y += 22, 50, 20, "selectServer.edit")); + addLabel(new GuiNpcLabel(4, "Legs", guiLeft, y + 5, 0xFFFFFF)); + + addButton(new GuiNpcButton(44, guiLeft + 310, guiTop + 14, 80, 20, "Save Model")); + addButton(new GuiNpcButton(45, guiLeft + 310, guiTop + 36, 80, 20, "Load Model")); + + + } + + private void showPixelmonMenu(EntityLivingBase entity) { + GuiCustomScroll scroll = new GuiCustomScroll(this, 0); + scroll.setSize(120, 200); + scroll.guiLeft = guiLeft; + scroll.guiTop = guiTop + 20; + addScroll(scroll); + + scroll.setList(PixelmonHelper.getPixelmonList()); + scroll.setSelected(PixelmonHelper.getName(entity)); + + Minecraft.getMinecraft().thePlayer.sendChatMessage(PixelmonHelper.getName(entity)); + } + + private void showEntityButtons(EntityLivingBase entity) { + mapped.clear(); + if(entity instanceof EntityNPCInterface) + return; + int y = guiTop + 20; + + NBTTagCompound compound = getExtras(entity); + Set keys = compound.func_150296_c(); + int i = 0; + for(String name : keys){ + if(isIgnored(name)) + continue; + NBTBase base = compound.getTag(name); + if(name.equals("Age")){ + i++; + addLabel(new GuiNpcLabel(0, "Child", guiLeft, y + 5 + i * 22, 0xFFFFFF)); + addButton(new GuiNpcButton(30, guiLeft + 80, y + i * 22, 50, 20, new String[]{"gui.no","gui.yes"},entity.isChild()?1:0)); + } + else if(base.getId() == 1){ + byte b = ((NBTTagByte)base).func_150290_f(); + if(b != 0 && b != 1) + continue; + if(playerdata.extra.hasKey(name)) + b = playerdata.extra.getByte(name); + i++; + addLabel(new GuiNpcLabel(100 + i, name, guiLeft, y + 5 + i * 22, 0xFFFFFF)); + addButton(new GuiNpcButton(100 + i, guiLeft + 80, y + i * 22, 50, 20, new String[]{"gui.no","gui.yes"}, b)); + + mapped.put(i, name); + } + } + if(EntityList.getEntityString(entity).equals("doggystyle.Dog")){ + int breed = 0; + try { + Method method = entity.getClass().getMethod("getBreedID"); + breed = (Integer) method.invoke(entity); + } catch (Exception e) { + + } + i++; + addLabel(new GuiNpcLabel(201, "Breed", guiLeft, y + 5 + i * 22, 0xFFFFFF)); + addButton(new GuiNpcButton(201, guiLeft + 80, y + i * 22, 50, 20, new String[]{"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16"}, breed)); + } + } + private boolean isIgnored(String tag){ + for(String s : ignoredTags) + if(s.equals(tag)) + return true; + return false; + } + + private NBTTagCompound getExtras(EntityLivingBase entity) { + NBTTagCompound fake = new NBTTagCompound(); + new EntityFakeLiving(entity.worldObj).writeEntityToNBT(fake); + + NBTTagCompound compound = new NBTTagCompound(); + try{ + entity.writeEntityToNBT(compound); + } + catch(Exception e){ + + } + Set keys = fake.func_150296_c(); + for(String name : keys) + compound.removeTag(name); + + return compound; + } + + private int getCurrentEntityIndex(){ + return list.indexOf(EntityList.classToStringMapping.get(playerdata.getEntityClass())); + } + + @Override + protected void actionPerformed(GuiButton btn) { + super.actionPerformed(btn); + GuiNpcButton button = (GuiNpcButton) btn; + if(button.id == 0){ + int index = getCurrentEntityIndex(); + if(!prev.enabled) + return; + index--; + try{ + if(index < 0){ + playerdata.setEntityClass(null); + npc.display.texture = "customnpcs:textures/entity/humanmale/Steve.png"; + } + else{ + playerdata.setEntityClass(data.get(list.get(index))); + + EntityLivingBase entity = playerdata.getEntity(npc); + if(entity != null){ + RendererLivingEntity render = (RendererLivingEntity) RenderManager.instance.getEntityRenderObject(entity); + npc.display.texture = NPCRendererHelper.getTexture(render,entity); + } + } + npc.display.glowTexture = ""; + npc.textureLocation = null; + npc.textureGlowLocation = null; + npc.updateHitbox(); + } + catch(Exception ex){ + npc.display.texture = "customnpcs:textures/entity/humanmale/Steve.png"; + } + initGui(); + } + if(button.id == 2){ + int index = getCurrentEntityIndex(); + if(!next.enabled) + return; + index++; + playerdata.setEntityClass(data.get(list.get(index))); + + updateTexture(); + + initGui(); + } + + if(button.id == 1){ + this.mc.displayGuiScreen(new GuiEntitySelection(this, playerdata,npc)); + } + + if(button.id == 4){ + this.mc.displayGuiScreen(new GuiModelHead(this, npc)); + } + if(button.id == 5){ + this.mc.displayGuiScreen(new GuiModelBody(this, npc)); + } + if(button.id == 6){ + this.mc.displayGuiScreen(new GuiModelArms(this, npc)); + } + if(button.id == 7){ + this.mc.displayGuiScreen(new GuiModelLegs(this, npc)); + } + if(button.id == 8){ + this.mc.displayGuiScreen(new GuiModelScale(this, playerdata, npc)); + } + if(button.id == 30){ + playerdata.extra.setInteger("Age",button.getValue() == 1?-24000:0); + playerdata.clearEntity(); + } + + if(button.id == 44){ + this.mc.displayGuiScreen(new GuiPresetSave(this, playerdata)); + } + + if(button.id == 45){ + this.mc.displayGuiScreen(new GuiPresetSelection(this, playerdata)); + } + if(button.id >= 100 && button.id < 200){ + String name = mapped.get(button.id - 100); + if(name != null){ + playerdata.extra.setBoolean(name, button.getValue() == 1); + playerdata.clearEntity(); + } + } + if(button.id == 201){ + try { + EntityLivingBase entity = playerdata.getEntity(npc); + Method method = entity.getClass().getMethod("setBreedID", int.class); + method.invoke(entity, ((GuiNpcButton)button).getValue()); + NBTTagCompound comp = new NBTTagCompound(); + entity.writeEntityToNBT(comp); + playerdata.extra.setString("EntityData21", comp.getString("EntityData21")); + playerdata.clearEntity(); + updateTexture(); + } catch (Exception e) { + + } + } + } + + private void updateTexture(){ + try{ + EntityLivingBase entity = playerdata.getEntity(npc); + if(entity != null){ + RendererLivingEntity render = (RendererLivingEntity) RenderManager.instance.getEntityRenderObject(entity); + npc.display.texture = NPCRendererHelper.getTexture(render,entity); + } + else{ + npc.display.texture = "customnpcs:textures/entity/humanmale/Steve.png"; + } + npc.display.glowTexture = ""; + npc.textureLocation = null; + npc.textureGlowLocation = null; + npc.updateHitbox(); + } + catch(Exception ex){ + npc.display.texture = "customnpcs:textures/entity/humanmale/Steve.png"; + } + } + + @Override + public void close(){ + Client.sendData(EnumPacketServer.ModelDataSave, playerdata.writeToNBT()); + displayGuiScreen(parent); + } + + @Override + public void customScrollClicked(int i, int j, int k, GuiCustomScroll scroll) { + playerdata.clearEntity(); + playerdata.extra.setString("Name", scroll.getSelected()); + + EntityLivingBase entity = playerdata.getEntity(npc); + RendererLivingEntity render = (RendererLivingEntity) RenderManager.instance.getEntityRenderObject(entity); + npc.display.texture = NPCRendererHelper.getTexture(render, entity); + npc.textureLocation = null; + } +} diff --git a/src/main/java/noppes/npcs/client/gui/model/GuiEntitySelection.java b/src/main/java/noppes/npcs/client/gui/model/GuiEntitySelection.java new file mode 100644 index 000000000..2f10da803 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/model/GuiEntitySelection.java @@ -0,0 +1,165 @@ +package noppes.npcs.client.gui.model; + +import java.util.Collections; +import java.util.Vector; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.client.renderer.entity.NPCRendererHelper; +import net.minecraft.client.renderer.entity.RendererLivingEntity; +import net.minecraft.entity.EntityList; +import net.minecraft.entity.EntityLivingBase; +import noppes.npcs.ModelData; +import noppes.npcs.client.EntityUtil; +import noppes.npcs.client.gui.util.GuiNPCInterface; +import noppes.npcs.client.gui.util.GuiNPCStringSlot; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.entity.EntityCustomNpc; + +import org.lwjgl.opengl.GL11; + +public class GuiEntitySelection extends GuiNPCInterface +{ + private GuiNPCStringSlot slot; + private GuiCreationScreen parent; + private Class prevModel; + private ModelData playerdata; + private EntityCustomNpc npc; + + public GuiEntitySelection(GuiCreationScreen parent, ModelData playerdata, EntityCustomNpc npc) + { + this.parent = parent; + this.playerdata = playerdata; + this.npc = npc; + drawDefaultBackground = false; + prevModel = playerdata.getEntityClass(); + } + + @Override + public void initGui() + { + super.initGui(); + Vector list = new Vector(parent.data.keySet()); + list.add("CustomNPC"); + Collections.sort(list,String.CASE_INSENSITIVE_ORDER); + slot = new GuiNPCStringSlot(list,this,false,18); + if(playerdata.getEntityClass() != null) + slot.selected = (String) EntityList.classToStringMapping.get(playerdata.getEntityClass()); + else{ + slot.selected = "CustomNPC"; + } + slot.registerScrollButtons(4, 5); + + this.buttonList.add(new GuiNpcButton(2, width / 2 - 100, height - 44,98, 20, "gui.back")); + } + + @Override + public void drawScreen(int i, int j, float f) + { + EntityLivingBase entity = playerdata.getEntity(npc); + if(entity == null) + entity = this.npc; + else + EntityUtil.Copy(npc, entity); + + 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(); + GL11.glTranslatef(l + 33, i1 + 131, 50F); + + float scale = 1; + if(entity.height > 2.4) + scale = 2 / entity.height; + + GL11.glScalef(-50 * scale, 50 * scale, 50 * scale); + GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); + float f2 = entity.renderYawOffset; + float f3 = entity.rotationYaw; + float f4 = entity.rotationPitch; + float f7 = entity.rotationYawHead; + 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); + entity.renderYawOffset = (float)Math.atan(f5 / 40F) * 20F; + entity.rotationYaw = (float)Math.atan(f5 / 40F) * 40F; + entity.rotationPitch = -(float)Math.atan(f6 / 40F) * 20F; + entity.rotationYawHead = entity.rotationYaw; + GL11.glTranslatef(0.0F, entity.yOffset, 0.0F); + RenderManager.instance.playerViewY = 180F; + try{ + RenderManager.instance.renderEntityWithPosYaw(entity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F); + } + catch(Exception e){ + playerdata.setEntityClass(null); + } + entity.renderYawOffset = f2; + entity.rotationYaw = f3; + entity.rotationPitch = f4; + entity.rotationYawHead = f7; + GL11.glPopMatrix(); + RenderHelper.disableStandardItemLighting(); + GL11.glDisable(32826 /*GL_RESCALE_NORMAL_EXT*/); + + OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); + GL11.glDisable(GL11.GL_TEXTURE_2D); + OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); + slot.drawScreen(i, j, f); + super.drawScreen(i, j, f); + } + public void elementClicked(){ + try{ + playerdata.setEntityClass(parent.data.get(slot.selected)); + EntityLivingBase entity = playerdata.getEntity(npc); + if(entity != null){ + RendererLivingEntity render = (RendererLivingEntity) RenderManager.instance.getEntityRenderObject(entity); + npc.display.texture = NPCRendererHelper.getTexture(render,entity); + } + else{ + npc.display.texture = "customnpcs:textures/entity/humanmale/Steve.png"; + } + npc.display.glowTexture = ""; + npc.textureLocation = null; + npc.textureGlowLocation = null; + npc.updateHitbox(); + } + catch(Exception ex){ + npc.display.texture = "customnpcs:textures/entity/humanmale/Steve.png"; + } + } + public void doubleClicked(){ + close(); + } + + public void keyTyped(char par1, int par2) + { + if (par2 == 1) + { + close(); + } + } + public void close() { + this.mc.displayGuiScreen(parent); + } + + + protected void actionPerformed(GuiButton guibutton) + { + close(); + } + + @Override + public void save() { + // TODO Auto-generated method stub + + } + + +} diff --git a/src/main/java/noppes/npcs/client/gui/model/GuiModelArms.java b/src/main/java/noppes/npcs/client/gui/model/GuiModelArms.java new file mode 100644 index 000000000..66e02c257 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/model/GuiModelArms.java @@ -0,0 +1,58 @@ +package noppes.npcs.client.gui.model; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import noppes.npcs.ModelPartData; +import noppes.npcs.client.gui.util.GuiModelInterface; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.entity.EntityCustomNpc; + +public class GuiModelArms extends GuiModelInterface{ + + private final String[] arrParticles = new String[]{"gui.no","Both","Left","Right"}; + + private GuiScreen parent; + public GuiModelArms(GuiScreen parent, EntityCustomNpc npc){ + super(npc); + this.parent = parent; + this.xOffset = 60; + } + + @Override + public void initGui() { + super.initGui(); + int y = guiTop + 20; + + ModelPartData claws = playerdata.getPartData("claws"); + addButton(new GuiNpcButton(0, guiLeft + 50, y += 22, 70, 20, arrParticles, claws == null?0:claws.type + 1)); + addLabel(new GuiNpcLabel(0, "Claws", guiLeft, y + 5, 0xFFFFFF)); + if(claws != null) + addButton(new GuiNpcButton(10, guiLeft + 122, y, 40, 20, claws.getColor())); + } + + + @Override + protected void actionPerformed(GuiButton btn) { + super.actionPerformed(btn); + GuiNpcButton button = (GuiNpcButton) btn; + + if(button.id == 0){ + if(button.getValue() == 0) + playerdata.removePart("claws"); + else{ + ModelPartData data = playerdata.getOrCreatePart("claws"); + data.type = (byte) (button.getValue() - 1); + } + initGui(); + } + if(button.id == 10){ + this.mc.displayGuiScreen(new GuiModelColor(this, playerdata.getPartData("claws"), npc)); + } + } + + @Override + public void close(){ + this.mc.displayGuiScreen(parent); + } +} diff --git a/src/main/java/noppes/npcs/client/gui/model/GuiModelBody.java b/src/main/java/noppes/npcs/client/gui/model/GuiModelBody.java new file mode 100644 index 000000000..77d06f17a --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/model/GuiModelBody.java @@ -0,0 +1,141 @@ +package noppes.npcs.client.gui.model; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import noppes.npcs.ModelPartData; +import noppes.npcs.client.gui.util.GuiModelInterface; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.entity.EntityCustomNpc; + +public class GuiModelBody extends GuiModelInterface{ + + private GuiScreen parent; + private final String[] arrWing = new String[]{"gui.no","Player","Type1","Type2","Type3"}; + private final String[] arrBreasts = new String[]{"gui.no","Type1","Type2","Type3"}; + private final String[] arrParticles = new String[]{"gui.no","Player","Type1","Type2", "Rainbow"}; + private final String[] arrfins = new String[]{"gui.no","Player","Type1"}; + + public GuiModelBody(GuiScreen parent, EntityCustomNpc npc){ + super(npc); + this.parent = parent; + this.xOffset = 60; + } + + @Override + public void initGui() { + super.initGui(); + int y = guiTop + 20; + addButton(new GuiNpcButton(1, guiLeft + 50, y += 22, 70, 20, arrBreasts, playerdata.breasts)); + addLabel(new GuiNpcLabel(1, "Breasts", guiLeft, y + 5, 0xFFFFFF)); + + ModelPartData wing = playerdata.getPartData("wings"); + addButton(new GuiNpcButton(0, guiLeft + 50, y += 22, 70, 20, arrWing, wing == null?0:wing.type + 1)); + addLabel(new GuiNpcLabel(0, "Wings", guiLeft, y + 5, 0xFFFFFF)); + if(wing != null) + addButton(new GuiNpcButton(11, guiLeft + 122, y, 40, 20, wing.getColor())); + + ModelPartData particles = playerdata.getPartData("particles"); + addButton(new GuiNpcButton(2, guiLeft + 50, y += 22, 70, 20, arrParticles, getParticleIndex(particles))); + addLabel(new GuiNpcLabel(2, "Particles", guiLeft, y + 5, 0xFFFFFF)); + if(particles != null && particles.type != 1) + addButton(new GuiNpcButton(12, guiLeft + 122, y, 40, 20, particles.getColor())); + + ModelPartData fin = playerdata.getPartData("fin"); + addButton(new GuiNpcButton(3, guiLeft + 50, y += 22, 70, 20, arrfins, getFinIndex(fin))); + addLabel(new GuiNpcLabel(3, "Fin", guiLeft, y + 5, 0xFFFFFF)); + if(fin != null) + addButton(new GuiNpcButton(13, guiLeft + 122, y, 40, 20, fin.getColor())); + + } + + + private int getFinIndex(ModelPartData fin) { + if(fin == null) + return 0; + return fin.playerTexture?1:2; + } + + private int getParticleIndex(ModelPartData particles) { + if(particles == null) + return 0; + if(particles.type == 0){ + if(particles.playerTexture) + return 1; + if(particles.texture.contains("1")) + return 2; + if(particles.texture.contains("2")) + return 3; + } + if(particles.type == 1){ + return 4; + } + + return 0; + } + + @Override + protected void actionPerformed(GuiButton btn) { + super.actionPerformed(btn); + GuiNpcButton button = (GuiNpcButton) btn; + + if(button.id == 0){ + if(button.getValue() == 0) + playerdata.removePart("wings"); + else{ + ModelPartData data = playerdata.getOrCreatePart("wings"); + if(button.getValue() > 1) + data.setTexture("wings/wing" + (button.getValue() - 1), button.getValue() - 1); + } + initGui(); + } + if(button.id == 1){ + playerdata.breasts = (byte) button.getValue(); + } + if(button.id == 2){ + int value = button.getValue(); + if(value == 0) + playerdata.removePart("particles"); + else{ + ModelPartData particles = playerdata.getOrCreatePart("particles"); + if(value == 1) + particles.setTexture("", 0); + if(value == 2) + particles.setTexture("particle/type1", 0); + if(value == 3) + particles.setTexture("particle/type2", 0); + if(value == 4) + particles.setTexture("", 1); + } + initGui(); + } + if(button.id == 3){ + int value = button.getValue(); + if(value == 0) + playerdata.removePart("fin"); + else{ + ModelPartData particles = playerdata.getOrCreatePart("fin"); + if(value == 1) + particles.setTexture("", 0); + if(value == 2) + particles.setTexture("fin/fin1", 0); + } + initGui(); + } + + if(button.id == 11){ + this.mc.displayGuiScreen(new GuiModelColor(this, playerdata.getPartData("wings"), npc)); + } + if(button.id == 12){ + this.mc.displayGuiScreen(new GuiModelColor(this, playerdata.getPartData("particles"), npc)); + } + if(button.id == 13){ + this.mc.displayGuiScreen(new GuiModelColor(this, playerdata.getPartData("fin"), npc)); + } + } + + @Override + public void close(){ + this.mc.displayGuiScreen(parent); + } +} diff --git a/src/main/java/noppes/npcs/client/gui/model/GuiModelColor.java b/src/main/java/noppes/npcs/client/gui/model/GuiModelColor.java new file mode 100644 index 000000000..e053b0e8f --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/model/GuiModelColor.java @@ -0,0 +1,126 @@ +package noppes.npcs.client.gui.model; + +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.io.InputStream; + +import javax.imageio.ImageIO; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.resources.IResource; +import net.minecraft.util.ResourceLocation; +import noppes.npcs.ModelPartData; +import noppes.npcs.client.gui.util.GuiModelInterface; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.ITextfieldListener; +import noppes.npcs.entity.EntityCustomNpc; + +import org.lwjgl.opengl.GL11; + +public class GuiModelColor extends GuiModelInterface implements ITextfieldListener{ + + private GuiScreen parent; + private final static ResourceLocation color = new ResourceLocation("customnpcs:textures/gui/color.png"); + + private int colorX, colorY; + + private GuiNpcTextField textfield; + + private ModelPartData data; + public GuiModelColor(GuiScreen parent, ModelPartData data, EntityCustomNpc npc){ + super(npc); + this.parent = parent; + this.data = data; + this.xOffset = 60; + ySize = 230; + } + + @Override + public void initGui() { + super.initGui(); + colorX = guiLeft + 4; + colorY = guiTop + 50; + this.addTextField(textfield = new GuiNpcTextField(0, this, guiLeft + 25, guiTop + 20, 70, 20, data.getColor())); + textfield.setTextColor(data.color); + } + + @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{ + int color = Integer.parseInt(textfield.getText(),16); + data.color = color; + textfield.setTextColor(color); + } + catch(NumberFormatException e){ + textfield.setText(prev); + } + } + + @Override + protected void actionPerformed(GuiButton btn) { + super.actionPerformed(btn); + } + + @Override + public void close(){ + this.mc.displayGuiScreen(parent); + } + + @Override + public void drawScreen(int par1, int par2, float par3){ + super.drawScreen(par1, par2, par3); + mc.getTextureManager().bindTexture(color); + + 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 + 120 || j < colorY || j > colorY + 120) + return; + InputStream stream = null; + try { + IResource resource = this.mc.getResourceManager().getResource(color); + BufferedImage bufferedimage = ImageIO.read(stream = resource.getInputStream()); + int color = bufferedimage.getRGB((i - guiLeft - 4) * 4, (j - guiTop - 50) * 4) & 16777215; + if(color != 0){ + data.color = color; + textfield.setTextColor(color); + textfield.setText(data.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; + } + data.color = color; + textfield.setTextColor(color); + } +} diff --git a/src/main/java/noppes/npcs/client/gui/model/GuiModelHead.java b/src/main/java/noppes/npcs/client/gui/model/GuiModelHead.java new file mode 100644 index 000000000..12a795a88 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/model/GuiModelHead.java @@ -0,0 +1,187 @@ +package noppes.npcs.client.gui.model; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import noppes.npcs.ModelPartData; +import noppes.npcs.client.gui.util.GuiModelInterface; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.entity.EntityCustomNpc; + +public class GuiModelHead extends GuiModelInterface{ + + private GuiScreen parent; + + private final String[] arrHeadwear = new String[]{"gui.no","gui.yes","Solid"}; + private final String[] arrHair = new String[]{"gui.no","Player","Long","Thin","Stylish","Ponytail"}; + private final String[] arrBeard = new String[]{"gui.no","Player","Standard","Viking","Long","Short"}; + private final String[] arrMohawk = new String[]{"gui.no","Type1"}; + private final String[] arrSnout = new String[]{"gui.no","Player Small","Player Medium", "Player Large", "Player Bunny", + "Small1", "Medium1", "Large1", "Bunny1"}; + private final String[] arrEars = new String[]{"gui.no","Player","Player Bunny","Bunny","Type1"}; + + public GuiModelHead(GuiScreen parent, EntityCustomNpc npc){ + super(npc); + this.parent = parent; + this.xOffset = 60; + } + + @Override + public void initGui() { + super.initGui(); + + int y = guiTop + 20; + + addButton(new GuiNpcButton(0, guiLeft + 50, y += 22, 70, 20, arrHeadwear, playerdata.headwear)); + addLabel(new GuiNpcLabel(0, "Headwear", guiLeft, y + 5, 0xFFFFFF)); + + ModelPartData hair = playerdata.getPartData("hair"); + addButton(new GuiNpcButton(1, guiLeft + 50, y += 22, 70, 20, arrHair, hair == null?0:hair.type + 1)); + addLabel(new GuiNpcLabel(1, "Hair", guiLeft, y + 5, 0xFFFFFF)); + if(hair != null) + addButton(new GuiNpcButton(11, guiLeft + 122, y, 40, 20, hair.getColor())); + + ModelPartData mohawk = playerdata.getPartData("mohawk"); + addButton(new GuiNpcButton(2, guiLeft + 50, y += 22, 70, 20, arrMohawk, mohawk == null?0:mohawk.type)); + addLabel(new GuiNpcLabel(2, "Mohawk", guiLeft, y + 5, 0xFFFFFF)); + if(mohawk != null) + addButton(new GuiNpcButton(12, guiLeft + 122, y, 40, 20, mohawk.getColor())); + + ModelPartData beard = playerdata.getPartData("beard"); + addButton(new GuiNpcButton(3, guiLeft + 50, y += 22, 70, 20, arrBeard, beard == null?0:beard.type + 1)); + addLabel(new GuiNpcLabel(3, "Beard", guiLeft, y + 5, 0xFFFFFF)); + if(beard != null) + addButton(new GuiNpcButton(13, guiLeft + 122, y, 40, 20, beard.getColor())); + + ModelPartData snout = playerdata.getPartData("snout"); + addButton(new GuiNpcButton(4, guiLeft + 50, y += 22, 70, 20, arrSnout, snout == null?0:snout.type + (snout.playerTexture?1:5))); + addLabel(new GuiNpcLabel(4, "Snout", guiLeft, y + 5, 0xFFFFFF)); + if(snout != null) + addButton(new GuiNpcButton(14, guiLeft + 122, y, 40, 20, snout.getColor())); + + ModelPartData ears = playerdata.getPartData("ears"); + addButton(new GuiNpcButton(5, guiLeft + 50, y += 22, 70, 20, arrEars, getEars(ears))); + addLabel(new GuiNpcLabel(5, "Ears", guiLeft, y + 5, 0xFFFFFF)); + if(ears != null) + addButton(new GuiNpcButton(15, guiLeft + 122, y, 40, 20, ears.getColor())); + } + + + private int getEars(ModelPartData data) { + if(data == null) + return 0; + if(data.playerTexture && data.type == 0) + return 1; + if(data.playerTexture && data.type == 1) + return 2; + if(data.type == 0) + return 4; + if(data.type == 1) + return 3; + + return 0; + } + + @Override + protected void actionPerformed(GuiButton btn) { + super.actionPerformed(btn); + GuiNpcButton button = (GuiNpcButton) btn; + + if(button.id == 0){ + playerdata.headwear = (byte) button.getValue(); + } + + if(button.id == 1){ + if(button.getValue() == 0) + playerdata.removePart("hair"); + else{ + ModelPartData data = playerdata.getOrCreatePart("hair"); + if(button.getValue() > 1) + data.setTexture("hair/hair" + (button.getValue() - 1), button.getValue() - 1); + } + initGui(); + } + + if(button.id == 2){ + if(button.getValue() == 0) + playerdata.removePart("mohawk"); + else{ + ModelPartData data = playerdata.getOrCreatePart("mohawk"); + if(button.getValue() > 0) + data.setTexture("hair/mohawk" + button.getValue(),button.getValue()); + } + initGui(); + } + + if(button.id == 3){ + if(button.getValue() == 0) + playerdata.removePart("beard"); + else{ + ModelPartData data = playerdata.getOrCreatePart("beard"); + if(button.getValue() > 1) + data.setTexture("beard/beard" + (button.getValue() - 1),button.getValue() - 1); + } + initGui(); + } + + if(button.id == 4){ + if(button.getValue() == 0) + playerdata.removePart("snout"); + else if(button.getValue() < 5){ + ModelPartData data = playerdata.getOrCreatePart("snout"); + data.type = (byte) (button.getValue() - 1); + } + else{ + ModelPartData data = playerdata.getOrCreatePart("snout"); + byte type = 0; + if(button.displayString.startsWith("Medium")) + type = 1; + if(button.displayString.startsWith("Large")) + type = 2; + if(button.displayString.startsWith("Bunny")) + type = 3; + data.setTexture("snout/" + button.displayString.toLowerCase(), type); + } + initGui(); + } + + if(button.id == 5){ + int value = button.getValue(); + if(value == 0) + playerdata.removePart("ears"); + else{ + ModelPartData data = playerdata.getOrCreatePart("ears"); + if(value == 1) + data.setTexture("", 0); + if(value == 2) + data.setTexture("", 1); + if(value == 3) + data.setTexture("ears/bunny1", 1); + if(value == 4) + data.setTexture("ears/type1", 0); + } + initGui(); + } + + if(button.id == 11){ + this.mc.displayGuiScreen(new GuiModelColor(this, playerdata.getPartData("hair"), npc)); + } + if(button.id == 12){ + this.mc.displayGuiScreen(new GuiModelColor(this, playerdata.getPartData("mohawk"), npc)); + } + if(button.id == 13){ + this.mc.displayGuiScreen(new GuiModelColor(this, playerdata.getPartData("beard"), npc)); + } + if(button.id == 14){ + this.mc.displayGuiScreen(new GuiModelColor(this, playerdata.getPartData("snout"), npc)); + } + if(button.id == 15){ + this.mc.displayGuiScreen(new GuiModelColor(this, playerdata.getPartData("ears"), npc)); + } + } + + @Override + public void close(){ + this.mc.displayGuiScreen(parent); + } +} diff --git a/src/main/java/noppes/npcs/client/gui/model/GuiModelLegs.java b/src/main/java/noppes/npcs/client/gui/model/GuiModelLegs.java new file mode 100644 index 000000000..660d005dc --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/model/GuiModelLegs.java @@ -0,0 +1,134 @@ +package noppes.npcs.client.gui.model; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import noppes.npcs.ModelPartData; +import noppes.npcs.client.gui.util.GuiModelInterface; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.entity.EntityCustomNpc; + +public class GuiModelLegs extends GuiModelInterface{ + + private GuiScreen parent; + private final String[] arrLegs = new String[]{"gui.no","Player","Player Naga","Spider","Horse","Naga", "Mermaid","Digitigrade"}; + private final String[] arrTail = new String[]{"gui.no","Player", "Player Dragon","Cat","Wolf","Horse","Dragon", "Squirrel"}; + public GuiModelLegs(GuiScreen parent, EntityCustomNpc npc){ + super(npc); + this.parent = parent; + this.xOffset = 60; + } + + @Override + public void initGui() { + super.initGui(); + int y = guiTop + 20; + + addButton(new GuiNpcButton(1, guiLeft + 50, y += 22, 70, 20, arrLegs, getNagaIndex(playerdata.legParts))); + addLabel(new GuiNpcLabel(1, "Legs", guiLeft, y + 5, 0xFFFFFF)); + if(playerdata.legParts.type > 0) + addButton(new GuiNpcButton(11, guiLeft + 122, y, 40, 20, playerdata.legParts.getColor())); + + ModelPartData tail = playerdata.getPartData("tail"); + addButton(new GuiNpcButton(2, guiLeft + 50, y += 22, 70, 20, arrTail, getTailIndex(tail))); + addLabel(new GuiNpcLabel(2, "Tail", guiLeft, y + 5, 0xFFFFFF)); + if(tail != null) + addButton(new GuiNpcButton(12, guiLeft + 122, y, 40, 20, tail.getColor())); + } + private int getNagaIndex(ModelPartData data) { + if(!data.playerTexture && data.type == 1) + return 5; + if(data.type == 4) + return 6; + if(data.type == 5) + return 7; + return data.type + 1; + } + + private int getTailIndex(ModelPartData data){ + if(data == null) + return 0; + if(data.playerTexture && data.type == 0) + return 1; + if(data.type == 0 && data.texture.contains("tail1")) + return 3; + if(data.type == 0 && data.texture.contains("tail2")) + return 4; + if(data.playerTexture && data.type == 1) + return 2; + if(data.type == 1) + return 6; + if(data.type == 2) + return 5; + if(data.type == 3) + return 7; + + return 0; + } + + @Override + protected void actionPerformed(GuiButton btn) { + super.actionPerformed(btn); + GuiNpcButton button = (GuiNpcButton) btn; + + if(button.id == 1){ + ModelPartData data = playerdata.legParts; + int value = button.getValue() - 1; + if(value < 1) + data.color = 0xFFFFFF; + if(value < 2){ + data.setTexture("", value); + } + if(value == 2) + data.setTexture("legs/spider1", 2); + if(value == 3) + data.setTexture("legs/horse1", 3); + if(value == 4) + data.setTexture("legs/naga1", 1); + if(value == 5) + data.setTexture("legs/mermaid1", 4); + if(value == 6) + data.setTexture("", 5); + + initGui(); + + } + + if(button.id == 2){ + int value = button.getValue(); + if(value == 0) + playerdata.removePart("tail"); + else{ + ModelPartData data = playerdata.getOrCreatePart("tail"); + if(value == 1) + data.setTexture("", 0); + if(value == 2) + data.setTexture("", 1); + if(value == 3) + data.setTexture("tail/tail1", 0); + if(value == 4) + data.setTexture("tail/tail2", 0); + if(value == 5) + data.setTexture("tail/horse1", 2); + if(value == 6) + data.setTexture("tail/dragon1", 1); + if(value == 7) + data.setTexture("tail/squirrel1", 3); + + } + initGui(); + } + if(button.id == 11){ + this.mc.displayGuiScreen(new GuiModelColor(this, playerdata.legParts, npc)); + } + + if(button.id == 12){ + this.mc.displayGuiScreen(new GuiModelColor(this, playerdata.getPartData("tail"), npc)); + } + } + + @Override + public void close(){ + this.mc.displayGuiScreen(parent); + } +} diff --git a/src/main/java/noppes/npcs/client/gui/model/GuiModelScale.java b/src/main/java/noppes/npcs/client/gui/model/GuiModelScale.java new file mode 100644 index 000000000..805bcb1a4 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/model/GuiModelScale.java @@ -0,0 +1,130 @@ +package noppes.npcs.client.gui.model; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import noppes.npcs.ModelData; +import noppes.npcs.ModelPartConfig; +import noppes.npcs.client.gui.util.GuiModelInterface; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcSlider; +import noppes.npcs.client.gui.util.ISliderListener; +import noppes.npcs.entity.EntityCustomNpc; + +public class GuiModelScale extends GuiModelInterface implements ISliderListener{ + + private GuiScreen parent; + private int type = 0; + public GuiModelScale(GuiScreen parent, ModelData data, EntityCustomNpc npc){ + super(npc); + this.parent = parent; + this.xOffset = 100; + ySize = 230; + } + + @Override + public void initGui() { + super.initGui(); + + int y = guiTop + 2; + + addLabel(new GuiNpcLabel(20, "Head", guiLeft + 55, y + 5, 0xFFFFFF)); + if(type == 0){ + drawSlider(y, playerdata.head); + y += 88; + } + else{ + addButton(new GuiNpcButton(0, guiLeft + 110, y , 60, 20, "Edit")); + y += 24; + } + + addLabel(new GuiNpcLabel(21, "Body", guiLeft + 55, y + 5, 0xFFFFFF)); + if(type == 1){ + drawSlider(y, playerdata.body); + y += 88; + } + else{ + addButton(new GuiNpcButton(1, guiLeft + 110, y , 60, 20, "Edit")); + y += 24; + } + + addLabel(new GuiNpcLabel(22, "Arms", guiLeft + 55, y + 5, 0xFFFFFF)); + if(type == 2){ + drawSlider(y, playerdata.arms); + y += 88; + } + else{ + addButton(new GuiNpcButton(2, guiLeft + 110, y , 60, 20, "Edit")); + y += 24; + } + + addLabel(new GuiNpcLabel(23, "Legs", guiLeft + 55, y + 5, 0xFFFFFF)); + if(type == 3){ + drawSlider(y, playerdata.legs); + y += 88; + } + else{ + addButton(new GuiNpcButton(3, guiLeft + 110, y , 60, 20, "Edit")); + y += 24; + } + + } + + private void drawSlider(int y, ModelPartConfig config){ + y += 15; + addLabel(new GuiNpcLabel(10, "Width", guiLeft, y + 5, 0xFFFFFF)); + addSlider(new GuiNpcSlider(this, 10, guiLeft + 50, y, config.scaleX - 0.5f)); + y += 22; + addLabel(new GuiNpcLabel(11, "Height", guiLeft, y + 5, 0xFFFFFF)); + addSlider(new GuiNpcSlider(this, 11, guiLeft + 50, y, config.scaleY - 0.5f)); + y += 22; + addLabel(new GuiNpcLabel(12, "Depth", guiLeft, y + 5, 0xFFFFFF)); + addSlider(new GuiNpcSlider(this, 12, guiLeft + 50, y, config.scaleZ - 0.5f)); + } + + + @Override + protected void actionPerformed(GuiButton btn) { + super.actionPerformed(btn); + if(btn.id < 4){ + type = btn.id; + initGui(); + } + } + + @Override + public void close(){ + this.mc.displayGuiScreen(parent); + } + + @Override + public void mouseDragged(GuiNpcSlider slider) { + int percent = (int) (50 + slider.sliderValue * 100); + slider.setString(percent + "%"); + ModelPartConfig config = playerdata.head; + if(type == 1) + config = playerdata.body; + else if(type == 2) + config = playerdata.arms; + else if(type == 3) + config = playerdata.legs; + + if(slider.id == 10) + config.scaleX = slider.sliderValue + 0.5f; + if(slider.id == 11) + config.scaleY = slider.sliderValue + 0.5f; + if(slider.id == 12) + config.scaleZ = slider.sliderValue + 0.5f; + npc.updateHitbox(); + } + + @Override + public void mousePressed(GuiNpcSlider slider) { + // TODO Auto-generated method stub + + } + + @Override + public void mouseReleased(GuiNpcSlider slider) { + } +} diff --git a/src/main/java/noppes/npcs/client/gui/model/GuiPresetSave.java b/src/main/java/noppes/npcs/client/gui/model/GuiPresetSave.java new file mode 100644 index 000000000..a9e7b9f12 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/model/GuiPresetSave.java @@ -0,0 +1,49 @@ +package noppes.npcs.client.gui.model; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import noppes.npcs.ModelData; +import noppes.npcs.client.controllers.Preset; +import noppes.npcs.client.controllers.PresetController; +import noppes.npcs.client.gui.util.GuiNPCInterface; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcTextField; + +public class GuiPresetSave extends GuiNPCInterface{ + private ModelData data; + private GuiScreen parent; + + public GuiPresetSave(GuiScreen parent, ModelData data){ + this.data = data; + this.parent = parent; + xSize = 200; + this.drawDefaultBackground = true; + } + @Override + public void initGui(){ + super.initGui(); + this.addTextField(new GuiNpcTextField(0, this, guiLeft, guiTop + 70,200, 20, "")); + this.addButton(new GuiNpcButton(0,guiLeft, guiTop + 100,98, 20, "Save")); + this.addButton(new GuiNpcButton(1,guiLeft + 100, guiTop + 100, 98, 20, "Cancel")); + } + @Override + protected void actionPerformed(GuiButton btn) { + super.actionPerformed(btn); + GuiNpcButton button = (GuiNpcButton) btn; + if(button.id == 0){ + String name = this.getTextField(0).getText().trim(); + if(name.isEmpty()) + return; + Preset preset = new Preset(); + preset.name = name; + preset.data = data.copy(); + PresetController.instance.addPreset(preset); + } + mc.displayGuiScreen(parent); + } + @Override + public void save() { + // TODO Auto-generated method stub + + } +} diff --git a/src/main/java/noppes/npcs/client/gui/model/GuiPresetSelection.java b/src/main/java/noppes/npcs/client/gui/model/GuiPresetSelection.java new file mode 100644 index 000000000..eb4d99397 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/model/GuiPresetSelection.java @@ -0,0 +1,164 @@ +package noppes.npcs.client.gui.model; + +import java.util.Collections; +import java.util.Vector; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.ModelData; +import noppes.npcs.client.EntityUtil; +import noppes.npcs.client.controllers.Preset; +import noppes.npcs.client.controllers.PresetController; +import noppes.npcs.client.gui.util.GuiNPCInterface; +import noppes.npcs.client.gui.util.GuiNPCStringSlot; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.entity.EntityCustomNpc; + +import org.lwjgl.opengl.GL11; + +public class GuiPresetSelection extends GuiNPCInterface +{ + private GuiNPCStringSlot slot; + private GuiCreationScreen parent; + private NBTTagCompound prevData; + private ModelData playerdata; + private EntityCustomNpc npc; + + public GuiPresetSelection(GuiCreationScreen parent, ModelData playerdata) + { + this.parent = parent; + this.playerdata = playerdata; + prevData = playerdata.writeToNBT(); + drawDefaultBackground = false; + npc = new EntityCustomNpc(Minecraft.getMinecraft().theWorld); + npc.modelData = playerdata.copy(); + + PresetController.instance.load(); + } + + public void initGui() + { + super.initGui(); + Vector list = new Vector(); + for(Preset preset : PresetController.instance.presets.values()) + list.add(preset.name); + + Collections.sort(list,String.CASE_INSENSITIVE_ORDER); + slot = new GuiNPCStringSlot(list,this,false,18); + slot.registerScrollButtons(4, 5); + + this.buttonList.add(new GuiNpcButton(2, width / 2 - 100, height - 44,98, 20, "Back")); + this.buttonList.add(new GuiNpcButton(3, width / 2 + 2, height - 44,98, 20, "Load")); + this.buttonList.add(new GuiNpcButton(4, width / 2 - 49, height - 22,98, 20, "Remove")); + } + + + public void drawScreen(int i, int j, float f) + { + EntityLivingBase entity = npc.modelData.getEntity(npc); + if(entity == null) + entity = this.npc; + else + EntityUtil.Copy(npc, entity); + + 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(); + GL11.glTranslatef(l + 33, i1 + 131, 50F); + GL11.glScalef(-50, 50, 50); + GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); + float f2 = entity.renderYawOffset; + float f3 = entity.rotationYaw; + float f4 = entity.rotationPitch; + float f7 = entity.rotationYawHead; + 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); + entity.renderYawOffset = (float)Math.atan(f5 / 40F) * 20F; + entity.rotationYaw = (float)Math.atan(f5 / 40F) * 40F; + entity.rotationPitch = -(float)Math.atan(f6 / 40F) * 20F; + entity.rotationYawHead = entity.rotationYaw; + GL11.glTranslatef(0.0F, entity.yOffset, 0.0F); + RenderManager.instance.playerViewY = 180F; + RenderManager.instance.renderEntityWithPosYaw(entity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F); + entity.renderYawOffset = f2; + entity.rotationYaw = f3; + entity.rotationPitch = f4; + entity.rotationYawHead = f7; + GL11.glPopMatrix(); + RenderHelper.disableStandardItemLighting(); + GL11.glDisable(32826 /*GL_RESCALE_NORMAL_EXT*/); + + OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); + GL11.glDisable(GL11.GL_TEXTURE_2D); + OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); + slot.drawScreen(i, j, f); + super.drawScreen(i, j, f); + } + public void elementClicked(){ + Preset preset = PresetController.instance.getPreset(slot.selected); + npc.modelData.readFromNBT(preset.data.writeToNBT()); + } + public void doubleClicked(){ + playerdata.readFromNBT(npc.modelData.writeToNBT()); + close(); + } + + @Override + public void keyTyped(char par1, int par2) + { + if (par2 == 1) + { + close(); + } + } + public void close() { + mc.displayGuiScreen(parent); + } + + public FontRenderer getFontRenderer() { + return this.fontRendererObj; + } + + @Override + protected void actionPerformed(GuiButton button) + { + GuiNpcButton guibutton = (GuiNpcButton) button; + if(guibutton.id == 2){ + close(); + } + if(guibutton.id == 3){ + playerdata.readFromNBT(npc.modelData.writeToNBT()); + close(); + } + if(guibutton.id == 4){ + PresetController.instance.removePreset(slot.selected); + Vector list = new Vector(); + for(Preset preset : PresetController.instance.presets.values()) + list.add(preset.name); + + Collections.sort(list,String.CASE_INSENSITIVE_ORDER); + slot.setList(list); + slot.selected = ""; + } + } + + @Override + public void save() { + // TODO Auto-generated method stub + + } + + +} diff --git a/src/main/java/noppes/npcs/client/gui/player/GuiBigSign.java b/src/main/java/noppes/npcs/client/gui/player/GuiBigSign.java new file mode 100644 index 000000000..5a90a8e65 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/player/GuiBigSign.java @@ -0,0 +1,21 @@ +package noppes.npcs.client.gui.player; + +import noppes.npcs.NoppesUtilPlayer; +import noppes.npcs.blocks.tiles.TileBigSign; +import noppes.npcs.client.gui.SubGuiNpcTextArea; +import noppes.npcs.constants.EnumPlayerPacket; + +public class GuiBigSign extends SubGuiNpcTextArea{ + public TileBigSign tile; + public GuiBigSign(int x, int y, int z) { + super(""); + tile = (TileBigSign) player.worldObj.getTileEntity(x, y, z); + text = tile.getText(); + } + + @Override + public void close(){ + super.close(); + NoppesUtilPlayer.sendData(EnumPlayerPacket.SignSave, tile.xCoord, tile.yCoord, tile.zCoord, text); + } +} diff --git a/src/main/java/noppes/npcs/client/gui/player/GuiBook.java b/src/main/java/noppes/npcs/client/gui/player/GuiBook.java new file mode 100644 index 000000000..d66206f45 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/player/GuiBook.java @@ -0,0 +1,466 @@ +package noppes.npcs.client.gui.player; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.nbt.NBTTagString; +import net.minecraft.util.ChatAllowedCharacters; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.ResourceLocation; +import noppes.npcs.NoppesUtilPlayer; +import noppes.npcs.constants.EnumPlayerPacket; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.lwjgl.input.Keyboard; +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class GuiBook extends GuiScreen +{ + private static final Logger logger = LogManager.getLogger(); + private static final ResourceLocation bookGuiTextures = new ResourceLocation("textures/gui/book.png"); + /** + * The player editing the book + */ + private final EntityPlayer editingPlayer; + private final ItemStack bookObj; + /** + * Whether the book is signed or can still be edited + */ + private final boolean bookIsUnsigned; + private boolean field_146481_r; + private boolean field_146480_s; + /** + * Update ticks since the gui was opened + */ + private int updateCount; + private int bookImageWidth = 192; + private int bookImageHeight = 192; + private int bookTotalPages = 1; + private int currPage; + private NBTTagList bookPages; + private String bookTitle = ""; + private GuiBook.NextPageButton buttonNextPage; + private GuiBook.NextPageButton buttonPreviousPage; + private GuiButton buttonDone; + /** + * The GuiButton to sign this book. + */ + private GuiButton buttonSign; + private GuiButton buttonFinalize; + private GuiButton buttonCancel; + + private int x, y, z; + + public GuiBook(EntityPlayer par1EntityPlayer, ItemStack item, int x, int y, int z){ + this.x = x; + this.y = y; + this.z = z; + this.editingPlayer = par1EntityPlayer; + this.bookObj = item; + this.bookIsUnsigned = item.getItem() == Items.writable_book; + + if (item.hasTagCompound()) + { + NBTTagCompound nbttagcompound = item.getTagCompound(); + this.bookPages = nbttagcompound.getTagList("pages", 8); + + if (this.bookPages != null) + { + this.bookPages = (NBTTagList)this.bookPages.copy(); + this.bookTotalPages = this.bookPages.tagCount(); + + if (this.bookTotalPages < 1) + { + this.bookTotalPages = 1; + } + } + } + + if (this.bookPages == null && bookIsUnsigned) + { + this.bookPages = new NBTTagList(); + this.bookPages.appendTag(new NBTTagString("")); + this.bookTotalPages = 1; + } + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen(){ + super.updateScreen(); + ++this.updateCount; + } + @Override + public boolean doesGuiPauseGame(){ + return false; + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui(){ + this.buttonList.clear(); + Keyboard.enableRepeatEvents(true); + + if (this.bookIsUnsigned){ + this.buttonList.add(this.buttonSign = new GuiButton(3, this.width / 2 - 100, 4 + this.bookImageHeight, 98, 20, I18n.format("book.signButton", new Object[0]))); + this.buttonList.add(this.buttonDone = new GuiButton(0, this.width / 2 + 2, 4 + this.bookImageHeight, 98, 20, I18n.format("gui.done", new Object[0]))); + this.buttonList.add(this.buttonFinalize = new GuiButton(5, this.width / 2 - 100, 4 + this.bookImageHeight, 98, 20, I18n.format("book.finalizeButton", new Object[0]))); + this.buttonList.add(this.buttonCancel = new GuiButton(4, this.width / 2 + 2, 4 + this.bookImageHeight, 98, 20, I18n.format("gui.cancel", new Object[0]))); + } + else{ + this.buttonList.add(this.buttonDone = new GuiButton(0, this.width / 2 - 100, 4 + this.bookImageHeight, 200, 20, I18n.format("gui.done", new Object[0]))); + } + + int i = (this.width - this.bookImageWidth) / 2; + byte b0 = 2; + this.buttonList.add(this.buttonNextPage = new GuiBook.NextPageButton(1, i + 120, b0 + 154, true)); + this.buttonList.add(this.buttonPreviousPage = new GuiBook.NextPageButton(2, i + 38, b0 + 154, false)); + this.updateButtons(); + } + + /** + * Called when the screen is unloaded. Used to disable keyboard repeat events + */ + public void onGuiClosed(){ + Keyboard.enableRepeatEvents(false); + } + + private void updateButtons(){ + this.buttonNextPage.visible = !this.field_146480_s && (this.currPage < this.bookTotalPages - 1 || this.bookIsUnsigned); + this.buttonPreviousPage.visible = !this.field_146480_s && this.currPage > 0; + this.buttonDone.visible = !this.bookIsUnsigned || !this.field_146480_s; + + if (this.bookIsUnsigned) + { + this.buttonSign.visible = !this.field_146480_s; + this.buttonCancel.visible = this.field_146480_s; + this.buttonFinalize.visible = this.field_146480_s; + this.buttonFinalize.enabled = this.bookTitle.trim().length() > 0; + } + } + + private void sendBookToServer(boolean sign){ + if (this.bookIsUnsigned && this.field_146481_r){ + if (this.bookPages != null){ + + while (this.bookPages.tagCount() > 1){ + String s = this.bookPages.getStringTagAt(this.bookPages.tagCount() - 1); + + if (s.length() != 0) + break; + + this.bookPages.removeTag(this.bookPages.tagCount() - 1); + } + + if (this.bookObj.hasTagCompound()){ + NBTTagCompound nbttagcompound = this.bookObj.getTagCompound(); + nbttagcompound.setTag("pages", this.bookPages); + } + else{ + this.bookObj.setTagInfo("pages", this.bookPages); + } + + if (sign) + { + this.bookObj.setTagInfo("author", new NBTTagString(this.editingPlayer.getCommandSenderName())); + this.bookObj.setTagInfo("title", new NBTTagString(this.bookTitle.trim())); + this.bookObj.func_150996_a(Items.written_book); + } + + NoppesUtilPlayer.sendData(EnumPlayerPacket.SaveBook, x, y, z, sign, bookObj.writeToNBT(new NBTTagCompound())); + + } + } + } + + protected void actionPerformed(GuiButton p_146284_1_){ + if (p_146284_1_.enabled) + { + if (p_146284_1_.id == 0) + { + this.mc.displayGuiScreen((GuiScreen)null); + this.sendBookToServer(false); + } + else if (p_146284_1_.id == 3 && this.bookIsUnsigned) + { + this.field_146480_s = true; + } + else if (p_146284_1_.id == 1) + { + if (this.currPage < this.bookTotalPages - 1) + { + ++this.currPage; + } + else if (this.bookIsUnsigned) + { + this.addNewPage(); + + if (this.currPage < this.bookTotalPages - 1) + { + ++this.currPage; + } + } + } + else if (p_146284_1_.id == 2) + { + if (this.currPage > 0) + { + --this.currPage; + } + } + else if (p_146284_1_.id == 5 && this.field_146480_s) + { + this.sendBookToServer(true); + this.mc.displayGuiScreen((GuiScreen)null); + } + else if (p_146284_1_.id == 4 && this.field_146480_s) + { + this.field_146480_s = false; + } + + this.updateButtons(); + } + } + + private void addNewPage(){ + if (this.bookPages != null && this.bookPages.tagCount() < 50) + { + this.bookPages.appendTag(new NBTTagString("")); + ++this.bookTotalPages; + this.field_146481_r = true; + } + } + + /** + * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). + */ + protected void keyTyped(char par1, int par2){ + super.keyTyped(par1, par2); + + if (this.bookIsUnsigned) + { + if (this.field_146480_s) + { + this.func_146460_c(par1, par2); + } + else + { + this.keyTypedInBook(par1, par2); + } + } + } + + /** + * Processes keystrokes when editing the text of a book + */ + private void keyTypedInBook(char p_146463_1_, int p_146463_2_){ + switch (p_146463_1_) + { + case 22: + this.func_146459_b(GuiScreen.getClipboardString()); + return; + default: + switch (p_146463_2_) + { + case 14: + String s = this.func_146456_p(); + + if (s.length() > 0) + { + this.func_146457_a(s.substring(0, s.length() - 1)); + } + + return; + case 28: + case 156: + this.func_146459_b("\n"); + return; + default: + if (ChatAllowedCharacters.isAllowedCharacter(p_146463_1_)) + { + this.func_146459_b(Character.toString(p_146463_1_)); + } + } + } + } + + private void func_146460_c(char p_146460_1_, int p_146460_2_){ + switch (p_146460_2_) + { + case 14: + if (!this.bookTitle.isEmpty()) + { + this.bookTitle = this.bookTitle.substring(0, this.bookTitle.length() - 1); + this.updateButtons(); + } + + return; + case 28: + case 156: + if (!this.bookTitle.isEmpty()) + { + this.sendBookToServer(true); + this.mc.displayGuiScreen((GuiScreen)null); + } + + return; + default: + if (this.bookTitle.length() < 16 && ChatAllowedCharacters.isAllowedCharacter(p_146460_1_)) + { + this.bookTitle = this.bookTitle + Character.toString(p_146460_1_); + this.updateButtons(); + this.field_146481_r = true; + } + } + } + + private String func_146456_p(){ + return this.bookPages != null && this.currPage >= 0 && this.currPage < this.bookPages.tagCount() ? this.bookPages.getStringTagAt(this.currPage) : ""; + } + + private void func_146457_a(String p_146457_1_){ + if (this.bookPages != null && this.currPage >= 0 && this.currPage < this.bookPages.tagCount()) + { + this.bookPages.func_150304_a(this.currPage, new NBTTagString(p_146457_1_)); + this.field_146481_r = true; + } + } + + private void func_146459_b(String p_146459_1_){ + String s1 = this.func_146456_p(); + String s2 = s1 + p_146459_1_; + int i = this.fontRendererObj.splitStringWidth(s2 + "" + EnumChatFormatting.BLACK + "_", 118); + + if (i <= 118 && s2.length() < 256) + { + this.func_146457_a(s2); + } + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3){ + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(bookGuiTextures); + int k = (this.width - this.bookImageWidth) / 2; + byte b0 = 2; + this.drawTexturedModalRect(k, b0, 0, 0, this.bookImageWidth, this.bookImageHeight); + String s; + String s1; + int l; + + if (this.field_146480_s) + { + s = this.bookTitle; + + if (this.bookIsUnsigned) + { + if (this.updateCount / 6 % 2 == 0) + { + s = s + "" + EnumChatFormatting.BLACK + "_"; + } + else + { + s = s + "" + EnumChatFormatting.GRAY + "_"; + } + } + + s1 = I18n.format("book.editTitle", new Object[0]); + l = this.fontRendererObj.getStringWidth(s1); + this.fontRendererObj.drawString(s1, k + 36 + (116 - l) / 2, b0 + 16 + 16, 0); + int i1 = this.fontRendererObj.getStringWidth(s); + this.fontRendererObj.drawString(s, k + 36 + (116 - i1) / 2, b0 + 48, 0); + String s2 = I18n.format("book.byAuthor", new Object[] {this.editingPlayer.getCommandSenderName()}); + int j1 = this.fontRendererObj.getStringWidth(s2); + this.fontRendererObj.drawString(EnumChatFormatting.DARK_GRAY + s2, k + 36 + (116 - j1) / 2, b0 + 48 + 10, 0); + String s3 = I18n.format("book.finalizeWarning", new Object[0]); + this.fontRendererObj.drawSplitString(s3, k + 36, b0 + 80, 116, 0); + } + else + { + s = I18n.format("book.pageIndicator", new Object[] {Integer.valueOf(this.currPage + 1), Integer.valueOf(this.bookTotalPages)}); + s1 = ""; + + if (this.bookPages != null && this.currPage >= 0 && this.currPage < this.bookPages.tagCount()) + { + s1 = this.bookPages.getStringTagAt(this.currPage); + } + + if (this.bookIsUnsigned) + { + if (this.fontRendererObj.getBidiFlag()) + { + s1 = s1 + "_"; + } + else if (this.updateCount / 6 % 2 == 0) + { + s1 = s1 + "" + EnumChatFormatting.BLACK + "_"; + } + else + { + s1 = s1 + "" + EnumChatFormatting.GRAY + "_"; + } + } + + l = this.fontRendererObj.getStringWidth(s); + this.fontRendererObj.drawString(s, k - l + this.bookImageWidth - 44, b0 + 16, 0); + this.fontRendererObj.drawSplitString(s1, k + 36, b0 + 16 + 16, 116, 0); + } + + super.drawScreen(par1, par2, par3); + } + + @SideOnly(Side.CLIENT) + static class NextPageButton extends GuiButton + { + private final boolean field_146151_o; + private static final String __OBFID = "CL_00000745"; + + public NextPageButton(int par1, int par2, int par3, boolean par4) + { + super(par1, par2, par3, 23, 13, ""); + this.field_146151_o = par4; + } + + /** + * Draws this button to the screen. + */ + public void drawButton(Minecraft p_146112_1_, int p_146112_2_, int p_146112_3_) + { + if (this.visible) + { + 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; + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + p_146112_1_.getTextureManager().bindTexture(GuiBook.bookGuiTextures); + int k = 0; + int l = 192; + + if (flag) + { + k += 23; + } + + if (!this.field_146151_o) + { + l += 13; + } + + this.drawTexturedModalRect(this.xPosition, this.yPosition, k, l, 23, 13); + } + } + } +} \ No newline at end of file diff --git a/src/main/java/noppes/npcs/client/gui/player/GuiCrate.java b/src/main/java/noppes/npcs/client/gui/player/GuiCrate.java new file mode 100644 index 000000000..d5d62d854 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/player/GuiCrate.java @@ -0,0 +1,57 @@ +package noppes.npcs.client.gui.player; + +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.resources.I18n; +import net.minecraft.inventory.ContainerChest; +import net.minecraft.inventory.IInventory; +import net.minecraft.util.ResourceLocation; +import noppes.npcs.client.CustomNpcResourceListener; +import noppes.npcs.containers.ContainerCrate; + +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class GuiCrate extends GuiContainer +{ + private static final ResourceLocation field_147017_u = new ResourceLocation("textures/gui/container/generic_54.png"); + private IInventory upperChestInventory; + private IInventory lowerChestInventory; + /** + * window height is calculated with these values; the more rows, the heigher + */ + private int inventoryRows; + + public GuiCrate(ContainerCrate container) + { + super(container); + this.upperChestInventory = container.upperChestInventory; + this.lowerChestInventory = container.lowerChestInventory; + this.allowUserInput = false; + short short1 = 222; + int i = short1 - 108; + this.inventoryRows = lowerChestInventory.getSizeInventory() / 9; + this.ySize = i + this.inventoryRows * 18; + } + + /** + * Draw the foreground layer for the GuiContainer (everything in front of the items) + */ + protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) + { + this.fontRendererObj.drawString(this.lowerChestInventory.hasCustomInventoryName() ? this.lowerChestInventory.getInventoryName() : I18n.format(this.lowerChestInventory.getInventoryName(), new Object[0]), 8, 6, CustomNpcResourceListener.DefaultTextColor); + this.fontRendererObj.drawString(this.upperChestInventory.hasCustomInventoryName() ? this.upperChestInventory.getInventoryName() : I18n.format(this.upperChestInventory.getInventoryName(), new Object[0]), 8, this.ySize - 96 + 2, CustomNpcResourceListener.DefaultTextColor); + } + + protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(field_147017_u); + int k = (this.width - this.xSize) / 2; + int l = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.inventoryRows * 18 + 17); + this.drawTexturedModalRect(k, l + this.inventoryRows * 18 + 17, 0, 126, this.xSize, 96); + } +} \ No newline at end of file diff --git a/src/main/java/noppes/npcs/client/gui/player/GuiDialogInteract.java b/src/main/java/noppes/npcs/client/gui/player/GuiDialogInteract.java new file mode 100644 index 000000000..b6864bb1d --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/player/GuiDialogInteract.java @@ -0,0 +1,365 @@ +package noppes.npcs.client.gui.player; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.ResourceLocation; +import noppes.npcs.NoppesStringUtils; +import noppes.npcs.NoppesUtilPlayer; +import noppes.npcs.client.ClientProxy; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.TextBlockClient; +import noppes.npcs.client.controllers.MusicController; +import noppes.npcs.client.gui.util.GuiNPCInterface; +import noppes.npcs.client.gui.util.IGuiClose; +import noppes.npcs.constants.EnumOptionType; +import noppes.npcs.constants.EnumPlayerPacket; +import noppes.npcs.controllers.Dialog; +import noppes.npcs.controllers.DialogOption; +import noppes.npcs.entity.EntityNPCInterface; + +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public class GuiDialogInteract extends GuiNPCInterface implements IGuiClose +{ + private Dialog dialog; + private int selected = 0; + private List lines = new ArrayList(); + private List options = new ArrayList(); + private int rowStart = 0; + private int rowTotal = 0; + private int dialogHeight = 180; + + private ResourceLocation wheel; + private ResourceLocation[] wheelparts; + private ResourceLocation indicator; + + private boolean isGrabbed = false; + + public GuiDialogInteract(EntityNPCInterface npc, Dialog dialog){ + super(npc); + this.dialog = dialog; + appendDialog(dialog); + ySize = 238; + + wheel = this.getResource("wheel.png"); + indicator = this.getResource("indicator.png"); + wheelparts = new ResourceLocation[]{getResource("wheel1.png"),getResource("wheel2.png"),getResource("wheel3.png"), + getResource("wheel4.png"),getResource("wheel5.png"),getResource("wheel6.png")}; + } + + public void initGui(){ + super.initGui(); + isGrabbed = false; + grabMouse(dialog.showWheel); + guiTop = (height - ySize); + calculateRowHeight(); + } + + public void grabMouse(boolean grab){ + if(grab && !isGrabbed){ + Minecraft.getMinecraft().mouseHelper.grabMouseCursor(); + isGrabbed = true; + } + else if(!grab && isGrabbed){ + Minecraft.getMinecraft().mouseHelper.ungrabMouseCursor(); + isGrabbed = false; + } + } + + public void drawScreen(int i, int j, float f){ + GL11.glColor4f(1, 1, 1, 1); + + if(!dialog.hideNPC){ + float l = (guiLeft - 70); + float i1 = (guiTop + ySize); + GL11.glEnable(GL11.GL_COLOR_MATERIAL); + GL11.glPushMatrix(); + GL11.glTranslatef(l, i1, 50F); + float zoomed = npc.height; + if(npc.width * 2 > zoomed) + zoomed = npc.width * 2; + zoomed = 2 / zoomed * 40; + GL11.glScalef(-zoomed, zoomed, zoomed); + GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); + float f2 = npc.renderYawOffset; + float f3 = npc.rotationYaw; + float f4 = npc.rotationPitch; + float f7 = npc.rotationYawHead; + float f5 = (float)(l) - i; + float f6 = (float)(i1 - 50) - j; + int rotation = npc.ai.orientation; + npc.ai.orientation = 0; + 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 / 80F) * 20F, 1.0F, 0.0F, 0.0F); + npc.renderYawOffset = 0; + npc.rotationYaw = (float)Math.atan(f5 / 80F) * 40F; + npc.rotationPitch = -(float)Math.atan(f6 / 80F) * 20F; + npc.prevRotationYawHead = npc.rotationYawHead = npc.rotationYaw; + GL11.glTranslatef(0.0F, npc.yOffset, 0.0F); + RenderManager.instance.playerViewY = 180F; + + try{ + RenderManager.instance.renderEntityWithPosYaw(npc, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F); + } + catch(Exception e){ + } + npc.ai.orientation = rotation; + npc.renderYawOffset = f2; + npc.rotationYaw = f3; + npc.rotationPitch = f4; + npc.prevRotationYawHead = npc.rotationYawHead = f7; + GL11.glPopMatrix(); + RenderHelper.disableStandardItemLighting(); + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); + GL11.glDisable(GL11.GL_TEXTURE_2D); + OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); + } + super.drawScreen(i, j, f); + + GL11.glEnable(GL11.GL_BLEND); + OpenGlHelper.glBlendFunc(770, 771, 1, 0); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glPushMatrix(); + GL11.glTranslatef(0.0F, 0.5f, 100.065F); + int count = 0; + for(TextBlockClient block : lines){ + int size = ClientProxy.Font.width(block.getName() + ": "); + drawString(block.getName() + ": ", -4 - size, block.color, count); + for(IChatComponent line : block.lines){ + drawString(line.getFormattedText(), 0, block.color, count); + count++; + } + count++; + } + + if(!options.isEmpty()){ + if(!dialog.showWheel) + drawLinedOptions(j); + else + drawWheel(); + } + GL11.glPopMatrix(); + } + + private int selectedX = 0; + private int selectedY = 0; + private void drawWheel(){ + int yoffset = guiTop + dialogHeight + 14; + GL11.glColor4f(1, 1, 1, 1); + mc.renderEngine.bindTexture(wheel); + drawTexturedModalRect((width/2) - 31, yoffset, 0, 0, 63, 40); + + selectedX += Mouse.getDX(); + selectedY += Mouse.getDY(); + int limit = 80; + if(selectedX > limit) + selectedX = limit; + if(selectedX < -limit) + selectedX = -limit; + + if(selectedY > limit) + selectedY = limit; + if(selectedY < -limit) + selectedY = -limit; + + selected = 1; + if(selectedY < -20) + selected++; + if(selectedY > 54) + selected--; + + if(selectedX < 0) + selected += 3; + mc.renderEngine.bindTexture(wheelparts[selected]); + drawTexturedModalRect((width/2) - 31,yoffset, 0, 0, 85, 55); + for(int slot:dialog.options.keySet()){ + DialogOption option = dialog.options.get(slot); + if(option == null || option.optionType == EnumOptionType.Disabled) + continue; + int color = option.optionColor; + if(slot == (selected)) + color = 0x838FD8; + //drawString(fontRenderer, option.title, width/2 -50 ,yoffset+ 162 + slot * 13 , color); + if(slot == 0) + drawString(fontRendererObj, option.title, width/2 + 13,yoffset - 6 , color); + if(slot == 1) + drawString(fontRendererObj, option.title, width/2 + 33,yoffset + 12 , color); + if(slot == 2) + drawString(fontRendererObj, option.title, width/2 + 27,yoffset + 32 , color); + if(slot == 3) + drawString(fontRendererObj, option.title, width/2 - 13 - ClientProxy.Font.width(option.title),yoffset - 6 , color); + if(slot == 4) + drawString(fontRendererObj, option.title, width/2 - 33 - ClientProxy.Font.width(option.title),yoffset + 12 , color); + if(slot == 5) + drawString(fontRendererObj, option.title, width/2 - 27 - ClientProxy.Font.width(option.title),yoffset + 32 , color); + + } + mc.renderEngine.bindTexture(indicator); + drawTexturedModalRect(width/2 + selectedX/4 - 2,yoffset + 16 - selectedY/6, 0, 0, 8, 8); + } + private void drawLinedOptions(int j){ + drawHorizontalLine(guiLeft - 60, guiLeft + xSize + 120, guiTop + dialogHeight, 0xFFFFFFFF); + int offset = dialogHeight + 4; + if(j >= (int)((guiTop + offset))){ + int selected = (int) ((j - (guiTop + offset)) / (ClientProxy.Font.height())); + if(selected < options.size()) + this.selected = selected; + } + if(selected >= options.size()) + selected = 0; + if(selected < 0) + selected = 0; + int count = 0; + for(int k = 0; k < options.size(); k++){ + int id = options.get(k); + DialogOption option = dialog.options.get(id); + int y = (int)((guiTop + offset + (count * ClientProxy.Font.height()))); + if(selected == k){ + drawString(fontRendererObj, ">", guiLeft - 60, y, 0xe0e0e0); + } + drawString(fontRendererObj, NoppesStringUtils.formatText(option.title, player, npc), guiLeft - 30, y, option.optionColor); + count++; + } + } + + private void drawString(String text, int left, int color, int count){ + int height = count - rowStart; + drawString(fontRendererObj, text, guiLeft + left, guiTop + (height * ClientProxy.Font.height()), color); + } + + public void drawString(FontRenderer fontRendererIn, String text, int x, int y, int color){ + ClientProxy.Font.drawString(text, x, y, color); + //super.drawString(fontRendererIn, text, x, y, color); + } + + private int getSelected(){ + if(selected <= 0) + return 0; + + if(selected < options.size()) + return selected; + + return options.size() - 1; + } + + @Override + public void keyTyped(char c, int i){ + if(i == mc.gameSettings.keyBindForward.getKeyCode() || i == Keyboard.KEY_UP){ + selected--; + } + if(i == mc.gameSettings.keyBindBack.getKeyCode() || i == Keyboard.KEY_DOWN){ + selected++; + } + if(i == 28){ + handleDialogSelection(); + } + if (closeOnEsc && (i == 1 || isInventoryKey(i))){ + NoppesUtilPlayer.sendData(EnumPlayerPacket.Dialog, dialog.id, -1); + closed(); + close(); + } + super.keyTyped(c, i); + } + + @Override + public void mouseClicked(int i,int j,int k){ + if(selected == -1 && options.isEmpty() || selected >= 0) + handleDialogSelection(); + } + private void handleDialogSelection(){ + int optionId = -1; + if(dialog.showWheel) + optionId = selected; + else if(!options.isEmpty()) + optionId = options.get(selected); + NoppesUtilPlayer.sendData(EnumPlayerPacket.Dialog, dialog.id, optionId); + if(dialog == null || !dialog.hasOtherOptions() || options.isEmpty()){ + closed(); + close(); + return; + } + DialogOption option = dialog.options.get(optionId); + if(option == null || option.optionType != EnumOptionType.DialogOption){ + closed(); + close(); + return; + } + + lines.add(new TextBlockClient(player.getDisplayName(), option.title, 280, option.optionColor, player, npc)); + calculateRowHeight(); + + NoppesUtil.clickSound(); + + } + private void closed(){ + grabMouse(false); + NoppesUtilPlayer.sendData(EnumPlayerPacket.CheckQuestCompletion); + } + + public void save() { + + } + + public void appendDialog(Dialog dialog) { + closeOnEsc = !dialog.disableEsc; + this.dialog = dialog; + this.options = new ArrayList(); + + if(dialog.sound != null && !dialog.sound.isEmpty()){ + MusicController.Instance.stopMusic(); + MusicController.Instance.playSound(dialog.sound, (float)npc.posX, (float)npc.posY, (float)npc.posZ); + } + + lines.add(new TextBlockClient(npc, dialog.text, 280, 0xe0e0e0, player, npc)); + + for(int slot:dialog.options.keySet()){ + DialogOption option = dialog.options.get(slot); + if(option == null || option.optionType == EnumOptionType.Disabled) + continue; + options.add(slot); + } + calculateRowHeight(); + + grabMouse(dialog.showWheel); + } + private void calculateRowHeight(){ + if(dialog.showWheel){ + dialogHeight = ySize - 58; + } + else{ + dialogHeight = ySize - 3 * ClientProxy.Font.height() - 4; + if(dialog.options.size() > 3){ + dialogHeight -= (dialog.options.size() - 3) * ClientProxy.Font.height(); + } + } + rowTotal = 0; + for(TextBlockClient block : lines){ + rowTotal += block.lines.size() + 1; + } + int max = dialogHeight / ClientProxy.Font.height(); + + rowStart = rowTotal - max; + if(rowStart < 0) + rowStart = 0; + } + + @Override + public void setClose(int i, NBTTagCompound data) { + grabMouse(false); + } +} + diff --git a/src/main/java/noppes/npcs/client/gui/player/GuiFaction.java b/src/main/java/noppes/npcs/client/gui/player/GuiFaction.java new file mode 100644 index 000000000..8151df430 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/player/GuiFaction.java @@ -0,0 +1,188 @@ +package noppes.npcs.client.gui.player; + +import java.util.ArrayList; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; +import noppes.npcs.NoppesUtilPlayer; +import noppes.npcs.client.CustomNpcResourceListener; +import noppes.npcs.client.gui.util.GuiButtonNextPage; +import noppes.npcs.client.gui.util.GuiNPCInterface; +import noppes.npcs.client.gui.util.IGuiData; +import noppes.npcs.constants.EnumPlayerPacket; +import noppes.npcs.controllers.Faction; +import noppes.npcs.controllers.PlayerFactionData; + +import org.lwjgl.opengl.GL11; + +import tconstruct.client.tabs.InventoryTabFactions; +import tconstruct.client.tabs.TabRegistry; + +public class GuiFaction extends GuiNPCInterface implements IGuiData{ + + private int xSize; + private int ySize; + private int guiLeft; + private int guiTop; + + private ArrayList playerFactions = new ArrayList(); + + private int page = 0; + private int pages = 1; + + private GuiButtonNextPage buttonNextPage; + private GuiButtonNextPage buttonPreviousPage; + private ResourceLocation indicator; + + public GuiFaction() { + super(); + xSize = 200; + ySize = 195; + this.drawDefaultBackground = false; + title = ""; + NoppesUtilPlayer.sendData(EnumPlayerPacket.FactionsGet); + indicator = getResource("standardbg.png"); + } + + @Override + public void initGui() + { + super.initGui(); + guiLeft = (width - xSize) / 2; + guiTop = (height - ySize) / 2 + 12; + + + TabRegistry.updateTabValues(guiLeft, guiTop + 8, InventoryTabFactions.class); + TabRegistry.addTabsToList(buttonList); + + this.buttonList.add(buttonNextPage = new GuiButtonNextPage(1, guiLeft + xSize - 43, guiTop + 180, true)); + this.buttonList.add(buttonPreviousPage = new GuiButtonNextPage(2, guiLeft + 20, guiTop + 180, false)); + updateButtons(); + } + + @Override + public void drawScreen(int i, int j, float f) + { + drawDefaultBackground(); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + mc.renderEngine.bindTexture(indicator); + drawTexturedModalRect(guiLeft, guiTop + 8, 0, 0, xSize, ySize); + drawTexturedModalRect(guiLeft + 4, guiTop + 8, 56, 0, 200, ySize); + + if(playerFactions.isEmpty()){ + String noFaction = StatCollector.translateToLocal("faction.nostanding"); + fontRendererObj.drawString(noFaction,guiLeft + (xSize - fontRendererObj.getStringWidth(noFaction)) / 2,guiTop + 80, CustomNpcResourceListener.DefaultTextColor); + } + else + renderScreen(); + + super.drawScreen(i, j, f); + + } + + private void renderScreen(){ + int size = 5; + if(playerFactions.size() % 5 != 0 && page == pages) + size = playerFactions.size() % 5; + + for(int id = 0 ; id < size; id++){ + drawHorizontalLine(guiLeft + 2, guiLeft + xSize, guiTop + 14 + id * 30, 0xFF000000 + CustomNpcResourceListener.DefaultTextColor); + + Faction faction = playerFactions.get((page - 1) * 5 + id); + String name = faction.name; + String points = " : " + faction.defaultPoints; + + String standing = StatCollector.translateToLocal("faction.friendly"); + int color = 0x00FF00; + if(faction.defaultPoints < faction.neutralPoints){ + standing = StatCollector.translateToLocal("faction.unfriendly"); + color = 0xFF0000; + points += "/" + faction.neutralPoints; + } + else if(faction.defaultPoints < faction.friendlyPoints){ + standing = StatCollector.translateToLocal("faction.neutral"); + color = 0xF2FF00; + points += "/" + faction.friendlyPoints; + } + else{ + points += "/-"; + } + + fontRendererObj.drawString(name, guiLeft + (xSize - fontRendererObj.getStringWidth(name)) / 2, guiTop + 19 + id * 30, faction.color); + + fontRendererObj.drawString(standing, width / 2 - fontRendererObj.getStringWidth(standing) - 1, guiTop + 33 + id * 30, color); + fontRendererObj.drawString(points, width / 2, guiTop + 33 + id * 30, CustomNpcResourceListener.DefaultTextColor); + } + drawHorizontalLine(guiLeft + 2, guiLeft + xSize, guiTop + 14 + size * 30, 0xFF000000 + CustomNpcResourceListener.DefaultTextColor); + + if(pages > 1){ + String s = page +"/" + pages; + fontRendererObj.drawString(s, guiLeft + (xSize - fontRendererObj.getStringWidth(s)) / 2, guiTop + 203, CustomNpcResourceListener.DefaultTextColor); + } + } + + @Override + protected void actionPerformed(GuiButton guibutton){ + if(!(guibutton instanceof GuiButtonNextPage)) + return; + int id = guibutton.id; + if(id == 1){ + page++; + } + if(id == 2){ + page--; + } + updateButtons(); + } + private void updateButtons(){ + buttonNextPage.setVisible(page < pages); + buttonPreviousPage.setVisible(page > 1); + } + protected void drawGuiContainerBackgroundLayer(float f, int i, int j) + { + + } + + @Override + public void keyTyped(char c, int i) + { + if (i == 1 || isInventoryKey(i)) + { + close(); + } + } + @Override + public void save() { + } + @Override + public void setGuiData(NBTTagCompound compound) { + playerFactions = new ArrayList(); + + NBTTagList list = compound.getTagList("FactionList", 10); + for(int i = 0; i < list.tagCount(); i++){ + Faction faction = new Faction(); + faction.readNBT(list.getCompoundTagAt(i)); + playerFactions.add(faction); + } + PlayerFactionData data = new PlayerFactionData(); + data.loadNBTData(compound); + for(int id : data.factionData.keySet()){ + int points = data.factionData.get(id); + for(Faction faction : playerFactions){ + if(faction.id == id) + faction.defaultPoints = points; + } + } + + pages = (playerFactions.size() - 1) / 5 ; + pages++; + + page = 1; + + updateButtons(); + } + +} \ No newline at end of file diff --git a/src/main/java/noppes/npcs/client/gui/player/GuiMailbox.java b/src/main/java/noppes/npcs/client/gui/player/GuiMailbox.java new file mode 100644 index 000000000..a345fd0a0 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/player/GuiMailbox.java @@ -0,0 +1,165 @@ +package noppes.npcs.client.gui.player; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiYesNo; +import net.minecraft.client.gui.GuiYesNoCallback; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.StatCollector; +import noppes.npcs.NoppesUtilPlayer; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.gui.util.GuiCustomScroll; +import noppes.npcs.client.gui.util.GuiNPCInterface; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.ICustomScrollListener; +import noppes.npcs.client.gui.util.IGuiData; +import noppes.npcs.constants.EnumPlayerPacket; +import noppes.npcs.controllers.PlayerMail; +import noppes.npcs.controllers.PlayerMailData; + +public class GuiMailbox extends GuiNPCInterface implements IGuiData, ICustomScrollListener, GuiYesNoCallback{ + + private GuiCustomScroll scroll; + private PlayerMailData data; + private PlayerMail selected; + + public GuiMailbox() { + super(); + xSize = 256; + setBackground("menubg.png"); + NoppesUtilPlayer.sendData(EnumPlayerPacket.MailGet); + } + public void initGui() + { + super.initGui(); + if(scroll == null){ + scroll = new GuiCustomScroll(this,0); + scroll.setSize(165, 186); + } + scroll.guiLeft = guiLeft + 4; + scroll.guiTop = guiTop + 4; + addScroll(scroll); + + String title = StatCollector.translateToLocal("mailbox.name"); + int x = (xSize - this.fontRendererObj.getStringWidth(title)) / 2; + + this.addLabel(new GuiNpcLabel(0, title, guiLeft + x, guiTop - 8)); + + if(selected != null){ + this.addLabel(new GuiNpcLabel(3, StatCollector.translateToLocal("mailbox.sender") + ":", guiLeft + 170, guiTop + 6)); + this.addLabel(new GuiNpcLabel(1, selected.sender, guiLeft + 174, guiTop + 18)); + this.addLabel(new GuiNpcLabel(2, StatCollector.translateToLocalFormatted("mailbox.timesend",getTimePast()), guiLeft + 174, guiTop + 30)); + } + + this.addButton(new GuiNpcButton(0, guiLeft + 4, guiTop + 192,82,20, "mailbox.read")); + this.addButton(new GuiNpcButton(1, guiLeft + 88, guiTop + 192,82,20, "selectWorld.deleteButton")); + getButton(1).setEnabled(selected != null); + } + + private String getTimePast() { + if(selected.timePast > 86400000){ + int days = (int) (selected.timePast / 86400000); + if(days == 1) + return days + " " + StatCollector.translateToLocal("mailbox.day"); + else + return days + " " + StatCollector.translateToLocal("mailbox.days"); + } + if(selected.timePast > 3600000){ + int hours = (int) (selected.timePast / 3600000); + if(hours == 1) + return hours + " " + StatCollector.translateToLocal("mailbox.hour"); + else + return hours + " " + StatCollector.translateToLocal("mailbox.hours"); + } + int minutes = (int) (selected.timePast / 60000); + if(minutes == 1) + return minutes + " " + StatCollector.translateToLocal("mailbox.minutes"); + else + return minutes + " " + StatCollector.translateToLocal("mailbox.minutes"); + } + @Override + public void confirmClicked(boolean flag, int i) + { + if(flag && selected != null){ + NoppesUtilPlayer.sendData(EnumPlayerPacket.MailDelete, selected.time, selected.sender); + selected = null; + } + NoppesUtil.openGUI(player, this); + } + protected void actionPerformed(GuiButton guibutton) + { + int id = guibutton.id; + if(scroll.selected < 0) + return; + if(id == 0){ + GuiMailmanWrite.parent = this; + GuiMailmanWrite.mail = selected; + NoppesUtilPlayer.sendData(EnumPlayerPacket.MailboxOpenMail, selected.time, selected.sender); + selected = null; + scroll.selected = -1; + } + if(id == 1){ + GuiYesNo guiyesno = new GuiYesNo(this, "Confirm", StatCollector.translateToLocal("gui.delete"), 0); + displayGuiScreen(guiyesno); + } + } + + @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() { + // TODO Auto-generated method stub + + } + @Override + public void setGuiData(NBTTagCompound compound) { + PlayerMailData data = new PlayerMailData(); + data.loadNBTData(compound); + + List list = new ArrayList(); + Collections.sort(data.playermail, new Comparator(){ + public int compare(PlayerMail o1, PlayerMail o2){ + if(o1.time == o2.time) + return 0; + return o1.time > o2.time ? -1 : 1; + } + }); + for(PlayerMail mail : data.playermail){ + list.add(mail.subject); + } + + this.data = data; + scroll.clear(); + selected = null; + scroll.setUnsortedList(list); + } + @Override + public void customScrollClicked(int i, int j, int k, + GuiCustomScroll guiCustomScroll) { + selected = data.playermail.get(guiCustomScroll.selected); + initGui(); + + if(selected != null && !selected.beenRead){ + selected.beenRead = true; + NoppesUtilPlayer.sendData(EnumPlayerPacket.MailRead, selected.time, selected.sender); + } + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/player/GuiMailmanWrite.java b/src/main/java/noppes/npcs/client/gui/player/GuiMailmanWrite.java new file mode 100644 index 000000000..369fcd163 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/player/GuiMailmanWrite.java @@ -0,0 +1,408 @@ +package noppes.npcs.client.gui.player; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.GuiYesNo; +import net.minecraft.client.gui.GuiYesNoCallback; +import net.minecraft.client.resources.I18n; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.nbt.NBTTagString; +import net.minecraft.util.ChatAllowedCharacters; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; +import noppes.npcs.NoppesUtilPlayer; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.gui.util.GuiButtonNextPage; +import noppes.npcs.client.gui.util.GuiContainerNPCInterface; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.IGuiClose; +import noppes.npcs.client.gui.util.IGuiError; +import noppes.npcs.client.gui.util.ITextfieldListener; +import noppes.npcs.constants.EnumPlayerPacket; +import noppes.npcs.containers.ContainerMail; +import noppes.npcs.controllers.PlayerMail; + +import org.lwjgl.input.Keyboard; +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class GuiMailmanWrite extends GuiContainerNPCInterface implements ITextfieldListener, IGuiError, IGuiClose, GuiYesNoCallback +{ + private static final ResourceLocation bookGuiTextures = new ResourceLocation("textures/gui/book.png"); + private static final ResourceLocation bookWidgets = new ResourceLocation("textures/gui/widgets.png"); + private static final ResourceLocation bookInventory = new ResourceLocation("textures/gui/container/inventory.png"); + + + /** Update ticks since the gui was opened */ + private int updateCount; + private int bookImageWidth = 192; + private int bookImageHeight = 192; + private int bookTotalPages = 1; + private int currPage; + private NBTTagList bookPages; + private GuiButtonNextPage buttonNextPage; + private GuiButtonNextPage buttonPreviousPage; + + private boolean canEdit; + private boolean canSend; + + /** The GuiButton to sign this book. */ + + public static GuiScreen parent; + public static PlayerMail mail = new PlayerMail(); + + private Minecraft mc = Minecraft.getMinecraft(); + + private String username = ""; + private GuiNpcLabel error; + + public GuiMailmanWrite(ContainerMail container, boolean canEdit, boolean canSend) + { + super(null, container); + title = ""; + this.canEdit = canEdit; + this.canSend = canSend; + + if(mail.message.hasKey("pages")) + this.bookPages = mail.message.getTagList("pages", 8); + + if (this.bookPages != null) + { + this.bookPages = (NBTTagList)this.bookPages.copy(); + this.bookTotalPages = this.bookPages.tagCount(); + + if (this.bookTotalPages < 1) + { + this.bookTotalPages = 1; + } + } + else + { + this.bookPages = new NBTTagList(); + this.bookPages.appendTag(new NBTTagString("")); + this.bookTotalPages = 1; + } + xSize = 360; + ySize = 260; + drawDefaultBackground = false; + closeOnEsc = true; + } + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + super.updateScreen(); + ++this.updateCount; + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + super.initGui(); + this.buttonList.clear(); + Keyboard.enableRepeatEvents(true); + + if(canEdit && !canSend) + addLabel(new GuiNpcLabel(0, "mailbox.sender", guiLeft + 170, guiTop + 32, 0)); + else + addLabel(new GuiNpcLabel(0, "mailbox.username", guiLeft + 170, guiTop + 32, 0)); + + if(canEdit && !canSend) + addTextField(new GuiNpcTextField(2, this, fontRendererObj, guiLeft + 170, guiTop + 42, 114, 20, mail.sender)); + else if(canEdit) + addTextField(new GuiNpcTextField(0, this, fontRendererObj, guiLeft + 170, guiTop + 42, 114, 20, username)); + else + addLabel(new GuiNpcLabel(10, mail.sender, guiLeft + 170, guiTop + 42, 0)); + + addLabel(new GuiNpcLabel(1, "mailbox.subject", guiLeft + 170, guiTop + 72, 0)); + if(canEdit) + addTextField(new GuiNpcTextField(1, this, fontRendererObj, guiLeft + 170, guiTop + 82, 114, 20, mail.subject)); + else + addLabel(new GuiNpcLabel(11, mail.subject, guiLeft + 170, guiTop + 82, 0)); + + addLabel(error = new GuiNpcLabel(2, "", guiLeft + 170, guiTop + 114, 0xFF0000)); + if(canEdit && !canSend) + addButton(new GuiNpcButton(0, this.guiLeft + 200, guiTop + 171, 60, 20, "gui.done")); + else if(canEdit) + addButton(new GuiNpcButton(0, this.guiLeft + 200, guiTop + 171, 60, 20, "mailbox.send")); + + if(!canEdit && !canSend) + addButton(new GuiNpcButton(4, this.guiLeft + 200, guiTop + 171, 60, 20, "selectWorld.deleteButton")); + if(!canEdit || canSend) + addButton(new GuiNpcButton(3, this.guiLeft + 200, guiTop + 194, 60, 20, "gui.cancel")); + + this.buttonList.add(this.buttonNextPage = new GuiButtonNextPage(1, guiLeft + 120, guiTop + 156, true)); + this.buttonList.add(this.buttonPreviousPage = new GuiButtonNextPage(2, guiLeft + 38, guiTop + 156, false)); + this.updateButtons(); + } + + /** + * Called when the screen is unloaded. Used to disable keyboard repeat events + */ + public void onGuiClosed() + { + Keyboard.enableRepeatEvents(false); + } + + private void updateButtons() + { + this.buttonNextPage.setVisible(this.currPage < this.bookTotalPages - 1 || this.canEdit); + this.buttonPreviousPage.setVisible(this.currPage > 0); + } + + @Override + public void confirmClicked(boolean flag, int i) + { + if(flag){ + NoppesUtilPlayer.sendData(EnumPlayerPacket.MailDelete, mail.time, mail.sender); + close(); + } + else + NoppesUtil.openGUI(player, this); + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + @Override + protected void actionPerformed(GuiButton par1GuiButton) + { + if (par1GuiButton.enabled) + { + int id = par1GuiButton.id; + if(id == 0){ + mail.message.setTag("pages", bookPages); + if(canSend) + NoppesUtilPlayer.sendData(EnumPlayerPacket.MailSend, this.username, mail.writeNBT()); + else + close(); + } + if (id == 3) + { + close(); + } + if (id == 4) + { + GuiYesNo guiyesno = new GuiYesNo(this, "Confirm", StatCollector.translateToLocal("gui.delete"), 0); + displayGuiScreen(guiyesno); + } + else if (id == 1) + { + if (this.currPage < this.bookTotalPages - 1) + { + ++this.currPage; + } + else if (this.canEdit) + { + this.addNewPage(); + + if (this.currPage < this.bookTotalPages - 1) + { + ++this.currPage; + } + } + } + else if (id == 2) + { + if (this.currPage > 0) + { + --this.currPage; + } + } + + this.updateButtons(); + } + } + + private void addNewPage() + { + if (this.bookPages != null && this.bookPages.tagCount() < 50) + { + this.bookPages.appendTag(new NBTTagString("")); + ++this.bookTotalPages; + } + } + + /** + * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). + */ + public void keyTyped(char par1, int par2) + { + if(!GuiNpcTextField.isActive() && canEdit) + this.keyTypedInBook(par1, par2); + else + super.keyTyped(par1, par2); + } + + /** + * Processes keystrokes when editing the text of a book + */ + private void keyTypedInBook(char par1, int par2) + { + switch (par1) + { + case 22: + this.func_74160_b(GuiScreen.getClipboardString());//getClipboardString + return; + default: + switch (par2) + { + case 14: + String s = this.func_74158_i(); + + if (s.length() > 0) + { + this.func_74159_a(s.substring(0, s.length() - 1)); + } + + return; + case 28: + case 156: + this.func_74160_b("\n"); + return; + default: + if (ChatAllowedCharacters.isAllowedCharacter(par1)) + { + this.func_74160_b(Character.toString(par1)); + } + } + } + } + + private String func_74158_i() + { + if (this.bookPages != null && this.currPage >= 0 && this.currPage < this.bookPages.tagCount()) + { + return this.bookPages.getStringTagAt(this.currPage); + } + else + { + return ""; + } + } + + private void func_74159_a(String par1Str) + { + if (this.bookPages != null && this.currPage >= 0 && this.currPage < this.bookPages.tagCount()) + { + bookPages.func_150304_a(currPage, new NBTTagString(par1Str)); + } + } + + private void func_74160_b(String par1Str) + { + String s1 = this.func_74158_i(); + String s2 = s1 + par1Str; + int i = mc.fontRenderer.splitStringWidth(s2 + "" + EnumChatFormatting.BLACK + "_", 118); + + if (i <= 118 && s2.length() < 256) + { + this.func_74159_a(s2); + } + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.drawWorldBackground(0); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(bookGuiTextures); + this.drawTexturedModalRect(guiLeft + 130, guiTop + 22, 0, 0, this.bookImageWidth, this.bookImageHeight / 3); + this.drawTexturedModalRect(guiLeft + 130, guiTop + 22 + bookImageHeight/3, 0, bookImageHeight / 2, this.bookImageWidth, this.bookImageHeight / 2); + + this.drawTexturedModalRect(guiLeft, guiTop + 2, 0, 0, this.bookImageWidth, this.bookImageHeight); + + this.mc.getTextureManager().bindTexture(bookInventory); + this.drawTexturedModalRect(guiLeft + 20, guiTop + 173, 0, 82, 180, 55); + this.drawTexturedModalRect(guiLeft + 20, guiTop + 228, 0, 140, 180, 28); + String s; + String s1; + int l; + + s = I18n.format("book.pageIndicator", new Object[] {Integer.valueOf(this.currPage + 1), Integer.valueOf(this.bookTotalPages)}); + s1 = ""; + + if (this.bookPages != null && this.currPage >= 0 && this.currPage < this.bookPages.tagCount()) + { + s1 = this.bookPages.getStringTagAt(this.currPage); + } + + if(canEdit){ + if (mc.fontRenderer.getBidiFlag()) + { + s1 = s1 + "_"; + } + else if (this.updateCount / 6 % 2 == 0) + { + s1 = s1 + "" + EnumChatFormatting.BLACK + "_"; + } + else + { + s1 = s1 + "" + EnumChatFormatting.GRAY + "_"; + } + } + + l = mc.fontRenderer.getStringWidth(s); + mc.fontRenderer.drawString(s, guiLeft - l + this.bookImageWidth - 44, guiTop + 18, 0); + mc.fontRenderer.drawSplitString(s1, guiLeft + 36, guiTop + 18 + 16, 116, 0); + + this.drawGradientRect(guiLeft + 175, guiTop + 136, guiLeft + 269, guiTop + 154, -1072689136, -804253680); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + + + this.mc.getTextureManager().bindTexture(bookWidgets); + for(int i = 0; i < 4; i++) + this.drawTexturedModalRect(guiLeft + 175 + i * 24, guiTop + 134, 0, 22, 24, 24); + + super.drawScreen(par1, par2, par3); + + } + + public void close(){ + mc.displayGuiScreen(parent); + parent = null; + mail = new PlayerMail(); + } + + @Override + public void unFocused(GuiNpcTextField textField) { + if(textField.id == 0) + username = textField.getText(); + if(textField.id == 1) + mail.subject = textField.getText(); + if(textField.id == 2) + mail.sender = textField.getText(); + } + + @Override + public void setError(int i, NBTTagCompound data) { + if(i == 0) + error.label = StatCollector.translateToLocal("mailbox.errorUsername"); + if(i == 1) + error.label = StatCollector.translateToLocal("mailbox.errorSubject"); + } + + @Override + public void setClose(int i, NBTTagCompound data) { + player.addChatMessage(new ChatComponentTranslation("mailbox.succes", data.getString("username"))); + } + + @Override + public void save() { + + } +} diff --git a/src/main/java/noppes/npcs/client/gui/player/GuiNPCBankChest.java b/src/main/java/noppes/npcs/client/gui/player/GuiNPCBankChest.java new file mode 100644 index 000000000..25fafefb9 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/player/GuiNPCBankChest.java @@ -0,0 +1,159 @@ +package noppes.npcs.client.gui.player; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; +import noppes.npcs.NoppesUtilPlayer; +import noppes.npcs.NoppesUtilServer; +import noppes.npcs.client.CustomNpcResourceListener; +import noppes.npcs.client.gui.util.GuiContainerNPCInterface; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.IGuiData; +import noppes.npcs.constants.EnumPlayerPacket; +import noppes.npcs.containers.ContainerNPCBankInterface; +import noppes.npcs.entity.EntityNPCInterface; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public class GuiNPCBankChest extends GuiContainerNPCInterface implements IGuiData +{ + private final ResourceLocation resource = new ResourceLocation("customnpcs","textures/gui/bankchest.png"); + private ContainerNPCBankInterface container; + private int availableSlots = 0; + private int maxSlots = 1; + private int unlockedSlots = 1; + private ItemStack currency; + + public GuiNPCBankChest(EntityNPCInterface npc,ContainerNPCBankInterface container) + { + super(npc,container); + this.container = container; + this.title = ""; + allowUserInput = false; //allowUserInput + ySize = 235; + closeOnEsc = true; + + } + @Override + public void initGui(){ + super.initGui(); + availableSlots = 0; + if(maxSlots > 1){ + for(int i = 0; i < maxSlots ; i++){ + GuiNpcButton button = new GuiNpcButton(i, guiLeft - 50, guiTop + 10 + i * 24, 50, 20, "Tab " + (i+1)); + if( i > unlockedSlots) + button.setEnabled(false); + addButton(button); + availableSlots++; + } + if(availableSlots == 1) + buttonList.clear(); + } + if(!container.isAvailable()){ + addButton(new GuiNpcButton(8, guiLeft + 48, guiTop + 48,80,20, StatCollector.translateToLocal("bank.unlock"))); + } + else if(container.canBeUpgraded()){ + addButton(new GuiNpcButton(9, guiLeft + 48, guiTop + 48,80,20, StatCollector.translateToLocal("bank.upgrade"))); + } + if(maxSlots > 1){ + getButton(container.slot).visible = false; + getButton(container.slot).setEnabled(false); + } + } + @Override + public void actionPerformed(GuiButton guibutton) + { + super.actionPerformed(guibutton); + int id = guibutton.id; + if(id < 6){ + close(); + NoppesUtilPlayer.sendData(EnumPlayerPacket.BankSlotOpen, id, container.bankid); + } + if(id == 8){ + NoppesUtilPlayer.sendData(EnumPlayerPacket.BankUnlock); + } + if(id == 9){ + NoppesUtilPlayer.sendData(EnumPlayerPacket.BankUpgrade); + } + + + } + + @Override + protected void drawGuiContainerBackgroundLayer(float f, int i, int j) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + mc.renderEngine.bindTexture(resource); + int l = (width - xSize) / 2; + int i1 = (height - ySize) / 2; + drawTexturedModalRect(l, i1, 0, 0, xSize, 6); + if(!container.isAvailable()){ + drawTexturedModalRect(l, i1 + 6, 0, 6, xSize, 64); + drawTexturedModalRect(l, i1 + 70, 0, 124, xSize, 222-124); + int x = guiLeft + 30; + int y = guiTop + 8; + fontRendererObj.drawString(StatCollector.translateToLocal("bank.unlockCosts")+":", x , y + 4 , CustomNpcResourceListener.DefaultTextColor); + drawItem(x + 90,y,currency,i,j); + } + else if(container.isUpgraded()){ + drawTexturedModalRect(l, i1 + 60, 0, 60, xSize, 162); + drawTexturedModalRect(l, i1 + 6, 0, 60, xSize, 64); + } + else if(container.canBeUpgraded()){ + drawTexturedModalRect(l, i1 + 6, 0, 6, xSize, 216); + int x = guiLeft + 30; + int y = guiTop + 8; + fontRendererObj.drawString(StatCollector.translateToLocal("bank.upgradeCosts") + ":", x , y + 4 , CustomNpcResourceListener.DefaultTextColor); + drawItem(x + 90,y,currency,i,j); + } + else{ + drawTexturedModalRect(l, i1 + 6, 0, 60, xSize, 162); + } + if(maxSlots > 1){ + for(int ii = 0; ii < maxSlots ; ii++){ + if(availableSlots == ii) + break; + fontRendererObj.drawString("Tab " + (ii+1), guiLeft - 40, guiTop + 16 + ii * 24 , 0xFFFFFF); + } + } + super.drawGuiContainerBackgroundLayer(f, i, j); + } + private void drawItem(int x, int y, ItemStack item, int mouseX, int mouseY){ + if(item == null) + return; + RenderHelper.enableGUIStandardItemLighting(); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glEnable(GL11.GL_COLOR_MATERIAL); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glColor4f(1, 1, 1, 1); + itemRender.renderItemAndEffectIntoGUI(fontRendererObj, mc.renderEngine, item, x,y); + itemRender.renderItemOverlayIntoGUI(fontRendererObj, mc.renderEngine, item, x,y); + + if (this.func_146978_c(x - guiLeft, y - guiTop, 16, 16, mouseX, mouseY)) + { + this.renderToolTip(item, mouseX, mouseY); + } + RenderHelper.disableStandardItemLighting(); + GL11.glColor4f(1, 1, 1, 1); + } + @Override + public void save() { + return; + } + @Override + public void setGuiData(NBTTagCompound compound) { + maxSlots = compound.getInteger("MaxSlots"); + unlockedSlots = compound.getInteger("UnlockedSlots"); + if(compound.hasKey("Currency")) + currency = NoppesUtilServer.readItem(compound.getCompoundTag("Currency")); + else + currency = null; + if(container.currency != null) + container.currency.item = currency; + initGui(); + } +} diff --git a/src/main/java/noppes/npcs/client/gui/player/GuiNPCTrader.java b/src/main/java/noppes/npcs/client/gui/player/GuiNPCTrader.java new file mode 100644 index 000000000..81ffe1346 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/player/GuiNPCTrader.java @@ -0,0 +1,138 @@ +package noppes.npcs.client.gui.player; + +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; +import noppes.npcs.NoppesUtilPlayer; +import noppes.npcs.client.CustomNpcResourceListener; +import noppes.npcs.client.gui.util.GuiContainerNPCInterface; +import noppes.npcs.containers.ContainerNPCTrader; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.RoleTrader; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public class GuiNPCTrader extends GuiContainerNPCInterface{ + private final ResourceLocation resource = new ResourceLocation("customnpcs","textures/gui/trader.png"); + private final ResourceLocation slot = new ResourceLocation("customnpcs","textures/gui/slot.png"); + private RoleTrader role; + private ContainerNPCTrader container; + + public GuiNPCTrader(EntityNPCInterface npc, ContainerNPCTrader container){ + super(npc, container); + this.container = container; + role = (RoleTrader) npc.roleInterface; + closeOnEsc = true; + ySize = 224; + xSize = 223; + this.title = "role.trader"; + } + + @Override + protected void drawGuiContainerBackgroundLayer(float f, int i, int j){ + this.drawWorldBackground(0); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + mc.renderEngine.bindTexture(resource); + drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); + RenderHelper.enableGUIStandardItemLighting(); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glEnable(GL11.GL_COLOR_MATERIAL); + GL11.glEnable(GL11.GL_LIGHTING); + + mc.renderEngine.bindTexture(slot); + for(int slot = 0; slot < 18; slot++){ + int x = guiLeft + slot%3 * 72 + 10; + int y = guiTop + slot/3 * 21 + 6; + + ItemStack item = role.inventoryCurrency.items.get(slot); + ItemStack item2 = role.inventoryCurrency.items.get(slot + 18); + if(item == null){ + item = item2; + item2 = null; + } + if(NoppesUtilPlayer.compareItems(item, item2, false, false)){ + item = item.copy(); + item.stackSize += item2.stackSize; + item2 = null; + } + + ItemStack sold = role.inventorySold.items.get(slot); + GL11.glColor4f(1, 1, 1, 1); + mc.renderEngine.bindTexture(this.slot); + drawTexturedModalRect(x + 42, y, 0, 0, 18, 18); + if(item != null && sold != null){ + RenderHelper.enableGUIStandardItemLighting(); + + if(item2 != null){ + itemRender.renderItemAndEffectIntoGUI(fontRendererObj, mc.renderEngine, item2, x, y + 1); + itemRender.renderItemOverlayIntoGUI(fontRendererObj, mc.renderEngine, item2, x, y + 1); + } + GL11.glColor4f(1, 1, 1, 1); + itemRender.renderItemAndEffectIntoGUI(fontRendererObj, mc.renderEngine, item, x + 18, y + 1); + itemRender.renderItemOverlayIntoGUI(fontRendererObj, mc.renderEngine, item, x + 18, y + 1); + RenderHelper.disableStandardItemLighting(); + + fontRendererObj.drawString("=", x + 36, y + 5, CustomNpcResourceListener.DefaultTextColor); + + } + } + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_DEPTH_TEST); + RenderHelper.enableStandardItemLighting(); + super.drawGuiContainerBackgroundLayer(f, i, j); + } + @Override + protected void drawGuiContainerForegroundLayer(int par1, int par2){ + for(int slot = 0; slot < 18; slot++){ + int x = slot%3 * 72 + 10; + int y = slot/3 * 21 + 6; + + ItemStack item = role.inventoryCurrency.items.get(slot); + ItemStack item2 = role.inventoryCurrency.items.get(slot + 18); + if(item == null){ + item = item2; + item2 = null; + } + if(NoppesUtilPlayer.compareItems(item, item2, role.ignoreDamage, role.ignoreNBT)){ + item = item.copy(); + item.stackSize += item2.stackSize; + item2 = null; + } + ItemStack sold = role.inventorySold.items.get(slot); + if(item == null || sold == null) + continue; + + if(this.func_146978_c(x + 43, y + 1, 16, 16, par1, par2)){ + if(!container.canBuy(slot, player)){ + GL11.glTranslatef(0, 0, 300); + if(item != null && !NoppesUtilPlayer.compareItems(player, item, role.ignoreDamage, role.ignoreNBT)) + this.drawGradientRect(x + 17, y, x + 35, y + 18, 0x70771010, 0x70771010); + if(item2 != null && !NoppesUtilPlayer.compareItems(player, item2, role.ignoreDamage, role.ignoreNBT)) + this.drawGradientRect(x - 1, y, x + 17, y + 18, 0x70771010, 0x70771010); + + String title = StatCollector.translateToLocal("trader.insufficient"); + this.fontRendererObj.drawString(title, (xSize - fontRendererObj.getStringWidth(title))/2, 131, 0xDD0000); + GL11.glTranslatef(0, 0, -300); + } + else{ + String title = StatCollector.translateToLocal("trader.sufficient"); + this.fontRendererObj.drawString(title, (xSize - fontRendererObj.getStringWidth(title))/2, 131, 0x00DD00); + } + } + + if (this.func_146978_c(x, y, 16, 16, par1, par2) && item2 != null){ + this.renderToolTip(item2, par1 - guiLeft, par2 - guiTop); + } + if (this.func_146978_c(x + 18, y, 16, 16, par1, par2)){ + this.renderToolTip(item, par1 - guiLeft, par2 - guiTop); + } + } + } + + @Override + public void save() { + } +} diff --git a/src/main/java/noppes/npcs/client/gui/player/GuiNpcCarpentryBench.java b/src/main/java/noppes/npcs/client/gui/player/GuiNpcCarpentryBench.java new file mode 100644 index 000000000..d4cfc5ca3 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/player/GuiNpcCarpentryBench.java @@ -0,0 +1,61 @@ +package noppes.npcs.client.gui.player; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.resources.I18n; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; +import noppes.npcs.client.CustomNpcResourceListener; +import noppes.npcs.client.gui.util.GuiContainerNPCInterface; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.containers.ContainerCarpentryBench; +import noppes.npcs.controllers.RecipeController; + +import org.lwjgl.opengl.GL11; + +public class GuiNpcCarpentryBench extends GuiContainerNPCInterface +{ + private final ResourceLocation resource = new ResourceLocation("customnpcs","textures/gui/carpentry.png"); + private ContainerCarpentryBench container; + private GuiNpcButton button; + + public GuiNpcCarpentryBench(ContainerCarpentryBench container) + { + super(null,container); + this.container = container; + this.title = ""; + allowUserInput = false;//allowUserInput + closeOnEsc = true; + ySize = 180; + } + @Override + public void initGui(){ + super.initGui(); + addButton(button = new GuiNpcButton(0, guiLeft + 158, guiTop + 4, 12, 20, "...")); + } + + public void buttonEvent(GuiButton guibutton){ + displayGuiScreen(new GuiRecipes()); + } + + @Override + protected void drawGuiContainerBackgroundLayer(float f, int i, int j) + { + button.enabled = RecipeController.instance != null && !RecipeController.instance.anvilRecipes.isEmpty(); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + mc.renderEngine.bindTexture(resource); + int l = (width - xSize) / 2; + int i1 = (height - ySize) / 2; + String title = StatCollector.translateToLocal("tile.npcCarpentyBench.name"); + if(container.getMetadata() >= 4) + title = StatCollector.translateToLocal("tile.anvil.name"); + drawTexturedModalRect(l, i1, 0, 0, xSize, ySize); + super.drawGuiContainerBackgroundLayer(f, i, j); + fontRendererObj.drawString(title, guiLeft + 4 , guiTop + 4 , CustomNpcResourceListener.DefaultTextColor); + fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), guiLeft + 4, guiTop + 87, CustomNpcResourceListener.DefaultTextColor); + } + + @Override + public void save() { + return; + } +} diff --git a/src/main/java/noppes/npcs/client/gui/player/GuiNpcFollower.java b/src/main/java/noppes/npcs/client/gui/player/GuiNpcFollower.java new file mode 100644 index 000000000..acb032a81 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/player/GuiNpcFollower.java @@ -0,0 +1,115 @@ +package noppes.npcs.client.gui.player; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; +import noppes.npcs.NoppesUtilPlayer; +import noppes.npcs.client.CustomNpcResourceListener; +import noppes.npcs.client.gui.util.GuiContainerNPCInterface; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.IGuiData; +import noppes.npcs.constants.EnumPlayerPacket; +import noppes.npcs.containers.ContainerNPCFollower; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.RoleFollower; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public class GuiNpcFollower extends GuiContainerNPCInterface implements IGuiData{ + private final ResourceLocation resource = new ResourceLocation("customnpcs","textures/gui/follower.png"); + private EntityNPCInterface npc; + private RoleFollower role; + + public GuiNpcFollower(EntityNPCInterface npc,ContainerNPCFollower container){ + super(npc, container); + this.npc = npc; + role = (RoleFollower) npc.roleInterface; + closeOnEsc = true; + + NoppesUtilPlayer.sendData(EnumPlayerPacket.RoleGet); + } + @Override + public void initGui(){ + super.initGui(); + buttonList.clear(); + addButton(new GuiNpcButton(4, guiLeft + 100, guiTop+ 110, 50, 20, new String[]{StatCollector.translateToLocal("follower.waiting"),StatCollector.translateToLocal("follower.following")},role.isFollowing?1:0)); + if(!role.infiniteDays) + addButton(new GuiNpcButton(5, guiLeft + 8, guiTop+ 30, 50, 20, StatCollector.translateToLocal("follower.hire"))); + } + @Override + public void actionPerformed(GuiButton guibutton){ + super.actionPerformed(guibutton); + int id = guibutton.id; + if(id == 4){ + NoppesUtilPlayer.sendData(EnumPlayerPacket.FollowerState); + } + if(id == 5){ + NoppesUtilPlayer.sendData(EnumPlayerPacket.FollowerExtend); + } + } + + @Override + protected void drawGuiContainerForegroundLayer(int par1, int par2){ + fontRendererObj.drawString(StatCollector.translateToLocal("follower.health")+": " + npc.getHealth()+"/"+ npc.getMaxHealth(), 62, 70, CustomNpcResourceListener.DefaultTextColor); + if(!role.infiniteDays){ + if(role.getDaysLeft() <= 1) + fontRendererObj.drawString(StatCollector.translateToLocal("follower.daysleft")+": " + StatCollector.translateToLocal("follower.lastday"), 62, 94, CustomNpcResourceListener.DefaultTextColor); + else + fontRendererObj.drawString(StatCollector.translateToLocal("follower.daysleft") + ": " + (role.getDaysLeft()-1), 62, 94, CustomNpcResourceListener.DefaultTextColor); + } + } + + @Override + protected void drawGuiContainerBackgroundLayer(float f, int i, int j){ + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + mc.renderEngine.bindTexture(resource); + int l = guiLeft; + int i1 = guiTop; + drawTexturedModalRect(l, i1, 0, 0, xSize, ySize); + int index = 0; + if(!role.infiniteDays){ + for(int id : role.inventory.items.keySet()){ + ItemStack itemstack = role.inventory.items.get(id); + if(itemstack == null) + continue; + int days = 1; + if(role.rates.containsKey(id)) + days = role.rates.get(id); + + int yOffset = index * 20; + + int x = guiLeft + 68; + int y = guiTop + yOffset + 4; + RenderHelper.enableGUIStandardItemLighting(); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glEnable(GL11.GL_COLOR_MATERIAL); + GL11.glEnable(GL11.GL_LIGHTING); + itemRender.renderItemIntoGUI(fontRendererObj, mc.renderEngine, itemstack, x + 11,y); + itemRender.renderItemOverlayIntoGUI(fontRendererObj, mc.renderEngine, itemstack, x+11,y); + RenderHelper.disableStandardItemLighting(); + GL11.glDisable(32826 /*GL_RESCALE_NORMAL_EXT*/); + + String daysS = days + " " + ((days == 1)?StatCollector.translateToLocal("follower.day"):StatCollector.translateToLocal("follower.days")); + fontRendererObj.drawString(" = "+daysS, x + 27, y + 4, CustomNpcResourceListener.DefaultTextColor); + //fontRenderer.drawString(quantity, x + 0 + (12-fontRenderer.getStringWidth(quantity))/2, y + 4, 0x404040); + + index++; + } + } + this.drawNpc(33, 131); + } + + @Override + public void save() { + + } + @Override + public void setGuiData(NBTTagCompound compound) { + npc.roleInterface.readFromNBT(compound); + initGui(); + } +} diff --git a/src/main/java/noppes/npcs/client/gui/player/GuiNpcFollowerHire.java b/src/main/java/noppes/npcs/client/gui/player/GuiNpcFollowerHire.java new file mode 100644 index 000000000..7d1a1aec8 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/player/GuiNpcFollowerHire.java @@ -0,0 +1,102 @@ +package noppes.npcs.client.gui.player; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; +import noppes.npcs.NoppesUtilPlayer; +import noppes.npcs.client.CustomNpcResourceListener; +import noppes.npcs.client.gui.util.GuiContainerNPCInterface; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.constants.EnumPlayerPacket; +import noppes.npcs.containers.ContainerNPCFollowerHire; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.RoleFollower; + +import org.lwjgl.opengl.GL11; + +public class GuiNpcFollowerHire extends GuiContainerNPCInterface +{ + private final ResourceLocation resource = new ResourceLocation("customnpcs","textures/gui/followerhire.png"); + private EntityNPCInterface npc; + private ContainerNPCFollowerHire container; + private RoleFollower role; + public GuiNpcFollowerHire(EntityNPCInterface npc,ContainerNPCFollowerHire container) + { + super(npc, container); + this.container = container; + this.npc = npc; + role = (RoleFollower) npc.roleInterface; + closeOnEsc = true; + } + public void initGui() + { + super.initGui(); + addButton(new GuiNpcButton(5, guiLeft + 26, guiTop+ 60, 50, 20, StatCollector.translateToLocal("follower.hire"))); + } + + @Override + public void actionPerformed(GuiButton guibutton) + { + super.actionPerformed(guibutton); + if(guibutton.id == 5) + { + NoppesUtilPlayer.sendData(EnumPlayerPacket.FollowerHire); + close(); + } + } + + @Override + protected void drawGuiContainerForegroundLayer(int par1, int par2) + { + //fontRenderer.drawString("Inventory", 8, (ySize - 96) + 2, 0x404040); + } + + @Override + protected void drawGuiContainerBackgroundLayer(float f, int i, int j) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + mc.renderEngine.bindTexture(resource); + int l = (width - xSize) / 2; + int i1 = (height - ySize) / 2; + drawTexturedModalRect(l, i1, 0, 0, xSize, ySize); + int index = 0; + for(int id : role.inventory.items.keySet()){ + ItemStack itemstack = role.inventory.items.get(id); + if(itemstack == null) + continue; + int days = 1; + if(role.rates.containsKey(id)) + days = role.rates.get(id); + + + int yOffset = index * 26; + + int x = guiLeft + 78; + int y = guiTop + yOffset + 10; + GL11.glEnable(32826 /*GL_RESCALE_NORMAL_EXT*/); + RenderHelper.enableGUIStandardItemLighting(); + itemRender.renderItemIntoGUI(fontRendererObj, mc.renderEngine, itemstack, x + 11,y); + itemRender.renderItemOverlayIntoGUI(fontRendererObj, mc.renderEngine, itemstack, x+11,y); + + RenderHelper.disableStandardItemLighting(); + GL11.glDisable(32826 /*GL_RESCALE_NORMAL_EXT*/); + + String daysS = days + " " + ((days == 1)?StatCollector.translateToLocal("follower.day"):StatCollector.translateToLocal("follower.days")); + fontRendererObj.drawString(" = "+daysS, x + 27, y + 4, CustomNpcResourceListener.DefaultTextColor); + //fontRenderer.drawString(quantity, x + 0 + (12-fontRenderer.getStringWidth(quantity))/2, y + 4, 0x404040); + + if (this.func_146978_c(x - guiLeft + 11, y - guiTop, 16, 16, mouseX, mouseY)) + { + this.renderToolTip(itemstack, mouseX, mouseY); + } + index++; + } + + } + @Override + public void save() { + return; + } +} diff --git a/src/main/java/noppes/npcs/client/gui/player/GuiQuestCompletion.java b/src/main/java/noppes/npcs/client/gui/player/GuiQuestCompletion.java new file mode 100644 index 000000000..4e689ac0b --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/player/GuiQuestCompletion.java @@ -0,0 +1,88 @@ +package noppes.npcs.client.gui.player; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; +import noppes.npcs.NoppesStringUtils; +import noppes.npcs.NoppesUtilPlayer; +import noppes.npcs.client.CustomNpcResourceListener; +import noppes.npcs.client.TextBlockClient; +import noppes.npcs.client.gui.util.GuiNPCInterface; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.ITopButtonListener; +import noppes.npcs.constants.EnumPlayerPacket; +import noppes.npcs.controllers.Quest; + +import org.lwjgl.opengl.GL11; + +public class GuiQuestCompletion extends GuiNPCInterface implements ITopButtonListener{ + + private Quest quest; + private final ResourceLocation resource = new ResourceLocation("customnpcs","textures/gui/smallbg.png"); + + public GuiQuestCompletion(Quest quest) { + super(); + xSize = 176; + ySize = 222; + this.quest = quest; + this.drawDefaultBackground = false; + title = ""; + } + public void initGui() + { + super.initGui(); + + String questTitle = quest.title; + int left = (xSize - this.fontRendererObj.getStringWidth(questTitle)) / 2; + this.addLabel(new GuiNpcLabel(0,questTitle, guiLeft + left, guiTop + 4)); + + this.addButton(new GuiNpcButton(0, guiLeft + 38, guiTop + ySize - 24, 100, 20, StatCollector.translateToLocal("quest.complete"))); + } + public void drawScreen(int i, int j, float f) + { + drawDefaultBackground(); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + mc.renderEngine.bindTexture(resource); + drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); + drawHorizontalLine(guiLeft + 4, guiLeft + 170, guiTop + 13, + 0xFF000000 + CustomNpcResourceListener.DefaultTextColor); + + + drawQuestText(); + super.drawScreen(i, j, f); + } + private void drawQuestText(){ + int xoffset = guiLeft + 4; + TextBlockClient block = new TextBlockClient(quest.completeText, 172, true, player); + int yoffset = guiTop + 20; + for(int i = 0; i < block.lines.size(); i++){ + String text = block.lines.get(i).getFormattedText(); + fontRendererObj.drawString(text, guiLeft + 4, guiTop + 16 + (i * fontRendererObj.FONT_HEIGHT), CustomNpcResourceListener.DefaultTextColor); + } + } + @Override + protected void actionPerformed(GuiButton guibutton) + { + if(guibutton.id == 0){ + NoppesUtilPlayer.sendData(EnumPlayerPacket.QuestCompletion, quest.id); + close(); + } + } + protected void drawGuiContainerBackgroundLayer(float f, int i, int j) + { + + } + + @Override + public void keyTyped(char c, int i) + { + if (i == 1 || isInventoryKey(i)){ + close(); + } + } + @Override + public void save() { + NoppesUtilPlayer.sendData(EnumPlayerPacket.QuestCompletion, quest.id); + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/player/GuiQuestLog.java b/src/main/java/noppes/npcs/client/gui/player/GuiQuestLog.java new file mode 100644 index 000000000..9f7ea6341 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/player/GuiQuestLog.java @@ -0,0 +1,244 @@ +package noppes.npcs.client.gui.player; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; +import noppes.npcs.NoppesUtilPlayer; +import noppes.npcs.QuestLogData; +import noppes.npcs.client.CustomNpcResourceListener; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.TextBlockClient; +import noppes.npcs.client.gui.util.GuiButtonNextPage; +import noppes.npcs.client.gui.util.GuiCustomScroll; +import noppes.npcs.client.gui.util.GuiMenuSideButton; +import noppes.npcs.client.gui.util.GuiNPCInterface; +import noppes.npcs.client.gui.util.ICustomScrollListener; +import noppes.npcs.client.gui.util.IGuiData; +import noppes.npcs.client.gui.util.ITopButtonListener; +import noppes.npcs.constants.EnumPlayerPacket; + +import org.lwjgl.opengl.GL11; + +import tconstruct.client.tabs.InventoryTabQuests; +import tconstruct.client.tabs.TabRegistry; + +public class GuiQuestLog extends GuiNPCInterface implements ITopButtonListener,ICustomScrollListener, IGuiData{ + + private final ResourceLocation resource = new ResourceLocation("customnpcs","textures/gui/standardbg.png"); + + private EntityPlayer player; + private GuiCustomScroll scroll; + private HashMap sideButtons = new HashMap(); + private QuestLogData data = new QuestLogData(); + private boolean noQuests = false; + private boolean questDetails = true; + + private Minecraft mc = Minecraft.getMinecraft(); + + public GuiQuestLog(EntityPlayer player) { + super(); + this.player = player; + xSize = 280; + ySize = 180; + NoppesUtilPlayer.sendData(EnumPlayerPacket.QuestLog); + drawDefaultBackground = false; + } + public void initGui(){ + super.initGui(); + sideButtons.clear(); + guiTop +=10; + + TabRegistry.addTabsToList(buttonList); + TabRegistry.updateTabValues(guiLeft, guiTop, InventoryTabQuests.class); + + noQuests = false; + + if(data.categories.isEmpty()){ + noQuests = true; + return; + } + List categories = new ArrayList(); + categories.addAll(data.categories.keySet()); + Collections.sort(categories,String.CASE_INSENSITIVE_ORDER); + int i = 0; + for(String category : categories){ + if(data.selectedCategory.isEmpty()) + data.selectedCategory = category; + sideButtons.put(i, new GuiMenuSideButton(i,guiLeft - 69, this.guiTop +2 + i*21, 70,22, category)); + i++; + } + sideButtons.get(categories.indexOf(data.selectedCategory)).active = true; + + if(scroll == null) + scroll = new GuiCustomScroll(this,0); + + scroll.setList(data.categories.get(data.selectedCategory)); + scroll.setSize(134, 174); + scroll.guiLeft = guiLeft + 5; + scroll.guiTop = guiTop + 15; + addScroll(scroll); + + addButton(new GuiButtonNextPage(1, guiLeft + 286, guiTop + 176, true)); + addButton(new GuiButtonNextPage(2, guiLeft + 144, guiTop + 176, false)); + + getButton(1).visible = questDetails && data.hasSelectedQuest(); + getButton(2).visible = !questDetails && data.hasSelectedQuest(); + } + @Override + protected void actionPerformed(GuiButton guibutton){ + if(!(guibutton instanceof GuiButtonNextPage)) + return; + if(guibutton.id == 1){ + questDetails = false; + initGui(); + } + if(guibutton.id == 2){ + questDetails = true; + initGui(); + } + } + @Override + public void drawScreen(int i, int j, float f){ + if(scroll != null) + scroll.visible = !noQuests; + drawDefaultBackground(); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + mc.renderEngine.bindTexture(resource); + drawTexturedModalRect(guiLeft, guiTop, 0, 0, 252, 195); + drawTexturedModalRect(guiLeft + 252, guiTop, 188, 0, 67, 195); + super.drawScreen(i, j, f); + + if(noQuests){ + mc.fontRenderer.drawString(StatCollector.translateToLocal("quest.noquests"),guiLeft + 84,guiTop + 80, CustomNpcResourceListener.DefaultTextColor); + return; + } + for(GuiMenuSideButton button: sideButtons.values().toArray(new GuiMenuSideButton[sideButtons.size()])){ + button.drawButton(mc, i, j); + } + mc.fontRenderer.drawString(data.selectedCategory,guiLeft + 5,guiTop + 5, CustomNpcResourceListener.DefaultTextColor); + + if(!data.hasSelectedQuest()) + return; + + if(questDetails){ + drawProgress(); + String title = StatCollector.translateToLocal("gui.text"); + mc.fontRenderer.drawString(title, guiLeft + 284 - mc.fontRenderer.getStringWidth(title), guiTop + 179, CustomNpcResourceListener.DefaultTextColor); + } + else{ + drawQuestText(); + String title = StatCollector.translateToLocal("quest.objectives"); + mc.fontRenderer.drawString(title, guiLeft + 168, guiTop + 179, CustomNpcResourceListener.DefaultTextColor); + } + + GL11.glPushMatrix(); + GL11.glTranslatef(guiLeft + 148, guiTop, 0); + GL11.glScalef(1.24f, 1.24f, 1.24f); + fontRendererObj.drawString(data.selectedQuest, (130 - fontRendererObj.getStringWidth(data.selectedQuest)) / 2, 4, CustomNpcResourceListener.DefaultTextColor); + GL11.glPopMatrix(); + drawHorizontalLine(guiLeft + 142, guiLeft + 312, guiTop + 17, + 0xFF000000 + CustomNpcResourceListener.DefaultTextColor); + } + + private void drawQuestText(){ + TextBlockClient block = new TextBlockClient(data.getQuestText(), 174, true, player); + int yoffset = guiTop + 5; + for(int i = 0; i < block.lines.size(); i++){ + String text = block.lines.get(i).getFormattedText(); + fontRendererObj.drawString(text, guiLeft + 142, guiTop + 20 + (i * fontRendererObj.FONT_HEIGHT), CustomNpcResourceListener.DefaultTextColor); + } + } + + private void drawProgress() { + String complete = data.getComplete(); + if(complete != null && !complete.isEmpty()) + mc.fontRenderer.drawString(StatCollector.translateToLocalFormatted("quest.completewith", complete), guiLeft + 144, guiTop + 105, CustomNpcResourceListener.DefaultTextColor); + + int yoffset = guiTop + 22; + for(String process : data.getQuestStatus()){ + int index = process.lastIndexOf(":"); + if(index > 0){ + String name = process.substring(0, index); + String trans = StatCollector.translateToLocal(name); + if(!trans.equals(name)) + name = trans; + trans = StatCollector.translateToLocal("entity." + name + ".name"); + if(!trans.equals("entity." + name + ".name")){ + name = trans; + } + process = name + process.substring(index); + } + mc.fontRenderer.drawString("- " + process, guiLeft + 144, yoffset , CustomNpcResourceListener.DefaultTextColor); + yoffset += 10; + } + } + + protected void drawGuiContainerBackgroundLayer(float f, int i, int j) + { + } + @Override + public void mouseClicked(int i, int j, int k) + { + super.mouseClicked(i, j, k); + if (k == 0){ + if(scroll != null) + scroll.mouseClicked(i, j, k); + for (GuiMenuSideButton button : new ArrayList(sideButtons.values())){ + if (button.mousePressed(mc, i, j)){ + sideButtonPressed(button); + } + } + } + } + private void sideButtonPressed(GuiMenuSideButton button) { + if(button.active) + return; + NoppesUtil.clickSound(); + data.selectedCategory = button.displayString; + data.selectedQuest = ""; + this.initGui(); + } + @Override + public void customScrollClicked(int i, int j, int k, GuiCustomScroll scroll) { + if(!scroll.hasSelected()) + return; + data.selectedQuest = scroll.getSelected(); + initGui(); + } + + @Override + public void keyTyped(char c, int i) + { + if (i == 1 || i == mc.gameSettings.keyBindInventory.getKeyCode()) // inventory key + { + mc.displayGuiScreen(null); + mc.setIngameFocus(); + } + } + + @Override + public boolean doesGuiPauseGame() + { + return false; + } + @Override + public void setGuiData(NBTTagCompound compound) { + QuestLogData data = new QuestLogData(); + data.readNBT(compound); + this.data = data; + initGui(); + } + @Override + public void save() { + // TODO Auto-generated method stub + + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/player/GuiRecipes.java b/src/main/java/noppes/npcs/client/gui/player/GuiRecipes.java new file mode 100644 index 000000000..f41060706 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/player/GuiRecipes.java @@ -0,0 +1,161 @@ +package noppes.npcs.client.gui.player; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import noppes.npcs.client.gui.util.GuiButtonNextPage; +import noppes.npcs.client.gui.util.GuiNPCInterface; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.controllers.RecipeCarpentry; +import noppes.npcs.controllers.RecipeController; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class GuiRecipes extends GuiNPCInterface +{ + private static final ResourceLocation resource = new ResourceLocation("customnpcs","textures/gui/slot.png"); + private int page = 0; + private boolean npcRecipes = true; + private GuiNpcLabel label; + private GuiNpcButton left, right; + private List recipes = new ArrayList(); + + public GuiRecipes(){ + this.ySize = 182; + this.xSize = 256; + setBackground("recipes.png"); + this.closeOnEsc = true; + recipes.addAll(RecipeController.instance.anvilRecipes.values()); + } + @Override + public void initGui(){ + super.initGui(); + + addLabel(new GuiNpcLabel(0, "Recipe List", guiLeft + 5, guiTop + 5)); + addLabel(label = new GuiNpcLabel(1, "", guiLeft + 5, guiTop + 168)); + + addButton(this.left = new GuiButtonNextPage(1, guiLeft + 150, guiTop + 164, true)); + addButton(this.right = new GuiButtonNextPage(2, guiLeft + 80, guiTop + 164, false)); + + updateButton(); + } + private void updateButton(){ + right.visible = right.enabled = page > 0; + left.visible = left.enabled = page + 1 < MathHelper.ceiling_float_int(recipes.size() / 4f); + } + + protected void actionPerformed(GuiButton button){ + if(!button.enabled) + return; + + if(button == right) + page--; + if(button == left) + page++; + updateButton(); + } + + @Override + public void drawScreen(int xMouse, int yMouse, float f){ + super.drawScreen(xMouse, yMouse, f); + mc.renderEngine.bindTexture(resource); + + label.label = page + 1 + "/" + MathHelper.ceiling_float_int(recipes.size() / 4f); + label.x = guiLeft + (256 - Minecraft.getMinecraft().fontRenderer.getStringWidth(label.label)) / 2; + for(int i = 0; i < 4; i++){ + int index = i + page * 4; + if(index >= recipes.size()) + break; + IRecipe irecipe = recipes.get(index); + if(irecipe.getRecipeOutput() == null) + continue; + int x = guiLeft + 5 + i / 2 * 126; + int y = guiTop + 15 + i % 2 * 76; + drawItem(irecipe.getRecipeOutput(), x + 98, y + 28, xMouse, yMouse); + if(irecipe instanceof RecipeCarpentry){ + RecipeCarpentry recipe = (RecipeCarpentry) irecipe; + x += (72 - recipe.recipeWidth * 18) / 2; + y += (72 - recipe.recipeHeight * 18) / 2; + for(int j = 0; j < recipe.recipeWidth; j++){ + for(int k = 0; k < recipe.recipeHeight; k++){ + mc.renderEngine.bindTexture(resource); + GL11.glColor4f(1, 1, 1, 1); + drawTexturedModalRect(x + j * 18, y + k * 18, 0, 0, 18, 18); + ItemStack item = recipe.getCraftingItem(j + k * recipe.recipeWidth); + if(item == null) + continue; + drawItem(item, x + j * 18 + 1, y + k * 18 + 1, xMouse, yMouse); + } + } + } + } + for(int i = 0; i < 4; i++){ + int index = i + page * 4; + if(index >= recipes.size()) + break; + IRecipe irecipe = recipes.get(index); + if(irecipe instanceof RecipeCarpentry){ + RecipeCarpentry recipe = (RecipeCarpentry) irecipe; + if(recipe.getRecipeOutput() == null) + continue; + int x = guiLeft + 5 + i / 2 * 126; + int y = guiTop + 15 + i % 2 * 76; + drawOverlay(recipe.getRecipeOutput(), x + 98, y + 22, xMouse, yMouse); + x += (72 - recipe.recipeWidth * 18) / 2; + y += (72 - recipe.recipeHeight * 18) / 2; + for(int j = 0; j < recipe.recipeWidth; j++){ + for(int k = 0; k < recipe.recipeHeight; k++){ + ItemStack item = recipe.getCraftingItem(j + k * recipe.recipeWidth); + if(item == null) + continue; + drawOverlay(item, x + j * 18 + 1, y + k * 18 + 1, xMouse, yMouse); + } + } + } + } + } + + private void drawItem(ItemStack item, int x, int y, int xMouse, int yMouse){ + GL11.glPushMatrix(); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + RenderHelper.enableGUIStandardItemLighting(); + itemRender.zLevel = 100.0F; + itemRender.renderItemAndEffectIntoGUI(fontRendererObj, mc.renderEngine, item, x, y); + itemRender.renderItemOverlayIntoGUI(fontRendererObj, mc.renderEngine, item, x, y); + itemRender.zLevel = 0.0F; + RenderHelper.disableStandardItemLighting(); + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + GL11.glPopMatrix(); + } + + private void drawOverlay(ItemStack item, int x, int y, int xMouse, int yMouse){ + if (this.func_146978_c(x - guiLeft, y - guiTop, 16, 16, xMouse, yMouse)){ + this.renderToolTip(item, xMouse, yMouse); + } + } + protected boolean func_146978_c(int p_146978_1_, int p_146978_2_, int p_146978_3_, int p_146978_4_, int p_146978_5_, int p_146978_6_) + { + int k1 = this.guiLeft; + int l1 = this.guiTop; + p_146978_5_ -= k1; + p_146978_6_ -= l1; + return p_146978_5_ >= p_146978_1_ - 1 && p_146978_5_ < p_146978_1_ + p_146978_3_ + 1 && p_146978_6_ >= p_146978_2_ - 1 && p_146978_6_ < p_146978_2_ + p_146978_4_ + 1; + } + + @Override + public void save() { + } +} \ No newline at end of file diff --git a/src/main/java/noppes/npcs/client/gui/player/GuiTransportSelection.java b/src/main/java/noppes/npcs/client/gui/player/GuiTransportSelection.java new file mode 100644 index 000000000..0b102bd21 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/player/GuiTransportSelection.java @@ -0,0 +1,105 @@ +package noppes.npcs.client.gui.player; + +import java.util.HashMap; +import java.util.Vector; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; +import noppes.npcs.NoppesUtilPlayer; +import noppes.npcs.client.gui.util.GuiCustomScroll; +import noppes.npcs.client.gui.util.GuiNPCInterface; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.ITopButtonListener; +import noppes.npcs.client.gui.util.IScrollData; +import noppes.npcs.constants.EnumPlayerPacket; +import noppes.npcs.entity.EntityNPCInterface; + +import org.lwjgl.opengl.GL11; + +public class GuiTransportSelection extends GuiNPCInterface implements ITopButtonListener,IScrollData{ + + private final ResourceLocation resource = new ResourceLocation("customnpcs","textures/gui/smallbg.png"); + protected int xSize; + protected int guiLeft; + protected int guiTop; + + private GuiCustomScroll scroll; + + public GuiTransportSelection(EntityNPCInterface npc) { + super(npc); + xSize = 176; + this.drawDefaultBackground = false; + title = ""; + } + public void initGui() + { + super.initGui(); + guiLeft = (width - xSize) / 2; + guiTop = (height - 222) / 2; + //String name = "Location: " + npc.getDataWatcher().getWatchableObjectString(11); + String name = ""; + addLabel(new GuiNpcLabel(0,name, guiLeft + (xSize - this.fontRendererObj.getStringWidth(name))/2, guiTop + 10)); + addButton(new GuiNpcButton(0, guiLeft+ 10, guiTop + 192,156,20, StatCollector.translateToLocal("transporter.travel"))); + if(scroll == null) + scroll = new GuiCustomScroll(this,0); + scroll.setSize(156, 165); + scroll.guiLeft = guiLeft + 10; + scroll.guiTop = guiTop + 20; + addScroll(scroll); + } + + @Override + public void drawScreen(int i, int j, float f) + { + drawDefaultBackground(); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + mc.renderEngine.bindTexture(resource); + drawTexturedModalRect(guiLeft, guiTop, 0, 0, 176, 222); + super.drawScreen(i, j, f); + } + + @Override + protected void actionPerformed(GuiButton guibutton) + { + GuiNpcButton button = (GuiNpcButton) guibutton; + String sel = scroll.getSelected(); + if(button.id == 0 && sel != null){ + close(); + NoppesUtilPlayer.sendData(EnumPlayerPacket.Transport,sel); + } + } +// @Override +// 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); + } + @Override + public void keyTyped(char c, int i) + { + if (i == 1 || isInventoryKey(i)) + { + close(); + } + } + + @Override + public void save() { + } + @Override + public void setData(Vector list, HashMap data) { + scroll.setList(list); + } + @Override + public void setSelected(String selected) { + // TODO Auto-generated method stub + + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/player/companion/GuiNpcCompanionInv.java b/src/main/java/noppes/npcs/client/gui/player/companion/GuiNpcCompanionInv.java new file mode 100644 index 000000000..f4dec90c3 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/player/companion/GuiNpcCompanionInv.java @@ -0,0 +1,96 @@ +package noppes.npcs.client.gui.player.companion; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import noppes.npcs.CustomItems; +import noppes.npcs.CustomNpcs; +import noppes.npcs.client.gui.util.GuiContainerNPCInterface; +import noppes.npcs.client.gui.util.GuiMenuTopIconButton; +import noppes.npcs.constants.EnumCompanionJobs; +import noppes.npcs.constants.EnumCompanionTalent; +import noppes.npcs.constants.EnumGuiType; +import noppes.npcs.containers.ContainerNPCCompanion; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.RoleCompanion; + +import org.lwjgl.opengl.GL11; + +public class GuiNpcCompanionInv extends GuiContainerNPCInterface{ + private final ResourceLocation resource = new ResourceLocation("customnpcs", "textures/gui/companioninv.png"); + private final ResourceLocation slot = new ResourceLocation("customnpcs", "textures/gui/slot.png"); + private EntityNPCInterface npc; + private RoleCompanion role; + + public GuiNpcCompanionInv(EntityNPCInterface npc, + ContainerNPCCompanion container) { + super(npc, container); + this.npc = npc; + role = (RoleCompanion) npc.roleInterface; + closeOnEsc = true; + xSize = 171; + ySize = 166; + } + + @Override + public void initGui() { + super.initGui(); + GuiNpcCompanionStats.addTopMenu(role, this, 3); + + } + + @Override + public void actionPerformed(GuiButton guibutton) { + super.actionPerformed(guibutton); + int id = guibutton.id; + if(id == 1){ + CustomNpcs.proxy.openGui(npc, EnumGuiType.Companion); + } + if(id == 2){ + CustomNpcs.proxy.openGui(npc, EnumGuiType.CompanionTalent); + } + } + + @Override + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + + } + + @Override + protected void drawGuiContainerBackgroundLayer(float f, int xMouse, int yMouse) { + this.drawWorldBackground(0); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + mc.renderEngine.bindTexture(resource); + drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); + mc.renderEngine.bindTexture(slot); + if(role.getTalentLevel(EnumCompanionTalent.ARMOR) > 0){ + for(int i = 0; i < 4; i++){ + drawTexturedModalRect(guiLeft + 5, guiTop + 7 + i * 18 , 0, 0, 18, 18); + } + } + if(role.getTalentLevel(EnumCompanionTalent.SWORD) > 0){ + drawTexturedModalRect(guiLeft + 78, guiTop + 16, 0, npc.inventory.weapons.get(0) == null?18:0, 18, 18); + } + if(role.getTalentLevel(EnumCompanionTalent.RANGED) > 0){ + + } + if(role.talents.containsKey(EnumCompanionTalent.INVENTORY)){ + int size = (role.getTalentLevel(EnumCompanionTalent.INVENTORY) + 1) * 2; + for(int i = 0; i < size; i++){ + drawTexturedModalRect(guiLeft + 113 + i % 3 * 18, guiTop + 7 + i / 3 * 18 , 0, 0, 18, 18); + } + } + + super.drawNpc(52, 70); + } + + @Override + public void drawScreen(int i, int j, float f) { + super.drawScreen(i, j, f); + } + + @Override + public void save() { + + } +} diff --git a/src/main/java/noppes/npcs/client/gui/player/companion/GuiNpcCompanionStats.java b/src/main/java/noppes/npcs/client/gui/player/companion/GuiNpcCompanionStats.java new file mode 100644 index 000000000..125e6a14d --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/player/companion/GuiNpcCompanionStats.java @@ -0,0 +1,165 @@ +package noppes.npcs.client.gui.player.companion; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.MathHelper; +import noppes.npcs.CustomItems; +import noppes.npcs.CustomNpcs; +import noppes.npcs.NoppesStringUtils; +import noppes.npcs.NoppesUtilPlayer; +import noppes.npcs.client.gui.util.GuiContainerNPCInterface; +import noppes.npcs.client.gui.util.GuiMenuTopIconButton; +import noppes.npcs.client.gui.util.GuiNPCInterface; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.IGuiData; +import noppes.npcs.constants.EnumCompanionJobs; +import noppes.npcs.constants.EnumCompanionTalent; +import noppes.npcs.constants.EnumGuiType; +import noppes.npcs.constants.EnumPlayerPacket; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.RoleCompanion; + +public class GuiNpcCompanionStats extends GuiNPCInterface implements IGuiData { + private RoleCompanion role; + private boolean isEating = false; + + public GuiNpcCompanionStats(EntityNPCInterface npc) { + super(npc); + role = (RoleCompanion) npc.roleInterface; + closeOnEsc = true; + setBackground("companion.png"); + xSize = 171; + ySize = 166; + NoppesUtilPlayer.sendData(EnumPlayerPacket.RoleGet); + } + + @Override + public void initGui() { + super.initGui(); + int y = guiTop + 10; + addLabel(new GuiNpcLabel(0, NoppesStringUtils.translate("gui.name", ": ",npc.display.name), guiLeft + 4, y)); + addLabel(new GuiNpcLabel(1, NoppesStringUtils.translate("companion.owner", ": ",role.ownerName), guiLeft + 4, y+=12)); + addLabel(new GuiNpcLabel(2, NoppesStringUtils.translate("companion.age", ": ", role.ticksActive / 18000 + " (", role.stage.name, ")" ), guiLeft + 4, y+=12)); + addLabel(new GuiNpcLabel(3, NoppesStringUtils.translate("companion.strength", ": ", npc.stats.getAttackStrength()), guiLeft + 4, y+=12)); + addLabel(new GuiNpcLabel(4, NoppesStringUtils.translate("companion.level", ": ", role.getTotalLevel()), guiLeft + 4, y+=12)); + addLabel(new GuiNpcLabel(5, NoppesStringUtils.translate("job.name", ": ", "gui.none"), guiLeft + 4, y+=12)); + + addTopMenu(role, this, 1); + + } + + public static void addTopMenu(RoleCompanion role, GuiScreen screen, int active){ + if(screen instanceof GuiNPCInterface){ + GuiNPCInterface gui = (GuiNPCInterface) screen; + GuiMenuTopIconButton button; + gui.addTopButton(button = new GuiMenuTopIconButton(1, gui.guiLeft + 4, gui.guiTop - 27, "menu.stats", new ItemStack(CustomItems.letter))); + gui.addTopButton(button = new GuiMenuTopIconButton(2, button, "companion.talent", new ItemStack(CustomItems.spellHoly))); + if(role.hasInv()) + gui.addTopButton(button = new GuiMenuTopIconButton(3, button, "inv.inventory", new ItemStack(CustomItems.bag))); + if(role.job != EnumCompanionJobs.NONE) + gui.addTopButton(new GuiMenuTopIconButton(4, button, "job.name", new ItemStack(CustomItems.bag))); + gui.getTopButton(active).active = true; + } + if(screen instanceof GuiContainerNPCInterface){ + GuiContainerNPCInterface gui = (GuiContainerNPCInterface) screen; + GuiMenuTopIconButton button; + gui.addTopButton(button = new GuiMenuTopIconButton(1, gui.guiLeft + 4, gui.guiTop - 27, "menu.stats", new ItemStack(CustomItems.letter))); + gui.addTopButton(button = new GuiMenuTopIconButton(2, button, "companion.talent", new ItemStack(CustomItems.spellHoly))); + if(role.hasInv()) + gui.addTopButton(button = new GuiMenuTopIconButton(3, button, "inv.inventory", new ItemStack(CustomItems.bag))); + if(role.job != EnumCompanionJobs.NONE) + gui.addTopButton(new GuiMenuTopIconButton(4, button, "job.name", new ItemStack(CustomItems.bag))); + gui.getTopButton(active).active = true; + } + } + + @Override + public void actionPerformed(GuiButton guibutton) { + super.actionPerformed(guibutton); + int id = guibutton.id; + if(id == 2){ + CustomNpcs.proxy.openGui(npc, EnumGuiType.CompanionTalent); + } + if(id == 3){ + NoppesUtilPlayer.sendData(EnumPlayerPacket.CompanionOpenInv); + } + } + + @Override + public void drawScreen(int i, int j, float f) { + super.drawScreen(i, j, f); + if(isEating && !role.isEating()){ + NoppesUtilPlayer.sendData(EnumPlayerPacket.RoleGet); + } + + isEating = role.isEating(); + super.drawNpc(34, 150); + int y = drawHealth(guiTop + 88); + } + + private int drawHealth(int y){ + this.mc.getTextureManager().bindTexture(icons); + + int max = role.getTotalArmorValue(); + if(role.talents.containsKey(EnumCompanionTalent.ARMOR) || max > 0){ + for (int i = 0; i < 10; ++i){ + int x = guiLeft + 66 + i * 10; + + if (i * 2 + 1 < max){ + this.drawTexturedModalRect(x, y, 34, 9, 9, 9); + } + + if (i * 2 + 1 == max){ + this.drawTexturedModalRect(x, y, 25, 9, 9, 9); + } + + if (i * 2 + 1 > max){ + this.drawTexturedModalRect(x, y, 16, 9, 9, 9); + } + + } + y += 10; + } + + max = MathHelper.ceiling_float_int(npc.getMaxHealth()); + int k = (int)npc.getHealth(); + float scale = 1; + if(max > 40){ + scale = max / 40f; + k = (int) (k / scale); + max = 40; + } + for(int i = 0; i < max; i++){ + int x = guiLeft + 66 + i % 20 * 5; + int offset = i / 20 * 10; + this.drawTexturedModalRect(x, y + offset, 52 + i % 2 * 5, 9, i % 2 == 1?4:5, 9); + if(k > i) + this.drawTexturedModalRect(x, y + offset, 52 + i % 2 * 5, 0, i % 2 == 1?4:5, 9); + } + + k = role.foodstats.getFoodLevel(); + y += 10; + if(max > 20) + y += 10; + + for(int i = 0; i < 20; i++){ + int x = guiLeft + 66 + i % 20 * 5; + this.drawTexturedModalRect(x, y, 16 + i % 2 * 5, 27, i % 2 == 1?4:5, 9); + if(k > i) + this.drawTexturedModalRect(x, y, 52 + i % 2 * 5, 27, i % 2 == 1?4:5, 9); + } + return y; + } + + @Override + public void save() { + + } + + @Override + public void setGuiData(NBTTagCompound compound) { + role.readFromNBT(compound); + } +} diff --git a/src/main/java/noppes/npcs/client/gui/player/companion/GuiNpcCompanionTalents.java b/src/main/java/noppes/npcs/client/gui/player/companion/GuiNpcCompanionTalents.java new file mode 100644 index 000000000..5d4a66ac4 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/player/companion/GuiNpcCompanionTalents.java @@ -0,0 +1,192 @@ +package noppes.npcs.client.gui.player.companion; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import noppes.npcs.CustomNpcs; +import noppes.npcs.NoppesStringUtils; +import noppes.npcs.NoppesUtilPlayer; +import noppes.npcs.client.CustomNpcResourceListener; +import noppes.npcs.client.gui.util.GuiNPCInterface; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.constants.EnumCompanionTalent; +import noppes.npcs.constants.EnumGuiType; +import noppes.npcs.constants.EnumPlayerPacket; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.RoleCompanion; + +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public class GuiNpcCompanionTalents extends GuiNPCInterface{ + private RoleCompanion role; + private Map talents = new HashMap(); + private GuiNpcButton selected; + + public GuiNpcCompanionTalents(EntityNPCInterface npc) { + super(npc); + role = (RoleCompanion) npc.roleInterface; + closeOnEsc = true; + setBackground("companion_empty.png"); + xSize = 171; + ySize = 166; + } + + @Override + public void initGui() { + super.initGui(); + talents.clear(); + int y = guiTop + 12; + + addLabel(new GuiNpcLabel(0, NoppesStringUtils.translate("quest.exp", ": "), guiLeft + 4, guiTop + 10)); + + GuiNpcCompanionStats.addTopMenu(role, this, 2); + int i = 0; + for(EnumCompanionTalent e : role.talents.keySet()){ + addTalent(i++, e); + } + } + + private void addTalent(int i, EnumCompanionTalent talent){ + int y = guiTop + 28 + i/2 * 26; + int x = guiLeft + 4 + i % 2 * 84; + talents.put(i, new GuiTalent(role, talent, x, y)); + if(role.getTalentLevel(talent) < 5){ + addButton(new GuiNpcButton(i + 10, x + 26, y, 14, 14, "+")); + y += 8; + } + addLabel(new GuiNpcLabel(i, role.talents.get(talent) + "/" + role.getNextLevel(talent), x + 26, y + 8)); + } + + @Override + public void actionPerformed(GuiButton guibutton) { + super.actionPerformed(guibutton); + int id = guibutton.id; + if(id == 1){ + CustomNpcs.proxy.openGui(npc, EnumGuiType.Companion); + } + if(id == 3){ + NoppesUtilPlayer.sendData(EnumPlayerPacket.CompanionOpenInv); + } + if(id >= 10){ + selected = (GuiNpcButton) guibutton; + lastPressedTime = startPressedTime = mc.theWorld.getWorldTime(); + addExperience(1); + } + } + + private void addExperience(int exp){ + EnumCompanionTalent talent = talents.get(selected.id - 10).talent; + if(!role.canAddExp(-exp) && role.currentExp <= 0) + return; + if(exp > role.currentExp) + exp = role.currentExp; + NoppesUtilPlayer.sendData(EnumPlayerPacket.CompanionTalentExp, talent.ordinal(), exp); + role.talents.put(talent, role.talents.get(talent) + exp); + role.addExp(-exp); + getLabel(selected.id - 10).label = role.talents.get(talent) + "/" + role.getNextLevel(talent); + } + + private long lastPressedTime = 0; + private long startPressedTime = 0; + @Override + public void drawScreen(int i, int j, float f) { + super.drawScreen(i, j, f); + if(selected != null && mc.theWorld.getWorldTime() - startPressedTime > 4 && lastPressedTime < mc.theWorld.getWorldTime() && mc.theWorld.getWorldTime() % 4 == 0){ + if(selected.mousePressed(mc, i, j) && Mouse.isButtonDown(0)){ + lastPressedTime = mc.theWorld.getWorldTime(); + if(lastPressedTime - startPressedTime < 20) + addExperience(1); + else if(lastPressedTime - startPressedTime < 40) + addExperience(2); + else if(lastPressedTime - startPressedTime < 60) + addExperience(4); + else if(lastPressedTime - startPressedTime < 90) + addExperience(8); + else if(lastPressedTime - startPressedTime < 140) + addExperience(14); + else + addExperience(28); + } + else{ + lastPressedTime = 0; + selected = null; + } + } + + mc.getTextureManager().bindTexture(Gui.icons); + this.drawTexturedModalRect(guiLeft + 4, guiTop + 20, 10, 64, 162, 5); + + if (role.currentExp > 0){ + float v = 1f * role.currentExp / role.getMaxExp(); + if(v > 1) + v = 1; + this.drawTexturedModalRect(guiLeft + 4, guiTop + 20, 10, 69, (int)(v * 162), 5); + } + String s = role.currentExp + "\\" + role.getMaxExp(); + mc.fontRenderer.drawString(s, guiLeft + xSize / 2 - mc.fontRenderer.getStringWidth(s) / 2, guiTop + 10, CustomNpcResourceListener.DefaultTextColor); + + for(GuiTalent talent : talents.values()){ + talent.drawScreen(i, j, f); + } + } + + @Override + public void save() { + + } + + public static class GuiTalent extends GuiScreen{ + private EnumCompanionTalent talent; + private int x, y; + private RoleCompanion role; + private static final ResourceLocation resource = new ResourceLocation("customnpcs:textures/gui/talent.png"); + public GuiTalent(RoleCompanion role, EnumCompanionTalent talent, int x, int y){ + this.talent = talent; + this.x = x; + this.y = y; + this.role = role; + } + + @Override + public void drawScreen(int i, int j, float f) { + Minecraft mc = Minecraft.getMinecraft(); + mc.getTextureManager().bindTexture(resource); + + ItemStack item = talent.item; + if(item.getItem() == null) + item = new ItemStack(Blocks.dirt); + GL11.glPushMatrix(); + GL11.glColor3f(1F, 1F, 1F); + GL11.glEnable(GL11.GL_BLEND); + boolean hover = x < i && x + 24 > i && y < j && y + 24 > j; + this.drawTexturedModalRect(x, y, 0, hover?24:0, 24, 24); + this.zLevel = 100.0F; + itemRender.zLevel = 100.0F; + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + RenderHelper.enableGUIStandardItemLighting(); + itemRender.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.getTextureManager(), item, x + 4, y + 4); + itemRender.renderItemOverlayIntoGUI(mc.fontRenderer, mc.getTextureManager(), item, x + 4, y + 4); + RenderHelper.disableStandardItemLighting(); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glTranslatef(0, 0, 200); + this.drawCenteredString(mc.fontRenderer, role.getTalentLevel(talent) + "", x + 20, y + 16, 0xFFFFFF); + itemRender.zLevel = 0.0F; + this.zLevel = 0.0F; + GL11.glPopMatrix(); + } + } +} diff --git a/src/main/java/noppes/npcs/client/gui/questtypes/GuiNpcQuestTypeDialog.java b/src/main/java/noppes/npcs/client/gui/questtypes/GuiNpcQuestTypeDialog.java new file mode 100644 index 000000000..1f0b321b9 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/questtypes/GuiNpcQuestTypeDialog.java @@ -0,0 +1,108 @@ +package noppes.npcs.client.gui.questtypes; + +import java.util.HashMap; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.client.Client; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.gui.GuiNPCDialogSelection; +import noppes.npcs.client.gui.util.GuiNPCInterface; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiSelectionListener; +import noppes.npcs.client.gui.util.IGuiData; +import noppes.npcs.client.gui.util.SubGuiInterface; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.controllers.Quest; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.quests.QuestDialog; + +public class GuiNpcQuestTypeDialog extends SubGuiInterface implements GuiSelectionListener, IGuiData +{ + private GuiScreen parent; + + private QuestDialog quest; + + private HashMap data = new HashMap(); + + public GuiNpcQuestTypeDialog(EntityNPCInterface npc, Quest q, GuiScreen parent) { + this.npc = npc; + this.parent = parent; + title = "Quest Dialog Setup"; + + quest = (QuestDialog) q.questInterface; + + setBackground("menubg.png"); + xSize = 256; + ySize = 216; + closeOnEsc = true; + Client.sendData(EnumPacketServer.QuestDialogGetTitle, + quest.dialogs.containsKey(0)?quest.dialogs.get(0):-1, + quest.dialogs.containsKey(1)?quest.dialogs.get(1):-1, + quest.dialogs.containsKey(2)?quest.dialogs.get(2):-1); + } + + public void initGui() { + super.initGui(); + for (int i = 0; i < 3; i++) { + String title = "dialog.selectoption"; + if(data.containsKey(i)) + title = data.get(i); + this.addButton(new GuiNpcButton(i + 9, guiLeft + 10, 55 + i * 22, 20, 20, "X")); + this.addButton(new GuiNpcButton(i + 3, guiLeft + 34, 55 + i * 22, 210, 20, title)); + + } + this.addButton(new GuiNpcButton(0, guiLeft + 150, guiTop + 190, 98, 20, "gui.back")); + + } + + private int selectedSlot; + protected void actionPerformed(GuiButton guibutton) { + GuiNpcButton button = (GuiNpcButton) guibutton; + if (button.id == 0) { + close(); + } + if (button.id >= 3 && button.id < 9) { + selectedSlot = button.id - 3; + int id = -1; + if(quest.dialogs.containsKey(selectedSlot)) + id = quest.dialogs.get(selectedSlot); + GuiNPCDialogSelection gui = new GuiNPCDialogSelection(npc, parent, id); + gui.listener = this; + NoppesUtil.openGUI(player, gui); + } + if (button.id >= 9 && button.id < 15) { + int slot = button.id - 9; + quest.dialogs.remove(slot); + data.remove(slot); + save(); + initGui(); + } + } + + public void save() { + } + + @Override + public void selected(int id, String name) { + quest.dialogs.put(selectedSlot, id); + data.put(selectedSlot, name); + } + + @Override + public void setGuiData(NBTTagCompound compound) { + data.clear(); + if(compound.hasKey("1")){ + data.put(0, compound.getString("1")); + } + if(compound.hasKey("2")){ + data.put(1, compound.getString("2")); + } + if(compound.hasKey("3")){ + data.put(2, compound.getString("3")); + } + initGui(); + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/questtypes/GuiNpcQuestTypeItem.java b/src/main/java/noppes/npcs/client/gui/questtypes/GuiNpcQuestTypeItem.java new file mode 100644 index 000000000..7b2ef8221 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/questtypes/GuiNpcQuestTypeItem.java @@ -0,0 +1,90 @@ +package noppes.npcs.client.gui.questtypes; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.util.ResourceLocation; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.gui.global.GuiNPCManageQuest; +import noppes.npcs.client.gui.util.GuiContainerNPCInterface; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcButtonYesNo; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.ITextfieldListener; +import noppes.npcs.containers.ContainerNpcQuestTypeItem; +import noppes.npcs.controllers.Quest; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.quests.QuestItem; + +import org.lwjgl.opengl.GL11; + +public class GuiNpcQuestTypeItem extends GuiContainerNPCInterface implements ITextfieldListener +{ + private Quest quest; + private static final ResourceLocation field_110422_t = new ResourceLocation("customnpcs","textures/gui/followersetup.png"); + public GuiNpcQuestTypeItem(EntityNPCInterface npc,ContainerNpcQuestTypeItem container){ + super(npc,container); + this.quest = GuiNPCManageQuest.quest; + title = ""; + ySize = 202; + closeOnEsc = false; + } + + @Override + public void initGui(){ + super.initGui(); + addLabel(new GuiNpcLabel(0, "quest.takeitems", guiLeft + 4, guiTop + 8)); + addButton(new GuiNpcButton(0, guiLeft + 90, guiTop + 3, 60, 20, new String[]{ "gui.yes","gui.no"}, ((QuestItem)quest.questInterface).leaveItems?1:0)); + + addLabel(new GuiNpcLabel(1, "gui.ignoreDamage", guiLeft + 4, guiTop + 29)); + addButton(new GuiNpcButtonYesNo(1, guiLeft + 90, guiTop + 24, 50, 20, ((QuestItem)quest.questInterface).ignoreDamage)); + + addLabel(new GuiNpcLabel(2, "gui.ignoreNBT", guiLeft + 62, guiTop + 51)); + addButton(new GuiNpcButtonYesNo(2, guiLeft + 120, guiTop + 46, 50, 20, ((QuestItem)quest.questInterface).ignoreNBT)); + + addButton(new GuiNpcButton(5, guiLeft, guiTop + ySize, 98, 20, "gui.back")); + } + + @Override + public void actionPerformed(GuiButton guibutton){ + if(guibutton.id == 0){ + ((QuestItem)quest.questInterface).leaveItems = ((GuiNpcButton)guibutton).getValue() == 1; + } + if(guibutton.id == 1){ + ((QuestItem)quest.questInterface).ignoreDamage = ((GuiNpcButtonYesNo)guibutton).getBoolean(); + } + if(guibutton.id == 2){ + ((QuestItem)quest.questInterface).ignoreNBT = ((GuiNpcButtonYesNo)guibutton).getBoolean(); + } + if(guibutton.id == 5){ + NoppesUtil.openGUI(player,GuiNPCManageQuest.Instance); + } + } + + @Override + protected void drawGuiContainerBackgroundLayer(float f, int i, int j) + { + this.drawWorldBackground(0); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + mc.renderEngine.bindTexture(field_110422_t); + int l = (width - xSize) / 2; + int i1 = (height - ySize) / 2; + drawTexturedModalRect(l, i1, 0, 0, xSize, ySize); + super.drawGuiContainerBackgroundLayer(f, i, j); + } + + @Override + public void save() { +// HashMap map = new HashMap(); +// for(int i= 0;i < container.invMatrix.getSizeInventory();i++){ +// ItemStack item = container.invMatrix.getStackInSlot(i); +// if(item != null) +// map.put(i, item.copy()); +// } +// ((QuestItem)quest.questInterface).items = map; +// QuestController.saveQuest(quest); + } + @Override + public void unFocused(GuiNpcTextField textfield) { + quest.rewardExp = textfield.getInteger(); + } +} diff --git a/src/main/java/noppes/npcs/client/gui/questtypes/GuiNpcQuestTypeKill.java b/src/main/java/noppes/npcs/client/gui/questtypes/GuiNpcQuestTypeKill.java new file mode 100644 index 000000000..201b177d9 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/questtypes/GuiNpcQuestTypeKill.java @@ -0,0 +1,129 @@ +package noppes.npcs.client.gui.questtypes; + +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.entity.EntityList; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.world.World; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.gui.util.GuiCustomScroll; +import noppes.npcs.client.gui.util.ICustomScrollListener; +import noppes.npcs.client.gui.util.GuiNPCInterface; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.ITextfieldListener; +import noppes.npcs.client.gui.util.SubGuiInterface; +import noppes.npcs.controllers.Quest; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.quests.QuestKill; + +public class GuiNpcQuestTypeKill extends SubGuiInterface implements ITextfieldListener, ICustomScrollListener +{ + private GuiScreen parent; + private GuiCustomScroll scroll; + + private QuestKill quest; + + private GuiNpcTextField lastSelected; + + public GuiNpcQuestTypeKill(EntityNPCInterface npc, Quest q, GuiScreen parent) { + this.npc = npc; + this.parent = parent; + title = "Quest Kill Setup"; + + quest = (QuestKill) q.questInterface; + + setBackground("menubg.png"); + xSize = 356; + ySize = 216; + closeOnEsc = true; + } + + public void initGui() { + super.initGui(); + int i = 0; + addLabel(new GuiNpcLabel(0, "You can fill in npc or player names too", guiLeft + 4, guiTop + 50)); + for (String name : quest.targets.keySet()) { + this.addTextField(new GuiNpcTextField(i, this, fontRendererObj, guiLeft + 4, guiTop + 70 + i * 22, 180, 20, name)); + this.addTextField(new GuiNpcTextField(i + 3, this, fontRendererObj, guiLeft + 186, guiTop + 70 + i * 22, 24, 20, quest.targets.get(name) + "")); + this.getTextField(i+3).numbersOnly = true; + this.getTextField(i+3).setMinMaxDefault(1, Integer.MAX_VALUE, 1); + i++; + } + + for(;i < 3; i++){ + this.addTextField(new GuiNpcTextField(i, this, fontRendererObj, guiLeft + 4, guiTop + 70 + i * 22, 180, 20, "")); + this.addTextField(new GuiNpcTextField(i + 3, this, fontRendererObj, guiLeft + 186, guiTop + 70 + i * 22, 24, 20, "1")); + this.getTextField(i+3).numbersOnly = true; + this.getTextField(i+3).setMinMaxDefault(1, Integer.MAX_VALUE, 1); + } + Map data = EntityList.stringToClassMapping; + ArrayList list = new ArrayList(); + for(Object name : data.keySet()){ + Class c = (Class) data.get(name); + try { + if(EntityLivingBase.class.isAssignableFrom(c) && !EntityNPCInterface.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) { + } + } + if(scroll == null) + scroll = new GuiCustomScroll(this,0); + scroll.setList(list); + scroll.setSize(130, 198); + scroll.guiLeft = guiLeft + 220; + scroll.guiTop = guiTop + 14; + addScroll(scroll); + this.addButton(new GuiNpcButton(0, guiLeft + 4, guiTop + 140, 98, 20, "gui.back")); + + scroll.visible = GuiNpcTextField.isActive(); + } + + protected void actionPerformed(GuiButton guibutton) { + super.actionPerformed(guibutton); + if (guibutton.id == 0) { + close(); + } + } + public void mouseClicked(int i, int j, int k) + { + super.mouseClicked(i, j, k); + scroll.visible = GuiNpcTextField.isActive(); + } + public void save() { + } + + @Override + public void unFocused(GuiNpcTextField guiNpcTextField) { + if(guiNpcTextField.id < 3) + lastSelected = guiNpcTextField; + + saveTargets(); + } + private void saveTargets(){ + HashMap map = new HashMap(); + for(int i = 0; i< 3; i++){ + String name = getTextField(i).getText(); + if(name.isEmpty()) + continue; + map.put(name, getTextField(i+3).getInteger()); + } + quest.targets = map; + } + @Override + public void customScrollClicked(int i, int j, int k, GuiCustomScroll guiCustomScroll) { + if(lastSelected == null) + return; + lastSelected.setText(guiCustomScroll.getSelected()); + saveTargets(); + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/questtypes/GuiNpcQuestTypeLocation.java b/src/main/java/noppes/npcs/client/gui/questtypes/GuiNpcQuestTypeLocation.java new file mode 100644 index 000000000..04c6c66cf --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/questtypes/GuiNpcQuestTypeLocation.java @@ -0,0 +1,65 @@ +package noppes.npcs.client.gui.questtypes; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.ITextfieldListener; +import noppes.npcs.client.gui.util.SubGuiInterface; +import noppes.npcs.controllers.Quest; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.quests.QuestLocation; + +public class GuiNpcQuestTypeLocation extends SubGuiInterface implements ITextfieldListener +{ + private GuiScreen parent; + + private QuestLocation quest; + + public GuiNpcQuestTypeLocation(EntityNPCInterface npc, Quest q, + GuiScreen parent) { + this.npc = npc; + this.parent = parent; + title = "Quest Location Setup"; + + quest = (QuestLocation) q.questInterface; + + setBackground("menubg.png"); + xSize = 256; + ySize = 216; + closeOnEsc = true; + } + + public void initGui() { + super.initGui(); + + addLabel(new GuiNpcLabel(0, "Fill in the name of your Location Quest Block", guiLeft + 4, guiTop + 50)); + this.addTextField(new GuiNpcTextField(0, this, fontRendererObj, guiLeft + 4, guiTop + 70, 180, 20, quest.location)); + this.addTextField(new GuiNpcTextField(1, this, fontRendererObj, guiLeft + 4, guiTop + 92, 180, 20, quest.location2)); + this.addTextField(new GuiNpcTextField(2, this, fontRendererObj, guiLeft + 4, guiTop + 114, 180, 20, quest.location3)); + this.addButton(new GuiNpcButton(0, guiLeft + 150, guiTop + 190, 98, 20, "gui.back")); + } + + protected void actionPerformed(GuiButton guibutton) { + super.actionPerformed(guibutton); + if (guibutton.id == 0) { + close(); + } + } + + public void save() { + } + + @Override + public void unFocused(GuiNpcTextField textfield) { + if(textfield.id == 0) + quest.location = textfield.getText(); + if(textfield.id == 1) + quest.location2 = textfield.getText(); + if(textfield.id == 2) + quest.location3 = textfield.getText(); + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/roles/GuiNpcBankSetup.java b/src/main/java/noppes/npcs/client/gui/roles/GuiNpcBankSetup.java new file mode 100644 index 000000000..14dd9ccb5 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/roles/GuiNpcBankSetup.java @@ -0,0 +1,85 @@ +package noppes.npcs.client.gui.roles; + +import java.util.HashMap; +import java.util.Vector; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.client.Client; +import noppes.npcs.client.gui.util.GuiCustomScroll; +import noppes.npcs.client.gui.util.ICustomScrollListener; +import noppes.npcs.client.gui.util.GuiNPCInterface2; +import noppes.npcs.client.gui.util.IScrollData; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.controllers.Bank; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.RoleBank; + + +public class GuiNpcBankSetup extends GuiNPCInterface2 implements IScrollData,ICustomScrollListener +{ + private GuiCustomScroll scroll; + private HashMap data = new HashMap(); + private RoleBank role; + + public GuiNpcBankSetup(EntityNPCInterface npc) + { + super(npc); + Client.sendData(EnumPacketServer.BanksGet); + role = (RoleBank) npc.roleInterface; + } + + public void initGui() + { + super.initGui(); + if(scroll == null) + scroll = new GuiCustomScroll(this,0); + scroll.setSize(200, 152); + scroll.guiLeft = guiLeft + 85; + scroll.guiTop = guiTop + 20; + addScroll(scroll); + } + + protected void actionPerformed(GuiButton guibutton) + { + } + + @Override + public void setData(Vector list, HashMap data) + { + String name = null; + Bank bank = role.getBank(); + if(bank != null) + name = bank.name; + this.data = data; + scroll.setList(list); + + if(name != null) + setSelected(name); + } + + public void mouseClicked(int i, int j, int k) + { + super.mouseClicked(i, j, k); + if(k == 0 && scroll != null) + scroll.mouseClicked(i, j, k); + } + + @Override + public void setSelected(String selected) { + scroll.setSelected(selected); + } + + @Override + public void customScrollClicked(int i, int j, int k, GuiCustomScroll guiCustomScroll) { + if(guiCustomScroll.id == 0) + { + role.bankId = data.get(scroll.getSelected()); + save(); + } + } + + public void save() { + Client.sendData(EnumPacketServer.RoleSave, role.writeToNBT(new NBTTagCompound())); + } +} diff --git a/src/main/java/noppes/npcs/client/gui/roles/GuiNpcBard.java b/src/main/java/noppes/npcs/client/gui/roles/GuiNpcBard.java new file mode 100644 index 000000000..3414870fc --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/roles/GuiNpcBard.java @@ -0,0 +1,108 @@ +package noppes.npcs.client.gui.roles; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.client.Client; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.controllers.MusicController; +import noppes.npcs.client.gui.GuiNpcSoundSelection; +import noppes.npcs.client.gui.util.GuiNPCInterface2; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.JobBard; + +public class GuiNpcBard extends GuiNPCInterface2 +{ + private JobBard job; + private GuiNpcSoundSelection gui; + + public GuiNpcBard(EntityNPCInterface npc) + { + super(npc); + job = (JobBard) npc.jobInterface; + } + + public void initGui() + { + super.initGui(); + + this.addButton(new GuiNpcButton(1, guiLeft + 55, guiTop + 15,20,20, "X")); + addLabel(new GuiNpcLabel(0,job.song, guiLeft + 80, guiTop + 20)); + this.addButton(new GuiNpcButton(0, guiLeft + 75, guiTop + 50, "gui.selectSound")); + + this.addButton(new GuiNpcButton(2, guiLeft + 75, guiTop + 71, new String[]{"gui.none","item.npcBanjo.name","item.npcViolin.name","item.npcGuitar.name","item.npcHarp.name","item.npcFrenchHorn.name"}, job.getInstrument().ordinal())); + this.addButton(new GuiNpcButton(3, guiLeft + 75, guiTop + 92, new String[]{"bard.jukebox","bard.background"}, job.isStreamer?0:1)); + + + addLabel(new GuiNpcLabel(2,"bard.ondistance", guiLeft + 60, guiTop + 143)); + addTextField(new GuiNpcTextField(2,this, this.fontRendererObj, guiLeft+160, guiTop + 138, 40, 20, job.minRange + "")); + getTextField(2).numbersOnly = true; + getTextField(2).setMinMaxDefault(2, 64, 5); + + addLabel(new GuiNpcLabel(4,"bard.hasoff", guiLeft + 60, guiTop + 166)); + addButton(new GuiNpcButton(4, guiLeft + 160, guiTop + 161, 60, 20, new String[]{"gui.no","gui.yes"}, job.hasOffRange?1:0)); + + addLabel(new GuiNpcLabel(3,"bard.offdistance", guiLeft + 60, guiTop + 189)); + addTextField(new GuiNpcTextField(3,this, this.fontRendererObj, guiLeft+160, guiTop + 184, 40, 20, job.maxRange + "")); + getTextField(3).numbersOnly = true; + getTextField(3).setMinMaxDefault(2, 64, 10); + + getLabel(3).enabled = job.hasOffRange; + getTextField(3).enabled = job.hasOffRange; + + } + @Override + public void elementClicked(){ + job.song = gui.getSelected(); + } + + protected void actionPerformed(GuiButton guibutton) + { + GuiNpcButton button = (GuiNpcButton) guibutton; + if(button.id == 0) + { + gui = new GuiNpcSoundSelection(npc, this, job.song); + NoppesUtil.openGUI(player, gui); + job.song = ""; + MusicController.Instance.stopMusic(); + } + if(button.id == 1) + { + job.song = ""; + getLabel(0).label = ""; + MusicController.Instance.stopMusic(); + } + if(button.id == 2) + { + job.setInstrument(button.getValue()); + } + if(button.id == 3) + { + job.isStreamer = button.getValue() == 0; + initGui(); + } + if(button.id == 4) + { + job.hasOffRange = button.getValue() == 1; + initGui(); + } + + } + + @Override + public void save() { + job.minRange = getTextField(2).getInteger(); + job.maxRange = getTextField(3).getInteger(); + + if(job.minRange > job.maxRange) + job.maxRange = job.minRange; + + MusicController.Instance.stopMusic(); + Client.sendData(EnumPacketServer.JobSave, job.writeToNBT(new NBTTagCompound())); + } + + +} diff --git a/src/main/java/noppes/npcs/client/gui/roles/GuiNpcCompanion.java b/src/main/java/noppes/npcs/client/gui/roles/GuiNpcCompanion.java new file mode 100644 index 000000000..f4d016082 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/roles/GuiNpcCompanion.java @@ -0,0 +1,131 @@ +package noppes.npcs.client.gui.roles; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.client.Client; +import noppes.npcs.client.gui.player.companion.GuiNpcCompanionTalents.GuiTalent; +import noppes.npcs.client.gui.util.GuiNPCInterface2; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcSlider; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.ISliderListener; +import noppes.npcs.client.gui.util.ITextfieldListener; +import noppes.npcs.constants.EnumCompanionStage; +import noppes.npcs.constants.EnumCompanionTalent; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.RoleCompanion; + +public class GuiNpcCompanion extends GuiNPCInterface2 implements ITextfieldListener, ISliderListener{ + private RoleCompanion role; + private List talents = new ArrayList(); + public GuiNpcCompanion(EntityNPCInterface npc){ + super(npc); + role = (RoleCompanion) npc.roleInterface; + } + + @Override + public void initGui(){ + super.initGui(); + talents.clear(); + int y = guiTop + 4; + + addButton(new GuiNpcButton(0, guiLeft + 70, y, 90, 20, new String[]{EnumCompanionStage.BABY.name, EnumCompanionStage.CHILD.name, EnumCompanionStage.TEEN.name, EnumCompanionStage.ADULT.name, EnumCompanionStage.FULLGROWN.name}, role.stage.ordinal())); + addLabel(new GuiNpcLabel(0, "companion.stage", guiLeft + 4, y + 5)); + addButton(new GuiNpcButton(1, guiLeft + 162, y, 90, 20, "gui.update")); + + addButton(new GuiNpcButton(2, guiLeft + 70, y += 22, 90, 20, new String[]{"gui.no", "gui.yes"}, role.canAge?1:0)); + addLabel(new GuiNpcLabel(2, "companion.age", guiLeft + 4, y + 5)); + if(role.canAge){ + addTextField(new GuiNpcTextField(2, this, guiLeft + 162, y, 140, 20, role.ticksActive + "")); + getTextField(2).numbersOnly = true; + getTextField(2).setMinMaxDefault(0, Integer.MAX_VALUE, 0); + } + + talents.add(new GuiTalent(role, EnumCompanionTalent.INVENTORY, guiLeft + 4, y+=26)); + addSlider(new GuiNpcSlider(this, 10, guiLeft + 30, y + 2, 100, 20, role.getExp(EnumCompanionTalent.INVENTORY)/5000f)); + + talents.add(new GuiTalent(role, EnumCompanionTalent.ARMOR, guiLeft + 4, y+=26)); + addSlider(new GuiNpcSlider(this, 11, guiLeft + 30, y + 2, 100, 20, role.getExp(EnumCompanionTalent.ARMOR)/5000f)); + + talents.add(new GuiTalent(role, EnumCompanionTalent.SWORD, guiLeft + 4, y+=26)); + addSlider(new GuiNpcSlider(this, 12, guiLeft + 30, y + 2, 100, 20, role.getExp(EnumCompanionTalent.SWORD)/5000f)); + +// talents.add(new GuiTalent(role, EnumCompanionTalent.RANGED, guiLeft + 4, y+=26)); +// addSlider(new GuiNpcSlider(this, 13, guiLeft + 30, y + 2, 100, 20, role.getExp(EnumCompanionTalent.RANGED)/5000f)); + } + + @Override + public void buttonEvent(GuiButton guibutton){ + if(guibutton.id == 0){ + GuiNpcButton button = (GuiNpcButton) guibutton; + role.matureTo(EnumCompanionStage.values()[button.getValue()]); + if(role.canAge) + role.ticksActive = role.stage.matureAge; + initGui(); + } + if(guibutton.id == 1){ + Client.sendData(EnumPacketServer.RoleCompanionUpdate, role.stage.ordinal()); + } + if(guibutton.id == 2){ + GuiNpcButton button = (GuiNpcButton) guibutton; + role.canAge = button.getValue() == 1; + initGui(); + } + } + + @Override + public void unFocused(GuiNpcTextField textfield) { + if(textfield.id == 2){ + role.ticksActive = textfield.getInteger(); + } + } + @Override + public void drawScreen(int i, int j, float f) { + super.drawScreen(i, j, f); + for(GuiTalent talent : talents){ + talent.drawScreen(i, j, f); + } + } + + @Override + public void elementClicked(){ + + } + + + @Override + public void save() { + Client.sendData(EnumPacketServer.RoleSave, role.writeToNBT(new NBTTagCompound())); + } + + @Override + public void mouseDragged(GuiNpcSlider slider) { + if(slider.sliderValue <= 0){ + slider.setString("gui.disabled"); + role.talents.remove(EnumCompanionTalent.values()[slider.id - 10]); + } + else{ + slider.displayString = (int)(slider.sliderValue * 50) * 100 + " exp"; + role.setExp(EnumCompanionTalent.values()[slider.id - 10], (int)(slider.sliderValue * 50) * 100); + } + } + + @Override + public void mousePressed(GuiNpcSlider slider) { + // TODO Auto-generated method stub + + } + + @Override + public void mouseReleased(GuiNpcSlider slider) { + // TODO Auto-generated method stub + + } + + +} diff --git a/src/main/java/noppes/npcs/client/gui/roles/GuiNpcConversation.java b/src/main/java/noppes/npcs/client/gui/roles/GuiNpcConversation.java new file mode 100644 index 000000000..0ddc3641f --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/roles/GuiNpcConversation.java @@ -0,0 +1,142 @@ +package noppes.npcs.client.gui.roles; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.client.Client; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.gui.SubGuiNpcAvailability; +import noppes.npcs.client.gui.global.GuiNPCQuestSelection; +import noppes.npcs.client.gui.util.GuiNPCInterface2; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.GuiSelectionListener; +import noppes.npcs.client.gui.util.ITextfieldListener; +import noppes.npcs.client.gui.util.SubGuiInterface; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.JobConversation; +import noppes.npcs.roles.JobConversation.ConversationLine; + +public class GuiNpcConversation extends GuiNPCInterface2 implements ITextfieldListener, GuiSelectionListener +{ + private JobConversation job; + + private int slot = -1; + private GuiNPCQuestSelection questSelection; + + public GuiNpcConversation(EntityNPCInterface npc){ + super(npc); + job = (JobConversation) npc.jobInterface; + } + + public void initGui(){ + super.initGui(); + + addLabel(new GuiNpcLabel(40, "gui.name", guiLeft + 40, guiTop + 4)); + addLabel(new GuiNpcLabel(41, "gui.name", guiLeft + 240, guiTop + 4)); + + addLabel(new GuiNpcLabel(42, "conversation.delay", guiLeft + 164, guiTop + 4)); + addLabel(new GuiNpcLabel(43, "conversation.delay", guiLeft + 364, guiTop + 4)); + + for (int i = 0; i < 14; i++) { + ConversationLine line = job.getLine(i); + int offset = i >=7 ?200:0; + this.addLabel(new GuiNpcLabel(i, "" + (i + 1), guiLeft + 5 + offset - (i > 8?6:0), guiTop + 18 + i % 7 * 22)); + this.addTextField(new GuiNpcTextField(i, this, this.fontRendererObj, guiLeft + 13 + offset, guiTop + 13 + i % 7 * 22, 100, 20, line.npc)); + this.addButton(new GuiNpcButton(i, guiLeft + 115 + offset, guiTop + 13 + i % 7 * 22, 46, 20, "conversation.line")); + + if(i > 0){ + this.addTextField(new GuiNpcTextField(i + 14, this, this.fontRendererObj, guiLeft + 164 + offset, guiTop + 13 + i % 7 * 22, 30, 20, line.delay + "")); + this.getTextField(i + 14).numbersOnly = true; + this.getTextField(i + 14).setMinMaxDefault(5, 1000, 40); + } + } + addLabel(new GuiNpcLabel(50, "conversation.delay", guiLeft + 202, guiTop + 175)); + addTextField(new GuiNpcTextField(50, this, fontRendererObj, guiLeft + 260, guiTop + 170, 40, 20, job.generalDelay + "")); + getTextField(50).numbersOnly = true; + getTextField(50).setMinMaxDefault(10, 1000000, 12000); + + addLabel(new GuiNpcLabel(54, "gui.range", guiLeft + 202, guiTop + 196)); + addTextField(new GuiNpcTextField(54, this, fontRendererObj, guiLeft + 260, guiTop + 191, 40, 20, job.range + "")); + getTextField(54).numbersOnly = true; + getTextField(54).setMinMaxDefault(4, 60, 20); + + addLabel(new GuiNpcLabel(51, "quest.quest", guiLeft + 13, guiTop + 175)); + String title = job.questTitle; + if(title.isEmpty()) + title = "gui.select"; + addButton(new GuiNpcButton(51, guiLeft + 70, guiTop + 170, 100, 20, title)); + addButton(new GuiNpcButton(52, guiLeft + 171, guiTop + 170, 20, 20, "X")); + + addLabel(new GuiNpcLabel(53, "availability.name", guiLeft + 13, guiTop + 196)); + addButton(new GuiNpcButton(53, guiLeft + 110, guiTop + 191, 60, 20, "selectServer.edit")); + + addButton(new GuiNpcButton(55, guiLeft + 310, guiTop + 181, 96, 20, new String[]{"gui.always", "gui.playernearby"}, job.mode)); + } + + protected void actionPerformed(GuiButton guibutton){ + GuiNpcButton button = (GuiNpcButton) guibutton; + if(button.id >= 0 && button.id < 14){ + slot = button.id; + ConversationLine line = job.getLine(slot); + setSubGui(new SubGuiNpcConversationLine(line.text, line.sound)); + } + if(button.id == 51){ + NoppesUtil.openGUI(player, questSelection = new GuiNPCQuestSelection(npc, this, job.quest)); + } + if(button.id == 52){ + job.quest = -1; + job.questTitle = ""; + initGui(); + } + if(button.id == 53){ + setSubGui(new SubGuiNpcAvailability(job.availability)); + } + if(button.id == 55){ + job.mode = button.getValue(); + } + } + @Override + public void selected(int ob, String name) { + job.quest = ob; + job.questTitle = questSelection.getSelected(); + initGui(); + } + + @Override + public void closeSubGui(SubGuiInterface gui) { + super.closeSubGui(gui); + if(gui instanceof SubGuiNpcConversationLine){ + SubGuiNpcConversationLine sub = (SubGuiNpcConversationLine) gui; + ConversationLine line = job.getLine(slot); + line.text = sub.line; + line.sound = sub.sound; + } + } + + @Override + public void save() { + Client.sendData(EnumPacketServer.JobSave, job.writeToNBT(new NBTTagCompound())); + } + + @Override + public void unFocused(GuiNpcTextField textfield) { + if(textfield.id >= 0 && textfield.id < 14){ + ConversationLine line = job.getLine(textfield.id); + line.npc = textfield.getText(); + } + if(textfield.id >= 14 && textfield.id < 28){ + ConversationLine line = job.getLine(textfield.id - 14); + line.delay = textfield.getInteger(); + } + if(textfield.id == 50){ + job.generalDelay = textfield.getInteger(); + } + if(textfield.id == 54){ + job.range = textfield.getInteger(); + } + } + + +} diff --git a/src/main/java/noppes/npcs/client/gui/roles/GuiNpcFollowerJob.java b/src/main/java/noppes/npcs/client/gui/roles/GuiNpcFollowerJob.java new file mode 100644 index 000000000..80ae2f7d1 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/roles/GuiNpcFollowerJob.java @@ -0,0 +1,63 @@ +package noppes.npcs.client.gui.roles; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.client.Client; +import noppes.npcs.client.gui.util.GuiCustomScroll; +import noppes.npcs.client.gui.util.GuiNPCInterface2; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.ICustomScrollListener; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.JobFollower; + +public class GuiNpcFollowerJob extends GuiNPCInterface2 implements ICustomScrollListener +{ + private JobFollower job; + private GuiCustomScroll scroll; + public GuiNpcFollowerJob(EntityNPCInterface npc) + { + super(npc); + job = (JobFollower) npc.jobInterface; + } + + public void initGui() + { + super.initGui(); + + addLabel(new GuiNpcLabel(1,"gui.name", guiLeft + 6, guiTop + 110)); + addTextField(new GuiNpcTextField(1,this, this.fontRendererObj, guiLeft + 50, guiTop + 105, 200, 20, job.name)); + + scroll = new GuiCustomScroll(this,0); + scroll.setSize(143, 208); + scroll.guiLeft = guiLeft + 268; + scroll.guiTop = guiTop + 4; + this.addScroll(scroll); + + List names = new ArrayList(); + List list = npc.worldObj.getEntitiesWithinAABB(EntityNPCInterface.class, npc.boundingBox.expand(40, 40, 40)); + for(EntityNPCInterface npc : list){ + if(npc == this.npc || names.contains(npc.display.name)) + continue; + names.add(npc.display.name); + } + scroll.setList(names); + } + + @Override + public void save() { + job.name = getTextField(1).getText(); + Client.sendData(EnumPacketServer.JobSave, job.writeToNBT(new NBTTagCompound())); + } + + @Override + public void customScrollClicked(int i, int j, int k, + GuiCustomScroll guiCustomScroll) { + getTextField(1).setText(guiCustomScroll.getSelected()); + } + + +} diff --git a/src/main/java/noppes/npcs/client/gui/roles/GuiNpcFollowerSetup.java b/src/main/java/noppes/npcs/client/gui/roles/GuiNpcFollowerSetup.java new file mode 100644 index 000000000..c63388c9f --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/roles/GuiNpcFollowerSetup.java @@ -0,0 +1,107 @@ +package noppes.npcs.client.gui.roles; + +import java.util.HashMap; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ResourceLocation; +import noppes.npcs.client.Client; +import noppes.npcs.client.gui.util.GuiContainerNPCInterface2; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcButtonYesNo; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.containers.ContainerNPCFollowerSetup; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.RoleFollower; + + +public class GuiNpcFollowerSetup extends GuiContainerNPCInterface2 +{ + private RoleFollower role; + private static final ResourceLocation field_110422_t = new ResourceLocation("textures/gui/followersetup.png"); + public GuiNpcFollowerSetup(EntityNPCInterface npc,ContainerNPCFollowerSetup container) + { + super(npc, container); + ySize = 200; + role = (RoleFollower) npc.roleInterface; + setBackground("followersetup.png"); + } + public void initGui() + { + super.initGui(); + for(int i = 0; i < 3; i++){ + int x = guiLeft + 66; + int y = guiTop + 37; + y += i * 25; + GuiNpcTextField tf = new GuiNpcTextField(i,this, fontRendererObj,x, y, 24, 20, "1"); + tf.numbersOnly = true; + tf.setMinMaxDefault(1, Integer.MAX_VALUE, 1); + addTextField(tf); + } + int i = 0; + for(int day : role.rates.values()){ + getTextField(i).setText(day + ""); + i++; + } + addTextField(new GuiNpcTextField(3,this, fontRendererObj,guiLeft + 100, guiTop + 6, 286, 20, role.dialogHire)); + addTextField(new GuiNpcTextField(4,this, fontRendererObj,guiLeft + 100, guiTop + 30, 286, 20, role.dialogFarewell)); + + addLabel(new GuiNpcLabel(7, "follower.infiniteDays", guiLeft + 180, guiTop + 80)); + addButton(new GuiNpcButtonYesNo(7, guiLeft + 260, guiTop + 75, role.infiniteDays)); + + addLabel(new GuiNpcLabel(8, "follower.guiDisabled", guiLeft + 180, guiTop + 104)); + addButton(new GuiNpcButtonYesNo(8, guiLeft + 260, guiTop + 99, role.disableGui)); + + addLabel(new GuiNpcLabel(9, "follower.allowSoulstone", guiLeft + 180, guiTop + 128)); + addButton(new GuiNpcButtonYesNo(9, guiLeft + 260, guiTop + 123, !role.refuseSoulStone)); + + + addButton(new GuiNpcButton(10, guiLeft + 195, guiTop + 147, 100, 20, "remote.reset")); + } + + @Override + protected void actionPerformed(GuiButton guibutton){ + if(guibutton.id == 7){ + role.infiniteDays = ((GuiNpcButtonYesNo)guibutton).getBoolean(); + } + if(guibutton.id == 8){ + role.disableGui = ((GuiNpcButtonYesNo)guibutton).getBoolean(); + } + if(guibutton.id == 9){ + role.refuseSoulStone = !((GuiNpcButtonYesNo)guibutton).getBoolean(); + } + if(guibutton.id == 10){ + role.killed(); + } + } + + @Override + protected void drawGuiContainerForegroundLayer(int par1, int par2) + { + + } + @Override + public void save() { + HashMap map = new HashMap(); + for(int i= 0;i < role.inventory.getSizeInventory();i++){ + ItemStack item = role.inventory.getStackInSlot(i); + if(item != null){ + + int days = 1; + if(!getTextField(i).isEmpty() && getTextField(i).isInteger()) + days = getTextField(i).getInteger(); + if(days <= 0) + days = 1; + + map.put(i,days); + } + } + role.rates = map; + role.dialogHire = getTextField(3).getText(); + role.dialogFarewell = getTextField(4).getText(); + Client.sendData(EnumPacketServer.RoleSave, role.writeToNBT(new NBTTagCompound())); + } +} diff --git a/src/main/java/noppes/npcs/client/gui/roles/GuiNpcGuard.java b/src/main/java/noppes/npcs/client/gui/roles/GuiNpcGuard.java new file mode 100644 index 000000000..7ae29d8df --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/roles/GuiNpcGuard.java @@ -0,0 +1,146 @@ +package noppes.npcs.client.gui.roles; + +import java.util.ArrayList; +import java.util.List; + +import javax.management.relation.RoleStatus; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.entity.EntityList; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.StatCollector; +import net.minecraft.world.biome.BiomeGenBase; +import noppes.npcs.client.Client; +import noppes.npcs.client.gui.util.GuiCustomScroll; +import noppes.npcs.client.gui.util.GuiNPCInterface2; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.JobGuard; + +public class GuiNpcGuard extends GuiNPCInterface2{ + private JobGuard role; + private GuiCustomScroll scroll1; + private GuiCustomScroll scroll2; + + public GuiNpcGuard(EntityNPCInterface npc){ + super(npc); + role = (JobGuard) npc.jobInterface; + } + + public void initGui(){ + super.initGui(); + this.addLabel(new GuiNpcLabel(0, "guard.animals", guiLeft + 10, guiTop + 9)); + this.addButton(new GuiNpcButton(0, guiLeft + 85, guiTop + 4, 50, 20, new String[]{"gui.no", "gui.yes"},role.attacksAnimals?1:0)); + + this.addLabel(new GuiNpcLabel(1, "guard.mobs", guiLeft + 140, guiTop + 9)); + this.addButton(new GuiNpcButton(1, guiLeft + 222, guiTop + 4, 50, 20, new String[]{"gui.no", "gui.yes"},role.attackHostileMobs?1:0)); + + this.addLabel(new GuiNpcLabel(2, "guard.creepers", guiLeft + 275, guiTop + 9)); + this.addButton(new GuiNpcButton(2, guiLeft + 360, guiTop + 4, 50, 20, new String[]{"gui.no", "gui.yes"},role.attackCreepers?1:0)); + getButton(2).enabled = role.attackHostileMobs; + + this.addLabel(new GuiNpcLabel(3, "guard.specifictargets", guiLeft + 10, guiTop + 31)); + this.addButton(new GuiNpcButton(3, guiLeft + 85, guiTop + 26, 50, 20, new String[]{"gui.no", "gui.yes"},role.specific?1:0)); + + if(role.specific){ + if(scroll1 == null){ + scroll1 = new GuiCustomScroll(this,0); + scroll1.setSize(175, 154); + } + scroll1.guiLeft = guiLeft + 4; + scroll1.guiTop = guiTop + 58; + this.addScroll(scroll1); + addLabel(new GuiNpcLabel(11, "guard.availableTargets", guiLeft + 4, guiTop + 48)); + + if(scroll2 == null){ + scroll2 = new GuiCustomScroll(this,1); + scroll2.setSize(175, 154); + } + scroll2.guiLeft = guiLeft + 235; + scroll2.guiTop = guiTop + 58; + this.addScroll(scroll2); + addLabel(new GuiNpcLabel(12, "guard.currentTargets", guiLeft + 235, guiTop + 48)); + + List all = new ArrayList(); + for(Object entity : EntityList.stringToClassMapping.keySet()){ + String name = "entity." + entity + ".name"; + Class cl = (Class) EntityList.stringToClassMapping.get(entity); + if(role.targets.contains(name) || EntityNPCInterface.class.isAssignableFrom(cl)) + continue; + if(EntityLivingBase.class.isAssignableFrom(cl)) + all.add(name); + } + scroll1.setList(all); + scroll2.setList(role.targets); + + + addButton(new GuiNpcButton(11, guiLeft + 180, guiTop + 80, 55, 20, ">")); + addButton(new GuiNpcButton(12, guiLeft + 180, guiTop + 102, 55, 20, "<")); + + addButton(new GuiNpcButton(13, guiLeft + 180, guiTop + 130, 55, 20, ">>")); + addButton(new GuiNpcButton(14, guiLeft + 180, guiTop + 152, 55, 20, "<<")); + } + } + + protected void actionPerformed(GuiButton guibutton){ + GuiNpcButton button = (GuiNpcButton) guibutton; + if(button.id == 0){ + role.attacksAnimals = button.getValue()==1; + } + if(button.id == 1){ + role.attackHostileMobs = button.getValue()==1; + initGui(); + } + if(button.id == 2){ + role.attackCreepers = button.getValue()==1; + } + if(button.id == 3){ + role.specific = button.getValue()==1; + initGui(); + } + + if(button.id == 11){ + if(scroll1.hasSelected()){ + role.targets.add(scroll1.getSelected()); + scroll1.selected = -1; + scroll1.selected = -1; + initGui(); + } + } + if(button.id == 12){ + if(scroll2.hasSelected()){ + role.targets.remove(scroll2.getSelected()); + scroll2.selected = -1; + initGui(); + } + } + if(button.id == 13){ + role.targets.clear(); + List all = new ArrayList(); + for(Object entity : EntityList.stringToClassMapping.keySet()){ + String name = "entity." + entity + ".name"; + Class cl = (Class) EntityList.stringToClassMapping.get(entity); + if(EntityLivingBase.class.isAssignableFrom(cl)) + all.add(name); + } + role.targets = all; + scroll1.selected = -1; + scroll1.selected = -1; + initGui(); + } + if(button.id == 14){ + role.targets.clear(); + scroll1.selected = -1; + scroll1.selected = -1; + initGui(); + } + } + + public void save() { + Client.sendData(EnumPacketServer.JobSave, role.writeToNBT(new NBTTagCompound())); + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/roles/GuiNpcHealer.java b/src/main/java/noppes/npcs/client/gui/roles/GuiNpcHealer.java new file mode 100644 index 000000000..3fc26ad1a --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/roles/GuiNpcHealer.java @@ -0,0 +1,51 @@ +package noppes.npcs.client.gui.roles; + +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.client.Client; +import noppes.npcs.client.gui.util.GuiNPCInterface2; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.JobHealer; + +public class GuiNpcHealer extends GuiNPCInterface2 +{ + private JobHealer job; + public GuiNpcHealer(EntityNPCInterface npc) + { + super(npc); + job = (JobHealer) npc.jobInterface; + } + + public void initGui() + { + super.initGui(); + + addLabel(new GuiNpcLabel(1,"Healing Speed:", guiLeft + 60, guiTop + 110)); + addTextField(new GuiNpcTextField(1,this, this.fontRendererObj, guiLeft+130, guiTop + 105, 40, 20, job.speed + "")); + getTextField(1).numbersOnly = true; + getTextField(1).setMinMaxDefault(1, 10, 8); + + addLabel(new GuiNpcLabel(2,"Range:", guiLeft + 60, guiTop + 133)); + addTextField(new GuiNpcTextField(2,this, this.fontRendererObj, guiLeft+130, guiTop + 128, 40, 20, job.range + "")); + getTextField(2).numbersOnly = true; + getTextField(2).setMinMaxDefault(2, 20, 5); + + } + @Override + public void elementClicked(){ + + } + + + @Override + public void save() { + job.speed = getTextField(1).getInteger(); + job.range = getTextField(2).getInteger(); + + Client.sendData(EnumPacketServer.JobSave, job.writeToNBT(new NBTTagCompound())); + } + + +} diff --git a/src/main/java/noppes/npcs/client/gui/roles/GuiNpcItemGiver.java b/src/main/java/noppes/npcs/client/gui/roles/GuiNpcItemGiver.java new file mode 100644 index 000000000..c5d855632 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/roles/GuiNpcItemGiver.java @@ -0,0 +1,95 @@ +package noppes.npcs.client.gui.roles; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.client.Client; +import noppes.npcs.client.gui.SubGuiNpcAvailability; +import noppes.npcs.client.gui.util.GuiContainerNPCInterface2; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.containers.ContainerNpcItemGiver; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.JobItemGiver; + +public class GuiNpcItemGiver extends GuiContainerNPCInterface2 +{ + private JobItemGiver role; + public GuiNpcItemGiver(EntityNPCInterface npc, ContainerNpcItemGiver container) + { + super(npc,container); + ySize = 200; + role = (JobItemGiver) npc.jobInterface; + setBackground("npcitemgiver.png"); + } + + public void initGui() + { + super.initGui(); + this.addButton(new GuiNpcButton(0, guiLeft + 6, guiTop + 6, 140,20, new String[]{"Random Item","All Items","Give Not Owned Items","Give When Doesnt Own Any","Chained"},role.givingMethod)); + this.addButton(new GuiNpcButton(1, guiLeft + 6, guiTop + 29, 140,20, new String[]{"Timer","Give Only Once","Daily"},role.cooldownType)); + + addTextField(new GuiNpcTextField(0, this, fontRendererObj, guiLeft + 55, guiTop + 54, 90, 20, role.cooldown + "")); + getTextField(0).numbersOnly = true; + addLabel(new GuiNpcLabel(0,"Cooldown:", guiLeft + 6, guiTop + 59)); + addLabel(new GuiNpcLabel(1,"Items to give", guiLeft + 46, guiTop + 79)); + + getTextField(0).numbersOnly = true; + + int i = 0; + for(String line : role.lines){ + addTextField(new GuiNpcTextField(i+1, this, fontRendererObj, guiLeft + 150, guiTop + 6 + i * 24, 236, 20,line)); + i++; + } + for(;i <3; i++){ + addTextField(new GuiNpcTextField(i+1, this, fontRendererObj, guiLeft + 150, guiTop + 6 + i * 24, 236, 20,"")); + } + getTextField(0).enabled = role.isOnTimer(); + getLabel(0).enabled = role.isOnTimer(); + + addLabel(new GuiNpcLabel(4, "availability.options", guiLeft + 180, guiTop + 101)); + addButton(new GuiNpcButton(4, guiLeft + 280, guiTop + 96, 50, 20, "selectServer.edit")); + } + + public void actionPerformed(GuiButton guibutton) + { + GuiNpcButton button = (GuiNpcButton) guibutton; + if(button.id == 0) + { + role.givingMethod = button.getValue(); + } + if(button.id == 1) + { + role.cooldownType = button.getValue(); + getTextField(0).enabled = role.isOnTimer(); + getLabel(0).enabled = role.isOnTimer(); + } + if(button.id == 4){ + setSubGui(new SubGuiNpcAvailability(role.availability)); + } + + } + + public void save() { + + List lines = new ArrayList(); + for(int i = 1; i < 4; i++){ + GuiNpcTextField tf = getTextField(i); + if(!tf.isEmpty()) + lines.add(tf.getText()); + } + role.lines = lines; + int cc = 10; + if(!getTextField(0).isEmpty() && getTextField(0).isInteger()) + cc = getTextField(0).getInteger(); + + role.cooldown = cc; + + Client.sendData(EnumPacketServer.JobSave, role.writeToNBT(new NBTTagCompound())); + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/roles/GuiNpcPuppet.java b/src/main/java/noppes/npcs/client/gui/roles/GuiNpcPuppet.java new file mode 100644 index 000000000..573a6d1ca --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/roles/GuiNpcPuppet.java @@ -0,0 +1,184 @@ +package noppes.npcs.client.gui.roles; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.ModelData; +import noppes.npcs.ModelPartConfig; +import noppes.npcs.client.Client; +import noppes.npcs.client.gui.util.GuiModelInterface; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcSlider; +import noppes.npcs.client.gui.util.ISliderListener; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.entity.EntityCustomNpc; +import noppes.npcs.roles.JobPuppet; +import noppes.npcs.roles.JobPuppet.PartConfig; + +public class GuiNpcPuppet extends GuiModelInterface implements ISliderListener{ + + private GuiScreen parent; + private int type = 6; + private JobPuppet job; + private PartConfig part; + + public GuiNpcPuppet(GuiScreen parent, EntityCustomNpc npc){ + super(npc); + this.parent = parent; + this.xOffset = 100; + ySize = 230; + job = (JobPuppet) npc.jobInterface; + } + + @Override + public void initGui() { + super.initGui(); + + int y = guiTop; + addLabel(new GuiNpcLabel(26, "gui.settings", guiLeft + 55, y + 5, 0xFFFFFF)); + if(type == 6){ + addButton(new GuiNpcButton(30, guiLeft + 120, y += 14, 60, 20, new String[]{"gui.yes", "gui.no"}, job.whileStanding?0:1)); + addLabel(new GuiNpcLabel(30, "puppet.standing", guiLeft + 30, y + 5, 0xFFFFFF)); + addButton(new GuiNpcButton(31, guiLeft + 120, y += 22, 60, 20, new String[]{"gui.yes", "gui.no"}, job.whileMoving?0:1)); + addLabel(new GuiNpcLabel(31, "puppet.walking", guiLeft + 30, y + 5, 0xFFFFFF)); + addButton(new GuiNpcButton(32, guiLeft + 120, y += 22, 60, 20, new String[]{"gui.yes", "gui.no"}, job.whileAttacking?0:1)); + addLabel(new GuiNpcLabel(32, "puppet.attacking", guiLeft + 30, y + 5, 0xFFFFFF)); + y += 24; + } + else{ + addButton(new GuiNpcButton(6, guiLeft + 110, y , 60, 20, "selectServer.edit")); + y += 24; + } + + addLabel(new GuiNpcLabel(20, "model.head", guiLeft + 55, y + 5, 0xFFFFFF)); + if(type == 0){ + drawSlider(y, job.head); + y += 90; + } + else{ + addButton(new GuiNpcButton(0, guiLeft + 110, y , 60, 20, "selectServer.edit")); + y += 24; + } + + addLabel(new GuiNpcLabel(21, "model.body", guiLeft + 55, y + 5, 0xFFFFFF)); + if(type == 1){ + drawSlider(y, job.body); + y += 90; + } + else{ + addButton(new GuiNpcButton(1, guiLeft + 110, y , 60, 20, "selectServer.edit")); + y += 24; + } + + addLabel(new GuiNpcLabel(22, "model.larm", guiLeft + 55, y + 5, 0xFFFFFF)); + if(type == 2){ + drawSlider(y, job.larm); + y += 90; + } + else{ + addButton(new GuiNpcButton(2, guiLeft + 110, y , 60, 20, "selectServer.edit")); + y += 24; + } + + addLabel(new GuiNpcLabel(23, "model.rarm", guiLeft + 55, y + 5, 0xFFFFFF)); + if(type == 3){ + drawSlider(y, job.rarm); + y += 90; + } + else{ + addButton(new GuiNpcButton(3, guiLeft + 110, y , 60, 20, "selectServer.edit")); + y += 24; + } + + addLabel(new GuiNpcLabel(24, "model.lleg", guiLeft + 55, y + 5, 0xFFFFFF)); + if(type == 4){ + drawSlider(y, job.lleg); + y += 90; + } + else{ + addButton(new GuiNpcButton(4, guiLeft + 110, y , 60, 20, "selectServer.edit")); + y += 24; + } + + addLabel(new GuiNpcLabel(25, "model.rleg", guiLeft + 55, y + 5, 0xFFFFFF)); + if(type == 5){ + drawSlider(y, job.rleg); + y += 90; + } + else{ + addButton(new GuiNpcButton(5, guiLeft + 110, y , 60, 20, "selectServer.edit")); + y += 24; + } + + } + + private void drawSlider(int y, PartConfig config){ + part = config; + addButton(new GuiNpcButton(29, guiLeft + 100, y , 80, 20, new String[]{"gui.enabled","gui.disabled"}, config.disabled?1:0)); + y += 22; + addLabel(new GuiNpcLabel(10, "X", guiLeft, y + 5, 0xFFFFFF)); + addSlider(new GuiNpcSlider(this, 10, guiLeft + 50, y, config.rotationX + 0.5f)); + y += 22; + addLabel(new GuiNpcLabel(11, "Y", guiLeft, y + 5, 0xFFFFFF)); + addSlider(new GuiNpcSlider(this, 11, guiLeft + 50, y, config.rotationY + 0.5f)); + y += 22; + addLabel(new GuiNpcLabel(12, "Z", guiLeft, y + 5, 0xFFFFFF)); + addSlider(new GuiNpcSlider(this, 12, guiLeft + 50, y, config.rotationZ + 0.5f)); + } + + + @Override + protected void actionPerformed(GuiButton btn) { + super.actionPerformed(btn); + if(btn.id < 7){ + type = btn.id; + initGui(); + } + if(!(btn instanceof GuiNpcButton)) + return; + + GuiNpcButton button = (GuiNpcButton) btn; + if(btn.id == 29){ + part.disabled = button.getValue() == 1; + } + if(btn.id == 30){ + job.whileStanding = button.getValue() == 0; + } + if(btn.id == 31){ + job.whileMoving = button.getValue() == 0; + } + if(btn.id == 32){ + job.whileAttacking = button.getValue() == 0; + } + } + + @Override + public void close(){ + this.mc.displayGuiScreen(parent); + Client.sendData(EnumPacketServer.JobSave, job.writeToNBT(new NBTTagCompound())); + } + + @Override + public void mouseDragged(GuiNpcSlider slider) { + int percent = (int) ((slider.sliderValue) * 360); + slider.setString(percent + "%"); + + if(slider.id == 10) + part.rotationX = slider.sliderValue - 0.5f; + if(slider.id == 11) + part.rotationY = slider.sliderValue - 0.5f; + if(slider.id == 12) + part.rotationZ = slider.sliderValue - 0.5f; + npc.updateHitbox(); + } + + @Override + public void mousePressed(GuiNpcSlider slider) { + + } + + @Override + public void mouseReleased(GuiNpcSlider slider) { + } +} diff --git a/src/main/java/noppes/npcs/client/gui/roles/GuiNpcSpawner.java b/src/main/java/noppes/npcs/client/gui/roles/GuiNpcSpawner.java new file mode 100644 index 000000000..9e7170d7b --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/roles/GuiNpcSpawner.java @@ -0,0 +1,176 @@ +package noppes.npcs.client.gui.roles; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.StatCollector; +import noppes.npcs.client.Client; +import noppes.npcs.client.gui.GuiNpcMobSpawnerSelector; +import noppes.npcs.client.gui.GuiNpcSoundSelection; +import noppes.npcs.client.gui.util.GuiNPCInterface2; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.IGuiData; +import noppes.npcs.client.gui.util.ITextfieldListener; +import noppes.npcs.client.gui.util.SubGuiInterface; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.JobSpawner; + + +public class GuiNpcSpawner extends GuiNPCInterface2 implements ITextfieldListener, IGuiData +{ + private JobSpawner job; + + private int slot = -1; + + public String title1 = "gui.selectnpc"; + public String title2 = "gui.selectnpc"; + public String title3 = "gui.selectnpc"; + public String title4 = "gui.selectnpc"; + public String title5 = "gui.selectnpc"; + public String title6 = "gui.selectnpc"; + + public GuiNpcSpawner(EntityNPCInterface npc) + { + super(npc); + job = (JobSpawner) npc.jobInterface; + } + + public void initGui() + { + super.initGui(); + + int y = guiTop + 6; + + this.addButton(new GuiNpcButton(20, guiLeft + 25, y,20,20, "X")); + addLabel(new GuiNpcLabel(0, "1:", guiLeft + 4, y + 5)); + this.addButton(new GuiNpcButton(0, guiLeft + 50, y, title1)); + + y += 23; + this.addButton(new GuiNpcButton(21, guiLeft + 25, y,20,20, "X")); + addLabel(new GuiNpcLabel(1, "2:", guiLeft + 4, y + 5)); + this.addButton(new GuiNpcButton(1, guiLeft + 50, y, title2)); + + y += 23; + this.addButton(new GuiNpcButton(22, guiLeft + 25, y,20,20, "X")); + addLabel(new GuiNpcLabel(2, "3:", guiLeft + 4, y + 5)); + this.addButton(new GuiNpcButton(2, guiLeft + 50, y, title3)); + + y += 23; + this.addButton(new GuiNpcButton(23, guiLeft + 25, y,20,20, "X")); + addLabel(new GuiNpcLabel(3, "4:", guiLeft + 4, y + 5)); + this.addButton(new GuiNpcButton(3, guiLeft + 50, y, title4)); + + y += 23; + this.addButton(new GuiNpcButton(24, guiLeft + 25, y,20,20, "X")); + addLabel(new GuiNpcLabel(4, "5:", guiLeft + 4, y + 5)); + this.addButton(new GuiNpcButton(4, guiLeft + 50, y, title5)); + + y += 23; + this.addButton(new GuiNpcButton(25, guiLeft + 25, y,20,20, "X")); + addLabel(new GuiNpcLabel(5, "6:", guiLeft + 4, y + 5)); + this.addButton(new GuiNpcButton(5, guiLeft + 50, y, title6)); + + y += 23; + addLabel(new GuiNpcLabel(6, "spawner.diesafter", guiLeft + 4, y + 5)); + this.addButton(new GuiNpcButton(26, guiLeft + 115, y,40,20, new String[]{"gui.yes","gui.no"}, job.doesntDie?1:0)); + + addLabel(new GuiNpcLabel(11, "spawner.despawn", guiLeft + 170, y + 5)); + this.addButton(new GuiNpcButton(11, guiLeft + 335, y,40,20, new String[]{"gui.no","gui.yes"}, job.despawnOnTargetLost?1:0)); + + y += 23; + addLabel(new GuiNpcLabel(7,StatCollector.translateToLocal("spawner.posoffset")+" X:", guiLeft + 4, y + 5)); + addTextField(new GuiNpcTextField(7,this, fontRendererObj, guiLeft + 99, y, 24, 20, job.xOffset + "")); + getTextField(7).numbersOnly = true; + getTextField(7).setMinMaxDefault(-9, 9, 0); + addLabel(new GuiNpcLabel(8,"Y:", guiLeft + 125, y + 5)); + addTextField(new GuiNpcTextField(8,this, fontRendererObj, guiLeft + 135, y, 24, 20, job.yOffset + "")); + getTextField(8).numbersOnly = true; + getTextField(8).setMinMaxDefault(-9, 9, 0); + addLabel(new GuiNpcLabel(9,"Z:", guiLeft + 161, y + 5)); + addTextField(new GuiNpcTextField(9,this, fontRendererObj, guiLeft + 171, y, 24, 20, job.zOffset + "")); + getTextField(9).numbersOnly = true; + getTextField(9).setMinMaxDefault(-9, 9, 0); + + y += 23; + addLabel(new GuiNpcLabel(10, "spawner.type", guiLeft + 4, y + 5)); + addButton(new GuiNpcButton(10, guiLeft + 80, y, 100, 20, new String[]{"spawner.one", "spawner.all", "spawner.random"}, job.spawnType)); + } + + @Override + public void elementClicked(){ + } + + protected void actionPerformed(GuiButton guibutton){ + GuiNpcButton button = (GuiNpcButton) guibutton; + if(button.id >= 0 && button.id < 6){ + slot = button.id + 1; + setSubGui(new GuiNpcMobSpawnerSelector()); + } + if(button.id >= 20 && button.id < 26){ + job.setJobCompound(button.id - 19, null); + Client.sendData(EnumPacketServer.JobSpawnerRemove, button.id - 19); + } + if(button.id == 26){ + job.doesntDie = button.getValue() == 1; + } + if(button.id == 10){ + job.spawnType = button.getValue(); + } + if(button.id == 11){ + job.despawnOnTargetLost = button.getValue() == 1; + } + } + + public void closeSubGui(SubGuiInterface gui) { + super.closeSubGui(gui); + GuiNpcMobSpawnerSelector selector = (GuiNpcMobSpawnerSelector) gui; + if(selector.isServer){ + String selected = selector.getSelected(); + if(selected != null) + Client.sendData(EnumPacketServer.JobSpawnerAdd, selector.isServer, selected, selector.activeTab, slot); + } + else{ + NBTTagCompound compound = selector.getCompound(); + if(compound != null){ + job.setJobCompound(slot, compound); + Client.sendData(EnumPacketServer.JobSpawnerAdd, selector.isServer, slot, compound); + } + } + initGui(); + } + + @Override + public void save() { + NBTTagCompound compound = job.writeToNBT(new NBTTagCompound()); + job.cleanCompound(compound); + Client.sendData(EnumPacketServer.JobSave, compound); + } + + @Override + public void unFocused(GuiNpcTextField textfield) { + if(textfield.id == 7){ + job.xOffset = textfield.getInteger(); + } + if(textfield.id == 8){ + job.yOffset = textfield.getInteger(); + } + if(textfield.id == 9){ + job.zOffset = textfield.getInteger(); + } + } + + @Override + public void setGuiData(NBTTagCompound compound) { + title1 = compound.getString("Title1"); + title2 = compound.getString("Title2"); + title3 = compound.getString("Title3"); + title4 = compound.getString("Title4"); + title5 = compound.getString("Title5"); + title6 = compound.getString("Title6"); + initGui(); + } + + +} diff --git a/src/main/java/noppes/npcs/client/gui/roles/GuiNpcTraderSetup.java b/src/main/java/noppes/npcs/client/gui/roles/GuiNpcTraderSetup.java new file mode 100644 index 000000000..84532cbcf --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/roles/GuiNpcTraderSetup.java @@ -0,0 +1,100 @@ + +package noppes.npcs.client.gui.roles; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ResourceLocation; +import noppes.npcs.client.Client; +import noppes.npcs.client.CustomNpcResourceListener; +import noppes.npcs.client.gui.util.GuiContainerNPCInterface2; +import noppes.npcs.client.gui.util.GuiNpcButtonYesNo; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.ITextfieldListener; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.containers.ContainerNPCTraderSetup; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.RoleTrader; + +import org.lwjgl.opengl.GL11; + +public class GuiNpcTraderSetup extends GuiContainerNPCInterface2 implements ITextfieldListener{ + + private final ResourceLocation slot = new ResourceLocation("customnpcs","textures/gui/slot.png"); + private RoleTrader role; + + public GuiNpcTraderSetup(EntityNPCInterface npc, ContainerNPCTraderSetup container){ + super(npc, container); + ySize = 220; + menuYOffset = 10; + role = container.role; + } + + @Override + public void initGui(){ + super.initGui(); + buttonList.clear(); + setBackground("tradersetup.png"); + addLabel(new GuiNpcLabel(0, "role.marketname", guiLeft + 214, guiTop + 150)); + addTextField(new GuiNpcTextField(0, this, guiLeft + 214, guiTop + 160, 180, 20, role.marketName)); + + addLabel(new GuiNpcLabel(1, "gui.ignoreDamage", guiLeft + 260, guiTop + 29)); + addButton(new GuiNpcButtonYesNo(1, guiLeft + 340, guiTop + 24, role.ignoreDamage)); + + addLabel(new GuiNpcLabel(2, "gui.ignoreNBT", guiLeft + 260, guiTop + 51)); + addButton(new GuiNpcButtonYesNo(2, guiLeft + 340, guiTop + 46, role.ignoreNBT)); + } + + @Override + public void drawScreen(int i, int j, float f){ + guiTop += 10; + super.drawScreen(i, j, f); + guiTop -= 10; + } + + @Override + public void actionPerformed(GuiButton guibutton){ + if(guibutton.id == 1){ + role.ignoreDamage = ((GuiNpcButtonYesNo)guibutton).getBoolean(); + } + if(guibutton.id == 2){ + role.ignoreNBT = ((GuiNpcButtonYesNo)guibutton).getBoolean(); + } + } + + @Override + protected void drawGuiContainerBackgroundLayer(float f, int i, int j){ + super.drawGuiContainerBackgroundLayer(f, i, j); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + for(int slot = 0; slot < 18; slot++){ + int x = guiLeft + slot%3 * 94 + 7; + int y = guiTop + slot/3 * 22 + 4; + + mc.renderEngine.bindTexture(this.slot); + GL11.glColor4f(1, 1, 1, 1); + drawTexturedModalRect(x - 1, y, 0, 0, 18, 18); + drawTexturedModalRect(x + 17, y, 0, 0, 18, 18); + + fontRendererObj.drawString("=", x + 36, y + 5, CustomNpcResourceListener.DefaultTextColor); + mc.renderEngine.bindTexture(this.slot); + GL11.glColor4f(1, 1, 1, 1); + drawTexturedModalRect(x + 42, y, 0, 0, 18, 18); + } + } + + @Override + public void save() { + Client.sendData(EnumPacketServer.TraderMarketSave, role.marketName, false); + Client.sendData(EnumPacketServer.RoleSave, role.writeToNBT(new NBTTagCompound())); + } + + @Override + public void unFocused(GuiNpcTextField guiNpcTextField) { + String name = guiNpcTextField.getText(); + if(!name.equalsIgnoreCase(role.marketName)){ + role.marketName = name; + Client.sendData(EnumPacketServer.TraderMarketSave, role.marketName, true); + } + + } +} diff --git a/src/main/java/noppes/npcs/client/gui/roles/GuiNpcTransporter.java b/src/main/java/noppes/npcs/client/gui/roles/GuiNpcTransporter.java new file mode 100644 index 000000000..b3c93a8e3 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/roles/GuiNpcTransporter.java @@ -0,0 +1,94 @@ +package noppes.npcs.client.gui.roles; + +import java.util.HashMap; +import java.util.Vector; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.client.Client; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.gui.mainmenu.GuiNpcAdvanced; +import noppes.npcs.client.gui.util.GuiCustomScroll; +import noppes.npcs.client.gui.util.GuiNPCInterface; +import noppes.npcs.client.gui.util.GuiNPCInterface2; +import noppes.npcs.client.gui.util.GuiNPCStringSlot; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.IGuiData; +import noppes.npcs.client.gui.util.IScrollData; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.controllers.TransportLocation; +import noppes.npcs.entity.EntityNPCInterface; + +public class GuiNpcTransporter extends GuiNPCInterface2 implements IScrollData, IGuiData{ + private GuiCustomScroll scroll; + public TransportLocation location = new TransportLocation(); + private HashMap data = new HashMap(); + + public GuiNpcTransporter(EntityNPCInterface npc){ + super(npc); + Client.sendData(EnumPacketServer.TransportCategoriesGet); + Client.sendData(EnumPacketServer.TransportGetLocation); + } + + public void initGui(){ + super.initGui(); + Vector list = new Vector(); + list.addAll(data.keySet()); + + if(scroll == null){ + scroll = new GuiCustomScroll(this,0); + scroll.setSize(143, 208); + } + scroll.guiLeft = guiLeft + 214; + scroll.guiTop = guiTop + 4; + + addScroll(scroll); + addLabel(new GuiNpcLabel(0,"gui.name", guiLeft + 4, height + 8)); + addTextField(new GuiNpcTextField(0, this, fontRendererObj, guiLeft + 60, guiTop + 3, 140, 20, location.name)); + addButton(new GuiNpcButton(0, guiLeft + 4, guiTop + 31, new String[]{"transporter.discovered","transporter.start","transporter.interaction"}, location.type)); + } + + protected void actionPerformed(GuiButton guibutton) + { + GuiNpcButton button = (GuiNpcButton) guibutton; + if(button.id == 0){ + location.type = button.getValue(); + } + } + @Override + public void save() { + if(!scroll.hasSelected()) + return; + String name = getTextField(0).getText(); + if(!name.isEmpty()) + location.name = name; + + location.posX = player.posX; + location.posY = player.posY; + location.posZ = player.posZ; + location.dimension = player.dimension; + + int cat = data.get(scroll.getSelected()); + Client.sendData(EnumPacketServer.TransportSave,cat, location.writeNBT()); + } + @Override + public void setData(Vector list, HashMap data) { + this.data = data; + this.scroll.setList(list); + } + @Override + public void setSelected(String selected) { + scroll.setSelected(selected); + } + @Override + public void setGuiData(NBTTagCompound compound) { + TransportLocation loc = new TransportLocation(); + loc.readNBT(compound); + location = loc; + initGui(); + } + + +} diff --git a/src/main/java/noppes/npcs/client/gui/roles/SubGuiNpcConversationLine.java b/src/main/java/noppes/npcs/client/gui/roles/SubGuiNpcConversationLine.java new file mode 100644 index 000000000..7963f09f9 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/roles/SubGuiNpcConversationLine.java @@ -0,0 +1,62 @@ +package noppes.npcs.client.gui.roles; + +import net.minecraft.client.gui.GuiButton; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.client.gui.GuiNpcSoundSelection; +import noppes.npcs.client.gui.util.GuiNpcButton; +import noppes.npcs.client.gui.util.GuiNpcLabel; +import noppes.npcs.client.gui.util.GuiNpcTextField; +import noppes.npcs.client.gui.util.ITextfieldListener; +import noppes.npcs.client.gui.util.SubGuiInterface; + +public class SubGuiNpcConversationLine extends SubGuiInterface implements ITextfieldListener{ + public String line; + public String sound; + private GuiNpcSoundSelection gui; + + public SubGuiNpcConversationLine(String line, String sound){ + this.line = line; + this.sound = sound; + setBackground("menubg.png"); + xSize = 256; + ySize = 216; + closeOnEsc = true; + } + + public void initGui(){ + super.initGui(); + + addLabel(new GuiNpcLabel(0, "Line", guiLeft + 4, guiTop+ 10)); + addTextField(new GuiNpcTextField(0, this, fontRendererObj, guiLeft + 4, guiTop + 22, 200, 20, line)); + + addButton(new GuiNpcButton(1, guiLeft + 4, guiTop + 55, 90, 20, "Select Sound")); + addButton(new GuiNpcButton(2, guiLeft + 96, guiTop + 55, 20, 20, "X")); + addLabel(new GuiNpcLabel(1, sound, guiLeft + 4, guiTop + 81)); + + addButton(new GuiNpcButton(66, guiLeft + 162, guiTop + 192, 90, 20, "gui.done")); + } + + public void unFocused(GuiNpcTextField textfield) { + line = textfield.getText(); + } + + @Override + public void elementClicked(){ + sound = gui.getSelected(); + } + + protected void actionPerformed(GuiButton guibutton){ + int id = guibutton.id; + if(id == 1){ + NoppesUtil.openGUI(player, gui = new GuiNpcSoundSelection(npc, parent, sound)); + } + if(id == 2){ + sound = ""; + initGui(); + } + if(id == 66){ + close(); + } + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/swing/GuiJTextArea.java b/src/main/java/noppes/npcs/client/gui/swing/GuiJTextArea.java new file mode 100644 index 000000000..65ac9eb8a --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/swing/GuiJTextArea.java @@ -0,0 +1,74 @@ +package noppes.npcs.client.gui.swing; + +import java.awt.event.WindowEvent; +import java.awt.event.WindowListener; + +import javax.swing.JDialog; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.ScrollPaneConstants; +import javax.swing.border.EtchedBorder; +import javax.swing.border.TitledBorder; + +import noppes.npcs.client.gui.util.IJTextAreaListener; + +import org.lwjgl.opengl.Display; + +public class GuiJTextArea extends JDialog implements WindowListener{ + public IJTextAreaListener listener; + private JTextArea area; + public GuiJTextArea(String text){ + setDefaultCloseOperation(DISPOSE_ON_CLOSE); + setSize(Display.getWidth() - 40, Display.getHeight() - 40); + setLocation(Display.getX() + 20, Display.getY() + 20); + + JScrollPane scroll = new JScrollPane(area = new JTextArea(text)); + scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); + this.add(scroll); + this.addWindowListener(this); + setVisible(true); + } + + + public GuiJTextArea setListener(IJTextAreaListener listener){ + this.listener = listener; + return this; + } + + @Override + public void windowOpened(WindowEvent e) { + + } + + @Override + public void windowClosing(WindowEvent e) { + + } + + @Override + public void windowClosed(WindowEvent e) { + if(listener != null) + listener.saveText(area.getText()); + } + + @Override + public void windowIconified(WindowEvent e) { + + } + + @Override + public void windowDeiconified(WindowEvent e) { + + } + + @Override + public void windowActivated(WindowEvent e) { + + } + + @Override + public void windowDeactivated(WindowEvent e) { + + } +} diff --git a/src/main/java/noppes/npcs/client/gui/util/GuiButtonBiDirectional.java b/src/main/java/noppes/npcs/client/gui/util/GuiButtonBiDirectional.java new file mode 100644 index 000000000..4e4016234 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/util/GuiButtonBiDirectional.java @@ -0,0 +1,82 @@ +package noppes.npcs.client.gui.util; + +import net.minecraft.client.Minecraft; +import net.minecraft.util.ResourceLocation; + +import org.lwjgl.opengl.GL11; + +public class GuiButtonBiDirectional extends GuiNpcButton{ + public static final ResourceLocation resource = new ResourceLocation("customnpcs:textures/gui/arrowbuttons.png"); + + public GuiButtonBiDirectional(int id, int x, int y, int width, int height, String[] arr, int current) { + super(id, x, y, width, height, arr, current); + } + + @Override + public void drawButton(Minecraft mc, int mouseX, int mouseY){ + if (!this.visible) + return; + + boolean hover = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; + + boolean hoverL = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + 11 && mouseY < this.yPosition + this.height; + + boolean hoverR = !hoverL && mouseX >= this.xPosition + width - 11 && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; + + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + mc.getTextureManager().bindTexture(resource); + + this.drawTexturedModalRect(this.xPosition, this.yPosition, 0, hoverL?40:20, 11, 20); + + this.drawTexturedModalRect(this.xPosition + width - 11, this.yPosition, 11, hoverR?40:20, 11, 20); + + int l = 0xffffff; + if (packedFGColour != 0){ + l = packedFGColour; + } + else if (!this.enabled){ + l = 10526880; + } + else if (hover){ + l = 16777120; + } + String text = ""; + float maxWidth = this.width - 36; + if(mc.fontRenderer.getStringWidth(displayString) > maxWidth){ + for(int h = 0; h < displayString.length(); h++){ + char c = displayString.charAt(h); + text += c; + if(mc.fontRenderer.getStringWidth(text) > maxWidth) + break; + } + text += "..."; + } + else + text = displayString; + if(hover) + text = (char)167 + "n" + text; + + this.drawCenteredString(mc.fontRenderer, text, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, l); + } + + @Override + public boolean mousePressed(Minecraft minecraft, int mouseX, int mouseY){ + int value = getValue(); + boolean bo = super.mousePressed(minecraft, mouseX, mouseY); + if(bo && display != null && display.length != 0){ + boolean hoverL = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + 11 && mouseY < this.yPosition + this.height; + + boolean hoverR = !hoverL && mouseX >= this.xPosition + 11 && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; + + if(hoverR) + value = (value+1) % display.length; + if(hoverL){ + if(value <= 0) + value = display.length; + value--; + } + this.setDisplay(value); + } + return bo; + } +} diff --git a/src/main/java/noppes/npcs/client/gui/util/GuiButtonNextPage.java b/src/main/java/noppes/npcs/client/gui/util/GuiButtonNextPage.java new file mode 100644 index 000000000..97b5ed159 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/util/GuiButtonNextPage.java @@ -0,0 +1,45 @@ +package noppes.npcs.client.gui.util; + +import org.lwjgl.opengl.GL11; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreenBook; +import net.minecraft.util.ResourceLocation; + +public class GuiButtonNextPage extends GuiNpcButton{ + private final boolean field_146151_o; + private static final String __OBFID = "CL_00000745"; + private static final ResourceLocation field_110405_a = new ResourceLocation("textures/gui/book.png"); + + public GuiButtonNextPage(int par1, int par2, int par3, boolean par4) + { + super(par1, par2, par3, 23, 13, ""); + this.field_146151_o = par4; + } + + @Override + public void drawButton(Minecraft p_146112_1_, int p_146112_2_, int p_146112_3_) + { + if (this.visible) + { + 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; + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + p_146112_1_.getTextureManager().bindTexture(field_110405_a); + int k = 0; + int l = 192; + + if (flag) + { + k += 23; + } + + if (!this.field_146151_o) + { + l += 13; + } + + this.drawTexturedModalRect(this.xPosition, this.yPosition, k, l, 23, 13); + } + } +} diff --git a/src/main/java/noppes/npcs/client/gui/util/GuiContainerNPCInterface.java b/src/main/java/noppes/npcs/client/gui/util/GuiContainerNPCInterface.java new file mode 100644 index 000000000..dbfa56b76 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/util/GuiContainerNPCInterface.java @@ -0,0 +1,289 @@ +package noppes.npcs.client.gui.util; + +import java.util.ArrayList; +import java.util.HashMap; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityClientPlayerMP; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.inventory.Container; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; +import noppes.npcs.containers.ContainerEmpty; +import noppes.npcs.entity.EntityNPCInterface; + +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public abstract class GuiContainerNPCInterface extends GuiContainer +{ + public boolean drawDefaultBackground = false; + public int guiLeft,guiTop; + public EntityClientPlayerMP player; + public EntityNPCInterface npc; + private HashMap buttons = new HashMap(); + private HashMap topbuttons = new HashMap(); + private HashMap textfields = new HashMap(); + private HashMap labels = new HashMap(); + private HashMap scrolls = new HashMap(); + private HashMap sliders = new HashMap(); + public String title; + public boolean closeOnEsc = false; + private SubGuiInterface subgui; + public int mouseX, mouseY; + + public GuiContainerNPCInterface(EntityNPCInterface npc,Container cont) + { + super(cont); + this.player = Minecraft.getMinecraft().thePlayer; + this.npc = npc; + title = "Npc Mainmenu"; + } + public void initGui() + { + super.initGui(); + GuiNpcTextField.unfocus(); + buttonList.clear(); + buttons.clear(); + topbuttons.clear(); + scrolls.clear(); + sliders.clear(); + labels.clear(); + textfields.clear(); + Keyboard.enableRepeatEvents(true); + + if(subgui != null){ + subgui.setWorldAndResolution(mc, width, height); + subgui.initGui(); + } + + buttonList.clear(); + + guiLeft = (width - xSize)/2; + guiTop = (height - ySize) / 2; + } + public ResourceLocation getResource(String texture){ + return new ResourceLocation("customnpcs","textures/gui/" + texture); + } + public void updateScreen(){ + for(GuiNpcTextField tf : new ArrayList(textfields.values())) + if(tf.enabled) + tf.updateCursorCounter(); + super.updateScreen(); + } + + @Override + protected void mouseClicked(int i, int j, int k) + { + if(subgui != null) + subgui.mouseClicked(i,j,k); + else{ + for(GuiNpcTextField tf : new ArrayList(textfields.values())) + if(tf.enabled) + tf.mouseClicked(i, j, k); + if (k == 0){ + for(GuiCustomScroll scroll : new ArrayList(scrolls.values())){ + scroll.mouseClicked(i, j, k); + } + } + mouseEvent(i,j,k); + super.mouseClicked(i, j, k); + } + } + public void mouseEvent(int i, int j, int k){}; + + @Override + protected void keyTyped(char c, int i) + { + if(subgui != null) + subgui.keyTyped(c,i); + else{ + for(GuiNpcTextField tf : new ArrayList(textfields.values())) + tf.textboxKeyTyped(c, i); + + if (closeOnEsc && (i == 1 || i == mc.gameSettings.keyBindInventory.getKeyCode() && !GuiNpcTextField.isActive())) + close(); + } + } + + + @Override + protected void actionPerformed(GuiButton guibutton) { + if(subgui != null) + subgui.buttonEvent(guibutton); + else + buttonEvent(guibutton); + } + public void buttonEvent(GuiButton guibutton){}; + + public void close(){ + GuiNpcTextField.unfocus(); + save(); + player.closeScreen(); + displayGuiScreen(null); + mc.setIngameFocus(); + } + public void addButton(GuiNpcButton button){ + buttons.put(button.id,button); + buttonList.add(button); + } + public void addTopButton(GuiMenuTopButton button){ + topbuttons.put(button.id,button); + buttonList.add(button); + } + public GuiNpcButton getButton(int i) { + return buttons.get(i); + } + public void addTextField(GuiNpcTextField tf){ + textfields.put(tf.id,tf); + } + public GuiNpcTextField getTextField(int i){ + return textfields.get(i); + } + public void addLabel(GuiNpcLabel label) { + labels.put(label.id, label); + } + public GuiNpcLabel getLabel(int i){ + return labels.get(i); + } + public GuiMenuTopButton getTopButton(int i) { + return topbuttons.get(i); + } + + public void addSlider(GuiNpcSlider slider){ + sliders.put(slider.id,slider); + buttonList.add(slider); + } + public GuiNpcSlider getSlider(int i) { + return sliders.get(i); + } + + public void addScroll(GuiCustomScroll scroll) { + scroll.setWorldAndResolution(mc, 350, 250); + scrolls.put(scroll.id, scroll); + } + public GuiCustomScroll getScroll(int id){ + return scrolls.get(id); + } + + @Override + protected void drawGuiContainerForegroundLayer(int par1, int par2){ + + } + + @Override + protected void drawGuiContainerBackgroundLayer(float f, int i, int j){ + drawCenteredString(fontRendererObj, StatCollector.translateToLocal(title), width / 2, guiTop - 8, 0xffffff); + for(GuiNpcLabel label : new ArrayList(labels.values())) + label.drawLabel(this,fontRendererObj); + for(GuiNpcTextField tf : new ArrayList(textfields.values())) + tf.drawTextBox(i, j); + for(GuiCustomScroll scroll : new ArrayList(scrolls.values())) + scroll.drawScreen(i, j, f, hasSubGui()?0:Mouse.getDWheel()); + } + public abstract void save(); + + @Override + public void drawScreen(int i, int j, float f){ + mouseX = i; + mouseY = j; + + Container container = this.inventorySlots; + if(subgui != null){ + this.inventorySlots = new ContainerEmpty(); + } + super.drawScreen(i, j, f); + zLevel = 0; + GL11.glColor4f(1, 1, 1, 1); + if(subgui != null){ + this.inventorySlots = container; + RenderHelper.disableStandardItemLighting(); + subgui.drawScreen(i,j,f); + } + } + + @Override + public void drawDefaultBackground() + { + if(drawDefaultBackground && subgui == null) + super.drawDefaultBackground(); + } + + public FontRenderer getFontRenderer() { + return this.fontRendererObj; + } + public void closeSubGui(SubGuiInterface gui) { + subgui = null; + } + public boolean hasSubGui() { + return subgui != null; + } + public SubGuiInterface getSubGui() { + if(hasSubGui() && subgui.hasSubGui()) + return subgui.getSubGui(); + return subgui; + } + + public void displayGuiScreen(GuiScreen gui) { + this.mc.displayGuiScreen(gui); + } + + public void setSubGui(SubGuiInterface gui){ + subgui = gui; + subgui.setWorldAndResolution(mc, width, height); + subgui.parent = this; + initGui(); + } + + public void drawNpc(int x, int y){ + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + + GL11.glEnable(GL11.GL_COLOR_MATERIAL); + GL11.glPushMatrix(); + GL11.glTranslatef(guiLeft + x, guiTop + y, 50F); + float scale = 1; + if(npc.height > 2.4) + scale = 2 / npc.height; + GL11.glScalef(-30 * scale, 30 * scale, 30 * scale); + GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); + + + float f2 = npc.renderYawOffset; + float f3 = npc.rotationYaw; + float f4 = npc.rotationPitch; + float f7 = npc.rotationYawHead; + float f5 = (float) (guiLeft + x) - mouseX; + float f6 = (float) ((guiTop + y) - 50) - mouseY; + 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; + npc.rotationYawHead = npc.rotationYaw; + GL11.glTranslatef(0.0F, npc.yOffset, 0.0F); + RenderManager.instance.playerViewY = 180F; + RenderManager.instance.renderEntityWithPosYaw(npc, 0, 0, 0, 0, 1); + npc.renderYawOffset = f2; + npc.rotationYaw = f3; + npc.rotationPitch = f4; + npc.rotationYawHead = f7; + GL11.glPopMatrix(); + RenderHelper.disableStandardItemLighting(); + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + + OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); + GL11.glDisable(GL11.GL_TEXTURE_2D); + OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/util/GuiContainerNPCInterface2.java b/src/main/java/noppes/npcs/client/gui/util/GuiContainerNPCInterface2.java new file mode 100644 index 000000000..ec7b28cf8 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/util/GuiContainerNPCInterface2.java @@ -0,0 +1,91 @@ +package noppes.npcs.client.gui.util; + +import java.util.List; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ResourceLocation; +import noppes.npcs.client.Client; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.entity.EntityNPCInterface; + +import org.lwjgl.opengl.GL11; + +public abstract class GuiContainerNPCInterface2 extends GuiContainerNPCInterface +{ + private ResourceLocation background = new ResourceLocation("customnpcs","textures/gui/menubg.png"); + private final ResourceLocation defaultBackground = new ResourceLocation("customnpcs","textures/gui/menubg.png"); + private GuiNpcMenu menu; + public int menuYOffset = 0; + + public GuiContainerNPCInterface2(EntityNPCInterface npc,Container cont) + { + this(npc, cont, -1); + } + public GuiContainerNPCInterface2(EntityNPCInterface npc,Container cont,int activeMenu) + { + super(npc, cont); + this.xSize = 420; + this.menu = new GuiNpcMenu(this,activeMenu,npc); + title = ""; + } + public void setBackground(String texture){ + background = new ResourceLocation("customnpcs","textures/gui/" + texture); + } + public ResourceLocation getResource(String texture){ + return new ResourceLocation("customnpcs","textures/gui/" + texture); + } + + @Override + public void initGui() + { + super.initGui(); + menu.initGui(guiLeft, guiTop + menuYOffset, xSize); + } + + @Override + protected void mouseClicked(int i, int j, int k) + { + super.mouseClicked(i, j, k); + if(!hasSubGui()) + menu.mouseClicked(i, j, k); + } + + public void delete(){ + npc.delete(); + displayGuiScreen(null); + mc.setIngameFocus(); + } + + @Override + protected void drawGuiContainerBackgroundLayer(float f, int i, int j) + { + drawDefaultBackground(); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + mc.renderEngine.bindTexture(background); + drawTexturedModalRect(guiLeft, guiTop, 0, 0, 256, 256); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + mc.renderEngine.bindTexture(defaultBackground); + drawTexturedModalRect(guiLeft + xSize-200, guiTop, 26, 0, 200, 220); + + menu.drawElements(fontRendererObj, i, j, mc, f); + + super.drawGuiContainerBackgroundLayer(f, i, j); + } + +// @Override +// protected void drawSlotInventory(Slot par1Slot) +// {this.dra +// if(subgui == null) +// super.drawSlotInventory(par1Slot); +// } //TODO fix +} diff --git a/src/main/java/noppes/npcs/client/gui/util/GuiCustomScroll.java b/src/main/java/noppes/npcs/client/gui/util/GuiCustomScroll.java new file mode 100644 index 000000000..f567c7043 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/util/GuiCustomScroll.java @@ -0,0 +1,283 @@ +package noppes.npcs.client.gui.util; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; + +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; + +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; + +public class GuiCustomScroll extends GuiScreen +{ + public static final ResourceLocation resource = new ResourceLocation("customnpcs","textures/gui/misc.png"); + private List list; + + public int id; + public int guiLeft = 0; + public int guiTop = 0; + private int xSize, ySize; + public int selected; + private HashSet selectedList; + private int hover; + private int listHeight; + private int scrollY; + private int maxScrollY; + private int scrollHeight; + private boolean isScrolling; + private boolean multipleSelection = false; + private ICustomScrollListener listener; + private boolean isSorted = true; + public boolean visible = true; + private boolean selectable = true; + + public GuiCustomScroll(GuiScreen parent, int id) + { + width = 176; + height = 166; + xSize = 176; + ySize = 159; + selected = -1; + hover = -1; + selectedList = new HashSet(); + listHeight = 0; + scrollY = 0; + scrollHeight = 0; + isScrolling = false; + if(parent instanceof ICustomScrollListener) + listener = (ICustomScrollListener) parent; + this.list = new ArrayList(); + this.id = id; + } + public GuiCustomScroll(GuiScreen parent, int id, boolean multipleSelection) + { + this(parent,id); + this.multipleSelection = multipleSelection; + } + public void setSize(int x, int y){ + ySize = y; + xSize = x; + listHeight = 14 * list.size(); + + if(listHeight > 0) + scrollHeight = (int) (((double)(ySize - 8) / (double)listHeight) * (ySize-8)); + else + scrollHeight = Integer.MAX_VALUE; + + maxScrollY = listHeight - (ySize - 8) - 1; + } + + public void drawScreen(int i, int j, float f, int mouseScrolled){ + if(!visible) + return; + drawGradientRect(guiLeft, guiTop, xSize+guiLeft ,ySize+guiTop, 0xc0101010, 0xd0101010); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + mc.renderEngine.bindTexture(resource); + + if(scrollHeight < ySize - 8){ + drawScrollBar(); + } + GL11.glPushMatrix(); + GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F); + GL11.glPopMatrix(); + GL11.glPushMatrix(); + GL11.glTranslatef(guiLeft, guiTop, 0.0F); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + + if(selectable) + hover = getMouseOver(i,j); + + drawItems(); + + GL11.glPopMatrix(); + if(scrollHeight < ySize - 8){ + i -= guiLeft; + j -= guiTop; + if(Mouse.isButtonDown(0)){ + if(i >= xSize-11 && i < xSize-6 && j >= 4 && j < ySize){ + isScrolling = true; + } + } + else + isScrolling = false; + + if(isScrolling){ + scrollY = (((j - 8) * listHeight) / (ySize-8)) - (scrollHeight); + if(scrollY < 0){ + scrollY = 0; + } + if(scrollY > maxScrollY){ + scrollY = maxScrollY; + } + } + + if(mouseScrolled != 0){ + scrollY += mouseScrolled > 0?-14:14; + if(scrollY > maxScrollY) + scrollY = maxScrollY; + if(scrollY < 0) + scrollY = 0; + } + } + } + + public boolean mouseInOption(int i, int j, int k) + { + int l = 4; + int i1 = ((14 * k + 4) - scrollY); + return i >= l - 1 && i < l + xSize - 11 && j >= i1 - 1 && j < i1 + 8; + } + + protected void drawItems() + { + for(int i = 0; i < list.size(); i++) + { + int j = 4; + int k = (14 * i + 4) - scrollY; + if(k >= 4 && k + 12 < ySize) + { + int xOffset = scrollHeight < ySize - 8?0:10; + String displayString = StatCollector.translateToLocal(list.get(i)); + + String text = ""; + float maxWidth = (xSize + xOffset - 8) * 0.8f; + if(fontRendererObj.getStringWidth(displayString) > maxWidth){ + for(int h = 0; h < displayString.length(); h++){ + char c = displayString.charAt(h); + text += c; + if(fontRendererObj.getStringWidth(text) > maxWidth) + break; + } + if(displayString.length() > text.length()) + text += "..."; + } + else + text = displayString; + if((multipleSelection && selectedList.contains(text)) || (!multipleSelection && selected == i)) { + drawVerticalLine(j-2, k-4, k + 10, 0xffffffff); + drawVerticalLine(j + xSize - 18 + xOffset, k - 4, k + 10, 0xffffffff); + drawHorizontalLine(j - 2, j + xSize - 18 + xOffset, k - 3 , 0xffffffff); + drawHorizontalLine(j - 2, j + xSize - 18 + xOffset, k + 10 , 0xffffffff); + fontRendererObj.drawString(text, j , k, 0xffffff); + } + else if(i == hover) + fontRendererObj.drawString(text, j , k, 0x00ff00); + else + fontRendererObj.drawString(text, j , k, 0xffffff); + } + } + + } + public String getSelected(){ + if(selected == -1 || selected >= list.size() ) + return null; + return list.get(selected); + } + private int getMouseOver(int i, int j){ + i -= guiLeft; + j -= guiTop; + //fontRenderer.drawString(".", i , j, 0xffffff); + if(i >= 4 && i < xSize - 4 && j >= 4 && j < ySize) + { + for(int j1 = 0; j1 < list.size(); j1++) + { + if(!mouseInOption(i, j, j1)) + { + continue; + } + + return j1; + } + + } + + return -1; + } + + public void mouseClicked(int i, int j, int k) + { + if(k != 0 || hover < 0) + return; + if(multipleSelection) { + if(selectedList.contains(list.get(hover))) { + selectedList.remove(list.get(hover)); + } else { + selectedList.add(list.get(hover)); + } + } else { + if(hover >= 0) + selected = hover; + hover = -1; + } + if(listener != null) + listener.customScrollClicked(i, j, k,this); + } + + private void drawScrollBar() + { + int i = guiLeft + xSize - 9; + int j = guiTop + (int)(((double)scrollY / (double)listHeight) * (double)(ySize-8)) + 4; + int k = j; + drawTexturedModalRect(i, k, xSize, 9, 5, 1); + for(k++; k < (j + scrollHeight) - 1; k++) + { + drawTexturedModalRect(i, k, xSize, 10, 5, 1); + } + + drawTexturedModalRect(i, k, xSize, 11, 5, 1); + } + public boolean hasSelected() { + // TODO Auto-generated method stub + return selected >= 0; + } + public void setList(List list){ + isSorted = true; + Collections.sort(list, String.CASE_INSENSITIVE_ORDER); + this.list = list; + setSize(xSize,ySize); + } + public void setUnsortedList(List list){ + isSorted = false; + this.list = list; + setSize(xSize,ySize); + } + public void replace(String old, String name) { + String select = getSelected(); + list.remove(old); + list.add(name); + if(isSorted) + Collections.sort(list,String.CASE_INSENSITIVE_ORDER); + if(old.equals(select)) + select = name; + + selected = list.indexOf(select); + setSize(xSize,ySize); + } + public void setSelected(String name) { + selected = list.indexOf(name); + } + public void clear() { + list = new ArrayList(); + selected = -1; + scrollY = 0; + setSize(xSize,ySize); + } + public List getList() { + return list; + } + public HashSet getSelectedList() { + return selectedList; + } + public void setSelectedList(HashSet selectedList) { + this.selectedList = selectedList; + } + public GuiCustomScroll setUnselectable() { + selectable = false; + return this; + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/util/GuiHoverText.java b/src/main/java/noppes/npcs/client/gui/util/GuiHoverText.java new file mode 100644 index 000000000..be2fed849 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/util/GuiHoverText.java @@ -0,0 +1,44 @@ +package noppes.npcs.client.gui.util; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.util.ResourceLocation; + +import org.lwjgl.opengl.GL11; + +public class GuiHoverText extends GuiScreen{ + private int x, y; + public int id; + + protected static final ResourceLocation buttonTextures = new ResourceLocation("customnpcs:textures/gui/info.png"); + private String text; + public GuiHoverText(int id, String text, int x, int y){ + this.text = text; + this.id = id; + this.x = x; + this.y = y; + } + + @Override + public void drawScreen(int par1, int par2, float par3){ + GL11.glColor4f(1, 1, 1, 1); + mc.getTextureManager().bindTexture(buttonTextures); + this.drawTexturedModalRect(this.x, this.y, 0, 0, 12, 12); + + if(inArea(x, y, 12, 12, par1, par2)){ + List lines = new ArrayList(); + lines.add(text); + this.drawHoveringText(lines, x + 8, y + 6, this.fontRendererObj); + GL11.glDisable(GL11.GL_LIGHTING); + } + } + public boolean inArea(int x, int y, int width, int height, int mouseX, int mouseY){ + if(mouseX < x || mouseX > x + width || mouseY < y || mouseY > y + height) + return false; + return true; + } +} diff --git a/src/main/java/noppes/npcs/client/gui/util/GuiMenuSideButton.java b/src/main/java/noppes/npcs/client/gui/util/GuiMenuSideButton.java new file mode 100644 index 000000000..a56cc4cd5 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/util/GuiMenuSideButton.java @@ -0,0 +1,82 @@ +package noppes.npcs.client.gui.util; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.util.ResourceLocation; + +import org.lwjgl.opengl.GL11; + +public class GuiMenuSideButton extends GuiNpcButton{ + public static final ResourceLocation resource = new ResourceLocation("customnpcs","textures/gui/menusidebutton.png"); + + public boolean active; + + public GuiMenuSideButton(int i, int j, int k, String s){ + this(i, j, k, 200, 20, s); + } + + public GuiMenuSideButton(int i, int j, int k, int l, int i1, String s){ + super(i, j, k, l, i1, s); + active = false; + } + + @Override + public int getHoverState(boolean flag){ + if (active) + return 0; + return 1; + } + + @Override + public void drawButton(Minecraft minecraft, int i, int j){ + if (!visible){ + return; + } + FontRenderer fontrenderer = minecraft.fontRenderer; + minecraft.renderEngine.bindTexture(resource); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + int width = this.width + (active?2:0); + field_146123_n = i >= xPosition && j >= yPosition && i < xPosition + width && j < yPosition + height; + int k = getHoverState(field_146123_n); + drawTexturedModalRect(xPosition, yPosition, 0, k * 22, width, height); + mouseDragged(minecraft, i, j); + + String text = ""; + float maxWidth = width * 0.75f; + if(fontrenderer.getStringWidth(displayString) > maxWidth){ + for(int h = 0; h < displayString.length(); h++){ + char c = displayString.charAt(h); + if(fontrenderer.getStringWidth(text + c) > maxWidth) + break; + text += c; + } + text += "..."; + } + else + text = displayString; + if (active){ + drawCenteredString(fontrenderer, text, xPosition + width / 2, yPosition + (height - 8) / 2, 0xffffa0); + } + else if (field_146123_n){ + drawCenteredString(fontrenderer, text, xPosition + width / 2, yPosition + (height - 8) / 2, 0xffffa0); + } + else{ + drawCenteredString(fontrenderer, text, xPosition + width / 2, yPosition + (height - 8) / 2, 0xe0e0e0); + } + } + + @Override + protected void mouseDragged(Minecraft minecraft, int i, int j){ + } + + @Override + public void mouseReleased(int i, int j){ + + } + + @Override + public boolean mousePressed(Minecraft minecraft, int i, int j){ + return !active && visible && field_146123_n; + } +} diff --git a/src/main/java/noppes/npcs/client/gui/util/GuiMenuTopButton.java b/src/main/java/noppes/npcs/client/gui/util/GuiMenuTopButton.java new file mode 100644 index 000000000..36801735b --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/util/GuiMenuTopButton.java @@ -0,0 +1,110 @@ +package noppes.npcs.client.gui.util; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; + +import org.lwjgl.opengl.GL11; + +public class GuiMenuTopButton extends GuiNpcButton +{ + public static final ResourceLocation resource = new ResourceLocation("customnpcs","textures/gui/menutopbutton.png"); + protected int height; + public boolean active; + public boolean hover = false; + public boolean rotated = false; + + public IButtonListener listener; + + public GuiMenuTopButton(int i, int j, int k, String s) + { + super(i,j,k,StatCollector.translateToLocal(s)); + active = false; + + width = Minecraft.getMinecraft().fontRenderer.getStringWidth(displayString) + 12; + height = 20; + } + public GuiMenuTopButton(int i, GuiButton parent, String s) + { + this(i, parent.xPosition + parent.width, parent.yPosition, s); + } + + public GuiMenuTopButton(int i, GuiButton parent, String s, + IButtonListener listener) { + this(i, parent, s); + this.listener = listener; + } + + @Override + public int getHoverState(boolean flag) + { + byte byte0 = 1; + if (active) + { + byte0 = 0; + } + else if (flag) + { + byte0 = 2; + } + return byte0; + } + + @Override + public void drawButton(Minecraft minecraft, int i, int j) + { + if (!getVisible()) + { + return; + } + GL11.glPushMatrix(); + minecraft.renderEngine.bindTexture(resource); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + int height = this.height - (active?0:2); + hover = i >= xPosition && j >= yPosition && i < xPosition + getWidth() && j < yPosition + height; + int k = getHoverState(hover); + drawTexturedModalRect(xPosition, yPosition, 0, k * 20, getWidth() / 2, height); + drawTexturedModalRect(xPosition + getWidth() / 2, yPosition, 200 - getWidth() / 2, k * 20, getWidth() / 2, height); + mouseDragged(minecraft, i, j); + FontRenderer fontrenderer = minecraft.fontRenderer; + if(rotated) + GL11.glRotatef(90, 1, 0, 0); + if (active) + { + drawCenteredString(fontrenderer, displayString, xPosition + getWidth() / 2, yPosition + (height - 8) / 2, 0xffffa0); + } + else if (hover) + { + drawCenteredString(fontrenderer, displayString, xPosition + getWidth() / 2, yPosition + (height - 8) / 2, 0xffffa0); + } + else + { + drawCenteredString(fontrenderer, displayString, xPosition + getWidth() / 2, yPosition + (height - 8) / 2, 0xe0e0e0); + } + GL11.glPopMatrix(); + } + + @Override + protected void mouseDragged(Minecraft minecraft, int i, int j) + { + } + + @Override + public void mouseReleased(int i, int j) + { + } + + @Override + public boolean mousePressed(Minecraft minecraft, int i, int j) + { + boolean bo = !active && getVisible() && hover; + if(bo && listener != null){ + listener.actionPerformed(this); + return false; + } + return bo; + } +} diff --git a/src/main/java/noppes/npcs/client/gui/util/GuiMenuTopIconButton.java b/src/main/java/noppes/npcs/client/gui/util/GuiMenuTopIconButton.java new file mode 100644 index 000000000..c7a7668a7 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/util/GuiMenuTopIconButton.java @@ -0,0 +1,167 @@ +package noppes.npcs.client.gui.util; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.entity.RenderItem; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public class GuiMenuTopIconButton extends GuiMenuTopButton{ + private static final ResourceLocation resource = new ResourceLocation("textures/gui/container/creative_inventory/tabs.png"); + protected static RenderItem itemRender = new RenderItem(); + private ItemStack item; + + public GuiMenuTopIconButton(int i, int x, int y, String s, ItemStack item) { + super(i, x, y, s); + width = 28; + height = 28; + this.item = item; + } + + public GuiMenuTopIconButton(int i, GuiButton parent, String s, ItemStack item){ + super(i,parent, s); + width = 28; + height = 28; + this.item = item; + } + + public GuiMenuTopIconButton(int i, int x, int y, String s, IButtonListener listener, ItemStack item) { + super(i, x, y, s); + width = 28; + height = 28; + this.item = item; + this.listener = listener; + } + + public GuiMenuTopIconButton(int i, GuiButton parent, String s, + IButtonListener listener, ItemStack item) { + super(i, parent, s, listener); + width = 28; + height = 28; + this.item = item; + } + + @Override + public void drawButton(Minecraft minecraft, int i, int j){ + if (!getVisible()){ + return; + } + if(item.getItem() == null) + item = new ItemStack(Blocks.dirt); + hover = i >= xPosition && j >= yPosition && i < xPosition + getWidth() && j < yPosition + height; + Minecraft mc = Minecraft.getMinecraft(); + if(hover && !active){ + int x = i + mc.fontRenderer.getStringWidth(displayString); + GL11.glTranslatef(x, yPosition + 2, 0); + drawHoveringText(Arrays.asList(new String[] {displayString}), 0, 0, mc.fontRenderer); + GL11.glTranslatef(-x, -(yPosition + 2), 0); + } + mc.getTextureManager().bindTexture(resource); + GL11.glPushMatrix(); + GL11.glColor4f(1F, 1F, 1F, 1F); + GL11.glEnable(GL11.GL_BLEND); + GL11.glDisable(GL11.GL_LIGHTING); + this.drawTexturedModalRect(xPosition, yPosition + (active?2:0), 0, active?32:0, 28, 28); + this.zLevel = 100.0F; + itemRender.zLevel = 100.0F; + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + RenderHelper.enableGUIStandardItemLighting(); + itemRender.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.getTextureManager(), item, xPosition + 6, yPosition + 10); + itemRender.renderItemOverlayIntoGUI(mc.fontRenderer, mc.getTextureManager(), item, xPosition + 6, yPosition + 10); + RenderHelper.disableStandardItemLighting(); + GL11.glDisable(GL11.GL_LIGHTING); + itemRender.zLevel = 0.0F; + this.zLevel = 0.0F; + GL11.glPopMatrix(); + + + } + protected void drawHoveringText(List p_146283_1_, int p_146283_2_, int p_146283_3_, FontRenderer font) + { + if (!p_146283_1_.isEmpty()) + { + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + RenderHelper.disableStandardItemLighting(); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_DEPTH_TEST); + int k = 0; + Iterator iterator = p_146283_1_.iterator(); + + while (iterator.hasNext()) + { + String s = (String)iterator.next(); + int l = font.getStringWidth(s); + + if (l > k) + { + k = l; + } + } + + int j2 = p_146283_2_ + 12; + int k2 = p_146283_3_ - 12; + int i1 = 8; + + if (p_146283_1_.size() > 1) + { + i1 += 2 + (p_146283_1_.size() - 1) * 10; + } + + if (j2 + k > this.width) + { + j2 -= 28 + k; + } + + if (k2 + i1 + 6 > this.height) + { + k2 = this.height - i1 - 6; + } + + this.zLevel = 300.0F; + itemRender.zLevel = 300.0F; + int j1 = -267386864; + this.drawGradientRect(j2 - 3, k2 - 4, j2 + k + 3, k2 - 3, j1, j1); + this.drawGradientRect(j2 - 3, k2 + i1 + 3, j2 + k + 3, k2 + i1 + 4, j1, j1); + this.drawGradientRect(j2 - 3, k2 - 3, j2 + k + 3, k2 + i1 + 3, j1, j1); + this.drawGradientRect(j2 - 4, k2 - 3, j2 - 3, k2 + i1 + 3, j1, j1); + this.drawGradientRect(j2 + k + 3, k2 - 3, j2 + k + 4, k2 + i1 + 3, j1, j1); + int k1 = 1347420415; + int l1 = (k1 & 16711422) >> 1 | k1 & -16777216; + this.drawGradientRect(j2 - 3, k2 - 3 + 1, j2 - 3 + 1, k2 + i1 + 3 - 1, k1, l1); + this.drawGradientRect(j2 + k + 2, k2 - 3 + 1, j2 + k + 3, k2 + i1 + 3 - 1, k1, l1); + this.drawGradientRect(j2 - 3, k2 - 3, j2 + k + 3, k2 - 3 + 1, k1, k1); + this.drawGradientRect(j2 - 3, k2 + i1 + 2, j2 + k + 3, k2 + i1 + 3, l1, l1); + + for (int i2 = 0; i2 < p_146283_1_.size(); ++i2) + { + String s1 = (String)p_146283_1_.get(i2); + font.drawStringWithShadow(s1, j2, k2, -1); + + if (i2 == 0) + { + k2 += 2; + } + + k2 += 10; + } + + this.zLevel = 0.0F; + itemRender.zLevel = 0.0F; + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_DEPTH_TEST); + RenderHelper.enableStandardItemLighting(); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + } + } +} diff --git a/src/main/java/noppes/npcs/client/gui/util/GuiModelInterface.java b/src/main/java/noppes/npcs/client/gui/util/GuiModelInterface.java new file mode 100644 index 000000000..026199a82 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/util/GuiModelInterface.java @@ -0,0 +1,155 @@ +package noppes.npcs.client.gui.util; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.ModelData; +import noppes.npcs.ModelDataShared; +import noppes.npcs.client.EntityUtil; +import noppes.npcs.controllers.PlayerDataController; +import noppes.npcs.entity.EntityCustomNpc; + +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public class GuiModelInterface extends GuiNPCInterface{ + public ModelData playerdata; + + private static float rotation = 0; + + private GuiNpcButton left,right,zoom,unzoom; + + private static float zoomed = 60; + + public int xOffset = 0; + + public EntityCustomNpc npc; + + public GuiModelInterface(EntityCustomNpc npc){ + this.npc = npc; + playerdata = npc.modelData; + xSize = 380; + drawDefaultBackground = false; + } + + @Override + public void initGui() { + super.initGui(); + + addButton(unzoom = new GuiNpcButton(666, guiLeft + 148 + xOffset, guiTop + 200, 20, 20, "-")); + addButton(zoom = new GuiNpcButton(667, guiLeft + 214 + xOffset, guiTop + 200, 20, 20, "+")); + addButton(left = new GuiNpcButton(668, guiLeft + 170 + xOffset, guiTop + 200, 20, 20, "<")); + addButton(right = new GuiNpcButton(669, guiLeft + 192 + xOffset, guiTop + 200, 20, 20, ">")); + + addButton(new GuiNpcButton(66, width - 22, 2, 20, 20, "X")); + } + + @Override + protected void actionPerformed(GuiButton btn) { + if(btn.id == 66){ + close(); + } + } + @Override + public boolean doesGuiPauseGame() + { + return false; + } + private long start = -1; + @Override + public void drawScreen(int par1, int par2, float par3) + { + if(Mouse.isButtonDown(0)){ + if(left.mousePressed(mc, par1, par2)) + rotation+=par3 * 2; + else if(right.mousePressed(mc, par1, par2)) + rotation-=par3 * 2; + else if(zoom.mousePressed(mc, par1, par2)) + zoomed+=par3 * 2; + else if(unzoom.mousePressed(mc, par1, par2) && zoomed > 10) + zoomed-=par3 * 2; + + } + this.drawDefaultBackground(); + GL11.glColor4f(1, 1, 1, 1); + + EntityLivingBase entity = playerdata.getEntity(npc); + if(entity == null) + entity = this.npc; + + EntityUtil.Copy(npc, entity); + + int l = guiLeft + 190 + xOffset; + int i1 = guiTop + 180; + GL11.glEnable(GL11.GL_COLOR_MATERIAL); + GL11.glPushMatrix(); + GL11.glTranslatef(l, i1, 60F); + + + GL11.glScalef(-zoomed, zoomed, zoomed); + GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); + float f2 = entity.renderYawOffset; + float f3 = entity.rotationYaw; + float f4 = entity.rotationPitch; + float f7 = entity.rotationYawHead; + float f5 = (float)(l) - par1; + float f6 = (float)(i1 - 50) - par2; + 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 / 80F) * 20F, 1.0F, 0.0F, 0.0F); + entity.prevRenderYawOffset = entity.renderYawOffset = rotation; + entity.prevRotationYaw = entity.rotationYaw = (float)Math.atan(f5 / 80F) * 40F + rotation; + entity.rotationPitch = -(float)Math.atan(f6 / 80F) * 20F; + entity.prevRotationYawHead = entity.rotationYawHead = entity.rotationYaw; + GL11.glTranslatef(0.0F, entity.yOffset, 0.0F); + RenderManager.instance.playerViewY = 180F; + + try{ + RenderManager.instance.renderEntityWithPosYaw(entity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F); + } + catch(Exception e){ + playerdata.setEntityClass(null); + } + entity.prevRenderYawOffset = entity.renderYawOffset = f2; + entity.prevRotationYaw = entity.rotationYaw = f3; + entity.rotationPitch = f4; + entity.prevRotationYawHead = entity.rotationYawHead = f7; + GL11.glPopMatrix(); + RenderHelper.disableStandardItemLighting(); + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); + GL11.glDisable(GL11.GL_TEXTURE_2D); + OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); + GL11.glPushMatrix(); + GL11.glTranslatef(0.0F, 0f, 500.065F); + super.drawScreen(par1, par2, par3); + GL11.glPopMatrix(); + } + + @Override + public void keyTyped(char par1, int par2) + { + super.keyTyped(par1, par2); + if (par2 == 1) + { + close(); + } + } + public void close(){ + this.mc.displayGuiScreen((GuiScreen)null); + this.mc.setIngameFocus(); + } + + @Override + public void save() { + // TODO Auto-generated method stub + + } +} diff --git a/src/main/java/noppes/npcs/client/gui/util/GuiNPCInterface.java b/src/main/java/noppes/npcs/client/gui/util/GuiNPCInterface.java new file mode 100644 index 000000000..9adce5233 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/util/GuiNPCInterface.java @@ -0,0 +1,356 @@ +package noppes.npcs.client.gui.util; + +import java.awt.Toolkit; +import java.awt.Window; +import java.net.URI; +import java.util.ArrayList; +import java.util.HashMap; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityClientPlayerMP; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.util.ResourceLocation; +import noppes.npcs.entity.EntityNPCInterface; + +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.Display; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public abstract class GuiNPCInterface extends GuiScreen +{ + public static Window AWTWindow; + public EntityClientPlayerMP player; + public boolean drawDefaultBackground = true; + public EntityNPCInterface npc; + private HashMap buttons = new HashMap(); + private HashMap topbuttons = new HashMap(); + private HashMap sidebuttons = new HashMap(); + private HashMap textfields = new HashMap(); + private HashMap labels = new HashMap(); + private HashMap scrolls = new HashMap(); + private HashMap sliders = new HashMap(); + private HashMap extra = new HashMap(); + public String title; + private ResourceLocation background = null; + public boolean closeOnEsc = false; + public int guiLeft,guiTop,xSize,ySize; + private SubGuiInterface subgui; + public int mouseX, mouseY; + + public float bgScale = 1; + + public GuiNPCInterface(EntityNPCInterface npc) + { + this.player = Minecraft.getMinecraft().thePlayer; + this.npc = npc; + title = ""; + xSize = 200; + ySize = 222; + } + public GuiNPCInterface() + { + this(null); + } + public void setBackground(String texture){ + background = new ResourceLocation("customnpcs","textures/gui/" + texture); + } + public ResourceLocation getResource(String texture){ + return new ResourceLocation("customnpcs","textures/gui/" + texture); + } + @Override + public void initGui(){ + super.initGui(); + GuiNpcTextField.unfocus(); + if(subgui != null){ + subgui.setWorldAndResolution(mc, width, height); + subgui.initGui(); + } + guiLeft = (width- xSize)/2; + guiTop = (height - ySize) / 2; + buttonList.clear(); + labels.clear(); + textfields.clear(); + buttons.clear(); + sidebuttons.clear(); + topbuttons.clear(); + scrolls.clear(); + sliders.clear(); + Keyboard.enableRepeatEvents(true); + } + @Override + public void updateScreen(){ + if(subgui != null) + subgui.updateScreen(); + else{ + for(GuiNpcTextField tf : textfields.values()){ + if(tf.enabled) + tf.updateCursorCounter(); + } + super.updateScreen(); + } + } + + + public void addExtra(GuiHoverText gui) { + gui.setWorldAndResolution(mc, 350, 250); + extra.put(gui.id, gui); + } + + public void mouseClicked(int i, int j, int k) + { + if(AWTWindow != null) + return; + if(subgui != null) + subgui.mouseClicked(i,j,k); + else{ + for(GuiNpcTextField tf : new ArrayList(textfields.values())) + if(tf.enabled) + tf.mouseClicked(i, j, k); + if (k == 0){ + for(GuiCustomScroll scroll : new ArrayList(scrolls.values())){ + scroll.mouseClicked(i, j, k); + } + } + mouseEvent(i,j,k); + super.mouseClicked(i, j, k); + } + } + + public void mouseEvent(int i, int j, int k){}; + + @Override + protected void actionPerformed(GuiButton guibutton) { + if(subgui != null) + subgui.buttonEvent(guibutton); + else{ + buttonEvent(guibutton); + } + } + public void buttonEvent(GuiButton guibutton){}; + + @Override + public void keyTyped(char c, int i){ + if(AWTWindow != null) + return; + if(subgui != null) + subgui.keyTyped(c,i); + for(GuiNpcTextField tf : textfields.values()) + tf.textboxKeyTyped(c, i); + + if (closeOnEsc && (i == 1 || !GuiNpcTextField.isActive() && isInventoryKey(i))){ + close(); + } + } + public void onGuiClosed(){ + GuiNpcTextField.unfocus(); + } + public void close(){ + displayGuiScreen(null); + mc.setIngameFocus(); + save(); + } + public void addButton(GuiNpcButton button){ + buttons.put(button.id,button); + buttonList.add(button); + } + public void addTopButton(GuiMenuTopButton button){ + topbuttons.put(button.id,button); + buttonList.add(button); + } + public void addSideButton(GuiMenuSideButton button){ + sidebuttons.put(button.id,button); + buttonList.add(button); + } + public GuiNpcButton getButton(int i) { + return buttons.get(i); + } + public GuiMenuSideButton getSideButton(int i) { + return sidebuttons.get(i); + } + public GuiMenuTopButton getTopButton(int i) { + return topbuttons.get(i); + } + public void addTextField(GuiNpcTextField tf){ + textfields.put(tf.id,tf); + } + public GuiNpcTextField getTextField(int i){ + return textfields.get(i); + } + public void addLabel(GuiNpcLabel label) { + labels.put(label.id, label); + } + public GuiNpcLabel getLabel(int i){ + return labels.get(i); + } + + public void addSlider(GuiNpcSlider slider){ + sliders.put(slider.id,slider); + buttonList.add(slider); + } + public GuiNpcSlider getSlider(int i) { + return sliders.get(i); + } + public void addScroll(GuiCustomScroll scroll) { + scroll.setWorldAndResolution(mc, 350, 250); + scrolls.put(scroll.id, scroll); + } + public GuiCustomScroll getScroll(int id){ + return scrolls.get(id); + } + + public abstract void save(); + + @Override + public void drawScreen(int i, int j, float f){ + if(AWTWindow != null){ + if(!AWTWindow.isVisible()){ + AWTWindow.dispose(); + AWTWindow = null; + } + else if(Display.isActive()){ + Toolkit.getDefaultToolkit().beep(); + AWTWindow.setVisible(true); + } + } + mouseX = i; + mouseY = j; + if(drawDefaultBackground && subgui == null) + drawDefaultBackground(); + + if(background != null && mc.renderEngine != null){ + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glPushMatrix(); + GL11.glTranslatef(guiLeft, guiTop, 0); + GL11.glScalef(bgScale, bgScale, bgScale); + mc.renderEngine.bindTexture(background); + if(xSize > 256){ + drawTexturedModalRect(0, 0, 0, 0, 250, ySize); + drawTexturedModalRect(250, 0, 256 - (xSize - 250), 0, xSize - 250, ySize); + } + else + drawTexturedModalRect(0, 0, 0, 0, xSize, ySize); + GL11.glPopMatrix(); + } + + drawCenteredString(fontRendererObj, title, width / 2, guiTop + 4, 0xffffff); + for(GuiNpcLabel label : labels.values()) + label.drawLabel(this,fontRendererObj); + for(GuiNpcTextField tf : textfields.values()){ + tf.drawTextBox(i, j); + } + for(GuiCustomScroll scroll : scrolls.values()) + scroll.drawScreen(i, j, f, hasSubGui()?0:Mouse.getDWheel()); + for(GuiScreen gui : extra.values()) + gui.drawScreen(i, j, f); + super.drawScreen(i, j, f); + if(subgui != null) + subgui.drawScreen(i,j,f); + } + public FontRenderer getFontRenderer() { + return this.fontRendererObj; + } + + public void elementClicked() { + if(subgui != null) + subgui.elementClicked(); + } + @Override + public boolean doesGuiPauseGame(){ + return false; + } + + public void doubleClicked() { + } + + public boolean isInventoryKey(int i){ + return i == mc.gameSettings.keyBindInventory.getKeyCode(); //inventory key + } + @Override + public void drawDefaultBackground() { + super.drawDefaultBackground(); + } + + public void displayGuiScreen(GuiScreen gui) { + mc.displayGuiScreen(gui); + } + + public void setSubGui(SubGuiInterface gui){ + subgui = gui; + subgui.setWorldAndResolution(mc, width, height); + subgui.parent = this; + initGui(); + } + public void closeSubGui(SubGuiInterface gui) { + subgui = null; + } + public boolean hasSubGui() { + return subgui != null; + } + public SubGuiInterface getSubGui() { + if(hasSubGui() && subgui.hasSubGui()) + return subgui.getSubGui(); + return subgui; + } + + public void drawNpc(int x, int y){ + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + + GL11.glEnable(GL11.GL_COLOR_MATERIAL); + GL11.glPushMatrix(); + GL11.glTranslatef(guiLeft + x, guiTop + y, 50F); + float scale = 1; + if(npc.height > 2.4) + scale = 2 / npc.height; + + GL11.glScalef(-30 * scale, 30 * scale, 30 * scale); + GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); + + + float f2 = npc.renderYawOffset; + float f3 = npc.rotationYaw; + float f4 = npc.rotationPitch; + float f7 = npc.rotationYawHead; + float f5 = (float) (guiLeft + x) - mouseX; + float f6 = (float) ((guiTop + y) - 50) - mouseY; + 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; + npc.rotationYawHead = npc.rotationYaw; + GL11.glTranslatef(0.0F, npc.yOffset, 0.0F); + RenderManager.instance.playerViewY = 180F; + RenderManager.instance.renderEntityWithPosYaw(npc, 0, 0, 0, 0, 1); + npc.renderYawOffset = f2; + npc.rotationYaw = f3; + npc.rotationPitch = f4; + npc.rotationYawHead = f7; + GL11.glPopMatrix(); + RenderHelper.disableStandardItemLighting(); + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + + OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); + GL11.glDisable(GL11.GL_TEXTURE_2D); + OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); + } + + public void openLink(String link){ + 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[] {new URI(link)}); + } + catch (Throwable throwable) + { + } + } +} diff --git a/src/main/java/noppes/npcs/client/gui/util/GuiNPCInterface2.java b/src/main/java/noppes/npcs/client/gui/util/GuiNPCInterface2.java new file mode 100644 index 000000000..bbb9a9a47 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/util/GuiNPCInterface2.java @@ -0,0 +1,72 @@ +package noppes.npcs.client.gui.util; + +import java.util.List; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ResourceLocation; +import noppes.npcs.client.Client; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.entity.EntityNPCInterface; + +import org.lwjgl.opengl.GL11; + +public abstract class GuiNPCInterface2 extends GuiNPCInterface +{ + private ResourceLocation background = new ResourceLocation("customnpcs:textures/gui/menubg.png"); + private GuiNpcMenu menu; + + public GuiNPCInterface2(EntityNPCInterface npc){ + this(npc, -1); + } + public GuiNPCInterface2(EntityNPCInterface npc, int activeMenu){ + super(npc); + xSize = 420; + ySize = 200; + menu = new GuiNpcMenu(this, activeMenu, npc); + + } + @Override + public void initGui(){ + super.initGui(); + menu.initGui(guiLeft, guiTop, xSize); + } + + + @Override + public void mouseClicked(int i, int j, int k){ + super.mouseClicked(i, j, k); + if(!hasSubGui()) + menu.mouseClicked(i, j, k); + } + + public void delete(){ + npc.delete(); + displayGuiScreen(null); + mc.setIngameFocus(); + } + public abstract void save(); + + @Override + public void drawScreen(int i, int j, float f) + { + if(drawDefaultBackground) + drawDefaultBackground(); //drawDefaultBackground + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + mc.renderEngine.bindTexture(background); + drawTexturedModalRect(guiLeft, guiTop, 0, 0, 200, 220); + drawTexturedModalRect(guiLeft + xSize-230, guiTop, 26, 0, 230, 220); + menu.drawElements(getFontRenderer(), i, j, mc, f); + + boolean bo = drawDefaultBackground; + drawDefaultBackground = false; + super.drawScreen(i, j, f); + drawDefaultBackground = bo; + } +} diff --git a/src/main/java/noppes/npcs/client/gui/util/GuiNPCStringSlot.java b/src/main/java/noppes/npcs/client/gui/util/GuiNPCStringSlot.java new file mode 100644 index 000000000..8e577c5c9 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/util/GuiNPCStringSlot.java @@ -0,0 +1,107 @@ +package noppes.npcs.client.gui.util; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Vector; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiSlot; +import net.minecraft.client.renderer.Tessellator; +import noppes.npcs.entity.EntityNPCInterface; + +public class GuiNPCStringSlot extends GuiSlot +{ + + private List list; /* synthetic field */ + public String selected; + public HashSet selectedList; + private boolean multiSelect; + private GuiNPCInterface parent; + public int size; + public GuiNPCStringSlot(Collection list,GuiNPCInterface parent,boolean multiSelect, int size) + { + super(Minecraft.getMinecraft(), parent.width, parent.height, 32, parent.height - 64, size); + selectedList = new HashSet(); + this.parent = parent; + this.list = new ArrayList(list); + Collections.sort(this.list,String.CASE_INSENSITIVE_ORDER); + this.multiSelect = multiSelect; + this.size = size; + } + public void setList(List list){ + Collections.sort(list,String.CASE_INSENSITIVE_ORDER); + this.list = list; + selected = ""; + } + + @Override + protected int getSize() + { + return list.size(); + } + private long prevTime = 0; + + @Override + protected void elementClicked(int i, boolean flag, int j, int k) + { +// GuiSelectWorld.onElementSelected(parentWorldGui, i); +// boolean flag1 = GuiSelectWorld.getSelectedWorld(parentWorldGui) >= 0 && GuiSelectWorld.getSelectedWorld(parentWorldGui) < getSize(); +// GuiSelectWorld.getSelectButton(parentWorldGui).enabled = flag1; +// GuiSelectWorld.getRenameButton(parentWorldGui).enabled = flag1; +// GuiSelectWorld.getDeleteButton(parentWorldGui).enabled = flag1; +// if(flag && flag1) +// { +// parentWorldGui.selectWorld(i); +// } + long time = System.currentTimeMillis(); + if(selected != null && selected.equals(list.get(i)) && time - prevTime < 400 ) + parent.doubleClicked(); + selected = list.get(i); + if(selectedList.contains(selected)) + selectedList.remove(selected); + else + selectedList.add(selected); + parent.elementClicked(); + prevTime = time; + } + + @Override + protected boolean isSelected(int i) + { + if(!multiSelect){ + if(selected == null) + return false; + return selected.equals(list.get(i)); + } + else{ + return selectedList.contains(list.get(i)); + } + } + + @Override + protected int getContentHeight() + { + return list.size() * size; + } + + @Override + protected void drawBackground() + { + parent.drawDefaultBackground(); + } + + @Override + protected void drawSlot(int i, int j, int k, int l, Tessellator tessellator, int var6, int var7) { + String s = list.get(i); + //if(!parent.drawSlot(i, j, k, l, tessellator, s)) + parent.drawString(parent.getFontRenderer(), s, j + 50, k + 3, 0xFFFFFF); + } + + public void clear() { + list.clear(); + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/util/GuiNpcButton.java b/src/main/java/noppes/npcs/client/gui/util/GuiNpcButton.java new file mode 100644 index 000000000..a59baa980 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/util/GuiNpcButton.java @@ -0,0 +1,72 @@ +package noppes.npcs.client.gui.util; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.util.StatCollector; + +public class GuiNpcButton extends GuiButton{ + + protected String[] display; + private int displayValue = 0; + public int id; + + public GuiNpcButton(int i, int j, int k, String s) { + super(i, j, k, StatCollector.translateToLocal(s)); + id = i; + } + public GuiNpcButton(int i, int j, int k, String[] display, int val) { + this(i, j, k, display[val]); + this.display = display; + this.displayValue = val; + } + public GuiNpcButton(int i, int j, int k, int l, int m, String string) { + super(i, j, k, l, m, StatCollector.translateToLocal(string)); + id = i; + } + public GuiNpcButton(int i, int j, int k, int l, int m, String[] display, + int val) { + this(i, j, k, l, m, display.length == 0?"":display[val % display.length]); + this.display = display; + this.displayValue = display.length == 0?0:val % display.length; + } + public void setDisplayText(String text){ + this.displayString = StatCollector.translateToLocal(text); + } + public int getValue(){ + return displayValue; + } + + public void setEnabled(boolean bo){ + this.enabled = bo; + } + public void setVisible(boolean b) { + this.visible = b; + } + public boolean getVisible() { + return visible; + } + + public void setDisplay(int value){ + this.displayValue = value; + this.setDisplayText(display[value]); + } + + public void setTextColor(int color){ + this.packedFGColour = color; + } + + @Override + public boolean mousePressed(Minecraft minecraft, int i, int j) + { + boolean bo = super.mousePressed(minecraft, i, j); + if(bo && display != null && display.length != 0){ + displayValue = (displayValue+1) % display.length; + this.setDisplayText(display[displayValue]); + } + return bo; + } + + public int getWidth() { + return width; + } +} diff --git a/src/main/java/noppes/npcs/client/gui/util/GuiNpcButtonYesNo.java b/src/main/java/noppes/npcs/client/gui/util/GuiNpcButtonYesNo.java new file mode 100644 index 000000000..1ae40534d --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/util/GuiNpcButtonYesNo.java @@ -0,0 +1,16 @@ +package noppes.npcs.client.gui.util; + +public class GuiNpcButtonYesNo extends GuiNpcButton{ + + public GuiNpcButtonYesNo(int id, int x, int y, boolean bo) { + this(id, x, y, 50, 20, bo); + } + + public GuiNpcButtonYesNo(int id, int x, int y, int width, int height, boolean bo) { + super(id, x, y, width, height, new String[]{"gui.no", "gui.yes"}, bo?1:0); + } + + public boolean getBoolean(){ + return getValue() == 1; + } +} diff --git a/src/main/java/noppes/npcs/client/gui/util/GuiNpcLabel.java b/src/main/java/noppes/npcs/client/gui/util/GuiNpcLabel.java new file mode 100644 index 000000000..b44132653 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/util/GuiNpcLabel.java @@ -0,0 +1,33 @@ +package noppes.npcs.client.gui.util; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.util.StatCollector; +import noppes.npcs.client.CustomNpcResourceListener; + +public class GuiNpcLabel { + public String label; + public int x,y,color; + public boolean enabled = true; + public int id; + + public GuiNpcLabel(int id, Object label, int x, int y, int color){ + this.id = id; + this.label = StatCollector.translateToLocal(label.toString()); + this.x = x; + this.y = y; + this.color = color; + } + public GuiNpcLabel(int id, Object label, int x, int y){ + this(id, label, x, y, CustomNpcResourceListener.DefaultTextColor); + } + public void drawLabel(GuiScreen gui, FontRenderer fontRenderer) { + if(enabled) + fontRenderer.drawString(label, x, y, color); + } + public void center(int width) { + int size = Minecraft.getMinecraft().fontRenderer.getStringWidth(label); + x += (width - size) / 2; + } +} diff --git a/src/main/java/noppes/npcs/client/gui/util/GuiNpcMenu.java b/src/main/java/noppes/npcs/client/gui/util/GuiNpcMenu.java new file mode 100644 index 000000000..3080b54af --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/util/GuiNpcMenu.java @@ -0,0 +1,149 @@ +package noppes.npcs.client.gui.util; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.GuiYesNo; +import net.minecraft.client.gui.GuiYesNoCallback; +import net.minecraft.util.StatCollector; +import noppes.npcs.CustomNpcs; +import noppes.npcs.client.Client; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.constants.EnumGuiType; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.entity.EntityNPCInterface; + +import org.lwjgl.input.Keyboard; + +public class GuiNpcMenu implements GuiYesNoCallback{ + + private GuiScreen parent; + private GuiMenuTopButton[] topButtons; + + private int activeMenu; + private EntityNPCInterface npc; + + public GuiNpcMenu(GuiScreen parent, int activeMenu, EntityNPCInterface npc) { + this.parent = parent; + this.activeMenu = activeMenu; + this.npc = npc; + } + + public void initGui(int guiLeft, int guiTop, int width) + { + Keyboard.enableRepeatEvents(true); + + GuiMenuTopButton display = new GuiMenuTopButton(1,guiLeft + 4, guiTop - 17, "menu.display"); + GuiMenuTopButton stats = new GuiMenuTopButton(2,display.xPosition + display.getWidth() , guiTop - 17, "menu.stats"); + GuiMenuTopButton ai = new GuiMenuTopButton(6,stats.xPosition + stats.getWidth() , guiTop - 17, "menu.ai"); + GuiMenuTopButton inv = new GuiMenuTopButton(3,ai.xPosition + ai.getWidth() , guiTop - 17, "menu.inventory"); + GuiMenuTopButton advanced = new GuiMenuTopButton(4,inv.xPosition + inv.getWidth() , guiTop - 17, "menu.advanced"); + GuiMenuTopButton global = new GuiMenuTopButton(5,advanced.xPosition + advanced.getWidth() , guiTop - 17, "menu.global"); + + GuiMenuTopButton close = new GuiMenuTopButton(0,guiLeft + width - 22, guiTop - 17, "X"); + GuiMenuTopButton delete = new GuiMenuTopButton(66,guiLeft + width - 72, guiTop - 17,"selectWorld.deleteButton"); + delete.xPosition = close.xPosition - delete.getWidth(); + + topButtons = new GuiMenuTopButton[]{display,stats,ai,inv,advanced,global,close,delete}; + + for(GuiMenuTopButton button : topButtons) + button.active = button.id == activeMenu; + } + + private void topButtonPressed(GuiMenuTopButton button) { + if(button.displayString.equals(activeMenu)) + return; + Minecraft mc = Minecraft.getMinecraft(); + NoppesUtil.clickSound(); + + int id = button.id; + if(id == 0){ + close(); + return; + } + else if(id == 66){ + GuiYesNo guiyesno = new GuiYesNo(this, "Confirm", StatCollector.translateToLocal("gui.delete"), 0); + mc.displayGuiScreen(guiyesno); + return; + } + save(); + if(id == 1){ + CustomNpcs.proxy.openGui(npc, EnumGuiType.MainMenuDisplay); + } + else if(id == 2){ + CustomNpcs.proxy.openGui(npc, EnumGuiType.MainMenuStats); + } + else if(id == 3){ + NoppesUtil.requestOpenGUI(EnumGuiType.MainMenuInv); + } + else if(id == 4){ + CustomNpcs.proxy.openGui(npc, EnumGuiType.MainMenuAdvanced); + } + else if(id == 5){ + CustomNpcs.proxy.openGui(npc, EnumGuiType.MainMenuGlobal); + } + else if(id == 6){ + CustomNpcs.proxy.openGui(npc, EnumGuiType.MainMenuAI); + } + activeMenu = id; + } + + private void save() { + GuiNpcTextField.unfocus(); + + if(parent instanceof GuiContainerNPCInterface2) + ((GuiContainerNPCInterface2)parent).save(); + + if(parent instanceof GuiNPCInterface2) + ((GuiNPCInterface2)parent).save(); + } + + private void close() { + if(parent instanceof GuiContainerNPCInterface2) + ((GuiContainerNPCInterface2)parent).close(); + + if(parent instanceof GuiNPCInterface2) + ((GuiNPCInterface2)parent).close(); + if(npc != null){ + npc.reset(); + Client.sendData(EnumPacketServer.NpcMenuClose); + } + } + + public void mouseClicked(int i, int j, int k) { + + if (k == 0) + { + Minecraft mc = Minecraft.getMinecraft(); + for (GuiMenuTopButton button : topButtons) + { + if (button.mousePressed(mc, i, j)) + { + topButtonPressed(button); + } + } + } + } + + + public void drawElements(FontRenderer fontRenderer, int i, int j, + Minecraft mc, float f) { + for(GuiMenuTopButton button: topButtons) + button.drawButton(mc, i, j); + + } + + + @Override + public void confirmClicked(boolean flag, int i){ + Minecraft mc = Minecraft.getMinecraft(); + if(flag){ + Client.sendData(EnumPacketServer.Delete); + mc.displayGuiScreen(null); + mc.setIngameFocus(); + } + else{ + NoppesUtil.openGUI(mc.thePlayer, parent); + } + } +} diff --git a/src/main/java/noppes/npcs/client/gui/util/GuiNpcSlider.java b/src/main/java/noppes/npcs/client/gui/util/GuiNpcSlider.java new file mode 100644 index 000000000..6e7751aa6 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/util/GuiNpcSlider.java @@ -0,0 +1,113 @@ +package noppes.npcs.client.gui.util; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import noppes.npcs.NoppesStringUtils; + +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; + +public class GuiNpcSlider extends GuiButton { + private ISliderListener listener; + public int id; + + public float sliderValue = 1.0F; + + public boolean dragging; + + public GuiNpcSlider(GuiScreen parent, int id, int xPos, int yPos, String displayString, float sliderValue) { + super(id, xPos, yPos, 150, 20, NoppesStringUtils.translate(displayString)); + this.id = id; + this.sliderValue = sliderValue; + if(parent instanceof ISliderListener) + listener = (ISliderListener) parent; + } + + public GuiNpcSlider(GuiScreen parent, int id, int xPos, int yPos, float sliderValue) { + this(parent, id, xPos, yPos, "", sliderValue); + if(listener != null) + listener.mouseDragged(this); + } + + public GuiNpcSlider(GuiScreen parent, int id, int xPos, int yPos, int width, int height, float sliderValue) { + this(parent, id, xPos, yPos, "", sliderValue); + this.width = width; + this.height = height; + if(listener != null) + listener.mouseDragged(this); + } + + @Override + public void mouseDragged(Minecraft mc, int par2, int par3){ + if (!this.visible) + return; + + mc.getTextureManager().bindTexture(buttonTextures); + if (this.dragging){ + this.sliderValue = (float)(par2 - (this.xPosition + 4)) / (float)(this.width - 8); + + if (this.sliderValue < 0.0F){ + this.sliderValue = 0.0F; + } + + if (this.sliderValue > 1.0F){ + this.sliderValue = 1.0F; + } + + if(listener != null) + listener.mouseDragged(this); + + if(!Mouse.isButtonDown(0)){ + this.func_146111_b(0, 0); + } + } + + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.drawTexturedModalRect(this.xPosition + (int)(this.sliderValue * (float)(this.width - 8)), this.yPosition, 0, 66, 4, 20); + this.drawTexturedModalRect(this.xPosition + (int)(this.sliderValue * (float)(this.width - 8)) + 4, this.yPosition, 196, 66, 4, 20); + } + + public String getDisplayString(){ + return displayString; + } + public void setString(String str) { + displayString = NoppesStringUtils.translate(str); + } + + @Override + public boolean mousePressed(Minecraft par1Minecraft, int par2, int par3){ + if (this.enabled && this.visible && par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height){ + this.sliderValue = (float)(par2 - (this.xPosition + 4)) / (float)(this.width - 8); + + if (this.sliderValue < 0.0F){ + this.sliderValue = 0.0F; + } + + if (this.sliderValue > 1.0F){ + this.sliderValue = 1.0F; + } + + if(listener != null) + listener.mousePressed(this); + + this.dragging = true; + return true; + } + return false; + } + + @Override + public void func_146111_b(int par1, int par2) + { + this.dragging = false; + + if(listener != null) + listener.mouseReleased(this); + } + + @Override + public int getHoverState(boolean par1){ + return 0; + } +} diff --git a/src/main/java/noppes/npcs/client/gui/util/GuiNpcTextArea.java b/src/main/java/noppes/npcs/client/gui/util/GuiNpcTextArea.java new file mode 100644 index 000000000..07837b115 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/util/GuiNpcTextArea.java @@ -0,0 +1,310 @@ +package noppes.npcs.client.gui.util; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.util.MathHelper; +import noppes.npcs.client.ClientProxy; +import noppes.npcs.client.ClientProxy.FontContainer; + +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; + +public class GuiNpcTextArea extends GuiNpcTextField{ + public boolean inMenu = true; + public boolean numbersOnly = false; + private int posX,posY,width,height; + private int cursorCounter; + private FontContainer font; + private int cursorPosition = 0; + private int listHeight; + private float scrolledY = 0; + private int startClick = -1; + private boolean clickVerticalBar = false; + private boolean wrapLine = true; + + public GuiNpcTextArea(int id,GuiScreen guiscreen, int i, int j, int k, int l, String s) { + super(id,guiscreen, i, j, k, l, s); + posX = i; + posY = j; + width = k; + listHeight = height = l; + this.font = ClientProxy.Font; + setMaxStringLength(Integer.MAX_VALUE); + this.setText(s); + } + + @Override + public void updateCursorCounter(){ + cursorCounter++; + } + + @Override + public boolean textboxKeyTyped(char c, int i){ + if (isFocused() && canEdit){ + String originalText = getText(); + this.setText(originalText); + if(c == '\r' || c == '\n'){ + this.setText(originalText.substring(0, cursorPosition) + c + originalText.substring(cursorPosition)); + } + this.setCursorPositionZero(); + this.moveCursorBy(cursorPosition); + boolean bo = super.textboxKeyTyped(c, i); + String newText = getText(); + if(i != Keyboard.KEY_DELETE) + cursorPosition += newText.length() - originalText.length(); + if(i == Keyboard.KEY_LEFT && cursorPosition > 0) + cursorPosition--; + if(i == Keyboard.KEY_RIGHT && cursorPosition < newText.length()) + cursorPosition++; + return bo; + + } + return false; + } + + @Override + public void mouseClicked(int i, int j, int k){ + boolean wasFocused = isFocused(); + super.mouseClicked(i, j, k); + + if(hoverVerticalScrollBar(i, j)){ + clickVerticalBar = true; + startClick = -1; + return; + } + if(k != 0 || !canEdit) + return; + + int x = i - posX; + int y = (j - posY - 4) / font.height() + getStartLineY(); + cursorPosition = 0; + List lines = getLines(); + int charCount = 0; + int lineCount = 0; + int maxSize = width - (isScrolling()?14:4); + for(int g = 0; g < lines.size(); g++){ + String wholeLine = lines.get(g); + String line = ""; + for(char c : wholeLine.toCharArray()){ + cursorPosition = charCount; + if(font.width(line + c) > maxSize && wrapLine){ + lineCount++; + line = ""; + if(y < lineCount){ + break; + } + } + if(lineCount == y && x <= font.width(line + c)) + return; + charCount++; + line += c; + + } + cursorPosition = charCount; + + + + lineCount++; + charCount++; + if(y < lineCount){ + break; + } + } + if(y >= lineCount) + cursorPosition = getText().length(); + } + + private List getLines(){ + List list = new ArrayList(); + String line = ""; + for(char c : getText().toCharArray()){ + if(c == '\r' || c == '\n'){ + list.add(line); + line = ""; + } + else + line += c; + } + list.add(line); + return list; + } + + private int getStartLineY(){ + if(!isScrolling()) + scrolledY = 0; + return MathHelper.ceiling_double_int(scrolledY * (listHeight) / font.height()); + } + + @Override + public void drawTextBox(int mouseX, int mouseY) { + drawRect(posX - 1, posY - 1, posX + width + 1, posY + height + 1, 0xffa0a0a0); + drawRect(posX, posY, posX + width, posY + height, 0xff000000); + + //int color = isEnabled?0xe0e0e0:0x707070; + int color = 0xe0e0e0; + boolean flag = isFocused() && (cursorCounter / 6) % 2 == 0; + + int startLine = getStartLineY(); + + int maxLine = height / font.height() + startLine; + + List lines = getLines(); + int charCount = 0; + int lineCount = 0; + int maxSize = width - (isScrolling()?14:4); + for(int i = 0; i < lines.size(); i++){ + String wholeLine = lines.get(i); + String line = ""; + for(char c : wholeLine.toCharArray()){ + if(font.width(line + c) > maxSize && wrapLine){ + if(lineCount >= startLine && lineCount < maxLine) + drawString(null, line, posX + 4, posY + 4 + ((lineCount - startLine) * font.height()), color); + line = ""; + lineCount++; + } + if(flag && charCount == cursorPosition && lineCount >= startLine && lineCount < maxLine && canEdit){ + int xx = posX + font.width(line) + 4; + int yy = posY + ((lineCount - startLine) * font.height()) + 4; + if(getText().length() == cursorPosition){ + font.drawString("_", xx, yy, color); + } + else{ + drawCursorVertical(xx, yy, xx + 1, yy + font.height()); + } + } + charCount++; + line += c; + } + if(lineCount >= startLine && lineCount < maxLine){ + drawString(null, line, posX + 4, posY + 4 + ((lineCount - startLine) * (font.height())), color); + if(flag && charCount == cursorPosition && canEdit){ + int xx = posX + font.width(line) + 4; + int yy = posY + ((lineCount - startLine) * font.height()) + 4; + if(getText().length() == cursorPosition){ + font.drawString("_", xx, yy, color); + } + else{ + drawCursorVertical(xx, yy, xx + 1, yy + font.height()); + } + } + } + lineCount++; + charCount++; + } + + + int k2 = Mouse.getDWheel(); + if(k2 != 0 && isFocused()){ + addScrollY(k2 < 0?-10:10); + } + + if(Mouse.isButtonDown(0)){ + if(clickVerticalBar){ + if(startClick >= 0) + addScrollY(startClick - (mouseY - posY)); + + if(hoverVerticalScrollBar(mouseX, mouseY)) + startClick = mouseY - posY; + + startClick = mouseY - posY; + } + } + else + clickVerticalBar = false; + + listHeight = lineCount * font.height(); + drawVerticalScrollBar(); + } + + public void drawString(FontRenderer fontRendererIn, String text, int x, int y, int color){ + GL11.glColor4f(1, 1, 1, 1); + font.drawString(text, x, y, color); + //super.drawString(fontRendererIn, text, x, y, color); + } + + private boolean isScrolling() { + return listHeight > height - 4; + } + + private void addScrollY(int scrolled){ + scrolledY -= 1f * scrolled / height; + + if(scrolledY < 0) + scrolledY = 0; + + float max = 1 - 1f * (height + 2) / listHeight; + if(scrolledY > max ) + scrolledY = max; + } + + private boolean hoverVerticalScrollBar(int x, int y){ + if(listHeight <= height - 4) + return false; + + if(posY < y && posY + height > y && x < posX + width && x > posX + (width - 8)) + return true; + + return false; + } + + private void drawCursorVertical(int p_146188_1_, int p_146188_2_, int p_146188_3_, int p_146188_4_){ + int i1; + + if (p_146188_1_ < p_146188_3_){ + i1 = p_146188_1_; + p_146188_1_ = p_146188_3_; + p_146188_3_ = i1; + } + + if (p_146188_2_ < p_146188_4_){ + i1 = p_146188_2_; + p_146188_2_ = p_146188_4_; + p_146188_4_ = i1; + } + + if (p_146188_3_ > this.posX + this.width){ + p_146188_3_ = this.posX + this.width; + } + + if (p_146188_1_ > this.posX + this.width){ + p_146188_1_ = this.posX + this.width; + } + + Tessellator tessellator = Tessellator.instance; + GL11.glColor4f(0.0F, 0.0F, 255.0F, 255.0F); + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glEnable(GL11.GL_COLOR_LOGIC_OP); + GL11.glLogicOp(GL11.GL_OR_REVERSE); + tessellator.startDrawingQuads(); + tessellator.addVertex((double)p_146188_1_, (double)p_146188_4_, 0.0D); + tessellator.addVertex((double)p_146188_3_, (double)p_146188_4_, 0.0D); + tessellator.addVertex((double)p_146188_3_, (double)p_146188_2_, 0.0D); + tessellator.addVertex((double)p_146188_1_, (double)p_146188_2_, 0.0D); + tessellator.draw(); + GL11.glDisable(GL11.GL_COLOR_LOGIC_OP); + GL11.glEnable(GL11.GL_TEXTURE_2D); + } + private int getVerticalBarSize(){ + return (int) (1f * height / listHeight * (height - 4)); + } + private void drawVerticalScrollBar(){ + if(listHeight <= height - 4) + return; + Minecraft.getMinecraft().renderEngine.bindTexture(GuiCustomScroll.resource); + int x = posX + width - 6; + int y = (int) (posY + scrolledY * height) + 2; + GL11.glColor4f(1, 1, 1, 1); + int sbSize = getVerticalBarSize(); + drawTexturedModalRect(x, y, width, 9, 5, 1); + for(int k = 0; k < sbSize; k++){ + drawTexturedModalRect(x, y + k, width, 10, 5, 1); + } + drawTexturedModalRect(x, y, width, 11, 5, 1); + } +} diff --git a/src/main/java/noppes/npcs/client/gui/util/GuiNpcTextField.java b/src/main/java/noppes/npcs/client/gui/util/GuiNpcTextField.java new file mode 100644 index 000000000..4aef50d55 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/util/GuiNpcTextField.java @@ -0,0 +1,130 @@ +package noppes.npcs.client.gui.util; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.GuiTextField; + +public class GuiNpcTextField extends GuiTextField{ + public boolean enabled = true; + public boolean inMenu = true; + public boolean numbersOnly = false; + private ITextfieldListener listener; + public int id; + public int min = 0,max = Integer.MAX_VALUE,def = 0; + private static GuiNpcTextField activeTextfield = null; + public boolean canEdit = true; + + private final int[] allowedSpecialChars = {14,211,203,205}; + + public GuiNpcTextField(int id,GuiScreen parent, FontRenderer fontRenderer, + int i, int j, int k, int l, String s) { + super(fontRenderer, i, j, k, l); + setMaxStringLength(500); + this.setText(s); + this.id = id; + if(parent instanceof ITextfieldListener) + listener = (ITextfieldListener) parent; + } + + public static boolean isActive(){ + return activeTextfield != null; + } + + public GuiNpcTextField(int id,GuiScreen parent, + int i, int j, int k, int l, String s) { + this(id, parent, Minecraft.getMinecraft().fontRenderer, i, j, k, l, s); + } + + private boolean charAllowed(char c, int i){ + if(!numbersOnly || Character.isDigit(c)) + return true; + for(int j : allowedSpecialChars) + if(j == i) + return true; + + return false; + } + + @Override + public boolean textboxKeyTyped(char c, int i) + { + if(!charAllowed(c,i) || !canEdit) + return false; + return super.textboxKeyTyped(c, i); + } + + public boolean isEmpty(){ + return getText().trim().length() == 0; + } + + public int getInteger(){ + return Integer.parseInt(getText()); + } + public boolean isInteger(){ + try{ + Integer.parseInt(getText()); + return true; + }catch(NumberFormatException e){ + return false; + } + } + @Override + public void mouseClicked(int i, int j, int k){ + if(!canEdit) + return; + boolean wasFocused = this.isFocused(); + super.mouseClicked(i, j, k); + if(wasFocused != isFocused()){ + if(wasFocused){ + unFocused(); + } + } + if(isFocused()) + activeTextfield = this; + } + + public void unFocused(){ + if(numbersOnly){ + if(isEmpty() || !isInteger()) + setText(def + ""); + else if( getInteger() < min) + setText(min+""); + else if(getInteger() > max) + setText(max+""); + } + if(listener != null) + listener.unFocused(this); + + if(this == activeTextfield) + activeTextfield = null; + } + @Override + public void drawTextBox() + { + if(enabled) + super.drawTextBox(); + } + public void setMinMaxDefault(int i, int j, int k) { + min = i; + max = j; + def = k; + } + public static void unfocus() { + GuiNpcTextField prev = activeTextfield; + activeTextfield = null; + if(prev != null){ + prev.unFocused(); + } + } + + public void drawTextBox(int mousX, int mousY) { + drawTextBox(); + } + + public GuiNpcTextField setNumbersOnly() { + numbersOnly = true; + return this; + } + +} diff --git a/src/main/java/noppes/npcs/client/gui/util/GuiSelectionListener.java b/src/main/java/noppes/npcs/client/gui/util/GuiSelectionListener.java new file mode 100644 index 000000000..5d3c727c5 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/util/GuiSelectionListener.java @@ -0,0 +1,5 @@ +package noppes.npcs.client.gui.util; + +public interface GuiSelectionListener { + public void selected(int id, String name); +} diff --git a/src/main/java/noppes/npcs/client/gui/util/IButtonListener.java b/src/main/java/noppes/npcs/client/gui/util/IButtonListener.java new file mode 100644 index 000000000..84a8a2c01 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/util/IButtonListener.java @@ -0,0 +1,7 @@ +package noppes.npcs.client.gui.util; + +import net.minecraft.client.gui.GuiButton; + +public interface IButtonListener { + public void actionPerformed(GuiButton button); +} diff --git a/src/main/java/noppes/npcs/client/gui/util/ICustomScrollListener.java b/src/main/java/noppes/npcs/client/gui/util/ICustomScrollListener.java new file mode 100644 index 000000000..b761c0c8f --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/util/ICustomScrollListener.java @@ -0,0 +1,9 @@ +package noppes.npcs.client.gui.util; + + + +public interface ICustomScrollListener { + + void customScrollClicked(int i, int j, int k, GuiCustomScroll guiCustomScroll); + +} diff --git a/src/main/java/noppes/npcs/client/gui/util/IGuiClose.java b/src/main/java/noppes/npcs/client/gui/util/IGuiClose.java new file mode 100644 index 000000000..29a09a21f --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/util/IGuiClose.java @@ -0,0 +1,7 @@ +package noppes.npcs.client.gui.util; + +import net.minecraft.nbt.NBTTagCompound; + +public interface IGuiClose { + public void setClose(int i, NBTTagCompound data); +} diff --git a/src/main/java/noppes/npcs/client/gui/util/IGuiData.java b/src/main/java/noppes/npcs/client/gui/util/IGuiData.java new file mode 100644 index 000000000..5984f6aae --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/util/IGuiData.java @@ -0,0 +1,7 @@ +package noppes.npcs.client.gui.util; + +import net.minecraft.nbt.NBTTagCompound; + +public interface IGuiData { + public void setGuiData(NBTTagCompound compound); +} diff --git a/src/main/java/noppes/npcs/client/gui/util/IGuiError.java b/src/main/java/noppes/npcs/client/gui/util/IGuiError.java new file mode 100644 index 000000000..5d4ff0f53 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/util/IGuiError.java @@ -0,0 +1,7 @@ +package noppes.npcs.client.gui.util; + +import net.minecraft.nbt.NBTTagCompound; + +public interface IGuiError { + public void setError(int i, NBTTagCompound data); +} diff --git a/src/main/java/noppes/npcs/client/gui/util/IJTextAreaListener.java b/src/main/java/noppes/npcs/client/gui/util/IJTextAreaListener.java new file mode 100644 index 000000000..311ebafb4 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/util/IJTextAreaListener.java @@ -0,0 +1,5 @@ +package noppes.npcs.client.gui.util; + +public interface IJTextAreaListener { + public void saveText(String text); +} diff --git a/src/main/java/noppes/npcs/client/gui/util/IScrollData.java b/src/main/java/noppes/npcs/client/gui/util/IScrollData.java new file mode 100644 index 000000000..318ca6fd3 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/util/IScrollData.java @@ -0,0 +1,9 @@ +package noppes.npcs.client.gui.util; + +import java.util.HashMap; +import java.util.Vector; + +public interface IScrollData { + public void setData(Vector list,HashMap data); + public void setSelected(String selected); +} diff --git a/src/main/java/noppes/npcs/client/gui/util/ISliderListener.java b/src/main/java/noppes/npcs/client/gui/util/ISliderListener.java new file mode 100644 index 000000000..1a08bcbb2 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/util/ISliderListener.java @@ -0,0 +1,12 @@ +package noppes.npcs.client.gui.util; + + +public interface ISliderListener { + + void mouseDragged(GuiNpcSlider guiNpcSlider); + + void mousePressed(GuiNpcSlider guiNpcSlider); + + void mouseReleased(GuiNpcSlider guiNpcSlider); + +} diff --git a/src/main/java/noppes/npcs/client/gui/util/ISubGuiListener.java b/src/main/java/noppes/npcs/client/gui/util/ISubGuiListener.java new file mode 100644 index 000000000..e4f0486cd --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/util/ISubGuiListener.java @@ -0,0 +1,5 @@ +package noppes.npcs.client.gui.util; + +public interface ISubGuiListener { + public void subGuiClosed(SubGuiInterface subgui); +} diff --git a/src/main/java/noppes/npcs/client/gui/util/ITextfieldListener.java b/src/main/java/noppes/npcs/client/gui/util/ITextfieldListener.java new file mode 100644 index 000000000..43763a6f0 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/util/ITextfieldListener.java @@ -0,0 +1,9 @@ +package noppes.npcs.client.gui.util; + + + +public interface ITextfieldListener { + + void unFocused(GuiNpcTextField textfield); + +} diff --git a/src/main/java/noppes/npcs/client/gui/util/ITopButtonListener.java b/src/main/java/noppes/npcs/client/gui/util/ITopButtonListener.java new file mode 100644 index 000000000..c28e3f168 --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/util/ITopButtonListener.java @@ -0,0 +1,7 @@ +package noppes.npcs.client.gui.util; + +public interface ITopButtonListener { + + void mouseClicked(int i, int j, int k); + +} diff --git a/src/main/java/noppes/npcs/client/gui/util/SubGuiInterface.java b/src/main/java/noppes/npcs/client/gui/util/SubGuiInterface.java new file mode 100644 index 000000000..b826c3ebb --- /dev/null +++ b/src/main/java/noppes/npcs/client/gui/util/SubGuiInterface.java @@ -0,0 +1,36 @@ +package noppes.npcs.client.gui.util; + +import net.minecraft.client.gui.GuiScreen; + +public class SubGuiInterface extends GuiNPCInterface{ + public GuiScreen parent; + + @Override + public void save() { + + } + @Override + public void close() { + if(parent instanceof ISubGuiListener) + ((ISubGuiListener)parent).subGuiClosed(this); + + if(parent instanceof GuiNPCInterface) + ((GuiNPCInterface)parent).closeSubGui(this); + else if(parent instanceof GuiContainerNPCInterface) + ((GuiContainerNPCInterface)parent).closeSubGui(this); + else + super.close(); + + } + + public GuiScreen getParent(){ + if(parent instanceof SubGuiInterface) + return ((SubGuiInterface)parent).getParent(); + return parent; + } + + @Override + public void drawScreen(int i, int j, float f){ + super.drawScreen(i, j, f); + } +} diff --git a/src/main/java/noppes/npcs/client/model/ModelMPM.java b/src/main/java/noppes/npcs/client/model/ModelMPM.java new file mode 100644 index 000000000..405a17de2 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/ModelMPM.java @@ -0,0 +1,431 @@ +package noppes.npcs.client.model; + +import java.util.Random; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelBiped; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.MathHelper; +import noppes.npcs.ModelPartConfig; +import noppes.npcs.ModelPartData; +import noppes.npcs.client.ClientProxy; +import noppes.npcs.client.model.animation.AniCrawling; +import noppes.npcs.client.model.animation.AniHug; +import noppes.npcs.client.model.part.ModelBeard; +import noppes.npcs.client.model.part.ModelBreasts; +import noppes.npcs.client.model.part.ModelClaws; +import noppes.npcs.client.model.part.ModelEars; +import noppes.npcs.client.model.part.ModelFin; +import noppes.npcs.client.model.part.ModelHair; +import noppes.npcs.client.model.part.ModelHeadwear; +import noppes.npcs.client.model.part.ModelLegs; +import noppes.npcs.client.model.part.ModelMohawk; +import noppes.npcs.client.model.part.ModelSnout; +import noppes.npcs.client.model.part.ModelTail; +import noppes.npcs.client.model.part.ModelWings; +import noppes.npcs.client.model.util.ModelPartInterface; +import noppes.npcs.client.model.util.ModelScaleRenderer; +import noppes.npcs.constants.EnumAnimation; +import noppes.npcs.constants.EnumJobType; +import noppes.npcs.entity.EntityCustomNpc; +import noppes.npcs.roles.JobPuppet; + +import org.lwjgl.opengl.GL11; + +public class ModelMPM extends ModelNPCMale{ + private ModelPartInterface wings; + private ModelPartInterface mohawk; + private ModelPartInterface hair; + private ModelPartInterface beard; + private ModelPartInterface breasts; + private ModelPartInterface snout; + private ModelPartInterface ears; + private ModelPartInterface fin; + + private ModelPartInterface clawsR; + private ModelPartInterface clawsL; + + private ModelLegs legs; + private ModelScaleRenderer headwear; + private ModelTail tail; + public ModelBase entityModel; + public EntityLivingBase entity; + + public boolean currentlyPlayerTexture; + + public boolean isArmor; + + public float alpha = 1; + + public ModelMPM(float par1) { + super(par1); + isArmor = par1 > 0; + float par2 = 0; + this.bipedCloak = new ModelRenderer(this, 0, 0); + this.bipedCloak.addBox(-5.0F, 0.0F, -1.0F, 10, 16, 1, par1); + this.bipedEars = new ModelRenderer(this, 24, 0); + this.bipedEars.addBox(-3.0F, -6.0F, -1.0F, 6, 6, 1, par1); + this.bipedHead = new ModelScaleRenderer(this, 0, 0); + this.bipedHead.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, par1); + this.bipedHead.setRotationPoint(0.0F, 0.0F + par2, 0.0F); + this.bipedHeadwear = new ModelScaleRenderer(this, 32, 0); + this.bipedHeadwear.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, par1 + 0.5F); + this.bipedHeadwear.setRotationPoint(0.0F, 0.0F + par2, 0.0F); + this.bipedBody = new ModelScaleRenderer(this, 16, 16); + this.bipedBody.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, par1); + this.bipedBody.setRotationPoint(0.0F, 0.0F + par2, 0.0F); + this.bipedRightArm = new ModelScaleRenderer(this, 40, 16); + this.bipedRightArm.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, par1); + this.bipedRightArm.setRotationPoint(-5.0F, 2.0F + par2, 0.0F); + this.bipedLeftArm = new ModelScaleRenderer(this, 40, 16); + this.bipedLeftArm.mirror = true; + this.bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, par1); + this.bipedLeftArm.setRotationPoint(5.0F, 2.0F + par2, 0.0F); + this.bipedRightLeg = new ModelScaleRenderer(this, 0, 16); + this.bipedRightLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, par1); + this.bipedRightLeg.setRotationPoint(-1.9F, 12.0F + par2, 0.0F); + this.bipedLeftLeg = new ModelScaleRenderer(this, 0, 16); + this.bipedLeftLeg.mirror = true; + this.bipedLeftLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, par1); + this.bipedLeftLeg.setRotationPoint(1.9F, 12.0F + par2, 0.0F); + + headwear = new ModelHeadwear(this); + legs = new ModelLegs(this, (ModelScaleRenderer)bipedRightLeg, (ModelScaleRenderer)bipedLeftLeg); + + breasts = new ModelBreasts(this); + this.bipedBody.addChild(breasts); + if(!isArmor){ + ears = new ModelEars(this); + this.bipedHead.addChild(ears); + + mohawk = new ModelMohawk(this); + this.bipedHead.addChild(mohawk); + + hair = new ModelHair(this); + this.bipedHead.addChild(hair); + + beard = new ModelBeard(this); + this.bipedHead.addChild(beard); + + snout = new ModelSnout(this); + this.bipedHead.addChild(snout); + + tail = new ModelTail(this); + + wings = new ModelWings(this); + this.bipedBody.addChild(wings); + + fin = new ModelFin(this); + this.bipedBody.addChild(fin); + + clawsL = new ModelClaws(this, false); + this.bipedLeftArm.addChild(clawsL); + + clawsR = new ModelClaws(this, true); + this.bipedRightArm.addChild(clawsR); + } + } + + private void setPlayerData(EntityCustomNpc entity){ + if(!isArmor){ + mohawk.setData(entity.modelData, entity); + beard.setData(entity.modelData, entity); + hair.setData(entity.modelData, entity); + snout.setData(entity.modelData, entity); + tail.setData(entity); + fin.setData(entity.modelData, entity); + wings.setData(entity.modelData, entity); + ears.setData(entity.modelData, entity); + clawsL.setData(entity.modelData, entity); + clawsR.setData(entity.modelData, entity); + } + breasts.setData(entity.modelData, entity); + legs.setData(entity); + } + + + @Override + public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7){ + EntityCustomNpc npc = (EntityCustomNpc) par1Entity; + + if(entityModel != null){ + if(!isArmor){ + entityModel.isChild = entity.isChild(); + entityModel.onGround = onGround; + entityModel.isRiding = isRiding; + if(entityModel instanceof ModelBiped){ + ModelBiped biped = (ModelBiped) entityModel; + biped.aimedBow = aimedBow; + biped.heldItemLeft = heldItemLeft; + biped.heldItemRight = heldItemRight; + biped.isSneak = isSneak; + } + entityModel.render(entity, par2, par3, par4, par5, par6, par7); + } + } + else{ + alpha = npc.isInvisible() && !npc.isInvisibleToPlayer(Minecraft.getMinecraft().thePlayer)?0.15f:1; + setPlayerData(npc); + currentlyPlayerTexture = true; + setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity); + if(npc.advanced.job == EnumJobType.Puppet){ + JobPuppet job = (JobPuppet) npc.jobInterface; + if(job.isActive()){ + float pi = (float) Math.PI; + + if(!job.head.disabled){ + bipedHeadwear.rotateAngleX = bipedHead.rotateAngleX = job.head.rotationX * pi; + bipedHeadwear.rotateAngleY = bipedHead.rotateAngleY = job.head.rotationY * pi; + bipedHeadwear.rotateAngleZ = bipedHead.rotateAngleZ = job.head.rotationZ * pi; + } + + if(!job.body.disabled){ + bipedBody.rotateAngleX = job.body.rotationX * pi; + bipedBody.rotateAngleY = job.body.rotationY * pi; + bipedBody.rotateAngleZ = job.body.rotationZ * pi; + } + + if(!job.larm.disabled){ + bipedLeftArm.rotateAngleX = job.larm.rotationX * pi; + bipedLeftArm.rotateAngleY = job.larm.rotationY * pi; + bipedLeftArm.rotateAngleZ = job.larm.rotationZ * pi; + + if(!npc.display.disableLivingAnimation){ + this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; + this.bipedLeftArm.rotateAngleX -= MathHelper.sin(par3 * 0.067F) * 0.05F; + } + } + + if(!job.rarm.disabled){ + bipedRightArm.rotateAngleX = job.rarm.rotationX * pi; + bipedRightArm.rotateAngleY = job.rarm.rotationY * pi; + bipedRightArm.rotateAngleZ = job.rarm.rotationZ * pi; + + if(!npc.display.disableLivingAnimation){ + this.bipedRightArm.rotateAngleZ += MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; + this.bipedRightArm.rotateAngleX += MathHelper.sin(par3 * 0.067F) * 0.05F; + } + } + + if(!job.rleg.disabled){ + bipedRightLeg.rotateAngleX = job.rleg.rotationX * pi; + bipedRightLeg.rotateAngleY = job.rleg.rotationY * pi; + bipedRightLeg.rotateAngleZ = job.rleg.rotationZ * pi; + } + + if(!job.lleg.disabled){ + bipedLeftLeg.rotateAngleX = job.lleg.rotationX * pi; + bipedLeftLeg.rotateAngleY = job.lleg.rotationY * pi; + bipedLeftLeg.rotateAngleZ = job.lleg.rotationZ * pi; + } + } + } + renderHead(npc, par7); + renderArms(npc, par7,false); + renderBody(npc, par7); + renderLegs(npc, par7); + } + + } + @Override + public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity entity) + { + EntityCustomNpc npc = (EntityCustomNpc) entity; + isRiding = npc.isRiding(); + if(isSneak && (npc.currentAnimation == EnumAnimation.CRAWLING || npc.currentAnimation == EnumAnimation.LYING)) + isSneak = false; + this.bipedBody.rotationPointX = 0; + this.bipedBody.rotationPointY = 0; + this.bipedBody.rotationPointZ = 0; + this.bipedBody.rotateAngleX = 0; + this.bipedBody.rotateAngleY = 0; + this.bipedBody.rotateAngleZ = 0; + this.bipedHead.rotateAngleZ = 0; + this.bipedHeadwear.rotateAngleZ = 0; + this.bipedLeftLeg.rotateAngleX = 0; + this.bipedLeftLeg.rotateAngleY = 0; + this.bipedLeftLeg.rotateAngleZ = 0; + this.bipedRightLeg.rotateAngleX = 0; + this.bipedRightLeg.rotateAngleY = 0; + this.bipedRightLeg.rotateAngleZ = 0; + this.bipedLeftArm.rotationPointY = 2; + this.bipedLeftArm.rotationPointZ = 0; + this.bipedRightArm.rotationPointY = 2; + this.bipedRightArm.rotationPointZ = 0; + + super.setRotationAngles(par1, par2, par3, par4, par5, par6, entity); + + if(!isArmor){ + hair.setRotationAngles(par1, par2, par3, par4, par5, par6, entity); + beard.setRotationAngles(par1, par2, par3, par4, par5, par6, entity); + wings.setRotationAngles(par1, par2, par3, par4, par5, par6, entity); + tail.setRotationAngles(par1, par2, par3, par4, par5, par6, entity); + } + legs.setRotationAngles(par1, par2, par3, par4, par5, par6, entity); + + if(isSleeping(entity)){ + if(bipedHead.rotateAngleX < 0){ + bipedHead.rotateAngleX = 0; + bipedHeadwear.rotateAngleX = 0; + } + } + else if(npc.currentAnimation == EnumAnimation.CRY) + bipedHeadwear.rotateAngleX = bipedHead.rotateAngleX = 0.7f; + else if(npc.currentAnimation == EnumAnimation.HUG){ + AniHug.setRotationAngles(par1, par2, par3, par4, par5, par6, entity, this); + } + else if(npc.currentAnimation == EnumAnimation.CRAWLING) + AniCrawling.setRotationAngles(par1, par2, par3, par4, par5, par6, entity, this); + else if(npc.currentAnimation == EnumAnimation.WAVING){ + bipedRightArm.rotateAngleX = -0.1f; + bipedRightArm.rotateAngleY = 0; + bipedRightArm.rotateAngleZ = (float) (Math.PI - 1f - Math.sin(entity.ticksExisted * 0.27f) * 0.5f ); + } + else if(isSneak) + this.bipedBody.rotateAngleX = 0.5F / npc.modelData.body.scaleY; + + + } + + public void setLivingAnimations(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4) + { + if(entityModel != null){ + entityModel.setLivingAnimations(entity, par2, par3, par4); + } + else{ + EntityCustomNpc npc = (EntityCustomNpc) par1EntityLivingBase; + if(!isArmor){ + ModelPartData partData = npc.modelData.getPartData("tail"); + if(partData != null) + tail.setLivingAnimations(partData, par1EntityLivingBase, par2, par3, par4); + } + } + } + + public void loadPlayerTexture(EntityCustomNpc npc){ + if(!isArmor && !currentlyPlayerTexture){ + ClientProxy.bindTexture(npc.textureLocation); + currentlyPlayerTexture = true; + } + } + + private void renderHead(EntityCustomNpc entity, float f) { + loadPlayerTexture(entity); + float x = 0; + float y = entity.modelData.getBodyY(); + float z = 0; + + GL11.glPushMatrix(); + if(entity.currentAnimation == EnumAnimation.DANCING){ + float dancing = entity.ticksExisted / 4f; + GL11.glTranslatef((float)Math.sin(dancing) * 0.075F, (float)Math.abs(Math.cos(dancing)) * 0.125F - 0.02F, (float)(-Math.abs(Math.cos(dancing))) * 0.075F); + } + ModelPartConfig head = entity.modelData.head; + if(bipedHeadwear.showModel && !bipedHeadwear.isHidden){ + if(entity.modelData.headwear == 1 || isArmor){ + ((ModelScaleRenderer)this.bipedHeadwear).setConfig(head,x,y,z); + ((ModelScaleRenderer)this.bipedHeadwear).render(f); + } + else if(entity.modelData.headwear == 2){ + this.headwear.rotateAngleX = bipedHeadwear.rotateAngleX; + this.headwear.rotateAngleY = bipedHeadwear.rotateAngleY; + this.headwear.rotateAngleZ = bipedHeadwear.rotateAngleZ; + this.headwear.rotationPointX = bipedHeadwear.rotationPointX; + this.headwear.rotationPointY = bipedHeadwear.rotationPointY; + this.headwear.rotationPointZ = bipedHeadwear.rotationPointZ; + this.headwear.setConfig(head,x,y,z); + this.headwear.render(f); + } + } + ((ModelScaleRenderer)this.bipedHead).setConfig(head,x,y,z); + ((ModelScaleRenderer)this.bipedHead).render(f); + + GL11.glPopMatrix(); + } + + private void renderBody(EntityCustomNpc entity, float f) { + loadPlayerTexture(entity); + float x = 0; + float y = entity.modelData.getBodyY(); + float z = 0; + GL11.glPushMatrix(); + + if(entity.currentAnimation == EnumAnimation.DANCING){ + float dancing = entity.ticksExisted / 4f; + GL11.glTranslatef((float)Math.sin(dancing) * 0.015F, 0.0F, 0.0F); + } + + ModelPartConfig body = entity.modelData.body; + ((ModelScaleRenderer)this.bipedBody).setConfig(body,x,y,z); + ((ModelScaleRenderer)this.bipedBody).render(f); + GL11.glPopMatrix(); + + } + public void renderArms(EntityCustomNpc entity, float f, boolean bo){ + loadPlayerTexture(entity); + ModelPartConfig arms = entity.modelData.arms; + + float x = (1 - entity.modelData.body.scaleX) * 0.25f + (1 - arms.scaleX) * 0.075f; + float y = entity.modelData.getBodyY() + (1 - arms.scaleY) * -0.1f; + float z = 0; + + GL11.glPushMatrix(); + + if(entity.currentAnimation == EnumAnimation.DANCING){ + float dancing = entity.ticksExisted / 4f; + GL11.glTranslatef((float)Math.sin(dancing) * 0.025F, (float)Math.abs(Math.cos(dancing)) * 0.125F - 0.02F, 0.0F); + } + + if(!bo){ + ((ModelScaleRenderer)this.bipedLeftArm).setConfig(arms,-x,y,z); + ((ModelScaleRenderer)this.bipedLeftArm).render(f); + ((ModelScaleRenderer)this.bipedRightArm).setConfig(arms,x,y,z); + ((ModelScaleRenderer)this.bipedRightArm).render(f); + } + else{ + ((ModelScaleRenderer)this.bipedRightArm).setConfig(arms,0,0,0); + ((ModelScaleRenderer)this.bipedRightArm).render(f); + } + + GL11.glPopMatrix(); + } + private void renderLegs(EntityCustomNpc entity, float f) { + loadPlayerTexture(entity); + ModelPartConfig legs = entity.modelData.legs; + + float x = (1 - legs.scaleX) * 0.125f; + float y = entity.modelData.getLegsY(); + float z = 0; + + GL11.glPushMatrix(); + this.legs.setConfig(legs,x,y,z); + this.legs.render(f); + if(!isArmor){ + this.tail.setConfig(legs, 0, y, z); + this.tail.render(f); + } + GL11.glPopMatrix(); + } + @Override + public ModelRenderer getRandomModelBox(Random par1Random) + { + int random = par1Random.nextInt(5); + switch(random){ + case 0: + return bipedRightLeg; + case 1: + return bipedHead; + case 2: + return bipedLeftArm; + case 3: + return bipedRightArm; + case 4: + return bipedLeftLeg; + } + + return bipedBody; + } +} diff --git a/src/main/java/noppes/npcs/client/model/ModelNPCGolem.java b/src/main/java/noppes/npcs/client/model/ModelNPCGolem.java new file mode 100644 index 000000000..e44c719bd --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/ModelNPCGolem.java @@ -0,0 +1,138 @@ +package noppes.npcs.client.model; + +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; +import noppes.npcs.constants.EnumAnimation; +import noppes.npcs.entity.EntityNPCInterface; + +public class ModelNPCGolem extends ModelNPCMale { + + private ModelRenderer bipedLowerBody; + + public ModelNPCGolem(float f) + { + super(f); + } + + public void init(float f, float f1) + { + super.init(f,f1); + short short1 = 128; + short short2 = 128; + float f2 = -7.0F; + this.bipedHead = (new ModelRenderer(this)).setTextureSize(short1, short2); + this.bipedHead.setRotationPoint(0.0F, f2, -2.0F); + this.bipedHead.setTextureOffset(0, 0).addBox(-4.0F, -12.0F, -5.5F, 8, 10, 8, f); + this.bipedHead.setTextureOffset(24, 0).addBox(-1.0F, -5.0F, -7.5F, 2, 4, 2, f); + this.bipedHeadwear = (new ModelRenderer(this)).setTextureSize(short1, short2); + this.bipedHeadwear.setRotationPoint(0.0F, f2, -2.0F); + this.bipedHeadwear.setTextureOffset(0, 85).addBox(-4.0F, -12.0F, -5.5F, 8, 10, 8, f + 0.5F); + this.bipedBody = (new ModelRenderer(this)).setTextureSize(short1, short2); + this.bipedBody.setRotationPoint(0.0F, 0.0F + f2, 0.0F); + this.bipedBody.setTextureOffset(0, 40).addBox(-9.0F, -2.0F, -6.0F, 18, 12, 11, f + 0.2F); + this.bipedBody.setTextureOffset(0, 21).addBox(-9.0F, -2.0F, -6.0F, 18, 8, 11, f); + this.bipedLowerBody = (new ModelRenderer(this)).setTextureSize(short1, short2); + this.bipedLowerBody.setRotationPoint(0.0F, 0.0F + f2, 0.0F); + this.bipedLowerBody.setTextureOffset(0, 70).addBox(-4.5F, 10.0F, -3.0F, 9, 5, 6, f + 0.5F); + this.bipedLowerBody.setTextureOffset(30, 70).addBox(-4.5F, 6.0F, -3.0F, 9, 9, 6, f + 0.4F); + this.bipedRightArm = (new ModelRenderer(this)).setTextureSize(short1, short2); + this.bipedRightArm.setRotationPoint(0.0F, f2, 0.0F); + this.bipedRightArm.setTextureOffset(60, 21).addBox(-13.0F, -2.5F, -3.0F, 4, 30, 6, f + 0.2F); + this.bipedRightArm.setTextureOffset(80, 21).addBox(-13.0F, -2.5F, -3.0F, 4, 20, 6, f); + this.bipedRightArm.setTextureOffset(100, 21).addBox(-13.0F, -2.5F, -3.0F, 4, 20, 6, f + 1.0F); + this.bipedLeftArm = (new ModelRenderer(this)).setTextureSize(short1, short2); + this.bipedLeftArm.setRotationPoint(0.0F, f2, 0.0F); + this.bipedLeftArm.setTextureOffset(60, 58).addBox(9.0F, -2.5F, -3.0F, 4, 30, 6, f + 0.2F); + this.bipedLeftArm.setTextureOffset(80, 58).addBox(9.0F, -2.5F, -3.0F, 4, 20, 6, f); + this.bipedLeftArm.setTextureOffset(100, 58).addBox(9.0F, -2.5F, -3.0F, 4, 20, 6, f + 1.0F); + this.bipedLeftLeg = (new ModelRenderer(this, 0, 22)).setTextureSize(short1, short2); + this.bipedLeftLeg.setRotationPoint(-4.0F, 18.0F + f2, 0.0F); + this.bipedLeftLeg.setTextureOffset(37, 0).addBox(-3.5F, -3.0F, -3.0F, 6, 16, 5, f); + this.bipedRightLeg = (new ModelRenderer(this, 0, 22)).setTextureSize(short1, short2); + this.bipedRightLeg.mirror = true; + this.bipedRightLeg.setTextureOffset(60, 0).setRotationPoint(5.0F, 18.0F + f2, 0.0F); + this.bipedRightLeg.addBox(-3.5F, -3.0F, -3.0F, 6, 16, 5, f); + } + + @Override + public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) + { + super.render(par1Entity, par2, par3, par4, par5, par6, par7); + bipedLowerBody.render(par7); + } + + @Override + public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity entity) + { + EntityNPCInterface npc = (EntityNPCInterface) entity; + isRiding = npc.isRiding(); + + if(isSneak && (npc.currentAnimation == EnumAnimation.CRAWLING || npc.currentAnimation == EnumAnimation.LYING)) + isSneak = false; + + bipedHead.rotateAngleY = par4 / (180F / (float)Math.PI); + bipedHead.rotateAngleX = par5 / (180F / (float)Math.PI); + bipedHeadwear.rotateAngleY = bipedHead.rotateAngleY; + bipedHeadwear.rotateAngleX = bipedHead.rotateAngleX; + bipedLeftLeg.rotateAngleX = -1.5F * this.func_78172_a(par1, 13.0F) * par2; + bipedRightLeg.rotateAngleX = 1.5F * this.func_78172_a(par1, 13.0F) * par2; + bipedLeftLeg.rotateAngleY = 0.0F; + bipedRightLeg.rotateAngleY = 0.0F; + + float f6 = MathHelper.sin(this.onGround * (float)Math.PI); + float f7 = MathHelper.sin((16.0F - (1.0F - this.onGround) * (1.0F - this.onGround)) * (float)Math.PI); + if (this.onGround > 0.0) + { + this.bipedRightArm.rotateAngleZ = 0.0F; + this.bipedLeftArm.rotateAngleZ = 0.0F; + this.bipedRightArm.rotateAngleY = -(0.1F - f6 * 0.6F); + this.bipedLeftArm.rotateAngleY = 0.1F - f6 * 0.6F; + bipedRightArm.rotateAngleX = 0.0F; + bipedLeftArm.rotateAngleX = 0.0F; + this.bipedRightArm.rotateAngleX = -((float)Math.PI / 2F); + this.bipedLeftArm.rotateAngleX = -((float)Math.PI / 2F); + this.bipedRightArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F; + this.bipedLeftArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F; + } + else if (aimedBow) + { + float f1 = 0.0F; + float f3 = 0.0F; + bipedRightArm.rotateAngleZ = 0.0F; + bipedRightArm.rotateAngleX = -((float)Math.PI / 2F) + bipedHead.rotateAngleX; + bipedRightArm.rotateAngleX -= f1 * 1.2F - f3 * 0.4F; + bipedRightArm.rotateAngleZ += MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; + bipedRightArm.rotateAngleX += MathHelper.sin(par3 * 0.067F) * 0.05F; + bipedLeftArm.rotateAngleX = (-0.2F - 1.5F * this.func_78172_a(par1, 13.0F)) * par2; + bipedBody.rotateAngleY = -(0.1F - f1 * 0.6F) + bipedHead.rotateAngleY; + bipedRightArm.rotateAngleY = -(0.1F - f1 * 0.6F) + bipedHead.rotateAngleY; + bipedLeftArm.rotateAngleY = (0.1F - f1 * 0.6F) + bipedHead.rotateAngleY; + } + else + { + bipedRightArm.rotateAngleX = (-0.2F + 1.5F * this.func_78172_a(par1, 13.0F)) * par2; + bipedLeftArm.rotateAngleX = (-0.2F - 1.5F * this.func_78172_a(par1, 13.0F)) * par2; + bipedBody.rotateAngleY = 0.0F; + bipedRightArm.rotateAngleY = 0.0F; + bipedLeftArm.rotateAngleY = 0.0F; + bipedRightArm.rotateAngleZ = 0.0F; + bipedLeftArm.rotateAngleZ = 0.0F; + } + + if (isRiding) + { + bipedRightArm.rotateAngleX += -((float)Math.PI / 5F); + bipedLeftArm.rotateAngleX += -((float)Math.PI / 5F); + bipedLeftLeg.rotateAngleX = -((float)Math.PI * 2F / 5F); + bipedRightLeg.rotateAngleX = -((float)Math.PI * 2F / 5F); + bipedLeftLeg.rotateAngleY = ((float)Math.PI / 10F); + bipedRightLeg.rotateAngleY = -((float)Math.PI / 10F); + } + } + + private float func_78172_a(float par1, float par2) + { + return (Math.abs(par1 % par2 - par2 * 0.5F) - par2 * 0.25F) / (par2 * 0.25F); + } +} \ No newline at end of file diff --git a/src/main/java/noppes/npcs/client/model/ModelNPCMale.java b/src/main/java/noppes/npcs/client/model/ModelNPCMale.java new file mode 100644 index 000000000..f26676198 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/ModelNPCMale.java @@ -0,0 +1,287 @@ +package noppes.npcs.client.model; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelBiped; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.MathHelper; +import noppes.npcs.CustomNpcs; +import noppes.npcs.constants.EnumAnimation; +import noppes.npcs.entity.EntityNPCInterface; + +import org.lwjgl.opengl.GL11; + +public class ModelNPCMale extends ModelBiped +{ + public boolean isDancing; + public boolean isSleeping; + + public float animationTick; + public float dancingTicks; + + public ModelNPCMale(float f) + { + init(f, 0.0F); + } + @Override + public void setLivingAnimations(EntityLivingBase par1EntityLiving, float f6, float f5, float par9){ + animationTick += par9; + dancingTicks = CustomNpcs.ticks / 3.978873F; + } + public void init(float f, float f1) + { + heldItemLeft = 0; + heldItemRight = 0; + isSneak = false; + aimedBow = false; + bipedCloak = new ModelRenderer(this, 0, 0); + bipedCloak.textureHeight = 32; + bipedCloak.addBox(-5F, 0.0F, -1F, 10, 16, 1, f); + + bipedEars = new ModelRenderer(this, 24, 0); + bipedEars.addBox(-3F, -6F, -1F, 6, 6, 1, f); + + bipedHead = new ModelRenderer(this, 0, 0); + bipedHead.addBox(-4F, -8F, -4F, 8, 8, 8, f); + bipedHead.setRotationPoint(0.0F, 0.0F + f1, 0.0F); + + bipedHeadwear = new ModelRenderer(this, 32, 0); + bipedHeadwear.addBox(-4F, -8F, -4F, 8, 8, 8, f + 0.5F); + bipedHeadwear.setRotationPoint(0.0F, 0.0F + f1, 0.0F); + bipedBody = new ModelRenderer(this, 16, 16); + bipedBody.addBox(-4F, 0.0F, -2F, 8, 12, 4, f); + bipedBody.setRotationPoint(0.0F, 0.0F + f1, 0.0F); + bipedRightArm = new ModelRenderer(this, 40, 16); + bipedRightArm.addBox(-3F, -2F, -2F, 4, 12, 4, f); + bipedRightArm.setRotationPoint(-5F, 2.0F + f1, 0.0F); + bipedLeftArm = new ModelRenderer(this, 40, 16); + bipedLeftArm.mirror = true; + bipedLeftArm.addBox(-1F, -2F, -2F, 4, 12, 4, f); + bipedLeftArm.setRotationPoint(5F, 2.0F + f1, 0.0F); + bipedRightLeg = new ModelRenderer(this, 0, 16); + bipedRightLeg.addBox(-2F, 0.0F, -2F, 4, 12, 4, f); + bipedRightLeg.setRotationPoint(-2F, 12F + f1, 0.0F); + bipedLeftLeg = new ModelRenderer(this, 0, 16); + bipedLeftLeg.mirror = true; + bipedLeftLeg.addBox(-2F, 0.0F, -2F, 4, 12, 4, f); + bipedLeftLeg.setRotationPoint(2.0F, 12F + f1, 0.0F); + + } + + @Override + public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7){ + setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity); + + if(!isDancing){ + bipedHead.render(par7); + bipedBody.render(par7); + bipedRightArm.render(par7); + bipedLeftArm.render(par7); + bipedRightLeg.render(par7); + bipedLeftLeg.render(par7); + bipedHeadwear.render(par7); + } + else{ + renderHead(par1Entity, par7); + renderArms(par1Entity, par7); + renderBody(par1Entity, par7); + renderLegs(par1Entity, par7); + } + } + public void renderHead(Entity entityliving,float par7){ + if(isDancing){ + GL11.glPushMatrix(); + GL11.glTranslatef((float)Math.sin(dancingTicks) * 0.075F, (float)Math.abs(Math.cos(dancingTicks)) * 0.125F - 0.02F, (float)(-Math.abs(Math.cos(dancingTicks))) * 0.075F); + bipedHead.render(par7); + bipedHeadwear.render(par7); + GL11.glPopMatrix(); + } + else{ + bipedHead.render(par7); + bipedHeadwear.render(par7); + } + } + public void renderLeftArm(Entity entityliving,float par7){ + if(isDancing){ + GL11.glPushMatrix(); + GL11.glTranslatef((float)Math.sin(dancingTicks) * 0.025F, (float)Math.abs(Math.cos(dancingTicks)) * 0.125F - 0.02F, 0.0F); + bipedLeftArm.render(par7); + GL11.glPopMatrix(); + } + else{ + bipedLeftArm.render(par7); + } + } + public void renderArms(Entity entity,float par7){ + renderLeftArm(entity,par7); + renderRightArm(entity,par7); + } + public void renderRightArm(Entity entityliving,float par7){ + if(isDancing){ + GL11.glPushMatrix(); + GL11.glTranslatef((float)Math.sin(dancingTicks) * 0.025F, (float)Math.abs(Math.cos(dancingTicks)) * 0.125F - 0.02F, 0.0F); + bipedRightArm.render(par7); + GL11.glPopMatrix(); + } + else{ + bipedRightArm.render(par7); + } + } + public void renderBody(Entity entityliving,float par7){ + if(isDancing){ + GL11.glPushMatrix(); + GL11.glTranslatef((float)Math.sin(dancingTicks) * 0.015F, 0.0F, 0.0F); + bipedBody.render(par7); + GL11.glPopMatrix(); + } + else{ + bipedBody.render(par7); + } + } + public void renderLegs(Entity entityliving,float par7){ + bipedRightLeg.render(par7); + bipedLeftLeg.render(par7); + } + + public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity entity) + { + EntityNPCInterface npc = (EntityNPCInterface) entity; + isRiding = npc.isRiding(); + + + if(isSneak && (npc.currentAnimation == EnumAnimation.CRAWLING || npc.currentAnimation == EnumAnimation.LYING)) + isSneak = false; + bipedHead.rotateAngleY = par4 / (180F / (float)Math.PI); + bipedHead.rotateAngleX = par5 / (180F / (float)Math.PI); + bipedHeadwear.rotateAngleY = bipedHead.rotateAngleY; + bipedHeadwear.rotateAngleX = bipedHead.rotateAngleX; + bipedRightArm.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 2.0F * par2 * 0.5F; + bipedLeftArm.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 2.0F * par2 * 0.5F; + bipedRightArm.rotateAngleZ = 0.0F; + bipedLeftArm.rotateAngleZ = 0.0F; + bipedRightLeg.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.4F * par2; + bipedLeftLeg.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 1.4F * par2; + bipedRightLeg.rotateAngleY = 0.0F; + bipedLeftLeg.rotateAngleY = 0.0F; + + if (isRiding) + { + bipedRightArm.rotateAngleX += -((float)Math.PI / 5F); + bipedLeftArm.rotateAngleX += -((float)Math.PI / 5F); + bipedRightLeg.rotateAngleX = -((float)Math.PI * 2F / 5F); + bipedLeftLeg.rotateAngleX = -((float)Math.PI * 2F / 5F); + bipedRightLeg.rotateAngleY = ((float)Math.PI / 10F); + bipedLeftLeg.rotateAngleY = -((float)Math.PI / 10F); + } + + if (heldItemLeft != 0) + { + bipedLeftArm.rotateAngleX = bipedLeftArm.rotateAngleX * 0.5F - ((float)Math.PI / 10F) * (float)heldItemLeft; + } + + if (heldItemRight != 0) + { + bipedRightArm.rotateAngleX = bipedRightArm.rotateAngleX * 0.5F - ((float)Math.PI / 10F) * (float)heldItemRight; + } + + bipedRightArm.rotateAngleY = 0.0F; + bipedLeftArm.rotateAngleY = 0.0F; + + if (onGround > -9990F) + { + float f = onGround; + bipedBody.rotateAngleY = MathHelper.sin(MathHelper.sqrt_float(f) * (float)Math.PI * 2.0F) * 0.2F; + bipedRightArm.rotationPointZ = MathHelper.sin(bipedBody.rotateAngleY) * 5F; + bipedRightArm.rotationPointX = -MathHelper.cos(bipedBody.rotateAngleY) * 5F; + bipedLeftArm.rotationPointZ = -MathHelper.sin(bipedBody.rotateAngleY) * 5F; + bipedLeftArm.rotationPointX = MathHelper.cos(bipedBody.rotateAngleY) * 5F; + bipedRightArm.rotateAngleY += bipedBody.rotateAngleY; + bipedLeftArm.rotateAngleY += bipedBody.rotateAngleY; + bipedLeftArm.rotateAngleX += bipedBody.rotateAngleY; + f = 1.0F - onGround; + f *= f; + f *= f; + f = 1.0F - f; + float f2 = MathHelper.sin(f * (float)Math.PI); + float f4 = MathHelper.sin(onGround * (float)Math.PI) * -(bipedHead.rotateAngleX - 0.7F) * 0.75F; + bipedRightArm.rotateAngleX -= (double)f2 * 1.2D + (double)f4; + bipedRightArm.rotateAngleY += bipedBody.rotateAngleY * 2.0F; + bipedRightArm.rotateAngleZ = MathHelper.sin(onGround * (float)Math.PI) * -0.4F; + } + + if (isSneak) + { + bipedBody.rotateAngleX = 0.5F; + bipedRightLeg.rotateAngleX -= 0.0F; + bipedLeftLeg.rotateAngleX -= 0.0F; + bipedRightArm.rotateAngleX += 0.4F; + bipedLeftArm.rotateAngleX += 0.4F; + bipedRightLeg.rotationPointZ = 4F; + bipedLeftLeg.rotationPointZ = 4F; + bipedRightLeg.rotationPointY = 9F; + bipedLeftLeg.rotationPointY = 9F; + bipedHead.rotationPointY = 1.0F; + } + else + { + bipedBody.rotateAngleX = 0.0F; + bipedRightLeg.rotationPointZ = 0.0F; + bipedLeftLeg.rotationPointZ = 0.0F; + bipedRightLeg.rotationPointY = 12F; + bipedLeftLeg.rotationPointY = 12F; + bipedHead.rotationPointY = 0.0F; + } + + bipedRightArm.rotateAngleZ += MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; + bipedLeftArm.rotateAngleZ -= MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; + bipedRightArm.rotateAngleX += MathHelper.sin(par3 * 0.067F) * 0.05F; + bipedLeftArm.rotateAngleX -= MathHelper.sin(par3 * 0.067F) * 0.05F; + + if (aimedBow) + { + float f1 = 0.0F; + float f3 = 0.0F; + bipedRightArm.rotateAngleZ = 0.0F; + bipedLeftArm.rotateAngleZ = 0.0F; + bipedRightArm.rotateAngleY = -(0.1F - f1 * 0.6F) + bipedHead.rotateAngleY; + bipedLeftArm.rotateAngleY = (0.1F - f1 * 0.6F) + bipedHead.rotateAngleY + 0.4F; + bipedRightArm.rotateAngleX = -((float)Math.PI / 2F) + bipedHead.rotateAngleX; + bipedLeftArm.rotateAngleX = -((float)Math.PI / 2F) + bipedHead.rotateAngleX; + bipedRightArm.rotateAngleX -= f1 * 1.2F - f3 * 0.4F; + bipedLeftArm.rotateAngleX -= f1 * 1.2F - f3 * 0.4F; + bipedRightArm.rotateAngleZ += MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; + bipedLeftArm.rotateAngleZ -= MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; + bipedRightArm.rotateAngleX += MathHelper.sin(par3 * 0.067F) * 0.05F; + bipedLeftArm.rotateAngleX -= MathHelper.sin(par3 * 0.067F) * 0.05F; + } + } + + public void renderEars(float f) + { + bipedEars.rotateAngleY = bipedHead.rotateAngleY; + bipedEars.rotateAngleX = bipedHead.rotateAngleX; + bipedEars.rotationPointX = 0.0F; + bipedEars.rotationPointY = 0.0F; + bipedEars.render(f); + } + + public void setRotation(ModelRenderer model, float x, float y, float z) + { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void renderCloak(float f) + { + bipedCloak.render(f); + } + + public boolean isSleeping(Entity entity) { + if(entity instanceof EntityPlayer && ((EntityPlayer)entity).isPlayerSleeping()) + return true; + return ((EntityNPCInterface)entity).currentAnimation == EnumAnimation.LYING; + } +} diff --git a/src/main/java/noppes/npcs/client/model/ModelNpcCrystal.java b/src/main/java/noppes/npcs/client/model/ModelNpcCrystal.java new file mode 100644 index 000000000..1abe9ee83 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/ModelNpcCrystal.java @@ -0,0 +1,67 @@ +package noppes.npcs.client.model; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.MathHelper; +import noppes.npcs.entity.EntityNpcCrystal; + +import org.lwjgl.opengl.GL11; + +public class ModelNpcCrystal extends ModelBase +{ + private ModelRenderer field_41057_g; + private ModelRenderer field_41058_h; + private ModelRenderer field_41059_i; + + public ModelNpcCrystal(float par1) + { + field_41058_h = new ModelRenderer(this, "glass"); + field_41058_h.setTextureOffset(0, 0).addBox(-4F, -4F, -4F, 8, 8, 8); + field_41057_g = new ModelRenderer(this, "cube"); + field_41057_g.setTextureOffset(32, 0).addBox(-4F, -4F, -4F, 8, 8, 8); + field_41059_i = new ModelRenderer(this, "base"); + field_41059_i.setTextureOffset(0, 16).addBox(-6F, 16.0F, -6F, 12, 4, 12); + } + float ticks; + @Override + public void setLivingAnimations(EntityLivingBase par1EntityLiving, float f6, float f5, float par9){ + ticks = par9; + } + /** + * Sets the models various rotation angles then renders the model. + */ + @Override + public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) + { + + GL11.glPushMatrix(); + GL11.glScalef(2.0F, 2.0F, 2.0F); + GL11.glTranslatef(0.0F, -0.5F, 0.0F); + field_41059_i.render(par7); + + float f = (float)par1Entity.ticksExisted + ticks; + float f1 = MathHelper.sin(f * 0.2F) / 2.0F + 0.5F; + f1 = f1 * f1 + f1; + + par3 = f * 3F; + par4 = f1 * 0.2F; + + GL11.glRotatef(par3, 0.0F, 1.0F, 0.0F); + GL11.glTranslatef(0.0F, 0.1F + par4, 0.0F); + GL11.glRotatef(60F, 0.7071F, 0.0F, 0.7071F); + field_41058_h.render(par7); + float sca = 0.875F; + GL11.glScalef(sca, sca, sca); + GL11.glRotatef(60F, 0.7071F, 0.0F, 0.7071F); + GL11.glRotatef(par3, 0.0F, 1.0F, 0.0F); + field_41058_h.render(par7); + GL11.glScalef(sca, sca, sca); + GL11.glRotatef(60F, 0.7071F, 0.0F, 0.7071F); + GL11.glRotatef(par3, 0.0F, 1.0F, 0.0F); + field_41057_g.render(par7); + GL11.glPopMatrix(); + } + +} diff --git a/src/main/java/noppes/npcs/client/model/ModelNpcDragon.java b/src/main/java/noppes/npcs/client/model/ModelNpcDragon.java new file mode 100644 index 000000000..6d9a93945 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/ModelNpcDragon.java @@ -0,0 +1,262 @@ +package noppes.npcs.client.model; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.MathHelper; +import noppes.npcs.entity.EntityNpcDragon; + +import org.lwjgl.opengl.GL11; + +public class ModelNpcDragon extends ModelBase +{ + + private ModelRenderer head; + private ModelRenderer neck; + private ModelRenderer jaw; + private ModelRenderer body; + private ModelRenderer rearLeg; + private ModelRenderer frontLeg; + private ModelRenderer rearLegTip; + private ModelRenderer frontLegTip; + private ModelRenderer rearFoot; + private ModelRenderer frontFoot; + private ModelRenderer wing; + private ModelRenderer wingTip; + private float field_40317_s; + + + + public ModelNpcDragon(float f) + { + textureWidth = 256; + textureHeight = 256; + setTextureOffset("body.body", 0, 0); + setTextureOffset("wing.skin", -56, 88); + setTextureOffset("wingtip.skin", -56, 144); + setTextureOffset("rearleg.main", 0, 0); + setTextureOffset("rearfoot.main", 112, 0); + setTextureOffset("rearlegtip.main", 196, 0); + setTextureOffset("head.upperhead", 112, 30); + setTextureOffset("wing.bone", 112, 88); + setTextureOffset("head.upperlip", 176, 44); + setTextureOffset("jaw.jaw", 176, 65); + setTextureOffset("frontleg.main", 112, 104); + setTextureOffset("wingtip.bone", 112, 136); + setTextureOffset("frontfoot.main", 144, 104); + setTextureOffset("neck.box", 192, 104); + setTextureOffset("frontlegtip.main", 226, 138); + setTextureOffset("body.scale", 220, 53); + setTextureOffset("head.scale", 0, 0); + setTextureOffset("neck.scale", 48, 0); + setTextureOffset("head.nostril", 112, 0); + float f1 = -16F; + head = new ModelRenderer(this, "head"); + head.addBox("upperlip", -6F, -1F, -8F + f1, 12, 5, 16); + head.addBox("upperhead", -8F, -8F, 6F + f1, 16, 16, 16); + head.mirror = true; + head.addBox("scale", -5F, -12F, 12F + f1, 2, 4, 6); + head.addBox("nostril", -5F, -3F, -6F + f1, 2, 2, 4); + head.mirror = false; + head.addBox("scale", 3F, -12F, 12F + f1, 2, 4, 6); + head.addBox("nostril", 3F, -3F, -6F + f1, 2, 2, 4); + jaw = new ModelRenderer(this, "jaw"); + jaw.setRotationPoint(0.0F, 4F, 8F + f1); + jaw.addBox("jaw", -6F, 0.0F, -16F, 12, 4, 16); + head.addChild(jaw); + neck = new ModelRenderer(this, "neck"); + neck.addBox("box", -5F, -5F, -5F, 10, 10, 10); + neck.addBox("scale", -1F, -9F, -3F, 2, 4, 6); + body = new ModelRenderer(this, "body"); + body.setRotationPoint(0.0F, 4F, 8F); + body.addBox("body", -12F, 0.0F, -16F, 24, 24, 64); + body.addBox("scale", -1F, -6F, -10F, 2, 6, 12); + body.addBox("scale", -1F, -6F, 10F, 2, 6, 12); + body.addBox("scale", -1F, -6F, 30F, 2, 6, 12); + wing = new ModelRenderer(this, "wing"); + wing.setRotationPoint(-12F, 5F, 2.0F); + wing.addBox("bone", -56F, -4F, -4F, 56, 8, 8); + wing.addBox("skin", -56F, 0.0F, 2.0F, 56, 0, 56); + wingTip = new ModelRenderer(this, "wingtip"); + wingTip.setRotationPoint(-56F, 0.0F, 0.0F); + wingTip.addBox("bone", -56F, -2F, -2F, 56, 4, 4); + wingTip.addBox("skin", -56F, 0.0F, 2.0F, 56, 0, 56); + wing.addChild(wingTip); + frontLeg = new ModelRenderer(this, "frontleg"); + frontLeg.setRotationPoint(-12F, 20F, 2.0F); + frontLeg.addBox("main", -4F, -4F, -4F, 8, 24, 8); + frontLegTip = new ModelRenderer(this, "frontlegtip"); + frontLegTip.setRotationPoint(0.0F, 20F, -1F); + frontLegTip.addBox("main", -3F, -1F, -3F, 6, 24, 6); + frontLeg.addChild(frontLegTip); + frontFoot = new ModelRenderer(this, "frontfoot"); + frontFoot.setRotationPoint(0.0F, 23F, 0.0F); + frontFoot.addBox("main", -4F, 0.0F, -12F, 8, 4, 16); + frontLegTip.addChild(frontFoot); + rearLeg = new ModelRenderer(this, "rearleg"); + rearLeg.setRotationPoint(-16F, 16F, 42F); + rearLeg.addBox("main", -8F, -4F, -8F, 16, 32, 16); + rearLegTip = new ModelRenderer(this, "rearlegtip"); + rearLegTip.setRotationPoint(0.0F, 32F, -4F); + rearLegTip.addBox("main", -6F, -2F, 0.0F, 12, 32, 12); + rearLeg.addChild(rearLegTip); + rearFoot = new ModelRenderer(this, "rearfoot"); + rearFoot.setRotationPoint(0.0F, 31F, 4F); + rearFoot.addBox("main", -9F, 0.0F, -20F, 18, 6, 24); + rearLegTip.addChild(rearFoot); + } + + @Override + public void setLivingAnimations(EntityLivingBase entityliving, float f, float f1, float f2) + { + field_40317_s = f2; + } + + @Override + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) + { + EntityNpcDragon entitydragon = (EntityNpcDragon)entity; + GL11.glPushMatrix(); + float f6 = entitydragon.field_40173_aw + (entitydragon.field_40172_ax - entitydragon.field_40173_aw) * field_40317_s; + jaw.rotateAngleX = (float)(Math.sin(f6 * (float)Math.PI * 2.0F) + 1.0D) * 0.2F; + float f7 = (float)(Math.sin(f6 * (float)Math.PI * 2.0F - 1.0F) + 1.0D); + f7 = (f7 * f7 * 1.0F + f7 * 2.0F) * 0.05F; + GL11.glTranslatef(0.0F, f7 - 2.0F, -3F); + GL11.glRotatef(f7 * 2.0F, 1.0F, 0.0F, 0.0F); + float f8 = -30F; + float f9 = 22F; + float f10 = 0.0F; + float f11 = 1.5F; + double ad[] = entitydragon.func_40160_a(6, field_40317_s); + float f12 = func_40307_a(entitydragon.func_40160_a(5, field_40317_s)[0] - entitydragon.func_40160_a(10, field_40317_s)[0]); + float f13 = func_40307_a(entitydragon.func_40160_a(5, field_40317_s)[0] + (double)(f12 / 2.0F)); + f8 += 2.0F; + float f14 = 0.0F; + float f15 = f6 * 3.141593F * 2.0F; + f8 = 20F; + f9 = -12F; + for(int i = 0; i < 5; i++) + { + double ad3[] = entitydragon.func_40160_a(5 - i, field_40317_s); + f14 = (float)Math.cos((float)i * 0.45F + f15) * 0.15F; + neck.rotateAngleY = ((func_40307_a(ad3[0] - ad[0]) * (float)Math.PI) / 180F) * f11; + neck.rotateAngleX = f14 + (((float)(ad3[1] - ad[1]) * (float)Math.PI) / 180F) * f11 * 5F; + neck.rotateAngleZ = ((-func_40307_a(ad3[0] - (double)f13) * (float)Math.PI) / 180F) * f11; + neck.rotationPointY = f8; + neck.rotationPointZ = f9; + neck.rotationPointX = f10; + f8 = (float)((double)f8 + Math.sin(neck.rotateAngleX) * 10D); + f9 = (float)((double)f9 - Math.cos(neck.rotateAngleY) * Math.cos(neck.rotateAngleX) * 10D); + f10 = (float)((double)f10 - Math.sin(neck.rotateAngleY) * Math.cos(neck.rotateAngleX) * 10D); + neck.render(f5); + } + + head.rotationPointY = f8; + head.rotationPointZ = f9; + head.rotationPointX = f10; + double ad1[] = entitydragon.func_40160_a(0, field_40317_s); + head.rotateAngleY = ((func_40307_a(ad1[0] - ad[0]) * (float)Math.PI) / 180F) * 1.0F; + head.rotateAngleZ = ((-func_40307_a(ad1[0] - (double)f13) * (float)Math.PI) / 180F) * 1.0F; + head.render(f5); + GL11.glPushMatrix(); + GL11.glTranslatef(0.0F, 1.0F, 0.0F); + if(entitydragon.onGround) + GL11.glRotatef(-f12 * f11 * 0.3F, 0.0F, 0.0F, 1.0F); + else + GL11.glRotatef(-f12 * f11 * 1.0F, 0.0F, 0.0F, 1.0F); + + GL11.glTranslatef(0.0F, -1F, 0.0F); + body.rotateAngleZ = 0.0F; + body.render(f5); + if(entitydragon.onGround){ + for(int j = 0; j < 2; j++) + { + GL11.glEnable(2884 /*GL_CULL_FACE*/); + wing.rotateAngleX = 0.25f; + wing.rotateAngleY = 0.95F; + wing.rotateAngleZ = -0.5f; + wingTip.rotateAngleZ = -0.4f; + frontLeg.rotateAngleX = MathHelper.cos((float) (f * 0.6662F + (j==0?0:Math.PI))) * 0.6F * f1 + 0.45f + f7 * 0.5f ; + frontLegTip.rotateAngleX = -1.3f - f7 * 1.2f ; + frontFoot.rotateAngleX = 0.85f + f7 * 0.5f; + frontLeg.render(f5); + + rearLeg.rotateAngleX = MathHelper.cos((float) (f * 0.6662F + (j==0?Math.PI:0))) * 0.6F * f1 + 0.75f + f7 * 0.5f; + rearLegTip.rotateAngleX = -1.6f - f7 * 0.8f ; + rearLegTip.rotationPointY = 20; + rearLegTip.rotationPointZ = 2; + rearFoot.rotateAngleX = 0.85f + f7 * 0.2f; + + rearLeg.render(f5); + wing.render(f5); + GL11.glScalef(-1F, 1.0F, 1.0F); + if(j == 0) + { + GL11.glCullFace(1028 /*GL_FRONT*/); + } + } + } + else{ + for(int j = 0; j < 2; j++) + { + GL11.glEnable(2884 /*GL_CULL_FACE*/); + float f16 = f6 * (float)Math.PI * 2.0F; + wing.rotateAngleX = 0.125F - (float)Math.cos(f16) * 0.2F; + wing.rotateAngleY = 0.25F; + wing.rotateAngleZ = (float)(Math.sin(f16) + 0.125D) * 0.8F; + wingTip.rotateAngleZ = -(float)(Math.sin(f16 + 2.0F) + 0.5D) * 0.75F; + rearLegTip.rotationPointY = 32; + rearLegTip.rotationPointZ = -2; + rearLeg.rotateAngleX = 1.0F + f7 * 0.1F; + rearLegTip.rotateAngleX = 0.5F + f7 * 0.1F; + rearFoot.rotateAngleX = 0.75F + f7 * 0.1F; + frontLeg.rotateAngleX = 1.3F + f7 * 0.1F; + frontLegTip.rotateAngleX = -0.5F - f7 * 0.1F; + frontFoot.rotateAngleX = 0.75F + f7 * 0.1F; + wing.render(f5); + frontLeg.render(f5); + rearLeg.render(f5); + GL11.glScalef(-1F, 1.0F, 1.0F); + if(j == 0) + { + GL11.glCullFace(1028 /*GL_FRONT*/); + } + } + } + GL11.glPopMatrix(); + GL11.glCullFace(1029 /*GL_BACK*/); + GL11.glDisable(2884 /*GL_CULL_FACE*/); + f14 = -(float)Math.sin(f6 * 3.141593F * 2.0F) * 0.0F; + f15 = f6 * (float)Math.PI * 2.0F; + f8 = 10F; + f9 = 60F; + f10 = 0.0F; + ad = entitydragon.func_40160_a(11, field_40317_s); + for(int k = 0; k < 12; k++) + { + double ad2[] = entitydragon.func_40160_a(12 + k, field_40317_s); + f14 = (float)((double)f14 + Math.sin((float)k * 0.45F + f15) * 0.05000000074505806D); + neck.rotateAngleY = ((func_40307_a(ad2[0] - ad[0]) * f11 + 180F) * (float)Math.PI) / 180F; + neck.rotateAngleX = f14 + (((float)(ad2[1] - ad[1]) * (float)Math.PI) / 180F) * f11 * 5F; + neck.rotateAngleZ = ((func_40307_a(ad2[0] - (double)f13) * (float)Math.PI) / 180F) * f11; + neck.rotationPointY = f8; + neck.rotationPointZ = f9; + neck.rotationPointX = f10; + f8 = (float)((double)f8 + Math.sin(neck.rotateAngleX) * 10D); + f9 = (float)((double)f9 - Math.cos(neck.rotateAngleY) * Math.cos(neck.rotateAngleX) * 10D); + f10 = (float)((double)f10 - Math.sin(neck.rotateAngleY) * Math.cos(neck.rotateAngleX) * 10D); + neck.render(f5); + } + + GL11.glPopMatrix(); + //} + } + + private float func_40307_a(double d) + { + for(; d >= 180D; d -= 360D) { } + for(; d < -180D; d += 360D) { } + return (float)d; + } +} diff --git a/src/main/java/noppes/npcs/client/model/ModelNpcSlime.java b/src/main/java/noppes/npcs/client/model/ModelNpcSlime.java new file mode 100644 index 000000000..ce53f7469 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/ModelNpcSlime.java @@ -0,0 +1,72 @@ +package noppes.npcs.client.model; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class ModelNpcSlime extends ModelBase +{ + ModelRenderer outerBody; + ModelRenderer innerBody; + + /** The slime's right eye */ + ModelRenderer slimeRightEye; + + /** The slime's left eye */ + ModelRenderer slimeLeftEye; + + /** The slime's mouth */ + ModelRenderer slimeMouth; + + public ModelNpcSlime(int par1) + { + this.textureHeight = 64; + this.textureWidth = 64; + outerBody = new ModelRenderer(this, 0, 0); + this.outerBody = new ModelRenderer(this, 0, 0); + this.outerBody.addBox(-8.0F, 32.0F, -8.0F, 16, 16, 16); + //this.outerBody.addBox(-8.0F, 32.0F, -8.0F, 16, 16, 16); + + if (par1 > 0) + { + this.innerBody = new ModelRenderer(this, 0, 32); + this.innerBody.addBox(-3.0F, 17.0F, -3.0F, 6, 6, 6); + + this.slimeRightEye = new ModelRenderer(this, 0, 0); + this.slimeRightEye.addBox(-3.25F, 18.0F, -3.5F, 2, 2, 2); + this.slimeLeftEye = new ModelRenderer(this, 0, 4); + this.slimeLeftEye.addBox(1.25F, 18.0F, -3.5F, 2, 2, 2); + this.slimeMouth = new ModelRenderer(this, 0, 8); + this.slimeMouth.addBox(0.0F, 21.0F, -3.5F, 1, 1, 1); + } + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) + { + this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity); + if(innerBody != null) + this.innerBody.render(par7); + else{ + GL11.glPushMatrix(); + GL11.glScalef(0.5f, 0.5f, 0.5f); + this.outerBody.render(par7); + GL11.glPopMatrix(); + } + + if (this.slimeRightEye != null) + { + this.slimeRightEye.render(par7); + this.slimeLeftEye.render(par7); + this.slimeMouth.render(par7); + } + } +} diff --git a/src/main/java/noppes/npcs/client/model/ModelPony.java b/src/main/java/noppes/npcs/client/model/ModelPony.java new file mode 100644 index 000000000..59505a28a --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/ModelPony.java @@ -0,0 +1,957 @@ +package noppes.npcs.client.model; + +import java.awt.Color; +import java.awt.image.BufferedImage; +import java.io.IOException; + +import javax.imageio.ImageIO; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.client.resources.IResource; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.MathHelper; +import noppes.npcs.client.model.util.ModelPlaneRenderer; +import noppes.npcs.constants.EnumAnimation; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.entity.EntityNpcPony; + +import org.lwjgl.opengl.GL11; + +public class ModelPony extends ModelBase +{ + + private boolean rainboom; + private float WingRotateAngleX; + private float WingRotateAngleY; + private float WingRotateAngleZ; + private float TailRotateAngleY; + public ModelRenderer Head; + public ModelRenderer Headpiece[]; + public ModelRenderer Helmet; + public ModelRenderer Body; + public ModelPlaneRenderer Bodypiece[]; + public ModelRenderer RightArm; + public ModelRenderer LeftArm; + public ModelRenderer RightLeg; + public ModelRenderer LeftLeg; + public ModelRenderer unicornarm; + public ModelPlaneRenderer Tail[]; + public ModelRenderer LeftWing[]; + public ModelRenderer RightWing[]; + public ModelRenderer LeftWingExt[]; + public ModelRenderer RightWingExt[]; + public boolean isPegasus; + public boolean isUnicorn; + public boolean isFlying; + public boolean isGlow; + public boolean isSleeping; + public boolean isSneak; + public boolean aimedBow; + public int heldItemRight; + + public ModelPony(float f) + { + init(f,0.0f); + } + + public void init(float strech,float f) + { + float f2 = 0.0F; + float f3 = 0.0F; + float f4 = 0.0F; + Head = new ModelRenderer(this, 0, 0); + Head.addBox(-4F, -4F, -6F, 8, 8, 8, strech); + Head.setRotationPoint(f2, f3 + f, f4); + Headpiece = new ModelRenderer[3]; + Headpiece[0] = new ModelRenderer(this, 12, 16); + Headpiece[0].addBox(-4F, -6F, -1F, 2, 2, 2, strech); + Headpiece[0].setRotationPoint(f2, f3 + f, f4); + Headpiece[1] = new ModelRenderer(this, 12, 16); + Headpiece[1].addBox(2.0F, -6F, -1F, 2, 2, 2, strech); + Headpiece[1].setRotationPoint(f2, f3 + f, f4); + Headpiece[2] = new ModelRenderer(this, 56, 0); + Headpiece[2].addBox(-0.5F, -10F, -4F, 1, 4, 1, strech); + Headpiece[2].setRotationPoint(f2, f3 + f, f4); + Helmet = new ModelRenderer(this, 32, 0); + Helmet.addBox(-4F, -4F, -6F, 8, 8, 8, strech + 0.5F); + Helmet.setRotationPoint(f2, f3, f4); + float f5 = 0.0F; + float f6 = 0.0F; + float f7 = 0.0F; + Body = new ModelRenderer(this, 16, 16); + Body.addBox(-4F, 4F, -2F, 8, 8, 4, strech); + Body.setRotationPoint(f5, f6 + f, f7); + Bodypiece = new ModelPlaneRenderer[13]; + Bodypiece[0] = new ModelPlaneRenderer(this, 24, 0); + Bodypiece[0].addSidePlane(-4F, 4F, 2.0F, 8, 8, strech); + Bodypiece[0].setRotationPoint(f5, f6 + f, f7); + Bodypiece[1] = new ModelPlaneRenderer(this, 24, 0); + Bodypiece[1].addSidePlane(4F, 4F, 2.0F, 8, 8, strech); + Bodypiece[1].setRotationPoint(f5, f6 + f, f7); + Bodypiece[2] = new ModelPlaneRenderer(this, 24, 0); + Bodypiece[2].addTopPlane(-4F, 4F, 2.0F, 8, 8, strech); + Bodypiece[2].setRotationPoint(f2, f3 + f, f4); + Bodypiece[3] = new ModelPlaneRenderer(this, 24, 0); + Bodypiece[3].addTopPlane(-4F, 12F, 2.0F, 8, 8, strech); + Bodypiece[3].setRotationPoint(f2, f3 + f, f4); + Bodypiece[4] = new ModelPlaneRenderer(this, 0, 20); + Bodypiece[4].addSidePlane(-4F, 4F, 10F, 8, 4, strech); + Bodypiece[4].setRotationPoint(f5, f6 + f, f7); + Bodypiece[5] = new ModelPlaneRenderer(this, 0, 20); + Bodypiece[5].addSidePlane(4F, 4F, 10F, 8, 4, strech); + Bodypiece[5].setRotationPoint(f5, f6 + f, f7); + Bodypiece[6] = new ModelPlaneRenderer(this, 24, 0); + Bodypiece[6].addTopPlane(-4F, 4F, 10F, 8, 4, strech); + Bodypiece[6].setRotationPoint(f2, f3 + f, f4); + Bodypiece[7] = new ModelPlaneRenderer(this, 24, 0); + Bodypiece[7].addTopPlane(-4F, 12F, 10F, 8, 4, strech); + Bodypiece[7].setRotationPoint(f2, f3 + f, f4); + Bodypiece[8] = new ModelPlaneRenderer(this, 24, 0); + Bodypiece[8].addBackPlane(-4F, 4F, 14F, 8, 8, strech); + Bodypiece[8].setRotationPoint(f2, f3 + f, f4); + Bodypiece[9] = new ModelPlaneRenderer(this, 32, 0); + Bodypiece[9].addTopPlane(-1F, 10F, 8F, 2, 6, strech); + Bodypiece[9].setRotationPoint(f2, f3 + f, f4); + Bodypiece[10] = new ModelPlaneRenderer(this, 32, 0); + Bodypiece[10].addTopPlane(-1F, 12F, 8F, 2, 6, strech); + Bodypiece[10].setRotationPoint(f2, f3 + f, f4); + Bodypiece[11] = new ModelPlaneRenderer(this, 32, 0); + Bodypiece[11].mirror = true; + Bodypiece[11].addSidePlane(-1F, 10F, 8F, 2, 6, strech); + Bodypiece[11].setRotationPoint(f2, f3 + f, f4); + Bodypiece[12] = new ModelPlaneRenderer(this, 32, 0); + Bodypiece[12].addSidePlane(1.0F, 10F, 8F, 2, 6, strech); + Bodypiece[12].setRotationPoint(f2, f3 + f, f4); + RightArm = new ModelRenderer(this, 40, 16); + RightArm.addBox(-2F, 4F, -2F, 4, 12, 4, strech); + RightArm.setRotationPoint(-3F, 8F + f, 0.0F); + LeftArm = new ModelRenderer(this, 40, 16); + LeftArm.mirror = true; + LeftArm.addBox(-2F, 4F, -2F, 4, 12, 4, strech); + LeftArm.setRotationPoint(3F, 8F + f, 0.0F); + RightLeg = new ModelRenderer(this, 40, 16); + RightLeg.addBox(-2F, 4F, -2F, 4, 12, 4, strech); + RightLeg.setRotationPoint(-3F, 0.0F + f, 0.0F); + LeftLeg = new ModelRenderer(this, 40, 16); + LeftLeg.mirror = true; + LeftLeg.addBox(-2F, 4F, -2F, 4, 12, 4, strech); + LeftLeg.setRotationPoint(3F, 0.0F + f, 0.0F); + unicornarm = new ModelRenderer(this, 40, 16); + unicornarm.addBox(-3F, -2F, -2F, 4, 12, 4, strech); + unicornarm.setRotationPoint(-5F, 2.0F + f, 0.0F); + float f8 = 0.0F; + float f9 = 8F; + float f10 = -14F; + float f11 = 0.0F - f8; + float f12 = 10F - f9; + float f13 = 0.0F; + Tail = new ModelPlaneRenderer[10]; + Tail[0] = new ModelPlaneRenderer(this, 32, 0); + Tail[0].addTopPlane(-2F + f8, -7F + f9, 16F + f10, 4, 4, strech); + Tail[0].setRotationPoint(f11, f12 + f, f13); + Tail[1] = new ModelPlaneRenderer(this, 32, 0); + Tail[1].addTopPlane(-2F + f8, 9F + f9, 16F + f10, 4, 4, strech); + Tail[1].setRotationPoint(f11, f12 + f, f13); + Tail[2] = new ModelPlaneRenderer(this, 32, 0); + Tail[2].addBackPlane(-2F + f8, -7F + f9, 16F + f10, 4, 8, strech); + Tail[2].setRotationPoint(f11, f12 + f, f13); + Tail[3] = new ModelPlaneRenderer(this, 32, 0); + Tail[3].addBackPlane(-2F + f8, -7F + f9, 20F + f10, 4, 8, strech); + Tail[3].setRotationPoint(f11, f12 + f, f13); + Tail[4] = new ModelPlaneRenderer(this, 32, 0); + Tail[4].addBackPlane(-2F + f8, 1.0F + f9, 16F + f10, 4, 8, strech); + Tail[4].setRotationPoint(f11, f12 + f, f13); + Tail[5] = new ModelPlaneRenderer(this, 32, 0); + Tail[5].addBackPlane(-2F + f8, 1.0F + f9, 20F + f10, 4, 8, strech); + Tail[5].setRotationPoint(f11, f12 + f, f13); + Tail[6] = new ModelPlaneRenderer(this, 36, 0); + Tail[6].mirror = true; + Tail[6].addSidePlane(2.0F + f8, -7F + f9, 16F + f10, 8, 4, strech); + Tail[6].setRotationPoint(f11, f12 + f, f13); + Tail[7] = new ModelPlaneRenderer(this, 36, 0); + Tail[7].addSidePlane(-2F + f8, -7F + f9, 16F + f10, 8, 4, strech); + Tail[7].setRotationPoint(f11, f12 + f, f13); + Tail[8] = new ModelPlaneRenderer(this, 36, 0); + Tail[8].mirror = true; + Tail[8].addSidePlane(2.0F + f8, 1.0F + f9, 16F + f10, 8, 4, strech); + Tail[8].setRotationPoint(f11, f12 + f, f13); + Tail[9] = new ModelPlaneRenderer(this, 36, 0); + Tail[9].addSidePlane(-2F + f8, 1.0F + f9, 16F + f10, 8, 4, strech); + Tail[9].setRotationPoint(f11, f12 + f, f13); + TailRotateAngleY = Tail[0].rotateAngleY; + TailRotateAngleY = Tail[0].rotateAngleY; + float f14 = 0.0F; + float f15 = 0.0F; + float f16 = 0.0F; + LeftWing = new ModelRenderer[3]; + LeftWing[0] = new ModelRenderer(this, 56, 16); + LeftWing[0].mirror = true; + LeftWing[0].addBox(4F, 5F, 2.0F, 2, 6, 2, strech); + LeftWing[0].setRotationPoint(f14, f15 + f, f16); + LeftWing[1] = new ModelRenderer(this, 56, 16); + LeftWing[1].mirror = true; + LeftWing[1].addBox(4F, 5F, 4F, 2, 8, 2, strech); + LeftWing[1].setRotationPoint(f14, f15 + f, f16); + LeftWing[2] = new ModelRenderer(this, 56, 16); + LeftWing[2].mirror = true; + LeftWing[2].addBox(4F, 5F, 6F, 2, 6, 2, strech); + LeftWing[2].setRotationPoint(f14, f15 + f, f16); + RightWing = new ModelRenderer[3]; + RightWing[0] = new ModelRenderer(this, 56, 16); + RightWing[0].addBox(-6F, 5F, 2.0F, 2, 6, 2, strech); + RightWing[0].setRotationPoint(f14, f15 + f, f16); + RightWing[1] = new ModelRenderer(this, 56, 16); + RightWing[1].addBox(-6F, 5F, 4F, 2, 8, 2, strech); + RightWing[1].setRotationPoint(f14, f15 + f, f16); + RightWing[2] = new ModelRenderer(this, 56, 16); + RightWing[2].addBox(-6F, 5F, 6F, 2, 6, 2, strech); + RightWing[2].setRotationPoint(f14, f15 + f, f16); + float f17 = f2 + 4.5F; + float f18 = f3 + 5F; + float f19 = f4 + 6F; + LeftWingExt = new ModelRenderer[7]; + LeftWingExt[0] = new ModelRenderer(this, 56, 19); + LeftWingExt[0].mirror = true; + LeftWingExt[0].addBox(0.0F, 0.0F, 0.0F, 1, 8, 2, strech + 0.1F); + LeftWingExt[0].setRotationPoint(f17, f18 + f, f19); + LeftWingExt[1] = new ModelRenderer(this, 56, 19); + LeftWingExt[1].mirror = true; + LeftWingExt[1].addBox(0.0F, 8F, 0.0F, 1, 6, 2, strech + 0.1F); + LeftWingExt[1].setRotationPoint(f17, f18 + f, f19); + LeftWingExt[2] = new ModelRenderer(this, 56, 19); + LeftWingExt[2].mirror = true; + LeftWingExt[2].addBox(0.0F, -1.2F, -0.2F, 1, 8, 2, strech - 0.2F); + LeftWingExt[2].setRotationPoint(f17, f18 + f, f19); + LeftWingExt[3] = new ModelRenderer(this, 56, 19); + LeftWingExt[3].mirror = true; + LeftWingExt[3].addBox(0.0F, 1.8F, 1.3F, 1, 8, 2, strech - 0.1F); + LeftWingExt[3].setRotationPoint(f17, f18 + f, f19); + LeftWingExt[4] = new ModelRenderer(this, 56, 19); + LeftWingExt[4].mirror = true; + LeftWingExt[4].addBox(0.0F, 5F, 2.0F, 1, 8, 2, strech); + LeftWingExt[4].setRotationPoint(f17, f18 + f, f19); + LeftWingExt[5] = new ModelRenderer(this, 56, 19); + LeftWingExt[5].mirror = true; + LeftWingExt[5].addBox(0.0F, 0.0F, -0.2F, 1, 6, 2, strech + 0.3F); + LeftWingExt[5].setRotationPoint(f17, f18 + f, f19); + LeftWingExt[6] = new ModelRenderer(this, 56, 19); + LeftWingExt[6].mirror = true; + LeftWingExt[6].addBox(0.0F, 0.0F, 0.2F, 1, 3, 2, strech + 0.2F); + LeftWingExt[6].setRotationPoint(f17, f18 + f, f19); + float f20 = f2 - 4.5F; + float f21 = f3 + 5F; + float f22 = f4 + 6F; + RightWingExt = new ModelRenderer[7]; + RightWingExt[0] = new ModelRenderer(this, 56, 19); + RightWingExt[0].mirror = true; + RightWingExt[0].addBox(0.0F, 0.0F, 0.0F, 1, 8, 2, strech + 0.1F); + RightWingExt[0].setRotationPoint(f20, f21 + f, f22); + RightWingExt[1] = new ModelRenderer(this, 56, 19); + RightWingExt[1].mirror = true; + RightWingExt[1].addBox(0.0F, 8F, 0.0F, 1, 6, 2, strech + 0.1F); + RightWingExt[1].setRotationPoint(f20, f21 + f, f22); + RightWingExt[2] = new ModelRenderer(this, 56, 19); + RightWingExt[2].mirror = true; + RightWingExt[2].addBox(0.0F, -1.2F, -0.2F, 1, 8, 2, strech - 0.2F); + RightWingExt[2].setRotationPoint(f20, f21 + f, f22); + RightWingExt[3] = new ModelRenderer(this, 56, 19); + RightWingExt[3].mirror = true; + RightWingExt[3].addBox(0.0F, 1.8F, 1.3F, 1, 8, 2, strech - 0.1F); + RightWingExt[3].setRotationPoint(f20, f21 + f, f22); + RightWingExt[4] = new ModelRenderer(this, 56, 19); + RightWingExt[4].mirror = true; + RightWingExt[4].addBox(0.0F, 5F, 2.0F, 1, 8, 2, strech); + RightWingExt[4].setRotationPoint(f20, f21 + f, f22); + RightWingExt[5] = new ModelRenderer(this, 56, 19); + RightWingExt[5].mirror = true; + RightWingExt[5].addBox(0.0F, 0.0F, -0.2F, 1, 6, 2, strech + 0.3F); + RightWingExt[5].setRotationPoint(f20, f21 + f, f22); + RightWingExt[6] = new ModelRenderer(this, 56, 19); + RightWingExt[6].mirror = true; + RightWingExt[6].addBox(0.0F, 0.0F, 0.2F, 1, 3, 2, strech + 0.2F); + RightWingExt[6].setRotationPoint(f20, f21 + f, f22); + WingRotateAngleX = LeftWingExt[0].rotateAngleX; + WingRotateAngleY = LeftWingExt[0].rotateAngleY; + WingRotateAngleZ = LeftWingExt[0].rotateAngleZ; + } + + + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) + { + EntityNPCInterface npc = (EntityNPCInterface) entity; + isRiding = npc.isRiding(); + + if(isSneak && (npc.currentAnimation == EnumAnimation.CRAWLING || npc.currentAnimation == EnumAnimation.LYING)) + isSneak = false; + rainboom = false; + float f6; + float f7; + if(isSleeping) + { + f6 = 1.4F; + f7 = 0.1F; + } else + { + f6 = f3 / 57.29578F; + f7 = f4 / 57.29578F; + } + Head.rotateAngleY = f6; + Head.rotateAngleX = f7; + Headpiece[0].rotateAngleY = f6; + Headpiece[0].rotateAngleX = f7; + Headpiece[1].rotateAngleY = f6; + Headpiece[1].rotateAngleX = f7; + Headpiece[2].rotateAngleY = f6; + Headpiece[2].rotateAngleX = f7; + Helmet.rotateAngleY = f6; + Helmet.rotateAngleX = f7; + Headpiece[2].rotateAngleX = f7 + 0.5F; + float f8; + float f9; + float f10; + float f11; + if(!isFlying || !isPegasus) + { + f8 = MathHelper.cos(f * 0.6662F + 3.141593F) * 0.6F * f1; + f9 = MathHelper.cos(f * 0.6662F) * 0.6F * f1; + f10 = MathHelper.cos(f * 0.6662F) * 0.3F * f1; + f11 = MathHelper.cos(f * 0.6662F + 3.141593F) * 0.3F * f1; + RightArm.rotateAngleY = 0.0F; + unicornarm.rotateAngleY = 0.0F; + LeftArm.rotateAngleY = 0.0F; + RightLeg.rotateAngleY = 0.0F; + LeftLeg.rotateAngleY = 0.0F; + } else + { + if(f1 < 0.9999F) + { + rainboom = false; + f8 = MathHelper.sin(0.0F - f1 * 0.5F); + f9 = MathHelper.sin(0.0F - f1 * 0.5F); + f10 = MathHelper.sin(f1 * 0.5F); + f11 = MathHelper.sin(f1 * 0.5F); + } else + { + rainboom = true; + f8 = 4.712F; + f9 = 4.712F; + f10 = 1.571F; + f11 = 1.571F; + } + RightArm.rotateAngleY = 0.2F; + LeftArm.rotateAngleY = -0.2F; + RightLeg.rotateAngleY = -0.2F; + LeftLeg.rotateAngleY = 0.2F; + } + if(isSleeping) + { + f8 = 4.712F; + f9 = 4.712F; + f10 = 1.571F; + f11 = 1.571F; + } + RightArm.rotateAngleX = f8; + unicornarm.rotateAngleX = 0.0F; + LeftArm.rotateAngleX = f9; + RightLeg.rotateAngleX = f10; + LeftLeg.rotateAngleX = f11; + RightArm.rotateAngleZ = 0.0F; + unicornarm.rotateAngleZ = 0.0F; + LeftArm.rotateAngleZ = 0.0F; + for(int i = 0; i < Tail.length; i++) + { + if(rainboom) + { + Tail[i].rotateAngleZ = 0.0F; + } else + { + Tail[i].rotateAngleZ = MathHelper.cos(f * 0.8F) * 0.2F * f1; + } + } + + if(heldItemRight != 0 && !rainboom && !isUnicorn) + { + RightArm.rotateAngleX = RightArm.rotateAngleX * 0.5F - 0.3141593F; + } + float f12 = 0.0F; + if(f5 > -9990F && !isUnicorn) + { + f12 = MathHelper.sin(MathHelper.sqrt_float(f5) * 3.141593F * 2.0F) * 0.2F; + } + Body.rotateAngleY = (float)((double)f12 * 0.20000000000000001D); + for(int j = 0; j < Bodypiece.length; j++) + { + Bodypiece[j].rotateAngleY = (float)((double)f12 * 0.20000000000000001D); + } + + for(int k = 0; k < LeftWing.length; k++) + { + LeftWing[k].rotateAngleY = (float)((double)f12 * 0.20000000000000001D); + } + + for(int l = 0; l < RightWing.length; l++) + { + RightWing[l].rotateAngleY = (float)((double)f12 * 0.20000000000000001D); + } + + for(int i1 = 0; i1 < Tail.length; i1++) + { + Tail[i1].rotateAngleY = f12; + } + + float f13 = MathHelper.sin(Body.rotateAngleY) * 5F; + float f14 = MathHelper.cos(Body.rotateAngleY) * 5F; + float f15 = 4F; + if(isSneak && !isFlying) + { + f15 = 0.0F; + } + if(isSleeping) + { + f15 = 2.6F; + } + if(rainboom) + { + RightArm.rotationPointZ = f13 + 2.0F; + LeftArm.rotationPointZ = (0.0F - f13) + 2.0F; + } else + { + RightArm.rotationPointZ = f13 + 1.0F; + LeftArm.rotationPointZ = (0.0F - f13) + 1.0F; + } + RightArm.rotationPointX = (0.0F - f14 - 1.0F) + f15; + LeftArm.rotationPointX = (f14 + 1.0F) - f15; + RightLeg.rotationPointX = (0.0F - f14 - 1.0F) + f15; + LeftLeg.rotationPointX = (f14 + 1.0F) - f15; + RightArm.rotateAngleY += Body.rotateAngleY; + LeftArm.rotateAngleY += Body.rotateAngleY; + LeftArm.rotateAngleX += Body.rotateAngleY; + RightArm.rotationPointY = 8F; + LeftArm.rotationPointY = 8F; + RightLeg.rotationPointY = 4F; + LeftLeg.rotationPointY = 4F; + if(f5 > -9990F) + { + float f16 = f5; + f16 = 1.0F - f5; + f16 *= f16 * f16; + f16 = 1.0F - f16; + float f22 = MathHelper.sin(f16 * 3.141593F); + float f28 = MathHelper.sin(f5 * 3.141593F); + float f33 = f28 * -(Head.rotateAngleX - 0.7F) * 0.75F; + if(isUnicorn) + { + unicornarm.rotateAngleX -= (double)f22 * 1.2D + (double)f33; + unicornarm.rotateAngleY += Body.rotateAngleY * 2.0F; + unicornarm.rotateAngleZ = f28 * -0.4F; + } else + { + unicornarm.rotateAngleX -= (double)f22 * 1.2D + (double)f33; + unicornarm.rotateAngleY += Body.rotateAngleY * 2.0F; + unicornarm.rotateAngleZ = f28 * -0.4F; +// RightArm.rotateAngleX -= (double)f22 * 1.2D + (double)f33; +// RightArm.rotateAngleY += Body.rotateAngleY * 2.0F; +// RightArm.rotateAngleZ = f28 * -0.4F; + } + } + if(isSneak && !isFlying) + { + float f17 = 0.4F; + float f23 = 7F; + float f29 = -4F; + Body.rotateAngleX = f17; + Body.rotationPointY = f23; + Body.rotationPointZ = f29; + for(int i3 = 0; i3 < Bodypiece.length; i3++) + { + Bodypiece[i3].rotateAngleX = f17; + Bodypiece[i3].rotationPointY = f23; + Bodypiece[i3].rotationPointZ = f29; + } + + float f34 = 3.5F; + float f37 = 6F; + for(int i4 = 0; i4 < LeftWingExt.length; i4++) + { + LeftWingExt[i4].rotateAngleX = (float)((double)f17 + 2.3561947345733643D); + LeftWingExt[i4].rotationPointY = f23 + f34; + LeftWingExt[i4].rotationPointZ = f29 + f37; + LeftWingExt[i4].rotateAngleX = 2.5F; + LeftWingExt[i4].rotateAngleZ = -6F; + } + + float f40 = 4.5F; + float f43 = 6F; + for(int i5 = 0; i5 < LeftWingExt.length; i5++) + { + RightWingExt[i5].rotateAngleX = (float)((double)f17 + 2.3561947345733643D); + RightWingExt[i5].rotationPointY = f23 + f40; + RightWingExt[i5].rotationPointZ = f29 + f43; + RightWingExt[i5].rotateAngleX = 2.5F; + RightWingExt[i5].rotateAngleZ = 6F; + } + + RightLeg.rotateAngleX -= 0.0F; + LeftLeg.rotateAngleX -= 0.0F; + RightArm.rotateAngleX -= 0.4F; + unicornarm.rotateAngleX += 0.4F; + LeftArm.rotateAngleX -= 0.4F; + RightLeg.rotationPointZ = 10F; + LeftLeg.rotationPointZ = 10F; + RightLeg.rotationPointY = 7F; + LeftLeg.rotationPointY = 7F; + float f46; + float f48; + float f50; + if(isSleeping) + { + f46 = 2.0F; + f48 = -1F; + f50 = 1.0F; + } else + { + f46 = 6F; + f48 = -2F; + f50 = 0.0F; + } + Head.rotationPointY = f46; + Head.rotationPointZ = f48; + Head.rotationPointX = f50; + Helmet.rotationPointY = f46; + Helmet.rotationPointZ = f48; + Helmet.rotationPointX = f50; + Headpiece[0].rotationPointY = f46; + Headpiece[0].rotationPointZ = f48; + Headpiece[0].rotationPointX = f50; + Headpiece[1].rotationPointY = f46; + Headpiece[1].rotationPointZ = f48; + Headpiece[1].rotationPointX = f50; + Headpiece[2].rotationPointY = f46; + Headpiece[2].rotationPointZ = f48; + Headpiece[2].rotationPointX = f50; + float f52 = 0.0F; + float f54 = 8F; + float f56 = -14F; + float f58 = 0.0F - f52; + float f60 = 9F - f54; + float f62 = -4F - f56; + float f63 = 0.0F; + for(int i6 = 0; i6 < Tail.length; i6++) + { + Tail[i6].rotationPointX = f58; + Tail[i6].rotationPointY = f60; + Tail[i6].rotationPointZ = f62; + Tail[i6].rotateAngleX = f63; + } + + } else + { + float f18 = 0.0F; + float f24 = 0.0F; + float f30 = 0.0F; + Body.rotateAngleX = f18; + Body.rotationPointY = f24; + Body.rotationPointZ = f30; + for(int j3 = 0; j3 < Bodypiece.length; j3++) + { + Bodypiece[j3].rotateAngleX = f18; + Bodypiece[j3].rotationPointY = f24; + Bodypiece[j3].rotationPointZ = f30; + } + + if(isPegasus) + { + if(!isFlying) + { + for(int k3 = 0; k3 < LeftWing.length; k3++) + { + LeftWing[k3].rotateAngleX = (float)((double)f18 + 1.5707964897155762D); + LeftWing[k3].rotationPointY = f24 + 13F; + LeftWing[k3].rotationPointZ = f30 - 3F; + } + + for(int l3 = 0; l3 < RightWing.length; l3++) + { + RightWing[l3].rotateAngleX = (float)((double)f18 + 1.5707964897155762D); + RightWing[l3].rotationPointY = f24 + 13F; + RightWing[l3].rotationPointZ = f30 - 3F; + } + + } else + { + float f35 = 5.5F; + float f38 = 3F; + for(int j4 = 0; j4 < LeftWingExt.length; j4++) + { + LeftWingExt[j4].rotateAngleX = (float)((double)f18 + 1.5707964897155762D); + LeftWingExt[j4].rotationPointY = f24 + f35; + LeftWingExt[j4].rotationPointZ = f30 + f38; + } + + float f41 = 6.5F; + float f44 = 3F; + for(int j5 = 0; j5 < RightWingExt.length; j5++) + { + RightWingExt[j5].rotateAngleX = (float)((double)f18 + 1.5707964897155762D); + RightWingExt[j5].rotationPointY = f24 + f41; + RightWingExt[j5].rotationPointZ = f30 + f44; + } + + } + } + RightLeg.rotationPointZ = 10F; + LeftLeg.rotationPointZ = 10F; + RightLeg.rotationPointY = 8F; + LeftLeg.rotationPointY = 8F; + float f36 = MathHelper.cos(f2 * 0.09F) * 0.05F + 0.05F; + float f39 = MathHelper.sin(f2 * 0.067F) * 0.05F; + unicornarm.rotateAngleZ += f36; + unicornarm.rotateAngleX += f39; + if(isPegasus && isFlying) + { + WingRotateAngleY = MathHelper.sin(f2 * 0.067F * 8F) * 1.0F; + WingRotateAngleZ = MathHelper.sin(f2 * 0.067F * 8F) * 1.0F; + for(int k4 = 0; k4 < LeftWingExt.length; k4++) + { + LeftWingExt[k4].rotateAngleX = 2.5F; + LeftWingExt[k4].rotateAngleZ = -WingRotateAngleZ - 4.712F - 0.4F; + } + + for(int l4 = 0; l4 < RightWingExt.length; l4++) + { + RightWingExt[l4].rotateAngleX = 2.5F; + RightWingExt[l4].rotateAngleZ = WingRotateAngleZ + 4.712F + 0.4F; + } + + } + float f42; + float f45; + float f47; + if(isSleeping) + { + f42 = 2.0F; + f45 = 1.0F; + f47 = 1.0F; + } else + { + f42 = 0.0F; + f45 = 0.0F; + f47 = 0.0F; + } + Head.rotationPointY = f42; + Head.rotationPointZ = f45; + Head.rotationPointX = f47; + Helmet.rotationPointY = f42; + Helmet.rotationPointZ = f45; + Helmet.rotationPointX = f47; + Headpiece[0].rotationPointY = f42; + Headpiece[0].rotationPointZ = f45; + Headpiece[0].rotationPointX = f47; + Headpiece[1].rotationPointY = f42; + Headpiece[1].rotationPointZ = f45; + Headpiece[1].rotationPointX = f47; + Headpiece[2].rotationPointY = f42; + Headpiece[2].rotationPointZ = f45; + Headpiece[2].rotationPointX = f47; + float f49 = 0.0F; + float f51 = 8F; + float f53 = -14F; + float f55 = 0.0F - f49; + float f57 = 9F - f51; + float f59 = 0.0F - f53; + float f61 = 0.5F * f1; + for(int k5 = 0; k5 < Tail.length; k5++) + { + Tail[k5].rotationPointX = f55; + Tail[k5].rotationPointY = f57; + Tail[k5].rotationPointZ = f59; + if(rainboom) + { + Tail[k5].rotateAngleX = 1.571F + 0.1F * MathHelper.sin(f); + } else + { + Tail[k5].rotateAngleX = f61; + } + } + + for(int l5 = 0; l5 < Tail.length; l5++) + { + if(!rainboom) + { + Tail[l5].rotateAngleX += f39; + } + } + + } + LeftWingExt[2].rotateAngleX = LeftWingExt[2].rotateAngleX - 0.85F; + LeftWingExt[3].rotateAngleX = LeftWingExt[3].rotateAngleX - 0.75F; + LeftWingExt[4].rotateAngleX = LeftWingExt[4].rotateAngleX - 0.5F; + LeftWingExt[6].rotateAngleX = LeftWingExt[6].rotateAngleX - 0.85F; + RightWingExt[2].rotateAngleX = RightWingExt[2].rotateAngleX - 0.85F; + RightWingExt[3].rotateAngleX = RightWingExt[3].rotateAngleX - 0.75F; + RightWingExt[4].rotateAngleX = RightWingExt[4].rotateAngleX - 0.5F; + RightWingExt[6].rotateAngleX = RightWingExt[6].rotateAngleX - 0.85F; + Bodypiece[9].rotateAngleX = Bodypiece[9].rotateAngleX + 0.5F; + Bodypiece[10].rotateAngleX = Bodypiece[10].rotateAngleX + 0.5F; + Bodypiece[11].rotateAngleX = Bodypiece[11].rotateAngleX + 0.5F; + Bodypiece[12].rotateAngleX = Bodypiece[12].rotateAngleX + 0.5F; + if(rainboom) + { + for(int j1 = 0; j1 < Tail.length; j1++) + { + Tail[j1].rotationPointY = Tail[j1].rotationPointY + 6F; + Tail[j1].rotationPointZ = Tail[j1].rotationPointZ + 1.0F; + } + + } +// if(isRiding) +// { +// float f19 = -10F; +// float f25 = -10F; +// Head.rotationPointY = Head.rotationPointY + f19; +// Head.rotationPointZ = Head.rotationPointZ + f25; +// Headpiece[0].rotationPointY = Headpiece[0].rotationPointY + f19; +// Headpiece[0].rotationPointZ = Headpiece[0].rotationPointZ + f25; +// Headpiece[1].rotationPointY = Headpiece[1].rotationPointY + f19; +// Headpiece[1].rotationPointZ = Headpiece[1].rotationPointZ + f25; +// Headpiece[2].rotationPointY = Headpiece[2].rotationPointY + f19; +// Headpiece[2].rotationPointZ = Headpiece[2].rotationPointZ + f25; +// Helmet.rotationPointY = Helmet.rotationPointY + f19; +// Helmet.rotationPointZ = Helmet.rotationPointZ + f25; +// Body.rotationPointY = Body.rotationPointY + f19; +// Body.rotationPointZ = Body.rotationPointZ + f25; +// for(int k1 = 0; k1 < Bodypiece.length; k1++) +// { +// Bodypiece[k1].rotationPointY = Bodypiece[k1].rotationPointY + f19; +// Bodypiece[k1].rotationPointZ = Bodypiece[k1].rotationPointZ + f25; +// } +// +// LeftArm.rotationPointY = LeftArm.rotationPointY + f19; +// LeftArm.rotationPointZ = LeftArm.rotationPointZ + f25; +// RightArm.rotationPointY = RightArm.rotationPointY + f19; +// RightArm.rotationPointZ = RightArm.rotationPointZ + f25; +// LeftLeg.rotationPointY = LeftLeg.rotationPointY + f19; +// LeftLeg.rotationPointZ = LeftLeg.rotationPointZ + f25; +// RightLeg.rotationPointY = RightLeg.rotationPointY + f19; +// RightLeg.rotationPointZ = RightLeg.rotationPointZ + f25; +// for(int l1 = 0; l1 < Tail.length; l1++) +// { +// Tail[l1].rotationPointY = Tail[l1].rotationPointY + f19; +// Tail[l1].rotationPointZ = Tail[l1].rotationPointZ + f25; +// } +// +// for(int i2 = 0; i2 < LeftWing.length; i2++) +// { +// LeftWing[i2].rotationPointY = LeftWing[i2].rotationPointY + f19; +// LeftWing[i2].rotationPointZ = LeftWing[i2].rotationPointZ + f25; +// } +// +// for(int j2 = 0; j2 < RightWing.length; j2++) +// { +// RightWing[j2].rotationPointY = RightWing[j2].rotationPointY + f19; +// RightWing[j2].rotationPointZ = RightWing[j2].rotationPointZ + f25; +// } +// +// for(int k2 = 0; k2 < LeftWingExt.length; k2++) +// { +// LeftWingExt[k2].rotationPointY = LeftWingExt[k2].rotationPointY + f19; +// LeftWingExt[k2].rotationPointZ = LeftWingExt[k2].rotationPointZ + f25; +// } +// +// for(int l2 = 0; l2 < RightWingExt.length; l2++) +// { +// RightWingExt[l2].rotationPointY = RightWingExt[l2].rotationPointY + f19; +// RightWingExt[l2].rotationPointZ = RightWingExt[l2].rotationPointZ + f25; +// } +// +// } + if(isSleeping) + { + RightArm.rotationPointZ = RightArm.rotationPointZ + 6F; + LeftArm.rotationPointZ = LeftArm.rotationPointZ + 6F; + RightLeg.rotationPointZ = RightLeg.rotationPointZ - 8F; + LeftLeg.rotationPointZ = LeftLeg.rotationPointZ - 8F; + RightArm.rotationPointY = RightArm.rotationPointY + 2.0F; + LeftArm.rotationPointY = LeftArm.rotationPointY + 2.0F; + RightLeg.rotationPointY = RightLeg.rotationPointY + 2.0F; + LeftLeg.rotationPointY = LeftLeg.rotationPointY + 2.0F; + } + if(aimedBow) + { + if(isUnicorn) + { + float f20 = 0.0F; + float f26 = 0.0F; + unicornarm.rotateAngleZ = 0.0F; + unicornarm.rotateAngleY = -(0.1F - f20 * 0.6F) + Head.rotateAngleY; + unicornarm.rotateAngleX = 4.712F + Head.rotateAngleX; + unicornarm.rotateAngleX -= f20 * 1.2F - f26 * 0.4F; + float f31 = f2; + unicornarm.rotateAngleZ += MathHelper.cos(f31 * 0.09F) * 0.05F + 0.05F; + unicornarm.rotateAngleX += MathHelper.sin(f31 * 0.067F) * 0.05F; + } else + { + float f21 = 0.0F; + float f27 = 0.0F; + RightArm.rotateAngleZ = 0.0F; + RightArm.rotateAngleY = -(0.1F - f21 * 0.6F) + Head.rotateAngleY; + RightArm.rotateAngleX = 4.712F + Head.rotateAngleX; + RightArm.rotateAngleX -= f21 * 1.2F - f27 * 0.4F; + float f32 = f2; + RightArm.rotateAngleZ += MathHelper.cos(f32 * 0.09F) * 0.05F + 0.05F; + RightArm.rotateAngleX += MathHelper.sin(f32 * 0.067F) * 0.05F; + RightArm.rotationPointZ = RightArm.rotationPointZ + 1.0F; + } + } + } + + @Override + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) + { + EntityNpcPony pony = (EntityNpcPony) entity; + if(pony.textureLocation != pony.checked && pony.textureLocation != null){ + try { + IResource resource = Minecraft.getMinecraft().getResourceManager().getResource(pony.textureLocation); + BufferedImage bufferedimage = ImageIO.read(resource.getInputStream()); + + pony.isPegasus = false; + pony.isUnicorn = false; + Color color = new Color(bufferedimage.getRGB(0, 0), true); + Color color1 = new Color(249, 177, 49, 255); + Color color2 = new Color(136, 202, 240, 255); + Color color3 = new Color(209, 159, 228, 255); + Color color4 = new Color(254, 249, 252, 255); + if(color.equals(color1)) + { + } + if(color.equals(color2)) + { + pony.isPegasus = true; + } + if(color.equals(color3)) + { + pony.isUnicorn = true; + } + if(color.equals(color4)) + { + pony.isPegasus = true; + pony.isUnicorn = true; + } + pony.checked = pony.textureLocation; + + } catch (IOException e) { + + } + } + isSleeping = pony.isPlayerSleeping(); + isUnicorn = pony.isUnicorn; + isPegasus = pony.isPegasus; + isSneak = pony.isSneaking(); + heldItemRight = pony.getHeldItem() == null ? 0 : 1; + setRotationAngles(f, f1, f2, f3, f4, f5, entity); + GL11.glPushMatrix(); + if(isSleeping){ + GL11.glRotatef(90, 1, 0, 0); + GL11.glTranslatef(0f, -0.5f, -0.9f); + } + float scale = f5; + Head.render(scale); + Headpiece[0].render(scale); + Headpiece[1].render(scale); + if(isUnicorn) + { + Headpiece[2].render(scale); + } + Helmet.render(scale); + Body.render(scale); + for(int i = 0; i < Bodypiece.length; i++) + { + Bodypiece[i].render(scale); + } + + LeftArm.render(scale); + RightArm.render(scale); + LeftLeg.render(scale); + RightLeg.render(scale); + for(int j = 0; j < Tail.length; j++) + { + Tail[j].render(scale); + } + + if(isPegasus) + { + if(isFlying || isSneak) + { + for(int k = 0; k < LeftWingExt.length; k++) + { + LeftWingExt[k].render(scale); + } + + for(int l = 0; l < RightWingExt.length; l++) + { + RightWingExt[l].render(scale); + } + + } else + { + for(int i1 = 0; i1 < LeftWing.length; i1++) + { + LeftWing[i1].render(scale); + } + + for(int j1 = 0; j1 < RightWing.length; j1++) + { + RightWing[j1].render(scale); + } + + } + } + GL11.glPopMatrix(); + } + + protected void renderGlow(RenderManager rendermanager, EntityPlayer entityplayer) + { + ItemStack itemstack = entityplayer.inventory.getCurrentItem(); + if(itemstack == null) + { + return; + } else + { + GL11.glPushMatrix(); + double d = entityplayer.posX; + double d1 = entityplayer.posY; + double d2 = entityplayer.posZ; + GL11.glEnable(32826 /*GL_RESCALE_NORMAL_EXT*/); + GL11.glTranslatef((float)d + 0.0F, (float)d1 + 2.3F, (float)d2); + GL11.glScalef(5F, 5F, 5F); + GL11.glRotatef(-rendermanager.playerViewY, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(rendermanager.playerViewX, 1.0F, 0.0F, 0.0F); +// RenderEngine renderengine = rendermanager.renderEngine; +// renderengine.bindTexture("/fx/glow.png"); + Tessellator tessellator = Tessellator.instance; + float f = 0.0F; + float f1 = 0.25F; + float f2 = 0.0F; + float f3 = 0.25F; + float f4 = 1.0F; + float f5 = 0.5F; + float f6 = 0.25F; + tessellator.startDrawingQuads(); + tessellator.setNormal(0.0F, 1.0F, 0.0F); + tessellator.addVertexWithUV(-1D, -1D, 0.0D, 0.0D, 1.0D); + tessellator.addVertexWithUV(-1D, 1.0D, 0.0D, 1.0D, 1.0D); + tessellator.addVertexWithUV(1.0D, 1.0D, 0.0D, 1.0D, 0.0D); + tessellator.addVertexWithUV(1.0D, -1D, 0.0D, 0.0D, 0.0D); + tessellator.draw(); + GL11.glDisable(32826 /*GL_RESCALE_NORMAL_EXT*/); + GL11.glPopMatrix(); + return; + } + } +} diff --git a/src/main/java/noppes/npcs/client/model/ModelPonyArmor.java b/src/main/java/noppes/npcs/client/model/ModelPonyArmor.java new file mode 100644 index 000000000..33333e00f --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/ModelPonyArmor.java @@ -0,0 +1,401 @@ +package noppes.npcs.client.model; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; +import noppes.npcs.constants.EnumAnimation; +import noppes.npcs.entity.EntityNPCInterface; + +public class ModelPonyArmor extends ModelBase +{ + + private boolean rainboom; + public ModelRenderer head; + public ModelRenderer Body; + public ModelRenderer BodyBack; + public ModelRenderer rightarm; + public ModelRenderer LeftArm; + public ModelRenderer RightLeg; + public ModelRenderer LeftLeg; + public ModelRenderer rightarm2; + public ModelRenderer LeftArm2; + public ModelRenderer RightLeg2; + public ModelRenderer LeftLeg2; + public boolean isPegasus = false; + public boolean isUnicorn = false; + public boolean isSleeping = false; + public boolean isFlying = false; + public boolean isGlow = false; + public boolean isSneak = false; + public boolean aimedBow; + public int heldItemRight; + + public ModelPonyArmor(float f) + { + init(f,0.0f); + } + + public void init(float strech,float f) + { + float f2 = 0.0F; + float f3 = 0.0F; + float f4 = 0.0F; + head = new ModelRenderer(this, 0, 0); + head.addBox(-4F, -4F, -6F, 8, 8, 8, strech); + head.setRotationPoint(f2, f3, f4); + float f5 = 0.0F; + float f6 = 0.0F; + float f7 = 0.0F; + Body = new ModelRenderer(this, 16, 16); + Body.addBox(-4F, 4F, -2F, 8, 8, 4, strech); + Body.setRotationPoint(f5, f6 + f, f7); + BodyBack = new ModelRenderer(this, 0, 0); + BodyBack.addBox(-4F, 4F, 6F, 8, 8, 8, strech); + BodyBack.setRotationPoint(f5, f6 + f, f7); + rightarm = new ModelRenderer(this, 0, 16); + rightarm.addBox(-2F, 4F, -2F, 4, 12, 4, strech); + rightarm.setRotationPoint(-3F, 8F + f, 0.0F); + LeftArm = new ModelRenderer(this, 0, 16); + LeftArm.mirror = true; + LeftArm.addBox(-2F, 4F, -2F, 4, 12, 4, strech); + LeftArm.setRotationPoint(3F, 8F + f, 0.0F); + RightLeg = new ModelRenderer(this, 0, 16); + RightLeg.addBox(-2F, 4F, -2F, 4, 12, 4, strech); + RightLeg.setRotationPoint(-3F, 0.0F + f, 0.0F); + LeftLeg = new ModelRenderer(this, 0, 16); + LeftLeg.mirror = true; + LeftLeg.addBox(-2F, 4F, -2F, 4, 12, 4, strech); + LeftLeg.setRotationPoint(3F, 0.0F + f, 0.0F); + rightarm2 = new ModelRenderer(this, 0, 16); + rightarm2.addBox(-2F, 4F, -2F, 4, 12, 4, strech * 0.5F); + rightarm2.setRotationPoint(-3F, 8F + f, 0.0F); + LeftArm2 = new ModelRenderer(this, 0, 16); + LeftArm2.mirror = true; + LeftArm2.addBox(-2F, 4F, -2F, 4, 12, 4, strech * 0.5F); + LeftArm2.setRotationPoint(3F, 8F + f, 0.0F); + RightLeg2 = new ModelRenderer(this, 0, 16); + RightLeg2.addBox(-2F, 4F, -2F, 4, 12, 4, strech * 0.5F); + RightLeg2.setRotationPoint(-3F, 0.0F + f, 0.0F); + LeftLeg2 = new ModelRenderer(this, 0, 16); + LeftLeg2.mirror = true; + LeftLeg2.addBox(-2F, 4F, -2F, 4, 12, 4, strech * 0.5F); + LeftLeg2.setRotationPoint(3F, 0.0F + f, 0.0F); + } + + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) + { + EntityNPCInterface npc = (EntityNPCInterface) entity; + if(!isRiding) + isRiding = npc.currentAnimation == EnumAnimation.SITTING; + + if(isSneak && (npc.currentAnimation == EnumAnimation.CRAWLING || npc.currentAnimation == EnumAnimation.LYING)) + isSneak = false; + rainboom = false; + float f6; + float f7; + if(isSleeping) + { + f6 = 1.4F; + f7 = 0.1F; + } else + { + f6 = f3 / 57.29578F; + f7 = f4 / 57.29578F; + } + head.rotateAngleY = f6; + head.rotateAngleX = f7; + float f8; + float f9; + float f10; + float f11; + if(!isFlying || !isPegasus) + { + f8 = MathHelper.cos(f * 0.6662F + 3.141593F) * 0.6F * f1; + f9 = MathHelper.cos(f * 0.6662F) * 0.6F * f1; + f10 = MathHelper.cos(f * 0.6662F) * 0.3F * f1; + f11 = MathHelper.cos(f * 0.6662F + 3.141593F) * 0.3F * f1; + rightarm.rotateAngleY = 0.0F; + LeftArm.rotateAngleY = 0.0F; + RightLeg.rotateAngleY = 0.0F; + LeftLeg.rotateAngleY = 0.0F; + rightarm2.rotateAngleY = 0.0F; + LeftArm2.rotateAngleY = 0.0F; + RightLeg2.rotateAngleY = 0.0F; + LeftLeg2.rotateAngleY = 0.0F; + } else + { + if(f1 < 0.9999F) + { + rainboom = false; + f8 = MathHelper.sin(0.0F - f1 * 0.5F); + f9 = MathHelper.sin(0.0F - f1 * 0.5F); + f10 = MathHelper.sin(f1 * 0.5F); + f11 = MathHelper.sin(f1 * 0.5F); + } else + { + rainboom = true; + f8 = 4.712F; + f9 = 4.712F; + f10 = 1.571F; + f11 = 1.571F; + } + rightarm.rotateAngleY = 0.2F; + LeftArm.rotateAngleY = -0.2F; + RightLeg.rotateAngleY = -0.2F; + LeftLeg.rotateAngleY = 0.2F; + rightarm2.rotateAngleY = 0.2F; + LeftArm2.rotateAngleY = -0.2F; + RightLeg2.rotateAngleY = -0.2F; + LeftLeg2.rotateAngleY = 0.2F; + } + if(isSleeping) + { + f8 = 4.712F; + f9 = 4.712F; + f10 = 1.571F; + f11 = 1.571F; + } + rightarm.rotateAngleX = f8; + LeftArm.rotateAngleX = f9; + RightLeg.rotateAngleX = f10; + LeftLeg.rotateAngleX = f11; + rightarm.rotateAngleZ = 0.0F; + LeftArm.rotateAngleZ = 0.0F; + rightarm2.rotateAngleX = f8; + LeftArm2.rotateAngleX = f9; + RightLeg2.rotateAngleX = f10; + LeftLeg2.rotateAngleX = f11; + rightarm2.rotateAngleZ = 0.0F; + LeftArm2.rotateAngleZ = 0.0F; + if(heldItemRight != 0 && !rainboom && !isUnicorn) + { + rightarm.rotateAngleX = rightarm.rotateAngleX * 0.5F - 0.3141593F; + rightarm2.rotateAngleX = rightarm2.rotateAngleX * 0.5F - 0.3141593F; + } + float f12 = 0.0F; + if(f5 > -9990F && !isUnicorn) + { + f12 = MathHelper.sin(MathHelper.sqrt_float(f5) * 3.141593F * 2.0F) * 0.2F; + } + Body.rotateAngleY = (float)((double)f12 * 0.20000000000000001D); + BodyBack.rotateAngleY = (float)((double)f12 * 0.20000000000000001D); + float f13 = MathHelper.sin(Body.rotateAngleY) * 5F; + float f14 = MathHelper.cos(Body.rotateAngleY) * 5F; + float f15 = 4F; + if(isSneak && !isFlying) + { + f15 = 0.0F; + } + if(isSleeping) + { + f15 = 2.6F; + } + if(rainboom) + { + rightarm.rotationPointZ = f13 + 2.0F; + rightarm2.rotationPointZ = f13 + 2.0F; + LeftArm.rotationPointZ = (0.0F - f13) + 2.0F; + LeftArm2.rotationPointZ = (0.0F - f13) + 2.0F; + } else + { + rightarm.rotationPointZ = f13 + 1.0F; + rightarm2.rotationPointZ = f13 + 1.0F; + LeftArm.rotationPointZ = (0.0F - f13) + 1.0F; + LeftArm2.rotationPointZ = (0.0F - f13) + 1.0F; + } + rightarm.rotationPointX = (0.0F - f14 - 1.0F) + f15; + rightarm2.rotationPointX = (0.0F - f14 - 1.0F) + f15; + LeftArm.rotationPointX = (f14 + 1.0F) - f15; + LeftArm2.rotationPointX = (f14 + 1.0F) - f15; + RightLeg.rotationPointX = (0.0F - f14 - 1.0F) + f15; + RightLeg2.rotationPointX = (0.0F - f14 - 1.0F) + f15; + LeftLeg.rotationPointX = (f14 + 1.0F) - f15; + LeftLeg2.rotationPointX = (f14 + 1.0F) - f15; + rightarm.rotateAngleY += Body.rotateAngleY; + rightarm2.rotateAngleY += Body.rotateAngleY; + LeftArm.rotateAngleY += Body.rotateAngleY; + LeftArm2.rotateAngleY += Body.rotateAngleY; + LeftArm.rotateAngleX += Body.rotateAngleY; + LeftArm2.rotateAngleX += Body.rotateAngleY; + rightarm.rotationPointY = 8F; + LeftArm.rotationPointY = 8F; + RightLeg.rotationPointY = 4F; + LeftLeg.rotationPointY = 4F; + rightarm2.rotationPointY = 8F; + LeftArm2.rotationPointY = 8F; + RightLeg2.rotationPointY = 4F; + LeftLeg2.rotationPointY = 4F; + if(f5 > -9990F && !isUnicorn) + { + float f16 = f5; + f16 = 1.0F - f5; + f16 *= f16 * f16; + f16 = 1.0F - f16; + float f21 = MathHelper.sin(f16 * 3.141593F); + float f26 = MathHelper.sin(f5 * 3.141593F); + float f30 = f26 * -(head.rotateAngleX - 0.7F) * 0.75F; +// rightarm.rotateAngleX -= (double)f21 * 1.2D + (double)f30; +// rightarm.rotateAngleY += Body.rotateAngleY * 2.0F; +// rightarm.rotateAngleZ = f26 * -0.4F; +// rightarm2.rotateAngleX -= (double)f21 * 1.2D + (double)f30; +// rightarm2.rotateAngleY += Body.rotateAngleY * 2.0F; +// rightarm2.rotateAngleZ = f26 * -0.4F; + } + if(isSneak && !isFlying) + { + float f17 = 0.4F; + float f22 = 7F; + float f27 = -4F; + Body.rotateAngleX = f17; + Body.rotationPointY = f22; + Body.rotationPointZ = f27; + BodyBack.rotateAngleX = f17; + BodyBack.rotationPointY = f22; + BodyBack.rotationPointZ = f27; + RightLeg.rotateAngleX -= 0.0F; + LeftLeg.rotateAngleX -= 0.0F; + rightarm.rotateAngleX -= 0.4F; + LeftArm.rotateAngleX -= 0.4F; + RightLeg.rotationPointZ = 10F; + LeftLeg.rotationPointZ = 10F; + RightLeg.rotationPointY = 7F; + LeftLeg.rotationPointY = 7F; + RightLeg2.rotateAngleX -= 0.0F; + LeftLeg2.rotateAngleX -= 0.0F; + rightarm2.rotateAngleX -= 0.4F; + LeftArm2.rotateAngleX -= 0.4F; + RightLeg2.rotationPointZ = 10F; + LeftLeg2.rotationPointZ = 10F; + RightLeg2.rotationPointY = 7F; + LeftLeg2.rotationPointY = 7F; + float f31; + float f33; + float f35; + if(isSleeping) + { + f31 = 2.0F; + f33 = -1F; + f35 = 1.0F; + } else + { + f31 = 6F; + f33 = -2F; + f35 = 0.0F; + } + head.rotationPointY = f31; + head.rotationPointZ = f33; + head.rotationPointX = f35; + } else + { + float f18 = 0.0F; + float f23 = 0.0F; + float f28 = 0.0F; + Body.rotateAngleX = f18; + Body.rotationPointY = f23; + Body.rotationPointZ = f28; + BodyBack.rotateAngleX = f18; + BodyBack.rotationPointY = f23; + BodyBack.rotationPointZ = f28; + RightLeg.rotationPointZ = 10F; + LeftLeg.rotationPointZ = 10F; + RightLeg.rotationPointY = 8F; + LeftLeg.rotationPointY = 8F; + RightLeg2.rotationPointZ = 10F; + LeftLeg2.rotationPointZ = 10F; + RightLeg2.rotationPointY = 8F; + LeftLeg2.rotationPointY = 8F; + float f32 = MathHelper.cos(f2 * 0.09F) * 0.05F + 0.05F; + float f34 = MathHelper.sin(f2 * 0.067F) * 0.05F; + float f36 = 0.0F; + float f37 = 0.0F; + head.rotationPointY = f36; + head.rotationPointZ = f37; + } +// if(isRiding) +// { +// float f19 = -10F; +// float f24 = -10F; +// head.rotationPointY = head.rotationPointY + f19; +// head.rotationPointZ = head.rotationPointZ + f24; +// Body.rotationPointY = Body.rotationPointY + f19; +// Body.rotationPointZ = Body.rotationPointZ + f24; +// BodyBack.rotationPointY = BodyBack.rotationPointY + f19; +// BodyBack.rotationPointZ = BodyBack.rotationPointZ + f24; +// LeftArm.rotationPointY = LeftArm.rotationPointY + f19; +// LeftArm.rotationPointZ = LeftArm.rotationPointZ + f24; +// rightarm.rotationPointY = rightarm.rotationPointY + f19; +// rightarm.rotationPointZ = rightarm.rotationPointZ + f24; +// LeftLeg.rotationPointY = LeftLeg.rotationPointY + f19; +// LeftLeg.rotationPointZ = LeftLeg.rotationPointZ + f24; +// RightLeg.rotationPointY = RightLeg.rotationPointY + f19; +// RightLeg.rotationPointZ = RightLeg.rotationPointZ + f24; +// LeftArm2.rotationPointY = LeftArm2.rotationPointY + f19; +// LeftArm2.rotationPointZ = LeftArm2.rotationPointZ + f24; +// rightarm2.rotationPointY = rightarm2.rotationPointY + f19; +// rightarm2.rotationPointZ = rightarm2.rotationPointZ + f24; +// LeftLeg2.rotationPointY = LeftLeg2.rotationPointY + f19; +// LeftLeg2.rotationPointZ = LeftLeg2.rotationPointZ + f24; +// RightLeg2.rotationPointY = RightLeg2.rotationPointY + f19; +// RightLeg2.rotationPointZ = RightLeg2.rotationPointZ + f24; +// } + if(isSleeping) + { + rightarm.rotationPointZ = rightarm.rotationPointZ + 6F; + LeftArm.rotationPointZ = LeftArm.rotationPointZ + 6F; + RightLeg.rotationPointZ = RightLeg.rotationPointZ - 8F; + LeftLeg.rotationPointZ = LeftLeg.rotationPointZ - 8F; + rightarm.rotationPointY = rightarm.rotationPointY + 2.0F; + LeftArm.rotationPointY = LeftArm.rotationPointY + 2.0F; + RightLeg.rotationPointY = RightLeg.rotationPointY + 2.0F; + LeftLeg.rotationPointY = LeftLeg.rotationPointY + 2.0F; + rightarm2.rotationPointZ = rightarm2.rotationPointZ + 6F; + LeftArm2.rotationPointZ = LeftArm2.rotationPointZ + 6F; + RightLeg2.rotationPointZ = RightLeg2.rotationPointZ - 8F; + LeftLeg2.rotationPointZ = LeftLeg2.rotationPointZ - 8F; + rightarm2.rotationPointY = rightarm2.rotationPointY + 2.0F; + LeftArm2.rotationPointY = LeftArm2.rotationPointY + 2.0F; + RightLeg2.rotationPointY = RightLeg2.rotationPointY + 2.0F; + LeftLeg2.rotationPointY = LeftLeg2.rotationPointY + 2.0F; + } + if(aimedBow && !isUnicorn) + { + float f20 = 0.0F; + float f25 = 0.0F; + rightarm.rotateAngleZ = 0.0F; + rightarm.rotateAngleY = -(0.1F - f20 * 0.6F) + head.rotateAngleY; + rightarm.rotateAngleX = 4.712F + head.rotateAngleX; + rightarm.rotateAngleX -= f20 * 1.2F - f25 * 0.4F; + float f29 = f2; + rightarm.rotateAngleZ += MathHelper.cos(f29 * 0.09F) * 0.05F + 0.05F; + rightarm.rotateAngleX += MathHelper.sin(f29 * 0.067F) * 0.05F; + rightarm2.rotateAngleZ = 0.0F; + rightarm2.rotateAngleY = -(0.1F - f20 * 0.6F) + head.rotateAngleY; + rightarm2.rotateAngleX = 4.712F + head.rotateAngleX; + rightarm2.rotateAngleX -= f20 * 1.2F - f25 * 0.4F; + rightarm2.rotateAngleZ += MathHelper.cos(f29 * 0.09F) * 0.05F + 0.05F; + rightarm2.rotateAngleX += MathHelper.sin(f29 * 0.067F) * 0.05F; + rightarm.rotationPointZ = rightarm.rotationPointZ + 1.0F; + rightarm2.rotationPointZ = rightarm2.rotationPointZ + 1.0F; + } + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) + { + float scale = f5; + setRotationAngles(f, f1, f2, f3, f4, f5, entity); + head.render(scale); + Body.render(scale); + BodyBack.render(scale); + LeftArm.render(scale); + rightarm.render(scale); + LeftLeg.render(scale); + RightLeg.render(scale); + LeftArm2.render(scale); + rightarm2.render(scale); + LeftLeg2.render(scale); + RightLeg2.render(scale); + + } + +} diff --git a/src/main/java/noppes/npcs/client/model/ModelSkirtArmor.java b/src/main/java/noppes/npcs/client/model/ModelSkirtArmor.java new file mode 100644 index 000000000..765898942 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/ModelSkirtArmor.java @@ -0,0 +1,61 @@ +package noppes.npcs.client.model; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelBiped; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import noppes.npcs.ModelData; +import noppes.npcs.ModelPartData; +import noppes.npcs.client.model.util.ModelPlaneRenderer; + +import org.lwjgl.opengl.GL11; + +public class ModelSkirtArmor extends ModelBiped { + private ModelPlaneRenderer Shape1; + public ModelSkirtArmor() { + float pi = (float) (Math.PI / 5); + + Shape1 = new ModelPlaneRenderer(this, 4, 20); + Shape1.addSidePlane(0, 0, 0, 9, 2); + + ModelPlaneRenderer part1 = new ModelPlaneRenderer(this, 6, 20); + part1.addSidePlane(2, 0, 0, 9, 2); + part1.rotateAngleY = -(float) (Math.PI/2); + Shape1.addChild(part1); + + Shape1.setRotationPoint(2.4F, 8.8F, 0F); + setRotation(Shape1, 0.3F, -0.2f, -0.2F); + } + + public void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) + { + this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity); + + GL11.glPushMatrix(); + GL11.glTranslatef(0, 0, this.bipedRightLeg.rotationPointZ * par7); + GL11.glScalef(1.6f, 1.04f, 1.6f); + for(int i = 0; i < 10; i++){ + GL11.glRotatef(36, 0, 1, 0); + Shape1.render(par7); + } + GL11.glPopMatrix(); + } + public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity) + { + setRotation(Shape1, 0.3F, -0.2f, -0.2F); + isSneak = par7Entity.isSneaking(); + super.setRotationAngles(par1, par2, par3, par4, par5, par6, par7Entity); + Shape1.rotateAngleX += this.bipedLeftArm.rotateAngleX * 0.02f; + Shape1.rotateAngleZ += this.bipedLeftArm.rotateAngleX * 0.06f; + //this.Shape1.rotateAngleX -= MathHelper.sin(par3 * 0.067F) * 0.05F; + this.Shape1.rotateAngleZ -= MathHelper.cos(par3 * 0.09F) * 0.02F - 0.05F; + } +} diff --git a/src/main/java/noppes/npcs/client/model/animation/AniCrawling.java b/src/main/java/noppes/npcs/client/model/animation/AniCrawling.java new file mode 100644 index 000000000..05c1ae3a0 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/animation/AniCrawling.java @@ -0,0 +1,49 @@ +package noppes.npcs.client.model.animation; + +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; +import noppes.npcs.client.model.ModelMPM; + +public class AniCrawling { + + public static void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity entity, ModelMPM model){ + + model.bipedHead.rotateAngleZ = -par4 / (180F / (float)Math.PI); + model.bipedHead.rotateAngleY = 0; + model.bipedHead.rotateAngleX = -55 / (180F / (float)Math.PI); + + model.bipedHeadwear.rotateAngleX = model.bipedHead.rotateAngleX; + model.bipedHeadwear.rotateAngleY = model.bipedHead.rotateAngleY; + model.bipedHeadwear.rotateAngleZ = model.bipedHead.rotateAngleZ; + + if(par2 > 0.25) + par2 = 0.25f; + float movement = MathHelper.cos(par1 * 0.8f + (float)Math.PI) * par2; + + model.bipedLeftArm.rotateAngleX = 180 / (180F / (float)Math.PI) - movement * 0.25f; + model.bipedLeftArm.rotateAngleY = movement * -0.46f; + model.bipedLeftArm.rotateAngleZ = movement * -0.2f; + model.bipedLeftArm.rotationPointY = 2 - movement * 9.0F; + + model.bipedRightArm.rotateAngleX = 180 / (180F / (float)Math.PI) + movement * 0.25f; + model.bipedRightArm.rotateAngleY = movement * -0.4f; + model.bipedRightArm.rotateAngleZ = movement * -0.2f; + model.bipedRightArm.rotationPointY = 2 + movement * 9.0F; + + model.bipedBody.rotateAngleY = movement * 0.1f; + model.bipedBody.rotateAngleX = 0; + model.bipedBody.rotateAngleZ = movement * 0.1f; + + model.bipedLeftLeg.rotateAngleX = movement * 0.1f; + model.bipedLeftLeg.rotateAngleY = movement * 0.1f; + model.bipedLeftLeg.rotateAngleZ = -7 / (180F / (float)Math.PI) - movement * 0.25f; + model.bipedLeftLeg.rotationPointY = 10.4f + movement * 9.0F; + model.bipedLeftLeg.rotationPointZ = movement * 0.6f - 0.01f; + + model.bipedRightLeg.rotateAngleX = movement * -0.1f; + model.bipedRightLeg.rotateAngleY = movement * 0.1f; + model.bipedRightLeg.rotateAngleZ = 7 / (180F / (float)Math.PI) - movement * 0.25f; + model.bipedRightLeg.rotationPointY = 10.4f - movement * 9.0F; + model.bipedRightLeg.rotationPointZ = movement * -0.6f - 0.01f; + } +} diff --git a/src/main/java/noppes/npcs/client/model/animation/AniHug.java b/src/main/java/noppes/npcs/client/model/animation/AniHug.java new file mode 100644 index 000000000..0485f1f59 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/animation/AniHug.java @@ -0,0 +1,26 @@ +package noppes.npcs.client.model.animation; + +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; +import noppes.npcs.client.model.ModelMPM; + +public class AniHug { + + public static void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity entity, ModelMPM base){ + + float f6 = MathHelper.sin(base.onGround * 3.141593F); + float f7 = MathHelper.sin((1.0F - (1.0F - base.onGround) * (1.0F - base.onGround)) * 3.141593F); + base.bipedRightArm.rotateAngleZ = 0.0F; + base.bipedLeftArm.rotateAngleZ = 0.0F; + base.bipedRightArm.rotateAngleY = -(0.1F - f6 * 0.6F); + base.bipedLeftArm.rotateAngleY = 0.1F; + base.bipedRightArm.rotateAngleX = -1.570796F; + base.bipedLeftArm.rotateAngleX = -1.570796F; + base.bipedRightArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F; + //bipedLeftArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F; + base.bipedRightArm.rotateAngleZ += MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; + base.bipedLeftArm.rotateAngleZ -= MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; + base.bipedRightArm.rotateAngleX += MathHelper.sin(par3 * 0.067F) * 0.05F; + base.bipedLeftArm.rotateAngleX -= MathHelper.sin(par3 * 0.067F) * 0.05F; + } +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelAnvil.java b/src/main/java/noppes/npcs/client/model/blocks/ModelAnvil.java new file mode 100644 index 000000000..27307ebf7 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelAnvil.java @@ -0,0 +1,90 @@ +// Date: 11-10-2012 19:29:20 +// Template version 1.1 +// Java generated by Techne +// Keep in mind that you still need to fill in some blanks +// - ZeuX + +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelAnvil extends ModelBase { + ModelRenderer Tail; + ModelRenderer Nose1; + ModelRenderer Nose2; + ModelRenderer Nose3; + ModelRenderer Nose4; + ModelRenderer Head1; + ModelRenderer Head2; + ModelRenderer Neck2; + ModelRenderer Bottom2; + ModelRenderer Bottom3; + ModelRenderer Foot4; + + public ModelAnvil() { + textureWidth = 64; + textureHeight = 32; + + Tail = new ModelRenderer(this, 0, 0); + Tail.addBox(0F, 0F, 0F, 1, 2, 4); + Tail.setRotationPoint(-7F, 12F, -2F); + + Nose1 = new ModelRenderer(this, 0, 0); + Nose1.addBox(0F, 0F, 0F, 1, 5, 6); + Nose1.setRotationPoint(6F, 10F, -3F); + + Nose2 = new ModelRenderer(this, 0, 0); + Nose2.addBox(0F, 0F, 0F, 1, 4, 5); + Nose2.setRotationPoint(7F, 10F, -2.5F); + + Nose3 = new ModelRenderer(this, 0, 0); + Nose3.addBox(0F, 0F, 0F, 1, 3, 4); + Nose3.setRotationPoint(8F, 10F, -2F); + + Nose4 = new ModelRenderer(this, 0, 0); + Nose4.addBox(0F, 0F, 0F, 1, 2, 2); + Nose4.setRotationPoint(9F, 10F, -1F); + + Head1 = new ModelRenderer(this, 0, 0); + Head1.addBox(0F, 0F, 0F, 12, 4, 7); + Head1.setRotationPoint(-6F, 12F, -3.5F); + + Head2 = new ModelRenderer(this, 0, 0); + Head2.addBox(0F, 0F, 0F, 14, 2, 9); + Head2.setRotationPoint(-8F, 10F, -4.5F); + + Neck2 = new ModelRenderer(this, 0, 0); + Neck2.addBox(0F, 0F, 0F, 10, 1, 6); + Neck2.setRotationPoint(-5F, 16F, -3F); + + Bottom2 = new ModelRenderer(this, 0, 0); + Bottom2.addBox(0F, 0F, 0F, 10, 2, 7); + Bottom2.setRotationPoint(-5F, 20F, -3.5F); + + Bottom3 = new ModelRenderer(this, 0, 0); + Bottom3.addBox(0F, 0F, 0F, 8, 3, 4); + Bottom3.setRotationPoint(-4F, 17F, -2F); + + Foot4 = new ModelRenderer(this, 0, 0); + Foot4.addBox(0F, 0F, 0F, 14, 2, 10); + Foot4.setRotationPoint(-7F, 22F, -5F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5,entity); + Tail.render(f5); + Nose1.render(f5); + Nose2.render(f5); + Nose3.render(f5); + Nose4.render(f5); + Head1.render(f5); + Head2.render(f5); + Neck2.render(f5); + Bottom2.render(f5); + Bottom3.render(f5); + Foot4.render(f5); + } +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelBanner.java b/src/main/java/noppes/npcs/client/model/blocks/ModelBanner.java new file mode 100644 index 000000000..4f9bde1f8 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelBanner.java @@ -0,0 +1,87 @@ + +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelBanner extends ModelBase +{ + //fields + ModelRenderer Base; + ModelRenderer MiddleStick; + ModelRenderer StickDecoration; + ModelRenderer TopDecoration; + ModelRenderer FlagPole1; + ModelRenderer FlagPole2; + ModelRenderer BaseDeco1; + ModelRenderer BaseDeco2; + ModelRenderer BaseDeco3; + ModelRenderer BaseDeco4; + + public ModelBanner() + { + Base = new ModelRenderer(this, 3, 1); + Base.addBox(-7F, 0F, -7F, 14, 1, 14); + Base.setRotationPoint(0F, 23F, 0F); + + MiddleStick = new ModelRenderer(this, 12, 2); + MiddleStick.addBox(-1F, 0F, -1F, 2, 32, 2); + MiddleStick.setRotationPoint(0F, -9F, 0F); + + StickDecoration = new ModelRenderer(this, 11, 12); + StickDecoration.addBox(0F, 0F, 0F, 16, 3, 3); + StickDecoration.setRotationPoint(-8F, -7.5F, -1.5F); + + TopDecoration = new ModelRenderer(this, 45, 19); + TopDecoration.addBox(0F, 0F, 0F, 1, 1, 1); + TopDecoration.setRotationPoint(-0.5F, -10F, -0.5F); + + FlagPole1 = new ModelRenderer(this, 45, 19); + FlagPole1.addBox(0F, 0F, 0F, 1, 1, 1); + FlagPole1.setRotationPoint(-7F, -6.5F, -2.5F); + + FlagPole2 = new ModelRenderer(this, 45, 19); + FlagPole2.addBox(0F, 0F, 0F, 1, 1, 1); + FlagPole2.setRotationPoint(6F, -6.5F, -2.5F); + + BaseDeco1 = new ModelRenderer(this, 1, 14); + BaseDeco1.addBox(0F, 0F, 0F, 12, 1, 1); + BaseDeco1.setRotationPoint(-6F, 23F, -8F); + + BaseDeco2 = new ModelRenderer(this, 1, 14); + BaseDeco2.addBox(0F, 0F, 0F, 12, 1, 1); + BaseDeco2.setRotationPoint(-6F, 23F, 7F); + + BaseDeco3 = new ModelRenderer(this, 2, 2); + BaseDeco3.addBox(0F, 0F, 0F, 1, 1, 12); + BaseDeco3.setRotationPoint(-8F, 23F, -6F); + + BaseDeco4 = new ModelRenderer(this, 2, 2); + BaseDeco4.addBox(0F, 0F, 0F, 1, 1, 12); + BaseDeco4.setRotationPoint(7F, 23F, -6F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) + { + super.render(entity, f, f1, f2, f3, f4, f5); + Base.render(f5); + MiddleStick.render(f5); + StickDecoration.render(f5); + TopDecoration.render(f5); + FlagPole1.render(f5); + FlagPole2.render(f5); + BaseDeco1.render(f5); + BaseDeco2.render(f5); + BaseDeco3.render(f5); + BaseDeco4.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) + { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelBannerFlag.java b/src/main/java/noppes/npcs/client/model/blocks/ModelBannerFlag.java new file mode 100644 index 000000000..bc3ea2656 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelBannerFlag.java @@ -0,0 +1,36 @@ + +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelBannerFlag extends ModelBase +{ + ModelRenderer Flag; + + public ModelBannerFlag() + { + textureWidth = 32; + textureHeight = 32; + + Flag = new ModelRenderer(this, 0, 0); + Flag.addBox(0F, 0F, 0F, 15, 27, 0); + Flag.setRotationPoint(-7.5F, -7F, -2F); + Flag.setTextureSize(32, 32); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) + { + super.render(entity, f, f1, f2, f3, f4, f5); + Flag.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) + { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelBarrel.java b/src/main/java/noppes/npcs/client/model/blocks/ModelBarrel.java new file mode 100644 index 000000000..acf209070 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelBarrel.java @@ -0,0 +1,110 @@ +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelBarrel extends ModelBase +{ + ModelRenderer Plank1; + ModelRenderer Plank2; + ModelRenderer Plank3; + ModelRenderer Plank4; + ModelRenderer Plank5; + ModelRenderer Plank6; + ModelRenderer Plank7; + ModelRenderer Plank8; + ModelRenderer Plank9; + ModelRenderer Plank10; + ModelRenderer Plank11; + ModelRenderer Plank12; + + public ModelBarrel() + { + Plank1 = new ModelRenderer(this, 10, 0); + Plank1.addBox(0F, 6.5F, -2F, 17, 1, 4); + Plank1.setRotationPoint(0F, 7.01F, 0F); + setRotation(Plank1, 0F, 0F, 1.570796F); + + Plank2 = new ModelRenderer(this, 10, 8); + Plank2.addBox(0F, 6.5F, -2F, 17, 1, 4); + Plank2.setRotationPoint(0F, 7F, 0F); + setRotation(Plank2, 0F, 0.5235988F, 1.570796F); + + Plank3 = new ModelRenderer(this, 10, 0); + Plank3.addBox(0F, 6.5F, -2F, 17, 1, 4); + Plank3.setRotationPoint(0F, 7.01F, 0F); + setRotation(Plank3, 0F, 1.047198F, 1.570796F); + + Plank4 = new ModelRenderer(this, 10, 8); + Plank4.addBox(0F, 6.5F, -2F, 17, 1, 4); + Plank4.setRotationPoint(0F, 7F, 0F); + setRotation(Plank4, 0F, 1.570796F, 1.570796F); + + Plank5 = new ModelRenderer(this, 10, 0); + Plank5.addBox(0F, 6.5F, -2F, 17, 1, 4); + Plank5.setRotationPoint(0F, 7.01F, 0F); + setRotation(Plank5, 0F, 2.094395F, 1.570796F); + + Plank6 = new ModelRenderer(this, 10, 8); + Plank6.addBox(0F, 6.5F, -2F, 17, 1, 4); + Plank6.setRotationPoint(0F, 7F, 0F); + setRotation(Plank6, 0F, 2.617994F, 1.570796F); + + Plank7 = new ModelRenderer(this, 10, 0); + Plank7.addBox(0F, 6.5F, -2F, 17, 1, 4); + Plank7.setRotationPoint(0F, 7.01F, 0F); + setRotation(Plank7, 0F, 3.150901F, 1.570796F); + + Plank8 = new ModelRenderer(this, 10, 8); + Plank8.addBox(0F, 6.5F, -2F, 17, 1, 4); + Plank8.setRotationPoint(0F, 7F, 0F); + setRotation(Plank8, 0F, -2.617994F, 1.570796F); + + Plank9 = new ModelRenderer(this, 10, 0); + Plank9.addBox(0F, 6.5F, -2F, 17, 1, 4); + Plank9.setRotationPoint(0F, 7.01F, 0F); + setRotation(Plank9, 0F, -2.094395F, 1.570796F); + + Plank10 = new ModelRenderer(this, 10, 8); + Plank10.addBox(0F, 6.5F, -2F, 17, 1, 4); + Plank10.setRotationPoint(0F, 7F, 0F); + setRotation(Plank10, 0F, -1.570796F, 1.570796F); + + Plank11 = new ModelRenderer(this, 10, 0); + Plank11.addBox(0F, 6.5F, -2F, 17, 1, 4); + Plank11.setRotationPoint(0F, 7.01F, 0F); + setRotation(Plank11, 0F, -1.047198F, 1.570796F); + + Plank12 = new ModelRenderer(this, 10, 0); + Plank12.addBox(0F, 6.5F, -2F, 17, 1, 4); + Plank12.setRotationPoint(0F, 7F, 0F); + setRotation(Plank12, 0F, -0.5235988F, 1.570796F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) + { + super.render(entity, f, f1, f2, f3, f4, f5); + Plank1.render(f5); + Plank2.render(f5); + Plank3.render(f5); + Plank4.render(f5); + Plank5.render(f5); + Plank6.render(f5); + Plank7.render(f5); + Plank8.render(f5); + Plank9.render(f5); + Plank10.render(f5); + Plank11.render(f5); + Plank12.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) + { + model.rotateAngleX = y; + model.rotateAngleY = x; + model.rotateAngleZ = z; + } + + +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelBarrelLit.java b/src/main/java/noppes/npcs/client/model/blocks/ModelBarrelLit.java new file mode 100644 index 000000000..00db785bc --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelBarrelLit.java @@ -0,0 +1,38 @@ +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelBarrelLit extends ModelBase +{ + ModelRenderer Top; + ModelRenderer Bottom; + + public ModelBarrelLit() + { + Top = new ModelRenderer(this, 0, 0); + Top.addBox(0F, 0F, 0F, 16, 0, 16); + Top.setRotationPoint(-8F, 9F, -8F); + + Bottom = new ModelRenderer(this, 0, 0); + Bottom.addBox(0F, 0F, 0F, 16, 0, 16); + Bottom.setRotationPoint(-8F, 23F, -8F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) + { + super.render(entity, f, f1, f2, f3, f4, f5); + Bottom.render(f5); + Top.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) + { + model.rotateAngleX = y; + model.rotateAngleY = x; + model.rotateAngleZ = z; + } + + +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelBeam.java b/src/main/java/noppes/npcs/client/model/blocks/ModelBeam.java new file mode 100644 index 000000000..f9056e490 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelBeam.java @@ -0,0 +1,31 @@ +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelBeam extends ModelBase { + ModelRenderer Bar; + + public ModelBeam() { + Bar = new ModelRenderer(this, 6, 6); + Bar.addBox(0F, 0F, 0F, 5, 5, 12); + Bar.setRotationPoint(-2.5F, 13.5F, -4F); + Bar.setTextureSize(64, 32); + Bar.mirror = true; + setRotation(Bar, 0F, 0F, 0F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, + float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + Bar.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelBigSign.java b/src/main/java/noppes/npcs/client/model/blocks/ModelBigSign.java new file mode 100644 index 000000000..d265c2370 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelBigSign.java @@ -0,0 +1,21 @@ +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; + +public class ModelBigSign extends ModelBase{ + public ModelRenderer signBoard = new ModelRenderer(this, 0, 0); + + public ModelBigSign() + { + this.signBoard.addBox(-8.0F, -8F, -1.0F, 16, 16, 2, 0.0F); + } + + /** + * Renders the sign model through TileEntitySignRenderer + */ + public void renderSign() + { + this.signBoard.render(0.0625F); + } +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelCampfire.java b/src/main/java/noppes/npcs/client/model/blocks/ModelCampfire.java new file mode 100644 index 000000000..913366d37 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelCampfire.java @@ -0,0 +1,108 @@ +// Date: 4-4-2014 12:51:17 +// Template version 1.1 +// Java generated by Techne +// Keep in mind that you still need to fill in some blanks +// - ZeuX + +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelCampfire extends ModelBase { + ModelRenderer Rock1; + ModelRenderer Rock2; + ModelRenderer Rock3; + ModelRenderer Rock4; + ModelRenderer Rock5; + ModelRenderer Rock6; + ModelRenderer Rock7; + ModelRenderer Rock8; + ModelRenderer Log3; + ModelRenderer Log1; + ModelRenderer Log4; + ModelRenderer Log2; + + public ModelCampfire() { + Rock1 = new ModelRenderer(this, 0, 0); + Rock1.addBox(0F, 0F, 0F, 3, 2, 3); + Rock1.setRotationPoint(5F, 22F, 3F); + setRotation(Rock1, 0F, -0.7435722F, 0F); + + Rock2 = new ModelRenderer(this, 0, 0); + Rock2.addBox(0F, 0F, 0F, 3, 3, 6); + Rock2.setRotationPoint(5F, 21F, -3F); + + Rock3 = new ModelRenderer(this, 0, 0); + Rock3.addBox(0F, 0F, 0F, 5, 3, 3); + Rock3.setRotationPoint(2.5F, 21F, -8F); + setRotation(Rock3, 0F, -0.5576792F, 0F); + + Rock4 = new ModelRenderer(this, 0, 0); + Rock4.addBox(0F, 0F, 0F, 3, 2, 2); + Rock4.setRotationPoint(-2F, 22F, -7.5F); + + Rock5 = new ModelRenderer(this, 0, 0); + Rock5.addBox(0F, 0F, -2F, 7, 2, 2); + Rock5.setRotationPoint(-3.5F, 22F, 7.8F); + + Rock6 = new ModelRenderer(this, 0, 0); + Rock6.addBox(0F, 0F, 0F, 3, 3, 3); + Rock6.setRotationPoint(-5F, 21F, 3F); + setRotation(Rock6, 0F, -1.003822F, 0F); + + Rock7 = new ModelRenderer(this, 0, 0); + Rock7.addBox(0F, 0F, 0F, 4, 3, 3); + Rock7.setRotationPoint(-7F, 21F, -4.5F); + setRotation(Rock7, 0F, 0.8551081F, 0F); + + Rock8 = new ModelRenderer(this, 0, 0); + Rock8.addBox(0F, 0F, 0F, 3, 2, 6); + Rock8.setRotationPoint(-8F, 22F, -3F); + + Log3 = new ModelRenderer(this, 0, 16); + Log3.addBox(0F, 0F, 0F, 2, 9, 2); + Log3.setRotationPoint(0F, 16F, -1F); + setRotation(Log3, 0.3717861F, -1.487144F, -0.1487144F); + + Log1 = new ModelRenderer(this, 8, 21); + Log1.addBox(0F, 0F, 0F, 2, 9, 2); + Log1.setRotationPoint(0F, 16F, -1F); + setRotation(Log1, -0.1487144F, 0F, -0.3717861F); + + Log4 = new ModelRenderer(this, 0, 16); + Log4.addBox(0F, 0F, -2F, 2, 9, 2); + Log4.setRotationPoint(1F, 16F, 1F); + setRotation(Log4, -0.3346075F, 3.141593F, 0F); + + Log2 = new ModelRenderer(this, 0, 20); + Log2.addBox(0F, 0F, 0F, 2, 9, 2); + Log2.setRotationPoint(1F, 16F, -1F); + setRotation(Log2, 0.2974289F, 3.141593F, 0F); + } + public void renderRock(float f5){ + Rock1.render(f5); + Rock2.render(f5); + Rock3.render(f5); + Rock4.render(f5); + Rock5.render(f5); + Rock6.render(f5); + Rock7.render(f5); + Rock8.render(f5); + } + + public void renderLog(float f5){ + Log3.render(f5); + Log1.render(f5); + Log4.render(f5); + Log2.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelCandle.java b/src/main/java/noppes/npcs/client/model/blocks/ModelCandle.java new file mode 100644 index 000000000..df74be964 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelCandle.java @@ -0,0 +1,59 @@ +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelCandle extends ModelBase { + // fields + ModelRenderer Base; + ModelRenderer Bar1; + ModelRenderer Bar2; + ModelRenderer Bar3; + ModelRenderer Bar4; + ModelRenderer Wax; + + public ModelCandle() { + Base = new ModelRenderer(this, 0, 0); + Base.addBox(0F, 0F, 0F, 4, 1, 4); + Base.setRotationPoint(-2F, 23F, -2F); + + Bar1 = new ModelRenderer(this, 0, 0); + Bar1.addBox(0F, 0F, 0F, 1, 1, 6); + Bar1.setRotationPoint(-3F, 22F, -3F); + + Bar2 = new ModelRenderer(this, 0, 0); + Bar2.addBox(0F, 0F, 0F, 1, 1, 6); + Bar2.setRotationPoint(2F, 22F, -3F); + + Bar3 = new ModelRenderer(this, 0, 0); + Bar3.addBox(0F, 0F, 0F, 4, 1, 1); + Bar3.setRotationPoint(-2F, 22F, -3F); + + Bar4 = new ModelRenderer(this, 0, 0); + Bar4.addBox(0F, 0F, 0F, 4, 1, 1); + Bar4.setRotationPoint(-2F, 22F, 2F); + + Wax = new ModelRenderer(this, 16, 0); + Wax.addBox(0F, 0F, 0F, 2, 4, 2); + Wax.setRotationPoint(-1F, 19F, -1F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, + float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + Base.render(f5); + Bar1.render(f5); + Bar2.render(f5); + Bar3.render(f5); + Bar4.render(f5); + Wax.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelCandleCeiling.java b/src/main/java/noppes/npcs/client/model/blocks/ModelCandleCeiling.java new file mode 100644 index 000000000..5913c6bad --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelCandleCeiling.java @@ -0,0 +1,143 @@ +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelCandleCeiling extends ModelBase { + ModelRenderer Wax1; + ModelRenderer Wax2; + ModelRenderer Wax3; + ModelRenderer Wax4; + ModelRenderer TippyTop1; + ModelRenderer TippyTop2; + ModelRenderer Middle; + ModelRenderer BottomBar1; + ModelRenderer Rod1; + ModelRenderer Rod2; + ModelRenderer Rod3; + ModelRenderer Rod4; + ModelRenderer Base1; + ModelRenderer Base2; + ModelRenderer Base3; + ModelRenderer Base4; + ModelRenderer BottomBar3; + ModelRenderer BottomBar2; + ModelRenderer BottomBar4; + + public ModelCandleCeiling() { + Wax1 = new ModelRenderer(this, 16, 0); + Wax1.addBox(0F, 0F, 0F, 2, 4, 2); + Wax1.setRotationPoint(-1F, 15.5F, 5F); + + Wax2 = new ModelRenderer(this, 16, 0); + Wax2.addBox(0F, 0F, 0F, 2, 4, 2); + Wax2.setRotationPoint(7F, 15.5F, 1F); + setRotation(Wax2, 0F, 3.141593F, 0F); + + Wax3 = new ModelRenderer(this, 16, 0); + Wax3.addBox(0F, 0F, 0F, 2, 4, 2); + Wax3.setRotationPoint(-7F, 15.5F, -1F); + + Wax4 = new ModelRenderer(this, 16, 0); + Wax4.addBox(0F, 0F, 0F, 2, 4, 2); + Wax4.setRotationPoint(1F, 15.5F, -5F); + setRotation(Wax4, 0F, 3.141593F, 0F); + + TippyTop1 = new ModelRenderer(this, 0, 0); + TippyTop1.addBox(0F, 0F, 0F, 4, 1, 4); + TippyTop1.setRotationPoint(-2.8F, 7.5F, 0F); + setRotation(TippyTop1, 0F, 0.7853982F, 0F); + + TippyTop2 = new ModelRenderer(this, 0, 0); + TippyTop2.addBox(0F, 0F, 0F, 3, 1, 3); + TippyTop2.setRotationPoint(-2.1F, 8F, 0F); + setRotation(TippyTop2, 0F, 0.7853982F, 0F); + + Middle = new ModelRenderer(this, 0, 0); + Middle.addBox(0F, 0F, 0F, 1, 13, 1); + Middle.setRotationPoint(-0.5F, 9F, -0.5F); + + BottomBar1 = new ModelRenderer(this, 0, 4); + BottomBar1.addBox(0F, 0F, 0F, 1, 1, 5); + BottomBar1.setRotationPoint(-0.5F, 21F, 0.5F); + + Rod1 = new ModelRenderer(this, 0, 0); + Rod1.addBox(0F, 0F, 0F, 1, 2, 1); + Rod1.setRotationPoint(-0.5F, 20F, 5.5F); + + Rod2 = new ModelRenderer(this, 0, 0); + Rod2.addBox(0F, 0F, 0F, 1, 2, 1); + Rod2.setRotationPoint(5.5F, 20F, -0.5F); + + Rod3 = new ModelRenderer(this, 0, 0); + Rod3.addBox(0F, 0F, 0F, 1, 2, 1); + Rod3.setRotationPoint(-6.5F, 20F, -0.5F); + + Rod4 = new ModelRenderer(this, 0, 0); + Rod4.addBox(0F, 0F, 0F, 1, 2, 1); + Rod4.setRotationPoint(-0.5F, 20F, -6.5F); + + Base1 = new ModelRenderer(this, 0, 0); + Base1.addBox(0F, 0F, 0F, 4, 1, 4); + Base1.setRotationPoint(-2F, 19F, 4F); + + Base2 = new ModelRenderer(this, 0, 0); + Base2.addBox(0F, 0F, 0F, 4, 1, 4); + Base2.setRotationPoint(4F, 19F, -2F); + + Base3 = new ModelRenderer(this, 0, 0); + Base3.addBox(0F, 0F, 0F, 4, 1, 4); + Base3.setRotationPoint(-8F, 19F, -2F); + + Base4 = new ModelRenderer(this, 0, 0); + Base4.addBox(0F, 0F, 0F, 4, 1, 4); + Base4.setRotationPoint(-2F, 19F, -8F); + + BottomBar3 = new ModelRenderer(this, 0, 4); + BottomBar3.addBox(0F, 0F, 0F, 1, 1, 5); + BottomBar3.setRotationPoint(-0.5F, 21F, -0.5F); + setRotation(BottomBar3, 0F, -1.570796F, 0F); + + BottomBar2 = new ModelRenderer(this, 0, 4); + BottomBar2.addBox(0F, 0F, 0F, 1, 1, 5); + BottomBar2.setRotationPoint(0.5F, 21F, 0.5F); + setRotation(BottomBar2, 0F, 1.570796F, 0F); + + BottomBar4 = new ModelRenderer(this, 0, 4); + BottomBar4.addBox(0F, 0F, 0F, 1, 1, 5); + BottomBar4.setRotationPoint(0.4F, 21F, -0.5F); + setRotation(BottomBar4, 0F, 3.141593F, 0F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, + float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + Wax1.render(f5); + Wax2.render(f5); + Wax3.render(f5); + Wax4.render(f5); + TippyTop1.render(f5); + TippyTop2.render(f5); + Middle.render(f5); + BottomBar1.render(f5); + Rod1.render(f5); + Rod2.render(f5); + Rod3.render(f5); + Rod4.render(f5); + Base1.render(f5); + Base2.render(f5); + Base3.render(f5); + Base4.render(f5); + BottomBar3.render(f5); + BottomBar2.render(f5); + BottomBar4.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelCandleWall.java b/src/main/java/noppes/npcs/client/model/blocks/ModelCandleWall.java new file mode 100644 index 000000000..ec7591700 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelCandleWall.java @@ -0,0 +1,84 @@ +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelCandleWall extends ModelBase { + ModelRenderer Base; + ModelRenderer Bar1; + ModelRenderer Bar2; + ModelRenderer Bar3; + ModelRenderer Bar4; + ModelRenderer Wax; + ModelRenderer Wall2; + ModelRenderer Wall1; + ModelRenderer Bar5; + ModelRenderer Bar6; + + public ModelCandleWall() { + Base = new ModelRenderer(this, 0, 0); + Base.addBox(0F, 0F, 0F, 4, 1, 4); + Base.setRotationPoint(-2F, 13F, -4F); + + Bar1 = new ModelRenderer(this, 0, 0); + Bar1.addBox(0F, 0F, 0F, 1, 1, 6); + Bar1.setRotationPoint(-3F, 12F, -5F); + + Bar2 = new ModelRenderer(this, 0, 0); + Bar2.addBox(0F, 0F, 0F, 1, 1, 6); + Bar2.setRotationPoint(2F, 12F, -5F); + + Bar3 = new ModelRenderer(this, 0, 0); + Bar3.addBox(0F, 0F, 0F, 4, 1, 1); + Bar3.setRotationPoint(-2F, 12F, -5F); + + Bar4 = new ModelRenderer(this, 0, 0); + Bar4.addBox(0F, 0F, 0F, 4, 1, 1); + Bar4.setRotationPoint(-2F, 12F, 0F); + + Wax = new ModelRenderer(this, 16, 0); + Wax.addBox(0F, 0F, 0F, 2, 4, 2); + Wax.setRotationPoint(-1F, 9F, -3F); + + Wall2 = new ModelRenderer(this, 0, 0); + Wall2.addBox(0F, 0F, 0F, 3, 3, 1); + Wall2.setRotationPoint(0F, 13.7F, -7.5F); + setRotation(Wall2, 0F, 0F, 0.7853982F); + + Wall1 = new ModelRenderer(this, 0, 0); + Wall1.addBox(0F, 0F, 0F, 4, 4, 1); + Wall1.setRotationPoint(0F, 13F, -8F); + setRotation(Wall1, 0F, 0F, 0.7853982F); + + Bar5 = new ModelRenderer(this, 0, 0); + Bar5.addBox(0F, 0F, 0F, 1, 2, 1); + Bar5.setRotationPoint(-0.5F, 13.5F, -2.5F); + + Bar6 = new ModelRenderer(this, 0, 0); + Bar6.addBox(0F, 0F, 0F, 1, 1, 5); + Bar6.setRotationPoint(-0.5F, 15.5F, -6.5F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, + float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + Base.render(f5); + Bar1.render(f5); + Bar2.render(f5); + Bar3.render(f5); + Bar4.render(f5); + Wax.render(f5); + Wall2.render(f5); + Wall1.render(f5); + Bar5.render(f5); + Bar6.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelCarpentryBench.java b/src/main/java/noppes/npcs/client/model/blocks/ModelCarpentryBench.java new file mode 100644 index 000000000..c5d2489f6 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelCarpentryBench.java @@ -0,0 +1,119 @@ +// Date: 11-10-2012 19:29:20 +// Template version 1.1 +// Java generated by Techne +// Keep in mind that you still need to fill in some blanks +// - ZeuX + +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelCarpentryBench extends ModelBase { + // fields + ModelRenderer Leg1; + ModelRenderer Leg2; + ModelRenderer Leg3; + ModelRenderer Leg4; + ModelRenderer Bottom_plate; + ModelRenderer Desktop; + ModelRenderer Backboard; + ModelRenderer Vice_Jaw1; + ModelRenderer Vice_Jaw2; + ModelRenderer Vice_Base1; + ModelRenderer Vice_Base2; + ModelRenderer Vice_Crank; + ModelRenderer Vice_Screw; + ModelRenderer Blueprint; + + public ModelCarpentryBench() { + this.textureWidth = 128; + this.textureHeight = 64; + + Leg1 = new ModelRenderer(this, 0, 0); + Leg1.addBox(0F, 0F, 0F, 2, 14, 2); + Leg1.setRotationPoint(6F, 10F, 5F); + + Leg2 = new ModelRenderer(this, 0, 0); + Leg2.addBox(0F, 0F, 0F, 2, 14, 2); + Leg2.setRotationPoint(6F, 10F, -5F); + + Leg3 = new ModelRenderer(this, 0, 0); + Leg3.addBox(0F, 0F, 0F, 2, 14, 2); + Leg3.setRotationPoint(-8F, 10F, 5F); + + Leg4 = new ModelRenderer(this, 0, 0); + Leg4.addBox(0F, 0F, 0F, 2, 14, 2); + Leg4.setRotationPoint(-8F, 10F, -5F); + + Bottom_plate = new ModelRenderer(this, 0, 24); + Bottom_plate.addBox(0F, 0F, 0F, 14, 1, 10); + Bottom_plate.setRotationPoint(-7F, 21F, -4F); + Bottom_plate.setTextureSize(130, 64); + + Desktop = new ModelRenderer(this, 0, 3); + Desktop.addBox(0F, 0F, 0F, 18, 2, 13); + Desktop.setRotationPoint(-9F, 9F, -6F); + + Backboard = new ModelRenderer(this, 0, 18); + Backboard.addBox(-1F, 0F, 0F, 18, 5, 1); + Backboard.setRotationPoint(-8F, 7F, 7F); + + Vice_Jaw1 = new ModelRenderer(this, 54, 18); + Vice_Jaw1.addBox(0F, 0F, 0F, 3, 2, 1); + Vice_Jaw1.setRotationPoint(3F, 6F, -8F); + + Vice_Jaw2 = new ModelRenderer(this, 54, 21); + Vice_Jaw2.addBox(0F, 0F, 0F, 3, 2, 1); + Vice_Jaw2.setRotationPoint(3F, 6F, -6F); + + Vice_Base1 = new ModelRenderer(this, 38, 30); + Vice_Base1.addBox(0F, 0F, 0F, 3, 1, 3); + Vice_Base1.setRotationPoint(3F, 8F, -5F); + + Vice_Base2 = new ModelRenderer(this, 38, 25); + Vice_Base2.addBox(0F, 0F, 0F, 1, 2, 2); + Vice_Base2.setRotationPoint(4F, 7F, -5F); + + Vice_Crank = new ModelRenderer(this, 54, 24); + Vice_Crank.addBox(0F, 0F, 0F, 1, 5, 1); + Vice_Crank.setRotationPoint(6F, 6F, -9F); + + Vice_Screw = new ModelRenderer(this, 44, 25); + Vice_Screw.addBox(0F, 0F, 0F, 1, 1, 4); + Vice_Screw.setRotationPoint(4F, 8F, -8F); + + Blueprint = new ModelRenderer(this, 31, 18); + Blueprint.addBox(0F, 0F, 0F, 8, 0, 7); + Blueprint.setRotationPoint(0F, 9F, 1F); + setRotation(Blueprint, 0.3271718F, 0.1487144F, 0F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5,entity); + Leg1.render(f5); + Leg2.render(f5); + Leg3.render(f5); + Leg4.render(f5); + Bottom_plate.render(f5); + Desktop.render(f5); + Backboard.render(f5); + Vice_Jaw1.render(f5); + Vice_Jaw2.render(f5); + Vice_Base1.render(f5); + Vice_Base2.render(f5); + Vice_Crank.render(f5); + Vice_Screw.render(f5); + Blueprint.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelChair.java b/src/main/java/noppes/npcs/client/model/blocks/ModelChair.java new file mode 100644 index 000000000..508c6e39d --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelChair.java @@ -0,0 +1,126 @@ +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelChair extends ModelBase +{ + //fields + ModelRenderer Leg1; + ModelRenderer Leg2; + ModelRenderer Leg3; + ModelRenderer Leg4; + ModelRenderer Shape1; + ModelRenderer Shape2; + ModelRenderer Shape3; + ModelRenderer Shape4; + ModelRenderer Shape5; + ModelRenderer Shape6; + ModelRenderer Shape7; + ModelRenderer Shape8; + ModelRenderer Shape9; + ModelRenderer Shape10; + ModelRenderer Shape11; + + public ModelChair() + { + Leg1 = new ModelRenderer(this, 0, 0); + Leg1.mirror = true; + Leg1.addBox(0F, 0F, 0F, 1, 18, 1); + Leg1.setRotationPoint(4.01F, 6F, 5.01F); + + Leg2 = new ModelRenderer(this, 0, 0); + Leg2.mirror = true; + Leg2.addBox(0F, 0F, 0F, 1, 9, 1); + Leg2.setRotationPoint(4.01F, 15.5F, -5.01F); + + Leg3 = new ModelRenderer(this, 0, 0); + Leg3.addBox(0F, 0F, 0F, 1, 18, 1); + Leg3.setRotationPoint(-5.01F, 6F, 5.01F); + + Leg4 = new ModelRenderer(this, 0, 0); + Leg4.addBox(0F, 0F, 0F, 1, 9, 1); + Leg4.setRotationPoint(-5.01F, 15.5F, -5.01F); + + Shape1 = new ModelRenderer(this, 8, 2); + Shape1.addBox(0F, 0F, 0F, 10, 1, 11); + Shape1.setRotationPoint(-5F, 16F, -5F); + + Shape2 = new ModelRenderer(this, 4, 4); + Shape2.addBox(0F, 0F, 0F, 3, 2, 1); + Shape2.setRotationPoint(-1.5F, 6.51F, 5.5F); + + Shape3 = new ModelRenderer(this, 4, 4); + Shape3.mirror = true; + Shape3.addBox(-3F, 0F, 0F, 3, 2, 1); + Shape3.setRotationPoint(4F, 6.5F, 5F); + setRotation(Shape3, 0F, 0.2094395F, 0F); + + Shape4 = new ModelRenderer(this, 4, 4); + Shape4.addBox(0F, 0F, 0F, 3, 2, 1); + Shape4.setRotationPoint(-4F, 6.5F, 5F); + setRotation(Shape4, 0F, -0.2094395F, 0F); + + Shape5 = new ModelRenderer(this, 46, 0); + Shape5.addBox(0F, 0F, 0F, 9, 1, 1); + Shape5.setRotationPoint(-4F, 19F, 5F); + + Shape6 = new ModelRenderer(this, 46, 0); + Shape6.addBox(0F, 0F, 0F, 8, 1, 1); + Shape6.setRotationPoint(-4F, 19F, -5F); + + Shape7 = new ModelRenderer(this, 11, 13); + Shape7.addBox(0F, 0F, 0F, 1, 1, 9); + Shape7.setRotationPoint(-5F, 20F, -4F); + + Shape8 = new ModelRenderer(this, 11, 13); + Shape8.mirror = true; + Shape8.addBox(0F, 0F, 0F, 1, 1, 9); + Shape8.setRotationPoint(4F, 20F, -4F); + + Shape9 = new ModelRenderer(this, 0, 0); + Shape9.mirror = true; + Shape9.addBox(0F, 0F, 0F, 1, 8, 1); + Shape9.setRotationPoint(2F, 8F, 5.5F); + setRotation(Shape9, -0.0523599F, 0F, 0F); + + Shape10 = new ModelRenderer(this, 0, 0); + Shape10.addBox(0F, 0F, 0F, 1, 8, 1); + Shape10.setRotationPoint(-3F, 8F, 5.5F); + setRotation(Shape10, -0.0523599F, 0F, 0F); + + Shape11 = new ModelRenderer(this, 0, 0); + Shape11.addBox(0F, 0F, 0F, 1, 8, 1); + Shape11.setRotationPoint(-0.5F, 8F, 5.6F); + setRotation(Shape11, -0.0698132F, 0F, 0F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) + { + super.render(entity, f, f1, f2, f3, f4, f5); + Leg1.render(f5); + Leg2.render(f5); + Leg3.render(f5); + Leg4.render(f5); + Shape1.render(f5); + Shape2.render(f5); + Shape3.render(f5); + Shape4.render(f5); + Shape5.render(f5); + Shape6.render(f5); + Shape7.render(f5); + Shape8.render(f5); + Shape9.render(f5); + Shape10.render(f5); + Shape11.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) + { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelCouchCorner.java b/src/main/java/noppes/npcs/client/model/blocks/ModelCouchCorner.java new file mode 100644 index 000000000..36f02c5a5 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelCouchCorner.java @@ -0,0 +1,76 @@ +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelCouchCorner extends ModelBase { + ModelRenderer Leg1; + ModelRenderer Leg2; + ModelRenderer Leg3; + ModelRenderer Leg4; + ModelRenderer Leg5; + ModelRenderer Back; + ModelRenderer Back2; + ModelRenderer Bottom; + ModelRenderer Bottom2; + + public ModelCouchCorner() { + Leg1 = new ModelRenderer(this, 0, 0); + Leg1.addBox(0F, 0F, 0F, 1, 1, 2); + Leg1.setRotationPoint(7F, 23F, 6F); + + Leg2 = new ModelRenderer(this, 0, 0); + Leg2.addBox(0F, 0F, 0F, 2, 1, 1); + Leg2.setRotationPoint(4F, 23F, -8F); + + Leg3 = new ModelRenderer(this, 0, 0); + Leg3.addBox(0F, 0F, 0F, 2, 1, 1); + Leg3.setRotationPoint(-8F, 23F, -8F); + + Leg4 = new ModelRenderer(this, 0, 0); + Leg4.addBox(0F, 0F, 0F, 2, 1, 2); + Leg4.setRotationPoint(-8F, 23F, 6F); + + Leg5 = new ModelRenderer(this, 0, 0); + Leg5.addBox(0F, 0F, 0F, 1, 1, 2); + Leg5.setRotationPoint(7F, 23F, -6F); + + Back = new ModelRenderer(this, 1, 1); + Back.addBox(0F, 0F, 0F, 1, 15, 15); + Back.setRotationPoint(-8F, 6F, -8F); + + Back2 = new ModelRenderer(this, 14, 15); + Back2.addBox(0F, 0F, 0F, 16, 15, 1); + Back2.setRotationPoint(-8F, 6F, 7F); + + Bottom = new ModelRenderer(this, 4, 0); + Bottom.addBox(0F, 0F, 0F, 16, 2, 14); + Bottom.setRotationPoint(-8F, 21F, -6F); + + Bottom2 = new ModelRenderer(this, 0, 0); + Bottom2.addBox(0F, 0F, 0F, 14, 2, 2); + Bottom2.setRotationPoint(-8F, 21F, -8F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, + float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + Leg1.render(f5); + Leg2.render(f5); + Leg3.render(f5); + Leg4.render(f5); + Leg5.render(f5); + Back.render(f5); + Back2.render(f5); + Bottom.render(f5); + Bottom2.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelCouchCornerWool.java b/src/main/java/noppes/npcs/client/model/blocks/ModelCouchCornerWool.java new file mode 100644 index 000000000..69bfaa4d6 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelCouchCornerWool.java @@ -0,0 +1,46 @@ +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelCouchCornerWool extends ModelBase { + ModelRenderer Wool1; + ModelRenderer Wool2; + ModelRenderer Wool3; + ModelRenderer Wool4; + + public ModelCouchCornerWool() { + Wool1 = new ModelRenderer(this, 11, 3); + Wool1.addBox(0F, 0F, 0F, 13, 5, 2); + Wool1.setRotationPoint(-7F, 16F, -8F); + + Wool2 = new ModelRenderer(this, 2, 4); + Wool2.addBox(0F, 0F, 0F, 2, 10, 13); + Wool2.setRotationPoint(-7F, 6F, -8F); + + Wool3 = new ModelRenderer(this, 14, 15); + Wool3.addBox(0F, 0F, 0F, 15, 10, 2); + Wool3.setRotationPoint(-7F, 6F, 5F); + + Wool4 = new ModelRenderer(this, 0, 45); + Wool4.addBox(0F, 0F, 0F, 15, 5, 13); + Wool4.setRotationPoint(-7F, 16F, -6F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, + float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + Wool1.render(f5); + Wool2.render(f5); + Wool3.render(f5); + Wool4.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelCouchLeft.java b/src/main/java/noppes/npcs/client/model/blocks/ModelCouchLeft.java new file mode 100644 index 000000000..c07f32051 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelCouchLeft.java @@ -0,0 +1,64 @@ +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelCouchLeft extends ModelBase { + ModelRenderer Leg1; + ModelRenderer Leg2; + ModelRenderer Leg3; + ModelRenderer Leg4; + ModelRenderer Back; + ModelRenderer Side; + ModelRenderer Bottom; + + public ModelCouchLeft() { + Leg1 = new ModelRenderer(this, 0, 0); + Leg1.addBox(0F, 0F, 0F, 2, 1, 2); + Leg1.setRotationPoint(-8F, 23F, 6F); + + Leg2 = new ModelRenderer(this, 0, 0); + Leg2.addBox(0F, 0F, 0F, 1, 1, 2); + Leg2.setRotationPoint(7F, 23F, -6F); + + Leg3 = new ModelRenderer(this, 0, 0); + Leg3.addBox(0F, 0F, 0F, 2, 1, 2); + Leg3.setRotationPoint(-8F, 23F, -6F); + + Leg4 = new ModelRenderer(this, 0, 0); + Leg4.addBox(0F, 0F, 0F, 1, 1, 2); + Leg4.setRotationPoint(7F, 23F, 6F); + + Back = new ModelRenderer(this, 1, 15); + Back.addBox(0F, 0F, 0F, 14, 15, 1); + Back.setRotationPoint(-6F, 6F, 7F); + + Side = new ModelRenderer(this, 1, 28); + Side.addBox(0F, 0F, 0F, 2, 11, 14); + Side.setRotationPoint(-8F, 12F, -6F); + + Bottom = new ModelRenderer(this, 3, 1); + Bottom.addBox(0F, 0F, 0F, 14, 2, 14); + Bottom.setRotationPoint(-6F, 21F, -6F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, + float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + Leg1.render(f5); + Leg2.render(f5); + Leg3.render(f5); + Leg4.render(f5); + Back.render(f5); + Side.render(f5); + Bottom.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelCouchLeftWool.java b/src/main/java/noppes/npcs/client/model/blocks/ModelCouchLeftWool.java new file mode 100644 index 000000000..039d843ba --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelCouchLeftWool.java @@ -0,0 +1,34 @@ +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelCouchLeftWool extends ModelBase { + ModelRenderer Wool1; + ModelRenderer Wool2; + + public ModelCouchLeftWool() { + Wool1 = new ModelRenderer(this, 3, 0); + Wool1.addBox(0F, 0F, 0F, 14, 5, 13); + Wool1.setRotationPoint(-6F, 16F, -6F); + + Wool2 = new ModelRenderer(this, 14, 0); + Wool2.addBox(0F, 0F, 0F, 14, 10, 2); + Wool2.setRotationPoint(-6F, 6F, 5F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, + float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + Wool1.render(f5); + Wool2.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelCouchMiddle.java b/src/main/java/noppes/npcs/client/model/blocks/ModelCouchMiddle.java new file mode 100644 index 000000000..563b9ff20 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelCouchMiddle.java @@ -0,0 +1,61 @@ +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelCouchMiddle extends ModelBase +{ + //fields + ModelRenderer Leg1; + ModelRenderer Leg2; + ModelRenderer Leg3; + ModelRenderer Leg4; + ModelRenderer Bottom; + ModelRenderer Back; + + public ModelCouchMiddle(){ + Leg1 = new ModelRenderer(this, 0, 0); + Leg1.addBox(0F, 0F, 0F, 1, 1, 2); + Leg1.setRotationPoint(7F, 23F, 6F); + + Leg2 = new ModelRenderer(this, 0, 0); + Leg2.addBox(0F, 0F, 0F, 1, 1, 2); + Leg2.setRotationPoint(7F, 23F, -6F); + + Leg3 = new ModelRenderer(this, 0, 0); + Leg3.addBox(0F, 0F, 0F, 1, 1, 2); + Leg3.setRotationPoint(-8F, 23F, -6F); + + Leg4 = new ModelRenderer(this, 0, 0); + Leg4.addBox(0F, 0F, 0F, 1, 1, 2); + Leg4.setRotationPoint(-8F, 23F, 6F); + + Bottom = new ModelRenderer(this, 2, 0); + Bottom.addBox(0F, 0F, 0F, 16, 2, 14); + Bottom.setRotationPoint(-8F, 21F, -6F); + + Back = new ModelRenderer(this, 14, 15); + Back.addBox(0F, 0F, 0F, 16, 15, 1); + Back.setRotationPoint(-8F, 6F, 7F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) + { + super.render(entity, f, f1, f2, f3, f4, f5); + Leg1.render(f5); + Leg2.render(f5); + Leg3.render(f5); + Leg4.render(f5); + Bottom.render(f5); + Back.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) + { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelCouchMiddleWool.java b/src/main/java/noppes/npcs/client/model/blocks/ModelCouchMiddleWool.java new file mode 100644 index 000000000..8746975b6 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelCouchMiddleWool.java @@ -0,0 +1,36 @@ +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelCouchMiddleWool extends ModelBase +{ + ModelRenderer Wool1; + ModelRenderer Wool2; + + public ModelCouchMiddleWool(){ + Wool1 = new ModelRenderer(this, 3, 0); + Wool1.addBox(0F, 0F, 0F, 16, 5, 13); + Wool1.setRotationPoint(-8F, 16F, -6F); + + Wool2 = new ModelRenderer(this, 14, 0); + Wool2.addBox(0F, 0F, 0F, 16, 10, 2); + Wool2.setRotationPoint(-8F, 6F, 5F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) + { + super.render(entity, f, f1, f2, f3, f4, f5); + Wool1.render(f5); + Wool2.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) + { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelCouchRight.java b/src/main/java/noppes/npcs/client/model/blocks/ModelCouchRight.java new file mode 100644 index 000000000..33f96e40c --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelCouchRight.java @@ -0,0 +1,68 @@ +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelCouchRight extends ModelBase { + // fields + ModelRenderer Leg1; + ModelRenderer Leg2; + ModelRenderer Leg3; + ModelRenderer Leg4; + ModelRenderer Back; + ModelRenderer Bottom; + ModelRenderer Side; + + public ModelCouchRight() { + Leg1 = new ModelRenderer(this, 0, 0); + Leg1.addBox(0F, 0F, 0F, 2, 1, 2); + Leg1.setRotationPoint(6F, 23F, 6F); + + Leg2 = new ModelRenderer(this, 0, 0); + Leg2.addBox(0F, 0F, 0F, 1, 1, 2); + Leg2.setRotationPoint(-8F, 23F, -6F); + + Leg3 = new ModelRenderer(this, 0, 0); + Leg3.addBox(0F, 0F, 0F, 2, 1, 2); + Leg3.setRotationPoint(6F, 23F, -6F); + + Leg4 = new ModelRenderer(this, 0, 0); + Leg4.addBox(0F, 0F, 0F, 1, 1, 2); + Leg4.setRotationPoint(-8F, 23F, 6F); + + Back = new ModelRenderer(this, 1, 15); + Back.mirror = true; + Back.addBox(0F, 0F, 0F, 14, 15, 1); + Back.setRotationPoint(-8F, 6F, 7F); + + Bottom = new ModelRenderer(this, 3, 1); + Bottom.mirror = true; + Bottom.addBox(0F, 0F, 0F, 14, 2, 14); + Bottom.setRotationPoint(-8F, 21F, -6F); + + Side = new ModelRenderer(this, 1, 28); + Side.mirror = true; + Side.addBox(0F, 0F, 0F, 2, 11, 14); + Side.setRotationPoint(6F, 12F, -6F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, + float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + Leg1.render(f5); + Leg2.render(f5); + Leg3.render(f5); + Leg4.render(f5); + Back.render(f5); + Bottom.render(f5); + Side.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelCouchRightWool.java b/src/main/java/noppes/npcs/client/model/blocks/ModelCouchRightWool.java new file mode 100644 index 000000000..ae9617417 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelCouchRightWool.java @@ -0,0 +1,36 @@ +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelCouchRightWool extends ModelBase { + ModelRenderer Wool1; + ModelRenderer Wool2; + + public ModelCouchRightWool() { + Wool1 = new ModelRenderer(this, 3, 0); + Wool1.mirror = true; + Wool1.addBox(0F, 0F, 0F, 14, 5, 13); + Wool1.setRotationPoint(-8F, 16F, -6F); + + Wool2 = new ModelRenderer(this, 14, 0); + Wool2.mirror = true; + Wool2.addBox(0F, 0F, 0F, 14, 10, 2); + Wool2.setRotationPoint(-8F, 6F, 5F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, + float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + Wool1.render(f5); + Wool2.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelCouchWoodLeft.java b/src/main/java/noppes/npcs/client/model/blocks/ModelCouchWoodLeft.java new file mode 100644 index 000000000..227e40c22 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelCouchWoodLeft.java @@ -0,0 +1,138 @@ +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelCouchWoodLeft extends ModelBase { + ModelRenderer Shape1; + ModelRenderer Shape2; + ModelRenderer Shape3; + ModelRenderer Shape4; + ModelRenderer Shape5; + ModelRenderer Shape6; + ModelRenderer Shape7; + ModelRenderer Shape8; + ModelRenderer Shape9; + ModelRenderer Shape10; + ModelRenderer Shape11; + ModelRenderer Shape12; + ModelRenderer Shape13; + ModelRenderer Shape14; + ModelRenderer Shape15; + ModelRenderer Shape16; + ModelRenderer Shape17; + ModelRenderer Shape18; + + public ModelCouchWoodLeft() { + Shape1 = new ModelRenderer(this, 0, 0); + Shape1.mirror = true; + Shape1.addBox(0F, 0F, 0F, 2, 3, 10); + Shape1.setRotationPoint(-8F, 18F, -4F); + + Shape2 = new ModelRenderer(this, 0, 0); + Shape2.addBox(0F, 0F, 0F, 1, 3, 2); + Shape2.setRotationPoint(7F, 21F, -6F); + + Shape3 = new ModelRenderer(this, 0, 0); + Shape3.mirror = true; + Shape3.addBox(0F, 0F, 0F, 2, 4, 1); + Shape3.setRotationPoint(-8F, 14F, 0.5F); + + Shape4 = new ModelRenderer(this, 0, 0); + Shape4.mirror = true; + Shape4.addBox(0F, 0F, 0F, 14, 2, 1); + Shape4.setRotationPoint(-6F, 7F, 7F); + + Shape5 = new ModelRenderer(this, 0, 0); + Shape5.mirror = true; + Shape5.addBox(0F, 0F, 0F, 14, 2, 2); + Shape5.setRotationPoint(-6F, 19F, 6F); + + Shape6 = new ModelRenderer(this, 0, 0); + Shape6.mirror = true; + Shape6.addBox(0F, 0F, 0F, 2, 1, 13); + Shape6.setRotationPoint(-8F, 13F, -7F); + + Shape7 = new ModelRenderer(this, 0, 0); + Shape7.addBox(0F, 0F, 0F, 1, 1, 10); + Shape7.setRotationPoint(-6F, 19F, -4F); + + Shape8 = new ModelRenderer(this, 0, 0); + Shape8.addBox(0F, 0F, 0F, 1, 3, 2); + Shape8.setRotationPoint(7F, 21F, 6F); + + Shape9 = new ModelRenderer(this, 0, 0); + Shape9.addBox(0F, 0F, 0F, 2, 1, 10); + Shape9.setRotationPoint(5F, 19F, -4F); + + Shape10 = new ModelRenderer(this, 0, 0); + Shape10.addBox(0F, 0F, 0F, 1, 10, 1); + Shape10.setRotationPoint(-6F, 9F, 7F); + + Shape11 = new ModelRenderer(this, 0, 0); + Shape11.mirror = true; + Shape11.addBox(0F, 0F, 0F, 14, 2, 2); + Shape11.setRotationPoint(-6F, 19F, -6F); + + Shape12 = new ModelRenderer(this, 0, 0); + Shape12.addBox(0F, 0F, 0F, 2, 1, 10); + Shape12.setRotationPoint(-3F, 19F, -4F); + + Shape13 = new ModelRenderer(this, 0, 0); + Shape13.addBox(0F, 0F, 0F, 2, 1, 10); + Shape13.setRotationPoint(1F, 19F, -4F); + + Shape14 = new ModelRenderer(this, 0, 0); + Shape14.addBox(0F, 0F, 0F, 2, 10, 1); + Shape14.setRotationPoint(-3F, 9F, 7F); + + Shape15 = new ModelRenderer(this, 0, 0); + Shape15.addBox(0F, 0F, 0F, 2, 10, 1); + Shape15.setRotationPoint(1F, 9F, 7F); + + Shape16 = new ModelRenderer(this, 0, 0); + Shape16.addBox(0F, 0F, 0F, 2, 10, 1); + Shape16.setRotationPoint(5F, 9F, 7F); + + Shape17 = new ModelRenderer(this, 0, 0); + Shape17.mirror = true; + Shape17.addBox(0F, 0F, 0F, 2, 10, 2); + Shape17.setRotationPoint(-8F, 14F, -6F); + + Shape18 = new ModelRenderer(this, 0, 0); + Shape18.mirror = true; + Shape18.addBox(0F, 0F, 0F, 2, 18, 2); + Shape18.setRotationPoint(-8F, 6F, 6F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, + float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + Shape1.render(f5); + Shape2.render(f5); + Shape3.render(f5); + Shape4.render(f5); + Shape5.render(f5); + Shape6.render(f5); + Shape7.render(f5); + Shape8.render(f5); + Shape9.render(f5); + Shape10.render(f5); + Shape11.render(f5); + Shape12.render(f5); + Shape13.render(f5); + Shape14.render(f5); + Shape15.render(f5); + Shape16.render(f5); + Shape17.render(f5); + Shape18.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelCouchWoodMiddle.java b/src/main/java/noppes/npcs/client/model/blocks/ModelCouchWoodMiddle.java new file mode 100644 index 000000000..5248f938a --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelCouchWoodMiddle.java @@ -0,0 +1,113 @@ +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelCouchWoodMiddle extends ModelBase { + // fields + ModelRenderer Shape2; + ModelRenderer Shape4; + ModelRenderer Shape5; + ModelRenderer Shape7; + ModelRenderer Shape8; + ModelRenderer Shape9; + ModelRenderer Shape10; + ModelRenderer Shape11; + ModelRenderer Shape12; + ModelRenderer Shape13; + ModelRenderer Shape14; + ModelRenderer Shape15; + ModelRenderer Shape16; + ModelRenderer Shape17; + ModelRenderer Shape19; + + public ModelCouchWoodMiddle() { + Shape2 = new ModelRenderer(this, 0, 0); + Shape2.addBox(0F, 0F, 0F, 1, 3, 2); + Shape2.setRotationPoint(-8F, 21F, -6F); + + Shape4 = new ModelRenderer(this, 0, 0); + Shape4.addBox(0F, 0F, 0F, 16, 2, 1); + Shape4.setRotationPoint(-8F, 7F, 7F); + + Shape5 = new ModelRenderer(this, 0, 0); + Shape5.addBox(0F, 0F, 0F, 16, 2, 2); + Shape5.setRotationPoint(-8F, 19F, 6F); + + Shape7 = new ModelRenderer(this, 0, 0); + Shape7.addBox(0F, 0F, 0F, 2, 1, 10); + Shape7.setRotationPoint(-7F, 19F, -4F); + + Shape8 = new ModelRenderer(this, 0, 0); + Shape8.addBox(0F, 0F, 0F, 1, 3, 2); + Shape8.setRotationPoint(-8F, 21F, 6F); + + Shape9 = new ModelRenderer(this, 0, 0); + Shape9.addBox(0F, 0F, 0F, 2, 1, 10); + Shape9.setRotationPoint(5F, 19F, -4F); + + Shape10 = new ModelRenderer(this, 0, 0); + Shape10.addBox(0F, 0F, 0F, 2, 10, 1); + Shape10.setRotationPoint(-7F, 9F, 7F); + + Shape11 = new ModelRenderer(this, 0, 0); + Shape11.addBox(0F, 0F, 0F, 16, 2, 2); + Shape11.setRotationPoint(-8F, 19F, -6F); + + Shape12 = new ModelRenderer(this, 0, 0); + Shape12.addBox(0F, 0F, 0F, 2, 1, 10); + Shape12.setRotationPoint(-3F, 19F, -4F); + + Shape13 = new ModelRenderer(this, 0, 0); + Shape13.addBox(0F, 0F, 0F, 2, 1, 10); + Shape13.setRotationPoint(1F, 19F, -4F); + + Shape14 = new ModelRenderer(this, 0, 0); + Shape14.addBox(0F, 0F, 0F, 2, 10, 1); + Shape14.setRotationPoint(-3F, 9F, 7F); + + Shape15 = new ModelRenderer(this, 0, 0); + Shape15.addBox(0F, 0F, 0F, 2, 10, 1); + Shape15.setRotationPoint(1F, 9F, 7F); + + Shape16 = new ModelRenderer(this, 0, 0); + Shape16.addBox(0F, 0F, 0F, 2, 10, 1); + Shape16.setRotationPoint(5F, 9F, 7F); + + Shape17 = new ModelRenderer(this, 0, 0); + Shape17.addBox(0F, 0F, 0F, 1, 3, 2); + Shape17.setRotationPoint(7F, 21F, 6F); + + Shape19 = new ModelRenderer(this, 0, 0); + Shape19.addBox(0F, 0F, 0F, 1, 3, 2); + Shape19.setRotationPoint(7F, 21F, -6F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, + float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + Shape2.render(f5); + Shape4.render(f5); + Shape5.render(f5); + Shape7.render(f5); + Shape8.render(f5); + Shape9.render(f5); + Shape10.render(f5); + Shape11.render(f5); + Shape12.render(f5); + Shape13.render(f5); + Shape14.render(f5); + Shape15.render(f5); + Shape16.render(f5); + Shape17.render(f5); + Shape19.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelCouchWoodRight.java b/src/main/java/noppes/npcs/client/model/blocks/ModelCouchWoodRight.java new file mode 100644 index 000000000..5819b2ada --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelCouchWoodRight.java @@ -0,0 +1,131 @@ +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelCouchWoodRight extends ModelBase { + // fields + ModelRenderer Shape1; + ModelRenderer Shape2; + ModelRenderer Shape3; + ModelRenderer Shape4; + ModelRenderer Shape5; + ModelRenderer Shape6; + ModelRenderer Shape7; + ModelRenderer Shape8; + ModelRenderer Shape9; + ModelRenderer Shape10; + ModelRenderer Shape11; + ModelRenderer Shape12; + ModelRenderer Shape13; + ModelRenderer Shape14; + ModelRenderer Shape15; + ModelRenderer Shape16; + ModelRenderer Shape17; + ModelRenderer Shape18; + + public ModelCouchWoodRight() { + Shape1 = new ModelRenderer(this, 0, 0); + Shape1.addBox(0F, 0F, 0F, 2, 3, 10); + Shape1.setRotationPoint(6F, 18F, -4F); + + Shape2 = new ModelRenderer(this, 0, 0); + Shape2.addBox(0F, 0F, 0F, 1, 3, 2); + Shape2.setRotationPoint(-8F, 21F, -6F); + + Shape3 = new ModelRenderer(this, 0, 0); + Shape3.addBox(0F, 0F, 0F, 2, 4, 1); + Shape3.setRotationPoint(6F, 14F, 0.5F); + + Shape4 = new ModelRenderer(this, 0, 0); + Shape4.addBox(0F, 0F, 0F, 14, 2, 1); + Shape4.setRotationPoint(-8F, 7F, 7F); + + Shape5 = new ModelRenderer(this, 0, 0); + Shape5.addBox(0F, 0F, 0F, 14, 2, 2); + Shape5.setRotationPoint(-8F, 19F, 6F); + + Shape6 = new ModelRenderer(this, 0, 0); + Shape6.addBox(0F, 0F, 0F, 2, 1, 13); + Shape6.setRotationPoint(6F, 13F, -7F); + + Shape7 = new ModelRenderer(this, 0, 0); + Shape7.addBox(0F, 0F, 0F, 2, 1, 10); + Shape7.setRotationPoint(-7F, 19F, -4F); + + Shape8 = new ModelRenderer(this, 0, 0); + Shape8.addBox(0F, 0F, 0F, 1, 3, 2); + Shape8.setRotationPoint(-8F, 21F, 6F); + + Shape9 = new ModelRenderer(this, 0, 0); + Shape9.addBox(0F, 0F, 0F, 1, 1, 10); + Shape9.setRotationPoint(5F, 19F, -4F); + + Shape10 = new ModelRenderer(this, 0, 0); + Shape10.addBox(0F, 0F, 0F, 2, 10, 1); + Shape10.setRotationPoint(-7F, 9F, 7F); + + Shape11 = new ModelRenderer(this, 0, 0); + Shape11.addBox(0F, 0F, 0F, 14, 2, 2); + Shape11.setRotationPoint(-8F, 19F, -6F); + + Shape12 = new ModelRenderer(this, 0, 0); + Shape12.addBox(0F, 0F, 0F, 2, 1, 10); + Shape12.setRotationPoint(-3F, 19F, -4F); + + Shape13 = new ModelRenderer(this, 0, 0); + Shape13.addBox(0F, 0F, 0F, 2, 1, 10); + Shape13.setRotationPoint(1F, 19F, -4F); + + Shape14 = new ModelRenderer(this, 0, 0); + Shape14.addBox(0F, 0F, 0F, 2, 10, 1); + Shape14.setRotationPoint(-3F, 9F, 7F); + + Shape15 = new ModelRenderer(this, 0, 0); + Shape15.addBox(0F, 0F, 0F, 2, 10, 1); + Shape15.setRotationPoint(1F, 9F, 7F); + + Shape16 = new ModelRenderer(this, 0, 0); + Shape16.addBox(0F, 0F, 0F, 1, 10, 1); + Shape16.setRotationPoint(5F, 9F, 7F); + + Shape17 = new ModelRenderer(this, 0, 0); + Shape17.addBox(0F, 0F, 0F, 2, 10, 2); + Shape17.setRotationPoint(6F, 14F, -6F); + + Shape18 = new ModelRenderer(this, 0, 0); + Shape18.addBox(0F, 0F, 0F, 2, 18, 2); + Shape18.setRotationPoint(6F, 6F, 6F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, + float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + Shape1.render(f5); + Shape2.render(f5); + Shape3.render(f5); + Shape4.render(f5); + Shape5.render(f5); + Shape6.render(f5); + Shape7.render(f5); + Shape8.render(f5); + Shape9.render(f5); + Shape10.render(f5); + Shape11.render(f5); + Shape12.render(f5); + Shape13.render(f5); + Shape14.render(f5); + Shape15.render(f5); + Shape16.render(f5); + Shape17.render(f5); + Shape18.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelCouchWoodSingle.java b/src/main/java/noppes/npcs/client/model/blocks/ModelCouchWoodSingle.java new file mode 100644 index 000000000..7023ba6b1 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelCouchWoodSingle.java @@ -0,0 +1,154 @@ +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelCouchWoodSingle extends ModelBase { + // fields + ModelRenderer Shape1; + ModelRenderer Shape2; + ModelRenderer Shape3; + ModelRenderer Shape4; + ModelRenderer Shape5; + ModelRenderer Shape6; + ModelRenderer Shape7; + ModelRenderer Shape8; + ModelRenderer Shape9; + ModelRenderer Shape10; + ModelRenderer Shape11; + ModelRenderer Shape12; + ModelRenderer Shape13; + ModelRenderer Shape14; + ModelRenderer Shape15; + ModelRenderer Shape16; + ModelRenderer Shape17; + ModelRenderer Shape18; + ModelRenderer Shape19; + ModelRenderer Shape20; + ModelRenderer Shape21; + + public ModelCouchWoodSingle() { + Shape1 = new ModelRenderer(this, 0, 0); + Shape1.mirror = true; + Shape1.addBox(0F, 0F, 0F, 2, 3, 10); + Shape1.setRotationPoint(-8F, 18F, -4F); + + Shape2 = new ModelRenderer(this, 0, 0); + Shape2.mirror = true; + Shape2.addBox(0F, 0F, 0F, 2, 10, 2); + Shape2.setRotationPoint(-8F, 14F, -6F); + + Shape3 = new ModelRenderer(this, 0, 0); + Shape3.mirror = true; + Shape3.addBox(0F, 0F, 0F, 2, 4, 1); + Shape3.setRotationPoint(-8F, 14F, 0.5F); + + Shape4 = new ModelRenderer(this, 0, 0); + Shape4.addBox(0F, 0F, 0F, 12, 2, 1); + Shape4.setRotationPoint(-6F, 7F, 7F); + + Shape5 = new ModelRenderer(this, 0, 0); + Shape5.addBox(0F, 0F, 0F, 12, 2, 2); + Shape5.setRotationPoint(-6F, 19F, 6F); + + Shape6 = new ModelRenderer(this, 0, 0); + Shape6.mirror = true; + Shape6.addBox(0F, 0F, 0F, 2, 1, 13); + Shape6.setRotationPoint(-8F, 13F, -7F); + + Shape7 = new ModelRenderer(this, 0, 0); + Shape7.addBox(0F, 0F, 0F, 1, 1, 10); + Shape7.setRotationPoint(-6F, 19F, -4F); + + Shape8 = new ModelRenderer(this, 0, 0); + Shape8.mirror = true; + Shape8.addBox(0F, 0F, 0F, 2, 18, 2); + Shape8.setRotationPoint(-8F, 6F, 6F); + + Shape9 = new ModelRenderer(this, 0, 0); + Shape9.addBox(0F, 0F, 0F, 1, 1, 10); + Shape9.setRotationPoint(5F, 19F, -4F); + + Shape10 = new ModelRenderer(this, 0, 0); + Shape10.addBox(0F, 0F, 0F, 1, 10, 1); + Shape10.setRotationPoint(-6F, 9F, 7F); + + Shape11 = new ModelRenderer(this, 0, 0); + Shape11.addBox(0F, 0F, 0F, 12, 2, 2); + Shape11.setRotationPoint(-6F, 19F, -6F); + + Shape12 = new ModelRenderer(this, 0, 0); + Shape12.addBox(0F, 0F, 0F, 2, 1, 10); + Shape12.setRotationPoint(-3F, 19F, -4F); + + Shape13 = new ModelRenderer(this, 0, 0); + Shape13.addBox(0F, 0F, 0F, 2, 1, 10); + Shape13.setRotationPoint(1F, 19F, -4F); + + Shape14 = new ModelRenderer(this, 0, 0); + Shape14.addBox(0F, 0F, 0F, 2, 10, 1); + Shape14.setRotationPoint(-3F, 9F, 7F); + + Shape15 = new ModelRenderer(this, 0, 0); + Shape15.addBox(0F, 0F, 0F, 2, 10, 1); + Shape15.setRotationPoint(1F, 9F, 7F); + + Shape16 = new ModelRenderer(this, 0, 0); + Shape16.addBox(0F, 0F, 0F, 1, 10, 1); + Shape16.setRotationPoint(5F, 9F, 7F); + + Shape17 = new ModelRenderer(this, 0, 0); + Shape17.addBox(0F, 0F, 0F, 2, 18, 2); + Shape17.setRotationPoint(6F, 6F, 6F); + + Shape18 = new ModelRenderer(this, 0, 0); + Shape18.addBox(0F, 0F, 0F, 2, 1, 13); + Shape18.setRotationPoint(6F, 13F, -7F); + + Shape19 = new ModelRenderer(this, 0, 0); + Shape19.addBox(0F, 0F, 0F, 2, 10, 2); + Shape19.setRotationPoint(6F, 14F, -6F); + + Shape20 = new ModelRenderer(this, 0, 0); + Shape20.addBox(0F, 0F, 0F, 2, 3, 10); + Shape20.setRotationPoint(6F, 18F, -4F); + + Shape21 = new ModelRenderer(this, 0, 0); + Shape21.addBox(0F, 0F, 0F, 2, 4, 1); + Shape21.setRotationPoint(6F, 14F, 0.5F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, + float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + Shape1.render(f5); + Shape2.render(f5); + Shape3.render(f5); + Shape4.render(f5); + Shape5.render(f5); + Shape6.render(f5); + Shape7.render(f5); + Shape8.render(f5); + Shape9.render(f5); + Shape10.render(f5); + Shape11.render(f5); + Shape12.render(f5); + Shape13.render(f5); + Shape14.render(f5); + Shape15.render(f5); + Shape16.render(f5); + Shape17.render(f5); + Shape18.render(f5); + Shape19.render(f5); + Shape20.render(f5); + Shape21.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelCrate.java b/src/main/java/noppes/npcs/client/model/blocks/ModelCrate.java new file mode 100644 index 000000000..9e179ca9b --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelCrate.java @@ -0,0 +1,143 @@ +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelCrate extends ModelBase { + ModelRenderer sticky1; + ModelRenderer sticky2; + ModelRenderer sticky3; + ModelRenderer sticky4; + ModelRenderer core; + ModelRenderer sticky1top; + ModelRenderer sticky2top; + ModelRenderer sticky3top; + ModelRenderer sticky4top; + ModelRenderer sidestick2; + ModelRenderer sidestick3; + ModelRenderer sidestick1; + ModelRenderer sidestick4; + ModelRenderer sidestuff2; + ModelRenderer sidestuff1; + ModelRenderer sidestuff3; + ModelRenderer sidestuff4; + ModelRenderer Shape1; + ModelRenderer Shape2; + + public ModelCrate() { + sticky1 = new ModelRenderer(this, 0, 0); + sticky1.addBox(0F, 0F, 0F, 2, 2, 12); + sticky1.setRotationPoint(6F, 22F, -6F); + + sticky2 = new ModelRenderer(this, 0, 0); + sticky2.addBox(0F, 0F, 0F, 12, 2, 2); + sticky2.setRotationPoint(-6F, 22F, -8F); + + sticky3 = new ModelRenderer(this, 0, 0); + sticky3.addBox(0F, 0F, 0F, 2, 2, 12); + sticky3.setRotationPoint(-8F, 22F, -6F); + + sticky4 = new ModelRenderer(this, 32, 0); + sticky4.addBox(0F, 0F, 0F, 12, 2, 2); + sticky4.setRotationPoint(-6F, 22F, 6F); + + core = new ModelRenderer(this, 0, 0); + core.addBox(-8F, 0, -8F, 16, 16, 16, -1f); + core.setRotationPoint(0, 8F, 0); + + sticky1top = new ModelRenderer(this, 0, 0); + sticky1top.addBox(0F, 0F, 0F, 2, 2, 12); + sticky1top.setRotationPoint(6F, 8F, -6F); + + sticky2top = new ModelRenderer(this, 0, 0); + sticky2top.addBox(0F, 0F, 0F, 12, 2, 2); + sticky2top.setRotationPoint(-6F, 8F, 6F); + + sticky3top = new ModelRenderer(this, 0, 0); + sticky3top.addBox(0F, 0F, 0F, 2, 2, 12); + sticky3top.setRotationPoint(-8F, 8F, -6F); + + sticky4top = new ModelRenderer(this, 0, 0); + sticky4top.addBox(0F, 0F, 0F, 12, 2, 2); + sticky4top.setRotationPoint(-6F, 8F, -8F); + + sidestick1 = new ModelRenderer(this, 0, 0); + sidestick1.addBox(0F, 0F, 0F, 2, 16, 2); + sidestick1.setRotationPoint(-8F, 8F, 6F); + + sidestick2 = new ModelRenderer(this, 0, 0); + sidestick2.addBox(0F, 0F, 0F, 2, 16, 2); + sidestick2.setRotationPoint(6F, 8F, 6F); + + sidestick3 = new ModelRenderer(this, 0, 0); + sidestick3.addBox(0F, 0F, 0F, 2, 16, 2); + sidestick3.setRotationPoint(-8F, 8F, -8F); + + sidestick4 = new ModelRenderer(this, 0, 0); + sidestick4.addBox(0F, 0F, 0F, 2, 16, 2); + sidestick4.setRotationPoint(6F, 8F, -8F); + + sidestuff1 = new ModelRenderer(this, 0, 0); + sidestuff1.addBox(0F, 1F, 0F, 1, 18, 2); + sidestuff1.setRotationPoint(6F, 8.5F, -6.5F); + setRotation(sidestuff1, -0.7853982F, 1.570796F, 0F); + + sidestuff2 = new ModelRenderer(this, 0, 0); + sidestuff2.addBox(0F, -1F, 0F, 1, 18, 2); + sidestuff2.setRotationPoint(-7.5F, 9.5F, 5F); + setRotation(sidestuff2, -0.7853982F, 0F, 0F); + + sidestuff3 = new ModelRenderer(this, 0, 0); + sidestuff3.addBox(0F, 1F, 0F, 1, 18, 2); + sidestuff3.setRotationPoint(7.5F, 8.5F, -6F); + setRotation(sidestuff3, -0.7853982F, 3.141593F, 0F); + + sidestuff4 = new ModelRenderer(this, 0, 0); + sidestuff4.addBox(0F, 1F, 0F, 1, 18, 2); + sidestuff4.setRotationPoint(-6F, 8.5F, 6.5F); + setRotation(sidestuff4, -0.7853982F, -1.570796F, 0F); + + Shape1 = new ModelRenderer(this, 0, 0); + Shape1.addBox(0F, 0F, 0F, 18, 1, 2); + Shape1.setRotationPoint(-5.5F, 22.5F, -7F); + setRotation(Shape1, 0F, -0.7853982F, 0F); + + Shape2 = new ModelRenderer(this, 0, 0); + Shape2.addBox(0F, 0F, 0F, 18, 1, 2); + Shape2.setRotationPoint(-5.5F, 8.5F, -7F); + setRotation(Shape2, 0F, -0.7853982F, 0F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, + float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + sticky1.render(f5); + sticky2.render(f5); + sticky3.render(f5); + sticky4.render(f5); + core.render(f5); + sticky1top.render(f5); + sticky2top.render(f5); + sticky3top.render(f5); + sticky4top.render(f5); + + sidestick1.render(f5); + sidestick2.render(f5); + sidestick3.render(f5); + sidestick4.render(f5); + sidestuff1.render(f5); + sidestuff2.render(f5); + sidestuff3.render(f5); + sidestuff4.render(f5); + Shape1.render(f5); + Shape2.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelInk.java b/src/main/java/noppes/npcs/client/model/blocks/ModelInk.java new file mode 100644 index 000000000..83bdd4f63 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelInk.java @@ -0,0 +1,52 @@ +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelInk extends ModelBase { + ModelRenderer InkMid; + ModelRenderer InkTop; + ModelRenderer InkBottom; + ModelRenderer Shape1; + ModelRenderer InkBottom2; + + public ModelInk() { + InkMid = new ModelRenderer(this, 0, 25); + InkMid.addBox(0F, 0F, 0F, 1, 1, 1); + InkMid.setRotationPoint(5F, 21F, 3.5F); + + InkTop = new ModelRenderer(this, 0, 22); + InkTop.addBox(0F, 0F, 0F, 2, 1, 2); + InkTop.setRotationPoint(4.5F, 20F, 3F); + + InkBottom = new ModelRenderer(this, 3, 16); + InkBottom.addBox(0F, 0F, 0F, 3, 1, 3); + InkBottom.setRotationPoint(4F, 22F, 2.5F); + + Shape1 = new ModelRenderer(this, 0, 0); + Shape1.addBox(0F, 0F, 0F, 0, 13, 3); + Shape1.setRotationPoint(5.5F, 10F, 2.5F); + + InkBottom2 = new ModelRenderer(this, 0, 27); + InkBottom2.addBox(0F, 0F, 0F, 3, 1, 3); + InkBottom2.setRotationPoint(4F, 23F, 2.5F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, + float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + Shape1.render(f5); + InkMid.render(f5); + InkTop.render(f5); + InkBottom2.render(f5); + InkBottom.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelLamp.java b/src/main/java/noppes/npcs/client/model/blocks/ModelLamp.java new file mode 100644 index 000000000..f1647ac3e --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelLamp.java @@ -0,0 +1,65 @@ +// Date: 9-3-2014 10:47:08 +// Template version 1.1 +// Java generated by Techne +// Keep in mind that you still need to fill in some blanks +// - ZeuX + +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelLamp extends ModelBase { + ModelRenderer Base; + ModelRenderer Top1; + ModelRenderer Top2; + ModelRenderer Top3; + ModelRenderer Handle; + ModelRenderer Shape1; + + public ModelLamp() { + Base = new ModelRenderer(this, 0, 6); + Base.addBox(0F, 0F, 0F, 4, 7, 4); + Base.setRotationPoint(-2F, 16F, -2F); + + Top1 = new ModelRenderer(this, 0, 0); + Top1.addBox(0F, 0F, 0F, 5, 1, 5); + Top1.setRotationPoint(-2.5F, 16F, -2.5F); + + Top2 = new ModelRenderer(this, 0, 0); + Top2.addBox(0F, 0F, 0F, 4, 1, 4); + Top2.setRotationPoint(-2F, 15.5F, -2F); + + Top3 = new ModelRenderer(this, 0, 0); + Top3.addBox(0F, 0F, 0F, 3, 1, 3); + Top3.setRotationPoint(-1.5F, 15F, -1.5F); + + Handle = new ModelRenderer(this, 24, 0); + Handle.addBox(0F, 0F, 0F, 3, 0, 3); + Handle.setRotationPoint(0F, 15F, 0F); + setRotation(Handle, 0.296706F, 0.1745329F, 0F); + + Shape1 = new ModelRenderer(this, 0, 17); + Shape1.addBox(-2F, 0F, -2F, 4, 1, 4); + Shape1.setRotationPoint(0F, 23F, 0F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, + float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + Base.render(f5); + Top1.render(f5); + Top2.render(f5); + Top3.render(f5); + Handle.render(f5); + Shape1.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelLampCeiling.java b/src/main/java/noppes/npcs/client/model/blocks/ModelLampCeiling.java new file mode 100644 index 000000000..1bdd106c0 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelLampCeiling.java @@ -0,0 +1,126 @@ +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelLampCeiling extends ModelBase { + ModelRenderer Base; + ModelRenderer Top1; + ModelRenderer Top2; + ModelRenderer Top3; + ModelRenderer Chain8; + ModelRenderer Chain1; + ModelRenderer Chain2; + ModelRenderer Chain3; + ModelRenderer Chain4; + ModelRenderer Chain5; + ModelRenderer Chain6; + ModelRenderer Chain7; + ModelRenderer TippyTop1; + ModelRenderer TippyTop2; + ModelRenderer Shape3; + ModelRenderer Shape1; + ModelRenderer Shape2; + + public ModelLampCeiling() { + Base = new ModelRenderer(this, 0, 6); + Base.addBox(0F, 0F, 0F, 4, 7, 4); + Base.setRotationPoint(-2F, 17F, -2F); + + Top1 = new ModelRenderer(this, 0, 0); + Top1.addBox(0F, 0F, 0F, 5, 1, 5); + Top1.setRotationPoint(-2.5F, 17F, -2.5F); + + Top2 = new ModelRenderer(this, 0, 0); + Top2.addBox(0F, 0F, 0F, 4, 1, 4); + Top2.setRotationPoint(-2F, 16.5F, -2F); + + Top3 = new ModelRenderer(this, 0, 0); + Top3.addBox(0F, 0F, 0F, 3, 1, 3); + Top3.setRotationPoint(-1.5F, 16F, -1.5F); + + Chain8 = new ModelRenderer(this, 0, 0); + Chain8.addBox(0F, 0F, 0F, 1, 2, 1); + Chain8.setRotationPoint(-0.5F, 14F, -1.5F); + + Chain1 = new ModelRenderer(this, 0, 0); + Chain1.addBox(0F, 0F, 0F, 1, 3, 1); + Chain1.setRotationPoint(0.5F, 8F, -0.5F); + + Chain2 = new ModelRenderer(this, 0, 0); + Chain2.addBox(0F, 0F, 0F, 1, 3, 1); + Chain2.setRotationPoint(-1.5F, 8F, -0.5F); + + Chain3 = new ModelRenderer(this, 0, 0); + Chain3.addBox(0F, 0F, 0F, 1, 3, 1); + Chain3.setRotationPoint(-0.5F, 10F, 0.5F); + + Chain4 = new ModelRenderer(this, 0, 0); + Chain4.addBox(0F, 0F, 0F, 1, 3, 1); + Chain4.setRotationPoint(-0.5F, 10F, -1.5F); + + Chain5 = new ModelRenderer(this, 0, 0); + Chain5.addBox(0F, 0F, 0F, 1, 3, 1); + Chain5.setRotationPoint(-1.5F, 12F, -0.5F); + + Chain6 = new ModelRenderer(this, 0, 0); + Chain6.addBox(0F, 0F, 0F, 1, 3, 1); + Chain6.setRotationPoint(0.5F, 12F, -0.5F); + + Chain7 = new ModelRenderer(this, 0, 0); + Chain7.addBox(0F, 0F, 0F, 1, 2, 1); + Chain7.setRotationPoint(-0.5F, 14F, 0.5F); + + TippyTop1 = new ModelRenderer(this, 0, 0); + TippyTop1.addBox(0F, 0F, 0F, 4, 1, 4); + TippyTop1.setRotationPoint(-2.8F, 8F, 0F); + setRotation(TippyTop1, 0F, 0.7853982F, 0F); + + TippyTop2 = new ModelRenderer(this, 0, 0); + TippyTop2.addBox(0F, 0F, 0F, 3, 1, 3); + TippyTop2.setRotationPoint(-2.1F, 8.5F, 0F); + setRotation(TippyTop2, 0F, 0.7853982F, 0F); + + Shape3 = new ModelRenderer(this, 0, 0); + Shape3.addBox(0F, 0F, 0F, 1, 1, 1); + Shape3.setRotationPoint(-0.5F, 14F, -0.5F); + + Shape1 = new ModelRenderer(this, 0, 0); + Shape1.addBox(0F, 0F, 0F, 1, 1, 1); + Shape1.setRotationPoint(-0.5F, 10F, -0.5F); + + Shape2 = new ModelRenderer(this, 0, 0); + Shape2.addBox(0F, 0F, 0F, 1, 1, 1); + Shape2.setRotationPoint(-0.5F, 12F, -0.5F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, + float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + Base.render(f5); + Top1.render(f5); + Top2.render(f5); + Top3.render(f5); + Chain8.render(f5); + Chain1.render(f5); + Chain2.render(f5); + Chain3.render(f5); + Chain4.render(f5); + Chain5.render(f5); + Chain6.render(f5); + Chain7.render(f5); + TippyTop1.render(f5); + TippyTop2.render(f5); + Shape3.render(f5); + Shape1.render(f5); + Shape2.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelLampWall.java b/src/main/java/noppes/npcs/client/model/blocks/ModelLampWall.java new file mode 100644 index 000000000..0125d5094 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelLampWall.java @@ -0,0 +1,73 @@ +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelLampWall extends ModelBase { + ModelRenderer Base; + ModelRenderer Top1; + ModelRenderer Top2; + ModelRenderer Top3; + ModelRenderer Shape2; + ModelRenderer Shape3; + ModelRenderer Shape4; + ModelRenderer Shape5; + + public ModelLampWall() { + Base = new ModelRenderer(this, 0, 6); + Base.addBox(0F, 0F, 0F, 4, 7, 4); + Base.setRotationPoint(-2F, 14F, 1F); + + Top1 = new ModelRenderer(this, 0, 0); + Top1.addBox(0F, 0F, 0F, 5, 1, 5); + Top1.setRotationPoint(-2.5F, 14F, 0.5F); + + Top2 = new ModelRenderer(this, 0, 0); + Top2.addBox(0F, 0F, 0F, 4, 1, 4); + Top2.setRotationPoint(-2F, 13.5F, 1F); + + Top3 = new ModelRenderer(this, 0, 0); + Top3.addBox(0F, 0F, 0F, 3, 1, 3); + Top3.setRotationPoint(-1.5F, 13F, 1.5F); + + Shape2 = new ModelRenderer(this, 0, 0); + Shape2.addBox(0F, 0F, 0F, 1, 1, 3); + Shape2.setRotationPoint(-0.5F, 11F, 3.5F); + + Shape3 = new ModelRenderer(this, 0, 0); + Shape3.addBox(0F, 0F, 0F, 3, 3, 1); + Shape3.setRotationPoint(0F, 9.5F, 6.5F); + setRotation(Shape3, 0F, 0F, 0.7853982F); + + Shape4 = new ModelRenderer(this, 0, 0); + Shape4.addBox(0F, 0F, 0F, 1, 3, 1); + Shape4.setRotationPoint(-0.5F, 10.5F, 2.5F); + + Shape5 = new ModelRenderer(this, 0, 0); + Shape5.addBox(0F, 0F, 0F, 4, 4, 1); + Shape5.setRotationPoint(0F, 8.7F, 7F); + setRotation(Shape5, 0F, 0F, 0.7853982F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, + float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + Base.render(f5); + Top1.render(f5); + Top2.render(f5); + Top3.render(f5); + Shape2.render(f5); + Shape3.render(f5); + Shape4.render(f5); + Shape5.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelLongCrate.java b/src/main/java/noppes/npcs/client/model/blocks/ModelLongCrate.java new file mode 100644 index 000000000..e7cfbdb52 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelLongCrate.java @@ -0,0 +1,68 @@ +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelLongCrate extends ModelBase { + // fields + ModelRenderer Vertical1; + ModelRenderer Horizontal1; + ModelRenderer Cratebody; + ModelRenderer Horizontal2; + ModelRenderer Vertical3; + ModelRenderer Vertical4; + ModelRenderer Vertical2; + + public ModelLongCrate() { + + Vertical1 = new ModelRenderer(this, 80, 0); + Vertical1.addBox(0F, 0F, 0F, 4, 13, 1); + Vertical1.setRotationPoint(-12F, 11F, 8F); + + Horizontal1 = new ModelRenderer(this, 0, 0); + Horizontal1.mirror = true; + Horizontal1.addBox(0F, 0F, 0F, 4, 1, 18); + Horizontal1.setRotationPoint(8F, 10F, -9F); + + Cratebody = new ModelRenderer(this, 8, 0); + Cratebody.addBox(-16F, 0F, -8F, 32, 13, 16); + Cratebody.setRotationPoint(0F, 11F, 0F); + + Horizontal2 = new ModelRenderer(this, 0, 0); + Horizontal2.addBox(0F, 0F, 0F, 4, 1, 18); + Horizontal2.setRotationPoint(-12F, 10F, -9F); + + Vertical3 = new ModelRenderer(this, 80, 0); + Vertical3.addBox(0F, 0F, 0F, 4, 13, 1); + Vertical3.setRotationPoint(-12F, 11F, -9F); + + Vertical4 = new ModelRenderer(this, 80, 0); + Vertical4.mirror = true; + Vertical4.addBox(0F, 0F, 0F, 4, 13, 1); + Vertical4.setRotationPoint(8F, 11F, -9F); + + Vertical2 = new ModelRenderer(this, 80, 0); + Vertical2.mirror = true; + Vertical2.addBox(0F, 0F, 0F, 4, 13, 1); + Vertical2.setRotationPoint(8F, 11F, 8F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, + float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + Vertical1.render(f5); + Horizontal1.render(f5); + Cratebody.render(f5); + Horizontal2.render(f5); + Vertical3.render(f5); + Vertical4.render(f5); + Vertical2.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelMailboxUS.java b/src/main/java/noppes/npcs/client/model/blocks/ModelMailboxUS.java new file mode 100644 index 000000000..522e8cf5e --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelMailboxUS.java @@ -0,0 +1,98 @@ +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelMailboxUS extends ModelBase { + // fields + ModelRenderer Shape1; + ModelRenderer Shape2; + ModelRenderer Shape3; + ModelRenderer Shape4; + ModelRenderer Shape5; + ModelRenderer Shape6; + ModelRenderer Shape7; + ModelRenderer Shape8; + ModelRenderer Shape9; + ModelRenderer Shape10; + ModelRenderer Shape11; + ModelRenderer Shape12; + ModelRenderer Shape13; + + public ModelMailboxUS() { + textureWidth = 64; + textureHeight = 128; + + Shape1 = new ModelRenderer(this, 0, 48); + Shape1.addBox(0F, 0F, 0F, 16, 14, 16); + Shape1.setRotationPoint(-8F, 8F, -8F); + + Shape2 = new ModelRenderer(this, 0, 79); + Shape2.addBox(0F, 0F, 0F, 1, 2, 1); + Shape2.setRotationPoint(-8F, 22F, -8F); + + Shape3 = new ModelRenderer(this, 5, 79); + Shape3.addBox(0F, 0F, 0F, 1, 2, 1); + Shape3.setRotationPoint(-8F, 22F, 7F); + + Shape4 = new ModelRenderer(this, 10, 79); + Shape4.addBox(0F, 0F, 0F, 1, 2, 1); + Shape4.setRotationPoint(7F, 22F, -8F); + + Shape5 = new ModelRenderer(this, 15, 79); + Shape5.addBox(0F, 0F, 0F, 1, 2, 1); + Shape5.setRotationPoint(7F, 22F, 7F); + + Shape6 = new ModelRenderer(this, 0, 14); + Shape6.addBox(0F, 0F, 0F, 16, 3, 7); + Shape6.setRotationPoint(-8F, 5F, 0F); + + Shape7 = new ModelRenderer(this, 0, 6); + Shape7.addBox(0F, 0F, 0F, 16, 2, 6); + Shape7.setRotationPoint(-8F, 3F, 0F); + + Shape8 = new ModelRenderer(this, 0, 0); + Shape8.addBox(0F, 0F, 0F, 16, 1, 5); + Shape8.setRotationPoint(-8F, 2F, 0F); + + Shape9 = new ModelRenderer(this, 0, 37); + Shape9.addBox(0F, 0F, 0F, 1, 3, 7); + Shape9.setRotationPoint(-8F, 5F, -7F); + + Shape10 = new ModelRenderer(this, 16, 37); + Shape10.addBox(0F, 0F, 0F, 1, 3, 7); + Shape10.setRotationPoint(7F, 5F, -7F); + + Shape11 = new ModelRenderer(this, 0, 29); + Shape11.addBox(0F, 0F, 0F, 1, 2, 6); + Shape11.setRotationPoint(-8F, 3F, -6F); + + Shape12 = new ModelRenderer(this, 14, 29); + Shape12.addBox(0F, 0F, 0F, 1, 2, 6); + Shape12.setRotationPoint(7F, 3F, -6F); + + Shape13 = new ModelRenderer(this, 0, 25); + Shape13.addBox(0F, 0F, 0F, 16, 1, 3); + Shape13.setRotationPoint(-8F, 2F, -3F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, + float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + Shape1.render(f5); + Shape2.render(f5); + Shape3.render(f5); + Shape4.render(f5); + Shape5.render(f5); + Shape6.render(f5); + Shape7.render(f5); + Shape8.render(f5); + Shape9.render(f5); + Shape10.render(f5); + Shape11.render(f5); + Shape12.render(f5); + Shape13.render(f5); + } + +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelMailboxWow.java b/src/main/java/noppes/npcs/client/model/blocks/ModelMailboxWow.java new file mode 100644 index 000000000..a3b048b3d --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelMailboxWow.java @@ -0,0 +1,43 @@ +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelMailboxWow extends ModelBase { + // fields + ModelRenderer Shape4; + ModelRenderer Shape1; + ModelRenderer Shape2; + ModelRenderer Shape3; + + public ModelMailboxWow() { + textureWidth = 128; + textureHeight = 64; + + Shape4 = new ModelRenderer(this, 59, 0); + Shape4.addBox(0F, 0F, 0F, 8, 6, 0); + Shape4.setRotationPoint(-4F, -4F, 0F); + + Shape1 = new ModelRenderer(this, 0, 39); + Shape1.addBox(0F, 0F, 0F, 8, 5, 8); + Shape1.setRotationPoint(-4F, 19F, -4F); + + Shape2 = new ModelRenderer(this, 0, 21); + Shape2.addBox(0F, 0F, 0F, 6, 9, 6); + Shape2.setRotationPoint(-3F, 10F, -3F); + + Shape3 = new ModelRenderer(this, 0, 0); + Shape3.addBox(0F, 0F, 0F, 12, 8, 12); + Shape3.setRotationPoint(-6F, 2F, -6F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, + float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + Shape4.render(f5); + Shape1.render(f5); + Shape2.render(f5); + Shape3.render(f5); + } +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelPedestal.java b/src/main/java/noppes/npcs/client/model/blocks/ModelPedestal.java new file mode 100644 index 000000000..5097f0d1c --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelPedestal.java @@ -0,0 +1,41 @@ +package noppes.npcs.client.model.blocks; + +import org.lwjgl.opengl.GL11; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelPedestal extends ModelBase { + ModelRenderer Main_Block; + ModelRenderer Front; + + public ModelPedestal() { + Main_Block = new ModelRenderer(this, 1, 0); + Main_Block.addBox(-7F, 0F, -8F, 14, 3, 16); + Main_Block.setRotationPoint(0, 16F, 0F); + + Front = new ModelRenderer(this, 16, 8); + Front.addBox(-8F, 0F, -8F, 16, 5, 16); + Front.setRotationPoint(0F, 19F, 0F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, + float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + GL11.glPushMatrix(); + GL11.glScalef(1, 1, 0.5f); + Main_Block.render(f5); + GL11.glScalef(1, 1, 1.25f); + Front.render(f5); + GL11.glPopMatrix(); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelShelf.java b/src/main/java/noppes/npcs/client/model/blocks/ModelShelf.java new file mode 100644 index 000000000..d0436d0bc --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelShelf.java @@ -0,0 +1,55 @@ +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelShelf extends ModelBase { + public ModelRenderer SupportLeft2; + ModelRenderer Top; + public ModelRenderer SupportLeft1; + public ModelRenderer SupportRight1; + public ModelRenderer SupportRight2; + + public ModelShelf() { + SupportLeft2 = new ModelRenderer(this, 0, 0); + SupportLeft2.mirror = true; + SupportLeft2.addBox(0F, 0F, 0F, 2, 10, 2); + SupportLeft2.setRotationPoint(-7.498F, 9.5F, -0.5F); + setRotation(SupportLeft2, 0.7853982F, 0F, 0F); + + Top = new ModelRenderer(this, 5, 0); + Top.addBox(0F, 0F, 0F, 16, 2, 11); + Top.setRotationPoint(-8F, 8F, -3F); + + SupportLeft1 = new ModelRenderer(this, 0, 0); + SupportLeft1.mirror = true; + SupportLeft1.addBox(0F, 0F, 0F, 2, 7, 2); + SupportLeft1.setRotationPoint(-7.5F, 10F, 6F); + + SupportRight1 = new ModelRenderer(this, 0, 0); + SupportRight1.addBox(0F, 0F, 0F, 2, 7, 2); + SupportRight1.setRotationPoint(5.5F, 10F, 6F); + + SupportRight2 = new ModelRenderer(this, 0, 0); + SupportRight2.addBox(0F, 0F, 0F, 2, 10, 2); + SupportRight2.setRotationPoint(5.498F, 9.5F, -0.5F); + setRotation(SupportRight2, 0.7853982F, 0F, 0F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, + float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + SupportLeft2.render(f5); + Top.render(f5); + SupportLeft1.render(f5); + SupportRight1.render(f5); + SupportRight2.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelSign.java b/src/main/java/noppes/npcs/client/model/blocks/ModelSign.java new file mode 100644 index 000000000..2fa43993c --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelSign.java @@ -0,0 +1,48 @@ +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelSign extends ModelBase{ + public ModelRenderer Sign; + ModelRenderer Chain2; + ModelRenderer Bar; + ModelRenderer Chain1; + + public ModelSign() + { + Sign = new ModelRenderer(this, 0, 22); + Sign.addBox(0F, 0F, 0F, 14, 9, 1); + Sign.setRotationPoint(-7F, 12F, -0.5F); + setRotation(Sign, 0.0174533F, 0F, 0F); + + Chain2 = new ModelRenderer(this, 0, 0); + Chain2.addBox(0F, 0F, 0F, 1, 2, 2); + Chain2.setRotationPoint(5F, 11F, -1F); + + Bar = new ModelRenderer(this, 0, 0); + Bar.addBox(0F, 0F, 0F, 16, 1, 1); + Bar.setRotationPoint(-8F, 10F, -0.5F); + + Chain1 = new ModelRenderer(this, 0, 0); + Chain1.addBox(0F, 0F, 0F, 1, 2, 2); + Chain1.setRotationPoint(-6F, 11F, -1F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) + { + super.render(entity, f, f1, f2, f3, f4, f5); + Chain2.render(f5); + Bar.render(f5); + Chain1.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) + { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelStool.java b/src/main/java/noppes/npcs/client/model/blocks/ModelStool.java new file mode 100644 index 000000000..1da08f6e6 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelStool.java @@ -0,0 +1,83 @@ +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelStool extends ModelBase { + ModelRenderer Base; + ModelRenderer Leg1; + ModelRenderer Leg2; + ModelRenderer Leg3; + ModelRenderer Leg4; + ModelRenderer Shape1; + ModelRenderer Shape2; + ModelRenderer Shape3; + ModelRenderer Shape4; + + public ModelStool() { + Base = new ModelRenderer(this, 9, 3); + Base.addBox(-5F, 0F, -5F, 10, 1, 10); + Base.setRotationPoint(0F, 16F, 0F); + + Leg1 = new ModelRenderer(this, 0, 12); + Leg1.addBox(-1F, 0F, 0F, 2, 8, 1); + Leg1.setRotationPoint(2F, 17F, 2F); + setRotation(Leg1, 0.3316126F, 0.7853982F, 0F); + + Leg2 = new ModelRenderer(this, 0, 12); + Leg2.addBox(-1F, 0F, 0F, 2, 8, 1); + Leg2.setRotationPoint(2F, 17F, -2F); + setRotation(Leg2, 0.3316126F, 2.356194F, -0.0081449F); + + Leg3 = new ModelRenderer(this, 0, 12); + Leg3.addBox(-1F, 0F, 0F, 2, 8, 1); + Leg3.setRotationPoint(-2F, 17F, 2F); + setRotation(Leg3, 0.3316126F, -0.7853982F, 0F); + + Leg4 = new ModelRenderer(this, 0, 12); + Leg4.addBox(-1F, 0F, 0F, 2, 8, 1); + Leg4.setRotationPoint(-2F, 17F, -2F); + setRotation(Leg4, 0.3316126F, -2.356194F, 0F); + + Shape1 = new ModelRenderer(this, 0, 11); + Shape1.addBox(-3F, 0F, 0F, 6, 1, 1); + Shape1.setRotationPoint(2.4F, 19F, 0F); + setRotation(Shape1, 0F, 1.570796F, 0F); + + Shape2 = new ModelRenderer(this, 0, 11); + Shape2.addBox(-3F, 0F, 0F, 6, 1, 1); + Shape2.setRotationPoint(0F, 19F, 2.4F); + + Shape3 = new ModelRenderer(this, 0, 11); + Shape3.addBox(-3F, 0F, 0F, 6, 1, 1); + Shape3.setRotationPoint(0F, 19F, -3.4F); + + Shape4 = new ModelRenderer(this, 0, 11); + Shape4.addBox(-3F, 0F, 0F, 6, 1, 1); + Shape4.setRotationPoint(-3.4F, 19F, 0F); + setRotation(Shape4, 0F, 1.570796F, 0F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, + float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + Base.render(f5); + Leg1.render(f5); + Leg2.render(f5); + Leg3.render(f5); + Leg4.render(f5); + Shape1.render(f5); + Shape2.render(f5); + Shape3.render(f5); + Shape4.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelTable.java b/src/main/java/noppes/npcs/client/model/blocks/ModelTable.java new file mode 100644 index 000000000..df4b79fef --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelTable.java @@ -0,0 +1,53 @@ +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelTable extends ModelBase { + public ModelRenderer Shape1; + public ModelRenderer Table; + public ModelRenderer Shape3; + public ModelRenderer Shape4; + public ModelRenderer Shape5; + + public ModelTable() { + Shape1 = new ModelRenderer(this, 0, 0); + Shape1.mirror = true; + Shape1.addBox(-1F, 0F, -1F, 2, 14, 2); + Shape1.setRotationPoint(-6F, 10F, 6F); + + Table = new ModelRenderer(this, 0, 0); + Table.addBox(0F, -2F, 0F, 16, 2, 16); + Table.setRotationPoint(-8F, 10F, -8F); + + Shape3 = new ModelRenderer(this, 0, 0); + Shape3.addBox(-1F, 0F, -1F, 2, 14, 2); + Shape3.setRotationPoint(6F, 10F, -6F); + + Shape4 = new ModelRenderer(this, 0, 0); + Shape4.addBox(-1F, 0F, -1F, 2, 14, 2); + Shape4.setRotationPoint(6F, 10F, 6F); + + Shape5 = new ModelRenderer(this, 0, 0); + Shape5.mirror = true; + Shape5.addBox(-1F, 0F, -1F, 2, 14, 2); + Shape5.setRotationPoint(-6F, 10F, -6F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, + float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + Shape1.render(f5); + Shape3.render(f5); + Shape4.render(f5); + Shape5.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelTallLamp.java b/src/main/java/noppes/npcs/client/model/blocks/ModelTallLamp.java new file mode 100644 index 000000000..e3ddacff2 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelTallLamp.java @@ -0,0 +1,67 @@ +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.item.ItemStack; + +public class ModelTallLamp extends ModelBase +{ + //fields + ModelRenderer Base; + ModelRenderer MiddleStick; + ModelRenderer LampShadeStick1; + ModelRenderer LampShadeStick2; + ModelRenderer LampShadeStick3; + ModelRenderer LampShadeStick4; + + public ModelTallLamp() + { + Base = new ModelRenderer(this, 6, 2); + Base.addBox(-6F, 0F, -6F, 12, 1, 12); + Base.setRotationPoint(0F, 23F, 0F); + + MiddleStick = new ModelRenderer(this, 12, 2); + MiddleStick.addBox(-1F, 0F, -1F, 2, 28, 2); + MiddleStick.setRotationPoint(0F, -5F, 0F); + + LampShadeStick1 = new ModelRenderer(this, 0, 30); + LampShadeStick1.addBox(0F, 0F, 0F, 5, 1, 1); + LampShadeStick1.setRotationPoint(1F, -1F, -0.5F); + + LampShadeStick2 = new ModelRenderer(this, 0, 30); + LampShadeStick2.addBox(0F, 0F, 0F, 5, 1, 1); + LampShadeStick2.setRotationPoint(-0.5F, -1F, -1F); + setRotation(LampShadeStick2, 0F, 1.570796F, 0F); + + LampShadeStick3 = new ModelRenderer(this, 0, 30); + LampShadeStick3.addBox(0F, 0F, 0F, 5, 1, 1); + LampShadeStick3.setRotationPoint(-1F, -1F, 0.5F); + setRotation(LampShadeStick3, 0F, 3.141593F, 0F); + + LampShadeStick4 = new ModelRenderer(this, 0, 30); + LampShadeStick4.addBox(0F, 0F, 0F, 5, 1, 1); + LampShadeStick4.setRotationPoint(0.5F, -1F, 1F); + setRotation(LampShadeStick4, 0F, -1.570796F, 0F); + } + + @Override + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) + { + super.render(entity, f, f1, f2, f3, f4, f5); + Base.render(f5); + MiddleStick.render(f5); + LampShadeStick1.render(f5); + LampShadeStick2.render(f5); + LampShadeStick3.render(f5); + LampShadeStick4.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) + { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelTallLampTop.java b/src/main/java/noppes/npcs/client/model/blocks/ModelTallLampTop.java new file mode 100644 index 000000000..c430be87a --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelTallLampTop.java @@ -0,0 +1,50 @@ +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelTallLampTop extends ModelBase +{ + ModelRenderer LampShade1; + ModelRenderer LampShade3; + ModelRenderer LampShade2; + ModelRenderer LampShade4; + + public ModelTallLampTop() + { + LampShade1 = new ModelRenderer(this, 0, 0); + LampShade1.addBox(-.5F, -6F, -6F, 1, 12, 12); + LampShade1.setRotationPoint(6F, -1F, 0F); + + LampShade3 = new ModelRenderer(this, 0, 0); + LampShade3.addBox(-6F, -6F, -.5F, 12, 12, 1); + LampShade3.setRotationPoint(0F, -1F, -6F); + + LampShade2 = new ModelRenderer(this, 0, 0); + LampShade2.addBox(-.5F, -6F, -6F, 1, 12, 12); + LampShade2.setRotationPoint(-6F, -1F, 0F); + + LampShade4 = new ModelRenderer(this, 0, 0); + LampShade4.addBox(-6F, -6F, -.5F, 12, 12, 1); + LampShade4.setRotationPoint(0F, -1F, 6F); + } + + @Override + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) + { + super.render(entity, f, f1, f2, f3, f4, f5); + LampShade1.render(f5); + LampShade3.render(f5); + LampShade2.render(f5); + LampShade4.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) + { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelTombstone1.java b/src/main/java/noppes/npcs/client/model/blocks/ModelTombstone1.java new file mode 100644 index 000000000..789fa2275 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelTombstone1.java @@ -0,0 +1,54 @@ +// Date: 4-4-2014 14:22:58 +// Template version 1.1 +// Java generated by Techne +// Keep in mind that you still need to fill in some blanks +// - ZeuX + +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelTombstone1 extends ModelBase { + // fields + ModelRenderer Mid; + ModelRenderer OuterEdge1; + ModelRenderer OuterEdge2; + ModelRenderer OuterEdgeTop; + + public ModelTombstone1() { + Mid = new ModelRenderer(this, 36, 0); + Mid.addBox(0F, 0F, 0F, 10, 14, 3); + Mid.setRotationPoint(-5F, 10F, -1.5F); + + OuterEdge1 = new ModelRenderer(this, 0, 0); + OuterEdge1.addBox(0F, 0F, 0F, 2, 16, 4); + OuterEdge1.setRotationPoint(-7F, 8F, -2F); + + OuterEdge2 = new ModelRenderer(this, 0, 0); + OuterEdge2.mirror = true; + OuterEdge2.addBox(1F, 0F, 0F, 2, 16, 4); + OuterEdge2.setRotationPoint(4F, 8F, -2F); + + OuterEdgeTop = new ModelRenderer(this, 0, 22); + OuterEdgeTop.addBox(0F, 0F, 0F, 10, 2, 4); + OuterEdgeTop.setRotationPoint(-5F, 8F, -2F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, + float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + Mid.render(f5); + OuterEdge1.render(f5); + OuterEdge2.render(f5); + OuterEdgeTop.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelTombstone2.java b/src/main/java/noppes/npcs/client/model/blocks/ModelTombstone2.java new file mode 100644 index 000000000..d3b71551d --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelTombstone2.java @@ -0,0 +1,33 @@ +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelTombstone2 extends ModelBase { + ModelRenderer Top; + ModelRenderer mid; + + public ModelTombstone2() { + Top = new ModelRenderer(this, 0, 0); + Top.addBox(0F, 0F, 0F, 10, 1, 4); + Top.setRotationPoint(-5F, 9F, -2F); + + mid = new ModelRenderer(this, 0, 0); + mid.addBox(0F, 0F, 0F, 12, 14, 4); + mid.setRotationPoint(-6F, 10F, -2F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, + float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + Top.render(f5); + mid.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelTombstone3.java b/src/main/java/noppes/npcs/client/model/blocks/ModelTombstone3.java new file mode 100644 index 000000000..efb7f266f --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelTombstone3.java @@ -0,0 +1,64 @@ +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelTombstone3 extends ModelBase { + ModelRenderer Bottom; + ModelRenderer Piece5; + ModelRenderer Piece2; + ModelRenderer Piece1; + ModelRenderer Piece4; + ModelRenderer Piece3; + ModelRenderer Piece7; + + public ModelTombstone3() { + Bottom = new ModelRenderer(this, 0, 0); + Bottom.addBox(0F, 0F, 0F, 12, 5, 4); + Bottom.setRotationPoint(-6F, 19F, -2F); + + Piece5 = new ModelRenderer(this, 0, 0); + Piece5.addBox(0F, 0F, 0F, 4, 1, 4); + Piece5.setRotationPoint(-4F, 16F, -2F); + + Piece2 = new ModelRenderer(this, 0, 0); + Piece2.addBox(0F, 0F, 0F, 4, 2, 4); + Piece2.setRotationPoint(2F, 17F, -2F); + + Piece1 = new ModelRenderer(this, 0, 0); + Piece1.addBox(0F, 0F, 0F, 6, 2, 4); + Piece1.setRotationPoint(-5F, 17F, -2F); + + Piece4 = new ModelRenderer(this, 0, 0); + Piece4.addBox(0F, 0F, 0F, 1, 3, 4); + Piece4.setRotationPoint(-5F, 14F, -2F); + + Piece3 = new ModelRenderer(this, 0, 0); + Piece3.addBox(0F, 0F, 0F, 3, 1, 4); + Piece3.setRotationPoint(3F, 16F, -2F); + + Piece7 = new ModelRenderer(this, 0, 0); + Piece7.addBox(0F, 0F, 0F, 1, 1, 4); + Piece7.setRotationPoint(-4F, 15F, -2F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, + float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + Bottom.render(f5); + Piece5.render(f5); + Piece2.render(f5); + Piece1.render(f5); + Piece4.render(f5); + Piece3.render(f5); + Piece7.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelWallBanner.java b/src/main/java/noppes/npcs/client/model/blocks/ModelWallBanner.java new file mode 100644 index 000000000..a4f9610a5 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelWallBanner.java @@ -0,0 +1,60 @@ +// Date: 21-2-2014 11:50:33 +// Template version 1.1 +// Java generated by Techne +// Keep in mind that you still need to fill in some blanks +// - ZeuX + +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelWallBanner extends ModelBase { + // fields + ModelRenderer MiddleStick; + ModelRenderer StickDecoration; + ModelRenderer TopDecoration; + ModelRenderer FlagPole1; + ModelRenderer FlagPole2; + + public ModelWallBanner() { + + MiddleStick = new ModelRenderer(this, 56, 0); + MiddleStick.addBox(-1F, 0F, -1F, 2, 3, 2); + MiddleStick.setRotationPoint(0F, -9F, 6.5F); + + StickDecoration = new ModelRenderer(this, 11, 12); + StickDecoration.addBox(0F, 0F, 0F, 16, 3, 3); + StickDecoration.setRotationPoint(-8F, -7.5F, 5F); + + TopDecoration = new ModelRenderer(this, 45, 19); + TopDecoration.addBox(0F, 0F, 0F, 1, 1, 1); + TopDecoration.setRotationPoint(-0.5F, -10F, 6F); + + FlagPole1 = new ModelRenderer(this, 45, 19); + FlagPole1.addBox(0F, 0F, 0F, 1, 1, 1); + FlagPole1.setRotationPoint(-7F, -6.5F, 4F); + + FlagPole2 = new ModelRenderer(this, 45, 19); + FlagPole2.addBox(0F, 0F, 0F, 1, 1, 1); + FlagPole2.setRotationPoint(6F, -6.5F, 4F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, + float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + MiddleStick.render(f5); + StickDecoration.render(f5); + TopDecoration.render(f5); + FlagPole1.render(f5); + FlagPole2.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelWallBannerFlag.java b/src/main/java/noppes/npcs/client/model/blocks/ModelWallBannerFlag.java new file mode 100644 index 000000000..a32a5fed6 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelWallBannerFlag.java @@ -0,0 +1,25 @@ +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelWallBannerFlag extends ModelBase { + ModelRenderer Flag; + + public ModelWallBannerFlag() { + textureWidth = 32; + textureHeight = 32; + Flag = new ModelRenderer(this, 0, 0); + Flag.addBox(0F, 0F, 0F, 15, 27, 0); + Flag.setRotationPoint(-7.5F, -7F, 4.5F); + Flag.setTextureSize(32, 32); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, + float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + Flag.render(f5); + } + +} diff --git a/src/main/java/noppes/npcs/client/model/blocks/ModelWeaponRack.java b/src/main/java/noppes/npcs/client/model/blocks/ModelWeaponRack.java new file mode 100644 index 000000000..df87345ff --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/blocks/ModelWeaponRack.java @@ -0,0 +1,147 @@ +package noppes.npcs.client.model.blocks; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelWeaponRack extends ModelBase { + ModelRenderer Support_1; + ModelRenderer Support_2; + ModelRenderer Support_3; + ModelRenderer Support_4; + ModelRenderer Support_5; + ModelRenderer Support_6; + ModelRenderer Rung_1_A; + ModelRenderer Rung_1_B; + ModelRenderer Rung_1_C; + ModelRenderer Rung_2_A; + ModelRenderer Rung_2_B; + ModelRenderer Rung_2_C; + ModelRenderer Rung_3_A; + ModelRenderer Rung_3_B; + ModelRenderer Rung_3_C; + ModelRenderer Cross_Top_1; + ModelRenderer Cross_Top_2; + ModelRenderer Bottom_Support_1; + ModelRenderer Bottom_Support_2; + ModelRenderer Middle_Support_1; + + public ModelWeaponRack() { + Support_1 = new ModelRenderer(this, 0, 0); + Support_1.addBox(0F, 0F, 0F, 1, 30, 2); + Support_1.setRotationPoint(-5F, -6.9F, 5F); + + Support_2 = new ModelRenderer(this, 0, 0); + Support_2.addBox(0F, 0F, 0F, 1, 30, 2); + Support_2.setRotationPoint(-8.01F, -6.9F, 5F); + + Support_3 = new ModelRenderer(this, 0, 0); + Support_3.addBox(0F, 0F, 0F, 1, 30, 2); + Support_3.setRotationPoint(-2F, -6.9F, 5F); + + Support_4 = new ModelRenderer(this, 0, 0); + Support_4.addBox(0F, 0F, 0F, 1, 30, 2); + Support_4.setRotationPoint(1F, -6.9F, 5F); + + Support_5 = new ModelRenderer(this, 0, 0); + Support_5.addBox(0F, 0F, 0F, 1, 30, 2); + Support_5.setRotationPoint(4F, -6.9F, 5F); + + Support_6 = new ModelRenderer(this, 0, 0); + Support_6.addBox(0F, 0F, 0F, 1, 30, 2); + Support_6.setRotationPoint(7.01F, -6.9F, 5F); + + Rung_1_A = new ModelRenderer(this, 0, 22); + Rung_1_A.addBox(0F, 0F, 0F, 4, 1, 0); + Rung_1_A.setRotationPoint(-8F, 11F, 3.99F); + + Rung_1_B = new ModelRenderer(this, 0, 24); + Rung_1_B.addBox(0F, 0F, 0F, 1, 1, 1); + Rung_1_B.setRotationPoint(-8F, 11F, 4F); + + Rung_1_C = new ModelRenderer(this, 0, 24); + Rung_1_C.addBox(0F, 0F, 0F, 1, 1, 1); + Rung_1_C.setRotationPoint(-5F, 11F, 4F); + + Rung_2_A = new ModelRenderer(this, 0, 22); + Rung_2_A.addBox(0F, 0F, 0F, 4, 1, 0); + Rung_2_A.setRotationPoint(-2F, 11F, 3.99F); + + Rung_2_B = new ModelRenderer(this, 0, 24); + Rung_2_B.addBox(0F, 0F, 0F, 1, 1, 1); + Rung_2_B.setRotationPoint(-2F, 11F, 4F); + + Rung_2_C = new ModelRenderer(this, 0, 24); + Rung_2_C.addBox(0F, 0F, 0F, 1, 1, 1); + Rung_2_C.setRotationPoint(1F, 11F, 4F); + + Rung_3_A = new ModelRenderer(this, 0, 22); + Rung_3_A.addBox(0F, 0F, 0F, 4, 1, 0); + Rung_3_A.setRotationPoint(4F, 11F, 3.99F); + + Rung_3_B = new ModelRenderer(this, 0, 24); + Rung_3_B.addBox(0F, 0F, 0F, 1, 1, 1); + Rung_3_B.setRotationPoint(4F, 11F, 4F); + + Rung_3_C = new ModelRenderer(this, 0, 24); + Rung_3_C.addBox(0F, 0F, 0F, 1, 1, 1); + Rung_3_C.setRotationPoint(7F, 11F, 4F); + + Cross_Top_1 = new ModelRenderer(this, 6, 0); + Cross_Top_1.addBox(0F, 0F, 0F, 16, 2, 1); + Cross_Top_1.setRotationPoint(-8F, -8.6F, 6F); + setRotation(Cross_Top_1, -0.5235988F, 0F, 0F); + + Cross_Top_2 = new ModelRenderer(this, 6, 0); + Cross_Top_2.addBox(0F, 0F, 0F, 16, 2, 1); + Cross_Top_2.setRotationPoint(-8F, -8.6F, 6.01F); + + Bottom_Support_1 = new ModelRenderer(this, 6, 0); + Bottom_Support_1.addBox(0F, 0F, 0F, 16, 2, 1); + Bottom_Support_1.setRotationPoint(-8F, 23F, 6F); + setRotation(Bottom_Support_1, -1.570796F, 0F, 0F); + + Bottom_Support_2 = new ModelRenderer(this, 6, 0); + Bottom_Support_2.addBox(0F, 0F, 0F, 16, 2, 1); + Bottom_Support_2.setRotationPoint(-8F, 23F, 8F); + setRotation(Bottom_Support_2, -1.570796F, 0F, 0F); + + Middle_Support_1 = new ModelRenderer(this, 6, 3); + Middle_Support_1.addBox(0F, 0F, 0F, 16, 1, 3); + Middle_Support_1.setRotationPoint(-8F, 10F, 7.01F); + setRotation(Middle_Support_1, -1.570796F, 0F, 0F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, + float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + Support_1.render(f5); + Support_2.render(f5); + Support_3.render(f5); + Support_4.render(f5); + Support_5.render(f5); + Support_6.render(f5); + Rung_1_A.render(f5); + Rung_1_B.render(f5); + Rung_1_C.render(f5); + Rung_2_A.render(f5); + Rung_2_B.render(f5); + Rung_2_C.render(f5); + Rung_3_A.render(f5); + Rung_3_B.render(f5); + Rung_3_C.render(f5); + Cross_Top_1.render(f5); + Cross_Top_2.render(f5); + Bottom_Support_1.render(f5); + Bottom_Support_2.render(f5); + Middle_Support_1.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + +} diff --git a/src/main/java/noppes/npcs/client/model/part/ModelBeard.java b/src/main/java/noppes/npcs/client/model/part/ModelBeard.java new file mode 100644 index 000000000..03ff0e74a --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/part/ModelBeard.java @@ -0,0 +1,50 @@ +package noppes.npcs.client.model.part; + +import net.minecraft.entity.Entity; +import net.minecraft.util.ResourceLocation; +import noppes.npcs.ModelData; +import noppes.npcs.ModelPartData; +import noppes.npcs.client.model.ModelMPM; +import noppes.npcs.client.model.util.Model2DRenderer; +import noppes.npcs.client.model.util.ModelPartInterface; + +public class ModelBeard extends ModelPartInterface { + + private Model2DRenderer model; + + public ModelBeard(ModelMPM base) { + super(base); + model = new Model2DRenderer(base, 56, 20, 8, 12, 64, 32); + model.setRotationPoint(-3.99F, 11.9f, -4); + model.setScale(0.74f); + this.addChild(model); + } + + @Override + public void setRotationAngles(float par1, float par2, float par3, + float par4, float par5, float par6, Entity entity) { + if(this.base.bipedHead.rotateAngleX > 0) + rotateAngleX = -base.bipedHead.rotateAngleX; + else + rotateAngleX = 0; + } + + @Override + public void initData(ModelData data) { + ModelPartData config = data.getPartData("beard"); + if(config == null) + { + isHidden = true; + return; + } + color = config.color; + isHidden = false; + + if(!config.playerTexture){ + location = config.getResource(); + } + else + location = null; + } + +} diff --git a/src/main/java/noppes/npcs/client/model/part/ModelBreasts.java b/src/main/java/noppes/npcs/client/model/part/ModelBreasts.java new file mode 100644 index 000000000..2d9310e9a --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/part/ModelBreasts.java @@ -0,0 +1,106 @@ +package noppes.npcs.client.model.part; + +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; +import noppes.npcs.ModelData; +import noppes.npcs.client.model.ModelMPM; +import noppes.npcs.client.model.util.Model2DRenderer; +import noppes.npcs.client.model.util.ModelPartInterface; + +public class ModelBreasts extends ModelPartInterface { + private Model2DRenderer breasts; + private ModelRenderer breasts2; + private ModelRenderer breasts3; + + public ModelBreasts(ModelMPM base) { + super(base); + + breasts = new Model2DRenderer(base, 20f, 22, 8, 3, 64, 32); + breasts.setRotationPoint(-3.6F, 5.2f, -3f); + breasts.setScale(0.17f, 0.19f); + breasts.setThickness(1); + this.addChild(breasts); + + breasts2 = new ModelRenderer(base); + this.addChild(breasts2); + + Model2DRenderer bottom = new Model2DRenderer(base, 20f, 22, 8, 4, 64, 32); + bottom.setRotationPoint(-3.6F, 5f, -3.1f); + bottom.setScale(0.225f, 0.20f); + bottom.setThickness(2f); + bottom.rotateAngleX = -(float) (Math.PI / 10); + breasts2.addChild(bottom); + + breasts3 = new ModelRenderer(base); + this.addChild(breasts3); + + Model2DRenderer right = new Model2DRenderer(base, 20f, 22, 3, 2, 64, 32); + right.setRotationPoint(-3.8F, 5.3f, -3.6f); + right.setScale(0.12f, 0.14f); + right.setThickness(1.75f); + breasts3.addChild(right); + + Model2DRenderer right2 = new Model2DRenderer(base, 20f, 22, 3, 1, 64, 32); + right2.setRotationPoint(-3.8F, 4.1f, -3.14f); + right2.setScale(0.06f, 0.07f); + right2.setThickness(1.75f); + right2.rotateAngleX = (float) (Math.PI / 9); + breasts3.addChild(right2); + + Model2DRenderer right3 = new Model2DRenderer(base, 20f, 24, 3, 1, 64, 32); + right3.setRotationPoint(-3.8F, 5.3f, -3.6f); + right3.setScale(0.06f, 0.07f); + right3.setThickness(1.75f); + right3.rotateAngleX = (float) (-Math.PI / 9); + breasts3.addChild(right3); + + Model2DRenderer right4 = new Model2DRenderer(base, 23f, 22, 1, 2, 64, 32); + right4.setRotationPoint(-1.8f, 5.3f, -3.14f); + right4.setScale(0.12f, 0.14f); + right4.setThickness(1.75f); + right4.rotateAngleY = (float) (Math.PI / 9); + breasts3.addChild(right4); + + Model2DRenderer left = new Model2DRenderer(base, 25f, 22, 3, 2, 64, 32); + left.setRotationPoint(0.8F, 5.3f, -3.6f); + left.setScale(0.12f, 0.14f); + left.setThickness(1.75f); + breasts3.addChild(left); + + Model2DRenderer left2 = new Model2DRenderer(base, 25f, 22, 3, 1, 64, 32); + left2.setRotationPoint(0.8F, 4.1f, -3.18f); + left2.setScale(0.06f, 0.07f); + left2.setThickness(1.75f); + left2.rotateAngleX = (float) (Math.PI / 9); + breasts3.addChild(left2); + + Model2DRenderer left3 = new Model2DRenderer(base, 25f, 24, 3, 1, 64, 32); + left3.setRotationPoint(0.8F, 5.3f, -3.6f); + left3.setScale(0.06f, 0.07f); + left3.setThickness(1.75f); + left3.rotateAngleX = (float) (-Math.PI / 9); + breasts3.addChild(left3); + + Model2DRenderer left4 = new Model2DRenderer(base, 24f, 22, 1, 2, 64, 32); + left4.setRotationPoint(0.8f, 5.3f, -3.6f); + left4.setScale(0.12f, 0.14f); + left4.setThickness(1.75f); + left4.rotateAngleY = (float) (-Math.PI / 9); + breasts3.addChild(left4); + } + + @Override + public void setRotationAngles(float par1, float par2, float par3, + float par4, float par5, float par6, Entity entity) { + + } + + @Override + public void initData(ModelData data) { + this.isHidden = data.breasts == 0; + breasts.isHidden = data.breasts != 1; + breasts2.isHidden = data.breasts != 2; + breasts3.isHidden = data.breasts != 3; + } + +} diff --git a/src/main/java/noppes/npcs/client/model/part/ModelClaws.java b/src/main/java/noppes/npcs/client/model/part/ModelClaws.java new file mode 100644 index 000000000..5722aeb2d --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/part/ModelClaws.java @@ -0,0 +1,47 @@ +package noppes.npcs.client.model.part; + +import net.minecraft.util.ResourceLocation; +import noppes.npcs.ModelData; +import noppes.npcs.ModelPartData; +import noppes.npcs.client.model.ModelMPM; +import noppes.npcs.client.model.util.Model2DRenderer; +import noppes.npcs.client.model.util.ModelPartInterface; +import noppes.npcs.entity.EntityCustomNpc; + +public class ModelClaws extends ModelPartInterface { + + private Model2DRenderer model; + private boolean isRight = false; + + public ModelClaws(ModelMPM base, boolean isRight) { + super(base); + this.isRight = isRight; + model = new Model2DRenderer(base, 0, 16, 4, 4, 64, 32); + if(isRight) + model.setRotationPoint(-2F, 14f, -2); + else + model.setRotationPoint(3F, 14f, -2); + model.rotateAngleY = (float) (Math.PI / -2); + model.setScale(0.25f); + this.addChild(model); + } + + @Override + public void initData(ModelData data) { + ModelPartData config = data.getPartData("claws"); + if(config == null || isRight && config.type == 1 || !isRight && config.type == 2) + { + isHidden = true; + return; + } + color = config.color; + isHidden = false; + + if(!config.playerTexture){ + location = config.getResource(); + } + else + location = null; + } + +} diff --git a/src/main/java/noppes/npcs/client/model/part/ModelEars.java b/src/main/java/noppes/npcs/client/model/part/ModelEars.java new file mode 100644 index 000000000..71ab3920b --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/part/ModelEars.java @@ -0,0 +1,83 @@ +package noppes.npcs.client.model.part; + +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.util.ResourceLocation; +import noppes.npcs.ModelData; +import noppes.npcs.ModelPartData; +import noppes.npcs.client.model.ModelMPM; +import noppes.npcs.client.model.util.Model2DRenderer; +import noppes.npcs.client.model.util.ModelPartInterface; + +public class ModelEars extends ModelPartInterface { + private ModelRenderer ears; + private ModelRenderer bunny; + public ModelEars(ModelMPM par1ModelBase) { + super(par1ModelBase); + + ears = new ModelRenderer(base); + this.addChild(ears); + + Model2DRenderer right = new Model2DRenderer(base, 56, 0, 8, 4, 64, 32); + right.setRotationPoint(-7.44f, -7.3f, -0.0f); + right.setScale(0.234f, 0.234f); + right.setThickness(1.16f); + ears.addChild(right); + + Model2DRenderer left = new Model2DRenderer(base, 56, 0, 8, 4, 64, 32); + left.setRotationPoint(7.44f, -7.3f, 1.15f); + left.setScale(0.234f, 0.234f); + setRotation(left, 0, (float)(Math.PI), 0); + left.setThickness(1.16f); + ears.addChild(left); + + Model2DRenderer right2 = new Model2DRenderer(base, 56, 4, 8, 4, 64, 32); + right2.setRotationPoint(-7.44f, -7.3f, 1.14f); + right2.setScale(0.234f, 0.234f); + right2.setThickness(1.16f); + ears.addChild(right2); + + Model2DRenderer left2 = new Model2DRenderer(base, 56, 4, 8, 4, 64, 32); + left2.setRotationPoint(7.44f, -7.3f, 2.31f); + left2.setScale(0.234f, 0.234f); + setRotation(left2, 0, (float)(Math.PI), 0); + left2.setThickness(1.16f); + ears.addChild(left2); + + + bunny = new ModelRenderer(base); + this.addChild(bunny); + + ModelRenderer earleft = new ModelRenderer(base, 56, 0); + earleft.mirror = true; + earleft.addBox(-1.466667F, -4F, 0F, 3, 7, 1); + earleft.setRotationPoint(2.533333F, -11F, 0F); + bunny.addChild(earleft); + + ModelRenderer earright = new ModelRenderer(base, 56, 0); + earright.addBox(-1.5F, -4F, 0F, 3, 7, 1); + earright.setRotationPoint(-2.466667F, -11F, 0F); + bunny.addChild(earright); + } + + @Override + public void initData(ModelData data) { + ModelPartData config = data.getPartData("ears"); + if(config == null) + { + isHidden = true; + return; + } + isHidden = false; + this.color = config.color; + + ears.isHidden = config.type != 0; + bunny.isHidden = config.type != 1; + + if(!config.playerTexture){ + location = config.getResource(); + } + else + location = null; + } + +} diff --git a/src/main/java/noppes/npcs/client/model/part/ModelFin.java b/src/main/java/noppes/npcs/client/model/part/ModelFin.java new file mode 100644 index 000000000..e8bbae8fa --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/part/ModelFin.java @@ -0,0 +1,41 @@ +package noppes.npcs.client.model.part; + +import net.minecraft.util.ResourceLocation; +import noppes.npcs.ModelData; +import noppes.npcs.ModelPartData; +import noppes.npcs.client.model.ModelMPM; +import noppes.npcs.client.model.util.Model2DRenderer; +import noppes.npcs.client.model.util.ModelPartInterface; + +public class ModelFin extends ModelPartInterface { + + private Model2DRenderer model; + + public ModelFin(ModelMPM base) { + super(base); + model = new Model2DRenderer(base, 56, 20, 8, 12, 64, 32); + model.setRotationPoint(-0.5F, 12, 10); + model.setScale(0.74f); + model.rotateAngleY = (float)Math.PI / 2; + this.addChild(model); + } + + @Override + public void initData(ModelData data) { + ModelPartData config = data.getPartData("fin"); + if(config == null) + { + isHidden = true; + return; + } + color = config.color; + isHidden = false; + + if(!config.playerTexture){ + location = config.getResource(); + } + else + location = null; + } + +} diff --git a/src/main/java/noppes/npcs/client/model/part/ModelHair.java b/src/main/java/noppes/npcs/client/model/part/ModelHair.java new file mode 100644 index 000000000..55dc378f7 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/part/ModelHair.java @@ -0,0 +1,58 @@ +package noppes.npcs.client.model.part; + +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.util.ResourceLocation; +import noppes.npcs.ModelData; +import noppes.npcs.ModelPartData; +import noppes.npcs.client.model.ModelMPM; +import noppes.npcs.client.model.util.Model2DRenderer; +import noppes.npcs.client.model.util.ModelPartInterface; + +public class ModelHair extends ModelPartInterface { + private Model2DRenderer model; + + public ModelHair(ModelMPM base) { + super(base); + model = new Model2DRenderer(base, 56, 20, 8, 12, 64, 32); + model.setRotationPoint(-4F, 12, 3); + model.setScale(0.75f); + addChild(model); + } + + @Override + public void setRotationAngles(float par1, float par2, float par3, + float par4, float par5, float par6, Entity entity) { + ModelRenderer parent = this.base.bipedHead; + if(parent.rotateAngleX < 0){ + rotateAngleX = -parent.rotateAngleX * 1.2f; + if(parent.rotateAngleX > -1){ + rotationPointY = -parent.rotateAngleX * 1.5f; + rotationPointZ = -parent.rotateAngleX * 1.5f; + } + } + else{ + rotateAngleX = 0; + rotationPointY = 0; + rotationPointZ = 0; + } + } + + @Override + public void initData(ModelData data) { + ModelPartData config = data.getPartData("hair"); + if(config == null) + { + isHidden = true; + return; + } + this.color = config.color; + isHidden = false; + if(!config.playerTexture){ + location = config.getResource(); + } + else + location = null; + } + +} diff --git a/src/main/java/noppes/npcs/client/model/part/ModelHeadwear.java b/src/main/java/noppes/npcs/client/model/part/ModelHeadwear.java new file mode 100644 index 000000000..a5f3cc479 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/part/ModelHeadwear.java @@ -0,0 +1,61 @@ +package noppes.npcs.client.model.part; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import noppes.npcs.client.model.util.Model2DRenderer; +import noppes.npcs.client.model.util.ModelScaleRenderer; + +public class ModelHeadwear extends ModelScaleRenderer{ + + public ModelHeadwear(ModelBase base) { + super(base); + Model2DRenderer right = new Model2DRenderer(base, 32, 8, 8, 8, 64, 32); + right.setRotationPoint(-4.641F, .8f, 4.64f); + right.setScale(0.58f); + right.setThickness(0.65f); + setRotation(right, 0, (float)(Math.PI/2f), 0); + this.addChild(right); + + Model2DRenderer left = new Model2DRenderer(base, 48, 8, 8, 8, 64, 32); + left.setRotationPoint(4.639F, .8f, -4.64f); + left.setScale(0.58f); + left.setThickness(0.65f); + setRotation(left, 0, (float)(Math.PI/-2f), 0); + this.addChild(left); + + Model2DRenderer front = new Model2DRenderer(base, 40, 8, 8, 8, 64, 32); + front.setRotationPoint(-4.64F, .801f, -4.641f); + front.setScale(0.58f); + front.setThickness(0.65f); + setRotation(front, 0, 0, 0); + this.addChild(front); + + Model2DRenderer back = new Model2DRenderer(base, 56, 8, 8, 8, 64, 32); + back.setRotationPoint(4.64F, .801f, 4.639f); + back.setScale(0.58f); + back.setThickness(0.65f); + setRotation(back, 0, (float)(Math.PI), 0); + this.addChild(back); + + Model2DRenderer top = new Model2DRenderer(base, 40, 0, 8, 8, 64, 32); + top.setRotationPoint(-4.64F, -8.5f, -4.64f); + top.setScale(0.5799f); + top.setThickness(0.65f); + setRotation(top, (float)(Math.PI / -2), 0, 0); + this.addChild(top); + + Model2DRenderer bottom = new Model2DRenderer(base, 48, 0, 8, 8, 64, 32); + bottom.setRotationPoint(-4.64F, 0f, -4.64f); + bottom.setScale(0.5799f); + bottom.setThickness(0.65f); + setRotation(bottom, (float)(Math.PI / -2), 0, 0); + this.addChild(bottom); + } + + public void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + +} diff --git a/src/main/java/noppes/npcs/client/model/part/ModelLegs.java b/src/main/java/noppes/npcs/client/model/part/ModelLegs.java new file mode 100644 index 000000000..a4c834263 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/part/ModelLegs.java @@ -0,0 +1,377 @@ +package noppes.npcs.client.model.part; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import noppes.npcs.ModelPartData; +import noppes.npcs.client.ClientProxy; +import noppes.npcs.client.model.ModelMPM; +import noppes.npcs.client.model.part.legs.ModelDigitigradeLegs; +import noppes.npcs.client.model.part.legs.ModelMermaidLegs; +import noppes.npcs.client.model.part.legs.ModelNagaLegs; +import noppes.npcs.client.model.util.ModelScaleRenderer; +import noppes.npcs.constants.EnumAnimation; +import noppes.npcs.entity.EntityCustomNpc; + +import org.lwjgl.opengl.GL11; + +public class ModelLegs extends ModelScaleRenderer{ + private EntityCustomNpc entity; + private ModelScaleRenderer leg1, leg2; + private ModelRenderer spider; + private ModelRenderer horse; + private ModelNagaLegs naga; + private ModelDigitigradeLegs digitigrade; + private ModelMermaidLegs mermaid; + + private ModelRenderer spiderLeg1; + private ModelRenderer spiderLeg2; + private ModelRenderer spiderLeg3; + private ModelRenderer spiderLeg4; + private ModelRenderer spiderLeg5; + private ModelRenderer spiderLeg6; + private ModelRenderer spiderLeg7; + private ModelRenderer spiderLeg8; + private ModelRenderer spiderBody; + private ModelRenderer spiderNeck; + + private ModelRenderer backLeftLeg; + private ModelRenderer backLeftShin; + private ModelRenderer backLeftHoof; + + private ModelRenderer backRightLeg; + private ModelRenderer backRightShin; + private ModelRenderer backRightHoof; + + private ModelRenderer frontLeftLeg; + private ModelRenderer frontLeftShin; + private ModelRenderer frontLeftHoof; + + private ModelRenderer frontRightLeg; + private ModelRenderer frontRightShin; + private ModelRenderer frontRightHoof; + + private ModelMPM base; + + public ModelLegs(ModelMPM base, ModelScaleRenderer leg1, ModelScaleRenderer leg2) { + super(base); + this.base = base; + this.leg1 = leg1; + this.leg2 = leg2; + + if(base.isArmor) + return; + spider = new ModelRenderer(base); + this.addChild(spider); + + float var1 = 0.0F; + byte var2 = 15; + spiderNeck = new ModelRenderer(base, 0, 0); + spiderNeck.addBox(-3.0F, -3.0F, -3.0F, 6, 6, 6, var1); + spiderNeck.setRotationPoint(0.0F, (float)var2, 2.0F); + spider.addChild(spiderNeck); + + spiderBody = new ModelRenderer(base, 0, 12); + spiderBody.addBox(-5.0F, -4.0F, -6.0F, 10, 8, 12, var1); + spiderBody.setRotationPoint(0.0F, (float)var2, 11.0F); + spider.addChild(spiderBody); + + this.spiderLeg1 = new ModelRenderer(base, 18, 0); + this.spiderLeg1.addBox(-15.0F, -1.0F, -1.0F, 16, 2, 2, var1); + this.spiderLeg1.setRotationPoint(-4.0F, (float)var2, 4.0F); + spider.addChild(spiderLeg1); + + this.spiderLeg2 = new ModelRenderer(base, 18, 0); + this.spiderLeg2.addBox(-1.0F, -1.0F, -1.0F, 16, 2, 2, var1); + this.spiderLeg2.setRotationPoint(4.0F, (float)var2, 4.0F); + spider.addChild(spiderLeg2); + + this.spiderLeg3 = new ModelRenderer(base, 18, 0); + this.spiderLeg3.addBox(-15.0F, -1.0F, -1.0F, 16, 2, 2, var1); + this.spiderLeg3.setRotationPoint(-4.0F, (float)var2, 3.0F); + spider.addChild(spiderLeg3); + + this.spiderLeg4 = new ModelRenderer(base, 18, 0); + this.spiderLeg4.addBox(-1.0F, -1.0F, -1.0F, 16, 2, 2, var1); + this.spiderLeg4.setRotationPoint(4.0F, (float)var2, 3.0F); + spider.addChild(spiderLeg4); + + this.spiderLeg5 = new ModelRenderer(base, 18, 0); + this.spiderLeg5.addBox(-15.0F, -1.0F, -1.0F, 16, 2, 2, var1); + this.spiderLeg5.setRotationPoint(-4.0F, (float)var2, 2.0F); + spider.addChild(spiderLeg5); + + this.spiderLeg6 = new ModelRenderer(base, 18, 0); + this.spiderLeg6.addBox(-1.0F, -1.0F, -1.0F, 16, 2, 2, var1); + this.spiderLeg6.setRotationPoint(4.0F, (float)var2, 2.0F); + spider.addChild(spiderLeg6); + + this.spiderLeg7 = new ModelRenderer(base, 18, 0); + this.spiderLeg7.addBox(-15.0F, -1.0F, -1.0F, 16, 2, 2, var1); + this.spiderLeg7.setRotationPoint(-4.0F, (float)var2, 1.0F); + spider.addChild(spiderLeg7); + + this.spiderLeg8 = new ModelRenderer(base, 18, 0); + this.spiderLeg8.addBox(-1.0F, -1.0F, -1.0F, 16, 2, 2, var1); + this.spiderLeg8.setRotationPoint(4.0F, (float)var2, 1.0F); + spider.addChild(spiderLeg8); + + + int zOffset = 10; + float yOffset = 7f; + horse = new ModelRenderer(base); + this.addChild(horse); + + ModelRenderer body = new ModelRenderer(base, 0, 34); + body.setTextureSize(128, 128); + body.addBox(-5.0F, -8.0F, -19.0F, 10, 10, 24); + body.setRotationPoint(0.0F, 11.0F + yOffset, 9.0F + zOffset); + horse.addChild(body); + + this.backLeftLeg = new ModelRenderer(base, 78, 29); + this.backLeftLeg.setTextureSize(128, 128); + this.backLeftLeg.addBox(-2.5F, -2.0F, -2.5F, 4, 9, 5); + this.backLeftLeg.setRotationPoint(4.0F, 9.0F + yOffset, 11.0F + zOffset); + horse.addChild(backLeftLeg); + this.backLeftShin = new ModelRenderer(base, 78, 43); + this.backLeftShin.setTextureSize(128, 128); + this.backLeftShin.addBox(-2.0F, 0.0F, -1.5F, 3, 5, 3); + this.backLeftShin.setRotationPoint(0F, 7.0F, 0); + backLeftLeg.addChild(backLeftShin); + this.backLeftHoof = new ModelRenderer(base, 78, 51); + this.backLeftHoof.setTextureSize(128, 128); + this.backLeftHoof.addBox(-2.5F, 5.1F, -2.0F, 4, 3, 4); + this.backLeftHoof.setRotationPoint(0F, 7.0F, 0); + backLeftLeg.addChild(backLeftHoof); + + this.backRightLeg = new ModelRenderer(base, 96, 29); + this.backRightLeg.setTextureSize(128, 128); + this.backRightLeg.addBox(-1.5F, -2.0F, -2.5F, 4, 9, 5); + this.backRightLeg.setRotationPoint(-4.0F, 9.0F + yOffset, 11.0F + zOffset); + horse.addChild(backRightLeg); + this.backRightShin = new ModelRenderer(base, 96, 43); + this.backRightShin.setTextureSize(128, 128); + this.backRightShin.addBox(-1.0F, 0.0F, -1.5F, 3, 5, 3); + this.backRightShin.setRotationPoint(0F, 7, 0); + backRightLeg.addChild(backRightShin); + this.backRightHoof = new ModelRenderer(base, 96, 51); + this.backRightHoof.setTextureSize(128, 128); + this.backRightHoof.addBox(-1.5F, 5.1F, -2.0F, 4, 3, 4); + this.backRightHoof.setRotationPoint(0F, 7, 0); + backRightLeg.addChild(backRightHoof); + + this.frontLeftLeg = new ModelRenderer(base, 44, 29); + this.frontLeftLeg.setTextureSize(128, 128); + this.frontLeftLeg.addBox(-1.9F, -1.0F, -2.1F, 3, 8, 4); + this.frontLeftLeg.setRotationPoint(4.0F, 9.0F + yOffset, -8.0F + zOffset); + horse.addChild(frontLeftLeg); + this.frontLeftShin = new ModelRenderer(base, 44, 41); + this.frontLeftShin.setTextureSize(128, 128); + this.frontLeftShin.addBox(-1.9F, 0.0F, -1.6F, 3, 5, 3); + this.frontLeftShin.setRotationPoint(0F, 7.0F, 0F); + frontLeftLeg.addChild(frontLeftShin); + this.frontLeftHoof = new ModelRenderer(base, 44, 51); + this.frontLeftHoof.setTextureSize(128, 128); + this.frontLeftHoof.addBox(-2.4F, 5.1F, -2.1F, 4, 3, 4); + this.frontLeftHoof.setRotationPoint(.0F, 7.0F, 0F); + frontLeftLeg.addChild(frontLeftHoof); + + this.frontRightLeg = new ModelRenderer(base, 60, 29); + this.frontRightLeg.setTextureSize(128, 128); + this.frontRightLeg.addBox(-1.1F, -1.0F, -2.1F, 3, 8, 4); + this.frontRightLeg.setRotationPoint(-4.0F, 9.0F + yOffset, -8.0F + zOffset); + horse.addChild(frontRightLeg); + this.frontRightShin = new ModelRenderer(base, 60, 41); + this.frontRightShin.setTextureSize(128, 128); + this.frontRightShin.addBox(-1.1F, 0.0F, -1.6F, 3, 5, 3); + this.frontRightShin.setRotationPoint(0F, 7, 0); + frontRightLeg.addChild(frontRightShin); + this.frontRightHoof = new ModelRenderer(base, 60, 51); + this.frontRightHoof.setTextureSize(128, 128); + this.frontRightHoof.addBox(-1.6F, 5.1F, -2.1F, 4, 3, 4); + this.frontRightHoof.setRotationPoint(0F, 7, 0); + frontRightLeg.addChild(frontRightHoof); + + naga = new ModelNagaLegs(base); + this.addChild(naga); + + mermaid = new ModelMermaidLegs(base); + this.addChild(mermaid); + + digitigrade = new ModelDigitigradeLegs(base); + this.addChild(digitigrade); + } + public void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity entity) + { + ModelPartData part = this.entity.modelData.legParts; + rotationPointZ = 0; + rotationPointY = 0; + + if(base.isArmor) + return; + if(part.type == 2){ + this.rotateAngleX = 0; + spiderBody.rotationPointY = 15; + spiderBody.rotationPointZ = 11; + spiderNeck.rotateAngleX = 0; + + float var8 = ((float)Math.PI / 4F); + this.spiderLeg1.rotateAngleZ = -var8; + this.spiderLeg2.rotateAngleZ = var8; + this.spiderLeg3.rotateAngleZ = -var8 * 0.74F; + this.spiderLeg4.rotateAngleZ = var8 * 0.74F; + this.spiderLeg5.rotateAngleZ = -var8 * 0.74F; + this.spiderLeg6.rotateAngleZ = var8 * 0.74F; + this.spiderLeg7.rotateAngleZ = -var8; + this.spiderLeg8.rotateAngleZ = var8; + float var9 = -0.0F; + float var10 = 0.3926991F; + this.spiderLeg1.rotateAngleY = var10 * 2.0F + var9; + this.spiderLeg2.rotateAngleY = -var10 * 2.0F - var9; + this.spiderLeg3.rotateAngleY = var10 * 1.0F + var9; + this.spiderLeg4.rotateAngleY = -var10 * 1.0F - var9; + this.spiderLeg5.rotateAngleY = -var10 * 1.0F + var9; + this.spiderLeg6.rotateAngleY = var10 * 1.0F - var9; + this.spiderLeg7.rotateAngleY = -var10 * 2.0F + var9; + this.spiderLeg8.rotateAngleY = var10 * 2.0F - var9; + float var11 = -(MathHelper.cos(par1 * 0.6662F * 2.0F + 0.0F) * 0.4F) * par2; + float var12 = -(MathHelper.cos(par1 * 0.6662F * 2.0F + (float)Math.PI) * 0.4F) * par2; + float var13 = -(MathHelper.cos(par1 * 0.6662F * 2.0F + ((float)Math.PI / 2F)) * 0.4F) * par2; + float var14 = -(MathHelper.cos(par1 * 0.6662F * 2.0F + ((float)Math.PI * 3F / 2F)) * 0.4F) * par2; + float var15 = Math.abs(MathHelper.sin(par1 * 0.6662F + 0.0F) * 0.4F) * par2; + float var16 = Math.abs(MathHelper.sin(par1 * 0.6662F + (float)Math.PI) * 0.4F) * par2; + float var17 = Math.abs(MathHelper.sin(par1 * 0.6662F + ((float)Math.PI / 2F)) * 0.4F) * par2; + float var18 = Math.abs(MathHelper.sin(par1 * 0.6662F + ((float)Math.PI * 3F / 2F)) * 0.4F) * par2; + this.spiderLeg1.rotateAngleY += var11; + this.spiderLeg2.rotateAngleY += -var11; + this.spiderLeg3.rotateAngleY += var12; + this.spiderLeg4.rotateAngleY += -var12; + this.spiderLeg5.rotateAngleY += var13; + this.spiderLeg6.rotateAngleY += -var13; + this.spiderLeg7.rotateAngleY += var14; + this.spiderLeg8.rotateAngleY += -var14; + this.spiderLeg1.rotateAngleZ += var15; + this.spiderLeg2.rotateAngleZ += -var15; + this.spiderLeg3.rotateAngleZ += var16; + this.spiderLeg4.rotateAngleZ += -var16; + this.spiderLeg5.rotateAngleZ += var17; + this.spiderLeg6.rotateAngleZ += -var17; + this.spiderLeg7.rotateAngleZ += var18; + this.spiderLeg8.rotateAngleZ += -var18; + + + if(base.isSneak){ + rotationPointZ = 5; + rotationPointY = -1; + spiderBody.rotationPointY = 16; + spiderBody.rotationPointZ = 10; + spiderNeck.rotateAngleX = (float) (Math.PI / -8); + } + if(base.isSleeping(entity) || this.entity.currentAnimation == EnumAnimation.CRAWLING){ + rotationPointY = 12 * this.entity.modelData.legs.scaleY; + rotationPointZ = 15 * this.entity.modelData.legs.scaleY; + + this.rotateAngleX = (float) (Math.PI / -2); + } + } + else if(part.type == 3){ + this.frontLeftLeg.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * .4F * par2; + this.frontRightLeg.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * .4F * par2; + this.backLeftLeg.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * .4F * par2; + this.backRightLeg.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * .4F * par2; + } + else if(part.type == 1){ + naga.isRiding = base.isRiding; + naga.isSleeping = base.isSleeping(entity); + naga.isCrawling = this.entity.currentAnimation == EnumAnimation.CRAWLING; + naga.isSneaking = base.isSneak; + naga.setRotationAngles(par1, par2, par3, par4, par5, par6, entity); + } + else if(part.type == 4){ + mermaid.setRotationAngles(par1, par2, par3, par4, par5, par6, entity); + } + else if(part.type == 5){ + digitigrade.setRotationAngles(par1, par2, par3, par4, par5, par6, entity); + } + } + + @Override + public void render(float par1) + { + if(!showModel || isHidden) + return; + ModelPartData part = entity.modelData.legParts; + if(part.type < 0) + return; + GL11.glPushMatrix(); + if(part.type == 4) + part.playerTexture = !entity.isInWater(); + if(!base.isArmor){ + if(!part.playerTexture){ + ClientProxy.bindTexture(part.getResource()); + base.currentlyPlayerTexture = false; + } + else if(!base.currentlyPlayerTexture){ + ClientProxy.bindTexture(entity.textureLocation); + base.currentlyPlayerTexture = true; + } + } + if(part.type == 0 || part.type == 4 && !entity.isInWater()){ + leg1.setConfig(config, x, y, z); + leg1.render(par1); + leg2.setConfig(config, -x, y, z); + leg2.render(par1); + } + + if(!base.isArmor){ + naga.isHidden = part.type != 1; + spider.isHidden = part.type != 2; + horse.isHidden = part.type != 3; + mermaid.isHidden = part.type != 4 || !entity.isInWater(); + digitigrade.isHidden = part.type != 5; + + if(!horse.isHidden){ + x = 0; + y *= 1.8f; + GL11.glScalef(0.9f, 0.9f, 0.9f); + } + else if(!spider.isHidden){ + x = 0; + y *= 2f; + } + else if(!naga.isHidden){ + x = 0; + y *= 2f; + } + else if(!mermaid.isHidden || !digitigrade.isHidden){ + x = 0; + y *= 2f; + } + } + boolean bo = entity.hurtTime <= 0 && entity.deathTime <= 0 && !base.isArmor; + if(bo){ + float red = (entity.modelData.legParts.color >> 16 & 255) / 255f; + float green = (entity.modelData.legParts.color >> 8 & 255) / 255f; + float blue = (entity.modelData.legParts.color & 255) / 255f; + GL11.glColor4f(red, green, blue, base.alpha); + } + super.render(par1); + if(bo){ + GL11.glColor4f(1, 1, 1, base.alpha); + } + GL11.glPopMatrix(); + + } + public void setData(EntityCustomNpc entity) { + this.entity = entity; + } +} diff --git a/src/main/java/noppes/npcs/client/model/part/ModelMohawk.java b/src/main/java/noppes/npcs/client/model/part/ModelMohawk.java new file mode 100644 index 000000000..ec402e9c5 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/part/ModelMohawk.java @@ -0,0 +1,44 @@ +package noppes.npcs.client.model.part; + +import net.minecraft.entity.Entity; +import net.minecraft.util.ResourceLocation; +import noppes.npcs.ModelData; +import noppes.npcs.ModelPartData; +import noppes.npcs.client.model.ModelMPM; +import noppes.npcs.client.model.util.Model2DRenderer; +import noppes.npcs.client.model.util.ModelPartInterface; + +public class ModelMohawk extends ModelPartInterface { + private Model2DRenderer model; + public ModelMohawk(ModelMPM base) { + super(base); + + model = new Model2DRenderer(base, 0, 0, 13 , 13); + model.setRotationPoint(-0.5F, 0f, 9F); + setRotation(model, 0, (float)(Math.PI/2f), 0); + model.setScale(0.825f); + this.addChild(model); + } + + @Override + public void setRotationAngles(float par1, float par2, float par3, + float par4, float par5, float par6, Entity entity) { + + } + + + @Override + public void initData(ModelData data) { + ModelPartData config = data.getPartData("mohawk"); + if(config == null) + { + isHidden = true; + return; + } + color = config.color; + isHidden = false; + location = config.getResource(); + + } + +} diff --git a/src/main/java/noppes/npcs/client/model/part/ModelSnout.java b/src/main/java/noppes/npcs/client/model/part/ModelSnout.java new file mode 100644 index 000000000..7fbee6551 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/part/ModelSnout.java @@ -0,0 +1,74 @@ +package noppes.npcs.client.model.part; + +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.util.ResourceLocation; +import noppes.npcs.ModelData; +import noppes.npcs.ModelPartData; +import noppes.npcs.client.model.ModelMPM; +import noppes.npcs.client.model.util.ModelPartInterface; + +public class ModelSnout extends ModelPartInterface { + private ModelRenderer small; + private ModelRenderer medium; + private ModelRenderer large; + private ModelRenderer bunny; + + public ModelSnout(ModelMPM base) { + super(base); + + small = new ModelRenderer(base, 24, 0); + small.addBox(0F, 0F, 0F, 4, 3, 1); + small.setRotationPoint(-2F, -3F, -5F); + this.addChild(small); + + medium = new ModelRenderer(base, 24, 0); + medium.addBox(0F, 0F, 0F, 4, 3, 2); + medium.setRotationPoint(-2F, -3F, -6F); + this.addChild(medium); + + large = new ModelRenderer(base, 24, 0); + large.addBox(0F, 0F, 0F, 4, 3, 3); + large.setRotationPoint(-2F, -3F, -7F); + this.addChild(large); + + bunny = new ModelRenderer(base, 24, 0); + bunny.addBox(1F, 1F, 0F, 4, 2, 1); + bunny.setRotationPoint(-3F, -4F, -5F); + this.addChild(bunny); + + ModelRenderer tooth = new ModelRenderer(base, 24, 3); + tooth.addBox(2F, 3f, 0F, 2, 1, 1); + tooth.setRotationPoint(0F, 0F, 0F); + bunny.addChild(tooth); + } + + @Override + public void setRotationAngles(float par1, float par2, float par3, + float par4, float par5, float par6, Entity entity) { + + } + + @Override + public void initData(ModelData data) { + ModelPartData config = data.getPartData("snout"); + if(config == null) + { + isHidden = true; + return; + } + + color = config.color; + isHidden = false; + small.isHidden = config.type != 0; + medium.isHidden = config.type != 1; + large.isHidden = config.type != 2; + bunny.isHidden = config.type != 3; + + if(!config.playerTexture){ + location = config.getResource(); + } + else + location = null; + } +} diff --git a/src/main/java/noppes/npcs/client/model/part/ModelTail.java b/src/main/java/noppes/npcs/client/model/part/ModelTail.java new file mode 100644 index 000000000..8456637cd --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/part/ModelTail.java @@ -0,0 +1,156 @@ +package noppes.npcs.client.model.part; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import noppes.npcs.ModelPartData; +import noppes.npcs.client.ClientProxy; +import noppes.npcs.client.model.ModelMPM; +import noppes.npcs.client.model.part.tails.ModelDragonTail; +import noppes.npcs.client.model.part.tails.ModelSquirrelTail; +import noppes.npcs.client.model.util.ModelScaleRenderer; +import noppes.npcs.constants.EnumAnimation; +import noppes.npcs.entity.EntityCustomNpc; + +import org.lwjgl.opengl.GL11; + +public class ModelTail extends ModelScaleRenderer { + private EntityCustomNpc entity; + private ModelMPM base; + + private ModelRenderer tail; + private ModelRenderer dragon; + private ModelRenderer squirrel; + private ModelRenderer horse; + + private int color = 0xFFFFFF; + + private ResourceLocation location = null; + + public ModelTail(ModelMPM base) { + super(base); + this.base = base; + this.rotationPointY = 11; + + tail = new ModelRenderer(base, 56, 21); + tail.addBox(-1F, 0F, 0F, 2, 9, 2); + tail.setRotationPoint(0F, 0, 1F); + setRotation(tail, 0.8714253F, 0F, 0F); + this.addChild(tail); + + horse = new ModelRenderer(base); + horse.setTextureSize(32, 32); + horse.setRotationPoint(0, -1, 1); + this.addChild(horse); + + ModelRenderer tailBase = new ModelRenderer(base, 0, 26); + tailBase.setTextureSize(32, 32); + tailBase.addBox(-1.0F, -1.0F, 0.0F, 2, 2, 3); + setRotation(tailBase, -1.134464F, 0.0F, 0.0F); + horse.addChild(tailBase); + ModelRenderer tailMiddle = new ModelRenderer(base, 0, 13); + tailMiddle.setTextureSize(32, 32); + tailMiddle.addBox(-1.5F, -2.0F, 3.0F, 3, 4, 7); + setRotation(tailMiddle, -1.134464F, 0.0F, 0.0F); + horse.addChild(tailMiddle); + ModelRenderer tailTip = new ModelRenderer(base, 0, 0); + tailTip.setTextureSize(32, 32); + tailTip.addBox(-1.5F, -4.5F, 9.0F, 3, 4, 7); + setRotation(tailTip, -1.40215F, 0.0F, 0.0F); + horse.addChild(tailTip); + horse.rotateAngleX = 0.5f; + + + this.addChild(dragon = new ModelDragonTail(base)); + + this.addChild(squirrel = new ModelSquirrelTail(base)); + } + + public void setData(EntityCustomNpc entity) { + this.entity = entity; + initData(entity); + } + + public void setRotationAngles(float par1, float par2, float par3, + float par4, float par5, float par6, Entity entity) { + rotateAngleY = MathHelper.cos(par1 * 0.6662F) * 0.3f * par2; + rotateAngleX = MathHelper.sin(par3 * 0.067F) * 0.05F; + + if(this.entity.modelData.legParts.type == 2){ + rotationPointY = 13f; + rotationPointZ = 14 * this.entity.modelData.legs.scaleZ; + + if(base.isSleeping(entity) || this.entity.currentAnimation == EnumAnimation.CRAWLING){ + rotationPointY = 12 + 16 * this.entity.modelData.legs.scaleZ; + rotationPointZ = 1f * this.entity.modelData.legs.scaleY; + + rotateAngleX = (float) (Math.PI / -4); + } + } + else if(this.entity.modelData.legParts.type == 3){ + rotationPointY = 8.6f; + rotationPointZ = 19 * this.entity.modelData.legs.scaleZ; + } + else{ + rotationPointY = 11; + this.rotationPointZ = -1; + } + this.rotationPointZ += base.bipedRightLeg.rotationPointZ + 0.5f; + } + + public void setLivingAnimations(ModelPartData data, EntityLivingBase entity, float par2, float par3, float par4) { + } + + public void initData(EntityCustomNpc data) { + ModelPartData config = data.modelData.getPartData("tail"); + if(config == null) + { + isHidden = true; + return; + } + color = config.color; + isHidden = false; + tail.isHidden = config.type != 0; + dragon.isHidden = config.type != 1; + horse.isHidden = config.type != 2; + squirrel.isHidden = config.type != 3; + if(!config.playerTexture){ + location = config.getResource(); + } + else + location = null; + } + + @Override + public void render(float par1) + { + if(isHidden) + return; + if(!base.isArmor){ + if(location != null){ + ClientProxy.bindTexture(location); + base.currentlyPlayerTexture = false; + } + else if(!base.currentlyPlayerTexture){ + ClientProxy.bindTexture(entity.textureLocation); + base.currentlyPlayerTexture = true; + } + } + boolean bo = entity.hurtTime <= 0 && entity.deathTime <= 0; + if(bo){ + float red = (color >> 16 & 255) / 255f; + float green = (color >> 8 & 255) / 255f; + float blue = (color & 255) / 255f; + GL11.glColor4f(red, green, blue, base.alpha); + } + super.render(par1); + if(bo){ + GL11.glColor4f(1, 1, 1, base.alpha); + } + } + +} diff --git a/src/main/java/noppes/npcs/client/model/part/ModelWings.java b/src/main/java/noppes/npcs/client/model/part/ModelWings.java new file mode 100644 index 000000000..511038fba --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/part/ModelWings.java @@ -0,0 +1,78 @@ +package noppes.npcs.client.model.part; + +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import noppes.npcs.ModelData; +import noppes.npcs.ModelPartData; +import noppes.npcs.client.model.ModelMPM; +import noppes.npcs.client.model.util.Model2DRenderer; +import noppes.npcs.client.model.util.ModelPartInterface; + +public class ModelWings extends ModelPartInterface { + + private Model2DRenderer lWing; + private Model2DRenderer rWing; + + public ModelWings(ModelMPM base) { + super(base); + + lWing = new Model2DRenderer(base, 56, 16, 8, 16, 64, 32); + lWing.mirror = true; + lWing.setRotationPoint(2F, 4, 2F); + lWing.setRotationOffset(-16, -12); + setRotation(lWing, 0.7141593F, -0.5235988F, -0.5090659F); + this.addChild(lWing); + + rWing = new Model2DRenderer(base, 56, 16, 8, 16, 64, 32); + rWing.setRotationPoint(-2F, 4F, 2F); + rWing.setRotationOffset(-16, -12); + setRotation(rWing, 0.7141593F, 0.5235988F, 0.5090659F); + this.addChild(rWing); + } + + @Override + public void setRotationAngles(float par1, float par2, float par3, + float par4, float par5, float par6, Entity entity) { + rWing.rotateAngleX = 0.7141593F; + rWing.rotateAngleZ = 0.5090659F; + + lWing.rotateAngleX = 0.7141593F; + lWing.rotateAngleZ = -0.5090659F; + + float motion = Math.abs(MathHelper.sin(par1 * 0.033F + (float)Math.PI) * 0.4F) * par2; + if(!entity.onGround || motion > 0.01){ + float speed = (float) (0.55f + 0.5f * motion); + float y = MathHelper.sin(par3 * 0.67F); + + rWing.rotateAngleZ += y * 0.5f * speed; + rWing.rotateAngleX += y * 0.5f * speed; + + lWing.rotateAngleZ -= y * 0.5f * speed; + lWing.rotateAngleX += y * 0.5f * speed; + } + else{ + lWing.rotateAngleZ += MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; + rWing.rotateAngleZ -= MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; + lWing.rotateAngleX += MathHelper.sin(par3 * 0.067F) * 0.05F; + rWing.rotateAngleX += MathHelper.sin(par3 * 0.067F) * 0.05F; + } + } + + @Override + public void initData(ModelData data) { + ModelPartData config = data.getPartData("wings"); + if(config == null) + { + isHidden = true; + return; + } + color = config.color; + isHidden = false; + if(!config.playerTexture){ + location = config.getResource(); + } + else + location = null; + } +} diff --git a/src/main/java/noppes/npcs/client/model/part/legs/ModelDigitigradeLegs.java b/src/main/java/noppes/npcs/client/model/part/legs/ModelDigitigradeLegs.java new file mode 100644 index 000000000..6f02c6086 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/part/legs/ModelDigitigradeLegs.java @@ -0,0 +1,101 @@ +package noppes.npcs.client.model.part.legs; + +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; +import noppes.npcs.client.model.ModelMPM; + +public class ModelDigitigradeLegs extends ModelRenderer { + + private ModelRenderer rightleg; + private ModelRenderer rightleg2; + private ModelRenderer rightleglow; + private ModelRenderer rightfoot; + private ModelRenderer leftleg; + private ModelRenderer leftleg2; + private ModelRenderer leftleglow; + private ModelRenderer leftfoot; + + public boolean isRiding = false; + public boolean isSneaking = false; + public boolean isSleeping = false; + public boolean isCrawling = false; + + private ModelMPM base; + + public ModelDigitigradeLegs(ModelMPM base) { + super(base); + this.base = base; + rightleg = new ModelRenderer(base, 0, 16); + rightleg.addBox(-2F, 0F, -2F, 4, 6, 4); + rightleg.setRotationPoint(-2.1F, 11F, 0F); + setRotation(rightleg, -0.3F, 0F, 0F); + this.addChild(rightleg); + + rightleg2 = new ModelRenderer(base, 0, 20); + rightleg2.addBox(-1.5F, -1F, -2F, 3, 7, 3); + rightleg2.setRotationPoint(0F, 4.1F, 0F); + setRotation(rightleg2, 1.1f, 0F, 0F); + rightleg.addChild(rightleg2); + + rightleglow = new ModelRenderer(base, 0, 24); + rightleglow.addBox(-1.5F, 0F, -1F, 3, 5, 2); + rightleglow.setRotationPoint(0F, 5F, 0F); + setRotation(rightleglow, -1.35F, 0F, 0F); + rightleg2.addChild(rightleglow); + + rightfoot = new ModelRenderer(base, 1, 26); + rightfoot.addBox(-1.5F, 0F, -5F, 3, 2, 4); + rightfoot.setRotationPoint(0F, 3.7F, 1.2F); + setRotation(rightfoot, 0.55F, 0F, 0F); + rightleglow.addChild(rightfoot); + + leftleg = new ModelRenderer(base, 0, 16); + leftleg.mirror = true; + leftleg.addBox(-2F, 0F, -2F, 4, 6, 4); + leftleg.setRotationPoint(2.1F, 11F, 0F); + setRotation(leftleg, -0.3F, 0F, 0F); + this.addChild(leftleg); + + leftleg2 = new ModelRenderer(base, 0, 20); + leftleg2.mirror = true; + leftleg2.addBox(-1.5F, -1F, -2F, 3, 7, 3); + leftleg2.setRotationPoint(0F, 4.1F, 0F); + setRotation(leftleg2, 1.1f, 0F, 0F); + leftleg.addChild(leftleg2); + + leftleglow = new ModelRenderer(base, 0, 24); + leftleglow.mirror = true; + leftleglow.addBox(-1.5F, 0F, -1F, 3, 5, 2); + leftleglow.setRotationPoint(0F, 5F, 0F); + setRotation(leftleglow, -1.35F, 0F, 0F); + leftleg2.addChild(leftleglow); + + leftfoot = new ModelRenderer(base, 1, 26); + leftfoot.mirror = true; + leftfoot.addBox(-1.5F, 0F, -5F, 3, 2, 4); + leftfoot.setRotationPoint(0F, 3.7F, 1.2F); + setRotation(leftfoot, 0.55F, 0F, 0F); + leftleglow.addChild(leftfoot); + } + + public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity entity) + { + rightleg.rotateAngleX = base.bipedRightLeg.rotateAngleX - 0.3f; + leftleg.rotateAngleX = base.bipedLeftLeg.rotateAngleX - 0.3f; + rightleg.rotationPointY = base.bipedRightLeg.rotationPointY; + leftleg.rotationPointY = base.bipedLeftLeg.rotationPointY; + rightleg.rotationPointZ = base.bipedRightLeg.rotationPointZ; + leftleg.rotationPointZ = base.bipedLeftLeg.rotationPointZ; + if(!base.isSneak){ + leftleg.rotationPointY--; + rightleg.rotationPointY--; + } + + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/noppes/npcs/client/model/part/legs/ModelMermaidLegs.java b/src/main/java/noppes/npcs/client/model/part/legs/ModelMermaidLegs.java new file mode 100644 index 000000000..817709eec --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/part/legs/ModelMermaidLegs.java @@ -0,0 +1,77 @@ +package noppes.npcs.client.model.part.legs; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; + +public class ModelMermaidLegs extends ModelRenderer { + + ModelRenderer top; + ModelRenderer middle; + ModelRenderer bottom; + ModelRenderer fin1; + ModelRenderer fin2; + + public ModelMermaidLegs(ModelBase base) { + super(base); + textureWidth = 64; + textureHeight = 32; + + top = new ModelRenderer(base, 0, 16); + top.addBox(-2F, -2.5F, -2F, 8, 9, 4); + top.setRotationPoint(-2F, 14F, 1F); + setRotation(top, 0.26F, 0F, 0F); + + middle = new ModelRenderer(base, 28, 0); + middle.addBox(0F, 0F, 0F, 7, 6, 4); + middle.setRotationPoint(-1.5F, 6.5F, -1F); + setRotation(middle, 0.86f, 0F, 0F); + top.addChild(middle); + + bottom = new ModelRenderer(base, 24, 16); + bottom.addBox(0F, 0F, 0F, 6, 7, 3); + bottom.setRotationPoint(0.5F, 6F, 0.5f); + setRotation(bottom, 0.15f, 0F, 0F); + middle.addChild(bottom); + + fin1 = new ModelRenderer(base, 0, 0); + fin1.addBox(0F, 0F, 0F, 5, 9, 1); + fin1.setRotationPoint(0F, 4.5F, 1F); + setRotation(fin1, 0.05f, 0, 0.5911399F); + bottom.addChild(fin1); + + fin2 = new ModelRenderer(base, 0, 0); + fin2.mirror = true; + fin2.addBox(-5F, 0F, 0F, 5, 9, 1); + fin2.setRotationPoint(6F, 4.5F, 1F); + setRotation(fin2, 0.05f, 0, -0.591143F); + bottom.addChild(fin2); + + } + + @Override + public void render(float f5) { + if (isHidden || !showModel) + return; + top.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void setRotationAngles(float par1, float par2, float par3, + float par4, float par5, float par6, Entity entity) { + float ani = MathHelper.sin(par1 * 0.6662F); + if(ani > 0.2) + ani /= 3f; + top.rotateAngleX = 0.26F - ani * 0.2F * par2; + middle.rotateAngleX = 0.86f - ani * 0.24F * par2; + bottom.rotateAngleX = 0.15f - ani * 0.28F * par2; + fin2.rotateAngleX = fin1.rotateAngleX = 0.05f - ani * 0.35F * par2; + + } +} diff --git a/src/main/java/noppes/npcs/client/model/part/legs/ModelNagaLegs.java b/src/main/java/noppes/npcs/client/model/part/legs/ModelNagaLegs.java new file mode 100644 index 000000000..238971fd5 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/part/legs/ModelNagaLegs.java @@ -0,0 +1,214 @@ +package noppes.npcs.client.model.part.legs; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; +import noppes.npcs.client.model.util.ModelPlaneRenderer; + +import org.lwjgl.opengl.GL11; + +public class ModelNagaLegs extends ModelRenderer{ + + private ModelRenderer nagaPart1; + private ModelRenderer nagaPart2; + private ModelRenderer nagaPart3; + private ModelRenderer nagaPart4; + private ModelRenderer nagaPart5; + + public boolean isRiding = false; + public boolean isSneaking = false; + public boolean isSleeping = false; + public boolean isCrawling = false; + + public ModelNagaLegs(ModelBase base) { + super(base); + + nagaPart1 = new ModelRenderer(base,0,0); + + ModelRenderer legPart = new ModelRenderer(base,0,16); + legPart.addBox(0, -2, -2, 4, 4, 4); + legPart.setRotationPoint(-4, 0, 0); + nagaPart1.addChild(legPart); + legPart = new ModelRenderer(base,0,16); + legPart.mirror = true; + legPart.addBox(0, -2, -2, 4, 4, 4); + nagaPart1.addChild(legPart); + + nagaPart2 = new ModelRenderer(base,0,0); + nagaPart2.childModels = nagaPart1.childModels; + + nagaPart3 = new ModelRenderer(base,0,0); + + ModelPlaneRenderer plane = new ModelPlaneRenderer(base, 4, 24); + plane.addBackPlane(0,-2, 0, 4, 4); + plane.setRotationPoint(-4, 0, 0); + nagaPart3.addChild(plane); + plane = new ModelPlaneRenderer(base, 4, 24); + plane.mirror = true; + plane.addBackPlane(0,-2, 0, 4, 4); + nagaPart3.addChild(plane); + + plane = new ModelPlaneRenderer(base, 8, 24); + plane.addBackPlane(0,-2, 6, 4, 4); + plane.setRotationPoint(-4, 0, 0); + nagaPart3.addChild(plane); + plane = new ModelPlaneRenderer(base, 8, 24); + plane.mirror = true; + plane.addBackPlane(0,-2, 6, 4, 4); + nagaPart3.addChild(plane); + + plane = new ModelPlaneRenderer(base, 4, 26); + plane.addTopPlane(0,-2, -6, 4, 6); + plane.setRotationPoint(-4, 0, 0); + plane.rotateAngleX = (float) (Math.PI); + nagaPart3.addChild(plane); + plane = new ModelPlaneRenderer(base, 4, 26); + plane.mirror = true; + plane.addTopPlane(0,-2, -6, 4, 6); + plane.rotateAngleX = (float) (Math.PI); + nagaPart3.addChild(plane); + + plane = new ModelPlaneRenderer(base, 8, 26); + plane.addTopPlane(0,-2, 0, 4, 6); + plane.setRotationPoint(-4, 0, 0); + nagaPart3.addChild(plane); + plane = new ModelPlaneRenderer(base, 8, 26); + plane.mirror = true; + plane.addTopPlane(0,-2, 0, 4, 6); + nagaPart3.addChild(plane);; + + plane = new ModelPlaneRenderer(base, 0, 26); + plane.rotateAngleX = (float) (Math.PI / 2); + plane.addSidePlane(0,0, -2, 6, 4); + plane.setRotationPoint(-4, 0, 0); + nagaPart3.addChild(plane); + plane = new ModelPlaneRenderer(base, 0, 26); + plane.rotateAngleX = (float) (Math.PI / 2); + plane.addSidePlane(4,0, -2, 6, 4); + nagaPart3.addChild(plane); + + nagaPart4 = new ModelRenderer(base,0,0); + nagaPart4.childModels = nagaPart3.childModels; + + nagaPart5 = new ModelRenderer(base,0,0); + + legPart = new ModelRenderer(base,56,20); + legPart.addBox(0, 0, -2, 2, 5, 2); + legPart.setRotationPoint(-2, 0, 0); + legPart.rotateAngleX = (float) (Math.PI/2); + nagaPart5.addChild(legPart); + legPart = new ModelRenderer(base,56,20); + legPart.mirror = true; + legPart.addBox(0, 0, -2, 2, 5, 2); + legPart.rotateAngleX = (float) (Math.PI/2); + nagaPart5.addChild(legPart); + + this.addChild(nagaPart1); + this.addChild(nagaPart2); + this.addChild(nagaPart3); + this.addChild(nagaPart4); + this.addChild(nagaPart5); + + nagaPart1.setRotationPoint(0F, 14.0F, 0.0F); + nagaPart2.setRotationPoint(0, 18.0F, 0.6F); + nagaPart3.setRotationPoint(0F, 22.0F, -0.3F); + nagaPart4.setRotationPoint(0F, 22.0F, 5F); + nagaPart5.setRotationPoint(0F, 22.0F, 10F); + } + public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity entity) + { + this.nagaPart1.rotateAngleY = MathHelper.cos(par1 * 0.6662F) * 0.26F * par2; + this.nagaPart2.rotateAngleY = MathHelper.cos(par1 * 0.6662F) * 0.5F * par2; + this.nagaPart3.rotateAngleY = MathHelper.cos(par1 * 0.6662F) * 0.26F * par2; + this.nagaPart4.rotateAngleY = -MathHelper.cos(par1 * 0.6662F) * 0.16F * par2; + this.nagaPart5.rotateAngleY = -MathHelper.cos(par1 * 0.6662F) * 0.3F * par2; + + nagaPart1.setRotationPoint(0F, 14.0F, 0.0F); + nagaPart2.setRotationPoint(0, 18.0F, 0.6F); + nagaPart3.setRotationPoint(0F, 22.0F, -0.3F); + nagaPart4.setRotationPoint(0F, 22.0F, 5F); + nagaPart5.setRotationPoint(0F, 22.0F, 10F); + + nagaPart1.rotateAngleX = 0; + nagaPart2.rotateAngleX = 0; + nagaPart3.rotateAngleX = 0; + nagaPart4.rotateAngleX = 0; + nagaPart5.rotateAngleX = 0; + + if(isSleeping || isCrawling){ + nagaPart3.rotateAngleX = (float) -(Math.PI/2); + nagaPart4.rotateAngleX = (float) -(Math.PI/2); + nagaPart5.rotateAngleX = (float) -(Math.PI/2); + + nagaPart3.rotationPointY -= 2; + nagaPart3.rotationPointZ = 0.9f; + + nagaPart4.rotationPointY += 4; + nagaPart4.rotationPointZ = 0.9f; + + nagaPart5.rotationPointY += 7; + nagaPart5.rotationPointZ = 2.9f; + } + if(this.isRiding){ + nagaPart1.rotationPointY-= 1; + nagaPart1.rotateAngleX = (float) -(Math.PI/16f); + nagaPart1.rotationPointZ = -1; + + nagaPart2.rotationPointY-= 4; + nagaPart2.rotationPointZ = -1; + + nagaPart3.rotationPointY-= 9; + nagaPart3.rotationPointZ -= 1; + nagaPart4.rotationPointY-= 13; + nagaPart4.rotationPointZ -= 1; + nagaPart5.rotationPointY-= 9; + nagaPart5.rotationPointZ -= 1; + if (this.isSneaking){ + nagaPart1.rotationPointZ += 5; + nagaPart3.rotationPointZ += 5; + nagaPart4.rotationPointZ += 5; + nagaPart5.rotationPointZ += 4; + nagaPart1.rotationPointY--; + nagaPart2.rotationPointY--; + nagaPart3.rotationPointY--; + nagaPart4.rotationPointY--; + nagaPart5.rotationPointY--; + } + } + else if (this.isSneaking){ + nagaPart1.rotationPointY--; + nagaPart2.rotationPointY--; + nagaPart3.rotationPointY--; + nagaPart4.rotationPointY--; + nagaPart5.rotationPointY--; + + nagaPart1.rotationPointZ = 5; + nagaPart2.rotationPointZ = 3; + } + } + + @Override + public void render(float par7) + { + if(isHidden || !showModel) + return; + + nagaPart1.render(par7); + nagaPart3.render(par7); + + if(!this.isRiding) + nagaPart2.render(par7); + + GL11.glPushMatrix(); + GL11.glScalef(0.74f, 0.7f,0.85f); + GL11.glTranslatef(nagaPart3.rotateAngleY, 0.66f, 0.06F); + nagaPart4.render(par7); + GL11.glPopMatrix(); + + GL11.glPushMatrix(); + GL11.glTranslatef(nagaPart3.rotateAngleY + nagaPart4.rotateAngleY, 0, 0); + nagaPart5.render(par7); + GL11.glPopMatrix(); + } +} diff --git a/src/main/java/noppes/npcs/client/model/part/tails/ModelDragonTail.java b/src/main/java/noppes/npcs/client/model/part/tails/ModelDragonTail.java new file mode 100644 index 000000000..ee356aaba --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/part/tails/ModelDragonTail.java @@ -0,0 +1,95 @@ +package noppes.npcs.client.model.part.tails; + +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; +import noppes.npcs.client.model.ModelMPM; +import noppes.npcs.client.model.util.ModelPlaneRenderer; + +public class ModelDragonTail extends ModelRenderer { + + public ModelDragonTail(ModelMPM base) { + super(base); + + int x = 52; + int y = 16; + + ModelRenderer dragon = new ModelRenderer(base, x, y); + dragon.setRotationPoint(0F, 0F, 3F); + this.addChild(dragon); + + ModelRenderer DragonTail2 = new ModelRenderer(base, x, y); + DragonTail2.setRotationPoint(0F, 2F, 2F); + + ModelRenderer DragonTail3 = new ModelRenderer(base, x, y); + DragonTail3.setRotationPoint(0F, 4.5F, 4F); + + ModelRenderer DragonTail4 = new ModelRenderer(base, x, y); + DragonTail4.setRotationPoint(0F, 7F, 5.75F); + + ModelRenderer DragonTail5 = new ModelRenderer(base, x, y); + DragonTail5.setRotationPoint(0F, 9F, 8F); + + ModelPlaneRenderer planeLeft = new ModelPlaneRenderer(base, x, y); + planeLeft.addSidePlane(-1.5F, -1.5F, -1.5F, 3, 3); + ModelPlaneRenderer planeRight = new ModelPlaneRenderer(base, x, y); + planeRight.addSidePlane(-1.5F, -1.5F, -1.5F, 3, 3); + setRotation(planeRight, (float)Math.PI, (float)Math.PI ,0); + + ModelPlaneRenderer planeTop = new ModelPlaneRenderer(base, x, y); + planeTop.addTopPlane(-1.5F, -1.5F, -1.5F, 3, 3); + setRotation(planeTop, 0 ,-(float)Math.PI / 2,0); + ModelPlaneRenderer planeBottom = new ModelPlaneRenderer(base, x, y); + planeBottom.addTopPlane(-1.5F, -1.5F, -1.5F, 3, 3); + setRotation(planeBottom, 0 ,-(float)Math.PI / 2, (float)Math.PI); + + ModelPlaneRenderer planeBack = new ModelPlaneRenderer(base, x, y); + planeBack.addBackPlane(-1.5F, -1.5F, -1.5F, 3, 3); + setRotation(planeBack, 0, 0 ,(float)Math.PI / 2); + ModelPlaneRenderer planeFront = new ModelPlaneRenderer(base, x, y); + planeFront.addBackPlane(-1.5F, -1.5F, -1.5F, 3, 3); + setRotation(planeFront, 0, (float)Math.PI ,-(float)Math.PI / 2); + + dragon.addChild(planeLeft); + dragon.addChild(planeRight); + dragon.addChild(planeTop); + dragon.addChild(planeBottom); + dragon.addChild(planeFront); + dragon.addChild(planeBack); + + DragonTail2.addChild(planeLeft); + DragonTail2.addChild(planeRight); + DragonTail2.addChild(planeTop); + DragonTail2.addChild(planeBottom); + DragonTail2.addChild(planeFront); + DragonTail2.addChild(planeBack); + + DragonTail3.addChild(planeLeft); + DragonTail3.addChild(planeRight); + DragonTail3.addChild(planeTop); + DragonTail3.addChild(planeBottom); + DragonTail3.addChild(planeFront); + DragonTail3.addChild(planeBack); + + DragonTail4.addChild(planeLeft); + DragonTail4.addChild(planeRight); + DragonTail4.addChild(planeTop); + DragonTail4.addChild(planeBottom); + DragonTail4.addChild(planeFront); + DragonTail4.addChild(planeBack); + + dragon.addChild(DragonTail2); + dragon.addChild(DragonTail3); + dragon.addChild(DragonTail4); + } + + public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity entity) + { + + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/noppes/npcs/client/model/part/tails/ModelSquirrelTail.java b/src/main/java/noppes/npcs/client/model/part/tails/ModelSquirrelTail.java new file mode 100644 index 000000000..fbd72b42d --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/part/tails/ModelSquirrelTail.java @@ -0,0 +1,59 @@ +package noppes.npcs.client.model.part.tails; + +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; +import noppes.npcs.client.model.ModelMPM; + +public class ModelSquirrelTail extends ModelRenderer { + + private ModelMPM base; + + public ModelSquirrelTail(ModelMPM base) { + super(base); + this.base = base; + + textureWidth = 64; + textureHeight = 32; + + ModelRenderer Shape1 = new ModelRenderer(base, 0, 0); + Shape1.addBox(-1F, -1F, -1F, 2, 2, 3); + Shape1.setRotationPoint(0F, -1F, 3F); + setRotation(Shape1, 0F, 0F, 0F); + this.addChild(Shape1); + + ModelRenderer Shape2 = new ModelRenderer(base, 0, 9); + Shape2.addBox(-2F, -5F, -1F, 4, 5, 3); + Shape2.setRotationPoint(0F, 0F, 1F); + setRotation(Shape2, -0.37F, 0F, 0F); + Shape1.addChild(Shape2); + + ModelRenderer Shape3 = new ModelRenderer(base, 0, 18); + Shape3.addBox(-2.466667F, -6F, -1F, 5, 7, 3); + Shape3.setRotationPoint(0F, -5F, 0F); + setRotation(Shape3, 0.3f, 0F, 0F); + Shape2.addChild(Shape3); + + ModelRenderer Shape4 = new ModelRenderer(base, 25, 0); + Shape4.addBox(-3F, -0.6F, -1F, 6, 5, 3); + Shape4.setRotationPoint(0F, -5F, 1F); + setRotation(Shape4, 2.5F, 0F, 0F); + Shape3.addChild(Shape4); + + ModelRenderer Shape5 = new ModelRenderer(base, 25, 10); + Shape5.addBox(-3F, -2F, -1F, 6, 3, 5); + Shape5.setRotationPoint(0F, 3.5F, 0F); + setRotation(Shape5, -2.5F, 0F, 0F); + Shape4.addChild(Shape5); + } + + public void setRotationAngles(float par1, float par2, float par3, + float par4, float par5, float par6, Entity entity) { + + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/noppes/npcs/client/model/util/Model2DRenderer.java b/src/main/java/noppes/npcs/client/model/util/Model2DRenderer.java new file mode 100644 index 000000000..264fa1ccf --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/util/Model2DRenderer.java @@ -0,0 +1,93 @@ +package noppes.npcs.client.model.util; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.client.renderer.GLAllocation; +import net.minecraft.client.renderer.ItemRenderer; +import net.minecraft.client.renderer.Tessellator; + +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class Model2DRenderer extends ModelRenderer { + + private boolean compiled; + + private int displayList; + + private float x1, x2, y1, y2; + private int width, height; + private float rotationOffsetX, rotationOffsetY; + + private float scaleX = 1, scaleY = 1, thickness = 1; + + public Model2DRenderer(ModelBase par1ModelBase, float x, float y, int width, int height, float textureWidth, float textureHeight) { + super(par1ModelBase); + this.width = width; + this.height = height; + this.textureWidth = textureWidth; + this.textureHeight = textureHeight; + + x1 = x / textureWidth; + y1 = y / textureHeight; + + x2 = (x + width) / textureWidth; + y2 = (y + height) / textureHeight; + } + + public Model2DRenderer(ModelBase base, int x, int y, int width, int height) { + this(base, x, y, width, height, width, height); + } + + public void render(float par1) { + if(!showModel || isHidden) + return; + if(!compiled) + compileDisplayList(par1); + + GL11.glPushMatrix(); + this.postRender(par1); + + GL11.glCallList(this.displayList); + GL11.glPopMatrix(); + } + + public void setRotationOffset(float x, float y){ + rotationOffsetX = x; + rotationOffsetY = y; + } + + public void setScale(float scale){ + this.scaleX = scale; + this.scaleY = scale; + } + public void setScale(float x, float y){ + this.scaleX = x; + this.scaleY = y; + } + + public void setThickness(float thickness) { + this.thickness = thickness; + } + @SideOnly(Side.CLIENT) + private void compileDisplayList(float par1) + { + this.displayList = GLAllocation.generateDisplayLists(1); + GL11.glNewList(this.displayList, GL11.GL_COMPILE); + + GL11.glScalef(scaleX * width / height, scaleY, thickness); + GL11.glRotatef(180, 1F, 0F, 0F); + if(mirror){ + GL11.glTranslatef(0, 0, -1f * par1); + GL11.glRotatef(180, 0, 1F, 0F); + } + + GL11.glTranslated( rotationOffsetX * par1, rotationOffsetY * par1, 0); + ItemRenderer.renderItemIn2D(Tessellator.instance, x1, y1, x2, y2, width, height, par1); + + GL11.glEndList(); + this.compiled = true; + } +} diff --git a/src/main/java/noppes/npcs/client/model/util/ModelPartInterface.java b/src/main/java/noppes/npcs/client/model/util/ModelPartInterface.java new file mode 100644 index 000000000..f9e7db40c --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/util/ModelPartInterface.java @@ -0,0 +1,80 @@ +package noppes.npcs.client.model.util; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.ResourceLocation; +import noppes.npcs.ModelData; +import noppes.npcs.ModelPartData; +import noppes.npcs.client.ClientProxy; +import noppes.npcs.client.model.ModelMPM; +import noppes.npcs.entity.EntityCustomNpc; + +import org.lwjgl.opengl.GL11; + +public abstract class ModelPartInterface extends ModelRenderer { + + public ModelData data; + private EntityCustomNpc entity; + public float scale = 1; + protected ResourceLocation location; + public int color = 0xFFFFFF; + + public ModelMPM base; + + public ModelPartInterface(ModelMPM par1ModelBase) { + super(par1ModelBase); + this.base = par1ModelBase; + this.setTextureSize(0, 0); + } + + public void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void setRotationAngles(float par1, float par2, float par3, + float par4, float par5, float par6, Entity entity) { + } + + public void setLivingAnimations(ModelPartData data, + EntityLivingBase entityliving, float f, float f1, float f2) { + } + + public void setData(ModelData data, EntityCustomNpc entity) { + this.data = data; + this.entity = entity; + initData(data); + } + + public void render(float par1) + { + if(!base.isArmor){ + if(location != null){ + ClientProxy.bindTexture(location); + base.currentlyPlayerTexture = false; + } + else if(!base.currentlyPlayerTexture){ + ClientProxy.bindTexture(entity.textureLocation); + base.currentlyPlayerTexture = true; + } + } + boolean bo = entity.hurtTime <= 0 && entity.deathTime <= 0 && !base.isArmor; + if(bo){ + float red = (color >> 16 & 255) / 255f; + float green = (color >> 8 & 255) / 255f; + float blue = (color & 255) / 255f; + GL11.glColor4f(red, green, blue, base.alpha); + } + super.render(par1); + if(bo){ + GL11.glColor4f(1, 1, 1, base.alpha); + } + } + public abstract void initData(ModelData data); + + +} diff --git a/src/main/java/noppes/npcs/client/model/util/ModelPlane.java b/src/main/java/noppes/npcs/client/model/util/ModelPlane.java new file mode 100644 index 000000000..bf2522b77 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/util/ModelPlane.java @@ -0,0 +1,75 @@ +package noppes.npcs.client.model.util; + +import net.minecraft.client.model.ModelBox; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.client.model.PositionTextureVertex; +import net.minecraft.client.model.TexturedQuad; +import net.minecraft.client.renderer.Tessellator; +import noppes.npcs.client.renderer.EnumPlanePosition; + +public class ModelPlane extends ModelBox{ + + private PositionTextureVertex[] vertexPositions; + private TexturedQuad quad; + + public ModelPlane(ModelRenderer par1ModelRenderer, int textureOffsetX, int textureOffsetY, float par4, float par5, float par6, + int par7, int par8, int par9, float par10, EnumPlanePosition position) { + super(par1ModelRenderer, textureOffsetX, textureOffsetY, par4, par5, par6, par7, par8, par9, par10); + + this.vertexPositions = new PositionTextureVertex[8]; + float var11 = par4 + (float)par7; + float var12 = par5 + (float)par8; + float var13 = par6 + (float)par9; + par4 -= par10; + par5 -= par10; + par6 -= par10; + var11 += par10; + var12 += par10; + var13 += par10; + + if (par1ModelRenderer.mirror) + { + float var14 = var11; + var11 = par4; + par4 = var14; + } + + PositionTextureVertex var23 = new PositionTextureVertex(par4, par5, par6, 0.0F, 0.0F); + PositionTextureVertex var15 = new PositionTextureVertex(var11, par5, par6, 0.0F, 8.0F); + PositionTextureVertex var16 = new PositionTextureVertex(var11, var12, par6, 8.0F, 8.0F); + PositionTextureVertex var17 = new PositionTextureVertex(par4, var12, par6, 8.0F, 0.0F); + PositionTextureVertex var18 = new PositionTextureVertex(par4, par5, var13, 0.0F, 0.0F); + PositionTextureVertex var19 = new PositionTextureVertex(var11, par5, var13, 0.0F, 8.0F); + PositionTextureVertex var20 = new PositionTextureVertex(var11, var12, var13, 8.0F, 8.0F); + PositionTextureVertex var21 = new PositionTextureVertex(par4, var12, var13, 8.0F, 0.0F); + this.vertexPositions[0] = var23; + this.vertexPositions[1] = var15; + this.vertexPositions[2] = var16; + this.vertexPositions[3] = var17; + this.vertexPositions[4] = var18; + this.vertexPositions[5] = var19; + this.vertexPositions[6] = var20; + this.vertexPositions[7] = var21; + + if(position == EnumPlanePosition.LEFT) + this.quad = new TexturedQuad(new PositionTextureVertex[] {var19, var15, var16, var20}, textureOffsetX, textureOffsetY, textureOffsetX + par9, textureOffsetY + par8, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight); + //this.quad = new TexturedQuad(new PositionTextureVertex[] {var23, var18, var21, var17}, textureOffsetX, textureOffsetY + par9, textureOffsetX + par9, textureOffsetY + par9 + par8, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight); + + if(position == EnumPlanePosition.TOP) + this.quad = new TexturedQuad(new PositionTextureVertex[] {var19, var18, var23, var15}, textureOffsetX, textureOffsetY, textureOffsetX + par7, textureOffsetY + par9, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight); + //this.quad = new TexturedQuad(new PositionTextureVertex[] {var16, var17, var21, var20}, textureOffsetX + par9 + par7, textureOffsetY + par9, textureOffsetX + par9 + par7 + par7, textureOffsetY, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight); + + if(position == EnumPlanePosition.BACK) + this.quad = new TexturedQuad(new PositionTextureVertex[] {var15, var23, var17, var16}, textureOffsetX, textureOffsetY, textureOffsetX + par7, textureOffsetY + par8, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight); + //this.quad = new TexturedQuad(new PositionTextureVertex[] {var18, var19, var20, var21}, textureOffsetX + par9 + par7, textureOffsetY + par9, textureOffsetX + par9 + par7 + par7, textureOffsetY + par9 + par8, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight); + + if (par1ModelRenderer.mirror) + quad.flipFace(); + } + + @Override + public void render(Tessellator par1Tessellator, float par2) + { + quad.draw(par1Tessellator, par2); + } +} diff --git a/src/main/java/noppes/npcs/client/model/util/ModelPlaneRenderer.java b/src/main/java/noppes/npcs/client/model/util/ModelPlaneRenderer.java new file mode 100644 index 000000000..f3353b8a9 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/util/ModelPlaneRenderer.java @@ -0,0 +1,53 @@ +package noppes.npcs.client.model.util; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import noppes.npcs.client.renderer.EnumPlanePosition; + +public class ModelPlaneRenderer extends ModelRenderer +{ + + private int textureOffsetX; + private int textureOffsetY; + + public ModelPlaneRenderer(ModelBase modelbase, int i, int j) + { + super(modelbase, i, j); + textureOffsetX = i; + textureOffsetY = j; + } + + public void addBackPlane(float f, float f1, float f2, int i, int j) + { + addPlane(f, f1, f2, i, j, 0, 0.0F,EnumPlanePosition.BACK); + } + + public void addSidePlane(float f, float f1, float f2, int j, int k) + { + addPlane(f, f1, f2, 0, j, k, 0.0F,EnumPlanePosition.LEFT); + } + + public void addTopPlane(float f, float f1, float f2, int i, int k) + { + addPlane(f, f1, f2, i, 0, k, 0.0F,EnumPlanePosition.TOP); + } + + public void addBackPlane(float f, float f1, float f2, int i, int j, float scale) + { + addPlane(f, f1, f2, i, j, 0, scale,EnumPlanePosition.BACK); + } + + public void addSidePlane(float f, float f1, float f2, int j, int k, float scale) + { + addPlane(f, f1, f2, 0, j, k, scale,EnumPlanePosition.LEFT); + } + + public void addTopPlane(float f, float f1, float f2, int i, int k, float scale) + { + addPlane(f, f1, f2, i, 0, k, scale,EnumPlanePosition.TOP); + } + + public void addPlane(float par1, float par2, float par3, int par4, int par5, int par6, float f3,EnumPlanePosition pos){ + this.cubeList.add(new ModelPlane(this, this.textureOffsetX, this.textureOffsetY, par1, par2, par3, par4, par5, par6, f3,pos)); + } +} diff --git a/src/main/java/noppes/npcs/client/model/util/ModelRenderPassHelper.java b/src/main/java/noppes/npcs/client/model/util/ModelRenderPassHelper.java new file mode 100644 index 000000000..ce027f32f --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/util/ModelRenderPassHelper.java @@ -0,0 +1,26 @@ +package noppes.npcs.client.model.util; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.renderer.entity.NPCRendererHelper; +import net.minecraft.client.renderer.entity.RendererLivingEntity; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.init.Blocks; + +public class ModelRenderPassHelper extends ModelBase{ + + public RendererLivingEntity renderer; + public EntityLivingBase entity; + + public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) { + ModelBase model = NPCRendererHelper.getPassModel(renderer); + model.isChild = isChild; + model.render(entity, par2, par3, par4, par5, par6, par7); + } + + public void setLivingAnimations(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4) { + ModelBase model = NPCRendererHelper.getPassModel(renderer); + model.isChild = isChild; + model.setLivingAnimations(entity, par2, par3, par4); + } +} diff --git a/src/main/java/noppes/npcs/client/model/util/ModelScaleRenderer.java b/src/main/java/noppes/npcs/client/model/util/ModelScaleRenderer.java new file mode 100644 index 000000000..f8edf5aec --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/util/ModelScaleRenderer.java @@ -0,0 +1,126 @@ +package noppes.npcs.client.model.util; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelBox; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.client.renderer.GLAllocation; +import net.minecraft.client.renderer.Tessellator; +import noppes.npcs.ModelPartConfig; + +import org.lwjgl.opengl.GL11; + +public class ModelScaleRenderer extends ModelRenderer { + + public boolean compiled; + + /** The GL display list rendered by the Tessellator for this model */ + public int displayList; + + protected ModelPartConfig config; + + public float x, y, z; + + public ModelScaleRenderer(ModelBase par1ModelBase) { + super(par1ModelBase); + } + public ModelScaleRenderer(ModelBase par1ModelBase, int par2, int par3) + { + this(par1ModelBase); + this.setTextureOffset(par2, par3); + } + + public void setConfig(ModelPartConfig config, float x, float y, float z){ + this.config = config; + this.x = x; + this.y = y; + this.z = z; + } + + public void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void renderChilderen(float par1) + { + if(!showModel || isHidden) + return; + if(!compiled) + compileDisplayList(par1); + GL11.glPushMatrix(); + GL11.glTranslatef(x, y, z); + if(config != null) + GL11.glTranslatef(config.transX, config.transY, config.transZ); + this.postRender(par1); + if(config != null) + GL11.glScalef(config.scaleX, config.scaleY, config.scaleZ); + GL11.glCallList(this.displayList); + if (this.childModels != null) + { + for (int i = 0; i < this.childModels.size(); ++i) + { + ((ModelRenderer)this.childModels.get(i)).render(par1); + } + } + GL11.glPopMatrix(); + } + public void renderChild(float par1, ModelRenderer model) + { + if(!showModel || isHidden) + return; + GL11.glPushMatrix(); + GL11.glTranslatef(x, y, z); + if(config != null) + GL11.glTranslatef(config.transX, config.transY, config.transZ); + this.postRender(par1); + if(config != null) + GL11.glScalef(config.scaleX, config.scaleY, config.scaleZ); + model.render(par1); + GL11.glPopMatrix(); + + } + + public void render(float par1) + { + if(!showModel || isHidden) + return; + if(!compiled) + compileDisplayList(par1); + GL11.glPushMatrix(); + GL11.glTranslatef(x, y, z); + if(config != null) + GL11.glTranslatef(config.transX, config.transY, config.transZ); + this.postRender(par1); + if(config != null) + GL11.glScalef(config.scaleX, config.scaleY, config.scaleZ); + GL11.glCallList(this.displayList); + if (this.childModels != null) + { + for (int i = 0; i < this.childModels.size(); ++i) + { + ((ModelRenderer)this.childModels.get(i)).render(par1); + } + } + GL11.glPopMatrix(); + } + public void parentRender(float par1){ + super.render(par1); + } + + public void compileDisplayList(float par1) + { + this.displayList = GLAllocation.generateDisplayLists(1); + GL11.glNewList(this.displayList, GL11.GL_COMPILE); + Tessellator tessellator = Tessellator.instance; + + for (int i = 0; i < this.cubeList.size(); ++i) + { + ((ModelBox)this.cubeList.get(i)).render(tessellator, par1); + } + + GL11.glEndList(); + this.compiled = true; + } + +} diff --git a/src/main/java/noppes/npcs/client/renderer/EnumPlanePosition.java b/src/main/java/noppes/npcs/client/renderer/EnumPlanePosition.java new file mode 100644 index 000000000..98f5b0043 --- /dev/null +++ b/src/main/java/noppes/npcs/client/renderer/EnumPlanePosition.java @@ -0,0 +1,5 @@ +package noppes.npcs.client.renderer; + +public enum EnumPlanePosition { +TOP,BOTTOM,RIGHT,LEFT,FRONT,BACK +} diff --git a/src/main/java/noppes/npcs/client/renderer/ImageBufferDownloadAlt.java b/src/main/java/noppes/npcs/client/renderer/ImageBufferDownloadAlt.java new file mode 100644 index 000000000..9c4091dd8 --- /dev/null +++ b/src/main/java/noppes/npcs/client/renderer/ImageBufferDownloadAlt.java @@ -0,0 +1,255 @@ +package noppes.npcs.client.renderer; + +import java.awt.Graphics; +import java.awt.image.BufferedImage; +import java.awt.image.DataBufferInt; + +import net.minecraft.client.renderer.ImageBufferDownload; + +public class ImageBufferDownloadAlt extends ImageBufferDownload +{ + private int imageData[]; + private int imageWidth; + private int imageHeight; + + @Override + public BufferedImage parseUserSkin(BufferedImage bufferedimage) + { + imageWidth = bufferedimage.getWidth(null); + imageHeight = imageWidth / 2; + + BufferedImage bufferedimage1 = new BufferedImage(imageWidth, imageHeight, 2); + Graphics g = bufferedimage1.getGraphics(); + g.drawImage(bufferedimage, 0, 0, null); + g.dispose(); + imageData = ((DataBufferInt)bufferedimage1.getRaster().getDataBuffer()).getData(); + setAreaTransparent(imageWidth / 2, 0, imageWidth, imageHeight / 2); + return bufferedimage1; + } + /** + * Makes the given area of the image transparent if it was previously completely opaque (used to remove the outer + * layer of a skin around the head if it was saved all opaque; this would be redundant so it's assumed that the skin + * maker is just using an image editor without an alpha channel) + */ + private void setAreaTransparent(int par1, int par2, int par3, int par4) + { + if (!this.hasTransparency(par1, par2, par3, par4)) + { + for (int i1 = par1; i1 < par3; ++i1) + { + for (int j1 = par2; j1 < par4; ++j1) + { + this.imageData[i1 + j1 * this.imageWidth] &= 16777215; + } + } + } + } + + /** + * Returns true if the given area of the image contains transparent pixels + */ + private boolean hasTransparency(int par1, int par2, int par3, int par4) + { + for (int i1 = par1; i1 < par3; ++i1) + { + for (int j1 = par2; j1 < par4; ++j1) + { + int k1 = this.imageData[i1 + j1 * this.imageWidth]; + + if ((k1 >> 24 & 255) < 128) + { + return true; + } + } + } + + return false; + } +// +// private boolean loadPlayerData(BufferedImage bufferedimage,EntityPlayer player) { +// if(player == null) +// return false; +// PlayerData data = RenderMorePlayer.getPlayerData(player); +// data.setPlayerModel(checkSkin(bufferedimage,player.username)); +// data.isChanged = true; +// return data.model != null; +// } +// public static ModelData checkSkin(BufferedImage bufferedimage,String player){ +// if(bufferedimage == null) +// return null; +// +// if (!new Color(bufferedimage.getRGB(0, 0), true).equals(new Color(128, 128, 128, 255))) { +// return null; +// } +// ModelData data = new ModelData(); +// Color type = new Color(bufferedimage.getRGB(1, 0), true); +// if (type.equals(new Color(255, 0, 255, 255))) { +// data.type = EnumPlayerModelType.HUMANFEMALE; +// data.mainModel = new ModelHumanFemale(data,0); +// data.modelArmor = new ModelHumanFemale(data,0.3f); +// data.modelArmorChestplate = new ModelHumanFemale(data,0.8f); +// data.scaleX = 0.9075f; +// data.scaleY = 0.9075f; +// data.scaleZ = 0.9075f; +// } else if (type.equals(new Color(128, 0, 0, 255))) { +// data.type = EnumPlayerModelType.DWARFMALE; +// data.mainModel = new ModelDwarfMale(data,0); +// data.modelArmor = new ModelDwarfMale(data,0.3f); +// data.modelArmorChestplate = new ModelDwarfMale(data,0.8f); +// data.scaleX = 0.85f; +// data.scaleY = 0.6875f; +// data.scaleZ = 0.85f; +// } else if (type.equals(new Color(255, 0, 0, 255))) { +// data.type = EnumPlayerModelType.DWARFFEMALE; +// data.mainModel = new ModelDwarfFemale(data,0); +// data.modelArmor = new ModelDwarfFemale(data,0.3f); +// data.modelArmorChestplate = new ModelDwarfFemale(data,0.8f); +// data.scaleX = 0.75f; +// data.scaleY = 0.6275f; +// data.scaleZ = 0.75f; +// } else if (type.equals(new Color(0, 128, 0, 255))) { +// data.type = EnumPlayerModelType.ORCMALE; +// data.mainModel = new ModelOrcMale(data,0); +// data.modelArmor = new ModelOrcMale(data,0.3f); +// data.modelArmorChestplate = new ModelOrcMale(data,0.8f); +// data.scaleX = 1.2f; +// data.scaleY = 1f; +// data.scaleZ = 1.2f; +// } else if (type.equals(new Color(0, 255, 0, 255))) { +// data.type = EnumPlayerModelType.ORCFEMALE; +// data.mainModel = new ModelOrcFemale(data,0); +// data.modelArmor = new ModelOrcFemale(data,0.3f); +// data.modelArmorChestplate = new ModelOrcFemale(data,0.8f); +// } else if (type.equals(new Color(0, 0, 128, 255))) { +// data.type = EnumPlayerModelType.FURRYMALE; +// data.mainModel = new ModelFurryMale(data,0); +// data.modelArmor = new ModelFurryMale(data,0.3f); +// data.modelArmorChestplate = new ModelFurryMale(data,0.8f); +// } else if (type.equals(new Color(0, 0, 255, 255))) { +// data.type = EnumPlayerModelType.FURRYFEMALE; +// data.mainModel = new ModelFurryFemale(data,0); +// data.modelArmor = new ModelFurryFemale(data,0.3f); +// data.modelArmorChestplate = new ModelFurryFemale(data,0.8f); +// data.scaleX = 0.9075f; +// data.scaleY = 0.9075f; +// data.scaleZ = 0.9075f; +// }else if (type.equals(new Color(255, 128, 0, 255))) { +// data.type = EnumPlayerModelType.MONSTERMALE; +// data.mainModel = new ModelMonsterMale(data,0); +// data.modelArmor = new ModelMonsterMale(data,0.3f); +// data.modelArmorChestplate = new ModelMonsterMale(data,0.8f); +// } else if (type.equals(new Color(255, 255, 0, 255))) { +// data.type = EnumPlayerModelType.MONSTERFEMALE; +// data.mainModel = new ModelMonsterFemale(data,0); +// data.modelArmor = new ModelMonsterFemale(data,0.3f); +// data.modelArmorChestplate = new ModelMonsterFemale(data,0.8f); +// data.scaleX = 0.9075f; +// data.scaleY = 0.9075f; +// data.scaleZ = 0.9075f; +// }else if (type.equals(new Color(0,255, 128, 255))) { +// data.type = EnumPlayerModelType.ELFMALE; +// data.mainModel = new ModelElfMale(data,0); +// data.modelArmor = new ModelElfMale(data,0.3f); +// data.modelArmorChestplate = new ModelElfMale(data,0.8f); +// data.scaleX = 0.85f; +// data.scaleY = 1.07f; +// data.scaleZ = 0.85f; +// } else if (type.equals(new Color(0, 255, 255, 255))) { +// data.type = EnumPlayerModelType.ELFFEMALE; +// data.mainModel = new ModelElfFemale(data,0); +// data.modelArmor = new ModelElfFemale(data,0.3f); +// data.modelArmorChestplate = new ModelElfFemale(data,0.8f); +// data.scaleX = 0.8f; +// data.scaleY = 1f; +// data.scaleZ = 0.8f; +// } else if (type.equals(new Color(32, 32, 32, 255))) { +// data.type = EnumPlayerModelType.ENDER; +// data.mainModel = new ModelEnderChibi(data,0); +// data.modelArmor = new ModelEnderChibi(data,0.3f); +// data.modelArmorChestplate = new ModelEnderChibi(data,0.8f); +// } +// else if (type.equals(new Color(128, 255, 0, 255))) { +// data.type = EnumPlayerModelType.NAGAMALE; +// data.mainModel = new ModelNagaMale(data,0); +// data.modelArmor = new ModelNagaMale(data,0.3f); +// data.modelArmorChestplate = new ModelNagaMale(data,0.8f); +// } +// else if (type.equals(new Color(128, 128, 0, 255))) { +// data.type = EnumPlayerModelType.NAGAFEMALE; +// data.mainModel = new ModelNagaFemale(data,0); +// data.modelArmor = new ModelNagaFemale(data,0.3f); +// data.modelArmorChestplate = new ModelNagaFemale(data,0.8f); +// } +// else if(RenderMorePlayer.superUsers.contains(player)){ +// if (type.equals(new Color(66, 66, 66, 255))){ +// data.mainModel = new ModelCrystal(data,0); +// data.modelArmor = new ModelCrystal(data,0.3f); +// data.modelArmorChestplate = new ModelCrystal(data,0.8f); +// } +// else if (type.equals(new Color(13, 13, 13, 255))){ +// data.mainModel = new ModelFail(data); +// } +// } +// +// Color sizeColor = new Color(bufferedimage.getRGB(2, 0), true); +// int size = 3; +// if (sizeColor.equals(new Color(255, 0, 0, 255))) +// size = 4; +// else if (sizeColor.equals(new Color(0, 255, 0, 255))) +// size = 2; +// else if (sizeColor.equals(new Color(0, 0, 255, 255))) +// size = 1; +// else if (sizeColor.equals(new Color(255, 0, 255, 255))) +// size = 0; +// data.size = size; +// +// Color headVissible = new Color(bufferedimage.getRGB(3, 0), true); +// if (headVissible.equals(new Color(255, 0, 0, 255))) +// data.showHelmet = false; +// else if (headVissible.equals(new Color(0, 255, 0, 255))) +// data.showHeadwear = false; +// else if (headVissible.equals(new Color(255, 255, 0, 255))){ +// data.showHeadwear = false; +// data.showHelmet = false; +// } +// +// +// int extraOption1 = getValue(new Color(bufferedimage.getRGB(7, 0), true)); +// data.mainModel.setExtraOption1(extraOption1); +// data.modelArmorChestplate.setExtraOption1(extraOption1); +// data.modelArmor.setExtraOption1(extraOption1); +// +// int extraOption2 = getValue(new Color(bufferedimage.getRGB(7, 1), true)); +// data.mainModel.setExtraOption2(extraOption2); +// data.modelArmorChestplate.setExtraOption2(extraOption2); +// data.modelArmor.setExtraOption2(extraOption2); +// +// int extraOption3 = getValue(new Color(bufferedimage.getRGB(7, 2), true)); +// data.mainModel.setExtraOption3(extraOption3); +// data.modelArmorChestplate.setExtraOption3(extraOption3); +// data.modelArmor.setExtraOption3(extraOption3); +// +// Color color = new Color(bufferedimage.getRGB(7, 3), true); +// data.mainModel.setExtraColor(color); +// +// Color claws = new Color(bufferedimage.getRGB(0, 1), true); +// if (claws.equals(new Color(255, 0, 0, 255))) +// ((ModelInterface)data.mainModel).addClaws(); +// +// data.headSize = getValue(new Color(bufferedimage.getRGB(1, 1), true)); +// +// data.bellySize = getValue(new Color(bufferedimage.getRGB(2, 1), true)); +// return data; +// } +// private static int getValue(Color color){ +// if (color.equals(new Color(255, 0, 0, 255))) +// return 1; +// else if (color.equals(new Color(0, 255, 0, 255))) +// return 2; +// else if (color.equals(new Color(0, 0, 255, 255))) +// return 3; +// else if (color.equals(new Color(255, 0, 255, 255))) +// return 4; +// return 0; +// } +} diff --git a/src/main/java/noppes/npcs/client/renderer/NpcItemRenderer.java b/src/main/java/noppes/npcs/client/renderer/NpcItemRenderer.java new file mode 100644 index 000000000..243533499 --- /dev/null +++ b/src/main/java/noppes/npcs/client/renderer/NpcItemRenderer.java @@ -0,0 +1,110 @@ +package noppes.npcs.client.renderer; + +import javax.swing.Icon; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.ItemRenderer; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.IItemRenderer; +import noppes.npcs.items.ItemRenderInterface; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public class NpcItemRenderer implements IItemRenderer { + private static final ResourceLocation enchant = new ResourceLocation("textures/misc/enchanted_item_glint.png"); + + @Override + public boolean handleRenderType(ItemStack item, ItemRenderType type) { + if (type == ItemRenderType.EQUIPPED || type == ItemRenderType.EQUIPPED_FIRST_PERSON) { + return true; + } + return false; + } + + @Override + public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { + return false; + } + + @Override + public void renderItem(ItemRenderType type, ItemStack par2ItemStack, Object... data) { + if (!(par2ItemStack.getItem() instanceof ItemRenderInterface)) + return; + EntityLivingBase par1EntityLiving = (EntityLivingBase) data[1]; + GL11.glTranslatef(0.9375F, 0.0625F, 0.0F); + GL11.glRotatef(-315.0F, 0.0F, 0.0F, 1.0F); + + ((ItemRenderInterface) par2ItemStack.getItem()).renderSpecial(); + GL11.glRotatef(-20.0F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(-50.0F, 0.0F, 1.0F, 0.0F); + GL11.glTranslatef(-0.09375F, 0.0625F, 0.0F); + renderItem3d(par1EntityLiving, par2ItemStack); + } + + public void renderItem3d(EntityLivingBase par1EntityLiving, ItemStack par2ItemStack) { + Minecraft mc = Minecraft.getMinecraft(); + TextureManager texturemanager = mc.getTextureManager(); + int par3 = 0; + texturemanager.bindTexture(texturemanager.getResourceLocation(par2ItemStack.getItemSpriteNumber())); + Tessellator tessellator = Tessellator.instance; + IIcon icon = par1EntityLiving.getItemIcon(par2ItemStack, par3); + + if (icon == null) { + return; + } + float f = icon.getMinU(); + float f1 = icon.getMaxU(); + float f2 = icon.getMinV(); + float f3 = icon.getMaxV(); + float f4 = 0.0F; + float f5 = 0.3F; + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glTranslatef(-f4, -f5, 0.0F); + float f6 = 1.5F; + GL11.glScalef(f6, f6, f6); + GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F); + GL11.glTranslatef(-0.9375F, -0.0625F, 0.0F); + ItemRenderer.renderItemIn2D(tessellator, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 0.0625F); + + if (par2ItemStack.hasEffect(par3)) { + GL11.glDepthFunc(GL11.GL_EQUAL); + GL11.glDisable(GL11.GL_LIGHTING); + texturemanager.bindTexture(enchant); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); + float f7 = 0.76F; + GL11.glColor4f(0.5F * f7, 0.25F * f7, 0.8F * f7, 1.0F); + GL11.glMatrixMode(GL11.GL_TEXTURE); + GL11.glPushMatrix(); + float f8 = 0.125F; + GL11.glScalef(f8, f8, f8); + float f9 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F; + GL11.glTranslatef(f9, 0.0F, 0.0F); + GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F); + ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F); + GL11.glPopMatrix(); + GL11.glPushMatrix(); + GL11.glScalef(f8, f8, f8); + f9 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F; + GL11.glTranslatef(-f9, 0.0F, 0.0F); + GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F); + ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F); + GL11.glPopMatrix(); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glDisable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glDepthFunc(GL11.GL_LEQUAL); + } + + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + } + +} diff --git a/src/main/java/noppes/npcs/client/renderer/RenderCustomNpc.java b/src/main/java/noppes/npcs/client/renderer/RenderCustomNpc.java new file mode 100644 index 000000000..3d390b075 --- /dev/null +++ b/src/main/java/noppes/npcs/client/renderer/RenderCustomNpc.java @@ -0,0 +1,116 @@ +package noppes.npcs.client.renderer; + +import java.lang.reflect.Method; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.renderer.entity.NPCRendererHelper; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.client.renderer.entity.RendererLivingEntity; +import net.minecraft.entity.EntityList; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import noppes.npcs.client.model.ModelMPM; +import noppes.npcs.client.model.util.ModelRenderPassHelper; +import noppes.npcs.controllers.PixelmonHelper; +import noppes.npcs.entity.EntityCustomNpc; +import noppes.npcs.entity.EntityNPCInterface; + +import org.lwjgl.opengl.GL11; + +public class RenderCustomNpc extends RenderNPCHumanMale{ + + private RendererLivingEntity renderEntity; + private EntityLivingBase entity; + + private ModelRenderPassHelper renderpass = new ModelRenderPassHelper(); + + public RenderCustomNpc() { + super(new ModelMPM(0), new ModelMPM(1), new ModelMPM(0.5f)); + } + + @Override + public void renderPlayer(EntityNPCInterface npcInterface, double d, double d1, double d2, float f, float f1){ + EntityCustomNpc npc = (EntityCustomNpc) npcInterface; + entity = npc.modelData.getEntity(npc); + ModelBase model = null; + renderEntity = null; + if(entity != null){ + renderEntity = (RendererLivingEntity) RenderManager.instance.getEntityRenderObject(entity); + model = NPCRendererHelper.getMainModel(renderEntity); + if(PixelmonHelper.isPixelmon(entity)){ + try { + Class c = Class.forName("com.pixelmonmod.pixelmon.entities.pixelmon.Entity2HasModel"); + Method m = c.getMethod("getModel"); + model = (ModelBase) m.invoke(entity); + } catch (Exception e) { + e.printStackTrace(); + } + } + if(EntityList.getEntityString(entity).equals("doggystyle.Dog")){ + try { + Method m = entity.getClass().getMethod("getBreed"); + Object breed = m.invoke(entity); + m = breed.getClass().getMethod("getModel"); + model = (ModelBase) m.invoke(breed); + model.getClass().getMethod("setPosition", int.class).invoke(model, 0); + } catch (Exception e) { + e.printStackTrace(); + } + } + renderPassModel = renderpass; + renderpass.renderer = renderEntity; + renderpass.entity = entity; + } + ((ModelMPM)this.modelArmor).entityModel = model; + ((ModelMPM)this.modelArmor).entity = entity; + + ((ModelMPM)this.modelArmorChestplate).entityModel = model; + ((ModelMPM)this.modelArmorChestplate).entity = entity; + + ((ModelMPM)this.mainModel).entityModel = model; + ((ModelMPM)this.mainModel).entity = entity; + + super.renderPlayer(npc, d, d1, d2, f, f1); + + } + + @Override + protected void renderEquippedItems(EntityLivingBase entityliving, float f){ + if(renderEntity != null) + NPCRendererHelper.renderEquippedItems(entity, f, renderEntity); + else + super.renderEquippedItems(entityliving, f); + } + + @Override + protected int shouldRenderPass(EntityLivingBase par1EntityLivingBase, int par2, float par3){ + if(renderEntity != null){ + return NPCRendererHelper.shouldRenderPass(entity, par2, par3, renderEntity); + } + return this.func_130006_a((EntityLiving)par1EntityLivingBase, par2, par3); + } + + @Override + protected void preRenderCallback(EntityLivingBase entityliving, float f){ + if(renderEntity != null){ + EntityNPCInterface npc = (EntityNPCInterface) entityliving; + int size = npc.display.modelSize; + if(entity instanceof EntityNPCInterface){ + ((EntityNPCInterface)entity).display.modelSize = 5; + } + NPCRendererHelper.preRenderCallback(entity, f, renderEntity); + npc.display.modelSize = size; + GL11.glScalef(0.2f * npc.display.modelSize, 0.2f * npc.display.modelSize, 0.2f * npc.display.modelSize); + } + else + super.preRenderCallback(entityliving, f); + } + + @Override + protected float handleRotationFloat(EntityLivingBase par1EntityLivingBase, float par2){ + if(renderEntity != null){ + return NPCRendererHelper.handleRotationFloat(entity, par2, renderEntity); + } + return super.handleRotationFloat(par1EntityLivingBase, par2); + } +} \ No newline at end of file diff --git a/src/main/java/noppes/npcs/client/renderer/RenderNPCHumanMale.java b/src/main/java/noppes/npcs/client/renderer/RenderNPCHumanMale.java new file mode 100644 index 000000000..630e2107b --- /dev/null +++ b/src/main/java/noppes/npcs/client/renderer/RenderNPCHumanMale.java @@ -0,0 +1,414 @@ +package noppes.npcs.client.renderer; + +import static net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED; +import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D; +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.model.ModelBiped; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.entity.RenderBiped; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.ForgeHooksClient; +import net.minecraftforge.client.IItemRenderer; +import net.minecraftforge.client.MinecraftForgeClient; +import noppes.npcs.client.model.ModelNPCMale; +import noppes.npcs.constants.EnumAnimation; +import noppes.npcs.entity.EntityCustomNpc; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.items.ItemClaw; +import noppes.npcs.items.ItemShield; + +import org.lwjgl.opengl.GL11; + +public class RenderNPCHumanMale extends RenderNPCInterface +{ + + private ModelNPCMale modelBipedMain; + protected ModelNPCMale modelArmorChestplate; + protected ModelNPCMale modelArmor; + + public RenderNPCHumanMale(ModelNPCMale mainmodel, ModelNPCMale armorChest, ModelNPCMale armor) + { + super(mainmodel, 0.5F); + modelBipedMain = mainmodel; + modelArmorChestplate = armorChest; + modelArmor = armor; + } + + protected int func_130006_a(EntityLiving par1EntityLiving, int par2, float par3) + { + ItemStack itemstack = par1EntityLiving.func_130225_q(3 - par2); + + if (itemstack != null) + { + Item item = itemstack.getItem(); + + if (item instanceof ItemArmor) + { + ItemArmor itemarmor = (ItemArmor)item; + this.bindTexture(RenderBiped.getArmorResource(par1EntityLiving, itemstack, par2, null)); + ModelBiped modelbiped = par2 == 2 ? this.modelArmor : this.modelArmorChestplate; + modelbiped.bipedHead.showModel = par2 == 0; + modelbiped.bipedHeadwear.showModel = par2 == 0; + modelbiped.bipedBody.showModel = par2 == 1 || par2 == 2; + modelbiped.bipedRightArm.showModel = par2 == 1; + modelbiped.bipedLeftArm.showModel = par2 == 1; + modelbiped.bipedRightLeg.showModel = par2 == 2 || par2 == 3; + modelbiped.bipedLeftLeg.showModel = par2 == 2 || par2 == 3; + modelbiped = ForgeHooksClient.getArmorModel(par1EntityLiving, itemstack, par2, modelbiped); + this.setRenderPassModel(modelbiped); + modelbiped.onGround = this.mainModel.onGround; + modelbiped.isRiding = this.mainModel.isRiding; + modelbiped.isChild = this.mainModel.isChild; + float f1 = 1.0F; + + //Move out of if to allow for more then just CLOTH to have color + int j = itemarmor.getColor(itemstack); + if (j != -1) + { + float f2 = (float)(j >> 16 & 255) / 255.0F; + float f3 = (float)(j >> 8 & 255) / 255.0F; + float f4 = (float)(j & 255) / 255.0F; + GL11.glColor3f(f1 * f2, f1 * f3, f1 * f4); + + if (itemstack.isItemEnchanted()) + { + return 31; + } + + return 16; + } + + GL11.glColor3f(f1, f1, f1); + + if (itemstack.isItemEnchanted()) + { + return 15; + } + + return 1; + } + } + + return -1; + } + @Override + protected int shouldRenderPass(EntityLivingBase par1EntityLivingBase, int par2, float par3){ + return this.func_130006_a((EntityLiving)par1EntityLivingBase, par2, par3); + } + + public void renderPlayer(EntityNPCInterface npc, double d, double d1, double d2, + float f, float f1) + { + ItemStack itemstack = npc.getHeldItem(); + modelArmorChestplate.heldItemRight = modelArmor.heldItemRight = modelBipedMain.heldItemRight = + itemstack == null ? 0 : npc.hurtResistantTime > 0 ? 3 : 1; + + modelArmorChestplate.heldItemLeft = modelArmor.heldItemLeft = modelBipedMain.heldItemLeft = + npc.getOffHand() == null ? 0 : npc.hurtResistantTime > 0 ? 3 : 1; + + modelArmorChestplate.isSneak = modelArmor.isSneak = modelBipedMain.isSneak = npc.isSneaking(); + + modelArmorChestplate.isSleeping = modelArmor.isSleeping = modelBipedMain.isSleeping = npc.isPlayerSleeping(); + modelArmorChestplate.isDancing = modelArmor.isDancing = modelBipedMain.isDancing = npc.currentAnimation == EnumAnimation.DANCING; + modelArmorChestplate.aimedBow = modelArmor.aimedBow = modelBipedMain.aimedBow = npc.currentAnimation == EnumAnimation.AIMING; + + modelArmorChestplate.isRiding = modelArmor.isRiding = modelBipedMain.isRiding = npc.isRiding(); + + double d3 = d1 - (double)npc.yOffset; + if(npc.isSneaking()) + { + d3 -= 0.125D; + } + super.doRender(npc, d, d3, d2, f, f1); + modelArmorChestplate.aimedBow = modelArmor.aimedBow = modelBipedMain.aimedBow = false; + modelArmorChestplate.isSneak = modelArmor.isSneak = modelBipedMain.isSneak = false; + modelArmorChestplate.heldItemRight = modelArmor.heldItemRight = modelBipedMain.heldItemRight = 0; + modelArmorChestplate.heldItemLeft = modelArmor.heldItemLeft = modelBipedMain.heldItemLeft = 0; + } + + protected void renderSpecials(EntityNPCInterface npc, float f) + { + super.renderEquippedItems(npc, f); + GL11.glColor3f(1,1,1); + int i = npc.getBrightnessForRender(f); + int j = i % 65536; + int k = i / 65536; + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F); + if (!npc.display.cloakTexture.isEmpty()) + { + if(npc.textureCloakLocation == null){ + npc.textureCloakLocation = new ResourceLocation(npc.display.cloakTexture); + } + bindTexture((ResourceLocation) npc.textureCloakLocation); + //AbstractClientPlayer.func_110307_b(, null); + GL11.glPushMatrix(); + GL11.glTranslatef(0.0F, 0.0F, 0.125F); + double d = (npc.field_20066_r + (npc.field_20063_u - npc.field_20066_r) * (double)f) - (npc.prevPosX + (npc.posX - npc.prevPosX) * (double)f); + double d1 = (npc.field_20065_s + (npc.field_20062_v - npc.field_20065_s) * (double)f) - (npc.prevPosY + (npc.posY - npc.prevPosY) * (double)f); + double d2 = (npc.field_20064_t + (npc.field_20061_w - npc.field_20064_t) * (double)f) - (npc.prevPosZ + (npc.posZ - npc.prevPosZ) * (double)f); + float f11 = npc.prevRenderYawOffset + (npc.renderYawOffset - npc.prevRenderYawOffset) * f; + double d3 = MathHelper.sin((f11 * 3.141593F) / 180F); + double d4 = -MathHelper.cos((f11 * 3.141593F) / 180F); + float f14 = (float)(d * d3 + d2 * d4) * 100F; + float f15 = (float)(d * d4 - d2 * d3) * 100F; + if (f14 < 0.0F) + { + f14 = 0.0F; + } + float f16 = npc.prevRotationYaw + (npc.rotationYaw - npc.prevRotationYaw) * f; + //f13 += MathHelper.sin((entityplayer.prevDistanceWalkedModified + (entityplayer.distanceWalkedModified - entityplayer.prevDistanceWalkedModified) * f) * 6F) * 32F * f16; + float f13 = 5f; + if (npc.isSneaking()) + { + f13 += 25F; + } + //System.out.println(entityplayer.prevDistanceWalkedModified); + GL11.glRotatef(6F + f14 / 2.0F + f13, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(f15 / 2.0F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(-f15 / 2.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(180F, 0.0F, 1.0F, 0.0F); + modelBipedMain.renderCloak(0.0625F); + + GL11.glPopMatrix(); + } + GL11.glColor3f(1,1,1); + ItemStack itemstack = npc.inventory.armorItemInSlot(0); + if(itemstack != null) + { + GL11.glPushMatrix(); + if(npc instanceof EntityCustomNpc){ + EntityCustomNpc cnpc = (EntityCustomNpc) npc; + GL11.glTranslatef(0, cnpc.modelData.getBodyY(), 0); + this.modelBipedMain.bipedHead.postRender(0.0625F); + GL11.glScalef(cnpc.modelData.head.scaleX, cnpc.modelData.head.scaleY, cnpc.modelData.head.scaleZ); + } + else + this.modelBipedMain.bipedHead.postRender(0.0625F); + + IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack, EQUIPPED); + boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack, BLOCK_3D)); + + if (itemstack.getItem() instanceof ItemBlock) + { + if (is3D || RenderBlocks.renderItemIn3d(Block.getBlockFromItem(itemstack.getItem()).getRenderType())) + { + float var6 = 0.625F; + GL11.glTranslatef(0.0F, -0.25F, 0.0F); + GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); + GL11.glScalef(var6, -var6, -var6); + } + + this.renderManager.itemRenderer.renderItem(npc, itemstack, 0); + } + + GL11.glPopMatrix(); + } + GL11.glColor3f(1,1,1); + ItemStack itemstack2 = npc.getHeldItem(); + if(itemstack2 != null) + { + float var6; + GL11.glPushMatrix(); + float y = 0; + float x = 0; + if(npc instanceof EntityCustomNpc){ + EntityCustomNpc cnpc = (EntityCustomNpc) npc; + y = (cnpc.modelData.arms.scaleY - 1) * 0.7f; + x = (1 - cnpc.modelData.body.scaleX) * 0.28f + (1 - cnpc.modelData.arms.scaleX) * 0.175f; + GL11.glTranslatef(x, cnpc.modelData.getBodyY(), 0); + } + this.modelBipedMain.bipedRightArm.postRender(0.0625F); + GL11.glTranslatef(-0.0625F, 0.4375F + y, 0.0625F); + + IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack2, EQUIPPED); + boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack2, BLOCK_3D)); + + if (itemstack2.getItem() instanceof ItemBlock && (is3D || RenderBlocks.renderItemIn3d(Block.getBlockFromItem(itemstack2.getItem()).getRenderType()))) + { + var6 = 0.5F; + GL11.glTranslatef(0.0F, 0.1875F, -0.3125F); + var6 *= 0.75F; + GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); + GL11.glScalef(-var6, -var6, var6); + } + else if (itemstack2.getItem() == Items.bow) + { + var6 = 0.625F; + GL11.glTranslatef(0.0F, 0.125F, 0.3125F); + GL11.glRotatef(-20.0F, 0.0F, 1.0F, 0.0F); + GL11.glScalef(var6, -var6, var6); + GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); + } + else if (itemstack2.getItem().isFull3D()) + { + var6 = 0.625F; + + if (itemstack2.getItem().shouldRotateAroundWhenRendering()) + { + GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); + GL11.glTranslatef(0.0F, -0.125F, 0.0F); + } + + if (npc.hurtResistantTime > 0 && npc.stats.resistances.playermelee > 1f) + { + GL11.glTranslatef(0.05F, 0.0F, -0.1F); + GL11.glRotatef(-50.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(-10.0F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(-60.0F, 0.0F, 0.0F, 1.0F); + } + + GL11.glTranslatef(0.0F, 0.1875F, 0.0F); + GL11.glScalef(var6, -var6, var6); + GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); + } + else + { + var6 = 0.375F; + GL11.glTranslatef(0.25F, 0.1875F, -0.1875F); + GL11.glScalef(var6, var6, var6); + GL11.glRotatef(60.0F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(20.0F, 0.0F, 0.0F, 1.0F); + } + + if (itemstack2.getItem().requiresMultipleRenderPasses()) + { + for (int var25 = 0; var25 < itemstack2.getItem().getRenderPasses(itemstack2.getItemDamage()); ++var25) + { + int var24 = itemstack2.getItem().getColorFromItemStack(itemstack2, var25); + float var26 = (float)(var24 >> 16 & 255) / 255.0F; + float var9 = (float)(var24 >> 8 & 255) / 255.0F; + float var10 = (float)(var24 & 255) / 255.0F; + GL11.glColor4f(var26, var9, var10, 1.0F); + this.renderManager.itemRenderer.renderItem(npc, itemstack2, var25); + } + } + else + renderManager.itemRenderer.renderItem(npc, itemstack2, 0); + + GL11.glPopMatrix(); + } + GL11.glColor4f(1, 1, 1, 1.0F); + itemstack2 = npc.getOffHand(); + if(itemstack2 != null) + { + GL11.glPushMatrix(); + float y = 0; + float x = 0; + if(npc instanceof EntityCustomNpc){ + EntityCustomNpc cnpc = (EntityCustomNpc) npc; + y = (cnpc.modelData.arms.scaleY - 1) * 0.7f; + x = (1 - cnpc.modelData.body.scaleX) * -0.28f + (1 - cnpc.modelData.arms.scaleX) * -0.175f; + GL11.glTranslatef(x, cnpc.modelData.getBodyY(), 0); + } + this.modelBipedMain.bipedLeftArm.postRender(0.0625F); + GL11.glTranslatef(0.0625F, 0.4375F + y, 0.0625F); + float var6; + + IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack2, EQUIPPED); + boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack2, BLOCK_3D)); + + if(itemstack2.getItem() instanceof ItemShield || itemstack2.getItem() instanceof ItemClaw) + GL11.glTranslatef(0.30f, 0, 0f); + + + if (itemstack2.getItem() instanceof ItemBlock && (is3D || RenderBlocks.renderItemIn3d(Block.getBlockFromItem(itemstack2.getItem()).getRenderType()))) + { + var6 = 0.5F; + GL11.glTranslatef(0.0F, 0.1875F, -0.3125F); + var6 *= 0.75F; + GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); + GL11.glScalef(var6, -var6, var6); + } + else if (itemstack2.getItem() == Items.bow) + { + var6 = 0.625F; + GL11.glTranslatef(0.0F, 0.125F, 0.3125F); + GL11.glRotatef(-20.0F, 0.0F, 1.0F, 0.0F); + GL11.glScalef(var6, -var6, var6); + GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); + } + else if (itemstack2.getItem().isFull3D()) + { + var6 = 0.625F; + + if (itemstack2.getItem().shouldRotateAroundWhenRendering()) + { + GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); + GL11.glTranslatef(0.0F, -0.125F, 0.0F); + } + + if (npc.hurtResistantTime > 0 && npc.stats.resistances.arrow > 1f) + { + GL11.glTranslatef(0.05F, 0.0F, -0.1F); + GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(-10.0F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(60.0F, 0.0F, 0.0F, 1.0F); + } + + GL11.glTranslatef(0.0F, 0.1875F, 0.0F); + GL11.glScalef(var6, -var6, var6); + GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); + } + else + { + var6 = 0.375F; + GL11.glTranslatef(0.25F, 0.1875F, -0.1875F); + GL11.glScalef(var6, var6, var6); + GL11.glRotatef(60.0F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(20.0F, 0.0F, 0.0F, 1.0F); + } + + if (itemstack2.getItem().requiresMultipleRenderPasses()) + { + for (int var25 = 0; var25 < itemstack2.getItem().getRenderPasses(itemstack2.getItemDamage()); ++var25) + { + int var24 = itemstack2.getItem().getColorFromItemStack(itemstack2, var25); + float var26 = (float)(var24 >> 16 & 255) / 255.0F; + float var9 = (float)(var24 >> 8 & 255) / 255.0F; + float var10 = (float)(var24 & 255) / 255.0F; + GL11.glColor4f(var26, var9, var10, 1.0F); + this.renderManager.itemRenderer.renderItem(npc, itemstack2, var25); + } + }else + { + renderManager.itemRenderer.renderItem(npc, itemstack2, 0); + } + GL11.glPopMatrix(); + } + } + + @Override + protected void renderEquippedItems(EntityLivingBase entityliving, float f){ + renderSpecials((EntityNPCInterface)entityliving, f); + } + + @Override + public void doRender(EntityLiving entityliving, double d, double d1, double d2, float f, float f1){ + renderPlayer((EntityNPCInterface)entityliving, d, d1, d2, f, f1); + } + + @Override + public void doRender(Entity entity, double d, double d1, double d2, float f, float f1){ + renderPlayer((EntityNPCInterface)entity, d, d1, d2, f, f1); + } + +} diff --git a/src/main/java/noppes/npcs/client/renderer/RenderNPCInterface.java b/src/main/java/noppes/npcs/client/renderer/RenderNPCInterface.java new file mode 100644 index 000000000..0f1071f57 --- /dev/null +++ b/src/main/java/noppes/npcs/client/renderer/RenderNPCInterface.java @@ -0,0 +1,327 @@ +package noppes.npcs.client.renderer; + +import java.io.File; +import java.security.MessageDigest; +import java.util.Map; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.entity.RenderLiving; +import net.minecraft.client.renderer.texture.ITextureObject; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.resources.SkinManager; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.boss.BossStatus; +import net.minecraft.util.ResourceLocation; +import noppes.npcs.client.ImageDownloadAlt; +import noppes.npcs.client.model.ModelMPM; +import noppes.npcs.constants.EnumAnimation; +import noppes.npcs.constants.EnumStandingType; +import noppes.npcs.entity.EntityCustomNpc; +import noppes.npcs.entity.EntityNPCInterface; + +import org.lwjgl.opengl.GL11; + +import com.mojang.authlib.minecraft.MinecraftProfileTexture; +import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type; + + +public class RenderNPCInterface extends RenderLiving{ + public static long LastTextureTick = 0; + public RenderNPCInterface(ModelBase model, float f){ + super(model, f); + } + + protected void renderName(EntityNPCInterface npc, double d, double d1, double d2) { + if (!this.func_110813_b(npc)) + return; + float f2 = npc.getDistanceToEntity(renderManager.livingPlayer); + float f3 = npc.isSneaking() ? 32F : 64F; + + if (f2 > f3) + return; + if (npc.messages != null){ + float height = ((npc.baseHeight / 5f) * npc.display.modelSize); + float offset = npc.height * (1.2f + (!npc.display.showName()?0:npc.display.title.isEmpty()?0.15f:0.25f)); + + npc.messages.renderMessages(d, d1 + offset, d2, 0.666667F * height); + } + float scale = (npc.baseHeight / 5f) * npc.display.modelSize; + int height = 0; + if (npc.display.showName()) { + String s = npc.getCommandSenderName(); + if(!npc.display.title.isEmpty()){ + renderLivingLabel(npc, d, d1 + npc.height - 0.06f * scale, d2, 64, "<" + npc.display.title + ">", 0.6f, s, 1f); + height = 2; + } + else{ + renderLivingLabel(npc, d, d1 + npc.height - 0.06f * scale, d2, 64, s, 1f); + height = 1; + } + } + } + + public void doRenderShadowAndFire(Entity par1Entity, double par2, double par4, double par6, float par8, float par9){ + EntityNPCInterface npc = (EntityNPCInterface) par1Entity; + if(!npc.isKilled()) + super.doRenderShadowAndFire(par1Entity, par2, par4, par6, par8, par9); + } + + protected void renderLivingLabel(EntityNPCInterface npc, double d, double d1, double d2, int i, Object... obs){ + FontRenderer fontrenderer = getFontRendererFromRenderManager(); + + i = npc.getBrightnessForRender(0); + int j = i % 65536; + int k = i / 65536; + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F); + + float f1 = (npc.baseHeight / 5f) * npc.display.modelSize; + float f2 = 0.01666667F * f1; + GL11.glPushMatrix(); + GL11.glTranslatef((float)d + 0.0F, (float)d1, (float)d2); + GL11.glNormal3f(0.0F, 1.0F, 0.0F); + GL11.glRotatef(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(renderManager.playerViewX, 1.0F, 0.0F, 0.0F); + Tessellator tessellator = Tessellator.instance; + float height = f1 / 6.5f; + for(j = 0; j < obs.length; j += 2){ + float scale = (Float) obs[j + 1]; + height += f1 / 6.5f * scale; + GL11.glPushMatrix(); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDepthMask(false); + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glDisable(GL11.GL_TEXTURE_2D); + String s = obs[j].toString(); + GL11.glTranslatef(0, height, 0); + GL11.glScalef(-f2 * scale, -f2 * scale, f2 * scale); + tessellator.startDrawingQuads(); + int size = fontrenderer.getStringWidth(s) / 2; + tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F); + tessellator.addVertex(-size - 1, -1, 0.0D); + tessellator.addVertex(-size - 1, 8 , 0.0D); + tessellator.addVertex(size + 1, 8 , 0.0D); + tessellator.addVertex(size + 1, -1 , 0.0D); + tessellator.draw(); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glDepthMask(true); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + + int color = npc.faction.color; + fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, 0, color); + GL11.glPopMatrix(); + } + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glEnable(GL11.GL_LIGHTING /*GL_LIGHTING*/); + GL11.glDisable(GL11.GL_BLEND /*GL_BLEND*/); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glPopMatrix(); + } + + protected void renderPlayerScale(EntityNPCInterface npc, float f){ + GL11.glScalef((npc.scaleX / 5) * npc.display.modelSize, (npc.scaleY / 5) * npc.display.modelSize, (npc.scaleZ / 5) * npc.display.modelSize); + } + + protected void renderPlayerSleep(EntityNPCInterface npc, double d, double d1, double d2){ + shadowSize = npc.display.modelSize / 10f; + + float xOffset = 0; + float yOffset = npc.currentAnimation == EnumAnimation.NONE?npc.ai.bodyOffsetY / 10 - 0.5f:0; + float zOffset = 0; + + if(npc.isEntityAlive()){ + if(npc.isPlayerSleeping()){ + xOffset = (float) -Math.cos(Math.toRadians(180 - npc.ai.orientation)); + zOffset = (float) -Math.sin(Math.toRadians(npc.ai.orientation)); + yOffset += 0.14f; + } + else if(npc.isRiding()){ + yOffset -= 0.5f - ((EntityCustomNpc)npc).modelData.getLegsY() * 0.8f; + } + } + renderLiving(npc, d, d1, d2, xOffset, yOffset, zOffset); + } + private void renderLiving(EntityNPCInterface npc, double d, double d1, double d2,float xoffset,float yoffset,float zoffset){ + xoffset = (xoffset/ 5f) * npc.display.modelSize; + yoffset = (yoffset/ 5f) * npc.display.modelSize; + zoffset = (zoffset/ 5f) * npc.display.modelSize; + super.renderLivingAt(npc, d+xoffset, d1+yoffset, d2 + zoffset); + } + + @Override + protected void rotateCorpse(EntityLivingBase entity, float f, float f1, float f2){ + EntityNPCInterface npc = (EntityNPCInterface) entity; + if(npc.isEntityAlive() && npc.isPlayerSleeping()) + { + GL11.glRotatef(npc.ai.orientation, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(getDeathMaxRotation(npc), 0.0F, 0.0F, 1.0F); + GL11.glRotatef(270F, 0.0F, 1.0F, 0.0F); + } + else if(npc.isEntityAlive() && npc.currentAnimation == EnumAnimation.CRAWLING){ + GL11.glRotatef(270.0F - f1, 0.0F, 1.0F, 0.0F); + float scale = ((EntityCustomNpc)npc).display.modelSize / 5f; + GL11.glTranslated(-scale +((EntityCustomNpc)npc).modelData.getLegsY() * scale, 0.14f, 0); + GL11.glRotatef(270F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(270F, 0.0F, 1.0F, 0.0F); + } + else { + super.rotateCorpse(npc, f, f1, f2); +// if(npc.deathTime > 0) +// { +// float x = (float) -Math.cos(Math.toRadians(180 - f1)); +// float y = (float) -Math.sin(Math.toRadians(f1)); +// x = (x/ 5f) * npc.getModelSize(); +// y = (y/ 5f) * npc.getModelSize(); +// GL11.glTranslatef(x, 0, y); +// +// +// float f3 = ((((float)npc.deathTime+ f2) - 1.0F) / 20F) * 1.6F; +// f3 = MathHelper.sqrt_float(f3); +// if(f3 > 1.0F) +// { +// f3 = 1.0F; +// } +// GL11.glRotatef(f1, 0.0F, 1.0F, 0.0F); +// GL11.glRotatef(f3 * getDeathMaxRotation(npc), 0.0F, 0.0F, 1.0F); +// GL11.glRotatef(180F - f1, 0.0F, 1.0F, 0.0F); +// } +// else +// { +// GL11.glRotatef(180F - f1, 0.0F, 1.0F, 0.0F); +// } + } + } + + @Override + protected void passSpecialRender(EntityLivingBase par1EntityLivingBase, double par2, double par4, double par6){ + renderName((EntityNPCInterface)par1EntityLivingBase, par2, par4, par6); + } + + @Override + protected void preRenderCallback(EntityLivingBase entityliving, float f){ + renderPlayerScale((EntityNPCInterface)entityliving, f); + } + + @Override + public void doRender(EntityLiving entityliving, double d, double d1, double d2, float f, float f1){ + EntityNPCInterface npc = (EntityNPCInterface) entityliving; + if(npc.isKilled() && npc.stats.hideKilledBody && npc.deathTime > 20){ + return; + } + if((npc.display.showBossBar == 1 || npc.display.showBossBar == 2 && npc.isAttacking()) && !npc.isKilled() && npc.deathTime <= 20 && npc.canSee(Minecraft.getMinecraft().thePlayer)) + BossStatus.setBossStatus(npc, true); + + if(npc.ai.standingType == EnumStandingType.HeadRotation && !npc.isWalking() && !npc.isInteracting()){ + npc.prevRenderYawOffset = npc.renderYawOffset = npc.ai.orientation; + } + super.doRender(entityliving, d, d1, d2, f, f1); + } + + protected void renderModel(EntityLivingBase entityliving, float par2, float par3, float par4, float par5, float par6, float par7){ + super.renderModel(entityliving, par2, par3, par4, par5, par6, par7); + EntityNPCInterface npc = (EntityNPCInterface) entityliving; + if (!npc.display.glowTexture.isEmpty()) + { + GL11.glDepthFunc(GL11.GL_LEQUAL); + if(npc.textureGlowLocation == null){ + npc.textureGlowLocation = new ResourceLocation(npc.display.glowTexture); + } + bindTexture((ResourceLocation) npc.textureGlowLocation); + float f1 = 1.0F; + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); + GL11.glDisable(GL11.GL_LIGHTING); + if (npc.isInvisible()) + { + GL11.glDepthMask(false); + } + else + { + GL11.glDepthMask(true); + } + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glPushMatrix(); + GL11.glScalef(1.001f, 1.001f, 1.001f); + if(mainModel instanceof ModelMPM){ + ((ModelMPM)mainModel).isArmor = true; + mainModel.render(entityliving, par2, par3, par4, par5, par6, par7); + ((ModelMPM)mainModel).isArmor = false; + } + else + mainModel.render(entityliving, par2, par3, par4, par5, par6, par7); + GL11.glPopMatrix(); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glColor4f(1.0F, 1.0F, 1.0F, f1); + + + GL11.glDepthFunc(GL11.GL_LEQUAL); + GL11.glDisable(GL11.GL_BLEND); + } + } + @Override + protected float handleRotationFloat(EntityLivingBase par1EntityLiving, float par2){ + EntityNPCInterface npc = (EntityNPCInterface) par1EntityLiving; + if(npc.isKilled() || npc.display.disableLivingAnimation) + return 0; + return super.handleRotationFloat(par1EntityLiving, par2); + } + + @Override + protected void renderLivingAt(EntityLivingBase entityliving, double d, double d1, double d2){ + renderPlayerSleep((EntityNPCInterface)entityliving, d, d1, d2); + } + + @Override + public ResourceLocation getEntityTexture(Entity entity) { + EntityNPCInterface npc = (EntityNPCInterface) entity; + if(npc.textureLocation == null){ + if(npc.display.skinType == 0) + npc.textureLocation = new ResourceLocation(npc.display.texture); + else if(LastTextureTick < 5){ //fixes request flood somewhat + return AbstractClientPlayer.locationStevePng; + } + else if(npc.display.skinType == 1 && npc.display.playerProfile != null){ + Minecraft minecraft = Minecraft.getMinecraft(); + Map map = minecraft.func_152342_ad().func_152788_a(npc.display.playerProfile); + if (map.containsKey(Type.SKIN)){ + npc.textureLocation = minecraft.func_152342_ad().func_152792_a((MinecraftProfileTexture)map.get(Type.SKIN), Type.SKIN); + } + LastTextureTick = 0; + } + else if(npc.display.skinType == 2){ + try{ + MessageDigest digest = MessageDigest.getInstance("MD5"); + byte[] hash = digest.digest(npc.display.url.getBytes("UTF-8")); + StringBuilder sb = new StringBuilder(2*hash.length); + for(byte b : hash){ + sb.append(String.format("%02x", b&0xff)); + } + npc.textureLocation = new ResourceLocation("skins/" + sb.toString()); + func_110301_a(null, npc.textureLocation, npc.display.url); + LastTextureTick = 0; + } + catch(Exception ex){ + + } + } + } + if(npc.textureLocation == null) + return AbstractClientPlayer.locationStevePng; + return npc.textureLocation; + } + + private void func_110301_a(File file, ResourceLocation resource, String par1Str){ + TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager(); + ITextureObject object = new ImageDownloadAlt(file, par1Str, SkinManager.field_152793_a, new ImageBufferDownloadAlt()); + texturemanager.loadTexture(resource, object); + } +} diff --git a/src/main/java/noppes/npcs/client/renderer/RenderNPCPony.java b/src/main/java/noppes/npcs/client/renderer/RenderNPCPony.java new file mode 100644 index 000000000..17e236858 --- /dev/null +++ b/src/main/java/noppes/npcs/client/renderer/RenderNPCPony.java @@ -0,0 +1,298 @@ +package noppes.npcs.client.renderer; + +import java.awt.Color; +import java.awt.image.BufferedImage; +import java.io.IOException; + +import javax.imageio.ImageIO; + +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.entity.RenderBiped; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.client.resources.IResource; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemArmor.ArmorMaterial; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import noppes.npcs.client.model.ModelPony; +import noppes.npcs.client.model.ModelPonyArmor; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.entity.EntityNpcPony; + +import org.lwjgl.opengl.GL11; + +public class RenderNPCPony extends RenderNPCInterface +{ + + private ModelPony modelBipedMain; + private ModelPonyArmor modelArmorChestplate; + private ModelPonyArmor modelArmor; + + public RenderNPCPony() + { + super(new ModelPony(0.0F), 0.5F); + modelBipedMain = (ModelPony)mainModel; + modelArmorChestplate = new ModelPonyArmor(1.0F); + modelArmor = new ModelPonyArmor(0.5F); + } + + protected int setArmorModel(EntityNPCInterface entityplayer, int i, float f) + { + ItemStack itemstack = entityplayer.inventory.armorItemInSlot(i); + if(itemstack != null) + { + Item item = itemstack.getItem(); + if(item instanceof ItemArmor) + { + ItemArmor itemarmor = (ItemArmor)item; + this.bindTexture(RenderBiped.getArmorResource(entityplayer, itemstack, i, null)); + ModelPonyArmor modelbiped = i != 2 ? modelArmorChestplate : modelArmor; + modelbiped.head.showModel = i == 0; + + modelbiped.Body.showModel = i == 1 ; + modelbiped.BodyBack.showModel = i == 1 ; + modelbiped.rightarm.showModel = i == 3; + modelbiped.LeftArm.showModel = i == 3; + modelbiped.RightLeg.showModel = i == 3; + modelbiped.LeftLeg.showModel = i == 3; + + modelbiped.rightarm2.showModel = i == 2; + modelbiped.LeftArm2.showModel = i == 2; + modelbiped.RightLeg2.showModel = i == 2; + modelbiped.LeftLeg2.showModel = i == 2; + setRenderPassModel(modelbiped); + + float var8 = 1.0F; + + if (itemarmor.getArmorMaterial() == ArmorMaterial.CLOTH) + { + int var9 = itemarmor.getColor(itemstack); + float var10 = (float)(var9 >> 16 & 255) / 255.0F; + float var11 = (float)(var9 >> 8 & 255) / 255.0F; + float var12 = (float)(var9 & 255) / 255.0F; + GL11.glColor3f(var8 * var10, var8 * var11, var8 * var12); + + if (itemstack.isItemEnchanted()) + { + return 31; + } + + return 16; + } + + GL11.glColor3f(var8, var8, var8); + + return !itemstack.isItemEnchanted() ? 1 : 15; + } + } + return -1; + } + + @Override + public ResourceLocation getEntityTexture(Entity entity) { + EntityNpcPony pony = (EntityNpcPony) entity; + boolean check = pony.textureLocation == null || pony.textureLocation != pony.checked; + ResourceLocation loc = super.getEntityTexture(pony); + if(check){ + try { + IResource resource = Minecraft.getMinecraft().getResourceManager().getResource(loc); + BufferedImage bufferedimage = ImageIO.read(resource.getInputStream()); + + pony.isPegasus = false; + pony.isUnicorn = false; + Color color = new Color(bufferedimage.getRGB(0, 0), true); + Color color1 = new Color(249, 177, 49, 255); + Color color2 = new Color(136, 202, 240, 255); + Color color3 = new Color(209, 159, 228, 255); + Color color4 = new Color(254, 249, 252, 255); + if(color.equals(color1)) + { + } + if(color.equals(color2)) + { + pony.isPegasus = true; + } + if(color.equals(color3)) + { + pony.isUnicorn = true; + } + if(color.equals(color4)) + { + pony.isPegasus = true; + pony.isUnicorn = true; + } + pony.checked = loc; + + } catch (IOException e) { + + } + } + return loc; + } + + public void renderPlayer(EntityNpcPony pony, double d, double d1, double d2, + float f, float f1) + { + ItemStack itemstack = pony.getHeldItem(); + setRenderPassModel(modelBipedMain); + + modelArmorChestplate.heldItemRight = modelArmor.heldItemRight = modelBipedMain.heldItemRight = itemstack == null ? 0 : 1; + modelArmorChestplate.isSneak = modelArmor.isSneak = modelBipedMain.isSneak = pony.isSneaking(); + modelArmorChestplate.isRiding = modelArmor.isRiding = modelBipedMain.isRiding = false; + modelArmorChestplate.isSleeping = modelArmor.isSleeping = modelBipedMain.isSleeping = pony.isPlayerSleeping(); + modelArmorChestplate.isUnicorn = modelArmor.isUnicorn = modelBipedMain.isUnicorn = pony.isUnicorn; + modelArmorChestplate.isPegasus = modelArmor.isPegasus = modelBipedMain.isPegasus = pony.isPegasus; + double d3 = d1 - (double)pony.yOffset; + if(pony.isSneaking()) + { + d3 -= 0.125D; + } + super.doRender(pony, d, d3, d2, f, f1); + modelArmorChestplate.aimedBow = modelArmor.aimedBow = modelBipedMain.aimedBow = false; + modelArmorChestplate.isRiding = modelArmor.isRiding = modelBipedMain.isRiding = false; + modelArmorChestplate.isSneak = modelArmor.isSneak = modelBipedMain.isSneak = false; + modelArmorChestplate.heldItemRight = modelArmor.heldItemRight = modelBipedMain.heldItemRight = 0; + } +// @Override +// protected void rotatePlayer(EntityNPCInterface entityplayer, float f, float f1, float f2) +// { +// if(entityplayer.isEntityAlive() && entityplayer.isPlayerSleeping()) +// { +// GL11.glRotatef(entityplayer.orientation, 0.0F, 1.0F, 0.0F); +// GL11.glTranslatef(-1.25F, -0.875F, 0.0F); +// GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F); +// } else +// { +// GL11.glRotatef(180F - f1, 0.0F, 1.0F, 0.0F); +// if(entityplayer.deathTime > 0) +// { +// float f3 = ((((float)entityplayer.deathTime + f2) - 1.0F) / 20F) * 1.6F; +// f3 = MathHelper.sqrt_float(f3); +// if(f3 > 1.0F) +// { +// f3 = 1.0F; +// } +// GL11.glRotatef(f3 * getDeathMaxRotation(entityplayer), 0.0F, 0.0F, 1.0F); +// } +// } +// } + protected void renderSpecials(EntityNpcPony entityplayer, float f) + { + super.renderEquippedItems(entityplayer, f); + if(!entityplayer.isPlayerSleeping()) + { + if(entityplayer.isUnicorn) + { + renderDrop(this.renderManager, entityplayer, modelBipedMain.unicornarm, 1.0F, 0.35F, 0.5375F, -0.45F); + } else + { + renderDrop(this.renderManager, entityplayer, modelBipedMain.RightArm, 1.0F, -0.0625F, 0.8375F, 0.0625F); + } + } + } + + + protected void renderDrop(RenderManager rendermanager, EntityNpcPony entityplayer, ModelRenderer modelrenderer, float f, float f1, float f2, float f3) + { + ItemStack itemstack = entityplayer.getHeldItem(); + if(itemstack == null) + { + return; + } + GL11.glPushMatrix(); + if(modelrenderer != null) + { + modelrenderer.postRender(f * 0.0625F); + } + GL11.glTranslatef(f1, f2, f3); + if(itemstack.getItem() instanceof ItemBlock && RenderBlocks.renderItemIn3d(Block.getBlockFromItem(itemstack.getItem()).getRenderType())) + { + GL11.glTranslatef(0.0F, 0.1875F, -0.3125F); + GL11.glRotatef(20F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(45F, 0.0F, 1.0F, 0.0F); + float f4 = 0.375F * f; + GL11.glScalef(f4, -f4, f4); + } else + if(itemstack.getItem() == Items.bow) + { + GL11.glTranslatef(0.0F, 0.125F, 0.3125F); + GL11.glRotatef(-20F, 0.0F, 1.0F, 0.0F); + float f5 = 0.625F * f; + GL11.glScalef(f5, -f5, f5); + GL11.glRotatef(-100F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(45F, 0.0F, 1.0F, 0.0F); + } else + if(itemstack.getItem().isFull3D()) + { + if(itemstack.getItem().shouldRotateAroundWhenRendering()) + { + GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); + GL11.glTranslatef(0.0F, -0.125F, 0.0F); + } + GL11.glTranslatef(0.0F, 0.1875F, 0.0F); + float f6 = 0.625F * f; + GL11.glScalef(f6, -f6, f6); + GL11.glRotatef(-100F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(45F, 0.0F, 1.0F, 0.0F); + } else + { + GL11.glTranslatef(0.25F, 0.1875F, -0.1875F); + float f7 = 0.375F * f; + GL11.glScalef(f7, f7, f7); + GL11.glRotatef(60F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(-90F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(20F, 0.0F, 0.0F, 1.0F); + } + if(itemstack.getItem() == Items.potionitem) + { + for (int j = 0; j <= 1; j++) + { + int k = itemstack.getItem().getColorFromItemStack(itemstack, j); + float f9 = (float)(k >> 16 & 0xff) / 255F; + float f10 = (float)(k >> 8 & 0xff) / 255F; + float f12 = (float)(k & 0xff) / 255F; + GL11.glColor4f(f9, f10, f12, 1.0F); + renderManager.itemRenderer.renderItem(entityplayer, itemstack, j); + } + } else + { + rendermanager.itemRenderer.renderItem(entityplayer, itemstack, 0); + } + GL11.glPopMatrix(); + } + @Override + protected int shouldRenderPass(EntityLivingBase entityliving, int i, float f) + { + return setArmorModel((EntityNPCInterface)entityliving, i, f); + } + + @Override + protected void renderEquippedItems(EntityLivingBase entityliving, float f) + { + renderSpecials((EntityNpcPony)entityliving, f); + } + + @Override + public void doRender(EntityLiving entityliving, double d, double d1, double d2, + float f, float f1) + { + renderPlayer((EntityNpcPony)entityliving, d, d1, d2, f, f1); + } + + @Override + public void doRender(Entity entity, double d, double d1, double d2, + float f, float f1) + { + renderPlayer((EntityNpcPony)entity, d, d1, d2, f, f1); + } + +} diff --git a/src/main/java/noppes/npcs/client/renderer/RenderNpcCrystal.java b/src/main/java/noppes/npcs/client/renderer/RenderNpcCrystal.java new file mode 100644 index 000000000..895387071 --- /dev/null +++ b/src/main/java/noppes/npcs/client/renderer/RenderNpcCrystal.java @@ -0,0 +1,15 @@ +package noppes.npcs.client.renderer; + +import net.minecraft.entity.Entity; +import noppes.npcs.client.model.ModelNpcCrystal; +import noppes.npcs.entity.EntityNpcCrystal; + +public class RenderNpcCrystal extends RenderNPCInterface +{ + ModelNpcCrystal mainmodel; + public RenderNpcCrystal(ModelNpcCrystal model) + { + super(model,0); + mainmodel = model; + } +} diff --git a/src/main/java/noppes/npcs/client/renderer/RenderNpcDragon.java b/src/main/java/noppes/npcs/client/renderer/RenderNpcDragon.java new file mode 100644 index 000000000..19e381a40 --- /dev/null +++ b/src/main/java/noppes/npcs/client/renderer/RenderNpcDragon.java @@ -0,0 +1,20 @@ +package noppes.npcs.client.renderer; + +import org.lwjgl.opengl.GL11; + +import net.minecraft.client.model.ModelBase; +import noppes.npcs.entity.EntityNPCInterface; + +public class RenderNpcDragon extends RenderNPCInterface{ + + public RenderNpcDragon(ModelBase model, float f) { + super(model, f); + } + + @Override + protected void renderPlayerScale(EntityNPCInterface npc, float f) + { + GL11.glTranslatef(0, 0, 0.6f / 5 * npc.display.modelSize); + super.renderPlayerScale(npc, f); + } +} diff --git a/src/main/java/noppes/npcs/client/renderer/RenderNpcSlime.java b/src/main/java/noppes/npcs/client/renderer/RenderNpcSlime.java new file mode 100644 index 000000000..c7df89f98 --- /dev/null +++ b/src/main/java/noppes/npcs/client/renderer/RenderNpcSlime.java @@ -0,0 +1,77 @@ +package noppes.npcs.client.renderer; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.entity.EntityLivingBase; +import noppes.npcs.entity.EntityNPCInterface; + +import org.lwjgl.opengl.GL11; + +public class RenderNpcSlime extends RenderNPCInterface +{ + private ModelBase scaleAmount; + + public RenderNpcSlime(ModelBase par1ModelBase, ModelBase par2ModelBase, float par3) + { + super(par1ModelBase, par3); + this.scaleAmount = par2ModelBase; + } + + /** + * Determines whether Slime Render should pass or not. + */ + protected int shouldSlimeRenderPass(EntityNPCInterface par1EntitySlime, int par2, float par3) + { + if (par1EntitySlime.isInvisible()) + { + return 0; + } + else + if (par2 == 0) + { + this.setRenderPassModel(this.scaleAmount); + GL11.glEnable(GL11.GL_NORMALIZE); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + return 1; + } + else + { + if (par2 == 1) + { + GL11.glDisable(GL11.GL_BLEND); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + } + + return -1; + } + } + +// /** +// * sets the scale for the slime based on getSlimeSize in EntitySlime +// */ +// protected void scaleSlime(EntityNPCInterface par1EntitySlime, float par2) +// { +// float var3 = (float)par1EntitySlime.getSlimeSize(); +// float var4 = (par1EntitySlime.field_70812_c + (par1EntitySlime.field_70811_b - par1EntitySlime.field_70812_c) * par2) / (var3 * 0.5F + 1.0F); +// float var5 = 1.0F / (var4 + 1.0F); +// GL11.glScalef(var5 * var3, 1.0F / var5 * var3, var5 * var3); +// } +// +// /** +// * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args: +// * entityLiving, partialTickTime +// */ +// protected void preRenderCallback(EntityLiving par1EntityLiving, float par2) +// { +// this.scaleSlime((EntityNPCInterface)par1EntityLiving, par2); +// } + + /** + * Queries whether should render the specified pass or not. + */ + @Override + protected int shouldRenderPass(EntityLivingBase par1EntityLiving, int par2, float par3) + { + return this.shouldSlimeRenderPass((EntityNPCInterface)par1EntityLiving, par2, par3); + } +} diff --git a/src/main/java/noppes/npcs/client/renderer/RenderProjectile.java b/src/main/java/noppes/npcs/client/renderer/RenderProjectile.java new file mode 100644 index 000000000..33e1ff51f --- /dev/null +++ b/src/main/java/noppes/npcs/client/renderer/RenderProjectile.java @@ -0,0 +1,316 @@ +package noppes.npcs.client.renderer; + +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.ItemRenderer; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.entity.Entity; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemPotion; +import net.minecraft.item.ItemStack; +import net.minecraft.potion.PotionHelper; +import net.minecraft.util.IIcon; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import noppes.npcs.entity.EntityProjectile; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class RenderProjectile extends Render +{ + + public boolean renderWithColor = true; + private static final ResourceLocation field_110780_a = new ResourceLocation("textures/entity/arrow.png"); + private static final ResourceLocation field_110798_h = new ResourceLocation("textures/misc/enchanted_item_glint.png"); + private RenderBlocks itemRenderBlocks = new RenderBlocks(); + + public void doRenderProjectile(EntityProjectile par1EntityProjectile, double par2, double par4, double par6, float par8, float par9) + { + GL11.glPushMatrix(); + GL11.glTranslatef((float)par2, (float)par4, (float)par6); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + float f = (float)par1EntityProjectile.getDataWatcher().getWatchableObjectInt(23) / 10.0F; + ItemStack item = par1EntityProjectile.getItemDisplay(); + GL11.glScalef(f, f, f); + Tessellator tessellator = Tessellator.instance; + + if (par1EntityProjectile.isArrow()) { //If it's the special case we are rendering an arrow + + this.bindEntityTexture(par1EntityProjectile); + GL11.glRotatef(par1EntityProjectile.prevRotationYaw + (par1EntityProjectile.rotationYaw - par1EntityProjectile.prevRotationYaw) * par9 - 90.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(par1EntityProjectile.prevRotationPitch + (par1EntityProjectile.rotationPitch - par1EntityProjectile.prevRotationPitch) * par9, 0.0F, 0.0F, 1.0F); + byte b0 = 0; + float f2 = 0.0F; + float f3 = 0.5F; + float f4 = (float)(0 + b0 * 10) / 32.0F; + float f5 = (float)(5 + b0 * 10) / 32.0F; + float f6 = 0.0F; + float f7 = 0.15625F; + float f8 = (float)(5 + b0 * 10) / 32.0F; + float f9 = (float)(10 + b0 * 10) / 32.0F; + float f10 = 0.05625F; + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + float f11 = (float)par1EntityProjectile.arrowShake - par9; + + if (f11 > 0.0F) + { + float f12 = -MathHelper.sin(f11 * 3.0F) * f11; + GL11.glRotatef(f12, 0.0F, 0.0F, 1.0F); + } + + GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F); + GL11.glScalef(f10, f10, f10); + GL11.glTranslatef(-4.0F, 0.0F, 0.0F); + GL11.glNormal3f(f10, 0.0F, 0.0F); + tessellator.startDrawingQuads(); + tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double)f6, (double)f8); + tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double)f7, (double)f8); + tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double)f7, (double)f9); + tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double)f6, (double)f9); + tessellator.draw(); + GL11.glNormal3f(-f10, 0.0F, 0.0F); + tessellator.startDrawingQuads(); + tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double)f6, (double)f8); + tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double)f7, (double)f8); + tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double)f7, (double)f9); + tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double)f6, (double)f9); + tessellator.draw(); + + for (int i = 0; i < 4; ++i) + { + GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); + GL11.glNormal3f(0.0F, 0.0F, f10); + tessellator.startDrawingQuads(); + tessellator.addVertexWithUV(-8.0D, -2.0D, 0.0D, (double)f2, (double)f4); + tessellator.addVertexWithUV(8.0D, -2.0D, 0.0D, (double)f3, (double)f4); + tessellator.addVertexWithUV(8.0D, 2.0D, 0.0D, (double)f3, (double)f5); + tessellator.addVertexWithUV(-8.0D, 2.0D, 0.0D, (double)f2, (double)f5); + tessellator.draw(); + } + } + + else if (par1EntityProjectile.is3D()) { + GL11.glRotatef(par1EntityProjectile.prevRotationYaw + (par1EntityProjectile.rotationYaw - par1EntityProjectile.prevRotationYaw) * par9 - 90.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(par1EntityProjectile.prevRotationPitch + (par1EntityProjectile.rotationPitch - par1EntityProjectile.prevRotationPitch) * par9 - 180, 0.0F, 0.0F, 1.0F); + + //Render a block + if (item.getItemSpriteNumber() == 0 && item.getItem() instanceof ItemBlock && RenderBlocks.renderItemIn3d(Block.getBlockFromItem(item.getItem()).getRenderType())) + { + Block block = Block.getBlockFromItem(item.getItem()); + this.bindTexture(TextureMap.locationBlocksTexture); + float f7 = 0.25F; + int j = block.getRenderType(); + + if (j == 1 || j == 19 || j == 12 || j == 2) + { + f7 = 0.5F; + } + + float f5 = 1.0F; + this.itemRenderBlocks.renderBlockAsItem(block, item.getItemDamage(), 1.0F); + //this.renderBlocks.renderBlockAsItem(block, item.getItemDamage(), f5); + } + else //render a 3D item + { + float f4, f5, f6, f8; + GL11.glTranslatef(-0.6f, -0.6f, 0); + + if (item.getItem().requiresMultipleRenderPasses()) + { + + for (int k = 0; k < item.getItem().getRenderPasses(item.getItemDamage()); ++k) + { + IIcon icon = item.getItem().getIcon(item, k); + f8 = 1.0F; + + if (this.renderWithColor) + { + int i = item.getItem().getColorFromItemStack(item, k); + f5 = (float)(i >> 16 & 255) / 255.0F; + f4 = (float)(i >> 8 & 255) / 255.0F; + f6 = (float)(i & 255) / 255.0F; + GL11.glColor4f(f5 * f8, f4 * f8, f6 * f8, 1.0F); + this.renderManager.itemRenderer.renderItem(Minecraft.getMinecraft().thePlayer, item, 0); + } + else + { + this.renderManager.itemRenderer.renderItem(Minecraft.getMinecraft().thePlayer, item, 0); + } + } + } + else + { + + IIcon icon1 = item.getIconIndex(); + + if (this.renderWithColor) + { + int l = item.getItem().getColorFromItemStack(item, 0); + f8 = (float)(l >> 16 & 255) / 255.0F; + float f9 = (float)(l >> 8 & 255) / 255.0F; + f5 = (float)(l & 255) / 255.0F; + f4 = 1.0F; + this.renderDroppedItem(item, icon1, par9, f8 * f4, f9 * f4, f5 * f4, f); + } + else + { + this.renderDroppedItem(item, icon1, par9, 1.0F, 1.0F, 1.0F, f); + } + } + } + } + else //If the render is a sprite + { +// IIcon icon = item.getIconIndex(); + IIcon icon = item.getItem().getIconFromDamage(item.getItemDamage()); + + this.bindTexture(TextureMap.locationItemsTexture); + if (item.getItem().requiresMultipleRenderPasses()) + { + for (int k = 0; k < item.getItem().getRenderPasses(item.getItemDamage()); ++k) + { + int i = item.getItem().getColorFromItemStack(item, k); + float f5 = (float)(i >> 16 & 255) / 255.0F; + float f4 = (float)(i >> 8 & 255) / 255.0F; + float f6 = (float)(i & 255) / 255.0F; + GL11.glColor4f(f5, f4, f6, 1.0F); + } + } + if (icon == ItemPotion.func_94589_d("bottle_splash") || icon == ItemPotion.func_94589_d("bottle_drinkable")) + { + int var12 = PotionHelper.func_77915_a(item.getItemDamage(), false); + float var13 = (float)(var12 >> 16 & 255) / 255.0F; + float var14 = (float)(var12 >> 8 & 255) / 255.0F; + float var15 = (float)(var12 & 255) / 255.0F; + GL11.glColor3f(var13, var14, var15); + GL11.glPushMatrix(); + this.renderSprite(tessellator, ItemPotion.func_94589_d("overlay")); + GL11.glPopMatrix(); + GL11.glColor3f(1.0F, 1.0F, 1.0F); + } + this.renderSprite(tessellator, icon); + } + if (par1EntityProjectile.is3D() && par1EntityProjectile.glows()) { + GL11.glDisable(GL11.GL_LIGHTING); + } + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + GL11.glPopMatrix(); + GL11.glEnable(GL11.GL_LIGHTING); + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render= 4){ + this.bindTexture(resource3); + anvil.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + } + else{ + this.bindTexture(field_110631_g); + model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + } + GL11.glPopMatrix(); + } + + + @Override + public void renderInventoryBlock(Block block, int metadata, int modelId, + RenderBlocks renderer) { + GL11.glPushMatrix(); + GL11.glTranslatef(0, 0.85f, 0); + GL11.glRotatef(180, 0, 0, 1); + GL11.glRotatef(180, 0, 1, 0); + + GL11.glColor3f(1, 1, 1); + if(metadata == 0){ + this.bindTexture(field_110631_g); + model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + } + else{ + this.bindTexture(resource3); + anvil.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + } + + GL11.glPopMatrix(); + } + + + @Override + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, + Block block, int modelId, RenderBlocks renderer) { + // TODO Auto-generated method stub + return false; + } + + + @Override + public boolean shouldRender3DInInventory(int modelId) { + return true; + } + + + @Override + public int getRenderId() { + return CustomItems.carpentyBench.getRenderType(); + } +} diff --git a/src/main/java/noppes/npcs/client/renderer/blocks/BlockChairRenderer.java b/src/main/java/noppes/npcs/client/renderer/blocks/BlockChairRenderer.java new file mode 100644 index 000000000..94d1a371f --- /dev/null +++ b/src/main/java/noppes/npcs/client/renderer/blocks/BlockChairRenderer.java @@ -0,0 +1,85 @@ +package noppes.npcs.client.renderer.blocks; + +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.ItemRenderer; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.entity.RenderFireball; +import net.minecraft.client.renderer.entity.RenderItem; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.entity.projectile.EntityFireball; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.IBlockAccess; +import noppes.npcs.CustomItems; +import noppes.npcs.blocks.BlockChair; +import noppes.npcs.blocks.tiles.TileBanner; +import noppes.npcs.blocks.tiles.TileColorable; +import noppes.npcs.client.model.blocks.ModelBanner; +import noppes.npcs.client.model.blocks.ModelBannerFlag; +import noppes.npcs.client.model.blocks.ModelCarpentryBench; +import noppes.npcs.client.model.blocks.ModelChair; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; +import cpw.mods.fml.client.registry.RenderingRegistry; + +public class BlockChairRenderer extends BlockRendererInterface{ + + private final ModelChair model = new ModelChair(); + + public BlockChairRenderer(){ + ((BlockChair)CustomItems.chair).renderId = RenderingRegistry.getNextAvailableRenderId(); + RenderingRegistry.registerBlockHandler(this); + } + @Override + public void renderTileEntityAt(TileEntity var1, double var2, double var4, + double var6, float var8) { + TileColorable tile = (TileColorable) var1; + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + GL11.glPushMatrix(); + GL11.glTranslatef((float)var2 + 0.5f, (float)var4 + 1.68f, (float)var6 + 0.5f); + GL11.glScalef(1.2f, 1.1f, 1.2f); + GL11.glRotatef(180, 0, 0, 1); + GL11.glRotatef(90 * tile.rotation, 0, 1, 0); + GL11.glColor3f(1, 1, 1); + + setWoodTexture(var1.getBlockMetadata()); + model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + + GL11.glPopMatrix(); + } + + @Override + public void renderInventoryBlock(Block block, int metadata, int modelId, + RenderBlocks renderer) { + GL11.glPushMatrix(); + GL11.glTranslatef(0, 1f, 0); + GL11.glScalef(1.2f, 1.1f, 1.2f); + GL11.glRotatef(180, 0, 0, 1); + GL11.glRotatef(180, 0, 1, 0); + + setWoodTexture(metadata); + GL11.glColor3f(1, 1, 1); + model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + + GL11.glPopMatrix(); + } + + + + @Override + public int getRenderId() { + return CustomItems.chair.getRenderType(); + } +} diff --git a/src/main/java/noppes/npcs/client/renderer/blocks/BlockCouchWoodRenderer.java b/src/main/java/noppes/npcs/client/renderer/blocks/BlockCouchWoodRenderer.java new file mode 100644 index 000000000..b38135520 --- /dev/null +++ b/src/main/java/noppes/npcs/client/renderer/blocks/BlockCouchWoodRenderer.java @@ -0,0 +1,84 @@ +package noppes.npcs.client.renderer.blocks; + +import net.minecraft.block.Block; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.IBlockAccess; +import noppes.npcs.CustomItems; +import noppes.npcs.blocks.BlockCouchWood; +import noppes.npcs.blocks.tiles.TileCouchWood; +import noppes.npcs.blocks.tiles.TileCouchWool; +import noppes.npcs.client.model.blocks.ModelCouchWoodLeft; +import noppes.npcs.client.model.blocks.ModelCouchWoodMiddle; +import noppes.npcs.client.model.blocks.ModelCouchWoodRight; +import noppes.npcs.client.model.blocks.ModelCouchWoodSingle; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; +import cpw.mods.fml.client.registry.RenderingRegistry; + +public class BlockCouchWoodRenderer extends BlockRendererInterface{ + + private final ModelBase model = new ModelCouchWoodMiddle(); + + private final ModelBase modelLeft = new ModelCouchWoodLeft(); + + private final ModelBase modelRight = new ModelCouchWoodRight(); + + private final ModelBase modelCorner = new ModelCouchWoodSingle(); + + public BlockCouchWoodRenderer(){ + ((BlockCouchWood)CustomItems.couchWood).renderId = RenderingRegistry.getNextAvailableRenderId(); + RenderingRegistry.registerBlockHandler(this); + } + @Override + public void renderTileEntityAt(TileEntity var1, double var2, double var4, + double var6, float var8) { + TileCouchWood tile = (TileCouchWood) var1; + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + GL11.glPushMatrix(); + GL11.glTranslatef((float)var2 + 0.5f, (float)var4 + 1.5f, (float)var6 + 0.5f); + //GL11.glScalef(0.95f, 0.95f, 0.95f); + GL11.glRotatef(180, 0, 0, 1); + GL11.glRotatef(90 * tile.rotation, 0, 1, 0); + GL11.glColor3f(1, 1, 1); + + setWoodTexture(var1.getBlockMetadata()); + if(tile.hasLeft && tile.hasRight) + model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + else if(tile.hasLeft) + modelLeft.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + else if(tile.hasRight) + modelRight.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + else + modelCorner.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + + GL11.glPopMatrix(); + } + + @Override + public void renderInventoryBlock(Block block, int metadata, int modelId, + RenderBlocks renderer) { + GL11.glPushMatrix(); + GL11.glTranslatef(0, 0.9f, 0.1f); + GL11.glScalef(0.9f, 0.9f, 0.9f); + GL11.glRotatef(180, 0, 0, 1); + GL11.glRotatef(180, 0, 1, 0); + + setWoodTexture(metadata); + GL11.glColor3f(1, 1, 1); + modelCorner.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + + GL11.glPopMatrix(); + } + + + @Override + public int getRenderId() { + return CustomItems.couchWood.getRenderType(); + } +} diff --git a/src/main/java/noppes/npcs/client/renderer/blocks/BlockCouchWoolRenderer.java b/src/main/java/noppes/npcs/client/renderer/blocks/BlockCouchWoolRenderer.java new file mode 100644 index 000000000..f0ff68951 --- /dev/null +++ b/src/main/java/noppes/npcs/client/renderer/blocks/BlockCouchWoolRenderer.java @@ -0,0 +1,115 @@ +package noppes.npcs.client.renderer.blocks; + +import net.minecraft.block.Block; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.IBlockAccess; +import noppes.npcs.CustomItems; +import noppes.npcs.blocks.BlockCouchWool; +import noppes.npcs.blocks.tiles.TileCouchWool; +import noppes.npcs.client.model.blocks.ModelCouchCorner; +import noppes.npcs.client.model.blocks.ModelCouchCornerWool; +import noppes.npcs.client.model.blocks.ModelCouchLeft; +import noppes.npcs.client.model.blocks.ModelCouchLeftWool; +import noppes.npcs.client.model.blocks.ModelCouchMiddle; +import noppes.npcs.client.model.blocks.ModelCouchMiddleWool; +import noppes.npcs.client.model.blocks.ModelCouchRight; +import noppes.npcs.client.model.blocks.ModelCouchRightWool; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; +import cpw.mods.fml.client.registry.RenderingRegistry; + +public class BlockCouchWoolRenderer extends BlockRendererInterface{ + + private final ModelBase model = new ModelCouchMiddle(); + private final ModelBase model2 = new ModelCouchMiddleWool(); + + private final ModelBase modelLeft = new ModelCouchLeft(); + private final ModelBase modelLeft2 = new ModelCouchLeftWool(); + + private final ModelBase modelRight = new ModelCouchRight(); + private final ModelBase modelRight2 = new ModelCouchRightWool(); + + private final ModelBase modelCorner = new ModelCouchCorner(); + private final ModelBase modelCorner2 = new ModelCouchCornerWool(); + + public BlockCouchWoolRenderer(){ + ((BlockCouchWool)CustomItems.couchWool).renderId = RenderingRegistry.getNextAvailableRenderId(); + RenderingRegistry.registerBlockHandler(this); + } + @Override + public void renderTileEntityAt(TileEntity var1, double var2, double var4, + double var6, float var8) { + TileCouchWool tile = (TileCouchWool) var1; + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + GL11.glPushMatrix(); + GL11.glTranslatef((float)var2 + 0.5f, (float)var4 + 1.5f, (float)var6 + 0.5f); + //GL11.glScalef(0.95f, 0.95f, 0.95f); + GL11.glRotatef(180, 0, 0, 1); + GL11.glRotatef(90 * tile.rotation, 0, 1, 0); + GL11.glColor3f(1, 1, 1); + + setWoodTexture(var1.getBlockMetadata()); + if(tile.hasCornerLeft) + modelCorner.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + else if(tile.hasCornerRight){ + GL11.glRotatef(90, 0, 1, 0); + modelCorner.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + } + else if(tile.hasLeft && tile.hasRight) + model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + else if(tile.hasLeft) + modelLeft.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + else if(tile.hasRight) + modelRight.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + else + model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + + this.bindTexture(BlockTallLampRenderer.resourceTop); + float[] color = BlockBannerRenderer.colorTable[tile.color]; + GL11.glColor3f(color[0], color[1], color[2]); + + if(tile.hasCornerLeft || tile.hasCornerRight) + modelCorner2.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + else if(tile.hasLeft && tile.hasRight) + model2.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + else if(tile.hasLeft) + modelLeft2.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + else if(tile.hasRight) + modelRight2.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + else + model2.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + + GL11.glPopMatrix(); + } + + @Override + public void renderInventoryBlock(Block block, int metadata, int modelId, + RenderBlocks renderer) { + GL11.glPushMatrix(); + GL11.glTranslatef(0, 0.9f, 0.1f); + GL11.glScalef(0.9f, 0.9f, 0.9f); + GL11.glRotatef(180, 0, 0, 1); + GL11.glRotatef(180, 0, 1, 0); + + setWoodTexture(metadata); + GL11.glColor3f(1, 1, 1); + model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + + this.bindTexture(BlockTallLampRenderer.resourceTop); + float[] color = BlockBannerRenderer.colorTable[15 - metadata]; + GL11.glColor3f(color[0], color[1], color[2]); + model2.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + GL11.glPopMatrix(); + } + + @Override + public int getRenderId() { + return CustomItems.couchWool.getRenderType(); + } +} diff --git a/src/main/java/noppes/npcs/client/renderer/blocks/BlockCrateRenderer.java b/src/main/java/noppes/npcs/client/renderer/blocks/BlockCrateRenderer.java new file mode 100644 index 000000000..38e8b088f --- /dev/null +++ b/src/main/java/noppes/npcs/client/renderer/blocks/BlockCrateRenderer.java @@ -0,0 +1,62 @@ +package noppes.npcs.client.renderer.blocks; + +import net.minecraft.block.Block; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.tileentity.TileEntity; +import noppes.npcs.CustomItems; +import noppes.npcs.blocks.BlockCrate; +import noppes.npcs.blocks.tiles.TileColorable; +import noppes.npcs.client.model.blocks.ModelCrate; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +import cpw.mods.fml.client.registry.RenderingRegistry; + +public class BlockCrateRenderer extends BlockRendererInterface{ + + private final ModelCrate model = new ModelCrate(); + + public BlockCrateRenderer(){ + ((BlockCrate)CustomItems.crate).renderId = RenderingRegistry.getNextAvailableRenderId(); + RenderingRegistry.registerBlockHandler(this); + } + @Override + public void renderTileEntityAt(TileEntity var1, double var2, double var4, + double var6, float var8) { + TileColorable tile = (TileColorable) var1; + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + GL11.glPushMatrix(); + GL11.glTranslatef((float)var2 + 0.5f, (float)var4 + 1.5f, (float)var6 + 0.5f); + //GL11.glScalef(0.85f, 0.85f, 0.7f); + GL11.glRotatef(180, 0, 0, 1); + GL11.glRotatef(90 * tile.rotation, 0, 1, 0); + GL11.glColor3f(1, 1, 1); + + setWoodTexture(var1.getBlockMetadata()); + model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + + GL11.glPopMatrix(); + } + + @Override + public void renderInventoryBlock(Block block, int metadata, int modelId, + RenderBlocks renderer) { + GL11.glPushMatrix(); + GL11.glTranslatef(0, 0.99f, 0); + //GL11.glScalef(0.7f, 0.7f, 0.7f); + GL11.glRotatef(180, 0, 0, 1); + GL11.glRotatef(180, 0, 1, 0); + + setWoodTexture(metadata); + GL11.glColor3f(1, 1, 1); + model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + + GL11.glPopMatrix(); + } + + @Override + public int getRenderId() { + return CustomItems.crate.getRenderType(); + } +} diff --git a/src/main/java/noppes/npcs/client/renderer/blocks/BlockLampRenderer.java b/src/main/java/noppes/npcs/client/renderer/blocks/BlockLampRenderer.java new file mode 100644 index 000000000..4909c469a --- /dev/null +++ b/src/main/java/noppes/npcs/client/renderer/blocks/BlockLampRenderer.java @@ -0,0 +1,93 @@ +package noppes.npcs.client.renderer.blocks; + +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.IBlockAccess; +import noppes.npcs.CustomItems; +import noppes.npcs.blocks.BlockLamp; +import noppes.npcs.blocks.tiles.TileLamp; +import noppes.npcs.client.model.blocks.ModelLamp; +import noppes.npcs.client.model.blocks.ModelLampCeiling; +import noppes.npcs.client.model.blocks.ModelLampWall; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; +import cpw.mods.fml.client.registry.RenderingRegistry; + +public class BlockLampRenderer extends TileEntitySpecialRenderer implements ISimpleBlockRenderingHandler{ + + private final ModelLamp model = new ModelLamp(); + private final ModelLampCeiling model2 = new ModelLampCeiling(); + private final ModelLampWall model3 = new ModelLampWall(); + private static final ResourceLocation resource1 = new ResourceLocation("customnpcs","textures/models/Lamp.png"); + + public BlockLampRenderer(){ + ((BlockLamp)CustomItems.lamp).renderId = RenderingRegistry.getNextAvailableRenderId(); + ((BlockLamp)CustomItems.lamp_unlit).renderId = ((BlockLamp)CustomItems.lamp).renderId; + RenderingRegistry.registerBlockHandler(this); + } + + @Override + public void renderTileEntityAt(TileEntity var1, double var2, double var4, + double var6, float var8) { + TileLamp tile = (TileLamp) var1; + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + GL11.glPushMatrix(); + GL11.glTranslatef((float)var2 + 0.5f, (float)var4 + 1.5f, (float)var6 + 0.5f); + //GL11.glScalef(0.95f, 0.95f, 0.95f); + GL11.glRotatef(180, 0, 0, 1); + GL11.glRotatef(45 * tile.rotation, 0, 1, 0); + GL11.glColor3f(1, 1, 1); + + Minecraft.getMinecraft().getTextureManager().bindTexture(resource1); + if(tile.color == 0) + model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + else if(tile.color == 1) + model2.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + else + model3.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + + GL11.glPopMatrix(); + } + + @Override + public void renderInventoryBlock(Block block, int metadata, int modelId, + RenderBlocks renderer) { + GL11.glPushMatrix(); + GL11.glTranslatef(0, 2.2f, 0); + GL11.glScalef(2f, 2f, 2f); + GL11.glRotatef(180, 0, 0, 1); + GL11.glRotatef(180, 0, 1, 0); + + Minecraft.getMinecraft().getTextureManager().bindTexture(resource1); + GL11.glColor3f(1, 1, 1); + model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + + GL11.glPopMatrix(); + } + + + @Override + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, + Block block, int modelId, RenderBlocks renderer) { + return false; + } + + + @Override + public boolean shouldRender3DInInventory(int modelId) { + return true; + } + + + @Override + public int getRenderId() { + return CustomItems.lamp.getRenderType(); + } +} diff --git a/src/main/java/noppes/npcs/client/renderer/blocks/BlockMailboxRenderer.java b/src/main/java/noppes/npcs/client/renderer/blocks/BlockMailboxRenderer.java new file mode 100644 index 000000000..931ff65ed --- /dev/null +++ b/src/main/java/noppes/npcs/client/renderer/blocks/BlockMailboxRenderer.java @@ -0,0 +1,84 @@ +package noppes.npcs.client.renderer.blocks; + +import net.minecraft.block.Block; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.IBlockAccess; +import noppes.npcs.CustomItems; +import noppes.npcs.blocks.BlockMailbox; +import noppes.npcs.client.model.blocks.ModelMailboxUS; +import noppes.npcs.client.model.blocks.ModelMailboxWow; + +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; +import cpw.mods.fml.client.registry.RenderingRegistry; + +public class BlockMailboxRenderer extends TileEntitySpecialRenderer implements ISimpleBlockRenderingHandler{ + + private final ModelMailboxUS model = new ModelMailboxUS(); + private final ModelMailboxWow model2 = new ModelMailboxWow(); + + private static final ResourceLocation text1 = new ResourceLocation("customnpcs","textures/models/mailbox1.png"); + private static final ResourceLocation text2 = new ResourceLocation("customnpcs","textures/models/mailbox2.png"); + + public BlockMailboxRenderer(){ + ((BlockMailbox)CustomItems.mailbox).renderId = RenderingRegistry.getNextAvailableRenderId(); + RenderingRegistry.registerBlockHandler(this); + } + @Override + public void renderTileEntityAt(TileEntity var1, double var2, double var4, double var6, float var8) { + int meta = var1.getBlockMetadata() | 4; + int type = var1.getBlockMetadata() >> 2; + GL11.glPushMatrix(); + GL11.glTranslatef((float)var2 + 0.5f, (float)var4 + 1.5f, (float)var6 + 0.5f); + GL11.glRotatef(180, 0, 0, 1); + GL11.glRotatef(90 * meta, 0, 1, 0); + if(type == 0){ + this.bindTexture(text1); + model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + } + if(type == 1){ + this.bindTexture(text2); + model2.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + } + GL11.glPopMatrix(); + } + + @Override + public void renderInventoryBlock(Block block, int metadata, int modelID, + RenderBlocks renderer) { + GL11.glPushMatrix(); + GL11.glTranslatef(0, 0.74f, 0); + GL11.glScalef(0.9f, 0.86f, 0.9f); + GL11.glRotatef(180, 0, 0, 1); + GL11.glRotatef(180, 0, 1, 0); + if(metadata == 0){ + this.bindTexture(text1); + model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + } + if(metadata == 1){ + this.bindTexture(text2); + model2.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + } + GL11.glPopMatrix(); + } + + @Override + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, + Block block, int modelId, RenderBlocks renderer) { + return false; + } + + @Override + public int getRenderId() { + return CustomItems.mailbox.getRenderType(); + } + + @Override + public boolean shouldRender3DInInventory(int modelId) { + return true; + } +} diff --git a/src/main/java/noppes/npcs/client/renderer/blocks/BlockPedestalRenderer.java b/src/main/java/noppes/npcs/client/renderer/blocks/BlockPedestalRenderer.java new file mode 100644 index 000000000..ccc168b60 --- /dev/null +++ b/src/main/java/noppes/npcs/client/renderer/blocks/BlockPedestalRenderer.java @@ -0,0 +1,122 @@ +package noppes.npcs.client.renderer.blocks; + +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; +import noppes.npcs.CustomItems; +import noppes.npcs.blocks.BlockRotated; +import noppes.npcs.blocks.tiles.TilePedestal; +import noppes.npcs.client.model.blocks.ModelPedestal; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +import cpw.mods.fml.client.registry.RenderingRegistry; + +public class BlockPedestalRenderer extends BlockRendererInterface{ + + private final ModelPedestal model = new ModelPedestal(); + private final static ResourceLocation resource = new ResourceLocation("customnpcs:textures/models/npcPedestal.png"); + + public BlockPedestalRenderer(){ + ((BlockRotated)CustomItems.pedestal).renderId = RenderingRegistry.getNextAvailableRenderId(); + RenderingRegistry.registerBlockHandler(this); + } + + @Override + public void renderTileEntityAt(TileEntity var1, double var2, double var4, + double var6, float var8) { + TilePedestal tile = (TilePedestal) var1; + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glPushMatrix(); + GL11.glTranslatef((float)var2 + 0.5f, (float)var4 + 1.5f, (float)var6 + 0.5f); + //GL11.glScalef(0.95f, 0.95f, 0.95f); + GL11.glRotatef(180, 0, 0, 1); + GL11.glRotatef(90 * tile.rotation, 0, 1, 0); + GL11.glColor3f(1, 1, 1); + + setMaterialTexture(var1.getBlockMetadata()); + model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + GL11.glScalef(1f, 0.99f, 1f); + TextureManager manager = Minecraft.getMinecraft().getTextureManager(); + manager.bindTexture(resource); + model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + if(!this.playerTooFar(tile)) + doRender(tile.getStackInSlot(0)); + GL11.glPopMatrix(); + GL11.glColor3f(1, 1, 1); + } + private void doRender(ItemStack item){ + if(item == null || item.getItem() == null || item.getItem() instanceof ItemBlock) + return; + GL11.glPushMatrix(); + GL11.glTranslatef(0.06f, 0.30f, 0.02f); + GL11.glRotatef(180, 0, 0, 1); + GL11.glRotatef(90, 0, 1, 0); + GL11.glScalef(0.6f, 0.6f, 0.6f); + if(item.getItem().shouldRotateAroundWhenRendering()){ + GL11.glTranslatef(0.14f, 0, 0.5f); + GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); + } + else + GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(-200.0F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(-50.0F, 0.0F, 1.0F, 0.0F); + + if (item.getItem().requiresMultipleRenderPasses()) + { + for (int k = 0; k <= item.getItem().getRenderPasses(item.getItemDamage()); ++k) + { + int i = item.getItem().getColorFromItemStack(item, k); + float f12 = (float)(i >> 16 & 255) / 255.0F; + float f4 = (float)(i >> 8 & 255) / 255.0F; + float f5 = (float)(i & 255) / 255.0F; + GL11.glColor4f(f12, f4, f5, 1.0F); + RenderManager.instance.itemRenderer.renderItem(Minecraft.getMinecraft().thePlayer, item, k); + } + } + else + { + int k = item.getItem().getColorFromItemStack(item, 0); + float f11 = (float)(k >> 16 & 255) / 255.0F; + float f12 = (float)(k >> 8 & 255) / 255.0F; + float f4 = (float)(k & 255) / 255.0F; + GL11.glColor4f(f11, f12, f4, 1.0F); + RenderManager.instance.itemRenderer.renderItem(Minecraft.getMinecraft().thePlayer, item, 0); + } + GL11.glPopMatrix(); + + } + + @Override + public void renderInventoryBlock(Block block, int metadata, int modelId, + RenderBlocks renderer) { + GL11.glPushMatrix(); + GL11.glTranslatef(0, 0.44f, 0); + GL11.glScalef(0.76f, 0.66f, 0.76f); + GL11.glRotatef(180, 0, 0, 1); + GL11.glRotatef(180, 0, 1, 0); + + setMaterialTexture(metadata); + GL11.glColor3f(1, 1, 1); + model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + + GL11.glPopMatrix(); + } + + @Override + public int getRenderId() { + return CustomItems.pedestal.getRenderType(); + } + + public int specialRenderDistance(){ + return 40; + } +} diff --git a/src/main/java/noppes/npcs/client/renderer/blocks/BlockRendererInterface.java b/src/main/java/noppes/npcs/client/renderer/blocks/BlockRendererInterface.java new file mode 100644 index 000000000..c57a60d04 --- /dev/null +++ b/src/main/java/noppes/npcs/client/renderer/blocks/BlockRendererInterface.java @@ -0,0 +1,120 @@ +package noppes.npcs.client.renderer.blocks; + +import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.entity.RenderItem; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.IBlockAccess; + +public abstract class BlockRendererInterface extends TileEntitySpecialRenderer implements ISimpleBlockRenderingHandler{ + protected static final ResourceLocation Stone = new ResourceLocation("customnpcs","textures/cache/stone.png"); + protected static final ResourceLocation Iron = new ResourceLocation("customnpcs","textures/cache/iron_block.png"); + protected static final ResourceLocation Gold = new ResourceLocation("customnpcs","textures/cache/gold_block.png"); + protected static final ResourceLocation Diamond = new ResourceLocation("customnpcs","textures/cache/diamond_block.png"); + + protected static final ResourceLocation PlanksOak = new ResourceLocation("customnpcs","textures/cache/planks_oak.png"); + protected static final ResourceLocation PlanksBigOak = new ResourceLocation("customnpcs","textures/cache/planks_big_oak.png"); + protected static final ResourceLocation PlanksSpruce = new ResourceLocation("customnpcs","textures/cache/planks_spruce.png"); + protected static final ResourceLocation PlanksBirch = new ResourceLocation("customnpcs","textures/cache/planks_birch.png"); + protected static final ResourceLocation PlanksAcacia = new ResourceLocation("customnpcs","textures/cache/planks_acacia.png"); + protected static final ResourceLocation PlanksJungle = new ResourceLocation("customnpcs","textures/cache/planks_jungle.png"); + + protected static final ResourceLocation Steel = new ResourceLocation("customnpcs","textures/models/Steel.png"); + protected static final RenderItem renderer = new RenderItem(); + + public static float colorTable[][] = { + { + 1.0F, 1.0F, 1.0F + }, { + 0.95F, 0.7F, 0.2F + }, { + 0.9F, 0.5F, 0.85F + }, { + 0.6F, 0.7F, 0.95F + }, { + 0.9F, 0.9F, 0.2F + }, { + 0.5F, 0.8F, 0.1F + }, { + 0.95F, 0.7F, 0.8F + }, { + 0.3F, 0.3F, 0.3F + }, { + 0.6F, 0.6F, 0.6F + }, { + 0.3F, 0.6F, 0.7F + }, { + 0.7F, 0.4F, 0.9F + }, { + 0.2F, 0.4F, 0.8F + }, { + 0.5F, 0.4F, 0.3F + }, { + 0.4F, 0.5F, 0.2F + }, { + 0.8F, 0.3F, 0.3F + }, { + 0.1F, 0.1F, 0.1F + } + }; + @Override + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, + Block block, int modelId, RenderBlocks renderer) { + return false; + } + + + @Override + public boolean shouldRender3DInInventory(int modelId) { + return true; + } + + + public boolean playerTooFar(TileEntity tile){ + Minecraft mc = Minecraft.getMinecraft(); + double d6 = mc.renderViewEntity.posX - tile.xCoord; + double d7 = mc.renderViewEntity.posY - tile.yCoord; + double d8 = mc.renderViewEntity.posZ - tile.zCoord;; + + return d6 * d6 + d7 * d7 + d8 * d8 > specialRenderDistance() * specialRenderDistance(); + } + + public int specialRenderDistance(){ + return 20; + } + public void setWoodTexture(int meta){ + TextureManager manager = Minecraft.getMinecraft().getTextureManager(); + if(meta == 1) + manager.bindTexture(PlanksSpruce); + else if(meta == 2) + manager.bindTexture(PlanksBirch); + else if(meta == 3) + manager.bindTexture(PlanksJungle); + else if(meta == 4) + manager.bindTexture(PlanksAcacia); + else if(meta == 5) + manager.bindTexture(PlanksBigOak); + else + manager.bindTexture(PlanksOak); + } + + public static void setMaterialTexture(int meta){ + TextureManager manager = Minecraft.getMinecraft().getTextureManager(); + if(meta == 1) + manager.bindTexture(Stone); + else if(meta == 2) + manager.bindTexture(Iron); + else if(meta == 3) + manager.bindTexture(Gold); + else if(meta == 4) + manager.bindTexture(Diamond); + else + manager.bindTexture(PlanksOak); + + } +} diff --git a/src/main/java/noppes/npcs/client/renderer/blocks/BlockShelfRenderer.java b/src/main/java/noppes/npcs/client/renderer/blocks/BlockShelfRenderer.java new file mode 100644 index 000000000..b06dcb3d4 --- /dev/null +++ b/src/main/java/noppes/npcs/client/renderer/blocks/BlockShelfRenderer.java @@ -0,0 +1,101 @@ +package noppes.npcs.client.renderer.blocks; + +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import noppes.npcs.CustomItems; +import noppes.npcs.blocks.BlockChair; +import noppes.npcs.blocks.BlockRotated; +import noppes.npcs.blocks.tiles.TileColorable; +import noppes.npcs.blocks.tiles.TileShelf; +import noppes.npcs.client.model.blocks.ModelShelf; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +import cpw.mods.fml.client.registry.RenderingRegistry; + +public class BlockShelfRenderer extends BlockRendererInterface{ + + private final ModelShelf model = new ModelShelf(); + + public BlockShelfRenderer(){ + ((BlockRotated)CustomItems.shelf).renderId = RenderingRegistry.getNextAvailableRenderId(); + RenderingRegistry.registerBlockHandler(this); + } + @Override + public void renderTileEntityAt(TileEntity var1, double var2, double var4, + double var6, float var8) { + TileColorable tile = (TileColorable) var1; + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + GL11.glPushMatrix(); + GL11.glTranslatef((float)var2 + 0.5f, (float)var4 + 1.5f, (float)var6 + 0.5f); + //GL11.glScalef(1.2f, 1.1f, 1.2f); + GL11.glRotatef(180, 0, 0, 1); + GL11.glRotatef(90 * tile.rotation, 0, 1, 0); + GL11.glColor3f(1, 1, 1); + + boolean drawLeft = true; + boolean drawRight = true; + + if(tile.rotation == 3){ + drawLeft = shouldDraw(var1.getWorldObj(), var1.xCoord, var1.yCoord, var1.zCoord - 1, 3); + drawRight = shouldDraw(var1.getWorldObj(), var1.xCoord, var1.yCoord, var1.zCoord + 1, 3); + } + else if(tile.rotation == 1){ + drawLeft = shouldDraw(var1.getWorldObj(), var1.xCoord, var1.yCoord, var1.zCoord + 1, 1); + drawRight = shouldDraw(var1.getWorldObj(), var1.xCoord, var1.yCoord, var1.zCoord - 1, 1); + } + else if(tile.rotation == 0){ + drawLeft = shouldDraw(var1.getWorldObj(), var1.xCoord + 1, var1.yCoord, var1.zCoord, 0); + drawRight = shouldDraw(var1.getWorldObj(), var1.xCoord - 1, var1.yCoord, var1.zCoord, 0); + } + else if(tile.rotation == 2){ + drawLeft = shouldDraw(var1.getWorldObj(), var1.xCoord - 1, var1.yCoord, var1.zCoord, 2); + drawRight = shouldDraw(var1.getWorldObj(), var1.xCoord + 1, var1.yCoord, var1.zCoord, 2); + } + + + model.SupportLeft1.showModel = model.SupportLeft2.showModel = drawLeft; + model.SupportRight1.showModel = model.SupportRight2.showModel = drawRight; + + setWoodTexture(var1.getBlockMetadata()); + model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + + GL11.glPopMatrix(); + } + private boolean shouldDraw(World world,int x, int y, int z, int rotation){ + TileEntity tile = world.getTileEntity(x, y, z); + if(tile == null || !(tile instanceof TileShelf)) + return true; + return ((TileShelf)tile).rotation != rotation; + } + + @Override + public void renderInventoryBlock(Block block, int metadata, int modelId, + RenderBlocks renderer) { + GL11.glPushMatrix(); + GL11.glTranslatef(0, 0.6f, 0); + GL11.glScalef(1f, 1f, 1f); + GL11.glRotatef(180, 0, 0, 1); + GL11.glRotatef(180, 0, 1, 0); + + setWoodTexture(metadata); + GL11.glColor3f(1, 1, 1); + model.SupportLeft1.showModel = model.SupportLeft2.showModel = true; + model.SupportRight1.showModel = model.SupportRight2.showModel = true; + model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + + GL11.glPopMatrix(); + } + + + + @Override + public int getRenderId() { + return CustomItems.shelf.getRenderType(); + } +} diff --git a/src/main/java/noppes/npcs/client/renderer/blocks/BlockSignRenderer.java b/src/main/java/noppes/npcs/client/renderer/blocks/BlockSignRenderer.java new file mode 100644 index 000000000..5d108f5b1 --- /dev/null +++ b/src/main/java/noppes/npcs/client/renderer/blocks/BlockSignRenderer.java @@ -0,0 +1,97 @@ +package noppes.npcs.client.renderer.blocks; + +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import noppes.npcs.CustomItems; +import noppes.npcs.blocks.BlockRotated; +import noppes.npcs.blocks.tiles.TileSign; +import noppes.npcs.client.model.blocks.ModelSign; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +import cpw.mods.fml.client.registry.RenderingRegistry; + +public class BlockSignRenderer extends BlockRendererInterface{ + + private final ModelSign model = new ModelSign(); + + public BlockSignRenderer(){ + ((BlockRotated)CustomItems.sign).renderId = RenderingRegistry.getNextAvailableRenderId(); + RenderingRegistry.registerBlockHandler(this); + } + @Override + public void renderTileEntityAt(TileEntity var1, double var2, double var4, + double var6, float var8) { + TileSign tile = (TileSign) var1; + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + GL11.glPushMatrix(); + GL11.glTranslatef((float)var2 + 0.5f, (float)var4 + 1.62f, (float)var6 + 0.5f); + //GL11.glScalef(1.2f, 1.1f, 1.2f); + GL11.glRotatef(180, 0, 0, 1); + GL11.glRotatef(90 * tile.rotation + 90, 0, 1, 0); + GL11.glColor3f(1, 1, 1); + + Minecraft.getMinecraft().getTextureManager().bindTexture(Steel); + model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + + setWoodTexture(tile.getBlockMetadata()); + model.Sign.render(0.0625F); + + if(tile.icon != null && !this.playerTooFar(tile)){ + doRender(var2, var4, var6, tile.rotation, tile.icon); + } + + GL11.glPopMatrix(); + } + + public void doRender(double par2, double par4, double par6, int meta, ItemStack iicon) + { + if (iicon.getItemSpriteNumber() == 0 && RenderBlocks.renderItemIn3d(Block.getBlockFromItem(iicon.getItem()).getRenderType())) + return; + GL11.glPushMatrix(); + bindTexture(TextureMap.locationItemsTexture); + GL11.glTranslatef(0, 1.02f, -0.03f); + GL11.glDepthMask(false); + float f2 = 0.024f; + Minecraft mc = Minecraft.getMinecraft(); + GL11.glScalef(f2, f2, f2); + renderer.renderItemIntoGUI(this.func_147498_b(), mc.renderEngine, iicon, -8, -8); + GL11.glRotatef(180, 0, 1, 0); + GL11.glTranslatef(0, 0, -2.9f); + renderer.renderItemIntoGUI(this.func_147498_b(), mc.renderEngine, iicon, -8, -8); + GL11.glDepthMask(true); + GL11.glPopMatrix(); + } + + + @Override + public void renderInventoryBlock(Block block, int metadata, int modelId, + RenderBlocks renderer) { + GL11.glPushMatrix(); + GL11.glTranslatef(0, 0.6f, 0); + GL11.glScalef(1f, 1f, 1f); + GL11.glRotatef(180, 0, 0, 1); + GL11.glRotatef(180, 0, 1, 0); + GL11.glColor3f(1, 1, 1); + + Minecraft.getMinecraft().getTextureManager().bindTexture(Steel); + model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + + setWoodTexture(metadata); + model.Sign.render(0.0625F); + + GL11.glPopMatrix(); + } + + + + @Override + public int getRenderId() { + return CustomItems.sign.getRenderType(); + } +} diff --git a/src/main/java/noppes/npcs/client/renderer/blocks/BlockStoolRenderer.java b/src/main/java/noppes/npcs/client/renderer/blocks/BlockStoolRenderer.java new file mode 100644 index 000000000..5957e1e1c --- /dev/null +++ b/src/main/java/noppes/npcs/client/renderer/blocks/BlockStoolRenderer.java @@ -0,0 +1,60 @@ +package noppes.npcs.client.renderer.blocks; + +import net.minecraft.block.Block; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.tileentity.TileEntity; +import noppes.npcs.CustomItems; +import noppes.npcs.blocks.BlockStool; +import noppes.npcs.blocks.tiles.TileColorable; +import noppes.npcs.client.model.blocks.ModelStool; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +import cpw.mods.fml.client.registry.RenderingRegistry; + +public class BlockStoolRenderer extends BlockRendererInterface{ + + private final ModelStool model = new ModelStool(); + + public BlockStoolRenderer(){ + ((BlockStool)CustomItems.stool).renderId = RenderingRegistry.getNextAvailableRenderId(); + RenderingRegistry.registerBlockHandler(this); + } + @Override + public void renderTileEntityAt(TileEntity var1, double var2, double var4, + double var6, float var8) { + TileColorable tile = (TileColorable) var1; + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + GL11.glPushMatrix(); + GL11.glTranslatef((float)var2 + 0.5f, (float)var4 + 1.68f, (float)var6 + 0.5f); + GL11.glScalef(1.2f, 1.1f, 1.2f); + GL11.glRotatef(180, 0, 0, 1); + GL11.glColor3f(1, 1, 1); + setWoodTexture(var1.getBlockMetadata()); + model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + + GL11.glPopMatrix(); + } + + @Override + public void renderInventoryBlock(Block block, int metadata, int modelId, + RenderBlocks renderer) { + GL11.glPushMatrix(); + GL11.glTranslatef(0, 1f, 0); + GL11.glScalef(1.2f, 1.1f, 1.2f); + GL11.glRotatef(180, 0, 0, 1); + GL11.glRotatef(180, 0, 1, 0); + + setWoodTexture(metadata); + GL11.glColor3f(1, 1, 1); + model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + + GL11.glPopMatrix(); + } + + @Override + public int getRenderId() { + return CustomItems.stool.getRenderType(); + } +} diff --git a/src/main/java/noppes/npcs/client/renderer/blocks/BlockTableRenderer.java b/src/main/java/noppes/npcs/client/renderer/blocks/BlockTableRenderer.java new file mode 100644 index 000000000..f6be246c8 --- /dev/null +++ b/src/main/java/noppes/npcs/client/renderer/blocks/BlockTableRenderer.java @@ -0,0 +1,83 @@ +package noppes.npcs.client.renderer.blocks; + +import net.minecraft.block.Block; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.IBlockAccess; +import noppes.npcs.CustomItems; +import noppes.npcs.blocks.BlockTable; +import noppes.npcs.blocks.tiles.TileColorable; +import noppes.npcs.client.model.blocks.ModelTable; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +import cpw.mods.fml.client.registry.RenderingRegistry; + +public class BlockTableRenderer extends BlockRendererInterface{ + + private final ModelTable model = new ModelTable(); + private static final ResourceLocation resource1 = new ResourceLocation("customnpcs","textures/cache/planks_oak.png"); + private static final ResourceLocation resource2 = new ResourceLocation("customnpcs","textures/cache/planks_big_oak.png"); + private static final ResourceLocation resource3 = new ResourceLocation("customnpcs","textures/cache/planks_spruce.png"); + private static final ResourceLocation resource4 = new ResourceLocation("customnpcs","textures/cache/planks_birch.png"); + private static final ResourceLocation resource5 = new ResourceLocation("customnpcs","textures/cache/planks_acacia.png"); + private static final ResourceLocation resource6 = new ResourceLocation("customnpcs","textures/cache/planks_jungle.png"); + + public BlockTableRenderer(){ + ((BlockTable)CustomItems.table).renderId = RenderingRegistry.getNextAvailableRenderId(); + RenderingRegistry.registerBlockHandler(this); + } + @Override + public void renderTileEntityAt(TileEntity var1, double var2, double var4, + double var6, float var8) { + TileColorable tile = (TileColorable) var1; + GL11.glPushMatrix(); + GL11.glTranslatef((float)var2 + 0.5f, (float)var4 + 1.5f, (float)var6 + 0.5f); + GL11.glRotatef(180, 0, 0, 1); + GL11.glColor3f(1, 1, 1); + + boolean south = var1.getWorldObj().getBlock(var1.xCoord + 1, var1.yCoord, var1.zCoord) == CustomItems.table; + boolean north = var1.getWorldObj().getBlock(var1.xCoord - 1, var1.yCoord, var1.zCoord) == CustomItems.table; + boolean east = var1.getWorldObj().getBlock(var1.xCoord, var1.yCoord, var1.zCoord + 1) == CustomItems.table; + boolean west = var1.getWorldObj().getBlock(var1.xCoord, var1.yCoord, var1.zCoord - 1) == CustomItems.table; + + model.Shape1.showModel = !south && !east; + model.Shape3.showModel = !north && !west; + model.Shape4.showModel = !north && !east; + model.Shape5.showModel = !south && !west; + + setWoodTexture(var1.getBlockMetadata()); + model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + GL11.glRotatef(90 * tile.rotation, 0, 1, 0); + model.Table.render(0.0625f); + + GL11.glPopMatrix(); + } + + @Override + public void renderInventoryBlock(Block block, int metadata, int modelId, + RenderBlocks renderer) { + GL11.glPushMatrix(); + GL11.glTranslatef(0, 0.9f, 0); + GL11.glRotatef(180, 0, 0, 1); + GL11.glRotatef(180, 0, 1, 0); + + setWoodTexture(metadata); + GL11.glColor3f(1, 1, 1); + model.Table.render(0.0625f); + model.Shape1.showModel = true; + model.Shape3.showModel = true; + model.Shape4.showModel = true; + model.Shape5.showModel = true; + model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + + GL11.glPopMatrix(); + } + + @Override + public int getRenderId() { + return CustomItems.table.getRenderType(); + } +} diff --git a/src/main/java/noppes/npcs/client/renderer/blocks/BlockTallLampRenderer.java b/src/main/java/noppes/npcs/client/renderer/blocks/BlockTallLampRenderer.java new file mode 100644 index 000000000..94f357a11 --- /dev/null +++ b/src/main/java/noppes/npcs/client/renderer/blocks/BlockTallLampRenderer.java @@ -0,0 +1,78 @@ +package noppes.npcs.client.renderer.blocks; + +import net.minecraft.block.Block; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; +import noppes.npcs.CustomItems; +import noppes.npcs.blocks.BlockTallLamp; +import noppes.npcs.blocks.tiles.TileTallLamp; +import noppes.npcs.client.model.blocks.ModelTallLamp; +import noppes.npcs.client.model.blocks.ModelTallLampTop; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +import cpw.mods.fml.client.registry.RenderingRegistry; + +public class BlockTallLampRenderer extends BlockRendererInterface{ + + private final ModelTallLamp model = new ModelTallLamp(); + + private final ModelTallLampTop top = new ModelTallLampTop(); + public static final ResourceLocation resourceTop = new ResourceLocation("customnpcs","textures/cache/wool_colored_white.png"); + + public BlockTallLampRenderer(){ + ((BlockTallLamp)CustomItems.tallLamp).renderId = RenderingRegistry.getNextAvailableRenderId(); + RenderingRegistry.registerBlockHandler(this); + } + + @Override + public void renderTileEntityAt(TileEntity var1, double var2, double var4, + double var6, float var8) { + TileTallLamp tile = (TileTallLamp) var1; + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + GL11.glPushMatrix(); + GL11.glTranslatef((float)var2 + 0.5f, (float)var4 + 1.5f, (float)var6 + 0.5f); + //GL11.glScalef(0.95f, 0.95f, 0.95f); + GL11.glRotatef(180, 0, 0, 1); + GL11.glRotatef(90 * tile.rotation, 0, 1, 0); + GL11.glColor3f(1, 1, 1); + + setMaterialTexture(var1.getBlockMetadata()); + model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + + this.bindTexture(resourceTop); + float[] color = BlockBannerRenderer.colorTable[tile.color]; + GL11.glColor3f(color[0], color[1], color[2]); + top.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + + GL11.glPopMatrix(); + } + + @Override + public void renderInventoryBlock(Block block, int metadata, int modelId, + RenderBlocks renderer) { + GL11.glPushMatrix(); + GL11.glTranslatef(0, 0.42f, 0); + GL11.glScalef(0.76f, 0.66f, 0.76f); + GL11.glRotatef(180, 0, 0, 1); + GL11.glRotatef(180, 0, 1, 0); + + setMaterialTexture(metadata); + GL11.glColor3f(1, 1, 1); + model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + + this.bindTexture(resourceTop); + float[] color = BlockBannerRenderer.colorTable[15 - metadata]; + GL11.glColor3f(color[0], color[1], color[2]); + top.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + GL11.glPopMatrix(); + } + + + @Override + public int getRenderId() { + return CustomItems.tallLamp.getRenderType(); + } +} diff --git a/src/main/java/noppes/npcs/client/renderer/blocks/BlockTombstoneRenderer.java b/src/main/java/noppes/npcs/client/renderer/blocks/BlockTombstoneRenderer.java new file mode 100644 index 000000000..8d88ab7e2 --- /dev/null +++ b/src/main/java/noppes/npcs/client/renderer/blocks/BlockTombstoneRenderer.java @@ -0,0 +1,118 @@ +package noppes.npcs.client.renderer.blocks; + +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.tileentity.TileEntity; +import noppes.npcs.CustomItems; +import noppes.npcs.blocks.BlockTombstone; +import noppes.npcs.blocks.tiles.TileTombstone; +import noppes.npcs.client.TextBlockClient; +import noppes.npcs.client.model.blocks.ModelTombstone1; +import noppes.npcs.client.model.blocks.ModelTombstone2; +import noppes.npcs.client.model.blocks.ModelTombstone3; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +import cpw.mods.fml.client.registry.RenderingRegistry; + +public class BlockTombstoneRenderer extends BlockRendererInterface{ + + private final ModelTombstone1 model = new ModelTombstone1(); + private final ModelTombstone2 model2 = new ModelTombstone2(); + private final ModelTombstone3 model3 = new ModelTombstone3(); + + public BlockTombstoneRenderer(){ + ((BlockTombstone)CustomItems.tombstone).renderId = RenderingRegistry.getNextAvailableRenderId(); + RenderingRegistry.registerBlockHandler(this); + } + + @Override + public void renderTileEntityAt(TileEntity var1, double var2, double var4, + double var6, float var8) { + TileTombstone tile = (TileTombstone) var1; + int meta = tile.getBlockMetadata(); + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + GL11.glPushMatrix(); + GL11.glTranslatef((float)var2 + 0.5f, (float)var4 + 1.5f, (float)var6 + 0.5f); + if(meta == 2) + GL11.glScalef(1f, 1f, 1.14f); + GL11.glRotatef(180, 0, 0, 1); + GL11.glRotatef(90 * tile.rotation, 0, 1, 0); + GL11.glColor3f(1, 1, 1); + + + Minecraft.getMinecraft().getTextureManager().bindTexture(Stone); + if(meta == 0) + model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + else if(meta == 1) + model2.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + else + model3.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + if(meta < 2 && !playerTooFar(tile)) + renderText(tile, meta); + + GL11.glPopMatrix(); + } + + + private void renderText(TileTombstone tile, int meta){ + + if(tile.block == null || tile.hasChanged){ + tile.block = new TextBlockClient(tile.getText(), 94, true, Minecraft.getMinecraft().thePlayer); + tile.hasChanged = false; + } + if(!tile.block.lines.isEmpty()){ + GL11.glRotatef(180, 1, 0, 0); + float f3 = 0.0133F * 0.5f; + GL11.glTranslatef(0.0F, -0.64f, meta == 0?0.095F:0.126f); + GL11.glScalef(f3, -f3, f3); + GL11.glNormal3f(0.0F, 0.0F, -1.0F * f3); + GL11.glDepthMask(false); + FontRenderer fontrenderer = this.func_147498_b(); + + float lineOffset = 0; + if(tile.block.lines.size() < 11) + lineOffset = (11f - tile.block.lines.size()) / 2; + for(int i = 0; i < tile.block.lines.size(); i++){ + String text = tile.block.lines.get(i).getFormattedText(); + fontrenderer.drawString(text, -fontrenderer.getStringWidth(text) / 2, (int)((lineOffset + i) * (fontrenderer.FONT_HEIGHT - 0.3)), 0xffffff); + if(i == 13) + break; + } + + GL11.glDepthMask(true); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + } + } + + + @Override + public void renderInventoryBlock(Block block, int meta, int modelId, + RenderBlocks renderer) { + GL11.glPushMatrix(); + GL11.glTranslatef(0, 1f, 0); + GL11.glScalef(1f, 1f, 1f); + GL11.glRotatef(180, 0, 0, 1); + GL11.glRotatef(180, 0, 1, 0); + + Minecraft.getMinecraft().getTextureManager().bindTexture(Stone); + GL11.glColor3f(1, 1, 1); + if(meta == 0) + model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + else if(meta == 1) + model2.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + else + model3.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + + GL11.glPopMatrix(); + } + + + @Override + public int getRenderId() { + return CustomItems.tombstone.getRenderType(); + } +} diff --git a/src/main/java/noppes/npcs/client/renderer/blocks/BlockWallBannerRenderer.java b/src/main/java/noppes/npcs/client/renderer/blocks/BlockWallBannerRenderer.java new file mode 100644 index 000000000..b7ce9a88a --- /dev/null +++ b/src/main/java/noppes/npcs/client/renderer/blocks/BlockWallBannerRenderer.java @@ -0,0 +1,106 @@ +package noppes.npcs.client.renderer.blocks; + +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import noppes.npcs.CustomItems; +import noppes.npcs.blocks.BlockWallBanner; +import noppes.npcs.blocks.tiles.TileWallBanner; +import noppes.npcs.client.model.blocks.ModelWallBanner; +import noppes.npcs.client.model.blocks.ModelWallBannerFlag; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +import cpw.mods.fml.client.registry.RenderingRegistry; + +public class BlockWallBannerRenderer extends BlockRendererInterface{ + + private final ModelWallBanner model = new ModelWallBanner(); + private final ModelWallBannerFlag flag = new ModelWallBannerFlag(); + + public BlockWallBannerRenderer(){ + ((BlockWallBanner)CustomItems.wallBanner).renderId = RenderingRegistry.getNextAvailableRenderId(); + RenderingRegistry.registerBlockHandler(this); + } + + @Override + public void renderTileEntityAt(TileEntity var1, double var2, double var4, + double var6, float var8) { + TileWallBanner tile = (TileWallBanner) var1; + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glPushMatrix(); + GL11.glTranslatef((float)var2 + 0.5f, (float)var4 +0.4f, (float)var6 + 0.5f); + //GL11.glScalef(0.95f, 0.95f, 0.95f); + GL11.glRotatef(180, 0, 0, 1); + GL11.glRotatef(90 * tile.rotation, 0, 1, 0); + + setMaterialTexture(var1.getBlockMetadata()); + GL11.glColor3f(1, 1, 1); + model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + + this.bindTexture(BlockBannerRenderer.resourceFlag); + float[] color = BlockBannerRenderer.colorTable[tile.color]; + GL11.glColor3f(color[0], color[1], color[2]); + flag.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + + GL11.glPopMatrix(); + GL11.glColor3f(1, 1, 1); + if(tile.icon != null && !this.playerTooFar(tile)){ + doRender(var2, var4, var6, tile.rotation, tile.icon); + } + } + public void doRender(double par2, double par4, double par6, int meta, ItemStack iicon) + { + if (iicon.getItemSpriteNumber() == 0 && RenderBlocks.renderItemIn3d(Block.getBlockFromItem(iicon.getItem()).getRenderType())) + return; + GL11.glPushMatrix(); + bindTexture(TextureMap.locationItemsTexture); + GL11.glTranslatef((float)par2 + 0.5f, (float)par4 +0.2f, (float)par6 + 0.5f); + GL11.glRotatef(180, 0, 0, 1); + GL11.glRotatef(90 * meta, 0, 1, 0); + GL11.glTranslatef(0, 0, 0.26f); + GL11.glDepthMask(false); + float f2 = 0.05f; + Minecraft mc = Minecraft.getMinecraft(); + GL11.glScalef(f2, f2, f2); + renderer.renderItemIntoGUI(this.func_147498_b(), mc.renderEngine, iicon, -8, -8); + GL11.glDepthMask(true); + GL11.glPopMatrix(); + } + + + + @Override + public void renderInventoryBlock(Block block, int metadata, int modelId, + RenderBlocks renderer) { + GL11.glPushMatrix(); + GL11.glTranslatef(0, 0.26f, 0.3f); + GL11.glScalef(0.95f, 0.85f, 0.95f); + GL11.glRotatef(180, 0, 0, 1); + GL11.glRotatef(180, 0, 1, 0); + + setMaterialTexture(metadata); + GL11.glColor3f(1, 1, 1); + model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + + this.bindTexture(BlockBannerRenderer.resourceFlag); + float[] color = BlockBannerRenderer.colorTable[15 - metadata]; + GL11.glColor3f(color[0], color[1], color[2]); + flag.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + GL11.glPopMatrix(); + } + + @Override + public int getRenderId() { + return CustomItems.wallBanner.getRenderType(); + } + + public int specialRenderDistance(){ + return 26; + } +} diff --git a/src/main/java/noppes/npcs/client/renderer/blocks/BlockWeaponRackRenderer.java b/src/main/java/noppes/npcs/client/renderer/blocks/BlockWeaponRackRenderer.java new file mode 100644 index 000000000..3328adf71 --- /dev/null +++ b/src/main/java/noppes/npcs/client/renderer/blocks/BlockWeaponRackRenderer.java @@ -0,0 +1,114 @@ +package noppes.npcs.client.renderer.blocks; + +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import noppes.npcs.CustomItems; +import noppes.npcs.blocks.BlockWeaponRack; +import noppes.npcs.blocks.tiles.TileWeaponRack; +import noppes.npcs.client.model.blocks.ModelWeaponRack; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +import cpw.mods.fml.client.registry.RenderingRegistry; + +public class BlockWeaponRackRenderer extends BlockRendererInterface{ + + private final ModelWeaponRack model = new ModelWeaponRack(); + + public BlockWeaponRackRenderer(){ + ((BlockWeaponRack)CustomItems.weaponsRack).renderId = RenderingRegistry.getNextAvailableRenderId(); + RenderingRegistry.registerBlockHandler(this); + } + @Override + public void renderTileEntityAt(TileEntity var1, double var2, double var4, + double var6, float var8) { + TileWeaponRack tile = (TileWeaponRack) var1; + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glPushMatrix(); + GL11.glTranslatef((float)var2 + 0.5f, (float)var4 + 1.34f, (float)var6 + 0.5f); + GL11.glScalef(0.9f, 0.9f, 0.9f); + GL11.glRotatef(180, 0, 0, 1); + GL11.glRotatef(90 * tile.rotation, 0, 1, 0); + GL11.glColor3f(1, 1, 1); + + setWoodTexture(var1.getBlockMetadata()); + model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + if(!this.playerTooFar(tile)){ + for(int i = 0; i < 3; i++) + doRender(tile.getStackInSlot(i), i); + } + GL11.glPopMatrix(); + } + + private void doRender(ItemStack item, int pos){ + if(item == null || item.getItem() == null || item.getItem() instanceof ItemBlock) + return; + GL11.glPushMatrix(); + GL11.glTranslatef(-0.40f + pos * 0.37f, 0.8f, 0.23f); + GL11.glScalef(0.5f, 0.5f, 0.5f); + if(item.getItem().shouldRotateAroundWhenRendering()){ + GL11.glTranslatef(0.14f, 0, 0.5f); + GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); + } + else + GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(-200.0F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(-50.0F, 0.0F, 1.0F, 0.0F); + + if (item.getItem().requiresMultipleRenderPasses()) + { + for (int k = 0; k <= item.getItem().getRenderPasses(item.getItemDamage()); ++k) + { + int i = item.getItem().getColorFromItemStack(item, k); + float f12 = (float)(i >> 16 & 255) / 255.0F; + float f4 = (float)(i >> 8 & 255) / 255.0F; + float f5 = (float)(i & 255) / 255.0F; + GL11.glColor4f(f12, f4, f5, 1.0F); + RenderManager.instance.itemRenderer.renderItem(Minecraft.getMinecraft().thePlayer, item, k); + } + } + else + { + int k = item.getItem().getColorFromItemStack(item, 0); + float f11 = (float)(k >> 16 & 255) / 255.0F; + float f12 = (float)(k >> 8 & 255) / 255.0F; + float f4 = (float)(k & 255) / 255.0F; + GL11.glColor4f(f11, f12, f4, 1.0F); + RenderManager.instance.itemRenderer.renderItem(Minecraft.getMinecraft().thePlayer, item, 0); + } + GL11.glPopMatrix(); + + } + + @Override + public void renderInventoryBlock(Block block, int metadata, int modelId, + RenderBlocks renderer) { + GL11.glPushMatrix(); + GL11.glTranslatef(-0.3f, 0.15f, 0); + GL11.glScalef(0.9f, 0.7f, 0.9f); + GL11.glRotatef(180, 0, 0, 1); + GL11.glRotatef(180, 0, 1, 0); + + setWoodTexture(metadata); + GL11.glColor3f(1, 1, 1); + model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F); + + GL11.glPopMatrix(); + } + + @Override + public int getRenderId() { + return CustomItems.weaponsRack.getRenderType(); + } + + public int specialRenderDistance(){ + return 26; + } +} diff --git a/src/main/java/noppes/npcs/config/ConfigLoader.java b/src/main/java/noppes/npcs/config/ConfigLoader.java new file mode 100644 index 000000000..a0471eb62 --- /dev/null +++ b/src/main/java/noppes/npcs/config/ConfigLoader.java @@ -0,0 +1,152 @@ +package noppes.npcs.config; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.lang.reflect.Field; +import java.util.HashMap; +import java.util.LinkedList; + +import noppes.npcs.LogWriter; + +public class ConfigLoader { + private boolean updateFile = false; + private File dir; + private String fileName; + private Class configClass; + private LinkedList configFields; + + public ConfigLoader(Class clss, File dir, String fileName){ + if(!dir.exists()) + dir.mkdir(); + this.dir = dir; + configClass = clss; + configFields = new LinkedList(); + this.fileName = fileName+".cfg"; + Field fields[] = configClass.getDeclaredFields(); + for (Field field : fields) { + if (field.isAnnotationPresent(ConfigProp.class)){ + configFields.add(field); + } + } + } + public void loadConfig() { + try { + File configFile = new File(dir,fileName); + HashMap types = new HashMap(); + for(Field field : configFields){ + ConfigProp prop = (ConfigProp)field.getAnnotation(ConfigProp.class); + types.put(!prop.name().isEmpty()? prop.name() : field.getName(), field); + } + if(configFile.exists()){ + HashMap properties = parseConfig(configFile,types); + for(String prop : properties.keySet()){ + Field field = types.get(prop); + Object obj = properties.get(prop); + if(!obj.equals(field.get(null))){ + field.set(null, obj); + } + } + for(String type : types.keySet()) + if(!properties.containsKey(type)) + updateFile = true; + } + else{ + updateFile = true; + } + } catch (Exception e) { + updateFile = true; + LogWriter.except(e); + } + if(updateFile){ + updateConfig(); + } + updateFile = false; + } + private HashMap parseConfig(File file, HashMap types) throws Exception { + HashMap config = new HashMap(); + BufferedReader reader = new BufferedReader(new FileReader(file)); + String strLine; + while ((strLine = reader.readLine()) != null) { + if(strLine.startsWith("#") || strLine.length() == 0) + continue; + int index = strLine.indexOf("="); + if(index <= 0 || index == strLine.length()){ + updateFile = true; + continue; + } + String name = strLine.substring(0, index); + String prop = strLine.substring(index+1); + if(!types.containsKey(name)){ + updateFile = true; + continue; + } + Object obj = null; + Class class2 = types.get(name).getType(); + if (class2.isAssignableFrom(java.lang.String.class)) + { + obj = prop; + } + else if (class2.isAssignableFrom(Integer.TYPE)) + { + obj = Integer.valueOf(Integer.parseInt(prop)); + } + else if (class2.isAssignableFrom(Short.TYPE)) + { + obj = Short.valueOf(Short.parseShort(prop)); + } + else if (class2.isAssignableFrom(Byte.TYPE)) + { + obj = Byte.valueOf(Byte.parseByte(prop)); + } + else if (class2.isAssignableFrom(Boolean.TYPE)) + { + obj = Boolean.valueOf(Boolean.parseBoolean(prop)); + } + else if (class2.isAssignableFrom(Float.TYPE)) + { + obj = Float.valueOf(Float.parseFloat(prop)); + } + else if (class2.isAssignableFrom(Double.TYPE)) + { + obj = Double.valueOf(Double.parseDouble(prop)); + } + if(obj != null) + config.put(name, obj); + } + reader.close(); + return config; + } + + public void updateConfig() { + File file = new File(dir, fileName); + try { + if(!file.exists()) + file.createNewFile(); + BufferedWriter out = new BufferedWriter(new FileWriter(file)); + for(Field field : configFields){ + ConfigProp prop = (ConfigProp)field.getAnnotation(ConfigProp.class); + if(prop.info().length() != 0) + out.write("#"+prop.info() + System.getProperty( "line.separator" )); + String name = !prop.name().isEmpty()? prop.name() : field.getName(); + try { + out.write(name + "=" + field.get(null).toString() + System.getProperty( "line.separator" )); + out.write(System.getProperty( "line.separator" )); + } catch (IllegalArgumentException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IllegalAccessException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + out.close(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } +} diff --git a/src/main/java/noppes/npcs/config/ConfigProp.java b/src/main/java/noppes/npcs/config/ConfigProp.java new file mode 100644 index 000000000..281d99ca9 --- /dev/null +++ b/src/main/java/noppes/npcs/config/ConfigProp.java @@ -0,0 +1,14 @@ +package noppes.npcs.config; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) +public @interface ConfigProp { + String name() default ""; + + String info() default ""; +} diff --git a/src/main/java/noppes/npcs/config/GlyphCache.java b/src/main/java/noppes/npcs/config/GlyphCache.java new file mode 100644 index 000000000..6c3f38f01 --- /dev/null +++ b/src/main/java/noppes/npcs/config/GlyphCache.java @@ -0,0 +1,632 @@ +package noppes.npcs.config; + +import java.awt.AlphaComposite; +import java.awt.Color; +import java.awt.Font; +import java.awt.Graphics2D; +import java.awt.GraphicsEnvironment; +import java.awt.Rectangle; +import java.awt.RenderingHints; +import java.awt.font.FontRenderContext; +import java.awt.font.GlyphVector; +import java.awt.geom.Point2D; +import java.awt.image.BufferedImage; +import java.io.InputStream; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.nio.IntBuffer; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GLAllocation; +import net.minecraft.util.ResourceLocation; + +import org.lwjgl.opengl.GL11; + +/** + * @author https://github.com/secretdataz/BetterFonts + * The GlyphCache class is responsible for caching pre-rendered images of every glyph using OpenGL textures. This class is also + * responsible for selecting the proper fonts to render each glyph, since Java's own "SansSerif" logical font does not always + * select the proper physical font to use (especially on less common Linux distributions). Once a pre-rendered glyph image is + * cached, it will remain stored in an OpenGL texture for the entire lifetime of the application (StringCache depends on this + * behavior). + * + * @todo Should have a separate glyph cache and a separate smaller point size font for rendering the GUI at its smallest size + * and for use in the F3 debug screen; may need some explicit argument in StringCache.renderString() to select the size + * @todo Need to have a config file that allows overring the font search order by locale to properly support Traditional Chinese + * hanzi, Simplified Chinese hanzi, Japanese kanji, and Korean hanja + */ +public class GlyphCache +{ + /** + * The width in pixels of every texture used for caching pre-rendered glyph images. Used by GlyphCache when calculating + * floating point 0.0-1.0 texture coordinates. Must be a power of two for mip-mapping to work. + */ + private static final int TEXTURE_WIDTH = 256; + + /** + * The height in pixels of every texture used for caching pre-rendered glyph images. Used by GlyphCache when calculating + * floating point 0.0-1.0 texture coordinates. Must be a power of two for mip-mapping to work. + */ + private static final int TEXTURE_HEIGHT = 256; + + /** Initial width in pixels of the stringImage buffer used to extract individual glyph images. */ + private static final int STRING_WIDTH = 256; + + /** Initial height in pixels of the stringImage buffer used to extract individual glyph images. */ + private static final int STRING_HEIGHT = 64; + + /** + * The width in pixels of a transparent border between individual glyphs in the cache texture. This border keeps neighboring + * glyphs from "bleeding through" when the scaled GUI resolution is not pixel aligned and sometimes results in off-by-one + * sampling of the glyph cache textures. + */ + private static final int GLYPH_BORDER = 1; + + /** Transparent (alpha zero) white background color for use with BufferedImage.clearRect(). */ + private static Color BACK_COLOR = new Color(255, 255, 255, 0); + + /** The point size at which every OpenType font is rendered. */ + private int fontSize = 18; + + /** If true, then enble anti-aliasing when rendering the font glyph */ + private boolean antiAliasEnabled = false; + + + /** Temporary image for rendering a string to and then extracting the glyph images from. */ + private BufferedImage stringImage; + + /** The Graphics2D associated with stringImage and used for string drawing to extract the individual glyph shapes. */ + private Graphics2D stringGraphics; + + + /** All font glyphs are packed inside this image and are then loaded from here into an OpenGL texture. */ + private BufferedImage glyphCacheImage = new BufferedImage(TEXTURE_WIDTH, TEXTURE_HEIGHT, BufferedImage.TYPE_INT_ARGB); + + /** The Graphics2D associated with glyphCacheImage and used for bit blitting between stringImage. */ + private Graphics2D glyphCacheGraphics = glyphCacheImage.createGraphics(); + + /** Needed for all text layout operations that create GlyphVectors (maps point size to pixel size). */ + private FontRenderContext fontRenderContext = glyphCacheGraphics.getFontRenderContext(); + + + /** Intermediate data array for use with textureImage.getRgb(). */ + private int imageData[] = new int[TEXTURE_WIDTH * TEXTURE_HEIGHT]; + + /** + * A big-endian direct int buffer used with glTexSubImage2D() and glTexImage2D(). Used for loading the pre-rendered glyph + * images from the glyphCacheImage BufferedImage into OpenGL textures. This buffer uses big-endian byte ordering to ensure + * that the integers holding packed RGBA colors are stored into memory in a predictable order. + */ + private IntBuffer imageBuffer = ByteBuffer.allocateDirect(4 * TEXTURE_WIDTH * TEXTURE_HEIGHT).order(ByteOrder.BIG_ENDIAN).asIntBuffer(); + + /** A single integer direct buffer with native byte ordering used for returning values from glGenTextures(). */ + private IntBuffer singleIntBuffer = GLAllocation.createDirectIntBuffer(1); + + /** List of all available physical fonts on the system. Used by lookupFont() to find alternate fonts. */ + private List allFonts = Arrays.asList(GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts()); + + /** + * A list of all fonts that have been returned so far by lookupFont(), and that will always be searched first for a usable font before + * searching through allFonts[]. This list will only have plain variation of a font at a dummy point size, unlike fontCache which could + * have multiple entries for the various styles (i.e. bold, italic, etc.) of a font. This list starts with Java's "SansSerif" logical + * font. + */ + protected List usedFonts = new ArrayList(); + + + /** ID of current OpenGL cache texture being used by cacheGlyphs() to store pre-rendered glyph images. */ + private int textureName; + + /** + * A cache of all fonts that have at least one glyph pre-rendered in a texture. Each font maps to an integer (monotonically + * increasing) which forms the upper 32 bits of the key into the glyphCache map. This font cache can include different styles + * of the same font family like bold or italic. + */ + private LinkedHashMap fontCache = new LinkedHashMap(); + + /** + * A cache of pre-rendered glyphs mapping each glyph by its glyphcode to the position of its pre-rendered image within + * the cache texture. The key is a 64 bit number such that the lower 32 bits are the glyphcode and the upper 32 are the + * index of the font in the fontCache. This makes for a single globally unique number to identify any glyph from any font. + */ + private LinkedHashMap glyphCache = new LinkedHashMap(); + + + /** + * The X coordinate of the upper=left corner in glyphCacheImage where the next glyph image should be stored. Glyphs are + * always added left-to-right on the curren tline until it fills up, at which point they continue filling the texture on + * the next line. + */ + private int cachePosX = GLYPH_BORDER; + + /** + * The Y coordinate of the upper-left corner in glyphCacheImage where the next glyph image should be stored. Glyphs are + * stored left-to-right in horizontal lines, and top-to-bottom until the entire texture fills up. At that point, a new + * texture is allocated to keep storing additional glyphs, and the original texture remains allocated for the lifetime of + * the application. + */ + private int cachePosY = GLYPH_BORDER; + + /** + * The height in pixels of the current line of glyphs getting written into the texture. This value determines by how much + * cachePosY will get incremented when the current horizontal line in the texture fills up. + */ + private int cacheLineHeight = 0; + + /** + * This class holds information for a glyph about its pre-rendered image in an OpenGL texture. The texture coordinates in + * this class are normalized in the standard 0.0 - 1.0 OpenGL range. + */ + static class Entry + { + /** The OpenGL texture ID that contains this glyph image. */ + public int textureName; + + /** The width in pixels of the glyph image. */ + public int width; + + /** The height in pixels of the glyph image. */ + public int height; + + /** The horizontal texture coordinate of the upper-left corner. */ + public float u1; + + /** The vertical texture coordinate of the upper-left corner. */ + public float v1; + + /** The horizontal texture coordinate of the lower-right corner. */ + public float u2; + + /** The vertical texture coordinate of the lower-right corner. */ + public float v2; + } + + /** + * A single instance of GlyphCache is allocated for internal use by the StringCache class. + */ + public GlyphCache() + { + /* Set background color for use with clearRect() */ + glyphCacheGraphics.setBackground(BACK_COLOR); + + /* The drawImage() to this buffer will copy all source pixels instead of alpha blending them into the current image */ + glyphCacheGraphics.setComposite(AlphaComposite.Src); + + allocateGlyphCacheTexture(); + allocateStringImage(STRING_WIDTH, STRING_HEIGHT); + + /* Use Java's logical font as the default initial font if user does not override it in some configuration file */ + java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().preferLocaleFonts(); + usedFonts.add(new Font(Font.SANS_SERIF, Font.PLAIN, 72)); //size 1 > 72 + } + + /** + * Change the default font used to pre-render glyph images. If this method is called at runtime, the existing glyph images will remain cached + * in their respective textures and will remain accessible to StringCache. This method is normally called by StringCache.setDefaultFont() since + * the StringCache must also invalidate itself so it can re-layout and re-cache the glyphs for all strings using the new font. + * + * @param name the new font name + * @param size the new point size + */ + void setDefaultFont(String name, int size, boolean antiAlias) + { + + //System.out.println("BetterFonts loading font \"" + name + "\""); + usedFonts.clear(); + usedFonts.add(new Font(name, Font.PLAIN, 72)); //size 1 > 72 + + fontSize = size; + antiAliasEnabled = antiAlias; + setRenderingHints(); + } + + void setCustomFont(ResourceLocation location, int size, boolean antiAlias) throws Exception { + InputStream stream = Minecraft.getMinecraft().getResourceManager().getResource(location).getInputStream(); + + GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); + Font font = Font.createFont(Font.TRUETYPE_FONT, stream); + ge.registerFont(font); + font = font.deriveFont(Font.PLAIN, 72); + + usedFonts.clear(); + usedFonts.add(font); + + fontSize = size; + antiAliasEnabled = antiAlias; + setRenderingHints(); + } + + int fontHeight(String s){ + Font font = lookupFont(s.toCharArray(), 0, s.length(), 0); + return (int)(font.getLineMetrics(s, this.fontRenderContext).getHeight()); + } + + /** + * Given a single OpenType font, perform full text layout and create a new GlyphVector for a string. + * + * @param font the Font used to layout a GlyphVector for the string + * @param text the string to layout + * @param start the offset into text at which to start the layout + * @param limit the (offset + length) at which to stop performing the layout + * @param layoutFlags either Font.LAYOUT_RIGHT_TO_LEFT or Font.LAYOUT_LEFT_TO_RIGHT + * @return the newly created GlyphVector + */ + GlyphVector layoutGlyphVector(Font font, char text[], int start, int limit, int layoutFlags) + { + /* Ensure this font is already in fontCache so it can be referenced by cacheGlyphs() later on */ + if(!fontCache.containsKey(font)) + { + fontCache.put(font, fontCache.size()); + } + return font.layoutGlyphVector(fontRenderContext, text, start, limit, layoutFlags); + } + + /** + * Find the first font in the system able to render at least one character from a given string. The function always tries searching first + * in the fontCache (based on the request style). Failing that, it searches the usedFonts list followed by the allFonts[] array. + * + * @param text the string to check against the font + * @param start the offset into text at which to start checking characters for being supported by a font + * @param limit the (offset + length) at which to stop checking characters + * @param style combination of the Font.PLAIN, Font.BOLD, and Font.ITALIC to request a particular font style + * @return an OpenType font capable of displaying at least the first character at the start position in text + */ + Font lookupFont(char text[], int start, int limit, int style) + { + /* Try using an already known base font; the first font in usedFonts list is the one set with setDefaultFont() */ + Iterator iterator = usedFonts.iterator(); + while(iterator.hasNext()) + { + /* Only use the font if it can layout at least the first character of the requested string range */ + Font font = iterator.next(); + if(font.canDisplayUpTo(text, start, limit) != start) + { + /* Return a font instance of the proper point size and style; usedFonts has only 1pt sized plain style fonts */ + return font.deriveFont(style, fontSize); + } + } + + /* If still not found, try searching through all fonts installed on the system for the first that can layout this string */ + iterator = allFonts.iterator(); + while(iterator.hasNext()) + { + /* Only use the font if it can layout at least the first character of the requested string range */ + Font font = iterator.next(); + if(font.canDisplayUpTo(text, start, limit) != start) + { + /* If found, add this font to the usedFonts list so it can be looked up faster next time */ + //System.out.println("BetterFonts loading font \"" + font.getFontName() + "\""); + usedFonts.add(font); + + /* Return a font instance of the proper point size and style; allFonts has only 1pt sized plain style fonts */ + return font.deriveFont(style, fontSize); + } + } + + /* If no supported fonts found, use the default one (first in usedFonts) so it can draw its unknown character glyphs */ + Font font = usedFonts.get(0); + + /* Return a font instance of the proper point size and style; usedFonts only 1pt sized plain style fonts */ + return font.deriveFont(style, fontSize); + } + + /** + * Given an OpenType font and a glyph code within that font, locate the glyph's pre-rendered image in the glyph cache and return its + * cache entry,. The entry stores the texture ID with the pre-rendered glyph image, as well as the position and size of that image + * within the texture. This function assumes that any glyph lookup requests passed to it have been already cached by an earlier call + * to cacheGlyphs(). + * + * @param font the font to which this glyphCode belongs and which was used to pre-render the glyph image in cacheGlyphs() + * @param glyphCode the font specific flyph code to lookup in the cache + * @return the cache entry for this font/glyphCode pair + */ + Entry lookupGlyph(Font font, int glyphCode) + { + long fontKey = (long) fontCache.get(font) << 32; + return glyphCache.get(fontKey | glyphCode); + } + + /** + * Given an OpenType font and a string, make sure that every glyph used by that string is pre-rendered into an OpenGL texture and cached + * in the glyphCache map for later retrieval by lookupGlyph() + * + * @param font the font used to create a GlyphVector for the string and to actually draw the individual glyphs + * @param text the string from which to cache glyph images + * @param start the offset into text at which to start caching glyphs + * @param limit the (offset + length) at which to stop caching glyphs + * @param layoutFlags either Font.LAYOUT_RIGHT_TO_LEFT or Font.LAYOUT_LEFT_TO_RIGHT; needed for weak bidirectional characters like + * parenthesis which are mapped to two different glyph codes depending on the surrounding text direction + * + * @todo May need a blank border of pixels around everything for mip-map/tri-linear filtering with Optifine + */ + void cacheGlyphs(Font font, char text[], int start, int limit, int layoutFlags) + { + /* Create new GlyphVector so glyphs can be moved around (kerning workaround; see below) without affecting caller */ + GlyphVector vector = layoutGlyphVector(font, text, start, limit, layoutFlags); + + /* Pixel aligned bounding box for the entire vector; only set if the vector has to be drawn to cache a glyph image */ + Rectangle vectorBounds = null; + + /* This forms the upper 32 bits of the fontCache key to make every font/glyph code point unique */ + long fontKey = (long) fontCache.get(font) << 32; + + int numGlyphs = vector.getNumGlyphs(); /* Length of the GlyphVector */ + Rectangle dirty = null; /* Total area within texture that needs to be updated with glTexSubImage2D() */ + boolean vectorRendered = false; /* True if entire GlyphVector was rendered into stringImage */ + + for(int index = 0; index < numGlyphs; index++) + { + /* If this glyph code is already in glyphCache, then there is no reason to pre-render it again */ + int glyphCode = vector.getGlyphCode(index); + if(glyphCache.containsKey(fontKey | glyphCode)) + { + continue; + } + + /* + * The only way to get glyph shapes with font hinting is to draw the entire glyph vector into a + * temporary BufferedImage, and then bit blit the individual glyphs based on their bounding boxes + * returned by the glyph vector. Although it is possible to call font.createGlyphVector() with an + * array of glyphcodes (and therefore render only a few glyphs at a time), this produces corrupted + * Davengari glyphs under Windows 7. The vectorRendered flag will draw the string at most one time. + */ + if(!vectorRendered) + { + vectorRendered = true; + + /* + * Kerning can make it impossible to cleanly separate adjacent glyphs. To work around this, + * each glyph is manually advanced by 2 pixels to the right of its neighbor before rendering + * the entire string. The getGlyphPixelBounds() later on will return the new adjusted bounds + * for the glyph. + */ + for(int i = 0; i < numGlyphs; i++) + { + Point2D pos = vector.getGlyphPosition(i); + pos.setLocation(pos.getX() + 2 * i, pos.getY()); + vector.setGlyphPosition(i, pos); + } + + /* + * Compute the exact area that the rendered string will take up in the image buffer. Note that + * the string will actually be drawn at a positive (x,y) offset from (0,0) to leave enough room + * for the ascent above the baseline and to correct for a few glyphs that appear to have negative + * horizontal bearing (e.g. U+0423 Cyrillic uppercase letter U on Windows 7). + */ + vectorBounds = vector.getPixelBounds(fontRenderContext, 0, 0); + + /* Enlage the stringImage if it is too small to store the entire rendered string */ + if(stringImage == null || vectorBounds.width > stringImage.getWidth() || vectorBounds.height > stringImage.getHeight()) + { + int width = Math.max(vectorBounds.width, stringImage.getWidth()); + int height = Math.max(vectorBounds.height, stringImage.getHeight()); + allocateStringImage(width, height); + } + + /* Erase the upper-left corner where the string will get drawn*/ + stringGraphics.clearRect(0, 0, vectorBounds.width, vectorBounds.height); + + /* Draw string with opaque white color and baseline adjustment so the upper-left corner of the image is at (0,0) */ + stringGraphics.drawGlyphVector(vector, -vectorBounds.x, -vectorBounds.y); + } + + /* + * Get the glyph's pixel-aligned bounding box. The JavaDoc claims that the "The outline returned + * by this method is positioned around the origin of each individual glyph." However, the actual + * bounds are all relative to the start of the entire GlyphVector, which is actually more useful + * for extracting the glyph's image from the rendered string. + */ + Rectangle rect = vector.getGlyphPixelBounds(index, null, -vectorBounds.x, -vectorBounds.y); + + /* If the current line in cache image is full, then advance to the next line */ + if(cachePosX + rect.width + GLYPH_BORDER > TEXTURE_WIDTH) + { + cachePosX = GLYPH_BORDER; + cachePosY += cacheLineHeight + GLYPH_BORDER; + cacheLineHeight = 0; + } + + /* + * If the entire image is full, update the current OpenGL texture with everything changed so far in the image + * (i.e. the dirty rectangle), allocate a new cache texture, and then continue storing glyph images to the + * upper-left corner of the new texture. + */ + if(cachePosY + rect.height + GLYPH_BORDER > TEXTURE_HEIGHT) + { + updateTexture(dirty); + dirty = null; + + /* Note that allocateAndSetupTexture() will leave the GL texture already bound */ + allocateGlyphCacheTexture(); + cachePosY = cachePosX = GLYPH_BORDER; + cacheLineHeight = 0; + } + + /* The tallest glyph on this line determines the total vertical advance in the texture */ + if(rect.height > cacheLineHeight) + { + cacheLineHeight = rect.height; + } + + /* + * Blit the individual glyph from it's position in the temporary string buffer to its (cachePosX, + * cachePosY) position in the texture. NOTE: We don't have to erase the area in the texture image + * first because the composite method in the Graphics object is always set to AlphaComposite.Src. + */ + glyphCacheGraphics.drawImage(stringImage, + cachePosX, cachePosY, cachePosX + rect.width, cachePosY + rect.height, + rect.x, rect.y, rect.x + rect.width, rect.y + rect.height, null); + + /* + * Store this glyph's position in texture and its origin offset. Note that "rect" will not be modified after + * this point, and getGlyphPixelBounds() always returns a new Rectangle. + */ + rect.setLocation(cachePosX, cachePosY); + + /* + * Create new cache entry to record both the texture used by the glyph and its position within that texture. + * Texture coordinates are normalized to 0.0-1.0 by dividing with TEXTURE_WIDTH and TEXTURE_HEIGHT. + */ + Entry entry = new Entry(); + entry.textureName = textureName; + entry.width = rect.width; + entry.height = rect.height; + entry.u1 = ((float) rect.x) / TEXTURE_WIDTH; + entry.v1 = ((float) rect.y) / TEXTURE_HEIGHT; + entry.u2 = ((float) (rect.x + rect.width)) / TEXTURE_WIDTH; + entry.v2 = ((float) (rect.y + rect.height)) / TEXTURE_HEIGHT; + + /* + * The lower 32 bits of the glyphCache key are the glyph codepoint. The upper 64 bits are the font number + * stored in the fontCache. This creates a unique numerical id for every font/glyph combination. + */ + glyphCache.put(fontKey | glyphCode, entry); + + /* + * Track the overall modified region in the texture by performing a union of this glyph's texture position + * with the update region created so far. Reusing "rect" here makes it easier to extend the dirty rectangle + * region than using the add(x, y) method to extend by a single point. Also note that creating the first + * dirty rectangle here avoids having to deal with the special rules for empty/non-existent rectangles. + */ + if(dirty == null) + { + dirty = new Rectangle(cachePosX, cachePosY, rect.width, rect.height); + } + else + { + dirty.add(rect); + } + + /* Advance cachePosX so the next glyph can be stored immediately to the right of this one */ + cachePosX += rect.width + GLYPH_BORDER; + } + + /* Update OpenGL texture if any part of the glyphCacheImage has changed */ + updateTexture(dirty); + } + + /** + * Update a portion of the current glyph cache texture using the contents of the glyphCacheImage with glTexSubImage2D(). + * + * @param dirty The rectangular region in glyphCacheImage that has changed and needs to be copied into the texture + * + * @todo Add mip-mapping support here + * @todo Test with bilinear texture interpolation and possibly add a 1 pixel transparent border around each glyph to avoid + * bleedover when interpolation is active or add a small "fudge factor" to the UV coordinates like already n FontRenderer + */ + private void updateTexture(Rectangle dirty) + { + /* Only update OpenGL texture if changes were made to the texture */ + if(dirty != null) + { + /* Load imageBuffer with pixel data ready for transfer to OpenGL texture */ + updateImageBuffer(dirty.x, dirty.y, dirty.width, dirty.height); + + GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureName); + + GL11.glTexSubImage2D(GL11.GL_TEXTURE_2D, 0, dirty.x, dirty.y, dirty.width, dirty.height, + GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, imageBuffer); + } + } + + /** + * Allocte and initialize a new BufferedImage and Graphics2D context for rendering strings into. May need to be called + * at runtime to re-allocate a bigger BufferedImage if cacheGlyphs() is called with a very long string. + */ + private void allocateStringImage(int width, int height) + { + stringImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); + stringGraphics = stringImage.createGraphics(); + setRenderingHints(); + + /* Set background color for use with clearRect() */ + stringGraphics.setBackground(BACK_COLOR); + + /* + * Full white (1.0, 1.0, 1.0, 1.0) can be modulated by vertex color to produce a full gamut of text colors, although with + * a GL_ALPHA8 texture, only the alpha component of the color will actually get loaded into the texture. + */ + stringGraphics.setPaint(Color.WHITE); + } + + /** + * Set rendering hints on stringGraphics object. Uses current antiAliasEnabled settings and is therefore called both from + * allocateStringImage() when expanding the size of the BufferedImage and from setDefaultFont() when changing current + * configuration. + */ + private void setRenderingHints() + { + stringGraphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, + antiAliasEnabled ? RenderingHints.VALUE_ANTIALIAS_ON : RenderingHints.VALUE_ANTIALIAS_OFF); + stringGraphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, + antiAliasEnabled ? RenderingHints.VALUE_TEXT_ANTIALIAS_ON : RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); + + stringGraphics.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_OFF); + } + + /** + * Allocate a new OpenGL texture for caching pre-rendered glyph images. The new texture is initialized to fully transparent + * white so the individual glyphs images within can have a transparent border between them. The new texture remains bound + * after returning from the function. + * + * @todo use GL_ALPHA4 if anti-alias is turned off for even smaller textures + */ + private void allocateGlyphCacheTexture() + { + /* Initialize the background to all white but fully transparent. */ + glyphCacheGraphics.clearRect(0, 0, TEXTURE_WIDTH, TEXTURE_HEIGHT); + + /* Allocate new OpenGL texure */ + singleIntBuffer.clear(); + + GL11.glGenTextures(singleIntBuffer); + textureName = singleIntBuffer.get(0); + + /* Load imageBuffer with pixel data ready for transfer to OpenGL texture */ + updateImageBuffer(0, 0, TEXTURE_WIDTH, TEXTURE_HEIGHT); + + /* + * Initialize texture with the now cleared BufferedImage. Using a texture with GL_ALPHA8 internal format may result in + * faster rendering since the GPU has to only fetch 1 byte per texel instead of 4 with a regular RGBA texture. + */ + GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureName); + GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_ALPHA8, TEXTURE_WIDTH, TEXTURE_HEIGHT, 0, + GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, imageBuffer); + + /* Explicitely disable mipmap support becuase updateTexture() will only update the base level 0 */ + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); + } + + /** + * Copy pixel data from a region in glyphCacheImage into imageBuffer and prepare it for use with glText(Sub)Image2D(). This + * function takes care of converting the ARGB format used with BufferedImage into the RGBA format used by OpenGL. + * + * @param x the horizontal coordinate of the region's upper-left corner + * @param y the vertical coordinate of the region's upper-left corner + * @param width the width of the pixel region that will be copied into the buffer + * @param height the height of the pixel region that will be copied into the buffer + */ + private void updateImageBuffer(int x, int y, int width, int height) + { + /* Copy raw pixel data from BufferedImage to imageData array with one integer per pixel in 0xAARRGGBB form */ + glyphCacheImage.getRGB(x, y, width, height, imageData, 0, width); + + /* Swizzle each color integer from Java's ARGB format to OpenGL's RGBA */ + for(int i = 0; i < width * height; i++) + { + int color = imageData[i]; + imageData[i] = (color << 8) | (color >>> 24); + } + + /* Copy int array to direct buffer; big-endian order ensures a 0xRR, 0xGG, 0xBB, 0xAA byte layout */ + imageBuffer.clear(); + imageBuffer.put(imageData); + imageBuffer.flip(); + } +} diff --git a/src/main/java/noppes/npcs/config/StringCache.java b/src/main/java/noppes/npcs/config/StringCache.java new file mode 100644 index 000000000..499c7c4c4 --- /dev/null +++ b/src/main/java/noppes/npcs/config/StringCache.java @@ -0,0 +1,1257 @@ +package noppes.npcs.config; + +import java.awt.Font; +import java.awt.Point; +import java.awt.font.GlyphVector; +import java.lang.ref.WeakReference; +import java.text.Bidi; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.WeakHashMap; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.util.ResourceLocation; + +import org.lwjgl.opengl.GL11; + + +/** + * @author https://github.com/secretdataz/BetterFonts +* The StringCache is the public interface for rendering of all Unicode strings using OpenType fonts. It caches the glyph layout +* of individual strings, and it uses a GlyphCache instance to cache the pre-rendered images for individual glyphs. Once a string +* and its glyph images are cached, the critical path in renderString() will draw the glyphs as fast as if using a bitmap font. +* Strings are cached using weak references through a two layer string cache. Strings that are no longer in use by Minecraft will +* be evicted from the cache, while the pre-rendered images of individual glyphs remains cached forever. The following diagram +* illustrates how this works: +* +*
+* String passed to Key object considers Entry object holds Each Glyph object GlyphCache.Entry stores
+* renderString(); all ASCII digits equal an array of Glyph belongs to only one the texture ID, image
+* mapped by weak to zero ('0'); objects which may Entry object; it has width/height and
+* weakRefCache mapped by weak not directly the glyph x/y pos normalized texture
+* to Key object stringCahe to Entry correspond to Unicode within the string coordinates.
+* chars in string
+* String("Fi1") ------------\ ---> Glyph("F") ----------> GlyphCache.Entry("F")
+* N:1 \ 1:1 1:N / N:1
+* String("Fi4") ------------> Key("Fi0") -------------> Entry("Fi0") -----+----> Glyph("i") ----------> GlyphCache.Entry("i")
+* \ N:1
+* ---> Glyph("0") -----\
+* ----> GlyphCache.Entry("0")
+* ---> Glyph("0") -----/
+* N:1 1:1 1:N / N:1
+* String("Be1") ------------> Key("Be0") -------------> Entry("Be0") -----+----> Glyph("e") ----------> GlyphCache.Entry("e")
+* \ N:1
+* ---> Glyph("B") ----------> GlyphCache.Entry("B")
+* 
+*/ +public class StringCache +{ + /** Vertical adjustment (in pixels * 2) to string position because Minecraft uses top of string instead of baseline */ + private static final int BASELINE_OFFSET = 7; + + /** Offset from the string's baseline as which to draw the underline (in pixels) */ + private static final int UNDERLINE_OFFSET = 1; + + /** Thickness of the underline (in pixels) */ + private static final int UNDERLINE_THICKNESS = 2; + + /** Offset from the string's baseline as which to draw the strikethrough line (in pixels) */ + private static final int STRIKETHROUGH_OFFSET = -6; + + /** Thickness of the strikethrough line (in pixels) */ + private static final int STRIKETHROUGH_THICKNESS = 2; + + /** Reference to the unicode.FontRenderer class. Needed for creating GlyphVectors and retrieving glyph texture coordinates. */ + private GlyphCache glyphCache; + + /** +* Color codes from original FontRender class. First 16 entries are the primary chat colors; second 16 are darker versions +* used for drop shadows. +*/ + private int colorTable[]; + + /** +* A cache of recently seen strings to their fully layed-out state, complete with color changes and texture coordinates of +* all pre-rendered glyph images needed to display this string. The weakRefCache holds strong references to the Key +* objects used in this map. +*/ + private WeakHashMap stringCache = new WeakHashMap(); + + /** +* Every String passed to the public renderString() function is added to this WeakHashMap. As long as As long as Minecraft +* continues to hold a strong reference to the String object (i.e. from TileEntitySign and ChatLine) passed here, the +* weakRefCache map will continue to hold a strong reference to the Key object that said strings all map to (multiple strings +* in weakRefCache can map to a single Key if those strings only differ by their ASCII digits). +*/ + private WeakHashMap weakRefCache = new WeakHashMap(); + + /** +* Temporary Key object re-used for lookups with stringCache.get(). Using a temporary object like this avoids the overhead +* of allocating new objects in the critical rendering path. Of course, new Key objects are always created when adding +* a mapping to stringCache. +*/ + private Key lookupKey = new Key(); + + /** +* Pre-cached glyphs for the ASCII digits 0-9 (in that order). Used by renderString() to substiture digit glyphs on the fly +* as a performance boost. The speed up is most noticable on the F3 screen which rapidly displays lots of changing numbers. +* The 4 element array is index by the font style (combination of Font.PLAIN, Font.BOLD, and Font.ITALIC), and each of the +* nested elements is index by the digit value 0-9. +*/ + private Glyph[][] digitGlyphs = new Glyph[4][]; + + /** True if digitGlyphs[] has been assigned and cacheString() can begin replacing all digits with '0' in the string. */ + private boolean digitGlyphsReady = false; + + /** If true, then enble GL_BLEND in renderString() so anti-aliasing font glyphs show up properly. */ + private boolean antiAliasEnabled = false; + + /** +* Reference to the main Minecraft thread that created this GlyphCache object. Starting with Minecraft 1.3.1, it is possible +* for GlyphCache.cacheGlyphs() to be invoked from the TcpReaderThread while processing a chat packet and computing the width +* of the incoming chat text. Unfortunately, if cacheGlyphs() makes any OpenGL calls from any thread except the main one, +* it will crash LWJGL with a NullPointerException. By remembering the initial thread and comparing it later against +* Thread.currentThread(), the StringCache code can avoid calling cacheGlyphs() when it's not safe to do so. +*/ + private Thread mainThread; + + public int fontHeight; + + /** +* Wraps a String and acts as the key into stringCache. The hashCode() and equals() methods consider all ASCII digits +* to be equal when hashing and comparing Key objects together. Therefore, Strings which only differ in their digits will +* be all hashed together into the same entry. The renderString() method will then substitute the correct digit glyph on +* the fly. This special digit handling gives a significant speedup on the F3 debug screen. +*/ + static private class Key + { + /** +* A copy of the String which this Key is indexing. A copy is used to avoid creating a strong reference to the original +* passed into renderString(). When the original String is no longer needed by Minecraft, it will be garbage collected +* and the WeakHashMaps in StringCache will allow this Key object and its associated Entry object to be garbage +* collected as well. +*/ + public String str; + + /** +* Computes a hash code on str in the same manner as the String class, except all ASCII digits hash as '0' +* +* @return the augmented hash code on str +*/ + @Override + public int hashCode() + { + int code = 0, length = str.length(); + + /* +* True if a section mark character was last seen. In this case, if the next character is a digit, it must +* not be considered equal to any other digit. This forces any string that differs in color codes only to +* have a separate entry in the StringCache. +*/ + boolean colorCode = false; + + for (int index = 0; index < length; index++) + { + char c = str.charAt(index); + if(c >= '0' && c <= '9' && !colorCode) + { + c = '0'; + } + code = (code * 31) + c; + colorCode = (c == '\u00A7'); + } + + return code; + } + + /** +* Compare str against another object (specifically, the object's string representation as returned by toString). +* All ASCII digits are considered equal by this method, as long as they are at the same index within the string. +* +* @return true if the strings are the identical, or only differ in their ASCII digits +*/ + @Override + public boolean equals(Object o) + { + /* +* There seems to be a timing window inside WeakHashMap itself where a null object can be passed to this +* equals() method. Presumably it happens between computing a hash code for the weakly referenced Key object +* while it still exists and calling its equals() method after it was garbage collected. +*/ + if(o == null) + { + return false; + } + + /* Calling toString on a String object simply returns itself so no new object allocation is performed */ + String other = o.toString(); + int length = str.length(); + + if(length != other.length()) + { + return false; + } + + /* +* True if a section mark character was last seen. In this case, if the next character is a digit, it must +* not be considered equal to any other digit. This forces any string that differs in color codes only to +* have a separate entry in the StringCache. +*/ + boolean colorCode = false; + + for(int index = 0; index < length; index++) + { + char c1 = str.charAt(index); + char c2 = other.charAt(index); + + if(c1 != c2 && (c1 < '0' || c1 > '9' || c2 < '0' || c2 > '9' || colorCode)) + { + return false; + } + colorCode = (c1 == '\u00A7'); + } + + return true; + } + + /** +* Returns the contained String object within this Key. +* +* @return the str object +*/ + @Override + public String toString() + { + return str; + } + } + + /** This entry holds the layed out glyph positions for the cached string along with some relevant metadata. */ + static private class Entry + { + /** A weak reference back to the Key object in stringCache that maps to this Entry. */ + public WeakReference keyRef; + + /** The total horizontal advance (i.e. width) for this string in pixels. */ + public int advance; + + /** Array of fully layed out glyphs for the string. Sorted by logical order of characters (i.e. glyph.stringIndex) */ + public Glyph glyphs[]; + + /** Array of color code locations from the original string */ + public ColorCode colors[]; + + /** True if the string uses strikethrough or underlines anywhere and needs an extra pass in renderString() */ + public boolean specialRender; + } + + /** Identifies the location and value of a single color code in the original string */ + static private class ColorCode implements Comparable + { + /** Bit flag used with renderStyle to request the underline style */ + public static final byte UNDERLINE = 1; + + /** Bit flag used with renderStyle to request the strikethrough style */ + public static final byte STRIKETHROUGH = 2; + + /** The index into the original string (i.e. with color codes) for the location of this color code. */ + public int stringIndex; + + /** The index into the stripped string (i.e. with no color codes) of where this color code would have appeared */ + public int stripIndex; + + /** The numeric color code (i.e. index into the colorCode[] array); -1 to reset default color */ + public byte colorCode; + + /** Combination of Font.PLAIN, Font.BOLD, and Font.ITALIC specifying font specific syles */ + public byte fontStyle; + + /** Combination of UNDERLINE and STRIKETHROUGH flags specifying effects performed by renderString() */ + public byte renderStyle; + + /** +* Performs numeric comparison on stripIndex. Allows binary search on ColorCode arrays in layoutStyle. +* +* @param i the Integer object being compared +* @return either -1, 0, or 1 if this < other, this == other, or this > other +*/ + @Override + public int compareTo(Integer i) + { + return (stringIndex == i.intValue()) ? 0 : (stringIndex < i.intValue()) ? -1 : 1; + } + } + + /** +* Identifies a single glyph in the layed-out string. Includes a reference to a GlyphCache.Entry with the OpenGL texture ID +* and position of the pre-rendered glyph image, and includes the x/y pixel coordinates of where this glyph occurs within +* the string to which this Glyph object belongs. +*/ + static private class Glyph implements Comparable + { + /** The index into the original string (i.e. with color codes) for the character that generated this glyph. */ + public int stringIndex; + + /** Texture ID and position/size of the glyph's pre-rendered image within the cache texture. */ + public GlyphCache.Entry texture; + + /** Glyph's horizontal position (in pixels) relative to the entire string's baseline */ + public int x; + + /** Glyph's vertical position (in pixels) relative to the entire string's baseline */ + public int y; + + /** Glyph's horizontal advance (in pixels) used for strikethrough and underline effects */ + public int advance; + + /** +* Allows arrays of Glyph objects to be sorted. Performs numeric comparison on stringIndex. +* +* @param o the other Glyph object being compared with this one +* @return either -1, 0, or 1 if this < other, this == other, or this > other +*/ + @Override + public int compareTo(Glyph o) + { + return (stringIndex == o.stringIndex) ? 0 : (stringIndex < o.stringIndex) ? -1 : 1; + } + } + + /** +* A single StringCache object is allocated by Minecraft's FontRenderer which forwards all string drawing and requests for +* string width to this class. +* +* @param colors 32 element array of RGBA colors corresponding to the 16 text color codes followed by 16 darker version of the +* color codes for use as drop shadows +*/ + public StringCache() + { + /* StringCache is created by the main game thread; remember it for later thread safety checks */ + mainThread = Thread.currentThread(); + + glyphCache = new GlyphCache(); + colorTable = new int[32]; + + 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) + { + k += 85; + } + + 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; + k = j1; + l = k1; + i1 = l1; + } + + if (i >= 16) + { + k /= 4; + l /= 4; + i1 /= 4; + } + + this.colorTable[i] = (k & 255) << 16 | (l & 255) << 8 | i1 & 255; + } + + /* Pre-cache the ASCII digits to allow for fast glyph substitution */ + cacheDightGlyphs(); + } + + /** +* Change the default font used to pre-render glyph images. If this method is called at runtime, the string cache is flushed so that +* all visible strings will be immediately re-layed out using the new font selection. +* +* @param fontName the new font name +* @param fontSize the new point size +* @param antiAlias turn on anti aliasing +*/ + public void setDefaultFont(String fontName, int fontSize, boolean antiAlias) + { + /* Change the font in the glyph cache and clear the string cache so all strings have to be re-layed out and re-rendered */ + glyphCache.setDefaultFont(fontName, fontSize, antiAlias); + antiAliasEnabled = antiAlias; + weakRefCache.clear(); + stringCache.clear(); + + /* Pre-cache the ASCII digits to allow for fast glyph substitution */ + cacheDightGlyphs(); + updateHeight(); + } + + public Font usedFont(){ + return glyphCache.usedFonts.get(0); + } + + public void setCustomFont(ResourceLocation resource, int fontSize, boolean antiAlias) throws Exception + { + /* Change the font in the glyph cache and clear the string cache so all strings have to be re-layed out and re-rendered */ + glyphCache.setCustomFont(resource, fontSize, antiAlias); + antiAliasEnabled = antiAlias; + weakRefCache.clear(); + stringCache.clear(); + + /* Pre-cache the ASCII digits to allow for fast glyph substitution */ + cacheDightGlyphs(); + updateHeight(); + } + + public void updateHeight(){ + int height = 0; + int minY = Integer.MAX_VALUE; + int maxY = Integer.MIN_VALUE; + + for(Glyph g : cacheString("AaBbCcDdEeHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz").glyphs){ + if(g.texture.height > height) + height = g.texture.height; + if(g.y < minY) + minY = g.y; + if(g.y > maxY) + maxY = g.y; + } + fontHeight = (int) ((maxY + height) / 2.0F - minY / 2.0F ); + } + + /** +* Pre-cache the ASCII digits to allow for fast glyph substitution. Called once from the constructor and called any time the font selection +* changes at runtime via setDefaultFont(). +*/ + private void cacheDightGlyphs() + { + /* Need to cache each font style combination; the digitGlyphsReady = false disabled the normal glyph substitution mechanism */ + digitGlyphsReady = false; + digitGlyphs[Font.PLAIN] = cacheString("0123456789").glyphs; + digitGlyphs[Font.BOLD] = cacheString("\u00A7l0123456789").glyphs; + digitGlyphs[Font.ITALIC] = cacheString("\u00A7o0123456789").glyphs; + digitGlyphs[Font.BOLD | Font.ITALIC] = cacheString("\u00A7l\u00A7o0123456789").glyphs; + digitGlyphsReady = true; + } + + /** +* Render a single-line string to the screen using the current OpenGL color. The (x,y) coordinates are of the uppet-left +* corner of the string's bounding box, rather than the baseline position as is typical with fonts. This function will also +* add the string to the cache so the next renderString() call with the same string is faster. +* +* @param str the string being rendered; it can contain color codes +* @param startX the x coordinate to draw at +* @param startY the y coordinate to draw at +* @param initialColor the initial RGBA color to use when drawing the string; embedded color codes can override the RGB component +* @param shadowFlag if true, color codes are replaces by a darker version used for drop shadows +* @return the total advance (horizontal distance) of this string +* +* @todo Add optional NumericShaper to replace ASCII digits with locale specific ones +* @todo Add support for the "k" code which randomly replaces letters on each render (used only by splash screen) +* @todo Pre-sort by texture to minimize binds; can store colors per glyph in string cache +* @todo Optimize the underline/strikethrough drawing to draw a single line for each run +*/ + public int renderString(String str, int startX, int startY, int initialColor, boolean shadowFlag) + { + /* Check for invalid arguments */ + if(str == null || str.isEmpty()) + { + return 0; + } + + + /* Make sure the entire string is cached before rendering and return its glyph representation */ + Entry entry = cacheString(str); + + /* Adjust the baseline of the string because the startY coordinate in Minecraft is for the top of the string */ + startY += BASELINE_OFFSET; + + /* Color currently selected by color code; reapplied to Tessellator instance after glBindTexture() */ + + if((initialColor >> 24 & 0xff) == 0) + initialColor += 0xFF000000; + int color = initialColor; + /* Track which texture is currently bound to minimize the number of glBindTexture() and Tessellator.draw() calls needed */ + int boundTextureName = 0; + + /* +* This color change will have no effect on the actual text (since colors are included in the Tessellator vertex +* array), however GuiEditSign of all things depends on having the current color set to white when it renders its +* "Edit sign message:" text. Otherwise, the sign which is rendered underneath would look too dark. +*/ + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_MODULATE); //fixes black text + GL11.glColor4f((color >> 16 & 0xff) / 255f, (color >> 8 & 0xff) / 255f, (color & 0xff) / 255f, 1); + /* +* Enable GL_BLEND in case the font is drawn anti-aliased because Minecraft itself only enables blending for chat text +* (so it can fade out), but not GUI text or signs. Minecraft uses multiple blend functions so it has to be specified here +* as well for consistent blending. To reduce the overhead of OpenGL state changes and making native LWJGL calls, this +* function doesn't try to save/restore the blending state. Hopefully everything else that depends on blending in Minecraft +* will set its own state as needed. +*/ + if(antiAliasEnabled) + { + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + } + + /* Using the Tessellator to queue up data in a vertex array and then draw all at once should be faster than immediate mode */ + Tessellator tessellator = Tessellator.instance; + tessellator.startDrawingQuads(); + tessellator.setColorRGBA(color >> 16 & 0xff, color >> 8 & 0xff, color & 0xff, color >> 24 & 0xff); + + /* The currently active font syle is needed to select the proper ASCII digit style for fast replacement */ + int fontStyle = Font.PLAIN; + + for(int glyphIndex = 0, colorIndex = 0; glyphIndex < entry.glyphs.length; glyphIndex++) + { + /* +* If the original string had a color code at this glyph's position, then change the current GL color that gets added +* to the vertex array. Note that only the RGB component of the color is replaced by a color code; the alpha component +* of the original color passed into this function will remain. The while loop handles multiple consecutive color codes, +* in which case only the last such color code takes effect. +*/ + while(colorIndex < entry.colors.length && entry.glyphs[glyphIndex].stringIndex >= entry.colors[colorIndex].stringIndex) + { + color = applyColorCode(entry.colors[colorIndex].colorCode, initialColor, shadowFlag); + fontStyle = entry.colors[colorIndex].fontStyle; + colorIndex++; + } + + /* Select the current glyph's texture information and horizontal layout position within this string */ + Glyph glyph = entry.glyphs[glyphIndex]; + GlyphCache.Entry texture = glyph.texture; + int glyphX = glyph.x; + + /* +* Replace ASCII digits in the string with their respective glyphs; strings differing by digits are only cached once. +* If the new replacement glyph has a different width than the original placeholder glyph (e.g. the '1' glyph is often +* narrower than other digits), re-center the new glyph over the placeholder's position to minimize the visual impact +* of the width mismatch. +*/ + char c = str.charAt(glyph.stringIndex); + if(c >= '0' && c <= '9') + { + int oldWidth = texture.width; + texture = digitGlyphs[fontStyle][c - '0'].texture; + int newWidth = texture.width; + glyphX += (oldWidth - newWidth) >> 1; + } + + /* +* Make sure the OpenGL texture storing this glyph's image is bound (if not already bound). All pending glyphs in the +* Tessellator's vertex array must be drawn before switching textures, otherwise they would erroneously use the new +* texture as well. +*/ + if(boundTextureName != texture.textureName) + //if(true) + { + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setColorRGBA(color >> 16 & 0xff, color >> 8 & 0xff, color & 0xff, color >> 24 & 0xff); + GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture.textureName); + boundTextureName = texture.textureName; + } + + /* The divide by 2.0F is needed to align with the scaled GUI coordinate system; startX/startY are already scaled */ + float x1 = startX + (glyphX) / 2.0F; + float x2 = startX + (glyphX + texture.width) / 2.0F; + float y1 = startY + (glyph.y) / 2.0F; + float y2 = startY + (glyph.y + texture.height) / 2.0F; + + tessellator.addVertexWithUV(x1, y1, 0, texture.u1, texture.v1); + tessellator.addVertexWithUV(x1, y2, 0, texture.u1, texture.v2); + tessellator.addVertexWithUV(x2, y2, 0, texture.u2, texture.v2); + tessellator.addVertexWithUV(x2, y1, 0, texture.u2, texture.v1); + } + + /* Draw any remaining glyphs in the Tessellator's vertex array (there should be at least one glyph pending) */ + tessellator.draw(); + + /* Draw strikethrough and underlines if the string uses them anywhere */ + if(entry.specialRender) + { + int renderStyle = 0; + + /* Use initial color passed to renderString(); disable texturing to draw solid color lines */ + color = initialColor; + GL11.glDisable(GL11.GL_TEXTURE_2D); + tessellator.startDrawingQuads(); + tessellator.setColorRGBA(color >> 16 & 0xff, color >> 8 & 0xff, color & 0xff, color >> 24 & 0xff); + + for(int glyphIndex = 0, colorIndex = 0; glyphIndex < entry.glyphs.length; glyphIndex++) + { + /* +* If the original string had a color code at this glyph's position, then change the current GL color that gets added +* to the vertex array. The while loop handles multiple consecutive color codes, in which case only the last such +* color code takes effect. +*/ + while(colorIndex < entry.colors.length && entry.glyphs[glyphIndex].stringIndex >= entry.colors[colorIndex].stringIndex) + { + color = applyColorCode(entry.colors[colorIndex].colorCode, initialColor, shadowFlag); + renderStyle = entry.colors[colorIndex].renderStyle; + colorIndex++; + } + + /* Select the current glyph within this string for its layout position */ + Glyph glyph = entry.glyphs[glyphIndex]; + + /* The strike/underlines are drawn beyond the glyph's width to include the extra space between glyphs */ + int glyphSpace = glyph.advance - glyph.texture.width; + + /* Draw underline under glyph if the style is enabled */ + if((renderStyle & ColorCode.UNDERLINE) != 0) + { + /* The divide by 2.0F is needed to align with the scaled GUI coordinate system; startX/startY are already scaled */ + float x1 = startX + (glyph.x - glyphSpace) / 2.0F; + float x2 = startX + (glyph.x + glyph.advance) / 2.0F; + float y1 = startY + (UNDERLINE_OFFSET) / 2.0F; + float y2 = startY + (UNDERLINE_OFFSET + UNDERLINE_THICKNESS) / 2.0F; + + tessellator.addVertex(x1, y1, 0); + tessellator.addVertex(x1, y2, 0); + tessellator.addVertex(x2, y2, 0); + tessellator.addVertex(x2, y1, 0); + } + + /* Draw strikethrough in the middle of glyph if the style is enabled */ + if((renderStyle & ColorCode.STRIKETHROUGH) != 0) + { + /* The divide by 2.0F is needed to align with the scaled GUI coordinate system; startX/startY are already scaled */ + float x1 = startX + (glyph.x - glyphSpace) / 2.0F; + float x2 = startX + (glyph.x + glyph.advance) / 2.0F; + float y1 = startY + (STRIKETHROUGH_OFFSET) / 2.0F; + float y2 = startY + (STRIKETHROUGH_OFFSET + STRIKETHROUGH_THICKNESS) / 2.0F; + + tessellator.addVertex(x1, y1, 0); + tessellator.addVertex(x1, y2, 0); + tessellator.addVertex(x2, y2, 0); + tessellator.addVertex(x2, y1, 0); + } + } + + /* Finish drawing the last strikethrough/underline segments */ + tessellator.draw(); + GL11.glEnable(GL11.GL_TEXTURE_2D); + } + + + /* Return total horizontal advance (slightly wider than the bounding box, but close enough for centering strings) */ + return entry.advance / 2; + } + + /** +* Return the width of a string in pixels. Used for centering strings inside GUI buttons. +* +* @param str compute the width of this string +* @return the width in pixels (divided by 2; this matches the scaled coordinate system used by GUIs in Minecraft) +*/ + public int getStringWidth(String str) + { + /* Check for invalid arguments */ + if(str == null || str.isEmpty()) + { + return 0; + } + + /* Make sure the entire string is cached and rendered since it will probably be used again in a renderString() call */ + Entry entry = cacheString(str); + + /* Return total horizontal advance (slightly wider than the bounding box, but close enough for centering strings) */ + return entry.advance / 2; + } + + /** +* Return the number of characters in a string that will completly fit inside the specified width when rendered, with +* or without prefering to break the line at whitespace instead of breaking in the middle of a word. This private provides +* the real implementation of both sizeStringToWidth() and trimStringToWidth(). +* +* @param str the String to analyze +* @param width the desired string width (in GUI coordinate system) +* @param breakAtSpaces set to prefer breaking line at spaces than in the middle of a word +* @return the number of characters from str that will fit inside width +*/ + private int sizeString(String str, int width, boolean breakAtSpaces) + { + /* Check for invalid arguments */ + if(str == null || str.isEmpty()) + { + return 0; + } + + /* Convert the width from GUI coordinate system to pixels */ + width += width; + + /* The glyph array for a string is sorted by the string's logical character position */ + Glyph glyphs[] = cacheString(str).glyphs; + + /* Index of the last whitespace found in the string; used if breakAtSpaces is true */ + int wsIndex = -1; + + /* Add up the individual advance of each glyph until it exceeds the specified width */ + int advance = 0, index = 0; + while(index < glyphs.length && advance <= width) + { + /* Keep track of spaces if breakAtSpaces it set */ + if(breakAtSpaces) + { + char c = str.charAt(glyphs[index].stringIndex); + if(c == ' ') + { + wsIndex = index; + } + else if(c == '\n') + { + wsIndex = index; + break; + } + } + + advance += glyphs[index].advance; + index++; + } + + /* Avoid splitting individual words if breakAtSpaces set; same test condition as in Minecraft's FontRenderer */ + if(index < glyphs.length && wsIndex != -1 && wsIndex < index) + { + index = wsIndex; + } + + /* The string index of the last glyph that wouldn't fit gives the total desired length of the string in characters */ + return index < glyphs.length ? glyphs[index].stringIndex : str.length(); + } + + /** +* Return the number of characters in a string that will completly fit inside the specified width when rendered. +* +* @param str the String to analyze +* @param width the desired string width (in GUI coordinate system) +* @return the number of characters from str that will fit inside width +*/ + public int sizeStringToWidth(String str, int width) + { + return sizeString(str, width, true); + } + + /** +* Trim a string so that it fits in the specified width when rendered, optionally reversing the string +* +* @param str the String to trim +* @param width the desired string width (in GUI coordinate system) +* @param reverse if true, the returned string will also be reversed +* @return the trimmed and optionally reversed string +*/ + public String trimStringToWidth(String str, int width, boolean reverse) + { + int length = sizeString(str, width, false); + str = str.substring(0, length); + + if(reverse) + { + str = (new StringBuilder(str)).reverse().toString(); + } + + return str; + } + + /** +* Apply a new vertex color to the Tessellator instance based on the numeric chat color code. Only the RGB component of the +* color is replaced by a color code; the alpha component of the original default color will remain. +* +* @param colorCode the chat color code as a number 0-15 or -1 to reset the default color +* @param color the default color used when the colorCode is -1 +* @param shadowFlag ir true, the color code will select a darker version of the color suitable for drop shadows +* @return the new RGBA color set by this function +*/ + private int applyColorCode(int colorCode, int color, boolean shadowFlag) + { + /* A -1 color code indicates a reset to the initial color passed into renderString() */ + if(colorCode != -1) + { + colorCode = shadowFlag ? colorCode + 16 : colorCode; + color = colorTable[colorCode] & 0xffffff | color & 0xff000000; + } + + Tessellator.instance.setColorRGBA(color >> 16 & 0xff, color >> 8 & 0xff, color & 0xff, color >> 24 & 0xff); + return color; + } + + /** +* Add a string to the string cache by perform full layout on it, remembering its glyph positions, and making sure that +* every font glyph used by the string is pre-rendering. If this string has already been cached, then simply return its +* existing Entry from the cahe. Note that for caching purposes, this method considers two strings to be identical if they +* only differ in their ASCII digits; the renderString() method performs fast glyph substitution based on the actual digits +* in the string at the time. +* +* @param str this String will be layed out and added to the cache (or looked up, if alraedy cached) +* @return the string's cache entry containing all the glyph positions +*/ + private Entry cacheString(String str) + { + /* +* New Key object allocated only if the string was not found in the StringCache using lookupKey. This variable must +* be outside the (entry == null) code block to have a temporary strong reference between the time when the Key is +* added to stringCache and added to weakRefCache. +*/ + Key key; + + /* Either a newly created Entry object for the string, or the cached Entry if the string is already in the cache */ + Entry entry = null; + + /* Don't perform a cache lookup from other threads because the stringCache is not synchronized */ + if(mainThread == Thread.currentThread()) + { + /* Re-use existing lookupKey to avoid allocation overhead on the critical rendering path */ + lookupKey.str = str; + + /* If this string is already in the cache, simply return the cached Entry object */ + entry = stringCache.get(lookupKey); + } + + /* If string is not cached (or not on main thread) then layout the string */ + if(entry == null) + { + /* layoutGlyphVector() requires a char[] so create it here and pass it around to avoid duplication later on */ + char text[] = str.toCharArray(); + + /* Strip all color codes from the string */ + entry = new Entry(); + int length = stripColorCodes(entry, str, text); + + /* Layout the entire string, splitting it up by color codes and the Unicode bidirectional algorithm */ + List glyphList = new ArrayList(); + entry.advance = (int) layoutBidiString(glyphList, text, 0, length, entry.colors); + + /* Convert the accumulated Glyph list to an array for efficient storage */ + entry.glyphs = new Glyph[glyphList.size()]; + entry.glyphs = glyphList.toArray(entry.glyphs); + + /* +* Sort Glyph array by stringIndex so it can be compared during rendering to the already sorted ColorCode array. +* This will apply color codes in the string's logical character order and not the visual order on screen. +*/ + Arrays.sort(entry.glyphs); + + /* Do some post-processing on each Glyph object */ + int colorIndex = 0, shift = 0; + for(int glyphIndex = 0; glyphIndex < entry.glyphs.length; glyphIndex++) + { + Glyph glyph = entry.glyphs[glyphIndex]; + + /* +* Adjust the string index for each glyph to point into the original string with unstripped color codes. The while +* loop is necessary to handle multiple consecutive color codes with no visible glyphs between them. These new adjusted +* stringIndex can now be compared against the color stringIndex during rendering. It also allows lookups of ASCII +* digits in the original string for fast glyph replacement during rendering. +*/ + while(colorIndex < entry.colors.length && glyph.stringIndex + shift >= entry.colors[colorIndex].stringIndex) + { + shift += 2; + colorIndex++; + } + glyph.stringIndex += shift; + } + + /* +* Do not actually cache the string when called from other threads because GlyphCache.cacheGlyphs() will not have been called +* and the cache entry does not contain any texture data needed for rendering. +*/ + if(mainThread == Thread.currentThread()) + { + /* Wrap the string in a Key object (to change how ASCII digits are compared) and cache it along with the newly generated Entry */ + key = new Key(); + + /* Make a copy of the original String to avoid creating a strong reference to it */ + key.str = new String(str); + entry.keyRef = new WeakReference(key); + stringCache.put(key, entry); + } + } + + /* Do not access weakRefCache from other threads since it is unsynchronized, and for a newly created entry, the keyRef is null */ + if(mainThread == Thread.currentThread()) + { + /* +* Add the String passed into this method to the stringWeakMap so it keeps the Key reference live as long as the String is in use. +* If an existing Entry was already found in the stringCache, it's possible that its Key has already been garbage collected. The +* code below checks for this to avoid adding (str, null) entries into weakRefCache. Note that if a new Key object was created, it +* will still be live because of the strong reference created by the "key" variable. +*/ + Key oldKey = entry.keyRef.get(); + if(oldKey != null) + { + weakRefCache.put(str, oldKey); + } + lookupKey.str = null; + } + + /* Return either the existing or the newly created entry so it can be accessed immediately */ + return entry; + } + + /** +* Remove all color codes from the string by shifting data in the text[] array over so it overwrites them. The value of each +* color code and its position (relative to the new stripped text[]) is also recorded in a separate array. The color codes must +* be removed for a font's context sensitive glyph substitution to work (like Arabic letter middle form). +* +* @param cacheEntry each color change in the string will add a new ColorCode object to this list +* @param str the string from which color codes will be stripped +* @param text on input it should be an identical copy of str; on output it will be string with all color codes removed +* @return the length of the new stripped string in text[]; actual text.length will not change because the array is not reallocated +*/ + private int stripColorCodes(Entry cacheEntry, String str, char text[]) + { + List colorList = new ArrayList(); + int start = 0, shift = 0, next; + + byte fontStyle = Font.PLAIN; + byte renderStyle = 0; + byte colorCode = -1; + + /* Search for section mark characters indicating the start of a color code (but only if followed by at least one character) */ + while((next = str.indexOf('\u00A7', start)) != -1 && next + 1 < str.length()) + { + /* +* Remove the two char color code from text[] by shifting the remaining data in the array over on top of it. +* The "start" and "next" variables all contain offsets into the original unmodified "str" string. The "shift" +* variable keeps track of how many characters have been sripped so far, and it's used to compute offsets into +* the text[] array based on the start/next offsets in the original string. +*/ + System.arraycopy(text, next - shift + 2, text, next - shift, text.length - next - 2); + + /* Decode escape code used in the string and change current font style / color based on it */ + int code = "0123456789abcdefklmnor".indexOf(Character.toLowerCase(str.charAt(next + 1))); + switch(code) + { + /* Random style; TODO: NOT IMPLEMENTED YET */ + case 16: + break; + + /* Bold style */ + case 17: + fontStyle |= Font.BOLD; + break; + + /* Strikethrough style */ + case 18: + renderStyle |= ColorCode.STRIKETHROUGH; + cacheEntry.specialRender = true; + break; + + /* Underline style */ + case 19: + renderStyle |= ColorCode.UNDERLINE; + cacheEntry.specialRender = true; + break; + + /* Italic style */ + case 20: + fontStyle |= Font.ITALIC; + break; + + /* Plain style */ + case 21: + fontStyle = Font.PLAIN; + renderStyle = 0; + colorCode = -1; // This may be a bug in Minecraft's original FontRenderer + break; + + /* Otherwise, must be a color code or some other unsupported code */ + default: + if(code >= 0 && code <= 15) + { + colorCode = (byte) code; + fontStyle = Font.PLAIN; // This may be a bug in Minecraft's original FontRenderer + renderStyle = 0; // This may be a bug in Minecraft's original FontRenderer + } + break; + } + + /* Create a new ColorCode object that tracks the position of the code in the original string */ + ColorCode entry = new ColorCode(); + entry.stringIndex = next; + entry.stripIndex = next - shift; + entry.colorCode = colorCode; + entry.fontStyle = fontStyle; + entry.renderStyle = renderStyle; + colorList.add(entry); + + /* Resume search for section marks after skipping this one */ + start = next + 2; + shift += 2; + } + + /* Convert the accumulated ColorCode list to an array for efficient storage */ + cacheEntry.colors = new ColorCode[colorList.size()]; + cacheEntry.colors = colorList.toArray(cacheEntry.colors); + + /* Return the new length of the string after all color codes were removed */ + return text.length - shift; + } + + /** +* Split a string into contiguous LTR or RTL sections by applying the Unicode Bidirectional Algorithm. Calls layoutString() +* for each contiguous run to perform further analysis. +* +* @param glyphList will hold all new Glyph objects allocated by layoutFont() +* @param text the string to lay out +* @param start the offset into text at which to start the layout +* @param limit the (offset + length) at which to stop performing the layout +* @return the total advance (horizontal distance) of this string +*/ + private int layoutBidiString(List glyphList, char text[], int start, int limit, ColorCode colors[]) + { + int advance = 0; + + /* Avoid performing full bidirectional analysis if text has no "strong" right-to-left characters */ + if(Bidi.requiresBidi(text, start, limit)) + { + /* Note that while requiresBidi() uses start/limit the Bidi constructor uses start/length */ + Bidi bidi = new Bidi(text, start, null, 0, limit - start, Bidi.DIRECTION_DEFAULT_LEFT_TO_RIGHT); + + /* If text is entirely right-to-left, then insert an EntryText node for the entire string */ + if(bidi.isRightToLeft()) + { + return layoutStyle(glyphList, text, start, limit, Font.LAYOUT_RIGHT_TO_LEFT, advance, colors); + } + + /* Otherwise text has a mixture of LTR and RLT, and it requires full bidirectional analysis */ + else + { + int runCount = bidi.getRunCount(); + byte levels[] = new byte[runCount]; + Integer ranges[] = new Integer[runCount]; + + /* Reorder contiguous runs of text into their display order from left to right */ + for(int index = 0; index < runCount; index++) + { + levels[index] = (byte) bidi.getRunLevel(index); + ranges[index] = new Integer(index); + } + Bidi.reorderVisually(levels, 0, ranges, 0, runCount); + + /* +* Every GlyphVector must be created on a contiguous run of left-to-right or right-to-left text. Keep track of +* the horizontal advance between each run of text, so that the glyphs in each run can be assigned a position relative +* to the start of the entire string and not just relative to that run. +*/ + for(int visualIndex = 0; visualIndex < runCount; visualIndex++) + { + int logicalIndex = ranges[visualIndex]; + + /* An odd numbered level indicates right-to-left ordering */ + int layoutFlag = (bidi.getRunLevel(logicalIndex) & 1) == 1 ? Font.LAYOUT_RIGHT_TO_LEFT : Font.LAYOUT_LEFT_TO_RIGHT; + advance = layoutStyle(glyphList, text, start + bidi.getRunStart(logicalIndex), start + bidi.getRunLimit(logicalIndex), + layoutFlag, advance, colors); + } + } + + return advance; + } + + /* If text is entirely left-to-right, then insert an EntryText node for the entire string */ + else + { + return layoutStyle(glyphList, text, start, limit, Font.LAYOUT_LEFT_TO_RIGHT, advance, colors); + } + } + + private int layoutStyle(List glyphList, char text[], int start, int limit, int layoutFlags, int advance, ColorCode colors[]) + { + int currentFontStyle = Font.PLAIN; + + /* Find ColorCode object with stripIndex <= start; that will have the font style in effect at the beginning of this text run */ + int colorIndex = Arrays.binarySearch(colors, start); + + /* +* If no exact match is found, Arrays.binarySearch() returns (-(insertion point) - 1) where the insertion point is the index +* of the first ColorCode with a stripIndex > start. In that case, colorIndex is adjusted to select the immediately preceding +* ColorCode whose stripIndex < start. +*/ + if(colorIndex < 0) + { + colorIndex = -colorIndex - 2; + } + + /* Break up the string into segments, where each segment has the same font style in use */ + while(start < limit) + { + int next = limit; + + /* In case of multiple consecutive color codes with the same stripIndex, select the last one which will have active font style */ + while(colorIndex >= 0 && colorIndex < (colors.length - 1) && colors[colorIndex].stripIndex == colors[colorIndex + 1].stripIndex) + { + colorIndex++; + } + + /* If an actual ColorCode object was found (colorIndex within the array), use its fontStyle for layout and render */ + if(colorIndex >= 0 && colorIndex < colors.length) + { + currentFontStyle = colors[colorIndex].fontStyle; + } + + /* +* Search for the next ColorCode that uses a different fontStyle than the current one. If found, the stripIndex of that +* new code is the split point where the string must be split into a separately styled segment. +*/ + while(++colorIndex < colors.length) + { + if(colors[colorIndex].fontStyle != currentFontStyle) + { + next = colors[colorIndex].stripIndex; + break; + } + } + + /* Layout the string segment with the style currently selected by the last color code */ + advance = layoutString(glyphList, text, start, next, layoutFlags, advance, currentFontStyle); + start = next; + } + + return advance; + } + + /** +* Given a string that runs contiguously LTR or RTL, break it up into individual segments based on which fonts can render +* which characters in the string. Calls layoutFont() for each portion of the string that can be layed out with a single +* font. +* +* @param glyphList will hold all new Glyph objects allocated by layoutFont() +* @param text the string to lay out +* @param start the offset into text at which to start the layout +* @param limit the (offset + length) at which to stop performing the layout +* @param layoutFlags either Font.LAYOUT_RIGHT_TO_LEFT or Font.LAYOUT_LEFT_TO_RIGHT +* @param advance the horizontal advance (i.e. X position) returned by previous call to layoutString() +* @param style combination of Font.PLAIN, Font.BOLD, and Font.ITALIC to select a fonts with some specific style +* @return the advance (horizontal distance) of this string plus the advance passed in as an argument +* +* @todo Correctly handling RTL font selection requires scanning the sctring from RTL as well. +* @todo Use bitmap fonts as a fallback if no OpenType font could be found +*/ + private int layoutString(List glyphList, char text[], int start, int limit, int layoutFlags, int advance, int style) + { + /* +* Convert all digits in the string to a '0' before layout to ensure that any glyphs replaced on the fly will all have +* the same positions. Under Windows, Java's "SansSerif" logical font uses the "Arial" font for digits, in which the "1" +* digit is slightly narrower than all other digits. Checking the digitGlyphsReady flag prevents a chicken-and-egg +* problem where the digit glyphs have to be initially cached and the digitGlyphs[] array initialized without replacing +* every digit with '0'. +*/ + if(digitGlyphsReady) + { + for(int index = start; index < limit; index++) + { + if(text[index] >= '0' && text[index] <= '9') + { + text[index] = '0'; + } + } + } + + /* Break the string up into segments, where each segment can be displayed using a single font */ + while(start < limit) + { + Font font = glyphCache.lookupFont(text, start, limit, style); + int next = font.canDisplayUpTo(text, start, limit); + + /* canDisplayUpTo returns -1 if the entire string range is supported by this font */ + if(next == -1) + { + next = limit; + } + + /* +* canDisplayUpTo() returns start if the starting character is not supported at all. In that case, draw just the +* one unsupported character (which will use the font's "missing glyph code"), then retry the lookup again at the +* next character after that. +*/ + if(next == start) + { + next++; + } + + advance = layoutFont(glyphList, text, start, next, layoutFlags, advance, font); + start = next; + } + + return advance; + } + + /** +* Allocate new Glyph objects and add them to the glyph list. This sequence of Glyphs represents a portion of the +* string where all glyphs run contiguously in either LTR or RTL and come from the same physical/logical font. +* +* @param glyphList all newly created Glyph objects are added to this list +* @param text the string to layout +* @param start the offset into text at which to start the layout +* @param limit the (offset + length) at which to stop performing the layout +* @param layoutFlags either Font.LAYOUT_RIGHT_TO_LEFT or Font.LAYOUT_LEFT_TO_RIGHT +* @param advance the horizontal advance (i.e. X position) returned by previous call to layoutString() +* @param font the Font used to layout a GlyphVector for the string +* @return the advance (horizontal distance) of this string plus the advance passed in as an argument +* +* @todo need to ajust position of all glyphs if digits are present, by assuming every digit should be 0 in length +*/ + private int layoutFont(List glyphList, char text[], int start, int limit, int layoutFlags, int advance, Font font) + { + /* +* Ensure that all glyphs used by the string are pre-rendered and cached in the texture. Only safe to do so from the +* main thread because cacheGlyphs() can crash LWJGL if it makes OpenGL calls from any other thread. In this case, +* cacheString() will also not insert the entry into the stringCache since it may be incomplete if lookupGlyph() +* returns null for any glyphs not yet stored in the glyph cache. +*/ + if(mainThread == Thread.currentThread()) + { + glyphCache.cacheGlyphs(font, text, start, limit, layoutFlags); + } + + /* Creating a GlyphVector takes care of all language specific OpenType glyph substitutions and positionings */ + GlyphVector vector = glyphCache.layoutGlyphVector(font, text, start, limit, layoutFlags); + + /* +* Extract all needed information for each glyph from the GlyphVector so it won't be needed for actual rendering. +* Note that initially, glyph.start holds the character index into the stripped text array. But after the entire +* string is layed out, this field will be adjusted on every Glyph object to correctly index the original unstripped +* string. +*/ + Glyph glyph = null; + int numGlyphs = vector.getNumGlyphs(); + for(int index = 0; index < numGlyphs; index++) + { + Point position = vector.getGlyphPixelBounds(index, null, advance, 0).getLocation(); + + /* Compute horizontal advance for the previous glyph based on this glyph's position */ + if(glyph != null) + { + glyph.advance = position.x - glyph.x; + } + + /* +* Allocate a new glyph object and add to the glyphList. The glyph.stringIndex here is really like stripIndex but +* it will be corrected later to account for the color codes that have been stripped out. +*/ + glyph = new Glyph(); + glyph.stringIndex = start + vector.getGlyphCharIndex(index); + glyph.texture = glyphCache.lookupGlyph(font, vector.getGlyphCode(index)); + glyph.x = position.x; + glyph.y = position.y; + glyphList.add(glyph); + } + + /* Compute the advance position of the last glyph (or only glyph) since it can't be done by the above loop */ + advance += (int) vector.getGlyphPosition(numGlyphs).getX(); + if(glyph != null) + { + glyph.advance = advance - glyph.x; + } + + /* Return the overall horizontal advance in pixels from the start of string */ + return advance; + } +} + + diff --git a/src/main/java/noppes/npcs/constants/AiMutex.java b/src/main/java/noppes/npcs/constants/AiMutex.java new file mode 100644 index 000000000..825d5d157 --- /dev/null +++ b/src/main/java/noppes/npcs/constants/AiMutex.java @@ -0,0 +1,7 @@ +package noppes.npcs.constants; + +public class AiMutex { + public static byte PASSIVE = 1; //Usually ai which runs ones + public static byte LOOK = 2; //Used for ai which affect rotation + public static byte PATHING = 4; //Used for ai which runs during pathing +} diff --git a/src/main/java/noppes/npcs/constants/EnumAnimation.java b/src/main/java/noppes/npcs/constants/EnumAnimation.java new file mode 100644 index 000000000..f738c9658 --- /dev/null +++ b/src/main/java/noppes/npcs/constants/EnumAnimation.java @@ -0,0 +1,21 @@ +package noppes.npcs.constants; + +public enum EnumAnimation { + NONE,SITTING,LYING,SNEAKING,DANCING,AIMING,CRAWLING,HUG,CRY, WAVING, BOW; + + public int getWalkingAnimation() { + if(this == SNEAKING) + return 1; + if(this == AIMING) + return 2; + if(this == DANCING) + return 3; + if(this == CRAWLING) + return 4; + if(this == HUG) + return 5; + return 0; + } + + +} diff --git a/src/main/java/noppes/npcs/constants/EnumAvailabilityDialog.java b/src/main/java/noppes/npcs/constants/EnumAvailabilityDialog.java new file mode 100644 index 000000000..3cd3b03e8 --- /dev/null +++ b/src/main/java/noppes/npcs/constants/EnumAvailabilityDialog.java @@ -0,0 +1,5 @@ +package noppes.npcs.constants; + +public enum EnumAvailabilityDialog { + Always,After,Before +} diff --git a/src/main/java/noppes/npcs/constants/EnumAvailabilityFaction.java b/src/main/java/noppes/npcs/constants/EnumAvailabilityFaction.java new file mode 100644 index 000000000..687afbccf --- /dev/null +++ b/src/main/java/noppes/npcs/constants/EnumAvailabilityFaction.java @@ -0,0 +1,5 @@ +package noppes.npcs.constants; + +public enum EnumAvailabilityFaction { + Friendly,Neutral,Hostile +} diff --git a/src/main/java/noppes/npcs/constants/EnumAvailabilityFactionType.java b/src/main/java/noppes/npcs/constants/EnumAvailabilityFactionType.java new file mode 100644 index 000000000..2b6f09d20 --- /dev/null +++ b/src/main/java/noppes/npcs/constants/EnumAvailabilityFactionType.java @@ -0,0 +1,5 @@ +package noppes.npcs.constants; + +public enum EnumAvailabilityFactionType { + Always,Is,IsNot +} diff --git a/src/main/java/noppes/npcs/constants/EnumAvailabilityQuest.java b/src/main/java/noppes/npcs/constants/EnumAvailabilityQuest.java new file mode 100644 index 000000000..3354560b2 --- /dev/null +++ b/src/main/java/noppes/npcs/constants/EnumAvailabilityQuest.java @@ -0,0 +1,5 @@ +package noppes.npcs.constants; + +public enum EnumAvailabilityQuest { + Always,After,Before,Active,NotActive +} diff --git a/src/main/java/noppes/npcs/constants/EnumBardInstrument.java b/src/main/java/noppes/npcs/constants/EnumBardInstrument.java new file mode 100644 index 000000000..aaf61d91d --- /dev/null +++ b/src/main/java/noppes/npcs/constants/EnumBardInstrument.java @@ -0,0 +1,5 @@ +package noppes.npcs.constants; + +public enum EnumBardInstrument { + None,Banjo,Violin,Guitar,Harp, FrenchHorn +} diff --git a/src/main/java/noppes/npcs/constants/EnumCompanionJobs.java b/src/main/java/noppes/npcs/constants/EnumCompanionJobs.java new file mode 100644 index 000000000..992735d8e --- /dev/null +++ b/src/main/java/noppes/npcs/constants/EnumCompanionJobs.java @@ -0,0 +1,5 @@ +package noppes.npcs.constants; + +public enum EnumCompanionJobs { + NONE, SOLDIER, GUARD, FARMER, MINER, SHOP, ROBOT +} diff --git a/src/main/java/noppes/npcs/constants/EnumCompanionStage.java b/src/main/java/noppes/npcs/constants/EnumCompanionStage.java new file mode 100644 index 000000000..2de73a186 --- /dev/null +++ b/src/main/java/noppes/npcs/constants/EnumCompanionStage.java @@ -0,0 +1,18 @@ +package noppes.npcs.constants; + +public enum EnumCompanionStage { + BABY(0, EnumAnimation.CRAWLING, "companion.baby"), + CHILD(72000, EnumAnimation.NONE, "companion.child"), + TEEN(180000, EnumAnimation.NONE, "companion.teenager"), + ADULT(324000, EnumAnimation.NONE, "companion.adult"), + FULLGROWN(450000, EnumAnimation.NONE, "companion.fullgrown"); + + public int matureAge; + public EnumAnimation animation; + public String name; + EnumCompanionStage(int age, EnumAnimation animation, String name){ + this.matureAge = age; + this.animation = animation; + this.name = name; + } +} diff --git a/src/main/java/noppes/npcs/constants/EnumCompanionTalent.java b/src/main/java/noppes/npcs/constants/EnumCompanionTalent.java new file mode 100644 index 000000000..d83169377 --- /dev/null +++ b/src/main/java/noppes/npcs/constants/EnumCompanionTalent.java @@ -0,0 +1,18 @@ +package noppes.npcs.constants; + +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import noppes.npcs.CustomItems; +import noppes.npcs.roles.RoleCompanion; + +public enum EnumCompanionTalent { + INVENTORY(CustomItems.satchel), ARMOR(Items.iron_chestplate), + SWORD(Items.diamond_sword), RANGED(Items.bow), + ACROBATS(Items.leather_boots), INTEL(CustomItems.letter); + + public ItemStack item; + private EnumCompanionTalent(Item item){ + this.item = new ItemStack(item); + } +} diff --git a/src/main/java/noppes/npcs/constants/EnumDayTime.java b/src/main/java/noppes/npcs/constants/EnumDayTime.java new file mode 100644 index 000000000..9f319d79a --- /dev/null +++ b/src/main/java/noppes/npcs/constants/EnumDayTime.java @@ -0,0 +1,5 @@ +package noppes.npcs.constants; + +public enum EnumDayTime { + Always,Night,Day +} diff --git a/src/main/java/noppes/npcs/constants/EnumGuiType.java b/src/main/java/noppes/npcs/constants/EnumGuiType.java new file mode 100644 index 000000000..4f1e0b7fa --- /dev/null +++ b/src/main/java/noppes/npcs/constants/EnumGuiType.java @@ -0,0 +1,5 @@ +package noppes.npcs.constants; + +public enum EnumGuiType { + MainMenuDisplay, MainMenuInv, MainMenuStats, ManageFactions, MainMenuAdvanced, MainMenuGlobal, PlayerBankSmall, PlayerFollowerHire, PlayerFollower, SetupItemGiver, SetupTrader, SetupFollower, PlayerTrader, PlayerTransporter, RedstoneBlock, SetupTransporter, ManageTransport, ManageBanks, MobSpawner, SetupBank, ManageDialogs, ManageQuests, PlayerAnvil, QuestReward, ManageRecipes, QuestItem, NpcRemote, MoneyBag, MainMenuAI, MovingPath, PlayerBankUnlock, PlayerBankUprade, PlayerBankLarge, MobSpawnerAdd, PlayerMailbox, PlayerMailman, Waypoint, MerchantAdd, MobSpawnerMounter, Crate, NpcDimensions, Border, BigSign, Script, Companion, CompanionInv, CompanionTalent, CompanionTrader, ManageLinked +} diff --git a/src/main/java/noppes/npcs/constants/EnumJobType.java b/src/main/java/noppes/npcs/constants/EnumJobType.java new file mode 100644 index 000000000..5e6cd234b --- /dev/null +++ b/src/main/java/noppes/npcs/constants/EnumJobType.java @@ -0,0 +1,5 @@ +package noppes.npcs.constants; + +public enum EnumJobType { + None, Bard, Healer, Guard, ItemGiver, Follower, Spawner, Conversation, ChunkLoader, Puppet +} diff --git a/src/main/java/noppes/npcs/constants/EnumMovingType.java b/src/main/java/noppes/npcs/constants/EnumMovingType.java new file mode 100644 index 000000000..da0fae7cc --- /dev/null +++ b/src/main/java/noppes/npcs/constants/EnumMovingType.java @@ -0,0 +1,21 @@ +package noppes.npcs.constants; + +import java.util.ArrayList; + +public enum EnumMovingType { + Standing("ai.standing"), + Wandering("ai.wandering"), + MovingPath("ai.movingpath"); + + String name; + EnumMovingType(String name){ + this.name = name; + } + public static String[] names(){ + ArrayList list = new ArrayList(); + for(EnumMovingType e : values()) + list.add(e.name); + + return list.toArray(new String[list.size()]); + } +} diff --git a/src/main/java/noppes/npcs/constants/EnumNavType.java b/src/main/java/noppes/npcs/constants/EnumNavType.java new file mode 100644 index 000000000..b9ccde679 --- /dev/null +++ b/src/main/java/noppes/npcs/constants/EnumNavType.java @@ -0,0 +1,25 @@ +package noppes.npcs.constants; + +import java.util.ArrayList; + +public enum EnumNavType { + Default("aitactics.rush"), + Dodge("aitactics.stagger"), + Surround("aitactics.orbit"), + HitNRun("aitactics.hitandrun"), + Ambush("aitactics.ambush"), + Stalk("aitactics.stalk"), + None("gui.none"); + + String name; + EnumNavType(String name){ + this.name = name; + } + public static String[] names(){ + ArrayList list = new ArrayList(); + for(EnumNavType e : values()) + list.add(e.name); + + return list.toArray(new String[list.size()]); + } +} diff --git a/src/main/java/noppes/npcs/constants/EnumNpcToolMaterial.java b/src/main/java/noppes/npcs/constants/EnumNpcToolMaterial.java new file mode 100644 index 000000000..5a34c8d15 --- /dev/null +++ b/src/main/java/noppes/npcs/constants/EnumNpcToolMaterial.java @@ -0,0 +1,85 @@ +package noppes.npcs.constants; + +public enum EnumNpcToolMaterial +{ + WOOD(0, 59, 2.0F, 0, 15), + STONE(1, 131, 4.0F, 1, 5), + BRONZE(2, 170, 5.0F, 2, 15), + IRON(2, 250, 6.0F, 2, 14), + DIA(3, 1561, 8.0F, 3, 10), + GOLD(0, 32, 12.0F, 1, 22), + EMERALD(3, 1000, 8.0F, 4, 10), + DEMONIC(3, 100, 8.0F, 6, 10), + FROST(2, 59, 6.0F, 3, 5), + MITHRIL(3, 3000, 8.0F, 3, 10); + + /** + * The level of material this tool can harvest (3 = DIAMOND, 2 = IRON, 1 = STONE, 0 = IRON/GOLD) + */ + private final int harvestLevel; + + /** + * The number of uses this material allows. (wood = 59, stone = 131, iron = 250, diamond = 1561, gold = 32) + */ + private final int maxUses; + + /** + * The strength of this tool material against blocks which it is effective against. + */ + private final float efficiencyOnProperMaterial; + + /** Damage versus entities. */ + private final int damageVsEntity; + + /** Defines the natural enchantability factor of the material. */ + private final int enchantability; + + private EnumNpcToolMaterial(int par3, int par4, float par5, int par6, int par7) + { + this.harvestLevel = par3; + this.maxUses = par4; + this.efficiencyOnProperMaterial = par5; + this.damageVsEntity = par6; + this.enchantability = par7; + } + + /** + * The number of uses this material allows. (wood = 59, stone = 131, iron = 250, diamond = 1561, gold = 32) + */ + public int getMaxUses() + { + return this.maxUses; + } + + /** + * The strength of this tool material against blocks which it is effective against. + */ + public float getEfficiencyOnProperMaterial() + { + return this.efficiencyOnProperMaterial; + } + + /** + * Damage versus entities. + */ + public int getDamageVsEntity() + { + return this.damageVsEntity; + } + + /** + * The level of material this tool can harvest (3 = DIAMOND, 2 = IRON, 1 = STONE, 0 = IRON/GOLD) + */ + public int getHarvestLevel() + { + return this.harvestLevel; + } + + /** + * Return the natural enchantability factor of the material. + */ + public int getEnchantability() + { + return this.enchantability; + } +} diff --git a/src/main/java/noppes/npcs/constants/EnumOptionType.java b/src/main/java/noppes/npcs/constants/EnumOptionType.java new file mode 100644 index 000000000..0adc92b9c --- /dev/null +++ b/src/main/java/noppes/npcs/constants/EnumOptionType.java @@ -0,0 +1,6 @@ +package noppes.npcs.constants; + +public enum EnumOptionType { + QuitOption,DialogOption,Disabled,RoleOption,CommandBlock; + +} diff --git a/src/main/java/noppes/npcs/constants/EnumPacketClient.java b/src/main/java/noppes/npcs/constants/EnumPacketClient.java new file mode 100644 index 000000000..c392e5e51 --- /dev/null +++ b/src/main/java/noppes/npcs/constants/EnumPacketClient.java @@ -0,0 +1,6 @@ +package noppes.npcs.constants; + +public enum EnumPacketClient { + CHAT, MESSAGE, SYNCRECIPES_ADD, SYNCRECIPES_WORKBENCH, DIALOG, QUEST_COMPLETION, EDIT_NPC, PLAY_SOUND, PLAY_MUSIC, UPDATE_NPC, ROLE, GUI, PARTICLE, DELETE_NPC, SCROLL_LIST, SCROLL_DATA, SCROLL_DATA_PART, SCROLL_SELECTED, GUI_REDSTONE, GUI_WAYPOINT, GUI_DATA, GUI_ERROR, GUI_CLOSE, VILLAGER_LIST, CHATBUBBLE, SYNCRECIPES_CARPENTRYBENCH, CLONE, OPEN_BOOK, DIALOG_DUMMY, CONFIG + +} diff --git a/src/main/java/noppes/npcs/constants/EnumPacketServer.java b/src/main/java/noppes/npcs/constants/EnumPacketServer.java new file mode 100644 index 000000000..c15f88eda --- /dev/null +++ b/src/main/java/noppes/npcs/constants/EnumPacketServer.java @@ -0,0 +1,92 @@ +package noppes.npcs.constants; + +import noppes.npcs.CustomNpcsPermissions; + +public enum EnumPacketServer { + Delete(CustomNpcsPermissions.NPC_DELETE, true), + RemoteMainMenu(CustomNpcsPermissions.NPC_GUI), + NpcMenuClose(CustomNpcsPermissions.NPC_GUI, true), + RemoteDelete(CustomNpcsPermissions.NPC_DELETE, true), + RemoteFreeze(CustomNpcsPermissions.NPC_FREEZE), + RemoteReset(CustomNpcsPermissions.NPC_RESET), + SpawnMob(CustomNpcsPermissions.SPAWNER_MOB), + MobSpawner(CustomNpcsPermissions.SPAWNER_CREATE), + MainmenuAISave(CustomNpcsPermissions.NPC_AI,true), MainmenuAIGet(true), + MainmenuInvSave(CustomNpcsPermissions.NPC_INVENTORY, true), MainmenuInvGet(true), + MainmenuStatsSave(CustomNpcsPermissions.NPC_STATS, true), MainmenuStatsGet(true), + + MainmenuDisplaySave(CustomNpcsPermissions.NPC_DISPLAY, true), MainmenuDisplayGet(true), + ModelDataSave(CustomNpcsPermissions.NPC_DISPLAY, true), + + MainmenuAdvancedSave(CustomNpcsPermissions.NPC_ADVANCED,true), MainmenuAdvancedGet(true), + DialogNpcSet(CustomNpcsPermissions.NPC_ADVANCED), + DialogNpcRemove(CustomNpcsPermissions.NPC_ADVANCED, true), + FactionSet(CustomNpcsPermissions.NPC_ADVANCED, true), + TransportSave(CustomNpcsPermissions.NPC_ADVANCED, true), + TransformSave(CustomNpcsPermissions.NPC_ADVANCED, true), TransformGet(true), + TransformLoad(CustomNpcsPermissions.NPC_ADVANCED, true), + TraderMarketSave(CustomNpcsPermissions.NPC_ADVANCED, true), + JobSave(CustomNpcsPermissions.NPC_ADVANCED, true), JobGet(true), + RoleSave(CustomNpcsPermissions.NPC_ADVANCED, true), RoleGet(true), + JobSpawnerAdd(CustomNpcsPermissions.NPC_ADVANCED, true), JobSpawnerRemove(CustomNpcsPermissions.NPC_ADVANCED, true), + RoleCompanionUpdate(CustomNpcsPermissions.NPC_ADVANCED, true), + LinkedSet(CustomNpcsPermissions.NPC_ADVANCED, true), + + ClonePreSave(CustomNpcsPermissions.NPC_CLONE), CloneSave(CustomNpcsPermissions.NPC_CLONE), CloneRemove(CustomNpcsPermissions.NPC_CLONE), CloneList, + + LinkedGetAll, LinkedRemove(CustomNpcsPermissions.GLOBAL_LINKED), LinkedAdd(CustomNpcsPermissions.GLOBAL_LINKED), + ScriptDataSave(CustomNpcsPermissions.TOOL_SCRIPTER, true), ScriptDataGet(true), + PlayerDataRemove(CustomNpcsPermissions.GLOBAL_PLAYERDATA), + BankSave(CustomNpcsPermissions.GLOBAL_BANK), BanksGet, BankGet, + BankRemove(CustomNpcsPermissions.GLOBAL_BANK), + DialogCategorySave(CustomNpcsPermissions.GLOBAL_DIALOG), DialogCategoriesGet, DialogsGetFromDialog, + DialogCategoryRemove(CustomNpcsPermissions.GLOBAL_DIALOG), DialogCategoryGet, + DialogSave(CustomNpcsPermissions.GLOBAL_DIALOG), DialogsGet, DialogGet, + DialogRemove(CustomNpcsPermissions.GLOBAL_DIALOG), + TransportCategoryRemove(CustomNpcsPermissions.GLOBAL_TRANSPORT), TransportGetLocation(true), + TransportRemove(CustomNpcsPermissions.GLOBAL_TRANSPORT), TransportsGet, + TransportCategorySave(CustomNpcsPermissions.GLOBAL_TRANSPORT), TransportCategoriesGet, + FactionRemove(CustomNpcsPermissions.GLOBAL_FACTION), + FactionSave(CustomNpcsPermissions.GLOBAL_FACTION), FactionsGet, FactionGet, + QuestCategorySave(CustomNpcsPermissions.GLOBAL_QUEST), QuestCategoriesGet, + QuestRemove(CustomNpcsPermissions.GLOBAL_QUEST), + QuestCategoryRemove(CustomNpcsPermissions.GLOBAL_QUEST), + QuestRewardSave(CustomNpcsPermissions.GLOBAL_QUEST), + QuestSave(CustomNpcsPermissions.GLOBAL_QUEST), QuestsGetFromQuest, QuestsGet, + QuestDialogGetTitle(CustomNpcsPermissions.GLOBAL_QUEST), + RecipeSave(CustomNpcsPermissions.GLOBAL_RECIPE), + RecipeRemove(CustomNpcsPermissions.GLOBAL_RECIPE), + NaturalSpawnSave(CustomNpcsPermissions.GLOBAL_NATURALSPAWN), NaturalSpawnGet, + NaturalSpawnRemove(CustomNpcsPermissions.GLOBAL_NATURALSPAWN), + MerchantUpdate(CustomNpcsPermissions.EDIT_VILLAGER), + PlayerRider(CustomNpcsPermissions.TOOL_MOUNTER), + SpawnRider(CustomNpcsPermissions.TOOL_MOUNTER), + MovingPathSave(CustomNpcsPermissions.TOOL_PATHER,true), MovingPathGet(true), + DialogNpcGet, + + RecipesGet, RecipeGet, QuestOpenGui, PlayerDataGet, + + RemoteNpcsGet(CustomNpcsPermissions.NPC_GUI), + RemoteTpToNpc,QuestGet, QuestCategoryGet, + SaveTileEntity, + NaturalSpawnGetAll, MailOpenSetup, + DimensionsGet, DimensionTeleport, GetTileEntity, Gui, ; + + public CustomNpcsPermissions.Permission permission = null; + public boolean needsNpc = false; + + EnumPacketServer() {} + + EnumPacketServer(CustomNpcsPermissions.Permission permission, boolean npc) { + this(permission); + } + EnumPacketServer(boolean npc) { + needsNpc = npc; + } + EnumPacketServer(CustomNpcsPermissions.Permission permission) { + this.permission = permission; + } + public boolean hasPermission() { + return permission != null; + } +} diff --git a/src/main/java/noppes/npcs/constants/EnumParticleType.java b/src/main/java/noppes/npcs/constants/EnumParticleType.java new file mode 100644 index 000000000..f80f58a9f --- /dev/null +++ b/src/main/java/noppes/npcs/constants/EnumParticleType.java @@ -0,0 +1,18 @@ +package noppes.npcs.constants; + +public enum EnumParticleType { + None(""), + Smoke("smoke"), + Portal("portal"), + Redstone("reddust"), + Lightning("magicCrit"), + LargeSmoke("largesmoke"), + Magic("witchMagic"), + Enchant("enchantmenttable"), + Crit("crit"); + + public String particleName; + EnumParticleType(String name){ + this.particleName = name; + } +} \ No newline at end of file diff --git a/src/main/java/noppes/npcs/constants/EnumPlayerData.java b/src/main/java/noppes/npcs/constants/EnumPlayerData.java new file mode 100644 index 000000000..44c1e3444 --- /dev/null +++ b/src/main/java/noppes/npcs/constants/EnumPlayerData.java @@ -0,0 +1,5 @@ +package noppes.npcs.constants; + +public enum EnumPlayerData { + Players,Quest,Dialog,Transport,Bank,Factions +} diff --git a/src/main/java/noppes/npcs/constants/EnumPlayerPacket.java b/src/main/java/noppes/npcs/constants/EnumPlayerPacket.java new file mode 100644 index 000000000..c891d3d78 --- /dev/null +++ b/src/main/java/noppes/npcs/constants/EnumPlayerPacket.java @@ -0,0 +1,5 @@ +package noppes.npcs.constants; + +public enum EnumPlayerPacket { + FollowerHire,FollowerExtend,Trader, FollowerState, Transport, BankUnlock, BankUpgrade, Dialog, QuestLog, QuestCompletion, CheckQuestCompletion, BankSlotOpen, FactionsGet, MailGet, MailDelete, MailSend, MailRead, MailboxOpenMail, SignSave, SaveBook, CompanionOpenInv, RoleGet, CompanionTalentExp +} diff --git a/src/main/java/noppes/npcs/constants/EnumPotionType.java b/src/main/java/noppes/npcs/constants/EnumPotionType.java new file mode 100644 index 000000000..3d669c136 --- /dev/null +++ b/src/main/java/noppes/npcs/constants/EnumPotionType.java @@ -0,0 +1,5 @@ +package noppes.npcs.constants; + +public enum EnumPotionType { + None, Fire, Poison, Hunger, Weakness, Slowness, Nausea, Blindness, Wither; +} diff --git a/src/main/java/noppes/npcs/constants/EnumQuestCompletion.java b/src/main/java/noppes/npcs/constants/EnumQuestCompletion.java new file mode 100644 index 000000000..3441cc0d2 --- /dev/null +++ b/src/main/java/noppes/npcs/constants/EnumQuestCompletion.java @@ -0,0 +1,5 @@ +package noppes.npcs.constants; + +public enum EnumQuestCompletion { + Npc,Instant; +} diff --git a/src/main/java/noppes/npcs/constants/EnumQuestRepeat.java b/src/main/java/noppes/npcs/constants/EnumQuestRepeat.java new file mode 100644 index 000000000..954e4acd8 --- /dev/null +++ b/src/main/java/noppes/npcs/constants/EnumQuestRepeat.java @@ -0,0 +1,5 @@ +package noppes.npcs.constants; + +public enum EnumQuestRepeat { + NONE, REPEATABLE, MCDAILY, MCWEEKLY, RLDAILY, RLWEEKLY; +} diff --git a/src/main/java/noppes/npcs/constants/EnumQuestType.java b/src/main/java/noppes/npcs/constants/EnumQuestType.java new file mode 100644 index 000000000..2ca6b0591 --- /dev/null +++ b/src/main/java/noppes/npcs/constants/EnumQuestType.java @@ -0,0 +1,5 @@ +package noppes.npcs.constants; + +public enum EnumQuestType { + Item, Dialog, Kill, Location, AreaKill; +} diff --git a/src/main/java/noppes/npcs/constants/EnumRoleType.java b/src/main/java/noppes/npcs/constants/EnumRoleType.java new file mode 100644 index 000000000..a82f4b607 --- /dev/null +++ b/src/main/java/noppes/npcs/constants/EnumRoleType.java @@ -0,0 +1,6 @@ +package noppes.npcs.constants; + +public enum EnumRoleType { + + None, Trader, Follower, Bank, Transporter, Postman, Companion +} diff --git a/src/main/java/noppes/npcs/constants/EnumScriptType.java b/src/main/java/noppes/npcs/constants/EnumScriptType.java new file mode 100644 index 000000000..424a4e62d --- /dev/null +++ b/src/main/java/noppes/npcs/constants/EnumScriptType.java @@ -0,0 +1,5 @@ +package noppes.npcs.constants; + +public enum EnumScriptType { + INIT, TICK, INTERACT, DIALOG, DAMAGED, KILLED, ATTACK, TARGET, COLLIDE, KILLS, DIALOG_OPTION +} diff --git a/src/main/java/noppes/npcs/constants/EnumStandingType.java b/src/main/java/noppes/npcs/constants/EnumStandingType.java new file mode 100644 index 000000000..60f3d315c --- /dev/null +++ b/src/main/java/noppes/npcs/constants/EnumStandingType.java @@ -0,0 +1,5 @@ +package noppes.npcs.constants; + +public enum EnumStandingType { + RotateBody,NoRotation,Stalking,HeadRotation +} diff --git a/src/main/java/noppes/npcs/containers/ContainerCarpentryBench.java b/src/main/java/noppes/npcs/containers/ContainerCarpentryBench.java new file mode 100644 index 000000000..a6cf8cf8c --- /dev/null +++ b/src/main/java/noppes/npcs/containers/ContainerCarpentryBench.java @@ -0,0 +1,176 @@ +package noppes.npcs.containers; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.InventoryCraftResult; +import net.minecraft.inventory.InventoryCrafting; +import net.minecraft.inventory.Slot; +import net.minecraft.inventory.SlotCrafting; +import net.minecraft.item.ItemStack; +import net.minecraft.network.play.server.S2FPacketSetSlot; +import net.minecraft.world.World; +import noppes.npcs.CustomItems; +import noppes.npcs.controllers.RecipeCarpentry; +import noppes.npcs.controllers.RecipeController; + +public class ContainerCarpentryBench extends Container +{ + public InventoryCrafting craftMatrix = new InventoryCrafting(this, 4, 4); + public IInventory craftResult = new InventoryCraftResult(); + private EntityPlayer player; + private World worldObj; + private int posX; + private int posY; + private int posZ; + + public ContainerCarpentryBench(InventoryPlayer par1InventoryPlayer, World par2World, int par3, int par4, int par5) + { + this.worldObj = par2World; + this.posX = par3; + this.posY = par4; + this.posZ = par5; + this.player = par1InventoryPlayer.player; + this.addSlotToContainer(new SlotCrafting(par1InventoryPlayer.player, this.craftMatrix, this.craftResult, 0, 133, 41)); + int var6; + int var7; + + for (var6 = 0; var6 < 4; ++var6) + { + for (var7 = 0; var7 < 4; ++var7) + { + this.addSlotToContainer(new Slot(this.craftMatrix, var7 + var6 * 4, 17 + var7 * 18, 14 + var6 * 18)); + } + } + + for (var6 = 0; var6 < 3; ++var6) + { + for (var7 = 0; var7 < 9; ++var7) + { + this.addSlotToContainer(new Slot(par1InventoryPlayer, var7 + var6 * 9 + 9, 8 + var7 * 18, 98 + var6 * 18)); + } + } + + for (var6 = 0; var6 < 9; ++var6) + { + this.addSlotToContainer(new Slot(par1InventoryPlayer, var6, 8 + var6 * 18, 156)); + } + + this.onCraftMatrixChanged(this.craftMatrix); + } + + public int getMetadata(){ + return worldObj.getBlockMetadata(posX, posY, posZ); + } + + /** + * Callback for when the crafting matrix is changed. + */ + @Override + public void onCraftMatrixChanged(IInventory par1IInventory) + { + if(!this.worldObj.isRemote){ + RecipeCarpentry recipe = RecipeController.instance.findMatchingRecipe(this.craftMatrix); + + ItemStack item = null; + if(recipe != null && recipe.availability.isAvailable(player)){ + item = recipe.getCraftingResult(this.craftMatrix); + } + + this.craftResult.setInventorySlotContents(0, item); + EntityPlayerMP plmp = (EntityPlayerMP) player; + plmp.playerNetServerHandler.sendPacket(new S2FPacketSetSlot(this.windowId, 0, item)); + } + } + + /** + * Callback for when the crafting gui is closed. + */ + @Override + public void onContainerClosed(EntityPlayer par1EntityPlayer) + { + super.onContainerClosed(par1EntityPlayer); + + if (!this.worldObj.isRemote) + { + for (int var2 = 0; var2 < 16; ++var2) + { + ItemStack var3 = this.craftMatrix.getStackInSlotOnClosing(var2); + + if (var3 != null) + { + par1EntityPlayer.dropPlayerItemWithRandomChoice(var3, false); + } + } + } + } + @Override + public boolean canInteractWith(EntityPlayer par1EntityPlayer) + { + return this.worldObj.getBlock(this.posX, this.posY, this.posZ) != CustomItems.carpentyBench ? false : par1EntityPlayer.getDistanceSq((double)this.posX + 0.5D, (double)this.posY + 0.5D, (double)this.posZ + 0.5D) <= 64.0D; + } + + /** + * Called to transfer a stack from one inventory to the other eg. when shift clicking. + */ + @Override + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par1) + { + ItemStack var2 = null; + Slot var3 = (Slot)this.inventorySlots.get(par1); + + if (var3 != null && var3.getHasStack()) + { + ItemStack var4 = var3.getStack(); + var2 = var4.copy(); + + if (par1 == 0) + { + if (!this.mergeItemStack(var4, 17, 53, true)) + { + return null; + } + + var3.onSlotChange(var4, var2); + } + else if (par1 >= 17 && par1 < 44) + { + if (!this.mergeItemStack(var4, 44, 53, false)) + { + return null; + } + } + else if (par1 >= 44 && par1 < 53) + { + if (!this.mergeItemStack(var4, 17, 44, false)) + { + return null; + } + } + else if (!this.mergeItemStack(var4, 17, 53, false)) + { + return null; + } + + if (var4.stackSize == 0) + { + var3.putStack((ItemStack)null); + } + else + { + var3.onSlotChanged(); + } + + if (var4.stackSize == var2.stackSize) + { + return null; + } + + var3.onPickupFromSlot(par1EntityPlayer, var4); + } + + return var2; + } +} diff --git a/src/main/java/noppes/npcs/containers/ContainerCrate.java b/src/main/java/noppes/npcs/containers/ContainerCrate.java new file mode 100644 index 000000000..47205545f --- /dev/null +++ b/src/main/java/noppes/npcs/containers/ContainerCrate.java @@ -0,0 +1,106 @@ +package noppes.npcs.containers; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class ContainerCrate extends Container +{ + public IInventory lowerChestInventory; + public IInventory upperChestInventory; + private int numRows; + + public ContainerCrate(IInventory par1IInventory, IInventory par2IInventory) + { + this.lowerChestInventory = par2IInventory; + this.upperChestInventory = par1IInventory; + this.numRows = par2IInventory.getSizeInventory() / 9; + par2IInventory.openInventory(); + int i = (this.numRows - 4) * 18; + int j; + int k; + + for (j = 0; j < this.numRows; ++j) + { + for (k = 0; k < 9; ++k) + { + this.addSlotToContainer(new Slot(par2IInventory, k + j * 9, 8 + k * 18, 18 + j * 18)); + } + } + + for (j = 0; j < 3; ++j) + { + for (k = 0; k < 9; ++k) + { + this.addSlotToContainer(new Slot(par1IInventory, k + j * 9 + 9, 8 + k * 18, 103 + j * 18 + i)); + } + } + + for (j = 0; j < 9; ++j) + { + this.addSlotToContainer(new Slot(par1IInventory, j, 8 + j * 18, 161 + i)); + } + } + + public boolean canInteractWith(EntityPlayer par1EntityPlayer) + { + return this.lowerChestInventory.isUseableByPlayer(par1EntityPlayer); + } + + /** + * Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that. + */ + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) + { + ItemStack itemstack = null; + Slot slot = (Slot)this.inventorySlots.get(par2); + + if (slot != null && slot.getHasStack()) + { + ItemStack itemstack1 = slot.getStack(); + itemstack = itemstack1.copy(); + + if (par2 < this.numRows * 9) + { + if (!this.mergeItemStack(itemstack1, this.numRows * 9, this.inventorySlots.size(), true)) + { + return null; + } + } + else if (!this.mergeItemStack(itemstack1, 0, this.numRows * 9, false)) + { + return null; + } + + if (itemstack1.stackSize == 0) + { + slot.putStack((ItemStack)null); + } + else + { + slot.onSlotChanged(); + } + } + + return itemstack; + } + + /** + * Called when the container is closed. + */ + public void onContainerClosed(EntityPlayer par1EntityPlayer) + { + super.onContainerClosed(par1EntityPlayer); + this.lowerChestInventory.closeInventory(); + } + + /** + * Return this chest container's lower chest inventory. + */ + public IInventory getLowerChestInventory() + { + return this.lowerChestInventory; + } +} \ No newline at end of file diff --git a/src/main/java/noppes/npcs/containers/ContainerEmpty.java b/src/main/java/noppes/npcs/containers/ContainerEmpty.java new file mode 100644 index 000000000..b1cc1d106 --- /dev/null +++ b/src/main/java/noppes/npcs/containers/ContainerEmpty.java @@ -0,0 +1,13 @@ +package noppes.npcs.containers; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; + +public class ContainerEmpty extends Container{ + + @Override + public boolean canInteractWith(EntityPlayer var1) { + return false; + } + +} diff --git a/src/main/java/noppes/npcs/containers/ContainerMail.java b/src/main/java/noppes/npcs/containers/ContainerMail.java new file mode 100644 index 000000000..c2e2a6f2c --- /dev/null +++ b/src/main/java/noppes/npcs/containers/ContainerMail.java @@ -0,0 +1,112 @@ +package noppes.npcs.containers; + +import java.util.Iterator; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ContainerChest; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraft.util.MathHelper; +import noppes.npcs.CustomNpcs; +import noppes.npcs.client.gui.player.GuiMailmanWrite; +import noppes.npcs.constants.EnumGuiType; +import noppes.npcs.controllers.PlayerDataController; +import noppes.npcs.controllers.PlayerMail; +import noppes.npcs.controllers.PlayerMailData; + +public class ContainerMail extends ContainerNpcInterface{ + private static final String __OBFID = "CL_00001742"; + public static PlayerMail staticmail = new PlayerMail(); + public PlayerMail mail = new PlayerMail(); + private boolean canEdit, canSend; + + + public ContainerMail(EntityPlayer player, boolean canEdit, boolean canSend){ + super(player); + mail = staticmail; + staticmail = new PlayerMail(); + this.canEdit = canEdit; + this.canSend = canSend; + player.inventory.openInventory(); + int k; + + for (k = 0; k < 4; ++k) + { + this.addSlotToContainer(new SlotValid(mail, k , 179 + k * 24, 138, canEdit)); + } + + + for (int j = 0; j < 3; ++j) + { + for (k = 0; k < 9; ++k) + { + this.addSlotToContainer(new Slot(player.inventory, k + j * 9 + 9, 28 + k * 18, 175 + j * 18 )); + } + } + + for (int j = 0; j < 9; ++j) + { + this.addSlotToContainer(new Slot(player.inventory, j, 28 + j * 18, 230 )); + } + } + + /** + * Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that. + */ + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) + { + ItemStack itemstack = null; + Slot slot = (Slot)this.inventorySlots.get(par2); + + if (slot != null && slot.getHasStack()) + { + ItemStack itemstack1 = slot.getStack(); + itemstack = itemstack1.copy(); + + if (par2 < 4) + { + if (!this.mergeItemStack(itemstack1, 4, this.inventorySlots.size(), true)) + { + return null; + } + } + else if (!canEdit || !this.mergeItemStack(itemstack1, 0, 4, false)) + { + return null; + } + + if (itemstack1.stackSize == 0) + { + slot.putStack((ItemStack)null); + } + else + { + slot.onSlotChanged(); + } + } + + return itemstack; + } + + /** + * Called when the container is closed. + */ + @Override + public void onContainerClosed(EntityPlayer player){ + super.onContainerClosed(player); + if(!canEdit && !player.worldObj.isRemote){ + PlayerMailData data = PlayerDataController.instance.getPlayerData(player).mailData; + Iterator it = data.playermail.iterator(); + while(it.hasNext()){ + PlayerMail mail = it.next(); + if(mail.time == this.mail.time && mail.sender.equals(this.mail.sender)){ + mail.readNBT(this.mail.writeNBT()); + break; + } + } + } + } + +} diff --git a/src/main/java/noppes/npcs/containers/ContainerManageBanks.java b/src/main/java/noppes/npcs/containers/ContainerManageBanks.java new file mode 100644 index 000000000..e83eb490e --- /dev/null +++ b/src/main/java/noppes/npcs/containers/ContainerManageBanks.java @@ -0,0 +1,56 @@ +package noppes.npcs.containers; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import noppes.npcs.controllers.Bank; + +public class ContainerManageBanks extends Container +{ + public Bank bank; + + public ContainerManageBanks(EntityPlayer player) + { + bank = new Bank(); + + for(int i = 0; i < 6; i++) + { + int x = 36; + int y = 38; + y += i * 22; + addSlotToContainer(new Slot(bank.currencyInventory, i, x, y)); + } + + for(int i = 0; i < 6; i++) + { + int x = 142; + int y = 38; + y += i * 22; + addSlotToContainer(new Slot(bank.upgradeInventory, i, x, y)); + } + + for(int j1 = 0; j1 < 9; j1++) + { + addSlotToContainer(new Slot(player.inventory, j1, 8 + j1 * 18, 171)); + } + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int i){ + return null; + } + + @Override + public boolean canInteractWith(EntityPlayer entityplayer) { + return true; + } + + public void setBank(Bank bank2) { + for(int i = 0; i< 6; i++){ + bank.currencyInventory.setInventorySlotContents(i, bank2.currencyInventory.getStackInSlot(i)); + bank.upgradeInventory.setInventorySlotContents(i, bank2.upgradeInventory.getStackInSlot(i)); + } + } +} + diff --git a/src/main/java/noppes/npcs/containers/ContainerManageRecipes.java b/src/main/java/noppes/npcs/containers/ContainerManageRecipes.java new file mode 100644 index 000000000..b11209893 --- /dev/null +++ b/src/main/java/noppes/npcs/containers/ContainerManageRecipes.java @@ -0,0 +1,154 @@ +package noppes.npcs.containers; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.InventoryBasic; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import noppes.npcs.NoppesUtilPlayer; +import noppes.npcs.controllers.RecipeCarpentry; + +public class ContainerManageRecipes extends Container +{ + private InventoryBasic craftingMatrix; + public RecipeCarpentry recipe; + public int size; + public int width; + private boolean init = false; + public ContainerManageRecipes(EntityPlayer player,int size) + { + this.size = size * size; + this.width = size; + craftingMatrix = new InventoryBasic("crafting", false, this.size + 1); + recipe = new RecipeCarpentry(""); + addSlotToContainer(new Slot(craftingMatrix,0,87,61)); + + for(int i = 0; i < size;i++){ + for(int j = 0; j < size;j++){ + addSlotToContainer(new Slot(craftingMatrix, i * width + j + 1,j*18 + 8, i*18 + 35)); + } + } + + for(int i1 = 0; i1 < 3; i1++) + { + for(int l1 = 0; l1 < 9; l1++) + { + addSlotToContainer(new Slot(player.inventory, l1 + i1 * 9 + 9, 8 + l1 * 18, 113 + i1 * 18)); + } + + } + + for(int j1 = 0; j1 < 9; j1++) + { + addSlotToContainer(new Slot(player.inventory, j1, 8 + j1 * 18, 171)); + } + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int i) + { + return null; + } + @Override + public boolean canInteractWith(EntityPlayer entityplayer) { + return true; + } + + public void setRecipe(RecipeCarpentry recipe) { + craftingMatrix.setInventorySlotContents(0,recipe.getRecipeOutput()); + for(int i = 0; i < width;i++){ + for(int j = 0; j < width;j++){ + if(j >= recipe.recipeWidth) + craftingMatrix.setInventorySlotContents(i*width + j + 1,null); + else + craftingMatrix.setInventorySlotContents(i*width + j + 1, recipe.getCraftingItem(i * recipe.recipeWidth + j)); + } + } + this.recipe = recipe; + } + public void saveRecipe(){ + int nextChar = 0; + char[] chars = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P'}; + Map nameMapping = new HashMap(); + int firstRow = width,lastRow = 0,firstColumn = width,lastColumn = 0; + boolean seenRow = false; + for(int i = 0; i < width;i++){ + boolean seenColumn = false; + for(int j = 0; j < width;j++){ + ItemStack item = craftingMatrix.getStackInSlot(i * width + j + 1); + if(item == null){ + continue; + }else{ + if(!seenColumn && j < firstColumn){ + firstColumn = j; + } + if(j > lastColumn) + lastColumn = j; + + seenColumn = true; + } + Character letter = null; + for(ItemStack mapped : nameMapping.keySet()){ + if(NoppesUtilPlayer.compareItems(mapped, item, recipe.ignoreDamage, recipe.ignoreNBT)) + letter = nameMapping.get(mapped); + } + if(letter == null){ + letter = chars[nextChar]; + nextChar++; + nameMapping.put(item, letter); + } + } + if(seenColumn){ + if(!seenRow){ + firstRow = i; + lastRow = i; + seenRow = true; + } + else{ + lastRow = i; + } + } + + } + ArrayList recipe = new ArrayList(); + + for(int i = 0; i < width;i++){ + if(i < firstRow || i > lastRow) + continue; + String row = ""; + for(int j = 0; j < width;j++){ + if(j < firstColumn|| j > lastColumn) + continue; + ItemStack item = craftingMatrix.getStackInSlot(i * width + j + 1); + if(item == null){ + row += " "; + continue; + } + + for(ItemStack mapped : nameMapping.keySet()){ + if(NoppesUtilPlayer.compareItems(mapped, item, false, false)){ + row += nameMapping.get(mapped); + } + } + + } + recipe.add(row); + } + if(nameMapping.isEmpty()){ + RecipeCarpentry r = new RecipeCarpentry(this.recipe.name); + r.copy(this.recipe); + this.recipe = r; + return; + } + for(ItemStack mapped : nameMapping.keySet()){ + Character letter = nameMapping.get(mapped); + recipe.add(letter); + recipe.add(mapped); + } + this.recipe = RecipeCarpentry.saveRecipe(this.recipe, craftingMatrix.getStackInSlot(0), recipe.toArray()); + } +} diff --git a/src/main/java/noppes/npcs/containers/ContainerMerchantAdd.java b/src/main/java/noppes/npcs/containers/ContainerMerchantAdd.java new file mode 100644 index 000000000..ff79b04cc --- /dev/null +++ b/src/main/java/noppes/npcs/containers/ContainerMerchantAdd.java @@ -0,0 +1,161 @@ +package noppes.npcs.containers; + +import net.minecraft.entity.IMerchant; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.InventoryBasic; +import net.minecraft.inventory.InventoryMerchant; +import net.minecraft.inventory.Slot; +import net.minecraft.inventory.SlotMerchantResult; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class ContainerMerchantAdd extends ContainerNpcInterface +{ + /** Instance of Merchant. */ + private IMerchant theMerchant; + private InventoryBasic merchantInventory; + + /** Instance of World. */ + private final World theWorld; + + public ContainerMerchantAdd(EntityPlayer player, IMerchant par2IMerchant, World par3World) + { + super(player); + this.theMerchant = par2IMerchant; + this.theWorld = par3World; + this.merchantInventory = new InventoryBasic("", false,3); + this.addSlotToContainer(new Slot(this.merchantInventory, 0, 36, 53)); + this.addSlotToContainer(new Slot(this.merchantInventory, 1, 62, 53)); + this.addSlotToContainer(new Slot(this.merchantInventory, 2, 120, 53)); + int i; + + for (i = 0; i < 3; ++i) + { + for (int j = 0; j < 9; ++j) + { + this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); + } + } + + for (i = 0; i < 9; ++i) + { + this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142)); + } + } + + public void addCraftingToCrafters(ICrafting par1ICrafting) + { + super.addCraftingToCrafters(par1ICrafting); + } + + /** + * Looks for changes made in the container, sends them to every listener. + */ + public void detectAndSendChanges() + { + super.detectAndSendChanges(); + } + + /** + * Callback for when the crafting matrix is changed. + */ + public void onCraftMatrixChanged(IInventory par1IInventory) + { + //this.merchantInventory.resetRecipeAndSlots(); + super.onCraftMatrixChanged(par1IInventory); + } + + public void setCurrentRecipeIndex(int par1) + { + //this.merchantInventory.setCurrentRecipeIndex(par1); + } + + @SideOnly(Side.CLIENT) + public void updateProgressBar(int par1, int par2) {} + + + /** + * Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that. + */ + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) + { + ItemStack itemstack = null; + Slot slot = (Slot)this.inventorySlots.get(par2); + + if (slot != null && slot.getHasStack()) + { + ItemStack itemstack1 = slot.getStack(); + itemstack = itemstack1.copy(); + + if (par2 != 0 && par2 != 1 && par2 != 2) + { + if (par2 >= 3 && par2 < 30) + { + if (!this.mergeItemStack(itemstack1, 30, 39, false)) + { + return null; + } + } + else if (par2 >= 30 && par2 < 39 && !this.mergeItemStack(itemstack1, 3, 30, false)) + { + return null; + } + } + else if (!this.mergeItemStack(itemstack1, 3, 39, false)) + { + return null; + } + + if (itemstack1.stackSize == 0) + { + slot.putStack((ItemStack)null); + } + else + { + slot.onSlotChanged(); + } + + if (itemstack1.stackSize == itemstack.stackSize) + { + return null; + } + + slot.onPickupFromSlot(par1EntityPlayer, itemstack1); + } + + return itemstack; + } + + /** + * Called when the container is closed. + */ + public void onContainerClosed(EntityPlayer par1EntityPlayer) + { + super.onContainerClosed(par1EntityPlayer); + this.theMerchant.setCustomer((EntityPlayer)null); + super.onContainerClosed(par1EntityPlayer); + + if (!this.theWorld.isRemote) + { + ItemStack itemstack = this.merchantInventory.getStackInSlotOnClosing(0); + + if (itemstack != null) + { + par1EntityPlayer.dropPlayerItemWithRandomChoice(itemstack, false); + } + + itemstack = this.merchantInventory.getStackInSlotOnClosing(1); + + if (itemstack != null) + { + par1EntityPlayer.dropPlayerItemWithRandomChoice(itemstack, false); + } + } + } +} diff --git a/src/main/java/noppes/npcs/containers/ContainerNPCBankInterface.java b/src/main/java/noppes/npcs/containers/ContainerNPCBankInterface.java new file mode 100644 index 000000000..72d582643 --- /dev/null +++ b/src/main/java/noppes/npcs/containers/ContainerNPCBankInterface.java @@ -0,0 +1,102 @@ +package noppes.npcs.containers; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import noppes.npcs.NpcMiscInventory; +import noppes.npcs.controllers.PlayerBankData; +import noppes.npcs.controllers.PlayerDataController; + +public class ContainerNPCBankInterface extends ContainerNpcInterface +{ + public InventoryNPC currencyMatrix; + private EntityPlayer player; + public SlotNpcBankCurrency currency; + public int slot = 0; + public int bankid; + private PlayerBankData data; + public ContainerNPCBankInterface(EntityPlayer player, int slot, int bankid) + { + super(player); + this.bankid = bankid; + this.slot = slot; + this.player = player; + + currencyMatrix = new InventoryNPC("currency", 1, this); + if(!isAvailable() || canBeUpgraded()){ + currency = new SlotNpcBankCurrency(this, currencyMatrix, 0, 80, 29); + addSlotToContainer(currency); + } + + NpcMiscInventory items = new NpcMiscInventory(54); + if(!player.worldObj.isRemote){ + data = PlayerDataController.instance.getBankData(player,bankid); + items = data.getBankOrDefault(bankid).itemSlots.get(slot); + } + + int xOffset = xOffset(); + for (int j = 0; j < getRowNumber(); j++) + { + for (int i1 = 0; i1 < 9; i1++) + { + int id = i1 + j * 9; + addSlotToContainer(new Slot(items, id, 8 + i1 * 18, 17 + xOffset + j * 18)); + } + } + + if(isUpgraded()) + xOffset += 54; + for (int k = 0; k < 3; k++) + { + for (int j1 = 0; j1 < 9; j1++) + { + addSlotToContainer(new Slot(player.inventory, j1 + k * 9 + 9, 8 + j1 * 18, 86 + xOffset + k * 18)); + } + } + + for (int l = 0; l < 9; l++) + { + addSlotToContainer(new Slot(player.inventory, l, 8 + l * 18, 144 + xOffset )); + } + } + public int getRowNumber() { + return 0; + } + public int xOffset(){ + return 0; + } + @Override + public void onCraftMatrixChanged(IInventory inv){ + + } + public boolean isAvailable(){ + return false; + } + public boolean isUpgraded(){ + return false; + } + public boolean canBeUpgraded(){ + return false; + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int i) + { + return null; + } + @Override + public void onContainerClosed(EntityPlayer entityplayer) + { + super.onContainerClosed(entityplayer); + if (!entityplayer.worldObj.isRemote){ + ItemStack var3 = this.currencyMatrix.getStackInSlot(0); + currencyMatrix.setInventorySlotContents(0, null); + if (var3 != null) + { + entityplayer.dropPlayerItemWithRandomChoice(var3, false); + } + } + } +} diff --git a/src/main/java/noppes/npcs/containers/ContainerNPCBankLarge.java b/src/main/java/noppes/npcs/containers/ContainerNPCBankLarge.java new file mode 100644 index 000000000..b3abfd21c --- /dev/null +++ b/src/main/java/noppes/npcs/containers/ContainerNPCBankLarge.java @@ -0,0 +1,22 @@ +package noppes.npcs.containers; + +import net.minecraft.entity.player.EntityPlayer; + +public class ContainerNPCBankLarge extends ContainerNPCBankInterface +{ + + public ContainerNPCBankLarge(EntityPlayer player, int slot, int bankid) + { + super(player,slot,bankid); + } + + public boolean isUpgraded(){ + return true; + } + public boolean isAvailable(){ + return true; + } + public int getRowNumber() { + return 6; + } +} diff --git a/src/main/java/noppes/npcs/containers/ContainerNPCBankSmall.java b/src/main/java/noppes/npcs/containers/ContainerNPCBankSmall.java new file mode 100644 index 000000000..9d4620fcc --- /dev/null +++ b/src/main/java/noppes/npcs/containers/ContainerNPCBankSmall.java @@ -0,0 +1,18 @@ +package noppes.npcs.containers; + +import net.minecraft.entity.player.EntityPlayer; + +public class ContainerNPCBankSmall extends ContainerNPCBankInterface +{ + + public ContainerNPCBankSmall(EntityPlayer player, int slot, int bankid) + { + super(player,slot,bankid); + } + public boolean isAvailable(){ + return true; + } + public int getRowNumber() { + return 3; + } +} diff --git a/src/main/java/noppes/npcs/containers/ContainerNPCBankUnlock.java b/src/main/java/noppes/npcs/containers/ContainerNPCBankUnlock.java new file mode 100644 index 000000000..ee7a09e90 --- /dev/null +++ b/src/main/java/noppes/npcs/containers/ContainerNPCBankUnlock.java @@ -0,0 +1,11 @@ +package noppes.npcs.containers; + +import net.minecraft.entity.player.EntityPlayer; + +public class ContainerNPCBankUnlock extends ContainerNPCBankInterface +{ + public ContainerNPCBankUnlock(EntityPlayer player, int slot, int bankid) + { + super(player,slot,bankid); + } +} diff --git a/src/main/java/noppes/npcs/containers/ContainerNPCBankUpgrade.java b/src/main/java/noppes/npcs/containers/ContainerNPCBankUpgrade.java new file mode 100644 index 000000000..ae46c9d89 --- /dev/null +++ b/src/main/java/noppes/npcs/containers/ContainerNPCBankUpgrade.java @@ -0,0 +1,23 @@ +package noppes.npcs.containers; + +import net.minecraft.entity.player.EntityPlayer; + +public class ContainerNPCBankUpgrade extends ContainerNPCBankInterface +{ + public ContainerNPCBankUpgrade(EntityPlayer player, int slot, int bankid) + { + super(player,slot,bankid); + } + public boolean isAvailable(){ + return true; + } + public boolean canBeUpgraded(){ + return true; + } + public int xOffset(){ + return 54; + } + public int getRowNumber() { + return 3; + } +} diff --git a/src/main/java/noppes/npcs/containers/ContainerNPCCompanion.java b/src/main/java/noppes/npcs/containers/ContainerNPCCompanion.java new file mode 100644 index 000000000..e46f2eb2d --- /dev/null +++ b/src/main/java/noppes/npcs/containers/ContainerNPCCompanion.java @@ -0,0 +1,55 @@ +package noppes.npcs.containers; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import noppes.npcs.constants.EnumCompanionTalent; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.RoleCompanion; +import noppes.npcs.roles.RoleFollower; + +public class ContainerNPCCompanion extends ContainerNpcInterface{ + public InventoryNPC currencyMatrix; + public RoleCompanion role; + + public ContainerNPCCompanion(EntityNPCInterface npc,EntityPlayer player){ + super(player); + role = (RoleCompanion) npc.roleInterface; + for (int k = 0; k < 3; k++){ + for (int j1 = 0; j1 < 9; j1++){ + addSlotToContainer(new Slot(player.inventory, j1 + k * 9 + 9, 6 + j1 * 18, 87 + k * 18)); + } + } + + for (int l = 0; l < 9; l++){ + addSlotToContainer(new Slot(player.inventory, l, 6 + l * 18, 145)); + } + + if(role.talents.containsKey(EnumCompanionTalent.INVENTORY)){ + int size = (role.getTalentLevel(EnumCompanionTalent.INVENTORY) + 1) * 2; + for(int i = 0; i < size; i++){ + addSlotToContainer(new Slot(role.inventory, i, 114 + i % 3 * 18, 8 + i / 3 * 18)); + } + } + if(role.getTalentLevel(EnumCompanionTalent.ARMOR) > 0){ + for(int l = 0; l < 4; l++){ + addSlotToContainer(new SlotCompanionArmor(role, npc.inventory, l, 6, 8 + l * 18,l)); + } + } + if(role.getTalentLevel(EnumCompanionTalent.SWORD) > 0){ + addSlotToContainer(new SlotCompanionWeapon(role, npc.inventory, 4, 79, 17)); + } + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int i){ + return null; + } + + @Override + public void onContainerClosed(EntityPlayer entityplayer){ + super.onContainerClosed(entityplayer); + role.setStats(); + } +} diff --git a/src/main/java/noppes/npcs/containers/ContainerNPCFollower.java b/src/main/java/noppes/npcs/containers/ContainerNPCFollower.java new file mode 100644 index 000000000..2aec6ce31 --- /dev/null +++ b/src/main/java/noppes/npcs/containers/ContainerNPCFollower.java @@ -0,0 +1,47 @@ +package noppes.npcs.containers; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.RoleFollower; + +public class ContainerNPCFollower extends ContainerNpcInterface +{ + public InventoryNPC currencyMatrix; + public RoleFollower role; + + public ContainerNPCFollower(EntityNPCInterface npc,EntityPlayer player) + { + super(player); + role = (RoleFollower) npc.roleInterface; + + currencyMatrix = new InventoryNPC("currency", 1,this); + addSlotToContainer(new SlotNpcMercenaryCurrency(role,currencyMatrix, 0, 26, 9)); + + for(int j1 = 0; j1 < 9; j1++) + { + addSlotToContainer(new Slot(player.inventory, j1, 8 + j1 * 18, 142)); + } + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int i) + { + return null; + } + @Override + public void onContainerClosed(EntityPlayer entityplayer) + { + super.onContainerClosed(entityplayer); + if (!entityplayer.worldObj.isRemote){ + ItemStack itemstack = currencyMatrix.getStackInSlotOnClosing(0); + if(itemstack != null && !entityplayer.worldObj.isRemote) + { + entityplayer.entityDropItem(itemstack,0f); + } + } + + } +} diff --git a/src/main/java/noppes/npcs/containers/ContainerNPCFollowerHire.java b/src/main/java/noppes/npcs/containers/ContainerNPCFollowerHire.java new file mode 100644 index 000000000..e185357b7 --- /dev/null +++ b/src/main/java/noppes/npcs/containers/ContainerNPCFollowerHire.java @@ -0,0 +1,66 @@ +// 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 fieldsfirst + +package noppes.npcs.containers; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.InventoryBasic; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.RoleFollower; + +// Referenced classes of package net.minecraft.src: +// Container, InventoryCrafting, InventoryCraftResult, SlotCrafting, +// InventoryPlayer, Slot, CraftingManager, IInventory, +// World, EntityPlayer, Block, ItemStack + +public class ContainerNPCFollowerHire extends ContainerNpcInterface +{ + public InventoryBasic currencyMatrix; + public RoleFollower role; + + public ContainerNPCFollowerHire(EntityNPCInterface npc,EntityPlayer player) + { + super(player); + role = (RoleFollower) npc.roleInterface; + + currencyMatrix = new InventoryBasic("currency", false, 1); + addSlotToContainer(new SlotNpcMercenaryCurrency(role,currencyMatrix, 0, 44, 35)); + + for(int i1 = 0; i1 < 3; i1++) + { + for(int l1 = 0; l1 < 9; l1++) + { + addSlotToContainer(new Slot(player.inventory, l1 + i1 * 9 + 9, 8 + l1 * 18, 84 + i1 * 18)); + } + + } + + for(int j1 = 0; j1 < 9; j1++) + { + addSlotToContainer(new Slot(player.inventory, j1, 8 + j1 * 18, 142)); + } + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int i) + { + return null; + } + @Override + public void onContainerClosed(EntityPlayer entityplayer) + { + super.onContainerClosed(entityplayer); + + if (!entityplayer.worldObj.isRemote){ + ItemStack itemstack = currencyMatrix.getStackInSlotOnClosing(0); + if(itemstack != null && !entityplayer.worldObj.isRemote) + { + entityplayer.entityDropItem(itemstack,0f); + } + } + } +} diff --git a/src/main/java/noppes/npcs/containers/ContainerNPCFollowerSetup.java b/src/main/java/noppes/npcs/containers/ContainerNPCFollowerSetup.java new file mode 100644 index 000000000..3633bd8b1 --- /dev/null +++ b/src/main/java/noppes/npcs/containers/ContainerNPCFollowerSetup.java @@ -0,0 +1,91 @@ +package noppes.npcs.containers; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.RoleFollower; + +public class ContainerNPCFollowerSetup extends Container +{ + private RoleFollower role; + + public ContainerNPCFollowerSetup(EntityNPCInterface npc,EntityPlayer player) + { + role = (RoleFollower) npc.roleInterface; + + for(int i1 = 0; i1 < 3; i1++) + addSlotToContainer(new Slot(role.inventory, i1, 44, 39 + i1 * 25)); + + for(int i1 = 0; i1 < 3; i1++) + { + for(int l1 = 0; l1 < 9; l1++) + { + addSlotToContainer(new Slot(player.inventory, l1 + i1 * 9 + 9, 8 + l1 * 18, 113 + i1 * 18)); + } + + } + + for(int j1 = 0; j1 < 9; j1++) + { + addSlotToContainer(new Slot(player.inventory, j1, 8 + j1 * 18, 171)); + } + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int i) + { + ItemStack itemstack = null; + Slot slot = (Slot)inventorySlots.get(i); + if(slot != null && slot.getHasStack()) + { + ItemStack itemstack1 = slot.getStack(); + itemstack = itemstack1.copy(); + if(i >= 0 && i < 3) + { + if(!mergeItemStack(itemstack1, 3, 38, true)) + { + return null; + } + } else + if(i >= 3 && i < 30) + { + if(!mergeItemStack(itemstack1, 30, 38, false)) + { + return null; + } + } else + if(i >= 30 && i < 38) + { + if(!mergeItemStack(itemstack1, 3, 29, false)) + { + return null; + } + } else + if(!mergeItemStack(itemstack1, 3, 38, false)) + { + return null; + } + if(itemstack1.stackSize == 0) + { + slot.putStack(null); + } else + { + slot.onSlotChanged(); + } + if(itemstack1.stackSize != itemstack.stackSize) + { + slot.onPickupFromSlot(par1EntityPlayer, itemstack1); + } else + { + return null; + } + } + return itemstack; + } + @Override + public boolean canInteractWith(EntityPlayer entityplayer) { + return true; + } +} diff --git a/src/main/java/noppes/npcs/containers/ContainerNPCInv.java b/src/main/java/noppes/npcs/containers/ContainerNPCInv.java new file mode 100644 index 000000000..8b51da54e --- /dev/null +++ b/src/main/java/noppes/npcs/containers/ContainerNPCInv.java @@ -0,0 +1,44 @@ +package noppes.npcs.containers; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import noppes.npcs.entity.EntityNPCInterface; + +public class ContainerNPCInv extends Container{ + public ContainerNPCInv(EntityNPCInterface npc,EntityPlayer player){ + for(int l = 0; l < 4; l++){ + addSlotToContainer(new SlotNPCArmor(npc.inventory, l, 9, 22 + l * 18,l)); + } + + addSlotToContainer(new Slot(npc.inventory, 4, 81, 22)); + addSlotToContainer(new Slot(npc.inventory, 5, 81, 40)); + addSlotToContainer(new Slot(npc.inventory, 6, 81, 58)); + + for(int l = 0; l < 9; l++){ + addSlotToContainer(new Slot(npc.inventory, l + 7 , 191 , 16 + l * 21)); + } + + for(int i1 = 0; i1 < 3; i1++){ + for(int l1 = 0; l1 < 9; l1++){ + addSlotToContainer(new Slot(player.inventory, l1 + i1 * 9 + 9, l1 * 18 + 8, 113 + i1 * 18)); + } + + } + + for(int j1 = 0; j1 < 9; j1++){ + addSlotToContainer(new Slot(player.inventory, j1, j1 * 18 + 8, 171)); + } + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int i){ + return null; + } + + @Override + public boolean canInteractWith(EntityPlayer entityplayer) { + return true; + } +} diff --git a/src/main/java/noppes/npcs/containers/ContainerNPCTrader.java b/src/main/java/noppes/npcs/containers/ContainerNPCTrader.java new file mode 100644 index 000000000..77a3b8a43 --- /dev/null +++ b/src/main/java/noppes/npcs/containers/ContainerNPCTrader.java @@ -0,0 +1,121 @@ +package noppes.npcs.containers; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import noppes.npcs.NoppesUtilPlayer; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.RoleTrader; + + +public class ContainerNPCTrader extends ContainerNpcInterface{ + public RoleTrader role; + + public ContainerNPCTrader(EntityNPCInterface npc,EntityPlayer player){ + super(player); + role = (RoleTrader) npc.roleInterface; + + for(int i = 0; i < 18; i++){ + int x = 53; + x += i%3 * 72; + int y = 7; + y += i/3 * 21; + + ItemStack item = role.inventoryCurrency.items.get(i); + ItemStack item2 = role.inventoryCurrency.items.get(i + 18); + if(item == null){ + item = item2; + item2 = null; + } + addSlotToContainer(new Slot(role.inventorySold, i, x, y)); + } + + for(int i1 = 0; i1 < 3; i1++){ + for(int l1 = 0; l1 < 9; l1++){ + addSlotToContainer(new Slot(player.inventory, l1 + i1 * 9 + 9, 32 + l1 * 18, 140 + i1 * 18)); + } + + } + + for(int j1 = 0; j1 < 9; j1++){ + addSlotToContainer(new Slot(player.inventory, j1, 32 + j1 * 18, 198)); + } + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int i){ + return null; + } + @Override + public ItemStack slotClick(int i, int j, int par3, EntityPlayer entityplayer){ + if(par3 == 6) + par3 = 0; + if(i < 0 || i >= 18) + return super.slotClick(i, j, par3, entityplayer); + if( j ==1 ) + return null; + Slot slot = (Slot)inventorySlots.get(i); + if(slot == null || slot.getStack() == null) + return null; + ItemStack item = slot.getStack(); + if(!canGivePlayer(item, entityplayer)) + return null; + if(!canBuy(i, entityplayer)) + return null; + NoppesUtilPlayer.consumeItem(entityplayer, role.inventoryCurrency.getStackInSlot(i), role.ignoreDamage, role.ignoreNBT); + NoppesUtilPlayer.consumeItem(entityplayer, role.inventoryCurrency.getStackInSlot(i + 18), role.ignoreDamage, role.ignoreNBT); + ItemStack soldItem = item.copy(); + givePlayer(soldItem, entityplayer); + return soldItem; + + } + public boolean canBuy(int slot, EntityPlayer player) { + ItemStack currency = role.inventoryCurrency.getStackInSlot(slot); + ItemStack currency2 = role.inventoryCurrency.getStackInSlot(slot + 18); + if(currency == null && currency2 == null) + return true; + + if(currency == null){ + currency = currency2; + currency2 = null; + } + if(NoppesUtilPlayer.compareItems(currency, currency2, role.ignoreDamage, role.ignoreNBT)){ + currency = currency.copy(); + currency.stackSize += currency2.stackSize; + currency2 = null; + } + if(currency2 == null ) + return NoppesUtilPlayer.compareItems(player, currency, role.ignoreDamage, role.ignoreNBT); + return NoppesUtilPlayer.compareItems(player, currency, role.ignoreDamage, role.ignoreNBT) && NoppesUtilPlayer.compareItems(player, currency2, role.ignoreDamage, role.ignoreNBT); + + } + + private boolean canGivePlayer(ItemStack item,EntityPlayer entityplayer){//check Item being held with the mouse + ItemStack itemstack3 = entityplayer.inventory.getItemStack(); + if(itemstack3 == null){ + return true; + } + else if(NoppesUtilPlayer.compareItems(itemstack3, item, false, false)){ + int k1 = item.stackSize; + if(k1 > 0 && k1 + itemstack3.stackSize <= itemstack3.getMaxStackSize()) + { + return true; + } + } + return false; + } + private void givePlayer(ItemStack item,EntityPlayer entityplayer){//set item bought to the held mouse item + ItemStack itemstack3 = entityplayer.inventory.getItemStack(); + if(itemstack3 == null){ + entityplayer.inventory.setItemStack(item); + } + else if(NoppesUtilPlayer.compareItems(itemstack3, item, false, false)){ + + int k1 = item.stackSize; + if(k1 > 0 && k1 + itemstack3.stackSize <= itemstack3.getMaxStackSize()) + { + itemstack3.stackSize += k1; + } + } + } +} diff --git a/src/main/java/noppes/npcs/containers/ContainerNPCTraderSetup.java b/src/main/java/noppes/npcs/containers/ContainerNPCTraderSetup.java new file mode 100644 index 000000000..68e68131e --- /dev/null +++ b/src/main/java/noppes/npcs/containers/ContainerNPCTraderSetup.java @@ -0,0 +1,51 @@ +package noppes.npcs.containers; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.RoleTrader; + +public class ContainerNPCTraderSetup extends Container +{ + public RoleTrader role; + + public ContainerNPCTraderSetup(EntityNPCInterface npc,EntityPlayer player) + { + role = (RoleTrader) npc.roleInterface; + + for(int i = 0; i < 18; i++) + { + int x = 7; + x += i%3 * 94; + int y = 15; + y += i/3 * 22; + addSlotToContainer(new Slot(role.inventoryCurrency, i + 18, x, y)); + addSlotToContainer(new Slot(role.inventoryCurrency, i, x + 18, y)); + addSlotToContainer(new Slot(role.inventorySold, i, x + 43, y)); + + } + + for(int i1 = 0; i1 < 3; i1++){ + for(int l1 = 0; l1 < 9; l1++){ + addSlotToContainer(new Slot(player.inventory, l1 + i1 * 9 + 9, 48 + l1 * 18, 147 + i1 * 18)); + } + + } + + for(int j1 = 0; j1 < 9; j1++){ + addSlotToContainer(new Slot(player.inventory, j1, 48 + j1 * 18, 205)); + } + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int i) + { + return null; + } + @Override + public boolean canInteractWith(EntityPlayer entityplayer) { + return true; + } +} diff --git a/src/main/java/noppes/npcs/containers/ContainerNpcInterface.java b/src/main/java/noppes/npcs/containers/ContainerNpcInterface.java new file mode 100644 index 000000000..5577cd847 --- /dev/null +++ b/src/main/java/noppes/npcs/containers/ContainerNpcInterface.java @@ -0,0 +1,21 @@ +package noppes.npcs.containers; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.util.MathHelper; + +public class ContainerNpcInterface extends Container{ + private int posX, posZ; + + public ContainerNpcInterface(EntityPlayer player){ + posX = MathHelper.floor_double(player.posX); + posZ = MathHelper.floor_double(player.posZ); + player.motionX = 0; + player.motionZ = 0; + } + @Override + public boolean canInteractWith(EntityPlayer player) { + return !player.isDead && posX == MathHelper.floor_double(player.posX) && posZ == MathHelper.floor_double(player.posZ); + } + +} diff --git a/src/main/java/noppes/npcs/containers/ContainerNpcItemGiver.java b/src/main/java/noppes/npcs/containers/ContainerNpcItemGiver.java new file mode 100644 index 000000000..d68420403 --- /dev/null +++ b/src/main/java/noppes/npcs/containers/ContainerNpcItemGiver.java @@ -0,0 +1,46 @@ +package noppes.npcs.containers; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.JobItemGiver; + +public class ContainerNpcItemGiver extends Container +{ + private JobItemGiver role; + + public ContainerNpcItemGiver(EntityNPCInterface npc,EntityPlayer player) + { + this.role = (JobItemGiver) npc.jobInterface; + for(int j1 = 0; j1 < 9; j1++) + { + addSlotToContainer(new Slot(role.inventory, j1, 6 + j1 * 18, 90)); + } + + for(int i1 = 0; i1 < 3; i1++) + { + for(int l1 = 0; l1 < 9; l1++) + { + addSlotToContainer(new Slot(player.inventory, l1 + i1 * 9 + 9, 6 + l1 * 18, 116 + i1 * 18)); + } + + } + + for(int j1 = 0; j1 < 9; j1++) + { + addSlotToContainer(new Slot(player.inventory, j1, 6 + j1 * 18, 174)); + } + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int i) + { + return null; + } + @Override + public boolean canInteractWith(EntityPlayer entityplayer) { + return true; + } +} diff --git a/src/main/java/noppes/npcs/containers/ContainerNpcQuestReward.java b/src/main/java/noppes/npcs/containers/ContainerNpcQuestReward.java new file mode 100644 index 000000000..ce8103eb6 --- /dev/null +++ b/src/main/java/noppes/npcs/containers/ContainerNpcQuestReward.java @@ -0,0 +1,41 @@ +package noppes.npcs.containers; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import noppes.npcs.NoppesUtilServer; +import noppes.npcs.client.gui.global.GuiNPCManageQuest; +import noppes.npcs.controllers.Quest; + +public class ContainerNpcQuestReward extends Container{ + public ContainerNpcQuestReward(EntityPlayer player){ + Quest quest = NoppesUtilServer.getEditingQuest(player); + if(player.worldObj.isRemote) + quest = GuiNPCManageQuest.quest; + for(int l = 0; l < 3; l++){ + for(int k1 = 0; k1 < 3; k1++){ + addSlotToContainer(new Slot(quest.rewardItems, k1 + l * 3, 105 + k1 * 18, 17 + l * 18)); + } + } + + for(int i1 = 0; i1 < 3; i1++){ + for(int l1 = 0; l1 < 9; l1++){ + addSlotToContainer(new Slot(player.inventory, l1 + i1 * 9 + 9, 8 + l1 * 18, 84 + i1 * 18)); + } + } + + for(int j1 = 0; j1 < 9; j1++){ + addSlotToContainer(new Slot(player.inventory, j1, 8 + j1 * 18, 142)); + } + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int i){ + return null; + } + @Override + public boolean canInteractWith(EntityPlayer entityplayer) { + return true; + } +} diff --git a/src/main/java/noppes/npcs/containers/ContainerNpcQuestTypeItem.java b/src/main/java/noppes/npcs/containers/ContainerNpcQuestTypeItem.java new file mode 100644 index 000000000..274dc6c53 --- /dev/null +++ b/src/main/java/noppes/npcs/containers/ContainerNpcQuestTypeItem.java @@ -0,0 +1,47 @@ +package noppes.npcs.containers; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import noppes.npcs.NoppesUtilServer; +import noppes.npcs.client.gui.global.GuiNPCManageQuest; +import noppes.npcs.controllers.Quest; +import noppes.npcs.quests.QuestItem; + +public class ContainerNpcQuestTypeItem extends Container +{ + + public ContainerNpcQuestTypeItem(EntityPlayer player) + { + Quest quest = NoppesUtilServer.getEditingQuest(player); + if(player.worldObj.isRemote) + quest = GuiNPCManageQuest.quest; + for(int i1 = 0; i1 < 3; i1++) + addSlotToContainer(new Slot(((QuestItem)quest.questInterface).items, i1, 44, 39 + i1 * 25)); + + for(int i1 = 0; i1 < 3; i1++) + { + for(int l1 = 0; l1 < 9; l1++) + { + addSlotToContainer(new Slot(player.inventory, l1 + i1 * 9 + 9, 8 + l1 * 18, 113 + i1 * 18)); + } + + } + + for(int j1 = 0; j1 < 9; j1++) + { + addSlotToContainer(new Slot(player.inventory, j1, 8 + j1 * 18, 171)); + } + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int i) + { + return null; + } + @Override + public boolean canInteractWith(EntityPlayer entityplayer) { + return true; + } +} diff --git a/src/main/java/noppes/npcs/containers/InventoryNPC.java b/src/main/java/noppes/npcs/containers/InventoryNPC.java new file mode 100644 index 000000000..4812bfed2 --- /dev/null +++ b/src/main/java/noppes/npcs/containers/InventoryNPC.java @@ -0,0 +1,115 @@ +package noppes.npcs.containers; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; + +public class InventoryNPC + implements IInventory +{ + + private String inventoryTitle; + private int slotsCount; + private ItemStack inventoryContents[]; + private Container con; + + public InventoryNPC(String s, int i,Container con) + { + this.con = con; + inventoryTitle = s; + slotsCount = i; + inventoryContents = new ItemStack[i]; + } + @Override + public ItemStack getStackInSlot(int i) + { + return inventoryContents[i]; + } + + @Override + public ItemStack decrStackSize(int i, int j) + { + if(inventoryContents[i] != null) + { + if(inventoryContents[i].stackSize <= j) + { + ItemStack itemstack = inventoryContents[i]; + inventoryContents[i] = null; + //onInventoryChanged(); + return itemstack; + } + ItemStack itemstack1 = inventoryContents[i].splitStack(j); + if(inventoryContents[i].stackSize == 0) + { + inventoryContents[i] = null; + } + //onInventoryChanged(); + return itemstack1; + } else + { + return null; + } + } + + @Override + public void setInventorySlotContents(int i, ItemStack itemstack) + { + inventoryContents[i] = itemstack; + if(itemstack != null && itemstack.stackSize > getInventoryStackLimit()) + { + itemstack.stackSize = getInventoryStackLimit(); + } + //onInventoryChanged(); + } + + @Override + public int getSizeInventory() + { + return slotsCount; + } + + @Override + public int getInventoryStackLimit() + { + return 64; + } + + @Override + public boolean isUseableByPlayer(EntityPlayer entityplayer) + { + return false; + } + + + @Override + public ItemStack getStackInSlotOnClosing(int i) { + return null; + } + + @Override + public boolean isItemValidForSlot(int i, ItemStack itemstack) { + return true; + } + + @Override + public String getInventoryName() { + return inventoryTitle; + } + @Override + public boolean hasCustomInventoryName() { + return true; + } + @Override + public void markDirty() { + con.onCraftMatrixChanged(this); + } + @Override + public void openInventory() { + + } + @Override + public void closeInventory() { + + } +} diff --git a/src/main/java/noppes/npcs/containers/InventoryNpcTrader.java b/src/main/java/noppes/npcs/containers/InventoryNpcTrader.java new file mode 100644 index 000000000..ddcc68d01 --- /dev/null +++ b/src/main/java/noppes/npcs/containers/InventoryNpcTrader.java @@ -0,0 +1,105 @@ +package noppes.npcs.containers; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; + +public class InventoryNpcTrader + implements IInventory +{ + + private String inventoryTitle; + private int slotsCount; + private ItemStack inventoryContents[]; + private ContainerNPCTrader con; + + public InventoryNpcTrader(String s, int i,ContainerNPCTrader con) + { + this.con = con; + inventoryTitle = s; + slotsCount = i; + inventoryContents = new ItemStack[i]; + } + + public ItemStack getStackInSlot(int i) + { + ItemStack toBuy = inventoryContents[i]; + if(toBuy == null) + return null; + + return ItemStack.copyItemStack(toBuy); + } + + public ItemStack decrStackSize(int i, int j) + { + if(inventoryContents[i] != null) + { + ItemStack itemstack = inventoryContents[i]; + return ItemStack.copyItemStack(itemstack); + } else + { + return null; + } + } + + public void setInventorySlotContents(int i, ItemStack itemstack) + { + if(itemstack != null) + inventoryContents[i] = itemstack.copy(); + markDirty(); + + } + + public int getSizeInventory() + { + return slotsCount; + } + + + public int getInventoryStackLimit() + { + return 64; + } + + + public boolean isUseableByPlayer(EntityPlayer entityplayer) + { + return true; + } + + + @Override + public ItemStack getStackInSlotOnClosing(int i) { + return null; + } + + + @Override + public boolean isItemValidForSlot(int i, ItemStack itemstack) { + return true; + } + + + @Override + public String getInventoryName() { + return inventoryTitle; + } + + @Override + public boolean hasCustomInventoryName() { + return true; + } + + @Override + public void markDirty() { + con.onCraftMatrixChanged(this); + } + + @Override + public void openInventory() { + } + + @Override + public void closeInventory() { + } +} diff --git a/src/main/java/noppes/npcs/containers/SlotCompanionArmor.java b/src/main/java/noppes/npcs/containers/SlotCompanionArmor.java new file mode 100644 index 000000000..021d95906 --- /dev/null +++ b/src/main/java/noppes/npcs/containers/SlotCompanionArmor.java @@ -0,0 +1,42 @@ +package noppes.npcs.containers; + +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import noppes.npcs.roles.RoleCompanion; + +class SlotCompanionArmor extends Slot{ + + final int armorType; + final RoleCompanion role; + + public SlotCompanionArmor(RoleCompanion role, IInventory iinventory, int id, int x, int y, int type){ + super(iinventory, id, x, y); + armorType = type; + this.role = role; + } + + @Override + public int getSlotStackLimit() { + return 1; + } + + @Override + public IIcon getBackgroundIconIndex() { + return ItemArmor.func_94602_b(this.armorType); + } + + @Override + public boolean isItemValid(ItemStack itemstack) { + if (itemstack.getItem() instanceof ItemArmor && role.canWearArmor(itemstack)) + return ((ItemArmor) itemstack.getItem()).armorType == armorType; + + if (itemstack.getItem() instanceof ItemBlock) + return armorType == 0; + + return false; + } +} diff --git a/src/main/java/noppes/npcs/containers/SlotCompanionWeapon.java b/src/main/java/noppes/npcs/containers/SlotCompanionWeapon.java new file mode 100644 index 000000000..d6965a4ca --- /dev/null +++ b/src/main/java/noppes/npcs/containers/SlotCompanionWeapon.java @@ -0,0 +1,30 @@ +package noppes.npcs.containers; + +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemSword; +import net.minecraft.util.IIcon; +import noppes.npcs.roles.RoleCompanion; + +class SlotCompanionWeapon extends Slot{ + + final RoleCompanion role; + + public SlotCompanionWeapon(RoleCompanion role, IInventory iinventory, int id, int x, int y){ + super(iinventory, id, x, y); + this.role = role; + } + + @Override + public int getSlotStackLimit() { + return 1; + } + + @Override + public boolean isItemValid(ItemStack itemstack) { + return role.canWearSword(itemstack); + } +} diff --git a/src/main/java/noppes/npcs/containers/SlotNPCArmor.java b/src/main/java/noppes/npcs/containers/SlotNPCArmor.java new file mode 100644 index 000000000..290304cfe --- /dev/null +++ b/src/main/java/noppes/npcs/containers/SlotNPCArmor.java @@ -0,0 +1,48 @@ +package noppes.npcs.containers; + +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; + +class SlotNPCArmor extends Slot +{ + + final int armorType; /* synthetic field */ + + SlotNPCArmor(IInventory iinventory, int i, int j, int k, int l) + { + super(iinventory, i, j, k); + armorType = l; + } + + @Override + public int getSlotStackLimit() + { + return 1; + } + + @Override + public IIcon getBackgroundIconIndex() + { + return ItemArmor.func_94602_b(this.armorType); + } + + @Override + public boolean isItemValid(ItemStack itemstack) + { + if(itemstack.getItem() instanceof ItemArmor) + { + return ((ItemArmor)itemstack.getItem()).armorType == armorType; + } + if(itemstack.getItem() instanceof ItemBlock) + { + return armorType == 0; + } else + { + return false; + } + } +} diff --git a/src/main/java/noppes/npcs/containers/SlotNpcBankCurrency.java b/src/main/java/noppes/npcs/containers/SlotNpcBankCurrency.java new file mode 100644 index 000000000..0443a9910 --- /dev/null +++ b/src/main/java/noppes/npcs/containers/SlotNpcBankCurrency.java @@ -0,0 +1,34 @@ +package noppes.npcs.containers; + +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class SlotNpcBankCurrency extends Slot +{ + + public ItemStack item; + + public SlotNpcBankCurrency(ContainerNPCBankInterface containerplayer, IInventory iinventory, int i, int j, int k) + { + super(iinventory, i, j, k); + } + + @Override + public int getSlotStackLimit() + { + return 64; + } + + @Override + public boolean isItemValid(ItemStack itemstack) + { + if(item == null) + return false; + if(item.getItem() == itemstack.getItem()){ + if(!item.getHasSubtypes() || item.getItemDamage() == itemstack.getItemDamage()) + return true; + } + return false; + } +} diff --git a/src/main/java/noppes/npcs/containers/SlotNpcMercenaryCurrency.java b/src/main/java/noppes/npcs/containers/SlotNpcMercenaryCurrency.java new file mode 100644 index 000000000..57d779cad --- /dev/null +++ b/src/main/java/noppes/npcs/containers/SlotNpcMercenaryCurrency.java @@ -0,0 +1,40 @@ +package noppes.npcs.containers; + +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import noppes.npcs.roles.RoleFollower; + +class SlotNpcMercenaryCurrency extends Slot +{ + + RoleFollower role; /* synthetic field */ + + public SlotNpcMercenaryCurrency(RoleFollower role, IInventory inv, int i, int j, int k) + { + super(inv, i, j, k); + this.role = role; + } + + @Override + public int getSlotStackLimit() + { + return 64; + } + + @Override + public boolean isItemValid(ItemStack itemstack) + { + Item item = itemstack.getItem(); + for(ItemStack is : role.inventory.items.values()){ + if(item == is.getItem()){ + if(itemstack.getHasSubtypes() && itemstack.getItemDamage() != is.getItemDamage()) + continue; + return true; + } + } + return false; + + } +} diff --git a/src/main/java/noppes/npcs/containers/SlotNpcTraderItems.java b/src/main/java/noppes/npcs/containers/SlotNpcTraderItems.java new file mode 100644 index 000000000..e7142972a --- /dev/null +++ b/src/main/java/noppes/npcs/containers/SlotNpcTraderItems.java @@ -0,0 +1,37 @@ +package noppes.npcs.containers; + +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +class SlotNpcTraderItems extends Slot +{ + + + public SlotNpcTraderItems( IInventory iinventory, int i, int j, int k) + { + super(iinventory, i, j, k); + } + public void onPickupFromSlot(ItemStack itemstack) + { + if(itemstack == null) + return; + if(getStack() == null) + return; + if(itemstack.getItem() != getStack().getItem()) + return; + itemstack.stackSize--; + //onSlotChanged(); + } + + public int getSlotStackLimit() + { + return 64; + } + + public boolean isItemValid(ItemStack itemstack) + { + return false; + + } +} diff --git a/src/main/java/noppes/npcs/containers/SlotValid.java b/src/main/java/noppes/npcs/containers/SlotValid.java new file mode 100644 index 000000000..4099a56ef --- /dev/null +++ b/src/main/java/noppes/npcs/containers/SlotValid.java @@ -0,0 +1,22 @@ +package noppes.npcs.containers; + +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class SlotValid extends Slot{ + private boolean canPutIn = true; + + public SlotValid(IInventory par1iInventory, int par2, int par3, int par4) { + super(par1iInventory, par2, par3, par4); + } + + public SlotValid(IInventory par1iInventory, int par2, int par3, int par4, boolean bo) { + super(par1iInventory, par2, par3, par4); + canPutIn = bo; + } + + public boolean isItemValid(ItemStack par1ItemStack){ + return canPutIn && inventory.isItemValidForSlot(0, par1ItemStack); + } +} diff --git a/src/main/java/noppes/npcs/controllers/Availability.java b/src/main/java/noppes/npcs/controllers/Availability.java new file mode 100644 index 000000000..518ccd995 --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/Availability.java @@ -0,0 +1,236 @@ +package noppes.npcs.controllers; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.ICompatibilty; +import noppes.npcs.VersionCompatibility; +import noppes.npcs.constants.EnumAvailabilityDialog; +import noppes.npcs.constants.EnumAvailabilityFaction; +import noppes.npcs.constants.EnumAvailabilityFactionType; +import noppes.npcs.constants.EnumAvailabilityQuest; +import noppes.npcs.constants.EnumDayTime; + +public class Availability implements ICompatibilty { + public int version = VersionCompatibility.ModRev; + + public EnumAvailabilityDialog dialogAvailable = EnumAvailabilityDialog.Always; + public EnumAvailabilityDialog dialog2Available = EnumAvailabilityDialog.Always; + public EnumAvailabilityDialog dialog3Available = EnumAvailabilityDialog.Always; + public EnumAvailabilityDialog dialog4Available = EnumAvailabilityDialog.Always; + public int dialogId = -1; + public int dialog2Id = -1; + public int dialog3Id = -1; + public int dialog4Id = -1; + + public EnumAvailabilityQuest questAvailable = EnumAvailabilityQuest.Always; + public EnumAvailabilityQuest quest2Available = EnumAvailabilityQuest.Always; + public EnumAvailabilityQuest quest3Available = EnumAvailabilityQuest.Always; + public EnumAvailabilityQuest quest4Available = EnumAvailabilityQuest.Always; + public int questId = -1; + public int quest2Id = -1; + public int quest3Id = -1; + public int quest4Id = -1; + + public EnumDayTime daytime = EnumDayTime.Always; + + public int factionId = -1; + public int faction2Id = -1; + + public EnumAvailabilityFactionType factionAvailable = EnumAvailabilityFactionType.Always; + public EnumAvailabilityFactionType faction2Available = EnumAvailabilityFactionType.Always; + + public EnumAvailabilityFaction factionStance = EnumAvailabilityFaction.Friendly; + public EnumAvailabilityFaction faction2Stance = EnumAvailabilityFaction.Friendly; + + public int minPlayerLevel = 0; + + + public void readFromNBT(NBTTagCompound compound) + { + version = compound.getInteger("ModRev"); + VersionCompatibility.CheckAvailabilityCompatibility(this, compound); + + dialogAvailable = EnumAvailabilityDialog.values()[compound.getInteger("AvailabilityDialog")]; + dialog2Available = EnumAvailabilityDialog.values()[compound.getInteger("AvailabilityDialog2")]; + dialog3Available = EnumAvailabilityDialog.values()[compound.getInteger("AvailabilityDialog3")]; + dialog4Available = EnumAvailabilityDialog.values()[compound.getInteger("AvailabilityDialog4")]; + + dialogId = compound.getInteger("AvailabilityDialogId"); + dialog2Id = compound.getInteger("AvailabilityDialog2Id"); + dialog3Id = compound.getInteger("AvailabilityDialog3Id"); + dialog4Id = compound.getInteger("AvailabilityDialog4Id"); + + questAvailable = EnumAvailabilityQuest.values()[compound.getInteger("AvailabilityQuest")]; + quest2Available = EnumAvailabilityQuest.values()[compound.getInteger("AvailabilityQuest2")]; + quest3Available = EnumAvailabilityQuest.values()[compound.getInteger("AvailabilityQuest3")]; + quest4Available = EnumAvailabilityQuest.values()[compound.getInteger("AvailabilityQuest4")]; + + questId = compound.getInteger("AvailabilityQuestId"); + quest2Id = compound.getInteger("AvailabilityQuest2Id"); + quest3Id = compound.getInteger("AvailabilityQuest3Id"); + quest4Id = compound.getInteger("AvailabilityQuest4Id"); + + setFactionAvailability(compound.getInteger("AvailabilityFaction")); + setFactionAvailabilityStance(compound.getInteger("AvailabilityFactionStance")); + + setFaction2Availability(compound.getInteger("AvailabilityFaction2")); + setFaction2AvailabilityStance(compound.getInteger("AvailabilityFaction2Stance")); + + factionId = compound.getInteger("AvailabilityFactionId"); + faction2Id = compound.getInteger("AvailabilityFaction2Id"); + + daytime = EnumDayTime.values()[compound.getInteger("AvailabilityDayTime")]; + + minPlayerLevel = compound.getInteger("AvailabilityMinPlayerLevel"); + } + + public NBTTagCompound writeToNBT(NBTTagCompound compound){ + compound.setInteger("ModRev", version); + + compound.setInteger("AvailabilityDialog", dialogAvailable.ordinal()); + compound.setInteger("AvailabilityDialog2", dialog2Available.ordinal()); + compound.setInteger("AvailabilityDialog3", dialog3Available.ordinal()); + compound.setInteger("AvailabilityDialog4", dialog4Available.ordinal()); + + compound.setInteger("AvailabilityDialogId", dialogId); + compound.setInteger("AvailabilityDialog2Id", dialog2Id); + compound.setInteger("AvailabilityDialog3Id", dialog3Id); + compound.setInteger("AvailabilityDialog4Id", dialog4Id); + + compound.setInteger("AvailabilityQuest", questAvailable.ordinal()); + compound.setInteger("AvailabilityQuest2", quest2Available.ordinal()); + compound.setInteger("AvailabilityQuest3", quest3Available.ordinal()); + compound.setInteger("AvailabilityQuest4", quest4Available.ordinal()); + + compound.setInteger("AvailabilityQuestId", questId); + compound.setInteger("AvailabilityQuest2Id", quest2Id); + compound.setInteger("AvailabilityQuest3Id", quest3Id); + compound.setInteger("AvailabilityQuest4Id", quest4Id); + + compound.setInteger("AvailabilityFaction", factionAvailable.ordinal()); + compound.setInteger("AvailabilityFactionStance", factionStance.ordinal()); + + compound.setInteger("AvailabilityFactionId", factionId); + + compound.setInteger("AvailabilityFaction2", faction2Available.ordinal()); + compound.setInteger("AvailabilityFaction2Stance", faction2Stance.ordinal()); + + compound.setInteger("AvailabilityFaction2Id", faction2Id); + + compound.setInteger("AvailabilityDayTime", daytime.ordinal()); + compound.setInteger("AvailabilityMinPlayerLevel", minPlayerLevel); + return compound; + } + public void setFactionAvailability(int value) { + factionAvailable = EnumAvailabilityFactionType.values()[value]; + } + public void setFaction2Availability(int value) { + faction2Available = EnumAvailabilityFactionType.values()[value]; + } + public void setFactionAvailabilityStance(int integer) { + factionStance = EnumAvailabilityFaction.values()[integer]; + } + public void setFaction2AvailabilityStance(int integer) { + faction2Stance = EnumAvailabilityFaction.values()[integer]; + } + public boolean isAvailable(EntityPlayer player){ + if(daytime == EnumDayTime.Day){ + long time = player.worldObj.getWorldTime() % 24000; + if(time > 12000) + return false; + } + if(daytime == EnumDayTime.Night){ + long time = player.worldObj.getWorldTime() % 24000; + if(time < 12000) + return false; + } + + if(!dialogAvailable(dialogId, dialogAvailable, player)) + return false; + if(!dialogAvailable(dialog2Id, dialog2Available, player)) + return false; + if(!dialogAvailable(dialog3Id, dialog3Available, player)) + return false; + if(!dialogAvailable(dialog4Id, dialog4Available, player)) + return false; + + if(!questAvailable(questId, questAvailable, player)) + return false; + if(!questAvailable(quest2Id, quest2Available, player)) + return false; + if(!questAvailable(quest3Id, quest3Available, player)) + return false; + if(!questAvailable(quest4Id, quest4Available, player)) + return false; + + if(!factionAvailable(factionId, factionStance, factionAvailable, player)) + return false; + if(!factionAvailable(faction2Id, faction2Stance, faction2Available, player)) + return false; + + if(player.experienceLevel < minPlayerLevel) + return false; + + return true; + } + + private boolean factionAvailable(int id, EnumAvailabilityFaction stance, EnumAvailabilityFactionType available, EntityPlayer player) { + if(available == EnumAvailabilityFactionType.Always) + return true; + + Faction faction = FactionController.getInstance().getFaction(id); + if(faction == null) + return true; + + PlayerFactionData data = PlayerDataController.instance.getPlayerData(player).factionData; + int points = data.getFactionPoints(id); + + EnumAvailabilityFaction current = EnumAvailabilityFaction.Neutral; + if(faction.neutralPoints >= points) + current = EnumAvailabilityFaction.Hostile; + if(faction.friendlyPoints < points) + current = EnumAvailabilityFaction.Friendly; + + if(available == EnumAvailabilityFactionType.Is && stance == current){ + return true; + } + if(available == EnumAvailabilityFactionType.IsNot && stance != current){ + return true; + } + + return false; + } + + public boolean dialogAvailable(int id, EnumAvailabilityDialog en, EntityPlayer player){ + if(en == EnumAvailabilityDialog.Always) + return true; + boolean hasRead = PlayerDataController.instance.getPlayerData(player).dialogData.dialogsRead.contains(id); + if(hasRead && en == EnumAvailabilityDialog.After) + return true; + else if(!hasRead && en == EnumAvailabilityDialog.Before) + return true; + return false; + } + + public boolean questAvailable(int id, EnumAvailabilityQuest en, EntityPlayer player){ + if(en == EnumAvailabilityQuest.Always) + return true; + else if(en == EnumAvailabilityQuest.After && PlayerQuestController.isQuestFinished(player, id)) + return true; + else if(en == EnumAvailabilityQuest.Before && !PlayerQuestController.isQuestFinished(player, id)) + return true; + else if(en == EnumAvailabilityQuest.Active && PlayerQuestController.isQuestActive(player, id)) + return true; + else if(en == EnumAvailabilityQuest.NotActive && !PlayerQuestController.isQuestActive(player, id)) + return true; + return false; + } + @Override + public int getVersion() { + return version; + } + @Override + public void setVersion(int version) { + this.version = version; + } +} diff --git a/src/main/java/noppes/npcs/controllers/Bank.java b/src/main/java/noppes/npcs/controllers/Bank.java new file mode 100644 index 000000000..0453077d2 --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/Bank.java @@ -0,0 +1,63 @@ +package noppes.npcs.controllers; + +import java.util.HashMap; + +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.NBTTags; +import noppes.npcs.NpcMiscInventory; + + +public class Bank { + public int id = -1; + public String name = ""; + public HashMap slotTypes; + public int startSlots = 1; + public int maxSlots = 6; + public NpcMiscInventory currencyInventory; + public NpcMiscInventory upgradeInventory; + public Bank(){ + slotTypes = new HashMap(); + currencyInventory = new NpcMiscInventory(6); + upgradeInventory = new NpcMiscInventory(6); + for(int i = 0; i < 6; i++) + slotTypes.put(i, 0); + } + + public void writeEntityToNBT(NBTTagCompound nbttagcompound) { + nbttagcompound.setInteger("BankID", id); + nbttagcompound.setTag("BankCurrency", currencyInventory.getToNBT()); + nbttagcompound.setTag("BankUpgrade", upgradeInventory.getToNBT()); + nbttagcompound.setString("Username", name); + nbttagcompound.setInteger("MaxSlots", maxSlots); + nbttagcompound.setInteger("StartSlots", startSlots); + nbttagcompound.setTag("BankTypes", NBTTags.nbtIntegerIntegerMap(slotTypes)); + } + + public void readEntityFromNBT(NBTTagCompound nbttagcompound) { + id = nbttagcompound.getInteger("BankID"); + name = nbttagcompound.getString("Username"); + startSlots = nbttagcompound.getInteger("StartSlots"); + maxSlots = nbttagcompound.getInteger("MaxSlots"); + slotTypes = NBTTags.getIntegerIntegerMap(nbttagcompound.getTagList("BankTypes", 10)); + currencyInventory.setFromNBT(nbttagcompound.getCompoundTag("BankCurrency")); + upgradeInventory.setFromNBT(nbttagcompound.getCompoundTag("BankUpgrade")); + } + + public boolean isUpgraded(int slot){ + return slotTypes.get(slot) != null && slotTypes.get(slot) == 2; + } + + public boolean canBeUpgraded(int slot) { + if(upgradeInventory.getStackInSlot(slot) == null) + return false; + return slotTypes.get(slot) == null || slotTypes.get(slot) == 0; + } + + public int getMaxSlots() { + for(int i = 0; i < maxSlots; i++){ + if(currencyInventory.getStackInSlot(i) == null && i > startSlots-1) + return i; + } + return maxSlots; + } +} diff --git a/src/main/java/noppes/npcs/controllers/BankController.java b/src/main/java/noppes/npcs/controllers/BankController.java new file mode 100644 index 000000000..beb5ca5ce --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/BankController.java @@ -0,0 +1,168 @@ +package noppes.npcs.controllers; + +import io.netty.buffer.ByteBufInputStream; + +import java.io.BufferedInputStream; +import java.io.DataInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.HashMap; +import java.util.zip.GZIPInputStream; + +import net.minecraft.nbt.CompressedStreamTools; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import noppes.npcs.CustomNpcs; + +public class BankController { + public HashMap banks; + private String filePath = ""; + + private static BankController instance; + + public BankController(){ + instance = this; + banks = new HashMap(); + loadBanks(); + + if(banks.isEmpty()) + { + Bank bank = new Bank(); + bank.id = 0; + bank.name = "Default Bank"; + for(int i = 0;i < 6;i++) + bank.slotTypes.put(i, 0); + + banks.put(bank.id, bank); + } + } + public static BankController getInstance(){ + if(newInstance()){ + instance = new BankController(); + } + return instance; + } + + private static boolean newInstance() { + if(instance == null) + return true; + File file = CustomNpcs.getWorldSaveDirectory(); + if(file == null) + return false; + if(!instance.filePath.equals(file.getAbsolutePath())){ + return true; + } + + return false; + } + + private void loadBanks(){ + File saveDir = CustomNpcs.getWorldSaveDirectory(); + if(saveDir == null) + return; + + filePath = saveDir.getAbsolutePath(); + + try { + File file = new File(saveDir, "bank.dat"); + if(file.exists()){ + loadBanks(file); + } + } catch (Exception e) { + try { + File file = new File(saveDir, "bank.dat_old"); + if(file.exists()){ + loadBanks(file); + } + + } catch (Exception ee) { + } + } + } + private void loadBanks(File file) throws IOException{ + loadBanks(CompressedStreamTools.readCompressed(new FileInputStream(file))); + } + + public void loadBanks(NBTTagCompound nbttagcompound1) throws IOException{ + HashMap banks = new HashMap(); + NBTTagList list = nbttagcompound1.getTagList("Data", 10); + if(list != null){ + for(int i = 0; i < list.tagCount(); i++) + { + NBTTagCompound nbttagcompound = list.getCompoundTagAt(i); + Bank bank = new Bank(); + bank.readEntityFromNBT(nbttagcompound); + banks.put(bank.id,bank); + } + } + this.banks = banks; + } + + public NBTTagCompound getNBT(){ + + NBTTagList list = new NBTTagList(); + for(Bank bank : banks.values()){ + NBTTagCompound nbtfactions = new NBTTagCompound(); + bank.writeEntityToNBT(nbtfactions); + list.appendTag(nbtfactions); + } + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setTag("Data", list); + return nbttagcompound; + } + public Bank getBank(int bankId) { + Bank bank = banks.get(bankId); + if(bank != null) + return bank; + return banks.values().iterator().next(); + } + public void saveBanks(){ + try { + File saveDir = CustomNpcs.getWorldSaveDirectory(); + File file = new File(saveDir, "bank.dat_new"); + File file1 = new File(saveDir, "bank.dat_old"); + File file2 = new File(saveDir, "bank.dat"); + CompressedStreamTools.writeCompressed(getNBT(), new FileOutputStream(file)); + if(file1.exists()) + { + file1.delete(); + } + file2.renameTo(file1); + if(file2.exists()) + { + file2.delete(); + } + file.renameTo(file2); + if(file.exists()) + { + file.delete(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + public void saveBank(Bank bank) { + if(bank.id < 0){ + bank.id = getUnusedId(); + } + banks.put(bank.id, bank); + saveBanks(); + } + + public int getUnusedId(){ + int id = 0; + while(true){ + if(!banks.containsKey(id)) + return id; + id++; + } + } + public void removeBank(int bank) { + if(bank < 0 || banks.size() <= 1) + return; + banks.remove(bank); + saveBanks(); + } +} diff --git a/src/main/java/noppes/npcs/controllers/BankData.java b/src/main/java/noppes/npcs/controllers/BankData.java new file mode 100644 index 000000000..ba57ee415 --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/BankData.java @@ -0,0 +1,121 @@ +package noppes.npcs.controllers; + +import java.util.HashMap; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.inventory.Container; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import noppes.npcs.NBTTags; +import noppes.npcs.NoppesUtilServer; +import noppes.npcs.NpcMiscInventory; +import noppes.npcs.Server; +import noppes.npcs.constants.EnumGuiType; +import noppes.npcs.constants.EnumPacketClient; +import noppes.npcs.containers.ContainerNPCBankInterface; +import noppes.npcs.entity.EntityNPCInterface; + +public class BankData { + public HashMap itemSlots; + public HashMap upgradedSlots; + public int unlockedSlots = 0; + public int bankId = -1; + + public BankData(){ + itemSlots = new HashMap(); + upgradedSlots = new HashMap(); + + for(int i = 0; i < 6; i++){ + itemSlots.put(i, new NpcMiscInventory(54)); + upgradedSlots.put(i, false); + } + } + public void readNBT(NBTTagCompound nbttagcompound) { + bankId = nbttagcompound.getInteger("DataBankId"); + unlockedSlots = nbttagcompound.getInteger("UnlockedSlots"); + itemSlots = getItemSlots(nbttagcompound.getTagList("BankInv", 10)); + upgradedSlots = NBTTags.getBooleanList(nbttagcompound.getTagList("UpdatedSlots", 10)); + } + private HashMap getItemSlots(NBTTagList tagList) { + HashMap list = new HashMap(); + for(int i = 0; i < tagList.tagCount(); i++) + { + NBTTagCompound nbttagcompound = tagList.getCompoundTagAt(i); + int slot = nbttagcompound.getInteger("Slot"); + NpcMiscInventory inv = new NpcMiscInventory(54); + inv.setFromNBT(nbttagcompound.getCompoundTag("BankItems")); + list.put(slot, inv); + } + return list; + } + public void writeNBT(NBTTagCompound nbttagcompound) { + nbttagcompound.setInteger("DataBankId", bankId); + nbttagcompound.setInteger("UnlockedSlots", unlockedSlots); + nbttagcompound.setTag("UpdatedSlots", NBTTags.nbtBooleanList(upgradedSlots)); + nbttagcompound.setTag("BankInv", nbtItemSlots(itemSlots)); + } + private NBTTagList nbtItemSlots(HashMap items) { + NBTTagList list = new NBTTagList(); + for(int slot: items.keySet()){ + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setInteger("Slot", slot); + + nbttagcompound.setTag("BankItems",items.get(slot).getToNBT()); + list.appendTag(nbttagcompound); + } + return list; + } + public boolean isUpgraded(Bank bank, int slot) { + if(bank.isUpgraded(slot)) + return true; + return bank.canBeUpgraded(slot) && upgradedSlots.get(slot); + } + + public void openBankGui(EntityPlayer player, EntityNPCInterface npc, int bankId, int slot) { + Bank bank = BankController.getInstance().banks.get(bankId); + if(bank == null) + bank = BankController.getInstance().banks.values().iterator().next(); + + if(bank.getMaxSlots() <= slot) + return; + + if(bank.startSlots > unlockedSlots) + unlockedSlots = bank.startSlots; + + ItemStack currency = null; + if(unlockedSlots <= slot){ + currency = bank.currencyInventory.getStackInSlot(slot); + NoppesUtilServer.sendOpenGui(player, EnumGuiType.PlayerBankUnlock, npc, slot, bank.id, 0); + } + else if(isUpgraded(bank,slot)){ + NoppesUtilServer.sendOpenGui(player, EnumGuiType.PlayerBankLarge, npc, slot, bank.id, 0); + } + else if(bank.canBeUpgraded(slot)){ + currency = bank.upgradeInventory.getStackInSlot(slot); + NoppesUtilServer.sendOpenGui(player, EnumGuiType.PlayerBankUprade, npc, slot, bank.id, 0); + } + else{ + NoppesUtilServer.sendOpenGui(player, EnumGuiType.PlayerBankSmall, npc, slot, bank.id, 0); + } + + NBTTagCompound compound = new NBTTagCompound(); + compound.setInteger("MaxSlots", bank.getMaxSlots()); + compound.setInteger("UnlockedSlots", unlockedSlots); + if(currency != null){ + compound.setTag("Currency", NoppesUtilServer.writeItem(currency, new NBTTagCompound())); + ContainerNPCBankInterface container = getContainer(player); + container.currency.item = currency; + } + + Server.sendData((EntityPlayerMP)player, EnumPacketClient.GUI_DATA,compound); + } + private ContainerNPCBankInterface getContainer(EntityPlayer player){ + Container con = player.openContainer; + if(con == null || !(con instanceof ContainerNPCBankInterface)) + return null; + + return (ContainerNPCBankInterface) con; + } +} diff --git a/src/main/java/noppes/npcs/controllers/ChunkController.java b/src/main/java/noppes/npcs/controllers/ChunkController.java new file mode 100644 index 000000000..78de43b98 --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/ChunkController.java @@ -0,0 +1,89 @@ +package noppes.npcs.controllers; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; + +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; +import net.minecraft.world.ChunkCoordIntPair; +import net.minecraft.world.World; +import net.minecraftforge.common.ForgeChunkManager; +import net.minecraftforge.common.ForgeChunkManager.LoadingCallback; +import net.minecraftforge.common.ForgeChunkManager.Ticket; +import net.minecraftforge.common.ForgeChunkManager.Type; +import noppes.npcs.CustomNpcs; +import noppes.npcs.constants.EnumJobType; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.JobChunkLoader; + +public class ChunkController implements LoadingCallback{ + public static ChunkController instance; + + private HashMap tickets = new HashMap(); + + public ChunkController(){ + instance = this; + } + public void clear(){ + tickets = new HashMap(); + } + + public Ticket getTicket(EntityNPCInterface npc) { + Ticket ticket = tickets.get(npc); + if(ticket != null) + return ticket; + if(size() >= CustomNpcs.ChuckLoaders) + return null; + ticket = ForgeChunkManager.requestTicket(CustomNpcs.instance, npc.worldObj, Type.ENTITY); + if(ticket == null) + return null; + ticket.bindEntity(npc); + ticket.setChunkListDepth(6); + tickets.put(npc, ticket); + return null; + } + + public void deleteNPC(EntityNPCInterface npc) { + Ticket ticket = tickets.get(npc); + if(ticket != null){ + tickets.remove(npc); + ForgeChunkManager.releaseTicket(ticket); + } + } + + @Override + public void ticketsLoaded(List tickets, World world) { + for(Ticket ticket : tickets){ + if(!(ticket.getEntity() instanceof EntityNPCInterface)) + continue; + EntityNPCInterface npc = (EntityNPCInterface) ticket.getEntity(); + if(npc.advanced.job == EnumJobType.ChunkLoader && !tickets.contains(npc)){ + this.tickets.put(npc, ticket); + double x = npc.posX / 16; + double z = npc.posZ / 16; + + ForgeChunkManager.forceChunk(ticket, new ChunkCoordIntPair(MathHelper.floor_double(x), MathHelper.floor_double(z))); + ForgeChunkManager.forceChunk(ticket, new ChunkCoordIntPair(MathHelper.ceiling_double_int(x), MathHelper.ceiling_double_int(z))); + ForgeChunkManager.forceChunk(ticket, new ChunkCoordIntPair(MathHelper.floor_double(x), MathHelper.ceiling_double_int(z))); + ForgeChunkManager.forceChunk(ticket, new ChunkCoordIntPair(MathHelper.ceiling_double_int(x), MathHelper.floor_double(z))); + } + } + } + public int size() { + return tickets.size(); + } + public void unload(int toRemove) { + Iterator ite = tickets.keySet().iterator(); + int i = 0; + while(ite.hasNext()){ + if(i >= toRemove) + return; + Entity entity = ite.next(); + ForgeChunkManager.releaseTicket(tickets.get(entity)); + ite.remove(); + i++; + } + } +} diff --git a/src/main/java/noppes/npcs/controllers/Dialog.java b/src/main/java/noppes/npcs/controllers/Dialog.java new file mode 100644 index 000000000..8351f69cc --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/Dialog.java @@ -0,0 +1,152 @@ +package noppes.npcs.controllers; + +import java.util.HashMap; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import noppes.npcs.ICompatibilty; +import noppes.npcs.VersionCompatibility; +import noppes.npcs.constants.EnumOptionType; + +public class Dialog implements ICompatibilty { + public int version = VersionCompatibility.ModRev; + public int id = -1; + public String title = ""; + public String text = ""; + public int quest = -1; + public DialogCategory category; + public HashMap options = new HashMap(); + public Availability availability = new Availability(); + public FactionOptions factionOptions = new FactionOptions(); + public String sound; + public String command = ""; + public PlayerMail mail = new PlayerMail(); + + public boolean hideNPC = false; + public boolean showWheel = false; + public boolean disableEsc = false; + + public boolean hasDialogs(EntityPlayer player) { + for(DialogOption option: options.values()) + if(option != null && option.optionType == EnumOptionType.DialogOption && option.hasDialog() && option.isAvailable(player)) + return true; + return false; + } + + public void readNBT(NBTTagCompound compound) { + id = compound.getInteger("DialogId"); + readNBTPartial(compound); + } + public void readNBTPartial(NBTTagCompound compound) { + version = compound.getInteger("ModRev"); + VersionCompatibility.CheckAvailabilityCompatibility(this, compound); + + title = compound.getString("DialogTitle"); + text = compound.getString("DialogText"); + quest = compound.getInteger("DialogQuest"); + sound = compound.getString("DialogSound"); + command = compound.getString("DialogCommand"); + mail.readNBT(compound.getCompoundTag("DialogMail")); + + hideNPC = compound.getBoolean("DialogHideNPC"); + if(compound.hasKey("DialogShowWheel")) + showWheel = compound.getBoolean("DialogShowWheel"); + else + showWheel = true; + disableEsc = compound.getBoolean("DialogDisableEsc"); + + NBTTagList options = compound.getTagList("Options", 10); + HashMap newoptions = new HashMap(); + for(int iii = 0; iii < options.tagCount();iii++){ + NBTTagCompound option = options.getCompoundTagAt(iii); + int opslot = option.getInteger("OptionSlot"); + DialogOption dia = new DialogOption(); + dia.readNBT(option.getCompoundTag("Option")); + newoptions.put(opslot, dia); + } + this.options = newoptions; + + availability.readFromNBT(compound); + factionOptions.readFromNBT(compound); + } + + + public NBTTagCompound writeToNBT(NBTTagCompound compound) { + compound.setInteger("DialogId", id); + return writeToNBTPartial(compound); + } + + public NBTTagCompound writeToNBTPartial(NBTTagCompound compound) { + compound.setString("DialogTitle", title); + compound.setString("DialogText", text); + compound.setInteger("DialogQuest", quest); + compound.setString("DialogCommand", command); + compound.setTag("DialogMail", mail.writeNBT()); + compound.setBoolean("DialogHideNPC", hideNPC); + compound.setBoolean("DialogShowWheel", showWheel); + compound.setBoolean("DialogDisableEsc", disableEsc); + + if(sound != null && !sound.isEmpty()) + compound.setString("DialogSound", sound); + + NBTTagList options = new NBTTagList(); + for(int opslot : this.options.keySet()){ + NBTTagCompound listcompound = new NBTTagCompound(); + listcompound.setInteger("OptionSlot", opslot); + listcompound.setTag("Option", this.options.get(opslot).writeNBT()); + options.appendTag(listcompound); + } + compound.setTag("Options", options); + + availability.writeToNBT(compound); + factionOptions.writeToNBT(compound); + compound.setInteger("ModRev", version); + return compound; + } + + public boolean hasQuest() { + return getQuest() != null; + } + public Quest getQuest() { + return QuestController.instance.quests.get(quest); + } + public boolean hasOtherOptions() { + for(DialogOption option: options.values()) + if(option != null && option.optionType != EnumOptionType.Disabled) + return true; + return false; + } + + public Dialog copy(EntityPlayer player) { + Dialog dialog = new Dialog(); + dialog.id = id; + dialog.text = text; + dialog.title = title; + dialog.category = category; + dialog.quest = quest; + dialog.sound = sound; + dialog.mail = mail; + dialog.command = command; + dialog.hideNPC = hideNPC; + dialog.showWheel = showWheel; + dialog.disableEsc = disableEsc; + + for(int slot : options.keySet()){ + DialogOption option = options.get(slot); + if(option.optionType == EnumOptionType.DialogOption && (!option.hasDialog() || !option.isAvailable(player))) + continue; + dialog.options.put(slot, option); + } + return dialog; + } + @Override + public int getVersion() { + return version; + } + @Override + public void setVersion(int version) { + this.version = version; + } + +} diff --git a/src/main/java/noppes/npcs/controllers/DialogCategory.java b/src/main/java/noppes/npcs/controllers/DialogCategory.java new file mode 100644 index 000000000..7bbb64288 --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/DialogCategory.java @@ -0,0 +1,46 @@ +package noppes.npcs.controllers; + +import java.util.HashMap; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; + +public class DialogCategory { + + public int id = -1; + public String title = ""; + public HashMap dialogs; + + public DialogCategory(){ + dialogs = new HashMap(); + } + + public void readNBT(NBTTagCompound compound){ + id = compound.getInteger("Slot"); + title = compound.getString("Title"); + + NBTTagList dialogsList = compound.getTagList("Dialogs", 10); + if(dialogsList != null){ + for(int ii = 0; ii < dialogsList.tagCount(); ii++) + { + Dialog dialog = new Dialog(); + dialog.category = this; + NBTTagCompound comp = dialogsList.getCompoundTagAt(ii); + dialog.readNBT(comp); + dialog.id = comp.getInteger("DialogId"); + dialogs.put(dialog.id, dialog); + } + } + } + + public NBTTagCompound writeNBT(NBTTagCompound nbtfactions) { + nbtfactions.setInteger("Slot", id); + nbtfactions.setString("Title", title); + NBTTagList dialogs = new NBTTagList(); + for(Dialog dialog : this.dialogs.values()){ + dialogs.appendTag(dialog.writeToNBT(new NBTTagCompound())); + } + nbtfactions.setTag("Dialogs", dialogs); + return nbtfactions; + } +} diff --git a/src/main/java/noppes/npcs/controllers/DialogController.java b/src/main/java/noppes/npcs/controllers/DialogController.java new file mode 100644 index 000000000..5b8e8f765 --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/DialogController.java @@ -0,0 +1,315 @@ +package noppes.npcs.controllers; + +import java.io.File; +import java.io.FileInputStream; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import net.minecraft.nbt.CompressedStreamTools; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import noppes.npcs.CustomNpcs; +import noppes.npcs.LogWriter; +import noppes.npcs.NoppesStringUtils; +import noppes.npcs.constants.EnumOptionType; +import noppes.npcs.util.NBTJsonUtil; + +public class DialogController { + public HashMap categories = new HashMap(); + public HashMap dialogs = new HashMap(); + public static DialogController instance; + + private int lastUsedDialogID = 0; + private int lastUsedCatID = 0; + + public DialogController(){ + instance = this; + load(); + } + + public void load(){ + LogWriter.info("Loading Dialogs"); + loadCategories(); + LogWriter.info("Done loading Dialogs"); + } + + private void loadCategories(){ + categories.clear(); + dialogs.clear(); + + lastUsedCatID = 0; + lastUsedDialogID = 0; + + try { + File file = new File(CustomNpcs.getWorldSaveDirectory(), "dialog.dat"); + if(file.exists()){ + loadCategoriesOld(file); + file.delete(); + file = new File(CustomNpcs.getWorldSaveDirectory(), "dialog.dat_old"); + if(file.exists()) + file.delete(); + return; + } + } catch (Exception e) { + LogWriter.except(e); + } + + File dir = getDir(); + if(!dir.exists()){ + dir.mkdir(); + loadDefaultDialogs(); + } + else{ + for(File file : dir.listFiles()){ + if(!file.isDirectory()) + continue; + DialogCategory category = loadCategoryDir(file); + Iterator ite = category.dialogs.keySet().iterator(); + while(ite.hasNext()){ + int id = ite.next(); + if(id > lastUsedDialogID) + lastUsedDialogID = id; + Dialog dialog = category.dialogs.get(id); + if(dialogs.containsKey(id)){ + LogWriter.error("Duplicate id " + dialog.id + " from category " + category.title); + ite.remove(); + } + else{ + dialogs.put(id, dialog); + } + } + lastUsedCatID++; + category.id = lastUsedCatID; + categories.put(category.id, category); + } + } + } + private DialogCategory loadCategoryDir(File dir) { + DialogCategory category = new DialogCategory(); + category.title = dir.getName(); + for(File file : dir.listFiles()){ + if(!file.isFile() || !file.getName().endsWith(".json")) + continue; + try{ + Dialog dialog = new Dialog(); + dialog.id = Integer.parseInt(file.getName().substring(0, file.getName().length() - 5)); + dialog.readNBTPartial(NBTJsonUtil.LoadFile(file)); + category.dialogs.put(dialog.id, dialog); + dialog.category = category; + } + catch(Exception e){ + LogWriter.error("Error loading: " + file.getAbsolutePath(), e); + } + } + return category; + } + + private void loadCategoriesOld(File file) throws Exception{ + File dir = getDir(); + if(!dir.exists()){ + dir.mkdir(); + } + NBTTagCompound nbttagcompound1 = CompressedStreamTools.readCompressed(new FileInputStream(file)); + NBTTagList list = nbttagcompound1.getTagList("Data", 10); + if(list == null) + return; + + for(int i = 0; i < list.tagCount(); i++){ + DialogCategory category = new DialogCategory(); + category.readNBT(list.getCompoundTagAt(i)); + saveCategory(category); + Iterator> ita = category.dialogs.entrySet().iterator(); + while(ita.hasNext()){ + Map.Entry entry = ita.next(); + Dialog dialog = entry.getValue(); + dialog.id = entry.getKey(); + dialog.category = category; + if(dialogs.containsKey(dialog.id)) + ita.remove(); + else{ + saveDialog(category.id, dialog); + } + } + + } + } + + private void loadDefaultDialogs() { + DialogCategory cat = new DialogCategory(); + cat.id = lastUsedCatID++; + cat.title = "Villager"; + + Dialog dia1 = new Dialog(); + dia1.id = 1; + dia1.category = cat; + dia1.title = "Start"; + dia1.text = "Hello {player}, "+'\n'+'\n'+"Welcome to our village. I hope you enjoy your stay"; + + Dialog dia2 = new Dialog(); + dia2.id = 2; + dia2.category = cat; + dia2.title = "Ask about village"; + dia2.text = "This village has been around for ages. Enjoy your stay here."; + + Dialog dia3 = new Dialog(); + dia3.id = 3; + dia3.category = cat; + dia3.title = "Who are you"; + dia3.text = "I'm a villager here. I have lived in this village my whole life."; + + cat.dialogs.put(dia1.id, dia1); + cat.dialogs.put(dia2.id, dia2); + cat.dialogs.put(dia3.id, dia3); + + + DialogOption option = new DialogOption(); + option.title = "Tell me something about this village"; + option.dialogId = 2; + option.optionType = EnumOptionType.DialogOption; + + DialogOption option2 = new DialogOption(); + option2.title = "Who are you?"; + option2.dialogId = 3; + option2.optionType = EnumOptionType.DialogOption; + + DialogOption option3 = new DialogOption(); + option3.title = "Goodbye"; + option3.optionType = EnumOptionType.QuitOption; + + dia1.options.put(0, option2); + dia1.options.put(1, option); + dia1.options.put(2, option3); + + + DialogOption option4 = new DialogOption(); + option4.title = "Back"; + option4.dialogId = 1; + + dia2.options.put(1, option4); + dia3.options.put(1, option4); + lastUsedDialogID = 3; + saveCategory(cat); + saveDialog(cat.id, dia1); + saveDialog(cat.id, dia2); + saveDialog(cat.id, dia3); + } + + public void saveCategory(DialogCategory category){ + category.title = NoppesStringUtils.cleanFileName(category.title); + if(categories.containsKey(category.id)){ + DialogCategory currentCategory = categories.get(category.id); + if(!currentCategory.title.equals(category.title)){ + while(containsCategoryName(category.title)) + category.title += "_"; + File newdir = new File(getDir(), category.title); + File olddir = new File(getDir(), currentCategory.title); + if(newdir.exists()) + return; + if(!olddir.renameTo(newdir)) + return; + } + category.dialogs = currentCategory.dialogs; + } + else{ + if(category.id < 0){ + lastUsedCatID++; + category.id = lastUsedCatID; + } + while(containsCategoryName(category.title)) + category.title += "_"; + File dir = new File(getDir(), category.title); + if(!dir.exists()) + dir.mkdirs(); + } + categories.put(category.id, category); + } + + public void removeCategory(int category){ + DialogCategory cat = categories.get(category); + if(cat == null) + return; + File dir = new File(getDir(), cat.title); + if(!dir.delete()) + return; + for(int dia : cat.dialogs.keySet()) + dialogs.remove(dia); + categories.remove(category); + } + + private boolean containsCategoryName(String name) { + name = name.toLowerCase(); + for(DialogCategory cat : categories.values()){ + if(cat.title.toLowerCase().equals(name)) + return true; + } + return false; + } + private boolean containsDialogName(DialogCategory category, Dialog dialog) { + for(Dialog dia : category.dialogs.values()){ + if(dia.id != dialog.id && dia.title.equalsIgnoreCase(dialog.title)) + return true; + } + return false; + } + public Dialog saveDialog(int categoryId, Dialog dialog){ + DialogCategory category = categories.get(categoryId); + if(category == null) + return dialog; + dialog.category = category; + + while(containsDialogName(dialog.category, dialog)){ + dialog.title = dialog.title + "_"; + } + if(dialog.id < 0){ + lastUsedDialogID++; + dialog.id = lastUsedDialogID; + } + + dialogs.put(dialog.id, dialog); + category.dialogs.put(dialog.id, dialog); + + File dir = new File(getDir(), category.title); + if(!dir.exists()) + dir.mkdirs(); + + File file = new File(dir, dialog.id + ".json_new"); + File file2 = new File(dir, dialog.id + ".json"); + + try { + NBTJsonUtil.SaveFile(file, dialog.writeToNBTPartial(new NBTTagCompound())); + if(file2.exists()) + file2.delete(); + file.renameTo(file2); + } catch (Exception e) { + LogWriter.except(e); + } + return dialog; + } + + public void removeDialog(Dialog dialog) { + DialogCategory category = dialog.category; + File file = new File(new File(getDir(), category.title), dialog.id + ".json"); + if(!file.delete()) + return; + category.dialogs.remove(dialog.id); + dialogs.remove(dialog.id); + + } + + private File getDir(){ + return new File(CustomNpcs.getWorldSaveDirectory(), "dialogs"); + } + + public boolean hasDialog(int dialogId) { + return dialogs.containsKey(dialogId); + } + + public Map getScroll() { + Map map = new HashMap(); + for(DialogCategory category : categories.values()){ + map.put(category.title, category.id); + } + return map; + } +} diff --git a/src/main/java/noppes/npcs/controllers/DialogOption.java b/src/main/java/noppes/npcs/controllers/DialogOption.java new file mode 100644 index 000000000..30f41cede --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/DialogOption.java @@ -0,0 +1,61 @@ +package noppes.npcs.controllers; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.constants.EnumOptionType; + +public class DialogOption { + public int dialogId = -1; + public String title = "Talk"; + public EnumOptionType optionType = EnumOptionType.DialogOption; + public int optionColor = 0xe0e0e0; + public String command = ""; + + public void readNBT(NBTTagCompound compound) { + if(compound == null) + return; + title = compound.getString("Title"); + dialogId = compound.getInteger("Dialog"); + optionColor = compound.getInteger("DialogColor"); + optionType = EnumOptionType.values()[compound.getInteger("OptionType")]; + command = compound.getString("DialogCommand"); + if(optionColor == 0){ + optionColor = 0xe0e0e0; + } + } + + public NBTTagCompound writeNBT() { + NBTTagCompound compound = new NBTTagCompound(); + compound.setString("Title", title); + compound.setInteger("OptionType", optionType.ordinal()); + compound.setInteger("Dialog", dialogId); + compound.setInteger("DialogColor", optionColor); + compound.setString("DialogCommand", command); + return compound; + } + + + public boolean hasDialog(){ + if(dialogId <= 0) + return false; + if(!DialogController.instance.hasDialog(dialogId)){ + dialogId = -1; + return false; + } + return true; + } + + public Dialog getDialog() { + if(!hasDialog()) + return null; + return DialogController.instance.dialogs.get(dialogId); + } + + public boolean isAvailable(EntityPlayer player) { + Dialog dialog = getDialog(); + if(dialog == null) + return false; + + return dialog.availability.isAvailable(player); + } +} diff --git a/src/main/java/noppes/npcs/controllers/Faction.java b/src/main/java/noppes/npcs/controllers/Faction.java new file mode 100644 index 000000000..d97eb4fdb --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/Faction.java @@ -0,0 +1,88 @@ +package noppes.npcs.controllers; + +import java.util.HashSet; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.NBTTags; +import noppes.npcs.entity.EntityNPCInterface; + +public class Faction { + public String name = ""; + public int color = Integer.parseInt("FF00", 16); + + public HashSet attackFactions; + public int id = -1; + + public int neutralPoints = 500; + public int friendlyPoints = 1500; + + public int defaultPoints = 1000; + + public boolean hideFaction = false; + public boolean getsAttacked = false; + + public Faction(){ + attackFactions = new HashSet(); + } + + public Faction(int id, String name,int color, int defaultPoints){ + this.name = name; + this.color = color; + this.defaultPoints = defaultPoints; + this.id = id; + attackFactions = new HashSet(); + } + public static String formatName(String name){ + name = name.toLowerCase().trim(); + return name.substring(0, 1).toUpperCase() + name.substring(1); + } + public void readNBT(NBTTagCompound compound){ + name = compound.getString("Name"); + color = compound.getInteger("Color"); + id = compound.getInteger("Slot"); + + neutralPoints= compound.getInteger("NeutralPoints"); + friendlyPoints = compound.getInteger("FriendlyPoints"); + defaultPoints = compound.getInteger("DefaultPoints"); + + hideFaction = compound.getBoolean("HideFaction"); + getsAttacked = compound.getBoolean("GetsAttacked"); + + attackFactions = NBTTags.getIntegerSet(compound.getTagList("AttackFactions", 10)); + } + public void writeNBT(NBTTagCompound compound){ + compound.setInteger("Slot", id); + compound.setString("Name", name); + compound.setInteger("Color", color); + + compound.setInteger("NeutralPoints", neutralPoints); + compound.setInteger("FriendlyPoints", friendlyPoints); + compound.setInteger("DefaultPoints", defaultPoints); + + compound.setBoolean("HideFaction", hideFaction); + compound.setBoolean("GetsAttacked", getsAttacked); + + compound.setTag("AttackFactions", NBTTags.nbtIntegerSet(attackFactions)); + } + + public boolean isFriendlyToPlayer(EntityPlayer player) { + PlayerFactionData data = PlayerDataController.instance.getPlayerData(player).factionData; + return data.getFactionPoints(id) >= friendlyPoints; + } + + public boolean isAggressiveToPlayer(EntityPlayer player) { + PlayerFactionData data = PlayerDataController.instance.getPlayerData(player).factionData; + return data.getFactionPoints(id) < neutralPoints; + } + + public boolean isNeutralToPlayer(EntityPlayer player) { + PlayerFactionData data = PlayerDataController.instance.getPlayerData(player).factionData; + int points = data.getFactionPoints(id); + return points >= neutralPoints && points < friendlyPoints; + } + + public boolean isAggressiveToNpc(EntityNPCInterface entity) { + return attackFactions.contains(entity.faction.id); + } +} diff --git a/src/main/java/noppes/npcs/controllers/FactionController.java b/src/main/java/noppes/npcs/controllers/FactionController.java new file mode 100644 index 000000000..77a57a352 --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/FactionController.java @@ -0,0 +1,197 @@ +package noppes.npcs.controllers; + +import java.io.BufferedInputStream; +import java.io.DataInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.zip.GZIPInputStream; + +import net.minecraft.nbt.CompressedStreamTools; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import noppes.npcs.CustomNpcs; +import noppes.npcs.LogWriter; + +public class FactionController { + public HashMap factions; + + private static FactionController instance; + + private int lastUsedID = 0; + + public FactionController(){ + instance = this; + factions = new HashMap(); + loadFactions(); + if(factions.isEmpty()){ + factions.put(0,new Faction(0,"Friendly", 0x00DD00, 2000)); + factions.put(1,new Faction(1,"Neutral", 0xF2DD00, 1000)); + factions.put(2,new Faction(2,"Aggressive", 0xDD0000, 0)); + } + + } + + public static FactionController getInstance(){ + return instance; + } + + private void loadFactions(){ + + File saveDir = CustomNpcs.getWorldSaveDirectory(); + if(saveDir == null){ + return; + } + try { + File file = new File(saveDir, "factions.dat"); + if(file.exists()){ + loadFactionsFile(file); + } + } catch (Exception e) { + try { + File file = new File(saveDir, "factions.dat_old"); + if(file.exists()){ + loadFactionsFile(file); + } + + } catch (Exception ee) { + } + } + } + + private void loadFactionsFile(File file) throws IOException{ + DataInputStream var1 = new DataInputStream(new BufferedInputStream(new GZIPInputStream(new FileInputStream(file)))); + loadFactions(var1); + var1.close(); + } + + public void loadFactions(DataInputStream stream) throws IOException{ + HashMap factions = new HashMap(); + NBTTagCompound nbttagcompound1 = CompressedStreamTools.read(stream); + lastUsedID = nbttagcompound1.getInteger("lastID"); + NBTTagList list = nbttagcompound1.getTagList("NPCFactions", 10); + + if(list != null){ + for(int i = 0; i < list.tagCount(); i++) + { + NBTTagCompound nbttagcompound = list.getCompoundTagAt(i); + Faction faction = new Faction(); + faction.readNBT(nbttagcompound); + factions.put(faction.id,faction); + } + } + this.factions = factions; + } + public NBTTagCompound getNBT(){ + NBTTagList list = new NBTTagList(); + for(int slot : factions.keySet()){ + Faction faction = factions.get(slot); + NBTTagCompound nbtfactions = new NBTTagCompound(); + faction.writeNBT(nbtfactions); + list.appendTag(nbtfactions); + } + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setInteger("lastID", lastUsedID); + nbttagcompound.setTag("NPCFactions", list); + return nbttagcompound; + } + public void saveFactions(){ + try { + File saveDir = CustomNpcs.getWorldSaveDirectory(); + File file = new File(saveDir, "factions.dat_new"); + File file1 = new File(saveDir, "factions.dat_old"); + File file2 = new File(saveDir, "factions.dat"); + CompressedStreamTools.writeCompressed(getNBT(), new FileOutputStream(file)); + if(file1.exists()) + { + file1.delete(); + } + file2.renameTo(file1); + if(file2.exists()) + { + file2.delete(); + } + file.renameTo(file2); + if(file.exists()) + { + file.delete(); + } + } catch (Exception e) { + LogWriter.except(e); + } + } + + public Faction getFaction(int faction) { + return factions.get(faction); + } + + public void saveFaction(Faction faction) { + + if(faction.id < 0){ + faction.id = getUnusedId(); + while(hasName(faction.name)) + faction.name += "_"; + } + else{ + Faction existing = factions.get(faction.id); + if(existing != null && !existing.name.equals(faction.name)) + while(hasName(faction.name)) + faction.name += "_"; + } + factions.remove(faction.id); + factions.put(faction.id, faction); + saveFactions(); + } + + public int getUnusedId(){ + if(lastUsedID == 0){ + for(int catid : factions.keySet()) + if(catid > lastUsedID) + lastUsedID = catid; + } + lastUsedID++; + return lastUsedID; + } + public void removeFaction(int id) { + if(id < 0 || factions.size() <= 1) + return; + factions.remove(id); + saveFactions(); + } + + public int getFirstFactionId() { + return factions.keySet().iterator().next(); + } + public Faction getFirstFaction() { + return factions.values().iterator().next(); + } + public boolean hasName(String newName) { + if(newName.trim().isEmpty()) + return true; + for(Faction faction : factions.values()) + if(faction.name.equals(newName)) + return true; + return false; + } + public Faction getFactionFromName(String factioname){ + for (Map.Entryentryfaction:FactionController.getInstance().factions.entrySet()){ + if (entryfaction.getValue().name.equalsIgnoreCase(factioname)){ + return entryfaction.getValue(); + } + } + return null; + } + + public String[] getNames() { + String[] names = new String[factions.size()]; + int i = 0; + for(Faction faction : factions.values()){ + names[i] = faction.name.toLowerCase(); + i++; + } + return names; + } +} diff --git a/src/main/java/noppes/npcs/controllers/FactionOptions.java b/src/main/java/noppes/npcs/controllers/FactionOptions.java new file mode 100644 index 000000000..046b398ad --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/FactionOptions.java @@ -0,0 +1,67 @@ +package noppes.npcs.controllers; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ChatComponentTranslation; + +public class FactionOptions { + + public boolean decreaseFactionPoints = false; + public boolean decreaseFaction2Points = false; + + public int factionId = -1; + public int faction2Id = -1; + + public int factionPoints = 100; + public int faction2Points = 100; + + public void readFromNBT(NBTTagCompound compound) + { + factionId = compound.getInteger("OptionFactions1"); + faction2Id = compound.getInteger("OptionFactions2"); + + decreaseFactionPoints = compound.getBoolean("DecreaseFaction1Points"); + decreaseFaction2Points = compound.getBoolean("DecreaseFaction2Points"); + + factionPoints = compound.getInteger("OptionFaction1Points"); + faction2Points = compound.getInteger("OptionFaction2Points"); + } + public NBTTagCompound writeToNBT(NBTTagCompound par1NBTTagCompound) + { + par1NBTTagCompound.setInteger("OptionFactions1", factionId); + par1NBTTagCompound.setInteger("OptionFactions2", faction2Id); + + par1NBTTagCompound.setInteger("OptionFaction1Points", factionPoints); + par1NBTTagCompound.setInteger("OptionFaction2Points", faction2Points); + + par1NBTTagCompound.setBoolean("DecreaseFaction1Points", decreaseFactionPoints); + par1NBTTagCompound.setBoolean("DecreaseFaction2Points", decreaseFaction2Points); + return par1NBTTagCompound; + } + public boolean hasFaction(int id) { + return factionId == id || faction2Id == id; + } + public void addPoints(EntityPlayer player) { + if(factionId < 0 && faction2Id < 0) + return; + + PlayerFactionData data = PlayerDataController.instance.getPlayerData(player).factionData; + if(factionId >= 0 && factionPoints > 0) + addPoints(player, data, factionId, decreaseFactionPoints, factionPoints); + if(faction2Id >= 0 && faction2Points> 0) + addPoints(player, data, faction2Id, decreaseFaction2Points, faction2Points); + } + private void addPoints(EntityPlayer player, PlayerFactionData data, int factionId, boolean decrease, int points) { + Faction faction = FactionController.getInstance().getFaction(factionId); + if(faction == null) + return; + + if(!faction.hideFaction){ + String message = decrease?"faction.decreasepoints":"faction.increasepoints"; + player.addChatMessage(new ChatComponentTranslation(message, faction.name, points)); + } + + data.increasePoints(factionId, decrease?-points:points); + + } +} diff --git a/src/main/java/noppes/npcs/controllers/GlobalDataController.java b/src/main/java/noppes/npcs/controllers/GlobalDataController.java new file mode 100644 index 000000000..3c91876c3 --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/GlobalDataController.java @@ -0,0 +1,78 @@ +package noppes.npcs.controllers; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; + +import net.minecraft.nbt.CompressedStreamTools; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.CustomNpcs; + +public class GlobalDataController { + public static GlobalDataController instance; + + private int itemGiverId = 0; + + public GlobalDataController(){ + instance = this; + load(); + } + + private void load(){ + File saveDir = CustomNpcs.getWorldSaveDirectory(); + try { + File file = new File(saveDir, "global.dat"); + if(file.exists()){ + loadData(file); + } + } catch (Exception e) { + try { + File file = new File(saveDir, "global.dat_old"); + if(file.exists()){ + loadData(file); + } + + } catch (Exception ee) { + ee.printStackTrace(); + } + } + } + private void loadData(File file) throws Exception{ + NBTTagCompound nbttagcompound1 = CompressedStreamTools.readCompressed(new FileInputStream(file)); + itemGiverId = nbttagcompound1.getInteger("itemGiverId"); + } + public void saveData(){ + try { + File saveDir = CustomNpcs.getWorldSaveDirectory(); + + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setInteger("itemGiverId", itemGiverId); + + File file = new File(saveDir, "global.dat_new"); + File file1 = new File(saveDir, "global.dat_old"); + File file2 = new File(saveDir, "global.dat"); + CompressedStreamTools.writeCompressed(nbttagcompound, new FileOutputStream(file)); + if(file1.exists()) + { + file1.delete(); + } + file2.renameTo(file1); + if(file2.exists()) + { + file2.delete(); + } + file.renameTo(file2); + if(file.exists()) + { + file.delete(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + public int incrementItemGiverId(){ + itemGiverId++; + saveData(); + return itemGiverId; + } +} diff --git a/src/main/java/noppes/npcs/controllers/InnDoorData.java b/src/main/java/noppes/npcs/controllers/InnDoorData.java new file mode 100644 index 000000000..07c653c3d --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/InnDoorData.java @@ -0,0 +1,7 @@ +package noppes.npcs.controllers; + +public class InnDoorData { + public int x = 0; + public int y = 0; + public int z = 0; +} diff --git a/src/main/java/noppes/npcs/controllers/Line.java b/src/main/java/noppes/npcs/controllers/Line.java new file mode 100644 index 000000000..24b20b036 --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/Line.java @@ -0,0 +1,37 @@ +package noppes.npcs.controllers; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; + + +public class Line { + + public Line(){ + + } + public Line(String text){ + this.text = text; + } + + public String text = ""; + public String sound = ""; + public boolean hideText = false; + + public Line copy() { + Line line = new Line(text); + line.sound = sound; + line.hideText = hideText; + return line; + } + + public Line formatTarget(EntityLivingBase entity) { + if(entity == null) + return this; + Line line = copy(); + if(entity instanceof EntityPlayer) + line.text = line.text.replace("@target", ((EntityPlayer) entity).getDisplayName()); + else + line.text = line.text.replace("@target", entity.getCommandSenderName()); + return line; + } +} diff --git a/src/main/java/noppes/npcs/controllers/Lines.java b/src/main/java/noppes/npcs/controllers/Lines.java new file mode 100644 index 000000000..3a696558d --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/Lines.java @@ -0,0 +1,72 @@ +package noppes.npcs.controllers; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Random; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; + +public class Lines { + private static final Random random = new Random(); + private int lastLine = -1; + + public HashMap lines = new HashMap(); + + public NBTTagCompound writeToNBT() { + NBTTagCompound compound = new NBTTagCompound(); + + NBTTagList nbttaglist = new NBTTagList(); + for(int slot : lines.keySet()) + { + Line line = lines.get(slot); + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setInteger("Slot", slot); + nbttagcompound.setString("Line", line.text); + nbttagcompound.setString("Song", line.sound); + + nbttaglist.appendTag(nbttagcompound); + } + + compound.setTag("Lines", nbttaglist); + return compound; + } + + public void readNBT(NBTTagCompound compound) { + NBTTagList nbttaglist = compound.getTagList("Lines", 10); + + HashMap map = new HashMap(); + for(int i = 0; i < nbttaglist.tagCount(); i++) + { + NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i); + Line line = new Line(); + line.text = nbttagcompound.getString("Line"); + line.sound = nbttagcompound.getString("Song"); + + map.put(nbttagcompound.getInteger("Slot"), line); + } + lines = map; + } + + public Line getLine(boolean isRandom) { + if(lines.isEmpty()) + return null; + if(isRandom){ + List lines = new ArrayList(this.lines.values()); + return lines.get(random.nextInt(lines.size())); + } + lastLine++; + while(true){ + lastLine %= 8; + Line line = lines.get(lastLine); + if(line != null) + return line.copy(); + lastLine++; + } + } + + public boolean isEmpty() { + return lines.isEmpty(); + } +} diff --git a/src/main/java/noppes/npcs/controllers/LinkedNpcController.java b/src/main/java/noppes/npcs/controllers/LinkedNpcController.java new file mode 100644 index 000000000..a66c0a4a4 --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/LinkedNpcController.java @@ -0,0 +1,199 @@ +package noppes.npcs.controllers; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.CustomNpcs; +import noppes.npcs.LogWriter; +import noppes.npcs.NBTTags; +import noppes.npcs.NoppesUtilServer; +import noppes.npcs.entity.EntityCustomNpc; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.util.JsonException; +import noppes.npcs.util.NBTJsonUtil; + +public class LinkedNpcController { + public static LinkedNpcController Instance; + public List list = new ArrayList(); + + public LinkedNpcController(){ + Instance = this; + load(); + } + private void load(){ + try { + loadNpcs(); + } catch (Exception e) { + LogWriter.except(e); + } + } + + public File getDir(){ + File dir = new File(CustomNpcs.getWorldSaveDirectory(), "linkednpcs"); + if(!dir.exists()) + dir.mkdir(); + return dir; + } + + private void loadNpcs(){ + LogWriter.info("Loading Linked Npcs"); + File dir = getDir(); + if(dir.exists()){ + List list = new ArrayList(); + for(File file : dir.listFiles()){ + if(file.getName().endsWith(".json")){ + try{ + NBTTagCompound compound = NBTJsonUtil.LoadFile(file);; + LinkedData linked = new LinkedData(); + linked.setNBT(compound); + list.add(linked); + } + catch(Exception e){ + LogWriter.error("Error loading: " + file.getAbsolutePath(), e); + } + } + } + + this.list = list; + } + LogWriter.info("Done loading Linked Npcs"); + } + + public void save(){ + for(LinkedData npc : list){ + try { + saveNpc(npc); + } catch (IOException e) { + LogWriter.except(e); + } + } + } + + private void saveNpc(LinkedData npc) throws IOException { + File file = new File(getDir(), npc.name + ".json_new"); + File file1 = new File(getDir(), npc.name + ".json"); + try{ + NBTJsonUtil.SaveFile(file, npc.getNBT()); + if(file1.exists()){ + file1.delete(); + } + file.renameTo(file1); + + } catch (JsonException e) { + LogWriter.except(e); + } + } + + public static class LinkedData{ + public String name = "LinkedNpc"; + public long time = 0; + public NBTTagCompound data = new NBTTagCompound(); + + public LinkedData(){ + time = System.currentTimeMillis(); + } + + public void setNBT(NBTTagCompound compound){ + name = compound.getString("LinkedName"); + data = compound.getCompoundTag("NPCData"); + } + + public NBTTagCompound getNBT(){ + NBTTagCompound compound = new NBTTagCompound(); + compound.setString("LinkedName", name); + compound.setTag("NPCData", data); + return compound; + } + } + + public void loadNpcData(EntityNPCInterface npc) { + if(npc.linkedName.isEmpty()) + return; + LinkedData data = getData(npc.linkedName); + if(data == null){ + npc.linkedLast = 0; + npc.linkedName = ""; + npc.linkedData = null; + } + else{ + npc.linkedData = data; + if(npc.posX == 0 && npc.posY == 0 && npc.posX == 0) + return; + npc.linkedLast = data.time; + List points = npc.ai.getMovingPath(); + + NBTTagCompound compound = NBTTags.NBTMerge(readNpcData(npc), data.data); + + npc.display.readToNBT(compound); + npc.stats.readToNBT(compound); + npc.advanced.readToNBT(compound); + npc.inventory.readEntityFromNBT(compound); + if(compound.hasKey("ModelData")) + ((EntityCustomNpc)npc).modelData.readFromNBT(compound.getCompoundTag("ModelData")); + + npc.ai.readToNBT(compound); + npc.transform.readToNBT(compound); + npc.ai.setMovingPath(points); + + npc.updateClient = true; + } + } + + private void cleanTags(NBTTagCompound compound){ + compound.removeTag("MovingPathNew"); + } + + public LinkedData getData(String name){ + for(LinkedData data : list){ + if(data.name.equalsIgnoreCase(name)) + return data; + } + return null; + } + + private NBTTagCompound readNpcData(EntityNPCInterface npc){ + NBTTagCompound compound = new NBTTagCompound(); + npc.display.writeToNBT(compound); + npc.inventory.writeEntityToNBT(compound); + npc.stats.writeToNBT(compound); + npc.ai.writeToNBT(compound); + npc.advanced.writeToNBT(compound); + npc.transform.writeToNBT(compound); + compound.setTag("ModelData", ((EntityCustomNpc)npc).modelData.writeToNBT()); + return compound; + } + + public void saveNpcData(EntityNPCInterface npc) { + NBTTagCompound compound = readNpcData(npc); + cleanTags(compound); + + if(npc.linkedData.data.equals(compound)) + return; + + npc.linkedData.data = compound; + npc.linkedData.time = System.currentTimeMillis(); + save(); + } + public void removeData(String name) { + Iterator ita = list.iterator(); + while(ita.hasNext()){ + if(ita.next().name.equalsIgnoreCase(name)) + ita.remove(); + } + save(); + } + + public void addData(String name){ + if(getData(name) != null || name.isEmpty()) + return; + + LinkedData data = new LinkedData(); + data.name = name; + list.add(data); + save(); + } +} diff --git a/src/main/java/noppes/npcs/controllers/PixelmonHelper.java b/src/main/java/noppes/npcs/controllers/PixelmonHelper.java new file mode 100644 index 000000000..24508bc46 --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/PixelmonHelper.java @@ -0,0 +1,319 @@ +package noppes.npcs.controllers; + +import java.lang.reflect.Array; +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.client.Minecraft; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityList; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.passive.EntityTameable; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ChatComponentText; +import net.minecraft.world.World; +import noppes.npcs.LogWriter; +import noppes.npcs.constants.EnumJobType; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.JobSpawner; +import noppes.npcs.scripted.constants.JobType; + +import org.apache.logging.log4j.LogManager; + +import cpw.mods.fml.common.Loader; + +public class PixelmonHelper { + public static boolean Enabled = false; + + private static Object PokeballManager = null; + private static Method getPlayerStorage = null; + + private static Object ComputerManager = null; + private static Method getPlayerComputerStorage = null; + + private static Constructor attackByID = null; + private static Constructor attackByName = null; + private static Field baseAttack = null; + private static Field getAttackID = null; + private static Field getAttackName = null; + + private static Method getPixelmonModel = null; + + public static void load(){ + Enabled = Loader.isModLoaded("pixelmon"); + if(!Enabled) + return; + + try{ + Class c = Class.forName("com.pixelmonmod.pixelmon.storage.PixelmonStorage"); + PokeballManager = c.getField("PokeballManager").get(null); + ComputerManager = c.getField("ComputerManager").get(null); + + getPlayerStorage = PokeballManager.getClass().getMethod("getPlayerStorage", EntityPlayerMP.class); + getPlayerComputerStorage = ComputerManager.getClass().getMethod("getPlayerStorage", EntityPlayerMP.class); + + c = Class.forName("com.pixelmonmod.pixelmon.battles.attacks.Attack"); + attackByID = c.getConstructor(int.class); + attackByName = c.getConstructor(String.class); + baseAttack = c.getField("baseAttack"); + + c = Class.forName("com.pixelmonmod.pixelmon.battles.attacks.AttackBase"); + getAttackID = c.getField("attackIndex"); + getAttackName = c.getDeclaredField("attackName"); + + + c = Class.forName("com.pixelmonmod.pixelmon.entities.pixelmon.Entity2HasModel"); + getPixelmonModel = c.getMethod("getModel"); + } + catch(Exception e){ + LogWriter.except(e); + } + + } + + public static List getPixelmonList(){ + List list = new ArrayList(); + if(!Enabled) + return list; + try { + Class c = Class.forName("com.pixelmonmod.pixelmon.enums.EnumPokemon"); + Object[] array = c.getEnumConstants(); + for(Object ob : array) + list.add(ob.toString()); + + } catch (Exception e) { + LogManager.getLogger().error("getPixelmonList", e); + } + return list; + } + + public static boolean isPixelmon(Entity entity) { + if(!Enabled) + return false; + String s = EntityList.getEntityString(entity); + if(s == null) + return false; + return s.equals("pixelmon.Pixelmon"); + } + + public static void setName(EntityLivingBase entity, String name) { + if(!Enabled || !isPixelmon(entity)) + return; + try { + Method m = entity.getClass().getMethod("init", String.class); + m.invoke(entity, name); + + Class c = Class.forName("com.pixelmonmod.pixelmon.entities.pixelmon.Entity2HasModel"); + m = c.getDeclaredMethod("loadModel"); + m.setAccessible(true); + m.invoke(entity); + } catch (Exception e) { + LogManager.getLogger().error("setName", e); + } + } + + public static String getName(EntityLivingBase entity) { + if(!Enabled || !isPixelmon(entity)) + return ""; + try { + Method m = entity.getClass().getMethod("getName"); + return m.invoke(entity).toString(); + } catch (Exception e) { + LogManager.getLogger().error("getName", e); + } + return ""; + } + + + public static Object getModel(EntityLivingBase entity){ + try { + return getPixelmonModel.invoke(entity); + } catch (Exception e) { + LogManager.getLogger().error("getModel", e); + } + return null; + } + + + public static void debug(EntityLivingBase entity) { + if(!Enabled || !isPixelmon(entity)) + return; + try { + Method m = entity.getClass().getMethod("getModel"); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText((String) m.invoke(entity))); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public static boolean isTrainer(EntityLivingBase entity) { + if(!Enabled) + return false; + String s = EntityList.getEntityString(entity); + if(s == null) + return false; + return s.equals("pixelmon.Trainer"); + } + + public static boolean isBattling(EntityPlayerMP player) { + if(!Enabled) + return false; + try { + Class c = Class.forName("com.pixelmonmod.pixelmon.battles.BattleRegistry"); + Method m = c.getMethod("getBattle", EntityPlayer.class); + if(m.invoke(null, player) != null) + return false; + + return true; + } catch (Exception e) { + LogManager.getLogger().error("canBattle", e); + return false; + } + } + + public static boolean isBattling(EntityLivingBase trainer) { + if(!Enabled || !isTrainer(trainer)) + return false; + try { + Field f = trainer.getClass().getField("battleController"); + + return f.get(trainer) != null; + } catch (Exception e) { + LogManager.getLogger().error("canBattle", e); + return false; + } + } + + public static boolean canBattle(EntityPlayerMP player, EntityNPCInterface npc) { + if(!Enabled || npc.advanced.job != EnumJobType.Spawner || isBattling(player)) + return false; + try { + JobSpawner spawner = (JobSpawner) npc.jobInterface; + if(spawner.isOnCooldown(player.getCommandSenderName())) + return false; + + Object ob = getPlayerStorage.invoke(PokeballManager, player); + + Method m = ob.getClass().getMethod("countAblePokemon"); + + if((Integer) m.invoke(ob) == 0) + return false; + + return true; + } catch (Exception e) { + LogManager.getLogger().error("canBattle", e); + return false; + } + } + + public static EntityTameable pixelmonFromNBT(NBTTagCompound compound, EntityPlayer player){ + if(!Enabled) + return null; + + try { + Object ob = getPlayerStorage.invoke(PokeballManager, player); + return (EntityTameable) ob.getClass().getMethod("sendOut", NBTTagCompound.class, World.class).invoke(ob, compound, player); + } + catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + + public static NBTTagCompound getPartySlot(int i, EntityPlayer player){ + if(!Enabled) + return null; + + try { + Object ob = getPlayerStorage.invoke(PokeballManager, player); + NBTTagCompound[] party = (NBTTagCompound[]) ob.getClass().getFields()[0].get(ob); + return party[i]; + } + catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + public static boolean startBattle(EntityPlayerMP player, EntityLivingBase trainer) { + if(!Enabled) + return false; + try { + + Object ob = getPlayerStorage.invoke(PokeballManager, player); + + Class c = ob.getClass(); + + Method m = c.getMethod("getFirstAblePokemon", World.class); + Entity pixelmon = (Entity) m.invoke(ob, player.worldObj); + Class cEntity = Class.forName("com.pixelmonmod.pixelmon.entities.pixelmon.EntityPixelmon"); + m = c.getMethod("EntityAlreadyExists", cEntity); + if(!(Boolean)m.invoke(ob, pixelmon)){ + m = cEntity.getMethod("releaseFromPokeball"); + pixelmon.setPositionAndRotation(player.posX, player.posY, player.posZ, player.rotationYaw, 0); + } + + c = Class.forName("com.pixelmonmod.pixelmon.battles.controller.participants.TrainerParticipant"); + Object parTrainer = c.getConstructor(new Class[] {trainer.getClass(), EntityPlayer.class, int.class}).newInstance(trainer, player, 1); + + Object[] pixelmonArray = (Object[]) Array.newInstance(cEntity, 1); + pixelmonArray[0] = pixelmon; + + c = Class.forName("com.pixelmonmod.pixelmon.battles.controller.participants.PlayerParticipant"); + Object parPlayer = c.getConstructor(new Class[] {EntityPlayerMP.class, pixelmonArray.getClass()}).newInstance(player, pixelmonArray); + + cEntity = Class.forName("com.pixelmonmod.pixelmon.entities.pixelmon.Entity6CanBattle"); + c = Class.forName("com.pixelmonmod.pixelmon.battles.controller.participants.BattleParticipant"); + m = cEntity.getMethod("StartBattle", c, c); + m.invoke(pixelmon, parTrainer, parPlayer); + + return true; + } catch (Exception e) { + LogManager.getLogger().error("startBattle", e); + return false; + } + } + + public static int countPCPixelmon(EntityPlayerMP player) { + try { + Object ob = getPlayerComputerStorage.invoke(player); + return (Integer) ob.getClass().getMethod("count").invoke(ob); + } catch (Exception e) { + e.printStackTrace(); + } + return 0; + } + + public static String getAttackName(int id) { + try { + Object ob = attackByID.newInstance(id); + if(ob == null) + return null; + return getAttackName.get(baseAttack.get(ob)) + ""; + } + catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + public static int getAttackID(String name) { + try { + Object ob = attackByName.newInstance(name); + if(ob == null) + return -1; + return getAttackName.getInt(baseAttack.get(ob)); + } + catch (Exception e) { + e.printStackTrace(); + } + return -1; + } +} diff --git a/src/main/java/noppes/npcs/controllers/PlayerBankData.java b/src/main/java/noppes/npcs/controllers/PlayerBankData.java new file mode 100644 index 000000000..73907a414 --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/PlayerBankData.java @@ -0,0 +1,60 @@ +package noppes.npcs.controllers; + +import java.util.HashMap; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; + +public class PlayerBankData{ + public HashMap banks; + public PlayerBankData(){ + banks = new HashMap(); + } + + public void loadNBTData(NBTTagCompound compound) { + HashMap banks = new HashMap(); + NBTTagList list = compound.getTagList("BankData", 10); + if(list == null){ + return; + } + for(int i = 0; i < list.tagCount(); i++) + { + NBTTagCompound nbttagcompound = list.getCompoundTagAt(i); + BankData data = new BankData(); + data.readNBT(nbttagcompound); + banks.put(data.bankId, data); + } + this.banks = banks; + } + + public void saveNBTData(NBTTagCompound playerData){ + NBTTagList list = new NBTTagList(); + for(BankData data : banks.values()){ + NBTTagCompound nbttagcompound = new NBTTagCompound(); + data.writeNBT(nbttagcompound); + list.appendTag(nbttagcompound); + } + playerData.setTag("BankData", list); + } + + + public BankData getBank(int bankId) { + return banks.get(bankId); + } + public BankData getBankOrDefault(int bankId) { + BankData data = banks.get(bankId); + if(data != null) + return data; + Bank bank = BankController.getInstance().getBank(bankId); + return banks.get(bank.id); + } + public boolean hasBank(int bank) { + return banks.containsKey(bank); + } + public void loadNew(int bank) { + BankData data = new BankData(); + data.bankId = bank; + banks.put(bank, data); + + } +} diff --git a/src/main/java/noppes/npcs/controllers/PlayerData.java b/src/main/java/noppes/npcs/controllers/PlayerData.java new file mode 100644 index 000000000..675c0d089 --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/PlayerData.java @@ -0,0 +1,141 @@ +package noppes.npcs.controllers; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import net.minecraftforge.common.IExtendedEntityProperties; +import noppes.npcs.constants.EnumRoleType; +import noppes.npcs.entity.EntityCustomNpc; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.RoleCompanion; + +public class PlayerData implements IExtendedEntityProperties{ + public PlayerDialogData dialogData = new PlayerDialogData(); + public PlayerBankData bankData = new PlayerBankData(); + public PlayerQuestData questData = new PlayerQuestData(); + public PlayerTransportData transportData = new PlayerTransportData(); + public PlayerFactionData factionData = new PlayerFactionData(); + public PlayerItemGiverData itemgiverData = new PlayerItemGiverData(); + public PlayerMailData mailData = new PlayerMailData(); + + public EntityNPCInterface editingNpc; + public NBTTagCompound cloned; + + public EntityPlayer player; + + public String playername = ""; + public String uuid = ""; + + private EntityNPCInterface activeCompanion = null; + public int companionID = 0; + + @Override + public void saveNBTData(NBTTagCompound compound) { + PlayerDataController.instance.savePlayerData(this); + } + + @Override + public void loadNBTData(NBTTagCompound compound) { + NBTTagCompound data = PlayerDataController.instance.loadPlayerData(player.getPersistentID().toString()); + if(data.hasNoTags()){ + data = PlayerDataController.instance.loadPlayerDataOld(player.getCommandSenderName()); + } + setNBT(data); + } + + public void setNBT(NBTTagCompound data){ + dialogData.loadNBTData(data); + bankData.loadNBTData(data); + questData.loadNBTData(data); + transportData.loadNBTData(data); + factionData.loadNBTData(data); + itemgiverData.loadNBTData(data); + mailData.loadNBTData(data); + + + if(player != null){ + playername = player.getCommandSenderName(); + uuid = player.getPersistentID().toString(); + } + else{ + playername = data.getString("PlayerName"); + uuid = data.getString("UUID"); + } + companionID = data.getInteger("PlayerCompanionId"); + if(data.hasKey("PlayerCompanion") && !hasCompanion()){ + EntityCustomNpc npc = new EntityCustomNpc(player.worldObj); + npc.readEntityFromNBT(data.getCompoundTag("PlayerCompanion")); + npc.setPosition(player.posX, player.posY, player.posZ); + if(npc.advanced.role == EnumRoleType.Companion){ + setCompanion(npc); + ((RoleCompanion)npc.roleInterface).setSitting(false); + player.worldObj.spawnEntityInWorld(npc); + } + } + } + public NBTTagCompound getNBT() { + if(player != null){ + playername = player.getCommandSenderName(); + uuid = player.getPersistentID().toString(); + } + NBTTagCompound compound = new NBTTagCompound(); + dialogData.saveNBTData(compound); + bankData.saveNBTData(compound); + questData.saveNBTData(compound); + transportData.saveNBTData(compound); + factionData.saveNBTData(compound); + itemgiverData.saveNBTData(compound); + mailData.saveNBTData(compound); + + compound.setString("PlayerName", playername); + compound.setString("UUID", uuid); + compound.setInteger("PlayerCompanionId", companionID); + + if(hasCompanion()){ + NBTTagCompound nbt = new NBTTagCompound(); + if(activeCompanion.writeToNBTOptional(nbt)) + compound.setTag("PlayerCompanion", nbt); + } + return compound; + } + + @Override + public void init(Entity entity, World world) { + + } + + public boolean hasCompanion(){ + return activeCompanion != null && !activeCompanion.isDead; + } + + public void setCompanion(EntityNPCInterface npc) { + if(npc != null && npc.advanced.role != EnumRoleType.Companion)//shouldnt happen + return; + companionID++; + activeCompanion = npc; + if(npc != null) + ((RoleCompanion)npc.roleInterface).companionID = companionID; + saveNBTData(null); + } + + public void updateCompanion(World world) { + if(!hasCompanion() || world == activeCompanion.worldObj) + return; + RoleCompanion role = (RoleCompanion) activeCompanion.roleInterface; + role.owner = player; + if(!role.isFollowing()) + return; + NBTTagCompound nbt = new NBTTagCompound(); + activeCompanion.writeToNBTOptional(nbt); + activeCompanion.isDead = true; + + EntityCustomNpc npc = new EntityCustomNpc(world); + npc.readEntityFromNBT(nbt); + npc.setPosition(player.posX, player.posY, player.posZ); + setCompanion(npc); + ((RoleCompanion)npc.roleInterface).setSitting(false); + world.spawnEntityInWorld(npc); + } + +} diff --git a/src/main/java/noppes/npcs/controllers/PlayerDataController.java b/src/main/java/noppes/npcs/controllers/PlayerDataController.java new file mode 100644 index 000000000..4c72212d7 --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/PlayerDataController.java @@ -0,0 +1,181 @@ +package noppes.npcs.controllers; + +import java.io.EOFException; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.CompressedStreamTools; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.server.MinecraftServer; +import noppes.npcs.CustomNpcs; +import noppes.npcs.LogWriter; +import noppes.npcs.util.NBTJsonUtil; + +public class PlayerDataController { + public static PlayerDataController instance; + + public PlayerDataController(){ + instance = this; + } + public File getSaveDir(){ + try{ + File file = new File(CustomNpcs.getWorldSaveDirectory(),"playerdata"); + if(!file.exists()) + file.mkdir(); + return file; + } + catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + public NBTTagCompound loadPlayerDataOld(String player){ + File saveDir = getSaveDir(); + String filename = player; + if(filename.isEmpty()) + filename = "noplayername"; + filename += ".dat"; + try { + File file = new File(saveDir, filename); + if(file.exists()){ + NBTTagCompound comp = CompressedStreamTools.readCompressed(new FileInputStream(file)); + file.delete(); + file = new File(saveDir, filename+"_old"); + if(file.exists()) + file.delete(); + return comp; + } + } catch (Exception e) { + LogWriter.except(e); + } + try { + File file = new File(saveDir, filename+"_old"); + if(file.exists()){ + return CompressedStreamTools.readCompressed(new FileInputStream(file)); + } + + } catch (Exception e) { + LogWriter.except(e); + } + + return new NBTTagCompound(); + } + + public NBTTagCompound loadPlayerData(String player){ + File saveDir = getSaveDir(); + String filename = player; + if(filename.isEmpty()) + filename = "noplayername"; + filename += ".json"; + try { + File file = new File(saveDir, filename); + if(file.exists()){ + return NBTJsonUtil.LoadFile(file); + } + } catch (Exception e) { + LogWriter.error("Error loading: " + filename, e); + } + + return new NBTTagCompound(); + } + + public void savePlayerData(PlayerData data){ + NBTTagCompound compound = data.getNBT(); + String filename = data.uuid + ".json"; + try { + File saveDir = getSaveDir(); + File file = new File(saveDir, filename+"_new"); + File file1 = new File(saveDir, filename); + NBTJsonUtil.SaveFile(file, compound); + if(file1.exists()){ + file1.delete(); + } + file.renameTo(file1); + } catch (Exception e) { + LogWriter.except(e); + } + } + + public PlayerBankData getBankData(EntityPlayer player, int bankId) { + Bank bank = BankController.getInstance().getBank(bankId); + PlayerBankData data = getPlayerData(player).bankData; + if(!data.hasBank(bank.id)){ + data.loadNew(bank.id); + } + return data; + } + + public PlayerData getPlayerData(EntityPlayer player){ + PlayerData data = (PlayerData) player.getExtendedProperties("CustomNpcsData"); + if(data == null){ + player.registerExtendedProperties("CustomNpcsData", data = new PlayerData()); + data.player = player; + data.loadNBTData(null); + } + data.player = player; + return data; + } + public String hasPlayer(String username) { + for(String name : getUsernameData().keySet()){ + if(name.equalsIgnoreCase(username)) + return name; + } + + return ""; + } + + public PlayerData getDataFromUsername(String username){ + EntityPlayer player = MinecraftServer.getServer().getConfigurationManager().func_152612_a(username); + PlayerData data = null; + if(player == null){ + Map map = getUsernameData(); + for(String name : map.keySet()){ + if(name.equalsIgnoreCase(username)){ + data = new PlayerData(); + data.setNBT(map.get(name)); + break; + } + } + } + else + data = getPlayerData(player); + + return data; + } + + public void addPlayerMessage(String username, PlayerMail mail) { + mail.time = System.currentTimeMillis(); + + EntityPlayer player = MinecraftServer.getServer().getConfigurationManager().func_152612_a(username); + PlayerData data = getDataFromUsername(username); + data.mailData.playermail.add(mail.copy()); + savePlayerData(data); + } + + public Map getUsernameData(){ + Map map = new HashMap(); + for(File file : getSaveDir().listFiles()){ + if(file.isDirectory() || !file.getName().endsWith(".json")) + continue; + try { + NBTTagCompound compound = NBTJsonUtil.LoadFile(file); + if(compound.hasKey("PlayerName")){ + map.put(compound.getString("PlayerName"), compound); + } + } catch (Exception e) { + LogWriter.error("Error loading: " + file.getAbsolutePath(), e); + } + } + return map; + } + + public boolean hasMail(EntityPlayer player) { + return getPlayerData(player).mailData.hasMail(); + } +} diff --git a/src/main/java/noppes/npcs/controllers/PlayerDialogData.java b/src/main/java/noppes/npcs/controllers/PlayerDialogData.java new file mode 100644 index 000000000..386c83751 --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/PlayerDialogData.java @@ -0,0 +1,39 @@ +package noppes.npcs.controllers; + +import java.util.HashSet; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; + +public class PlayerDialogData{ + public HashSet dialogsRead = new HashSet(); + + public void loadNBTData(NBTTagCompound compound) { + HashSet dialogsRead = new HashSet(); + if(compound == null) + return; + NBTTagList list = compound.getTagList("DialogData", 10); + if(list == null){ + return; + } + + for(int i = 0; i < list.tagCount(); i++) + { + NBTTagCompound nbttagcompound = list.getCompoundTagAt(i); + dialogsRead.add(nbttagcompound.getInteger("Dialog")); + } + this.dialogsRead = dialogsRead; + } + + public void saveNBTData(NBTTagCompound compound) { + NBTTagList list = new NBTTagList(); + for(int dia : dialogsRead){ + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setInteger("Dialog", dia); + list.appendTag(nbttagcompound); + } + + compound.setTag("DialogData", list); + } + +} diff --git a/src/main/java/noppes/npcs/controllers/PlayerFactionData.java b/src/main/java/noppes/npcs/controllers/PlayerFactionData.java new file mode 100644 index 000000000..59d600710 --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/PlayerFactionData.java @@ -0,0 +1,74 @@ +package noppes.npcs.controllers; + +import java.util.HashMap; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; + +public class PlayerFactionData { + public HashMap factionData = new HashMap(); + + public void loadNBTData(NBTTagCompound compound) { + HashMap factionData = new HashMap(); + if(compound == null) + return; + NBTTagList list = compound.getTagList("FactionData", 10); + if(list == null){ + return; + } + + for(int i = 0; i < list.tagCount(); i++) + { + NBTTagCompound nbttagcompound = list.getCompoundTagAt(i); + factionData.put(nbttagcompound.getInteger("Faction"),nbttagcompound.getInteger("Points")); + } + this.factionData = factionData; + } + + public void saveNBTData(NBTTagCompound compound) { + NBTTagList list = new NBTTagList(); + for(int faction : factionData.keySet()){ + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setInteger("Faction", faction); + nbttagcompound.setInteger("Points", factionData.get(faction)); + list.appendTag(nbttagcompound); + } + + compound.setTag("FactionData", list); + } + + public int getFactionPoints(int id) { + if(!factionData.containsKey(id)){ + Faction faction = FactionController.getInstance().getFaction(id); + factionData.put(id, faction == null? -1 : faction.defaultPoints); + } + return factionData.get(id); + } + + public void increasePoints(int factionId, int points) { + if(!factionData.containsKey(factionId)){ + Faction faction = FactionController.getInstance().getFaction(factionId); + factionData.put(factionId, faction == null? -1 : faction.defaultPoints); + } + factionData.put(factionId, factionData.get(factionId) + points); + } + + public NBTTagCompound getPlayerGuiData(){ + NBTTagCompound compound = new NBTTagCompound(); + saveNBTData(compound); + + NBTTagList list = new NBTTagList(); + for(int id : factionData.keySet()){ + Faction faction = FactionController.getInstance().getFaction(id); + if(faction == null || faction.hideFaction) + continue; + NBTTagCompound com = new NBTTagCompound(); + faction.writeNBT(com); + list.appendTag(com); + } + compound.setTag("FactionList", list); + + return compound; + } + +} diff --git a/src/main/java/noppes/npcs/controllers/PlayerItemGiverData.java b/src/main/java/noppes/npcs/controllers/PlayerItemGiverData.java new file mode 100644 index 000000000..d13a637cb --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/PlayerItemGiverData.java @@ -0,0 +1,40 @@ +package noppes.npcs.controllers; + +import java.util.HashMap; + +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.NBTTags; +import noppes.npcs.roles.JobItemGiver; + +public class PlayerItemGiverData{ + private HashMap itemgivers = new HashMap(); + private HashMap chained = new HashMap(); + + public void loadNBTData(NBTTagCompound compound) { + chained = NBTTags.getIntegerIntegerMap(compound.getTagList("ItemGiverChained", 10)); + itemgivers = NBTTags.getIntegerLongMap(compound.getTagList("ItemGiversList", 10)); + } + + public void saveNBTData(NBTTagCompound compound) { + compound.setTag("ItemGiverChained", NBTTags.nbtIntegerIntegerMap(chained)); + compound.setTag("ItemGiversList", NBTTags.nbtIntegerLongMap(itemgivers)); + } + public boolean hasInteractedBefore(JobItemGiver jobItemGiver) { + return itemgivers.containsKey(jobItemGiver.itemGiverId); + } + + public long getTime(JobItemGiver jobItemGiver){ + return itemgivers.get(jobItemGiver.itemGiverId); + } + public void setTime(JobItemGiver jobItemGiver, long day) { + itemgivers.put(jobItemGiver.itemGiverId, day); + } + public int getItemIndex(JobItemGiver jobItemGiver) { + if(chained.containsKey(jobItemGiver.itemGiverId)) + return chained.get(jobItemGiver.itemGiverId); + return 0; + } + public void setItemIndex(JobItemGiver jobItemGiver, int i) { + chained.put(jobItemGiver.itemGiverId, i); + } +} diff --git a/src/main/java/noppes/npcs/controllers/PlayerMail.java b/src/main/java/noppes/npcs/controllers/PlayerMail.java new file mode 100644 index 000000000..25e87804c --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/PlayerMail.java @@ -0,0 +1,205 @@ +package noppes.npcs.controllers; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import noppes.npcs.NoppesUtilServer; +import noppes.npcs.NpcMiscInventory; + +public class PlayerMail implements IInventory{ + public String subject = ""; + public String sender = ""; + public NBTTagCompound message = new NBTTagCompound(); + public long time = 0; + public boolean beenRead = false; + public int questId = -1; + public String questTitle = ""; + public ItemStack[] items = new ItemStack[4]; + + public long timePast; + + public void readNBT(NBTTagCompound compound) { + subject = compound.getString("Subject"); + sender = compound.getString("Sender"); + time = compound.getLong("Time"); + beenRead = compound.getBoolean("BeenRead"); + message = compound.getCompoundTag("Message"); + timePast = compound.getLong("TimePast"); + if(compound.hasKey("MailQuest")) + questId = compound.getInteger("MailQuest"); + questTitle = compound.getString("MailQuestTitle"); + + this.items = new ItemStack[this.getSizeInventory()]; + + NBTTagList nbttaglist = compound.getTagList("MailItems", 10); + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { + NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); + int j = nbttagcompound1.getByte("Slot") & 255; + + if (j >= 0 && j < this.items.length) + { + this.items[j] = NoppesUtilServer.readItem(nbttagcompound1); + } + } + } + + public NBTTagCompound writeNBT() { + NBTTagCompound compound = new NBTTagCompound(); + compound.setString("Subject", subject); + compound.setString("Sender", sender); + compound.setLong("Time", time); + compound.setBoolean("BeenRead", beenRead); + compound.setTag("Message", message); + compound.setLong("TimePast", System.currentTimeMillis() - time); + compound.setInteger("MailQuest", questId); + + if(hasQuest()) + compound.setString("MailQuestTitle", getQuest().title); + + NBTTagList nbttaglist = new NBTTagList(); + + for (int i = 0; i < this.items.length; ++i) + { + if (this.items[i] != null) + { + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + nbttagcompound1.setByte("Slot", (byte)i); + NoppesUtilServer.writeItem(this.items[i], nbttagcompound1); + nbttaglist.appendTag(nbttagcompound1); + } + } + + compound.setTag("MailItems", nbttaglist); + return compound; + } + + public boolean isValid(){ + return !subject.isEmpty() && !message.hasNoTags() && !sender.isEmpty(); + } + + public boolean hasQuest() { + return getQuest() != null; + } + public Quest getQuest() { + return QuestController.instance != null?QuestController.instance.quests.get(questId):null; + } + + @Override + public int getSizeInventory() { + return 4; + } + + @Override + public int getInventoryStackLimit() { + return 64; + } + + @Override + public ItemStack getStackInSlot(int var1) { + return this.items[var1]; + } + + @Override + public ItemStack decrStackSize(int par1, int par2) { + if (this.items[par1] != null) + { + ItemStack itemstack; + + if (this.items[par1].stackSize <= par2) + { + itemstack = this.items[par1]; + this.items[par1] = null; + this.markDirty(); + return itemstack; + } + else + { + itemstack = this.items[par1].splitStack(par2); + + if (this.items[par1].stackSize == 0) + { + this.items[par1] = null; + } + + this.markDirty(); + return itemstack; + } + } + else + { + return null; + } + } + + @Override + public ItemStack getStackInSlotOnClosing(int var1) { + if (this.items[var1] != null) + { + ItemStack itemstack = this.items[var1]; + this.items[var1] = null; + return itemstack; + } + else + { + return null; + } + } + + @Override + public void setInventorySlotContents(int par1, ItemStack par2ItemStack) { + this.items[par1] = par2ItemStack; + + if (par2ItemStack != null && par2ItemStack.stackSize > this.getInventoryStackLimit()) + { + par2ItemStack.stackSize = this.getInventoryStackLimit(); + } + + this.markDirty(); + } + + @Override + public String getInventoryName() { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean hasCustomInventoryName() { + // TODO Auto-generated method stub + return false; + } + + @Override + public void markDirty() { + // TODO Auto-generated method stub + + } + + @Override + public boolean isUseableByPlayer(EntityPlayer var1) { + return true; + } + + @Override + public void openInventory() { + + } + + @Override + public void closeInventory() { + } + + @Override + public boolean isItemValidForSlot(int var1, ItemStack var2) { + return true; + } + + public PlayerMail copy() { + PlayerMail mail = new PlayerMail(); + mail.readNBT(writeNBT()); + return mail; + } +} diff --git a/src/main/java/noppes/npcs/controllers/PlayerMailData.java b/src/main/java/noppes/npcs/controllers/PlayerMailData.java new file mode 100644 index 000000000..eaaaad9e1 --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/PlayerMailData.java @@ -0,0 +1,42 @@ +package noppes.npcs.controllers; + +import java.util.ArrayList; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; + +public class PlayerMailData{ + public ArrayList playermail = new ArrayList(); + + public void loadNBTData(NBTTagCompound compound) { + ArrayList newmail = new ArrayList(); + NBTTagList list = compound.getTagList("MailData", 10); + if(list == null) + return; + + for(int i = 0; i < list.tagCount(); i++){ + PlayerMail mail = new PlayerMail(); + mail.readNBT(list.getCompoundTagAt(i)); + newmail.add(mail); + } + playermail = newmail; + } + + public NBTTagCompound saveNBTData(NBTTagCompound compound) { + NBTTagList list = new NBTTagList(); + + for(PlayerMail mail : playermail){ + list.appendTag(mail.writeNBT()); + } + + compound.setTag("MailData", list); + return compound; + } + + public boolean hasMail() { + for(PlayerMail mail : playermail) + if(!mail.beenRead) + return true; + return false; + } +} diff --git a/src/main/java/noppes/npcs/controllers/PlayerQuestController.java b/src/main/java/noppes/npcs/controllers/PlayerQuestController.java new file mode 100644 index 000000000..3c843d187 --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/PlayerQuestController.java @@ -0,0 +1,94 @@ +package noppes.npcs.controllers; + +import java.util.Vector; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import noppes.npcs.Server; +import noppes.npcs.constants.EnumPacketClient; +import noppes.npcs.constants.EnumQuestRepeat; +import noppes.npcs.constants.EnumQuestType; +import noppes.npcs.quests.QuestDialog; + +public class PlayerQuestController { + + public static boolean hasActiveQuests(EntityPlayer player){ + PlayerQuestData data = PlayerDataController.instance.getPlayerData(player).questData; + return !data.activeQuests.isEmpty(); + } + + public static boolean isQuestActive(EntityPlayer player, int quest){ + PlayerQuestData data = PlayerDataController.instance.getPlayerData(player).questData; + return data.activeQuests.containsKey(quest); + } + + public static boolean isQuestFinished(EntityPlayer player, int questid){ + PlayerQuestData data = PlayerDataController.instance.getPlayerData(player).questData; + return data.finishedQuests.containsKey(questid); + } + + public static void addActiveQuest(Quest quest, EntityPlayer player) { + PlayerQuestData data = PlayerDataController.instance.getPlayerData(player).questData; + if(canQuestBeAccepted(quest, player)){ + data.activeQuests.put(quest.id,new QuestData(quest)); + Server.sendData((EntityPlayerMP)player, EnumPacketClient.MESSAGE, "quest.newquest", quest.title); + Server.sendData((EntityPlayerMP)player, EnumPacketClient.CHAT, "quest.newquest", ": ", quest.title); + } + } + + public static void setQuestFinished(Quest quest, EntityPlayer player){ + PlayerData playerdata = PlayerDataController.instance.getPlayerData(player); + PlayerQuestData data = playerdata.questData; + data.activeQuests.remove(quest.id); + if(quest.repeat == EnumQuestRepeat.RLDAILY || quest.repeat == EnumQuestRepeat.RLWEEKLY) + data.finishedQuests.put(quest.id, System.currentTimeMillis()); + else + data.finishedQuests.put(quest.id,player.worldObj.getTotalWorldTime()); + if(quest.repeat != EnumQuestRepeat.NONE && quest.type == EnumQuestType.Dialog){ + QuestDialog questdialog = (QuestDialog) quest.questInterface; + for(int dialog : questdialog.dialogs.values()){ + playerdata.dialogData.dialogsRead.remove(dialog); + } + } + } + public static boolean canQuestBeAccepted(Quest quest, EntityPlayer player){ + if(quest == null) + return false; + + PlayerQuestData data = PlayerDataController.instance.getPlayerData(player).questData; + if(data.activeQuests.containsKey(quest.id)) + return false; + + if(!data.finishedQuests.containsKey(quest.id) || quest.repeat == EnumQuestRepeat.REPEATABLE) + return true; + if(quest.repeat == EnumQuestRepeat.NONE) + return false; + + long questTime = data.finishedQuests.get(quest.id); + + if(quest.repeat == EnumQuestRepeat.MCDAILY){ + return player.worldObj.getTotalWorldTime() - questTime >= 24000; + } + else if(quest.repeat == EnumQuestRepeat.MCWEEKLY){ + return player.worldObj.getTotalWorldTime() - questTime >= 168000; + } + else if(quest.repeat == EnumQuestRepeat.RLDAILY){ + return System.currentTimeMillis() - questTime >= 86400000; + } + else if(quest.repeat == EnumQuestRepeat.RLWEEKLY){ + return System.currentTimeMillis() - questTime >= 604800000; + } + return false; + } + public static Vector getActiveQuests(EntityPlayer player) + { + Vector quests = new Vector(); + PlayerQuestData data = PlayerDataController.instance.getPlayerData(player).questData; + for(QuestData questdata: data.activeQuests.values()){ + if(questdata.quest == null) + continue; + quests.add(questdata.quest); + } + return quests; + } +} diff --git a/src/main/java/noppes/npcs/controllers/PlayerQuestData.java b/src/main/java/noppes/npcs/controllers/PlayerQuestData.java new file mode 100644 index 000000000..2450f1562 --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/PlayerQuestData.java @@ -0,0 +1,115 @@ +package noppes.npcs.controllers; + +import java.util.HashMap; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import noppes.npcs.Server; +import noppes.npcs.constants.EnumPacketClient; +import noppes.npcs.constants.EnumQuestCompletion; +import noppes.npcs.constants.EnumQuestType; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.quests.QuestInterface; + +public class PlayerQuestData { + public HashMap activeQuests = new HashMap(); + public HashMap finishedQuests = new HashMap(); + + public void loadNBTData(NBTTagCompound mainCompound) { + if(mainCompound == null) + return; + NBTTagCompound compound = mainCompound.getCompoundTag("QuestData"); + + NBTTagList list = compound.getTagList("CompletedQuests", 10); + if(list != null){ + HashMap finishedQuests = new HashMap(); + for(int i = 0; i < list.tagCount(); i++) + { + NBTTagCompound nbttagcompound = list.getCompoundTagAt(i); + finishedQuests.put(nbttagcompound.getInteger("Quest"),nbttagcompound.getLong("Date")); + } + this.finishedQuests = finishedQuests; + } + + NBTTagList list2 = compound.getTagList("ActiveQuests", 10); + if(list2 != null){ + HashMap activeQuests = new HashMap(); + for(int i = 0; i < list2.tagCount(); i++) + { + NBTTagCompound nbttagcompound = list2.getCompoundTagAt(i); + int id = nbttagcompound.getInteger("Quest"); + Quest quest = QuestController.instance.quests.get(id); + if(quest == null) + continue; + QuestData data = new QuestData(quest); + data.readEntityFromNBT(nbttagcompound); + activeQuests.put(id,data); + } + this.activeQuests = activeQuests; + } + + } + + public void saveNBTData(NBTTagCompound maincompound) { + NBTTagCompound compound = new NBTTagCompound(); + NBTTagList list = new NBTTagList(); + for(int quest : finishedQuests.keySet()){ + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setInteger("Quest", quest); + nbttagcompound.setLong("Date", finishedQuests.get(quest)); + list.appendTag(nbttagcompound); + } + + compound.setTag("CompletedQuests", list); + + NBTTagList list2 = new NBTTagList(); + for(int quest : activeQuests.keySet()){ + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setInteger("Quest", quest); + activeQuests.get(quest).writeEntityToNBT(nbttagcompound); + list2.appendTag(nbttagcompound); + } + + compound.setTag("ActiveQuests", list2); + + maincompound.setTag("QuestData", compound); + } + + public QuestData getQuestCompletion(EntityPlayer player,EntityNPCInterface npc) { + for(QuestData data : activeQuests.values()){ + Quest quest = data.quest; + if(quest != null && quest.completion == EnumQuestCompletion.Npc && quest.completerNpc.equals(npc.getCommandSenderName()) && quest.questInterface.isCompleted(player)){ + return data; + } + } + return null; + } + + public boolean checkQuestCompletion(EntityPlayer player,EnumQuestType type) { + boolean bo = false; + for(QuestData data : this.activeQuests.values()){ + if(data.quest.type != type && type != null) + continue; + + QuestInterface inter = data.quest.questInterface; + + if(inter.isCompleted(player)){ + if(!data.isCompleted){ + if(!data.quest.complete(player,data)){ + Server.sendData((EntityPlayerMP)player, EnumPacketClient.MESSAGE, "quest.completed", data.quest.title); + Server.sendData((EntityPlayerMP)player, EnumPacketClient.CHAT, "quest.completed",": ",data.quest.title); + } + data.isCompleted = true; + bo = true; + } + } + else + data.isCompleted = false; + } + return bo; + + } + +} diff --git a/src/main/java/noppes/npcs/controllers/PlayerTransportData.java b/src/main/java/noppes/npcs/controllers/PlayerTransportData.java new file mode 100644 index 000000000..57857f798 --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/PlayerTransportData.java @@ -0,0 +1,39 @@ +package noppes.npcs.controllers; + +import java.util.HashSet; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; + +public class PlayerTransportData{ + public HashSet transports = new HashSet(); + + public void loadNBTData(NBTTagCompound compound) { + HashSet dialogsRead = new HashSet(); + if(compound == null) + return; + NBTTagList list = compound.getTagList("TransportData", 10); + if(list == null){ + return; + } + + for(int i = 0; i < list.tagCount(); i++) + { + NBTTagCompound nbttagcompound = list.getCompoundTagAt(i); + dialogsRead.add(nbttagcompound.getInteger("Transport")); + } + this.transports = dialogsRead; + } + + public void saveNBTData(NBTTagCompound compound) { + NBTTagList list = new NBTTagList(); + for(int dia : transports){ + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setInteger("Transport", dia); + list.appendTag(nbttagcompound); + } + + compound.setTag("TransportData", list); + } + +} diff --git a/src/main/java/noppes/npcs/controllers/Quest.java b/src/main/java/noppes/npcs/controllers/Quest.java new file mode 100644 index 000000000..ddd8e2f73 --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/Quest.java @@ -0,0 +1,151 @@ +package noppes.npcs.controllers; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.ICompatibilty; +import noppes.npcs.NpcMiscInventory; +import noppes.npcs.Server; +import noppes.npcs.VersionCompatibility; +import noppes.npcs.constants.EnumPacketClient; +import noppes.npcs.constants.EnumQuestCompletion; +import noppes.npcs.constants.EnumQuestRepeat; +import noppes.npcs.constants.EnumQuestType; +import noppes.npcs.quests.QuestDialog; +import noppes.npcs.quests.QuestInterface; +import noppes.npcs.quests.QuestItem; +import noppes.npcs.quests.QuestKill; +import noppes.npcs.quests.QuestLocation; + +public class Quest implements ICompatibilty { + public int version = VersionCompatibility.ModRev; + public int id = -1; + public EnumQuestType type = EnumQuestType.Item; + public EnumQuestRepeat repeat = EnumQuestRepeat.NONE; + public EnumQuestCompletion completion = EnumQuestCompletion.Npc; + public String title = "default"; + public QuestCategory category; + public String logText = ""; + public String completeText = ""; + public String completerNpc = ""; + public int nextQuestid = -1; + public String nextQuestTitle = ""; + public PlayerMail mail = new PlayerMail(); + public String command = ""; + + public QuestInterface questInterface = new QuestItem(); + + public int rewardExp = 0; + public NpcMiscInventory rewardItems = new NpcMiscInventory(9); + public boolean randomReward = false; + public FactionOptions factionOptions = new FactionOptions(); + + + public void readNBT(NBTTagCompound compound) { + id = compound.getInteger("Id"); + readNBTPartial(compound); + } + public void readNBTPartial(NBTTagCompound compound) { + version = compound.getInteger("ModRev"); + VersionCompatibility.CheckAvailabilityCompatibility(this, compound); + + setType(EnumQuestType.values()[compound.getInteger("Type")]); + title = compound.getString("Title"); + logText = compound.getString("Text"); + completeText = compound.getString("CompleteText"); + completerNpc = compound.getString("CompleterNpc"); + command = compound.getString("QuestCommand"); + nextQuestid = compound.getInteger("NextQuestId"); + nextQuestTitle = compound.getString("NextQuestTitle"); + if(hasNewQuest()) + nextQuestTitle = getNextQuest().title; + else + nextQuestTitle = ""; + randomReward = compound.getBoolean("RandomReward"); + rewardExp = compound.getInteger("RewardExp"); + rewardItems.setFromNBT(compound.getCompoundTag("Rewards")); + + completion = EnumQuestCompletion.values()[compound.getInteger("QuestCompletion")]; + repeat = EnumQuestRepeat.values()[compound.getInteger("QuestRepeat")]; + + questInterface.readEntityFromNBT(compound); + + factionOptions.readFromNBT(compound.getCompoundTag("QuestFactionPoints")); + + mail.readNBT(compound.getCompoundTag("QuestMail")); + } + + public void setType(EnumQuestType questType) { + type = questType; + if(type == EnumQuestType.Item) + questInterface = new QuestItem(); + else if(type == EnumQuestType.Dialog) + questInterface = new QuestDialog(); + else if(type == EnumQuestType.Kill || type == EnumQuestType.AreaKill) + questInterface = new QuestKill(); + else if(type == EnumQuestType.Location) + questInterface = new QuestLocation(); + + if(questInterface != null) + questInterface.questId = id; + } + + public NBTTagCompound writeToNBT(NBTTagCompound compound) { + compound.setInteger("Id", id); + return writeToNBTPartial(compound); + } + public NBTTagCompound writeToNBTPartial(NBTTagCompound compound) { + compound.setInteger("ModRev", version); + compound.setInteger("Type", type.ordinal()); + compound.setString("Title", title); + compound.setString("Text", logText); + compound.setString("CompleteText", completeText); + compound.setString("CompleterNpc", completerNpc); + compound.setInteger("NextQuestId", nextQuestid); + compound.setString("NextQuestTitle", nextQuestTitle); + compound.setInteger("RewardExp", rewardExp); + compound.setTag("Rewards", rewardItems.getToNBT()); + compound.setString("QuestCommand", command); + compound.setBoolean("RandomReward", randomReward); + + compound.setInteger("QuestCompletion", completion.ordinal()); + compound.setInteger("QuestRepeat", repeat.ordinal()); + + this.questInterface.writeEntityToNBT(compound); + compound.setTag("QuestFactionPoints", factionOptions.writeToNBT(new NBTTagCompound())); + compound.setTag("QuestMail", mail.writeNBT()); + + return compound; + } + + public boolean hasNewQuest() + { + return getNextQuest() != null; + } + public Quest getNextQuest() + { + return QuestController.instance == null?null:QuestController.instance.quests.get(nextQuestid); + } + + public boolean complete(EntityPlayer player, QuestData data) { + if(completion == EnumQuestCompletion.Instant){ + Server.sendData((EntityPlayerMP)player, EnumPacketClient.QUEST_COMPLETION, data.quest.writeToNBT(new NBTTagCompound())); + return true; + } + return false; + } + public Quest copy(){ + Quest quest = new Quest(); + quest.readNBT(this.writeToNBT(new NBTTagCompound())); + return quest; + } + + @Override + public int getVersion() { + return version; + } + @Override + public void setVersion(int version) { + this.version = version; + } +} diff --git a/src/main/java/noppes/npcs/controllers/QuestCategory.java b/src/main/java/noppes/npcs/controllers/QuestCategory.java new file mode 100644 index 000000000..a20ef1699 --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/QuestCategory.java @@ -0,0 +1,46 @@ +package noppes.npcs.controllers; + +import java.util.HashMap; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; + +public class QuestCategory { + public HashMap quests; + public int id = -1; + public String title = ""; + + public QuestCategory(){ + quests = new HashMap(); + } + + public void readNBT(NBTTagCompound nbttagcompound) { + id = nbttagcompound.getInteger("Slot"); + title = nbttagcompound.getString("Title"); + NBTTagList dialogsList = nbttagcompound.getTagList("Dialogs", 10); + if(dialogsList != null){ + for(int ii = 0; ii < dialogsList.tagCount(); ii++) + { + NBTTagCompound nbttagcompound2 = dialogsList.getCompoundTagAt(ii); + Quest quest = new Quest(); + quest.readNBT(nbttagcompound2); + quest.category = this; + quests.put(quest.id, quest); + } + } + } + + public NBTTagCompound writeNBT(NBTTagCompound nbttagcompound) { + nbttagcompound.setInteger("Slot", id); + nbttagcompound.setString("Title", title); + NBTTagList dialogs = new NBTTagList(); + for(int dialogId : quests.keySet()){ + Quest quest = quests.get(dialogId); + dialogs.appendTag(quest.writeToNBT(new NBTTagCompound())); + } + + nbttagcompound.setTag("Dialogs", dialogs); + + return nbttagcompound; + } +} diff --git a/src/main/java/noppes/npcs/controllers/QuestController.java b/src/main/java/noppes/npcs/controllers/QuestController.java new file mode 100644 index 000000000..f25355d52 --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/QuestController.java @@ -0,0 +1,236 @@ +package noppes.npcs.controllers; + +import java.io.File; +import java.io.FileInputStream; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import net.minecraft.nbt.CompressedStreamTools; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import noppes.npcs.CustomNpcs; +import noppes.npcs.LogWriter; +import noppes.npcs.NoppesStringUtils; +import noppes.npcs.util.NBTJsonUtil; + +public class QuestController { + public HashMap categories = new HashMap(); + public HashMap quests = new HashMap(); + + public static QuestController instance; + + private int lastUsedCatID = 0; + private int lastUsedQuestID = 0; + + public QuestController(){ + instance = this; + } + + public void load(){ + categories.clear(); + quests.clear(); + + lastUsedCatID = 0; + lastUsedQuestID = 0; + + try { + File file = new File(CustomNpcs.getWorldSaveDirectory(), "quests.dat"); + if(file.exists()){ + loadCategoriesOld(file); + file.delete(); + file = new File(CustomNpcs.getWorldSaveDirectory(), "quests.dat_old"); + if(file.exists()) + file.delete(); + return; + } + } catch (Exception e) { + + } + + File dir = getDir(); + if(!dir.exists()){ + dir.mkdir(); + } + else{ + for(File file : dir.listFiles()){ + if(!file.isDirectory()) + continue; + QuestCategory category = loadCategoryDir(file); + Iterator ite = category.quests.keySet().iterator(); + while(ite.hasNext()){ + int id = ite.next(); + if(id > lastUsedQuestID) + lastUsedQuestID = id; + Quest quest = category.quests.get(id); + if(quests.containsKey(id)){ + LogWriter.error("Duplicate id " + quest.id + " from category " + category.title); + ite.remove(); + } + else{ + quests.put(id, quest); + } + } + lastUsedCatID++; + category.id = lastUsedCatID; + categories.put(category.id, category); + } + } + } + private QuestCategory loadCategoryDir(File dir) { + QuestCategory category = new QuestCategory(); + category.title = dir.getName(); + for(File file : dir.listFiles()){ + if(!file.isFile() || !file.getName().endsWith(".json")) + continue; + try{ + Quest quest = new Quest(); + quest.id = Integer.parseInt(file.getName().substring(0, file.getName().length() - 5)); + quest.readNBTPartial(NBTJsonUtil.LoadFile(file)); + category.quests.put(quest.id, quest); + quest.category = category; + } + catch(Exception e){ + LogWriter.error("Error loading: " + file.getAbsolutePath(), e); + } + } + return category; + } + private void loadCategoriesOld(File file) throws Exception{ + File dir = getDir(); + if(!dir.exists()){ + dir.mkdir(); + } + NBTTagCompound nbttagcompound1 = CompressedStreamTools.readCompressed(new FileInputStream(file)); + lastUsedCatID = nbttagcompound1.getInteger("lastID"); + lastUsedQuestID = nbttagcompound1.getInteger("lastQuestID"); + NBTTagList list = nbttagcompound1.getTagList("Data", 10); + if(list != null){ + for(int i = 0; i < list.tagCount(); i++) + { + QuestCategory category = new QuestCategory(); + category.readNBT(list.getCompoundTagAt(i)); + categories.put(category.id,category); + saveCategory(category); + Iterator> ita = category.quests.entrySet().iterator(); + while(ita.hasNext()){ + Map.Entry entry = ita.next(); + Quest quest = entry.getValue(); + quest.id = entry.getKey(); + quest.category = category; + if(quests.containsKey(quest.id)) + ita.remove(); + else{ + saveQuest(category.id, quest); + } + } + } + } + } + + + public void removeCategory(int category){ + QuestCategory cat = categories.get(category); + if(cat == null) + return; + File dir = new File(getDir(), cat.title); + if(!dir.delete()) + return; + for(int dia : cat.quests.keySet()) + quests.remove(dia); + categories.remove(category); + } + + public void saveCategory(QuestCategory category){ + category.title = NoppesStringUtils.cleanFileName(category.title); + if(categories.containsKey(category.id)){ + QuestCategory currentCategory = categories.get(category.id); + if(!currentCategory.title.equals(category.title)){ + while(containsCategoryName(category.title)) + category.title += "_"; + File newdir = new File(getDir(), category.title); + File olddir = new File(getDir(), currentCategory.title); + if(newdir.exists()) + return; + if(!olddir.renameTo(newdir)) + return; + } + category.quests = currentCategory.quests; + } + else{ + if(category.id < 0){ + lastUsedCatID++; + category.id = lastUsedCatID; + } + while(containsCategoryName(category.title)) + category.title += "_"; + File dir = new File(getDir(), category.title); + if(!dir.exists()) + dir.mkdirs(); + } + categories.put(category.id, category); + } + private boolean containsCategoryName(String name) { + name = name.toLowerCase(); + for(QuestCategory cat : categories.values()){ + if(cat.title.toLowerCase().equals(name)) + return true; + } + return false; + } + + private boolean containsQuestName(QuestCategory category, Quest quest) { + for(Quest q : category.quests.values()){ + if(q.id != quest.id && q.title.equalsIgnoreCase(quest.title)) + return true; + } + return false; + } + + public void saveQuest(int categoryID, Quest quest){ + QuestCategory category = categories.get(categoryID); + if(category == null) + return; + quest.category = category; + + while(containsQuestName(quest.category, quest)){ + quest.title = quest.title + "_"; + } + + if(quest.id < 0){ + lastUsedQuestID++; + quest.id = lastUsedQuestID; + } + quests.put(quest.id, quest); + category.quests.put(quest.id, quest); + + File dir = new File(getDir(), category.title); + if(!dir.exists()) + dir.mkdirs(); + + File file = new File(dir, quest.id + ".json_new"); + File file2 = new File(dir, quest.id + ".json"); + + try { + NBTJsonUtil.SaveFile(file, quest.writeToNBTPartial(new NBTTagCompound())); + if(file2.exists()) + file2.delete(); + file.renameTo(file2); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void removeQuest(Quest quest) { + File file = new File(new File(getDir(), quest.category.title), quest.id + ".json"); + if(!file.delete()) + return; + quests.remove(quest.id); + quest.category.quests.remove(quest.id); + } + + private File getDir(){ + return new File(CustomNpcs.getWorldSaveDirectory(), "quests"); + } + +} diff --git a/src/main/java/noppes/npcs/controllers/QuestData.java b/src/main/java/noppes/npcs/controllers/QuestData.java new file mode 100644 index 000000000..1c51ae2ae --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/QuestData.java @@ -0,0 +1,20 @@ +package noppes.npcs.controllers; + +import net.minecraft.nbt.NBTTagCompound; + +public class QuestData { + public Quest quest; + public boolean isCompleted; + public NBTTagCompound extraData = new NBTTagCompound(); + public QuestData(Quest quest){ + this.quest = quest; + } + public void writeEntityToNBT(NBTTagCompound nbttagcompound){ + nbttagcompound.setBoolean("QuestCompleted", isCompleted); + nbttagcompound.setTag("ExtraData", extraData); + } + public void readEntityFromNBT(NBTTagCompound nbttagcompound){ + isCompleted = nbttagcompound.getBoolean("QuestCompleted"); + extraData = nbttagcompound.getCompoundTag("ExtraData"); + } +} diff --git a/src/main/java/noppes/npcs/controllers/RecipeCarpentry.java b/src/main/java/noppes/npcs/controllers/RecipeCarpentry.java new file mode 100644 index 000000000..243332d7b --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/RecipeCarpentry.java @@ -0,0 +1,225 @@ +package noppes.npcs.controllers; + +import java.util.HashMap; + +import net.minecraft.block.Block; +import net.minecraft.inventory.InventoryCrafting; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.item.crafting.ShapedRecipes; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import noppes.npcs.NBTTags; +import noppes.npcs.NoppesUtilPlayer; +import noppes.npcs.NoppesUtilServer; + +public class RecipeCarpentry extends ShapedRecipes{ + public int id = -1; + public String name = ""; + public Availability availability = new Availability(); + public boolean isGlobal = false; + public boolean ignoreDamage = false; + public boolean ignoreNBT = false; + + + public RecipeCarpentry(int width, int height, ItemStack[] recipe, ItemStack result){ + super(width, height, recipe, result); + } + public RecipeCarpentry(String name){ + super(0, 0, new ItemStack[0], null); + this.name = name; + } + + public static RecipeCarpentry read(NBTTagCompound compound){ + RecipeCarpentry recipe = new RecipeCarpentry(compound.getInteger("Width"), compound.getInteger("Height"), + NBTTags.getItemStackArray(compound.getTagList("Materials", 10)), NoppesUtilServer.readItem(compound.getCompoundTag("Item"))); + recipe.name = compound.getString("Name"); + recipe.id = compound.getInteger("ID"); + recipe.availability.readFromNBT(compound.getCompoundTag("Availability")); + recipe.ignoreDamage = compound.getBoolean("IgnoreDamage"); + recipe.ignoreNBT = compound.getBoolean("IgnoreNBT"); + recipe.isGlobal = compound.getBoolean("Global"); + + return recipe; + } + + public NBTTagCompound writeNBT() { + NBTTagCompound compound = new NBTTagCompound(); + compound.setInteger("ID", id); + compound.setInteger("Width", recipeWidth); + compound.setInteger("Height", recipeHeight); + if(getRecipeOutput() != null) + compound.setTag("Item", NoppesUtilServer.writeItem(getRecipeOutput(), new NBTTagCompound())); + compound.setTag("Materials", NBTTags.nbtItemStackArray(recipeItems)); + compound.setTag("Availability", availability.writeToNBT(new NBTTagCompound())); + compound.setString("Name", name); + compound.setBoolean("Global", isGlobal); + compound.setBoolean("IgnoreDamage", ignoreDamage); + compound.setBoolean("IgnoreNBT", ignoreNBT); + return compound; + } + + @Override + public boolean matches(InventoryCrafting par1InventoryCrafting, World world) { + for (int i = 0; i <= 4 - this.recipeWidth; ++i){ + for (int j = 0; j <= 4 - this.recipeHeight; ++j){ + if (this.checkMatch(par1InventoryCrafting, i, j, true)) + return true; + + if (this.checkMatch(par1InventoryCrafting, i, j, false)) + return true; + } + } + return false; + } + + + + /** + * Checks if the region of a crafting inventory is match for the recipe. + */ + private boolean checkMatch(InventoryCrafting par1InventoryCrafting, int par2, int par3, boolean par4){ + for (int i = 0; i < 4; i++){ + for (int j = 0; j < 4; j++){ + int var7 = i - par2; + int var8 = j - par3; + ItemStack var9 = null; + + if (var7 >= 0 && var8 >= 0 && var7 < this.recipeWidth && var8 < this.recipeHeight){ + if (par4) + var9 = this.recipeItems[this.recipeWidth - var7 - 1 + var8 * this.recipeWidth]; + else + var9 = this.recipeItems[var7 + var8 * this.recipeWidth]; + } + + ItemStack var10 = par1InventoryCrafting.getStackInRowAndColumn(i, j); + + if ((var10 != null || var9 != null) && !NoppesUtilPlayer.compareItems(var9, var10, ignoreDamage, ignoreNBT)){ + return false; + } + } + } + + return true; + } + + @Override + public ItemStack getCraftingResult(InventoryCrafting var1) { + if(getRecipeOutput() == null) + return null; + return getRecipeOutput().copy(); + } + + @Override + public int getRecipeSize() { + return 16; + } + + public static RecipeCarpentry saveRecipe(RecipeCarpentry recipe, ItemStack par1ItemStack, Object ... par2ArrayOfObj){ + String var3 = ""; + int var4 = 0; + int var5 = 0; + int var6 = 0; + int var9; + + if (par2ArrayOfObj[var4] instanceof String[]) + { + String[] var7 = (String[])((String[])par2ArrayOfObj[var4++]); + String[] var8 = var7; + var9 = var7.length; + + for (int var10 = 0; var10 < var9; ++var10) + { + String var11 = var8[var10]; + ++var6; + var5 = var11.length(); + var3 = var3 + var11; + } + } + else + { + while (par2ArrayOfObj[var4] instanceof String) + { + String var13 = (String)par2ArrayOfObj[var4++]; + ++var6; + var5 = var13.length(); + var3 = var3 + var13; + } + } + + HashMap var14; + + for (var14 = new HashMap(); var4 < par2ArrayOfObj.length; var4 += 2) + { + Character var16 = (Character)par2ArrayOfObj[var4]; + ItemStack var17 = null; + + if (par2ArrayOfObj[var4 + 1] instanceof Item) + { + var17 = new ItemStack((Item)par2ArrayOfObj[var4 + 1]); + } + else if (par2ArrayOfObj[var4 + 1] instanceof Block) + { + var17 = new ItemStack((Block)par2ArrayOfObj[var4 + 1], 1, -1); + } + else if (par2ArrayOfObj[var4 + 1] instanceof ItemStack) + { + var17 = (ItemStack)par2ArrayOfObj[var4 + 1]; + } + + var14.put(var16, var17); + } + + ItemStack[] var15 = new ItemStack[var5 * var6]; + + for (var9 = 0; var9 < var5 * var6; ++var9) + { + char var18 = var3.charAt(var9); + + if (var14.containsKey(Character.valueOf(var18))) + { + var15[var9] = ((ItemStack)var14.get(Character.valueOf(var18))).copy(); + } + else + { + var15[var9] = null; + } + } + RecipeCarpentry newrecipe = new RecipeCarpentry(var5, var6, var15, par1ItemStack); + newrecipe.copy(recipe); + if(var5 == 4 || var6 == 4) + newrecipe.isGlobal = false; + + + + return newrecipe; + } + public void copy(RecipeCarpentry recipe) { + this.id = recipe.id; + this.name = recipe.name; + this.availability = recipe.availability; + this.isGlobal = recipe.isGlobal; + this.ignoreDamage = recipe.ignoreDamage; + this.ignoreNBT = recipe.ignoreNBT; + } + + public ItemStack getCraftingItem(int i){ + if(recipeItems == null || i >= recipeItems.length) + return null; + return recipeItems[i]; + } + public void setCraftingItem(int i, ItemStack item){ + if(i < recipeItems.length) + recipeItems[i] = item; + } + public boolean isValid() { + if(recipeItems.length == 0 || getRecipeOutput() == null) + return false; + for(ItemStack item : recipeItems){ + if(item != null) + return true; + } + return false; + } +} diff --git a/src/main/java/noppes/npcs/controllers/RecipeController.java b/src/main/java/noppes/npcs/controllers/RecipeController.java new file mode 100644 index 000000000..cbe56242a --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/RecipeController.java @@ -0,0 +1,217 @@ +package noppes.npcs.controllers; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; + +import net.minecraft.inventory.InventoryCrafting; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.CraftingManager; +import net.minecraft.nbt.CompressedStreamTools; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import noppes.npcs.CustomNpcs; + +public class RecipeController { + private static Collection prevRecipes; + public HashMap globalRecipes = new HashMap(); + public HashMap anvilRecipes = new HashMap(); + public static RecipeController instance; + + public static final int version = 1; + public int nextId = 1; + + public static HashMap syncRecipes = new HashMap(); + + public RecipeController(){ + instance = this; + } + public void load(){ + loadCategories(); + reloadGlobalRecipes(globalRecipes); + } + public static void reloadGlobalRecipes(HashMap globalRecipes){ + List list = CraftingManager.getInstance().getRecipeList(); + if(prevRecipes != null){ + list.removeAll(prevRecipes); + } + + prevRecipes = new HashSet(); + for(RecipeCarpentry recipe : globalRecipes.values()){ + if(recipe.isValid()) + prevRecipes.add(recipe); + } + list.addAll(prevRecipes); + } + + private void loadCategories(){ + File saveDir = CustomNpcs.getWorldSaveDirectory(); + try { + File file = new File(saveDir, "recipes.dat"); + if(file.exists()){ + loadCategories(file); + } + else{ + globalRecipes.clear(); + anvilRecipes.clear(); + loadDefaultRecipes(-1); + } + } catch (Exception e) { + e.printStackTrace(); + try { + File file = new File(saveDir, "recipes.dat_old"); + if(file.exists()){ + loadCategories(file); + } + } catch (Exception ee) { + e.printStackTrace(); + } + } + } + private void loadDefaultRecipes(int i) { + if(i == version) + return; + RecipesDefault.loadDefaultRecipes(i); + saveCategories(); + } + + private void loadCategories(File file) throws Exception{ + NBTTagCompound nbttagcompound1 = CompressedStreamTools.readCompressed(new FileInputStream(file)); + nextId = nbttagcompound1.getInteger("LastId"); + NBTTagList list = nbttagcompound1.getTagList("Data", 10); + HashMap globalRecipes = new HashMap(); + HashMap anvilRecipes = new HashMap(); + if(list != null){ + for(int i = 0; i < list.tagCount(); i++) + { + RecipeCarpentry recipe = RecipeCarpentry.read(list.getCompoundTagAt(i)); + if(recipe.isGlobal) + globalRecipes.put(recipe.id,recipe); + else + anvilRecipes.put(recipe.id,recipe); + if(recipe.id > nextId) + nextId = recipe.id; + } + } + this.anvilRecipes = anvilRecipes; + this.globalRecipes = globalRecipes; + loadDefaultRecipes(nbttagcompound1.getInteger("Version")); + } + private void saveCategories(){ + try { + File saveDir = CustomNpcs.getWorldSaveDirectory(); + NBTTagList list = new NBTTagList(); + for(RecipeCarpentry recipe : globalRecipes.values()){ + list.appendTag(recipe.writeNBT()); + } + for(RecipeCarpentry recipe : anvilRecipes.values()){ + list.appendTag(recipe.writeNBT()); + } + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setTag("Data", list); + nbttagcompound.setInteger("LastId", nextId); + nbttagcompound.setInteger("Version", version); + File file = new File(saveDir, "recipes.dat_new"); + File file1 = new File(saveDir, "recipes.dat_old"); + File file2 = new File(saveDir, "recipes.dat"); + CompressedStreamTools.writeCompressed(nbttagcompound, new FileOutputStream(file)); + if(file1.exists()) + { + file1.delete(); + } + file2.renameTo(file1); + if(file2.exists()) + { + file2.delete(); + } + file.renameTo(file2); + if(file.exists()) + { + file.delete(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + public RecipeCarpentry findMatchingRecipe(InventoryCrafting par1InventoryCrafting){ + for(RecipeCarpentry recipe : anvilRecipes.values()){ + if(recipe.isValid() && recipe.matches(par1InventoryCrafting,null)) + return recipe; + } + return null; + } + + public RecipeCarpentry getRecipe(int id) { + if(globalRecipes.containsKey(id)) + return globalRecipes.get(id); + if(anvilRecipes.containsKey(id)) + return anvilRecipes.get(id); + return null; + } + + public RecipeCarpentry saveRecipe(NBTTagCompound compound) throws IOException { + RecipeCarpentry recipe = RecipeCarpentry.read(compound); + + RecipeCarpentry current = getRecipe(recipe.id); + if(current != null && !current.name.equals(recipe.name)){ + while(containsRecipeName(recipe.name)) + recipe.name += "_"; + } + + if(recipe.id == -1){ + recipe.id = getUniqueId(); + while(containsRecipeName(recipe.name)) + recipe.name += "_"; + } + if(recipe.isGlobal){ + anvilRecipes.remove(recipe.id); + globalRecipes.put(recipe.id, recipe); + } + else{ + globalRecipes.remove(recipe.id); + anvilRecipes.put(recipe.id, recipe); + } + saveCategories(); + reloadGlobalRecipes(globalRecipes); + return recipe; + } + + private int getUniqueId() { + return nextId++; + } + private boolean containsRecipeName(String name) { + name = name.toLowerCase(); + for(RecipeCarpentry recipe : globalRecipes.values()){ + if(recipe.name.toLowerCase().equals(name)) + return true; + } + for(RecipeCarpentry recipe : anvilRecipes.values()){ + if(recipe.name.toLowerCase().equals(name)) + return true; + } + return false; + } + + public RecipeCarpentry removeRecipe(int id) { + RecipeCarpentry recipe = getRecipe(id); + globalRecipes.remove(recipe.id); + anvilRecipes.remove(recipe.id); + saveCategories(); + reloadGlobalRecipes(globalRecipes); + return recipe; + } + public void addRecipe(RecipeCarpentry recipeAnvil) { + recipeAnvil.id = getUniqueId(); + if(!recipeAnvil.isGlobal) + RecipeController.instance.anvilRecipes.put(recipeAnvil.id, recipeAnvil); + else{ + RecipeController.instance.globalRecipes.put(recipeAnvil.id, recipeAnvil); + } + } +} diff --git a/src/main/java/noppes/npcs/controllers/RecipesDefault.java b/src/main/java/noppes/npcs/controllers/RecipesDefault.java new file mode 100644 index 000000000..629bbfd4e --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/RecipesDefault.java @@ -0,0 +1,188 @@ +package noppes.npcs.controllers; + +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import noppes.npcs.CustomItems; +import noppes.npcs.CustomNpcs; +public class RecipesDefault { + public static void addRecipe(String name, Object ob, boolean isGlobal, Object... recipe){ + ItemStack item; + if(ob instanceof Item) + item = new ItemStack((Item)ob); + else if(ob instanceof Block) + item = new ItemStack((Block)ob); + else + item = (ItemStack) ob; + + RecipeCarpentry recipeAnvil = new RecipeCarpentry(name); + recipeAnvil.isGlobal = isGlobal; + recipeAnvil = RecipeCarpentry.saveRecipe(recipeAnvil, item, recipe); + RecipeController.instance.addRecipe(recipeAnvil); + } + public static void loadDefaultRecipes(int i) { + if(i < 0){ + addRecipe("Npc Wand", CustomItems.wand, true, "XX"," Y"," Y",'X', Items.bread,'Y', Items.stick); + addRecipe("Mob Cloner", CustomItems.wand, true, "XX","XY"," Y",'X', Items.bread,'Y', Items.stick); + addRecipe("Carpentry Bench", CustomItems.carpentyBench, true, "XYX","Z Z","Z Z", 'X', Blocks.planks, 'Z', Items.stick, 'Y', Blocks.crafting_table); + + if(!CustomNpcs.DisableExtraItems){ + addRecipe("Mana", CustomItems.mana, true, "XY",'X',Items.redstone,'Y',Items.glowstone_dust); + addRecipe("Gun Wooden", CustomItems.gunWood, false, "XXXY"," ZM "," M ",'Y', Blocks.lever, 'M', Items.stick, 'Z', Blocks.stone_button,'X', Blocks.planks); + addRecipe("Gun Stone", CustomItems.gunStone, false, "XXXY"," ZM "," M ",'Y', Blocks.lever, 'M', Items.stick, 'Z', Blocks.stone_button,'X', Blocks.cobblestone); + addRecipe("Gun Iron", CustomItems.gunIron, false, "XXXY"," ZM "," M ",'Y', Blocks.lever, 'M', Items.stick, 'Z', Blocks.stone_button,'X', Items.iron_ingot); + addRecipe("Gun Gold", CustomItems.gunGold, false, "XXXY"," ZM "," M ",'Y', Blocks.lever, 'M', Items.stick, 'Z', Blocks.stone_button,'X', Items.gold_ingot); + addRecipe("Gun Diamond", CustomItems.gunDiamond, false, "XXXY"," ZM "," M ",'Y', Blocks.lever, 'M', Items.stick, 'Z', Blocks.stone_button,'X', Items.diamond); + addRecipe("Gun Emerald", CustomItems.gunEmerald, false, "XXXY"," ZM "," M ",'Y', Blocks.lever, 'M', Items.stick, 'Z', Blocks.stone_button,'X', Items.emerald); + addRecipe("Gun Bronze", CustomItems.gunBronze, false, "XXXY"," ZM "," M ",'Y', Blocks.lever, 'M', Items.stick, 'Z', Blocks.stone_button,'X', CustomItems.bronze_ingot); + + addRecipe("Bullet Wooden", CustomItems.bulletWood, true, "X",'X', Blocks.planks); + addRecipe("Bullet Stone", CustomItems.bulletStone, true, "X",'X', Blocks.cobblestone); + addRecipe("Bullet Iron", CustomItems.bulletIron, true, "X",'X', Items.iron_ingot); + addRecipe("Bullet Gold", CustomItems.bulletGold, true, "X",'X', Items.gold_ingot); + addRecipe("Bullet Diamond", CustomItems.bulletDiamond, true, "X",'X', Items.diamond); + addRecipe("Bullet Emerald", CustomItems.bulletEmerald, true, "X",'X', Items.emerald); + addRecipe("Bullet Bronze", CustomItems.bulletBronze, true, "X",'X', CustomItems.bronze_ingot); + } + } + if(i < 1){ + if(!CustomNpcs.DisableExtraBlock){ + addRecipe("WallBanner Wooden", new ItemStack(CustomItems.wallBanner, 1, 0), false, "XXX","ZZZ","ZZZ","Z Z",'Z', Blocks.wool, 'X', Blocks.planks); + addRecipe("WallBanner Stone", new ItemStack(CustomItems.wallBanner, 1, 1), false, "XXX","ZZZ","ZZZ","Z Z",'Z', Blocks.wool, 'X', Blocks.cobblestone); + addRecipe("WallBanner Iron", new ItemStack(CustomItems.wallBanner, 1, 2), false, "XXX","ZZZ","ZZZ","Z Z",'Z', Blocks.wool, 'X', Items.iron_ingot); + addRecipe("WallBanner Gold", new ItemStack(CustomItems.wallBanner, 1, 3), false, "XXX","ZZZ","ZZZ","Z Z",'Z', Blocks.wool, 'X', Items.gold_ingot); + addRecipe("WallBanner Diamond", new ItemStack(CustomItems.wallBanner, 1, 4), false, "XXX","ZZZ","ZZZ","Z Z",'Z', Blocks.wool, 'X', Items.diamond); + + addRecipe("Banner Wooden", new ItemStack(CustomItems.banner, 1, 0), false, " X "," Z "," Z ","ZZZ", 'X', new ItemStack(CustomItems.wallBanner,1,0), 'Z', Blocks.planks); + addRecipe("Banner Stone", new ItemStack(CustomItems.banner, 1, 1), false, " X "," Z "," Z ","ZZZ", 'X', new ItemStack(CustomItems.wallBanner,1,1), 'Z', Blocks.cobblestone); + addRecipe("Banner Iron", new ItemStack(CustomItems.banner, 1, 2), false, " X "," Z "," Z ","ZZZ", 'X', new ItemStack(CustomItems.wallBanner,1,2), 'Z', Items.iron_ingot); + addRecipe("Banner Gold", new ItemStack(CustomItems.banner, 1, 3), false, " X "," Z "," Z ","ZZZ", 'X', new ItemStack(CustomItems.wallBanner,1,3), 'Z', Items.gold_ingot); + addRecipe("Banner Diamond", new ItemStack(CustomItems.banner, 1, 4), false, " X "," Z "," Z ","ZZZ", 'X', new ItemStack(CustomItems.wallBanner,1,4), 'Z', Items.diamond); + + addRecipe("Lamp Wooden", new ItemStack(CustomItems.tallLamp, 1, 0), false, "YXY"," Z "," Z ","ZZZ", 'X', Blocks.torch, 'Y', Blocks.wool, 'Z', Blocks.planks); + addRecipe("Lamp Stone", new ItemStack(CustomItems.tallLamp, 1, 1), false, "YXY"," Z "," Z ","ZZZ", 'X', Blocks.torch, 'Y', Blocks.wool, 'Z', Blocks.cobblestone); + addRecipe("Lamp Iron", new ItemStack(CustomItems.tallLamp, 1, 2), false, "YXY"," Z "," Z ","ZZZ", 'X', Blocks.torch, 'Y', Blocks.wool, 'Z', Items.iron_ingot); + addRecipe("Lamp Gold", new ItemStack(CustomItems.tallLamp, 1, 3), false, "YXY"," Z "," Z ","ZZZ", 'X', Blocks.torch, 'Y', Blocks.wool, 'Z', Items.gold_ingot); + addRecipe("Lamp Diamond", new ItemStack(CustomItems.tallLamp, 1, 4), false, "YXY"," Z "," Z ","ZZZ", 'X', Blocks.torch, 'Y', Blocks.wool, 'Z', Items.diamond); + + addRecipe("Chair Wooden1", new ItemStack(CustomItems.chair, 1, 0), false, " X", " X","XXX","X X", 'X', new ItemStack(Blocks.planks,1,0)); + addRecipe("Chair Wooden2", new ItemStack(CustomItems.chair, 1, 1), false, " X", " X","XXX","X X", 'X', new ItemStack(Blocks.planks,1,1)); + addRecipe("Chair Wooden3", new ItemStack(CustomItems.chair, 1, 2), false, " X", " X","XXX","X X", 'X', new ItemStack(Blocks.planks,1,2)); + addRecipe("Chair Wooden4", new ItemStack(CustomItems.chair, 1, 3), false, " X", " X","XXX","X X", 'X', new ItemStack(Blocks.planks,1,3)); + addRecipe("Chair Wooden5", new ItemStack(CustomItems.chair, 1, 4), false, " X", " X","XXX","X X", 'X', new ItemStack(Blocks.planks,1,4)); + addRecipe("Chair Wooden6", new ItemStack(CustomItems.chair, 1, 5), false, " X", " X","XXX","X X", 'X', new ItemStack(Blocks.planks,1,5)); + + addRecipe("Crate Wooden1", new ItemStack(CustomItems.crate, 1, 0), false, "XXXX","X X","X X","XXXX", 'X', new ItemStack(Blocks.planks,1,0)); + addRecipe("Crate Wooden2", new ItemStack(CustomItems.crate, 1, 1), false, "XXXX","X X","X X","XXXX", 'X', new ItemStack(Blocks.planks,1,1)); + addRecipe("Crate Wooden3", new ItemStack(CustomItems.crate, 1, 2), false, "XXXX","X X","X X","XXXX", 'X', new ItemStack(Blocks.planks,1,2)); + addRecipe("Crate Wooden4", new ItemStack(CustomItems.crate, 1, 3), false, "XXXX","X X","X X","XXXX", 'X', new ItemStack(Blocks.planks,1,3)); + addRecipe("Crate Wooden5", new ItemStack(CustomItems.crate, 1, 4), false, "XXXX","X X","X X","XXXX", 'X', new ItemStack(Blocks.planks,1,4)); + addRecipe("Crate Wooden6", new ItemStack(CustomItems.crate, 1, 5), false, "XXXX","X X","X X","XXXX", 'X', new ItemStack(Blocks.planks,1,5)); + + addRecipe("WeaponRack Wooden1", new ItemStack(CustomItems.weaponsRack, 1, 0), false, "XXX","XYX","XYX","XXX", 'X', new ItemStack(Blocks.planks,1,0),'Y', Items.stick); + addRecipe("WeaponRack Wooden2", new ItemStack(CustomItems.weaponsRack, 1, 1), false, "XXX","XYX","XYX","XXX", 'X', new ItemStack(Blocks.planks,1,1),'Y', Items.stick); + addRecipe("WeaponRack Wooden3", new ItemStack(CustomItems.weaponsRack, 1, 2), false, "XXX","XYX","XYX","XXX", 'X', new ItemStack(Blocks.planks,1,2),'Y', Items.stick); + addRecipe("WeaponRack Wooden4", new ItemStack(CustomItems.weaponsRack, 1, 3), false, "XXX","XYX","XYX","XXX", 'X', new ItemStack(Blocks.planks,1,3),'Y', Items.stick); + addRecipe("WeaponRack Wooden5", new ItemStack(CustomItems.weaponsRack, 1, 4), false, "XXX","XYX","XYX","XXX", 'X', new ItemStack(Blocks.planks,1,4),'Y', Items.stick); + addRecipe("WeaponRack Wooden6", new ItemStack(CustomItems.weaponsRack, 1, 5), false, "XXX","XYX","XYX","XXX", 'X', new ItemStack(Blocks.planks,1,5),'Y', Items.stick); + + addRecipe("Couch Wooden1", new ItemStack(CustomItems.couchWood, 1, 0), false, " X"," X","XXXX","X X", 'X', new ItemStack(Blocks.planks,1,0)); + addRecipe("Couch Wooden2", new ItemStack(CustomItems.couchWood, 1, 1), false, " X"," X","XXXX","X X", 'X', new ItemStack(Blocks.planks,1,1)); + addRecipe("Couch Wooden3", new ItemStack(CustomItems.couchWood, 1, 2), false, " X"," X","XXXX","X X", 'X', new ItemStack(Blocks.planks,1,2)); + addRecipe("Couch Wooden4", new ItemStack(CustomItems.couchWood, 1, 3), false, " X"," X","XXXX","X X", 'X', new ItemStack(Blocks.planks,1,3)); + addRecipe("Couch Wooden5", new ItemStack(CustomItems.couchWood, 1, 4), false, " X"," X","XXXX","X X", 'X', new ItemStack(Blocks.planks,1,4)); + addRecipe("Couch Wooden6", new ItemStack(CustomItems.couchWood, 1, 5), false, " X"," X","XXXX","X X", 'X', new ItemStack(Blocks.planks,1,5)); + + addRecipe("Couch Wool1", new ItemStack(CustomItems.couchWool, 1, 0), false, " Z", " Z","ZZZZ","X X", 'X', new ItemStack(Blocks.planks,1,0), 'Z', Blocks.wool); + addRecipe("Couch Wool2", new ItemStack(CustomItems.couchWool, 1, 1), false, " Z", " Z","ZZZZ","X X", 'X', new ItemStack(Blocks.planks,1,1), 'Z', Blocks.wool); + addRecipe("Couch Wool3", new ItemStack(CustomItems.couchWool, 1, 2), false, " Z", " Z","ZZZZ","X X", 'X', new ItemStack(Blocks.planks,1,2), 'Z', Blocks.wool); + addRecipe("Couch Wool4", new ItemStack(CustomItems.couchWool, 1, 3), false, " Z", " Z","ZZZZ","X X", 'X', new ItemStack(Blocks.planks,1,3), 'Z', Blocks.wool); + addRecipe("Couch Wool5", new ItemStack(CustomItems.couchWool, 1, 4), false, " Z", " Z","ZZZZ","X X", 'X', new ItemStack(Blocks.planks,1,4), 'Z', Blocks.wool); + addRecipe("Couch Wool6", new ItemStack(CustomItems.couchWool, 1, 5), false, " Z", " Z","ZZZZ","X X", 'X', new ItemStack(Blocks.planks,1,5), 'Z', Blocks.wool); + + addRecipe("Table Wood1", new ItemStack(CustomItems.table, 1, 0), false, "XXXX","X X","X X", 'X', new ItemStack(Blocks.planks,1,0), 'Z', Blocks.wool); + addRecipe("Table Wood2", new ItemStack(CustomItems.table, 1, 1), false, "XXXX","X X","X X", 'X', new ItemStack(Blocks.planks,1,1), 'Z', Blocks.wool); + addRecipe("Table Wood3", new ItemStack(CustomItems.table, 1, 2), false, "XXXX","X X","X X", 'X', new ItemStack(Blocks.planks,1,2), 'Z', Blocks.wool); + addRecipe("Table Wood4", new ItemStack(CustomItems.table, 1, 3), false, "XXXX","X X","X X", 'X', new ItemStack(Blocks.planks,1,3), 'Z', Blocks.wool); + addRecipe("Table Wood5", new ItemStack(CustomItems.table, 1, 4), false, "XXXX","X X","X X", 'X', new ItemStack(Blocks.planks,1,4), 'Z', Blocks.wool); + addRecipe("Table Wood6", new ItemStack(CustomItems.table, 1, 5), false, "XXXX","X X","X X", 'X', new ItemStack(Blocks.planks,1,5), 'Z', Blocks.wool); + + addRecipe("Stool Wood1", new ItemStack(CustomItems.stool, 1, 0), false, "XXX"," X ","X X", 'X', new ItemStack(Blocks.planks,1,0)); + addRecipe("Stool Wood2", new ItemStack(CustomItems.stool, 1, 1), false, "XXX"," X ","X X", 'X', new ItemStack(Blocks.planks,1,1)); + addRecipe("Stool Wood3", new ItemStack(CustomItems.stool, 1, 2), false, "XXX"," X ","X X", 'X', new ItemStack(Blocks.planks,1,2)); + addRecipe("Stool Wood4", new ItemStack(CustomItems.stool, 1, 3), false, "XXX"," X ","X X", 'X', new ItemStack(Blocks.planks,1,3)); + addRecipe("Stool Wood5", new ItemStack(CustomItems.stool, 1, 4), false, "XXX"," X ","X X", 'X', new ItemStack(Blocks.planks,1,4)); + addRecipe("Stool Wood6", new ItemStack(CustomItems.stool, 1, 5), false, "XXX"," X ","X X", 'X', new ItemStack(Blocks.planks,1,5)); + + addRecipe("Barrel Wood1", new ItemStack(CustomItems.barrel, 1, 0), false, "XXX","X X","X X", "XXX", 'X', new ItemStack(Blocks.planks,1,0)); + addRecipe("Barrel Wood2", new ItemStack(CustomItems.barrel, 1, 1), false, "XXX","X X","X X", "XXX", 'X', new ItemStack(Blocks.planks,1,1)); + addRecipe("Barrel Wood3", new ItemStack(CustomItems.barrel, 1, 2), false, "XXX","X X","X X", "XXX", 'X', new ItemStack(Blocks.planks,1,2)); + addRecipe("Barrel Wood4", new ItemStack(CustomItems.barrel, 1, 3), false, "XXX","X X","X X", "XXX", 'X', new ItemStack(Blocks.planks,1,3)); + addRecipe("Barrel Wood5", new ItemStack(CustomItems.barrel, 1, 4), false, "XXX","X X","X X", "XXX", 'X', new ItemStack(Blocks.planks,1,4)); + addRecipe("Barrel Wood6", new ItemStack(CustomItems.barrel, 1, 5), false, "XXX","X X","X X", "XXX", 'X', new ItemStack(Blocks.planks,1,5)); + + addRecipe("Shelf Wood1", new ItemStack(CustomItems.shelf, 2, 0), false, "XXX","XY ","X ", 'Y', Items.stick, 'X', new ItemStack(Blocks.planks,1,0)); + addRecipe("Shelf Wood2", new ItemStack(CustomItems.shelf, 2, 1), false, "XXX","XY ","X ", 'Y', Items.stick, 'X', new ItemStack(Blocks.planks,1,1)); + addRecipe("Shelf Wood3", new ItemStack(CustomItems.shelf, 2, 2), false, "XXX","XY ","X ", 'Y', Items.stick, 'X', new ItemStack(Blocks.planks,1,2)); + addRecipe("Shelf Wood4", new ItemStack(CustomItems.shelf, 2, 3), false, "XXX","XY ","X ", 'Y', Items.stick, 'X', new ItemStack(Blocks.planks,1,3)); + addRecipe("Shelf Wood5", new ItemStack(CustomItems.shelf, 2, 4), false, "XXX","XY ","X ", 'Y', Items.stick, 'X', new ItemStack(Blocks.planks,1,4)); + addRecipe("Shelf Wood6", new ItemStack(CustomItems.shelf, 2, 5), false, "XXX","XY ","X ", 'Y', Items.stick, 'X', new ItemStack(Blocks.planks,1,5)); + + addRecipe("Beam Wood1", new ItemStack(CustomItems.beam, 2, 0), false, "XXX", "XXX", 'X', new ItemStack(Blocks.planks,1,0)); + addRecipe("Beam Wood2", new ItemStack(CustomItems.beam, 2, 1), false, "XXX", "XXX", 'X', new ItemStack(Blocks.planks,1,1)); + addRecipe("Beam Wood3", new ItemStack(CustomItems.beam, 2, 2), false, "XXX", "XXX", 'X', new ItemStack(Blocks.planks,1,2)); + addRecipe("Beam Wood4", new ItemStack(CustomItems.beam, 2, 3), false, "XXX", "XXX", 'X', new ItemStack(Blocks.planks,1,3)); + addRecipe("Beam Wood5", new ItemStack(CustomItems.beam, 2, 4), false, "XXX", "XXX", 'X', new ItemStack(Blocks.planks,1,4)); + addRecipe("Beam Wood6", new ItemStack(CustomItems.beam, 2, 5), false, "XXX", "XXX", 'X', new ItemStack(Blocks.planks,1,5)); + + addRecipe("Sign Wood1", new ItemStack(CustomItems.sign, 1, 0), false, "YYY", "XXX", "XXX", 'X', new ItemStack(Blocks.planks,1,0), 'Y', Items.iron_ingot); + addRecipe("Sign Wood2", new ItemStack(CustomItems.sign, 1, 1), false, "YYY", "XXX", "XXX", 'X', new ItemStack(Blocks.planks,1,1), 'Y', Items.iron_ingot); + addRecipe("Sign Wood3", new ItemStack(CustomItems.sign, 1, 2), false, "YYY", "XXX", "XXX", 'X', new ItemStack(Blocks.planks,1,2), 'Y', Items.iron_ingot); + addRecipe("Sign Wood4", new ItemStack(CustomItems.sign, 1, 3), false, "YYY", "XXX", "XXX", 'X', new ItemStack(Blocks.planks,1,3), 'Y', Items.iron_ingot); + addRecipe("Sign Wood5", new ItemStack(CustomItems.sign, 1, 4), false, "YYY", "XXX", "XXX", 'X', new ItemStack(Blocks.planks,1,4), 'Y', Items.iron_ingot); + addRecipe("Sign Wood6", new ItemStack(CustomItems.sign, 1, 5), false, "YYY", "XXX", "XXX", 'X', new ItemStack(Blocks.planks,1,5), 'Y', Items.iron_ingot); + + addRecipe("Lamp", new ItemStack(CustomItems.lamp), false, "XXX","YZY","XXX", 'X', Items.iron_ingot, 'Y', Blocks.glass, 'Z', Blocks.torch); + addRecipe("Candle", new ItemStack(CustomItems.candle), false, "XZX"," X ", 'X', Items.iron_ingot, 'Z', Blocks.torch); + addRecipe("BigSign", new ItemStack(CustomItems.bigsign, 2), false, "XXX","XXX","XXX", 'X', Blocks.planks); + + } + if(!CustomNpcs.DisableExtraItems){ + addRecipe("Battle Axe1", CustomItems.battleAxeWood, false, "XX","XY"," Y", " Y", 'Y', Items.stick, 'X', Blocks.planks); + addRecipe("Battle Axe2", CustomItems.battleAxeStone, false, "XX","XY"," Y", " Y", 'Y', Items.stick, 'X', Blocks.cobblestone); + addRecipe("Battle Axe3", CustomItems.battleAxeIron, false, "XX","XY"," Y", " Y", 'Y', Items.stick, 'X', Items.iron_ingot); + addRecipe("Battle Axe4", CustomItems.battleAxeGold, false, "XX","XY"," Y", " Y", 'Y', Items.stick, 'X', Items.gold_ingot); + addRecipe("Battle Axe5", CustomItems.battleAxeDiamond, false, "XX","XY"," Y", " Y", 'Y', Items.stick, 'X', Items.diamond); + addRecipe("Battle Axe6", CustomItems.battleAxeBronze, false, "XX","XY"," Y", " Y", 'Y', Items.stick, 'X', CustomItems.bronze_ingot); + addRecipe("Battle Axe7", CustomItems.battleAxeEmerald, false, "XX","XY"," Y", " Y", 'Y', Items.stick, 'X', Items.emerald); + + addRecipe("Halberd1", CustomItems.halberdWood, false, " X ","XYX"," Y ", " Y ", 'Y', Items.stick, 'X', Blocks.planks); + addRecipe("Halberd2", CustomItems.halberdStone, false, " X ","XYX"," Y ", " Y ", 'Y', Items.stick, 'X', Blocks.cobblestone); + addRecipe("Halberd3", CustomItems.halberdIron, false, " X ","XYX"," Y ", " Y ", 'Y', Items.stick, 'X', Items.iron_ingot); + addRecipe("Halberd4", CustomItems.halberdGold, false, " X ","XYX"," Y ", " Y ", 'Y', Items.stick, 'X', Items.gold_ingot); + addRecipe("Halberd5", CustomItems.halberdDiamond, false, " X ","XYX"," Y ", " Y ", 'Y', Items.stick, 'X', Items.diamond); + addRecipe("Halberd6", CustomItems.halberdBronze, false, " X ","XYX"," Y ", " Y ", 'Y', Items.stick, 'X', CustomItems.bronze_ingot); + addRecipe("Halberd7", CustomItems.halberdEmerald, false, " X ","XYX"," Y ", " Y ", 'Y', Items.stick, 'X', Items.emerald); + + addRecipe("Glaive1", CustomItems.glaiveWood, false, "X "," Y "," Y ", " X", 'Y', Items.stick, 'X', Blocks.planks); + addRecipe("Glaive2", CustomItems.glaiveStone, false, "X "," Y "," Y ", " X", 'Y', Items.stick, 'X', Blocks.cobblestone); + addRecipe("Glaive3", CustomItems.glaiveIron, false, "X "," Y "," Y ", " X", 'Y', Items.stick, 'X', Items.iron_ingot); + addRecipe("Glaive4", CustomItems.glaiveGold, false, "X "," Y "," Y ", " X", 'Y', Items.stick, 'X', Items.gold_ingot); + addRecipe("Glaive5", CustomItems.glaiveDiamond, false, "X "," Y "," Y ", " X", 'Y', Items.stick, 'X', Items.diamond); + addRecipe("Glaive6", CustomItems.glaiveBronze, false, "X "," Y "," Y ", " X", 'Y', Items.stick, 'X', CustomItems.bronze_ingot); + addRecipe("Glaive7", CustomItems.glaiveEmerald, false, "X "," Y "," Y ", " X", 'Y', Items.stick, 'X', Items.emerald); + + addRecipe("Trident1", CustomItems.tridentWood, false, "X X"," X "," Y ", " Y ", 'Y', Items.stick, 'X', Blocks.planks); + addRecipe("Trident2", CustomItems.tridentStone, false, "X X"," X "," Y ", " Y ", 'Y', Items.stick, 'X', Blocks.cobblestone); + addRecipe("Trident3", CustomItems.tridentIron, false, "X X"," X "," Y ", " Y ", 'Y', Items.stick, 'X', Items.iron_ingot); + addRecipe("Trident4", CustomItems.tridentGold, false, "X X"," X "," Y ", " Y ", 'Y', Items.stick, 'X', Items.gold_ingot); + addRecipe("Trident5", CustomItems.tridentDiamond, false, "X X"," X "," Y ", " Y ", 'Y', Items.stick, 'X', Items.diamond); + addRecipe("Trident6", CustomItems.tridentBronze, false, "X X"," X "," Y ", " Y ", 'Y', Items.stick, 'X', CustomItems.bronze_ingot); + addRecipe("Trident7", CustomItems.tridentEmerald, false, "X X"," X "," Y ", " Y ", 'Y', Items.stick, 'X', Items.emerald); + + } + } + } +} diff --git a/src/main/java/noppes/npcs/controllers/ScriptContainer.java b/src/main/java/noppes/npcs/controllers/ScriptContainer.java new file mode 100644 index 000000000..6b8d0aef2 --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/ScriptContainer.java @@ -0,0 +1,94 @@ +package noppes.npcs.controllers; + +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.List; + +import javax.script.Compilable; +import javax.script.CompiledScript; +import javax.script.ScriptEngine; +import javax.script.ScriptException; + +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.NBTTags; + +public class ScriptContainer { + public String fullscript = ""; + public String script = ""; + public String console = ""; + public boolean errored = false; + public List scripts = new ArrayList(); + private long lastCreated = 0; + private CompiledScript compScript = null; + private String currentScriptLanguage = null; + public ScriptEngine engine = null; + + public void readFromNBT(NBTTagCompound compound) { + script = compound.getString("Script"); + console = compound.getString("ScriptConsole"); + scripts = NBTTags.getStringList(compound.getTagList("ScriptList", 10)); + lastCreated = 0; + } + + public void writeToNBT(NBTTagCompound compound) { + compound.setString("Script", script); + compound.setString("ScriptConsole", console); + compound.setTag("ScriptList", NBTTags.nbtStringList(scripts)); + } + + public String getCode() { + if(ScriptController.Instance.lastLoaded > lastCreated){ + lastCreated = ScriptController.Instance.lastLoaded; + fullscript = script; + if(!fullscript.isEmpty()) + fullscript += "\n"; + for(String loc : scripts){ + String code = ScriptController.Instance.scripts.get(loc); + if(code != null && !code.isEmpty()) + fullscript += code + "\n"; + } + compScript = null; + } + return fullscript; + } + + public void run(ScriptEngine engine){ + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + engine.getContext().setWriter(pw); + engine.getContext().setErrorWriter(pw); + try { + if(compScript == null && engine instanceof Compilable) + compScript = ((Compilable)engine).compile(getCode()); + + if(compScript != null){ + compScript.eval(engine.getContext()); + } + else + engine.eval(getCode()); + + } catch (Exception e) { + errored = true; + appandConsole(e.getMessage()); + } + appandConsole(sw.getBuffer().toString().trim()); + } + + public void appandConsole(String message) { + if(message == null || message.isEmpty()) + return; + console = message + "\n" + console; + } + + public boolean hasCode() { + return !getCode().isEmpty(); + } + + public void setEngine(String scriptLanguage) { + if(currentScriptLanguage != null && currentScriptLanguage.equals(scriptLanguage)) + return; + engine = ScriptController.Instance.getEngineByName(scriptLanguage.toLowerCase()); + currentScriptLanguage = scriptLanguage; + } +} diff --git a/src/main/java/noppes/npcs/controllers/ScriptController.java b/src/main/java/noppes/npcs/controllers/ScriptController.java new file mode 100644 index 000000000..37f6df1e4 --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/ScriptController.java @@ -0,0 +1,215 @@ +package noppes.npcs.controllers; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.script.ScriptEngine; +import javax.script.ScriptEngineFactory; +import javax.script.ScriptEngineManager; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.monster.EntityMob; +import net.minecraft.entity.passive.EntityAnimal; +import net.minecraft.entity.passive.EntityTameable; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.nbt.NBTTagString; +import net.minecraft.server.MinecraftServer; +import net.minecraftforge.event.world.WorldEvent; +import noppes.npcs.CustomNpcs; +import noppes.npcs.LogWriter; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.scripted.ScriptAnimal; +import noppes.npcs.scripted.ScriptEntity; +import noppes.npcs.scripted.ScriptLiving; +import noppes.npcs.scripted.ScriptLivingBase; +import noppes.npcs.scripted.ScriptMonster; +import noppes.npcs.scripted.ScriptPixelmon; +import noppes.npcs.scripted.ScriptPlayer; +import noppes.npcs.scripted.ScriptWorld; +import noppes.npcs.util.NBTJsonUtil; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; + +public class ScriptController { + + public static ScriptController Instance; + public static boolean HasStart = false; + private ScriptEngineManager manager; + public Map languages = new HashMap(); + public Map scripts = new HashMap(); + public long lastLoaded = 0; + public File dir; + public NBTTagCompound compound = new NBTTagCompound(); + + private boolean loaded = false; + public boolean shouldSave = false; + + public ScriptController(){ + loaded = false; + Instance = this; + manager = new ScriptEngineManager(); + LogWriter.info("Script Engines Available:"); + for(ScriptEngineFactory fac : manager.getEngineFactories()){ + if(fac.getExtensions().isEmpty()) + continue; + fac.getScriptEngine(); + String ext = "." + fac.getExtensions().get(0).toLowerCase(); + LogWriter.info(fac.getLanguageName() + ": " + ext); + languages.put(fac.getLanguageName(), ext); + } + } + + private void loadCategories(){ + dir = new File(CustomNpcs.getWorldSaveDirectory(), "scripts"); + if(!dir.exists()) + dir.mkdir(); + if(!getSavedFile().exists()) + shouldSave = true; + new ScriptWorld(null).clearTempData(); + scripts.clear(); + for(String language : languages.keySet()){ + String ext = languages.get(language); + File scriptDir = new File(dir,language.toLowerCase()); + if(!scriptDir.exists()) + scriptDir.mkdir(); + else + loadDir(scriptDir, "", ext); + } + lastLoaded = System.currentTimeMillis(); + } + private void loadDir(File dir, String name, String ext){ + for(File file : dir.listFiles()){ + String filename = name + file.getName().toLowerCase(); + if(file.isDirectory()){ + loadDir(file, filename + "/", ext); + continue; + } + if(!filename.endsWith(ext)) + continue; + try { + scripts.put(filename, readFile(file)); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + public boolean loadStoredData(){ + loadCategories(); + File file = getSavedFile(); + try { + if(!file.exists()) + return false; + this.compound = NBTJsonUtil.LoadFile(file); + shouldSave = false; + } + catch (Exception e) { + LogWriter.error("Error loading: " + file.getAbsolutePath(), e); + return false; + } + return true; + } + + private File getSavedFile(){ + return new File(dir, "world_data.json"); + } + private String readFile(File file) throws IOException { + BufferedReader br = new BufferedReader(new FileReader(file)); + try { + StringBuilder sb = new StringBuilder(); + String line = br.readLine(); + + while (line != null) { + sb.append(line); + sb.append("\n"); + line = br.readLine(); + } + return sb.toString(); + } finally { + br.close(); + } + } + + public ScriptEngine getEngineByName(String language) { + return manager.getEngineByName(language); + } + + public NBTTagList nbtLanguages() { + NBTTagList list = new NBTTagList(); + for(String language : languages.keySet()){ + NBTTagCompound compound = new NBTTagCompound(); + NBTTagList scripts = new NBTTagList(); + for(String script : getScripts(language)){ + scripts.appendTag(new NBTTagString(script)); + } + compound.setTag("Scripts", scripts); + compound.setString("Language", language); + list.appendTag(compound); + } + return list; + } + + private List getScripts(String language){ + List list = new ArrayList(); + String ext = languages.get(language); + if(ext == null) + return list; + for(String script : scripts.keySet()){ + if(script.endsWith(ext)){ + list.add(script); + } + } + return list; + } + + public ScriptEntity getScriptForEntity(Entity entity) { + if(entity == null) + return null; + if(entity instanceof EntityNPCInterface) + return ((EntityNPCInterface) entity).script.dummyNpc; + else{ + ScriptEntityData data = (ScriptEntityData) entity.getExtendedProperties("ScriptedObject"); + if(data != null) + return data.base; + if(entity instanceof EntityPlayerMP) + data = new ScriptEntityData(new ScriptPlayer((EntityPlayerMP) entity)); + else if(PixelmonHelper.isPixelmon(entity)) + return new ScriptPixelmon((EntityTameable) entity); + else if(entity instanceof EntityAnimal) + data = new ScriptEntityData(new ScriptAnimal((EntityAnimal) entity)); + else if(entity instanceof EntityMob) + data = new ScriptEntityData(new ScriptMonster((EntityMob) entity)); + else if(entity instanceof EntityLiving) + data = new ScriptEntityData(new ScriptLiving((EntityLiving) entity)); + else if(entity instanceof EntityLivingBase) + data = new ScriptEntityData(new ScriptLivingBase((EntityLivingBase)entity)); + else + data = new ScriptEntityData(new ScriptEntity(entity)); + entity.registerExtendedProperties("ScriptedObject", data); + return data.base; + } + } + + @SubscribeEvent + public void saveWorld(WorldEvent.Save event){ + if(!shouldSave || event.world.isRemote || event.world != MinecraftServer.getServer().worldServers[0]) + return; + + try { + NBTJsonUtil.SaveFile(getSavedFile(), compound); + } + catch (Exception e) { + LogWriter.except(e); + } + + shouldSave = false; + } +} diff --git a/src/main/java/noppes/npcs/controllers/ScriptEntityData.java b/src/main/java/noppes/npcs/controllers/ScriptEntityData.java new file mode 100644 index 000000000..3f283f1f7 --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/ScriptEntityData.java @@ -0,0 +1,26 @@ +package noppes.npcs.controllers; + +import net.minecraft.entity.Entity; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import net.minecraftforge.common.IExtendedEntityProperties; +import noppes.npcs.scripted.ScriptEntity; + +public class ScriptEntityData implements IExtendedEntityProperties{ + public ScriptEntity base; + public ScriptEntityData(ScriptEntity base){ + this.base = base; + } + @Override + public void saveNBTData(NBTTagCompound compound) { + } + + @Override + public void loadNBTData(NBTTagCompound compound) { + } + + @Override + public void init(Entity entity, World world) { + } + +} diff --git a/src/main/java/noppes/npcs/controllers/ServerCloneController.java b/src/main/java/noppes/npcs/controllers/ServerCloneController.java new file mode 100644 index 000000000..e04f397ba --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/ServerCloneController.java @@ -0,0 +1,196 @@ +package noppes.npcs.controllers; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.minecraft.command.ICommandSender; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.CompressedStreamTools; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.util.ChatComponentText; +import noppes.npcs.CustomNpcs; +import noppes.npcs.LogWriter; +import noppes.npcs.controllers.LinkedNpcController.LinkedData; +import noppes.npcs.util.JsonException; +import noppes.npcs.util.NBTJsonUtil; + +public class ServerCloneController { + public static ServerCloneController Instance; + + public ServerCloneController(){ + loadClones(); + } + + private void loadClones(){ + try { + File dir = new File(getDir(), ".."); + File file = new File(dir, "clonednpcs.dat"); + System.out.println(file.getAbsolutePath()); + System.out.println(file.exists()); + if(file.exists()){ + Map> clones = loadOldClones(file); + file.delete(); + file = new File(dir, "clonednpcs.dat_old"); + if(file.exists()) + file.delete(); + + for(int tab : clones.keySet()){ + Map map = clones.get(tab); + for(String name: map.keySet()){ + saveClone(tab, name, map.get(name)); + } + } + } + } catch (Exception e) { + LogWriter.except(e); + } + } + + public File getDir(){ + File dir = new File(CustomNpcs.getWorldSaveDirectory(), "clones"); + if(!dir.exists()) + dir.mkdir(); + return dir; + } + + private Map> loadOldClones(File file) throws Exception{ + Map> clones = new HashMap>(); + NBTTagCompound nbttagcompound1 = CompressedStreamTools.readCompressed(new FileInputStream(file)); + NBTTagList list = nbttagcompound1.getTagList("Data", 10); + if(list == null){ + return clones; + } + for(int i = 0; i < list.tagCount(); i++) + { + NBTTagCompound compound = list.getCompoundTagAt(i); + if(!compound.hasKey("ClonedTab")){ + compound.setInteger("ClonedTab", 1); + } + + Map tab = clones.get(compound.getInteger("ClonedTab")); + if(tab == null) + clones.put(compound.getInteger("ClonedTab"), tab = new HashMap()); + + String name = compound.getString("ClonedName"); + int number = 1; + while(tab.containsKey(name)){ + number++; + name = String.format("%s%s", compound.getString("ClonedName"), number); + } + compound.removeTag("ClonedName"); + compound.removeTag("ClonedTab"); + compound.removeTag("ClonedDate"); + cleanTags(compound); + tab.put(name, compound); + } + return clones; + } + + public NBTTagCompound getCloneData(ICommandSender player, String name, int tab) { + File file = new File(new File(getDir(), tab + ""), name + ".json"); + if(!file.exists()){ + if(player != null) + player.addChatMessage(new ChatComponentText("Could not find clone file")); + return null; + } + try { + return NBTJsonUtil.LoadFile(file); + } catch (Exception e) { + LogWriter.error("Error loading: " + file.getAbsolutePath(), e); + if(player != null) + player.addChatMessage(new ChatComponentText(e.getMessage())); + } + return null; + } + + public void saveClone(int tab, String name, NBTTagCompound compound){ + try { + File dir = new File(getDir(), tab + ""); + if(!dir.exists()) + dir.mkdir(); + String filename = name + ".json"; + + File file = new File(dir, filename + "_new"); + File file2 = new File(dir, filename); + + NBTJsonUtil.SaveFile(file, compound); + if(file2.exists()){ + file2.delete(); + } + file.renameTo(file2); + } catch (Exception e) { + LogWriter.except(e); + } + } + public List getClones(int tab){ + List list = new ArrayList(); + File dir = new File(getDir(), tab + ""); + if(!dir.exists() || !dir.isDirectory()) + return list; + for(String file : dir.list()){ + if(file.endsWith(".json")) + list.add(file.substring(0, file.length() - 5)); + } + return list; + } + + public boolean removeClone(String name, int tab){ + File file = new File(new File(getDir(), tab + ""), name + ".json"); + if(!file.exists()) + return false; + file.delete(); + return true; + } + + public String addClone(NBTTagCompound nbttagcompound, String name, int tab) { + cleanTags(nbttagcompound); + saveClone(tab, name, nbttagcompound); + return name; + } + + public void cleanTags(NBTTagCompound nbttagcompound){ + if(nbttagcompound.hasKey("ItemGiverId")) + nbttagcompound.setInteger("ItemGiverId", 0); + if(nbttagcompound.hasKey("TransporterId")) + nbttagcompound.setInteger("TransporterId", -1); + + nbttagcompound.removeTag("StartPosNew"); + nbttagcompound.removeTag("StartPos"); + nbttagcompound.removeTag("MovingPathNew"); + nbttagcompound.removeTag("Pos"); + nbttagcompound.removeTag("Riding"); + + if(!nbttagcompound.hasKey("ModRev")) + nbttagcompound.setInteger("ModRev", 1); + + if(nbttagcompound.hasKey("TransformRole")){ + NBTTagCompound adv = nbttagcompound.getCompoundTag("TransformRole"); + adv.setInteger("TransporterId", -1); + nbttagcompound.setTag("TransformRole", adv); + } + + if(nbttagcompound.hasKey("TransformJob")){ + NBTTagCompound adv = nbttagcompound.getCompoundTag("TransformJob"); + adv.setInteger("ItemGiverId", 0); + nbttagcompound.setTag("TransformJob", adv); + } + + if(nbttagcompound.hasKey("TransformAI")){ + NBTTagCompound adv = nbttagcompound.getCompoundTag("TransformAI"); + adv.removeTag("StartPosNew"); + adv.removeTag("StartPos"); + adv.removeTag("MovingPathNew"); + nbttagcompound.setTag("TransformAI", adv); + } + } +} diff --git a/src/main/java/noppes/npcs/controllers/SpawnController.java b/src/main/java/noppes/npcs/controllers/SpawnController.java new file mode 100644 index 000000000..825422ed8 --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/SpawnController.java @@ -0,0 +1,192 @@ +package noppes.npcs.controllers; + +import java.io.BufferedInputStream; +import java.io.DataInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.zip.GZIPInputStream; + +import net.minecraft.nbt.CompressedStreamTools; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.util.WeightedRandom; +import noppes.npcs.CustomNpcs; +import noppes.npcs.LogWriter; + +public class SpawnController { + public HashMap> biomes = new HashMap>() ; + public ArrayList data = new ArrayList(); + public Random random = new Random(); + + public static SpawnController instance; + + private int lastUsedID = 0; + + public SpawnController(){ + instance = this; + loadData(); + + } + + private void loadData(){ + + File saveDir = CustomNpcs.getWorldSaveDirectory(); + if(saveDir == null){ + return; + } + try { + File file = new File(saveDir, "spawns.dat"); + if(file.exists()){ + loadDataFile(file); + } + } catch (Exception e) { + try { + File file = new File(saveDir, "spawns.dat_old"); + if(file.exists()){ + loadDataFile(file); + } + + } catch (Exception ee) { + } + } + } + + private void loadDataFile(File file) throws IOException{ + DataInputStream var1 = new DataInputStream(new BufferedInputStream(new GZIPInputStream(new FileInputStream(file)))); + loadData(var1); + var1.close(); + } + + public void loadData(DataInputStream stream) throws IOException{ + ArrayList data = new ArrayList(); + NBTTagCompound nbttagcompound1 = CompressedStreamTools.read(stream); + lastUsedID = nbttagcompound1.getInteger("lastID"); + NBTTagList nbtlist = nbttagcompound1.getTagList("NPCSpawnData", 10); + + if(nbtlist != null){ + for(int i = 0; i < nbtlist.tagCount(); i++) + { + NBTTagCompound nbttagcompound = nbtlist.getCompoundTagAt(i); + SpawnData spawn = new SpawnData(); + spawn.readNBT(nbttagcompound); + data.add(spawn); + } + } + this.data = data; + fillBiomeData(); + } + public NBTTagCompound getNBT(){ + NBTTagList list = new NBTTagList(); + for(SpawnData spawn : data){ + NBTTagCompound nbtfactions = new NBTTagCompound(); + spawn.writeNBT(nbtfactions); + list.appendTag(nbtfactions); + } + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setInteger("lastID", lastUsedID); + nbttagcompound.setTag("NPCSpawnData", list); + return nbttagcompound; + } + public void saveData(){ + try { + File saveDir = CustomNpcs.getWorldSaveDirectory(); + File file = new File(saveDir, "spawns.dat_new"); + File file1 = new File(saveDir, "spawns.dat_old"); + File file2 = new File(saveDir, "spawns.dat"); + CompressedStreamTools.writeCompressed(getNBT(), new FileOutputStream(file)); + if(file1.exists()) + { + file1.delete(); + } + file2.renameTo(file1); + if(file2.exists()) + { + file2.delete(); + } + file.renameTo(file2); + if(file.exists()) + { + file.delete(); + } + } catch (Exception e) { + LogWriter.except(e); + } + } + + public SpawnData getSpawnData(int id) { + for(SpawnData spawn : data) + if(spawn.id == id) + return spawn; + return null; + } + + public void saveSpawnData(SpawnData spawn) { + if(spawn.id < 0) + spawn.id = getUnusedId(); + SpawnData original = getSpawnData(spawn.id); + if(original == null) + data.add(spawn); + else{ + original.readNBT(spawn.writeNBT(new NBTTagCompound())); + } + fillBiomeData(); + saveData(); + } + + private void fillBiomeData(){ + HashMap> biomes = new HashMap>() ; + for(SpawnData spawn : data){ + for(String s : spawn.biomes){ + List list = biomes.get(s); + if(list == null) + biomes.put(s, (list = new ArrayList())); + list.add(spawn); + } + } + this.biomes = biomes; + } + + public int getUnusedId(){ + lastUsedID++; + return lastUsedID; + } + public void removeSpawnData(int id) { + ArrayList data = new ArrayList(); + + for(SpawnData spawn : this.data){ + if(spawn.id == id) + continue; + data.add(spawn); + } + this.data = data; + + fillBiomeData(); + saveData(); + } + + public List getSpawnList(String biome) { + return biomes.get(biome); + } + + public SpawnData getRandomSpawnData(String biome, boolean isAir) { + List list = getSpawnList(biome); + if(list == null || list.isEmpty()) + return null; + return (SpawnData) WeightedRandom.getRandomItem(this.random, list); + } + + public Map getScroll() { + Map map = new HashMap(); + for(SpawnData spawn : data){ + map.put(spawn.name, spawn.id); + } + return map; + } +} diff --git a/src/main/java/noppes/npcs/controllers/SpawnData.java b/src/main/java/noppes/npcs/controllers/SpawnData.java new file mode 100644 index 000000000..113937f4a --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/SpawnData.java @@ -0,0 +1,45 @@ +package noppes.npcs.controllers; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.WeightedRandom; +import noppes.npcs.NBTTags; + +public class SpawnData extends WeightedRandom.Item{ + public List biomes = new ArrayList(); + public int id = -1; + public String name = ""; + public NBTTagCompound compound1 = new NBTTagCompound(); + public boolean liquid = false; + + public SpawnData() { + super(10); + } + + public void readNBT(NBTTagCompound compound) { + id = compound.getInteger("SpawnId"); + name = compound.getString("SpawnName"); + itemWeight = compound.getInteger("SpawnWeight"); + if(itemWeight == 0) + itemWeight = 1; + + biomes = NBTTags.getStringList(compound.getTagList("SpawnBiomes", 10)); + + compound1 = compound.getCompoundTag("SpawnCompound1"); + + } + + public NBTTagCompound writeNBT(NBTTagCompound compound) { + compound.setInteger("SpawnId", id); + compound.setString("SpawnName", name); + compound.setInteger("SpawnWeight", itemWeight); + + compound.setTag("SpawnBiomes", NBTTags.nbtStringList(biomes)); + + compound.setTag("SpawnCompound1", compound1); + return compound; + } + +} diff --git a/src/main/java/noppes/npcs/controllers/TransformData.java b/src/main/java/noppes/npcs/controllers/TransformData.java new file mode 100644 index 000000000..4a41c4e37 --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/TransformData.java @@ -0,0 +1,245 @@ +package noppes.npcs.controllers; + +import java.util.Set; + +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.DataAI; +import noppes.npcs.DataAdvanced; +import noppes.npcs.DataDisplay; +import noppes.npcs.DataInventory; +import noppes.npcs.DataStats; +import noppes.npcs.NBTTags; +import noppes.npcs.NoppesUtilServer; +import noppes.npcs.constants.EnumAnimation; +import noppes.npcs.constants.EnumJobType; +import noppes.npcs.constants.EnumRoleType; +import noppes.npcs.entity.EntityCustomNpc; +import noppes.npcs.entity.EntityNPCInterface; + +public class TransformData { + public NBTTagCompound display; + public NBTTagCompound ai; + public NBTTagCompound advanced; + public NBTTagCompound inv; + public NBTTagCompound stats; + public NBTTagCompound role; + public NBTTagCompound job; + + public boolean hasDisplay, hasAi, hasAdvanced, hasInv, hasStats, hasRole, hasJob, isActive; + + private EntityNPCInterface npc; + + public boolean editingModus = false; + + public TransformData(EntityNPCInterface npc){ + this.npc = npc; + } + + + public NBTTagCompound writeToNBT(NBTTagCompound compound) { + compound.setBoolean("TransformIsActive", isActive); + writeOptions(compound); + if(hasDisplay) + compound.setTag("TransformDisplay", display); + if(hasAi) + compound.setTag("TransformAI", ai); + if(hasAdvanced) + compound.setTag("TransformAdvanced", advanced); + if(hasInv) + compound.setTag("TransformInv", inv); + if(hasStats) + compound.setTag("TransformStats", stats); + if(hasRole) + compound.setTag("TransformRole", role); + if(hasJob) + compound.setTag("TransformJob", job); + + return compound; + } + + public Object writeOptions(NBTTagCompound compound) { + compound.setBoolean("TransformHasDisplay", hasDisplay); + compound.setBoolean("TransformHasAI", hasAi); + compound.setBoolean("TransformHasAdvanced", hasAdvanced); + compound.setBoolean("TransformHasInv", hasInv); + compound.setBoolean("TransformHasStats", hasStats); + compound.setBoolean("TransformHasRole", hasRole); + compound.setBoolean("TransformHasJob", hasJob); + compound.setBoolean("TransformEditingModus", editingModus); + return compound; + } + + + public void readToNBT(NBTTagCompound compound) { + isActive = compound.getBoolean("TransformIsActive"); + readOptions(compound); + display = hasDisplay?compound.getCompoundTag("TransformDisplay"): getDisplay(); + ai = hasAi?compound.getCompoundTag("TransformAI"): npc.ai.writeToNBT(new NBTTagCompound()); + advanced = hasAdvanced?compound.getCompoundTag("TransformAdvanced"): getAdvanced(); + inv = hasInv?compound.getCompoundTag("TransformInv"): npc.inventory.writeEntityToNBT(new NBTTagCompound()); + stats = hasStats?compound.getCompoundTag("TransformStats"): npc.stats.writeToNBT(new NBTTagCompound()); + job = hasJob?compound.getCompoundTag("TransformJob"): getJob(); + role = hasRole?compound.getCompoundTag("TransformRole"): getRole(); + } + + public NBTTagCompound getJob() { + NBTTagCompound compound = new NBTTagCompound(); + + compound.setInteger("NpcJob", npc.advanced.job.ordinal()); + if (npc.advanced.job != EnumJobType.None && npc.jobInterface != null) { + npc.jobInterface.writeToNBT(compound); + } + + return compound; + } + public NBTTagCompound getRole() { + NBTTagCompound compound = new NBTTagCompound(); + + compound.setInteger("Role", npc.advanced.role.ordinal()); + if (npc.advanced.role != EnumRoleType.None && npc.roleInterface != null) { + npc.roleInterface.writeToNBT(compound); + } + + return compound; + } + + public NBTTagCompound getDisplay() { + NBTTagCompound compound = npc.display.writeToNBT(new NBTTagCompound()); + if(npc instanceof EntityCustomNpc){ + compound.setTag("ModelData", ((EntityCustomNpc)npc).modelData.writeToNBT()); + } + + return compound; + } + + public NBTTagCompound getAdvanced() { + EnumJobType jopType = npc.advanced.job; + EnumRoleType roleType = npc.advanced.role; + + npc.advanced.job = EnumJobType.None; + npc.advanced.role = EnumRoleType.None; + + NBTTagCompound compound = npc.advanced.writeToNBT(new NBTTagCompound()); + compound.removeTag("Role"); + compound.removeTag("NpcJob"); + + npc.advanced.job = jopType; + npc.advanced.role = roleType; + + return compound; + } + + + public void readOptions(NBTTagCompound compound){ + boolean hadDisplay = hasDisplay; + boolean hadAI = hasAi; + boolean hadAdvanced = hasAdvanced; + boolean hadInv = hasInv; + boolean hadStats = hasStats; + boolean hadRole = hasRole; + boolean hadJob = hasJob; + + hasDisplay = compound.getBoolean("TransformHasDisplay"); + hasAi = compound.getBoolean("TransformHasAI"); + hasAdvanced = compound.getBoolean("TransformHasAdvanced"); + hasInv = compound.getBoolean("TransformHasInv"); + hasStats = compound.getBoolean("TransformHasStats"); + hasRole = compound.getBoolean("TransformHasRole"); + hasJob = compound.getBoolean("TransformHasJob"); + editingModus = compound.getBoolean("TransformEditingModus"); + + if(hasDisplay && !hadDisplay){ + display = getDisplay(); + } + if(hasAi && !hadAI) + ai = npc.ai.writeToNBT(new NBTTagCompound()); + if(hasStats && !hadStats) + stats = npc.stats.writeToNBT(new NBTTagCompound()); + if(hasInv && !hadInv) + inv = npc.inventory.writeEntityToNBT(new NBTTagCompound()); + if(hasAdvanced && !hadAdvanced) + advanced = getAdvanced(); + if(hasJob && !hadJob) + job = getJob(); + if(hasRole && !hadRole) + role = getRole(); + } + + public boolean isValid(){ + return hasAdvanced || hasAi || hasDisplay || hasInv || hasStats || hasJob || hasRole; + } + + + public NBTTagCompound processAdvanced(NBTTagCompound compoundAdv, + NBTTagCompound compoundRole, NBTTagCompound compoundJob) { + + if(hasAdvanced) + compoundAdv = advanced; + if(hasRole) + compoundRole = role; + if(hasJob) + compoundJob = job; + + Set names = compoundRole.func_150296_c(); + for(String name : names) + compoundAdv.setTag(name, compoundRole.getTag(name)); + + names = compoundJob.func_150296_c(); + for(String name : names) + compoundAdv.setTag(name, compoundJob.getTag(name)); + + return compoundAdv; + } + + public void transform(boolean isActive){ + if(this.isActive == isActive) + return; + if(hasDisplay){ + NBTTagCompound compound = getDisplay(); + npc.display.readToNBT(NBTTags.NBTMerge(compound, display)); + if(npc instanceof EntityCustomNpc){ + ((EntityCustomNpc)npc).modelData.readFromNBT(NBTTags.NBTMerge(compound.getCompoundTag("ModelData"), display.getCompoundTag("ModelData"))); + } + display = compound; + } + if(hasStats){ + NBTTagCompound compound = npc.stats.writeToNBT(new NBTTagCompound()); + npc.stats.readToNBT(NBTTags.NBTMerge(compound, stats)); + stats = compound; + } + if(hasAdvanced || hasJob || hasRole){ + NBTTagCompound compoundAdv = getAdvanced(); + NBTTagCompound compoundRole = getRole(); + NBTTagCompound compoundJob = getJob(); + + NBTTagCompound compound = processAdvanced(compoundAdv, compoundRole, compoundJob); + npc.advanced.readToNBT(compound); + if (npc.advanced.role != EnumRoleType.None && npc.roleInterface != null) + npc.roleInterface.readFromNBT(NBTTags.NBTMerge(compoundRole, compound)); + if (npc.advanced.job != EnumJobType.None && npc.jobInterface != null) + npc.jobInterface.readFromNBT(NBTTags.NBTMerge(compoundJob, compound)); + + if(hasAdvanced) + advanced = compoundAdv; + if(hasRole) + role = compoundRole; + if(hasJob) + job = compoundJob; + } + if(hasAi){ + NBTTagCompound compound = npc.ai.writeToNBT(new NBTTagCompound()); + npc.ai.readToNBT(NBTTags.NBTMerge(compound, ai)); + ai = compound; + npc.setCurrentAnimation(EnumAnimation.NONE); + } + if(hasInv){ + NBTTagCompound compound = npc.inventory.writeEntityToNBT(new NBTTagCompound()); + npc.inventory.readEntityFromNBT(NBTTags.NBTMerge(compound, inv)); + inv = compound; + } + npc.updateHitbox(); + this.isActive = isActive; + npc.updateAI= true; + npc.updateClient = true; + } +} diff --git a/src/main/java/noppes/npcs/controllers/TransportCategory.java b/src/main/java/noppes/npcs/controllers/TransportCategory.java new file mode 100644 index 000000000..5fe2dba9c --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/TransportCategory.java @@ -0,0 +1,50 @@ +package noppes.npcs.controllers; + +import java.util.HashMap; +import java.util.Vector; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; + +public class TransportCategory { + public int id = -1; + public String title = ""; + public HashMap locations; + public TransportCategory(){ + locations = new HashMap(); + } + public Vector getDefaultLocations() { + Vector list = new Vector(); + for(TransportLocation loc : locations.values()) + if(loc.isDefault()) + list.add(loc); + return list; + } + + public void readNBT(NBTTagCompound compound){ + id = compound.getInteger("CategoryId"); + title = compound.getString("CategoryTitle"); + + NBTTagList locs = compound.getTagList("CategoryLocations", 10); + if(locs == null || locs.tagCount() == 0) + return; + + for(int ii = 0; ii < locs.tagCount(); ii++) + { + TransportLocation location = new TransportLocation(); + location.readNBT(locs.getCompoundTagAt(ii)); + location.category = this; + locations.put(location.id,location); + } + } + + public void writeNBT(NBTTagCompound compound){ + compound.setInteger("CategoryId", id); + compound.setString("CategoryTitle", title); + NBTTagList locs = new NBTTagList(); + for(TransportLocation location : locations.values()){ + locs.appendTag(location.writeNBT()); + } + compound.setTag("CategoryLocations", locs); + } +} diff --git a/src/main/java/noppes/npcs/controllers/TransportController.java b/src/main/java/noppes/npcs/controllers/TransportController.java new file mode 100644 index 000000000..e2beb1a20 --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/TransportController.java @@ -0,0 +1,247 @@ +package noppes.npcs.controllers; + +import java.io.BufferedInputStream; +import java.io.DataInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.HashMap; +import java.util.zip.GZIPInputStream; + +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.nbt.CompressedStreamTools; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import noppes.npcs.CustomNpcs; +import noppes.npcs.LogWriter; +import noppes.npcs.constants.EnumRoleType; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.RoleTransporter; + +public class TransportController { + private HashMap locations = new HashMap(); + public HashMap categories = new HashMap(); + + private int lastUsedID = 0; + + private static TransportController instance; + public TransportController(){ + instance = this; + loadCategories(); + if(categories.isEmpty()){ + TransportCategory cat = new TransportCategory(); + cat.id = 1; + cat.title = "Default"; + categories.put(cat.id, cat); + } + } + private void loadCategories(){ + File saveDir = CustomNpcs.getWorldSaveDirectory(); + if(saveDir == null) + return; + try { + File file = new File(saveDir, "transport.dat"); + if(!file.exists()){ + return; + } + loadCategories(file); + } catch (IOException e) { + try { + File file = new File(saveDir, "transport.dat_old"); + if(!file.exists()){ + return; + } + loadCategories(file); + + } catch (IOException ee) { + } + } + } + + public void loadCategories(File file) throws IOException{ + HashMap locations = new HashMap(); + HashMap categories = new HashMap(); + NBTTagCompound nbttagcompound1 = CompressedStreamTools.readCompressed(new FileInputStream(file)); + lastUsedID = nbttagcompound1.getInteger("lastID"); + NBTTagList list = nbttagcompound1.getTagList("NPCTransportCategories", 10); + if(list == null){ + return; + } + for(int i = 0; i < list.tagCount(); i++) + { + TransportCategory category = new TransportCategory(); + NBTTagCompound compound = list.getCompoundTagAt(i); + category.readNBT(compound); + + for(TransportLocation location : category.locations.values()) + locations.put(location.id,location); + + categories.put(category.id, category); + } + this.locations = locations; + this.categories = categories; + } + + public NBTTagCompound getNBT(){ + NBTTagList list = new NBTTagList(); + for(TransportCategory category : categories.values()){ + NBTTagCompound compound = new NBTTagCompound(); + category.writeNBT(compound); + list.appendTag(compound); + } + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setInteger("lastID", lastUsedID); + nbttagcompound.setTag("NPCTransportCategories", list); + return nbttagcompound; + } + + public void saveCategories(){ + try { + File saveDir = CustomNpcs.getWorldSaveDirectory(); + File file = new File(saveDir, "transport.dat_new"); + File file1 = new File(saveDir, "transport.dat_old"); + File file2 = new File(saveDir, "transport.dat"); + CompressedStreamTools.writeCompressed(getNBT(), new FileOutputStream(file)); + if(file1.exists()) + { + file1.delete(); + } + file2.renameTo(file1); + if(file2.exists()) + { + file2.delete(); + } + file.renameTo(file2); + if(file.exists()) + { + file.delete(); + } + } catch (Exception e) { + LogWriter.except(e); + } + } + public TransportLocation getTransport(int transportId) { + return locations.get(transportId); + } + public TransportLocation getTransport(String name) { + for(TransportLocation loc : locations.values()){ + if(loc.name.equals(name)) + return loc; + } + + return null; + } + private int getUniqueIdLocation() { + if(lastUsedID == 0){ + for(int catid : locations.keySet()) + if(catid > lastUsedID) + lastUsedID = catid; + } + lastUsedID++; + return lastUsedID; + } + private int getUniqueIdCategory() { + int id = 0; + for(int catid : categories.keySet()) + if(catid > id) + id = catid; + id++; + return id; + } + public void setLocation(TransportLocation location) { + if(locations.containsKey(location.id)){ + for(TransportCategory cat : categories.values()) + cat.locations.remove(location.id); + } + locations.put(location.id, location); + location.category.locations.put(location.id, location); + } + public TransportLocation removeLocation(int location) { + TransportLocation loc = locations.get(location); + if(loc == null) + return null; + loc.category.locations.remove(location); + locations.remove(location); + + saveCategories(); + return loc; + } + private boolean containsCategoryName(String name) { + name = name.toLowerCase(); + for(TransportCategory cat : categories.values()){ + if(cat.title.toLowerCase().equals(name)) + return true; + } + return false; + } + public void saveCategory(String name, int id){ + if(id < 0){ + id = getUniqueIdCategory(); + } + if(categories.containsKey(id)){ + TransportCategory category = categories.get(id); + if(!category.title.equals(name)){ + while(containsCategoryName(name)) + name += "_"; + categories.get(id).title = name; + } + } + else{ + while(containsCategoryName(name)) + name += "_"; + TransportCategory category = new TransportCategory(); + category.id = id; + category.title = name; + categories.put(id, category); + } + saveCategories(); + } + public void removeCategory(int id){ + if(categories.size() == 1) + return; + TransportCategory cat = categories.get(id); + if(cat == null) + return; + for(int i : cat.locations.keySet()) + locations.remove(i); + categories.remove(id); + + saveCategories(); + } + public boolean containsLocationName(String name) { + name = name.toLowerCase(); + for(TransportLocation loc : locations.values()){ + if(loc.name.toLowerCase().equals(name)) + return true; + } + return false; + } + public static TransportController getInstance(){ + return instance; + } + public TransportLocation saveLocation(int categoryId, NBTTagCompound compound, EntityPlayerMP player, EntityNPCInterface npc){ + TransportCategory category = categories.get(categoryId); + if(category == null || npc.advanced.role != EnumRoleType.Transporter) + return null; + RoleTransporter role = (RoleTransporter) npc.roleInterface; + TransportLocation location = new TransportLocation(); + location.readNBT(compound); + location.category = category; + if(role.hasTransport()) + location.id = role.transportId; + if(location.id < 0 || !locations.get(location.id).name.equals(location.name)){ + while(containsLocationName(location.name)) + location.name += "_"; + } + if(location.id < 0) + location.id = getUniqueIdLocation(); + + category.locations.put(location.id, location); + locations.put(location.id, location); + saveCategories(); + + return location; + } + +} diff --git a/src/main/java/noppes/npcs/controllers/TransportLocation.java b/src/main/java/noppes/npcs/controllers/TransportLocation.java new file mode 100644 index 000000000..ae677fd1a --- /dev/null +++ b/src/main/java/noppes/npcs/controllers/TransportLocation.java @@ -0,0 +1,45 @@ +package noppes.npcs.controllers; + +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.entity.EntityNPCInterface; + +public class TransportLocation { + public int id = -1; + public String name = "default name"; + public double posX; + public double posY; + public double posZ; + + public int type = 0; + public int dimension = 0; + + public TransportCategory category; + + public void readNBT(NBTTagCompound compound) { + if(compound == null) + return; + id = compound.getInteger("Id"); + posX = compound.getDouble("PosX"); + posY = compound.getDouble("PosY"); + posZ = compound.getDouble("PosZ"); + type = compound.getInteger("Type"); + dimension = compound.getInteger("Dimension"); + name = compound.getString("Name"); + } + + public NBTTagCompound writeNBT() { + NBTTagCompound compound = new NBTTagCompound(); + compound.setInteger("Id", id); + compound.setDouble("PosX", posX); + compound.setDouble("PosY", posY); + compound.setDouble("PosZ", posZ); + compound.setInteger("Type", type); + compound.setInteger("Dimension", dimension); + compound.setString("Name", name); + return compound; + } + + public boolean isDefault() { + return type == 1; + } +} diff --git a/src/main/java/noppes/npcs/enchants/EnchantConfusion.java b/src/main/java/noppes/npcs/enchants/EnchantConfusion.java new file mode 100644 index 000000000..5c8f89e6a --- /dev/null +++ b/src/main/java/noppes/npcs/enchants/EnchantConfusion.java @@ -0,0 +1,27 @@ +package noppes.npcs.enchants; + +import noppes.npcs.items.ItemGun; +import noppes.npcs.items.ItemStaff; + +public class EnchantConfusion extends EnchantInterface { + + public EnchantConfusion() { + super(3, ItemStaff.class, ItemGun.class); + setName("confusion"); + } + + @Override + public int getMinEnchantability(int par1) { + return 12 + (par1 - 1) * 20; + } + + @Override + public int getMaxEnchantability(int par1) { + return this.getMinEnchantability(par1) + 25; + } + + @Override + public int getMaxLevel() { + return 2; + } +} diff --git a/src/main/java/noppes/npcs/enchants/EnchantDamage.java b/src/main/java/noppes/npcs/enchants/EnchantDamage.java new file mode 100644 index 000000000..b21d4553e --- /dev/null +++ b/src/main/java/noppes/npcs/enchants/EnchantDamage.java @@ -0,0 +1,27 @@ +package noppes.npcs.enchants; + +import noppes.npcs.items.ItemGun; +import noppes.npcs.items.ItemStaff; + +public class EnchantDamage extends EnchantInterface { + + public EnchantDamage() { + super(10, ItemStaff.class, ItemGun.class); + setName("damage"); + } + + @Override + public int getMinEnchantability(int par1) { + return 1 + (par1 - 1) * 10; + } + + @Override + public int getMaxEnchantability(int par1) { + return this.getMinEnchantability(par1) + 15; + } + + @Override + public int getMaxLevel() { + return 5; + } +} diff --git a/src/main/java/noppes/npcs/enchants/EnchantInfinite.java b/src/main/java/noppes/npcs/enchants/EnchantInfinite.java new file mode 100644 index 000000000..bc3f8c7d1 --- /dev/null +++ b/src/main/java/noppes/npcs/enchants/EnchantInfinite.java @@ -0,0 +1,27 @@ +package noppes.npcs.enchants; + +import noppes.npcs.items.ItemGun; +import noppes.npcs.items.ItemStaff; + +public class EnchantInfinite extends EnchantInterface { + + public EnchantInfinite() { + super(3, ItemStaff.class, ItemGun.class); + setName("infinite"); + } + + @Override + public int getMinEnchantability(int par1) { + return 20; + } + + @Override + public int getMaxEnchantability(int par1) { + return 50; + } + + @Override + public int getMaxLevel() { + return 1; + } +} diff --git a/src/main/java/noppes/npcs/enchants/EnchantInterface.java b/src/main/java/noppes/npcs/enchants/EnchantInterface.java new file mode 100644 index 000000000..408d4c37a --- /dev/null +++ b/src/main/java/noppes/npcs/enchants/EnchantInterface.java @@ -0,0 +1,59 @@ +package noppes.npcs.enchants; + +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.enchantment.EnumEnchantmentType; +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.EnumHelper; +import noppes.npcs.CustomNpcs; +import noppes.npcs.LogWriter; +import noppes.npcs.items.ItemStaff; + +public abstract class EnchantInterface extends Enchantment{ + + private static EnumEnchantmentType CustomNpcsType; + + public static EnchantInterface Damage; + public static EnchantInterface Poison; + public static EnchantInterface Confusion; + public static EnchantInterface Infinite; + + private Class[] classes; + + protected EnchantInterface(int par2, Class... obs) { + super(CustomNpcs.EnchantStartId++, par2, CustomNpcsType); + classes = obs; + } + + @Override + public boolean canApply(ItemStack par1ItemStack){ + if(par1ItemStack.getItem() == null) + return false; + for(Class cls : classes){ + if(cls.isInstance(par1ItemStack.getItem())) + return true; + } + return false; + } + + public static void load(){ + if(!CustomNpcs.DisableEnchants){ + CustomNpcsType = EnumHelper.addEnchantmentType("customnpcs_enchants"); + try{ + Damage = new EnchantDamage(); + Poison = new EnchantPoison(); + Confusion = new EnchantConfusion(); + Infinite = new EnchantInfinite(); + } + catch(Exception e){ + LogWriter.except(e); + } + } + } + + public static int getLevel(EnchantInterface enchant, ItemStack stack) { + if(CustomNpcs.DisableEnchants || enchant == null) + return 0; + return EnchantmentHelper.getEnchantmentLevel(enchant.effectId, stack); + } +} diff --git a/src/main/java/noppes/npcs/enchants/EnchantPoison.java b/src/main/java/noppes/npcs/enchants/EnchantPoison.java new file mode 100644 index 000000000..d59dbec2a --- /dev/null +++ b/src/main/java/noppes/npcs/enchants/EnchantPoison.java @@ -0,0 +1,27 @@ +package noppes.npcs.enchants; + +import noppes.npcs.items.ItemGun; +import noppes.npcs.items.ItemStaff; + +public class EnchantPoison extends EnchantInterface { + + public EnchantPoison() { + super(6, ItemStaff.class, ItemGun.class); + setName("poison"); + } + + @Override + public int getMinEnchantability(int par1) { + return 12 + (par1 - 1) * 20; + } + + @Override + public int getMaxEnchantability(int par1) { + return this.getMinEnchantability(par1) + 25; + } + + @Override + public int getMaxLevel() { + return 2; + } +} diff --git a/src/main/java/noppes/npcs/entity/EntityChairMount.java b/src/main/java/noppes/npcs/entity/EntityChairMount.java new file mode 100644 index 000000000..ec022e1c6 --- /dev/null +++ b/src/main/java/noppes/npcs/entity/EntityChairMount.java @@ -0,0 +1,74 @@ +package noppes.npcs.entity; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.entity.Entity; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; + +public class EntityChairMount extends Entity{ + + public EntityChairMount(World world) { + super(world); + setSize(0, 0); + } + + public double getMountedYOffset(){ + return 0.5f; + } + + @Override + protected void entityInit() { + } + + public void onEntityUpdate(){ + super.onEntityUpdate(); + if(this.worldObj != null && !this.worldObj.isRemote && riddenByEntity == null) + isDead = true; + } + + @Override + public boolean isEntityInvulnerable(){ + return true; + } + + @Override + public boolean isInvisible(){ + return true; + } + @Override + public void moveEntity(double p_70091_1_, double p_70091_3_, double p_70091_5_){ + + } + @Override + protected void readEntityFromNBT(NBTTagCompound p_70037_1_) { + + } + + @Override + protected void writeEntityToNBT(NBTTagCompound p_70014_1_) { + + } + + @Override + public boolean canBeCollidedWith(){ + return false; + } + + @Override + public boolean canBePushed(){ + return false; + } + + @Override + protected void fall(float p_70069_1_){ + + } + + @Override + @SideOnly(Side.CLIENT) + public void setPositionAndRotation2(double p_70056_1_, double p_70056_3_, double p_70056_5_, float p_70056_7_, float p_70056_8_, int p_70056_9_){ + this.setPosition(p_70056_1_, p_70056_3_, p_70056_5_); + this.setRotation(p_70056_7_, p_70056_8_); + } +} diff --git a/src/main/java/noppes/npcs/entity/EntityCustomNpc.java b/src/main/java/noppes/npcs/entity/EntityCustomNpc.java new file mode 100644 index 000000000..a4198484c --- /dev/null +++ b/src/main/java/noppes/npcs/entity/EntityCustomNpc.java @@ -0,0 +1,80 @@ +package noppes.npcs.entity; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import noppes.npcs.CustomNpcs; +import noppes.npcs.ModelData; +import noppes.npcs.ModelPartData; +import noppes.npcs.client.EntityUtil; + +public class EntityCustomNpc extends EntityNPCInterface{ + public ModelData modelData = new ModelData(); + + public EntityCustomNpc(World world) { + super(world); + } + + @Override + public void readEntityFromNBT(NBTTagCompound compound) { + if(compound.hasKey("NpcModelData")) + modelData.readFromNBT(compound.getCompoundTag("NpcModelData")); + super.readEntityFromNBT(compound); + } + + @Override + public void writeEntityToNBT(NBTTagCompound compound) { + super.writeEntityToNBT(compound); + compound.setTag("NpcModelData", modelData.writeToNBT()); + } + + @Override + public void onUpdate(){ + super.onUpdate(); + if(isRemote()){ + ModelPartData particles = modelData.getPartData("particles"); + if(particles != null && !isKilled()){ + CustomNpcs.proxy.spawnParticle(this, "ModelData", modelData, particles); + } + EntityLivingBase entity = modelData.getEntity(this); + if(entity != null){ + try{ + entity.onUpdate(); + } + catch(Exception e){ + + } + EntityUtil.Copy(this, entity); + } + } + } + + @Override + public void mountEntity(Entity par1Entity){ + super.mountEntity(par1Entity); + updateHitbox(); + } + + @Override + public void updateHitbox() { + Entity entity = modelData.getEntity(this); + if(modelData == null || entity == null){ + baseHeight = 1.9f - modelData.getBodyY() + (modelData.head.scaleY - 1) / 2; + super.updateHitbox(); + } + else{ + if(entity instanceof EntityNPCInterface) + ((EntityNPCInterface)entity).updateHitbox(); + width = (entity.width / 5f) * display.modelSize; + height = (entity.height / 5f) * display.modelSize; + + if(width < 0.1f) + width = 0.1f; + if(height < 0.1f) + height = 0.1f; + this.setPosition(posX, posY, posZ); + } + } +} + \ No newline at end of file diff --git a/src/main/java/noppes/npcs/entity/EntityDialogNpc.java b/src/main/java/noppes/npcs/entity/EntityDialogNpc.java new file mode 100644 index 000000000..c100de45f --- /dev/null +++ b/src/main/java/noppes/npcs/entity/EntityDialogNpc.java @@ -0,0 +1,34 @@ +package noppes.npcs.entity; + +import java.util.UUID; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.world.World; + +public class EntityDialogNpc extends EntityNPCInterface{ + + public EntityDialogNpc(World world) { + super(world); + } + + + @Override + public boolean isInvisibleToPlayer(EntityPlayer player){ + return true; + } + + @Override + public boolean isInvisible(){ + return true; + } + + @Override + public void onUpdate(){ + + } + + @Override + public boolean interact(EntityPlayer player) { + return false; + } +} diff --git a/src/main/java/noppes/npcs/entity/EntityFakeLiving.java b/src/main/java/noppes/npcs/entity/EntityFakeLiving.java new file mode 100644 index 000000000..1f3525f85 --- /dev/null +++ b/src/main/java/noppes/npcs/entity/EntityFakeLiving.java @@ -0,0 +1,12 @@ +package noppes.npcs.entity; + +import net.minecraft.entity.EntityLiving; +import net.minecraft.world.World; + +public class EntityFakeLiving extends EntityLiving{ + + public EntityFakeLiving(World par1World) { + super(par1World); + } + +} diff --git a/src/main/java/noppes/npcs/entity/EntityMagicProjectile.java b/src/main/java/noppes/npcs/entity/EntityMagicProjectile.java new file mode 100644 index 000000000..04b53c8a7 --- /dev/null +++ b/src/main/java/noppes/npcs/entity/EntityMagicProjectile.java @@ -0,0 +1,31 @@ +package noppes.npcs.entity; + +import net.minecraft.entity.EntityList; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; + +public class EntityMagicProjectile extends EntityProjectile{ + private EntityPlayer player; + private ItemStack equiped; + public EntityMagicProjectile(World par1World, + EntityPlayer player, ItemStack item, boolean isNPC) { + super(par1World, player, item, isNPC); + + this.player = player; + this.equiped = player.inventory.getCurrentItem(); + } + + @Override + public void onUpdate(){ + if(player.inventory.getCurrentItem() != equiped) + this.setDead(); + super.onUpdate(); + } + + @Override + public String getCommandSenderName(){ + return StatCollector.translateToLocal("entity.throwableitem.name"); + } +} diff --git a/src/main/java/noppes/npcs/entity/EntityNPCGolem.java b/src/main/java/noppes/npcs/entity/EntityNPCGolem.java new file mode 100644 index 000000000..371f1c925 --- /dev/null +++ b/src/main/java/noppes/npcs/entity/EntityNPCGolem.java @@ -0,0 +1,61 @@ +// 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 fieldsfirst + +package noppes.npcs.entity; + +import net.minecraft.entity.monster.EntityIronGolem; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import noppes.npcs.ModelData; +import noppes.npcs.constants.EnumAnimation; + +// Referenced classes of package net.minecraft.src: +// EntityAnimal, Item, EntityPlayer, InventoryPlayer, +// ItemStack, World, NBTTagCompound + +public class EntityNPCGolem extends EntityNPCInterface +{ + + public EntityNPCGolem(World world) + { + super(world); + display.texture = "customnpcs:textures/entity/golem/Iron Golem.png"; + + width = 1.4f; + height = 2.5f; + } + + public void updateHitbox() { + currentAnimation = EnumAnimation.values()[dataWatcher.getWatchableObjectInt(14)]; + if(currentAnimation == EnumAnimation.LYING){ + width = height = 0.5f; + } + else if (currentAnimation == EnumAnimation.SITTING){ + width = 1.4f; + height = 2f; + } + else{ + width = 1.4f; + height = 2.5f; + } + } + public void onUpdate() + { + isDead = true; + + if(!worldObj.isRemote){ + NBTTagCompound compound = new NBTTagCompound(); + + writeToNBT(compound); + EntityCustomNpc npc = new EntityCustomNpc(worldObj); + npc.readFromNBT(compound); + ModelData data = npc.modelData; + data.setEntityClass(EntityNPCGolem.class); + + + worldObj.spawnEntityInWorld(npc); + } + super.onUpdate(); + } +} \ No newline at end of file diff --git a/src/main/java/noppes/npcs/entity/EntityNPCInterface.java b/src/main/java/noppes/npcs/entity/EntityNPCInterface.java new file mode 100644 index 000000000..f3536f887 --- /dev/null +++ b/src/main/java/noppes/npcs/entity/EntityNPCInterface.java @@ -0,0 +1,1695 @@ +package noppes.npcs.entity; + +import io.netty.buffer.ByteBuf; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; + +import com.mojang.authlib.GameProfile; + +import net.minecraft.block.Block; +import net.minecraft.command.ICommandSender; +import net.minecraft.command.IEntitySelector; +import net.minecraft.entity.DataWatcher; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityCreature; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.EnumCreatureAttribute; +import net.minecraft.entity.IRangedAttackMob; +import net.minecraft.entity.NPCEntityHelper; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.EntityAIAttackOnCollide; +import net.minecraft.entity.ai.EntityAIBase; +import net.minecraft.entity.ai.EntityAIHurtByTarget; +import net.minecraft.entity.ai.EntityAILeapAtTarget; +import net.minecraft.entity.ai.EntityAIOpenDoor; +import net.minecraft.entity.ai.EntityAIRestrictSun; +import net.minecraft.entity.ai.EntityAITasks; +import net.minecraft.entity.ai.EntityAITasks.EntityAITaskEntry; +import net.minecraft.entity.ai.attributes.AttributeModifier; +import net.minecraft.entity.boss.IBossDisplayData; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.monster.EntityMob; +import net.minecraft.entity.monster.EntityZombie; +import net.minecraft.entity.passive.EntityBat; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.entity.projectile.EntityThrowable; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.util.DamageSource; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.IIcon; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; +import net.minecraft.world.WorldServer; +import net.minecraftforge.common.ForgeHooks; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.util.FakePlayer; +import net.minecraftforge.event.ServerChatEvent; +import noppes.npcs.CustomItems; +import noppes.npcs.CustomNpcs; +import noppes.npcs.DataAI; +import noppes.npcs.DataAdvanced; +import noppes.npcs.DataDisplay; +import noppes.npcs.DataInventory; +import noppes.npcs.DataScript; +import noppes.npcs.DataStats; +import noppes.npcs.IChatMessages; +import noppes.npcs.NBTTags; +import noppes.npcs.NoppesStringUtils; +import noppes.npcs.NoppesUtilServer; +import noppes.npcs.NpcDamageSource; +import noppes.npcs.Server; +import noppes.npcs.VersionCompatibility; +import noppes.npcs.ai.EntityAIAmbushTarget; +import noppes.npcs.ai.EntityAIAnimation; +import noppes.npcs.ai.EntityAIAttackTarget; +import noppes.npcs.ai.EntityAIAvoidTarget; +import noppes.npcs.ai.EntityAIBustDoor; +import noppes.npcs.ai.EntityAIDodgeShoot; +import noppes.npcs.ai.EntityAIFindShade; +import noppes.npcs.ai.EntityAIFollow; +import noppes.npcs.ai.EntityAIJob; +import noppes.npcs.ai.EntityAILook; +import noppes.npcs.ai.EntityAIMoveIndoors; +import noppes.npcs.ai.EntityAIMovingPath; +import noppes.npcs.ai.EntityAIOrbitTarget; +import noppes.npcs.ai.EntityAIPanic; +import noppes.npcs.ai.EntityAIRangedAttack; +import noppes.npcs.ai.EntityAIReturn; +import noppes.npcs.ai.EntityAIRole; +import noppes.npcs.ai.EntityAISprintToTarget; +import noppes.npcs.ai.EntityAIStalkTarget; +import noppes.npcs.ai.EntityAITransform; +import noppes.npcs.ai.EntityAIWander; +import noppes.npcs.ai.EntityAIWatchClosest; +import noppes.npcs.ai.EntityAIWaterNav; +import noppes.npcs.ai.EntityAIWorldLines; +import noppes.npcs.ai.EntityAIZigZagTarget; +import noppes.npcs.ai.selector.NPCAttackSelector; +import noppes.npcs.ai.target.EntityAIClearTarget; +import noppes.npcs.ai.target.EntityAIClosestTarget; +import noppes.npcs.ai.target.EntityAIOwnerHurtByTarget; +import noppes.npcs.ai.target.EntityAIOwnerHurtTarget; +import noppes.npcs.client.EntityUtil; +import noppes.npcs.constants.EnumAnimation; +import noppes.npcs.constants.EnumJobType; +import noppes.npcs.constants.EnumMovingType; +import noppes.npcs.constants.EnumNavType; +import noppes.npcs.constants.EnumPacketClient; +import noppes.npcs.constants.EnumPotionType; +import noppes.npcs.constants.EnumRoleType; +import noppes.npcs.constants.EnumScriptType; +import noppes.npcs.constants.EnumStandingType; +import noppes.npcs.controllers.Dialog; +import noppes.npcs.controllers.DialogOption; +import noppes.npcs.controllers.Faction; +import noppes.npcs.controllers.FactionController; +import noppes.npcs.controllers.Line; +import noppes.npcs.controllers.LinkedNpcController; +import noppes.npcs.controllers.LinkedNpcController.LinkedData; +import noppes.npcs.controllers.PlayerDataController; +import noppes.npcs.controllers.PlayerQuestData; +import noppes.npcs.controllers.QuestData; +import noppes.npcs.controllers.ScriptController; +import noppes.npcs.controllers.TransformData; +import noppes.npcs.roles.JobBard; +import noppes.npcs.roles.JobFollower; +import noppes.npcs.roles.JobInterface; +import noppes.npcs.roles.RoleCompanion; +import noppes.npcs.roles.RoleFollower; +import noppes.npcs.roles.RoleInterface; +import noppes.npcs.scripted.ScriptEventAttack; +import noppes.npcs.scripted.ScriptEventDamaged; +import noppes.npcs.scripted.ScriptEventKilled; +import noppes.npcs.scripted.ScriptEventTarget; +import noppes.npcs.util.GameProfileAlt; +import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData; + +public abstract class EntityNPCInterface extends EntityCreature implements IEntityAdditionalSpawnData, ICommandSender, IRangedAttackMob, IBossDisplayData{ + + private static final GameProfileAlt chateventProfile = new GameProfileAlt(); + private static FakePlayer chateventPlayer; + public DataDisplay display; + public DataStats stats; + public DataAI ai; + public DataAdvanced advanced; + public DataInventory inventory; + public DataScript script; + public TransformData transform; + + public String linkedName = ""; + public long linkedLast = 0; + public LinkedData linkedData; + + public float baseHeight = 1.8f; + public float scaleX, scaleY, scaleZ; + private boolean wasKilled = false; + public RoleInterface roleInterface; + public JobInterface jobInterface; + public HashMap dialogs; + public boolean hasDied = false; + public long killedtime = 0; + public long totalTicksAlive = 0; + private int taskCount = 1; + public int lastInteract = 0; + public Faction faction; //should only be used server side + + private EntityAIRangedAttack aiRange; + private EntityAIBase aiResponse, aiLeap, aiSprint, aiAttackTarget; + + public List interactingEntities = new ArrayList(); + + public ResourceLocation textureLocation = null; + public ResourceLocation textureGlowLocation = null; + public ResourceLocation textureCloakLocation = null; + + public EnumAnimation currentAnimation = EnumAnimation.NONE; + + public int npcVersion = VersionCompatibility.ModRev; + public IChatMessages messages; + + public boolean updateClient = false; + public boolean updateAI = false; + + public EntityNPCInterface(World world) { + super(world); + try{ + dialogs = new HashMap(); + if(!CustomNpcs.DefaultInteractLine.isEmpty()) + advanced.interactLines.lines.put(0, new Line(CustomNpcs.DefaultInteractLine)); + + experienceValue = 0; + scaleX = scaleY = scaleZ = 0.9375f; + + faction = getFaction(); + setFaction(faction.id); + setSize(1, 1); + this.updateTasks(); + } + catch(Exception e){ + e.printStackTrace(); + } + } + + @Override + protected void applyEntityAttributes(){ + super.applyEntityAttributes(); + + display = new DataDisplay(this); + stats = new DataStats(this); + ai = new DataAI(this); + advanced = new DataAdvanced(this); + inventory = new DataInventory(this); + transform = new TransformData(this); + script = new DataScript(this); + + this.getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage); + + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(stats.maxHealth); + this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(CustomNpcs.NpcNavRange); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(this.getSpeed()); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(stats.getAttackStrength()); + } + + @Override + protected void entityInit() { + super.entityInit(); + this.dataWatcher.addObject(13, String.valueOf(""));//faction + this.dataWatcher.addObject(14, Integer.valueOf(0)); // Animation + this.dataWatcher.addObject(15, Integer.valueOf(0)); // isWalking + this.dataWatcher.addObject(16, String.valueOf("")); // Role + } + protected boolean isAIEnabled(){ + return true; + } + + @Override + public boolean getLeashed(){ + return false; //Prevents npcs from being leashed + } + + @Override + public boolean isEntityAlive(){ + return super.isEntityAlive() && !isKilled(); + } + + @Override + public void onUpdate(){ + super.onUpdate(); + if(this.ticksExisted % 10 == 0) + script.callScript(EnumScriptType.TICK); + } + + public void setWorld(World world){ + super.setWorld(world); + script.setWorld(world); + } + + @Override + public boolean attackEntityAsMob(Entity par1Entity){ + float f = stats.getAttackStrength(); + + if (stats.attackSpeed < 10){ + par1Entity.hurtResistantTime = 0; + } + if(par1Entity instanceof EntityLivingBase){ + ScriptEventAttack event = new ScriptEventAttack(f, (EntityLivingBase)par1Entity, false); + if(script.callScript(EnumScriptType.ATTACK, "event", event, "target", par1Entity)) + return false; + f = event.getDamage(); + } + + boolean var4 = par1Entity.attackEntityFrom(new NpcDamageSource("mob", this), f); + + if (var4){ + if(getOwner() instanceof EntityPlayer) + NPCEntityHelper.setRecentlyHit((EntityLivingBase)par1Entity); + if (stats.knockback > 0){ + par1Entity.addVelocity((double)(-MathHelper.sin(this.rotationYaw * (float)Math.PI / 180.0F) * (float)stats.knockback * 0.5F), 0.1D, (double)(MathHelper.cos(this.rotationYaw * (float)Math.PI / 180.0F) * (float)stats.knockback * 0.5F)); + this.motionX *= 0.6D; + this.motionZ *= 0.6D; + } + if(advanced.role == EnumRoleType.Companion){ + ((RoleCompanion)roleInterface).attackedEntity(par1Entity); + } + } + + if (stats.potionType != EnumPotionType.None){ + if (stats.potionType != EnumPotionType.Fire) + ((EntityLivingBase)par1Entity).addPotionEffect(new PotionEffect(this.getPotionEffect(stats.potionType), stats.potionDuration * 20, stats.potionAmp)); + else + par1Entity.setFire(stats.potionDuration); + } + return var4; + } + + @Override + public void onLivingUpdate(){ + if(CustomNpcs.FreezeNPCs) + return; + totalTicksAlive++; + this.updateArmSwingProgress(); + if(this.ticksExisted % 20 == 0) + faction = getFaction(); + if(!worldObj.isRemote){ + if(!isKilled() && this.ticksExisted % 20 == 0){ + if(this.getHealth() < this.getMaxHealth()){ + if(stats.healthRegen > 0 && !isAttacking()) + heal(stats.healthRegen); + if(stats.combatRegen > 0 && isAttacking()) + heal(stats.combatRegen); + } + if(faction.getsAttacked && !isAttacking()){ + List list = this.worldObj.getEntitiesWithinAABB(EntityMob.class, this.boundingBox.expand(16, 16, 16)); + for(EntityMob mob : list){ + if(mob.getAttackTarget() == null && this.canSee(mob)){ + if(mob instanceof EntityZombie && !mob.getEntityData().hasKey("AttackNpcs")){ + mob.tasks.addTask(2, new EntityAIAttackOnCollide(mob, EntityLivingBase.class, 1.0D, false)); + mob.getEntityData().setBoolean("AttackNpcs", true); + } + mob.setAttackTarget(this); + } + } + } + if(linkedData != null && linkedData.time > linkedLast){ + LinkedNpcController.Instance.loadNpcData(this); + } + if(updateClient){ + NBTTagCompound compound = writeSpawnData(); + compound.setInteger("EntityId", getEntityId()); + Server.sendAssociatedData(this, EnumPacketClient.UPDATE_NPC, compound); + updateClient = false; + } + if(updateAI){ + updateTasks(); + updateAI = false; + } + } + if(getHealth() <= 0){ + clearActivePotions(); + setBoolFlag(true, 8); + } + setBoolFlag(this.getAttackTarget() != null, 4); + setBoolFlag(!getNavigator().noPath(), 1); + setBoolFlag(isInteracting(), 2); + + onCollide(); + } + + if(wasKilled != isKilled() && wasKilled){ + reset(); + } + + wasKilled = isKilled(); + + if (this.worldObj.isDaytime() && !this.worldObj.isRemote && this.stats.burnInSun){ + float f = this.getBrightness(1.0F); + + if (f > 0.5F && this.rand.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.worldObj.canBlockSeeTheSky(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ))){ + this.setFire(8); + } + } + + super.onLivingUpdate(); + + if (worldObj.isRemote){ + if(roleInterface != null){ + roleInterface.clientUpdate(); + } + + if(!display.cloakTexture.isEmpty()) + cloakUpdate(); + if(currentAnimation.ordinal() != dataWatcher.getWatchableObjectInt(14)){ + currentAnimation = EnumAnimation.values()[dataWatcher.getWatchableObjectInt(14)]; + updateHitbox(); + } + if(advanced.job == EnumJobType.Bard) + ((JobBard)jobInterface).onLivingUpdate(); + } + } + + @Override + public boolean interact(EntityPlayer player) { + if(worldObj.isRemote) + return false; + ItemStack currentItem = player.inventory.getCurrentItem(); + if (currentItem != null) { + Item item = currentItem.getItem(); + if (item == CustomItems.cloner || item == CustomItems.wand || item == CustomItems.mount || item == CustomItems.scripter) { + setAttackTarget(null); + setRevengeTarget(null); + return true; + } + if (item == CustomItems.moving) { + setAttackTarget(null); + if(currentItem.stackTagCompound == null) + currentItem.stackTagCompound = new NBTTagCompound(); + + currentItem.stackTagCompound.setInteger("NPCID",this.getEntityId()); + player.addChatMessage(new ChatComponentTranslation("Registered " + this.getCommandSenderName() + " to your NPC Pather")); + return true; + } + } + + if(script.callScript(EnumScriptType.INTERACT, "player", player) || isAttacking() || isKilled() || faction.isAggressiveToPlayer(player)) + return false; + + addInteract(player); + + Dialog dialog = getDialog(player); + PlayerQuestData playerdata = PlayerDataController.instance.getPlayerData(player).questData; + QuestData data = playerdata.getQuestCompletion(player, this); + if (data != null){ + Server.sendData((EntityPlayerMP)player, EnumPacketClient.QUEST_COMPLETION, data.quest.writeToNBT(new NBTTagCompound())); + } + else if (dialog != null){ + NoppesUtilServer.openDialog(player, this, dialog); + } + else if(roleInterface != null) + roleInterface.interact(player); + else + say(player, advanced.getInteractLine()); + + return true; + } + + public void addInteract(EntityLivingBase entity){ + if( !ai.stopAndInteract || isAttacking() || !entity.isEntityAlive()) + return; + if((ticksExisted - lastInteract) < 180) + interactingEntities.clear(); + getNavigator().clearPathEntity(); + lastInteract = ticksExisted; + if(!interactingEntities.contains(entity)) + interactingEntities.add(entity); + } + + public boolean isInteracting(){ + if((ticksExisted - lastInteract) < 40 || isRemote() && getBoolFlag(2)) + return true; + return ai.stopAndInteract && !interactingEntities.isEmpty() && (ticksExisted - lastInteract) < 180; + } + + private Dialog getDialog(EntityPlayer player) { + for (DialogOption option : dialogs.values()) { + if (option == null) + continue; + if (!option.hasDialog()) + continue; + Dialog dialog = option.getDialog(); + if (dialog.availability.isAvailable(player)){ + return dialog; + } + } + return null; + } + + @Override + public boolean attackEntityFrom(DamageSource damagesource, float i) { + if (this.worldObj.isRemote || CustomNpcs.FreezeNPCs || damagesource.damageType.equals("inWall")){ + return false; + } + if(damagesource.damageType.equals("outOfWorld") && isKilled()){ + reset(); + } + i = stats.resistances.applyResistance(damagesource, i); + if((float)this.hurtResistantTime > (float)this.maxHurtResistantTime / 2.0F && i <= this.lastDamage) + return false; + + Entity entity = damagesource.getEntity(); + + EntityLivingBase attackingEntity = null; + + if (entity instanceof EntityLivingBase) + attackingEntity = (EntityLivingBase) entity; + + if ((entity instanceof EntityArrow) && ((EntityArrow) entity).shootingEntity instanceof EntityLivingBase) + attackingEntity = (EntityLivingBase) ((EntityArrow) entity).shootingEntity; + else if ((entity instanceof EntityThrowable)) + attackingEntity = ((EntityThrowable) entity).getThrower(); + + if(attackingEntity != null && attackingEntity == getOwner()) + return false; + else if (attackingEntity instanceof EntityNPCInterface){ + EntityNPCInterface npc = (EntityNPCInterface) attackingEntity; + if(npc.faction.id == faction.id) + return false; + if(npc.getOwner() instanceof EntityPlayer) + this.recentlyHit = 100; + } + else if (attackingEntity instanceof EntityPlayer && faction.isFriendlyToPlayer((EntityPlayer) attackingEntity)) + return false; + ScriptEventDamaged result = new ScriptEventDamaged(i, attackingEntity, damagesource); + if(script.callScript(EnumScriptType.DAMAGED, "event", result) || isKilled()) + return false; + i = result.getDamage(); + + if(isKilled()) + return false; + + if(attackingEntity == null) + return super.attackEntityFrom(damagesource, i); + + try{ + if (isAttacking()){ + if(getAttackTarget() != null && attackingEntity != null && this.getDistanceSqToEntity(getAttackTarget()) > this.getDistanceSqToEntity(attackingEntity)){ + setAttackTarget(attackingEntity); + } + return super.attackEntityFrom(damagesource, i); + } + + if (i > 0) { + List inRange = worldObj.getEntitiesWithinAABB(EntityNPCInterface.class, this.boundingBox.expand(32D, 16D, 32D)); + for (EntityNPCInterface npc : inRange) { + if (npc.isKilled() || !npc.advanced.defendFaction || npc.faction.id != faction.id) + continue; + + if (npc.canSee(this) || npc.ai.directLOS || npc.canSee(attackingEntity)) + npc.onAttack(attackingEntity); + } + setAttackTarget(attackingEntity); + } + return super.attackEntityFrom(damagesource, i); + } + finally{ + if(result.getClearTarget()){ + setAttackTarget(null); + setRevengeTarget(null); + } + } + } + public void onAttack(EntityLivingBase entity) { + if (entity == null || entity == this || isAttacking() || ai.onAttack == 3 || entity == getOwner()) + return; + super.setAttackTarget(entity); + } + + @Override + public void setAttackTarget(EntityLivingBase entity){ + if(entity instanceof EntityPlayer && ((EntityPlayer)entity).capabilities.disableDamage || entity != null && entity == getOwner()) + return; + if(getAttackTarget() != entity && entity != null){ + ScriptEventTarget event = new ScriptEventTarget(entity); + if(script.callScript(EnumScriptType.TARGET, "event", event)) + return; + + if(event.getTarget() == null) + entity = null; + else + entity = event.getTarget().getMinecraftEntity(); + } + if (entity != null && entity != this && ai.onAttack != 3 && !isAttacking() && !isRemote()){ + Line line = advanced.getAttackLine(); + if(line != null) + saySurrounding(line.formatTarget(entity)); + } + + super.setAttackTarget(entity); + } + + @Override + public void attackEntityWithRangedAttack(EntityLivingBase entity, float f) { + ItemStack proj = inventory.getProjectile(); + if(proj == null){ + updateTasks(); + return; + } + ScriptEventAttack event = new ScriptEventAttack(stats.pDamage, entity, true); + if(script.callScript(EnumScriptType.ATTACK, "event", event, "target", entity)) + return; + for(int i = 0; i < this.stats.shotCount; i++) + { + EntityProjectile projectile = shoot(entity, stats.accuracy, proj, f == 1); + projectile.damage = event.getDamage(); + } + this.playSound(this.stats.fireSound, 2.0F, 1.0f); + + } + + public EntityProjectile shoot(EntityLivingBase entity, int accuracy, ItemStack proj, boolean indirect){ + return shoot(entity.posX, entity.boundingBox.minY + (double)(entity.height / 2.0F), entity.posZ, accuracy, proj, indirect); + } + + public EntityProjectile shoot(double x, double y, double z, int accuracy, ItemStack proj, boolean indirect){ + EntityProjectile projectile = new EntityProjectile(this.worldObj, this, proj.copy(), true); + //TODO calculate height of the thrower + double varX = x - this.posX; + double varY = y - (this.posY + this.getEyeHeight()); + double varZ = z - this.posZ; + float varF = projectile.hasGravity() ? MathHelper.sqrt_double(varX * varX + varZ * varZ) : 0.0F; + float angle = projectile.getAngleForXYZ(varX, varY, varZ, varF, indirect); + float acc = 20.0F - MathHelper.floor_float(accuracy / 5.0F); + projectile.setThrowableHeading(varX, varY, varZ, angle, acc); + worldObj.spawnEntityInWorld(projectile); + return projectile; + } + + private void clearTasks(EntityAITasks tasks){ + Iterator iterator = tasks.taskEntries.iterator(); + List list = new ArrayList(tasks.taskEntries); + for (EntityAITaskEntry entityaitaskentry : list) + { + tasks.removeTask(entityaitaskentry.action); + } + tasks.taskEntries = new ArrayList(); + } + private void updateTasks() { + if (worldObj == null || worldObj.isRemote) + return; + aiLeap = aiAttackTarget = aiResponse = aiSprint = aiRange = null; + + clearTasks(tasks); + clearTasks(targetTasks); + IEntitySelector attackEntitySelector = new NPCAttackSelector(this); + this.targetTasks.addTask(0, new EntityAIClearTarget(this)); + this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false)); + this.targetTasks.addTask(2, new EntityAIClosestTarget(this, EntityLivingBase.class, 4, this.ai.directLOS, false, attackEntitySelector)); + this.targetTasks.addTask(3, new EntityAIOwnerHurtByTarget(this)); + this.targetTasks.addTask(4, new EntityAIOwnerHurtTarget(this)); + + this.tasks.addTask(0, new EntityAIWaterNav(this)); + this.taskCount = 1; + this.doorInteractType(); + this.seekShelter(); + this.setResponse(); + this.setMoveType(); + this.addRegularEntries(); + } + + private void removeTask(EntityAIBase task){ + if(task != null) + tasks.removeTask(task); + } + + /* + * Branch task function for setting how an NPC responds to a threat + */ + public void setResponse(){ + removeTask(aiLeap); + removeTask(aiResponse); + removeTask(aiSprint); + removeTask(aiAttackTarget); + removeTask(aiRange); + aiLeap = aiAttackTarget = aiResponse = aiSprint = aiRange = null; + + if (this.ai.onAttack == 1) + this.tasks.addTask(this.taskCount++, aiResponse = new EntityAIPanic(this, 1.2F)); + + else if (this.ai.onAttack == 2) { + this.tasks.addTask(this.taskCount++, aiResponse = new EntityAIAvoidTarget(this)); + this.setCanSprint(); + } + + else if (this.ai.onAttack == 0) { + this.setCanLeap(); + this.setCanSprint(); + if (this.inventory.getProjectile() == null || this.ai.useRangeMelee == 2) + { + switch(this.ai.tacticalVariant) + { + case Dodge : this.tasks.addTask(this.taskCount++, aiResponse = new EntityAIZigZagTarget(this, 1.0D, this.ai.tacticalRadius)); break; + case Surround : this.tasks.addTask(this.taskCount++, aiResponse = new EntityAIOrbitTarget(this, 1.0D, this.ai.tacticalRadius, true)); break; + case HitNRun : this.tasks.addTask(this.taskCount++, aiResponse = new EntityAIAvoidTarget(this)); break; + case Ambush : this.tasks.addTask(this.taskCount++, aiResponse = new EntityAIAmbushTarget(this, 1.2D, this.ai.tacticalRadius, false)); break; + case Stalk : this.tasks.addTask(this.taskCount++, aiResponse = new EntityAIStalkTarget(this, this.ai.tacticalRadius)); break; + default : + } + } + else + { + switch(this.ai.tacticalVariant) + { + case Dodge : this.tasks.addTask(this.taskCount++, aiResponse = new EntityAIDodgeShoot(this)); break; + case Surround : this.tasks.addTask(this.taskCount++, aiResponse = new EntityAIOrbitTarget(this, 1.0D, stats.rangedRange, false)); break; + case HitNRun : this.tasks.addTask(this.taskCount++, aiResponse = new EntityAIAvoidTarget(this)); break; + case Ambush : this.tasks.addTask(this.taskCount++, aiResponse = new EntityAIAmbushTarget(this, 1.2D, this.ai.tacticalRadius, false)); break; + case Stalk : this.tasks.addTask(this.taskCount++, aiResponse = new EntityAIStalkTarget(this, this.ai.tacticalRadius)); break; + default : + } + } + this.tasks.addTask(this.taskCount, aiAttackTarget = new EntityAIAttackTarget(this)); + ((EntityAIAttackTarget)aiAttackTarget).navOverride(ai.tacticalVariant == EnumNavType.None); + + if(this.inventory.getProjectile() != null){ + this.tasks.addTask(this.taskCount++, aiRange = new EntityAIRangedAttack(this)); + aiRange.navOverride(ai.tacticalVariant == EnumNavType.None); + } + } + else if (this.ai.onAttack == 3) { + //do nothing + } + } + + /* + * Branch task function for setting if an NPC wanders or not + */ + public void setMoveType(){ + if (ai.movingType == EnumMovingType.Wandering){ + this.tasks.addTask(this.taskCount++, new EntityAIWander(this)); + } + if (ai.movingType == EnumMovingType.MovingPath){ + this.tasks.addTask(this.taskCount++, new EntityAIMovingPath(this)); + } + } + /* + * Branch task function for adjusting NPC door interactivity + */ + public void doorInteractType(){ + EntityAIBase aiDoor = null; + if (this.ai.doorInteract == 1) + { + this.tasks.addTask(this.taskCount++, aiDoor = new EntityAIOpenDoor(this, true)); + } + else if (this.ai.doorInteract == 0) + { + this.tasks.addTask(this.taskCount++, aiDoor = new EntityAIBustDoor(this)); + } + this.getNavigator().setBreakDoors(aiDoor != null); + } + + /* + * Branch task function for finding shelter under the appropriate conditions + */ + public void seekShelter() { + if (this.ai.findShelter == 0) + { + this.tasks.addTask(this.taskCount++, new EntityAIMoveIndoors(this)); + } + else if (this.ai.findShelter == 1) + { + this.tasks.addTask(this.taskCount++, new EntityAIRestrictSun(this)); + this.tasks.addTask(this.taskCount++, new EntityAIFindShade(this)); + } + } + + /* + * Branch task function for leaping + */ + public void setCanLeap() { + if (this.ai.canLeap) + this.tasks.addTask(this.taskCount++, aiLeap = new EntityAILeapAtTarget(this, 0.4F)); + } + + /* + * Branch task function for sprinting + */ + public void setCanSprint() { + if (this.ai.canSprint) + this.tasks.addTask(this.taskCount++, aiSprint = new EntityAISprintToTarget(this)); + } + + /* + * Add immutable task entries. + */ + public void addRegularEntries() { + this.tasks.addTask(this.taskCount++, new EntityAIReturn(this)); + this.tasks.addTask(this.taskCount++, new EntityAIFollow(this)); + if (this.ai.standingType != EnumStandingType.NoRotation && this.ai.standingType != EnumStandingType.HeadRotation) + this.tasks.addTask(this.taskCount++, new EntityAIWatchClosest(this, EntityLivingBase.class, 5.0F)); + this.tasks.addTask(this.taskCount++, new EntityAILook(this)); + this.tasks.addTask(this.taskCount++, new EntityAIWorldLines(this)); + this.tasks.addTask(this.taskCount++, new EntityAIJob(this)); + this.tasks.addTask(this.taskCount++, new EntityAIRole(this)); + this.tasks.addTask(this.taskCount++, new EntityAIAnimation(this)); + if(transform.isValid()) + this.tasks.addTask(this.taskCount++, new EntityAITransform(this)); + } + + /* + * Function for getting proper move speeds. This way we don't have to modify them every time we use them. + */ + public float getSpeed() { + return (float)ai.getWalkingSpeed() / 20.0F; + } + + @Override + public float getBlockPathWeight(int par1, int par2, int par3){ + float weight = this.worldObj.getLightBrightness(par1, par2, par3) - 0.5F; + Block block = worldObj.getBlock(par1, par2, par3); + if(block.isOpaqueCube()) + weight += 10; + return weight; + } + + /* + * Used for getting the applied potion effect from dataStats. + */ + private int getPotionEffect(EnumPotionType p) { + switch(p) + { + case Poison : return Potion.poison.id; + case Hunger : return Potion.hunger.id; + case Weakness : return Potion.weakness.id; + case Slowness : return Potion.moveSlowdown.id; + case Nausea : return Potion.confusion.id; + case Blindness : return Potion.blindness.id; + case Wither : return Potion.wither.id; + default : return 0; + } + } + + @Override + protected int decreaseAirSupply(int par1) + { + if (!this.stats.canDrown) + return par1; + return super.decreaseAirSupply(par1); + } + + @Override + public EnumCreatureAttribute getCreatureAttribute() + { + return this.stats.creatureType; + } + + /** + * Returns the sound this mob makes while it's alive. + */ + @Override + protected String getLivingSound() { + if (!this.isEntityAlive()) + return null; + if (this.getAttackTarget() != null) + return advanced.angrySound.isEmpty() ? null : advanced.angrySound; + + return advanced.idleSound.isEmpty() ? null : advanced.idleSound; + } + + @Override + public int getTalkInterval(){ + return 160; + } + /** + * Returns the sound this mob makes when it is hurt. + */ + @Override + protected String getHurtSound(){ + if(this.advanced.hurtSound.isEmpty()) + return null; + return this.advanced.hurtSound; + } + + /** + * Returns the sound this mob makes on death. + */ + @Override + protected String getDeathSound(){ + if(this.advanced.deathSound.isEmpty()) + return null; + return this.advanced.deathSound; + } + + @Override + protected float getSoundPitch(){ + if(this.advanced.disablePitch) + return 1; + return super.getSoundPitch(); + } + + /** + * Plays step sound at given x, y, z for the entity + */ + @Override + protected void func_145780_a(int p_145780_1_, int p_145780_2_, int p_145780_3_, Block p_145780_4_) + { + if (!this.advanced.stepSound.equals("")) + { + this.playSound(this.advanced.stepSound, 0.15F, 1.0F); + } + else + { + super.func_145780_a(p_145780_1_, p_145780_2_, p_145780_3_, p_145780_4_); + } + } + + + public EntityPlayerMP getFakePlayer(){ + if(worldObj.isRemote) + return null; + if(chateventPlayer == null) + chateventPlayer = new FakePlayer((WorldServer)worldObj, chateventProfile); + EntityUtil.Copy(this, chateventPlayer); + chateventProfile.npc = this; + chateventPlayer.refreshDisplayName(); + return chateventPlayer; + } + + public void saySurrounding(Line line) { + if (line == null || line.text == null) + return; + ServerChatEvent event = new ServerChatEvent(getFakePlayer(), line.text, new ChatComponentTranslation(line.text.replace("%", "%%"))); + if (MinecraftForge.EVENT_BUS.post(event) || event.component == null){ + return; + } + line.text = event.component.getUnformattedText().replace("%%", "%"); + List inRange = worldObj.getEntitiesWithinAABB( + EntityPlayer.class, this.boundingBox.expand(20D, 20D, 20D)); + for (EntityPlayer player : inRange) + say(player, line); + } + + public void say(EntityPlayer player, Line line) { + if (line == null || !this.canSee(player) || line.text == null) + return; + + if(!line.sound.isEmpty()){ + Server.sendData((EntityPlayerMP)player, EnumPacketClient.PLAY_SOUND, line.sound, (float)posX, (float)posY, (float)posZ); + } + Server.sendData((EntityPlayerMP)player, EnumPacketClient.CHATBUBBLE, this.getEntityId(), line.text, !line.hideText); + } + public boolean getAlwaysRenderNameTagForRender(){ + return true; + } + + @Override + public void addVelocity(double d, double d1, double d2) { + if (isWalking() && !isKilled()) + super.addVelocity(d, d1, d2); + } + + + @Override + public void readEntityFromNBT(NBTTagCompound compound) { + super.readEntityFromNBT(compound); + npcVersion = compound.getInteger("ModRev"); + VersionCompatibility.CheckNpcCompatibility(this, compound); + + display.readToNBT(compound); + stats.readToNBT(compound); + ai.readToNBT(compound); + script.readFromNBT(compound); + + advanced.readToNBT(compound); + if (advanced.role != EnumRoleType.None && roleInterface != null) + roleInterface.readFromNBT(compound); + if (advanced.job != EnumJobType.None && jobInterface != null) + jobInterface.readFromNBT(compound); + + inventory.readEntityFromNBT(compound); + transform.readToNBT(compound); + + killedtime = compound.getLong("KilledTime"); + totalTicksAlive = compound.getLong("TotalTicksAlive"); + + linkedName = compound.getString("LinkedNpcName"); + if(!isRemote()) + LinkedNpcController.Instance.loadNpcData(this); + + this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(CustomNpcs.NpcNavRange); + + this.updateTasks(); + } + + + + @Override + public void writeEntityToNBT(NBTTagCompound compound) { + super.writeEntityToNBT(compound); + display.writeToNBT(compound); + stats.writeToNBT(compound); + ai.writeToNBT(compound); + script.writeToNBT(compound); + + advanced.writeToNBT(compound); + if (advanced.role != EnumRoleType.None && roleInterface != null) + roleInterface.writeToNBT(compound); + if (advanced.job != EnumJobType.None && jobInterface != null) + jobInterface.writeToNBT(compound); + + inventory.writeEntityToNBT(compound); + transform.writeToNBT(compound); + + compound.setLong("KilledTime", killedtime); + compound.setLong("TotalTicksAlive", totalTicksAlive); + compound.setInteger("ModRev", npcVersion); + compound.setString("LinkedNpcName", linkedName); + } + + public void updateHitbox() { + + if(currentAnimation == EnumAnimation.LYING || currentAnimation == EnumAnimation.CRAWLING){ + width = 0.8f; + height = 0.4f; + } + else if (isRiding()){ + width = 0.6f; + height = baseHeight * 0.77f; + } + else{ + width = 0.6f; + height = baseHeight; + } + width = (width / 5f) * display.modelSize; + height = (height / 5f) * display.modelSize; + + this.setPosition(posX, posY, posZ); + } + + @Override + public void onDeathUpdate(){ + if(stats.spawnCycle == 3){ + super.onDeathUpdate(); + return; + } + + ++this.deathTime; + if(worldObj.isRemote) + return; + if(!hasDied){ + setDead(); + } + if (killedtime < System.currentTimeMillis()) { + if (stats.spawnCycle == 0 || (this.worldObj.isDaytime() && stats.spawnCycle == 1) || (!this.worldObj.isDaytime() && stats.spawnCycle == 2)) { + reset(); + } + } + } + + public void reset() { + hasDied = false; + isDead = false; + wasKilled = false; + setSprinting(false); + setHealth(getMaxHealth()); + dataWatcher.updateObject(14, 0); // animation Normal + dataWatcher.updateObject(15, 0); + this.setAttackTarget(null); + this.setRevengeTarget(null); + this.deathTime = 0; + //fleeingTick = 0; + if(ai.returnToStart && !hasOwner()) + setLocationAndAngles(getStartXPos(), getStartYPos(), getStartZPos(), rotationYaw, rotationPitch); + killedtime = 0; + extinguish(); + this.clearActivePotions(); + moveEntityWithHeading(0,0); + distanceWalkedModified = 0; + getNavigator().clearPathEntity(); + currentAnimation = EnumAnimation.NONE; + updateHitbox(); + updateAI = true; + ai.movingPos = 0; + if(getOwner() != null){ + getOwner().setLastAttacker(null); + } + + if(jobInterface != null) + jobInterface.reset(); + + script.callScript(EnumScriptType.INIT); + } + + public void onCollide() { + if(!isEntityAlive() || ticksExisted % 4 != 0) + return; + + AxisAlignedBB axisalignedbb = null; + + if (this.ridingEntity != null && this.ridingEntity.isEntityAlive()){ + axisalignedbb = this.boundingBox.func_111270_a(this.ridingEntity.boundingBox).expand(1.0D, 0.0D, 1.0D); + } + else{ + axisalignedbb = this.boundingBox.expand(1.0D, 0.5D, 1.0D); + } + + List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, axisalignedbb); + if(list == null) + return; + + for (int i = 0; i < list.size(); ++i){ + Entity entity = (Entity)list.get(i); + if (entity.isEntityAlive()) + script.callScript(EnumScriptType.COLLIDE, "entity", entity); + } + + } + + + + @Override + public void setInPortal(){ + //prevent npcs from walking into portals + } + + public double field_20066_r; + public double field_20065_s; + public double field_20064_t; + public double field_20063_u; + public double field_20062_v; + public double field_20061_w; + + public void cloakUpdate() { + field_20066_r = field_20063_u; + field_20065_s = field_20062_v; + field_20064_t = field_20061_w; + double d = posX - field_20063_u; + double d1 = posY - field_20062_v; + double d2 = posZ - field_20061_w; + double d3 = 10D; + if (d > d3) { + field_20066_r = field_20063_u = posX; + } + if (d2 > d3) { + field_20064_t = field_20061_w = posZ; + } + if (d1 > d3) { + field_20065_s = field_20062_v = posY; + } + if (d < -d3) { + field_20066_r = field_20063_u = posX; + } + if (d2 < -d3) { + field_20064_t = field_20061_w = posZ; + } + if (d1 < -d3) { + field_20065_s = field_20062_v = posY; + } + field_20063_u += d * 0.25D; + field_20061_w += d2 * 0.25D; + field_20062_v += d1 * 0.25D; + } + + @Override + protected boolean canDespawn() { + return stats.canDespawn; + } + + @Override + public ItemStack getHeldItem() { + if (isAttacking()) + return inventory.getWeapon(); + else if(advanced.role == EnumRoleType.Companion) + return ((RoleCompanion)roleInterface).getHeldItem(); + else if (jobInterface != null && jobInterface.overrideMainHand) + return jobInterface.mainhand; + else + return inventory.getWeapon(); + } + + @Override + public ItemStack getEquipmentInSlot(int slot){ + if(slot == 0) + return inventory.weapons.get(0); + return inventory.armorItemInSlot(4 - slot); + } + + @Override + public ItemStack func_130225_q(int slot){ + return inventory.armorItemInSlot(3 - slot); + } + + @Override + public void setCurrentItemOrArmor(int slot, ItemStack item){ + if(slot == 0) + inventory.setWeapon(item); + else{ + inventory.armor.put(4 - slot, item); + } + } + private static final ItemStack[] lastActive = new ItemStack[5]; + @Override + public ItemStack[] getLastActiveItems(){ + return lastActive; + } + + @Override + protected void dropEquipment(boolean p_82160_1_, int p_82160_2_){ + + } + + public ItemStack getOffHand() { + if (isAttacking()) + return inventory.getOffHand(); + else if (jobInterface != null && jobInterface.overrideOffHand) + return jobInterface.offhand; + else + return inventory.getOffHand(); + } + + @Override + public void onDeath(DamageSource damagesource){ + setSprinting(false); + getNavigator().clearPathEntity(); + extinguish(); + clearActivePotions(); + + Entity entity = damagesource.getEntity(); + + EntityLivingBase attackingEntity = null; + + if (entity instanceof EntityLivingBase) + attackingEntity = (EntityLivingBase) entity; + + if ((entity instanceof EntityArrow) && ((EntityArrow) entity).shootingEntity instanceof EntityLivingBase) + attackingEntity = (EntityLivingBase) ((EntityArrow) entity).shootingEntity; + else if ((entity instanceof EntityThrowable)) + attackingEntity = ((EntityThrowable) entity).getThrower(); + + ScriptEventKilled result = new ScriptEventKilled(attackingEntity, damagesource); + if(script.callScript(EnumScriptType.KILLED, "event", result)) + return; + if(!isRemote()){ + if(this.recentlyHit > 0) + inventory.dropStuff(entity, damagesource); + Line line = advanced.getKilledLine(); + if(line != null) + saySurrounding(line.formatTarget(attackingEntity)); + } + super.onDeath(damagesource); + } + + @Override + public void setDead() { + hasDied = true; + if(worldObj.isRemote || stats.spawnCycle == 3){ + this.spawnExplosionParticle(); + delete(); + } + else { + if(this.riddenByEntity != null) + this.riddenByEntity.mountEntity(null); + if(this.ridingEntity != null) + this.mountEntity(null); + setHealth(-1); + setSprinting(false); + getNavigator().clearPathEntity(); + if(killedtime <= 0) + killedtime = stats.respawnTime * 1000 + System.currentTimeMillis(); + + if (advanced.role != EnumRoleType.None && roleInterface != null) + roleInterface.killed(); + if (advanced.job != EnumJobType.None && jobInterface != null) + jobInterface.killed(); + } + } + + public void delete() { + if (advanced.role != EnumRoleType.None && roleInterface != null) + roleInterface.delete(); + if (advanced.job != EnumJobType.None && jobInterface != null) + jobInterface.delete(); + super.setDead(); + } + + public float getStartXPos(){ + + return getStartPos()[0] + ai.bodyOffsetX / 10; + } + + public float getStartZPos(){ + return getStartPos()[2] + ai.bodyOffsetZ / 10; + } + + public int[] getStartPos(){ + if(ai.startPos == null || ai.startPos.length != 3) + ai.startPos = new int[] { + MathHelper.floor_double(posX), + MathHelper.floor_double(posY), + MathHelper.floor_double(posZ) }; + return ai.startPos; + } + + public boolean isVeryNearAssignedPlace() { + double xx = posX - getStartXPos(); + double zz = posZ - getStartZPos(); + if (xx < -0.2 || xx > 0.2) + return false; + if (zz < -0.2 || zz > 0.2) + return false; + return true; + } + + @Override + public IIcon getItemIcon(ItemStack par1ItemStack, int par2){ + if (par1ItemStack.getItem() == Items.bow){ + return Items.bow.getIcon(par1ItemStack, par2); + } + EntityPlayer player = CustomNpcs.proxy.getPlayer(); + if(player == null) + return super.getItemIcon(par1ItemStack, par2); + return player.getItemIcon(par1ItemStack, par2); + } + + public double getStartYPos() { + int i = getStartPos()[0]; + int j = getStartPos()[1]; + int k = getStartPos()[2]; + double yy = 0; + for (int ii = j; ii >= 0; ii--) { + Block block = worldObj.getBlock(i, ii, k); + if (block == null) + continue; + AxisAlignedBB bb = block.getCollisionBoundingBoxFromPool(worldObj, i, ii, k); + if (bb == null) + continue; + yy = bb.maxY; + break; + } + if (yy <= 0) + setDead(); + yy += 0.5; + return yy; + } + + public void givePlayerItem(EntityPlayer player, ItemStack item) { + if (worldObj.isRemote) { + return; + } + item = item.copy(); + float f = 0.7F; + double d = (double) (worldObj.rand.nextFloat() * f) + + (double) (1.0F - f); + double d1 = (double) (worldObj.rand.nextFloat() * f) + + (double) (1.0F - f); + double d2 = (double) (worldObj.rand.nextFloat() * f) + + (double) (1.0F - f); + EntityItem entityitem = new EntityItem(worldObj, posX + d, posY + d1, + posZ + d2, item); + entityitem.delayBeforeCanPickup = 2; + worldObj.spawnEntityInWorld(entityitem); + + int i = item.stackSize; + + if (player.inventory.addItemStackToInventory(item)) { + worldObj.playSoundAtEntity( + entityitem, + "random.pop", + 0.2F, + ((rand.nextFloat() - rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); + player.onItemPickup(entityitem, i); + + if (item.stackSize <= 0) { + entityitem.setDead(); + } + } + } + + @Override + public boolean isPlayerSleeping() { + return currentAnimation == EnumAnimation.LYING && !isAttacking(); + } + + @Override + public boolean isRiding() { + return currentAnimation == EnumAnimation.SITTING && !isAttacking() || ridingEntity != null; + } + + public boolean isWalking() { + return ai.movingType != EnumMovingType.Standing || isAttacking() || isFollower() || getBoolFlag(1); + } + + public void setBoolFlag(boolean bo, int id){ + int i = dataWatcher.getWatchableObjectInt(15); + if(bo && (i & id) == 0) + dataWatcher.updateObject(15, i | id); + if(!bo && (i & id) != 0) + dataWatcher.updateObject(15, i - id); + } + + /** + * 1: walking, 2:interacting, 4:attacking, 8:killed + */ + public boolean getBoolFlag(int id){ + return (dataWatcher.getWatchableObjectInt(15) & id) != 0; + } + + @Override + public boolean isSneaking() { + return currentAnimation == EnumAnimation.SNEAKING; + } + @Override + public void knockBack(Entity par1Entity, float par2, double par3, double par5) + { + if(stats.resistances.knockback >= 2) + return; + this.isAirBorne = true; + float f1 = MathHelper.sqrt_double(par3 * par3 + par5 * par5); + float f2 = 0.5F * (2 - stats.resistances.knockback); + this.motionX /= 2.0D; + this.motionY /= 2.0D; + this.motionZ /= 2.0D; + this.motionX -= par3 / (double)f1 * (double)f2; + this.motionY += 0.2 + f2 / 2; + this.motionZ -= par5 / (double)f1 * (double)f2; + + if (this.motionY > 0.4000000059604645D) + { + this.motionY = 0.4000000059604645D; + } + } + + public Faction getFaction() { + String[] split = dataWatcher.getWatchableObjectString(13).split(":"); + int faction = 0; + if(worldObj == null || split.length <= 1 && worldObj.isRemote) + return new Faction(); + if(split.length > 1) + faction = Integer.parseInt(split[0]); + if(worldObj.isRemote){ + Faction fac = new Faction(); + fac.id = faction; + fac.color = Integer.parseInt(split[1]); + fac.name = split[2]; + return fac; + } + else{ + Faction fac = FactionController.getInstance().getFaction(faction); + if (fac == null) { + faction = FactionController.getInstance().getFirstFactionId(); + fac = FactionController.getInstance().getFaction(faction); + } + return fac; + } + } + public boolean isRemote(){ + return worldObj == null || worldObj.isRemote; + } + public void setFaction(int integer) { + if(integer < 0|| isRemote()) + return; + Faction faction = FactionController.getInstance().getFaction(integer); + if(faction == null) + return; + String str = faction.id + ":" + faction.color + ":" + faction.name; + if(str.length() > 64) + str = str.substring(0, 64); + dataWatcher.updateObject(13, str); + } + + @Override + public boolean isPotionApplicable(PotionEffect effect){ + if(stats.potionImmune) + return false; + if(getCreatureAttribute() == EnumCreatureAttribute.ARTHROPOD && effect.getPotionID() == Potion.poison.id) + return false; + return super.isPotionApplicable(effect); + } + + public boolean isAttacking() { + return getBoolFlag(4); + } + + public boolean isKilled() { + return getBoolFlag(8) || isDead; + } + + @Override + public void writeSpawnData(ByteBuf buffer) { + try { + Server.writeNBT(buffer, writeSpawnData()); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public NBTTagCompound writeSpawnData() { + NBTTagCompound compound = new NBTTagCompound(); + display.writeToNBT(compound); + compound.setInteger("MaxHealth", stats.maxHealth); + compound.setTag("Armor", NBTTags.nbtItemStackList(inventory.getArmor())); + compound.setTag("Weapons", NBTTags.nbtItemStackList(inventory.getWeapons())); + compound.setInteger("Speed", ai.getWalkingSpeed()); + compound.setBoolean("DeadBody", stats.hideKilledBody); + compound.setInteger("StandingState", ai.standingType.ordinal()); + compound.setInteger("MovingState", ai.movingType.ordinal()); + compound.setInteger("Orientation", ai.orientation); + compound.setInteger("Role", advanced.role.ordinal()); + compound.setInteger("Job", advanced.job.ordinal()); + if(advanced.job == EnumJobType.Bard){ + NBTTagCompound bard = new NBTTagCompound(); + jobInterface.writeToNBT(bard); + compound.setTag("Bard", bard); + } + if(advanced.job == EnumJobType.Puppet){ + NBTTagCompound bard = new NBTTagCompound(); + jobInterface.writeToNBT(bard); + compound.setTag("Puppet", bard); + } + if(advanced.role == EnumRoleType.Companion){ + NBTTagCompound bard = new NBTTagCompound(); + roleInterface.writeToNBT(bard); + compound.setTag("Companion", bard); + } + + if(this instanceof EntityCustomNpc){ + compound.setTag("ModelData", ((EntityCustomNpc)this).modelData.writeToNBT()); + } + return compound; + } + @Override + public void readSpawnData(ByteBuf buf) { + try { + readSpawnData(Server.readNBT(buf)); + } catch (IOException e) { + } + } + public void readSpawnData(NBTTagCompound compound) { + stats.maxHealth = compound.getInteger("MaxHealth"); + ai.setWalkingSpeed(compound.getInteger("Speed")); + stats.hideKilledBody = compound.getBoolean("DeadBody"); + ai.standingType = EnumStandingType.values()[compound.getInteger("StandingState") % EnumStandingType.values().length]; + ai.movingType = EnumMovingType.values()[compound.getInteger("MovingState") % EnumMovingType.values().length]; + ai.orientation = compound.getInteger("Orientation"); + + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(stats.maxHealth); + inventory.setArmor(NBTTags.getItemStackList(compound.getTagList("Armor", 10))); + inventory.setWeapons(NBTTags.getItemStackList(compound.getTagList("Weapons", 10))); + advanced.setRole(compound.getInteger("Role")); + advanced.setJob(compound.getInteger("Job")); + if(advanced.job == EnumJobType.Bard){ + NBTTagCompound bard = compound.getCompoundTag("Bard"); + jobInterface.readFromNBT(bard); + } + if(advanced.job == EnumJobType.Puppet){ + NBTTagCompound puppet = compound.getCompoundTag("Puppet"); + jobInterface.readFromNBT(puppet); + } + if(advanced.role == EnumRoleType.Companion){ + NBTTagCompound puppet = compound.getCompoundTag("Companion"); + roleInterface.readFromNBT(puppet); + } + if(this instanceof EntityCustomNpc){ + ((EntityCustomNpc)this).modelData.readFromNBT(compound.getCompoundTag("ModelData")); + } + display.readToNBT(compound); + } + + @Override + public String getCommandSenderName() { + return display.name; + } + + @Override + public boolean canCommandSenderUseCommand(int var1, String var2) { + if(CustomNpcs.NpcUseOpCommands) + return true; + return var1 <= 2; + } + + @Override + public ChunkCoordinates getPlayerCoordinates() { + return new ChunkCoordinates(MathHelper.floor_double(posX), MathHelper.floor_double(posY), MathHelper.floor_double(posZ)); + } + + @Override + public boolean canAttackClass(Class par1Class) + { + return EntityBat.class != par1Class; + } + public void setImmuneToFire(boolean immuneToFire) { + this.isImmuneToFire = immuneToFire; + stats.immuneToFire = immuneToFire; + } + + public void setAvoidWater(boolean avoidWater) { + this.getNavigator().setAvoidsWater(avoidWater); + ai.avoidsWater = avoidWater; + } + @Override + protected void fall(float par1) { + if (!this.stats.noFallDamage) + super.fall(par1); + } + @Override + public void setInWeb(){ + if(!ai.ignoreCobweb) + super.setInWeb(); + } + @Override + public boolean canBeCollidedWith(){ + return !isKilled(); + } + + public EntityAIRangedAttack getRangedTask(){ + return this.aiRange; + } + + public String getRoleDataWatcher(){ + return dataWatcher.getWatchableObjectString(16); + } + + public void setRoleDataWatcher(String s){ + dataWatcher.updateObject(16, s); + } + + @Override + public World getEntityWorld() { + return worldObj; + } + + @Override + public boolean isInvisibleToPlayer(EntityPlayer player){ + return display.visible == 1 && (player.getHeldItem() == null || player.getHeldItem().getItem() != CustomItems.wand); + } + + @Override + public boolean isInvisible(){ + return display.visible != 0; + } + + @Override + public void addChatMessage(IChatComponent var1) {} + + public void setCurrentAnimation(EnumAnimation animation) { + currentAnimation = animation; + dataWatcher.updateObject(14, animation.ordinal()); + } + + public boolean canSee(Entity entity){ + return this.getEntitySenses().canSee(entity); + } + + public boolean isFollower() { + return advanced.role == EnumRoleType.Follower && ((RoleFollower) roleInterface).isFollowing() || + advanced.role == EnumRoleType.Companion && ((RoleCompanion) roleInterface).isFollowing() || + advanced.job == EnumJobType.Follower && ((JobFollower)jobInterface).isFollowing(); + } + + public EntityLivingBase getOwner(){ + if(roleInterface instanceof RoleFollower) + return ((RoleFollower)roleInterface).owner; + + if(roleInterface instanceof RoleCompanion) + return ((RoleCompanion)roleInterface).owner; + + if(jobInterface instanceof JobFollower) + return ((JobFollower)jobInterface).following; + + return null; + } + + public boolean hasOwner(){ + return advanced.role == EnumRoleType.Follower && ((RoleFollower) roleInterface).hasOwner() || + advanced.role == EnumRoleType.Companion && ((RoleCompanion) roleInterface).hasOwner() || + advanced.job == EnumJobType.Follower && ((JobFollower)jobInterface).hasOwner(); + } + + public int followRange() { + if(advanced.role == EnumRoleType.Follower && ((RoleFollower) roleInterface).isFollowing()) + return 36; + if(advanced.role == EnumRoleType.Companion && ((RoleCompanion) roleInterface).isFollowing()) + return ((RoleCompanion) roleInterface).followRange(); + if(advanced.job == EnumJobType.Follower && ((JobFollower)jobInterface).isFollowing()) + return 16; + + return 225; + } + + @Override + public void setHomeArea(int x, int y, int z, int range){ + super.setHomeArea(x, y, z, range); + ai.startPos = new int[]{x, y, z}; + } + + @Override + protected float applyArmorCalculations(DamageSource source, float damage){ + if(advanced.role == EnumRoleType.Companion) + damage = ((RoleCompanion)roleInterface).applyArmorCalculations(source, damage); + return damage; + } + + @Override + public boolean isOnSameTeam(EntityLivingBase entity){ + if(entity instanceof EntityPlayer && !isRemote() && getFaction().isFriendlyToPlayer((EntityPlayer)entity)) + return true; + return super.isOnSameTeam(entity); + } + + public void setDataWatcher(DataWatcher dataWatcher) { + this.dataWatcher = dataWatcher; + } + + @Override + public void moveEntityWithHeading(float p_70612_1_, float p_70612_2_){ + double d0 = this.posX; + double d1 = this.posY; + double d2 = this.posZ; + super.moveEntityWithHeading(p_70612_1_, p_70612_2_); + if(advanced.role == EnumRoleType.Companion && !isRemote()) + ((RoleCompanion)roleInterface).addMovementStat(this.posX - d0, this.posY - d1, this.posZ - d2); + } + + @Override + public boolean allowLeashing(){ + return false; + } + + @Override + public boolean shouldDismountInWater(Entity rider){ + return false; + } +} diff --git a/src/main/java/noppes/npcs/entity/EntityNpcCrystal.java b/src/main/java/noppes/npcs/entity/EntityNpcCrystal.java new file mode 100644 index 000000000..acc159443 --- /dev/null +++ b/src/main/java/noppes/npcs/entity/EntityNpcCrystal.java @@ -0,0 +1,45 @@ +// 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 fieldsfirst + +package noppes.npcs.entity; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import noppes.npcs.ModelData; + +// Referenced classes of package net.minecraft.src: +// EntityAnimal, Item, EntityPlayer, InventoryPlayer, +// ItemStack, World, NBTTagCompound + +public class EntityNpcCrystal extends EntityNPCInterface +{ + public EntityNpcCrystal(World world) + { + super(world); + scaleX = 0.7f; + scaleY = 0.7f; + scaleZ = 0.7f; + display.texture = "customnpcs:textures/entity/crystal/EnderCrystal.png"; + } + + @Override + public void onUpdate() + { + isDead = true; + if(!worldObj.isRemote){ + NBTTagCompound compound = new NBTTagCompound(); + + writeToNBT(compound); + EntityCustomNpc npc = new EntityCustomNpc(worldObj); + npc.readFromNBT(compound); + ModelData data = npc.modelData; + data.setEntityClass(EntityNpcCrystal.class); + + + worldObj.spawnEntityInWorld(npc); + } + super.onUpdate(); + } + +} diff --git a/src/main/java/noppes/npcs/entity/EntityNpcDragon.java b/src/main/java/noppes/npcs/entity/EntityNpcDragon.java new file mode 100644 index 000000000..45d49956c --- /dev/null +++ b/src/main/java/noppes/npcs/entity/EntityNpcDragon.java @@ -0,0 +1,121 @@ +package noppes.npcs.entity; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import noppes.npcs.ModelData; + +public class EntityNpcDragon extends EntityNPCInterface{ + public EntityNpcDragon(World world) + { + super(world); + field_40162_d = new double[64][3]; + field_40164_e = -1; + field_40173_aw = 0.0F; + field_40172_ax = 0.0F; + field_40178_aA = 0; + scaleX = 0.4f; + scaleY = 0.4f; + scaleZ = 0.4f; + display.texture = "customnpcs:textures/entity/dragon/BlackDragon.png"; + + width = 1.8f; + height = 1.4f; + } + public double field_40162_d[][]; + public int field_40164_e; + public float field_40173_aw; + public float field_40172_ax; + public int field_40178_aA; + + public boolean isFlying = false; + + @Override + public double getMountedYOffset(){ + return 1.1; + } + + public double[] func_40160_a(int i, float f) + { + f = 1.0F - f; + int j = field_40164_e - i * 1 & 0x3f; + int k = field_40164_e - i * 1 - 1 & 0x3f; + double ad[] = new double[3]; + double d = field_40162_d[j][0]; + double d1; + for(d1 = field_40162_d[k][0] - d; d1 < -180D; d1 += 360D) { } + for(; d1 >= 180D; d1 -= 360D) { } + ad[0] = d + d1 * (double)f; + d = field_40162_d[j][1]; + d1 = field_40162_d[k][1] - d; + ad[1] = d + d1 * (double)f; + ad[2] = field_40162_d[j][2] + (field_40162_d[k][2] - field_40162_d[j][2]) * (double)f; + return ad; + } + public void onUpdate() + { + isDead = true; + + if(!worldObj.isRemote){ + NBTTagCompound compound = new NBTTagCompound(); + + writeToNBT(compound); + EntityCustomNpc npc = new EntityCustomNpc(worldObj); + npc.readFromNBT(compound); + ModelData data = npc.modelData; + data.setEntityClass(EntityNpcDragon.class); + + + worldObj.spawnEntityInWorld(npc); + } + super.onUpdate(); + } + private boolean exploded = false; + @Override + public void onLivingUpdate() + { + field_40173_aw = field_40172_ax; + if(worldObj.isRemote && getHealth() <= 0) + { + if(!exploded){ + exploded = true; + float f = (rand.nextFloat() - 0.5F) * 8F; + float f2 = (rand.nextFloat() - 0.5F) * 4F; + float f4 = (rand.nextFloat() - 0.5F) * 8F; + worldObj.spawnParticle("largeexplode", posX + (double)f, posY + 2D + (double)f2, posZ + (double)f4, 0.0D, 0.0D, 0.0D); + } + } + else{ + exploded = false; + //func_41011_ay(); + float f1 = 0.2F / (MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ) * 10F + 1.0F); + f1 = 0.045f; + f1 *= (float)Math.pow(2D, motionY); + field_40172_ax += f1 * 0.5F; + } + super.onLivingUpdate(); + } + +// public float ticks = 0.0f; +// public void updateRiderPosition() +// { +// if (riddenByEntity == null) +// { +// super.updateRiderPosition(); +// return; +// } +// else +// { +// float f6 = field_40173_aw + (field_40172_ax - field_40173_aw) * ticks; +// float f7 = (float)(Math.sin(f6 * 3.141593F * 2.0F - 1.0F) + 1.0D); +// riddenByEntity.setPosition(posX , posY + getMountedYOffset() + riddenByEntity.getYOffset() - f7 / 12, posZ); +// return; +// } +// } + @Override + public void updateHitbox() { + width = 1.8f; + height = 1.4f; + } + +} diff --git a/src/main/java/noppes/npcs/entity/EntityNpcPony.java b/src/main/java/noppes/npcs/entity/EntityNpcPony.java new file mode 100644 index 000000000..27f657ed2 --- /dev/null +++ b/src/main/java/noppes/npcs/entity/EntityNpcPony.java @@ -0,0 +1,42 @@ +package noppes.npcs.entity; + +import net.minecraft.entity.passive.EntityVillager; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; +import noppes.npcs.ModelData; + +public class EntityNpcPony extends EntityNPCInterface +{ + public boolean isPegasus = false; + public boolean isUnicorn = false; + public boolean isFlying = false; + + public ResourceLocation checked = null; + + public EntityNpcPony(World world) + { + super(world); + display.texture = "customnpcs:textures/entity/ponies/MineLP Derpy Hooves.png"; + } + + public void onUpdate() + { + isDead = true; + + if(!worldObj.isRemote){ + NBTTagCompound compound = new NBTTagCompound(); + + writeToNBT(compound); + EntityCustomNpc npc = new EntityCustomNpc(worldObj); + npc.readFromNBT(compound); + ModelData data = npc.modelData; + data.setEntityClass(EntityNpcPony.class); + + + worldObj.spawnEntityInWorld(npc); + } + super.onUpdate(); + } + +} diff --git a/src/main/java/noppes/npcs/entity/EntityNpcSlime.java b/src/main/java/noppes/npcs/entity/EntityNpcSlime.java new file mode 100644 index 000000000..b2cf83ec0 --- /dev/null +++ b/src/main/java/noppes/npcs/entity/EntityNpcSlime.java @@ -0,0 +1,43 @@ +package noppes.npcs.entity; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import noppes.npcs.ModelData; + +public class EntityNpcSlime extends EntityNPCInterface{ + public EntityNpcSlime(World world) + { + super(world); + scaleX = 2f; + scaleY = 2f; + scaleZ = 2f; + display.texture = "customnpcs:textures/entity/slime/Slime.png"; + width = 0.8f; + height = 0.8f; + } + @Override + public void updateHitbox() { + width = 0.8f; + height = 0.8f; + } + + @Override + public void onUpdate() + { + isDead = true; + + if(!worldObj.isRemote){ + NBTTagCompound compound = new NBTTagCompound(); + + writeToNBT(compound); + EntityCustomNpc npc = new EntityCustomNpc(worldObj); + npc.readFromNBT(compound); + ModelData data = npc.modelData; + data.setEntityClass(EntityNpcSlime.class); + + + worldObj.spawnEntityInWorld(npc); + } + super.onUpdate(); + } +} diff --git a/src/main/java/noppes/npcs/entity/EntityProjectile.java b/src/main/java/noppes/npcs/entity/EntityProjectile.java new file mode 100644 index 000000000..dec7f789e --- /dev/null +++ b/src/main/java/noppes/npcs/entity/EntityProjectile.java @@ -0,0 +1,919 @@ +package noppes.npcs.entity; + +import java.util.Iterator; +import java.util.List; +import java.util.UUID; + +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.monster.EntityEnderman; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.entity.projectile.EntityThrowable; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.network.play.server.S27PacketExplosion; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.DamageSource; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.MovingObjectPosition.MovingObjectType; +import net.minecraft.util.Vec3; +import net.minecraft.world.Explosion; +import net.minecraft.world.World; +import noppes.npcs.DataStats; +import noppes.npcs.constants.EnumParticleType; +import noppes.npcs.constants.EnumPotionType; +import noppes.npcs.util.IProjectileCallback; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + + +public class EntityProjectile extends EntityThrowable { + + private int xTile = -1; + private int yTile = -1; + private int zTile = -1; + private Block inTile; + protected boolean inGround = false; + private int inData = 0; + public int throwableShake = 0; + public int arrowShake = 0; + + public boolean canBePickedUp = false; + public boolean destroyedOnEntityHit = true; + + /** + * Is the entity that throws this 'thing' (snowball, ender pearl, eye of ender or potion) + */ + private EntityLivingBase thrower; + private EntityNPCInterface npc; + public EntityItem entityitem; + private String throwerName = null; + private int ticksInGround; + public int ticksInAir = 0; + + private double accelerationX; + private double accelerationY; + private double accelerationZ; + + /** + * Properties settable by GUI + */ + + public float damage = 5; + public int punch = 0; + public boolean accelerate = false; + public boolean explosive = false; + public boolean explosiveDamage = true; + public int explosiveRadius = 0; + public EnumPotionType effect = EnumPotionType.None; + public int duration = 5; + public int amplify = 0; + + public IProjectileCallback callback; + public ItemStack callbackItem; + + + public EntityProjectile(World par1World) + { + super(par1World); + this.setSize(0.25F, 0.25F); + } + + protected void entityInit() { + this.dataWatcher.addObjectByDataType(21, 5); + this.dataWatcher.addObject(22, String.valueOf(""));//particle + this.dataWatcher.addObject(23, Integer.valueOf(5));//size + this.dataWatcher.addObject(24, Byte.valueOf((byte)0));//glows + this.dataWatcher.addObject(25, Integer.valueOf(10));//velocity + this.dataWatcher.addObject(26, Byte.valueOf((byte)0));//gravity + this.dataWatcher.addObject(27, Byte.valueOf((byte)0));//Arrow + this.dataWatcher.addObject(28, Byte.valueOf((byte)0));//3D + this.dataWatcher.addObject(29, Byte.valueOf((byte)0));//Rotating + this.dataWatcher.addObject(30, Byte.valueOf((byte)0));//Sticks + this.dataWatcher.addObject(31, Byte.valueOf((byte)0));//FakeExplosion + } + + @SideOnly(Side.CLIENT) + + /** + * Checks if the entity is in range to render by using the past in distance and comparing it to its average edge + * length * 64 * renderDistanceWeight Args: distance + */ + public boolean isInRangeToRenderDist(double par1) + { + double d1 = this.boundingBox.getAverageEdgeLength() * 4.0D; + d1 *= 64.0D; + return par1 < d1 * d1; + } + + public EntityProjectile(World par1World, EntityLivingBase par2EntityLiving, ItemStack item, boolean isNPC) + { + super(par1World); + this.thrower = par2EntityLiving; + if(this.thrower != null) + this.throwerName = this.thrower.getUniqueID().toString(); + setThrownItem(item); + this.dataWatcher.updateObject(27, Byte.valueOf((byte) ((this.getItem() == Items.arrow) ? 1 : 0))); + this.setSize(this.dataWatcher.getWatchableObjectInt(23) / 10 , this.dataWatcher.getWatchableObjectInt(23) / 10); + this.setLocationAndAngles(par2EntityLiving.posX, par2EntityLiving.posY + (double)par2EntityLiving.getEyeHeight(), par2EntityLiving.posZ, par2EntityLiving.rotationYaw, par2EntityLiving.rotationPitch); + this.posX -= (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * 0.1F); + this.posY -= 0.1f; + this.posZ -= (double)(MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * 0.1F); + this.setPosition(this.posX, this.posY, this.posZ); + this.yOffset = 0.0F; + + if (isNPC) { + this.npc = (EntityNPCInterface) this.thrower; + this.getStatProperties(this.npc.stats); + } + } + + public void setThrownItem(ItemStack item){ + dataWatcher.updateObject(21, item); + } + + /** + * Par: X, Y, Z, Angle, Accuracy + */ + @Override + public void setThrowableHeading(double par1, double par3, double par5, float par7, float par8) + { + float f2 = MathHelper.sqrt_double(par1 * par1 + par3 * par3 + par5 * par5); + float f3 = MathHelper.sqrt_double(par1 * par1 + par5 * par5); + float yaw = (float)(Math.atan2(par1, par5) * 180.0D / Math.PI); + float pitch = this.hasGravity() ? par7 : (float)(Math.atan2(par3, (double)f3) * 180.0D / Math.PI); + this.prevRotationYaw = this.rotationYaw = yaw; + this.prevRotationPitch = this.rotationPitch = pitch; + this.motionX = (double)(MathHelper.sin(yaw / 180.0F * (float)Math.PI) * MathHelper.cos(pitch / 180.0F * (float)Math.PI)); + this.motionZ = (double)(MathHelper.cos(yaw / 180.0F * (float)Math.PI) * MathHelper.cos(pitch / 180.0F * (float)Math.PI)); + this.motionY = (double)(MathHelper.sin((pitch + 1.0F) / 180.0F * (float)Math.PI)); + this.motionX += this.rand.nextGaussian() * 0.007499999832361937D * (double)par8; + this.motionZ += this.rand.nextGaussian() * 0.007499999832361937D * (double)par8; + this.motionY += this.rand.nextGaussian() * 0.007499999832361937D * (double)par8; + this.motionX *= this.getSpeed(); + this.motionZ *= this.getSpeed(); + this.motionY *= this.getSpeed(); + this.accelerationX = par1 / f2 * 0.1D; + this.accelerationY = par3 / f2 * 0.1D; + this.accelerationZ = par5 / f2 * 0.1D; + this.ticksInGround = 0; + } + + /** + * get an angle for firing at coordinates XYZ + * Par: X Distance, Y Distance, Z Distance, Horizontial Distance + */ + public float getAngleForXYZ(double varX, double varY, double varZ, double horiDist, boolean arc) { + float g = this.getGravityVelocity(); + float var1 = this.getSpeed() * this.getSpeed(); + double var2 = (g * horiDist); + double var3 = ((g * horiDist * horiDist) + (2 * varY * var1)); + double var4 = (var1 * var1) - (g * var3); + if (var4 < 0) return 30.0F; + float var6 = arc ? var1 + MathHelper.sqrt_double(var4) : var1 - MathHelper.sqrt_double(var4); + float var7 = (float) (Math.atan2(var6 , var2) * 180.0D / Math.PI); + return var7; + } + + public void shoot(float speed){ + double varX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI)); + double varZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI)); + double varY = (double)(-MathHelper.sin(this.rotationPitch / 180.0F * (float)Math.PI)); + this.setThrowableHeading(varX, varY, varZ, -rotationPitch, speed); + } + + @SideOnly(Side.CLIENT) + + /** + * Sets the position and rotation. Only difference from the other one is no bounding on the rotation. Args: posX, + * posY, posZ, yaw, pitch + */ + public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9) + { + if(worldObj.isRemote && inGround) + return; + this.setPosition(par1, par3, par5); + this.setRotation(par7, par8); + } + + @Override + public void onUpdate() + { + super.onEntityUpdate(); + if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) + { + float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); + this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(this.motionY, (double)f) * 180.0D / Math.PI); + if (this.isRotating()) { + this.rotationPitch -= 20; + } + } + if (this.effect == EnumPotionType.Fire && !this.inGround) + this.setFire(1); + + + Block block = this.worldObj.getBlock(this.xTile, this.yTile, this.zTile); + + if ((this.isArrow() || this.sticksToWalls()) && block != null) + { + block.setBlockBoundsBasedOnState(this.worldObj, this.xTile, this.yTile, this.zTile); + AxisAlignedBB axisalignedbb = block.getCollisionBoundingBoxFromPool(this.worldObj, this.xTile, this.yTile, this.zTile); + + if (axisalignedbb != null && axisalignedbb.isVecInside(Vec3.createVectorHelper(this.posX, this.posY, this.posZ))) + { + this.inGround = true; + } + } + + if (this.arrowShake > 0) + { + --this.arrowShake; + } + + if (this.inGround) + { + int j = this.worldObj.getBlockMetadata(this.xTile, this.yTile, this.zTile); + if (block == this.inTile && j == this.inData) + { + ++this.ticksInGround; + + if (this.ticksInGround == 1200) + { + this.setDead(); + } + } + else + { + this.inGround = false; + this.motionX *= (double)(this.rand.nextFloat() * 0.2F); + this.motionY *= (double)(this.rand.nextFloat() * 0.2F); + this.motionZ *= (double)(this.rand.nextFloat() * 0.2F); + this.ticksInGround = 0; + this.ticksInAir = 0; + } + } + else + { + ++this.ticksInAir; + + if (this.ticksInAir == 1200) + { + this.setDead(); + } + Vec3 vec3 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ); + Vec3 vec31 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + MovingObjectPosition movingobjectposition = this.worldObj.func_147447_a(vec3, vec31, false, true, false);//rayTraceBlocks_do_do + vec3 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ); + vec31 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + + if (movingobjectposition != null) + { + vec31 = Vec3.createVectorHelper(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord); + } + if (!this.worldObj.isRemote) + { + Entity entity = null; + List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); + double d0 = 0.0D; + EntityLivingBase entityliving = this.getThrower(); + + for (int k = 0; k < list.size(); ++k) + { + Entity entity1 = (Entity)list.get(k); + + if (entity1.canBeCollidedWith() && (!entity1.isEntityEqual(this.thrower) || this.ticksInAir >= 25)) + { + float f = 0.3F; + AxisAlignedBB axisalignedbb = entity1.boundingBox.expand((double)f, (double)f, (double)f); + MovingObjectPosition movingobjectposition1 = axisalignedbb.calculateIntercept(vec3, vec31); + + if (movingobjectposition1 != null) + { + double d1 = vec3.distanceTo(movingobjectposition1.hitVec); + + if (d1 < d0 || d0 == 0.0D) + { + entity = entity1; + d0 = d1; + } + } + } + } + + if (entity != null) + { + movingobjectposition = new MovingObjectPosition(entity); + } + + if (npc != null && movingobjectposition != null && movingobjectposition.entityHit != null && movingobjectposition.entityHit instanceof EntityPlayer) + { + EntityPlayer entityplayer = (EntityPlayer)movingobjectposition.entityHit; + if (this.npc.faction.isFriendlyToPlayer(entityplayer)){ + movingobjectposition = null; + } + } + } + + if (movingobjectposition != null) + { + if (movingobjectposition.typeOfHit == MovingObjectType.BLOCK && this.worldObj.getBlock(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ) == Blocks.portal) + { + this.setInPortal(); + } + else + { + this.dataWatcher.updateObject(29, Byte.valueOf((byte)0)); + this.onImpact(movingobjectposition); + } + } + + this.posX += this.motionX; + this.posY += this.motionY; + this.posZ += this.motionZ; + float f1 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); + + for (this.rotationPitch = (float)(Math.atan2(this.motionY, (double)f1) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) + { + ; + } + + while (this.rotationPitch - this.prevRotationPitch >= 180.0F) + { + this.prevRotationPitch += 360.0F; + } + + while (this.rotationYaw - this.prevRotationYaw < -180.0F) + { + this.prevRotationYaw -= 360.0F; + } + + while (this.rotationYaw - this.prevRotationYaw >= 180.0F) + { + this.prevRotationYaw += 360.0F; + } + + float f = this.isArrow() ? 0.0F : 225.0F; + this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) + f * 0.2F; + this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F; + if (this.isRotating()) { + int spin = isBlock()? 10 : 20; + this.rotationPitch -= (this.ticksInAir % 15) * spin * getSpeed(); + } + float f2 = this.getMotionFactor(); + float f3 = this.getGravityVelocity(); + + if (this.isInWater()) + { + if(worldObj.isRemote){ + for (int k = 0; k < 4; ++k) + { + float f4 = 0.25F; + this.worldObj.spawnParticle("bubble", this.posX - this.motionX * (double)f4, this.posY - this.motionY * (double)f4, this.posZ - this.motionZ * (double)f4, this.motionX, this.motionY, this.motionZ); + } + } + + f2 = 0.8F; + } + + this.motionX *= (double)f2; + this.motionY *= (double)f2; + this.motionZ *= (double)f2; + + if (hasGravity()) + this.motionY -= (double)f3; + + if (accelerate) + { + this.motionX += this.accelerationX; + this.motionY += this.accelerationY; + this.motionZ += this.accelerationZ; + } + + if (worldObj.isRemote && !this.dataWatcher.getWatchableObjectString(22).equals("")){ + this.worldObj.spawnParticle(this.dataWatcher.getWatchableObjectString(22), this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D); + } + this.setPosition(this.posX, this.posY, this.posZ); + this.func_145775_I();//doBlockCollisions + } + } + public boolean isBlock(){ + ItemStack item = this.getItemDisplay(); + if(item == null) + return false; + return item.getItem() instanceof ItemBlock; + } + + private Item getItem(){ + ItemStack item = this.getItemDisplay(); + if(item == null) + return null; + return item.getItem(); + } + + protected float getMotionFactor() + { + return accelerate ? 0.95F : 1.0F; + } + + /** + * Called when this EntityThrowable hits a block or entity. + */ + @Override + protected void onImpact(MovingObjectPosition movingobjectposition) + { + if (movingobjectposition.entityHit != null) + { + if(callback != null && callbackItem != null && movingobjectposition.entityHit instanceof EntityLivingBase && callback.onImpact(this, (EntityLivingBase)movingobjectposition.entityHit, callbackItem)){ + return; + } + float damage = this.damage; + if(damage == 0) + damage = 0.001f; + + if (movingobjectposition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), damage)) + { + if (movingobjectposition.entityHit instanceof EntityLivingBase && (this.isArrow() || this.sticksToWalls())) + { + EntityLivingBase entityliving = (EntityLivingBase)movingobjectposition.entityHit; + + if (!this.worldObj.isRemote) + { + entityliving.setArrowCountInEntity(entityliving.getArrowCountInEntity() + 1); + } + + if (destroyedOnEntityHit && !(movingobjectposition.entityHit instanceof EntityEnderman)) + { + this.setDead(); + } + } + + if (this.isBlock()) + { + this.worldObj.playAuxSFX(2001, (int) movingobjectposition.entityHit.posX, (int) movingobjectposition.entityHit.posY, (int) movingobjectposition.entityHit.posZ, Item.getIdFromItem(getItem())); + } + else if (!this.isArrow() && !this.sticksToWalls()) + { + for (int i = 0; i < 8; ++i) + { + this.worldObj.spawnParticle("iconcrack_" + Item.getIdFromItem(getItem()), this.posX, this.posY, this.posZ, this.rand.nextGaussian() * 0.15D, this.rand.nextGaussian() * 0.2D, this.rand.nextGaussian() * 0.15D); + } + } + + if (this.punch > 0) + { + float f3 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + + if (f3 > 0.0F) + { + movingobjectposition.entityHit.addVelocity(this.motionX * (double)this.punch * 0.6000000238418579D / (double)f3, 0.1D, this.motionZ * (double)this.punch * 0.6000000238418579D / (double)f3); + } + } + + if (this.effect != EnumPotionType.None && movingobjectposition.entityHit instanceof EntityLivingBase) + { + if (this.effect != EnumPotionType.Fire) + { + int p = this.getPotionEffect(effect); + ((EntityLivingBase)movingobjectposition.entityHit).addPotionEffect(new PotionEffect(p, this.duration * 20, this.amplify)); + } + else + { + movingobjectposition.entityHit.setFire(duration); + } + } + } + else if (this.hasGravity() && (this.isArrow() || this.sticksToWalls())) + { + this.motionX *= -0.10000000149011612D; + this.motionY *= -0.10000000149011612D; + this.motionZ *= -0.10000000149011612D; + this.rotationYaw += 180.0F; + this.prevRotationYaw += 180.0F; + this.ticksInAir = 0; + } + } + else + { + if (this.isArrow() || this.sticksToWalls()) { +// if (this.sticksToWalls()) { +// float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); +// float f1 = this.isArrow() ? 0.0F :this.isRotating() ? 180.0F : 225.0F; +// this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(this.motionY, (double)f) * 180.0D / Math.PI) + f1; +// } + this.xTile = movingobjectposition.blockX; + this.yTile = movingobjectposition.blockY; + this.zTile = movingobjectposition.blockZ; + this.inTile = this.worldObj.getBlock(this.xTile, this.yTile, this.zTile); + this.inData = this.worldObj.getBlockMetadata(this.xTile, this.yTile, this.zTile); + this.motionX = (double)((float)(movingobjectposition.hitVec.xCoord - this.posX)); + this.motionY = (double)((float)(movingobjectposition.hitVec.yCoord - this.posY)); + this.motionZ = (double)((float)(movingobjectposition.hitVec.zCoord - this.posZ)); + float f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); + this.posX -= this.motionX / (double)f2 * 0.05000000074505806D; + this.posY -= this.motionY / (double)f2 * 0.05000000074505806D; + this.posZ -= this.motionZ / (double)f2 * 0.05000000074505806D; + this.inGround = true; + if (this.isArrow()) + this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F)); + else + this.playSound("random.break", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F)); + this.arrowShake = 7; + + if (!this.hasGravity()) { + this.dataWatcher.updateObject(26, Byte.valueOf((byte) 1)); + } + + if (this.inTile != null) + {//onEntityCollidedWithBlock + inTile.onEntityCollidedWithBlock(this.worldObj, this.xTile, this.yTile, this.zTile, this); + } + } + else + { + if (this.isBlock()) + { + this.worldObj.playAuxSFX(2001, MathHelper.floor_double(posX), MathHelper.floor_double(posY), MathHelper.floor_double(posZ), Item.getIdFromItem(getItem())); + } + else + { + for (int i = 0; i < 8; ++i) + { + this.worldObj.spawnParticle("iconcrack_" + Item.getIdFromItem(getItem()), this.posX, this.posY, this.posZ, this.rand.nextGaussian() * 0.15D, this.rand.nextGaussian() * 0.2D, this.rand.nextGaussian() * 0.15D); + } + } + } + } + + + if (explosive){ + if (this.explosiveRadius != 0 || this.effect == EnumPotionType.None){ + boolean terraindamage = this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing") && explosiveDamage; + Explosion explosion = new Explosion(worldObj, this, posX, posY, posZ, explosiveRadius); + explosion.isFlaming = this.effect == EnumPotionType.Fire; + explosion.isSmoking = terraindamage; + if(terraindamage) + explosion.doExplosionA(); + explosion.doExplosionB(worldObj.isRemote); + //this.worldObj.newExplosion(null, this.posX, this.posY, this.posZ, this.explosiveRadius, this.effect == EnumPotionType.Fire, this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing") && explosiveDamage); + if(!worldObj.isRemote){ + Iterator iterator = worldObj.playerEntities.iterator(); + + while (iterator.hasNext()){ + EntityPlayer entityplayer = (EntityPlayer)iterator.next(); + if (entityplayer.getDistanceSq(posX, posY, posZ) < 4096.0D){ + ((EntityPlayerMP)entityplayer).playerNetServerHandler.sendPacket(new S27PacketExplosion(posX, posY, posZ, explosiveRadius, explosion.affectedBlockPositions, (Vec3)explosion.func_77277_b().get(entityplayer))); + } + } + } + if (this.explosiveRadius != 0 && (this.isArrow() || this.sticksToWalls())) + this.setDead(); + } + else if (this.effect == EnumPotionType.Fire){ + int i = movingobjectposition.blockX; + int j = movingobjectposition.blockY; + int k = movingobjectposition.blockZ; + + switch (movingobjectposition.sideHit) + { + case 0: + --j; + break; + case 1: + ++j; + break; + case 2: + --k; + break; + case 3: + ++k; + break; + case 4: + --i; + break; + case 5: + ++i; + } + + if (this.worldObj.isAirBlock(i, j, k)) + { + this.worldObj.setBlock(i, j, k, Blocks.fire); + } + } + else + { + AxisAlignedBB axisalignedbb = this.boundingBox.expand(4.0D, 2.0D, 4.0D); + List list1 = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb); + + if (list1 != null && !list1.isEmpty()) + { + Iterator iterator = list1.iterator(); + + while (iterator.hasNext()) + { + EntityLivingBase entitylivingbase = (EntityLivingBase)iterator.next(); + double d0 = this.getDistanceSqToEntity(entitylivingbase); + + if (d0 < 16.0D) + { + double d1 = 1.0D - Math.sqrt(d0) / 4.0D; + + if (entitylivingbase == movingobjectposition.entityHit) + { + d1 = 1.0D; + } + + int i = this.getPotionEffect(effect); + + if (Potion.potionTypes[i].isInstant()) + { + Potion.potionTypes[i].affectEntity(this.getThrower(), entitylivingbase, this.amplify, d1); + } + else + { + int j = (int)(d1 * (double)this.duration + 0.5D); + + if (j > 20) + { + entitylivingbase.addPotionEffect(new PotionEffect(i, j, this.amplify)); + } + } + } + } + } + this.worldObj.playAuxSFX(2002, (int)Math.round(this.posX), (int)Math.round(this.posY), (int)Math.round(this.posZ), this.getPotionColor(this.effect)); + } + } + + if (!this.worldObj.isRemote && !this.isArrow() && !this.sticksToWalls()) + { + this.setDead(); + } + } + + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + par1NBTTagCompound.setShort("xTile", (short)this.xTile); + par1NBTTagCompound.setShort("yTile", (short)this.yTile); + par1NBTTagCompound.setShort("zTile", (short)this.zTile); + par1NBTTagCompound.setByte("inTile", (byte)Block.getIdFromBlock(this.inTile)); + par1NBTTagCompound.setByte("inData", (byte)this.inData); + par1NBTTagCompound.setByte("shake", (byte)this.throwableShake); + par1NBTTagCompound.setByte("inGround", (byte)(this.inGround ? 1 : 0)); + par1NBTTagCompound.setByte("isArrow", (byte)(this.isArrow() ? 1 : 0)); + par1NBTTagCompound.setTag("direction", this.newDoubleNBTList(new double[] {this.motionX, this.motionY, this.motionZ})); + par1NBTTagCompound.setBoolean("canBePickedUp", canBePickedUp); + + if ((this.throwerName == null || this.throwerName.length() == 0) && this.thrower != null && this.thrower instanceof EntityPlayer) + { + this.throwerName = this.thrower.getUniqueID().toString(); + } + + par1NBTTagCompound.setString("ownerName", this.throwerName == null ? "" : this.throwerName); + if (this.getItemDisplay() != null) + { + par1NBTTagCompound.setTag("Item", this.getItemDisplay().writeToNBT(new NBTTagCompound())); + } + + par1NBTTagCompound.setFloat("damagev2", damage); + par1NBTTagCompound.setInteger("punch", punch); + par1NBTTagCompound.setInteger("size", this.dataWatcher.getWatchableObjectInt(23)); + par1NBTTagCompound.setInteger("velocity", this.dataWatcher.getWatchableObjectInt(25)); + par1NBTTagCompound.setInteger("explosiveRadius", explosiveRadius); + par1NBTTagCompound.setInteger("effectDuration", duration); + par1NBTTagCompound.setBoolean("gravity", this.hasGravity()); + par1NBTTagCompound.setBoolean("accelerate", this.accelerate); + par1NBTTagCompound.setByte("glows", this.dataWatcher.getWatchableObjectByte(24)); + par1NBTTagCompound.setBoolean("explosive", explosive); + par1NBTTagCompound.setInteger("PotionEffect", effect.ordinal()); + par1NBTTagCompound.setString("trail", this.dataWatcher.getWatchableObjectString(22)); + par1NBTTagCompound.setByte("Render3D", this.dataWatcher.getWatchableObjectByte(28)); + par1NBTTagCompound.setByte("Spins", this.dataWatcher.getWatchableObjectByte(29)); + par1NBTTagCompound.setByte("Sticks", this.dataWatcher.getWatchableObjectByte(30)); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + this.xTile = par1NBTTagCompound.getShort("xTile"); + this.yTile = par1NBTTagCompound.getShort("yTile"); + this.zTile = par1NBTTagCompound.getShort("zTile"); + this.inTile = Block.getBlockById(par1NBTTagCompound.getByte("inTile") & 255); + this.inData = par1NBTTagCompound.getByte("inData") & 255; + this.throwableShake = par1NBTTagCompound.getByte("shake") & 255; + this.inGround = par1NBTTagCompound.getByte("inGround") == 1; + this.dataWatcher.updateObject(27, par1NBTTagCompound.getByte("isArrow")); + this.throwerName = par1NBTTagCompound.getString("ownerName"); + this.canBePickedUp = par1NBTTagCompound.getBoolean("canBePickedUp"); + + this.damage = par1NBTTagCompound.getFloat("damagev2"); + this.punch = par1NBTTagCompound.getInteger("punch"); + this.explosiveRadius = par1NBTTagCompound.getInteger("explosiveRadius"); + this.duration = par1NBTTagCompound.getInteger("effectDuration"); + this.accelerate = par1NBTTagCompound.getBoolean("accelerate"); + this.explosive = par1NBTTagCompound.getBoolean("explosive"); + this.effect = EnumPotionType.values()[par1NBTTagCompound.getInteger("PotionEffect") % EnumPotionType.values().length]; + this.dataWatcher.updateObject(22, par1NBTTagCompound.getString("trail")); + this.dataWatcher.updateObject(23, Integer.valueOf(par1NBTTagCompound.getInteger("size"))); + this.dataWatcher.updateObject(24, Byte.valueOf((byte) (par1NBTTagCompound.getBoolean("glows") ? 1 : 0))); + this.dataWatcher.updateObject(25, Integer.valueOf(par1NBTTagCompound.getInteger("velocity"))); + this.dataWatcher.updateObject(26, Byte.valueOf((byte) (par1NBTTagCompound.getBoolean("gravity") ? 1 : 0))); + this.dataWatcher.updateObject(28, Byte.valueOf((byte) (par1NBTTagCompound.getBoolean("Render3D") ? 1 : 0))); + this.dataWatcher.updateObject(29, Byte.valueOf((byte) (par1NBTTagCompound.getBoolean("Spins") ? 1 : 0))); + this.dataWatcher.updateObject(30, Byte.valueOf((byte) (par1NBTTagCompound.getBoolean("Sticks") ? 1 : 0))); + + if (this.throwerName != null && this.throwerName.length() == 0) + { + this.throwerName = null; + } + if (par1NBTTagCompound.hasKey("direction")) + { + NBTTagList nbttaglist = par1NBTTagCompound.getTagList("direction",6); + this.motionX = nbttaglist.func_150309_d(0); + this.motionY = nbttaglist.func_150309_d(1); + this.motionZ = nbttaglist.func_150309_d(2); + } + + NBTTagCompound var2 = par1NBTTagCompound.getCompoundTag("Item"); + ItemStack item = ItemStack.loadItemStackFromNBT(var2); + + if (item == null) + this.setDead(); + else + dataWatcher.updateObject(21, item); + } + + @Override + public EntityLivingBase getThrower() + { + if(throwerName == null || throwerName.isEmpty()) + return null; + try{ + UUID uuid = UUID.fromString(throwerName); + if (this.thrower == null && uuid != null) + this.thrower = this.worldObj.func_152378_a(uuid); + } + catch(IllegalArgumentException ex){ + + } + + return this.thrower; + } + + private int getPotionEffect(EnumPotionType p) { + switch(p) + { + case Poison : return Potion.poison.id; + case Hunger : return Potion.hunger.id; + case Weakness : return Potion.weakness.id; + case Slowness : return Potion.moveSlowdown.id; + case Nausea : return Potion.confusion.id; + case Blindness : return Potion.blindness.id; + case Wither : return Potion.wither.id; + default : return 0; + } + } + + private int getPotionColor(EnumPotionType p) { + switch(p) + { + case Poison : return 32660; + case Hunger : return 32660; + case Weakness : return 32696; + case Slowness : return 32698; + case Nausea : return 32732; + case Blindness : return Potion.blindness.id; + case Wither : return 32732; + default : return 0; + } + } + + public void getStatProperties(DataStats stats) + { + this.damage = stats.pDamage; + this.punch = stats.pImpact; + this.accelerate = stats.pXlr8; + this.explosive = stats.pExplode; + this.explosiveRadius = stats.pArea; + this.effect = stats.pEffect; + this.duration = stats.pDur; + this.amplify = stats.pEffAmp; + this.setParticleEffect(stats.pTrail); + this.dataWatcher.updateObject(23, Integer.valueOf(stats.pSize)); + this.dataWatcher.updateObject(24, Byte.valueOf((byte) (stats.pGlows ? 1 : 0))); + this.setSpeed(stats.pSpeed); + this.setHasGravity(stats.pPhysics); + setIs3D(stats.pRender3D); + this.setRotating(stats.pSpin); + this.setStickInWall(stats.pStick); + } + public void setParticleEffect(EnumParticleType type){ + this.dataWatcher.updateObject(22, type.particleName); + } + + public void setHasGravity(boolean bo){ + this.dataWatcher.updateObject(26, Byte.valueOf((byte) (bo ? 1 : 0))); + } + public void setIs3D(boolean bo){ + this.dataWatcher.updateObject(28, Byte.valueOf((byte) (bo ? 1 : 0))); + } + public void setStickInWall(boolean bo){ + this.dataWatcher.updateObject(30, Byte.valueOf((byte) (bo ? 1 : 0))); + } + + public ItemStack getItemDisplay() { + return dataWatcher.getWatchableObjectItemStack(21); + } + + public float getBrightness(float par1) + { + return this.dataWatcher.getWatchableObjectByte(24) == 1 ? 1.0F : super.getBrightness(par1); + } + + @SideOnly(Side.CLIENT) + public int getBrightnessForRender(float par1) + { + return this.dataWatcher.getWatchableObjectByte(24) == 1 ? 15728880 : super.getBrightnessForRender(par1); + } + + public boolean hasGravity() { + return this.dataWatcher.getWatchableObjectByte(26) == 1; + } + + public void setSpeed(int speed) { + this.dataWatcher.updateObject(25, speed); + } + + public float getSpeed() { + return this.dataWatcher.getWatchableObjectInt(25) / 10.0F; + } + + public boolean isArrow() { + return this.dataWatcher.getWatchableObjectByte(27) == 1; + } + + public void setRotating(boolean bo) { + dataWatcher.updateObject(29, Byte.valueOf((byte) (bo ? 1 : 0))); + } + + public boolean isRotating() { + return this.dataWatcher.getWatchableObjectByte(29) == 1; + } + + public boolean glows() { + return this.dataWatcher.getWatchableObjectByte(24) == 1; + } + + public boolean is3D() { + return this.dataWatcher.getWatchableObjectByte(28) == 1 || isBlock(); + } + + public boolean sticksToWalls() { + return this.is3D() && this.dataWatcher.getWatchableObjectByte(30) == 1; + } + + @Override + public void onCollideWithPlayer(EntityPlayer par1EntityPlayer) + { + if (this.worldObj.isRemote || !canBePickedUp || !this.inGround || this.arrowShake > 0) + return; + if (par1EntityPlayer.inventory.addItemStackToInventory(getItemDisplay())) + { + inGround = false; + this.playSound("random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); + par1EntityPlayer.onItemPickup(this, 1); + this.setDead(); + } + + } + + @Override + protected boolean canTriggerWalking() + { + return false; + } + + @Override + public IChatComponent func_145748_c_() + { + if(getItemDisplay() != null) + return new ChatComponentTranslation(getItemDisplay().getDisplayName()); + return super.func_145748_c_(); + } +} diff --git a/src/main/java/noppes/npcs/entity/old/EntityNPCDwarfFemale.java b/src/main/java/noppes/npcs/entity/old/EntityNPCDwarfFemale.java new file mode 100644 index 000000000..81dbbff3e --- /dev/null +++ b/src/main/java/noppes/npcs/entity/old/EntityNPCDwarfFemale.java @@ -0,0 +1,46 @@ +// 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 fieldsfirst + +package noppes.npcs.entity.old; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import noppes.npcs.ModelData; +import noppes.npcs.entity.EntityCustomNpc; +import noppes.npcs.entity.EntityNPCInterface; + +// Referenced classes of package net.minecraft.src: +// EntityAnimal, Item, EntityPlayer, InventoryPlayer, +// ItemStack, World, NBTTagCompound + +public class EntityNPCDwarfFemale extends EntityNPCInterface +{ + public EntityNPCDwarfFemale(World world) + { + super(world); + scaleX = scaleZ = 0.75f; + scaleY = 0.6275f; + display.texture = "customnpcs:textures/entity/dwarffemale/Simone.png"; + } + + public void onUpdate(){ + isDead = true; + + if(!worldObj.isRemote){ + NBTTagCompound compound = new NBTTagCompound(); + + writeToNBT(compound); + EntityCustomNpc npc = new EntityCustomNpc(worldObj); + npc.readFromNBT(compound); + ModelData data = npc.modelData; + data.breasts = 2; + data.legs.setScale(0.8f,1.05f); + data.arms.setScale(0.8f,1.05f); + data.body.setScale(0.8f,1.05f); + data.head.setScale(0.8f,0.85f); + worldObj.spawnEntityInWorld(npc); + } + super.onUpdate(); + } +} diff --git a/src/main/java/noppes/npcs/entity/old/EntityNPCDwarfMale.java b/src/main/java/noppes/npcs/entity/old/EntityNPCDwarfMale.java new file mode 100644 index 000000000..de050923b --- /dev/null +++ b/src/main/java/noppes/npcs/entity/old/EntityNPCDwarfMale.java @@ -0,0 +1,45 @@ +// 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 fieldsfirst + +package noppes.npcs.entity.old; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import noppes.npcs.ModelData; +import noppes.npcs.entity.EntityCustomNpc; +import noppes.npcs.entity.EntityNPCInterface; + +// Referenced classes of package net.minecraft.src: +// EntityAnimal, Item, EntityPlayer, InventoryPlayer, +// ItemStack, World, NBTTagCompound + +public class EntityNPCDwarfMale extends EntityNPCInterface +{ + public EntityNPCDwarfMale(World world) + { + super(world); + scaleX = scaleZ = 0.85f; + scaleY = 0.6875f; + display.texture = "customnpcs:textures/entity/dwarfmale/Simon.png"; + } + + public void onUpdate(){ + isDead = true; + + if(!worldObj.isRemote){ + NBTTagCompound compound = new NBTTagCompound(); + + writeToNBT(compound); + EntityCustomNpc npc = new EntityCustomNpc(worldObj); + npc.readFromNBT(compound); + ModelData data = npc.modelData; + data.legs.setScale(1.1f,0.7f, 0.9f); + data.arms.setScale(0.9f,0.7f); + data.body.setScale(1.2f, 0.7f, 1.5f); + data.head.setScale(0.85f,0.85f); + worldObj.spawnEntityInWorld(npc); + } + super.onUpdate(); + } +} diff --git a/src/main/java/noppes/npcs/entity/old/EntityNPCElfFemale.java b/src/main/java/noppes/npcs/entity/old/EntityNPCElfFemale.java new file mode 100644 index 000000000..f544cb391 --- /dev/null +++ b/src/main/java/noppes/npcs/entity/old/EntityNPCElfFemale.java @@ -0,0 +1,49 @@ +// 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 fieldsfirst + +package noppes.npcs.entity.old; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import noppes.npcs.ModelData; +import noppes.npcs.constants.EnumAnimation; +import noppes.npcs.entity.EntityCustomNpc; +import noppes.npcs.entity.EntityNPCInterface; + +// Referenced classes of package net.minecraft.src: +// EntityAnimal, Item, EntityPlayer, InventoryPlayer, +// ItemStack, World, NBTTagCompound + +public class EntityNPCElfFemale extends EntityNPCInterface +{ + public EntityNPCElfFemale(World world) + { + super(world); + display.texture = "customnpcs:textures/entity/elffemale/ElfFemale.png"; + scaleX = 0.8f; + scaleY = 1f; + scaleZ = 0.8f; + } + + + public void onUpdate(){ + isDead = true; + + if(!worldObj.isRemote){ + NBTTagCompound compound = new NBTTagCompound(); + + writeToNBT(compound); + EntityCustomNpc npc = new EntityCustomNpc(worldObj); + npc.readFromNBT(compound); + ModelData data = npc.modelData; + data.breasts = 2; + data.legs.setScale(0.8f,1.05f); + data.arms.setScale(0.8f,1.05f); + data.body.setScale(0.8f,1.05f); + data.head.setScale(0.8f,0.85f); + worldObj.spawnEntityInWorld(npc); + } + super.onUpdate(); + } +} diff --git a/src/main/java/noppes/npcs/entity/old/EntityNPCElfMale.java b/src/main/java/noppes/npcs/entity/old/EntityNPCElfMale.java new file mode 100644 index 000000000..2d4ebcb26 --- /dev/null +++ b/src/main/java/noppes/npcs/entity/old/EntityNPCElfMale.java @@ -0,0 +1,48 @@ +// 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 fieldsfirst + +package noppes.npcs.entity.old; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import noppes.npcs.ModelData; +import noppes.npcs.constants.EnumAnimation; +import noppes.npcs.entity.EntityCustomNpc; +import noppes.npcs.entity.EntityNPCInterface; + +// Referenced classes of package net.minecraft.src: +// EntityAnimal, Item, EntityPlayer, InventoryPlayer, +// ItemStack, World, NBTTagCompound + +public class EntityNPCElfMale extends EntityNPCInterface +{ + public EntityNPCElfMale(World world) + { + super(world); + scaleX = 0.85f; + scaleY = 1.07f; + scaleZ = 0.85f; + display.texture = "customnpcs:textures/entity/elfmale/ElfMale.png"; + } + + + public void onUpdate(){ + isDead = true; + + if(!worldObj.isRemote){ + NBTTagCompound compound = new NBTTagCompound(); + + writeToNBT(compound); + EntityCustomNpc npc = new EntityCustomNpc(worldObj); + npc.readFromNBT(compound); + ModelData data = npc.modelData; + data.legs.setScale(0.85f,1.15f); + data.arms.setScale(0.85f,1.15f); + data.body.setScale(0.85f,1.15f); + data.head.setScale(0.85f,0.95f); + worldObj.spawnEntityInWorld(npc); + } + super.onUpdate(); + } +} diff --git a/src/main/java/noppes/npcs/entity/old/EntityNPCEnderman.java b/src/main/java/noppes/npcs/entity/old/EntityNPCEnderman.java new file mode 100644 index 000000000..8d0b237d8 --- /dev/null +++ b/src/main/java/noppes/npcs/entity/old/EntityNPCEnderman.java @@ -0,0 +1,59 @@ +// 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 fieldsfirst + +package noppes.npcs.entity.old; + +import net.minecraft.entity.monster.EntityEnderman; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import noppes.npcs.ModelData; +import noppes.npcs.constants.EnumAnimation; +import noppes.npcs.entity.EntityCustomNpc; + +public class EntityNPCEnderman extends EntityNpcEnderchibi +{ + public EntityNPCEnderman(World world) + { + super(world); + display.texture = "customnpcs:textures/entity/enderman/enderman.png"; + display.glowTexture = "customnpcs:textures/overlays/ender_eyes.png"; + this.width = 0.6F; + this.height = 2.9F; + } + + public void updateHitbox() { + + if(currentAnimation == EnumAnimation.LYING){ + width = height = 0.2f; + } + else if (currentAnimation == EnumAnimation.SITTING){ + width = 0.6f; + height = 2.3f; + } + else{ + width = 0.6f; + height = 2.9f; + } + width = (width / 5f) * display.modelSize; + height = (height / 5f) * display.modelSize; + } + + public void onUpdate() + { + isDead = true; + + if(!worldObj.isRemote){ + NBTTagCompound compound = new NBTTagCompound(); + + writeToNBT(compound); + EntityCustomNpc npc = new EntityCustomNpc(worldObj); + npc.readFromNBT(compound); + ModelData data = npc.modelData; + data.setEntityClass(EntityEnderman.class); + + worldObj.spawnEntityInWorld(npc); + } + super.onUpdate(); + } +} \ No newline at end of file diff --git a/src/main/java/noppes/npcs/entity/old/EntityNPCFurryFemale.java b/src/main/java/noppes/npcs/entity/old/EntityNPCFurryFemale.java new file mode 100644 index 000000000..824a8c7d0 --- /dev/null +++ b/src/main/java/noppes/npcs/entity/old/EntityNPCFurryFemale.java @@ -0,0 +1,55 @@ +// 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 fieldsfirst + +package noppes.npcs.entity.old; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import noppes.npcs.ModelData; +import noppes.npcs.ModelPartData; +import noppes.npcs.entity.EntityCustomNpc; +import noppes.npcs.entity.EntityNPCInterface; + +// Referenced classes of package net.minecraft.src: +// EntityAnimal, Item, EntityPlayer, InventoryPlayer, +// ItemStack, World, NBTTagCompound + +public class EntityNPCFurryFemale extends EntityNPCInterface +{ + public EntityNPCFurryFemale(World world) + { + super(world); + scaleX = scaleY = scaleZ = 0.9075f; + display.texture = "customnpcs:textures/entity/furryfemale/WolfBlack.png"; + } + public void onUpdate() + { + isDead = true; + + if(!worldObj.isRemote){ + NBTTagCompound compound = new NBTTagCompound(); + + writeToNBT(compound); + EntityCustomNpc npc = new EntityCustomNpc(worldObj); + npc.readFromNBT(compound); + ModelData data = npc.modelData; + data.breasts = 2; + data.head.setScale(0.95f,0.95f); + data.legs.setScale(0.92f,0.92f); + data.arms.setScale(0.80f,0.92f); + data.body.setScale(0.92f, 0.92f); + ModelPartData hair = data.getOrCreatePart("ears"); + hair.playerTexture = true; + ModelPartData snout = data.getOrCreatePart("snout"); + snout.playerTexture = true; + snout.type = 1; + ModelPartData tail = data.getOrCreatePart("tail"); + tail.playerTexture = true; + + + worldObj.spawnEntityInWorld(npc); + } + super.onUpdate(); + } +} diff --git a/src/main/java/noppes/npcs/entity/old/EntityNPCFurryMale.java b/src/main/java/noppes/npcs/entity/old/EntityNPCFurryMale.java new file mode 100644 index 000000000..7eb484286 --- /dev/null +++ b/src/main/java/noppes/npcs/entity/old/EntityNPCFurryMale.java @@ -0,0 +1,52 @@ +// 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 fieldsfirst + +package noppes.npcs.entity.old; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import noppes.npcs.ModelData; +import noppes.npcs.ModelPartData; +import noppes.npcs.client.controllers.Preset; +import noppes.npcs.entity.EntityCustomNpc; +import noppes.npcs.entity.EntityNPCInterface; + +// Referenced classes of package net.minecraft.src: +// EntityAnimal, Item, EntityPlayer, InventoryPlayer, +// ItemStack, World, NBTTagCompound + +public class EntityNPCFurryMale extends EntityNPCInterface +{ + public EntityNPCFurryMale(World world) + { + super(world); + display.texture = "customnpcs:textures/entity/furrymale/WolfGrey.png"; + } + + public void onUpdate() + { + isDead = true; + + if(!worldObj.isRemote){ + NBTTagCompound compound = new NBTTagCompound(); + + writeToNBT(compound); + EntityCustomNpc npc = new EntityCustomNpc(worldObj); + npc.readFromNBT(compound); + ModelData data = npc.modelData; + ModelPartData hair = data.getOrCreatePart("ears"); + hair.playerTexture = true; + ModelPartData snout = data.getOrCreatePart("snout"); + snout.playerTexture = true; + snout.type = 1; + ModelPartData tail = data.getOrCreatePart("tail"); + tail.playerTexture = true; + + + worldObj.spawnEntityInWorld(npc); + } + super.onUpdate(); + } + +} diff --git a/src/main/java/noppes/npcs/entity/old/EntityNPCHumanFemale.java b/src/main/java/noppes/npcs/entity/old/EntityNPCHumanFemale.java new file mode 100644 index 000000000..80009c494 --- /dev/null +++ b/src/main/java/noppes/npcs/entity/old/EntityNPCHumanFemale.java @@ -0,0 +1,45 @@ +// 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 fieldsfirst + +package noppes.npcs.entity.old; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import noppes.npcs.ModelData; +import noppes.npcs.entity.EntityCustomNpc; +import noppes.npcs.entity.EntityNPCInterface; + +// Referenced classes of package net.minecraft.src: +// EntityAnimal, Item, EntityPlayer, InventoryPlayer, +// ItemStack, World, NBTTagCompound + +public class EntityNPCHumanFemale extends EntityNPCInterface +{ + public EntityNPCHumanFemale(World world) + { + super(world); + scaleX = scaleY = scaleZ = 0.9075f; + display.texture = "customnpcs:textures/entity/humanfemale/Stephanie.png"; + } + + public void onUpdate(){ + isDead = true; + + if(!worldObj.isRemote){ + NBTTagCompound compound = new NBTTagCompound(); + + writeToNBT(compound); + EntityCustomNpc npc = new EntityCustomNpc(worldObj); + npc.readFromNBT(compound); + ModelData data = npc.modelData; + data.breasts = 2; + data.head.setScale(0.95f,0.95f); + data.legs.setScale(0.92f,0.92f); + data.arms.setScale(0.80f,0.92f); + data.body.setScale(0.92f, 0.92f); + worldObj.spawnEntityInWorld(npc); + } + super.onUpdate(); + } +} diff --git a/src/main/java/noppes/npcs/entity/old/EntityNPCHumanMale.java b/src/main/java/noppes/npcs/entity/old/EntityNPCHumanMale.java new file mode 100644 index 000000000..da42a077f --- /dev/null +++ b/src/main/java/noppes/npcs/entity/old/EntityNPCHumanMale.java @@ -0,0 +1,37 @@ +// 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 fieldsfirst + +package noppes.npcs.entity.old; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import noppes.npcs.entity.EntityCustomNpc; +import noppes.npcs.entity.EntityNPCInterface; + +// Referenced classes of package net.minecraft.src: +// EntityAnimal, Item, EntityPlayer, InventoryPlayer, +// ItemStack, World, NBTTagCompound + +public class EntityNPCHumanMale extends EntityNPCInterface +{ + public EntityNPCHumanMale(World world) + { + super(world); + } + + + public void onUpdate(){ + isDead = true; + + if(!worldObj.isRemote){ + NBTTagCompound compound = new NBTTagCompound(); + + writeToNBT(compound); + EntityCustomNpc npc = new EntityCustomNpc(worldObj); + npc.readFromNBT(compound); + worldObj.spawnEntityInWorld(npc); + } + super.onUpdate(); + } +} diff --git a/src/main/java/noppes/npcs/entity/old/EntityNPCOrcFemale.java b/src/main/java/noppes/npcs/entity/old/EntityNPCOrcFemale.java new file mode 100644 index 000000000..53f3e4b02 --- /dev/null +++ b/src/main/java/noppes/npcs/entity/old/EntityNPCOrcFemale.java @@ -0,0 +1,45 @@ +// 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 fieldsfirst + +package noppes.npcs.entity.old; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import noppes.npcs.ModelData; +import noppes.npcs.entity.EntityCustomNpc; +import noppes.npcs.entity.EntityNPCInterface; + +// Referenced classes of package net.minecraft.src: +// EntityAnimal, Item, EntityPlayer, InventoryPlayer, +// ItemStack, World, NBTTagCompound + +public class EntityNPCOrcFemale extends EntityNPCInterface +{ + public EntityNPCOrcFemale(World world) + { + super(world); + scaleX = scaleY = scaleZ = 0.9375f; + display.texture = "customnpcs:textures/entity/orcfemale/StrandedFemaleOrc.png"; + } + + public void onUpdate(){ + isDead = true; + + if(!worldObj.isRemote){ + NBTTagCompound compound = new NBTTagCompound(); + + writeToNBT(compound); + EntityCustomNpc npc = new EntityCustomNpc(worldObj); + npc.readFromNBT(compound); + ModelData data = npc.modelData; + data.breasts = 2; + data.legs.setScale(0.9f,0.65f); + data.arms.setScale(0.9f,0.65f); + data.body.setScale(1f, 0.65f, 1.1f); + data.head.setScale(0.85f,0.85f); + worldObj.spawnEntityInWorld(npc); + } + super.onUpdate(); + } +} diff --git a/src/main/java/noppes/npcs/entity/old/EntityNPCOrcMale.java b/src/main/java/noppes/npcs/entity/old/EntityNPCOrcMale.java new file mode 100644 index 000000000..4ae4f68e4 --- /dev/null +++ b/src/main/java/noppes/npcs/entity/old/EntityNPCOrcMale.java @@ -0,0 +1,45 @@ +// 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 fieldsfirst + +package noppes.npcs.entity.old; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import noppes.npcs.ModelData; +import noppes.npcs.entity.EntityCustomNpc; +import noppes.npcs.entity.EntityNPCInterface; + +// Referenced classes of package net.minecraft.src: +// EntityAnimal, Item, EntityPlayer, InventoryPlayer, +// ItemStack, World, NBTTagCompound + +public class EntityNPCOrcMale extends EntityNPCInterface +{ + public EntityNPCOrcMale(World world) + { + super(world); + scaleY = 1f; + scaleX = scaleZ = 1.2f; + display.texture = "customnpcs:textures/entity/orcmale/StrandedOrc.png"; + } + + public void onUpdate(){ + isDead = true; + + if(!worldObj.isRemote){ + NBTTagCompound compound = new NBTTagCompound(); + + writeToNBT(compound); + EntityCustomNpc npc = new EntityCustomNpc(worldObj); + npc.readFromNBT(compound); + ModelData data = npc.modelData; + data.legs.setScale(1.2f,1.05f); + data.arms.setScale(1.2f,1.05f); + data.body.setScale(1.4f, 1.1f, 1.5f); + data.head.setScale(1.2f,1.1f); + worldObj.spawnEntityInWorld(npc); + } + super.onUpdate(); + } +} diff --git a/src/main/java/noppes/npcs/entity/old/EntityNPCVillager.java b/src/main/java/noppes/npcs/entity/old/EntityNPCVillager.java new file mode 100644 index 000000000..6862a5d9c --- /dev/null +++ b/src/main/java/noppes/npcs/entity/old/EntityNPCVillager.java @@ -0,0 +1,46 @@ +// 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 fieldsfirst + +package noppes.npcs.entity.old; + +import net.minecraft.entity.monster.EntitySkeleton; +import net.minecraft.entity.passive.EntityVillager; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import noppes.npcs.ModelData; +import noppes.npcs.entity.EntityCustomNpc; +import noppes.npcs.entity.EntityNPCInterface; + +// Referenced classes of package net.minecraft.src: +// EntityAnimal, Item, EntityPlayer, InventoryPlayer, +// ItemStack, World, NBTTagCompound + +public class EntityNPCVillager extends EntityNPCInterface +{ + + public EntityNPCVillager(World world) + { + super(world); + display.texture = "textures/entity/villager/villager.png"; + } + public void onUpdate() + { + isDead = true; + + if(!worldObj.isRemote){ + NBTTagCompound compound = new NBTTagCompound(); + + writeToNBT(compound); + EntityCustomNpc npc = new EntityCustomNpc(worldObj); + npc.readFromNBT(compound); + ModelData data = npc.modelData; + data.setEntityClass(EntityVillager.class); + + + worldObj.spawnEntityInWorld(npc); + } + super.onUpdate(); + } + +} diff --git a/src/main/java/noppes/npcs/entity/old/EntityNpcEnderchibi.java b/src/main/java/noppes/npcs/entity/old/EntityNpcEnderchibi.java new file mode 100644 index 000000000..d9969d542 --- /dev/null +++ b/src/main/java/noppes/npcs/entity/old/EntityNpcEnderchibi.java @@ -0,0 +1,48 @@ +// 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 fieldsfirst + +package noppes.npcs.entity.old; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import noppes.npcs.ModelData; +import noppes.npcs.ModelPartData; +import noppes.npcs.client.NoppesUtil; +import noppes.npcs.entity.EntityCustomNpc; +import noppes.npcs.entity.EntityNPCInterface; + +// Referenced classes of package net.minecraft.src: +// EntityAnimal, Item, EntityPlayer, InventoryPlayer, +// ItemStack, World, NBTTagCompound + +public class EntityNpcEnderchibi extends EntityNPCInterface +{ + public EntityNpcEnderchibi(World world) + { + super(world); + display.texture = "customnpcs:textures/entity/enderchibi/MrEnderchibi.png"; + } + @Override + public void onUpdate() + { + isDead = true; + + if(!worldObj.isRemote){ + NBTTagCompound compound = new NBTTagCompound(); + + writeToNBT(compound); + EntityCustomNpc npc = new EntityCustomNpc(worldObj); + npc.readFromNBT(compound); + ModelData data = npc.modelData; + data.legs.setScale(0.65f,0.75f); + data.arms.setScale(0.50f,1.45f); + ModelPartData part = data.getOrCreatePart("particles"); + part.playerTexture = true; + + worldObj.spawnEntityInWorld(npc); + } + super.onUpdate(); + } + +} diff --git a/src/main/java/noppes/npcs/entity/old/EntityNpcMonsterFemale.java b/src/main/java/noppes/npcs/entity/old/EntityNpcMonsterFemale.java new file mode 100644 index 000000000..77c41bb64 --- /dev/null +++ b/src/main/java/noppes/npcs/entity/old/EntityNpcMonsterFemale.java @@ -0,0 +1,48 @@ +// 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 fieldsfirst + +package noppes.npcs.entity.old; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import noppes.npcs.ModelData; +import noppes.npcs.constants.EnumAnimation; +import noppes.npcs.entity.EntityCustomNpc; +import noppes.npcs.entity.EntityNPCInterface; + +// Referenced classes of package net.minecraft.src: +// EntityAnimal, Item, EntityPlayer, InventoryPlayer, +// ItemStack, World, NBTTagCompound + +public class EntityNpcMonsterFemale extends EntityNPCInterface +{ + public EntityNpcMonsterFemale(World world) + { + super(world); + scaleX = scaleY = scaleZ = 0.9075f; + display.texture = "customnpcs:textures/entity/monsterfemale/ZombieStephanie.png"; + } + + public void onUpdate(){ + isDead = true; + + if(!worldObj.isRemote){ + NBTTagCompound compound = new NBTTagCompound(); + + writeToNBT(compound); + EntityCustomNpc npc = new EntityCustomNpc(worldObj); + npc.readFromNBT(compound); + ModelData data = npc.modelData; + data.breasts = 2; + data.head.setScale(0.95f,0.95f); + data.legs.setScale(0.92f,0.92f); + data.arms.setScale(0.80f,0.92f); + data.body.setScale(0.92f, 0.92f); + npc.ai.animationType = EnumAnimation.HUG; + worldObj.spawnEntityInWorld(npc); + } + super.onUpdate(); + } + +} diff --git a/src/main/java/noppes/npcs/entity/old/EntityNpcMonsterMale.java b/src/main/java/noppes/npcs/entity/old/EntityNpcMonsterMale.java new file mode 100644 index 000000000..f01bf1cb3 --- /dev/null +++ b/src/main/java/noppes/npcs/entity/old/EntityNpcMonsterMale.java @@ -0,0 +1,40 @@ +// 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 fieldsfirst + +package noppes.npcs.entity.old; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import noppes.npcs.constants.EnumAnimation; +import noppes.npcs.entity.EntityCustomNpc; +import noppes.npcs.entity.EntityNPCInterface; + +// Referenced classes of package net.minecraft.src: +// EntityAnimal, Item, EntityPlayer, InventoryPlayer, +// ItemStack, World, NBTTagCompound + +public class EntityNpcMonsterMale extends EntityNPCInterface +{ + public EntityNpcMonsterMale(World world) + { + super(world); + display.texture = "customnpcs:textures/entity/monstermale/ZombieSteve.png"; + } + + public void onUpdate(){ + isDead = true; + + if(!worldObj.isRemote){ + NBTTagCompound compound = new NBTTagCompound(); + + writeToNBT(compound); + EntityCustomNpc npc = new EntityCustomNpc(worldObj); + npc.readFromNBT(compound); + npc.ai.animationType = EnumAnimation.HUG; + worldObj.spawnEntityInWorld(npc); + } + super.onUpdate(); + } + +} diff --git a/src/main/java/noppes/npcs/entity/old/EntityNpcNagaFemale.java b/src/main/java/noppes/npcs/entity/old/EntityNpcNagaFemale.java new file mode 100644 index 000000000..879832d59 --- /dev/null +++ b/src/main/java/noppes/npcs/entity/old/EntityNpcNagaFemale.java @@ -0,0 +1,50 @@ +// 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 fieldsfirst + +package noppes.npcs.entity.old; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import noppes.npcs.ModelData; +import noppes.npcs.ModelPartData; +import noppes.npcs.entity.EntityCustomNpc; +import noppes.npcs.entity.EntityNPCInterface; + +// Referenced classes of package net.minecraft.src: +// EntityAnimal, Item, EntityPlayer, InventoryPlayer, +// ItemStack, World, NBTTagCompound + +public class EntityNpcNagaFemale extends EntityNPCInterface +{ + public EntityNpcNagaFemale(World world) + { + super(world); + scaleX = scaleY = scaleZ = 0.9075f; + display.texture = "customnpcs:textures/entity/nagafemale/Claire.png"; + } + public void onUpdate() + { + isDead = true; + + if(!worldObj.isRemote){ + NBTTagCompound compound = new NBTTagCompound(); + + writeToNBT(compound); + EntityCustomNpc npc = new EntityCustomNpc(worldObj); + npc.readFromNBT(compound); + ModelData data = npc.modelData; + data.breasts = 2; + data.head.setScale(0.95f,0.95f); + data.legs.setScale(0.92f,0.92f); + data.arms.setScale(0.80f,0.92f); + data.body.setScale(0.92f, 0.92f); + ModelPartData legs = data.legParts; + legs.playerTexture = true; + legs.type = 1; + + worldObj.spawnEntityInWorld(npc); + } + super.onUpdate(); + } +} diff --git a/src/main/java/noppes/npcs/entity/old/EntityNpcNagaMale.java b/src/main/java/noppes/npcs/entity/old/EntityNpcNagaMale.java new file mode 100644 index 000000000..7ca57c7b5 --- /dev/null +++ b/src/main/java/noppes/npcs/entity/old/EntityNpcNagaMale.java @@ -0,0 +1,45 @@ +// 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 fieldsfirst + +package noppes.npcs.entity.old; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import noppes.npcs.ModelData; +import noppes.npcs.ModelPartData; +import noppes.npcs.entity.EntityCustomNpc; +import noppes.npcs.entity.EntityNPCInterface; + +// Referenced classes of package net.minecraft.src: +// EntityAnimal, Item, EntityPlayer, InventoryPlayer, +// ItemStack, World, NBTTagCompound + +public class EntityNpcNagaMale extends EntityNPCInterface +{ + public EntityNpcNagaMale(World world) + { + super(world); + display.texture = "customnpcs:textures/entity/nagamale/Cobra.png"; + } + + public void onUpdate() + { + isDead = true; + + if(!worldObj.isRemote){ + NBTTagCompound compound = new NBTTagCompound(); + + writeToNBT(compound); + EntityCustomNpc npc = new EntityCustomNpc(worldObj); + npc.readFromNBT(compound); + ModelData data = npc.modelData; + ModelPartData legs = data.legParts; + legs.playerTexture = true; + legs.type = 1; + + worldObj.spawnEntityInWorld(npc); + } + super.onUpdate(); + } +} diff --git a/src/main/java/noppes/npcs/entity/old/EntityNpcSkeleton.java b/src/main/java/noppes/npcs/entity/old/EntityNpcSkeleton.java new file mode 100644 index 000000000..c0766ad67 --- /dev/null +++ b/src/main/java/noppes/npcs/entity/old/EntityNpcSkeleton.java @@ -0,0 +1,44 @@ +// 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 fieldsfirst + +package noppes.npcs.entity.old; + +import net.minecraft.entity.monster.EntitySkeleton; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import noppes.npcs.ModelData; +import noppes.npcs.entity.EntityCustomNpc; +import noppes.npcs.entity.EntityNPCInterface; + +// Referenced classes of package net.minecraft.src: +// EntityAnimal, Item, EntityPlayer, InventoryPlayer, +// ItemStack, World, NBTTagCompound + +public class EntityNpcSkeleton extends EntityNPCInterface +{ + public EntityNpcSkeleton(World world) + { + super(world); + display.texture = "customnpcs:textures/entity/skeleton/Skeleton.png"; + } + + public void onUpdate() + { + isDead = true; + + if(!worldObj.isRemote){ + NBTTagCompound compound = new NBTTagCompound(); + + writeToNBT(compound); + EntityCustomNpc npc = new EntityCustomNpc(worldObj); + npc.readFromNBT(compound); + ModelData data = npc.modelData; + data.setEntityClass(EntitySkeleton.class); + + + worldObj.spawnEntityInWorld(npc); + } + super.onUpdate(); + } +} diff --git a/src/main/java/noppes/npcs/items/ItemBattleAxe.java b/src/main/java/noppes/npcs/items/ItemBattleAxe.java new file mode 100644 index 000000000..7d873cdcf --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemBattleAxe.java @@ -0,0 +1,17 @@ +package noppes.npcs.items; + +import org.lwjgl.opengl.GL11; + + +public class ItemBattleAxe extends ItemNpcWeaponInterface{ + + public ItemBattleAxe(int par1, ToolMaterial tool) { + super(par1, tool); + } + + public void renderSpecial(){ + GL11.glScalef(1f, 0.8f,1f); + GL11.glTranslatef(-0.04f, 0.2f, -0.16f); + GL11.glRotatef(180, 0, 1, 0); + } +} diff --git a/src/main/java/noppes/npcs/items/ItemBroadSword.java b/src/main/java/noppes/npcs/items/ItemBroadSword.java new file mode 100644 index 000000000..25f6457f1 --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemBroadSword.java @@ -0,0 +1,18 @@ +package noppes.npcs.items; + +import org.lwjgl.opengl.GL11; + + +public class ItemBroadSword extends ItemNpcWeaponInterface{ + + public ItemBroadSword(ToolMaterial tool) { + super(tool); + } + + public void renderSpecial(){ + GL11.glScalef(1f, 1.2f, 1f); + GL11.glTranslatef(-0.12f, 0.14f, -0.16f); + GL11.glRotatef(180, 0, 1, 0); + } + +} diff --git a/src/main/java/noppes/npcs/items/ItemBullet.java b/src/main/java/noppes/npcs/items/ItemBullet.java new file mode 100644 index 000000000..443621040 --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemBullet.java @@ -0,0 +1,18 @@ +package noppes.npcs.items; + +import noppes.npcs.CustomItems; +import noppes.npcs.constants.EnumNpcToolMaterial; + + +public class ItemBullet extends ItemNpcInterface{ + private EnumNpcToolMaterial material; + public ItemBullet(int par1, EnumNpcToolMaterial material) { + super(par1); + this.material = material; + setCreativeTab(CustomItems.tabWeapon); + } + public int getBulletDamage(){ + return material.getDamageVsEntity(); + } + +} diff --git a/src/main/java/noppes/npcs/items/ItemClaw.java b/src/main/java/noppes/npcs/items/ItemClaw.java new file mode 100644 index 000000000..a7a65c21b --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemClaw.java @@ -0,0 +1,18 @@ +package noppes.npcs.items; + +import org.lwjgl.opengl.GL11; + +public class ItemClaw extends ItemNpcWeaponInterface{ + + public ItemClaw(int par1, ToolMaterial material) { + super(par1,material); + } + + @Override + public void renderSpecial(){ + GL11.glScalef(0.6f, 0.6f,0.6f); + GL11.glTranslatef(-0.6f, 0.2f, -0.2f); + GL11.glRotatef(90, 0, 0, -1); + GL11.glRotatef(6, 1, 0, 0); + } +} diff --git a/src/main/java/noppes/npcs/items/ItemCrossbow.java b/src/main/java/noppes/npcs/items/ItemCrossbow.java new file mode 100644 index 000000000..c0f9e7634 --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemCrossbow.java @@ -0,0 +1,100 @@ +package noppes.npcs.items; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.EnumAction; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import noppes.npcs.CustomItems; +import noppes.npcs.entity.EntityProjectile; + +import org.lwjgl.opengl.GL11; + +public class ItemCrossbow extends ItemNpcInterface{ + + public ItemCrossbow(int par1) { + super(par1); + this.setMaxDamage(129); + setCreativeTab(CustomItems.tabWeapon); + } + public void onPlayerStoppedUsing(ItemStack stack, World par2World, EntityPlayer player, int count) { + if(player.worldObj.isRemote) + return; + + if(stack.stackTagCompound.getInteger("IsLoaded") == 1 || player.capabilities.isCreativeMode) { + if(stack.stackTagCompound.getInteger("Reloading") == 1 && !player.capabilities.isCreativeMode) { + stack.stackTagCompound.setInteger("Reloading", 0); + return; + } + stack.damageItem(1, player); + EntityProjectile projectile = new EntityProjectile(player.worldObj, player, new ItemStack(Items.arrow, 1, 0), false); + projectile.damage = 10; + projectile.setSpeed(20); + projectile.setHasGravity(true); + projectile.shoot(2); + + if(!player.capabilities.isCreativeMode) + consumeItem(player, CustomItems.crossbowBolt); + + player.worldObj.playSoundAtEntity(player, "random.bow", 0.9F, itemRand.nextFloat() * 0.3F + 0.8F); + player.worldObj.spawnEntityInWorld(projectile); + stack.stackTagCompound.setInteger("IsLoaded", 0); + } + } + + @Override + public void onUsingTick(ItemStack stack, EntityPlayer player, int count) + { + if(player.worldObj.isRemote){ + return; + } + + int ticks = getMaxItemUseDuration(stack) - count; + + if(!player.capabilities.isCreativeMode){ + if(stack.stackTagCompound.getInteger("Reloading") == 1 && hasItem(player, CustomItems.crossbowBolt)){ + if(ticks == 20){ + player.worldObj.playSoundAtEntity(player, "random.click", 1.0F,1); + stack.stackTagCompound.setInteger("IsLoaded", 1); + } + return; + } + } + } + + @Override + public void renderSpecial(){ + GL11.glRotatef(96, 1f, 0, 0); + GL11.glRotatef(-10, 0, 1f, 0); + GL11.glScalef(0.8f, 0.8f,0.8f); + GL11.glTranslatef(0.5f, -0.7f, -0.4F); + } + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + @Override + public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) + { + if(stack.stackTagCompound == null) + stack.stackTagCompound = new NBTTagCompound(); + if(!player.capabilities.isCreativeMode && hasItem(player, CustomItems.crossbowBolt) && stack.stackTagCompound.getInteger("IsLoaded") == 0) + stack.stackTagCompound.setInteger("Reloading", 1); + player.setItemInUse(stack, this.getMaxItemUseDuration(stack)); + return stack; + } + @Override + public int getMaxItemUseDuration(ItemStack par1ItemStack) + { + return 72000; + } + + public EnumAction getItemUseAction(ItemStack stack) + { + if(stack.stackTagCompound == null || stack.stackTagCompound.getInteger("Reloading") == 0) + return EnumAction.bow; + + return EnumAction.block; + } +} \ No newline at end of file diff --git a/src/main/java/noppes/npcs/items/ItemDagger.java b/src/main/java/noppes/npcs/items/ItemDagger.java new file mode 100644 index 000000000..b167da44c --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemDagger.java @@ -0,0 +1,16 @@ +package noppes.npcs.items; + +import org.lwjgl.opengl.GL11; + +public class ItemDagger extends ItemNpcWeaponInterface{ + + public ItemDagger(int par1, ToolMaterial tool) { + super(par1, tool); + } + + @Override + public void renderSpecial(){ + GL11.glScalef(0.6f, 0.6f, 0.6f); + GL11.glTranslatef(0.14F, 0.22f, 0.06f); + } +} diff --git a/src/main/java/noppes/npcs/items/ItemDaggerReversed.java b/src/main/java/noppes/npcs/items/ItemDaggerReversed.java new file mode 100644 index 000000000..0a1281eb9 --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemDaggerReversed.java @@ -0,0 +1,27 @@ +package noppes.npcs.items; + +import net.minecraft.client.renderer.texture.IIconRegister; + +import org.lwjgl.opengl.GL11; + +public class ItemDaggerReversed extends ItemDagger{ + + private ItemDagger dagger; + public ItemDaggerReversed(int par1, ItemDagger dagger, ToolMaterial tool) { + super(par1,tool); + this.dagger = dagger; + } + + @Override + public void renderSpecial(){ + GL11.glScalef(0.6f, 0.6f, 0.6f); + GL11.glTranslatef(0.16f, 0.6f, -0.16f); + GL11.glRotatef(180F, 1F, 0F, 0F); + } + + @Override + public void registerIcons(IIconRegister par1IconRegister) + { + this.itemIcon = dagger.getIconFromDamage(0); + } +} diff --git a/src/main/java/noppes/npcs/items/ItemElementalStaff.java b/src/main/java/noppes/npcs/items/ItemElementalStaff.java new file mode 100644 index 000000000..4fe9a182f --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemElementalStaff.java @@ -0,0 +1,48 @@ +package noppes.npcs.items; + +import java.awt.Color; +import java.util.List; + +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.passive.EntitySheep; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import noppes.npcs.CustomItems; +import noppes.npcs.CustomNpcs; +import noppes.npcs.constants.EnumNpcToolMaterial; + +public class ItemElementalStaff extends ItemStaff{ + public ItemElementalStaff(int par1, EnumNpcToolMaterial material) { + super(par1,material); + setHasSubtypes(true); + } + + @Override + public int getColorFromItemStack(ItemStack par1ItemStack, int par2){ + float[] color = EntitySheep.fleeceColorTable[par1ItemStack.getItemDamage()]; + return new Color(color[0],color[1],color[2]).getRGB(); + } + + @Override + public boolean requiresMultipleRenderPasses(){ + return true; + } + + @Override + public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List){ + for (int var4 = 0; var4 < 16; ++var4){ + par3List.add(new ItemStack(par1, 1, var4)); + } + } + + @Override + public ItemStack getProjectile(ItemStack stack){ + return new ItemStack(CustomItems.orb,1,stack.getItemDamage()); + } + + @Override + public void spawnParticle(ItemStack stack, EntityPlayer player){ + CustomNpcs.proxy.spawnParticle(player,"Spell",stack.getItemDamage(),4); + } +} diff --git a/src/main/java/noppes/npcs/items/ItemExcalibur.java b/src/main/java/noppes/npcs/items/ItemExcalibur.java new file mode 100644 index 000000000..31bc68d09 --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemExcalibur.java @@ -0,0 +1,38 @@ +package noppes.npcs.items; + +import org.lwjgl.opengl.GL11; + +public class ItemExcalibur extends ItemNpcWeaponInterface{ + + public static String[] quotes = new String[]{ + "Victory and Glory!", + "Excalibur! Excalibur! From the United K! I'm looking for heaven! I'm going to California!", + "FOOL! As someone who is unaware of the vital role that singing has played in the cultural history of mankind you are in no position to question me.", + "SILENCE! This is number 349 of the 1,000 provisions you must observe. Meisters should eat everything regardless of personal likes and dislikes. Never say anything as selfish as \"I don't like carrots.\" again.", + "About the 1,000 provisions that you are required to observe. Now I would like for you to participate in the most important provision. Number 452 the 5 hour story telling party.", + "Thus at long last the fighting between the rival gangs had ended! To sum up, this leads us to number 778 of the 1,000 provisions you must observe. Never mail a letter without the return address or the proper postage. And don't call collect.", + "To sum up, that is what led to number 679 of the 1,000 provisions you must observe. Always place a dehumidifier in your room.", + "This brings us to number 278 of the 1,000 provisions you must observe. I hate carrots. Never even think about putting them in my food, you get it?", + "Thus I found myself carrying the entire weight of the troop as I preformed my dance before a capacity crowd at the opera house.", + "A symphony can not be created using common sense and probabilities. It is already written in the fate of the composer. No... that's not it. A symphony is the inevitable result of a bad childhood, deafness, and too many beans eaten after a certain time of day.", + "Humming and the nightly news share a very tight connection indeed.", + "Number 58 of the 1,000 provisions I would like you to observe, never talk to me while I'm humming to myself. This is an important provision do you understand?", + "Hey! Hold on, come back! I'll tell you what! I can lower those 1,000 provisions down to 800, just as long as you take part in the five hour story telling party.", + "Before becoming my Meister there is a list of 1,000 provisions you must peruse. Be sure to look through all of them, they're important. I greatly look forward to your participation in number 452 the five hour story telling party.", + "Nothing beats a cup of herbal tea in the morning.", + "My legend dates back to the 12th Century you see. My legend is quite old. The 12th Century was a long time ago.", + "Young ones! Do you want to hear the legend of me? Do you want to hear a heroic tale?", + "No autographs!", + "The only thing you can change about the past is how you feel about it in the present.", + "My mornings begin with a cup of coffee with cream at the cafe. My afternoon begins with hot tea with two lumps of sugar. And my evenings... In the evening I change into my pajamas.", + }; + + public ItemExcalibur(int par1, ToolMaterial tool) { + super(par1, tool); + } + + @Override + public void renderSpecial(){ + GL11.glTranslatef(0.2F, 0.3f, 0.1f); + } +} diff --git a/src/main/java/noppes/npcs/items/ItemGlaive.java b/src/main/java/noppes/npcs/items/ItemGlaive.java new file mode 100644 index 000000000..a83ce0386 --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemGlaive.java @@ -0,0 +1,15 @@ +package noppes.npcs.items; + +import org.lwjgl.opengl.GL11; + +public class ItemGlaive extends ItemNpcWeaponInterface{ + + public ItemGlaive(int par1, ToolMaterial tool) { + super(par1, tool); + } + + @Override + public void renderSpecial(){ + GL11.glTranslatef(0.03F, -0.4f, 0.08f); + } +} diff --git a/src/main/java/noppes/npcs/items/ItemGun.java b/src/main/java/noppes/npcs/items/ItemGun.java new file mode 100644 index 000000000..3df84154b --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemGun.java @@ -0,0 +1,144 @@ +package noppes.npcs.items; + +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumAction; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.world.World; +import noppes.npcs.CustomItems; +import noppes.npcs.CustomNpcs; +import noppes.npcs.constants.EnumNpcToolMaterial; +import noppes.npcs.enchants.EnchantInterface; +import noppes.npcs.entity.EntityProjectile; +import noppes.npcs.util.IProjectileCallback; + +import org.lwjgl.opengl.GL11; + +public class ItemGun extends ItemNpcInterface implements IProjectileCallback{ + + private EnumNpcToolMaterial material; + public ItemGun(int par1, EnumNpcToolMaterial material) { + super(par1); + this.maxStackSize = 1; + this.material = material; + this.setMaxDamage(material.getMaxUses()); + setCreativeTab(CustomItems.tabWeapon); + } + @Override + public void onPlayerStoppedUsing(ItemStack stack, World worldObj, EntityPlayer player, int par4) { + if(worldObj.isRemote) + return; + + if (!hasBullet(player, stack) || !CustomNpcs.GunsEnabled){ + worldObj.playSoundAtEntity(player, "customnpcs:gun.empty", 1.0F,1); + return; + } + int ticks = getMaxItemUseDuration(stack) - par4; + if(ticks < 10){ + return; + } + stack.damageItem(1, player); + ItemBullet bullet = (ItemBullet) getBullet(); + int damage = (bullet.getBulletDamage() + material.getDamageVsEntity() + 1) / 2 + 5; + damage += damage * EnchantInterface.getLevel(EnchantInterface.Damage, stack) * 0.5f; + EntityProjectile projectile = new EntityProjectile(worldObj, player, new ItemStack(getBullet()), false); + projectile.damage = damage; + projectile.callback = this; + projectile.callbackItem = stack; + projectile.setSpeed(40); + projectile.shoot(material.getDamageVsEntity() + 1); + + if(!player.capabilities.isCreativeMode && !hasInfinite(stack)) + consumeItem(player, getBullet()); + + worldObj.playSoundAtEntity(player, "customnpcs:gun.pistol.shot", 1.0F,itemRand.nextFloat() * 0.3F + 0.8F); + worldObj.spawnEntityInWorld(projectile); + } + + @Override + public void onUsingTick(ItemStack stack, EntityPlayer player, int count) + { + int ticks = getMaxItemUseDuration(stack) - count; + if(ticks == 8 && !player.worldObj.isRemote){ + player.worldObj.playSoundAtEntity(player, "customnpcs:gun.pistol.trigger", 1.0F, + 1.0F / (player.worldObj.rand.nextFloat() * 0.4F + 0.8F)); + } + } + + @Override + public void renderSpecial(){ + GL11.glScalef(0.7f, 0.7f,0.7f); + GL11.glTranslatef(0.3f, 0.3f, 0.1f); + } + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + @Override + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack)); + return par1ItemStack; + } + @Override + public int getMaxItemUseDuration(ItemStack par1ItemStack) + { + return 72000; + } + private boolean hasBullet(EntityPlayer player, ItemStack stack){ + if(player.capabilities.isCreativeMode || hasInfinite(stack)) + return true; + return hasItem(player, getBullet()); + } + private Item getBullet(){ + switch(material){ + case EMERALD: + return CustomItems.bulletEmerald; + case DIA: + return CustomItems.bulletDiamond; + case IRON: + return CustomItems.bulletIron; + case BRONZE: + return CustomItems.bulletBronze; + case GOLD: + return CustomItems.bulletGold; + case STONE: + return CustomItems.bulletStone; + case WOOD: + return CustomItems.bulletWood; + default: + return CustomItems.bulletBlack; + } + } + + public boolean hasInfinite(ItemStack stack){ + return EnchantInterface.getLevel(EnchantInterface.Infinite, stack) > 0; + } + + @Override + public int getItemEnchantability(){ + return this.material.getEnchantability(); + } + + public EnumAction getItemUseAction(ItemStack par1ItemStack) + { + return EnumAction.bow; + } + @Override + public boolean onImpact(EntityProjectile entityProjectile, EntityLivingBase entity, ItemStack itemstack) { + int confusion = EnchantInterface.getLevel(EnchantInterface.Confusion, itemstack); + if(confusion > 0){ + if(entity.getRNG().nextInt(4) > confusion) + entity.addPotionEffect(new PotionEffect(Potion.confusion.id, 100)); + } + int poison = EnchantInterface.getLevel(EnchantInterface.Poison, itemstack); + if(poison > 0){ + if(entity.getRNG().nextInt(4) > poison) + entity.addPotionEffect(new PotionEffect(Potion.poison.id, 100)); + } + return false; + } +} diff --git a/src/main/java/noppes/npcs/items/ItemGunChainsaw.java b/src/main/java/noppes/npcs/items/ItemGunChainsaw.java new file mode 100644 index 000000000..781b29acd --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemGunChainsaw.java @@ -0,0 +1,34 @@ +package noppes.npcs.items; + +import org.lwjgl.opengl.GL11; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; + +public class ItemGunChainsaw extends ItemNpcWeaponInterface{ + + public ItemGunChainsaw(int par1, ToolMaterial tool) { + super(par1, tool); + } + + @Override + public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLiving, EntityLivingBase par3EntityLiving) + { + if(par2EntityLiving.getHealth() <= 0) + return false; + double x = par2EntityLiving.posX; + double y = par2EntityLiving.posY+ par2EntityLiving.height / 2; + double z = par2EntityLiving.posZ; + + par3EntityLiving.worldObj.playSoundEffect(x, y, z, "random.explode", 0.8F, (1.0F + (par3EntityLiving.worldObj.rand.nextFloat() - par3EntityLiving.worldObj.rand.nextFloat()) * 0.2F) * 0.7F); + par3EntityLiving.worldObj.spawnParticle("largeexplode", x, y , z, 0.0D, 0.0D, 0.0D); + return super.hitEntity(par1ItemStack, par2EntityLiving, par3EntityLiving); + } + + public void renderSpecial(){ + super.renderSpecial(); + GL11.glTranslatef(-0.1f, 0f, -0.16f); + GL11.glRotatef(180, 0, 1, 0); + GL11.glRotatef(-16, 0, 0, 1); + } +} diff --git a/src/main/java/noppes/npcs/items/ItemKunai.java b/src/main/java/noppes/npcs/items/ItemKunai.java new file mode 100644 index 000000000..03cd38662 --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemKunai.java @@ -0,0 +1,65 @@ +package noppes.npcs.items; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import noppes.npcs.entity.EntityProjectile; + +import org.lwjgl.opengl.GL11; + +public class ItemKunai extends ItemNpcWeaponInterface{ + + public ItemKunai(int par1, ToolMaterial tool) { + super(par1, tool); + } + + public void onPlayerStoppedUsing(ItemStack par1ItemStack, World worldObj, EntityPlayer player, int par4) + { + if(worldObj.isRemote){ + player.swingItem(); + return; + } + EntityProjectile projectile = new EntityProjectile(worldObj, player, par1ItemStack, false); + projectile.damage = func_150931_i(); + projectile.destroyedOnEntityHit = false; + projectile.canBePickedUp = !player.capabilities.isCreativeMode; + projectile.setIs3D(true); + projectile.setStickInWall(true); + projectile.setHasGravity(true); + projectile.setSpeed(12); + projectile.shoot(1); + + if(!player.capabilities.isCreativeMode){ + par1ItemStack.damageItem(1, player); + if(par1ItemStack.stackSize == 0) + return; + player.inventory.mainInventory[player.inventory.currentItem] = null; + //item.dropItem = par1ItemStack; + } + + worldObj.playSoundAtEntity(player, "customnpcs:misc.swosh", 1.0F,1); + + worldObj.spawnEntityInWorld(projectile); + } + + @Override + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack)); + return par1ItemStack; + } + @Override + public int getMaxItemUseDuration(ItemStack par1ItemStack) + { + return 72000; + } + @Override + public void renderSpecial(){ + GL11.glScalef(0.4f, 0.4f, 0.4f); + GL11.glTranslatef(-0.4F, 0.5f, 0.1f); + } + @Override + public boolean shouldRotateAroundWhenRendering(){ + return true; + } +} diff --git a/src/main/java/noppes/npcs/items/ItemKunaiReversed.java b/src/main/java/noppes/npcs/items/ItemKunaiReversed.java new file mode 100644 index 000000000..826092df4 --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemKunaiReversed.java @@ -0,0 +1,27 @@ +package noppes.npcs.items; + +import net.minecraft.client.renderer.texture.IIconRegister; +import noppes.npcs.CustomItems; + +import org.lwjgl.opengl.GL11; + +public class ItemKunaiReversed extends ItemKunai{ + + public ItemKunaiReversed(int par1, ToolMaterial tool) { + super(par1, tool); + + } + + @Override + public void renderSpecial(){ + GL11.glScalef(0.4f, 0.4f, 0.4f); + GL11.glRotatef(180F, 1F, 0F, 0F); + + GL11.glTranslatef(-0.4f, -0.9f, 0.2f); + } + @Override + public void registerIcons(IIconRegister par1IconRegister) + { + this.itemIcon = CustomItems.kunai.getIconFromDamage(0); + } +} diff --git a/src/main/java/noppes/npcs/items/ItemLeafBlade.java b/src/main/java/noppes/npcs/items/ItemLeafBlade.java new file mode 100644 index 000000000..66e0b06be --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemLeafBlade.java @@ -0,0 +1,18 @@ +package noppes.npcs.items; + +import org.lwjgl.opengl.GL11; + +public class ItemLeafBlade extends ItemNpcWeaponInterface{ + + public ItemLeafBlade(int par1, ToolMaterial tool) { + super(par1, tool); + } + + @Override + public void renderSpecial(){ + GL11.glScalef(0.8f, 0.8f, 0.8f); + GL11.glTranslatef(-0.2F, 0.28f, -0.12f); + GL11.glRotatef(180, 0, 1, 0); + GL11.glRotatef(-16, 0, 0, 1); + } +} diff --git a/src/main/java/noppes/npcs/items/ItemMachineGun.java b/src/main/java/noppes/npcs/items/ItemMachineGun.java new file mode 100644 index 000000000..88e01ae43 --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemMachineGun.java @@ -0,0 +1,117 @@ +package noppes.npcs.items; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumAction; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import noppes.npcs.CustomItems; +import noppes.npcs.CustomNpcs; +import noppes.npcs.entity.EntityProjectile; + +import org.lwjgl.opengl.GL11; + +public class ItemMachineGun extends ItemNpcInterface{ + + public ItemMachineGun(int par1) { + super(par1); + this.setMaxDamage(80); + setCreativeTab(CustomItems.tabWeapon); + } + public void onPlayerStoppedUsing(ItemStack stack, World par2World, EntityPlayer player, int count) { + if(player.capabilities.isCreativeMode) + return; + + int ticks = getMaxItemUseDuration(stack) - count; + int shotsleft = stack.stackTagCompound.getInteger("ShotsLeft") - ticks/6; + if(stack.stackTagCompound.getBoolean("Reloading2")){ + shotsleft = ticks/5; + if(ticks > 40) + shotsleft = 8; + if(shotsleft > 1){ + stack.stackTagCompound.setInteger("ShotsLeft", shotsleft); + stack.stackTagCompound.setBoolean("Reloading2", false); + } + } + else if(shotsleft <= 0){ + stack.stackTagCompound.setBoolean("Reloading2", true); + stack.damageItem(1, player); + } + else + stack.stackTagCompound.setInteger("ShotsLeft", shotsleft); + } + + @Override + public void onUsingTick(ItemStack stack, EntityPlayer player, int count) + { + if(player.worldObj.isRemote){ + return; + } + + int ticks = getMaxItemUseDuration(stack) - count; + if(ticks % 6 != 0){ + return; + } + + int shotsleft = stack.stackTagCompound.getInteger("ShotsLeft") - ticks/6; + if(!player.capabilities.isCreativeMode || !CustomNpcs.GunsEnabled){ + if(stack.stackTagCompound.getBoolean("Reloading2") && hasItem(player, CustomItems.bulletBlack)){ + if(ticks > 0 && ticks <= 24){ + player.worldObj.playSoundAtEntity(player, "customnpcs:gun.ak47.load", 1.0F,1); + } + return; + } + else if((shotsleft <= 0 || !hasItem(player, CustomItems.bulletBlack)) || !CustomNpcs.GunsEnabled) + { + player.worldObj.playSoundAtEntity(player, "customnpcs:gun.empty", 1.0F,1); + return; + } + }else{ + stack.stackTagCompound.removeTag("Reloading2"); + } + EntityProjectile projectile = new EntityProjectile(player.worldObj, player, new ItemStack(CustomItems.bulletBlack,1, 0), false); + projectile.damage = 4; + projectile.setSpeed(40); + projectile.shoot(2); + + if(!player.capabilities.isCreativeMode) + consumeItem(player, CustomItems.bulletBlack); + + player.worldObj.playSoundAtEntity(player, "customnpcs:gun.pistol.shot", 0.9F, itemRand.nextFloat() * 0.3F + 0.8F); + player.worldObj.spawnEntityInWorld(projectile); + + + } + @Override + public void renderSpecial(){ + GL11.glRotatef(-6, 0, 0, 1f); + GL11.glScalef(0.8f, 0.7f,0.7f); + GL11.glTranslatef(0.2f, 0.0f, 0.2F); + } + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + @Override + public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) + { + if(stack.stackTagCompound == null) + stack.stackTagCompound = new NBTTagCompound(); + if(!player.capabilities.isCreativeMode && !hasItem(player, CustomItems.bulletBlack)) + stack.stackTagCompound.setBoolean("Reloading2", true); + player.setItemInUse(stack, this.getMaxItemUseDuration(stack)); + return stack; + } + @Override + public int getMaxItemUseDuration(ItemStack par1ItemStack) + { + return 72000; + } + + public EnumAction getItemUseAction(ItemStack stack) + { + if(stack.stackTagCompound == null || !stack.stackTagCompound.getBoolean("Reloading2")) + return EnumAction.bow; + + return EnumAction.block; + } +} diff --git a/src/main/java/noppes/npcs/items/ItemMoneyBag.java b/src/main/java/noppes/npcs/items/ItemMoneyBag.java new file mode 100644 index 000000000..5c9414cc8 --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemMoneyBag.java @@ -0,0 +1,36 @@ +package noppes.npcs.items; + +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import noppes.npcs.CustomItems; +import noppes.npcs.CustomNpcs; +import noppes.npcs.client.NoppesUtil; + +public class ItemMoneyBag extends Item{ + + public ItemMoneyBag(int i) + { + //super(i - 26700 + CustomNpcs.ItemStartId); + maxStackSize = 1; + setCreativeTab(CustomItems.tab); + } + @Override + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + if(par2World.isRemote) //Client check. Only server may create the moneybagcontents + return par1ItemStack; + + if(par1ItemStack.stackTagCompound == null) //You use the par1ItemStack.stackTagCompound to store your data in the item + par1ItemStack.stackTagCompound = new NBTTagCompound(); + + MoneyBagContents contents = new MoneyBagContents(par3EntityPlayer); + + NoppesUtil.openGUI(par3EntityPlayer, new GuiScreen()); + + return par1ItemStack; + } +} \ No newline at end of file diff --git a/src/main/java/noppes/npcs/items/ItemMounter.java b/src/main/java/noppes/npcs/items/ItemMounter.java new file mode 100644 index 000000000..1aaaa6d07 --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemMounter.java @@ -0,0 +1,41 @@ +package noppes.npcs.items; + +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import noppes.npcs.CustomItems; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + + +public class ItemMounter extends Item{ + + public ItemMounter(){ + maxStackSize = 1; + setCreativeTab(CustomItems.tab); + } + + @Override + public int getColorFromItemStack(ItemStack par1ItemStack, int par2){ + return 0x8B4513; + } + + @Override + public boolean requiresMultipleRenderPasses(){ + return true; + } + + @SideOnly(Side.CLIENT) + @Override + public void registerIcons(IIconRegister par1IconRegister){ + this.itemIcon = Items.saddle.getIconFromDamage(0); + } + + @Override + public Item setUnlocalizedName(String name){ + GameRegistry.registerItem(this, name); + return super.setUnlocalizedName(name); + } +} diff --git a/src/main/java/noppes/npcs/items/ItemMusic.java b/src/main/java/noppes/npcs/items/ItemMusic.java new file mode 100644 index 000000000..13f6b13ec --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemMusic.java @@ -0,0 +1,42 @@ +package noppes.npcs.items; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import noppes.npcs.CustomItems; + +public class ItemMusic extends ItemNpcInterface{ + + private boolean shouldRotate = false; + + public ItemMusic() { + setCreativeTab(CustomItems.tabMisc); + } + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer player) + { + if(par2World.isRemote) + return par1ItemStack; + + int note = par2World.rand.nextInt(24); + float var7 = (float)Math.pow(2.0D, (double)(note - 12) / 12.0D); + + String var8 = "harp"; + + par2World.playSoundEffect(player.posX, player.posY, player.posZ, "note." + var8, 3.0F, var7); + par2World.spawnParticle("note", player.posY, player.posY + 1.2D, player.posY, (double)note / 24.0D, 0.0D, 0.0D); + + return par1ItemStack; + } + + public Item setRotated(){ + shouldRotate = true; + return this; + } + + public boolean shouldRotateAroundWhenRendering() + { + return shouldRotate; + } + +} diff --git a/src/main/java/noppes/npcs/items/ItemMusicBanjo.java b/src/main/java/noppes/npcs/items/ItemMusicBanjo.java new file mode 100644 index 000000000..6f20e5dab --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemMusicBanjo.java @@ -0,0 +1,13 @@ +package noppes.npcs.items; + +import org.lwjgl.opengl.GL11; + +public class ItemMusicBanjo extends ItemMusic{ + + @Override + public void renderSpecial(){ + GL11.glScalef(0.85f, 0.85f,0.85f); + GL11.glTranslatef(0.1f, 0.4f, -0.14f); + GL11.glRotatef(-90, -1F, 0, 0F); + } +} diff --git a/src/main/java/noppes/npcs/items/ItemMusicClarinet.java b/src/main/java/noppes/npcs/items/ItemMusicClarinet.java new file mode 100644 index 000000000..d3662fdcb --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemMusicClarinet.java @@ -0,0 +1,35 @@ +package noppes.npcs.items; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumAction; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +import org.lwjgl.opengl.GL11; + +public class ItemMusicClarinet extends ItemMusic{ + + @Override + public void renderSpecial(){ + GL11.glScalef(0.8f, 0.9f, 0.8f); + GL11.glRotatef(-90, 0, 1, 0); + GL11.glRotatef(20, 1, 0, 0); + GL11.glTranslatef(0.44f, -0.7f, -0.04f); + } + @Override + public EnumAction getItemUseAction(ItemStack par1ItemStack) + { + return EnumAction.bow; + } + @Override + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack)); + return super.onItemRightClick(par1ItemStack, par2World, par3EntityPlayer); + } + @Override + public int getMaxItemUseDuration(ItemStack par1ItemStack) + { + return 72000; + } +} diff --git a/src/main/java/noppes/npcs/items/ItemMusicOracina.java b/src/main/java/noppes/npcs/items/ItemMusicOracina.java new file mode 100644 index 000000000..9cff022c9 --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemMusicOracina.java @@ -0,0 +1,36 @@ +package noppes.npcs.items; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumAction; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +import org.lwjgl.opengl.GL11; + +public class ItemMusicOracina extends ItemMusic{ + + @Override + public void renderSpecial(){ + GL11.glScalef(0.5f, 0.5f,0.5f); + GL11.glRotatef(-30, -1, 0, -1F); + GL11.glRotatef(90, 0, 1, 0F); + + GL11.glTranslatef(-0.0f, 0.3f, 0.3f); + } + @Override + public EnumAction getItemUseAction(ItemStack par1ItemStack) + { + return EnumAction.bow; + } + @Override + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack)); + return super.onItemRightClick(par1ItemStack, par2World, par3EntityPlayer); + } + @Override + public int getMaxItemUseDuration(ItemStack par1ItemStack) + { + return 72000; + } +} diff --git a/src/main/java/noppes/npcs/items/ItemMusicViolin.java b/src/main/java/noppes/npcs/items/ItemMusicViolin.java new file mode 100644 index 000000000..3d8415fa6 --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemMusicViolin.java @@ -0,0 +1,37 @@ +package noppes.npcs.items; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumAction; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +import org.lwjgl.opengl.GL11; + +public class ItemMusicViolin extends ItemMusic{ + + @Override + public void renderSpecial(){ + GL11.glScalef(0.66f, 0.66f,0.66f); + GL11.glRotatef(-90, 0F, 0, 1F); + GL11.glRotatef(90, 0, 1, 0F); + + GL11.glTranslatef(0.2f, -0.9f, -0.52f); + } + + @Override + public EnumAction getItemUseAction(ItemStack par1ItemStack) + { + return EnumAction.bow; + } + @Override + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack)); + return super.onItemRightClick(par1ItemStack, par2World, par3EntityPlayer); + } + @Override + public int getMaxItemUseDuration(ItemStack par1ItemStack) + { + return 72000; + } +} diff --git a/src/main/java/noppes/npcs/items/ItemMusket.java b/src/main/java/noppes/npcs/items/ItemMusket.java new file mode 100644 index 000000000..1e9c836f4 --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemMusket.java @@ -0,0 +1,104 @@ +package noppes.npcs.items; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumAction; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import noppes.npcs.CustomItems; +import noppes.npcs.CustomNpcs; +import noppes.npcs.constants.EnumParticleType; +import noppes.npcs.entity.EntityProjectile; + +import org.lwjgl.opengl.GL11; + +public class ItemMusket extends ItemNpcInterface{ + + public ItemMusket(int par1) { + super(par1); + this.setMaxDamage(129); + setCreativeTab(CustomItems.tabWeapon); + } + public void onPlayerStoppedUsing(ItemStack stack, World par2World, EntityPlayer player, int count) { + if(player.worldObj.isRemote) + return; + + if(!stack.stackTagCompound.getBoolean("IsLoaded2") && !player.capabilities.isCreativeMode || !CustomNpcs.GunsEnabled) { + player.worldObj.playSoundAtEntity(player, "customnpcs:gun.empty", 1.0F,1); + return; + } + + if(stack.stackTagCompound.getBoolean("Reloading2") && !player.capabilities.isCreativeMode) { + stack.stackTagCompound.setBoolean("Reloading2", false); + return; + } + stack.damageItem(1, player); + EntityProjectile projectile = new EntityProjectile(player.worldObj, player, new ItemStack(CustomItems.bulletBlack,1, 0), false); + projectile.damage = 16; + projectile.setSpeed(50); + projectile.setParticleEffect(EnumParticleType.Smoke); + projectile.shoot(2); + + if(!player.capabilities.isCreativeMode) + consumeItem(player, CustomItems.bulletBlack); + + player.worldObj.playSoundAtEntity(player, "random.explode", 0.9F, itemRand.nextFloat() * 0.3F + 1.8F); + player.worldObj.playSoundAtEntity(player, "ambient.weather.thunder", 2.0F, itemRand.nextFloat() * 0.3F + 1.8F); + player.worldObj.spawnEntityInWorld(projectile); + stack.stackTagCompound.setBoolean("IsLoaded2", false); + + } + + @Override + public void onUsingTick(ItemStack stack, EntityPlayer player, int count) + { + if(player.worldObj.isRemote){ + return; + } + + int ticks = getMaxItemUseDuration(stack) - count; + + if(!player.capabilities.isCreativeMode){ + if(stack.stackTagCompound.getBoolean("Reloading2") && hasItem(player, CustomItems.bulletBlack)){ + if(ticks == 60){ + player.worldObj.playSoundAtEntity(player, "customnpcs:gun.ak47.load", 1.0F,1); + stack.stackTagCompound.setBoolean("IsLoaded2", true); + } + return; + } + } + } + + @Override + public void renderSpecial(){ + GL11.glRotatef(-6, 0, 0, 1f); + GL11.glScalef(0.7f, 0.7f,0.7f); + GL11.glTranslatef(0.4f, 0.0f, 0.2F); + } + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + @Override + public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) + { + if(stack.stackTagCompound == null) + stack.stackTagCompound = new NBTTagCompound(); + if(!player.capabilities.isCreativeMode && hasItem(player, CustomItems.bulletBlack) && !stack.stackTagCompound.getBoolean("IsLoaded2")) + stack.stackTagCompound.setBoolean("Reloading2", true); + player.setItemInUse(stack, this.getMaxItemUseDuration(stack)); + return stack; + } + @Override + public int getMaxItemUseDuration(ItemStack par1ItemStack) + { + return 72000; + } + + public EnumAction getItemUseAction(ItemStack stack) + { + if(stack.stackTagCompound == null || !stack.stackTagCompound.getBoolean("Reloading2")) + return EnumAction.bow; + + return EnumAction.block; + } +} \ No newline at end of file diff --git a/src/main/java/noppes/npcs/items/ItemNpcArmor.java b/src/main/java/noppes/npcs/items/ItemNpcArmor.java new file mode 100644 index 000000000..955099db0 --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemNpcArmor.java @@ -0,0 +1,35 @@ +package noppes.npcs.items; + +import net.minecraft.entity.Entity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemStack; +import noppes.npcs.CustomItems; +import noppes.npcs.CustomNpcs; +import cpw.mods.fml.common.registry.GameRegistry; + +public class ItemNpcArmor extends ItemArmor{ + + private String texture; + public ItemNpcArmor(int par1, ArmorMaterial par2EnumArmorMaterial,int par4, String texture) { + super(par2EnumArmorMaterial, 0, par4); + this.texture = texture; + setCreativeTab(CustomItems.tabArmor); + } + + + @Override + public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) + { + if(armorType == 2) + return "customnpcs:textures/armor/" + texture + "_2.png"; + return "customnpcs:textures/armor/" + texture + "_1.png"; + } + + + @Override + public Item setUnlocalizedName(String name){ + GameRegistry.registerItem(this, name); + return super.setUnlocalizedName(name); + } +} diff --git a/src/main/java/noppes/npcs/items/ItemNpcArmorColorable.java b/src/main/java/noppes/npcs/items/ItemNpcArmorColorable.java new file mode 100644 index 000000000..6fda21c9b --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemNpcArmorColorable.java @@ -0,0 +1,112 @@ +package noppes.npcs.items; + +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.Entity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.IIcon; +import net.minecraft.util.ResourceLocation; +import noppes.npcs.CustomItems; +import noppes.npcs.CustomNpcs; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class ItemNpcArmorColorable extends ItemArmor{ + + private String texture; + public ItemNpcArmorColorable(int par1, ArmorMaterial par2EnumArmorMaterial,int par4, String texture) { + super(par2EnumArmorMaterial, 0, par4); + this.texture = texture; + setCreativeTab(CustomItems.tabArmor); + } + + + @Override + public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type){ + if(type != null) + return "customnpcs:textures/gui/invisible.png"; + if(armorType == 2) + return "customnpcs:textures/armor/" + texture + "_2.png"; + return "customnpcs:textures/armor/" + texture + "_1.png"; + } + + @Override + public int getColorFromItemStack(ItemStack par1ItemStack, int par2){ + int j = this.getColor(par1ItemStack); + if (j < 0) + return 16777215; + return j; + } + + public int getColor(ItemStack par1ItemStack){ + NBTTagCompound nbttagcompound = par1ItemStack.getTagCompound(); + + if (nbttagcompound == null) + return 10511680; + else{ + NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("display"); + return nbttagcompound1 == null ? 10511680 : (nbttagcompound1.hasKey("color", 3) ? nbttagcompound1.getInteger("color") : 10511680); + } + } + + @Override + public void removeColor(ItemStack par1ItemStack) { + NBTTagCompound nbttagcompound = par1ItemStack.getTagCompound(); + + if (nbttagcompound != null) { + NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("display"); + + if (nbttagcompound1.hasKey("color")) { + nbttagcompound1.removeTag("color"); + } + } + } + + public void func_82813_b(ItemStack par1ItemStack, int par2){ + NBTTagCompound nbttagcompound = par1ItemStack.getTagCompound(); + + if (nbttagcompound == null){ + nbttagcompound = new NBTTagCompound(); + par1ItemStack.setTagCompound(nbttagcompound); + } + + NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("display"); + + if (!nbttagcompound.hasKey("display", 10)) + nbttagcompound.setTag("display", nbttagcompound1); + + nbttagcompound1.setInteger("color", par2); + + } + @Override + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamageForRenderPass(int par1, int par2){ + return this.getIconFromDamage(par1); + } + + @Override + @SideOnly(Side.CLIENT) + public boolean requiresMultipleRenderPasses(){ + return true; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister par1IconRegister){ + this.itemIcon = par1IconRegister.registerIcon(this.getIconString()); + } + + @Override + public boolean hasColor(ItemStack par1ItemStack){ + return !par1ItemStack.hasTagCompound() ? false : (!par1ItemStack.getTagCompound().hasKey("display", 10) ? false : par1ItemStack.getTagCompound().getCompoundTag("display").hasKey("color", 3)); + } + + @Override + public Item setUnlocalizedName(String name){ + GameRegistry.registerItem(this, name); + return super.setUnlocalizedName(name); + } +} diff --git a/src/main/java/noppes/npcs/items/ItemNpcBlock.java b/src/main/java/noppes/npcs/items/ItemNpcBlock.java new file mode 100644 index 000000000..5b9babebe --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemNpcBlock.java @@ -0,0 +1,18 @@ +package noppes.npcs.items; + +import net.minecraft.block.Block; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; + +public class ItemNpcBlock extends ItemBlock{ + public String[] names; + public ItemNpcBlock(Block block) { + super(block); + } + + public String getUnlocalizedName(ItemStack par1ItemStack){ + if(names != null && par1ItemStack.getItemDamage() < names.length) + return names[par1ItemStack.getItemDamage()]; + return this.field_150939_a.getUnlocalizedName(); + } +} diff --git a/src/main/java/noppes/npcs/items/ItemNpcCloner.java b/src/main/java/noppes/npcs/items/ItemNpcCloner.java new file mode 100644 index 000000000..f663bf511 --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemNpcCloner.java @@ -0,0 +1,51 @@ +package noppes.npcs.items; + +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import noppes.npcs.CustomItems; +import noppes.npcs.CustomNpcs; +import noppes.npcs.constants.EnumGuiType; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class ItemNpcCloner extends Item{ + + public ItemNpcCloner(){ + maxStackSize = 1; + setCreativeTab(CustomItems.tab); + } + + @Override + public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10){ + if(par3World.isRemote) + CustomNpcs.proxy.openGui(par4, par5, par6, EnumGuiType.MobSpawner, par2EntityPlayer); + return true; + } + + @Override + public int getColorFromItemStack(ItemStack par1ItemStack, int par2){ + return 0x8B4513; + } + + @Override + public boolean requiresMultipleRenderPasses(){ + return true; + } + + @SideOnly(Side.CLIENT) + @Override + public void registerIcons(IIconRegister par1IconRegister){ + this.itemIcon = Items.iron_axe.getIconFromDamage(0); + } + + @Override + public Item setUnlocalizedName(String name){ + GameRegistry.registerItem(this, name); + return super.setUnlocalizedName(name); + } +} diff --git a/src/main/java/noppes/npcs/items/ItemNpcColored.java b/src/main/java/noppes/npcs/items/ItemNpcColored.java new file mode 100644 index 000000000..274f52b49 --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemNpcColored.java @@ -0,0 +1,12 @@ +package noppes.npcs.items; + +import net.minecraft.block.Block; +import net.minecraft.item.ItemColored; + +public class ItemNpcColored extends ItemColored{ + + public ItemNpcColored(Block p_i45332_1_) { + super(p_i45332_1_, true); + } + +} diff --git a/src/main/java/noppes/npcs/items/ItemNpcInterface.java b/src/main/java/noppes/npcs/items/ItemNpcInterface.java new file mode 100644 index 000000000..9598fa05d --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemNpcInterface.java @@ -0,0 +1,61 @@ +package noppes.npcs.items; + +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraftforge.client.MinecraftForgeClient; +import noppes.npcs.CustomItems; +import noppes.npcs.CustomNpcs; +import noppes.npcs.client.renderer.NpcItemRenderer; + +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.common.registry.GameRegistry; + +public class ItemNpcInterface extends Item implements ItemRenderInterface{ + + public ItemNpcInterface(int par1) { + this(); + } + public ItemNpcInterface() { + setCreativeTab(CustomItems.tab); + CustomNpcs.proxy.registerItem(this); + } + public void renderSpecial(){ + GL11.glScalef(0.66f, 0.66f,0.66f); + GL11.glTranslatef(0, 0.3f, 0); + }; + + @Override + public int getItemEnchantability() + { + //return this.toolMaterial.getEnchantability(); + return super.getItemEnchantability(); + } + + @Override + public Item setUnlocalizedName(String name){ + super.setUnlocalizedName(name); + GameRegistry.registerItem(this, name); + return this; + } + + @Override + public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLiving, EntityLivingBase par3EntityLiving) + { + if(par2EntityLiving.getHealth() <= 0) + return false; + par1ItemStack.damageItem(1, par3EntityLiving); + return true; + } + + public boolean hasItem(EntityPlayer player, Item item) { + return player.inventory.hasItem(item); + } + + public boolean consumeItem(EntityPlayer player, Item item) { + return player.inventory.consumeInventoryItem(item); + } +} diff --git a/src/main/java/noppes/npcs/items/ItemNpcMovingPath.java b/src/main/java/noppes/npcs/items/ItemNpcMovingPath.java new file mode 100644 index 000000000..dade35f4f --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemNpcMovingPath.java @@ -0,0 +1,97 @@ +package noppes.npcs.items; + +import java.util.List; + +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import noppes.npcs.CustomItems; +import noppes.npcs.CustomNpcs; +import noppes.npcs.CustomNpcsPermissions; +import noppes.npcs.NoppesUtilServer; +import noppes.npcs.constants.EnumGuiType; +import noppes.npcs.entity.EntityNPCInterface; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + + + +public class ItemNpcMovingPath extends Item{ + public ItemNpcMovingPath(){ + maxStackSize = 1; + setCreativeTab(CustomItems.tab); + } + + @Override + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer){ + if(par2World.isRemote || !CustomNpcsPermissions.Instance.hasPermission(par3EntityPlayer, CustomNpcsPermissions.TOOL_MOUNTER)) + return par1ItemStack; + EntityNPCInterface npc = getNpc(par1ItemStack, par2World); + if(npc != null) + NoppesUtilServer.sendOpenGui(par3EntityPlayer, EnumGuiType.MovingPath, npc); + return par1ItemStack; + } + + @Override + public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer player, World par3World, int x, int y, int z, int par7, float par8, float par9, float par10){ + if(par3World.isRemote || !CustomNpcsPermissions.Instance.hasPermission(player, CustomNpcsPermissions.TOOL_MOUNTER)) + return false; + EntityNPCInterface npc = getNpc(par1ItemStack, par3World); + if(npc == null) + return true; + List list = npc.ai.getMovingPath(); + int[] pos = list.get(list.size() - 1); + list.add(new int[]{x,y,z}); + + double d3 = x - pos[0]; + double d4 = y - pos[1]; + double d5 = z - pos[2]; + double distance = (double)MathHelper.sqrt_double(d3 * d3 + d4 * d4 + d5 * d5); + + player.addChatMessage(new ChatComponentText("Added point x:" + x + " y:"+ y + " z:" + z + " to npc " + npc.getCommandSenderName())); + if(distance > CustomNpcs.NpcNavRange) + player.addChatMessage(new ChatComponentText("Warning: point is too far away from previous point. Max block walk distance = " + CustomNpcs.NpcNavRange)); + + return true; + } + + private EntityNPCInterface getNpc(ItemStack item, World world){ + if(world.isRemote || item.stackTagCompound == null) + return null; + + Entity entity = world.getEntityByID(item.stackTagCompound.getInteger("NPCID")); + if(entity == null || !(entity instanceof EntityNPCInterface)) + return null; + + return (EntityNPCInterface) entity; + } + + @Override + public int getColorFromItemStack(ItemStack par1ItemStack, int par2){ + return 0x8B4513; + } + + @Override + public boolean requiresMultipleRenderPasses(){ + return true; + } + + @SideOnly(Side.CLIENT) + @Override + public void registerIcons(IIconRegister par1IconRegister){ + this.itemIcon = Items.iron_sword.getIconFromDamage(0); + } + + @Override + public Item setUnlocalizedName(String name){ + GameRegistry.registerItem(this, name); + return super.setUnlocalizedName(name); + } +} diff --git a/src/main/java/noppes/npcs/items/ItemNpcScripter.java b/src/main/java/noppes/npcs/items/ItemNpcScripter.java new file mode 100644 index 000000000..3207b7cf7 --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemNpcScripter.java @@ -0,0 +1,40 @@ +package noppes.npcs.items; + +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import noppes.npcs.CustomItems; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class ItemNpcScripter extends Item{ + + public ItemNpcScripter(){ + maxStackSize = 1; + setCreativeTab(CustomItems.tab); + } + + @Override + public int getColorFromItemStack(ItemStack par1ItemStack, int par2){ + return 0x8B4513; + } + + @Override + public boolean requiresMultipleRenderPasses(){ + return true; + } + + @SideOnly(Side.CLIENT) + @Override + public void registerIcons(IIconRegister par1IconRegister){ + this.itemIcon = Items.iron_shovel.getIconFromDamage(0); + } + + @Override + public Item setUnlocalizedName(String name){ + GameRegistry.registerItem(this, name); + return super.setUnlocalizedName(name); + } +} diff --git a/src/main/java/noppes/npcs/items/ItemNpcWand.java b/src/main/java/noppes/npcs/items/ItemNpcWand.java new file mode 100644 index 000000000..6e6783e4c --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemNpcWand.java @@ -0,0 +1,81 @@ +package noppes.npcs.items; + +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.world.World; +import noppes.npcs.CustomItems; +import noppes.npcs.CustomNpcs; +import noppes.npcs.CustomNpcsPermissions; +import noppes.npcs.NoppesUtilServer; +import noppes.npcs.constants.EnumGuiType; +import noppes.npcs.entity.EntityCustomNpc; +import noppes.npcs.entity.EntityNPCInterface; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class ItemNpcWand extends Item{ + + public ItemNpcWand(){ + maxStackSize = 1; + setCreativeTab(CustomItems.tab); + } + + @Override + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer){ + if(!par2World.isRemote) + return par1ItemStack; + CustomNpcs.proxy.openGui(0, 0, 0, EnumGuiType.NpcRemote, par3EntityPlayer); + return par1ItemStack; + } + + @Override + public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer player, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) + { + if(par3World.isRemote) + return true; + if(CustomNpcs.OpsOnly && !MinecraftServer.getServer().getConfigurationManager().func_152596_g(player.getGameProfile())){ + player.addChatMessage(new ChatComponentTranslation("availability.permission")); + } + else if(CustomNpcsPermissions.Instance.hasPermission(player, CustomNpcsPermissions.NPC_CREATE)){ + EntityCustomNpc npc = new EntityCustomNpc(par3World); + npc.ai.startPos = new int[]{par4,par5,par6}; + + npc.setLocationAndAngles((float)par4 + 0.5F, npc.getStartYPos(), (float)par6 + 0.5F, player.rotationYaw, player.rotationPitch); + + par3World.spawnEntityInWorld(npc); + npc.setHealth(npc.getMaxHealth()); + + NoppesUtilServer.sendOpenGui(player,EnumGuiType.MainMenuDisplay,npc); + } + else + player.addChatMessage(new ChatComponentTranslation("availability.permission")); + return true; + } + + @Override + public int getColorFromItemStack(ItemStack par1ItemStack, int par2){ + return 0x8B4513; + } + @Override + public boolean requiresMultipleRenderPasses(){ + return true; + } + + @SideOnly(Side.CLIENT) + @Override + public void registerIcons(IIconRegister par1IconRegister){ + this.itemIcon = Items.iron_hoe.getIconFromDamage(0); + } + + @Override + public Item setUnlocalizedName(String name){ + GameRegistry.registerItem(this, name); + return super.setUnlocalizedName(name); + } +} diff --git a/src/main/java/noppes/npcs/items/ItemNpcWeaponInterface.java b/src/main/java/noppes/npcs/items/ItemNpcWeaponInterface.java new file mode 100644 index 000000000..06317e83f --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemNpcWeaponInterface.java @@ -0,0 +1,34 @@ +package noppes.npcs.items; + +import net.minecraft.item.Item; +import net.minecraft.item.ItemSword; +import noppes.npcs.CustomItems; +import noppes.npcs.CustomNpcs; + +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.common.registry.GameRegistry; + +public class ItemNpcWeaponInterface extends ItemSword implements ItemRenderInterface{ + + + public ItemNpcWeaponInterface(int par1, ToolMaterial material) { + this(material); + } + public ItemNpcWeaponInterface(ToolMaterial material) { + super(material); + setCreativeTab(CustomItems.tab); + CustomNpcs.proxy.registerItem(this); + setCreativeTab(CustomItems.tabWeapon); + } + public void renderSpecial(){ + GL11.glScalef(0.66f, 0.66f,0.66f); + GL11.glTranslatef(0.16f, 0.26f, 0.06f); + } + + @Override + public Item setUnlocalizedName(String name){ + GameRegistry.registerItem(this, name); + return super.setUnlocalizedName(name); + } +} diff --git a/src/main/java/noppes/npcs/items/ItemOrb.java b/src/main/java/noppes/npcs/items/ItemOrb.java new file mode 100644 index 000000000..0fe26403e --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemOrb.java @@ -0,0 +1,38 @@ +package noppes.npcs.items; + +import java.awt.Color; +import java.util.List; + +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.passive.EntitySheep; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +public class ItemOrb extends ItemNpcInterface{ + + public ItemOrb(int par1) { + super(par1); + setHasSubtypes(true); + } + + + @Override + public int getColorFromItemStack(ItemStack par1ItemStack, int par2){ + float[] color = EntitySheep.fleeceColorTable[par1ItemStack.getItemDamage()]; + return new Color(color[0],color[1],color[2]).getRGB(); + } + + public boolean requiresMultipleRenderPasses() + { + return true; + } + @Override + public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) + { + for (int var4 = 0; var4 < 16; ++var4) + { + par3List.add(new ItemStack(par1, 1, var4)); + } + } + +} diff --git a/src/main/java/noppes/npcs/items/ItemPlaceholder.java b/src/main/java/noppes/npcs/items/ItemPlaceholder.java new file mode 100644 index 000000000..08cafd322 --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemPlaceholder.java @@ -0,0 +1,28 @@ +package noppes.npcs.items; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.Block; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; + +public class ItemPlaceholder extends ItemBlock{ + + public ItemPlaceholder(Block p_i45328_1_) { + super(p_i45328_1_); + setHasSubtypes(true); + } + + @Override + public String getUnlocalizedName(ItemStack par1ItemStack){ + return super.getUnlocalizedName(par1ItemStack) + "_" + par1ItemStack.getItemDamage(); + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamage(int par1) + { + return this.field_150939_a.getIcon(0, par1); + } +} diff --git a/src/main/java/noppes/npcs/items/ItemRenderInterface.java b/src/main/java/noppes/npcs/items/ItemRenderInterface.java new file mode 100644 index 000000000..603e56fbf --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemRenderInterface.java @@ -0,0 +1,5 @@ +package noppes.npcs.items; + +public interface ItemRenderInterface { + public void renderSpecial(); +} diff --git a/src/main/java/noppes/npcs/items/ItemRotatedShield.java b/src/main/java/noppes/npcs/items/ItemRotatedShield.java new file mode 100644 index 000000000..35955eb83 --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemRotatedShield.java @@ -0,0 +1,20 @@ +package noppes.npcs.items; + +import noppes.npcs.constants.EnumNpcToolMaterial; + +import org.lwjgl.opengl.GL11; + +public class ItemRotatedShield extends ItemShield{ + + public ItemRotatedShield(int par1, EnumNpcToolMaterial material) { + super(par1,material); + } + + @Override + public void renderSpecial(){ + GL11.glScalef(0.6f, 0.6f,0.6f); + GL11.glTranslatef(0.4f, 1f, -0.18f); + GL11.glRotatef(-6, 0, 1, 0); + GL11.glRotatef(120, 0, 0, 1); + } +} diff --git a/src/main/java/noppes/npcs/items/ItemScythe.java b/src/main/java/noppes/npcs/items/ItemScythe.java new file mode 100644 index 000000000..0acd40c00 --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemScythe.java @@ -0,0 +1,17 @@ +package noppes.npcs.items; + +import org.lwjgl.opengl.GL11; + +public class ItemScythe extends ItemNpcWeaponInterface{ + + public ItemScythe(int par1 ,ToolMaterial tool) { + super(par1, tool); + } + + @Override + public void renderSpecial(){ + GL11.glScalef(1f, 1.3f, 1f); + GL11.glTranslatef(0.0F, -0.2f, -0.16f); + GL11.glRotatef(180, 0, 1, 0); + } +} diff --git a/src/main/java/noppes/npcs/items/ItemShield.java b/src/main/java/noppes/npcs/items/ItemShield.java new file mode 100644 index 000000000..342b6b40a --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemShield.java @@ -0,0 +1,42 @@ +package noppes.npcs.items; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumAction; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import noppes.npcs.CustomItems; +import noppes.npcs.constants.EnumNpcToolMaterial; + +import org.lwjgl.opengl.GL11; + +public class ItemShield extends ItemNpcInterface{ + public EnumNpcToolMaterial material; + public ItemShield(int par1, EnumNpcToolMaterial material) { + super(par1); + this.material = material; + this.setMaxDamage(material.getMaxUses()); + setCreativeTab(CustomItems.tabWeapon); + } + + @Override + public void renderSpecial(){ + GL11.glScalef(0.6f, 0.6f,0.6f); + GL11.glTranslatef(0f, 0f, -0.2f); + GL11.glRotatef(-6, 0, 1, 0); + } + + public EnumAction getItemUseAction(ItemStack par1ItemStack){ + return EnumAction.block; + } + + @Override + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer){ + par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack)); + return par1ItemStack; + } + + @Override + public int getMaxItemUseDuration(ItemStack par1ItemStack){ + return 72000; + } +} diff --git a/src/main/java/noppes/npcs/items/ItemSkirt.java b/src/main/java/noppes/npcs/items/ItemSkirt.java new file mode 100644 index 000000000..9a53d3cf0 --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemSkirt.java @@ -0,0 +1,61 @@ +package noppes.npcs.items; + +import net.minecraft.client.model.ModelBiped; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.Item; +import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import noppes.npcs.CustomItems; +import noppes.npcs.CustomNpcs; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class ItemSkirt extends ItemArmor{ + + private String texture; + + public ItemSkirt(ArmorMaterial par2EnumArmorMaterial, String texture) { + super(par2EnumArmorMaterial, 0, 2); + this.texture = texture; + setCreativeTab(CustomItems.tabArmor); + setMaxStackSize(1); + } + @Override + public int getColorFromItemStack(ItemStack par1ItemStack, int par2){ + int j = this.getColor(par1ItemStack); + + if (j < 0) + { + j = 16777215; + } + + return j; + } + + @Override + public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type){ + if(type != null && type.equals("overlay")) + return null; + return texture; + } + + @Override + @SideOnly(Side.CLIENT) + public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot){ + return CustomNpcs.proxy.getSkirtModel(); + } + + @Override + public Item setUnlocalizedName(String name){ + GameRegistry.registerItem(this, name); + return super.setUnlocalizedName(name); + } + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamageForRenderPass(int par1, int par2) + { + return super.getIconFromDamage(par1); + } +} diff --git a/src/main/java/noppes/npcs/items/ItemSlingshot.java b/src/main/java/noppes/npcs/items/ItemSlingshot.java new file mode 100644 index 000000000..50b11e3bc --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemSlingshot.java @@ -0,0 +1,79 @@ +package noppes.npcs.items; + +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.EnumAction; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import noppes.npcs.CustomItems; +import noppes.npcs.constants.EnumParticleType; +import noppes.npcs.entity.EntityProjectile; + +import org.lwjgl.opengl.GL11; + +public class ItemSlingshot extends ItemNpcInterface{ + + public ItemSlingshot(int par1) { + super(par1); + this.maxStackSize = 1; + this.setMaxDamage(384); + setCreativeTab(CustomItems.tabWeapon); + } + @Override + public void onPlayerStoppedUsing(ItemStack par1ItemStack, World worldObj, EntityPlayer player, int par4) { + if(worldObj.isRemote) + return; + int ticks = getMaxItemUseDuration(par1ItemStack) - par4; + + if(ticks < 6){//prevent rightclick spamming + return; + } + if (!player.capabilities.isCreativeMode && !consumeItem(player, Item.getItemFromBlock(Blocks.cobblestone))) + { + return; + } + par1ItemStack.damageItem(1, player); + EntityProjectile projectile = new EntityProjectile(worldObj, player, new ItemStack(Blocks.cobblestone), false); + projectile.damage = 4; + projectile.punch = 1; + projectile.setRotating(true); + if(ticks > 24){ + projectile.setParticleEffect(EnumParticleType.Crit); + projectile.punch = 2; + } + projectile.setHasGravity(true); + projectile.setSpeed(14); + projectile.shoot(1); + + worldObj.playSoundAtEntity(player, "random.bow", 1.0F,itemRand.nextFloat() * 0.3F + 0.8F); + worldObj.spawnEntityInWorld(projectile); + } + + @Override + public void renderSpecial(){ + GL11.glRotatef(90, 0, 1, 0); + GL11.glScalef(0.5f, 0.5f,0.5f); + GL11.glTranslatef(0f, 0.5f, 0); + } + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + @Override + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack)); + return par1ItemStack; + } + @Override + public int getMaxItemUseDuration(ItemStack par1ItemStack) + { + return 72000; + } + + public EnumAction getItemUseAction(ItemStack par1ItemStack) + { + return EnumAction.bow; + } +} diff --git a/src/main/java/noppes/npcs/items/ItemSoulstoneEmpty.java b/src/main/java/noppes/npcs/items/ItemSoulstoneEmpty.java new file mode 100644 index 000000000..74e739860 --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemSoulstoneEmpty.java @@ -0,0 +1,95 @@ +package noppes.npcs.items; + +import net.minecraft.entity.EntityList; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.passive.EntityAnimal; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.CustomItems; +import noppes.npcs.CustomNpcs; +import noppes.npcs.CustomNpcsPermissions; +import noppes.npcs.NoppesUtilServer; +import noppes.npcs.constants.EnumRoleType; +import noppes.npcs.controllers.ServerCloneController; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.RoleCompanion; +import noppes.npcs.roles.RoleFollower; +import cpw.mods.fml.common.registry.GameRegistry; + +public class ItemSoulstoneEmpty extends Item { + public ItemSoulstoneEmpty(){ + this.setMaxStackSize(64); + } + @Override + public Item setUnlocalizedName(String name){ + super.setUnlocalizedName(name); + GameRegistry.registerItem(this, name); + return this; + } + + public boolean store(EntityLivingBase entity, ItemStack stack, EntityPlayer player) { + if(!hasPermission(entity, player) || entity instanceof EntityPlayer) + return false; + ItemStack stone = new ItemStack(CustomItems.soulstoneFull); + NBTTagCompound compound = new NBTTagCompound(); + if(!entity.writeToNBTOptional(compound)) + return false; + ServerCloneController.Instance.cleanTags(compound); + if(stone.stackTagCompound == null) + stone.stackTagCompound = new NBTTagCompound(); + stone.stackTagCompound.setTag("Entity", compound); + + String name = EntityList.getEntityString(entity); + if (name == null) + name = "generic"; + stone.stackTagCompound.setString("Name", "entity." + name + ".name"); + if(entity instanceof EntityNPCInterface){ + EntityNPCInterface npc = (EntityNPCInterface) entity; + stone.stackTagCompound.setString("DisplayName", entity.getCommandSenderName()); + if(npc.advanced.role == EnumRoleType.Companion){ + RoleCompanion role = (RoleCompanion) npc.roleInterface; + stone.stackTagCompound.setString("ExtraText", "companion.stage,: ," + role.stage.name); + } + } + else if(entity instanceof EntityLiving && ((EntityLiving)entity).hasCustomNameTag()) + stone.stackTagCompound.setString("DisplayName", ((EntityLiving)entity).getCustomNameTag()); + NoppesUtilServer.GivePlayerItem(player, player, stone); + + if(!player.capabilities.isCreativeMode){ + stack.splitStack(1); + if(stack.stackSize <= 0) + player.destroyCurrentEquippedItem(); + } + + entity.isDead = true; + return true; + } + + public boolean hasPermission(EntityLivingBase entity, EntityPlayer player){ + if(NoppesUtilServer.isOp(player) && player.capabilities.isCreativeMode) + return true; + if(CustomNpcsPermissions.enabled() && CustomNpcsPermissions.hasPermission(player, CustomNpcsPermissions.SOULSTONE_ALL)) + return true; + if(entity instanceof EntityNPCInterface){ + EntityNPCInterface npc = (EntityNPCInterface) entity; + if(npc.advanced.role == EnumRoleType.Companion){ + RoleCompanion role = (RoleCompanion) npc.roleInterface; + if(role.getOwner() == player) + return true; + } + if(npc.advanced.role == EnumRoleType.Follower){ + RoleFollower role = (RoleFollower) npc.roleInterface; + if(role.getOwner() == player) + return !role.refuseSoulStone; + } + return CustomNpcs.SoulStoneNPCs; + } + if(entity instanceof EntityAnimal) + return CustomNpcs.SoulStoneAnimals; + + return false; + } +} diff --git a/src/main/java/noppes/npcs/items/ItemSoulstoneFilled.java b/src/main/java/noppes/npcs/items/ItemSoulstoneFilled.java new file mode 100644 index 000000000..8a05e130e --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemSoulstoneFilled.java @@ -0,0 +1,100 @@ +package noppes.npcs.items; + +import java.text.DateFormat; +import java.util.Date; +import java.util.List; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityList; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; +import noppes.npcs.constants.EnumRoleType; +import noppes.npcs.controllers.PlayerData; +import noppes.npcs.controllers.PlayerDataController; +import noppes.npcs.entity.EntityCustomNpc; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.RoleCompanion; +import noppes.npcs.roles.RoleFollower; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class ItemSoulstoneFilled extends Item { + public ItemSoulstoneFilled(){ + setMaxStackSize(1); + } + @Override + public Item setUnlocalizedName(String name){ + super.setUnlocalizedName(name); + GameRegistry.registerItem(this, name); + return this; + } + + @Override + @SideOnly(Side.CLIENT) + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bo) { + if(stack.stackTagCompound == null || !stack.stackTagCompound.hasKey("Entity", 10)){ + list.add(EnumChatFormatting.RED + "Error"); + return; + } + String name = StatCollector.translateToLocal(stack.stackTagCompound.getString("Name")); + if(stack.stackTagCompound.hasKey("DisplayName")) + name = stack.stackTagCompound.getString("DisplayName") + " (" + name + ")"; + list.add(EnumChatFormatting.BLUE + name); + + if(stack.stackTagCompound.hasKey("ExtraText")){ + String text = ""; + String[] split = stack.stackTagCompound.getString("ExtraText").split(","); + for(String s : split) + text += StatCollector.translateToLocal(s); + list.add(text); + } + } + + @Override + public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_){ + if(!spawn(player, stack, world, x, y, z)) + return false; + + if(!player.capabilities.isCreativeMode) + stack.splitStack(1); + return true; + } + + public boolean spawn(EntityPlayer player, ItemStack stack, World world, int x, int y, int z){ + if(world.isRemote) + return true; + if(stack.stackTagCompound == null || !stack.stackTagCompound.hasKey("Entity", 10)) + return false; + NBTTagCompound compound = stack.stackTagCompound.getCompoundTag("Entity"); + Entity entity = EntityList.createEntityFromNBT(compound, world); + if(entity == null) + return false; + entity.setPosition(x + 0.5, y + 1 + 0.2F, z + 0.5); + if(entity instanceof EntityNPCInterface){ + EntityNPCInterface npc = (EntityNPCInterface) entity; + npc.ai.startPos = new int[]{x, y, z}; + npc.setHealth(npc.getMaxHealth()); + npc.setPosition((float)x + 0.5F, npc.getStartYPos(), (float)z + 0.5F); + + if(npc.advanced.role == EnumRoleType.Companion && player != null){ + PlayerData data = PlayerDataController.instance.getPlayerData(player); + if(data.hasCompanion()) + return false; + ((RoleCompanion)npc.roleInterface).setOwner(player); + data.setCompanion(npc); + } + if(npc.advanced.role == EnumRoleType.Follower && player != null){ + ((RoleFollower)npc.roleInterface).setOwner(player); + } + } + world.spawnEntityInWorld(entity); + return true; + } +} diff --git a/src/main/java/noppes/npcs/items/ItemSpear.java b/src/main/java/noppes/npcs/items/ItemSpear.java new file mode 100644 index 000000000..ad69b5c53 --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemSpear.java @@ -0,0 +1,18 @@ +package noppes.npcs.items; + +import org.lwjgl.opengl.GL11; + + +public class ItemSpear extends ItemNpcWeaponInterface{ + + public ItemSpear(int par1, ToolMaterial tool) { + super(par1, tool); + } + + public void renderSpecial(){ + GL11.glScalef(1f, 1.3f, 1f); + GL11.glTranslatef(-0.12f, -0.24f, -0.16f); + GL11.glRotatef(180, 0, 1, 0); + } + +} diff --git a/src/main/java/noppes/npcs/items/ItemStaff.java b/src/main/java/noppes/npcs/items/ItemStaff.java new file mode 100644 index 000000000..f8c1b1ce4 --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemStaff.java @@ -0,0 +1,201 @@ +package noppes.npcs.items; + +import org.lwjgl.opengl.GL11; + +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumAction; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import net.minecraft.world.WorldServer; +import noppes.npcs.CustomItems; +import noppes.npcs.CustomNpcs; +import noppes.npcs.constants.EnumNpcToolMaterial; +import noppes.npcs.enchants.EnchantInterface; +import noppes.npcs.entity.EntityMagicProjectile; +import noppes.npcs.entity.EntityProjectile; +import noppes.npcs.util.IProjectileCallback; + +public class ItemStaff extends ItemNpcInterface implements IProjectileCallback{ + + private EnumNpcToolMaterial material; + public ItemStaff(int par1, EnumNpcToolMaterial material) { + super(par1); + this.material = material; + setCreativeTab(CustomItems.tabWeapon); + } + public void renderSpecial(){ + GL11.glScalef(1f, 1.14f, 1f); + GL11.glTranslatef(0.14f, -0.3f, 0.08f); + } + @Override + public void onPlayerStoppedUsing(ItemStack stack, World worldObj, EntityPlayer player, int par4) { + if(worldObj.isRemote){ + return; + } + if(stack.stackTagCompound == null) + return; + Entity entity = ((WorldServer)player.worldObj).getEntityByID(stack.stackTagCompound.getInteger("MagicProjectile")); + if(entity == null || !(entity instanceof EntityProjectile)) + return; + EntityProjectile item = (EntityProjectile) entity; + item.callback = this; + item.callbackItem = stack; + item.explosive = true; + item.explosiveDamage = false; + item.explosiveRadius = 1; + item.prevRotationYaw = item.rotationYaw = player.rotationYaw; + item.prevRotationPitch = item.rotationPitch = player.rotationPitch; + item.shoot(2); + + player.worldObj.playSoundAtEntity(player, "customnpcs:magic.shot", 1.0F,1); + + } + + @Override + public void onUsingTick(ItemStack stack, EntityPlayer player, int count) + { + int tick = getMaxItemUseDuration(stack) - count; + if(player.worldObj.isRemote){ + spawnParticle(stack, player); + return; + } + int chargeTime = 20 + material.getHarvestLevel() * 8; + if(tick == chargeTime){ + if(!player.capabilities.isCreativeMode && !hasInfinite(stack)){ + if(!hasItem(player, CustomItems.mana)) + return; + consumeItem(player, CustomItems.mana); + } + player.worldObj.playSoundAtEntity(player, "customnpcs:magic.charge", 1.0F,1); + if(stack.stackTagCompound == null){ + stack.stackTagCompound = new NBTTagCompound(); + } + int damage = 6 + material.getDamageVsEntity() + player.worldObj.rand.nextInt(4); + damage += damage * EnchantInterface.getLevel(EnchantInterface.Damage, stack) * 0.5f; + EntityProjectile projectile = new EntityMagicProjectile(player.worldObj, player, getProjectile(stack), false); + projectile.damage = damage; + projectile.setSpeed(25); + 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)); + projectile.setPosition(player.posX + dx * 0.8, player.posY + 1.5 - player.rotationPitch/80, player.posZ + dz * 0.8); + player.worldObj.spawnEntityInWorld(projectile); + stack.stackTagCompound.setInteger("MagicProjectile", projectile.getEntityId());//entityid + } + if(tick > chargeTime && stack.stackTagCompound != null){ + Entity entity = ((WorldServer)player.worldObj).getEntityByID(stack.stackTagCompound.getInteger("MagicProjectile")); + if(entity == null || !(entity instanceof EntityProjectile)) + return; + EntityProjectile item = (EntityProjectile) entity; + item.ticksInAir = 0; + + 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)); + item.setPosition(player.posX + dx * 0.8, player.posY + 1.5 - player.rotationPitch/80, player.posZ + dz * 0.8); + } + + } + @Override + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer){ + par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack)); + return par1ItemStack; + } + @Override + public int getMaxItemUseDuration(ItemStack par1ItemStack){ + return 72000; + } + + @Override + public EnumAction getItemUseAction(ItemStack par1ItemStack){ + return EnumAction.bow; + } + + public ItemStack getProjectile(ItemStack stack){ + if(stack.getItem() == CustomItems.staffWood){ + return new ItemStack(CustomItems.spellNature); + } + if(stack.getItem() == CustomItems.staffStone || stack.getItem() == CustomItems.staffDemonic){ + return new ItemStack(CustomItems.spellDark); + } + if(stack.getItem() == CustomItems.staffIron || stack.getItem() == CustomItems.staffMithril){ + return new ItemStack(CustomItems.spellHoly); + } + if(stack.getItem() == CustomItems.staffBronze){ + return new ItemStack(CustomItems.spellLightning); + } + if(stack.getItem() == CustomItems.staffGold){ + return new ItemStack(CustomItems.spellFire); + } + if(stack.getItem() == CustomItems.staffDiamond || stack.getItem() == CustomItems.staffFrost){ + return new ItemStack(CustomItems.spellIce); + } + if(stack.getItem() == CustomItems.staffEmerald){ + return new ItemStack(CustomItems.spellArcane); + } + return new ItemStack(CustomItems.orb,1,stack.getItemDamage()); + } + public void spawnParticle(ItemStack stack, EntityPlayer player){ + if(stack.getItem() == CustomItems.staffWood){ + CustomNpcs.proxy.spawnParticle(player,"Spell",5,2); + CustomNpcs.proxy.spawnParticle(player,"Spell",12,2); + } + else if(stack.getItem() == CustomItems.staffStone || stack.getItem() == CustomItems.staffDemonic){ + CustomNpcs.proxy.spawnParticle(player,"Spell",0x563357,2); + CustomNpcs.proxy.spawnParticle(player,"Spell",0x432744,2); + } + else if(stack.getItem() == CustomItems.staffBronze){ + CustomNpcs.proxy.spawnParticle(player,"Spell",0x83F7F6,2); + CustomNpcs.proxy.spawnParticle(player,"Spell",0x5CF0FF,2); + } + else if(stack.getItem() == CustomItems.staffIron || stack.getItem() == CustomItems.staffMithril){ + CustomNpcs.proxy.spawnParticle(player,"Spell",0xFCFFC9,2); + CustomNpcs.proxy.spawnParticle(player,"Spell",0xEFFF97,2); + } + else if(stack.getItem() == CustomItems.staffGold){ + CustomNpcs.proxy.spawnParticle(player,"Spell",1,2); + CustomNpcs.proxy.spawnParticle(player,"Spell",14,2); + } + else if(stack.getItem() == CustomItems.staffDiamond || stack.getItem() == CustomItems.staffFrost){ + CustomNpcs.proxy.spawnParticle(player,"Spell",0x94DFED,2); + CustomNpcs.proxy.spawnParticle(player,"Spell",0x44B6FF,2); + } + else if(stack.getItem() == CustomItems.staffEmerald){ + CustomNpcs.proxy.spawnParticle(player,"Spell",0xFFC3E7,2); + CustomNpcs.proxy.spawnParticle(player,"Spell",0xFB92FF,2); + } + } + + @Override + public int getItemEnchantability(){ + return this.material.getEnchantability(); + } + @Override + public boolean isItemTool(ItemStack par1ItemStack){ + return true; + } + + @Override + public boolean onImpact(EntityProjectile entityProjectile, EntityLivingBase entity, ItemStack itemstack) { + int confusion = EnchantInterface.getLevel(EnchantInterface.Confusion, itemstack); + if(confusion > 0){ + if(entity.getRNG().nextInt(4) > confusion) + entity.addPotionEffect(new PotionEffect(Potion.confusion.id, 100)); + } + int poison = EnchantInterface.getLevel(EnchantInterface.Poison, itemstack); + if(poison > 0){ + if(entity.getRNG().nextInt(4) > poison) + entity.addPotionEffect(new PotionEffect(Potion.poison.id, 100)); + } + return false; + } + + public boolean hasInfinite(ItemStack stack){ + return EnchantInterface.getLevel(EnchantInterface.Infinite, stack) > 0; + } +} diff --git a/src/main/java/noppes/npcs/items/ItemTeleporter.java b/src/main/java/noppes/npcs/items/ItemTeleporter.java new file mode 100644 index 000000000..b7f3694ae --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemTeleporter.java @@ -0,0 +1,178 @@ +package noppes.npcs.items; + +import java.util.List; + +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; +import noppes.npcs.CustomItems; +import noppes.npcs.CustomNpcs; +import noppes.npcs.constants.EnumGuiType; +import noppes.npcs.entity.EntityNPCInterface; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + + +public class ItemTeleporter extends Item{ + + public ItemTeleporter(){ + maxStackSize = 1; + setCreativeTab(CustomItems.tab); + } + + @Override + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer){ + if(!par2World.isRemote) + return par1ItemStack; + CustomNpcs.proxy.openGui((EntityNPCInterface)null,EnumGuiType.NpcDimensions); + return par1ItemStack; + } + + @Override + public boolean onEntitySwing(EntityLivingBase par3EntityPlayer, ItemStack stack){ + if(par3EntityPlayer.worldObj.isRemote) + return false; + float f = 1.0F; + float f1 = par3EntityPlayer.prevRotationPitch + (par3EntityPlayer.rotationPitch - par3EntityPlayer.prevRotationPitch) * f; + float f2 = par3EntityPlayer.prevRotationYaw + (par3EntityPlayer.rotationYaw - par3EntityPlayer.prevRotationYaw) * f; + double d0 = par3EntityPlayer.prevPosX + (par3EntityPlayer.posX - par3EntityPlayer.prevPosX) * (double)f; + double d1 = par3EntityPlayer.prevPosY + (par3EntityPlayer.posY - par3EntityPlayer.prevPosY) * (double)f + 1.62D - (double)par3EntityPlayer.yOffset; + double d2 = par3EntityPlayer.prevPosZ + (par3EntityPlayer.posZ - par3EntityPlayer.prevPosZ) * (double)f; + Vec3 vec3 = Vec3.createVectorHelper(d0, d1, d2); + float f3 = MathHelper.cos(-f2 * 0.017453292F - (float)Math.PI); + float f4 = MathHelper.sin(-f2 * 0.017453292F - (float)Math.PI); + float f5 = -MathHelper.cos(-f1 * 0.017453292F); + float f6 = MathHelper.sin(-f1 * 0.017453292F); + float f7 = f4 * f5; + float f8 = f3 * f5; + double d3 = 80.0D; + Vec3 vec31 = vec3.addVector((double)f7 * d3, (double)f6 * d3, (double)f8 * d3); + MovingObjectPosition movingobjectposition = par3EntityPlayer.worldObj.rayTraceBlocks(vec3, vec31, true); + if (movingobjectposition == null) + return false; + + Vec3 vec32 = par3EntityPlayer.getLook(f); + boolean flag = false; + float f9 = 1.0F; + List list = par3EntityPlayer.worldObj.getEntitiesWithinAABBExcludingEntity(par3EntityPlayer, par3EntityPlayer.boundingBox.addCoord(vec32.xCoord * d3, vec32.yCoord * d3, vec32.zCoord * d3).expand((double)f9, (double)f9, (double)f9)); + + for (int i = 0; i < list.size(); ++i){ + Entity entity = (Entity)list.get(i); + + if (entity.canBeCollidedWith()){ + float f10 = entity.getCollisionBorderSize(); + AxisAlignedBB axisalignedbb = entity.boundingBox.expand((double)f10, (double)f10, (double)f10); + + if (axisalignedbb.isVecInside(vec3)){ + flag = true; + } + } + } + + if (flag) + return false; + + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK){ + int i = movingobjectposition.blockX; + int j = movingobjectposition.blockY; + int k = movingobjectposition.blockZ; + + while(par3EntityPlayer.worldObj.getBlock(i, j, k) != Blocks.air){ + j++; + } + par3EntityPlayer.setPositionAndUpdate(i + 0.5F, j + 1.0F, k + 0.5F); + } + + + return true; + } +// protected static MovingObjectPosition rayTraceBlocks(EntityPlayer entityPlayer, int radius) { +// Vec3 vec3 = Vec3.createVectorHelper(entityPlayer.posX, entityPlayer.height * 0.8 + entityPlayer.boundingBox.minY, entityPlayer.posZ); +// Vec3 vec3a = entityPlayer.getLookVec(); +// Vec3 vec3b = vec3.addVector(vec3a.xCoord * radius, vec3a.yCoord * radius, vec3a.zCoord * radius); +// +// return entityPlayer.worldObj.func_147447_a(vec3, vec3b, false, false, true); +// } +// +// protected static MovingObjectPosition getPointingEntity(EntityPlayer entityPlayer, int radius) { +// MovingObjectPosition block = rayTraceBlocks(entityPlayer, radius); +// Vec3 vec3 = Vec3.createVectorHelper(entityPlayer.posX, entityPlayer.height * 0.8 + entityPlayer.boundingBox.minY, entityPlayer.posZ); +// +// Vec3 vec31 = entityPlayer.getLookVec(); +// Vec3 vec32 = vec3.addVector(vec31.xCoord * radius, vec31.yCoord * radius, vec31.zCoord * radius); +// Vec3 vec33 = null; +// List entities = entityPlayer.worldObj.getEntitiesWithinAABBExcludingEntity(entityPlayer, entityPlayer.boundingBox.addCoord(vec31.xCoord * radius, vec31.yCoord * radius, vec31.zCoord * radius).expand(1.0D, 1.0D, 1.0D)); +// Entity pointedEntity = null; +// double d = radius; +// +// for (Entity entity : entities) { +// if (entity.canBeCollidedWith()) { +// float f = entity.getCollisionBorderSize(); +// AxisAlignedBB axisalignedbb = entity.boundingBox.expand((double)f, (double)f, (double)f); +// MovingObjectPosition movingObjectPosition = axisalignedbb.calculateIntercept(vec3, vec32); +// +// if (axisalignedbb.isVecInside(vec3)) { +// if (0.0D < radius || radius == 0.0D) { +// pointedEntity = entity; +// vec33 = movingObjectPosition == null ? vec3 : movingObjectPosition.hitVec; +// d = 0.0D; +// } +// } else if (movingObjectPosition != null) { +// double d2 = vec3.distanceTo(movingObjectPosition.hitVec); +// +// if (d2 < radius || radius == 0.0D) { +// if (entity == entityPlayer.ridingEntity && !entity.canRiderInteract()) { +// if (radius == 0.0D) { +// pointedEntity = entity; +// vec33 = movingObjectPosition.hitVec; +// } +// } else { +// pointedEntity = entity; +// vec33 = movingObjectPosition.hitVec; +// d = d2; +// } +// } +// } +// } +// } +// +// if (pointedEntity != null && (d < radius)) { +// return new MovingObjectPosition(pointedEntity, vec33); +// } +// +// return null; +// } + + @Override + public int getColorFromItemStack(ItemStack par1ItemStack, int par2){ + return 0x8B4513; + } + + @Override + public boolean requiresMultipleRenderPasses(){ + return true; + } + + @SideOnly(Side.CLIENT) + @Override + public void registerIcons(IIconRegister par1IconRegister){ + this.itemIcon = Items.feather.getIconFromDamage(0); + } + + @Override + public Item setUnlocalizedName(String name){ + GameRegistry.registerItem(this, name); + return super.setUnlocalizedName(name); + } +} diff --git a/src/main/java/noppes/npcs/items/ItemThrowingShuriken.java b/src/main/java/noppes/npcs/items/ItemThrowingShuriken.java new file mode 100644 index 000000000..643092b61 --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemThrowingShuriken.java @@ -0,0 +1,20 @@ +package noppes.npcs.items; + +import org.lwjgl.opengl.GL11; + +public class ItemThrowingShuriken extends ItemThrowingWeapon{ + + public ItemThrowingShuriken(int par1) { + super(par1); + } + + @Override + public void renderSpecial(){ + GL11.glScalef(0.5f, 0.5f, 0.5f); + GL11.glTranslatef(-0.1F, 0.3f, 0f); + } + @Override + public boolean shouldRotateAroundWhenRendering(){ + return true; + } +} diff --git a/src/main/java/noppes/npcs/items/ItemThrowingWeapon.java b/src/main/java/noppes/npcs/items/ItemThrowingWeapon.java new file mode 100644 index 000000000..8653433b5 --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemThrowingWeapon.java @@ -0,0 +1,73 @@ +package noppes.npcs.items; + +import org.lwjgl.opengl.GL11; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import noppes.npcs.CustomItems; +import noppes.npcs.entity.EntityProjectile; + +public class ItemThrowingWeapon extends ItemNpcInterface{ + private boolean rotating = false; + private int damage = 2; + private boolean dropItem = false; + + public ItemThrowingWeapon(int par1) { + super(par1); + setCreativeTab(CustomItems.tabWeapon); + } + + public void onPlayerStoppedUsing(ItemStack par1ItemStack, World worldObj, EntityPlayer player, int par4) + { + if(worldObj.isRemote){ + player.swingItem(); + return; + } + EntityProjectile projectile = new EntityProjectile(worldObj, player, new ItemStack(par1ItemStack.getItem(), 1,par1ItemStack.getItemDamage()), false); + projectile.damage = damage; + projectile.canBePickedUp = !player.capabilities.isCreativeMode && dropItem; + projectile.setRotating(rotating);; + projectile.setIs3D(true); + projectile.setStickInWall(true); + projectile.setHasGravity(true); + projectile.setSpeed(12); + + if(!player.capabilities.isCreativeMode){ + consumeItem(player, this); + } + projectile.shoot(1); + worldObj.playSoundAtEntity(player, "customnpcs:misc.swosh", 1.0F,1); + worldObj.spawnEntityInWorld(projectile); + } + public ItemThrowingWeapon setRotating(){ + rotating = true; + return this; + } + public ItemThrowingWeapon setDamage(int damage){ + this.damage = damage; + return this; + } + public ItemThrowingWeapon setDropItem(){ + dropItem = true; + return this; + } + + @Override + public void renderSpecial(){ + super.renderSpecial(); + GL11.glTranslatef(0.2F, 0.1f, 0.06f); + } + + @Override + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack)); + return par1ItemStack; + } + @Override + public int getMaxItemUseDuration(ItemStack par1ItemStack) + { + return 72000; + } +} diff --git a/src/main/java/noppes/npcs/items/ItemWand.java b/src/main/java/noppes/npcs/items/ItemWand.java new file mode 100644 index 000000000..09e342d0b --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemWand.java @@ -0,0 +1,25 @@ +package noppes.npcs.items; + +import net.minecraft.item.ItemStack; +import noppes.npcs.CustomItems; + +import org.lwjgl.opengl.GL11; + +public class ItemWand extends ItemNpcInterface{ + + public ItemWand(int par1) { + super(par1); + setCreativeTab(CustomItems.tabMisc); + } + + @Override + public boolean hasEffect(ItemStack par1ItemStack, int pass){ + return true; + } + + @Override + public void renderSpecial(){ + GL11.glScalef(0.54f, 0.54f, 0.54f); + GL11.glTranslatef(0.1F, 0.5f, 0.1f); + } +} diff --git a/src/main/java/noppes/npcs/items/ItemWarhammer.java b/src/main/java/noppes/npcs/items/ItemWarhammer.java new file mode 100644 index 000000000..208d2caae --- /dev/null +++ b/src/main/java/noppes/npcs/items/ItemWarhammer.java @@ -0,0 +1,16 @@ +package noppes.npcs.items; + +import org.lwjgl.opengl.GL11; + +public class ItemWarhammer extends ItemNpcWeaponInterface{ + + public ItemWarhammer(int par1 ,ToolMaterial tool) { + super(par1, tool); + } + + @Override + public void renderSpecial(){ + GL11.glScalef(1.2f, 1.4f, 1f); + GL11.glTranslatef(0.2F, -0.08f, 0.08f); + } +} diff --git a/src/main/java/noppes/npcs/items/MoneyBagContents.java b/src/main/java/noppes/npcs/items/MoneyBagContents.java new file mode 100644 index 000000000..6e532b295 --- /dev/null +++ b/src/main/java/noppes/npcs/items/MoneyBagContents.java @@ -0,0 +1,55 @@ +package noppes.npcs.items; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; + +public class MoneyBagContents { + private EntityPlayer player; + private int[] coinData = new int[]{0,0,0,0,0,0,0}; + + public MoneyBagContents(EntityPlayer player) { + this.player = player; + } + + public void readNBT(NBTTagCompound compound){ + coinData = compound.getIntArray("coins"); + } + + public NBTTagCompound writeNBT(){ + NBTTagCompound compound = new NBTTagCompound(); + compound.setIntArray("coins", coinData); + return compound; + } + + + public enum CoinType { + WOOD,STONE,IRON,GOLD,DIAMOND,BRONZE,EMERALD; + } + + + //Adds stackSize to coinType + public void AddCurrency(CoinType coinType, byte stackSize, ItemStack theBag){ + coinData[coinType.ordinal()] = coinData[coinType.ordinal()] + stackSize; + theBag.stackTagCompound.setTag("contents", writeNBT()); + } + + //Creates amount number of coinType in playerInventory and subtracts from the moneyBag. + public void WithdrawCurrencyByVal(CoinType coinType, short amount, ItemStack theBag) { + int amtAdded = 0; + + coinData[coinType.ordinal()] = coinData[coinType.ordinal()]- amtAdded; + theBag.stackTagCompound.setTag("contents", writeNBT()); + } + + //Creates numStacks of coinType in recievingInventory and subtracts from the moneyBag. + public void WithdrawCurrencyByStack(CoinType coinType, byte numStacks, ItemStack theBag) { + int amtAdded = 0; + //check inventory space + + coinData[coinType.ordinal()] = coinData[coinType.ordinal()]- amtAdded; + theBag.stackTagCompound.setTag("contents", writeNBT()); + } +} diff --git a/src/main/java/noppes/npcs/quests/QuestDialog.java b/src/main/java/noppes/npcs/quests/QuestDialog.java new file mode 100644 index 000000000..a2c4f9548 --- /dev/null +++ b/src/main/java/noppes/npcs/quests/QuestDialog.java @@ -0,0 +1,58 @@ +package noppes.npcs.quests; + +import java.util.HashMap; +import java.util.Vector; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.NBTTags; +import noppes.npcs.controllers.Dialog; +import noppes.npcs.controllers.DialogController; +import noppes.npcs.controllers.PlayerDataController; + +public class QuestDialog extends QuestInterface{ + + public HashMap dialogs = new HashMap(); + + @Override + public void readEntityFromNBT(NBTTagCompound compound) { + dialogs = NBTTags.getIntegerIntegerMap(compound.getTagList("QuestDialogs", 10)); + } + + @Override + public void writeEntityToNBT(NBTTagCompound compound) { + compound.setTag("QuestDialogs", NBTTags.nbtIntegerIntegerMap(dialogs)); + } + + @Override + public boolean isCompleted(EntityPlayer player) { + for(int dialogId : dialogs.values()) + if(!PlayerDataController.instance.getPlayerData(player).dialogData.dialogsRead.contains(dialogId)) + return false; + return true; + } + + @Override + public void handleComplete(EntityPlayer player) { + + } + + @Override + public Vector getQuestLogStatus(EntityPlayer player) { + Vector vec = new Vector(); + for(int dialogId : dialogs.values()){ + Dialog dialog = DialogController.instance.dialogs.get(dialogId); + if(dialog == null) + continue; + String title = dialog.title; + if(PlayerDataController.instance.getPlayerData(player).dialogData.dialogsRead.contains(dialogId)) + title += " (read)"; + else + title += " (unread)"; + vec.add(title); + } + + return vec; + } + +} diff --git a/src/main/java/noppes/npcs/quests/QuestInterface.java b/src/main/java/noppes/npcs/quests/QuestInterface.java new file mode 100644 index 000000000..9e48fd02d --- /dev/null +++ b/src/main/java/noppes/npcs/quests/QuestInterface.java @@ -0,0 +1,15 @@ +package noppes.npcs.quests; + +import java.util.Vector; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; + +public abstract class QuestInterface { + public int questId; + public abstract void writeEntityToNBT(NBTTagCompound compound); + public abstract void readEntityFromNBT(NBTTagCompound compound); + public abstract boolean isCompleted(EntityPlayer player); + public abstract void handleComplete(EntityPlayer player); + public abstract Vector getQuestLogStatus(EntityPlayer player); +} diff --git a/src/main/java/noppes/npcs/quests/QuestItem.java b/src/main/java/noppes/npcs/quests/QuestItem.java new file mode 100644 index 000000000..910b168d2 --- /dev/null +++ b/src/main/java/noppes/npcs/quests/QuestItem.java @@ -0,0 +1,123 @@ +package noppes.npcs.quests; + +import java.util.HashMap; +import java.util.Vector; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.NoppesUtilPlayer; +import noppes.npcs.NpcMiscInventory; + +public class QuestItem extends QuestInterface{ + public NpcMiscInventory items = new NpcMiscInventory(3); + public boolean leaveItems = false; + public boolean ignoreDamage = false; + public boolean ignoreNBT = false; + + @Override + public void readEntityFromNBT(NBTTagCompound compound) { + items.setFromNBT(compound.getCompoundTag("Items")); + leaveItems = compound.getBoolean("LeaveItems"); + ignoreDamage = compound.getBoolean("IgnoreDamage"); + ignoreNBT = compound.getBoolean("IgnoreNBT"); + } + + @Override + public void writeEntityToNBT(NBTTagCompound compound) { + compound.setTag("Items", items.getToNBT()); + compound.setBoolean("LeaveItems", leaveItems); + compound.setBoolean("IgnoreDamage", ignoreDamage); + compound.setBoolean("IgnoreNBT", ignoreNBT); + } + + @Override + public boolean isCompleted(EntityPlayer player) { + HashMap map = getProcessSet(player); + for(ItemStack reqItem : items.items.values()){ + boolean done = false; + for(ItemStack item : map.values()){ + if(NoppesUtilPlayer.compareItems(reqItem, item, ignoreDamage, ignoreNBT) && item.stackSize >= reqItem.stackSize){ + done = true; + break; + } + } + if(!done) + return false; + } + + + return true; + } + public HashMap getProcessSet(EntityPlayer player){ + HashMap map = new HashMap(); + for(int slot : items.items.keySet()){ + ItemStack item = items.items.get(slot); + if(item == null) + continue; + ItemStack is = item.copy(); + is.stackSize = 0; + map.put(slot,is); + } + for(ItemStack item : player.inventory.mainInventory){ + if(item == null) + continue; + for(ItemStack questItem : map.values()){ + if(NoppesUtilPlayer.compareItems(questItem, item, ignoreDamage, ignoreNBT)){ + questItem.stackSize += item.stackSize; + } + } + } + return map; + } + @Override + public void handleComplete(EntityPlayer player) { + if(leaveItems) + return; + for(ItemStack questitem : items.items.values()){ + int stacksize = questitem.stackSize; + for(int i = 0; i < player.inventory.mainInventory.length; i++){ + ItemStack item = player.inventory.mainInventory[i]; + if(item == null) + continue; + if(NoppesUtilPlayer.compareItems(item, questitem, ignoreDamage, ignoreNBT)){ + int size = item.stackSize; + if(stacksize - size >= 0){ + player.inventory.setInventorySlotContents(i, null); + item.splitStack(size); + } + else{ + item.splitStack(stacksize); + } + stacksize -= size; + if(stacksize <= 0) + break; + } + } + } + } + + @Override + public Vector getQuestLogStatus(EntityPlayer player) { + Vector vec = new Vector(); + + HashMap map = getProcessSet(player); + for(int slot : map.keySet()){ + ItemStack item = map.get(slot); + ItemStack quest = items.items.get(slot); + if(item == null) + continue; + String process = item.stackSize + ""; + if(item.stackSize > quest.stackSize) + process = quest.stackSize + ""; + process += "/" + quest.stackSize + ""; + if(item.hasDisplayName()) + vec.add(item.getDisplayName() + ": " + process); + else + vec.add(item.getUnlocalizedName() + ".name" + ": " + process); + } + return vec; + } + + +} diff --git a/src/main/java/noppes/npcs/quests/QuestKill.java b/src/main/java/noppes/npcs/quests/QuestKill.java new file mode 100644 index 000000000..fbe6cd87d --- /dev/null +++ b/src/main/java/noppes/npcs/quests/QuestKill.java @@ -0,0 +1,77 @@ +package noppes.npcs.quests; + +import java.util.HashMap; +import java.util.Vector; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityList; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.NBTTags; +import noppes.npcs.controllers.PlayerDataController; +import noppes.npcs.controllers.PlayerQuestData; +import noppes.npcs.controllers.QuestData; + +public class QuestKill extends QuestInterface{ + public HashMap targets = new HashMap(); + + @Override + public void readEntityFromNBT(NBTTagCompound compound) { + targets = NBTTags.getStringIntegerMap(compound.getTagList("QuestDialogs", 10)); + } + + @Override + public void writeEntityToNBT(NBTTagCompound compound) { + compound.setTag("QuestDialogs", NBTTags.nbtStringIntegerMap(targets)); + } + + @Override + public boolean isCompleted(EntityPlayer player) { + PlayerQuestData playerdata = PlayerDataController.instance.getPlayerData(player).questData; + QuestData data = playerdata.activeQuests.get(questId); + if(data == null) + return false; + HashMap killed = getKilled(data); + if(killed.size() != targets.size()) + return false; + for(String entity : killed.keySet()){ + if(!targets.containsKey(entity) || targets.get(entity) > killed.get(entity)) + return false; + } + + return true; + } + + @Override + public void handleComplete(EntityPlayer player) { + } + + @Override + public Vector getQuestLogStatus(EntityPlayer player) { + Vector vec = new Vector(); + PlayerQuestData playerdata = PlayerDataController.instance.getPlayerData(player).questData; + QuestData data = playerdata.activeQuests.get(questId); + if(data == null) + return vec; + HashMap killed = getKilled(data); + for(String entityName : targets.keySet()){ + //Class cls = (Class) EntityList.stringToClassMapping.get(entityName); + int amount = 0; + if(killed.containsKey(entityName)) + amount = killed.get(entityName); + String state = amount + "/" + targets.get(entityName); + + vec.add(entityName + ": " + state); + } + + return vec; + } + + public HashMap getKilled(QuestData data) { + return NBTTags.getStringIntegerMap(data.extraData.getTagList("Killed", 10)); + } + public void setKilled(QuestData data, HashMap killed) { + data.extraData.setTag("Killed", NBTTags.nbtStringIntegerMap(killed)); + } + +} diff --git a/src/main/java/noppes/npcs/quests/QuestLocation.java b/src/main/java/noppes/npcs/quests/QuestLocation.java new file mode 100644 index 000000000..29348d6b7 --- /dev/null +++ b/src/main/java/noppes/npcs/quests/QuestLocation.java @@ -0,0 +1,98 @@ +package noppes.npcs.quests; + +import java.util.Vector; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.StatCollector; +import noppes.npcs.controllers.PlayerDataController; +import noppes.npcs.controllers.PlayerQuestData; +import noppes.npcs.controllers.QuestData; + +public class QuestLocation extends QuestInterface{ + public String location = ""; + public String location2 = ""; + public String location3 = ""; + + @Override + public void readEntityFromNBT(NBTTagCompound compound) { + location = compound.getString("QuestLocation"); + location2 = compound.getString("QuestLocation2"); + location3 = compound.getString("QuestLocation3"); + + } + + @Override + public void writeEntityToNBT(NBTTagCompound compound) { + compound.setString("QuestLocation", location); + compound.setString("QuestLocation2", location2); + compound.setString("QuestLocation3", location3); + } + + @Override + public boolean isCompleted(EntityPlayer player) { + PlayerQuestData playerdata = PlayerDataController.instance.getPlayerData(player).questData; + QuestData data = playerdata.activeQuests.get(questId); + if(data == null) + return false; + return getFound(data, 0); + } + + @Override + public void handleComplete(EntityPlayer player) { + } + + @Override + public Vector getQuestLogStatus(EntityPlayer player) { + Vector vec = new Vector(); + PlayerQuestData playerdata = PlayerDataController.instance.getPlayerData(player).questData; + QuestData data = playerdata.activeQuests.get(questId); + if(data == null) + return vec; + String found = StatCollector.translateToLocal("quest.found"); + String notfound = StatCollector.translateToLocal("quest.notfound"); + + if(!location.isEmpty()) + vec.add(location + ": " + (getFound(data,1)?found:notfound)); + if(!location2.isEmpty()) + vec.add(location2 + ": " + (getFound(data,2)?found:notfound)); + if(!location3.isEmpty()) + vec.add(location3 + ": " + (getFound(data,3)?found:notfound)); + + return vec; + } + + public boolean getFound(QuestData data, int i) { + if(i == 1) + return data.extraData.getBoolean("LocationFound"); + if(i == 2) + return data.extraData.getBoolean("Location2Found"); + if(i == 3) + return data.extraData.getBoolean("Location3Found"); + + if(!location.isEmpty() && !data.extraData.getBoolean("LocationFound")) + return false; + if(!location2.isEmpty() && !data.extraData.getBoolean("Location2Found")) + return false; + if(!location3.isEmpty() && !data.extraData.getBoolean("Location3Found")) + return false; + return true; + } + public boolean setFound(QuestData data, String location) { + if(location.equalsIgnoreCase(this.location) && !data.extraData.getBoolean("LocationFound")){ + data.extraData.setBoolean("LocationFound", true); + return true; + } + if(location.equalsIgnoreCase(location2) && !data.extraData.getBoolean("LocationFound2")){ + data.extraData.setBoolean("Location2Found", true); + return true; + } + if(location.equalsIgnoreCase(location3) && !data.extraData.getBoolean("LocationFound3")){ + data.extraData.setBoolean("Location3Found", true); + return true; + } + + return false; + } + +} diff --git a/src/main/java/noppes/npcs/roles/JobBard.java b/src/main/java/noppes/npcs/roles/JobBard.java new file mode 100644 index 000000000..5ef96df86 --- /dev/null +++ b/src/main/java/noppes/npcs/roles/JobBard.java @@ -0,0 +1,134 @@ +package noppes.npcs.roles; + +import java.util.List; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.CustomItems; +import noppes.npcs.CustomNpcs; +import noppes.npcs.client.controllers.MusicController; +import noppes.npcs.constants.EnumBardInstrument; +import noppes.npcs.entity.EntityNPCInterface; + +public class JobBard extends JobInterface{ + public int minRange = 2; + public int maxRange = 64; + + public boolean isStreamer = true; + public boolean hasOffRange = true; + + public String song = ""; + + private EnumBardInstrument instrument = EnumBardInstrument.Banjo; + + public JobBard(EntityNPCInterface npc) { + super(npc); + if(CustomItems.banjo != null){ + mainhand = new ItemStack(CustomItems.banjo); + overrideMainHand = overrideOffHand = true; + } + } + + @Override + public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) { + nbttagcompound.setString("BardSong", song); + nbttagcompound.setInteger("BardMinRange", minRange); + nbttagcompound.setInteger("BardMaxRange", maxRange); + nbttagcompound.setInteger("BardInstrument", instrument.ordinal()); + nbttagcompound.setBoolean("BardStreamer", isStreamer); + nbttagcompound.setBoolean("BardHasOff", hasOffRange); + + return nbttagcompound; + } + + @Override + public void readFromNBT(NBTTagCompound nbttagcompound) { + song = nbttagcompound.getString("BardSong"); + minRange = nbttagcompound.getInteger("BardMinRange"); + maxRange = nbttagcompound.getInteger("BardMaxRange"); + setInstrument(nbttagcompound.getInteger("BardInstrument")); + isStreamer = nbttagcompound.getBoolean("BardStreamer"); + hasOffRange = nbttagcompound.getBoolean("BardHasOff"); + } + + public void setInstrument(int i) { + if(CustomItems.banjo == null) + return; + instrument = EnumBardInstrument.values()[i]; + overrideMainHand = overrideOffHand = instrument != EnumBardInstrument.None; + switch(instrument){ + case None: + this.mainhand = null; + this.offhand = null; + break; + case Banjo: + this.mainhand = new ItemStack(CustomItems.banjo); + this.offhand = null; + break; + case Violin: + this.mainhand = new ItemStack(CustomItems.violin); + this.offhand = new ItemStack(CustomItems.violinbow); + break; + case Guitar: + this.mainhand = new ItemStack(CustomItems.guitar); + this.offhand = null; + break; + case Harp: + this.mainhand = new ItemStack(CustomItems.harp); + this.offhand = null; + break; + case FrenchHorn: + this.mainhand = new ItemStack(CustomItems.frenchHorn); + this.offhand = null; + break; + } + } + public EnumBardInstrument getInstrument(){ + return instrument; + } + private long ticks = 0; + public void onLivingUpdate() { + if(!npc.isRemote()) + return; + ticks++; + if(ticks % 10 != 0 ) + return; + if(song.isEmpty()) + return; + if(!MusicController.Instance.isPlaying(song)){ + List list = npc.worldObj.getEntitiesWithinAABB(EntityPlayer.class, npc.boundingBox.expand(minRange, minRange/2, minRange)); + if(!list.contains(CustomNpcs.proxy.getPlayer())) + return; + if(isStreamer) + MusicController.Instance.playStreaming(song, npc); + else + MusicController.Instance.playMusic(song, npc); + }else if(MusicController.Instance.playingEntity != npc){ + EntityPlayer player = CustomNpcs.proxy.getPlayer(); + if(npc.getDistanceSqToEntity(player) < MusicController.Instance.playingEntity.getDistanceSqToEntity(player)){ + MusicController.Instance.playingEntity = npc; + } + + }else if(hasOffRange){ + List list = npc.worldObj.getEntitiesWithinAABB(EntityPlayer.class, npc.boundingBox.expand(maxRange, maxRange/2, maxRange)); + if(!list.contains(CustomNpcs.proxy.getPlayer())) + MusicController.Instance.stopMusic(); + } + + } + + @Override + public void killed() { + delete(); + } + + @Override + public void delete() { + if(npc.worldObj.isRemote && hasOffRange){ + if(MusicController.Instance.isPlaying(song)){ + MusicController.Instance.stopMusic(); + } + } + } +} diff --git a/src/main/java/noppes/npcs/roles/JobChunkLoader.java b/src/main/java/noppes/npcs/roles/JobChunkLoader.java new file mode 100644 index 000000000..27d57b415 --- /dev/null +++ b/src/main/java/noppes/npcs/roles/JobChunkLoader.java @@ -0,0 +1,88 @@ +package noppes.npcs.roles; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.MathHelper; +import net.minecraft.world.ChunkCoordIntPair; +import net.minecraftforge.common.ForgeChunkManager; +import net.minecraftforge.common.ForgeChunkManager.Ticket; +import noppes.npcs.controllers.ChunkController; +import noppes.npcs.entity.EntityNPCInterface; + +public class JobChunkLoader extends JobInterface{ + + private List chunks = new ArrayList(); + private int ticks = 20; + private long playerLastSeen = 0; + + public JobChunkLoader(EntityNPCInterface npc) { + super(npc); + } + + @Override + public NBTTagCompound writeToNBT(NBTTagCompound compound) { + compound.setLong("ChunkPlayerLastSeen", playerLastSeen); + return compound; + } + + @Override + public void readFromNBT(NBTTagCompound compound) { + playerLastSeen = compound.getLong("ChunkPlayerLastSeen"); + } + + @Override + public boolean aiShouldExecute() { + ticks--; + if(ticks > 0) + return false; + ticks = 20; + + List players = npc.worldObj.getEntitiesWithinAABB(EntityPlayer.class, npc.boundingBox.expand(48, 48, 48)); + if(!players.isEmpty()) + playerLastSeen = System.currentTimeMillis(); + + //unload after 10 min + if(System.currentTimeMillis() > playerLastSeen + 600000){ + ChunkController.instance.deleteNPC(npc); + chunks.clear(); + return false; + } + Ticket ticket = ChunkController.instance.getTicket(npc); + if(ticket == null) //Only null when too many active chunkloaders already + return false; + double x = npc.posX / 16; + double z = npc.posZ / 16; + + List list = new ArrayList(); + list.add(new ChunkCoordIntPair(MathHelper.floor_double(x), MathHelper.floor_double(z))); + list.add(new ChunkCoordIntPair(MathHelper.ceiling_double_int(x), MathHelper.ceiling_double_int(z))); + list.add(new ChunkCoordIntPair(MathHelper.floor_double(x), MathHelper.ceiling_double_int(z))); + list.add(new ChunkCoordIntPair(MathHelper.ceiling_double_int(x), MathHelper.floor_double(z))); + + for(ChunkCoordIntPair chunk : list){ + if(!chunks.contains(chunk)){ + ForgeChunkManager.forceChunk(ticket, chunk); + } + else + chunks.remove(chunk); + } + + for(ChunkCoordIntPair chunk : chunks) + ForgeChunkManager.unforceChunk(ticket, chunk); + + this.chunks = list; + return false; + } + + @Override + public void reset() { + ChunkController.instance.deleteNPC(npc); + chunks.clear(); + playerLastSeen = 0; + } + public void delete() { + } +} diff --git a/src/main/java/noppes/npcs/roles/JobConversation.java b/src/main/java/noppes/npcs/roles/JobConversation.java new file mode 100644 index 000000000..6fe448ae2 --- /dev/null +++ b/src/main/java/noppes/npcs/roles/JobConversation.java @@ -0,0 +1,243 @@ +package noppes.npcs.roles; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import noppes.npcs.controllers.Availability; +import noppes.npcs.controllers.Line; +import noppes.npcs.controllers.PlayerQuestController; +import noppes.npcs.controllers.Quest; +import noppes.npcs.controllers.QuestController; +import noppes.npcs.entity.EntityNPCInterface; + +public class JobConversation extends JobInterface{ + public Availability availability = new Availability(); + + private ArrayList names = new ArrayList(); + private HashMap npcs = new HashMap(); + + public HashMap lines = new HashMap(); + + public int quest = -1; + public String questTitle = ""; + public int generalDelay = 400; + public int ticks = 100; + public int range = 20; + + private ConversationLine nextLine; + + private boolean hasStarted = false; + private int startedTicks = 20; + public int mode = 0; //0:Always, 1:Player near + + public JobConversation(EntityNPCInterface npc) { + super(npc); + } + + @Override + public NBTTagCompound writeToNBT(NBTTagCompound compound) { + compound.setTag("ConversationAvailability", availability.writeToNBT(new NBTTagCompound())); + compound.setInteger("ConversationQuest", quest); + compound.setInteger("ConversationDelay", generalDelay); + compound.setInteger("ConversationRange", range); + compound.setInteger("ConversationMode", mode); + + NBTTagList nbttaglist = new NBTTagList(); + for(int slot : lines.keySet()){ + ConversationLine line = lines.get(slot); + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setInteger("Slot", slot); + line.writeEntityToNBT(nbttagcompound); + + nbttaglist.appendTag(nbttagcompound); + } + + compound.setTag("ConversationLines", nbttaglist); + if(hasQuest()) + compound.setString("ConversationQuestTitle", getQuest().title); + + return compound; + } + + @Override + public void readFromNBT(NBTTagCompound compound) { + names.clear(); + availability.readFromNBT(compound.getCompoundTag("ConversationAvailability")); + quest = compound.getInteger("ConversationQuest"); + generalDelay = compound.getInteger("ConversationDelay"); + questTitle = compound.getString("ConversationQuestTitle"); + range = compound.getInteger("ConversationRange"); + mode = compound.getInteger("ConversationMode"); + + NBTTagList nbttaglist = compound.getTagList("ConversationLines", 10); + HashMap map = new HashMap(); + for(int i = 0; i < nbttaglist.tagCount(); i++){ + NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i); + ConversationLine line = new ConversationLine(); + line.readEntityFromNBT(nbttagcompound); + if(!line.npc.isEmpty() && !names.contains(line.npc.toLowerCase())) + names.add(line.npc.toLowerCase()); + + map.put(nbttagcompound.getInteger("Slot"), line); + } + lines = map; + ticks = generalDelay; + } + + public boolean hasQuest() { + return getQuest() != null; + } + public Quest getQuest() { + if(npc.isRemote()) + return null; + return QuestController.instance.quests.get(quest); + } + @Override + public void aiUpdateTask() { + ticks--; + if(ticks > 0 || nextLine == null) + return; + say(nextLine); + boolean seenNext = false; + ConversationLine compare = nextLine; + nextLine = null; + for(ConversationLine line : lines.values()){ + if(line.isEmpty()) + continue; + if(seenNext){ + nextLine = line; + break; + } + if(line == compare){ + seenNext = true; + } + } + if(nextLine != null) + ticks = nextLine.delay; + else if(hasQuest()){ + List inRange = npc.worldObj.getEntitiesWithinAABB(EntityPlayer.class, npc.boundingBox.expand(range, range, range)); + + for (EntityPlayer player : inRange){ + if(availability.isAvailable(player)) + PlayerQuestController.addActiveQuest(getQuest(), player); + } + } + } + + + @Override + public boolean aiShouldExecute() { + if(lines.isEmpty() || npc.isKilled() || npc.isAttacking() || !shouldRun()) + return false; + if(!hasStarted && mode == 1){ + if(startedTicks-- > 0) + return false; + startedTicks = 10; + if(npc.worldObj.getEntitiesWithinAABB(EntityPlayer.class, npc.boundingBox.expand(range, range, range)).isEmpty()){ + return false; + } + } + + for(ConversationLine line : lines.values()){ + if(line == null || line.isEmpty()) + continue; + nextLine = line; + break; + } + return nextLine != null; + } + + private boolean shouldRun() { + ticks--; + if(ticks > 0) + return false; + npcs.clear(); + List list = npc.worldObj.getEntitiesWithinAABB(EntityNPCInterface.class, npc.boundingBox.expand(10, 10, 10)); + for(EntityNPCInterface npc : list){ + if(!npc.isKilled() && !npc.isAttacking() && names.contains(npc.getCommandSenderName().toLowerCase())) + npcs.put(npc.getCommandSenderName().toLowerCase(), npc); + } + boolean bo = names.size() == npcs.size(); + if(!bo) + ticks = 20; + return bo; + } + + @Override + public boolean aiContinueExecute() { + for(EntityNPCInterface npc : npcs.values()){ + if(npc.isKilled() || npc.isAttacking()) + return false; + } + return nextLine != null; + } + + @Override + public void resetTask() { + nextLine = null; + ticks = generalDelay; + hasStarted = false; + } + + @Override + public void aiStartExecuting() { + startedTicks = 20; + hasStarted = true; + } + + private void say(ConversationLine line) { + List inRange = npc.worldObj.getEntitiesWithinAABB(EntityPlayer.class, npc.boundingBox.expand(range, range, range)); + + EntityNPCInterface npc = npcs.get(line.npc.toLowerCase()); + if(npc == null) + return; + for (EntityPlayer player : inRange){ + if(availability.isAvailable(player)) + npc.say(player, line); + } + } + + @Override + public void reset() { + hasStarted = false; + resetTask(); + ticks = 60; + } + @Override + public void killed() { + reset(); + } + public class ConversationLine extends Line{ + public String npc = ""; + public int delay = 40; + + public void writeEntityToNBT(NBTTagCompound compound) { + compound.setString("Line", text); + compound.setString("Npc", npc); + compound.setString("Sound", sound); + compound.setInteger("Delay", delay); + } + + public void readEntityFromNBT(NBTTagCompound compound) { + text = compound.getString("Line"); + npc = compound.getString("Npc"); + sound = compound.getString("Sound"); + delay = compound.getInteger("Delay"); + } + + public boolean isEmpty(){ + return npc.isEmpty() || text.isEmpty(); + } + } + public ConversationLine getLine(int slot) { + if(lines.containsKey(slot)) + return lines.get(slot); + ConversationLine line = new ConversationLine(); + lines.put(slot, line); + return line; + } +} diff --git a/src/main/java/noppes/npcs/roles/JobFollower.java b/src/main/java/noppes/npcs/roles/JobFollower.java new file mode 100644 index 000000000..69e44850a --- /dev/null +++ b/src/main/java/noppes/npcs/roles/JobFollower.java @@ -0,0 +1,74 @@ +package noppes.npcs.roles; + +import java.util.List; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.CustomNpcs; +import noppes.npcs.entity.EntityNPCInterface; + +public class JobFollower extends JobInterface{ + public EntityNPCInterface following = null; + private int ticks = 40; + private int range = 20; + public String name = ""; + + public JobFollower(EntityNPCInterface npc) { + super(npc); + } + + @Override + public NBTTagCompound writeToNBT(NBTTagCompound compound) { + compound.setString("FollowingEntityName", name); + return compound; + } + + @Override + public void readFromNBT(NBTTagCompound compound) { + name = compound.getString("FollowingEntityName"); + + } + @Override + public boolean aiShouldExecute() { + if(npc.isAttacking()) + return false; + + ticks--; + if(ticks > 0) + return false; + + ticks = 10; + following = null; + List list = npc.worldObj.getEntitiesWithinAABB(EntityNPCInterface.class, npc.boundingBox.expand(getRange(), getRange(), getRange())); + for(EntityNPCInterface entity : list){ + if(entity == npc || entity.isKilled()) + continue; + if(entity.display.name.equalsIgnoreCase(name)){ + following = entity; + break; + } + } + + return false; + } + + private int getRange(){ + if(range > CustomNpcs.NpcNavRange) + return CustomNpcs.NpcNavRange; + return range; + } + + public boolean isFollowing(){ + return following != null; + } + + public void reset() { + } + public void resetTask() { + following = null; + } + + public boolean hasOwner() { + return !name.isEmpty(); + } +} diff --git a/src/main/java/noppes/npcs/roles/JobGuard.java b/src/main/java/noppes/npcs/roles/JobGuard.java new file mode 100644 index 000000000..b53a42acf --- /dev/null +++ b/src/main/java/noppes/npcs/roles/JobGuard.java @@ -0,0 +1,72 @@ +package noppes.npcs.roles; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityList; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.boss.EntityDragon; +import net.minecraft.entity.monster.EntityCreeper; +import net.minecraft.entity.monster.IMob; +import net.minecraft.entity.passive.EntityAnimal; +import net.minecraft.entity.passive.EntityTameable; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.NBTTags; +import noppes.npcs.entity.EntityNPCInterface; + +public class JobGuard extends JobInterface{ + + public boolean attacksAnimals = false; + public boolean attackHostileMobs = true; + public boolean attackCreepers = false; + + public List targets = new ArrayList(); + public boolean specific = false; + + public JobGuard(EntityNPCInterface npc) { + super(npc); + } + + @Override + public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) { + nbttagcompound.setBoolean("GuardAttackAnimals", attacksAnimals); + nbttagcompound.setBoolean("GuardAttackMobs", attackHostileMobs); + nbttagcompound.setBoolean("GuardAttackCreepers", attackCreepers); + nbttagcompound.setBoolean("GuardSpecific", specific); + + nbttagcompound.setTag("GuardTargets", NBTTags.nbtStringList(targets)); + return nbttagcompound; + } + + @Override + public void readFromNBT(NBTTagCompound nbttagcompound) { + attacksAnimals = nbttagcompound.getBoolean("GuardAttackAnimals"); + attackHostileMobs = nbttagcompound.getBoolean("GuardAttackMobs"); + attackCreepers = nbttagcompound.getBoolean("GuardAttackCreepers"); + specific = nbttagcompound.getBoolean("GuardSpecific"); + + targets = NBTTags.getStringList(nbttagcompound.getTagList("GuardTargets", 10)); + } + + public boolean isEntityApplicable(Entity entity) { + if(entity instanceof EntityPlayer || entity instanceof EntityNPCInterface) + return false; + if(specific && targets.contains("entity." + EntityList.getEntityString(entity) + ".name")) + return true; + + if(entity instanceof EntityAnimal){ + if(!attacksAnimals || entity instanceof EntityTameable && ((EntityTameable)entity).getOwner() != null) + return false; + return true; + } + else if (entity instanceof EntityCreeper) { + return attackCreepers; + } + else if(entity instanceof IMob || entity instanceof EntityDragon){ + return attackHostileMobs; + } + return false; + } +} diff --git a/src/main/java/noppes/npcs/roles/JobHealer.java b/src/main/java/noppes/npcs/roles/JobHealer.java new file mode 100644 index 000000000..b4d1995d6 --- /dev/null +++ b/src/main/java/noppes/npcs/roles/JobHealer.java @@ -0,0 +1,74 @@ +package noppes.npcs.roles; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.NoppesUtilServer; +import noppes.npcs.entity.EntityNPCInterface; + +public class JobHealer extends JobInterface{ + private long healTicks = 0; + public int range = 5; + public int speed = 5; + + public JobHealer(EntityNPCInterface npc) { + super(npc); + } + + @Override + public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) { + nbttagcompound.setInteger("HealerRange", range); + nbttagcompound.setInteger("HealerSpeed", speed); + return nbttagcompound; + } + + @Override + public void readFromNBT(NBTTagCompound nbttagcompound) { + range = nbttagcompound.getInteger("HealerRange"); + speed = nbttagcompound.getInteger("HealerSpeed"); + } + private List toHeal = new ArrayList(); + + //TODO heal food, heal potion effects, heal more types of entities besides just the player and npcs + public boolean aiShouldExecute() { + healTicks++; + if (healTicks < speed * 10) + return false; + + for(Object plObj: npc.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, npc.boundingBox.expand(range, range/2, range))){ + EntityLivingBase entity = (EntityLivingBase) plObj; + + if(entity instanceof EntityPlayer){ + EntityPlayer player = (EntityPlayer) entity; + if(player.getHealth() < player.getMaxHealth() && !npc.faction.isAggressiveToPlayer(player)) + toHeal.add(player); + } + if(entity instanceof EntityNPCInterface){ + EntityNPCInterface npc = (EntityNPCInterface) entity; + if(npc.getHealth() < npc.getMaxHealth() && !this.npc.faction.isAggressiveToNpc(npc)) + toHeal.add(npc); + } + + } + + healTicks = 0; + return !toHeal.isEmpty(); + } + + public void aiStartExecuting() { + for(EntityLivingBase entity : toHeal){ + float heal = entity.getMaxHealth() / 20; //heal 5% of max health + heal(entity, heal > 0?heal:1); + } + toHeal.clear(); + } + + public void heal(EntityLivingBase entity, float amount){ + entity.heal(amount); + NoppesUtilServer.spawnParticle(entity, "heal",entity.dimension); + } +} diff --git a/src/main/java/noppes/npcs/roles/JobInterface.java b/src/main/java/noppes/npcs/roles/JobInterface.java new file mode 100644 index 000000000..72949fa90 --- /dev/null +++ b/src/main/java/noppes/npcs/roles/JobInterface.java @@ -0,0 +1,37 @@ +package noppes.npcs.roles; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.entity.EntityNPCInterface; + +public abstract class JobInterface { + public EntityNPCInterface npc; + + public boolean overrideMainHand = false; + public boolean overrideOffHand = false; + + public ItemStack mainhand = null; + public ItemStack offhand = null; + + public JobInterface(EntityNPCInterface npc){ + this.npc = npc; + } + public abstract NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound); + public abstract void readFromNBT(NBTTagCompound nbttagcompound); + public void killed(){}; + public void delete(){}; + + public boolean aiShouldExecute() { + return false; + } + + public boolean aiContinueExecute() { + return aiShouldExecute(); + } + public void aiStartExecuting() {} + public void aiUpdateTask() {} + public void reset() {} + public void resetTask() {} + + +} diff --git a/src/main/java/noppes/npcs/roles/JobItemGiver.java b/src/main/java/noppes/npcs/roles/JobItemGiver.java new file mode 100644 index 000000000..7d26f30aa --- /dev/null +++ b/src/main/java/noppes/npcs/roles/JobItemGiver.java @@ -0,0 +1,281 @@ +package noppes.npcs.roles; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Vector; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import noppes.npcs.NBTTags; +import noppes.npcs.NpcMiscInventory; +import noppes.npcs.controllers.Availability; +import noppes.npcs.controllers.GlobalDataController; +import noppes.npcs.controllers.Line; +import noppes.npcs.controllers.PlayerDataController; +import noppes.npcs.controllers.PlayerItemGiverData; +import noppes.npcs.entity.EntityNPCInterface; + +public class JobItemGiver extends JobInterface{ + + public int cooldownType = 0; + public int givingMethod = 0; + public int cooldown = 10; + public NpcMiscInventory inventory; + public int itemGiverId = 0; + + public List lines = new ArrayList(); + + private int ticks = 10; + + private List recentlyChecked = new ArrayList(); + private List toCheck; + public Availability availability = new Availability(); + + public JobItemGiver(EntityNPCInterface npc) { + super(npc); + inventory = new NpcMiscInventory(9); + lines.add("Have these items {player}"); + } + + @Override + public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) { + nbttagcompound.setInteger("igCooldownType", cooldownType); + nbttagcompound.setInteger("igGivingMethod", givingMethod); + nbttagcompound.setInteger("igCooldown", cooldown); + nbttagcompound.setInteger("ItemGiverId", itemGiverId); + nbttagcompound.setTag("igLines", NBTTags.nbtStringList(lines)); + nbttagcompound.setTag("igJobInventory", inventory.getToNBT()); + nbttagcompound.setTag("igAvailability", availability.writeToNBT(new NBTTagCompound())); + return nbttagcompound; + } + + @Override + public void readFromNBT(NBTTagCompound nbttagcompound) { + itemGiverId = nbttagcompound.getInteger("ItemGiverId"); + cooldownType = nbttagcompound.getInteger("igCooldownType"); + givingMethod = nbttagcompound.getInteger("igGivingMethod"); + cooldown = nbttagcompound.getInteger("igCooldown"); + lines = NBTTags.getStringList(nbttagcompound.getTagList("igLines", 10)); + inventory.setFromNBT(nbttagcompound.getCompoundTag("igJobInventory")); + + if(itemGiverId == 0 && GlobalDataController.instance != null) + itemGiverId = GlobalDataController.instance.incrementItemGiverId(); + + availability.readFromNBT(nbttagcompound.getCompoundTag("igAvailability")); + } + + public NBTTagList newHashMapNBTList(HashMap lines) { + NBTTagList nbttaglist = new NBTTagList(); + HashMap lines2 = lines; + for (String s : lines2.keySet()) { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setString("Line", s); + nbttagcompound.setLong("Time", lines.get(s)); + nbttaglist.appendTag(nbttagcompound); + } + return nbttaglist; + } + + public HashMap getNBTLines(NBTTagList tagList) { + HashMap map = new HashMap(); + for (int i = 0; i < tagList.tagCount(); i++) { + NBTTagCompound nbttagcompound = tagList.getCompoundTagAt(i); + String line = nbttagcompound.getString("Line"); + long time = nbttagcompound.getLong("Time"); + map.put(line, time); + + } + return map; + } + + private boolean giveItems(EntityPlayer player){ + PlayerItemGiverData data = PlayerDataController.instance.getPlayerData(player).itemgiverData; + if(!canPlayerInteract(data)){ + return false; + } + + Vector items = new Vector(); + Vector toGive = new Vector(); + + for(ItemStack is : inventory.items.values()) + if(is != null) + items.add(is.copy()); + if(items.isEmpty()) + return false; + if(isAllGiver()){ + toGive = items; + } + else if(isRemainingGiver()){ + for(ItemStack is : items){ + if(!playerHasItem(player,is.getItem())) + toGive.add(is); + } + } + else if(isRandomGiver()){ + toGive.add(items.get(npc.worldObj.rand.nextInt(items.size())).copy()); + } + else if(isGiverWhenNotOwnedAny()){ + boolean ownsItems = false; + for(ItemStack is : items){ + if(playerHasItem(player,is.getItem())){ + ownsItems = true; + break; + } + } + if(!ownsItems){ + toGive = items; + } + else + return false; + } + else if(isChainedGiver()){ + int itemIndex = data.getItemIndex(this); + int i = 0; + for(ItemStack item : inventory.items.values()){ + if(i == itemIndex){ + toGive.add(item); + break; + } + i++; + } + } + if(toGive.isEmpty()) + return false; + if(givePlayerItems(player,toGive)){ + if(!lines.isEmpty()){ + npc.say(player, new Line(lines.get(npc.getRNG().nextInt(lines.size())))); + } + if(isDaily()) + data.setTime(this,getDay()); + else + data.setTime(this,System.currentTimeMillis()); + if(isChainedGiver()) + data.setItemIndex(this, (data.getItemIndex(this) + 1) % inventory.items.size()); + return true; + } + return false; + } + private int getDay(){ + return (int) (npc.worldObj.getTotalWorldTime() / 24000L); + } + private boolean canPlayerInteract(PlayerItemGiverData data) { + if(inventory.items.isEmpty()) + return false; + if(isOnTimer()){ + if(!data.hasInteractedBefore(this)) + return true; + return data.getTime(this) + (cooldown*1000) < System.currentTimeMillis(); + } + else if(isGiveOnce()){ + return !data.hasInteractedBefore(this); + } + else if(isDaily()){ + if(!data.hasInteractedBefore(this)) + return true; + return getDay() > data.getTime(this); + } + return false; + } + + private boolean givePlayerItems(EntityPlayer player, + Vector toGive) { + if(toGive.isEmpty()) + return false; + if(freeInventorySlots(player) < toGive.size()) + return false; + for(ItemStack is : toGive){ + npc.givePlayerItem(player, is); + } + return true; + } + private boolean playerHasItem(EntityPlayer player, Item item){ + for(ItemStack is : player.inventory.mainInventory){ + if(is != null && is.getItem() == item) + return true; + } + for(ItemStack is : player.inventory.armorInventory){ + if(is != null && is.getItem() == item) + return true; + } + return false; + } + private int freeInventorySlots(EntityPlayer player){ + int i = 0; + for(ItemStack is : player.inventory.mainInventory) + if(is == null) + i++; + return i; + } + private boolean isRandomGiver(){ + return givingMethod == 0; + } + private boolean isAllGiver(){ + return givingMethod == 1; + } + private boolean isRemainingGiver(){ + return givingMethod == 2; + } + private boolean isGiverWhenNotOwnedAny(){ + return givingMethod == 3; + } + private boolean isChainedGiver(){ + return givingMethod == 4; + } + public boolean isOnTimer(){ + return cooldownType == 0; + } + private boolean isGiveOnce(){ + return cooldownType == 1; + } + private boolean isDaily(){ + return cooldownType == 2; + } + + public boolean aiShouldExecute() { + if(npc.isAttacking()) + return false; + ticks--; + if(ticks > 0) + return false; + ticks = 10; + + toCheck = npc.worldObj.getEntitiesWithinAABB(EntityPlayer.class, npc.boundingBox.expand(3, 3, 3)); + toCheck.removeAll(recentlyChecked); + + List listMax = npc.worldObj.getEntitiesWithinAABB(EntityPlayer.class, npc.boundingBox.expand(10, 10, 10)); + recentlyChecked.retainAll(listMax); + recentlyChecked.addAll(toCheck); + return toCheck.size() > 0; + } + + public void aiStartExecuting() { + for(EntityPlayer player : toCheck){ + if(npc.canSee(player) && availability.isAvailable(player)){ + recentlyChecked.add(player); + interact(player); + } + } + } + + @Override + public void killed() { + // TODO Auto-generated method stub + + } + + private boolean interact(EntityPlayer player) { + if(!giveItems(player)) + npc.say(player, npc.advanced.getInteractLine()); + return true; + } + + @Override + public void delete() { + // TODO Auto-generated method stub + + } +} diff --git a/src/main/java/noppes/npcs/roles/JobPuppet.java b/src/main/java/noppes/npcs/roles/JobPuppet.java new file mode 100644 index 000000000..9b0b111c3 --- /dev/null +++ b/src/main/java/noppes/npcs/roles/JobPuppet.java @@ -0,0 +1,106 @@ +package noppes.npcs.roles; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.MathHelper; +import net.minecraft.world.ChunkCoordIntPair; +import net.minecraftforge.common.ForgeChunkManager; +import net.minecraftforge.common.ForgeChunkManager.Ticket; +import noppes.npcs.controllers.ChunkController; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.util.ValueUtil; + +public class JobPuppet extends JobInterface{ + public PartConfig head = new PartConfig(); + public PartConfig larm = new PartConfig(); + public PartConfig rarm = new PartConfig(); + public PartConfig body = new PartConfig(); + public PartConfig lleg = new PartConfig(); + public PartConfig rleg = new PartConfig(); + + public boolean whileStanding = true; + public boolean whileAttacking = false; + public boolean whileMoving = false; + + public JobPuppet(EntityNPCInterface npc) { + super(npc); + } + + @Override + public NBTTagCompound writeToNBT(NBTTagCompound compound) { + compound.setTag("PuppetHead", head.writeNBT()); + compound.setTag("PuppetLArm", larm.writeNBT()); + compound.setTag("PuppetRArm", rarm.writeNBT()); + compound.setTag("PuppetBody", body.writeNBT()); + compound.setTag("PuppetLLeg", lleg.writeNBT()); + compound.setTag("PuppetRLeg", rleg.writeNBT()); + + compound.setBoolean("PuppetStanding", whileStanding); + compound.setBoolean("PuppetAttacking", whileAttacking); + compound.setBoolean("PuppetMoving", whileMoving); + return compound; + } + + @Override + public void readFromNBT(NBTTagCompound compound) { + head.readNBT(compound.getCompoundTag("PuppetHead")); + larm.readNBT(compound.getCompoundTag("PuppetLArm")); + rarm.readNBT(compound.getCompoundTag("PuppetRArm")); + body.readNBT(compound.getCompoundTag("PuppetBody")); + lleg.readNBT(compound.getCompoundTag("PuppetLLeg")); + rleg.readNBT(compound.getCompoundTag("PuppetRLeg")); + + whileStanding = compound.getBoolean("PuppetStanding"); + whileAttacking = compound.getBoolean("PuppetAttacking"); + whileMoving = compound.getBoolean("PuppetMoving"); + } + + @Override + public boolean aiShouldExecute() { + return false; + } + + @Override + public void reset() { + } + public void delete() { + } + + public boolean isActive() { + if(!npc.isEntityAlive()) + return false; + + if(whileAttacking && npc.isAttacking() || whileMoving && npc.isWalking() || whileStanding && !npc.isWalking()) + return true; + return false; + } + + public static class PartConfig{ + public float rotationX = 0f; + public float rotationY = 0f; + public float rotationZ = 0f; + + public boolean disabled = false; + + public NBTTagCompound writeNBT(){ + NBTTagCompound compound = new NBTTagCompound(); + compound.setFloat("RotationX", rotationX); + compound.setFloat("RotationY", rotationY); + compound.setFloat("RotationZ", rotationZ); + + compound.setBoolean("Disabled", disabled); + return compound; + } + + public void readNBT(NBTTagCompound compound){ + rotationX = ValueUtil.correctFloat(compound.getFloat("RotationX"), -0.5f, 0.5f); + rotationY = ValueUtil.correctFloat(compound.getFloat("RotationY"), -0.5f, 0.5f); + rotationZ = ValueUtil.correctFloat(compound.getFloat("RotationZ"), -0.5f, 0.5f); + + disabled = compound.getBoolean("Disabled"); + } + } +} diff --git a/src/main/java/noppes/npcs/roles/JobSpawner.java b/src/main/java/noppes/npcs/roles/JobSpawner.java new file mode 100644 index 000000000..4e456a4f3 --- /dev/null +++ b/src/main/java/noppes/npcs/roles/JobSpawner.java @@ -0,0 +1,419 @@ +package noppes.npcs.roles; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.MathHelper; +import noppes.npcs.CustomNpcs; +import noppes.npcs.NoppesUtilServer; +import noppes.npcs.controllers.PixelmonHelper; +import noppes.npcs.entity.EntityNPCInterface; + +import org.apache.commons.lang3.RandomStringUtils; + +public class JobSpawner extends JobInterface{ + public NBTTagCompound compound6; + public NBTTagCompound compound5; + public NBTTagCompound compound4; + public NBTTagCompound compound3; + public NBTTagCompound compound2; + public NBTTagCompound compound1; + + public String title1; + public String title2; + public String title3; + public String title4; + public String title5; + public String title6; + + private int number = 0; + + public List spawned = new ArrayList(); + + private Map cooldown = new HashMap(); + + private String id = RandomStringUtils.random(8, true, true); + public boolean doesntDie = false; + + public int spawnType = 0; + + public int xOffset = 0; + public int yOffset = 0; + public int zOffset = 0; + + private EntityLivingBase target; + + public boolean despawnOnTargetLost = true; + + public JobSpawner(EntityNPCInterface npc) { + super(npc); + } + + @Override + public NBTTagCompound writeToNBT(NBTTagCompound compound) { + saveCompound(compound1, "SpawnerNBT1", compound); + saveCompound(compound2, "SpawnerNBT2", compound); + saveCompound(compound3, "SpawnerNBT3", compound); + saveCompound(compound4, "SpawnerNBT4", compound); + saveCompound(compound5, "SpawnerNBT5", compound); + saveCompound(compound6, "SpawnerNBT6", compound); + + compound.setString("SpawnerId", id); + compound.setBoolean("SpawnerDoesntDie", doesntDie); + compound.setInteger("SpawnerType", spawnType); + compound.setInteger("SpawnerXOffset", xOffset); + compound.setInteger("SpawnerYOffset", yOffset); + compound.setInteger("SpawnerZOffset", zOffset); + + compound.setBoolean("DespawnOnTargetLost", despawnOnTargetLost); + return compound; + } + + public NBTTagCompound getTitles() { + NBTTagCompound compound = new NBTTagCompound(); + compound.setString("Title1", getTitle(compound1)); + compound.setString("Title2", getTitle(compound2)); + compound.setString("Title3", getTitle(compound3)); + compound.setString("Title4", getTitle(compound4)); + compound.setString("Title5", getTitle(compound5)); + compound.setString("Title6", getTitle(compound6)); + return compound; + } + + private String getTitle(NBTTagCompound compound) { + if(compound != null && compound.hasKey("ClonedName")) + return compound.getString("ClonedName"); + + return "gui.selectnpc"; + } + + private void saveCompound(NBTTagCompound save, String name, NBTTagCompound compound) { + if(save != null) + compound.setTag(name, save); + } + + + @Override + public void readFromNBT(NBTTagCompound compound) { + compound1 = compound.getCompoundTag("SpawnerNBT1"); + compound2 = compound.getCompoundTag("SpawnerNBT2"); + compound3 = compound.getCompoundTag("SpawnerNBT3"); + compound4 = compound.getCompoundTag("SpawnerNBT4"); + compound5 = compound.getCompoundTag("SpawnerNBT5"); + compound6 = compound.getCompoundTag("SpawnerNBT6"); + + id = compound.getString("SpawnerId"); + doesntDie = compound.getBoolean("SpawnerDoesntDie"); + spawnType = compound.getInteger("SpawnerType"); + xOffset = compound.getInteger("SpawnerXOffset"); + yOffset = compound.getInteger("SpawnerYOffset"); + zOffset = compound.getInteger("SpawnerZOffset"); + + despawnOnTargetLost = compound.getBoolean("DespawnOnTargetLost"); + } + + + public void cleanCompound(NBTTagCompound compound) { + compound.removeTag("SpawnerNBT1"); + compound.removeTag("SpawnerNBT2"); + compound.removeTag("SpawnerNBT3"); + compound.removeTag("SpawnerNBT4"); + compound.removeTag("SpawnerNBT5"); + compound.removeTag("SpawnerNBT6"); + } + + public void setJobCompound(int i, NBTTagCompound compound){ + if(i == 1) + compound1 = compound; + if(i == 2) + compound2 = compound; + if(i == 3) + compound3 = compound; + if(i == 4) + compound4 = compound; + if(i == 5) + compound5 = compound; + if(i == 6) + compound6 = compound; + } + + @Override + public void aiUpdateTask() { + if(spawned.isEmpty()){ + if(spawnType == 0){ + if(spawnEntity(number + 1) == null && !doesntDie) + npc.setDead(); + } + if(spawnType == 1){ + if(number >= 6 && !doesntDie) + npc.setDead(); + else{ + spawnEntity(compound1); + spawnEntity(compound2); + spawnEntity(compound3); + spawnEntity(compound4); + spawnEntity(compound5); + spawnEntity(compound6); + number = 6; + } + } + if(spawnType == 2){ + ArrayList list = new ArrayList(); + if(compound1 != null && compound1.hasKey("id")) + list.add(compound1); + if(compound2 != null && compound2.hasKey("id")) + list.add(compound2); + if(compound3 != null && compound3.hasKey("id")) + list.add(compound3); + if(compound4 != null && compound4.hasKey("id")) + list.add(compound4); + if(compound5 != null && compound5.hasKey("id")) + list.add(compound5); + if(compound6 != null && compound6.hasKey("id")) + list.add(compound6); + + if(!list.isEmpty()){ + NBTTagCompound compound = list.get(npc.getRNG().nextInt(list.size())); + spawnEntity(compound); + } + else if(!doesntDie) + npc.setDead(); + } + } + else{ + checkSpawns(); + } + + } + + public void checkSpawns(){ + Iterator iterator = spawned.iterator(); + while(iterator.hasNext()){ + EntityLivingBase spawn = iterator.next(); + if(shouldDelete(spawn)){ + spawn.isDead = true; + iterator.remove(); + } + else{ + checkTarget(spawn); + } + } + } + + public void checkTarget(EntityLivingBase entity){ + if(entity instanceof EntityLiving){ + EntityLiving liv = (EntityLiving) entity; + if(liv.getAttackTarget() == null || npc.getRNG().nextInt(100) == 1) + liv.setAttackTarget(target); + } + else if(entity.getAITarget() == null || npc.getRNG().nextInt(100) == 1){ + entity.setRevengeTarget(target); + } + } + + public boolean shouldDelete(EntityLivingBase entity){ + return npc.getDistanceToEntity(entity) > 60 || entity.isDead || entity.getHealth() <= 0 || + PixelmonHelper.Enabled && hasPixelmon() && !PixelmonHelper.isBattling(entity) || despawnOnTargetLost && target == null; + } + + private EntityLivingBase getTarget() { + EntityLivingBase target = getTarget(npc); + if(target != null) + return target; + + for(EntityLivingBase entity : spawned){ + target = getTarget(entity); + if(target != null) + return target; + } + return null; + } + + private EntityLivingBase getTarget(EntityLivingBase entity){ + if(entity instanceof EntityLiving){ + target = ((EntityLiving)entity).getAttackTarget(); + if(target != null && !target.isDead && target.getHealth() > 0) + return target; + } + target = entity.getAITarget(); + if(target != null && !target.isDead && target.getHealth() > 0) + return target; + return null; + } + + private boolean isEmpty(){ + if(compound1 != null && compound1.hasKey("id")) + return false; + if(compound2 != null && compound2.hasKey("id")) + return false; + if(compound3 != null && compound3.hasKey("id")) + return false; + if(compound4 != null && compound4.hasKey("id")) + return false; + if(compound5 != null && compound5.hasKey("id")) + return false; + if(compound6 != null && compound6.hasKey("id")) + return false; + + return true; + } + + private void setTarget(EntityLivingBase base, EntityLivingBase target) { + if (PixelmonHelper.isTrainer(base) && target instanceof EntityPlayerMP) { + EntityPlayerMP player = (EntityPlayerMP) target; + if(!PixelmonHelper.canBattle(player, npc)) + return; + cooldown.put(player.getCommandSenderName(), System.currentTimeMillis()); + + Iterator> ita = cooldown.entrySet().iterator(); + + while(ita.hasNext()){ + Entry entry = ita.next(); + if(!isOnCooldown(entry.getKey())) + ita.remove(); + } + } + else if (base instanceof EntityLiving) + ((EntityLiving) base).setAttackTarget(target); + else + base.setRevengeTarget(target); + } + + @Override + public boolean aiShouldExecute() { + if(isEmpty() || npc.isKilled()) + return false; + + target = getTarget(); + if(npc.getRNG().nextInt(30) == 1){ + if(spawned.isEmpty()) + spawned = getNearbySpawned(); + } + if(!spawned.isEmpty()) + checkSpawns(); + return target != null; + } + + public boolean aiContinueExecute() { + return aiShouldExecute(); + } + public void resetTask() { + reset(); + } + + public void aiStartExecuting() { + number = 0; + for(EntityLivingBase entity : spawned){ + int i = entity.getEntityData().getInteger("NpcSpawnerNr"); + if(i > number) + number = i; + setTarget(entity, npc.getAttackTarget()); + } + } + + @Override + public void reset() { + number = 0; + if(spawned.isEmpty()) + spawned = getNearbySpawned(); + + target = null; + checkSpawns(); + } + @Override + public void killed() { + reset(); + } + + public EntityLivingBase spawnEntity(int i){ + NBTTagCompound compound = getCompound(i); + if(compound == null){ + return null; + } + return spawnEntity(compound); + } + + private EntityLivingBase spawnEntity(NBTTagCompound compound){ + if(compound == null || !compound.hasKey("id")) + return null; + double x = npc.posX + xOffset - 0.5 + npc.getRNG().nextFloat(); + double y = npc.posY + yOffset; + double z = npc.posZ + zOffset - 0.5 + npc.getRNG().nextFloat(); + Entity entity = NoppesUtilServer.spawnClone(compound, MathHelper.floor_double(x), MathHelper.floor_double(y), MathHelper.floor_double(z), npc.worldObj); + if(entity == null || !(entity instanceof EntityLivingBase)) + return null; + EntityLivingBase living = (EntityLivingBase) entity; + living.getEntityData().setString("NpcSpawnerId", id); + living.getEntityData().setInteger("NpcSpawnerNr", number); + setTarget(living, npc.getAttackTarget()); + living.setPosition(x, y, z); + if(living instanceof EntityNPCInterface){ + EntityNPCInterface snpc = (EntityNPCInterface) living; + snpc.stats.spawnCycle = 3; + snpc.ai.returnToStart = false; + } + spawned.add(living); + return living; + } + + private NBTTagCompound getCompound(int i) { + if(i <= 1 && compound1 != null && compound1.hasKey("id")){ + number = 1; + return compound1; + } + if(i <= 2 && compound2 != null && compound2.hasKey("id")){ + number = 2; + return compound2; + } + if(i <= 3 && compound3 != null && compound3.hasKey("id")){ + number = 3; + return compound3; + } + if(i <= 4 && compound4 != null && compound4.hasKey("id")){ + number = 4; + return compound4; + } + if(i <= 5 && compound5 != null && compound5.hasKey("id")){ + number = 5; + return compound5; + } + if(i <= 6 && compound6 != null && compound6.hasKey("id")){ + number = 6; + return compound6; + } + return null; + } + + + private List getNearbySpawned(){ + List spawnList = new ArrayList(); + List list = npc.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, npc.boundingBox.expand(40, 40, 40)); + for(EntityLivingBase entity : list){ + if(entity.getEntityData().getString("NpcSpawnerId").equals(id) && !entity.isDead) + spawnList.add(entity); + } + return spawnList; + } + + public boolean isOnCooldown(String name) { + if(!cooldown.containsKey(name)) + return false; + + long time = cooldown.get(name); + return System.currentTimeMillis() < time + 1200000; //20 minutes cooldown + } + + + public boolean hasPixelmon() { + return compound1 != null && compound1.getString("id").equals("pixelmontainer"); + } +} diff --git a/src/main/java/noppes/npcs/roles/RoleBank.java b/src/main/java/noppes/npcs/roles/RoleBank.java new file mode 100644 index 000000000..770b33cb9 --- /dev/null +++ b/src/main/java/noppes/npcs/roles/RoleBank.java @@ -0,0 +1,43 @@ +package noppes.npcs.roles; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.controllers.Bank; +import noppes.npcs.controllers.BankController; +import noppes.npcs.controllers.BankData; +import noppes.npcs.controllers.PlayerDataController; +import noppes.npcs.entity.EntityNPCInterface; + +public class RoleBank extends RoleInterface{ + + public int bankId = -1; + + public RoleBank(EntityNPCInterface npc) { + super(npc); + } + + @Override + public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) { + nbttagcompound.setInteger("RoleBankID", bankId); + return nbttagcompound; + } + + @Override + public void readFromNBT(NBTTagCompound nbttagcompound) { + bankId = nbttagcompound.getInteger("RoleBankID"); + } + + @Override + public void interact(EntityPlayer player) { + BankData data = PlayerDataController.instance.getBankData(player,bankId).getBankOrDefault(bankId); + data.openBankGui(player,npc,bankId,0); + npc.say(player, npc.advanced.getInteractLine()); + } + + public Bank getBank() { + Bank bank = BankController.getInstance().banks.get(bankId); + if(bank != null) + return bank; + return BankController.getInstance().banks.values().iterator().next(); + } +} diff --git a/src/main/java/noppes/npcs/roles/RoleCompanion.java b/src/main/java/noppes/npcs/roles/RoleCompanion.java new file mode 100644 index 000000000..eb425094f --- /dev/null +++ b/src/main/java/noppes/npcs/roles/RoleCompanion.java @@ -0,0 +1,705 @@ +package noppes.npcs.roles; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.TreeMap; +import java.util.UUID; +import java.util.Map.Entry; + +import com.google.common.collect.HashMultimap; + +import cpw.mods.fml.common.ObfuscationReflectionHelper; +import net.minecraft.entity.Entity; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.attributes.AttributeModifier; +import net.minecraft.entity.ai.attributes.BaseAttributeMap; +import net.minecraft.entity.ai.attributes.IAttributeInstance; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemBow; +import net.minecraft.item.ItemFood; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemSword; +import net.minecraft.item.ItemArmor.ArmorMaterial; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; +import noppes.npcs.CustomNpcs; +import noppes.npcs.NoppesUtilServer; +import noppes.npcs.NpcMiscInventory; +import noppes.npcs.constants.EnumAnimation; +import noppes.npcs.constants.EnumCompanionJobs; +import noppes.npcs.constants.EnumCompanionStage; +import noppes.npcs.constants.EnumCompanionTalent; +import noppes.npcs.constants.EnumGuiType; +import noppes.npcs.controllers.PlayerData; +import noppes.npcs.controllers.PlayerDataController; +import noppes.npcs.entity.EntityCustomNpc; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.companion.CompanionFarmer; +import noppes.npcs.roles.companion.CompanionFoodStats; +import noppes.npcs.roles.companion.CompanionGuard; +import noppes.npcs.roles.companion.CompanionJobInterface; +import noppes.npcs.roles.companion.CompanionTrader; + +public class RoleCompanion extends RoleInterface { + public NpcMiscInventory inventory; + public String uuid = ""; + public String ownerName = ""; + public Map talents = new TreeMap(); + + public boolean canAge = true; + public long ticksActive = 0; + public EnumCompanionStage stage = EnumCompanionStage.FULLGROWN; + + public EntityPlayer owner = null; + public int companionID; + + public EnumCompanionJobs job = EnumCompanionJobs.NONE; + public CompanionJobInterface jobInterface = null; + + public boolean hasInv = true; + public boolean defendOwner = true; + + public CompanionFoodStats foodstats = new CompanionFoodStats(); + private int eatingTicks = 20; + private ItemStack eating = null; + private int eatingDelay = 00; + + public int currentExp = 0; + + public RoleCompanion(EntityNPCInterface npc) { + super(npc); + inventory = new NpcMiscInventory(12); + } + + @Override + public boolean aiShouldExecute() { + EntityPlayer prev = owner; + owner = getOwner(); + if(jobInterface != null && jobInterface.isSelfSufficient()) + return true; + + if(owner == null && !uuid.isEmpty()){ + npc.isDead = true; + } + else if(prev != owner && owner != null){ + ownerName = owner.getDisplayName(); + PlayerData data = PlayerDataController.instance.getPlayerData(owner); + if(data.companionID != companionID){ + npc.isDead = true; + } + } + return owner != null; + } + + @Override + public void aiUpdateTask() { + if(owner != null && (jobInterface == null || !jobInterface.isSelfSufficient())) + foodstats.onUpdate(npc); + if(foodstats.getFoodLevel() >= 18){ + npc.stats.healthRegen = 0; + npc.stats.combatRegen = 0; + } + if(foodstats.needFood() && isSitting()){ + if(eatingDelay > 0){ + eatingDelay--; + return; + } + + ItemStack prev = eating; + eating = getFood(); + + if(prev != null && eating == null) + npc.setRoleDataWatcher(""); + + if(prev == null && eating != null){ + npc.setRoleDataWatcher("eating"); + eatingTicks = 20; + } + + if(isEating()){ + doEating(); + } + + } + else if(eating != null && !isSitting()){ + eating = null; + eatingDelay = 20; + npc.setRoleDataWatcher(""); + } + + ticksActive++; + if(canAge && stage != EnumCompanionStage.FULLGROWN){ + if(stage == EnumCompanionStage.BABY && ticksActive > EnumCompanionStage.CHILD.matureAge){ + matureTo(EnumCompanionStage.CHILD); + } + else if(stage == EnumCompanionStage.CHILD && ticksActive > EnumCompanionStage.TEEN.matureAge){ + matureTo(EnumCompanionStage.TEEN); + } + else if(stage == EnumCompanionStage.TEEN && ticksActive > EnumCompanionStage.ADULT.matureAge){ + matureTo(EnumCompanionStage.ADULT); + } + else if(stage == EnumCompanionStage.ADULT && ticksActive > EnumCompanionStage.FULLGROWN.matureAge){ + matureTo(EnumCompanionStage.FULLGROWN); + } + } + } + + public void clientUpdate() { + if(npc.getRoleDataWatcher().equals("eating")){ + eating = getFood(); + + if(isEating()){ + doEating(); + } + } + else if(eating != null){ + eating = null; + } + + } + private void doEating(){ + if(npc.worldObj.isRemote){ + Random rand = npc.getRNG(); + for (int j = 0; j < 2; ++j){ + Vec3 vec3 = Vec3.createVectorHelper(((double)rand.nextFloat() - 0.5D) * 0.1D, Math.random() * 0.1D + 0.1D, 0.0D); + vec3.rotateAroundX(-npc.rotationPitch * (float)Math.PI / 180.0F); + vec3.rotateAroundY(-npc.renderYawOffset * (float)Math.PI / 180.0F); + Vec3 vec31 = Vec3.createVectorHelper(((double)rand.nextFloat() - 0.5D) * 0.3D, (double)(-rand.nextFloat()) * 0.6D - 0.3D, npc.width / 2 + 0.1); + vec31.rotateAroundX(-npc.rotationPitch * (float)Math.PI / 180.0F); + vec31.rotateAroundY(-npc.renderYawOffset * (float)Math.PI / 180.0F); + vec31 = vec31.addVector(npc.posX, npc.posY + (double)npc.height + 0.1, npc.posZ); + String s = "iconcrack_" + Item.getIdFromItem(eating.getItem()); + + if (eating.getHasSubtypes()){ + s = s + "_" + eating.getItemDamage(); + } + + npc.worldObj.spawnParticle(s, vec31.xCoord, vec31.yCoord, vec31.zCoord, vec3.xCoord, vec3.yCoord + 0.0D, vec3.zCoord); + } + } + else{ + eatingTicks--; + + if(eatingTicks <= 0){ + if(inventory.decrStackSize(eating, 1)){ + ItemFood food = (ItemFood) eating.getItem(); + foodstats.onFoodEaten(food, eating); + npc.playSound("random.burp", 0.5F, npc.getRNG().nextFloat() * 0.1F + 0.9F); + } + eatingDelay = 20; + npc.setRoleDataWatcher(""); + eating = null; + } + else if(eatingTicks > 3 && eatingTicks % 2 == 0){ + Random rand = npc.getRNG(); + npc.playSound("random.eat", 0.5F + 0.5F * rand.nextInt(2), (rand.nextFloat() - rand.nextFloat()) * 0.2F + 1.0F); + } + } + } + + public void matureTo(EnumCompanionStage stage){ + this.stage = stage; + EntityCustomNpc npc = (EntityCustomNpc) this.npc; + npc.ai.animationType = stage.animation; + if(stage == EnumCompanionStage.BABY){ + npc.modelData.arms.setScale(0.5f, 0.5f, 0.5f); + npc.modelData.legs.setScale(0.5f, 0.5f, 0.5f); + npc.modelData.body.setScale(0.5f, 0.5f, 0.5f); + npc.modelData.head.setScale(0.7f, 0.7f, 0.7f); + + npc.ai.onAttack = 1; + npc.ai.setWalkingSpeed(3); + if(!talents.containsKey(EnumCompanionTalent.INVENTORY)) + talents.put(EnumCompanionTalent.INVENTORY, 0); + } + if(stage == EnumCompanionStage.CHILD){ + npc.modelData.arms.setScale(0.6f, 0.6f, 0.6f); + npc.modelData.legs.setScale(0.6f, 0.6f, 0.6f); + npc.modelData.body.setScale(0.6f, 0.6f, 0.6f); + npc.modelData.head.setScale(0.8f, 0.8f, 0.8f); + + npc.ai.onAttack = 0; + npc.ai.setWalkingSpeed(4); + if(!talents.containsKey(EnumCompanionTalent.SWORD)) + talents.put(EnumCompanionTalent.SWORD, 0); + } + if(stage == EnumCompanionStage.TEEN){ + npc.modelData.arms.setScale(0.8f, 0.8f, 0.8f); + npc.modelData.legs.setScale(0.8f, 0.8f, 0.8f); + npc.modelData.body.setScale(0.8f, 0.8f, 0.8f); + npc.modelData.head.setScale(0.9f, 0.9f, 0.9f); + + npc.ai.onAttack = 0; + npc.ai.setWalkingSpeed(5); + if(!talents.containsKey(EnumCompanionTalent.ARMOR)) + talents.put(EnumCompanionTalent.ARMOR, 0); + } + if(stage == EnumCompanionStage.ADULT || stage == EnumCompanionStage.FULLGROWN){ + npc.modelData.arms.setScale(1f, 1f, 1f); + npc.modelData.legs.setScale(1f, 1f, 1f); + npc.modelData.body.setScale(1f, 1f, 1f); + npc.modelData.head.setScale(1f, 1f, 1f); + + npc.ai.onAttack = 0; + npc.ai.setWalkingSpeed(5); + } + } + + @Override + public NBTTagCompound writeToNBT(NBTTagCompound compound) { + compound.setTag("CompanionInventory", inventory.getToNBT()); + compound.setString("CompanionOwner", uuid); + compound.setString("CompanionOwnerName", ownerName); + compound.setInteger("CompanionID", companionID); + + compound.setInteger("CompanionStage", stage.ordinal()); + compound.setInteger("CompanionExp", currentExp); + compound.setBoolean("CompanionCanAge", canAge); + compound.setLong("CompanionAge", ticksActive); + + compound.setBoolean("CompanionHasInv", hasInv); + compound.setBoolean("CompanionDefendOwner", defendOwner); + + foodstats.writeNBT(compound); + + compound.setInteger("CompanionJob", job.ordinal()); + if(jobInterface != null) + compound.setTag("CompanionJobData", jobInterface.getNBT()); + + NBTTagList list = new NBTTagList(); + for(EnumCompanionTalent talent : talents.keySet()){ + NBTTagCompound c = new NBTTagCompound(); + c.setInteger("Talent", talent.ordinal()); + c.setInteger("Exp", talents.get(talent)); + list.appendTag(c); + } + compound.setTag("CompanionTalents", list); + return compound; + } + + @Override + public void readFromNBT(NBTTagCompound compound) { + inventory.setFromNBT(compound.getCompoundTag("CompanionInventory")); + uuid = compound.getString("CompanionOwner"); + ownerName = compound.getString("CompanionOwnerName"); + companionID = compound.getInteger("CompanionID"); + + stage = EnumCompanionStage.values()[compound.getInteger("CompanionStage")]; + currentExp = compound.getInteger("CompanionExp"); + canAge = compound.getBoolean("CompanionCanAge"); + ticksActive = compound.getLong("CompanionAge"); + + hasInv = compound.getBoolean("CompanionHasInv"); + defendOwner = compound.getBoolean("CompanionDefendOwner"); + + foodstats.readNBT(compound); + + NBTTagList list = compound.getTagList("CompanionTalents", 10); + Map talents = new TreeMap(); + for(int i = 0; i < list.tagCount(); i++){ + NBTTagCompound c = list.getCompoundTagAt(i); + EnumCompanionTalent talent = EnumCompanionTalent.values()[c.getInteger("Talent")]; + talents.put(talent, c.getInteger("Exp")); + } + this.talents = talents; + + setJob(compound.getInteger("CompanionJob")); + if(jobInterface != null) + jobInterface.setNBT(compound.getCompoundTag("CompanionJobData")); + setStats(); + } + + private void setJob(int i) { + job = EnumCompanionJobs.values()[i]; + if(job == EnumCompanionJobs.SHOP) + jobInterface = new CompanionTrader(); + else if(job == EnumCompanionJobs.FARMER) + jobInterface = new CompanionFarmer(); + else if(job == EnumCompanionJobs.GUARD) + jobInterface = new CompanionGuard(); + else + jobInterface = null; + + if(jobInterface != null) + jobInterface.npc = npc; + } + + @Override + public void interact(EntityPlayer player) { + if(player != null && job == EnumCompanionJobs.SHOP) + ((CompanionTrader)jobInterface).interact(player); + if(player != owner || !npc.isEntityAlive() || npc.isAttacking()) + return; + if(player.isSneaking()){ + openGui(player); + } + else{ + setSitting(!isSitting()); + } + } + + public int getTotalLevel(){ + int level = 0; + for(EnumCompanionTalent talent : talents.keySet()) + level += this.getTalentLevel(talent); + return level; + } + + public int getMaxExp(){ + return 500 + getTotalLevel() * 200; + } + + public void addExp(int exp){ + if(canAddExp(exp)) + this.currentExp += exp; + } + + public boolean canAddExp(int exp){ + int newExp = this.currentExp + exp; + return newExp >= 0 && newExp < getMaxExp(); + } + + public void gainExp(int chance){ + if(npc.getRNG().nextInt(chance) == 0) + addExp(1); + } + + private void openGui(EntityPlayer player){ + NoppesUtilServer.sendOpenGui(player, EnumGuiType.Companion, npc); + } + + public EntityPlayer getOwner(){ + if(uuid == null || uuid.isEmpty()) + return null; + try{ + UUID id = UUID.fromString(uuid); + if(id != null){ + return NoppesUtilServer.getPlayer(id); + } + } + catch(IllegalArgumentException ex){ + + } + return null; + } + + + public void setOwner(EntityPlayer player) { + uuid = player.getUniqueID().toString(); + } + + + public boolean hasTalent(EnumCompanionTalent talent) { + return getTalentLevel(talent) > 0; + } + + public int getTalentLevel(EnumCompanionTalent talent){ + if(!talents.containsKey(talent)) + return 0; + + int exp = talents.get(talent); + if(exp >= 5000) + return 5; + if(exp >= 3000) + return 4; + if(exp >= 1700) + return 3; + if(exp >= 1000) + return 2; + if(exp >= 400) + return 1; + return 0; + } + + public Integer getNextLevel(EnumCompanionTalent talent) { + if(!talents.containsKey(talent)) + return 0; + int exp = talents.get(talent); + if(exp < 400) + return 400; + if(exp < 1000) + return 700; + if(exp < 1700) + return 1700; + if(exp < 3000) + return 3000; + return 5000; + } + + public void levelSword(){ + if(!talents.containsKey(EnumCompanionTalent.SWORD)) + return; + } + public void levelTalent(EnumCompanionTalent talent, int exp){ + if(!talents.containsKey(EnumCompanionTalent.SWORD)) + return; + talents.put(talent, exp + talents.get(talent)); + } + + public int getExp(EnumCompanionTalent talent) { + if(talents.containsKey(talent)) + return talents.get(talent); + return -1; + } + + public void setExp(EnumCompanionTalent talent, int exp) { + talents.put(talent, exp); + } + + private boolean isWeapon(ItemStack item) { + if(item == null || item.getItem() == null) + return false; + return item.getItem() instanceof ItemSword || + item.getItem() instanceof ItemBow || + item.getItem() == Item.getItemFromBlock(Blocks.cobblestone); + } + + public boolean canWearWeapon(ItemStack item){ + if(item == null || item.getItem() == null) + return false; + + if(item.getItem() instanceof ItemSword) + return canWearSword(item); + + if(item.getItem() instanceof ItemBow) + return this.getTalentLevel(EnumCompanionTalent.RANGED) > 2; + + if(item.getItem() == Item.getItemFromBlock(Blocks.cobblestone)) + return this.getTalentLevel(EnumCompanionTalent.RANGED) > 1; + + return false; + } + + public boolean canWearArmor(ItemStack item){ + int level = getTalentLevel(EnumCompanionTalent.ARMOR); + if(item == null || !(item.getItem() instanceof ItemArmor) || level <= 0) + return false; + + if(level >= 5) + return true; + + ItemArmor armor = (ItemArmor) item.getItem(); + int reduction = ObfuscationReflectionHelper.getPrivateValue(ArmorMaterial.class, armor.getArmorMaterial(), 5); + if(reduction <= 5 && level >= 1) + return true; + if(reduction <= 7 && level >= 2) + return true; + if(reduction <= 15 && level >= 3) + return true; + if(reduction <= 33 && level >= 4) + return true; + return false; + } + public boolean canWearSword(ItemStack item){ + int level = getTalentLevel(EnumCompanionTalent.SWORD); + if(item == null || !(item.getItem() instanceof ItemSword) || level <= 0) + return false; + if(level >= 5) + return true; + return getSwordDamage(item) - level < 4; + } + + private double getSwordDamage(ItemStack item){ + if(item == null || !(item.getItem() instanceof ItemSword)) + return 0; + HashMultimap map = (HashMultimap) item.getAttributeModifiers(); + Iterator iterator = map.entries().iterator(); + while (iterator.hasNext()) + { + Entry entry = (Entry)iterator.next(); + if(entry.getKey().equals(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName())){ + AttributeModifier mod = (AttributeModifier) entry.getValue(); + return mod.getAmount(); + } + } + return 0; + } + + public void setStats(){ + ItemStack weapon = npc.inventory.getWeapon(); + npc.stats.setAttackStrength((int) (1 + getSwordDamage(weapon))); + npc.stats.healthRegen = 0; + npc.stats.combatRegen = 0; + int ranged = getTalentLevel(EnumCompanionTalent.RANGED); + if(ranged > 0 && weapon != null){ + if(ranged > 0 && weapon.getItem() == Item.getItemFromBlock(Blocks.cobblestone)){ + npc.inventory.setProjectile(weapon); + } + if(ranged > 0 && weapon.getItem() instanceof ItemBow){ + npc.inventory.setProjectile(new ItemStack(Items.arrow)); + } + } + + inventory.setSize(2 + getTalentLevel(EnumCompanionTalent.INVENTORY) * 2); + } + + public void setSelfsuficient(boolean bo){ + if(owner == null || jobInterface != null && bo == jobInterface.isSelfSufficient()) + return; + PlayerData data = PlayerDataController.instance.getPlayerData(owner); + if(!bo && data.hasCompanion()) + return; + data.setCompanion(bo?null:npc); + if(job == EnumCompanionJobs.GUARD) + ((CompanionGuard)jobInterface).isStanding = bo; + else if(job == EnumCompanionJobs.FARMER) + ((CompanionFarmer)jobInterface).isStanding = bo; + + } + + public void setSitting(boolean sit){ + if(sit){ + npc.ai.animationType = EnumAnimation.SITTING; + npc.ai.onAttack = 3; + npc.ai.startPos = new int[]{MathHelper.floor_double(npc.posX), + MathHelper.floor_double(npc.posY), MathHelper.floor_double(npc.posZ)}; + npc.getNavigator().clearPathEntity(); + npc.setPositionAndUpdate(npc.ai.startPos[0] + 0.5, npc.posY, npc.ai.startPos[2] + 0.5); + } + else{ + npc.ai.animationType = stage.animation; + npc.ai.onAttack = 0; + } + npc.setResponse(); + } + + public boolean isSitting(){ + return npc.ai.animationType == EnumAnimation.SITTING; + } + + public float applyArmorCalculations(DamageSource source, float damage) { + if(!hasInv || getTalentLevel(EnumCompanionTalent.ARMOR) <=0) + return damage; + if (!source.isUnblockable()){ + damageArmor(damage); + int i = 25 - getTotalArmorValue(); + float f1 = damage * (float)i; + damage = f1 / 25.0F; + } + return damage; + } + + private void damageArmor(float damage){ + damage /= 4.0F; + + if (damage < 1.0F){ + damage = 1.0F; + } + boolean hasArmor = false; + Iterator> ita = npc.inventory.armor.entrySet().iterator(); + while(ita.hasNext()){ + Entry entry = ita.next(); + ItemStack item = entry.getValue(); + if(item == null || !(item.getItem() instanceof ItemArmor)) + continue; + hasArmor = true; + item.damageItem((int)damage, npc); + if(item.stackSize <= 0) + ita.remove(); + } + this.gainExp(hasArmor?4:8); + } + + public int getTotalArmorValue(){ + int armorValue = 0; + for(ItemStack armor : npc.inventory.getArmor().values()){ + if(armor != null && armor.getItem() instanceof ItemArmor) + armorValue += ((ItemArmor)armor.getItem()).damageReduceAmount; + } + return armorValue; + } + + public boolean isFollowing(){ + if(jobInterface != null && jobInterface.isSelfSufficient()) + return false; + return owner != null && !isSitting(); + } + + @Override + public boolean defendOwner() { + if(!defendOwner || owner == null || stage == EnumCompanionStage.BABY || jobInterface != null && jobInterface.isSelfSufficient()) + return false; + return true; + } + + public int followRange() { + return 9 + 12 * stage.ordinal(); + + } + + public boolean hasOwner() { + return !uuid.isEmpty(); + } + + public void addMovementStat(double x, double y, double z) { + int i = Math.round(MathHelper.sqrt_double(x * x + y * y + z * z) * 100.0F); + if(npc.isAttacking()) + foodstats.addExhaustion(0.04F * (float)i * 0.01F); + else + foodstats.addExhaustion(0.02F * (float)i * 0.01F); + } + + private ItemStack getFood(){ + List food = new ArrayList(inventory.items.values()); + Iterator ite = food.iterator(); + int i = -1; + while(ite.hasNext()){ + ItemStack is = ite.next(); + if(is == null || !(is.getItem() instanceof ItemFood)){ + ite.remove(); + continue; + } + int amount = ((ItemFood) is.getItem()).func_150905_g(is); + if(i == -1 || amount < i) + i = amount; + } + for(ItemStack is : food){ + if(((ItemFood)is.getItem()).func_150905_g(is) == i) + return is; + } + return null; + } + + public ItemStack getHeldItem() { + if(eating != null) + return eating; + return npc.inventory.getWeapon(); + } + + public boolean isEating() { + return eating != null; + } + + public boolean hasInv() { + if(!hasInv) + return false; + return hasTalent(EnumCompanionTalent.INVENTORY) || hasTalent(EnumCompanionTalent.ARMOR) || hasTalent(EnumCompanionTalent.SWORD); + } + + public void attackedEntity(Entity entity) { + ItemStack weapon = npc.inventory.getWeapon(); + gainExp(weapon == null?8:4); + if(weapon == null) + return; + weapon.damageItem(1, npc); + if(weapon.stackSize <= 0) + npc.inventory.setWeapon(null); + } + + public void addTalentExp(EnumCompanionTalent talent, int exp) { + if(talents.containsKey(talent)) + exp += talents.get(talent); + talents.put(talent, exp); + } +} diff --git a/src/main/java/noppes/npcs/roles/RoleFollower.java b/src/main/java/noppes/npcs/roles/RoleFollower.java new file mode 100644 index 000000000..67a578f3c --- /dev/null +++ b/src/main/java/noppes/npcs/roles/RoleFollower.java @@ -0,0 +1,156 @@ +package noppes.npcs.roles; + +import java.util.HashMap; +import java.util.UUID; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.StatCollector; +import noppes.npcs.NBTTags; +import noppes.npcs.NoppesStringUtils; +import noppes.npcs.NoppesUtilServer; +import noppes.npcs.NpcMiscInventory; +import noppes.npcs.constants.EnumGuiType; +import noppes.npcs.constants.EnumJobType; +import noppes.npcs.entity.EntityNPCInterface; + +public class RoleFollower extends RoleInterface{ + + private String ownerUUID; + public boolean isFollowing = true; + public HashMap rates; + public NpcMiscInventory inventory; + public String dialogHire = StatCollector.translateToLocal("follower.hireText") + " {days} " + StatCollector.translateToLocal("follower.days"); + public String dialogFarewell = StatCollector.translateToLocal("follower.farewellText") + " {player}"; + public int daysHired; + public long hiredTime; + public boolean disableGui = false; + public boolean infiniteDays = false; + public boolean refuseSoulStone = false; + + public EntityPlayer owner = null; + + public RoleFollower(EntityNPCInterface npc) { + super(npc); + inventory = new NpcMiscInventory(3); + rates = new HashMap(); + } + + @Override + public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) { + nbttagcompound.setInteger("MercenaryDaysHired", daysHired); + nbttagcompound.setLong("MercenaryHiredTime", hiredTime); + nbttagcompound.setString("MercenaryDialogHired", dialogHire); + nbttagcompound.setString("MercenaryDialogFarewell", dialogFarewell); + if(hasOwner()) + nbttagcompound.setString("MercenaryOwner", ownerUUID); + nbttagcompound.setTag("MercenaryDayRates", NBTTags.nbtIntegerIntegerMap(rates)); + nbttagcompound.setTag("MercenaryInv", inventory.getToNBT()); + nbttagcompound.setBoolean("MercenaryIsFollowing", isFollowing); + nbttagcompound.setBoolean("MercenaryDisableGui", disableGui); + nbttagcompound.setBoolean("MercenaryInfiniteDays", infiniteDays); + nbttagcompound.setBoolean("MercenaryRefuseSoulstone", refuseSoulStone); + return nbttagcompound; + } + + @Override + public void readFromNBT(NBTTagCompound nbttagcompound) { + ownerUUID = nbttagcompound.getString("MercenaryOwner"); + daysHired = nbttagcompound.getInteger("MercenaryDaysHired"); + hiredTime = nbttagcompound.getLong("MercenaryHiredTime"); + dialogHire = nbttagcompound.getString("MercenaryDialogHired"); + dialogFarewell = nbttagcompound.getString("MercenaryDialogFarewell"); + rates = NBTTags.getIntegerIntegerMap(nbttagcompound.getTagList("MercenaryDayRates", 10)); + inventory.setFromNBT(nbttagcompound.getCompoundTag("MercenaryInv")); + isFollowing = nbttagcompound.getBoolean("MercenaryIsFollowing"); + disableGui = nbttagcompound.getBoolean("MercenaryDisableGui"); + infiniteDays = nbttagcompound.getBoolean("MercenaryInfiniteDays"); + refuseSoulStone = nbttagcompound.getBoolean("MercenaryRefuseSoulstone"); + } + + @Override + public boolean aiShouldExecute() { + owner = getOwner(); + if(!infiniteDays && owner != null && getDaysLeft() <= 0){ + owner.addChatMessage(new ChatComponentTranslation(NoppesStringUtils.formatText(dialogFarewell, owner, npc))); + killed(); + } + return false; + } + + public EntityPlayer getOwner(){ + if(ownerUUID == null || ownerUUID.isEmpty()) + return null; + try{ + UUID uuid = UUID.fromString(ownerUUID); + if(uuid != null) + return npc.worldObj.func_152378_a(uuid); + } + catch(IllegalArgumentException ex){ + + } + + return npc.worldObj.getPlayerEntityByName(ownerUUID); + } + public boolean hasOwner(){ + if(!infiniteDays && daysHired <= 0) + return false; + return ownerUUID != null && !ownerUUID.isEmpty(); + } + @Override + public void killed() { + ownerUUID = null; + daysHired = 0; + hiredTime = 0; + isFollowing = true; + } + + public int getDaysLeft(){ + if(infiniteDays) + return 100; + if(daysHired <= 0) + return 0; + int days = (int) ((npc.worldObj.getTotalWorldTime()- hiredTime) / 24000); + return daysHired - days; + } + + public void addDays(int days) { + daysHired = days + getDaysLeft(); + hiredTime = npc.worldObj.getTotalWorldTime(); + } + + @Override + public void interact(EntityPlayer player) { + if(ownerUUID == null || ownerUUID.isEmpty()){ + npc.say(player, npc.advanced.getInteractLine()); + NoppesUtilServer.sendOpenGui(player, EnumGuiType.PlayerFollowerHire, npc); + } + else if(player == owner && !disableGui){ + NoppesUtilServer.sendOpenGui(player, EnumGuiType.PlayerFollower, npc); + } + } + + @Override + public boolean defendOwner() { + return isFollowing() && npc.advanced.job == EnumJobType.Guard; + } + + @Override + public void delete() { + + } + + public boolean isFollowing(){ + return owner != null && isFollowing && getDaysLeft() > 0; + } + + public void setOwner(EntityPlayer player) { + UUID id = player.getUniqueID(); + if(ownerUUID == null || id == null || !ownerUUID.equals(id)) + killed(); + ownerUUID = id.toString(); + } + + +} diff --git a/src/main/java/noppes/npcs/roles/RoleInnkeeper.java b/src/main/java/noppes/npcs/roles/RoleInnkeeper.java new file mode 100644 index 000000000..d1794c0fc --- /dev/null +++ b/src/main/java/noppes/npcs/roles/RoleInnkeeper.java @@ -0,0 +1,80 @@ +package noppes.npcs.roles; + +import java.util.HashMap; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.util.ChatComponentTranslation; +import noppes.npcs.controllers.InnDoorData; +import noppes.npcs.entity.EntityNPCInterface; + +public class RoleInnkeeper extends RoleInterface{ + + private String innName = "Inn"; + private HashMap doors = new HashMap(); + + public RoleInnkeeper(EntityNPCInterface npc) { + super(npc); + } + + @Override + public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) { + nbttagcompound.setString("InnName", innName); + nbttagcompound.setTag("InnDoors", nbtInnDoors(doors)); + return nbttagcompound; + } + + private NBTBase nbtInnDoors(HashMap doors1) { + NBTTagList nbttaglist = new NBTTagList(); + if(doors1 == null) + return nbttaglist; + HashMap doors2 = doors1; + for(String name : doors2.keySet()) + { + InnDoorData door = doors2.get(name); + if(door == null) + continue; + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setString("Name", name); + nbttagcompound.setInteger("posX", door.x); + nbttagcompound.setInteger("posY", door.y); + nbttagcompound.setInteger("posZ", door.z); + + nbttaglist.appendTag(nbttagcompound); + } + return nbttaglist; + } + + @Override + public void readFromNBT(NBTTagCompound nbttagcompound) { + innName = nbttagcompound.getString("InnName"); + doors = getInnDoors(nbttagcompound.getTagList("InnDoors", 10)); + } + + private HashMap getInnDoors(NBTTagList tagList) { + HashMap list = new HashMap(); + for(int i = 0; i < tagList.tagCount(); i++) + { + NBTTagCompound nbttagcompound = tagList.getCompoundTagAt(i); + String name = nbttagcompound.getString("Name"); + + InnDoorData door = new InnDoorData(); + door.x = nbttagcompound.getInteger("posX"); + door.y = nbttagcompound.getInteger("posY"); + door.z = nbttagcompound.getInteger("posZ"); + list.put(name, door); + } + return list; + } + + @Override + public void interact(EntityPlayer player) { + npc.say(player, npc.advanced.getInteractLine()); + if(doors.isEmpty()){ + player.addChatMessage(new ChatComponentTranslation("No Rooms available")); + } + } + +} diff --git a/src/main/java/noppes/npcs/roles/RoleInterface.java b/src/main/java/noppes/npcs/roles/RoleInterface.java new file mode 100644 index 000000000..4c77119c1 --- /dev/null +++ b/src/main/java/noppes/npcs/roles/RoleInterface.java @@ -0,0 +1,36 @@ +package noppes.npcs.roles; + +import java.util.HashMap; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.entity.EntityNPCInterface; + +public abstract class RoleInterface { + public EntityNPCInterface npc; + public HashMap dataString = new HashMap(); + public RoleInterface(EntityNPCInterface npc){ + this.npc = npc; + } + public abstract NBTTagCompound writeToNBT(NBTTagCompound compound); + public abstract void readFromNBT(NBTTagCompound compound); + public abstract void interact(EntityPlayer player); + public void killed(){}; + public void delete(){}; + + public boolean aiShouldExecute() { + return false; + } + + public boolean aiContinueExecute() { + return false; + } + public void aiStartExecuting() {} + public void aiUpdateTask() {} + public boolean defendOwner() { + return false; + } + public void clientUpdate() { + + } +} diff --git a/src/main/java/noppes/npcs/roles/RolePostman.java b/src/main/java/noppes/npcs/roles/RolePostman.java new file mode 100644 index 000000000..3e100fcfc --- /dev/null +++ b/src/main/java/noppes/npcs/roles/RolePostman.java @@ -0,0 +1,61 @@ +package noppes.npcs.roles; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ChatComponentTranslation; +import noppes.npcs.CustomNpcs; +import noppes.npcs.NoppesUtilServer; +import noppes.npcs.NpcMiscInventory; +import noppes.npcs.constants.EnumGuiType; +import noppes.npcs.controllers.PlayerDataController; +import noppes.npcs.entity.EntityNPCInterface; + +public class RolePostman extends RoleInterface{ + + public NpcMiscInventory inventory = new NpcMiscInventory(1); + private List recentlyChecked = new ArrayList(); + private List toCheck; + + public RolePostman(EntityNPCInterface npc) { + super(npc); + } + + public boolean aiShouldExecute() { + if(npc.ticksExisted % 20 != 0) + return false; + + toCheck = npc.worldObj.getEntitiesWithinAABB(EntityPlayer.class, npc.boundingBox.expand(10, 10, 10)); + toCheck.removeAll(recentlyChecked); + + List listMax = npc.worldObj.getEntitiesWithinAABB(EntityPlayer.class, npc.boundingBox.expand(20, 20, 20)); + recentlyChecked.retainAll(listMax); + recentlyChecked.addAll(toCheck); + + for(EntityPlayer player : toCheck){ + if(PlayerDataController.instance.hasMail(player)) + player.addChatMessage(new ChatComponentTranslation("You've got mail")); + } + return false; + } + + @Override + public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) { + nbttagcompound.setTag("PostInv", inventory.getToNBT()); + return nbttagcompound; + } + + @Override + public void readFromNBT(NBTTagCompound nbttagcompound) { + inventory.setFromNBT(nbttagcompound.getCompoundTag("PostInv")); + } + + + @Override + public void interact(EntityPlayer player) { + player.openGui(CustomNpcs.instance, EnumGuiType.PlayerMailman.ordinal(), player.worldObj, 1, 1, 0); + } + +} diff --git a/src/main/java/noppes/npcs/roles/RoleTrader.java b/src/main/java/noppes/npcs/roles/RoleTrader.java new file mode 100644 index 000000000..d8da53a7c --- /dev/null +++ b/src/main/java/noppes/npcs/roles/RoleTrader.java @@ -0,0 +1,95 @@ +package noppes.npcs.roles; + +import java.util.logging.Level; +import java.util.logging.Logger; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.NoppesUtilPlayer; +import noppes.npcs.NoppesUtilServer; +import noppes.npcs.NpcMiscInventory; +import noppes.npcs.constants.EnumGuiType; +import noppes.npcs.entity.EntityNPCInterface; +import foxz.utils.Market; + +public class RoleTrader extends RoleInterface{ + + public String marketName = ""; + public NpcMiscInventory inventoryCurrency; + public NpcMiscInventory inventorySold; + + public boolean ignoreDamage = false; + public boolean ignoreNBT = false; + + public boolean toSave = false; + + public RoleTrader(EntityNPCInterface npc) { + super(npc); + inventoryCurrency = new NpcMiscInventory(36); + inventorySold = new NpcMiscInventory(18); + } + + @Override + public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) { + nbttagcompound.setString("TraderMarket", marketName); + writeNBT(nbttagcompound); + if (toSave && !npc.isRemote()) { + Market.save(this, marketName); + } + toSave = false; + return nbttagcompound; + } + + public NBTTagCompound writeNBT(NBTTagCompound nbttagcompound) { + nbttagcompound.setTag("TraderCurrency", inventoryCurrency.getToNBT()); + nbttagcompound.setTag("TraderSold", inventorySold.getToNBT()); + nbttagcompound.setBoolean("TraderIgnoreDamage", ignoreDamage); + nbttagcompound.setBoolean("TraderIgnoreNBT", ignoreNBT); + return nbttagcompound; + } + + @Override + public void readFromNBT(NBTTagCompound nbttagcompound) { + marketName = nbttagcompound.getString("TraderMarket"); + readNBT(nbttagcompound); + + try { + Market.load(this, marketName); + } catch (Exception ex) { + Logger.getLogger(getClass().getName()).log(Level.SEVERE, null, ex); + + } + } + + public void readNBT(NBTTagCompound nbttagcompound) { + inventoryCurrency.setFromNBT(nbttagcompound.getCompoundTag("TraderCurrency")); + inventorySold.setFromNBT(nbttagcompound.getCompoundTag("TraderSold")); + ignoreDamage = nbttagcompound.getBoolean("TraderIgnoreDamage"); + ignoreNBT = nbttagcompound.getBoolean("TraderIgnoreNBT"); + + } + + @Override + public void interact(EntityPlayer player) { + npc.say(player, npc.advanced.getInteractLine()); + try { + Market.load(this, marketName); + } catch (Exception ex) { + Logger.getLogger(getClass().getName()).log(Level.SEVERE, null, ex); + } + NoppesUtilServer.sendOpenGui(player, EnumGuiType.PlayerTrader, npc); + } + + public boolean hasCurrency(ItemStack itemstack) { + if(itemstack == null) + return false; + for(ItemStack item : inventoryCurrency.items.values()){ + if(item != null && NoppesUtilPlayer.compareItems(item, itemstack, ignoreDamage, ignoreNBT)){ + return true; + } + } + return false; + } + +} diff --git a/src/main/java/noppes/npcs/roles/RoleTransporter.java b/src/main/java/noppes/npcs/roles/RoleTransporter.java new file mode 100644 index 000000000..79a1f83fe --- /dev/null +++ b/src/main/java/noppes/npcs/roles/RoleTransporter.java @@ -0,0 +1,105 @@ +package noppes.npcs.roles; + +import java.util.List; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ChatComponentTranslation; +import noppes.npcs.NoppesUtilServer; +import noppes.npcs.Server; +import noppes.npcs.constants.EnumGuiType; +import noppes.npcs.constants.EnumPacketServer; +import noppes.npcs.controllers.PlayerDataController; +import noppes.npcs.controllers.PlayerTransportData; +import noppes.npcs.controllers.TransportController; +import noppes.npcs.controllers.TransportLocation; +import noppes.npcs.entity.EntityNPCInterface; + +public class RoleTransporter extends RoleInterface{ + + public int transportId = -1; + public String name; + + public RoleTransporter(EntityNPCInterface npc) { + super(npc); + } + + + @Override + public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) { + nbttagcompound.setInteger("TransporterId", transportId); + return nbttagcompound; + } + + @Override + public void readFromNBT(NBTTagCompound nbttagcompound) { + transportId = nbttagcompound.getInteger("TransporterId"); + TransportLocation loc = getLocation(); + if(loc != null){ + name = loc.name; + } + } + private int ticks = 10; + @Override + public boolean aiShouldExecute() { + ticks--; + if(ticks > 0) + return false; + ticks = 10; + + if(!hasTransport()) + return false; + + TransportLocation loc = getLocation(); + if(loc.type != 0) + return false; + + List inRange = npc.worldObj.getEntitiesWithinAABB(EntityPlayer.class,npc.boundingBox.expand(6D, 6D, 6D)); + for(EntityPlayer player :inRange){ + if(!npc.canSee(player)) + continue; + unlock(player, loc); + } + return false; + + } + @Override + public void aiStartExecuting() { + + } + + @Override + public void interact(EntityPlayer player) { + if(hasTransport()){ + TransportLocation loc = getLocation(); + if(loc.type == 2){ + unlock(player, loc); + } + NoppesUtilServer.sendOpenGui(player, EnumGuiType.PlayerTransporter, npc); + } + } + + private void unlock(EntityPlayer player, TransportLocation loc){ + PlayerTransportData data = PlayerDataController.instance.getPlayerData(player).transportData; + if(data.transports.contains(transportId)) + return; + data.transports.add(transportId); + player.addChatMessage(new ChatComponentTranslation("transporter.unlock", loc.name)); + } + public TransportLocation getLocation(){ + if(npc.isRemote()) + return null; + return TransportController.getInstance().getTransport(transportId); + } + public boolean hasTransport(){ + TransportLocation loc = getLocation(); + return loc != null && loc.id == transportId; + } + + public void setTransport(TransportLocation location) { + transportId = location.id; + name = location.name; + } + +} diff --git a/src/main/java/noppes/npcs/roles/companion/CompanionFarmer.java b/src/main/java/noppes/npcs/roles/companion/CompanionFarmer.java new file mode 100644 index 000000000..e05e506af --- /dev/null +++ b/src/main/java/noppes/npcs/roles/companion/CompanionFarmer.java @@ -0,0 +1,29 @@ +package noppes.npcs.roles.companion; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; + +public class CompanionFarmer extends CompanionJobInterface{ + public boolean isStanding = false; + @Override + public NBTTagCompound getNBT() { + NBTTagCompound compound = new NBTTagCompound(); + compound.setBoolean("CompanionFarmerStanding", isStanding); + return compound; + } + + @Override + public void setNBT(NBTTagCompound compound) { + isStanding = compound.getBoolean("CompanionFarmerStanding"); + } + + @Override + public boolean isSelfSufficient(){ + return isStanding; + } + + @Override + public void onUpdate(){ + + } +} diff --git a/src/main/java/noppes/npcs/roles/companion/CompanionFoodStats.java b/src/main/java/noppes/npcs/roles/companion/CompanionFoodStats.java new file mode 100644 index 000000000..d0cabd3e2 --- /dev/null +++ b/src/main/java/noppes/npcs/roles/companion/CompanionFoodStats.java @@ -0,0 +1,150 @@ +package noppes.npcs.roles.companion; + +import net.minecraft.item.ItemFood; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.DamageSource; +import net.minecraft.world.EnumDifficulty; +import noppes.npcs.entity.EntityNPCInterface; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class CompanionFoodStats { + /** The player's food level. */ + private int foodLevel = 20; + /** The player's food saturation. */ + private float foodSaturationLevel = 5.0F; + /** The player's food exhaustion. */ + private float foodExhaustionLevel; + /** The player's food timer value. */ + private int foodTimer; + private int prevFoodLevel = 20; + + /** + * Args: int foodLevel, float foodSaturationModifier + */ + private void addStats(int p_75122_1_, float p_75122_2_){ + this.foodLevel = Math.min(p_75122_1_ + this.foodLevel, 20); + this.foodSaturationLevel = Math.min(this.foodSaturationLevel + (float)p_75122_1_ * p_75122_2_ * 2.0F, (float)this.foodLevel); + } + + public void onFoodEaten(ItemFood food, ItemStack itemstack){ + this.addStats(food.func_150905_g(itemstack), food.func_150906_h(itemstack)); + } + + /** + * Handles the food game logic. + */ + public void onUpdate(EntityNPCInterface npc){ + EnumDifficulty enumdifficulty = npc.worldObj.difficultySetting; + this.prevFoodLevel = this.foodLevel; + + if (this.foodExhaustionLevel > 4.0F){ + this.foodExhaustionLevel -= 4.0F; + + if (this.foodSaturationLevel > 0.0F) + { + this.foodSaturationLevel = Math.max(this.foodSaturationLevel - 1.0F, 0.0F); + } + else if (enumdifficulty != EnumDifficulty.PEACEFUL) + { + this.foodLevel = Math.max(this.foodLevel - 1, 0); + } + } + + if (npc.worldObj.getGameRules().getGameRuleBooleanValue("naturalRegeneration") && this.foodLevel >= 18 && npc.getHealth() > 0.0F && npc.getHealth() < npc.getMaxHealth()) + { + ++this.foodTimer; + + if (this.foodTimer >= 80){ + npc.heal(1.0F); + this.addExhaustion(3.0F); + this.foodTimer = 0; + } + } + else if (this.foodLevel <= 0){ + ++this.foodTimer; + + if (this.foodTimer >= 80){ + if (npc.getHealth() > 10.0F || enumdifficulty == EnumDifficulty.HARD || npc.getHealth() > 1.0F && enumdifficulty == EnumDifficulty.NORMAL) + { + npc.attackEntityFrom(DamageSource.starve, 1.0F); + } + + this.foodTimer = 0; + } + } + else + { + this.foodTimer = 0; + } + } + + /** + * Reads food stats from an NBT object. + */ + public void readNBT(NBTTagCompound p_75112_1_) + { + if (p_75112_1_.hasKey("foodLevel", 99)) + { + this.foodLevel = p_75112_1_.getInteger("foodLevel"); + this.foodTimer = p_75112_1_.getInteger("foodTickTimer"); + this.foodSaturationLevel = p_75112_1_.getFloat("foodSaturationLevel"); + this.foodExhaustionLevel = p_75112_1_.getFloat("foodExhaustionLevel"); + } + } + + /** + * Writes food stats to an NBT object. + */ + public void writeNBT(NBTTagCompound p_75117_1_) + { + p_75117_1_.setInteger("foodLevel", this.foodLevel); + p_75117_1_.setInteger("foodTickTimer", this.foodTimer); + p_75117_1_.setFloat("foodSaturationLevel", this.foodSaturationLevel); + p_75117_1_.setFloat("foodExhaustionLevel", this.foodExhaustionLevel); + } + + /** + * Get the player's food level. + */ + public int getFoodLevel(){ + return this.foodLevel; + } + + @SideOnly(Side.CLIENT) + public int getPrevFoodLevel(){ + return this.prevFoodLevel; + } + + /** + * If foodLevel is not max. + */ + public boolean needFood(){ + return this.foodLevel < 20; + } + + /** + * adds input to foodExhaustionLevel to a max of 40 + */ + public void addExhaustion(float p_75113_1_){ + this.foodExhaustionLevel = Math.min(this.foodExhaustionLevel + p_75113_1_, 40.0F); + } + + /** + * Get the player's food saturation level. + */ + public float getSaturationLevel(){ + return this.foodSaturationLevel; + } + + @SideOnly(Side.CLIENT) + public void setFoodLevel(int p_75114_1_){ + this.foodLevel = p_75114_1_; + } + + @SideOnly(Side.CLIENT) + public void setFoodSaturationLevel(float p_75119_1_){ + this.foodSaturationLevel = p_75119_1_; + } +} diff --git a/src/main/java/noppes/npcs/roles/companion/CompanionGuard.java b/src/main/java/noppes/npcs/roles/companion/CompanionGuard.java new file mode 100644 index 000000000..38d39724b --- /dev/null +++ b/src/main/java/noppes/npcs/roles/companion/CompanionGuard.java @@ -0,0 +1,45 @@ +package noppes.npcs.roles.companion; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityList; +import net.minecraft.entity.boss.EntityDragon; +import net.minecraft.entity.monster.EntityCreeper; +import net.minecraft.entity.monster.IMob; +import net.minecraft.entity.passive.EntityAnimal; +import net.minecraft.entity.passive.EntityTameable; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.entity.EntityNPCInterface; + +public class CompanionGuard extends CompanionJobInterface{ + public boolean isStanding = false; + @Override + public NBTTagCompound getNBT() { + NBTTagCompound compound = new NBTTagCompound(); + compound.setBoolean("CompanionGuardStanding", isStanding); + return compound; + } + + @Override + public void setNBT(NBTTagCompound compound) { + isStanding = compound.getBoolean("CompanionGuardStanding"); + } + + public boolean isEntityApplicable(Entity entity) { + + if(entity instanceof EntityPlayer || entity instanceof EntityNPCInterface) + return false; + + else if (entity instanceof EntityCreeper) { + return false; + } + else if(entity instanceof IMob){ + return true; + } + return false; + } + + public boolean isSelfSufficient(){ + return isStanding; + } +} diff --git a/src/main/java/noppes/npcs/roles/companion/CompanionJobInterface.java b/src/main/java/noppes/npcs/roles/companion/CompanionJobInterface.java new file mode 100644 index 000000000..475ab715a --- /dev/null +++ b/src/main/java/noppes/npcs/roles/companion/CompanionJobInterface.java @@ -0,0 +1,14 @@ +package noppes.npcs.roles.companion; + +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.entity.EntityNPCInterface; + +public abstract class CompanionJobInterface { + public EntityNPCInterface npc; + public abstract NBTTagCompound getNBT(); + public abstract void setNBT(NBTTagCompound compound); + public void onUpdate(){} + public boolean isSelfSufficient(){ + return false; + } +} diff --git a/src/main/java/noppes/npcs/roles/companion/CompanionTrader.java b/src/main/java/noppes/npcs/roles/companion/CompanionTrader.java new file mode 100644 index 000000000..052c4e945 --- /dev/null +++ b/src/main/java/noppes/npcs/roles/companion/CompanionTrader.java @@ -0,0 +1,24 @@ +package noppes.npcs.roles.companion; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.NoppesUtilServer; +import noppes.npcs.constants.EnumGuiType; + +public class CompanionTrader extends CompanionJobInterface{ + + @Override + public NBTTagCompound getNBT() { + NBTTagCompound compound = new NBTTagCompound(); + return compound; + } + + @Override + public void setNBT(NBTTagCompound compound) { + + } + + public void interact(EntityPlayer player){ + NoppesUtilServer.sendOpenGui(player, EnumGuiType.CompanionTrader, npc); + } +} diff --git a/src/main/java/noppes/npcs/scripted/ScriptAnimal.java b/src/main/java/noppes/npcs/scripted/ScriptAnimal.java new file mode 100644 index 000000000..232d230bd --- /dev/null +++ b/src/main/java/noppes/npcs/scripted/ScriptAnimal.java @@ -0,0 +1,21 @@ +package noppes.npcs.scripted; + +import net.minecraft.entity.passive.EntityAnimal; +import noppes.npcs.scripted.constants.EntityType; + +public class ScriptAnimal extends ScriptLiving{ + + public ScriptAnimal(EntityAnimal entity) { + super(entity); + } + + @Override + public int getType(){ + return EntityType.ANIMAL; + } + + @Override + public boolean typeOf(int type){ + return type == EntityType.ANIMAL?true:super.typeOf(type); + } +} diff --git a/src/main/java/noppes/npcs/scripted/ScriptEntity.java b/src/main/java/noppes/npcs/scripted/ScriptEntity.java new file mode 100644 index 000000000..b7391b251 --- /dev/null +++ b/src/main/java/noppes/npcs/scripted/ScriptEntity.java @@ -0,0 +1,431 @@ +package noppes.npcs.scripted; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.minecraft.block.material.Material; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityList; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.monster.EntityMob; +import net.minecraft.entity.passive.EntityAnimal; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTBase.NBTPrimitive; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagString; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MathHelper; +import noppes.npcs.controllers.ScriptController; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.scripted.constants.EntityType; + +public class ScriptEntity { + protected Entity entity; + private Map tempData = new HashMap(); + + public ScriptEntity(Entity entity){ + this.entity = entity; + } + + + /** + * @return The entities x position + */ + public double getX(){ + return entity.posX; + } + + /** + * @param x The entities x position + */ + public void setX(double x){ + entity.posX = x; + } + + /** + * @return The entities y position + */ + public double getY(){ + return entity.posY; + } + + /** + * @param y The entities y position + */ + public void setY(double y){ + entity.posY = y; + } + + /** + * @return The entities x position + */ + public double getZ(){ + return entity.posZ; + } + + /** + * @param z The entities x position + */ + public void setZ(double z){ + entity.posZ = z; + } + + /** + * @return The block x position + */ + public int getBlockX(){ + return MathHelper.floor_double(entity.posX); + } + + /** + * @return The block y position + */ + public int getBlockY(){ + return MathHelper.floor_double(entity.posY); + } + + /** + * @return The block z position + */ + public int getBlockZ(){ + return MathHelper.floor_double(entity.posZ); + } + + /** + * @param x The x position + * @param y The y position + * @param z The z position + */ + public void setPosition(double x, double y, double z){ + entity.setPosition(x, y, z); + } + + + /** + * @param range The search range for entities around this entity + * @return Array of entities within range + */ + public ScriptEntity[] getSurroundingEntities(int range){ + List entities = entity.worldObj.getEntitiesWithinAABB(Entity.class, entity.boundingBox.expand(range, range, range)); + List list = new ArrayList(); + for(Entity living : entities){ + if(living != entity) + list.add(ScriptController.Instance.getScriptForEntity(living)); + } + return list.toArray(new ScriptEntity[list.size()]); + } + + /** + * @param range The search range for entities around this entity + * @param type The EntityType you want to find + * @return Array of entities within range + */ + public ScriptEntity[] getSurroundingEntities(int range, int type){ + Class cls = Entity.class; + if(type == EntityType.LIVING) + cls = EntityLivingBase.class; + else if(type == EntityType.PLAYER) + cls = EntityPlayer.class; + else if(type == EntityType.ANIMAL) + cls = EntityAnimal.class; + else if(type == EntityType.MONSTER) + cls = EntityMob.class; + else if(type == EntityType.NPC) + cls = EntityNPCInterface.class; + + List entities = entity.worldObj.getEntitiesWithinAABB(cls, entity.boundingBox.expand(range, range, range)); + List list = new ArrayList(); + for(Entity living : entities){ + if(living != entity) + list.add(ScriptController.Instance.getScriptForEntity(living)); + } + return list.toArray(new ScriptEntity[list.size()]); + } + + + /** + * @return Whether the entity is alive or not + */ + public boolean isAlive(){ + return entity.isEntityAlive(); + } + + /** + * @param key Get temp data for this key + * @return Returns the stored temp data + */ + public Object getTempData(String key){ + return tempData.get(key); + } + + /** + * Tempdata gets cleared when the entity gets unloaded or the world restarts + * @param key The key for the data stored + * @param value The data stored + */ + public void setTempData(String key, Object value){ + tempData.put(key, value); + } + + /** + * @param key The key thats going to be tested against the temp data + * @return Whether or not temp data containes the key + */ + public boolean hasTempData(String key){ + return tempData.containsKey(key); + } + + /** + * @param key The key for the temp data to be removed + */ + public void removeTempData(String key){ + tempData.remove(key); + } + + /** + * Remove all tempdata + */ + public void clearTempData(){ + tempData.clear(); + } + + /** + * @param key The key of the data to be returned + * @return Returns the stored data + */ + public Object getStoredData(String key){ + NBTTagCompound compound = getStoredCompound(); + if(!compound.hasKey(key)) + return null; + NBTBase base = compound.getTag(key); + if(base instanceof NBTPrimitive) + return ((NBTPrimitive)base).func_150286_g(); + return ((NBTTagString)base).func_150285_a_(); + } + + /** + * Stored data persists through world restart. Unlike tempdata only Strings and Numbers can be saved + * @param key The key for the data stored + * @param value The data stored. This data can be either a Number or a String. Other data is not stored + */ + public void setStoredData(String key, Object value){ + NBTTagCompound compound = getStoredCompound(); + if(value instanceof Number){ + compound.setDouble(key, ((Number) value).doubleValue()); + } + else if(value instanceof String) + compound.setString(key, (String)value); + saveStoredCompound(compound); + } + + /** + * @param key The key of the data to be checked + * @return Returns whether or not the stored data contains the key + */ + public boolean hasStoredData(String key){ + return getStoredCompound().hasKey(key); + } + + /** + * @param key The key of the data to be removed + */ + public void removeStoredData(String key){ + NBTTagCompound compound = getStoredCompound(); + compound.removeTag(key); + saveStoredCompound(compound); + } + + /** + * Remove all stored data + */ + public void clearStoredData(){ + entity.getEntityData().removeTag("CNPCStoredData"); + } + + private NBTTagCompound getStoredCompound(){ + NBTTagCompound compound = entity.getEntityData().getCompoundTag("CNPCStoredData"); + if(compound == null) + entity.getEntityData().setTag("CNPCStoredData", compound = new NBTTagCompound()); + return compound; + } + + private void saveStoredCompound(NBTTagCompound compound){ + entity.getEntityData().setTag("CNPCStoredData", compound); + } + + /** + * @return The age of this entity in ticks + */ + public long getAge(){ + return entity.ticksExisted; + } + + /** + * Despawns this entity. Removes it permanently + */ + public void despawn(){ + entity.isDead = true; + } + + /** + * @return Return whether or not this entity is standing in water + */ + public boolean inWater(){ + return entity.isInsideOfMaterial(Material.water); + } + + /** + * @return Return whether or not this entity is standing in lava + */ + public boolean inLava(){ + return entity.isInsideOfMaterial(Material.lava); + } + + /** + * @return Return whether or not this entity is standing in fire + */ + public boolean inFire(){ + return entity.isInsideOfMaterial(Material.fire); + } + + /** + * @return Return whether or not this entity is on fire + */ + public boolean isBurning(){ + return entity.isBurning(); + } + + /** + * @param ticks Amount of world ticks this entity will burn. 20 ticks equals 1 second + */ + public void setBurning(int ticks){ + entity.setFire(ticks); + } + + /** + * Removes fire from this entity + */ + public void extinguish(){ + entity.extinguish(); + } + + /** + * @return Name as which it's registered in minecraft + */ + public String getTypeName(){ + return EntityList.getEntityString(entity); + } + + /** + * @param item Item to be dropped + */ + public void dropItem(ScriptItemStack item){ + entity.entityDropItem(item.item, 0); + } + + /** + * @return Return the rider + */ + public ScriptEntity getRider(){ + return ScriptController.Instance.getScriptForEntity(entity.riddenByEntity); + } + + /** + * @param entity The entity to ride this entity + */ + public void setRider(ScriptEntity entity){ + if(entity != null){ + entity.entity.mountEntity(this.entity);; + } + else if(this.entity.riddenByEntity != null) + this.entity.riddenByEntity.mountEntity(null); + } + + /** + * @return Return the entity, this entity is riding + */ + public ScriptEntity getMount(){ + return ScriptController.Instance.getScriptForEntity(entity.ridingEntity); + } + + /** + * @param entity The entity this entity will mount + */ + public void setMount(ScriptEntity entity){ + if(entity == null) + this.entity.mountEntity(null); + else + this.entity.mountEntity(entity.entity); + } + + /** + * @see noppes.npcs.scripted.constants.EntityType + * @return Returns the EntityType of this entity + */ + public int getType(){ + return EntityType.UNKNOWN; + } + + /** + * @since 1.7.10c + * @param type @EntityType to check + * @return Returns whether the entity is type of the given @EntityType + */ + public boolean typeOf(int type){ + return type == EntityType.UNKNOWN; + } + + /** + * @param rotation The rotation to be set (0-360) + */ + public void setRotation(float rotation){ + entity.rotationYaw = rotation; + } + + /** + * @return Current rotation of the npc + */ + public float getRotation(){ + return entity.rotationYaw; + } + + /** + * @param power How strong the knockback is + * @param direction The direction in which he flies back (0-360). Usually based on getRotation() + */ + public void knockback(int power, float direction){ + float v = direction * (float)Math.PI / 180.0F; + entity.addVelocity(-MathHelper.sin(v) * (float)power, 0.1D + power * 0.04f, MathHelper.cos(v) * (float)power); + entity.motionX *= 0.6D; + entity.motionZ *= 0.6D; + entity.attackEntityFrom(DamageSource.outOfWorld, 0.0001F); + } + + /** + * @since 1.7.10c + * @return Returns whether or not this entity is sneaking + */ + public boolean isSneaking(){ + return entity.isSneaking(); + } + + /** + * @since 1.7.10c + * @return Returns whether or not this entity is sprinting + */ + public boolean isSprinting(){ + return entity.isSprinting(); + } + + /** + * @since 1.7.10c + * Expert users only + * @return Returns minecrafts entity + */ + public Entity getMCEntity(){ + return entity; + } +} diff --git a/src/main/java/noppes/npcs/scripted/ScriptEvent.java b/src/main/java/noppes/npcs/scripted/ScriptEvent.java new file mode 100644 index 000000000..fc5ccc9a1 --- /dev/null +++ b/src/main/java/noppes/npcs/scripted/ScriptEvent.java @@ -0,0 +1,14 @@ +package noppes.npcs.scripted; + +public +class ScriptEvent{ + private boolean isCancelled = false; + + public void setCancelled(boolean bo){ + isCancelled = bo; + } + + public boolean isCancelled(){ + return isCancelled; + } +} diff --git a/src/main/java/noppes/npcs/scripted/ScriptEventAttack.java b/src/main/java/noppes/npcs/scripted/ScriptEventAttack.java new file mode 100644 index 000000000..218b6e681 --- /dev/null +++ b/src/main/java/noppes/npcs/scripted/ScriptEventAttack.java @@ -0,0 +1,48 @@ +package noppes.npcs.scripted; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.DamageSource; +import noppes.npcs.controllers.ScriptController; + +public class ScriptEventAttack extends ScriptEvent{ + + private float damage; + private ScriptLivingBase target; + private boolean isRanged; + + public ScriptEventAttack(float damage, EntityLivingBase target, boolean isRanged){ + this.damage = damage; + this.isRanged = isRanged; + this.target = (ScriptLivingBase)ScriptController.Instance.getScriptForEntity(target); + } + + /** + * @return The source of the damage + * @deprecated + */ + public ScriptLivingBase getTarget(){ + return target; + } + + + /** + * @return Returns the damage value + */ + public float getDamage(){ + return damage; + } + + /** + * @param damage The new damage value + */ + public void setDamage(float damage){ + this.damage = damage; + } + + /** + * @return Returns the damage type + */ + public boolean isRange(){ + return isRanged; + } +} diff --git a/src/main/java/noppes/npcs/scripted/ScriptEventDamaged.java b/src/main/java/noppes/npcs/scripted/ScriptEventDamaged.java new file mode 100644 index 000000000..27cf4a26f --- /dev/null +++ b/src/main/java/noppes/npcs/scripted/ScriptEventDamaged.java @@ -0,0 +1,55 @@ +package noppes.npcs.scripted; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.DamageSource; +import noppes.npcs.controllers.ScriptController; + +public class ScriptEventDamaged extends ScriptEvent{ + + private float damage; + private boolean clear = false; + private ScriptLivingBase source; + private DamageSource damagesource; + + public ScriptEventDamaged(float damage, EntityLivingBase attackingEntity, DamageSource damagesource){ + this.damage = damage; + this.damagesource = damagesource; + this.source = (ScriptLivingBase)ScriptController.Instance.getScriptForEntity(attackingEntity); + } + + /** + * @return The source of the damage + */ + public ScriptLivingBase getSource(){ + return source; + } + + public void setClearTarget(boolean bo){ + this.clear = bo; + } + + public boolean getClearTarget(){ + return clear; + } + + /** + * @return Returns the damage value + */ + public float getDamage(){ + return damage; + } + + /** + * @param damage The new damage value + */ + public void setDamage(float damage){ + this.damage = damage; + } + + /** + * @return Returns the damage type + */ + public String getType(){ + return damagesource.damageType; + } +} diff --git a/src/main/java/noppes/npcs/scripted/ScriptEventDialog.java b/src/main/java/noppes/npcs/scripted/ScriptEventDialog.java new file mode 100644 index 000000000..861faa27e --- /dev/null +++ b/src/main/java/noppes/npcs/scripted/ScriptEventDialog.java @@ -0,0 +1,15 @@ +package noppes.npcs.scripted; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.DamageSource; +import noppes.npcs.controllers.ScriptController; + +public class ScriptEventDialog extends ScriptEvent{ + + /** + * @deprecated + */ + public boolean isClosing(){ + return true; + } +} diff --git a/src/main/java/noppes/npcs/scripted/ScriptEventKilled.java b/src/main/java/noppes/npcs/scripted/ScriptEventKilled.java new file mode 100644 index 000000000..37c7e202f --- /dev/null +++ b/src/main/java/noppes/npcs/scripted/ScriptEventKilled.java @@ -0,0 +1,30 @@ +package noppes.npcs.scripted; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.DamageSource; +import noppes.npcs.controllers.ScriptController; + +public class ScriptEventKilled extends ScriptEvent{ + + private ScriptLivingBase source; + private DamageSource damagesource; + + public ScriptEventKilled(EntityLivingBase target, DamageSource damagesource){ + this.damagesource = damagesource; + this.source = (ScriptLivingBase)ScriptController.Instance.getScriptForEntity(target); + } + + /** + * @return The source of the damage + */ + public ScriptLivingBase getSource(){ + return source; + } + + /** + * @return Returns the damage type + */ + public String getType(){ + return damagesource.damageType; + } +} diff --git a/src/main/java/noppes/npcs/scripted/ScriptEventTarget.java b/src/main/java/noppes/npcs/scripted/ScriptEventTarget.java new file mode 100644 index 000000000..9fa1f28d3 --- /dev/null +++ b/src/main/java/noppes/npcs/scripted/ScriptEventTarget.java @@ -0,0 +1,27 @@ +package noppes.npcs.scripted; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.DamageSource; +import noppes.npcs.controllers.ScriptController; + +public class ScriptEventTarget extends ScriptEvent{ + + private ScriptLivingBase target; + + public ScriptEventTarget(EntityLivingBase target){ + if(target != null) + this.target = (ScriptLivingBase)ScriptController.Instance.getScriptForEntity(target); + } + + + /** + * @return The source of the damage + */ + public ScriptLivingBase getTarget(){ + return target; + } + + public void setTarget(ScriptLivingBase target){ + this.target = target; + } +} diff --git a/src/main/java/noppes/npcs/scripted/ScriptFaction.java b/src/main/java/noppes/npcs/scripted/ScriptFaction.java new file mode 100644 index 000000000..003c08dba --- /dev/null +++ b/src/main/java/noppes/npcs/scripted/ScriptFaction.java @@ -0,0 +1,49 @@ +package noppes.npcs.scripted; + +import noppes.npcs.controllers.Faction; + +public class ScriptFaction { + private Faction faction; + + public ScriptFaction(Faction faction){ + this.faction = faction; + } + + /** + * @return Returns the factions id + */ + public int getId(){ + return faction.id; + } + + /** + * @return Return the factions name + */ + public String getName(){ + return faction.name; + } + + public int getDefaultPoints(){ + return faction.defaultPoints; + } + + public int getColor(){ + return faction.color; + } + + public boolean isFriendlyToPlayer(ScriptPlayer player){ + return faction.isFriendlyToPlayer(player.player); + } + + public boolean isNeutralToPlayer(ScriptPlayer player){ + return faction.isNeutralToPlayer(player.player); + } + + public boolean isAggressiveToPlayer(ScriptPlayer player){ + return faction.isAggressiveToPlayer(player.player); + } + + public boolean isAggressiveToNpc(ScriptNpc npc){ + return faction.isAggressiveToNpc(npc.npc); + } +} diff --git a/src/main/java/noppes/npcs/scripted/ScriptItemStack.java b/src/main/java/noppes/npcs/scripted/ScriptItemStack.java new file mode 100644 index 000000000..5be275499 --- /dev/null +++ b/src/main/java/noppes/npcs/scripted/ScriptItemStack.java @@ -0,0 +1,209 @@ +package noppes.npcs.scripted; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTBase.NBTPrimitive; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.nbt.NBTTagString; + +public class ScriptItemStack { + protected ItemStack item; + + public ScriptItemStack(ItemStack item){ + this.item = item; + } + + /** + * @return The minecraft name for this item + */ + public String getName(){ + return Item.itemRegistry.getNameForObject(item.getItem()); + } + + /** + * @return Returns the stacksize + */ + public int getStackSize(){ + return item.stackSize; + } + + /** + * @return Return whether or not the item has a custom name + */ + public boolean hasCustomName(){ + return item.hasDisplayName(); + } + + /** + * @param name The custom name this item will get + */ + public void setCustomName(String name){ + item.setStackDisplayName(name); + } + + /** + * @return Return the ingame displayed name. This is either the item name or the custom name if it has one. + */ + public String getDisplayName(){ + return item.getDisplayName(); + } + + /** + * @return Get the items ingame name. Use this incase the item ingame has custom name and you want the original name. + */ + public String getItemName(){ + return item.getItem().getItemStackDisplayName(item); + } + + /** + * @param size The size of the itemstack. A number between 1 and 64 + */ + public void setStackSize(int size){ + if(size < 0) + size = 1; + else if(size > 64) + size = 64; + item.stackSize = size; + } + + /** + * @return Returns the item damage of this item. For tools this is the durability for other items the color and more. + */ + public int getItemDamage(){ + return item.getItemDamage(); + } + + /** + * @param value The value to be set as item damage. For tools this is the durability for other items the color and more. + */ + public void setItemDamage(int value){ + item.setItemDamage(value); + } + + /** + * @param key The key of this NBTTag + * @param value The value to be stored. Can be a Number or String + */ + public void setTag(String key, Object value){ + if(value instanceof Number) + getTag().setDouble(key, ((Number) value).doubleValue()); + else if(value instanceof String) + getTag().setString(key, (String) value); + + } + + /** + * @param key The key of the NBTTag + * @return Returns whether or not the key exists + */ + public boolean hasTag(String key){ + return getTag().hasKey(key); + } + + /** + * @param key The key of the NBTTag + * @return Returns the value associated with the key. Returns null of it doesnt exist + */ + public Object getTag(String key){ + NBTBase tag = getTag().getTag(key); + if(tag == null) + return null; + if(tag instanceof NBTPrimitive) + return ((NBTPrimitive)tag).func_150286_g(); + if(tag instanceof NBTTagString) + return ((NBTTagString)tag).func_150285_a_(); + return tag; + } + + public boolean isEnchanted(){ + return item.isItemEnchanted(); + } + + /** + * @since 1.7.10d + * @param id The enchantment id + * @return + */ + public boolean hasEnchant(int id){ + if(!isEnchanted()) + return false; + NBTTagList list = item.getEnchantmentTagList(); + for(int i = 0; i < list.tagCount(); i++){ + NBTTagCompound compound = list.getCompoundTagAt(i); + if(compound.getShort("id") == id) + return true; + } + return false; + } + + /** + * @since 1.7.10d + * @return Returns whether this item is a book + */ + public boolean isWrittenBook(){ + return item.getItem() == Items.written_book || item.getItem() == Items.writable_book; + } + + /** + * @since 1.7.10d + * @return Returns the books title + */ + public String getBookTitle(){ + return item.getTagCompound().getString("title"); + } + + /** + * @since 1.7.10d + * @return Returns the books author + */ + public String getBookAuthor(){ + return item.getTagCompound().getString("author"); + } + + /** + * @since 1.7.10d + * @return If the item is a book, returns a string array with book pages + */ + public String[] getBookText(){ + if(!isWrittenBook()) + return null; + List list = new ArrayList(); + NBTTagList pages = item.getTagCompound().getTagList("pages", 8); + for (int i = 0; i < pages.tagCount(); ++i){ + list.add(pages.getStringTagAt(i)); + } + return list.toArray(new String[list.size()]); + } + + private NBTTagCompound getTag(){ + if(item.stackTagCompound == null) + item.stackTagCompound = new NBTTagCompound(); + return item.stackTagCompound; + } + + /** + * @return Returns whether or not this item is a block + */ + public boolean isBlock(){ + Block block = Block.getBlockFromItem(item.getItem()); + if(block == null || block == Blocks.air) + return false; + return true; + } + + /** + * No support is given for this method. Dont use if you dont know what you are doing. + * @return Minecraft ItemStack + */ + public ItemStack getMCItemStack() { + return item; + } +} diff --git a/src/main/java/noppes/npcs/scripted/ScriptLiving.java b/src/main/java/noppes/npcs/scripted/ScriptLiving.java new file mode 100644 index 000000000..2809ebc24 --- /dev/null +++ b/src/main/java/noppes/npcs/scripted/ScriptLiving.java @@ -0,0 +1,68 @@ +package noppes.npcs.scripted; + +import net.minecraft.entity.NPCEntityHelper; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import noppes.npcs.controllers.ScriptController; +import noppes.npcs.scripted.constants.EntityType; + +public class ScriptLiving extends ScriptLivingBase{ + + private EntityLiving entity; + public ScriptLiving(EntityLiving entity) { + super(entity); + this.entity = entity; + } + + @Override + public boolean isAttacking(){ + return super.isAttacking() || entity.getAttackTarget() != null; + } + + @Override + public void setAttackTarget(ScriptLivingBase living){ + if(living == null) + entity.setAttackTarget(null); + else + entity.setAttackTarget(living.entity); + super.setAttackTarget(living); + } + + @Override + public ScriptLivingBase getAttackTarget(){ + ScriptLivingBase base = (ScriptLivingBase)ScriptController.Instance.getScriptForEntity(entity.getAttackTarget()); + return (base != null)? base: super.getAttackTarget(); + } + + /** + * Start path finding toward this target + * @param x Destination x position + * @param y Destination x position + * @param z Destination x position + * @param speed Walking speed of the entity 0.7 is default + */ + public void navigateTo(double x, double y, double z, double speed){ + entity.getNavigator().tryMoveToXYZ(x, y, z, speed); + } + + /** + * Stop navigating wherever this npc was walking to + */ + public void clearNavigation(){ + entity.getNavigator().clearPathEntity(); + } + + /** + * @return Whether or not this entity is navigating somewhere + */ + public boolean isNavigating(){ + return !entity.getNavigator().noPath(); + } + + @Override + public boolean canSeeEntity(ScriptEntity entity){ + return this.entity.getEntitySenses().canSee(entity.entity); + } +} diff --git a/src/main/java/noppes/npcs/scripted/ScriptLivingBase.java b/src/main/java/noppes/npcs/scripted/ScriptLivingBase.java new file mode 100644 index 000000000..070433b6f --- /dev/null +++ b/src/main/java/noppes/npcs/scripted/ScriptLivingBase.java @@ -0,0 +1,201 @@ +package noppes.npcs.scripted; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.minecraft.block.material.Material; +import net.minecraft.entity.EntityList; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTBase.NBTPrimitive; +import net.minecraft.nbt.NBTTagString; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.MathHelper; +import noppes.npcs.controllers.ScriptController; +import noppes.npcs.scripted.constants.EntityType; + +public class ScriptLivingBase extends ScriptEntity{ + protected EntityLivingBase entity; + + public ScriptLivingBase(EntityLivingBase entity){ + super(entity); + this.entity = entity; + } + + /** + * @return The entity's current health + */ + public float getHealth(){ + return entity.getHealth(); + } + + /** + * @param health The new health of this entity + */ + public void setHealth(float health){ + entity.setHealth(health); + } + + /** + * @return Entity's max health + */ + public float getMaxHealth(){ + return entity.getMaxHealth(); + } + /** + * @return Whether or not this entity is attacking something + */ + public boolean isAttacking(){ + return entity.getAITarget() != null; + } + + /** + * @param living Entity which this entity will attack + */ + public void setAttackTarget(ScriptLivingBase living){ + if(living == null) + entity.setRevengeTarget(null); + else + entity.setRevengeTarget(living.entity); + } + + /** + * @return The entity which this entity is attacking + */ + public ScriptLivingBase getAttackTarget(){ + return (ScriptLivingBase)ScriptController.Instance.getScriptForEntity(entity.getAITarget()); + } + + @Override + public int getType(){ + return EntityType.LIVING; + } + + + @Override + public boolean typeOf(int type){ + return type == EntityType.LIVING?true:super.typeOf(type); + } + /** + * @param entity Entity to check + * @return Whether or not this entity can see the given entity + */ + public boolean canSeeEntity(ScriptEntity entity){ + return this.entity.canEntityBeSeen(entity.entity); + } + + /** + * Expert use only + * @return Returns the minecraft entity object + */ + public EntityLivingBase getMinecraftEntity(){ + return entity; + } + + /** + * Makes the entity swing its hand + */ + public void swingHand(){ + entity.swingItem(); + } + + /** + * Works the same as the /effect command + * @param effect + * @param duration The duration in seconds + * @param strength The amplifier of the potion effect + * @param hideParticles Whether or not you want to hide potion particles + */ + public void addPotionEffect(int effect, int duration, int strength, boolean hideParticles){ + if (effect < 0 || effect >= Potion.potionTypes.length || Potion.potionTypes[effect] == null) + return; + + if(strength < 0) + strength = 0; + else if(strength > 255) + strength = 255; + + if(duration < 0) + duration = 0; + else if(duration > 1000000) + duration = 1000000; + + if(!Potion.potionTypes[effect].isInstant()) + duration *= 20; + + if(duration == 0) + entity.removePotionEffect(effect); + else + entity.addPotionEffect(new PotionEffect(effect, duration, strength)); + //TODO in 1.8 add hideParticles option + } + + /** + * Clears all potion effects + */ + public void clearPotionEffects(){ + entity.clearActivePotions(); + } + + /** + * @since 1.7.10c + * @param effect Potion effect to check + * @return Returns -1 if its not active. Otherwise returns the strenght of the potion + */ + public int getPotionEffect(int effect){ + PotionEffect pf = entity.getActivePotionEffect(Potion.potionTypes[effect]); + if(pf == null) + return -1; + return pf.getAmplifier(); + } + + /** + * Note not all Living Entities support this + * @since 1.7.10c + * @return The item the entity is holding + */ + public ScriptItemStack getHeldItem(){ + ItemStack item = entity.getHeldItem(); + if(item == null) + return null; + return new ScriptItemStack(item); + } + + /** + * Note not all Living Entities support this + * @since 1.7.10c + * @param item The item to be set + */ + public void setHeldItem(ScriptItemStack item){ + entity.setCurrentItemOrArmor(0, item == null?null:item.item); + } + + /** + * Note not all Living Entities support this + * @param slot Slot of what armor piece to get, 0:boots, 1:pants, 2:body, 3:head + * @return The item in the given slot + */ + public ScriptItemStack getArmor(int slot){ + ItemStack item = entity.getEquipmentInSlot(slot + 1); + if(item == null) + return null; + return new ScriptItemStack(item); + } + + /** + * Note not all Living Entities support this + * @since 1.7.10c + * @param slot Slot of what armor piece to set, 0:boots, 1:pants, 2:body, 3:head + * @param item Item to be set + */ + public void setArmor(int slot, ScriptItemStack item){ + entity.setCurrentItemOrArmor(slot + 1, item == null?null:item.item); + } +} diff --git a/src/main/java/noppes/npcs/scripted/ScriptMonster.java b/src/main/java/noppes/npcs/scripted/ScriptMonster.java new file mode 100644 index 000000000..12f504a66 --- /dev/null +++ b/src/main/java/noppes/npcs/scripted/ScriptMonster.java @@ -0,0 +1,23 @@ +package noppes.npcs.scripted; + +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.monster.EntityMob; +import noppes.npcs.scripted.constants.EntityType; + +public class ScriptMonster extends ScriptLiving{ + + public ScriptMonster(EntityMob entity) { + super(entity); + } + + @Override + public int getType(){ + return EntityType.MONSTER; + } + + @Override + public boolean typeOf(int type){ + return type == EntityType.MONSTER?true:super.typeOf(type); + } + +} diff --git a/src/main/java/noppes/npcs/scripted/ScriptNpc.java b/src/main/java/noppes/npcs/scripted/ScriptNpc.java new file mode 100644 index 000000000..1a07d2f77 --- /dev/null +++ b/src/main/java/noppes/npcs/scripted/ScriptNpc.java @@ -0,0 +1,663 @@ +package noppes.npcs.scripted; + +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.MathHelper; +import noppes.npcs.NoppesUtilServer; +import noppes.npcs.constants.EnumAnimation; +import noppes.npcs.constants.EnumJobType; +import noppes.npcs.constants.EnumRoleType; +import noppes.npcs.controllers.Line; +import noppes.npcs.entity.EntityCustomNpc; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.JobBard; +import noppes.npcs.scripted.constants.AnimationType; +import noppes.npcs.scripted.constants.EntityType; +import noppes.npcs.scripted.roles.ScriptJobBard; +import noppes.npcs.scripted.roles.ScriptJobConversation; +import noppes.npcs.scripted.roles.ScriptJobFollower; +import noppes.npcs.scripted.roles.ScriptJobGuard; +import noppes.npcs.scripted.roles.ScriptJobHealer; +import noppes.npcs.scripted.roles.ScriptJobInterface; +import noppes.npcs.scripted.roles.ScriptJobItemGiver; +import noppes.npcs.scripted.roles.ScriptJobPuppet; +import noppes.npcs.scripted.roles.ScriptJobSpawner; +import noppes.npcs.scripted.roles.ScriptRoleBank; +import noppes.npcs.scripted.roles.ScriptRoleFollower; +import noppes.npcs.scripted.roles.ScriptRoleInterface; +import noppes.npcs.scripted.roles.ScriptRoleMailman; +import noppes.npcs.scripted.roles.ScriptRoleTrader; +import noppes.npcs.scripted.roles.ScriptRoleTransporter; +import noppes.npcs.util.ValueUtil; + +public class ScriptNpc extends ScriptLiving{ + protected EntityCustomNpc npc; + + public ScriptNpc(EntityCustomNpc npc){ + super(npc); + this.npc = npc; + } + + /** + * @return Returns the current npcs size 1-30 + */ + public int getSize(){ + return npc.display.modelSize; + } + + /** + * @param size The size of the npc (1-30) default is 5 + */ + public void setSize(int size){ + if(size > 30) + size = 30; + else if(size < 1) + size = 1; + npc.display.modelSize = size; + npc.script.clientNeedsUpdate = true; + } + + /** + * @return The npcs name + */ + public String getName(){ + return npc.display.name; + } + + public void setRotation(float rotation){ + npc.ai.orientation = (int)rotation; + super.setRotation(rotation); + } + /** + * @param name The name of the npc + */ + public void setName(String name){ + npc.display.name = name; + npc.script.clientNeedsUpdate = true; + } + + /** + * @since 1.7.10 + * @return The npcs title + */ + public String getTitle(){ + return npc.display.title; + } + + /** + * @since 1.7.10 + * @param title The title of the npc + */ + public void setTitle(String title){ + npc.display.title = title; + npc.script.clientNeedsUpdate = true; + } + + /** + * @return The npcs texture + */ + public String getTexture(){ + return npc.display.texture; + } + + /** + * @param texture The texture of the npc + */ + public void setTexture(String texture){ + npc.display.texture = texture; + npc.script.clientNeedsUpdate = true; + } + + /** + * @return Home position x + */ + public int getHomeX(){ + return npc.getStartPos()[0]; + } + + /** + * @param x The home x position + */ + public void setHomeX(int x){ + npc.ai.startPos[0] = x; + } + + /** + * @return Home position x + */ + public int getHomeY(){ + return npc.getStartPos()[1]; + } + + /** + * @param y The home y position + */ + public void setHomeY(int y){ + npc.ai.startPos[1] = y; + } + + /** + * @return Home position x + */ + public int getHomeZ(){ + return npc.getStartPos()[2]; + } + + /** + * @param z The home x position + */ + public void setHomeZ(int z){ + npc.ai.startPos[2] = z; + } + + /** + * @param x The home x position + * @param y The home y position + * @param z The home z position + */ + public void setHome(int x, int y, int z){ + npc.ai.startPos = new int[]{x, y, z}; + } + /** + * @param health New max health + */ + public void setMaxHealth(int health){ + npc.stats.setMaxHealth(health); + npc.script.clientNeedsUpdate = true; + } + + /** + * @param bo Whether or not the npc will try to return to his home position + */ + public void setReturnToHome(boolean bo){ + npc.ai.returnToStart = bo; + } + + /** + * @return Whether or not the npc returns home + */ + public boolean getReturnToHome(){ + return npc.ai.returnToStart; + } + + /** + * @return The faction of the npc + */ + public ScriptFaction getFaction(){ + return new ScriptFaction(npc.getFaction()); + } + + /** + * @param id The id of the new faction + */ + public void setFaction(int id){ + npc.setFaction(id); + } + + @Override + public int getType(){ + return EntityType.NPC; + } + + @Override + public boolean typeOf(int type){ + return type == EntityType.NPC?true:super.typeOf(type); + } + + /** + * @param target The targeted npc + * @param item The item you want to shoot + * @param accuracy Accuracy of the shot (0-100) + */ + public void shootItem(ScriptLivingBase target, ScriptItemStack item, int accuracy){ + if(item == null) + return; + if(accuracy < 0) + accuracy = 0; + else if(accuracy > 100) + accuracy = 100; + npc.shoot(target.entity, accuracy, item.item, false); + } + + /** + * @param message The message the npc will say + */ + public void say(String message){ + npc.saySurrounding(new Line(message)); + } + + /** + * @param message The message the npc will say + */ + public void say(ScriptPlayer player, String message){ + if(player == null || message == null || message.isEmpty()) + return; + npc.say(player.player, new Line(message)); + } + + /** + * Kill the npc, doesnt't despawn it + */ + public void kill(){ + npc.setDead(); + } + + /** + * Basically completely resets the npc. This will also call the Init script + */ + public void reset(){ + npc.reset(); + } + + /** + * @return Returns the npcs current role + */ + public ScriptRoleInterface getRole(){ + if(npc.advanced.role == EnumRoleType.Bank) + return new ScriptRoleBank(npc); + else if(npc.advanced.role == EnumRoleType.Follower) + return new ScriptRoleFollower(npc); + else if(npc.advanced.role == EnumRoleType.Postman) + return new ScriptRoleMailman(npc); + else if(npc.advanced.role == EnumRoleType.Trader) + return new ScriptRoleTrader(npc); + else if(npc.advanced.role == EnumRoleType.Transporter) + return new ScriptRoleTransporter(npc); + return new ScriptRoleInterface(npc); + } + + /** + * @return Returns the npcs current job + */ + public ScriptJobInterface getJob(){ + if(npc.advanced.job == EnumJobType.Bard) + return new ScriptJobBard(npc); + else if(npc.advanced.job == EnumJobType.Conversation) + return new ScriptJobConversation(npc); + else if(npc.advanced.job == EnumJobType.Follower) + return new ScriptJobFollower(npc); + else if(npc.advanced.job == EnumJobType.Guard) + return new ScriptJobGuard(npc); + else if(npc.advanced.job == EnumJobType.Healer) + return new ScriptJobHealer(npc); + else if(npc.advanced.job == EnumJobType.Puppet) + return new ScriptJobPuppet(npc); + else if(npc.advanced.job == EnumJobType.ItemGiver) + return new ScriptJobItemGiver(npc); + else if(npc.advanced.job == EnumJobType.Spawner) + return new ScriptJobSpawner(npc); + return new ScriptJobInterface(npc); + } + + /** + * @return The item held in the right hand + */ + public ScriptItemStack getRightItem(){ + ItemStack item = npc.inventory.getWeapon(); + if(item == null || item.getItem() == null) + return null; + return new ScriptItemStack(item); + } + + /** + * @param item Item to be held in the right hand + */ + public void setRightItem(ScriptItemStack item){ + if(item == null) + npc.inventory.setWeapon(null); + else + npc.inventory.setWeapon(item.item); + npc.script.clientNeedsUpdate = true; + } + + /** + * @return The item held in the left hand + */ + public ScriptItemStack getLefttItem(){ + ItemStack item = npc.getOffHand(); + if(item == null || item.getItem() == null) + return null; + return new ScriptItemStack(item); + } + + /** + * @param item Item to be held in the left hand + */ + public void setLeftItem(ScriptItemStack item){ + if(item == null) + npc.inventory.setOffHand(null); + else + npc.inventory.setOffHand(item.item); + npc.script.clientNeedsUpdate = true; + } + + /** + * @return Returns the projectile the npc uses + */ + public ScriptItemStack getProjectileItem(){ + ItemStack item = npc.inventory.getProjectile(); + if(item == null || item.getItem() == null) + return null; + return new ScriptItemStack(item); + } + + /** + * @param item Item to be used as projectile + */ + public void setProjectileItem(ScriptItemStack item){ + if(item == null) + npc.inventory.setProjectile(null); + else + npc.inventory.setProjectile(item.item); + npc.script.aiNeedsUpdate = true; + } + + /** + * @param slot The armor slot to return. 0:head, 1:body, 2:legs, 3:boots + * @return Returns the worn armor in slot + */ + @Override + public ScriptItemStack getArmor(int slot){ + ItemStack item = npc.inventory.armor.get(slot); + if(item == null) + return null; + return new ScriptItemStack(item); + } + + /** + * @param slot The armor slot to set. 0:head, 1:body, 2:legs, 3:boots + * @param item Item to be set as armor + */ + @Override + public void setArmor(int slot, ScriptItemStack item){ + if(item == null) + npc.inventory.armor.put(slot, null); + else + npc.inventory.armor.put(slot, item.item); + + npc.script.clientNeedsUpdate = true; + } + + /** + * @param type The AnimationType + */ + public void setAnimation(int type){ + if(type == AnimationType.NORMAL) + npc.ai.animationType = EnumAnimation.NONE; + else if(type == AnimationType.SITTING) + npc.ai.animationType = EnumAnimation.SITTING; + else if(type == AnimationType.DANCING) + npc.ai.animationType = EnumAnimation.DANCING; + else if(type == AnimationType.SNEAKING) + npc.ai.animationType = EnumAnimation.SNEAKING; + else if(type == AnimationType.LYING) + npc.ai.animationType = EnumAnimation.LYING; + else if(type == AnimationType.HUGGING) + npc.ai.animationType = EnumAnimation.HUG; + + } + + /** + * @param type The visibility type of the npc, 0:visible, 1:invisible, 2:semi-visible + */ + public void setVisibleType(int type){ + npc.display.visible = type; + npc.script.clientNeedsUpdate = true; + } + + /** + * @return The visibility type of the npc, 0:visible, 1:invisible, 2:semi-visible + */ + public int getVisibleType(){ + return npc.display.visible; + } + + /** + * @param type The visibility type of the name, 0:visible, 1:invisible, 2:when-attacking + */ + public void setShowName(int type){ + npc.display.showName = type; + npc.script.clientNeedsUpdate = true; + } + + /** + * @return Returns the visibility type of the name, 0:visible, 1:invisible, 2:when-attacking + */ + public int getShowName(){ + return npc.display.showName; + } + + /** + * @return Returns the visiblity of the boss bar, 0:invisible, 1:visible, 2:when-attacking + */ + public int getShowBossBar(){ + return npc.display.showBossBar; + } + + /** + * @param type The visibility type of the boss bar, 0:invisible, 1:visible, 2:when-attacking + */ + public void setShowBossBar(int type){ + npc.display.showBossBar = (byte) type; + npc.script.clientNeedsUpdate = true; + } + + /** + * @return The melee strength + */ + public int getMeleeStrength(){ + return npc.stats.getAttackStrength(); + } + + /** + * @param strength The melee strength + */ + public void setMeleeStrength(int strength){ + npc.stats.setAttackStrength(strength); + } + + /** + * @return The melee speed + */ + public int getMeleeSpeed(){ + return npc.stats.attackSpeed; + } + + /** + * @param speed The melee speed + */ + public void setMeleeSpeed(int speed){ + npc.stats.attackSpeed = speed; + } + + /** + * @return The ranged strength + */ + public int getRangedStrength(){ + return npc.stats.pDamage; + } + + /** + * @param strength The ranged strength + */ + public void setRangedStrength(int strength){ + npc.stats.pDamage = strength; + } + + /** + * @return The ranged speed + */ + public int getRangedSpeed(){ + return npc.stats.pSpeed; + } + + /** + * @param speed The ranged speed + */ + public void setRangedSpeed(int speed){ + npc.stats.pSpeed = speed; + } + + /** + * @return The ranged burst count + */ + public int getRangedBurst(){ + return npc.stats.burstCount; + } + + /** + * @param count The ranged burst count + */ + public void setRangedBurst(int count){ + npc.stats.burstCount = count; + } + + /** + * @param player The player to give the item to + * @param item The item given to the player + */ + public void giveItem(ScriptPlayer player, ScriptItemStack item){ + npc.givePlayerItem(player.player, item.item); + } + + + /** + * On servers the enable-command-block option in the server.properties needs to be set to true + * @param command The command to be executed + */ + public void executeCommand(String command){ + NoppesUtilServer.runCommand(npc, npc.getCommandSenderName(), command, null); + } + + public void setHeadScale(float x, float y, float z){ + npc.modelData.head.scaleX = ValueUtil.correctFloat(x, 0.5f, 1.5f); + npc.modelData.head.scaleY = ValueUtil.correctFloat(y, 0.5f, 1.5f); + npc.modelData.head.scaleZ = ValueUtil.correctFloat(z, 0.5f, 1.5f); + + npc.script.clientNeedsUpdate = true; + } + + public void setBodyScale(float x, float y, float z){ + npc.modelData.body.scaleX = ValueUtil.correctFloat(x, 0.5f, 1.5f); + npc.modelData.body.scaleY = ValueUtil.correctFloat(y, 0.5f, 1.5f); + npc.modelData.body.scaleZ = ValueUtil.correctFloat(z, 0.5f, 1.5f); + + npc.script.clientNeedsUpdate = true; + } + + public void setArmsScale(float x, float y, float z){ + npc.modelData.arms.scaleX = ValueUtil.correctFloat(x, 0.5f, 1.5f); + npc.modelData.arms.scaleY = ValueUtil.correctFloat(y, 0.5f, 1.5f); + npc.modelData.arms.scaleZ = ValueUtil.correctFloat(z, 0.5f, 1.5f); + + npc.script.clientNeedsUpdate = true; + } + + public void setLegsScale(float x, float y, float z){ + npc.modelData.legs.scaleX = ValueUtil.correctFloat(x, 0.5f, 1.5f); + npc.modelData.legs.scaleY = ValueUtil.correctFloat(y, 0.5f, 1.5f); + npc.modelData.legs.scaleZ = ValueUtil.correctFloat(z, 0.5f, 1.5f); + + npc.script.clientNeedsUpdate = true; + } + + /** + * @since 1.7.10c + * @param resistance Explosion resistance (0-2) default is 1 + */ + public void seExplosionResistance(float resistance){ + npc.stats.resistances.explosion = ValueUtil.correctFloat(resistance, 0, 2); + } + + /** + * @since 1.7.10c + * @return Returns Explosion Resistance + */ + public float getExplosionResistance(){ + return npc.stats.resistances.explosion; + } + + /** + * @param resistance Melee resistance (0-2) default is 1 + */ + public void setMeleeResistance(float resistance){ + npc.stats.resistances.playermelee = ValueUtil.correctFloat(resistance, 0, 2); + } + + /** + * @return Returns Melee Resistance + */ + public float getMeleeResistance(){ + return npc.stats.resistances.playermelee; + } + + /** + * @param resistance Arrow resistance (0-2) default is 1 + */ + public void setArrowResistance(float resistance){ + npc.stats.resistances.arrow = ValueUtil.correctFloat(resistance, 0, 2); + } + + /** + * @return Returns Arrow Resistance + */ + public float getArrowResistance(){ + return npc.stats.resistances.arrow; + } + + /** + * @param resistance Knockback resistance (0-2) default is 1 + */ + public void setKnockbackResistance(float resistance){ + npc.stats.resistances.knockback = ValueUtil.correctFloat(resistance, 0, 2); + } + + /** + * @return Returns Knockback Resistance + */ + public float getKnockbackResistance(){ + return npc.stats.resistances.knockback; + } + + /** + * @param type Retaliation type. 0:normal, 1:panic, 2:retreat, 3:nothing + */ + public void setRetaliateType(int type){ + npc.ai.onAttack = type; + npc.setResponse(); + } + + /** + * @return Returns the combat health regen per second + */ + public int getCombatRegen(){ + return npc.stats.combatRegen; + } + + /** + * @param regen The combat health regen per second + */ + public void setCombatRegen(int regen){ + npc.stats.combatRegen = regen; + } + + /** + * @return Returns the health regen per second when not in combat + */ + public int getHealthRegen(){ + return npc.stats.healthRegen; + } + + /** + * @param regen The health regen per second when not in combat + */ + public void setHealthRegen(int regen){ + npc.stats.healthRegen = regen; + } + + @Override + public long getAge(){ + return npc.totalTicksAlive; + } +} diff --git a/src/main/java/noppes/npcs/scripted/ScriptPixelmon.java b/src/main/java/noppes/npcs/scripted/ScriptPixelmon.java new file mode 100644 index 000000000..f3d1ef628 --- /dev/null +++ b/src/main/java/noppes/npcs/scripted/ScriptPixelmon.java @@ -0,0 +1,263 @@ +package noppes.npcs.scripted; + +import net.minecraft.entity.passive.EntityAnimal; +import net.minecraft.entity.passive.EntityTameable; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.controllers.PixelmonHelper; +import noppes.npcs.util.ValueUtil; + +public class ScriptPixelmon extends ScriptAnimal{ + private EntityTameable pixelmon; + private NBTTagCompound compound = null; + public ScriptPixelmon(EntityTameable pixelmon){ + super(pixelmon); + this.pixelmon = pixelmon; + compound = new NBTTagCompound(); + pixelmon.writeEntityToNBT(compound); + } + public ScriptPixelmon(EntityTameable pixelmon, NBTTagCompound compound){ + this(pixelmon); + this.compound = compound; + } + + public boolean getIsShiny(){ + return compound.getBoolean("IsShiny"); + } + + public void setIsShiny(boolean bo){ + compound.setBoolean("IsShiny", bo); + pixelmon.readEntityFromNBT(compound); + } + + public int getLevel(){ + return compound.getInteger("Level"); + } + + public void setLevel(int level){ + compound.setInteger("Level", level); + pixelmon.readEntityFromNBT(compound); + } + + /** + * @param type 0:HP, 1:Attack, 2:Defense, 3:SpAttack, 4:SpDefense, 5:Speed + */ + public int getIV(int type){ + if(type == 0) + return compound.getInteger("IVHP"); + if(type == 1) + return compound.getInteger("IVAttack"); + if(type == 2) + return compound.getInteger("IVDefence"); + if(type == 3) + return compound.getInteger("IVSpAtt"); + if(type == 4) + return compound.getInteger("IVSpDef"); + if(type == 5) + return compound.getInteger("IVSpeed"); + + return -1; + } + + + /** + * @param type 0:HP, 1:Attack, 2:Defense, 3:SpAttack, 4:SpDefense, 5:Speed + */ + public void setIV(int type, int value){ + if(type == 0) + compound.setInteger("IVHP", value); + else if(type == 1) + compound.setInteger("IVAttack", value); + else if(type == 2) + compound.setInteger("IVDefence", value); + else if(type == 3) + compound.setInteger("IVSpAtt", value); + else if(type == 4) + compound.setInteger("IVSpDef", value); + else if(type == 5) + compound.setInteger("IVSpeed", value); + pixelmon.readEntityFromNBT(compound); + } + + /** + * @param type 0:HP, 1:Attack, 2:Defense, 3:SpAttack, 4:SpDefense, 5:Speed + */ + public int getEV(int type){ + if(type == 0) + return compound.getInteger("EVHP"); + if(type == 1) + return compound.getInteger("EVAttack"); + if(type == 2) + return compound.getInteger("EVDefence"); + if(type == 3) + return compound.getInteger("EVSpecialAttack"); + if(type == 4) + return compound.getInteger("EVSpecialDefence"); + if(type == 5) + return compound.getInteger("EVSpeed"); + + return -1; + } + + + /** + * @param type 0:HP, 1:Attack, 2:Defense, 3:SpAttack, 4:SpDefense, 5:Speed + */ + public void setEV(int type, int value){ + if(type == 0) + compound.setInteger("EVHP", value); + else if(type == 1) + compound.setInteger("EVAttack", value); + else if(type == 2) + compound.setInteger("EVDefence", value); + else if(type == 3) + compound.setInteger("EVSpecialAttack", value); + else if(type == 4) + compound.setInteger("EVSpecialDefence", value); + else if(type == 5) + compound.setInteger("EVSpeed", value); + pixelmon.readEntityFromNBT(compound); + } + + /** + * @param type 0:HP, 1:Attack, 2:Defense, 3:SpAttack, 4:SpDefense, 5:Speed + */ + public int getStat(int type){ + if(type == 0) + return compound.getInteger("StatsHP"); + if(type == 1) + return compound.getInteger("StatsAttack"); + if(type == 2) + return compound.getInteger("StatsDefence"); + if(type == 3) + return compound.getInteger("StatsSpecialAttack"); + if(type == 4) + return compound.getInteger("StatsSpecialDefence"); + if(type == 5) + return compound.getInteger("StatsSpeed"); + + return -1; + } + + + /** + * @param type 0:HP, 1:Attack, 2:Defense, 3:SpAttack, 4:SpDefense, 5:Speed + */ + public void setStat(int type, int value){ + if(type == 0) + compound.setInteger("StatsHP", value); + else if(type == 1) + compound.setInteger("StatsAttack", value); + else if(type == 2) + compound.setInteger("StatsDefence", value); + else if(type == 3) + compound.setInteger("StatsSpecialAttack", value); + else if(type == 4) + compound.setInteger("StatsSpecialDefence", value); + else if(type == 5) + compound.setInteger("StatsSpeed", value); + pixelmon.readEntityFromNBT(compound); + } + + /** + * @return type 0:Pygmy, 1:Runt, 2:Small, 3:Normal, 4:Huge, 5:Giant, 6:Enormous, 7:Ginormous, 8:Microscopic + */ + public int getSize(){ + return compound.getShort("Growth"); + } + + /** + * @param type 0:Pygmy, 1:Runt, 2:Small, 3:Normal, 4:Huge, 5:Giant, 6:Enormous, 7:Ginormous, 8:Microscopic + */ + public void setSize(int type){ + compound.setShort("Growth", (short) type); + pixelmon.readEntityFromNBT(compound); + } + + /** + * @return 0-255 + */ + public int getHapiness(){ + return compound.getInteger("Friendship"); + } + + /** + * @param value 0-255 + */ + public void setHapiness(int value){ + value = ValueUtil.CorrectInt(value, 0, 255); + compound.setInteger("Friendship", value); + pixelmon.readEntityFromNBT(compound); + } + + /** + * @return 0:Hardy, 1:Serious, 2:Docile, 3:Bashful, 4:Quirky, 5:Lonely, 6:Brave, 7:Adamant, 8:Naughty, 9:Bold, 10:Relaxed, 11:Impish, 12:Lax, 13:Timid, 14:Hasty, 15:Jolly, 16:Naive, 17:Modest, 18:Mild, 19:Quiet, 20:Rash, 21:Calm, 22:Gentle, 23:Sassy, 24:Careful + */ + public int getNature(){ + return compound.getShort("Nature"); + } + + /** + * @param type 0:Hardy, 1:Serious, 2:Docile, 3:Bashful, 4:Quirky, 5:Lonely, 6:Brave, 7:Adamant, 8:Naughty, 9:Bold, 10:Relaxed, 11:Impish, 12:Lax, 13:Timid, 14:Hasty, 15:Jolly, 16:Naive, 17:Modest, 18:Mild, 19:Quiet, 20:Rash, 21:Calm, 22:Gentle, 23:Sassy, 24:Careful + */ + public void setNature(int type){ + compound.setShort("Nature", (short) type); + pixelmon.readEntityFromNBT(compound); + } + + /** + * @return -1:Uncaught, 0:Pokeball, 1:GreatBall, 2:UltraBall, 3:MasterBall, 4:LevelBall, 5:MoonBall, 6:FriendBall, 7:LoveBall, 8:SafariBall, 9:HeavyBall, 10:FastBall, 11:RepeatBall, 12:TimerBall, 13:NestBall, 14:NetBall, 15:DiveBall, 16:LuxuryBall, 17:HealBall, 18:DuskBall, 19:PremierBall, 20:SportBall, 21:QuickBall, 22:ParkBall, 23:LureBall, 24:CherishBall, 25:GSBall + */ + public int getPokeball(){ + if(compound.hasKey("CaughtBall")) + return -1; + return compound.getInteger("CaughtBall"); + } + + /** + * @param type -1:Uncaught, 0:Pokeball, 1:GreatBall, 2:UltraBall, 3:MasterBall, 4:LevelBall, 5:MoonBall, 6:FriendBall, 7:LoveBall, 8:SafariBall, 9:HeavyBall, 10:FastBall, 11:RepeatBall, 12:TimerBall, 13:NestBall, 14:NetBall, 15:DiveBall, 16:LuxuryBall, 17:HealBall, 18:DuskBall, 19:PremierBall, 20:SportBall, 21:QuickBall, 22:ParkBall, 23:LureBall, 24:CherishBall, 25:GSBall + */ + public void setPokeball(int type){ + compound.setInteger("CaughtBall", type); + pixelmon.readEntityFromNBT(compound); + } + + public String getNickname(){ + return compound.getString("Nickname"); + } + + public boolean hasNickname(){ + return !getNickname().isEmpty(); + } + + public void setNickname(String name){ + compound.setString("Nickname", name); + pixelmon.readEntityFromNBT(compound); + } + + public String getMove(int slot){ + if(!compound.hasKey("PixelmonMoveID" + slot)) + return null; + return PixelmonHelper.getAttackName(compound.getInteger("PixelmonMoveID" + slot)); + } + + public void setMove(int slot, String move){ + slot = ValueUtil.CorrectInt(slot, 0, 3); + int id = PixelmonHelper.getAttackID(move); + compound.removeTag("PixelmonMovePP" + slot); + compound.removeTag("PixelmonMovePPBase" + slot); + if(id < 0){ + compound.removeTag("PixelmonMoveID" + slot); + } + else{ + compound.setInteger("PixelmonMoveID" + slot, id); + } + int size = 0; + for(int i = 0; i < 4; i++){ + if(compound.hasKey("PixelmonMoveID" + i)) + size++; + } + compound.setInteger("PixelmonNumberMoves", size); + + pixelmon.readEntityFromNBT(compound); + } +} diff --git a/src/main/java/noppes/npcs/scripted/ScriptPixelmonPlayerData.java b/src/main/java/noppes/npcs/scripted/ScriptPixelmonPlayerData.java new file mode 100644 index 000000000..e44476362 --- /dev/null +++ b/src/main/java/noppes/npcs/scripted/ScriptPixelmonPlayerData.java @@ -0,0 +1,25 @@ +package noppes.npcs.scripted; + +import net.minecraft.entity.passive.EntityTameable; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.controllers.PixelmonHelper; + +public class ScriptPixelmonPlayerData { + private EntityPlayerMP player; + public ScriptPixelmonPlayerData(EntityPlayerMP player){ + this.player = player; + } + + public ScriptPixelmon getPartySlot(int slot){ + NBTTagCompound compound = PixelmonHelper.getPartySlot(slot, player); + if(compound == null) + return null; + EntityTameable pixelmon = PixelmonHelper.pixelmonFromNBT(compound, player); + return new ScriptPixelmon(pixelmon, compound); + } + + public int countPCPixelmon(){ + return PixelmonHelper.countPCPixelmon(player); + } +} diff --git a/src/main/java/noppes/npcs/scripted/ScriptPlayer.java b/src/main/java/noppes/npcs/scripted/ScriptPlayer.java new file mode 100644 index 000000000..19eb36dc6 --- /dev/null +++ b/src/main/java/noppes/npcs/scripted/ScriptPlayer.java @@ -0,0 +1,341 @@ +package noppes.npcs.scripted; + +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.stats.Achievement; +import net.minecraft.stats.StatBase; +import net.minecraft.stats.StatList; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.world.WorldSettings; +import noppes.npcs.CustomNpcsPermissions; +import noppes.npcs.NoppesStringUtils; +import noppes.npcs.NoppesUtilPlayer; +import noppes.npcs.Server; +import noppes.npcs.constants.EnumPacketClient; +import noppes.npcs.controllers.PixelmonHelper; +import noppes.npcs.controllers.PlayerData; +import noppes.npcs.controllers.PlayerDataController; +import noppes.npcs.controllers.PlayerDialogData; +import noppes.npcs.controllers.PlayerQuestData; +import noppes.npcs.controllers.Quest; +import noppes.npcs.controllers.QuestController; +import noppes.npcs.controllers.QuestData; +import noppes.npcs.scripted.constants.EntityType; +import noppes.npcs.util.ValueUtil; + +public class ScriptPlayer extends ScriptLivingBase{ + protected EntityPlayerMP player; + public ScriptPlayer(EntityPlayerMP player){ + super(player); + this.player = player; + } + + /** + * @return Returns the displayed name of the player + */ + public String getDisplayName(){ + return player.getDisplayName(); + } + + /** + * @return Returns the players name + */ + public String getName(){ + return player.getCommandSenderName(); + } + + @Override + public void setPosition(double x, double y, double z){ + NoppesUtilPlayer.teleportPlayer(player, x, y, z, player.dimension); + } + + public boolean hasFinishedQuest(int id){ + PlayerQuestData data = PlayerDataController.instance.getPlayerData(player).questData; + return data.finishedQuests.containsKey(id); + } + + public boolean hasActiveQuest(int id){ + PlayerQuestData data = PlayerDataController.instance.getPlayerData(player).questData; + return data.activeQuests.containsKey(id); + } + + public boolean hasReadDialog(int id){ + PlayerDialogData data = PlayerDataController.instance.getPlayerData(player).dialogData; + return data.dialogsRead.contains(id); + } + + /** + * Add the quest from active quest list + * @param id The Quest ID + */ + public void startQuest(int id){ + Quest quest = QuestController.instance.quests.get(id); + if (quest == null) + return; + PlayerData data = PlayerDataController.instance.getPlayerData(player); + if(data.questData.activeQuests.containsKey(id)) + return; + QuestData questdata = new QuestData(quest); + data.questData.activeQuests.put(id, questdata); + Server.sendData((EntityPlayerMP)player, EnumPacketClient.MESSAGE, "quest.newquest", quest.title); + Server.sendData((EntityPlayerMP)player, EnumPacketClient.CHAT, "quest.newquest", ": ", quest.title); + } + + /** + * Add the quest from finished quest list + * @param id The Quest ID + */ + public void finishQuest(int id){ + Quest quest = QuestController.instance.quests.get(id); + if (quest == null) + return; + PlayerData data = PlayerDataController.instance.getPlayerData(player); + data.questData.finishedQuests.put(id, System.currentTimeMillis()); + } + + /** + * Removes the quest from active quest list + * @param id The Quest ID + */ + public void stopQuest(int id){ + Quest quest = QuestController.instance.quests.get(id); + if (quest == null) + return; + PlayerData data = PlayerDataController.instance.getPlayerData(player); + data.questData.activeQuests.remove(id); + } + + /** + * Removes the quest from active and finished quest list + * @param id The Quest ID + */ + public void removeQuest(int id){ + Quest quest = QuestController.instance.quests.get(id); + if (quest == null) + return; + PlayerData data = PlayerDataController.instance.getPlayerData(player); + data.questData.activeQuests.remove(id); + data.questData.finishedQuests.remove(id); + } + + @Override + public int getType(){ + return EntityType.PLAYER; + } + + @Override + public boolean typeOf(int type){ + return type == EntityType.PLAYER?true:super.typeOf(type); + } + /** + * @param faction The faction id + * @param points The points to increase. Use negative values to decrease + */ + public void addFactionPoints(int faction, int points){ + PlayerData data = PlayerDataController.instance.getPlayerData(player); + data.factionData.increasePoints(faction, points); + } + + /** + * @param faction The faction id + * @return points + */ + public int getFactionPoints(int faction) { + PlayerData data = PlayerDataController.instance.getPlayerData(player); + return data.factionData.getFactionPoints(faction); + } + + /** + * @param message The message you want to send + */ + public void sendMessage(String message){ + player.addChatMessage(new ChatComponentTranslation(NoppesStringUtils.formatText(message,player))); + } + + /** + * @return Return gamemode. 0: Survival, 1: Creative, 2: Adventure + */ + public int getMode(){ + return player.theItemInWorldManager.getGameType().getID(); + } + + /** + * @param type The gamemode type. 0:SURVIVAL, 1:CREATIVE, 2:ADVENTURE + */ + public void setMode(int type){ + player.setGameType(WorldSettings.getGameTypeById(type)); + } + + /** + * @param item The item to be checked + * @return How many of this item the player has + */ + public int inventoryItemCount(ScriptItemStack item){ + int i = 0; + for(ItemStack is : player.inventory.mainInventory){ + if (is != null && is.isItemEqual(item.item)) + i += is.stackSize; + } + return i; + } + + /** + * @since 1.7.10d + * @return Returns a IItemStack array size 36 + */ + public ScriptItemStack[] getInventory(){ + ScriptItemStack[] items = new ScriptItemStack[36]; + for(int i = 0; i < player.inventory.mainInventory.length; i++){ + ItemStack item = player.inventory.mainInventory[i]; + if(item != null) + items[i] = new ScriptItemStack(item); + } + return items; + } + + /** + * @param item The Item type to be removed + * @param amount How many will be removed + * @return Returns true if the items were removed succesfully. Returns false incase a bigger amount than what the player has was given + */ + public boolean removeItem(ScriptItemStack item, int amount){ + int count = inventoryItemCount(item); + if(amount > count) + return false; + else if(count == amount) + removeAllItems(item); + else{ + for(int i = 0; i < player.inventory.mainInventory.length; i++){ + ItemStack is = player.inventory.mainInventory[i]; + if (is != null && is.isItemEqual(item.item)){ + if(amount > is.stackSize){ + player.inventory.mainInventory[i] = null; + amount -= is.stackSize; + } + else{ + is.splitStack(amount); + break; + } + } + } + } + return true; + } + + /** + * @since 1.7.10c + * @param id The items name + * @param damage The damage value + * @param amount How many will be removed + * @return Returns true if the items were removed succesfully. Returns false incase a bigger amount than what the player has was given or item doesnt exist + */ + public boolean removeItem(String id, int damage, int amount){ + Item item = (Item)Item.itemRegistry.getObject(id); + if(item == null) + return false; + return removeItem(new ScriptItemStack(new ItemStack(item, 1, damage)), amount); + } + + /** + * @since 1.7.10c + * @param item Item to be added + * @param amount The amount of the item to be added + * @return Returns whether or not it gave the item succesfully + */ + public boolean giveItem(ScriptItemStack item, int amount){ + String itemname = Item.itemRegistry.getNameForObject(item.getMCItemStack().getItem()); + return giveItem(itemname, item.getItemDamage(), amount); + } + + /** + * @since 1.7.10c + * @param id The items name + * @param damage The damage value + * @param amount The amount of the item to be added + * @return Returns whether or not it gave the item succesfully + */ + public boolean giveItem(String id, int damage, int amount){ + Item item = (Item)Item.itemRegistry.getObject(id); + if(item == null) + return false; + return player.inventory.addItemStackToInventory(new ItemStack(item, amount, damage)); + } + + /** + * Same as the /spawnpoint command + * @param x The x position + * @param y The y position + * @param z The z position + */ + public void setSpawnpoint(int x, int y, int z){ + x = ValueUtil.CorrectInt(x, -30000000, 30000000); + z = ValueUtil.CorrectInt(z, -30000000, 30000000); + y = ValueUtil.CorrectInt(y, 0, 256); + player.setSpawnChunk(new ChunkCoordinates(x, y, z), true); + } + + public void resetSpawnpoint(){ + player.setSpawnChunk(null, false); + } + + /** + * @param item The item to be removed from the players inventory + */ + public void removeAllItems(ScriptItemStack item){ + for(int i = 0; i < player.inventory.mainInventory.length; i++){ + ItemStack is = player.inventory.mainInventory[i]; + if (is != null && is.isItemEqual(item.item)) + player.inventory.mainInventory[i] = null; + } + } + + + /** + * @param achievement The achievement id. For a complete list see http://minecraft.gamepedia.com/Achievements + * @return Returns whether or not the player has this achievement + */ + public boolean hasAchievement(String achievement){ + StatBase statbase = StatList.func_151177_a(achievement); + if(statbase == null || !(statbase instanceof Achievement)){ + return false; + } + return player.func_147099_x().hasAchievementUnlocked((Achievement) statbase); + } + + /** + * @param permission Bukkit/Cauldron permission + * @return Returns whether or not the player has the permission + */ + public boolean hasBukkitPermission(String permission){ + return CustomNpcsPermissions.hasPermissionString(player, permission); + } + + /** + * @since 1.7.10c + * @return Returns the exp level + */ + public int getExpLevel(){ + return player.experienceLevel; + } + + /** + * @since 1.7.10c + * @param level The new exp level you want to set + */ + public void setExpLevel(int level){ + player.experienceLevel = level; + player.addExperienceLevel(0); + } + + /** + * Requires pixelmon to be installed + * @since 1.7.10d + */ + public ScriptPixelmonPlayerData getPixelmonData(){ + if(!PixelmonHelper.Enabled) + return null; + return new ScriptPixelmonPlayerData(player); + } +} diff --git a/src/main/java/noppes/npcs/scripted/ScriptScoreboard.java b/src/main/java/noppes/npcs/scripted/ScriptScoreboard.java new file mode 100644 index 000000000..603f88ec8 --- /dev/null +++ b/src/main/java/noppes/npcs/scripted/ScriptScoreboard.java @@ -0,0 +1,177 @@ +package noppes.npcs.scripted; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.scoreboard.IScoreObjectiveCriteria; +import net.minecraft.scoreboard.Score; +import net.minecraft.scoreboard.ScoreObjective; +import net.minecraft.scoreboard.ScorePlayerTeam; +import net.minecraft.scoreboard.Scoreboard; +import net.minecraft.server.MinecraftServer; + +/** + * @author Karel + */ +public class ScriptScoreboard { + private Scoreboard board; + + protected ScriptScoreboard(){ + board = MinecraftServer.getServer().worldServerForDimension(0).getScoreboard(); + } + + /** + * @return Returns an array with all ScoreboardObjectives + */ + public ScriptScoreboardObjective[] getObjectives(){ + List collection = new ArrayList(board.getScoreObjectives()); + ScriptScoreboardObjective[] objectives = new ScriptScoreboardObjective[collection.size()]; + for(int i = 0; i < collection.size(); i++){ + objectives[i] = new ScriptScoreboardObjective(collection.get(i)); + } + return objectives; + } + + /** + * @param name Name of the objective + * @return Returns the ScoreboardObjective + */ + public ScriptScoreboardObjective getObjective(String name){ + ScoreObjective obj = board.getObjective(name); + if(obj == null) + return null; + return new ScriptScoreboardObjective(obj); + } + + /** + * @param objective Objective to check + * @return Returns whether or not the objective exists + */ + public boolean hasObjective(String objective){ + return board.getObjective(objective) != null; + } + + /** + * @param objective Objective to remove + */ + public void removeObjective(String objective){ + ScoreObjective obj = board.getObjective(objective); + if(obj != null) + board.func_96519_k(obj); + } + + /** + * @version 1.8 + * @param objective Scoreboard objective name (1-16 chars) + * @param criteria The criteria see http://minecraft.gamepedia.com/Scoreboard#Objectives + * @return Returns the created ScoreboardObjective, returns null if it failed to create + */ + public ScriptScoreboardObjective addObjective(String objective, String criteria){ + if(hasObjective(objective)) + return null; + + IScoreObjectiveCriteria icriteria = (IScoreObjectiveCriteria)IScoreObjectiveCriteria.field_96643_a.get(criteria); + if(icriteria == null) + return null; + + if(objective.length() == 0 || objective.length() > 16) + return null; + + ScoreObjective obj = board.addScoreObjective(objective, icriteria); + return new ScriptScoreboardObjective(obj); + } + + /** + * @since 1.7.10c + * @param player Name of a player or non existing thing + * @param objective Scoreboard objective name + * @param score Score as integer between -2,147,483,648 and 2,147,483,647 + * @param datatag Optional tag to specify type, can be left empty + */ + public void setPlayerScore(String player, String objective, int score, String datatag){ + ScoreObjective objec = board.getObjective(objective); + if(objec == null || objec.getCriteria().isReadOnly() || + score < Integer.MIN_VALUE || score > Integer.MAX_VALUE) + return; + + Score sco = board.func_96529_a(player, objec); + sco.setScorePoints(score); + } + + /** + * @since 1.7.10c + * @param player Name of a player or non existing thing + * @param objective Scoreboard objective name + * @param datatag Optional tag to specify type, can be left empty + * @return Returns score value + */ + public int getPlayerScore(String player, String objective, String datatag){ + ScoreObjective objec = board.getObjective(objective); + if(objec == null || objec.getCriteria().isReadOnly()) + return 0; + + return board.func_96529_a(player, objec).getScorePoints(); + } + + /** + * @version 1.8 + * @param player Name of a player or non existing thing + * @param objective Scoreboard objective name + * @param datatag Optional tag to specify type, can be left empty + * @return Returns whether or not the player has the objective + */ + public boolean hasPlayerObjective(String player, String objective, String datatag){ + ScoreObjective objec = board.getObjective(objective); + if(objec == null) + return false; + + return board.func_96510_d(player).get(objec) != null; + } + + /** + * @version 1.8 + * @param player Name of a player or non existing thing + * @param objective Scoreboard objective name + * @param datatag Optional tag to specify type, can be left empty + */ + public void deletePlayerScore(String player, String objective, String datatag){ + ScoreObjective objec = board.getObjective(objective); + if(objec == null) + return; + + if(board.func_96510_d(player).remove(objec) != null) + board.func_96516_a(player); + } + + public ScriptScoreboardTeam[] getTeams(){ + List list = new ArrayList(board.getTeams()); + ScriptScoreboardTeam[] teams = new ScriptScoreboardTeam[list.size()]; + for(int i = 0; i < list.size(); i++){ + teams[i] = new ScriptScoreboardTeam(list.get(i), board); + } + return teams; + } + + public boolean hasTeam(String name){ + return board.getPlayersTeam(name) != null; + } + + public ScriptScoreboardTeam addTeam(String name){ + if(hasTeam(name)) + return null; + return new ScriptScoreboardTeam(board.createTeam(name), board); + } + + public ScriptScoreboardTeam getTeam(String name){ + ScorePlayerTeam team = board.getPlayersTeam(name); + if(team == null) + return null; + return new ScriptScoreboardTeam(team, board); + } + + public void removeTeam(String name){ + ScorePlayerTeam team = board.getPlayersTeam(name); + if(team != null) + board.removeTeam(team); + } +} diff --git a/src/main/java/noppes/npcs/scripted/ScriptScoreboardObjective.java b/src/main/java/noppes/npcs/scripted/ScriptScoreboardObjective.java new file mode 100644 index 000000000..7100640a1 --- /dev/null +++ b/src/main/java/noppes/npcs/scripted/ScriptScoreboardObjective.java @@ -0,0 +1,50 @@ +package noppes.npcs.scripted; + +import net.minecraft.scoreboard.ScoreObjective; + +public class ScriptScoreboardObjective { + private ScoreObjective objective; + + protected ScriptScoreboardObjective(ScoreObjective objective){ + this.objective = objective; + } + + /** + * @return Returns objective name + */ + public String getName(){ + return objective.getName(); + } + + /** + * @return Returns display name + */ + public String getDisplayName(){ + return objective.getDisplayName(); + } + + /** + * @since 1.7.10c + * @param name Name used for display (1-32 chars) + */ + public void setDisplayName(String name){ + if(name.length() > 0 && name.length() <= 32) + objective.setDisplayName(name); + } + + /** + * @since 1.7.10c + * @return Returns the criteria string + */ + public String getCriteria(){ + return objective.getCriteria().func_96636_a(); + } + + /** + * @return Return whether or not the objective value can be changed. E.g. player health can't be changed + */ + public boolean isReadyOnly(){ + return objective.getCriteria().isReadOnly(); + } + +} diff --git a/src/main/java/noppes/npcs/scripted/ScriptScoreboardTeam.java b/src/main/java/noppes/npcs/scripted/ScriptScoreboardTeam.java new file mode 100644 index 000000000..639ee0b3e --- /dev/null +++ b/src/main/java/noppes/npcs/scripted/ScriptScoreboardTeam.java @@ -0,0 +1,96 @@ +package noppes.npcs.scripted; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.scoreboard.ScorePlayerTeam; +import net.minecraft.scoreboard.Scoreboard; +import net.minecraft.util.EnumChatFormatting; + +public class ScriptScoreboardTeam { + private ScorePlayerTeam team; + private Scoreboard board; + protected ScriptScoreboardTeam(ScorePlayerTeam team, Scoreboard board){ + this.team = team; + this.board = board; + } + + public String getName(){ + return team.getRegisteredName(); + } + + public String getDisplayName(){ + return team.func_96669_c(); + } + + /** + * @param name Name used as display (1-32 chars) + */ + public void setDisplayName(String name){ + if(name.length() > 0 && name.length() <= 32) + team.setTeamName(name); + } + + public void addPlayer(String player){ + board.func_151392_a(player, getName()); + } + + public void removePlayer(String player){ + board.removePlayerFromTeam(player, team); + } + + public String[] getPlayers(){ + List list = new ArrayList(team.getMembershipCollection()); + return list.toArray(new String[list.size()]); + } + + public void clearPlayers(){ + List list = new ArrayList(team.getMembershipCollection()); + for(String player : list){ + board.removePlayerFromTeam(player, team); + } + } + + public boolean getFriendlyFire(){ + return team.getAllowFriendlyFire(); + } + + public void setFriendlyFire(boolean bo){ + team.setAllowFriendlyFire(bo); + } + + /** + * @param color Valid color values are "black", "dark_blue", "dark_green", "dark_aqua", "dark_red", "dark_purple", "gold", "gray", "dark_gray", "blue", "green", "aqua", "red", "light_purple", "yellow", and "white". Or "reset" if you want default + */ + public void setColor(String color){ + EnumChatFormatting enumchatformatting = EnumChatFormatting.getValueByName(color); + + if (enumchatformatting == null || enumchatformatting.isFancyStyling()) + return; + + team.setNamePrefix(enumchatformatting.toString()); + team.setNameSuffix(EnumChatFormatting.RESET.toString()); + } + + /** + * @return Returns color string. Returns null if no color was set + */ + public String getColor(){ + String prefix = team.getColorPrefix(); + if(prefix == null || prefix.isEmpty()) + return null; + for(EnumChatFormatting format : EnumChatFormatting.values()){ + if(prefix.equals(format.toString()) && format != EnumChatFormatting.RESET) + return format.getFriendlyName(); + } + return null; + } + + public void setSeeInvisibleTeamPlayers(boolean bo){ + team.setSeeFriendlyInvisiblesEnabled(bo); + } + + public boolean getSeeInvisibleTeamPlayers(){ + return team.func_98297_h(); + } +} diff --git a/src/main/java/noppes/npcs/scripted/ScriptWorld.java b/src/main/java/noppes/npcs/scripted/ScriptWorld.java new file mode 100644 index 000000000..b22b335db --- /dev/null +++ b/src/main/java/noppes/npcs/scripted/ScriptWorld.java @@ -0,0 +1,345 @@ +package noppes.npcs.scripted; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.effect.EntityLightningBolt; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTBase.NBTPrimitive; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagString; +import net.minecraft.server.MinecraftServer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntitySign; +import net.minecraft.world.World; +import net.minecraft.world.WorldServer; +import noppes.npcs.NoppesUtilServer; +import noppes.npcs.blocks.tiles.TileBigSign; +import noppes.npcs.blocks.tiles.TileSign; +import noppes.npcs.controllers.ScriptController; +import noppes.npcs.controllers.ServerCloneController; + +public class ScriptWorld{ + private static Map tempData = new HashMap(); + protected WorldServer world; + public ScriptWorld(WorldServer world){ + this.world = world; + } + + /** + * @return The worlds time + */ + public long getTime(){ + return world.getWorldTime(); + } + + /** + * @return The total world time + */ + public long getTotalTime(){ + return world.getTotalWorldTime(); + } + + /** + * @param x World position x + * @param y World position y + * @param z World position z + * @return The block at the given position. Returns null if there isn't a block + */ + public ScriptItemStack getBlock(int x, int y, int z){ + Block block = world.getBlock(x, y, z); + if(block == null || block.isAir(world, x, y, z)) + return null; + return new ScriptItemStack(new ItemStack(block, 1, world.getBlockMetadata(x, y, z))); + } + + /** + * @param x World position x + * @param y World position y + * @param z World position z + * @return Text from signs + * @since 1.7.10d + */ + public String getSignText(int x, int y, int z){ + TileEntity tile = world.getTileEntity(x, y, z); + + if(tile instanceof TileBigSign) + return ((TileBigSign)tile).getText(); + + if(tile instanceof TileEntitySign){ + TileEntitySign tileSign = (TileEntitySign)tile; + String s = tileSign.signText[0] + "\n"; + s += tileSign.signText[1] + "\n"; + s += tileSign.signText[2] + "\n"; + s += tileSign.signText[3]; + return s; + } + + return null; + } + + /** + * @param x World position x + * @param y World position y + * @param z World position z + * @param item The block to be set + */ + public void setBlock(int x, int y, int z, ScriptItemStack item){ + if(item == null){ + removeBlock(x, y, z); + return; + } + Block block = Block.getBlockFromItem(item.item.getItem()); + if(block == null || block == Blocks.air) + return; + world.setBlock(x, y, z, block); + } + + /** + * @param x World position x + * @param y World position y + * @param z World position z + */ + public void removeBlock(int x, int y, int z){ + world.setBlock(x, y, z, Blocks.air); + } + + /** + * @param name The name of the player to be returned + * @return The Player with name. Null is returned when the player isnt found + */ + public ScriptPlayer getPlayer(String name){ + EntityPlayer player = world.getPlayerEntityByName(name); + if(player == null) + return null; + return (ScriptPlayer) ScriptController.Instance.getScriptForEntity(player); + } + + /** + * @param time The world time to be set + */ + public void setTime(long time){ + world.setWorldTime(time); + } + + /** + * @return Whether or not its daytime + */ + public boolean isDay(){ + return world.getWorldTime() % 24000 < 12000; + } + + /** + * @return Whether or not its currently raining + */ + public boolean isRaining(){ + return world.getWorldInfo().isRaining(); + } + + /** + * @param bo Set if it's raining + */ + public void setRaining(boolean bo){ + world.getWorldInfo().setRaining(bo); + } + + /** + * @param x The x position + * @param y The y position + * @param z The z position + */ + public void thunderStrike(double x, double y, double z){ + world.addWeatherEffect(new EntityLightningBolt(world, x, y, z)); + } + + /** + * Sends a packet from the server to the client everytime its called. Probably should not use this too much. + * @param particle Particle name. Particle name list: http://minecraft.gamepedia.com/Particles + * @param x The x position + * @param y The y position + * @param z The z position + * @param dx Usually used for the x motion + * @param dy Usually used for the y motion + * @param dz Usually used for the z motion + * @param speed Speed of the particles, usually between 0 and 1 + * @param count Particle count + */ + public void spawnParticle(String particle, double x, double y, double z, double dx, double dy, double dz, double speed, int count){ + world.func_147487_a(particle, x, y, z, count, dx, dy, dz, speed); + } + + /** + * @param id The items name + * @param damage The damage value + * @param size The number of items in the item + * @return Returns the item + */ + public ScriptItemStack createItem(String id, int damage, int size){ + Item item = (Item)Item.itemRegistry.getObject(id); + if(item == null) + return null; + return new ScriptItemStack(new ItemStack(item, size, damage)); + } + + /** + * @param key Get temp data for this key + * @return Returns the stored temp data + */ + public Object getTempData(String key){ + return tempData.get(key); + } + + /** + * Tempdata gets cleared when the server restarts. All worlds share the same temp data. + * @param key The key for the data stored + * @param value The data stored + */ + public void setTempData(String key, Object value){ + tempData.put(key, value); + } + + /** + * @param key The key thats going to be tested against the temp data + * @return Whether or not temp data containes the key + */ + public boolean hasTempData(String key){ + return tempData.containsKey(key); + } + + /** + * @param key The key for the temp data to be removed + */ + public void removeTempData(String key){ + tempData.remove(key); + } + + /** + * Removes all tempdata + */ + public void clearTempData(){ + tempData.clear(); + } + + /** + * @param key The key of the data to be returned + * @return Returns the stored data + */ + public Object getStoredData(String key){ + NBTTagCompound compound = ScriptController.Instance.compound; + if(!compound.hasKey(key)) + return null; + NBTBase base = compound.getTag(key); + if(base instanceof NBTPrimitive) + return ((NBTPrimitive)base).func_150286_g(); + return ((NBTTagString)base).func_150285_a_(); + } + + /** + * Stored data persists through world restart. Unlike tempdata only Strings and Numbers can be saved + * @param key The key for the data stored + * @param value The data stored. This data can be either a Number or a String. Other data is not stored + */ + public void setStoredData(String key, Object value){ + NBTTagCompound compound = ScriptController.Instance.compound; + if(value instanceof Number) + compound.setDouble(key, ((Number) value).doubleValue()); + else if(value instanceof String) + compound.setString(key, (String)value); + ScriptController.Instance.shouldSave = true; + } + + /** + * @param key The key of the data to be checked + * @return Returns whether or not the stored data contains the key + */ + public boolean hasStoredData(String key){ + return ScriptController.Instance.compound.hasKey(key); + } + + /** + * @param key The key of the data to be removed + */ + public void removeStoredData(String key){ + ScriptController.Instance.compound.removeTag(key); + ScriptController.Instance.shouldSave = true; + } + + /** + * Remove all stored data + */ + public void clearStoredData(){ + ScriptController.Instance.compound = new NBTTagCompound(); + ScriptController.Instance.shouldSave = true; + } + + /** + * @param x Position x + * @param y Position y + * @param z Position z + * @param range Range of the explosion + * @param fire Whether or not the explosion does fire damage + * @param grief Whether or not the explosion does damage to blocks + */ + public void explode(double x, double y, double z, float range, boolean fire, boolean grief){ + world.newExplosion(null, x, y, z, range, fire, grief); + } + + public ScriptPlayer[] getAllServerPlayers(){ + List list = MinecraftServer.getServer().getConfigurationManager().playerEntityList; + ScriptPlayer[] arr = new ScriptPlayer[list.size()]; + for(int i = 0; i < list.size(); i++){ + arr[i] = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(list.get(i)); + } + + return arr; + } + + /** + * @since 1.7.10c + * @param x Position x + * @param z Position z + * @return Returns the name of the biome + */ + public String getBiomeName(int x, int z){ + return world.getBiomeGenForCoords(x, z).biomeName; + } + + /** + * Lets you spawn a server side cloned entity + * @param x The x position the clone will be spawned at + * @param y The y position the clone will be spawned at + * @param z The z position the clone will be spawned at + * @param tab The tab in which the clone is + * @param name Name of the cloned entity + * @return Returns the entity which was spawned + */ + public ScriptEntity spawnClone(int x, int y, int z, int tab, String name){ + NBTTagCompound compound = ServerCloneController.Instance.getCloneData(null, name, tab); + if(compound == null) + return null; + Entity entity = NoppesUtilServer.spawnClone(compound, x, y, z, world); + if(entity == null) + return null; + return ScriptController.Instance.getScriptForEntity(entity); + } + + public ScriptScoreboard getScoreboard(){ + return new ScriptScoreboard(); + } + + /** + * @since 1.7.10c + * Expert use only + * @return Returns minecraft world object + */ + public World getMCWorld(){ + return world; + } +} diff --git a/src/main/java/noppes/npcs/scripted/constants/AnimationType.java b/src/main/java/noppes/npcs/scripted/constants/AnimationType.java new file mode 100644 index 000000000..a5ce8a8cd --- /dev/null +++ b/src/main/java/noppes/npcs/scripted/constants/AnimationType.java @@ -0,0 +1,10 @@ +package noppes.npcs.scripted.constants; + +public class AnimationType { + public static final int NORMAL = 0; + public static final int SITTING = 1; + public static final int LYING = 2; + public static final int HUGGING = 3; + public static final int SNEAKING = 4; + public static final int DANCING = 5; +} diff --git a/src/main/java/noppes/npcs/scripted/constants/EntityType.java b/src/main/java/noppes/npcs/scripted/constants/EntityType.java new file mode 100644 index 000000000..3a9b1842c --- /dev/null +++ b/src/main/java/noppes/npcs/scripted/constants/EntityType.java @@ -0,0 +1,10 @@ +package noppes.npcs.scripted.constants; + +public class EntityType { + public static final int UNKNOWN = 0; + public static final int PLAYER = 1; + public static final int NPC = 2; + public static final int MONSTER = 3; + public static final int ANIMAL = 4; + public static final int LIVING = 5; +} diff --git a/src/main/java/noppes/npcs/scripted/constants/JobType.java b/src/main/java/noppes/npcs/scripted/constants/JobType.java new file mode 100644 index 000000000..27ace8d47 --- /dev/null +++ b/src/main/java/noppes/npcs/scripted/constants/JobType.java @@ -0,0 +1,13 @@ +package noppes.npcs.scripted.constants; + +public class JobType { + public static final int UNKNOWN = 0; + public static final int BARD = 1; + public static final int HEALER = 2; + public static final int GUARD = 3; + public static final int FOLLOWER = 4; + public static final int ITEMGIVER = 5; + public static final int SPAWNER = 6; + public static final int CONVERSATION = 7; + public static final int PUPPET = 8; +} diff --git a/src/main/java/noppes/npcs/scripted/constants/RoleType.java b/src/main/java/noppes/npcs/scripted/constants/RoleType.java new file mode 100644 index 000000000..7fbc1f421 --- /dev/null +++ b/src/main/java/noppes/npcs/scripted/constants/RoleType.java @@ -0,0 +1,10 @@ +package noppes.npcs.scripted.constants; + +public class RoleType { + public static final int UNKNOWN = 0; + public static final int MAILMAN = 1; + public static final int TRADER = 2; + public static final int FOLLOWER = 3; + public static final int BANK = 4; + public static final int TRANSPORTER = 5; +} diff --git a/src/main/java/noppes/npcs/scripted/roles/ScriptJobBard.java b/src/main/java/noppes/npcs/scripted/roles/ScriptJobBard.java new file mode 100644 index 000000000..306a652cc --- /dev/null +++ b/src/main/java/noppes/npcs/scripted/roles/ScriptJobBard.java @@ -0,0 +1,32 @@ +package noppes.npcs.scripted.roles; + +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.JobBard; +import noppes.npcs.scripted.constants.JobType; + +public class ScriptJobBard extends ScriptJobInterface{ + private JobBard job; + public ScriptJobBard(EntityNPCInterface npc){ + super(npc); + this.job = (JobBard) npc.jobInterface; + } + @Override + public int getType(){ + return JobType.BARD; + } + + /** + * @return The song the bard is playing + */ + public String getSong(){ + return job.song; + } + + /** + * @param song The song you want the bard to play + */ + public void setSong(String song){ + job.song = song; + npc.script.clientNeedsUpdate = true; + } +} diff --git a/src/main/java/noppes/npcs/scripted/roles/ScriptJobConversation.java b/src/main/java/noppes/npcs/scripted/roles/ScriptJobConversation.java new file mode 100644 index 000000000..45d403e34 --- /dev/null +++ b/src/main/java/noppes/npcs/scripted/roles/ScriptJobConversation.java @@ -0,0 +1,23 @@ +package noppes.npcs.scripted.roles; + +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.JobConversation; +import noppes.npcs.roles.JobGuard; +import noppes.npcs.roles.JobItemGiver; +import noppes.npcs.scripted.ScriptItemStack; +import noppes.npcs.scripted.ScriptPlayer; +import noppes.npcs.scripted.constants.JobType; + +public class ScriptJobConversation extends ScriptJobInterface{ + private JobConversation job; + public ScriptJobConversation(EntityNPCInterface npc){ + super(npc); + this.job = (JobConversation) npc.jobInterface; + } + + @Override + public int getType(){ + return JobType.SPAWNER; + } + +} diff --git a/src/main/java/noppes/npcs/scripted/roles/ScriptJobFollower.java b/src/main/java/noppes/npcs/scripted/roles/ScriptJobFollower.java new file mode 100644 index 000000000..f12e9cb88 --- /dev/null +++ b/src/main/java/noppes/npcs/scripted/roles/ScriptJobFollower.java @@ -0,0 +1,39 @@ +package noppes.npcs.scripted.roles; + +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.JobFollower; +import noppes.npcs.roles.JobGuard; +import noppes.npcs.scripted.ScriptNpc; +import noppes.npcs.scripted.constants.JobType; + +public class ScriptJobFollower extends ScriptJobInterface{ + private JobFollower job; + public ScriptJobFollower(EntityNPCInterface npc){ + super(npc); + this.job = (JobFollower) npc.jobInterface; + } + + public String getFollowingName(){ + return job.name; + } + + public void setFollowingName(String name){ + job.name = name; + } + + public ScriptNpc getFollowingNpc(){ + if(!isFollowing()) + return null; + return job.following.script.dummyNpc; + } + + public boolean isFollowing(){ + return job.isFollowing(); + } + + @Override + public int getType(){ + return JobType.FOLLOWER; + } + +} diff --git a/src/main/java/noppes/npcs/scripted/roles/ScriptJobGuard.java b/src/main/java/noppes/npcs/scripted/roles/ScriptJobGuard.java new file mode 100644 index 000000000..1543cd0a6 --- /dev/null +++ b/src/main/java/noppes/npcs/scripted/roles/ScriptJobGuard.java @@ -0,0 +1,19 @@ +package noppes.npcs.scripted.roles; + +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.JobGuard; +import noppes.npcs.scripted.constants.JobType; + +public class ScriptJobGuard extends ScriptJobInterface{ + private JobGuard job; + public ScriptJobGuard(EntityNPCInterface npc){ + super(npc); + this.job = (JobGuard) npc.jobInterface; + } + + @Override + public int getType(){ + return JobType.GUARD; + } + +} diff --git a/src/main/java/noppes/npcs/scripted/roles/ScriptJobHealer.java b/src/main/java/noppes/npcs/scripted/roles/ScriptJobHealer.java new file mode 100644 index 000000000..8c6c934ce --- /dev/null +++ b/src/main/java/noppes/npcs/scripted/roles/ScriptJobHealer.java @@ -0,0 +1,25 @@ +package noppes.npcs.scripted.roles; + +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.JobGuard; +import noppes.npcs.roles.JobHealer; +import noppes.npcs.scripted.ScriptLivingBase; +import noppes.npcs.scripted.constants.JobType; + +public class ScriptJobHealer extends ScriptJobInterface{ + private JobHealer job; + public ScriptJobHealer(EntityNPCInterface npc){ + super(npc); + this.job = (JobHealer) npc.jobInterface; + } + + public void heal(ScriptLivingBase entity, float amount){ + job.heal(entity.getMinecraftEntity(), amount); + } + + @Override + public int getType(){ + return JobType.HEALER; + } + +} diff --git a/src/main/java/noppes/npcs/scripted/roles/ScriptJobInterface.java b/src/main/java/noppes/npcs/scripted/roles/ScriptJobInterface.java new file mode 100644 index 000000000..d3887629c --- /dev/null +++ b/src/main/java/noppes/npcs/scripted/roles/ScriptJobInterface.java @@ -0,0 +1,19 @@ +package noppes.npcs.scripted.roles; + +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.scripted.constants.JobType; + +public class ScriptJobInterface { + protected EntityNPCInterface npc; + + public ScriptJobInterface(EntityNPCInterface npc){ + this.npc = npc; + } + /** + * @see noppes.npcs.scripted.constants.JobType + * @return Returns the JobType + */ + public int getType(){ + return JobType.UNKNOWN; + } +} diff --git a/src/main/java/noppes/npcs/scripted/roles/ScriptJobItemGiver.java b/src/main/java/noppes/npcs/scripted/roles/ScriptJobItemGiver.java new file mode 100644 index 000000000..e2d81c5c2 --- /dev/null +++ b/src/main/java/noppes/npcs/scripted/roles/ScriptJobItemGiver.java @@ -0,0 +1,22 @@ +package noppes.npcs.scripted.roles; + +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.JobGuard; +import noppes.npcs.roles.JobItemGiver; +import noppes.npcs.scripted.ScriptItemStack; +import noppes.npcs.scripted.ScriptPlayer; +import noppes.npcs.scripted.constants.JobType; + +public class ScriptJobItemGiver extends ScriptJobInterface{ + private JobItemGiver job; + public ScriptJobItemGiver(EntityNPCInterface npc){ + super(npc); + this.job = (JobItemGiver) npc.jobInterface; + } + + @Override + public int getType(){ + return JobType.ITEMGIVER; + } + +} diff --git a/src/main/java/noppes/npcs/scripted/roles/ScriptJobPuppet.java b/src/main/java/noppes/npcs/scripted/roles/ScriptJobPuppet.java new file mode 100644 index 000000000..7177de312 --- /dev/null +++ b/src/main/java/noppes/npcs/scripted/roles/ScriptJobPuppet.java @@ -0,0 +1,207 @@ +package noppes.npcs.scripted.roles; + +import noppes.npcs.controllers.ScriptController; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.JobGuard; +import noppes.npcs.roles.JobHealer; +import noppes.npcs.roles.JobPuppet; +import noppes.npcs.scripted.ScriptLivingBase; +import noppes.npcs.scripted.constants.JobType; + +public class ScriptJobPuppet extends ScriptJobInterface{ + private JobPuppet job; + public ScriptJobPuppet(EntityNPCInterface npc){ + super(npc); + this.job = (JobPuppet) npc.jobInterface; + } + + /** + * @since 1.7.10c + * @param part Body part (0:head, 1:body, 2:leftarm, 3:rightarm, 4:leftleg, 5:rightleg) + * @return Returns X rotation in degrees (0-360) + */ + public int getRotationX(int part){ + if(part == 0) + return floatToInt(job.head.rotationX); + if(part == 1) + return floatToInt(job.body.rotationX); + if(part == 2) + return floatToInt(job.larm.rotationX); + if(part == 3) + return floatToInt(job.rarm.rotationX); + if(part == 4) + return floatToInt(job.lleg.rotationX); + if(part == 5) + return floatToInt(job.rleg.rotationX); + return 0; + } + + /** + * @since 1.7.10c + * @param part Body part (0:head, 1:body, 2:leftarm, 3:rightarm, 4:leftleg, 5:rightleg) + * @return Returns Y rotation in degrees (0-360) + */ + public int getRotationY(int part){ + if(part == 0) + return floatToInt(job.head.rotationY); + if(part == 1) + return floatToInt(job.body.rotationY); + if(part == 2) + return floatToInt(job.larm.rotationY); + if(part == 3) + return floatToInt(job.rarm.rotationY); + if(part == 4) + return floatToInt(job.lleg.rotationY); + if(part == 5) + return floatToInt(job.rleg.rotationY); + return 0; + } + + /** + * @since 1.7.10c + * @param part Body part (0:head, 1:body, 2:leftarm, 3:rightarm, 4:leftleg, 5:rightleg) + * @return Returns Z rotation in degrees (0-360) + */ + public int getRotationZ(int part){ + if(part == 0) + return floatToInt(job.head.rotationZ); + if(part == 1) + return floatToInt(job.body.rotationZ); + if(part == 2) + return floatToInt(job.larm.rotationZ); + if(part == 3) + return floatToInt(job.rarm.rotationZ); + if(part == 4) + return floatToInt(job.lleg.rotationZ); + if(part == 5) + return floatToInt(job.rleg.rotationZ); + return 0; + } + + /** + * @since 1.7.10c + * @param part Body part (0:head, 1:body, 2:leftarm, 3:rightarm, 4:leftleg, 5:rightleg) + * @param rotation Rotation the of the body part + */ + public void setRotationX(int part, int rotation){ + float f = rotation / 360f - 0.5f; + if(getRotationX(part) != f) + npc.script.clientNeedsUpdate = true; + + if(part == 0) + job.head.rotationX = f; + if(part == 1) + job.body.rotationX = f; + if(part == 2) + job.larm.rotationX = f; + if(part == 3) + job.rarm.rotationX = f; + if(part == 4) + job.lleg.rotationX = f; + if(part == 5) + job.rleg.rotationX = f; + } + + /** + * @since 1.7.10c + * @param type Body part (0:head, 1:body, 2:leftarm, 3:rightarm, 4:leftleg, 5:rightleg) + * @param rotation Rotation the of the body part + */ + public void setRotationY(int part, int rotation){ + float f = rotation / 360f - 0.5f; + if(getRotationY(part) != f) + npc.script.clientNeedsUpdate = true; + + if(part == 0) + job.head.rotationY = f; + if(part == 1) + job.body.rotationY = f; + if(part == 2) + job.larm.rotationY = f; + if(part == 3) + job.rarm.rotationY = f; + if(part == 4) + job.lleg.rotationY = f; + if(part == 5) + job.rleg.rotationY = f; + } + + /** + * @since 1.7.10c + * @param part Body part (0:head, 1:body, 2:leftarm, 3:rightarm, 4:leftleg, 5:rightleg) + * @param rotation Rotation the of the body part + */ + public void setRotationZ(int part, int rotation){ + float f = rotation / 360f - 0.5f; + if(getRotationZ(part) != f) + npc.script.clientNeedsUpdate = true; + + if(part == 0) + job.head.rotationZ = f; + if(part == 1) + job.body.rotationZ = f; + if(part == 2) + job.larm.rotationZ = f; + if(part == 3) + job.rarm.rotationZ = f; + if(part == 4) + job.lleg.rotationZ = f; + if(part == 5) + job.rleg.rotationZ = f; + } + + /** + * @since 1.7.10c + * @param part Body part (0:head, 1:body, 2:leftarm, 3:rightarm, 4:leftleg, 5:rightleg) + * @return Returns whether or not the body part is enabled + */ + public boolean isEnabled(int part){ + if(part == 0) + return !job.head.disabled; + if(part == 1) + return !job.body.disabled; + if(part == 2) + return !job.larm.disabled; + if(part == 3) + return !job.rarm.disabled; + if(part == 4) + return !job.lleg.disabled; + if(part == 5) + return !job.rleg.disabled; + + return false; + } + + /** + * @since 1.7.10c + * @param part Body part (0:head, 1:body, 2:leftarm, 3:rightarm, 4:leftleg, 5:rightleg) + * @param bo Whether or not the body part is enabled + */ + public void setEnabled(int part, boolean bo){ + if(isEnabled(part) != bo) + npc.script.clientNeedsUpdate = true; + + if(part == 0) + job.head.disabled = !bo; + if(part == 1) + job.body.disabled = !bo; + if(part == 2) + job.larm.disabled = !bo; + if(part == 3) + job.rarm.disabled = !bo; + if(part == 4) + job.lleg.disabled = !bo; + if(part == 5) + job.rleg.disabled = !bo; + } + + private int floatToInt(float f){ + return (int)((f + 0.5) * 360); + } + + @Override + public int getType(){ + return JobType.PUPPET; + } + +} diff --git a/src/main/java/noppes/npcs/scripted/roles/ScriptJobSpawner.java b/src/main/java/noppes/npcs/scripted/roles/ScriptJobSpawner.java new file mode 100644 index 000000000..178afc911 --- /dev/null +++ b/src/main/java/noppes/npcs/scripted/roles/ScriptJobSpawner.java @@ -0,0 +1,52 @@ +package noppes.npcs.scripted.roles; + +import java.util.ArrayList; +import java.util.Iterator; + +import net.minecraft.entity.EntityLivingBase; +import noppes.npcs.controllers.ScriptContainer; +import noppes.npcs.controllers.ScriptController; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.JobGuard; +import noppes.npcs.roles.JobItemGiver; +import noppes.npcs.roles.JobSpawner; +import noppes.npcs.scripted.ScriptItemStack; +import noppes.npcs.scripted.ScriptLivingBase; +import noppes.npcs.scripted.ScriptPlayer; +import noppes.npcs.scripted.constants.JobType; + +public class ScriptJobSpawner extends ScriptJobInterface{ + private JobSpawner job; + public ScriptJobSpawner(EntityNPCInterface npc){ + super(npc); + this.job = (JobSpawner) npc.jobInterface; + } + + @Override + public int getType(){ + return JobType.SPAWNER; + } + + /** + * Npc needs to be attacking something or be set to Despawn Spawns On Target Lost: No, otherwise it will despawn right away + * @param number The entity going to be spawned (1-6) + * @return Returns spawned entity + */ + public ScriptLivingBase spawnEntity(int number){ + EntityLivingBase base = job.spawnEntity(number); + if(base == null) + return null; + + return (ScriptLivingBase) ScriptController.Instance.getScriptForEntity(base); + } + + /** + * Removes all spawned entities + */ + public void removeAllSpawned(){ + for(EntityLivingBase entity : job.spawned){ + entity.isDead = true; + } + job.spawned = new ArrayList(); + } +} diff --git a/src/main/java/noppes/npcs/scripted/roles/ScriptRoleBank.java b/src/main/java/noppes/npcs/scripted/roles/ScriptRoleBank.java new file mode 100644 index 000000000..222ddcc9e --- /dev/null +++ b/src/main/java/noppes/npcs/scripted/roles/ScriptRoleBank.java @@ -0,0 +1,16 @@ +package noppes.npcs.scripted.roles; + +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.scripted.constants.RoleType; + +public class ScriptRoleBank extends ScriptRoleInterface{ + + public ScriptRoleBank(EntityNPCInterface npc) { + super(npc); + } + + @Override + public int getType(){ + return RoleType.BANK; + } +} diff --git a/src/main/java/noppes/npcs/scripted/roles/ScriptRoleFollower.java b/src/main/java/noppes/npcs/scripted/roles/ScriptRoleFollower.java new file mode 100644 index 000000000..3b65007c6 --- /dev/null +++ b/src/main/java/noppes/npcs/scripted/roles/ScriptRoleFollower.java @@ -0,0 +1,101 @@ +package noppes.npcs.scripted.roles; + +import net.minecraft.entity.player.EntityPlayer; +import noppes.npcs.controllers.ScriptController; +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.RoleFollower; +import noppes.npcs.scripted.ScriptPlayer; +import noppes.npcs.scripted.constants.RoleType; + +public class ScriptRoleFollower extends ScriptRoleInterface{ + private RoleFollower role; + public ScriptRoleFollower(EntityNPCInterface npc) { + super(npc); + role = (RoleFollower) npc.roleInterface; + } + + /** + * @since 1.7.10c + * @param player Player who is set as the owner. If null given everything resets + */ + public void setOwner(ScriptPlayer player){ + if(player == null || player.getMinecraftEntity() == null){ + role.setOwner(null); + return; + } + EntityPlayer mcplayer = (EntityPlayer) player.getMinecraftEntity(); + role.setOwner(mcplayer); + } + + /** + * @since 1.7.10c + * @return Returns the followers owner. Returns null if he has no owner or the owner is offline + */ + public ScriptPlayer getOwner(){ + if(role.owner == null) + return null; + + return (ScriptPlayer) ScriptController.Instance.getScriptForEntity(role.owner); + } + + /** + * @since 1.7.10c + * @return Returns whether or not the follower has an owner + */ + public boolean hasOwner(){ + return role.owner != null; + } + + /** + * @since 1.7.10c + * @return Returns days left + */ + public int getDaysLeft(){ + return role.getDaysLeft(); + } + + /** + * @since 1.7.10c + * @param days The days you want to add to the days remaining + */ + public void addDaysLeft(int days){ + role.addDays(days); + } + + /** + * @since 1.7.10c + * @return Returns whether or not the follower is set to infinite days + */ + public boolean getInfiniteDays(){ + return role.infiniteDays; + } + + /** + * @since 1.7.10c + * @param infinite Sets whether the days hired are infinite + */ + public void setInfiniteDays(boolean infinite){ + role.infiniteDays = infinite; + } + + /** + * @since 1.7.10c + * @return Return whether the gui is disabled + */ + public boolean getGuiDisabled(){ + return role.disableGui; + } + + /** + * @since 1.7.10c + * @param disabled Set the gui to be disabled or not + */ + public void setGuiDisabled(boolean disabled){ + role.disableGui = disabled; + } + + @Override + public int getType(){ + return RoleType.FOLLOWER; + } +} diff --git a/src/main/java/noppes/npcs/scripted/roles/ScriptRoleInterface.java b/src/main/java/noppes/npcs/scripted/roles/ScriptRoleInterface.java new file mode 100644 index 000000000..338306819 --- /dev/null +++ b/src/main/java/noppes/npcs/scripted/roles/ScriptRoleInterface.java @@ -0,0 +1,20 @@ +package noppes.npcs.scripted.roles; + +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.scripted.constants.RoleType; + +public class ScriptRoleInterface { + protected EntityNPCInterface npc; + + public ScriptRoleInterface(EntityNPCInterface npc){ + this.npc = npc; + } + + /** + * @see noppes.npcs.scripted.constants.RoleType + * @return The RoleType of this role + */ + public int getType(){ + return RoleType.UNKNOWN; + } +} diff --git a/src/main/java/noppes/npcs/scripted/roles/ScriptRoleMailman.java b/src/main/java/noppes/npcs/scripted/roles/ScriptRoleMailman.java new file mode 100644 index 000000000..dd461bf92 --- /dev/null +++ b/src/main/java/noppes/npcs/scripted/roles/ScriptRoleMailman.java @@ -0,0 +1,16 @@ +package noppes.npcs.scripted.roles; + +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.scripted.constants.RoleType; + +public class ScriptRoleMailman extends ScriptRoleInterface{ + + public ScriptRoleMailman(EntityNPCInterface npc) { + super(npc); + } + + @Override + public int getType(){ + return RoleType.MAILMAN; + } +} diff --git a/src/main/java/noppes/npcs/scripted/roles/ScriptRoleTrader.java b/src/main/java/noppes/npcs/scripted/roles/ScriptRoleTrader.java new file mode 100644 index 000000000..353afc2fb --- /dev/null +++ b/src/main/java/noppes/npcs/scripted/roles/ScriptRoleTrader.java @@ -0,0 +1,78 @@ +package noppes.npcs.scripted.roles; + +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.roles.RoleTrader; +import noppes.npcs.scripted.ScriptItemStack; +import noppes.npcs.scripted.constants.RoleType; +import foxz.utils.Market; + +public class ScriptRoleTrader extends ScriptRoleInterface{ + private RoleTrader role; + public ScriptRoleTrader(EntityNPCInterface npc) { + super(npc); + role = (RoleTrader) npc.roleInterface; + } + + /** + * @param slot Slot number 0-17 + * @param currency Currency item + * @param currency2 Currency item number two + * @param sold Item to be sold by this npc + */ + public void setSellOption(int slot, ScriptItemStack currency, ScriptItemStack currency2, ScriptItemStack sold){ + if(sold == null || slot >= 18 || slot < 0) + return; + if(currency == null) + currency = currency2; + + if(currency != null) + role.inventoryCurrency.items.put(slot, currency.getMCItemStack()); + else + role.inventoryCurrency.items.remove(slot); + if(currency2 != null) + role.inventoryCurrency.items.put(slot + 18, currency2.getMCItemStack()); + else + role.inventoryCurrency.items.remove(slot + 18); + + role.inventorySold.items.put(slot, sold.getMCItemStack()); + } + + /** + * @param slot Slot number 0-17 + * @param currency Currency item + * @param sold Item to be sold by this npc + */ + public void setSellOption(int slot, ScriptItemStack currency, ScriptItemStack sold){ + setSellOption(slot, currency, null, sold); + } + + /** + * @param slot Slot number 0-17 + */ + public void removeSellOption(int slot){ + if(slot >= 18 || slot < 0) + return; + role.inventoryCurrency.items.remove(slot); + role.inventoryCurrency.items.remove(slot + 18); + role.inventorySold.items.remove(slot); + } + /** + * @param name The trader Linked Market name + */ + public void setMarket(String name){ + role.marketName = name; + Market.load(role, name); + } + + /** + * @return Get the currently set Linked Market name + */ + public String getMarket(){ + return role.marketName; + } + + @Override + public int getType(){ + return RoleType.TRADER; + } +} diff --git a/src/main/java/noppes/npcs/scripted/roles/ScriptRoleTransporter.java b/src/main/java/noppes/npcs/scripted/roles/ScriptRoleTransporter.java new file mode 100644 index 000000000..50e9b63cd --- /dev/null +++ b/src/main/java/noppes/npcs/scripted/roles/ScriptRoleTransporter.java @@ -0,0 +1,16 @@ +package noppes.npcs.scripted.roles; + +import noppes.npcs.entity.EntityNPCInterface; +import noppes.npcs.scripted.constants.RoleType; + +public class ScriptRoleTransporter extends ScriptRoleInterface{ + + public ScriptRoleTransporter(EntityNPCInterface npc) { + super(npc); + } + + @Override + public int getType(){ + return RoleType.TRANSPORTER; + } +} diff --git a/src/main/java/noppes/npcs/util/GameProfileAlt.java b/src/main/java/noppes/npcs/util/GameProfileAlt.java new file mode 100644 index 000000000..5f236dd2b --- /dev/null +++ b/src/main/java/noppes/npcs/util/GameProfileAlt.java @@ -0,0 +1,29 @@ +package noppes.npcs.util; + +import java.util.UUID; + +import noppes.npcs.entity.EntityNPCInterface; + +import com.mojang.authlib.GameProfile; + +public class GameProfileAlt extends GameProfile{ + private static final UUID id = UUID.randomUUID(); + public EntityNPCInterface npc; + public GameProfileAlt() { + super(null, "customnpc"); + } + + @Override + public String getName() { + if(npc == null) + return super.getName(); + return npc.getCommandSenderName(); + } + + @Override + public UUID getId(){ + if(npc == null) + return id; + return npc.getPersistentID(); + } +} diff --git a/src/main/java/noppes/npcs/util/IProjectileCallback.java b/src/main/java/noppes/npcs/util/IProjectileCallback.java new file mode 100644 index 000000000..0730ce2e2 --- /dev/null +++ b/src/main/java/noppes/npcs/util/IProjectileCallback.java @@ -0,0 +1,13 @@ +package noppes.npcs.util; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; +import net.minecraft.util.MovingObjectPosition; +import noppes.npcs.entity.EntityProjectile; + +public interface IProjectileCallback { + + boolean onImpact(EntityProjectile entityProjectile, + EntityLivingBase entity, ItemStack itemstack); + +} diff --git a/src/main/java/noppes/npcs/util/JsonException.java b/src/main/java/noppes/npcs/util/JsonException.java new file mode 100644 index 000000000..9358469af --- /dev/null +++ b/src/main/java/noppes/npcs/util/JsonException.java @@ -0,0 +1,9 @@ +package noppes.npcs.util; + +import noppes.npcs.util.NBTJsonUtil.JsonFile; + +public class JsonException extends Exception{ + public JsonException(String message, JsonFile json){ + super(message + ": " + json.getCurrentPos()); + } +} diff --git a/src/main/java/noppes/npcs/util/NBTJsonUtil.java b/src/main/java/noppes/npcs/util/NBTJsonUtil.java new file mode 100644 index 000000000..054f677b2 --- /dev/null +++ b/src/main/java/noppes/npcs/util/NBTJsonUtil.java @@ -0,0 +1,331 @@ +package noppes.npcs.util; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTTagByte; +import net.minecraft.nbt.NBTTagByteArray; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagDouble; +import net.minecraft.nbt.NBTTagFloat; +import net.minecraft.nbt.NBTTagInt; +import net.minecraft.nbt.NBTTagIntArray; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.nbt.NBTTagLong; +import net.minecraft.nbt.NBTTagShort; +import net.minecraft.nbt.NBTTagString; +import noppes.npcs.NoppesStringUtils; + +import org.apache.commons.io.Charsets; + +import com.google.common.io.Files; + +import cpw.mods.fml.common.ObfuscationReflectionHelper; + +public class NBTJsonUtil { + public static String Convert(NBTTagCompound compound){ + List list = new ArrayList(); + JsonLine line = ReadTag("", compound, list); + line.removeComma(); + return ConvertList(list); + } + + public static NBTTagCompound Convert(String json) throws JsonException{ + json = json.trim(); + JsonFile file = new JsonFile(json); + if(!json.startsWith("{") || !json.endsWith("}")) + throw new JsonException("Not properly incapsulated between { }", file); + + NBTTagCompound compound = new NBTTagCompound(); + FillCompound(compound, file); + return compound; + } + + public static void FillCompound(NBTTagCompound compound, JsonFile json) throws JsonException{ + if(json.startsWith("{") || json.startsWith(",")) + json.cut(1); + if(json.startsWith("}")) + return; + int index = json.indexOf(":"); + if(index < 1) + throw new JsonException("Expected key after ," ,json); + + String key = json.substring(0, index); + json.cut(index + 1); + + NBTBase base = ReadValue(json); + + if(base == null) + base = new NBTTagString(); + + if(key.startsWith("\"")) + key = key.substring(1); + if(key.endsWith("\"")) + key = key.substring(0, key.length() - 1); + + compound.setTag(key, base); + if(json.startsWith(",")) + FillCompound(compound, json); + + } + + public static NBTBase ReadValue(JsonFile json) throws JsonException{ + if(json.startsWith("{")){ + NBTTagCompound compound = new NBTTagCompound(); + FillCompound(compound, json); + if(!json.startsWith("}")){ + throw new JsonException("Expected }", json); + } + json.cut(1); + + return compound; + } + if(json.startsWith("[")){ + json.cut(1); + NBTTagList list = new NBTTagList(); + + NBTBase value = ReadValue(json); + while(value != null){ + list.appendTag(value); + if(!json.startsWith(",")) + break; + json.cut(1); + value = ReadValue(json); + } + if(!json.startsWith("]")){ + throw new JsonException("Expected ]", json); + } + json.cut(1); + + if(list.func_150303_d() == 3){ + int[] arr = new int[list.tagCount()]; + for(int i = 0; list.tagCount() > 0 ; i++){ + arr[i] = ((NBTTagInt)list.removeTag(0)).func_150287_d(); + } + return new NBTTagIntArray(arr); + } + if(list.func_150303_d() == 1){ + byte[] arr = new byte[list.tagCount()]; + for(int i = 0; list.tagCount() > 0 ; i++){ + arr[i] = ((NBTTagByte)list.removeTag(0)).func_150290_f(); + } + return new NBTTagByteArray(arr); + } + + return list; + } + if(json.startsWith("\"")){ + json.cut(1); + String s = ""; + boolean ignore = false; + while(!json.startsWith("\"") || ignore){ + String cut = json.cutDirty(1); + ignore = cut.equals("\\"); + s += cut; + } + json.cut(1); + return new NBTTagString(s.replace("\\\"", "\"")); + } + String s = ""; + while(!json.startsWith(",", "]", "}")){ + s += json.cut(1); + } + s = s.trim().toLowerCase(); + if(s.isEmpty()) + return null; + try{ + if(s.endsWith("d")){ + return new NBTTagDouble(Double.parseDouble(s.substring(0, s.length() - 1))); + } + if(s.endsWith("f")){ + return new NBTTagFloat(Float.parseFloat(s.substring(0, s.length() - 1))); + } + if(s.endsWith("b")){ + return new NBTTagByte(Byte.parseByte(s.substring(0, s.length() - 1))); + } + if(s.endsWith("s")){ + return new NBTTagShort(Short.parseShort(s.substring(0, s.length() - 1))); + } + if(s.endsWith("l")){ + return new NBTTagLong(Long.parseLong(s.substring(0, s.length() - 1))); + } + if(s.contains(".")) + return new NBTTagDouble(Double.parseDouble(s)); + else + return new NBTTagInt(Integer.parseInt(s)); + } + catch(NumberFormatException ex){ + throw new JsonException("Unable to convert: "+ s +" to a number", json); + } + } + + private static List getListData(NBTTagList list){ + return ObfuscationReflectionHelper.getPrivateValue(NBTTagList.class, list, 0); + } + + private static JsonLine ReadTag(String name, NBTBase base, List list){ + if(!name.isEmpty()) + name = "\"" + name + "\": "; + if(base.getId() == 8){//NBTTagString + String data = ((NBTTagString)base).func_150285_a_(); + data = data.replace("\"", "\\\""); //replace " with \" + list.add(new JsonLine(name + "\"" + data + "\"")); + } + else if(base.getId() == 9){//NBTTagList + list.add(new JsonLine(name + "[")); + NBTTagList tags = (NBTTagList) base; + JsonLine line = null; + List data = getListData(tags); + for(NBTBase b : data) + line = ReadTag("", b, list); + if(line != null) + line.removeComma(); + list.add(new JsonLine("]")); + } + else if(base.getId() == 10){ //NBTTagCompound + list.add(new JsonLine(name + "{")); + NBTTagCompound compound = (NBTTagCompound)base; + JsonLine line = null; + for(Object key : compound.func_150296_c()) + line = ReadTag(key.toString(), compound.getTag(key.toString()), list); + + if(line != null) + line.removeComma(); + + list.add(new JsonLine("}")); + } + else if(base.getId() == 11){//NBTTagList + list.add(new JsonLine(name + base.toString().replaceFirst(",]", "]"))); + } + else{ + list.add(new JsonLine(name + base)); + } + JsonLine line = list.get(list.size() - 1); + line.line += ","; + return line; + } + + private static String ConvertList(List list) { + String json = ""; + int tab = 0; + for(JsonLine tag : list){ + if(tag.reduceTab()) + tab--; + for(int i = 0; i < tab; i++){ + json += " "; + } + json += tag + "\n"; + + if(tag.increaseTab()) + tab++; + } + return json; + } + static class JsonLine{ + private String line; + public JsonLine(String line){ + this.line = line; + } + + public void removeComma(){ + if(line.endsWith(",")) + line = line.substring(0, line.length() - 1); + } + + public boolean reduceTab(){ + int length = line.length(); + return length == 1 && (line.endsWith("}") || line.endsWith("]")) + || length == 2 && (line.endsWith("},") ||line.endsWith("],")); + } + + public boolean increaseTab(){ + return line.endsWith("{") || line.endsWith("["); + } + + @Override + public String toString(){ + return line; + } + } + static class JsonFile{ + private String original; + private String text; + + public JsonFile(String text){ + this.text = text; + this.original = text; + } + + public String cutDirty(int i) { + String s = text.substring(0, i); + text = text.substring(i); + return s; + } + + public String cut(int i) { + String s = text.substring(0, i); + text = text.substring(i).trim(); + return s; + } + + public String substring(int beginIndex, int endIndex) { + return text.substring(beginIndex, endIndex); + } + + public int indexOf(String s) { + return text.indexOf(s); + } + + public String getCurrentPos(){ + int lengthOr = original.length(); + int lengthCur = text.length(); + int currentPos = lengthOr - lengthCur; + String done = original.substring(0, currentPos); + String[] lines = done.split("\r\n|\r|\n"); + + int pos = 0; + String line = ""; + if(lines.length > 0){ + pos = lines[lines.length - 1].length(); + line = original.split("\r\n|\r|\n")[lines.length - 1].trim(); + } + + return "Line: " + lines.length + ", Pos: " + pos + ", Text: " + line; + } + + public boolean startsWith(String... ss) { + for(String s : ss) + if(text.startsWith(s)) + return true; + return false; + } + public boolean endsWith(String s) { + return text.endsWith(s); + } + } + + + public static NBTTagCompound LoadFile(File file) throws IOException, JsonException { + return Convert(Files.toString(file, Charsets.UTF_8)); + } + + public static void SaveFile(File file, NBTTagCompound compound) throws IOException, JsonException { + String json = Convert(compound); + OutputStreamWriter writer = null; + try{ + writer = new OutputStreamWriter(new FileOutputStream(file), Charsets.UTF_8); + writer.write(json); + + } + finally{ + if(writer != null) + writer.close(); + } + } +} diff --git a/src/main/java/noppes/npcs/util/ValueUtil.java b/src/main/java/noppes/npcs/util/ValueUtil.java new file mode 100644 index 000000000..08f016b86 --- /dev/null +++ b/src/main/java/noppes/npcs/util/ValueUtil.java @@ -0,0 +1,19 @@ +package noppes.npcs.util; + +public class ValueUtil { + public static float correctFloat(float given, float min, float max){ + if(given < min) + return min; + if(given > max) + return max; + return given; + } + + public static int CorrectInt(int given, int min, int max) { + if(given < min) + return min; + if(given > max) + return max; + return given; + } +} diff --git a/src/main/java/overview.html b/src/main/java/overview.html new file mode 100644 index 000000000..790901c77 --- /dev/null +++ b/src/main/java/overview.html @@ -0,0 +1,93 @@ + + +

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
HookParamsDescription
Cancelable
Initevent(ScriptEvent), world, npcCalled when the npc spawns or respawns
Updateevent(ScriptEvent), world, npcCalled as update tick (once every 10 ticks)
Interactevent(ScriptEvent), world, npc, playerCalled when a player interacts with the npcyes
Dialogevent(ScriptEvent), world, npc, player, dialogCalled when a player opens a dialog from the npc
DialogClosedevent(ScriptEvent), world, npc, player, dialog, optionCalled when a player selects a dialog option or closes a dialog
Damagedevent(ScriptEventDamaged), world, npcCalled when an npc gets attacked. Can be cancelledyes
Killedevent(ScriptEventKilled), world, npcCalled when an npc gets killed
Attackevent(ScriptEventAttack), world, npcCalled when an npc is going to attackyes
Targetevent(ScriptEventTarget), world, npcCalled when an npc targets somethingyes
TargetLostevent(ScriptEventTarget), world, npc
Called when an npc looses his target
Killsevent(ScriptEvent), world, npc, target
Called when an npc kills something
Roleevent(ScriptEventRole), world, npc, player
Called by some roles
some
Collideevent(ScriptEvent), world, npc, entityCalled when an npc collides with an entity
+

+ + \ No newline at end of file diff --git a/src/main/java/tconstruct/client/tabs/AbstractTab.java b/src/main/java/tconstruct/client/tabs/AbstractTab.java new file mode 100644 index 000000000..6f7b1c414 --- /dev/null +++ b/src/main/java/tconstruct/client/tabs/AbstractTab.java @@ -0,0 +1,65 @@ +package tconstruct.client.tabs; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.entity.RenderItem; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.*; + +public abstract class AbstractTab extends GuiButton { + ResourceLocation texture = new ResourceLocation( + "textures/gui/container/creative_inventory/tabs.png"); + ItemStack renderStack; + RenderItem itemRenderer = new RenderItem(); + + public AbstractTab(int id, int posX, int posY, ItemStack renderStack) { + super(id, posX, posY, 28, 32, ""); + this.renderStack = renderStack; + } + + @Override + public void drawButton(Minecraft mc, int mouseX, int mouseY) { + if (this.visible) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + int yTexPos = this.enabled ? 3 : 32; + int ySize = this.enabled ? 25 : 32; + int xOffset = this.id == 2 ? 0 : 1; + int yPos = this.yPosition + (this.enabled ? 3 : 0); + mc.renderEngine.bindTexture(this.texture); + this.drawTexturedModalRect(this.xPosition, yPos, xOffset * 28, + yTexPos, 28, ySize); + RenderHelper.enableGUIStandardItemLighting(); + this.zLevel = 100.0F; + this.itemRenderer.zLevel = 100.0F; + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + this.itemRenderer.renderItemAndEffectIntoGUI(mc.fontRenderer, + mc.renderEngine, renderStack, xPosition + 6, yPosition + 8); + this.itemRenderer.renderItemOverlayIntoGUI(mc.fontRenderer, + mc.renderEngine, renderStack, xPosition + 6, yPosition + 8); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_BLEND); + this.itemRenderer.zLevel = 0.0F; + this.zLevel = 0.0F; + RenderHelper.disableStandardItemLighting(); + } + } + + @Override + public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) { + boolean inWindow = this.enabled && this.visible + && mouseX >= this.xPosition && mouseY >= this.yPosition + && mouseX < this.xPosition + this.width + && mouseY < this.yPosition + this.height; + if (inWindow) { + this.onTabClicked(); + } + return inWindow; + } + + public abstract void onTabClicked(); + + public abstract boolean shouldAddToList(); +} \ No newline at end of file diff --git a/src/main/java/tconstruct/client/tabs/InventoryTabFactions.java b/src/main/java/tconstruct/client/tabs/InventoryTabFactions.java new file mode 100644 index 000000000..0c8174d78 --- /dev/null +++ b/src/main/java/tconstruct/client/tabs/InventoryTabFactions.java @@ -0,0 +1,37 @@ +package tconstruct.client.tabs; + +import net.minecraft.client.Minecraft; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import noppes.npcs.CustomItems; +import noppes.npcs.client.gui.player.GuiFaction; + +public class InventoryTabFactions extends AbstractTab { + public InventoryTabFactions() { + super(0, 0, 0, new ItemStack(CustomItems.wallBanner, 1, 1)); + if(CustomItems.wallBanner == null) + renderStack = new ItemStack(Blocks.tnt); + } + + @Override + public void onTabClicked() { + Thread t = new Thread(){ + @Override + public void run(){ + try { + Thread.sleep(100); + } catch (InterruptedException e) { + e.printStackTrace(); + } + Minecraft mc = Minecraft.getMinecraft(); + mc.displayGuiScreen(new GuiFaction()); + } + }; + t.start(); + } + + @Override + public boolean shouldAddToList() { + return true; + } +} \ No newline at end of file diff --git a/src/main/java/tconstruct/client/tabs/InventoryTabQuests.java b/src/main/java/tconstruct/client/tabs/InventoryTabQuests.java new file mode 100644 index 000000000..41dde7a5a --- /dev/null +++ b/src/main/java/tconstruct/client/tabs/InventoryTabQuests.java @@ -0,0 +1,39 @@ +package tconstruct.client.tabs; + +import net.minecraft.client.Minecraft; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.network.play.client.C0DPacketCloseWindow; +import noppes.npcs.CustomItems; +import noppes.npcs.client.gui.player.GuiQuestLog; + +public class InventoryTabQuests extends AbstractTab { + public InventoryTabQuests() { + super(0, 0, 0, new ItemStack(CustomItems.letter)); + + if(CustomItems.letter == null) + renderStack = new ItemStack(Items.book); + } + + @Override + public void onTabClicked() { + Thread t = new Thread(){ + @Override + public void run(){ + try { + Thread.sleep(100); + } catch (InterruptedException e) { + e.printStackTrace(); + } + Minecraft mc = Minecraft.getMinecraft(); + mc.displayGuiScreen(new GuiQuestLog(mc.thePlayer)); + } + }; + t.start(); + } + + @Override + public boolean shouldAddToList() { + return true; + } +} \ No newline at end of file diff --git a/src/main/java/tconstruct/client/tabs/InventoryTabVanilla.java b/src/main/java/tconstruct/client/tabs/InventoryTabVanilla.java new file mode 100644 index 000000000..a0c8c965f --- /dev/null +++ b/src/main/java/tconstruct/client/tabs/InventoryTabVanilla.java @@ -0,0 +1,20 @@ +package tconstruct.client.tabs; + +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; + +public class InventoryTabVanilla extends AbstractTab { + public InventoryTabVanilla() { + super(0, 0, 0, new ItemStack(Blocks.crafting_table)); + } + + @Override + public void onTabClicked() { + TabRegistry.openInventoryGui(); + } + + @Override + public boolean shouldAddToList() { + return true; + } +} \ No newline at end of file diff --git a/src/main/java/tconstruct/client/tabs/TabRegistry.java b/src/main/java/tconstruct/client/tabs/TabRegistry.java new file mode 100644 index 000000000..eb37fd542 --- /dev/null +++ b/src/main/java/tconstruct/client/tabs/TabRegistry.java @@ -0,0 +1,101 @@ +package tconstruct.client.tabs; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiInventory; +import net.minecraft.network.play.client.C0DPacketCloseWindow; +import net.minecraftforge.client.event.GuiScreenEvent; +import cpw.mods.fml.client.FMLClientHandler; +import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class TabRegistry { + private static ArrayList tabList = new ArrayList(); + + public static void registerTab(AbstractTab tab) { + tabList.add(tab); + } + + public static ArrayList getTabList() { + return tabList; + } + + @SideOnly(Side.CLIENT) + @SubscribeEvent + public void guiPostInit(GuiScreenEvent.InitGuiEvent.Post event) { + if ((event.gui instanceof GuiInventory)) { + int xSize = 176; + int ySize = 166; + int guiLeft = (event.gui.width - xSize) / 2; + int guiTop = (event.gui.height - ySize) / 2; + guiLeft += getPotionOffset(); + updateTabValues(guiLeft, guiTop, InventoryTabVanilla.class); + addTabsToList(event.buttonList); + } + } + + private static Minecraft mc = FMLClientHandler.instance().getClient(); + + public static void openInventoryGui() { + mc.thePlayer.sendQueue.addToSendQueue(new C0DPacketCloseWindow( + mc.thePlayer.openContainer.windowId)); + GuiInventory inventory = new GuiInventory(mc.thePlayer); + mc.displayGuiScreen(inventory); + } + + public static void updateTabValues(int cornerX, int cornerY, + Class selectedButton) { + int count = 2; + for (int i = 0; i < tabList.size(); i++) { + AbstractTab t = tabList.get(i); + if (t.shouldAddToList()) { + t.id = count; + t.xPosition = cornerX + (count - 2) * 28; + t.yPosition = cornerY - 28; + t.enabled = !t.getClass().equals(selectedButton); + count++; + } + } + } + + public static void addTabsToList(List buttonList) { + for (AbstractTab tab : tabList) { + if (tab.shouldAddToList()) { + buttonList.add(tab); + } + } + } + + public static int getPotionOffset() { + // If at least one potion is active... + if (!mc.thePlayer.getActivePotionEffects().isEmpty()) { + if (Loader.isModLoaded("NotEnoughItems")) { + try { + // Check whether NEI is hidden and enabled + Class c = Class + .forName("codechicken.nei.NEIClientConfig"); + Object hidden = c.getMethod("isHidden").invoke(null); + Object enabled = c.getMethod("isEnabled").invoke(null); + if (hidden != null && hidden instanceof Boolean + && enabled != null && enabled instanceof Boolean) { + if ((Boolean) hidden || !((Boolean) enabled)) { + // If NEI is disabled or hidden, offset the tabs by + // 60 + return 60; + } + } + } catch (Exception e) { + } + } else { + // If NEI is not installed, offset the tabs + return 60; + } + } + // No potions, no offset needed + return 0; + } +} \ No newline at end of file diff --git a/src/main/resources/assets/customnpcs/OpenSans.ttf b/src/main/resources/assets/customnpcs/OpenSans.ttf new file mode 100644 index 000000000..db433349b Binary files /dev/null and b/src/main/resources/assets/customnpcs/OpenSans.ttf differ diff --git a/src/main/resources/assets/customnpcs/lang/cs_CZ.lang b/src/main/resources/assets/customnpcs/lang/cs_CZ.lang new file mode 100644 index 000000000..b377588b2 --- /dev/null +++ b/src/main/resources/assets/customnpcs/lang/cs_CZ.lang @@ -0,0 +1,440 @@ +itemGroup.cnpcs=CustomNpcs Nástroje +itemGroup.cnpcsw=CustomNpcs Zbraně +itemGroup.cnpcsa=CustomNpcs Armor +itemGroup.cnpcsm=CustomNpcs Různé + +tile.npcRedstoneBlock.name=Ruditový blok +tile.npcCarpentyBench.name=Carpenty Bench +tile.npcBloodBlock.name=Blok krve + +gui.deleteConfirm=Jste si jisti, že chcete smazat toto NPC? +gui.add=Přidat +gui.remove=Odstranit +gui.edit=Edit +gui.name=Název +gui.color=Barva +gui.none=Nic +gui.time=Čas +gui.title=Název +gui.categories=Kategorie +gui.close=Zavřít +gui.disabled=Zakázáno +gui.increase=Zvýšení +gui.decrease=Snížení +gui.day=Den +gui.night=Noc +gui.constant=Konstantní +gui.accelerate=Urychlení +gui.small=Malé +gui.medium=Střední +gui.large=Velké +gui.type=Typ +gui.always=Vždy +gui.untilclose=UntilClose +gui.ignoreDamage=Ignorovat poškození + +display.model=Model +display.show=Zobrazit +display.hide=Skrýt +display.showAttacking=Zobrazit při útoku +display.size=Velikost +display.texture=Textura +display.textureCape=Textura kápě +display.player=Player +display.selectTexture=Vyberte texturu +display.livingAnimation=Animace života +display.tint=Barevný odstín + +inv.minExp=Min Exp +inv.maxExp=Max Exp +inv.npcInventory=NPC inventář +inv.inventory=Inventář +inv.dropChance=Šance na drop + +availability.options=Možnosti +availability.always=Vždy +availability.after=Po +availability.before=Před +availability.available=K dispozici +availability.whenactive=Je-li aktivní +availability.whennotactive=Není-li aktivní +availability.selectquest=Vyberte Quest +availability.selectdialog=Vyberte dialog +availability.selectfaction=Vyberte frakci +availability.daytime=Denní +availability.wholeday=Celý den +availability.night=Během noci +availability.day=Během dne +availability.is=Je +availability.isnot=Není + +stats.health=Zdraví +stats.aggro=AggroRange +stats.meleeproperties=Melee vlastnosti +stats.rangedproperties=Range vlastnosti +stats.projectileproperties=VLastnosti projektilu +stats.meleestrength=Síla melee +stats.meleerange=Síla range +stats.meleespeed=Rychlost melee +stats.accuracy=Přesnost (%) +stats.rangedrange=Range vzdálenost +stats.burstspeed=Rychlost útoku +stats.firedelay=Zpoždění útoku +stats.delayvariance=Odchylka zpoždění +stats.burstcount=BurstCount +stats.walkspeed=Rychlsot chůze +stats.chargespeed=Rychlost charge +stats.meleeeffect=Effect (s) +stats.respawn=Respawn +stats.deadbody=Schovat mrtvolu +stats.fireimmune=Imuní na střely +stats.candrown=CanDrown +stats.firesound:=SoundFX +stats.creaturetype=Ty kreatury +stats.normal=Normální +stats.undead=Nemrtvý +stats.arthropod=Arthropod +stats.nofalldamage=Žádný pádový dmg +stats.meleeproperties=Nastavení melee +stats.rangedproperties=Nastavení range +stats.burninsun=BurnsInSun +stats.amplify=Amplified + +stats.size=Velikost +stats.speed=Rychlost +stats.glows=Svítí +stats.hasgravity=HasGravity +stats.explosive=Exploduje +stats.rangedeffect=Effect +stats.trail=TrailType +stats.spin=Roztočení +stats.stick=Tyčinky +stats.regular=Ne Amp +stats.amplified=Amp + +ai.standing=Stojící +ai.wandering=Toulající +ai.movingpath=Cesta chůze +ai.looping=Smyčka +ai.backtracking=Backtracking + +ai.enemyresponse:=OnFoundEnemy +ai.door:=DoorInteract +ai.avoidwater:=AvoidsWater +ai.return:=ReturnToStart +ai.swim:=CanSwim +ai.shelter:=SeekShelter +ai.leapattarget:=LeapAtTarget +ai.clearlos:=MustSeeTarget +ai.indirect:=CanFireIndirect +ai.rangemelee:=UseRangeAttack + +faction.hostiles=Nepřátelská frakce +faction.unfriendly=Nepřátelská +faction.neutral=Neutrální +faction.friendly=Přátelská +faction.points=Body +faction.ondeath=OnDeath +faction.hidden=Schován +faction.default=Výchozí +faction.attackHostile=Útok nepřátelské frakce +faction.defend=Obrana členů frakce +faction.nostanding=Nemáte žádnou interakci s jakoukoli frakcí +faction.options=Možnosti frakce +faction.increasepoints=Frakce %s zvýšeno o %s bodů +faction.decreasepoints=Frakce %s sníženo o %s bodů + +menu.inventory=Invetář +menu.quests=Úkoly +menu.display=Zobrazit +menu.stats=Statistiky +menu.factions=Frakce +menu.ai=AI +menu.advanced=Pokročilé +menu.global=Globální +menu.delete=Vymazat +menu.role=Role + +global.banks=Banky +global.factions=Frakce +global.dialogs=Dialogy +global.quests=Úkoly +global.transport=Transport +global.playerdata=PlayerData +global.recipes=Recipes + +bank.slot=Slot +bank.unlock=Odemknout +bank.upgrade=Upgrade +bank.upgradeCosts=Náklady k upgradu +bank.unlockCosts=Náklady k odemčení + +ank.slot=Slot +bank.unlock=Odemknout +bank.upgrade=Vylepšit +bank.upgradeCosts=Vylepšení stojí +bank.unlockCosts=Odemčení stojí + +follower.waiting=Čekat +follower.following=Sledovat +follower.hire=Najmout +follower.health=Zdraví +follower.daysleft=Zbývá dnů +follower.lastday=Poslední den +follower.day=Den +follower.days=Dny +follower.hireText=Díky, že sis mě pronajal. +follower.farewellText=Naše cesty se zde rozchází. Sbohem, příteli. + +transporter.travel=Travel +transporter.unlock1=Travel do +transporter.unlock2=je nyní odemčený + +dialog.dialog=Dialog +dialog.dialogs=Dialogy +dialog.options=Dialog Možnosti +dialog.dialogtext=Dialog Text +dialog.editoption=Upravit dialogový typ +dialog.optiontype=Volba typu + +quest.quest=Úkol +quest.quests=Úkoly +quest.item=Předmětový úkol +quest.kill=Úkol na zabití +quest.dialog=Úkol na dialog +quest.completedtext=Text při dokončení +quest.questlogtext=Text v deníku +quest.complete=Hotovo +quest.turnin=Teď lze dokončit úkol +quest.start=Spuštěn nový úkol +quest.reward=Odměna +quest.repeatable=Opakovatelné +quest.daily=Denní +quest.weekly=Týdně +quest.instant=Okamžité dokončení +quest.npc=Dokočení NPC + +item.npcWand.name=Npc hůlka +item.npcCloner.name=Npc cloner +item.npcSpawner.name=Mob spawner + +item.npcBanjo.name=Banjo +item.npcViolin.name=Housle +item.npcViolinBow.name=Houslový smyčec +item.npcHarp.name=Harfa +item.npcGuitar.name=Kytara + +item.npcCoinWooden.name=Dřevěná mince +item.npcCoinStone.name=Kamennná mince +item.npcCoinBronze.name=Bronzová mince +item.npcCoinIron.name=Železná mince +item.npcCoinGold.name=Zlatá mince +item.npcCoinDiamond.name=Diamantová mince +item.npcCoinEmerald.name=Emeraldová mince + +item.npcWoodenGun.name=Dřevěná pistole +item.npcStoneGun.name=Kamenná pistole +item.npcIronGun.name=Železná pistole +item.npcGoldGun.name=Zlatá pistole +item.npcDiamondGun.name=Diamantová pistole +item.npcBronzeGun.name=Bronzová pistole +item.npcEmeraldGun.name=Emeraldová pistole +item.npcMachineGun.name=Kulomet + +item.npcWoodenBullet.name=Dřevěná kulka +item.npcStoneBullet.name=Kamenná kulka +item.npcIronBullet.name=Železná kulka +item.npcGoldenBullet.name=Zlatá kulka +item.npcDiamondBullet.name=Diamantová kulka +item.npcBronzeBullet.name=Bronzová kulka +item.npcBlackBullet.name=Černá kulka +item.npcEmeraldBullet.name=Emeraldová kulka + +item.npcWoodenTrident.name=Dřevěný trojzubec +item.npcStoneTrident.name=Kamenný trojzubec +item.npcIronTrident.name=Železný trojzubec +item.npcGoldTrident.name=Zlatý trojzubec +item.npcDiamondTrident.name=Diamantový trojzubec +item.npcBronzeTrident.name=Bronzový trojzubec +item.npcEmeraldTrident.name=Emeraldový trojzubec +item.npcCursedTrident.name=Prokletý trojzubec + +item.npcNatureSpell.name=Přírodní kouzlo +item.npcArcaneSpell.name=Arcane kouzlo +item.npcLightningSpell.name=Bleskové kouzlo +item.npcIceSpell.name=Ledové kouzlo +item.npcFireSpell.name=Ohnivé kouzlo +item.npcDarkSpell.name=Temné kouzlo +item.npcHolySpell.name=Svaté kouzlo + +item.npcKunai.name=Kunai +item.npcReverseKunai.name=Obrácená kunai +item.npcShuriken.name=Shuriken +item.npcGiantShuriken.name=Velký Shuriken +item.npcKatana.name=Katana +item.npcKukri.name=Kukri + +item.npcGolfClub.name=Golfová hůl +item.npcMagicWand.name=Magická hůlka +item.npcChickenSword.name=Slepičí meč +item.npcHandCuffs.name=Želízka +item.npcHammer.name=Kladivo +item.npcBaseballBat.name=Baseballová čepice +item.npcLeadPipe.name=Olověná dýmka +item.npcCleaver.name=Sekáček +item.npcSaber.name=Šavle +item.npcHockeyStick.name=Hokejka +item.npcSledgeHammer.name=Perlík +item.npcBrokenBottle.name=Rozbitá láhev +item.npcCombatKnive.name=Bojový nůž +item.npcLighter.name=Zapalovač +item.npcBatton.name=Obušek +item.npcGunChainsaw.name=Řetězová pila +item.npcRapier.name=Rapír +item.npcCrowbar.name=Sochor +item.npcWrench.name=Hasák +item.npcSwissArmyKnife.name=Švýcarský nůž + +item.npcWoodenShield.name=Dřevěný Štít +item.npcStoneShield.name=Kamenný Štít +item.npcIronShield.name=Železný Štít +item.npcGoldenShield.name=Zlatý Štít +item.npcDiaShield.name=Diamantový Štít +item.npcBronzeShield.name=Bronzový Štít +item.npcFullWoodenShield.name=Velký Dřevěný Štít +item.npcFullStoneShield.name=Velký Kamenný Štít +item.npcFullIronShield.name=Velký Železný Štít +item.npcFullGoldenShield.name=Velký Zlatý Štít +item.npcFullDiaShield.name=Velký Diamantový Štít +item.npcFullBronzeShield.name=Velký Bronzový Štít +item.npcTowerShield.name=Věžovitý šťít z oceli +item.npcCryscentShield.name=Ocelový cryscent šťít +item.npcScutumShield.name=Ocelový scutum šťít +item.npcHeaterShield.name=Ocelový heater šťít + +item.npcWoodenSpear.name=Dřevěné kopí +item.npcStoneSpear.name=Kamenné kopí +item.npcIronSpear.name=Železné kopí +item.npcGoldenSpear.name=Zlaté kopí +item.npcDiamondSpear.name=Diamantové kopí +item.npcBronzeSpear.name=Bronzové kopí +item.npcEmeraldSpear.name=Emeraldové kopí + +item.npcWoodenBattleAxe.name=Dřevěná válečná sekera +item.npcStoneBattleAxe.name=Kamenná válečná sekera +item.npcIronBattleAxe.name=Železná válečná sekera +item.npcGoldenBattleAxe.name=Zlatá válečná sekera +item.npcDiamondBattleAxe.name=Diamantová válečná sekera +item.npcBronzeBattleAxe.name=Bronzová válečná sekera +item.npcEmeraldBattleAxe.name=Emeraldová válečná sekera + +item.npcWoodenMace.name=Dřevěný palcát +item.npcStoneMace.name=Kamenný palcát +item.npcIronMace.name=Železný palcát +item.npcGoldenMace.name=Zlatý palcát +item.npcDiamondMace.name=Diamantový palcát +item.npcBronzeMace.name=Bronzový palcát +item.npcEmeraldMace.name=Emeraldový palcát + +item.npcWoodenDagger.name=Dřevěná dýka +item.npcStoneDagger.name=Kamenná dýka +item.npcIronDagger.name=Železná dýka +item.npcGoldenDagger.name=Zlatá dýka +item.npcDiamondDagger.name=Diamantová dýka +item.npcBronzeDagger.name=Bronzová dýka +item.npcEmeraldDagger.name=Emeraldová dýka +item.npcDeadlyDiamondDagger.name=Vražedná Diamond dýka +item.npcWoodenReversedDagger.name=Obrácená dřevěná dýka +item.npcStoneReversedDagger.name=Obrácená kamenná dýka +item.npcIronReversedDagger.name=Obrácená železná dýka +item.npcGoldenReversedDagger.name=Obrácená zlatá dýka +item.npcDiamondReversedDagger.name=Obrácená diamantová dýka +item.npcBronzeReversedDagger.name=Obrácená bronzová dýka +item.npcEmeraldReversedDagger.name=Obrácená emeraldová dýka + +item.npcWoodenStaff.name=Dřevěná hůl +item.npcIronStaff.name=Železná hůl +item.npcGoldenStaff.name=Zlatá hůl +item.npcDiamondStaff.name=Diamantová hůl +item.npcElementalStaff.name=Elemental hůl + +item.npcWoodenScythe.name=Dřevěná kosa +item.npcStoneScythe.name=Kamenná kosa +item.npcIronScythe.name=Železná kosa +item.npcGoldenScythe.name=Zlatá kosa +item.npcEmeraldScythe.name=Emeraldová kosa +item.npcDiamondScythe.name=Diamantová kosa + +item.npcWoodenGlaive.name=Dřevěná glaive +item.npcStoneGlaive.name=Kamenná glaive +item.npcIronGlaive.name=Železná glaive +item.npcGoldenGlaive.name=Zlatá glaive +item.npcDiamondGlaive.name=Diamantová glaive +item.npcBronzeGlaive.name=Bronzová glaive +item.npcEmeraldGlaive.name=Emeraldový glaive + +item.npcCowleatherHead.name=Helma z kravské kůže +item.npcCowleatherChest.name=Brnění z kravské kůže +item.npcCowleatherLegs.name=Kalhoty z kravské kůže +item.npcCowleatherBoots.name=Boty z kravské kůže + +item.npcNanorumHead.name=Trpasličí helma +item.npcNanorumChest.name=Trpasličí brnění +item.npcNanorumLegs.name=Trpasličí kalhoty +item.npcNanorumBoots.name=Trpasličí Boots + +item.npcTacticalHead.name=Taktická helma +item.npcTacticalChest.name=Taktická vesta + +item.npcFullIronHead.name=Lepší železná helma +item.npcFullIronChest.name=Lepší železné brnění + +item.npcFullGoldHead.name=Lepší zlatá helma +item.npcFullGoldChest.name=Lepší zlaté brnění + +item.npcFullDiamondHead.name=Lepší diamantová helma +item.npcFullDiamondChest.name=Lepší diamantové brnění + +item.npcFullBronzeHead.name=Lepší brozová helma +item.npcFullBronzeChest.name=Lepší bronzové brnění +item.npcFullBronzeLeggings.name=Lepší bronzové kalhoty +item.npcFullBronzeBoots.name=Lepší bronzové boty + +item.npcFullWoodenHead.name=Lepší dřevěná helma +item.npcFullWoodenChest.name=Lepší dřevěné brnění +item.npcFullWoodenLeggings.name=Lepší dřevěné kalhoty +item.npcFullWoodenBoots.name=Lepší dřevěné boty + +item.npcTuxedoChest.name=Tuxedo brnění +item.npcTuxedoPants.name=Tuxedo kalhoty +item.npcTuxedoBottom.name=Tuxedo plášť + +item.npcWizardHead.name=Kouzelnická čapka +item.npcWizardChest.name=Kouzelnické brnění +item.npcWizardPants.name=Kouzelnické kalhoty + +item.npcAssassinHead.name=Přilba zabijáka +item.npcAssassinChest.name=Brnění zabijáka +item.npcAssassinLeggings.name=Kalhoty zabijáka +item.npcAssassinBoots.name=Boty zabijáka + +item.npcSoldierHead.name=Vojenská helma +item.npcSoldierChest.name=Vojenské brnění +item.npcSoldierLegs.name=Vojenské kalhoty +item.npcSoldierBottom.name=Vojenský kabát + +item.npcX407Head.name=X407 Prototyp helmy +item.npcX407Chest.name=X407 Prototyp brnění +item.npcX407Legs.name=X407 Prototyp kalhot +item.npcX407Boots.name=X407 Prototyp bot + +item.npcCommissarHead.name=Komisařovo helma +item.npcCommissarChest.name=Komisařovo brnění +item.npcCommissarLegs.name=Komisařovo kalhoty +item.npcCommissarBottom.name=Komisařovo boty + +item.npcInfantryHelmet.name=Armádní helma +item.npcOfficerHelmet.name=důstojnické brnění + +item.npcCrown.name=Koruna +item.npcCrown2.name=Koruna \ No newline at end of file diff --git a/src/main/resources/assets/customnpcs/lang/de_DE.lang b/src/main/resources/assets/customnpcs/lang/de_DE.lang new file mode 100644 index 000000000..5efa87a55 --- /dev/null +++ b/src/main/resources/assets/customnpcs/lang/de_DE.lang @@ -0,0 +1,870 @@ +customnpcs.defaultTextColor=404040 + +entity.CustomNpc.name=Custom Npc + +itemGroup.cnpcs=CustomNpcs Werkzeuge +itemGroup.cnpcsw=CustomNpcs Waffen +itemGroup.cnpcsa=CustomNpcs Rüstung +itemGroup.cnpcsb=CustomNpcs Blöcke +itemGroup.cnpcsm=CustomNpcs Verschiedenes + +tile.npcRedstoneBlock.name=Redstone Block +tile.npcCarpentyBench.name=Werkbank +tile.npcBloodBlock.name=Blut Block +tile.npcMailbox.name=Mail-Box +tile.npcLocationBlock.name=Location Quest Block +tile.npcBanner.name=Fahne +tile.npcWallBanner.name=Wand Fahne +tile.npcChair.name=Stuhl +tile.npcCrate.name=Kiste +tile.npcTallLamp.name=Stehlampe +tile.npcWeaponRack.name=Waffenregal +tile.npcCouchWool.name=Sofa +tile.npcTable.name=Holztisch +tile.npcCouchWood.name=Holzsofa +tile.npcLamp.name=Lampe +tile.npcCandle.name=Kerze +tile.npcStool.name=Hocker +tile.npcBorder.name=Grenzblock +tile.npcBigSign.name=Großes Schild +tile.npcBarrel.name=Fass +tile.npcShelf.name=Regal +tile.npcSign.name=Schild +tile.npcTombstone.name=Grabstein +tile.npcCampfire.name=Lagerfeuer +tile.npcBeam.name=Holz Strahl +tile.npcPedestal.name=Sockel +tile.npcPlaceholder_0.name=Platzhalter +tile.npcPlaceholder_1.name=Platzhalter +tile.npcPlaceholder_2.name=Platzhalter +tile.npcPlaceholder_3.name=Platzhalter +tile.npcPlaceholder_4.name=Platzhalter +tile.npcPlaceholder_5.name=Platzhalter +tile.npcPlaceholder_6.name=Platzhalter +tile.npcPlaceholder_7.name=Platzhalter +tile.npcPlaceholder_8.name=Platzhalter +tile.npcPlaceholder_9.name=Platzhalter +tile.npcPlaceholder_10.name=Platzhalter +tile.npcPlaceholder_11.name=Platzhalter +tile.npcPlaceholder_12.name=Platzhalter +tile.npcPlaceholder_13.name=Platzhalter +tile.npcPlaceholder_14.name=Platzhalter +tile.npcPlaceholder_15.name=Platzhalter + +gui.delete=Sind Sie sicher das sie diesen NPC löschen möchten? +gui.add=Hinzufügen +gui.remove=Entfernen +gui.save=Speichern +gui.name=Name +gui.color=Farbe +gui.none=Nichts +gui.time=Zeit +gui.title=Titel +gui.categories=Kategorie +gui.close=Schließen +gui.disabled=Aus +gui.increase=Erhöhen +gui.decrease=Verringern +gui.day=Tag +gui.night=Nacht +gui.constant=Konstant +gui.accelerate=Beschleunigen +gui.small=Klein +gui.medium=Mittel +gui.large=Groß +gui.type=Typ +gui.retaliate=Normal +gui.panic=Panik +gui.retreat=Rückzug +gui.nothing=Nichts +gui.break=Pause +gui.open=Offen +gui.darkness=Dunkelheit +gui.sunlight=Sonnenlicht +gui.always=Immer +gui.untilclose=bis Schließen +gui.whenavailable=Unterwegs +gui.ignoreDamage=Schaden ignorieren +gui.minrange=Min. Bereich +gui.engagedistance=Engage Entfernung +gui.orbitdistance=Orbit Entfernung +gui.fightifthisclose=Kämpfen, wenn diese schließen +gui.ambushdistance=Ambush Entfernung +gui.whendistant=Wenn Distant +gui.whenhidden=Wenn Versteckt +gui.currentFolder=Aktueller Ordner +gui.play=Play +gui.selectSound=Wähle Sound +gui.selectnpc=Wähle NPC +gui.select=Wähle +gui.range=Entfernung +gui.name=Name +gui.partly=Geist +gui.copy=Kopie +gui.clear=Löschen +gui.done=Fertig +gui.paste=Einfügen +gui.settings=Einstellungen +gui.enabled=Aktiviert +gui.website=Webseite +gui.text=Text +gui.detailed=Detailliert +gui.server=Server +gui.showmore=Zeig mehr +gui.update=Update + +remote.title=In der Nähe NPCs +remote.reset=Reset +remote.tp=Tp zu +remote.resetall=Alle Resetten +remote.freeze=NPCs einfrieren + +spawner.entities=Unternehmen +spawner.clones=Klone +spawner.mobspawner=MobSpawner +spawner.mount=Geritten von... +spawner.mountplayer=Geritten von selbst + +spawner.diesafter=Stirbt, nachdem Laiche sterben +spawner.posoffset=Position Offset +spawner.type=Spawn Typ +spawner.all=Alle +spawner.random=Zufall +spawner.one=Nacheinander +spawner.despawn=Despawnt die Spawns am Ziel + +mailbox.name=Mail-Box +mailbox.sender=Sender +mailbox.read=Lesen +mailbox.timesend=vor %s +mailbox.day=Tag +mailbox.days=Tage +mailbox.hour=Stunde +mailbox.hours=Stunden +mailbox.minute=Minute +mailbox.minutes=Minuten +mailbox.username=User-Name +mailbox.subject=Thema +mailbox.send=Schicken +mailbox.write=Mail schreiben +mailbox.succes=Erfolgreich an %s geschickt +mailbox.errorUsername=Unbekannter User-Name +mailbox.errorSubject=Gegenstand kann nicht leer sein +mailbox.setup=Setup-Mail + +display.model=Model +display.show=Zeigen +display.hide=Verstecken +display.showAttacking=Beim Angriff zeigen +display.size=Größe +display.texture=Texture +display.cape=Umhang +display.overlay=Auflage +display.player=Spieler +display.selectTexture=Wähle Texture +display.livingAnimation=Lebende Animation +display.visible=Sichtbar +display.bossbar=Boss-Lebensanzeige +display.url=Url + +inv.minExp=Min. Xp +inv.maxExp=Max. Xp +inv.npcInventory=NPC Inventar +inv.inventory=Inventar +inv.dropChance=Drop chance + +availability.options=Verfügbarkeit Optionen +availability.always=Immer +availability.after=Danach +availability.before=Vorher +availability.available=Verfügbar +availability.whenactive=Wenn Aktiv +availability.whennotactive=Wenn Inaktiv +availability.selectquest=Wähle Quest +availability.selectdialog=Wähle Dialog +availability.selectfaction=Wähle Fraktion +availability.daytime=Tageszeit +availability.wholeday=Den ganzen Tag +availability.night=Nachtsüber +availability.day=Tagsüber +availability.is=ist +availability.isnot=ist nicht +availability.minlevel=XP Level +availability.name=Verfügbarkeit +availability.areaNotAvailble=Sie können auf diese Weise nicht weitergehen +availability.permission=Du hast keine Rechte um dies zu tun +availability.editIcon=Für die nächsten 10 Sekunden können Sie ein beliebiges Item, mit der rechten Maustaste einfügen + +spawning.availableBiomes=Erhätliche Biome +spawning.spawningBiomes=Spawning Biome +spawning.biomes=Biome +spawning.weightedChance=Chance + +role.name=Rolle +role.none=Keine Rolle +role.trader=Händler +role.follower=Verfolger +role.bank=Bank +role.transporter=Transporter +role.mailman=Mailman +role.marketname=Verlinkter Händler Name +role.companion=Begleiter + +trader.insufficient=Du hast nicht, was er will! +trader.sufficient=ausreichende Geld + +job.name=Job +job.none=Kein Job +job.bard=Bard +job.guard=Guard +job.healer=Heiler +job.bard=Sänger +job.itemgiver=Item Geber +job.boss=Boss +job.spawner=Spawner +job.conversation=Gespräch +job.chunkloader=Chunk Loader +job.puppet=Puppe + +stats.health=Leben +stats.aggro=Agro Reichweite +stats.meleeproperties=Nahkampf Eigenschaften +stats.rangedproperties=Reichweite Eigenschaften +stats.projectileproperties=Projektil Typ +stats.meleestrength=Stärke +stats.meleerange=Reichweite +stats.meleespeed=Geschwindigkeit +stats.accuracy=Genauigkeit (%) +stats.rangedrange=Reichweite +stats.burstspeed=Feuerrate +stats.mindelay=Min Verzögerung +stats.maxdelay=Max Verzögerung +stats.burstcount=Sprengungsradius +stats.shotcount=Shot Count +stats.walkspeed=Geh Geschwindigkeit +stats.meleeeffect=Effekte +stats.respawn=Wiederbelebeung +stats.deadbody=Verstecke toten Körper +stats.fireimmune=Feuerimmunität +stats.candrown=Kann ertrinken +stats.firesound:=SoundFX +stats.creaturetype=Kreaturen Typ +stats.normal=Normal +stats.undead=Untot +stats.arthropod=Gliederfüßler +stats.nofalldamage=Kein Fallschaden +stats.meleeproperties=Nahkampf Optionen +stats.rangedproperties=Fernkampf Optionen +stats.burninsun=Verbrennt in der Sonne +stats.amplify=Stärkung +stats.melee=Nahkampf +stats.regenhealth=Leben Regenerieren +stats.combatregen=In Kampf Regenerieren +stats.naturallydespawns=Naturally Despawn + +stats.size=Größe +stats.speed=Speed +stats.glows=Glüht +stats.noglow=Glüht nicht +stats.hasgravity=Physik +stats.explosive=Explodiert +stats.rangedeffect=Effekt +stats.trail=Spur Typ +stats.spin=Drehen +stats.stick=Sticks +stats.regular=No Amp +stats.amplified=Amp +stats.explosion=Explosion + +ai.standing=Stehend +ai.wandering=Wandert +ai.movingpath=Weg abgehen +ai.looping=Schleife ablaufen +ai.backtracking=Zurückgehen +ai.enemyresponse=Gegner gefunden +ai.door=Tür (Pause: Zerstören) +ai.avoidwater=Meidet Wasser +ai.return=Zurück zum Anfang +ai.swim=Kann schwimmen +ai.shelter=Flüchtet vor +ai.leapattarget=Sprung Angriff +ai.sprint=Kann Sprinten +ai.clearlos=MussDasZielSehen +ai.indirect=Feuert indirekt +ai.rangemelee=EinsatzbereichAngriff +ai.tacticalvariant=taktische Variante +ai.cobwebAffected=LangsamInNetz +ai.movement=Bewegung + +aitactics.rush=Rush +aitactics.stagger=Ausweichen +aitactics.orbit=umzingeln +aitactics.hitandrun=Hit&Run +aitactics.ambush=Hinterhalt +aitactics.stalk=Stalk + +advanced.idlesound=LivingSound +advanced.angersound=AngrySound +advanced.hurtsound=HurtSound +advanced.deathsound=DeathSound +advanced.stepsound=StepSound +advanced.sounds=Sounds +advanced.lines=Sprüche +advanced.night=Nacht +advanced.editingmode=EditingMode +advanced.loadday=Tag NPC laden +advanced.loadnight=Nacht NPC laden +advanced.haspitch=hat Pech + +faction.hostiles=Feindliche Fraktionen +faction.unfriendly=Unfreundlich +faction.neutral=Neutral +faction.friendly=Freundlich +faction.points=Punkte +faction.ondeath=Beim Tod +faction.hidden=Versteckt +faction.default=Voreinstellung +faction.attackHostile=Feindlich Fraktionen angreifen +faction.defend=Verteidige Fraktionsmitglieder +faction.nostanding=Ihr steht zu keiner Fraktion +faction.options=Fraktion +faction.increasepoints=Fraktion % wurde um % erhöht +faction.decreasepoints=Fraktion % wurde um % verringert +faction.attacked=MobsGreifenAn + +menu.inventory=Inventar +menu.display=Aussehen +menu.stats=Werte +menu.factions=Fraktionen +menu.ai=AI +menu.advanced=Erweitert +menu.global=Global +menu.role=Rolle + +global.banks=Banks +global.transport=Transport +global.playerdata=PlayerData +global.recipes=Rezepte +global.naturalspawn=Natural Spawns + +bank.slot=Slot +bank.unlock=Freischalten +bank.upgrade=Erweitern +bank.upgradeCosts=Kosten für Erweiterung +bank.unlockCosts=Kosten für Freischalten + +follower.waiting=Warten +follower.following=Folgen +follower.hire=Anheuern +follower.health=Leben +follower.daysleft=verbleibende Tage +follower.lastday=Letzter Tag +follower.day=Tag +follower.days=Tage +follower.hireText=Danke, das du mich angeheuert hast.Ich folge dir für +follower.farewellText=Meine Tage mit dir sind vorrüber. Machs gut! +follower.infiniteDays=Unendlich Tage +follower.guiDisabled=Gui deaktivieren + +transporter.travel=Reisen +transporter.unlock=Transport zu %s ist nun freigeschaltet +transporter.discovered=Verfügbar, wenn entdeckt +transporter.start=Von Anfang an verfügbar +transporter.interaction=Erhältlich nach Wechselwirkung + +conversation.delay=Delay +conversation.line=Text + +bard.jukebox=Play an Jukebox +bard.background=Play in Hintergrund +bard.ondistance=On Distance +bard.offdistance=Off Distance +bard.hasoff=Has Off Distance + +dialog.dialog=Dialog +dialog.dialogs=Dialogs +dialog.options=Dialog Optionen +dialog.dialogtext=Dialog Text +dialog.editoption=Bearbeite Dialog Optionen +dialog.optiontype=Option Typ +dialog.selectoption=Wähle Optionen +dialog.quitoption=Optionen verlassen +dialog.option=Dialog Optionen +dialog.roleoption=Rolle Optionen +dialog.commandoption=Kommand Optionen +dialog.commandoptionplayer=Benutze "@dp" für den Namen der mit den NPC spricht +dialog.hideNPC=Verstecke NPC +dialog.showWheel=Zeige Dialog Rad + +quest.quest=Quest +quest.quests=Quests +quest.item=Item +quest.kill=Tötungs Quest +quest.areakill=Area Tötungs Quest +quest.dialog=Dialog +quest.location=Location +quest.completedtext=Abgeschlossener Text +quest.questlogtext=Questlog text +quest.complete=Abschließen +quest.reward=Belohnung +quest.repeatable=Wiederholbar +quest.mcdaily=MC Täglich +quest.mcweekly=MC Wöchentlich +quest.rldaily=RL Täglich +quest.rlweekly=RL Täglich +quest.instant=Sofort Abgeschlossen +quest.npc=Abgeschlossen bei npc +quest.next=Nächste Quest +quest.found=Gefunden +quest.notfound=Nicht gefunden +quest.completed=Quest abgeschlossen +quest.newquest=Neue Quest +quest.noquests=Du hast keine Quest angenommen +quest.completewith=Abgeschlossen mit %s +quest.randomitem=Zufalls Item +quest.exp=XP +quest.takeitems=Nimmt die Items +quest.objectives=Ziele + +script.init=Drin +script.interact=interagieren +script.update=Update +script.console=Konsole +script.language=Sprache +script.damaged=Schaden +script.killed=Sterben +script.attack=Angriff +script.target=Ziel +script.availableScripts=erhältlich Scripts +script.loadedScripts=Lädt Scripts +script.collide=kollidieren + +item.npcWand.name=Npc Zauberstab +item.npcMobCloner.name=Npc Kloner +item.npcMovingPath.name=Npc Pather +item.npcMounter.name=Npc Reiter +item.npcTeleporter.name=Teleporter +item.npcScripter.name=Npc Scripter + +item.npcBanjo.name=Banjo +item.npcViolin.name=Violine +item.npcViolinBow.name=Geige +item.npcHarp.name=Harfe +item.npcGuitar.name=Gitarre +item.npcFrenchHorn.name=Französisches Horn +item.npcOcarina.name=Ocarina +item.npcClarinet.name=Klarinette + +item.npcCoinWooden.name=Holzmünze +item.npcCoinStone.name=Steinmünze +item.npcCoinBronze.name=Bronzemünze +item.npcCoinIron.name=Eisenmünze +item.npcCoinGold.name=Goldmünze +item.npcCoinDiamond.name=Diamantmünze +item.npcCoinEmerald.name=Smaragtmünze + +item.npcWoodenGun.name=Holzpistole +item.npcStoneGun.name=Steinpistole +item.npcIronGun.name=Eisenpistole +item.npcGoldGun.name=Goldpistole +item.npcDiamondGun.name=Diamantpistole +item.npcBronzeGun.name=Bronzepistole +item.npcEmeraldGun.name=Smaragdpistole +item.npcMachineGun.name=Maschinengewehr + +item.npcWoodenBullet.name=Holzkugel +item.npcStoneBullet.name=Steinkugel +item.npcIronBullet.name=Eisenkugel +item.npcGoldenBullet.name=Goldkugel +item.npcDiamondBullet.name=Diamantkugel +item.npcBronzeBullet.name=Bronzekugel +item.npcEmeraldBullet.name=Smaragdkugel +item.npcBlackBullet.name=schwarze Kugel + +item.npcWoodenTrident.name=Holzdreizack +item.npcStoneTrident.name=Holzdreizack +item.npcIronTrident.name=Eisendreizack +item.npcGoldTrident.name=Golddreizack +item.npcDiamondTrident.name=Diamantdreizack +item.npcBronzeTrident.name=Bronzedreizack +item.npcEmeraldTrident.name=Smaragddreizack +item.npcCursedTrident.name=Verfluchter Dreizack +item.npcDemonicTrident.name=Demonen Dreizack +item.npcFrostTrident.name=Eis Dreizack + +item.npcNatureSpell.name=Naturzauber +item.npcArcaneSpell.name=Arkaner Zauber +item.npcLightningSpell.name=Blitzzauber +item.npcIceSpell.name=Eiszauber +item.npcFireSpell.name=Feuerzauber +item.npcDarkSpell.name=Dunkler Zauber +item.npcHolySpell.name=Heiliger Zauber + +item.npcKunai.name=Kunai +item.npcReverseKunai.name=Umgedrehtes Kunai +item.npcShuriken.name=Wurfstern +item.npcGiantShuriken.name=Riesiger Wurfstern +item.npcKatana.name=Katana +item.npcKukri.name=Kukri + +item.npcGolfClub.name=Golfschläger +item.npcMagicWand.name=Zauberstab +item.npcChickenSword.name=Hühnchenschwert +item.npcHandCuffs.name=Handschellen +item.npcHammer.name=Hammer +item.npcBaseballBat.name=Baseballschläger +item.npcLeadPipe.name=Blasrohr +item.npcCleaver.name=Hackbeil +item.npcSaber.name=Säbel +item.npcHockeyStick.name=Hockeyschläger +item.npcSledgeHammer.name=Schlachthammer +item.npcBrokenBottle.name=zerbrochene Flasche +item.npcCombatKnive.name=Kampfmesser +item.npcLighter.name=Feuerzeug +item.npcBatton.name=Schlagstock +item.npcGunChainsaw.name=Kettensägenpistole +item.npcRapier.name=Rapier +item.npcCrowbar.name=Brecheisen +item.npcPipeWrench.name=Rohrzange +item.npcWrench.name=Schraubenschlüssel +item.npcSwissArmyKnife.name=Schweizer Taschenmesser +item.npcLeafBlade.name=Spreite + +item.npcWoodenShield.name=Rundes Holz Schild +item.npcStoneShield.name=Rundes Stein Schild +item.npcIronShield.name=Rundes Eisen Schild +item.npcGoldenShield.name=Rundes Gold Schild +item.npcDiaShield.name=Rundes Diamant Schild +item.npcBronzeShield.name=Rundes Bronze Schild +item.npcEmeraldShield.name=Rundes Smaragd Schild +item.npcDemonicShield.name=Rundes Demonen Schild +item.npcFrostShield.name=Rundes Eis Schild +item.npcFullWoodenShield.name=Holz Schild +item.npcFullStoneShield.name=Stein Schild +item.npcFullIronShield.name=Eisen Schild +item.npcFullGoldenShield.name=Gold Schild +item.npcFullDiaShield.name=Diamant Schild +item.npcFullBronzeShield.name=Bronze Schild +item.npcFullEmeraldShield.name=Smaragd + +item.npcTowerShield.name=stählerner Turmschild +item.npcCryscentShield.name=stählerner Halbmondschild +item.npcScutumShield.name=stählerner Scutumschild +item.npcHeaterShield.name=stählerner Heaterschild + +item.npcWoodenSpear.name=Holzspeer +item.npcStoneSpear.name=Steinspeer +item.npcIronSpear.name=Eisenspeer +item.npcGoldenSpear.name=Goldspeer +item.npcDiamondSpear.name=Diamantspeer +item.npcBronzeSpear.name=Bronzespeer +item.npcEmeraldSpear.name=Smaragdspeer +item.npcDemonicSpear.name=Demonenspeer +item.npcFrostSpear.name=Eisspeer + +item.npcWoodenBattleAxe.name=Holzkampfaxt +item.npcStoneBattleAxe.name=Steinkampfaxt +item.npcIronBattleAxe.name=Eisenkampfaxt +item.npcGoldenBattleAxe.name=Goldkampfaxt +item.npcDiamondBattleAxe.name=Diamantkampfaxt +item.npcBronzeBattleAxe.name=Bronzekampfaxt +item.npcEmeraldBattleAxe.name=Smaragdkampfaxt +item.npcDemonicBattleAxe.name=Demonenkampfaxt +item.npcFrostBattleAxe.name=Eiskampfaxt + +item.npcWoodenMace.name=Holzkeule +item.npcStoneMace.name=Steinkeule +item.npcIronMace.name=Eisenkeule +item.npcGoldenMace.name=Goldkeule +item.npcDiamondMace.name=Diamantkeule +item.npcBronzeMace.name=Bronzekeule +item.npcEmeraldMace.name=Smaragdkeule +item.npcDemonicMace.name=Demonenkeule +item.npcFrostMace.name=Eiskeule + +item.npcWoodenDagger.name=Holzmesser +item.npcStoneDagger.name=Steinmesser +item.npcIronDagger.name=Eisenmesser +item.npcGoldenDagger.name=Goldmesser +item.npcDiamondDagger.name=Diamantmesser +item.npcBronzeDagger.name=Bronzemesser +item.npcEmeraldDagger.name=Smaragdmesser +item.npcDemonicDagger.name=Demonenmesser +item.npcFrostDagger.name=Eismesser +item.npcWoodenReversedDagger.name=Umgedrehtes Holzmesser +item.npcStoneReversedDagger.name=Umgedrehtes Steinmesser +item.npcIronReversedDagger.name=Umgedrehtes Eisenmesser +item.npcGoldenReversedDagger.name=Umgedrehtes Goldmesser +item.npcDiamondReversedDagger.name=Umgedrehtes Diamantmesser +item.npcBronzeReversedDagger.name=Umgedrehtes Bronzemesser +item.npcEmeraldReversedDagger.name=Umgedrehtes Smaragdmesser +item.npcDemonicReversedDagger.name=Umgedrehtes Demonenmesser +item.npcFrostReversedDagger.name=Umgedrehtes Eismesser + +item.npcWoodenStaff.name=Holzstab +item.npcStoneStaff.name=Steinstab +item.npcIronStaff.name=Eisenstab +item.npcGoldenStaff.name=Goldstab +item.npcDiamondStaff.name=Diamantstab +item.npcBronzeStaff.name=Bronzestab +item.npcEmeraldStaff.name=Smaragdstab +item.npcElementalStaff.name=Elementarstab +item.npcDemonicStaff.name=Demonenstab +item.npcFrostStaff.name=Eisstab + +item.npcWoodenScythe.name=Holzsense +item.npcStoneScythe.name=Steinsense +item.npcIronScythe.name=Eisensense +item.npcGoldenScythe.name=Goldsense +item.npcBronzeScythe.name=Bronzesense +item.npcDiamondScythe.name=Diamantsense +item.npcEmeraldScythe.name=Smaragdsense +item.npcDemonicScythe.name=Demonensense +item.npcFrostScythe.name=Eissense + +item.npcWoodenGlaive.name=Holzglefe +item.npcStoneGlaive.name=Steinglefe +item.npcIronGlaive.name=Eisenglefe +item.npcGoldenGlaive.name=Goldglefe +item.npcDiamondGlaive.name=Diamantglefe +item.npcBronzeGlaive.name=Bronzeglefe +item.npcEmeraldGlaive.name=Smaragdglefe +item.npcDemonicGlaive.name=Demonenglefe +item.npcFrostGlaive.name=Eisglefe + +item.npcCowleatherHead.name=Kuhlederhelm +item.npcCowleatherChest.name=Kuhlederharnisch +item.npcCowleatherLegs.name=Kuhlederbeinschienen +item.npcCowleatherBoots.name=Kuhlederstiefel + +item.npcNanorumHead.name=Nanorumhelm +item.npcNanorumChest.name=Nanorumharnisch +item.npcNanorumLegs.name=Nanorumbeinschienen +item.npcNanorumBoots.name=Nanorumstiefel + +item.npcTacticalHead.name=Taktischer Helm +item.npcTacticalChest.name=Taktische Weste + +item.npcFullLeatherHead.name=Volllederhelm +item.npcFullLeatherChest.name=Volllederharnisch + +item.npcFullIronHead.name=Volleisenhelm +item.npcFullIronChest.name=Volleisenharnisch + +item.npcFullGoldHead.name=Vollgoldhelm +item.npcFullGoldChest.name=Vollgoldharnisch + +item.npcFullDiamondHead.name=Volldiamanthelm +item.npcFullDiamondChest.name=Volldiamantharnisch + +item.npcFullBronzeHead.name=Vollbronzehelm +item.npcFullBronzeChest.name=Vollbronzeharnisch +item.npcFullBronzeLeggings.name=Vollbronzebeinschienen +item.npcFullBronzeBoots.name=Vollbronzestiefel + +item.npcFullWoodenHead.name=Vollholzhelm +item.npcFullWoodenChest.name=Vollholzharnisch +item.npcFullWoodenLeggings.name=Vollholzbeinschienen +item.npcFullWoodenBoots.name=Vollholzstiefel + +item.npcTuxedoChest.name=Smokinghemd +item.npcTuxedoPants.name=Smokinghose +item.npcTuxedoBottom.name=Smokingmantel + +item.npcWizardHead.name=Zauberhut +item.npcWizardChest.name=Zaubererrobe +item.npcWizardPants.name=Zaubererhose + +item.npcAssassinHead.name=Assassinenhelm +item.npcAssassinChest.name=Assassinenharnisch +item.npcAssassinLeggings.name=Assassins Leggings +item.npcAssassinBoots.name=Assassinenstiefel + +item.npcSoldierHead.name=Soldatenhelm +item.npcSoldierChest.name=Soldatenschutzweste +item.npcSoldierLegs.name=Soldatenstiefel +item.npcSoldierBottom.name=Soldatenmantel + +item.npcX407Head.name=X407 Prototyphelm +item.npcX407Chest.name=X407 Prototypbrustpanzer +item.npcX407Legs.name=X407 Prototypbeinschienen +item.npcX407Boots.name=X407 Prototypstiefel + +item.npcCommissarHead.name=Kommisarmütze +item.npcCommissarChest.name=Kommissaruniformbrust +item.npcCommissarLegs.name=Kommissarhose +item.npcCommissarBottom.name=Kommissarmantel + +item.npcInfantryHelmet.name=Infantriehelm +item.npcOfficerChest.name=Offiziersuniform + +item.npcCrown.name=Krone +item.npcCrown2.name=Krone +item.npcPaperCrown.name=Papier Krone + +item.npcNinjaHead.name=Ninjahelm +item.npcNinjaChest.name=Ninjaharnisch +item.npcNinjaPants.name=Ninjabeinschienen + +item.npcFullEmeraldHead.name=Vollsmaragdhelm +item.npcFullEmeraldChest.name=Vollsmaragdharnisch +item.npcFullEmeraldLeggings.name=Vollsmaragdbeinschienen +item.npcFullEmeraldBoots.name=Vollsmaragdstiefel + +item.npcOrb.name=Kugel +item.npcBrokenOrb.name=Zerbrochene Kugel +item.npcMana.name=Mana + +item.npcNinjaClaw.name=Ninjaklaue +item.npcSteelClaw.name=Stahlklaue +item.npcBearClaw.name=Bärenklaue +item.npcKatar.name=Katar + +item.npcLetter.name=Brief +item.npcPlans.name=Pläne +item.npcSatchel.name=Beutel +item.npcBag.name=Tasche +item.npcCrystal.name=Kristall +item.npcSeveredEar.name=Abgeschlagenes Ohr +item.npcPhone.name=Handy +item.npcBanditMask.name=Banditenmaske +item.npcBrokenArrow.name=Zerbrochener Pfeil +item.npcEarthElement.name=Erdelement +item.npcWaterElement.name=Wasserelement +item.npcFireElement.name=Feuerelement +item.npcAirElement.name=Luftelement +item.npcCarKey.name=Autoschlüssel +item.npcKey.name=Schlüssel +item.npcKey2.name=Schlüssel +item.npcPendant.name=Anhänger +item.npcBlueprint.name=Entwurf +item.npcRing.name=Ring + +item.npcSkull.name=Totenkopf +item.npcSaphire.name=Saphir +item.npcAmethyst.name=Amethyst +item.npcRuby.name=Rubin +item.npcBronzeIngot.name=Bronzebarren +item.npcDemonicIngot.name=Demonenbarren + +item.npcMacuahuitl.name=Obsidianschwert +item.npcBoStaff.name=Bo Stab +item.npcSaiBlade.name=Sai Klinge +item.npcCrossbow.name=Armbrust +item.npcCrossBolt.name=Armbrust Bolzen +item.npcSlingshot.name=Steinschleuder +item.npcMusket.name=Muskete +item.npcExcalibur.name=Exkalibur + +item.npcBronzeSword.name=Bronze Schwert +item.npcEmeraldSword.name=Smaragd Schwert +item.npcDemonicSword.name=Demonen Schwert +item.npcFrostSword.name=Eis Schwert + +item.npcAncientCoin.name=Alte Münze +item.npcAncientScroll.name=Alte Schriftrolle +item.npcArtifact.name=Artefakt +item.npcLocket.name=Medaillon +item.npcSilk.name=Seide +item.npcStatuette.name=Statue +item.npcTablet.name=Tablette + +item.npcWoodenHalberd.name=Holz Hellebarde +item.npcStoneHalberd.name=Stein Hellebarde +item.npcIronHalberd.name=Eisen Hellebarde +item.npcGoldenHalberd.name=Gold Hellebarde +item.npcDiamondHalberd.name=Diamant Hellebarde +item.npcBronzeHalberd.name=Bronze Hellebarde +item.npcEmeraldHalberd.name=Smaragd Hellebarde +item.npcCursedHalberd.name=Verfluchte Hellebarde +item.npcDemonicHalberd.name=Demonen Hellebarde +item.npcFrostHalberd.name=Eis Hellebarde + +item.npcWoodenWarhammer.name=Holz Kampfhammer +item.npcStoneWarhammer.name=Stein Kampfhammer +item.npcIronWarhammer.name=Eisen Kampfhammer +item.npcGoldenWarhammer.name=Gold Kampfhammer +item.npcDiamondWarhammer.name=Diamant Kampfhammer +item.npcBronzeWarhammer.name=Bronze Kampfhammer +item.npcEmeraldWarhammer.name=Smaragd Kampfhammer +item.npcCursedWarhammer.name=Verfluchter Kampfhammer +item.npcDemonicWarhammer.name=Demonen Kampfhammer +item.npcFrostWarhammer.name=Eis Kampfhammer + +item.npcChainSkirt.name=Kettenrock +item.npcLeatherSkirt.name=Lederrock +item.npcGoldSkirt.name=Goldrock +item.npcIronSkirt.name=Eisenrock +item.npcDiamondSkirt.name=Diamantrock + +enchantment.damage=Schaden +enchantment.confusion=Verwirrung +enchantment.infinite=Unendlichkeit +enchantment.poison=Gift + +item.npcWoodenBroadsword.name=Breites Holz Schwert +item.npcStoneBroadsword.name=Breites Stein Schwert +item.npcIronBroadsword.name=Breites Eisen Schwert +item.npcGoldenBroadsword.name=Breites Gold Schwert +item.npcDiamondBroadsword.name=Breites Diamant Schwert +item.npcBronzeBroadsword.name=Breites Bronze Schwert +item.npcEmeraldBroadsword.name=Breites Smaragd Schwert +item.npcCursedBroadsword.name=Breites verfluchtes Schwert +item.npcDemonicBroadsword.name=Breites Demonen Schwert +item.npcFrostBroadsword.name=Breites Eis Schwert + +movement.name=Bewegung +movement.type=Bewegungs Typ +movement.wanderinteract=Interagieren Sie mit NPCs +movement.sitting=Sitzend +movement.lying=Liegend +movement.sneaking=Gebückt +movement.dancing=Tanzend +movement.aiming=Arme hoch +movement.animation=Animation +movement.rotation=Drehung +movement.body=Körper +movement.manual=Manual +movement.stalking=Stalking +movement.stalking=Stalking +movement.head=Kopf +movement.pauses=mit Pausen +movement.stopinteract=Stopp bei Interact +movement.crawling=Kriechen +movement.hug=Umarmen + +item.npcSoulstoneEmpty.name=Seelenstein Leer +item.npcSoulstoneFilled.name=Seelenstein Voll + +model.head=Kopf +model.rarm=R. Arm +model.larm=L. Arm +model.arms=Arme +model.body=Körper +model.lleg=L. Bein +model.rleg=R. Bein +model.legs=Beine +model.scale=Umfang +model.load=Model Laden +model.save=Model Speichern + +puppet.standing=Stehen +puppet.walking=beim Gehen +puppet.attacking=beim Angriff + +guard.creepers=Creeper angreifen +guard.animals=Tiere angreifen +guard.mobs=Monster angreifen +guard.currentTargets=Aktuelle Ziele +guard.availableTargets=Verfügbaren Ziele +guard.specifictargets=Spezifische Ziele + +companion.baby=Baby +companion.child=Kind +companion.teenager=Jugendlich +companion.adult=Erwachsen +companion.fullgrown=Voll gewachsen +companion.age=Alter +companion.stage=Bühne + +#German by DewTix \ No newline at end of file diff --git a/src/main/resources/assets/customnpcs/lang/en_US.lang b/src/main/resources/assets/customnpcs/lang/en_US.lang new file mode 100644 index 000000000..bed7f8ecc --- /dev/null +++ b/src/main/resources/assets/customnpcs/lang/en_US.lang @@ -0,0 +1,923 @@ +customnpcs.defaultTextColor=404040 + +entity.CustomNpc.name=Custom Npc +entity.customnpcs.CustomNpc.name=Custom Npc + +itemGroup.cnpcs=CustomNpcs Tools +itemGroup.cnpcsw=CustomNpcs Weapons +itemGroup.cnpcsa=CustomNpcs Armor +itemGroup.cnpcsb=CustomNpcs Blocks +itemGroup.cnpcsm=CustomNpcs Misc + +tile.npcRedstoneBlock.name=Redstone Block +tile.npcCarpentyBench.name=Carpentry Bench +tile.npcBloodBlock.name=Blood Block +tile.npcMailbox.name=Mailbox +tile.npcLocationBlock.name=Location Quest Block +tile.npcBanner.name=Banner +tile.npcWallBanner.name=Wall Banner +tile.npcChair.name=Chair +tile.npcCrate.name=Crate +tile.npcTallLamp.name=Tall Lamp +tile.npcWeaponRack.name=Weapon Rack +tile.npcCouchWool.name=Wool Couch +tile.npcTable.name=Wooden Table +tile.npcCouchWood.name=Wooden Couch +tile.npcLamp.name=Lamp +tile.npcCandle.name=Candle +tile.npcStool.name=Stool +tile.npcBorder.name=Border +tile.npcBigSign.name=Big Sign +tile.npcBarrel.name=Barrel +tile.npcShelf.name=Shelf +tile.npcSign.name=Sign +tile.npcTombstone.name=Tombstone +tile.npcCampfire.name=Campfire +tile.npcBeam.name=Beam +tile.npcPedestal.name=Pedestal +tile.npcPlaceholder_0.name=Placeholder +tile.npcPlaceholder_1.name=Placeholder +tile.npcPlaceholder_2.name=Placeholder +tile.npcPlaceholder_3.name=Placeholder +tile.npcPlaceholder_4.name=Placeholder +tile.npcPlaceholder_5.name=Placeholder +tile.npcPlaceholder_6.name=Placeholder +tile.npcPlaceholder_7.name=Placeholder +tile.npcPlaceholder_8.name=Placeholder +tile.npcPlaceholder_9.name=Placeholder +tile.npcPlaceholder_10.name=Placeholder +tile.npcPlaceholder_11.name=Placeholder +tile.npcPlaceholder_12.name=Placeholder +tile.npcPlaceholder_13.name=Placeholder +tile.npcPlaceholder_14.name=Placeholder +tile.npcPlaceholder_15.name=Placeholder + +gui.delete=Are you sure you want to delete this? +gui.add=Add +gui.remove=Remove +gui.save=Save +gui.name=Name +gui.color=Color +gui.none=None +gui.time=Time +gui.title=Title +gui.categories=Categories +gui.close=Close +gui.disabled=Disabled +gui.increase=Increase +gui.decrease=Decrease +gui.day=Day +gui.night=Night +gui.constant=Constant +gui.accelerate=Accelerate +gui.small=Small +gui.medium=Med +gui.large=Large +gui.type=Type +gui.retaliate=Retaliate +gui.panic=Panic +gui.retreat=Retreat +gui.nothing=Nothing +gui.break=Break +gui.open=Open +gui.darkness=Darkness +gui.sunlight=Sunlight +gui.always=Always +gui.untilclose=UntilClose +gui.whenavailable=OnTheMove +gui.ignoreDamage=Ignore damage +gui.ignoreNBT=Ignore NBT +gui.minrange=MinimumRange +gui.engagedistance=EngageDistance +gui.orbitdistance=OrbitDistance +gui.fightifthisclose=FightIfThisClose +gui.ambushdistance=AmbushDistance +gui.whendistant=WhenDistant +gui.whenhidden=WhenHidden +gui.currentFolder=Current Folder +gui.play=Play +gui.selectSound=Select Sound +gui.selectnpc=Select NPC +gui.select=Select +gui.range=Range +gui.name=Name +gui.partly=Partially +gui.copy=Copy +gui.clear=Clear +gui.done=Done +gui.paste=Paste +gui.settings=Settings +gui.enabled=Enabled +gui.website=Website +gui.text=Text +gui.detailed=Detailed +gui.server=Server +gui.showmore=Show More +gui.update=Update +gui.disabled=Disabled +gui.editor=Editor +gui.playernearby=Player nearby + +remote.title=Nearby NPCs +remote.reset=Reset +remote.tp=Tp to +remote.resetall=Reset All +remote.freeze=Freeze NPCs + +spawner.entities=Entities +spawner.clones=Clones +spawner.mobspawner=MobSpawner +spawner.mount=Mount by +spawner.mountplayer=Player mounts + +spawner.diesafter=Dies after spawns die +spawner.posoffset=Position Offset +spawner.type=Spawn Type +spawner.all=All +spawner.random=Random +spawner.one=One by One +spawner.despawn=Despawn Spawns On Target Lost + +mailbox.name=Mailbox +mailbox.sender=Sender +mailbox.read=Read +mailbox.timesend=%s ago +mailbox.day=day +mailbox.days=days +mailbox.hour=hour +mailbox.hours=hours +mailbox.minute=minute +mailbox.minutes=minutes +mailbox.username=Username +mailbox.subject=Subject +mailbox.send=Send +mailbox.write=Write Message +mailbox.succes=Succesfully sent your mail to %s +mailbox.errorUsername=Unknown username +mailbox.errorSubject=Subject cant be empty +mailbox.setup=Setup mail + +display.model=Model +display.show=Show +display.hide=Hide +display.showAttacking=Show when attacking +display.size=Size +display.texture=Texture +display.cape=Cape +display.overlay=Overlay +display.player=Player +display.selectTexture=Select Texture +display.livingAnimation=Has a living animation +display.visible=Visible +display.bossbar=BossBar +display.url=Url + +inv.minExp=Min Exp +inv.maxExp=Max Exp +inv.npcInventory=NPC Inventory +inv.inventory=Inventory +inv.dropChance=Drop chance +inv.auto=Auto Pickup + +availability.options=Availability Options +availability.always=Always +availability.after=After +availability.before=Before +availability.available=Available +availability.whenactive=When Active +availability.whennotactive=When Not Active +availability.selectquest=Select Quest +availability.selectdialog=Select Dialog +availability.selectfaction=Select Faction +availability.daytime=Daytime +availability.wholeday=Whole day +availability.night=During the night +availability.day=During the day +availability.is=Is +availability.isnot=Is not +availability.minlevel=Exp lvl +availability.name=Availability +availability.areaNotAvailble=You can't go this way +availability.permission=You don't have permission to do this +availability.editIcon=For the next 10 seconds you can set any item icon by right clicking + +spawning.availableBiomes=Available Biomes +spawning.spawningBiomes=Spawning Biomes +spawning.biomes=Biomes +spawning.weightedChance=Weighted Chance + +role.name=Role +role.none=No Role +role.trader=Trader +role.follower=Follower +role.bank=Bank +role.transporter=Transporter +role.mailman=Mailman +role.marketname=Linked Marketname +role.companion=Companion + +trader.insufficient=Insufficient Currency +trader.sufficient=Sufficient Currency + +job.name=Job +job.none=No Job +job.guard=Guard +job.healer=Healer +job.bard=Bard +job.itemgiver=Item Giver +job.boss=Boss +job.spawner=Spawner +job.conversation=Conversation +job.chunkloader=Chunk Loader +job.puppet=Puppet + +stats.health=Health +stats.aggro=AggroRange +stats.meleeproperties=MeleeProperties +stats.rangedproperties=RangeProperties +stats.projectileproperties=ProjectileType +stats.meleestrength=MeleeStrength +stats.meleerange=MeleeRange +stats.meleespeed=MeleeSpeed +stats.accuracy=Accuracy(%) +stats.rangedrange=RangedRange +stats.burstspeed=FireRate +stats.mindelay=MinDelay +stats.maxdelay=MaxDelay +stats.burstcount=BurstCount +stats.shotcount=ShotCount +stats.walkspeed=WalkSpeed +stats.meleeeffect=Effect(s) +stats.respawn=Respawn +stats.deadbody=HideDeadBody +stats.fireimmune=ImmuneToFire +stats.candrown=CanDrown +stats.firesound:=SoundFX +stats.creaturetype=CreatureType +stats.normal=Normal +stats.undead=Undead +stats.arthropod=Arthropod +stats.nofalldamage=NoFallDamage +stats.meleeproperties=MeleeOptions +stats.rangedproperties=RangedOptions +stats.burninsun=BurnsInSun +stats.amplify=Amplified +stats.melee=Melee +stats.regenhealth=Health Regen +stats.combatregen=Combat Regen +stats.naturallydespawns=Naturally Despawn +stats.aimWhileShooting=Aim While Shooting +stats.potionImmune=PotionImmune +stats.attackInvisible=Attack Invi + +stats.size=Size +stats.speed=Speed +stats.glows=Glows +stats.noglow=NoGlow +stats.hasgravity=HasGravity +stats.explosive=Explodes +stats.rangedeffect=Effect +stats.trail=TrailType +stats.spin=Spins +stats.stick=Sticks +stats.regular=No Amp +stats.amplified=Amp +stats.explosion=Explosion + +ai.standing=Standing +ai.wandering=Wandering +ai.movingpath=Moving Path +ai.looping=Looping +ai.backtracking=Backtracking +ai.enemyresponse=OnFoundEnemy +ai.door=DoorInteract +ai.avoidwater=AvoidsWater +ai.return=ReturnToStart +ai.swim=CanSwim +ai.shelter=ShelterFrom +ai.leapattarget=LeapAtTarget +ai.sprint=CanSprint +ai.clearlos=MustSeeTarget +ai.indirect=CanFireIndirect +ai.rangemelee=UseRangeAttack +ai.tacticalvariant=TacticalVariant +ai.cobwebAffected=CobwebAffected +ai.movement=Movement + +aitactics.rush=Rush +aitactics.stagger=Dodge +aitactics.orbit=Surround +aitactics.hitandrun=Hit&Run +aitactics.ambush=Ambush +aitactics.stalk=Stalk + +advanced.idlesound=LivingSound +advanced.angersound=AngrySound +advanced.hurtsound=HurtSound +advanced.deathsound=DeathSound +advanced.stepsound=StepSound +advanced.sounds=Sounds +advanced.lines=Lines +advanced.night=Night +advanced.editingmode=EditingMode +advanced.loadday=Load Day +advanced.loadnight=Load Night +advanced.haspitch=Has Pitch + +faction.hostiles=Hostile Factions +faction.unfriendly=Unfriendly +faction.neutral=Neutral +faction.friendly=Friendly +faction.points=Points +faction.ondeath=On death +faction.hidden=Hidden +faction.default=Default +faction.attackHostile=Attack hostile factions +faction.defend=Defence faction members +faction.nostanding=You have no standings with any faction +faction.options=Faction Options +faction.increasepoints=Faction %s increased by %s points +faction.decreasepoints=Faction %s decreased by %s points +faction.attacked=Attacked by mobs + +menu.inventory=Inventory +menu.display=Display +menu.stats=Stats +menu.factions=Factions +menu.ai=AI +menu.advanced=Advanced +menu.global=Global +menu.role=Role + +global.banks=Banks +global.transport=Transport +global.playerdata=PlayerData +global.recipes=Recipes +global.naturalspawn=Natural Spawns +global.linked=Linked + +bank.slot=Slot +bank.unlock=Unlock +bank.upgrade=Upgrade +bank.upgradeCosts=Costs to upgrade +bank.unlockCosts=Costs to unlock + +follower.waiting=Waiting +follower.following=Following +follower.hire=Hire +follower.health=Health +follower.daysleft=Days left +follower.lastday=Last day +follower.day=Day +follower.days=Days +follower.hireText=Thank you for hiring me for +follower.farewellText=My days with you are over. Farewell +follower.infiniteDays=Infinite Days +follower.guiDisabled=GuiDisabled +follower.allowSoulstone=AllowSoulstone + +transporter.travel=Travel +transporter.unlock=Transport to %s is now unlocked +transporter.discovered=Available when discovered +transporter.start=Available from the start +transporter.interaction=Available after interaction + +conversation.delay=Delay +conversation.line=Line + +bard.jukebox=Play as jukebox +bard.background=Play as background +bard.ondistance=On Distance +bard.offdistance=Off Distance +bard.hasoff=Has Off Distance + +dialog.dialog=Dialog +dialog.dialogs=Dialogs +dialog.options=Dialog Options +dialog.dialogtext=Dialog Text +dialog.editoption=Edit Dialog Option +dialog.optiontype=Option type +dialog.selectoption=Select Option +dialog.quitoption=Quit Option +dialog.option=Dialog Option +dialog.roleoption=Role Option +dialog.commandoption=Command Option +dialog.commandoptionplayer=Use "@dp" to target the player using this +dialog.hideNPC=Hide NPC +dialog.showWheel=Show Dialog Wheel +dialog.disableEsc=Disable Esc + +quest.quest=Quest +quest.quests=Quests +quest.item=Item +quest.kill=Kill +quest.areakill=AreaKill +quest.dialog=Dialog +quest.location=Location +quest.completedtext=Completed text +quest.questlogtext=Questlog text +quest.complete=Complete +quest.reward=Reward +quest.repeatable=Repeatable +quest.mcdaily=MC Daily +quest.mcweekly=MC Weekly +quest.rldaily=RL Daily +quest.rlweekly=RL Weekly +quest.instant=Instant Complete +quest.npc=Complete by npc +quest.next=Next Quest +quest.found=Found +quest.notfound=Not Found +quest.completed=Quest Complete +quest.newquest=New Quest +quest.noquests=You have no active quests +quest.completewith=Complete with %s +quest.randomitem=Random Item +quest.exp=Exp +quest.takeitems=Take Items +quest.objectives=Objectives + +script.scripts=Scripts +script.hooks=Hooks +script.loadscript=Load Scripts +script.openfolder=Open scripts folder +script.init=Init +script.interact=Interact +script.update=Update +script.console=Console +script.language=Language +script.damaged=Damaged +script.killed=Killed +script.attack=Attack +script.target=Target +script.availableScripts=Available Scripts +script.loadedScripts=Loaded Scripts +script.collide=Collide +script.kills=Kills +script.dialog_closed=Dialog Closed + +item.npcWand.name=Npc Wand +item.npcMobCloner.name=Mob Cloner +item.npcMovingPath.name=Npc Pather +item.npcMounter.name=Mounter +item.npcTeleporter.name=Teleporter +item.npcScripter.name=Scripter + +item.npcBanjo.name=Banjo +item.npcViolin.name=Violin +item.npcViolinBow.name=Violin Bow +item.npcHarp.name=Harp +item.npcGuitar.name=Guitar +item.npcFrenchHorn.name=French Horn +item.npcOcarina.name=Ocarina +item.npcClarinet.name=Clarinet + +item.npcCoinWooden.name=Wooden Coin +item.npcCoinStone.name=Stone Coin +item.npcCoinBronze.name=Bronze Coin +item.npcCoinIron.name=Iron Coin +item.npcCoinGold.name=Golden Coin +item.npcCoinDiamond.name=Diamond Coin +item.npcCoinEmerald.name=Emerald Coin + +item.npcWoodenGun.name=Wooden Gun +item.npcStoneGun.name=Stone Gun +item.npcIronGun.name=Iron Gun +item.npcGoldGun.name=Golden Gun +item.npcDiamondGun.name=Diamond Gun +item.npcBronzeGun.name=Bronze Gun +item.npcEmeraldGun.name=Emerald Gun +item.npcMachineGun.name=Machine Gun + +item.npcWoodenBullet.name=Wooden Bullet +item.npcStoneBullet.name=Stone Bullet +item.npcIronBullet.name=Iron Bullet +item.npcGoldenBullet.name=Golden Bullet +item.npcDiamondBullet.name=Diamond Bullet +item.npcBronzeBullet.name=Bronze Bullet +item.npcEmeraldBullet.name=Emerald Bullet +item.npcBlackBullet.name=Black Bullet + +item.npcWoodenTrident.name=Wooden Trident +item.npcStoneTrident.name=Stone Trident +item.npcIronTrident.name=Iron Trident +item.npcGoldTrident.name=Golden Trident +item.npcDiamondTrident.name=Diamond Trident +item.npcBronzeTrident.name=Bronze Trident +item.npcEmeraldTrident.name=Emerald Trident +item.npcCursedTrident.name=Cursed Trident +item.npcDemonicTrident.name=Demonic Trident +item.npcFrostTrident.name=Frost Trident +item.npcMithrilTrident.name=Mithril Trident + +item.npcNatureSpell.name=Nature Spell +item.npcArcaneSpell.name=Arcane Spell +item.npcLightningSpell.name=Lightning Spell +item.npcIceSpell.name=Ice Spell +item.npcFireSpell.name=Fire Spell +item.npcDarkSpell.name=Dark Spell +item.npcHolySpell.name=Holy Spell + +item.npcKunai.name=Kunai +item.npcReverseKunai.name=Reverse Kunai +item.npcShuriken.name=Shuriken +item.npcGiantShuriken.name=Giant Shuriken +item.npcKatana.name=Katana +item.npcKukri.name=Kukri + +item.npcGolfClub.name=Golf Club +item.npcMagicWand.name=Magic Wand +item.npcChickenSword.name=Chicken Sword +item.npcHandCuffs.name=Handcuffs +item.npcHammer.name=Hammer +item.npcBaseballBat.name=Baseball Bat +item.npcLeadPipe.name=Lead Pipe +item.npcCleaver.name=Cleaver +item.npcSaber.name=Saber +item.npcHockeyStick.name=Hockey Stick +item.npcSledgeHammer.name=Sledgehammer +item.npcBrokenBottle.name=Broken Bottle +item.npcCombatKnive.name=Combat Knife +item.npcLighter.name=Lighter +item.npcBatton.name=Baton +item.npcGunChainsaw.name=GunChainsaw +item.npcRapier.name=Rapier +item.npcCrowbar.name=Crowbar +item.npcPipeWrench.name=Pipe Wrench +item.npcWrench.name=Wrench +item.npcSwissArmyKnife.name=Swiss Army Knife +item.npcLeafBlade.name=Leaf Blade + +item.npcWoodenShield.name=Round Wooden Shield +item.npcStoneShield.name=Round Stone Shield +item.npcIronShield.name=Round Iron Shield +item.npcGoldenShield.name=Round Golden Shield +item.npcDiaShield.name=Round Diamond Shield +item.npcBronzeShield.name=Round Bronze Shield +item.npcEmeraldShield.name=Round Emerald Shield +item.npcDemonicShield.name=Demonic Shield +item.npcFrostShield.name=Frost Shield +item.npcMithrilShield.name=Mithril Shield +item.npcFullWoodenShield.name=Wooden Shield +item.npcFullStoneShield.name=Stone Shield +item.npcFullIronShield.name=Iron Shield +item.npcFullGoldenShield.name=Golden Shield +item.npcFullDiaShield.name=Diamond Shield +item.npcFullBronzeShield.name=Bronze Shield +item.npcFullEmeraldShield.name=Emerald Shield + +item.npcTowerShield.name=Steel Tower Shield +item.npcCryscentShield.name=Steel Cryscent Shield +item.npcScutumShield.name=Steel Scutum Shield +item.npcHeaterShield.name=Steel Heater Shield + +item.npcWoodenSpear.name=Wooden Spear +item.npcStoneSpear.name=Stone Spear +item.npcIronSpear.name=Iron Spear +item.npcGoldenSpear.name=Golden Spear +item.npcDiamondSpear.name=Diamond Spear +item.npcBronzeSpear.name=Bronze Spear +item.npcEmeraldSpear.name=Emerald Spear +item.npcDemonicSpear.name=Demonic Spear +item.npcFrostSpear.name=Frost Spear +item.npcMithrilSpear.name=Mithril Spear + +item.npcWoodenBattleAxe.name=Wooden Battle Axe +item.npcStoneBattleAxe.name=Stone Battle Axe +item.npcIronBattleAxe.name=Iron Battle Axe +item.npcGoldenBattleAxe.name=Golden Battle Axe +item.npcDiamondBattleAxe.name=Diamond Battle Axe +item.npcBronzeBattleAxe.name=Bronze Battle Axe +item.npcEmeraldBattleAxe.name=Emerald Battle Axe +item.npcDemonicBattleAxe.name=Demonic Battle Axe +item.npcFrostBattleAxe.name=Frost Battle Axe +item.npcMithrilBattleAxe.name=Mithril Battle Axe + +item.npcWoodenMace.name=Wooden Mace +item.npcStoneMace.name=Stone Mace +item.npcIronMace.name=Iron Mace +item.npcGoldenMace.name=Golden Mace +item.npcDiamondMace.name=Diamond Mace +item.npcBronzeMace.name=Bronze Mace +item.npcEmeraldMace.name=Emerald Mace +item.npcDemonicMace.name=Demonic Mace +item.npcFrostMace.name=Frost Mace +item.npcMithrilMace.name=Mithril Mace + +item.npcWoodenDagger.name=Wooden Dagger +item.npcStoneDagger.name=Stone Dagger +item.npcIronDagger.name=Iron Dagger +item.npcGoldenDagger.name=Golden Dagger +item.npcDiamondDagger.name=Diamond Dagger +item.npcBronzeDagger.name=Bronze Dagger +item.npcEmeraldDagger.name=Emerald Dagger +item.npcDemonicDagger.name=Demonic Dagger +item.npcFrostDagger.name=Frost Dagger +item.npcMithrilDagger.name=Mithril Dagger +item.npcWoodenReversedDagger.name=Reversed Wooden Dagger +item.npcStoneReversedDagger.name=Reversed Stone Dagger +item.npcIronReversedDagger.name=Reversed Iron Dagger +item.npcGoldenReversedDagger.name=Reversed Golden Dagger +item.npcDiamondReversedDagger.name=Reversed Diamond Dagger +item.npcBronzeReversedDagger.name=Reversed Bronze Dagger +item.npcEmeraldReversedDagger.name=Reversed Emerald Dagger +item.npcDemonicReversedDagger.name=Reversed Demonic Dagger +item.npcFrostReversedDagger.name=Reversed Frost Dagger +item.npcMithrilReversedDagger.name=Reversed Mithril Dagger + +item.npcWoodenStaff.name=Wooden Staff +item.npcStoneStaff.name=Stone Staff +item.npcIronStaff.name=Iron Staff +item.npcGoldenStaff.name=Golden Staff +item.npcDiamondStaff.name=Diamond Staff +item.npcBronzeStaff.name=Bronze Staff +item.npcEmeraldStaff.name=Emerald Staff +item.npcElementalStaff.name=Elemental Staff +item.npcDemonicStaff.name=Demonic Staff +item.npcFrostStaff.name=Frost Staff +item.npcMithrilStaff.name=Mithril Staff + +item.npcWoodenScythe.name=Wooden Scythe +item.npcStoneScythe.name=Stone Scythe +item.npcIronScythe.name=Iron Scythe +item.npcGoldenScythe.name=Golden Scythe +item.npcBronzeScythe.name=Bronze Scythe +item.npcDiamondScythe.name=Diamond Scythe +item.npcEmeraldScythe.name=Emerald Scythe +item.npcDemonicScythe.name=Demonic Scythe +item.npcFrostScythe.name=Frost Scythe +item.npcMithrilScythe.name=Mithril Scythe + +item.npcWoodenGlaive.name=Wooden Glaive +item.npcStoneGlaive.name=Stone Glaive +item.npcIronGlaive.name=Iron Glaive +item.npcGoldenGlaive.name=Golden Glaive +item.npcDiamondGlaive.name=Diamond Glaive +item.npcBronzeGlaive.name=Bronze Glaive +item.npcEmeraldGlaive.name=Emerald Glaive +item.npcDemonicGlaive.name=Demonic Glaive +item.npcFrostGlaive.name=Frost Glaive +item.npcMithrilGlaive.name=Mithril Glaive + +item.npcCowleatherHead.name=Cowleather Helmet +item.npcCowleatherChest.name=Cowleather ChestPlate +item.npcCowleatherLegs.name=Cowleather Leggings +item.npcCowleatherBoots.name=Cowleather Boots + +item.npcNanorumHead.name=Nanorum Helmet +item.npcNanorumChest.name=Nanorum ChestPlate +item.npcNanorumLegs.name=Nanorum Leggings +item.npcNanorumBoots.name=Nanorum Boots + +item.npcTacticalHead.name=Tactical Helmet +item.npcTacticalChest.name=Tactical Vest + +item.npcFullLeatherHead.name=Full Leather Helmet +item.npcFullLeatherChest.name=Full Leather ChestPlate + +item.npcFullIronHead.name=Full Iron Helmet +item.npcFullIronChest.name=Full Iron ChestPlate + +item.npcFullGoldHead.name=Full Gold Helmet +item.npcFullGoldChest.name=Full Gold ChestPlate + +item.npcFullDiamondHead.name=Full Diamond Helmet +item.npcFullDiamondChest.name=Full Diamond ChestPlate + +item.npcFullBronzeHead.name=Full Bronze Helmet +item.npcFullBronzeChest.name=Full Bronze ChestPlate +item.npcFullBronzeLeggings.name=Full Bronze Leggings +item.npcFullBronzeBoots.name=Full Bronze Boots + +item.npcFullWoodenHead.name=Full Wooden Helmet +item.npcFullWoodenChest.name=Full Wooden ChestPlate +item.npcFullWoodenLeggings.name=Full Wooden Leggings +item.npcFullWoodenBoots.name=Full Wooden Boots + +item.npcTuxedoChest.name=Tuxedo Chest +item.npcTuxedoPants.name=Tuxedo Pants +item.npcTuxedoBottom.name=Tuxedo Trenchcoat + +item.npcWizardHead.name=Wizard Head +item.npcWizardChest.name=Wizard Chest +item.npcWizardPants.name=Wizard Leggings + +item.npcAssassinHead.name=Assassins Helmet +item.npcAssassinChest.name=Assassins ChestPlate +item.npcAssassinLeggings.name=Assassins Leggings +item.npcAssassinBoots.name=Assassins Boots + +item.npcSoldierHead.name=Soldier Helmet +item.npcSoldierChest.name=Soldier ChestPlate +item.npcSoldierLegs.name=Soldier Leggings +item.npcSoldierBottom.name=Soldier Trenchcoat + +item.npcX407Head.name=X407 Prototype Helmet +item.npcX407Chest.name=X407 Prototype ChestPlate +item.npcX407Legs.name=X407 Prototype Leggings +item.npcX407Boots.name=X407 Prototype Boots + +item.npcMithrilHead.name=Mithril Helmet +item.npcMithrilChest.name=Mithril ChestPlate +item.npcMithrilLegs.name=Mithril Leggings +item.npcMithrilBoots.name=Mithril Boots + +item.npcDemonicHead.name=Demonic Helmet +item.npcDemonicChest.name=Demonic ChestPlate +item.npcDemonicLegs.name=Demonic Leggings +item.npcDemonicBoots.name=Demonic Boots + +item.npcCommissarHead.name=Commissar Helmet +item.npcCommissarChest.name=Commissar ChestPlate +item.npcCommissarLegs.name=Commissar Leggings +item.npcCommissarBottom.name=Commissar Trenchcoat + +item.npcInfantryHelmet.name=Infantry Helmet +item.npcOfficerChest.name=Officer ChestPlate + +item.npcCrown.name=Crown +item.npcCrown2.name=Crown +item.npcPaperCrown.name=Paper Crown + +item.npcNinjaHead.name=Ninja Head +item.npcNinjaChest.name=Ninja Chest +item.npcNinjaPants.name=Ninja Leggings + +item.npcFullEmeraldHead.name=Full Emerald Helmet +item.npcFullEmeraldChest.name=Full Emerald ChestPlate +item.npcFullEmeraldLeggings.name=Full Emerald Leggings +item.npcFullEmeraldBoots.name=Full Emerald Boots + +item.npcOrb.name=Orb +item.npcBrokenOrb.name=BrokenOrb +item.npcMana.name=Mana + +item.npcNinjaClaw.name=Ninja Claw +item.npcSteelClaw.name=Steel Claw +item.npcBearClaw.name=Bear Claw +item.npcKatar.name=Katar + +item.npcLetter.name=Letter +item.npcPlans.name=Plans +item.npcSatchel.name=Satchel +item.npcBag.name=Bag +item.npcCrystal.name=Crystal +item.npcSeveredEar.name=Severed Ear +item.npcPhone.name=Phone +item.npcBanditMask.name=Bandit Mask +item.npcBrokenArrow.name=Broken Arrow +item.npcEarthElement.name=Earth Element +item.npcWaterElement.name=Water Element +item.npcFireElement.name=Fire Element +item.npcAirElement.name=Air Element +item.npcCarKey.name=Car Key +item.npcKey.name=Key +item.npcKey2.name=Key +item.npcPendant.name=Pendant +item.npcBlueprint.name=Blueprint +item.npcRing.name=Ring + +item.npcSkull.name=Skull +item.npcSaphire.name=Sapphire +item.npcAmethyst.name=Amethyst +item.npcRuby.name=Ruby +item.npcBronzeIngot.name=Bronze Ingot +item.npcDemonicIngot.name=Demonic Ingot +item.npcMithrilIngot.name=Mithril Ingot + +item.npcMacuahuitl.name=Macuahuitl +item.npcBoStaff.name=Bo Staff +item.npcSaiBlade.name=Sai Blade +item.npcCrossbow.name=Crossbow +item.npcCrossBolt.name=Crossbow Bolt +item.npcSlingshot.name=Slingshot +item.npcMusket.name=Musket +item.npcExcalibur.name=Excalibur + +item.npcBronzeSword.name=Bronze Sword +item.npcEmeraldSword.name=Emerald Sword +item.npcDemonicSword.name=Demonic Sword +item.npcFrostSword.name=Frost Sword +item.npcMithrilSword.name=Mithril Sword + +item.npcAncientCoin.name=Ancient Coin +item.npcAncientScroll.name=Ancient Scroll +item.npcArtifact.name=Artifact +item.npcLocket.name=Locket +item.npcSilk.name=Silk +item.npcStatuette.name=Statuette +item.npcTablet.name=Tablet + +item.npcWoodenHalberd.name=Wooden Halberd +item.npcStoneHalberd.name=Stone Halberd +item.npcIronHalberd.name=Iron Halberd +item.npcGoldenHalberd.name=Golden Halberd +item.npcDiamondHalberd.name=Diamond Halberd +item.npcBronzeHalberd.name=Bronze Halberd +item.npcEmeraldHalberd.name=Emerald Halberd +item.npcCursedHalberd.name=Cursed Halberd +item.npcDemonicHalberd.name=Demonic Halberd +item.npcFrostHalberd.name=Frost Halberd +item.npcMithrilHalberd.name=Mithril Halberd + +item.npcWoodenWarhammer.name=Wooden Warhammer +item.npcStoneWarhammer.name=Stone Warhammer +item.npcIronWarhammer.name=Iron Warhammer +item.npcGoldenWarhammer.name=Golden Warhammer +item.npcDiamondWarhammer.name=Diamond Warhammer +item.npcBronzeWarhammer.name=Bronze Warhammer +item.npcEmeraldWarhammer.name=Emerald Warhammer +item.npcCursedWarhammer.name=Cursed Warhammer +item.npcDemonicWarhammer.name=Demonic Warhammer +item.npcFrostWarhammer.name=Frost Warhammer +item.npcMithrilWarhammer.name=Mithril Warhammer + +item.npcChainSkirt.name=Chain Skirt +item.npcLeatherSkirt.name=Leather Skirt +item.npcGoldSkirt.name=Golden Skirt +item.npcIronSkirt.name=Iron Skirt +item.npcDiamondSkirt.name=Diamond Skirt +item.npcEmeraldSkirt.name=Emerald Skirt +item.npcBronzeSkirt.name=Bronze Skirt +item.npcDemonicSkirt.name=Demonic Skirt +item.npcMithrilSkirt.name=Mithril Skirt + +item.npcWoodenBroadsword.name=Wooden Broadsword +item.npcStoneBroadsword.name=Stone Broadsword +item.npcIronBroadsword.name=Iron Broadsword +item.npcGoldenBroadsword.name=Golden Broadsword +item.npcDiamondBroadsword.name=Diamond Broadsword +item.npcBronzeBroadsword.name=Bronze Broadsword +item.npcEmeraldBroadsword.name=Emerald Broadsword +item.npcCursedBroadsword.name=Cursed Broadsword +item.npcDemonicBroadsword.name=Demonic Broadsword +item.npcFrostBroadsword.name=Frost Broadsword +item.npcMithrilBroadsword.name=Mithril Broadsword + +item.npcSoulstoneEmpty.name=Soulstone Empty +item.npcSoulstoneFilled.name=Soulstone Filled + +item.npcHeart.name=Heart +item.npcMoney.name=Money +item.npcNecklace.name=Necklace +item.npcUsbStick.name=USB-Stick + +enchantment.damage=Damage +enchantment.confusion=Confusion +enchantment.infinite=Infinite +enchantment.poison=Poison + +movement.name=Movement +movement.type=Moving type +movement.wanderinteract=Interact with npcs +movement.sitting=Sitting +movement.lying=Lying +movement.sneaking=Sneaking +movement.dancing=Dancing +movement.aiming=Aiming +movement.animation=Animation +movement.rotation=Rotation +movement.body=Body +movement.manual=Manual +movement.stalking=Stalking +movement.stalking=Stalking +movement.head=Head +movement.pauses=Pauses +movement.stopinteract=Stop on interact +movement.crawling=Crawling +movement.hug=Hugging + +model.head=Head +model.rarm=R. Arm +model.larm=L. Arm +model.arms=Arms +model.body=Body +model.lleg=L. Leg +model.rleg=R. Leg +model.legs=Legs +model.scale=Scale +model.load=Model Load +model.save=Model Save + +puppet.standing=While standing +puppet.walking=While walking +puppet.attacking=While attacking + +guard.creepers=Attack Creepers +guard.animals=Attack Animals +guard.mobs=Attack Monsters +guard.currentTargets=Current Targets +guard.availableTargets=Available Targets +guard.specifictargets=Specific targets + +companion.baby=Baby +companion.child=Child +companion.teenager=Teenager +companion.adult=Adult +companion.fullgrown=Full-Grown +companion.age=Age +companion.stage=Stage +companion.owner=Owner +companion.strength=Strength +companion.talent=Talent +companion.level=Level \ No newline at end of file diff --git a/src/main/resources/assets/customnpcs/lang/es_AR.lang b/src/main/resources/assets/customnpcs/lang/es_AR.lang new file mode 100644 index 000000000..917abd4f4 --- /dev/null +++ b/src/main/resources/assets/customnpcs/lang/es_AR.lang @@ -0,0 +1,500 @@ +itemGroup.cnpcs=Herramientas de CustomNpcs +itemGroup.cnpcsw=Armas de CustomNpcs +itemGroup.cnpcsa=Armaduras de CustomNpcs +itemGroup.cnpcsm=Miscelaneo de CustomNpcs + +tile.npcRedstoneBlock.name=Bloke de Redstone +tile.npcCarpentyBench.name=Mesa de Carpinteria +tile.npcBloodBlock.name=Bloque de Sangre + +gui.deleteConfirm=Estas Seguro de que quieres eliminar este npc? +gui.add=Añadir +gui.remove=Remover +gui.edit=Editar +gui.name=Nombre +gui.color=Color +gui.none=None +gui.time=Tiempo +gui.title=Titulo +gui.categories=Categorias +gui.close=Cerrar +gui.disabled=Desactivado +gui.increase=Increase +gui.decrease=Decrease +gui.day=Dia +gui.night=Noche +gui.constant=Constante +gui.accelerate=Acelerar +gui.small=Chico +gui.medium=Mediano +gui.large=Grande +gui.type=Tipo +gui.always=Siempre +gui.untilclose=HastaCerrar +gui.ignoreDamage=Ignorar daño + +display.model=Modelo +display.show=Mostrar +display.hide=Esconder +display.showAttacking=Mostrar cuando ataca +display.size=Tamaño +display.texture=Textura +display.textureCape=Textura de capa +display.player=Jugador +display.selectTexture=Selecciona Textura +display.livingAnimation=Animacion Viva +display.tint=Tint Color + +inv.minExp=Exp Minimo +inv.maxExp=Exp Maximo +inv.npcInventory=Inventario de NPC +inv.inventory=Inventario +inv.dropChance=Chances de dropeo + +availability.options=Availability Options +availability.always=Siempre +availability.after=Despues +availability.before=Antes +availability.available=Disponible +availability.whenactive=Cuando esta activo +availability.whennotactive=Cuando no esta activo +availability.selectquest=Seleccionar Mision +availability.selectdialog=Seleccionar Dialogo +availability.selectfaction=Seleccionar faccion +availability.daytime=De dia +availability.wholeday=Todo el dia +availability.night=Durante la noche +availability.day=Durante el dia +availability.is=Esta +availability.isnot=No esta + +stats.health=Curacion +stats.aggro=AggroRange +stats.meleeproperties=Propiedades de Melee +stats.rangedproperties=Propiedades de Rango +stats.projectileproperties=Tipo de proyectil +stats.meleestrength=Fuerza de Melee +stats.meleerange=Rango de Melee +stats.meleespeed=Rapidez de Melee +stats.accuracy=Accuracy(%) +stats.rangedrange=RangedRange +stats.burstspeed=Rapidad de Fuego +stats.firedelay=FireDelay +stats.delayvariance=DelayVariance +stats.burstcount=Contador de Disparos +stats.walkspeed=Rapidez de caminata +stats.chargespeed=Rapidez cargada +stats.meleeeffect=Efecto(s) +stats.respawn=Respawn +stats.deadbody=Esconder cuerpo muerto +stats.fireimmune=Inmune al fuego +stats.candrown=Puede ahogarse +stats.firesound:=Sonido de fuego +stats.creaturetype=Tipo de criatura +stats.normal=Normal +stats.undead=No-Muerto +stats.arthropod=Artropodo +stats.nofalldamage=Sin daño de caida +stats.meleeproperties=Opciones de Melee +stats.rangedproperties=RangedOptions +stats.burninsun=Se quema al sol +stats.amplify=Amplificado + +stats.size=Tamaño +stats.speed=Rapidez +stats.glows=Brilla +stats.hasgravity=Tiene gravedad +stats.explosive=Explota +stats.rangedeffect=Efecto +stats.trail=TrailType +stats.spin=Gira +stats.stick=Se pega +stats.regular=No Amplificado +stats.amplified=Amplificado + +ai.standing=Parado +ai.wandering=Wandering +ai.movingpath=Camino de Movimiento +ai.looping=Looping +ai.backtracking=Backtracking + +ai.enemyresponse:=Encontro Enemigo +ai.door:=Interaccion con Puertas +ai.avoidwater:=Evita el agua +ai.return:=Vuelve al comienzo +ai.swim:=Puede Nadar +ai.shelter:=Busca refugio +ai.leapattarget:=Va al objetivo +ai.clearlos:=Debe ver el objetivo +ai.indirect:=Puede disparar indirectamente +ai.rangemelee:=UseRangeAttack + +faction.hostiles=Hostile Factions +faction.unfriendly=Unfriendly +faction.neutral=Neutral +faction.friendly=Friendly +faction.points=Points +faction.ondeath=On death +faction.hidden=Hidden +faction.default=Default +faction.attackHostile=Attack hostile factions +faction.defend=Defence faction members +faction.nostanding=You have no standings with any faction +faction.options=Faction Options +faction.increasepoints=Faction %s increased by %s points +faction.decreasepoints=Faction %s decreased by %s points + +menu.inventory=Inventario +menu.quests=Misiones +menu.display=Display +menu.stats=Status +menu.factions=Facciones +menu.ai=IA +menu.advanced=Avanzado +menu.global=Global +menu.delete=Borrar +menu.role=Rol + +global.banks=Banco +global.factions=Facciones +global.dialogs=Dialogos +global.quests=Misiones +global.transport=Transporte +global.playerdata=Datos del Jugador +global.recipes=Recetas + +bank.slot=Slot +bank.unlock=Desbloqueo +bank.upgrade=Subir Nivel +bank.upgradeCosts=Costo de subir nivel +bank.unlockCosts=Costo de desbloqueo + +follower.waiting=Espera +follower.following=Siguiendo +follower.hire=Contratar +follower.health=Curacion +follower.daysleft=Dias faltantes +follower.lastday=Ultimo dia +follower.day=Dia +follower.days=Dias +follower.hireText=Gracias por contratarme +follower.farewellText=Mis dias contigo terminaron. Adios + +transporter.travel=Viajar +transporter.unlock1=Transportar a +transporter.unlock2=Esta desbloqueado + +dialog.dialog=Dialogo +dialog.dialogs=Dialogos +dialog.options=Opciones de Dialogo +dialog.dialogtext=Texto de Dialogo +dialog.editoption=Editar opciones de dialogo +dialog.optiontype=Tipo de Opcion + +quest.quest=Mision +quest.quests=Misiones +quest.item=Objeto de Mision +quest.kill=Mision de matar +quest.dialog=Mision de dialogo +quest.completedtext=Texto completado +quest.questlogtext=Libro de misiones +quest.complete=Completado +quest.turnin=Ya puedes poner la mision +quest.start=Empezada nueva mision +quest.reward=Recompensa +quest.repeatable=Repetible +quest.daily=Diario +quest.weekly=Semanal +quest.instant=Completado instantaneo +quest.npc=Completado por npc + +item.npcWand.name=Varita Npc +item.npcCloner.name=Clonador Npc +item.npcSpawner.name=Spawneador de mobs +item.npcMovingPath.name=Camino de Npcs + +item.npcBanjo.name=Banyo +item.npcViolin.name=Violin +item.npcViolinBow.name=Arco de Violin +item.npcHarp.name=Arpa +item.npcGuitar.name=Guitarra + +item.npcCoinWooden.name=Moneda de Madera +item.npcCoinStone.name=Moneda de Piedra +item.npcCoinBronze.name=Moneda de Bronce +item.npcCoinIron.name=Moneda de Hierro +item.npcCoinGold.name=Moneda de Oro +item.npcCoinDiamond.name=Moneda de Diamante +item.npcCoinEmerald.name=Moneda de Esmeralda + +item.npcWoodenGun.name=Arma de Madera +item.npcStoneGun.name=Arma de Piedra +item.npcIronGun.name=Arma de Hierro +item.npcGoldGun.name=Arma Dorada +item.npcDiamondGun.name=Arma de diamante +item.npcBronzeGun.name=Arma de bronce +item.npcEmeraldGun.name=Arma de esmeraldas +item.npcMachineGun.name=Arma Maquina + +item.npcWoodenBullet.name=Bala de Madera +item.npcStoneBullet.name=Bala de Piedra +item.npcIronBullet.name=Bala de Hierro +item.npcGoldenBullet.name=Bala de Oro +item.npcDiamondBullet.name=Bala de Diamante +item.npcBronzeBullet.name=Bala de Bronce +item.npcEmeraldBullet.name=Bala de Esmeralda +item.npcBlackBullet.name=Bala Negra + +item.npcWoodenTrident.name=Tridente de Madera +item.npcStoneTrident.name=Tridente de Piedra +item.npcIronTrident.name=Tridente de Hierro +item.npcGoldTrident.name=Tridente Dorado +item.npcDiamondTrident.name=Tridente de diamante +item.npcBronzeTrident.name=Tridente de Bronce +item.npcEmeraldTrident.name=Tridente de Esmeralda +item.npcCursedTrident.name=Tridente Maldito + +item.npcNatureSpell.name=Hechizo Natural +item.npcArcaneSpell.name=Hechizo Arcano +item.npcLightningSpell.name=Hechizo de Rayo +item.npcIceSpell.name=Hechizo de Hielo +item.npcFireSpell.name=Hechizo de Fuego +item.npcDarkSpell.name=Hechizo Negro +item.npcHolySpell.name=Hechizo Sagrado + +item.npcKunai.name=Kunai +item.npcReverseKunai.name=Reverse Kunai +item.npcShuriken.name=Shuriken +item.npcGiantShuriken.name=Shuriken gigante +item.npcKatana.name=Katana +item.npcKukri.name=Kukri + +item.npcGolfClub.name=Club de Golf +item.npcMagicWand.name=Varita Magica +item.npcChickenSword.name=Espada de Pollo +item.npcHandCuffs.name=Esposas +item.npcHammer.name=Martillo +item.npcBaseballBat.name=Bate de Beisbol +item.npcLeadPipe.name=Tuberia +item.npcCleaver.name=Carnicero +item.npcSaber.name=Sable +item.npcHockeyStick.name=Palo de Hockey +item.npcSledgeHammer.name=Trineo +item.npcBrokenBottle.name=Botella Rota +item.npcCombatKnive.name=Cuchillo de combate +item.npcLighter.name=Encendedor +item.npcBatton.name=Baston +item.npcGunChainsaw.name=Motosierra +item.npcRapier.name=Rapier +item.npcCrowbar.name=Palanca +item.npcPipeWrench.name=Pedazo de Tuberia +item.npcWrench.name=Llave Inglesa +item.npcSwissArmyKnife.name=Navaja del ejercito + +item.npcWoodenShield.name=Escudo de madera redondo +item.npcStoneShield.name=Escudo de piedra redondo +item.npcIronShield.name=Escudo de hierro redondo +item.npcGoldenShield.name=Escudo dorado redondo +item.npcDiaShield.name=Escudo de diamante redondo +item.npcBronzeShield.name=Escudo de bronce redondo +item.npcEmeraldShield.name=Escudo de Esmeralda redondo +item.npcFullWoodenShield.name=Escudo de madera +item.npcFullStoneShield.name=Escudo de piedra +item.npcFullIronShield.name=Escudo de hierro + +item.npcFullGoldenShield.name=Escudo Dorado +item.npcFullDiaShield.name=Escudo de diamante +item.npcFullBronzeShield.name=Escudo de bronce +item.npcFullEmeraldShield.name=Escudo de esmeralda + +item.npcTowerShield.name=Escudo de Acero de torre +item.npcCryscentShield.name=Super Escudo de Acero +item.npcScutumShield.name=Mega Escudo de Acero +item.npcHeaterShield.name=Escudo de Acero petoso + +item.npcWoodenSpear.name=Lanza de Madera +item.npcStoneSpear.name=Lanza de Piedra +item.npcIronSpear.name=Lanza de Hierro +item.npcGoldenSpear.name=Lanza de Oro +item.npcDiamondSpear.name=Lanza de Diamante +item.npcBronzeSpear.name=Lanza de Bronce +item.npcEmeraldSpear.name=Lanza de Esmeralda + +item.npcWoodenBattleAxe.name=Hacha de Combate de madera +item.npcStoneBattleAxe.name=Hacha de Combate de piedra +item.npcIronBattleAxe.name=Hacha de Combate de hierro +item.npcGoldenBattleAxe.name=Hacha de Combate de oro +item.npcDiamondBattleAxe.name=Hacha de Combate de diamante +item.npcBronzeBattleAxe.name=Hacha de Combate de bronce +item.npcEmeraldBattleAxe.name=Hacha de Combate de esmeralda + +item.npcWoodenMace.name=Maza de Madera +item.npcStoneMace.name=Maza de Piedra +item.npcIronMace.name=Maza de Hierro +item.npcGoldenMace.name=Maza de Oro +item.npcDiamondMace.name=Maza de Diamante +item.npcBronzeMace.name=Maza de Bronce +item.npcEmeraldMace.name=Maza de Esmeralda + +item.npcWoodenDagger.name=Daga de Madera +item.npcStoneDagger.name=Daga de Piedra +item.npcIronDagger.name=Daga de Hierro +item.npcGoldenDagger.name=Daga de Oro +item.npcDiamondDagger.name=Daga de Diamante +item.npcBronzeDagger.name=Daga de Bronce +item.npcEmeraldDagger.name=Daga de Esmeralda +item.npcWoodenReversedDagger.name=Daga de Madera reversa +item.npcStoneReversedDagger.name=Daga de Piedra reversa +item.npcIronReversedDagger.name=Daga de Hierro reversa +item.npcGoldenReversedDagger.name=Daga de Oro reversa +item.npcDiamondReversedDagger.name=Daga de Diamante reversa +item.npcBronzeReversedDagger.name=Daga de bronce reversa +item.npcEmeraldReversedDagger.name=Daga de Esmeralda reversa + +item.npcWoodenStaff.name=Staff de Madera +item.npcStoneStaff.name=Staff de Piedra +item.npcIronStaff.name=Staff de Hierro +item.npcGoldenStaff.name=Staff de Oro +item.npcDiamondStaff.name=Staff de Diamante +item.npcBronzeStaff.name=Staff de Bronce +item.npcEmeraldStaff.name=Staff de Esmeralda +item.npcElementalStaff.name=Staff Elemental + +item.npcWoodenScythe.name=Scythe de Madera +item.npcStoneScythe.name=Scythe de Piedra +item.npcIronScythe.name=Scythe de Hierro +item.npcGoldenScythe.name=Scythe de Oro +item.npcBronzeScythe.name=Scythe de Bronce +item.npcDiamondScythe.name=Scythe de Diamante +item.npcEmeraldScythe.name=Scythe de Esmeralda + +item.npcWoodenGlaive.name=Glaive de Madera +item.npcStoneGlaive.name=Glaive de Piedra +item.npcIronGlaive.name=Glaive de Hierro +item.npcGoldenGlaive.name=Glaive de Oro +item.npcDiamondGlaive.name=Glaive de Diamante +item.npcBronzeGlaive.name=Glaive de Bronce +item.npcEmeraldGlaive.name=Glaive de Esmeralda + +item.npcCowleatherHead.name=Casco de VacaCuero +item.npcCowleatherChest.name=Peto de VacaCuero +item.npcCowleatherLegs.name=Perneras de VacaCuero +item.npcCowleatherBoots.name=Botas de VacaCuero + +item.npcNanorumHead.name=Casco de Narunom +item.npcNanorumChest.name=Peto de Narunom +item.npcNanorumLegs.name=Perneras de Narunom +item.npcNanorumBoots.name=Botas de Narunom + +item.npcTacticalHead.name=Casco Tactico +item.npcTacticalChest.name=Peto Tactico + +item.npcFullLeatherHead.name=Casco de Cuero Completo +item.npcFullLeatherChest.name=Peto de Cuero Completo + +item.npcFullIronHead.name=Casco de Hierro Completo +item.npcFullIronChest.name=Peto de Hierro Completo + +item.npcFullGoldHead.name=Casco de Oro Completo +item.npcFullGoldChest.name=Peto de Oro Completo + + +item.npcFullDiamondHead.name=Casco de Diamante Completo +item.npcFullDiamondChest.name=Peto de Diamante Completo + +item.npcFullBronzeHead.name=Casco de Bronce Completo +item.npcFullBronzeChest.name=Peto de Bronce Completo +item.npcFullBronzeLeggings.name=Perneras de Bronce Completas +item.npcFullBronzeBoots.name=Botas de Bronce Completas + +item.npcFullWoodenHead.name=Casco de Madera Completo +item.npcFullWoodenChest.name=Peto de Madera Completo +item.npcFullWoodenLeggings.name=Perneras de Madera Completas +item.npcFullWoodenBoots.name=Botas de Madera Completas + +item.npcTuxedoChest.name=Torso del Esmoquin +item.npcTuxedoPants.name=Pantalones de Esmoquin +item.npcTuxedoBottom.name=Fondo del Esmoquin + +item.npcWizardHead.name=Casco de Hechizero +item.npcWizardChest.name=Peto de Hechizero +item.npcWizardPants.name=Perneras de Hechizero + +item.npcAssassinHead.name=Casco de Asesinos +item.npcAssassinChest.name=Peto de Asesinos +item.npcAssassinLeggings.name=Perneras de Asesino +item.npcAssassinBoots.name=Botas de Asesino + +item.npcSoldierHead.name=Casco de Soldado +item.npcSoldierChest.name=Peto de Soldado +item.npcSoldierLegs.name=Perneras de Soldado +item.npcSoldierBottom.name=Fondo de Soldado + +item.npcX407Head.name=Casco Prototipo X407 +item.npcX407Chest.name=Peto Prototitpo X407 +item.npcX407Legs.name=Perneras Prototipo X407 +item.npcX407Boots.name=Botas Prototitpo X407 + +item.npcCommissarHead.name=Casco de General Comisario +item.npcCommissarChest.name=Peto de General Comisario +item.npcCommissarLegs.name=Perneras de General Comisario +item.npcCommissarBottom.name=Botas de General Comisario + +item.npcInfantryHelmet.name=Casco de Infanteria +item.npcOfficerChest.name=Peto de Oficial + +item.npcCrown.name=Corona +item.npcCrown2.name=Corona + +item.npcNinjaHead.name=Casco de Ninja +item.npcNinjaChest.name=Peto de Ninja +item.npcNinjaPants.name=Perneras de Ninja + +item.npcFullEmeraldHead.name=Casco de Esmeralda +item.npcFullEmeraldChest.name=Peto de Esmeralda +item.npcFullEmeraldLeggings.name=Perneras de Esmeralda +item.npcFullEmeraldBoots.name=Botas de Esmeralda + +item.npcOrb.name=Orbe +item.npcBrokenOrb.name=Orbe Roto +item.npcMana.name=Mana + +item.npcNinjaClaw.name=Zarpa Ninja +item.npcSteelClaw.name=Zarpa de Hierro +item.npcBearClaw.name=Zarpa de Oso +item.npcKatar.name=Katar + +item.npcLetter.name=Nota +item.npcPlans.name=Planes +item.npcSatchel.name=Satchel +item.npcBag.name=Bolsa +item.npcCrystal.name=Cristal +item.npcSeveredEar.name=Oreja Severa +item.npcPhone.name=Telefono +item.npcBanditMask.name=Mascara de Bandido +item.npcBrokenArrow.name=Flecha Rota +item.npcEarthElement.name=Elemento Tierra +item.npcWaterElement.name=Elemento Agua +item.npcFireElement.name=Elemento Fuego +item.npcAirElement.name=Elemento Aire +item.npcCarKey.name=Llave de Auto +item.npcKey.name=Llave +item.npcKey2.name=Llave +item.npcPendant.name=Pendiente +item.npcBlueprint.name=Planos +item.npcRing.name=Anillo + +item.npcSkull.name=Calavera +item.npcBronzeIngot.name=Lingote de Bronce +item.npcSaphire.name=Zafiro +item.npcAmethyst.name=Amatista +item.npcRuby.name=Rubi + +item.npcMacuahuitl.name=Macuahuitl; +item.npcBoStaff.name=Bo Staff; +item.npcSaiBlade.name=Sai Blade; +item.npcCrossbow.name=Ballesta +item.npcCrossBolt.name=Flecha de Ballesta +item.npcSlingshot.name=Slingshot +item.npcMusket.name=Mosquete +item.npcExcalibur.name=Excalibur \ No newline at end of file diff --git a/src/main/resources/assets/customnpcs/lang/es_MX.lang b/src/main/resources/assets/customnpcs/lang/es_MX.lang new file mode 100644 index 000000000..2d34e3827 --- /dev/null +++ b/src/main/resources/assets/customnpcs/lang/es_MX.lang @@ -0,0 +1,500 @@ +itemGroup.cnpcs=Herramientas de CustomNpcs +itemGroup.cnpcsw=Armas de CustomNpcs +itemGroup.cnpcsa=Armaduras de CustomNpcs +itemGroup.cnpcsm=Miscelaneo de CustomNpcs + +tile.npcRedstoneBlock.name=Bloque de Redstone +tile.npcCarpentyBench.name=Mesa de Carpinteria +tile.npcBloodBlock.name=Bloque de Sangre + +gui.deleteConfirm=Estas Seguro de que quieres eliminar este npc? +gui.add=Agregar +gui.remove=Quitar +gui.edit=Editar +gui.name=Nombre +gui.color=Color +gui.none=Ninguno +gui.time=Tiempo +gui.title=Titulo +gui.categories=Categorias +gui.close=Cerrar +gui.disabled=Desactivado +gui.increase=Incrementar +gui.decrease=Decrementar +gui.day=Dia +gui.night=Noche +gui.constant=Constante +gui.accelerate=Acelerar +gui.small=Pequeño +gui.medium=Mediano +gui.large=Grande +gui.type=Tipo +gui.always=Siempre +gui.untilclose=HastaCierre +gui.ignoreDamage=Ignorar Daño + +display.model=Modelo +display.show=Mostrar +display.hide=Esconder +display.showAttacking=Mostrar Al Atacar +display.size=Tamaño +display.texture=Textura +display.textureCape=Textura de capa +display.player=Jugador +display.selectTexture=Selecciona Textura +display.livingAnimation=Animacion Viviente +display.tint=Tinte Color + +inv.minExp=Exp Minimo +inv.maxExp=Exp Maximo +inv.npcInventory=Inventario de NPC +inv.inventory=Inventario +inv.dropChance=Probabilidad de Caida + +availability.options=Opciones de Disponibilidad +availability.always=Siempre +availability.after=Despues +availability.before=Antes +availability.available=Disponible +availability.whenactive=Cuando esta activo +availability.whennotactive=Cuando no esta activo +availability.selectquest=Seleccionar Mision +availability.selectdialog=Seleccionar Dialogo +availability.selectfaction=Seleccionar Faccion +availability.daytime=De dia +availability.wholeday=Todo el dia +availability.night=De noche +availability.day=Durante el dia +availability.is=Esta +availability.isnot=No esta + +stats.health=Salud +stats.aggro=RangoAggro +stats.meleeproperties=Propiedades de Melee +stats.rangedproperties=Propiedades de Distancia +stats.projectileproperties=Tipo de proyectil +stats.meleestrength=Fuerza de Melee +stats.meleerange=Rango de Melee +stats.meleespeed=Rapidez de Melee +stats.accuracy=Precision(%) +stats.rangedrange=Rango de Distancia +stats.burstspeed=Rapidez de Fuego +stats.firedelay=AtrasoDeDisparo +stats.delayvariance=VariacionDeAtraso +stats.burstcount=Contador de Disparos +stats.walkspeed=Rapidez de caminata +stats.chargespeed=Rapidez de Carga +stats.meleeeffect=Efecto(s) +stats.respawn=Revivir +stats.deadbody=Esconder cadaver +stats.fireimmune=Inmune al fuego +stats.candrown=Puede ahogarse +stats.firesound:=Sonido de Disparo +stats.creaturetype=Tipo de cratura +stats.normal=Normal +stats.undead=No-Muerto +stats.arthropod=Artropodo +stats.nofalldamage=Sin daño de caida +stats.meleeproperties=Opciones de Melee +stats.rangedproperties=PropiedadesDeDistancia +stats.burninsun=Se quema al sol +stats.amplify=Amplificar + +stats.size=Tamaño +stats.speed=Rapidez +stats.glows=Brilla +stats.hasgravity=Tiene gravedad +stats.explosive=Explota +stats.rangedeffect=EfectoDeDistancia +stats.trail=TipoDeCamino +stats.spin=Gira +stats.stick=Se pega +stats.regular=Regular +stats.amplified=Amplificado + +ai.standing=Parado +ai.wandering=Camninando +ai.movingpath=Camino de Movimiento +ai.looping=Ciclico +ai.backtracking=Regresando + +ai.enemyresponse:=Encontro Enemigo +ai.door:=Interaccion con Puertas +ai.avoidwater:=Evita el agua +ai.return:=Vuelve al comienzo +ai.swim:=Puede Nadar +ai.shelter:=Busca refugio +ai.leapattarget:=Va al objetivo +ai.clearlos:=Debe ver el objetivo +ai.indirect:=Puede disparar indirectamente +ai.rangemelee:=UseRangeAttack + +faction.hostiles=Facciones Hostiles +faction.unfriendly=Hostil +faction.neutral=Neutral +faction.friendly=Amigable +faction.points=Puntos +faction.ondeath=Al morir +faction.hidden=Escondido +faction.default=Default +faction.attackHostile=Atacar Facciones Hostiles +faction.defend=Defender Miembros Faccion +faction.nostanding=Eres Neutral con las Facciones +faction.options=Opciones de Faccion +faction.increasepoints=Faccion %s incrementado por %s puntos +faction.decreasepoints=Faccion %s disminuida por %s puntos + +menu.inventory=Inventario +menu.quests=Misiones +menu.display=Display +menu.stats=Estadisticas +menu.factions=Facciones +menu.ai=IA +menu.advanced=Avanzado +menu.global=Global +menu.delete=Borrar +menu.role=Rol + +global.banks=Banco +global.factions=Facciones +global.dialogs=Dialogos +global.quests=Misiones +global.transport=Transporte +global.playerdata=Datos del Jugador +global.recipes=Recetas + +bank.slot=Espacio +bank.unlock=Desbloquear +bank.upgrade=Subir Nivel +bank.upgradeCosts=Costo de subir nivel +bank.unlockCosts=Costo de desbloquear + +follower.waiting=Esperando +follower.following=Siguiendo +follower.hire=Contratar +follower.health=Curar +follower.daysleft=Dias sobrantes +follower.lastday=Ultimo dia +follower.day=Dia +follower.days=Dias +follower.hireText=Gracias por contratarme +follower.farewellText=Mis dias contigo terminaron. Adios + +transporter.travel=Viajar +transporter.unlock1=Transportar a +transporter.unlock2=Esta desbloqueado + +dialog.dialog=Dialogo +dialog.dialogs=Dialogos +dialog.options=Opciones de Dialogo +dialog.dialogtext=Texto de Dialogo +dialog.editoption=Editar opciones de dialogo +dialog.optiontype=Tipo de Opcion + +quest.quest=Mision +quest.quests=Misiones +quest.item=Objeto de Mision +quest.kill=Mision Assessinar +quest.dialog=Mision de dialogo +quest.completedtext=Texto completado +quest.questlogtext=Libro de misiones +quest.complete=Completado +quest.turnin=Ya puedes entregar la mision +quest.start=Empezar nueva mision +quest.reward=Recompensa +quest.repeatable=Repetible +quest.daily=Diario +quest.weekly=Semanal +quest.instant=Completado instantaneo +quest.npc=Completado por npc + +item.npcWand.name=Varita Npc +item.npcCloner.name=Clonador Npc +item.npcSpawner.name=Spawneador de mobs +item.npcMovingPath.name=Camino de Npcs + +item.npcBanjo.name=Banjo +item.npcViolin.name=Violin +item.npcViolinBow.name=Arco de Violin +item.npcHarp.name=Arpa +item.npcGuitar.name=Guitarra + +item.npcCoinWooden.name=Moneda de Madera +item.npcCoinStone.name=Moneda de Piedra +item.npcCoinBronze.name=Moneda de Bronce +item.npcCoinIron.name=Moneda de Hierro +item.npcCoinGold.name=Moneda de Oro +item.npcCoinDiamond.name=Moneda de Diamante +item.npcCoinEmerald.name=Moneda de Esmeralda + +item.npcWoodenGun.name=Pistola de Madera +item.npcStoneGun.name=Pistola de Piedra +item.npcIronGun.name=Pistola de Hierro +item.npcGoldGun.name=Pistola Dorada +item.npcDiamondGun.name=Pistola de diamante +item.npcBronzeGun.name=Pistola de bronce +item.npcEmeraldGun.name=Pistola de esmeraldas +item.npcMachineGun.name=Pistola Maquina + +item.npcWoodenBullet.name=Bala de Madera +item.npcStoneBullet.name=Bala de Piedra +item.npcIronBullet.name=Bala de Hierro +item.npcGoldenBullet.name=Bala de Oro +item.npcDiamondBullet.name=Bala de Diamante +item.npcBronzeBullet.name=Bala de Bronce +item.npcEmeraldBullet.name=Bala de Esmeralda +item.npcBlackBullet.name=Bala Negra + +item.npcWoodenTrident.name=Tridente de Madera +item.npcStoneTrident.name=Tridente de Piedra +item.npcIronTrident.name=Tridente de Hierro +item.npcGoldTrident.name=Tridente Dorado +item.npcDiamondTrident.name=Tridente de diamante +item.npcBronzeTrident.name=Tridente de Bronce +item.npcEmeraldTrident.name=Tridente de Esmeralda +item.npcCursedTrident.name=Tridente Maldito + +item.npcNatureSpell.name=Hechizo Natural +item.npcArcaneSpell.name=Hechizo Arcano +item.npcLightningSpell.name=Hechizo de Rayo +item.npcIceSpell.name=Hechizo de Hielo +item.npcFireSpell.name=Hechizo de Fuego +item.npcDarkSpell.name=Hechizo Negro +item.npcHolySpell.name=Hechizo Sagrado + +item.npcKunai.name=Kunai +item.npcReverseKunai.name=Reverse Kunai +item.npcShuriken.name=Shuriken +item.npcGiantShuriken.name=Shuriken gigante +item.npcKatana.name=Katana +item.npcKukri.name=Kukri + +item.npcGolfClub.name=Palo de Golf +item.npcMagicWand.name=Varita Magica +item.npcChickenSword.name=Espada de Pollo +item.npcHandCuffs.name=Esposas +item.npcHammer.name=Martillo +item.npcBaseballBat.name=Bat de Beisbol +item.npcLeadPipe.name=Tuberia +item.npcCleaver.name=Cuchillo de Carnicero +item.npcSaber.name=Sable +item.npcHockeyStick.name=Palo de Hockey +item.npcSledgeHammer.name=Trineo +item.npcBrokenBottle.name=Botella Rota +item.npcCombatKnive.name=Cuchillo de combate +item.npcLighter.name=Encendedor +item.npcBatton.name=Baston +item.npcGunChainsaw.name=Motosierra +item.npcRapier.name=Rapier +item.npcCrowbar.name=Palanca +item.npcPipeWrench.name=Pedazo de Tuberia +item.npcWrench.name=Llave Inglesa +item.npcSwissArmyKnife.name=Navaja del ejercito + +item.npcWoodenShield.name=Escudo de madera redondo +item.npcStoneShield.name=Escudo de piedra redondo +item.npcIronShield.name=Escudo de hierro redondo +item.npcGoldenShield.name=Escudo dorado redondo +item.npcDiaShield.name=Escudo de diamante redondo +item.npcBronzeShield.name=Escudo de bronce redondo +item.npcEmeraldShield.name=Escudo de Esmeralda redondo +item.npcFullWoodenShield.name=Escudo de madera +item.npcFullStoneShield.name=Escudo de piedra +item.npcFullIronShield.name=Escudo de hierro + +item.npcFullGoldenShield.name=Escudo Dorado +item.npcFullDiaShield.name=Escudo de diamante +item.npcFullBronzeShield.name=Escudo de bronce +item.npcFullEmeraldShield.name=Escudo de esmeralda + +item.npcTowerShield.name=Escudo de Acero de torre +item.npcCryscentShield.name=Super Escudo de Acero +item.npcScutumShield.name=Mega Escudo de Acero +item.npcHeaterShield.name=Escudo de Acero petoso + +item.npcWoodenSpear.name=Lanza de Madera +item.npcStoneSpear.name=Lanza de Piedra +item.npcIronSpear.name=Lanza de Hierro +item.npcGoldenSpear.name=Lanza de Oro +item.npcDiamondSpear.name=Lanza de Diamante +item.npcBronzeSpear.name=Lanza de Bronce +item.npcEmeraldSpear.name=Lanza de Esmeralda + +item.npcWoodenBattleAxe.name=Hacha de Combate de madera +item.npcStoneBattleAxe.name=Hacha de Combate de piedra +item.npcIronBattleAxe.name=Hacha de Combate de hierro +item.npcGoldenBattleAxe.name=Hacha de Combate de oro +item.npcDiamondBattleAxe.name=Hacha de Combate de diamante +item.npcBronzeBattleAxe.name=Hacha de Combate de bronce +item.npcEmeraldBattleAxe.name=Hacha de Combate de esmeralda + +item.npcWoodenMace.name=Mazo de Madera +item.npcStoneMace.name=Mazo de Piedra +item.npcIronMace.name=Mazo de Hierro +item.npcGoldenMace.name=Mazo de Oro +item.npcDiamondMace.name=Mazo de Diamante +item.npcBronzeMace.name=Mazo de Bronce +item.npcEmeraldMace.name=Mazo de Esmeralda + +item.npcWoodenDagger.name=Daga de Madera +item.npcStoneDagger.name=Daga de Piedra +item.npcIronDagger.name=Daga de Hierro +item.npcGoldenDagger.name=Daga de Oro +item.npcDiamondDagger.name=Daga de Diamante +item.npcBronzeDagger.name=Daga de Bronce +item.npcEmeraldDagger.name=Daga de Esmeralda +item.npcWoodenReversedDagger.name=Daga de Madera reversa +item.npcStoneReversedDagger.name=Daga de Piedra reversa +item.npcIronReversedDagger.name=Daga de Hierro reversa +item.npcGoldenReversedDagger.name=Daga de Oro reversa +item.npcDiamondReversedDagger.name=Daga de Diamante reversa +item.npcBronzeReversedDagger.name=Daga de bronce reversa +item.npcEmeraldReversedDagger.name=Daga de Esmeralda reversa + +item.npcWoodenStaff.name=Staff de Madera +item.npcStoneStaff.name=Staff de Piedra +item.npcIronStaff.name=Staff de Hierro +item.npcGoldenStaff.name=Staff de Oro +item.npcDiamondStaff.name=Staff de Diamante +item.npcBronzeStaff.name=Staff de Bronce +item.npcEmeraldStaff.name=Staff de Esmeralda +item.npcElementalStaff.name=Staff Elemental + +item.npcWoodenScythe.name=Scythe de Madera +item.npcStoneScythe.name=Scythe de Piedra +item.npcIronScythe.name=Scythe de Hierro +item.npcGoldenScythe.name=Scythe de Oro +item.npcBronzeScythe.name=Scythe de Bronce +item.npcDiamondScythe.name=Scythe de Diamante +item.npcEmeraldScythe.name=Scythe de Esmeralda + +item.npcWoodenGlaive.name=Glaive de Madera +item.npcStoneGlaive.name=Glaive de Piedra +item.npcIronGlaive.name=Glaive de Hierro +item.npcGoldenGlaive.name=Glaive de Oro +item.npcDiamondGlaive.name=Glaive de Diamante +item.npcBronzeGlaive.name=Glaive de Bronce +item.npcEmeraldGlaive.name=Glaive de Esmeralda + +item.npcCowleatherHead.name=Casco de VacaCuero +item.npcCowleatherChest.name=Peto de VacaCuero +item.npcCowleatherLegs.name=Perneras de VacaCuero +item.npcCowleatherBoots.name=Botas de VacaCuero + +item.npcNanorumHead.name=Casco de Narunom +item.npcNanorumChest.name=Peto de Narunom +item.npcNanorumLegs.name=Perneras de Narunom +item.npcNanorumBoots.name=Botas de Narunom + +item.npcTacticalHead.name=Casco Tactico +item.npcTacticalChest.name=Peto Tactico + +item.npcFullLeatherHead.name=Casco de Cuero Completo +item.npcFullLeatherChest.name=Peto de Cuero Completo + +item.npcFullIronHead.name=Casco de Hierro Completo +item.npcFullIronChest.name=Peto de Hierro Completo + +item.npcFullGoldHead.name=Casco de Oro Completo +item.npcFullGoldChest.name=Peto de Oro Completo + + +item.npcFullDiamondHead.name=Casco de Diamante Completo +item.npcFullDiamondChest.name=Peto de Diamante Completo + +item.npcFullBronzeHead.name=Casco de Bronce Completo +item.npcFullBronzeChest.name=Peto de Bronce Completo +item.npcFullBronzeLeggings.name=Perneras de Bronce Completas +item.npcFullBronzeBoots.name=Botas de Bronce Completas + +item.npcFullWoodenHead.name=Casco de Madera Completo +item.npcFullWoodenChest.name=Peto de Madera Completo +item.npcFullWoodenLeggings.name=Perneras de Madera Completas +item.npcFullWoodenBoots.name=Botas de Madera Completas + +item.npcTuxedoChest.name=Torso del Esmoquin +item.npcTuxedoPants.name=Pantalones de Esmoquin +item.npcTuxedoBottom.name=Fondo del Esmoquin + +item.npcWizardHead.name=Casco de Hechizero +item.npcWizardChest.name=Peto de Hechizero +item.npcWizardPants.name=Perneras de Hechizero + +item.npcAssassinHead.name=Casco de Asesinos +item.npcAssassinChest.name=Peto de Asesinos +item.npcAssassinLeggings.name=Perneras de Asesino +item.npcAssassinBoots.name=Botas de Asesino + +item.npcSoldierHead.name=Casco de Soldado +item.npcSoldierChest.name=Peto de Soldado +item.npcSoldierLegs.name=Perneras de Soldado +item.npcSoldierBottom.name=Fondo de Soldado + +item.npcX407Head.name=Casco Prototipo X407 +item.npcX407Chest.name=Peto Prototitpo X407 +item.npcX407Legs.name=Perneras Prototipo X407 +item.npcX407Boots.name=Botas Prototitpo X407 + +item.npcCommissarHead.name=Casco de General Comisario +item.npcCommissarChest.name=Peto de General Comisario +item.npcCommissarLegs.name=Perneras de General Comisario +item.npcCommissarBottom.name=Botas de General Comisario + +item.npcInfantryHelmet.name=Casco de Infanteria +item.npcOfficerChest.name=Peto de Oficial + +item.npcCrown.name=Corona +item.npcCrown2.name=Corona + +item.npcNinjaHead.name=Casco de Ninja +item.npcNinjaChest.name=Peto de Ninja +item.npcNinjaPants.name=Perneras de Ninja + +item.npcFullEmeraldHead.name=Casco de Esmeralda +item.npcFullEmeraldChest.name=Peto de Esmeralda +item.npcFullEmeraldLeggings.name=Perneras de Esmeralda +item.npcFullEmeraldBoots.name=Botas de Esmeralda + +item.npcOrb.name=Orbe +item.npcBrokenOrb.name=Orbe Roto +item.npcMana.name=Mana + +item.npcNinjaClaw.name=Zarpa Ninja +item.npcSteelClaw.name=Zarpa de Hierro +item.npcBearClaw.name=Zarpa de Oso +item.npcKatar.name=Katar + +item.npcLetter.name=Nota +item.npcPlans.name=Planes +item.npcSatchel.name=Satchel +item.npcBag.name=Bolsa +item.npcCrystal.name=Cristal +item.npcSeveredEar.name=Oreja Severa +item.npcPhone.name=Telefono +item.npcBanditMask.name=Mascara de Bandido +item.npcBrokenArrow.name=Flecha Rota +item.npcEarthElement.name=Elemento Tierra +item.npcWaterElement.name=Elemento Agua +item.npcFireElement.name=Elemento Fuego +item.npcAirElement.name=Elemento Aire +item.npcCarKey.name=Llave de Auto +item.npcKey.name=Llave +item.npcKey2.name=Llave +item.npcPendant.name=Pendiente +item.npcBlueprint.name=Planos +item.npcRing.name=Anillo + +item.npcSkull.name=Calavera +item.npcBronzeIngot.name=Lingote de Bronce +item.npcSaphire.name=Zafiro +item.npcAmethyst.name=Amatista +item.npcRuby.name=Rubi + +item.npcMacuahuitl.name=Macuahuitl; +item.npcBoStaff.name=Bo Staff; +item.npcSaiBlade.name=Sai Blade; +item.npcCrossbow.name=Ballesta +item.npcCrossBolt.name=Flecha de Ballesta +item.npcSlingshot.name=Slingshot +item.npcMusket.name=Mosquete +item.npcExcalibur.name=Excalibur \ No newline at end of file diff --git a/src/main/resources/assets/customnpcs/lang/fr_FR.lang b/src/main/resources/assets/customnpcs/lang/fr_FR.lang new file mode 100644 index 000000000..23820f78a --- /dev/null +++ b/src/main/resources/assets/customnpcs/lang/fr_FR.lang @@ -0,0 +1,542 @@ +itemGroup.cnpcs=Outils CustomNpcs +itemGroup.cnpcsw=Armes CustomNpcs +itemGroup.cnpcsa=Armures CustomNpcs +itemGroup.cnpcsm=Divers CustomNpcs + +tile.npcRedstoneBlock.name=Bloc de Redstone +tile.npcCarpentyBench.name=Banc de menuiserie +tile.npcBloodBlock.name=Bloc de Sang + +gui.deleteConfirm="Êtes-vous sûr de vouloir effacer ce PNJ ?" +gui.add=Ajouter +gui.remove=Retirer +gui.edit=Editer +gui.name=Nom +gui.color=Couleur +gui.none=Aucun +gui.time=Temps +gui.title=Titre +gui.categories=Catégories +gui.close=Fermer +gui.disabled=Désactiver +gui.increase=Diminuer +gui.decrease=Augmenter +gui.day=Jour +gui.night=Nuit +gui.constant=Constant +gui.accelerate=Accéléré +gui.small=Petit +gui.medium=Moyen +gui.large=Grand +gui.type=Type +gui.always=Toujours +gui.untilclose=Jusqu'à Fermeture +gui.ignoreDamage=Ignore dégâts +gui.save=Sauvegarder +gui.retaliate=Riposte +gui.panic=Panique +gui.retreat=Retraite +gui.nothing=Rien +gui.break=Casse +gui.open=Ouvre +gui.darkness=Nocturne +gui.sunlight=Diurne +gui.whenavailable=Quand prêt +gui.engagedistance=Distance d'aggro +gui.currentFolder=Dossier courant +gui.play=Jouer +gui.selectSound=Choisir le son + +remote.title=Pnj proche +remote.reset=Reset +remote.tp=Tp à +remote.resetall=Tout reset +remote.freeze=Geler Pnj + +spawner.entities=Entités +spawner.clones=Clones +spawner.mobspawner=MobSpawner + +display.model=Modèle +display.show=Montrer +display.hide=Cacher +display.showAttacking=Montrer en Combat +display.size=Taille +display.texture=Modèle +display.textureCape=Cape +display.textureOverlay=Regard +display.player=Joueur +display.selectTexture=Choisir +display.livingAnimation=Est Animè +display.tint=Couleur de teinte + +inv.minExp=Min Exp +inv.maxExp=Max Exp +inv.npcInventory=Inventaire Pnj +inv.inventory=Inventaire +inv.dropChance=Chance de loot + +availability.options=Options Disponibilité +availability.always=Toujours +availability.after=Après +availability.before=Avant +availability.available=Disponible +availability.whenactive=Quand Actif +availability.whennotactive=Quand Non-Actif +availability.selectquest=Choix Quêtes +availability.selectdialog=Choix Dialogue +availability.selectfaction=Choix Faction +availability.daytime=Journée +availability.wholeday=toujours +availability.night=Durant la nuit +availability.day=Durant le jour +availability.is=est +availability.isnot=n'est pas + +stats.health=Santé +stats.aggro=Portée d'Aggro +stats.meleeproperties=Propriétés Mélée +stats.rangedproperties=Propriétés Portée +stats.projectileproperties=Type de Projectile +stats.meleestrength=Force Mélée +stats.meleerange=Distance Mélée +stats.meleespeed=Vitesse Mélée +stats.accuracy=Précision(%) +stats.rangedrange=RangedRange +stats.burstspeed=FireRate +stats.firedelay=FireDelay +stats.delayvariance=Délai Variant +stats.burstcount=Nombre de cycle +stats.walkspeed=Vitesse de Marche +stats.chargespeed=Vitesse de Charge +stats.meleeeffect=Effet(s) +stats.respawn=Respawn +stats.deadbody=CacherCadavre +stats.fireimmune=Immunisé au Feu +stats.candrown=Peut se Noyer +stats.firesound:=SoundFX +stats.creaturetype=Type de Créature +stats.normal=Normal +stats.undead=Non-Mort +stats.arthropod=Arthropodes +stats.nofalldamage=Pas de dégâts de Chute +stats.meleeproperties=Options Mélée +stats.rangedproperties=Options Distance +stats.burninsun=Brule Au Soleil +stats.amplify=Amplifie +stats.regenhealth=Se regénère + +stats.size=Taille +stats.speed=Vitesse +stats.glows=Brillance +stats.hasgravity=Gravité +stats.explosive=Explosion +stats.rangedeffect=Effet +stats.trail=Trainée +stats.spin=Pivote +stats.stick=Colle +stats.regular=Régulier +stats.amplified=Amplifié + +ai.standing=Attend +ai.wandering=Errant +ai.movingpath=Se Déplace +ai.looping=En boucle +ai.backtracking=Marche Arrière +ai.tacticalvariant=Variante tactique + +aitactics.rush=Se ruer +aitactics.stagger=Se faufiler +aitactics.orbit=Encercler +aitactics.ambush=Embusquer +aitactics.stalk=Traquer + +advanced.idlesound=Quand vivant +advanced.angersound=Quand furieux +advanced.hurtsound=Quand blessé +advanced.deathsound=Quand mort +advanced.stepsound=Quand marche + +ai.enemyresponse:=Présence hostile +ai.door:=Ouvre les portes +ai.avoidwater:=Evite l'eau +ai.return:=Retour au début +ai.swim:=Peut nager +ai.shelter:=Cherche refuge +ai.leapattarget:=Bondit sur cible +ai.clearlos:=Doit voir +ai.indirect:=S'enflamme indirect. +ai.rangemelee:=Utilise distance d'attaque + +faction.hostiles=Hostiles +faction.unfriendly=Inamical +faction.neutral=Neutre +faction.friendly=Amical +faction.points=Points +faction.ondeath=A la mort +faction.hidden=Caché +faction.default=Défaut +faction.attackHostile=Attaquer les factions hostiles +faction.defend=Defendre les membres de la faction +faction.nostanding=Vous n'avez pas de classement sur aucune faction +faction.options=Options de Faction +faction.increasepoints=Réputation %s augmentée de %s points +faction.decreasepoints=Réputation %s diminuée de %s points + +menu.inventory=Inventaire +menu.quests=Quêtes +menu.display=Affichage +menu.stats=Stats +menu.factions=Factions +menu.ai=IA +menu.advanced=Avancé +menu.global=Global +menu.delete=Effacer +menu.role=Role + +global.banks=Banques +global.factions=Factions +global.dialogs=Dialogues +global.quests=Quêtes +global.transport=Transport +global.playerdata=Données Joueurs +global.recipes=Recettes + +bank.slot=Onglet +bank.unlock=Débloquer +bank.upgrade=Améliorer +bank.upgradeCosts=Coût d'Amélioration +bank.unlockCosts=Coût de Débloquage + +follower.waiting=Attendre +follower.following=Suivre +follower.hire=Embaucher +follower.health=Santé +follower.daysleft=Jours restants +follower.lastday=Dernier Jour +follower.day=Jour +follower.days=Jours +follower.hireText=Merci de m'embaucher +follower.farewellText=Ma vie pour votre protection + +transporter.travel=Voyager +transporter.unlock1=Transport vers +transporter.unlock2=est débloqué + +dialog.dialog=Dialogue +dialog.dialogs=Dialogues +dialog.options=Options de Dialogue +dialog.dialogtext=Texte Dialogue +dialog.editoption=Editer Option de Dialogue +dialog.optiontype=type d'Option +dialog.selectoption=Choisir Option +dialog.quitoption=Option de sortie +dialog.option=Option du dialogue +dialog.roleoption=Option du rôle +dialogcommandoption=Option des commandes + +quest.quest=Quête +quest.quests=Quêtes +quest.item=Quête d'Objet +quest.kill=Quête de Meurtre +quest.dialog=Quête de Dialogue +quest.completedtext=Texte d'Achèvement +quest.questlogtext=Texte de quête +quest.complete=Terminer +quest.turnin=Vous pouvez maintenant rendre la quête +quest.start=Début de la quête +quest.reward=Récompense +quest.repeatable=Répétable +quest.daily=Journalière +quest.weekly=Hebdomadaire +quest.instant=Terminer en instantané +quest.npc=Terminer par Pnj + +item.npcWand.name=Baguette de Pnj +item.npcCloner.name=Cloneur de Pnj +item.npcSpawner.name=Mob Spawner +item.npcMovingPath.name=Traceur de Pnj + +item.npcBanjo.name=Banjo +item.npcViolin.name=Violion +item.npcViolinBow.name=Archet de Violion +item.npcHarp.name=Harpe +item.npcGuitar.name=Guitare + +item.npcCoinWooden.name=Pièce en Bois +item.npcCoinStone.name=Pièce en Pierre +item.npcCoinBronze.name=Pièce en Bronze +item.npcCoinIron.name=Pièce en Fer +item.npcCoinGold.name=Pièce en Or +item.npcCoinDiamond.name=Pièce en Diamand +item.npcCoinEmerald.name=Pièce en Emeraude + +item.npcWoodenGun.name=Pistolet en Bois +item.npcStoneGun.name=Pistolet en Pierre +item.npcIronGun.name=Pistolet en Fer +item.npcGoldGun.name=Pistolet en Or +item.npcDiamondGun.name=Pistolet en Diamand +item.npcBronzeGun.name=Pistolet en +item.npcEmeraldGun.name=Pistolet en Emeraude +item.npcMachineGun.name=Mitrailleuse + +item.npcWoodenBullet.name=Balle en Bois +item.npcStoneBullet.name=Balle en Pierre +item.npcIronBullet.name=Fer Bullet +item.npcGoldBullet.name=Balle en Or +item.npcDiamondBullet.name=Balle en Diamand +item.npcBronzeBullet.name=Balle en Bronze +item.npcEmeraldBullet.name=Balle en Emeraude +item.npcBlackBullet.name=Balle Noire + +item.npcWoodenTrident.name=Trident en Bois +item.npcStoneTrident.name=Trident en Pierre +item.npcIronTrident.name=Trident en Fer +item.npcGoldTrident.name=Trident en Or +item.npcDiamondTrident.name=Trident en Diamand +item.npcBronzeTrident.name=Trident en Bronze +item.npcEmeraldTrident.name=Trident en Emeraude +item.npcCursedTrident.name=Trident Maudit + +item.npcNatureSpell.name=Sort de Nature +item.npcArcaneSpell.name=Sort d'Arcane +item.npcLightningSpell.name=Sort de Lumière +item.npcIceSpell.name=Sort de Glace +item.npcFireSpell.name=Sort de Feu +item.npcDarkSpell.name=Sort d'Ombre +item.npcHolySpell.name=Sort de Sacré + +item.npcKunai.name=Kunaï +item.npcReverseKunai.name=Kunaï Inversé +item.npcShuriken.name=Shuriken +item.npcGiantShuriken.name=Shuriken Géant +item.npcKatana.name=Katana +item.npcKukri.name=Kukri + +item.npcGolfClub.name=Club de Golf +item.npcMagicWand.name=Baguette Magique +item.npcChickenSword.name=Epée Poulet +item.npcHandCuffs.name=Menottes +item.npcHammer.name=Marteau +item.npcBaseballBat.name=Ba tte de Baseball +item.npcLeadPipe.name=Tuyau en Plomb +item.npcCleaver.name=Couperet +item.npcSaber.name=Sabre +item.npcHockeyStick.name=Crosse de Hockey +item.npcSledgeHammer.name=Marteau de Forgeron +item.npcBrokenBottle.name=Bouteille Cassée +item.npcCombatKnive.name=Couteau de Combat +item.npcLighter.name=Briquet +item.npcBatton.name=Batte +item.npcGunChainsaw.name=Taille-Haie +item.npcRapier.name=Rapière +item.npcCrowbar.name=Pied de Biche +item.npcPipeWrench.name=Clé àPipe +item.npcWrench.name=Clé +item.npcSwissArmyKnife.name=Couteau Suisse + +item.npcWoodenShield.name=Bouclier Rond en Bois +item.npcStoneShield.name=Bouclier Rond en Pierre +item.npcIronShield.name=Bouclier Rond en Fer +item.npcGoldShield.name=Bouclier Rond en Or +item.npcDiaShield.name=Bouclier Rond en Diamand +item.npcBronzeShield.name=Bouclier Rond en Bronze +item.npcEmeraldShield.name=Bouclier Rond en Emeraude +item.npcFullWoodenShield.name=Bouclier en Bois +item.npcFullStoneShield.name=Bouclier en Pierre +item.npcFullIronShield.name=Bouclier en Fer +item.npcFullGoldShield.name=Bouclier en Or +item.npcFullDiaShield.name=Bouclier en Diamand +item.npcFullBronzeShield.name=Bouclier en Bronze +item.npcFullEmeraldShield.name=Bouclier en Emeraude + +item.npcTowerShield.name=Bouclier d'Acier Rempart +item.npcCryscentShield.name=Bouclier d'Acier Hurlant +item.npcScutumShield.name=Bouclier d'Acier Scutum +item.npcHeaterShield.name=Bouclier d'Acier Brûlant + +item.npcWoodenSpear.name=Lance en Bois +item.npcStoneSpear.name=Lance en Pierre +item.npcIronSpear.name=Lance en Fer +item.npcGoldSpear.name=Lance en Or +item.npcDiamondSpear.name=Diamand +item.npcBronzeSpear.name=Lance en Bronze +item.npcEmeraldSpear.name=Lance en Emeraude + +item.npcWoodenBattleAxe.name=Hache de bataille en Bois +item.npcStoneBattleAxe.name=Hache de bataille en Pierre +item.npcIronBattleAxe.name=Hache de bataille en Fer +item.npcGoldBattleAxe.name=Hache de bataille en Or +item.npcDiamondBattleAxe.name=Hache de bataille en Diamand +item.npcBronzeBattleAxe.name=Hache de bataille en Bronze +item.npcEmeraldBattleAxe.name=Hache de bataille en Emeraude + +item.npcWoodenMace.name=Masse en Bois +item.npcStoneMace.name=Masse en Pierre +item.npcIronMace.name=Masse en Fer +item.npcGoldMace.name=Masse en Or +item.npcDiamondMace.name=Masse en Diamand +item.npcBronzeMace.name=Masse en Bronze +item.npcEmeraldMace.name=Masse en Emeraude + +item.npcWoodenDagger.name=Dague en Bois +item.npcStoneDagger.name=Dague en Pierre +item.npcIronDagger.name=Dague en Fer +item.npcGoldDagger.name=Dague en Or +item.npcDiamondDagger.name=Dague en Diamand +item.npcBronzeDagger.name=Dague en Bronze +item.npcEmeraldDagger.name=Dague en Emeraude +item.npcWoodenReversedDagger.name=Dague Inversée en Bois +item.npcStoneReversedDagger.name=Dague Inversée en Pierre +item.npcIronReversedDagger.name=Dague Inversée en Fer +item.npcGoldReversedDagger.name=Dague Inversée en Or +item.npcDiamondReversedDagger.name=Dague Inversée en Diamand +item.npcBronzeReversedDagger.name=Dague Inversée en Bronze +item.npcEmeraldReversedDagger.name=Dague Inversée en Emeraude + +item.npcWoodenStaff.name=Crosse en Bois +item.npcStoneStaff.name=Crosse en Pierre +item.npcIronStaff.name=Crosse en Fer +item.npcGoldStaff.name=Crosse en Or +item.npcDiamondStaff.name=Crosse en Diamand +item.npcBronzeStaff.name=Crosse en Bronze +item.npcEmeraldStaff.name=Crosse en Emeraude +item.npcElementalStaff.name=Crosse Elémentaire + +item.npcWoodenScythe.name=Faux en Bois +item.npcStoneScythe.name=Faux en Pierre +item.npcIronScythe.name=Faux en Fer +item.npcGoldScythe.name=Faux en Or +item.npcBronzeScythe.name=Faux en Bronze +item.npcDiamondScythe.name=Faux en Diamand +item.npcEmeraldScythe.name=Faux en Emeraude + +item.npcWoodenGlaive.name=Glaive en Bois +item.npcStoneGlaive.name=Glaive en Pierre +item.npcIronGlaive.name=Glaive en Fer +item.npcGoldGlaive.name=Glaive en Or +item.npcDiamondGlaive.name=Glaive en Diamand +item.npcBronzeGlaive.name=Glaive en Bronze +item.npcEmeraldGlaive.name=Glaive en Emeraude + +item.npcCowleatherHead.name=Casque en Cuir de Vache +item.npcCowleatherChest.name=Torse en Cuir de Vache +item.npcCowleatherLegs.name=Jambières en Cuir de Vache +item.npcCowleatherBottes.name=Bottes en Cuir de Vache + +item.npcNanorumHead.name=Casque Nanorum +item.npcNanorumChest.name=Torse Nanorum +item.npcNanorumLegs.name=Jambières Nanorum +item.npcNanorumBottes.name=Bottes Nanorum + +item.npcTacticalHead.name=Casque Tactique +item.npcTacticalChest.name=Veste Tactique + +item.npcFullLeatherHead.name=Casque en Cuir Lourd +item.npcFullLeatherChest.name=Torse en Cuir Lourd + +item.npcFullIronHead.name=Casque en Fer Lourd +item.npcFullIronChest.name=Torse en Fer Lourd + +item.npcFullGoldHead.name=Casque en Or Lourd +item.npcFullGoldChest.name=Torse en Or Lourd + +item.npcFullDiamondHead.name=Casque en Diamand Lourd +item.npcFullDiamondChest.name=Torse en Diamand Lourd + +item.npcFullBronzeHead.name=Casque en Bronze Lourd +item.npcFullBronzeChest.name=Torse en Bronze Lourd +item.npcFullBronzeJambières.name=Jambières en Bronze Lourd +item.npcFullBronzeBottes.name=Bottes en Bronze Lourd + +item.npcFullWoodenHead.name=Casque en Bois Lourd +item.npcFullWoodenChest.name=Torse en Bois Lourd +item.npcFullWoodenJambières.name=Jambières en Bois Lourd +item.npcFullWoodenBottes.name=Bottes en Bois Lourd + +item.npcTuxedoChest.name=Veste Tuxedo +item.npcTuxedoPants.name=Pantalon Tuxedo +item.npcTuxedoBottom.name=Rangers Tuxedo + +item.npcWizardHead.name=Chapeau de Sorcier +item.npcWizardChest.name=Robe de Sorcier +item.npcWizardPants.name=Jambières de Sorcier + +item.npcAssassinHead.name=Casque d'Assassin +item.npcAssassinChest.name=Torse d'Assassin +item.npcAssassinJambières.name=Jambières d'Assassin +item.npcAssassinBottes.name=Bottes d'Assassin + +item.npcSoldierHead.name=Casque de Soldat +item.npcSoldierChest.name=Torse de Soldat +item.npcSoldierLegs.name=Jambières de Soldat +item.npcSoldierBottom.name=Rangers de Soldat + +item.npcX407Head.name=X407 Casque Prototype X407 +item.npcX407Chest.name=Torse Prototype X407 +item.npcX407Legs.name=Jambières Prototype X407 +item.npcX407Bottes.name=Bottes Prototype X407 + +item.npcCommissarHead.name=Casque de Comissaire +item.npcCommissarChest.name=Torse de Comissaire +item.npcCommissarLegs.name=Jambières de Comissaire +item.npcCommissarBottom.name=Rangers de Comissaire + +item.npcInfantryCasque.name=Casque d'Infantrie +item.npcOfficerCasque.name=Torse d'Officier + +item.npcCrown.name=Couronne +item.npcCrown2.name=Couronne + +item.npcNinjaHead.name=Head de Ninja +item.npcNinjaChest.name=Torse de Ninja +item.npcNinjaPants.name=Jambières de Ninja + +item.npcFullEmeraldHead.name=Emeraude Lourd Casque en Emeraude Lourd +item.npcFullEmeraldChest.name=Torse en Emeraude Lourd +item.npcFullEmeraldJambières.name=Jambières en Emeraude Lourdes +item.npcFullEmeraldBottes.name=Bottes en Emeraude Lourdes + +item.npcOrb.name=Orbe +item.npcBrokenOrb.name=Orbe Cassé +item.npcMana.name=Mana + +item.npcNinjaClaw.name=Griffe de Ninja +item.npcSteelClaw.name=Griffe d'Acier +item.npcBearClaw.name=Griffe de Souffrance +item.npcKatar.name=Katar + +item.npcLetter.name=Lettre +item.npcPlans.name=Plans +item.npcSatchel.name=Saccoche +item.npcBag.name=Sac +item.npcCrystal.name=Cristal +item.npcSeveredEar.name=Oreille Coupée +item.npcPhone.name=Téléphone +item.npcBanditMask.name=Masque Bandit +item.npcBrokenArrow.name=Flèche Cassée +item.npcEarthElement.name=Elément de Terre +item.npcWaterElement.name=Elément d'Eau +item.npcFireElement.name=Elément de Feu +item.npcAirElement.name=Elément d'Air +item.npcCarKey.name=Clé de Voiture +item.npcKey.name=Clé +item.npcKey2.name=Clé +item.npcPendant.name=Pendantif +item.npcBlueprint.name=Plan +item.npcRing.name=Anneau + +item.npcSkull.name=Crâne +item.npcBronzeIngot.name=Lingot de Bronze +item.npcSaphire.name=Saphire +item.npcAmethyst.name=Améthyste +item.npcRuby.name=Rubis + +item.npcMacuahuitl.name=Macuahuitl +item.npcBoStaff.name=Bo Staff +item.npcSaiBlade.name=Lame Sai +item.npcCrossbow.name=Arbalète +item.npcCrossBolt.name=Carreau d'Arbalète +item.npcSlingshot.name=Lance-Pièrre +item.npcMusket.name=Mousquet +item.npcExcalibur.name=Excalibur \ No newline at end of file diff --git a/src/main/resources/assets/customnpcs/lang/hu_HU.lang b/src/main/resources/assets/customnpcs/lang/hu_HU.lang new file mode 100644 index 000000000..612df7a82 --- /dev/null +++ b/src/main/resources/assets/customnpcs/lang/hu_HU.lang @@ -0,0 +1,542 @@ +itemGroup.cnpcs=CustomNpcs Eszközök +itemGroup.cnpcsw=CustomNpcs Fegyverek +itemGroup.cnpcsa=CustomNpcs Páncél +itemGroup.cnpcsm=CustomNpcs Egyéb + +tile.npcRedstoneBlock.name=Vöröskő Blokk +tile.npcCarpentyBench.name=Asztalos Pad +tile.npcBloodBlock.name=Vér Blokk + +gui.deleteConfirm=Tényleg le akarod törölni az NPC-t? +gui.add=Hozzáad +gui.remove=Töröl +gui.save=Mentés +gui.name=Név +gui.color=Szín +gui.none=Semmi +gui.time=Idő +gui.title=Cím +gui.categories=Kategóriák +gui.close=Bezár +gui.disabled=Kikapcsolva +gui.increase=Növel +gui.decrease=Csökkent +gui.day=Nap +gui.night=Éj +gui.constant=Állandó +gui.accelerate=Gyorsul +gui.small=Kicsi +gui.medium=Közepes +gui.large=Nagy +gui.type=Típus +gui.retaliate=Megtorló +gui.panic=Pánikoló +gui.retreat=Visszavonuló +gui.nothing=Semmi +gui.break=Betöri +gui.open=Kinyitja +gui.darkness=Sötétség +gui.sunlight=Napfény +gui.always=Mindig +gui.untilclose=Bezárásig +gui.whenavailable=Ha készenáll +gui.ignoreDamage=Törhetetlen +gui.engagedistance=Harctávolság +gui.currentFolder=Helyi mappa +gui.play=Lejátszás +gui.selectSound=Hang lejátszása + +remote.title=Közeli Npc-k +remote.reset=Visszaállít +remote.tp=Tp +remote.resetall=Mind Visszaállít +remote.freeze=NPC-lefagyasztása + +spawner.entities=Entitások +spawner.clones=Klónok +spawner.mobspawner=MobSpawner + +display.model=Model +display.show=Mutat +display.hide=Elrejt +display.showAttacking=Támadásnál mutat +display.size=Méret +display.texture=Textúra +display.textureCape=Köpeny Textúra +display.textureOverlay=Textúra Színezet +display.player=Játékos +display.selectTexture=Textúra +display.livingAnimation=Élő animáció +display.tint=Árnyalat + +inv.minExp=Min Exp +inv.maxExp=Max Exp +inv.npcInventory=NPC felszerelés +inv.inventory=Felszerelés +inv.dropChance=Dobási Esély + +availability.options=Elérhetőség opciók +availability.always=Mindig +availability.after=Utána +availability.before=Előtte +availability.available=Elérhetőség +availability.whenactive=Ha aktív +availability.whennotactive=Ha nem aktív +availability.selectquest=Küldetést kiválaszt +availability.selectdialog=Párbeszéd kiválaszt +availability.selectfaction=Csoportok kiválaszt +availability.daytime=Nappal +availability.wholeday=Egész nap +availability.night=Este +availability.day=Nap +availability.is=Létezik +availability.isnot=Nemlétezik + +stats.health=Élet +stats.aggro=AggroRange +stats.meleeproperties=Közelharc Opciók +stats.rangedproperties=Távolsági Opciók +stats.projectileproperties=Lövedéktípus +stats.meleestrength=Közelharc erő +stats.meleerange=Közelharc táv +stats.meleespeed=Közelharc sebesség +stats.accuracy=Pontosság(%) +stats.rangedrange=Távolsági táv +stats.burstspeed=Tüzelési táv +stats.firedelay=Tüzelési késleltetés +stats.delayvariance=Késleltetés eltérés +stats.burstcount=Robbanás számossága +stats.walkspeed=Séta sebesség +stats.meleeeffect=Hatás(s) +stats.respawn=Újjáéledés +stats.deadbody=Holttest elrejtése +stats.fireimmune=Tűzálló +stats.candrown=Fulladó +stats.firesound:=HangFX +stats.creaturetype=Lénytípus +stats.normal=Normal +stats.undead=Élőholt +stats.arthropod=Ízeltlábú +stats.nofalldamage=Nincs esési sebzés +stats.meleeproperties=Közelharci Opciók +stats.rangedproperties=Távolsági Opciók +stats.burninsun=Napon ég +stats.amplify=Erősít +stats.melee=Közelharc +stats.regenhealth=Regeneráció + +stats.size=Méret +stats.speed=Sebesség +stats.glows=Ragyogás +stats.hasgravity=Van gravitáció +stats.explosive=Robbanó +stats.rangedeffect=TávHatás +stats.trail=Nyomtípus +stats.spin=Pörgés +stats.stick=Bot +stats.regular=Átlagos +stats.amplified=Erősített + +ai.standing=Álló +ai.wandering=Vándorló +ai.movingpath=Útvonal +ai.looping=Ismétlés +ai.backtracking=Nyomkövetés + +ai.enemyresponse=Ellenség észlelésekor +ai.door=Ajtót kezel +ai.avoidwater=Vizet elkerül +ai.return=Visszatér a Starthoz +ai.swim=Úszik +ai.shelter=Megvéd +ai.leapattarget=Ráugrik +ai.sprint=Rohanhat +ai.clearlos=Látnia kell a célt +ai.indirect=Közvetetten lőhet +ai.rangemelee=Lő +ai.tacticalvariant=Taktikai változat + +aitactics.rush=Rohan +aitactics.stagger=Kitér +aitactics.orbit=Körbevesz +aitactics.ambush=Lesben áll +aitactics.stalk=Lopakodik + +advanced.idlesound=Tétlen hangja +advanced.angersound=Mérges hangja +advanced.hurtsound=Sebződés hangja +advanced.deathsound=Halál hangja +advanced.stepsound=Lépés hangja + +faction.hostiles=Ellenséges Csoportok +faction.unfriendly=Ellenséges +faction.neutral=Semleges +faction.friendly=Barátságos +faction.points=Pont +faction.ondeath=Halál esetén +faction.hidden=Rejtett +faction.default=Alapbeállítás +faction.attackHostile=Ellenséges csoportokat támad +faction.defend=Csoport tagokat megvéd +faction.nostanding=Nincs semmilyen kapcsolatod +faction.options=Csoport beállítások +faction.increasepoints=Csoport %s növekedett %s ponttal +faction.decreasepoints=Csoport %s csökkent %s ponttal + +menu.inventory=Felszerelés +menu.quests=Küldetések +menu.display=Kijelzés +menu.stats=Státusz +menu.factions=Csoportok +menu.ai=AI +menu.advanced=Haladó +menu.global=Globális +menu.role=Szerep + +global.banks=Bankok +global.factions=Csoportok +global.dialogs=Dialógusok +global.quests=Küldetések +global.transport=Utazás +global.playerdata=Játékos adat +global.recipes=Receptek + +bank.slot=Hely +bank.unlock=Megvesz +bank.upgrade=Fejleszt +bank.upgradeCosts=Fejlesztéshez kell +bank.unlockCosts=Megvételhez kell + +follower.waiting=Várakozik +follower.following=Követ +follower.hire=Felfogad +follower.health=Élet +follower.daysleft=Hátralévő napok +follower.lastday=Utolsó nap +follower.day=Nap +follower.days=Napok +follower.hireText=Kösz hogy felfogadtál +follower.farewellText=A veled töltött napjaimnak vége. Viszlát! + +transporter.travel=Utazik +transporter.unlock1=Szállítva +transporter.unlock2=mostmár kinyitva + +dialog.dialog=Dialógus +dialog.dialogs=Dialógusok +dialog.options=Dialógus Opciók +dialog.dialogtext=Dialógus Szöveg +dialog.editoption=Dialógus Szerkesztése +dialog.optiontype=Opció típus +dialog.selectoption=Kiválaszt Opció +dialog.quitoption=Kilép Opció +dialog.option=Dialógus Opció +dialog.roleoption=Szerep Opció +dialogcommandoption=Parancs Opció + +quest.quest=Küldetés +quest.quests=Küldetések +quest.item=Tárgy Küldetés +quest.kill=Harc Küldetés +quest.dialog=Szöveg Küldetés +quest.completedtext=Befejezett szöveg +quest.questlogtext=Küldetésnapló szöveg +quest.complete=Kész +quest.turnin=Mostmár befejezheted a küldetést +quest.start=Új küldetés elkezdve +quest.reward=Jutalom +quest.repeatable=Ismétlődő +quest.daily=Naponta +quest.weekly=Heti +quest.instant=Azonnal kész +quest.npc=Npc által kész +quest.next=Következő Küldetés + +item.npcWand.name=Npc Bot +item.npcCloner.name=Npc Klónozó +item.npcSpawner.name=Mob Spawner +item.npcMovingPath.name=Npc Útválasztó + +item.npcBanjo.name=Citera +item.npcViolin.name=Hegedű +item.npcViolinBow.name=Hegedű vonó +item.npcHarp.name=Hárfa +item.npcGuitar.name=Gitár + +item.npcCoinWooden.name=Fa Érme +item.npcCoinStone.name=Kő Érme +item.npcCoinBronze.name=Bronz Érme +item.npcCoinIron.name=Vas Érme +item.npcCoinGold.name=Arany Érme +item.npcCoinDiamond.name=Gyémánt Érme +item.npcCoinEmerald.name=Drágakő Érme + +item.npcWoodenGun.name=Fa Pisztoly +item.npcStoneGun.name=Kő Pisztoly +item.npcIronGun.name=Vas Pisztoly +item.npcGoldGun.name=Arany Pisztoly +item.npcDiamondGun.name=Gyémánt Pisztoly +item.npcBronzeGun.name=Bronz Pisztoly +item.npcEmeraldGun.name=Drágakő Pisztoly +item.npcMachineGun.name=Géppuska + +item.npcWoodenBullet.name=Fa Töltény +item.npcStoneBullet.name=Kő Töltény +item.npcIronBullet.name=Vas Töltény +item.npcGoldenBullet.name=Arany Töltény +item.npcDiamondBullet.name=Gyémánt Töltény +item.npcBronzeBullet.name=Bronz Töltény +item.npcEmeraldBullet.name=Drágakő Töltény +item.npcBlackBullet.name=Fekete Töltény + +item.npcWoodenTrident.name=Fa Szigony +item.npcStoneTrident.name=Kő Szigony +item.npcIronTrident.name=Vas Szigony +item.npcGoldTrident.name=Arany Szigony +item.npcDiamondTrident.name=Gyémánt Szigony +item.npcBronzeTrident.name=Bronz Szigony +item.npcEmeraldTrident.name=Drágakő Szigony +item.npcCursedTrident.name=Elátkozott Szigony + +item.npcNatureSpell.name=Természet Varázslat +item.npcArcaneSpell.name=Misztikus Varázslat +item.npcLightningSpell.name=Villám Varázslat +item.npcIceSpell.name=Jég Varázslat +item.npcFireSpell.name=Tűz Varázslat +item.npcDarkSpell.name=Sötét Varázslat +item.npcHolySpell.name=Szent Varázslat + +item.npcKunai.name=Kunai +item.npcReverseKunai.name=Fordított Kunai +item.npcShuriken.name=Shuriken +item.npcGiantShuriken.name=Óriás Shuriken +item.npcKatana.name=Katana +item.npcKukri.name=Kukri + +item.npcGolfClub.name=Golfütő +item.npcMagicWand.name=Varázspálca +item.npcChickenSword.name=Csibe kard +item.npcHandCuffs.name=Bilincs +item.npcHammer.name=Kalapács +item.npcBaseballBat.name=Baseball ütő +item.npcLeadPipe.name=Cső +item.npcCleaver.name=Bárd +item.npcSaber.name=Szabja +item.npcHockeyStick.name=Hokiütő +item.npcSledgeHammer.name=Pöröly +item.npcBrokenBottle.name=Törött Üveg +item.npcCombatKnive.name=Harci Kés +item.npcLighter.name=Öngyújtó +item.npcBatton.name=Gumibot +item.npcGunChainsaw.name=Láncfűrészpuska +item.npcRapier.name=Vívótőr +item.npcCrowbar.name=Feszítővas +item.npcPipeWrench.name=Csőfogó +item.npcWrench.name=Csavarkulcs +item.npcSwissArmyKnife.name=Svájci bicska + +item.npcWoodenShield.name=Kerek Fa Pajzs +item.npcStoneShield.name=Kerek Kő Pajzs +item.npcIronShield.name=Kerek Vas Pajzs +item.npcGoldenShield.name=Kerek Arany Pajzs +item.npcDiaShield.name=Kerek Gyémánt Pajzs +item.npcBronzeShield.name=Kerek Bronz Pajzs +item.npcEmeraldShield.name=Kerek Drágakő Pajzs +item.npcFullWoodenShield.name=Fa Pajzs +item.npcFullStoneShield.name=Kő Pajzs +item.npcFullIronShield.name=Vas Pajzs +item.npcFullGoldenShield.name=Arany Pajzs +item.npcFullDiaShield.name=Gyémánt Pajzs +item.npcFullBronzeShield.name=Bronz Pajzs +item.npcFullEmeraldShield.name=Drágakő Pajzs + +item.npcTowerShield.name=Fém Hosszú Pajzs +item.npcCryscentShield.name=Fém Félhold Pajzs +item.npcScutumShield.name=Fém Csillag Pajzs +item.npcHeaterShield.name=Fém Szögletes Pajzs + +item.npcWoodenSpear.name=Fa Lándzsa +item.npcStoneSpear.name=Kő Lándzsa +item.npcIronSpear.name=Vas Lándzsa +item.npcGoldenSpear.name=Arany Lándzsa +item.npcDiamondSpear.name=Gyémánt Lándzsa +item.npcBronzeSpear.name=Bronz Lándzsa +item.npcEmeraldSpear.name=Drágakő Lándzsa + +item.npcWoodenBattleAxe.name=Fa Harci Balta +item.npcStoneBattleAxe.name=Kő Harci Balta +item.npcIronBattleAxe.name=Vas Harci Balta +item.npcGoldenBattleAxe.name=Arany Harci Balta +item.npcDiamondBattleAxe.name=Gyémánt Harci Balta +item.npcBronzeBattleAxe.name=Bronz Harci Balta +item.npcEmeraldBattleAxe.name=Drágakő Harci Balta + +item.npcWoodenMace.name=Fa Buzogány +item.npcStoneMace.name=Kő Buzogány +item.npcIronMace.name=Vas Buzogány +item.npcGoldenMace.name=Arany Buzogány +item.npcDiamondMace.name=Gyémánt Buzogány +item.npcBronzeMace.name=Bronz Buzogány +item.npcEmeraldMace.name=Drágakő Buzogány + +item.npcWoodenDagger.name=Fa Tőr +item.npcStoneDagger.name=Kő Tőr +item.npcIronDagger.name=Vas Tőr +item.npcGoldenDagger.name=Arany Tőr +item.npcDiamondDagger.name=Gyémánt Tőr +item.npcBronzeDagger.name=Bronz Tőr +item.npcEmeraldDagger.name=Drágakő Tőr +item.npcWoodenReversedDagger.name=Fordított Fa Tőr +item.npcStoneReversedDagger.name=Fordított Kő Tőr +item.npcIronReversedDagger.name=Fordított Vas Tőr +item.npcGoldenReversedDagger.name=Fordított Arany Tőr +item.npcDiamondReversedDagger.name=Fordított Gyémánt Tőr +item.npcBronzeReversedDagger.name=Fordított Bronz Tőr +item.npcEmeraldReversedDagger.name=Fordított Drágakő Tőr + +item.npcWoodenStaff.name=Fa Bot +item.npcStoneStaff.name=Kő Bot +item.npcIronStaff.name=Vas Bot +item.npcGoldenStaff.name=Arany Bot +item.npcDiamondStaff.name=Gyémánt Bot +item.npcBronzeStaff.name=Bronz Bot +item.npcEmeraldStaff.name=Drágakő Bot +item.npcElementalStaff.name=Elemental Bot + +item.npcWoodenScythe.name=Fa Kasza +item.npcStoneScythe.name=Kő Kasza +item.npcIronScythe.name=Vas Kasza +item.npcGoldenScythe.name=Arany Kasza +item.npcBronzeScythe.name=Bronz Kasza +item.npcDiamondScythe.name=Gyémánt Kasza +item.npcEmeraldScythe.name=Drágakő Kasza + +item.npcWoodenGlaive.name=Fa Penge +item.npcStoneGlaive.name=Kő Penge +item.npcIronGlaive.name=Vas Penge +item.npcGoldenGlaive.name=Arany Penge +item.npcDiamondGlaive.name=Gyémánt Penge +item.npcBronzeGlaive.name=Bronz Penge +item.npcEmeraldGlaive.name=Drágakő Penge + +item.npcCowleatherHead.name=Marhabőr Sisak +item.npcCowleatherChest.name=Marhabőr Mellvért +item.npcCowleatherLegs.name=Marhabőr Lábszárvédő +item.npcCowleatherBoots.name=Marhabőr Cipő + +item.npcNanorumHead.name=Nanorum Sisak +item.npcNanorumChest.name=Nanorum Mellvért +item.npcNanorumLegs.name=Nanorum Lábszárvédő +item.npcNanorumBoots.name=Nanorum Csizma + +item.npcTacticalHead.name=Taktikai Sisak +item.npcTacticalChest.name=Taktikai Mellény + +item.npcFullLeatherHead.name=Teljes Leather Sisak +item.npcFullLeatherChest.name=Teljes Leather Mellvért + +item.npcFullIronHead.name=Teljes Vas Sisak +item.npcFullIronChest.name=Teljes Vas Mellvért + +item.npcFullGoldHead.name=Teljes Arany Sisak +item.npcFullGoldChest.name=Teljes Arany Mellvért + +item.npcFullDiamondHead.name=Teljes Gyémánt Sisak +item.npcFullDiamondChest.name=Teljes Gyémánt Mellvért + +item.npcFullBronzeHead.name=Teljes Bronz Sisak +item.npcFullBronzeChest.name=Teljes Bronz Mellvért +item.npcFullBronzeLeggings.name=Teljes Bronz Lábszárvédő +item.npcFullBronzeBoots.name=Teljes Bronz Csizma + +item.npcFullWoodenHead.name=Teljes Fa Sisak +item.npcFullWoodenChest.name=Teljes Fa Mellvért +item.npcFullWoodenLeggings.name=Teljes Fa Lábszárvédő +item.npcFullWoodenBoots.name=Teljes Fa Csizma + +item.npcTuxedoChest.name=Szmoking Öltöny +item.npcTuxedoPants.name=Szmoking Nadrág +item.npcTuxedoBottom.name=Szmoking Alsó + +item.npcWizardHead.name=Varázsló Head +item.npcWizardChest.name=Varázsló Chest +item.npcWizardPants.name=Varázsló Lábszárvédő + +item.npcAssassinHead.name=Bérgyilkos Sisak +item.npcAssassinChest.name=Bérgyilkos Mellvért +item.npcAssassinLeggings.name=Bérgyilkos Lábszárvédő +item.npcAssassinBoots.name=Bérgyilkos Csizma + +item.npcSoldierHead.name=Katona Sisak +item.npcSoldierChest.name=Katona Mellvért +item.npcSoldierLegs.name=Katona Lábszárvédő +item.npcSoldierBottom.name=Katona Surranó + +item.npcX407Head.name=X407 Prototípus Sisak +item.npcX407Chest.name=X407 Prototípus Mellvért +item.npcX407Legs.name=X407 Prototípus Lábszárvédő +item.npcX407Boots.name=X407 Prototípus Csizma + +item.npcCommissarHead.name=Tiszti Kalap +item.npcCommissarChest.name=Tiszti Zubbony +item.npcCommissarLegs.name=Tiszti Nadrág +item.npcCommissarBottom.name=Tiszti Surranó + +item.npcInfantryHelmet.name=Gyalogos Sisak +item.npcOfficerChest.name=Tiszt Mellvért + +item.npcCrown.name=Korona +item.npcCrown2.name=Korona + +item.npcNinjaHead.name=Nindzsa Fejfedő +item.npcNinjaChest.name=Nindzsa Mellvért +item.npcNinjaPants.name=Nindzsa Lábszárvédő + +item.npcFullEmeraldHead.name=Teljes Drágakő Sisak +item.npcFullEmeraldChest.name=Teljes Drágakő Mellvért +item.npcFullEmeraldLeggings.name=Teljes Drágakő Lábszárvédő +item.npcFullEmeraldBoots.name=Teljes Drágakő Csizma + +item.npcOrb.name=Gömb +item.npcBrokenOrb.name=Törött Gömb +item.npcMana.name=Mana + +item.npcNinjaClaw.name=Ninja Karom +item.npcSteelClaw.name=Fém Karom +item.npcBearClaw.name=Medve Karom +item.npcKatar.name=Katar + +item.npcLetter.name=Levél +item.npcPlans.name=Tervek +item.npcSatchel.name=Táska +item.npcBag.name=Csomag +item.npcCrystal.name=Kristály +item.npcSeveredEar.name=Levágott Fül +item.npcPhone.name=Telefon +item.npcBanditMask.name=Bandita Maszk +item.npcBrokenArrow.name=Törött Nyíl +item.npcEarthElement.name=Föld Elem +item.npcWaterElement.name=Víz Elem +item.npcFireElement.name=Tűz Elem +item.npcAirElement.name=Levegő Elem +item.npcCarKey.name=Kocsikulcs +item.npcKey.name=Kulcs +item.npcKey2.name=Kulcs +item.npcPendant.name=Nyakék +item.npcBlueprint.name=Kéknyomtatvány +item.npcRing.name=Gyűrű + +item.npcSkull.name=Koponya +item.npcBronzeIngot.name=Bronzrúd +item.npcSaphire.name=Zafír +item.npcAmethyst.name=Ametiszt +item.npcRuby.name=Rubin + +item.npcMacuahuitl.name=Macuahuitl; +item.npcBoStaff.name=Bo bot; +item.npcSaiBlade.name=Sai penge; +item.npcCrossbow.name=Számszeríj +item.npcCrossBolt.name=Tüske +item.npcSlingshot.name=Csúzli +item.npcMusket.name=Muskéta +item.npcExcalibur.name=Excalibur \ No newline at end of file diff --git a/src/main/resources/assets/customnpcs/lang/id_ID.lang b/src/main/resources/assets/customnpcs/lang/id_ID.lang new file mode 100644 index 000000000..a5952d7ab --- /dev/null +++ b/src/main/resources/assets/customnpcs/lang/id_ID.lang @@ -0,0 +1,318 @@ +tile.npcRedstoneBlock.name=Blok Batu Merah +tile.npcCarpentyBench.name=Bangku Tukang Kayu +tile.npcBloodBlock.name=Blok Darah + +gui.deleteConfirm=Yakin ingin menghapus npc ini? + +menu.inventory=Persediaan +menu.quests=Tugas +menu.display=Tampilan +menu.stats=Stats +menu.advanced=Lanjutan +menu.global=Global +menu.delete=Hapus + +bank.slot=Slot +bank.unlock=Buka +bank.upgrade=Upgrade +bank.upgradeCosts=Biaya untuk upgrade +bank.unlockCosts=Biaya untuk membuka + +follower.waiting=Tunggu +follower.following=Mengikuti +follower.hire=Rekrut +follower.health=Nyawa +follower.daysleft=Hari lagi +follower.lastday=Hari terakhir +follower.day=Hari +follower.days=Hari +follower.hireText=Terima kasih telah merekrutku untuk +follower.farewellText=Hariku denganmu telah usai. Selamat tinggal + +transporter.travel=Travel +transporter.unlock1=Pindah ke +transporter.unlock2=Sekarang tersedia + +quest.complete=Selesai +quest.turnin=Sekarang kau bisa mengambil hadiahnya +quest.start=Mulai tugas baru + +item.npcWand.name=Tongkat Npc +item.npcCloner.name=Pengganda Npc +item.npcSpawner.name=Spawner Mob + +item.npcBanjo.name=Banjo +item.npcViolin.name=Biola +item.npcViolinBow.name=Tongkat Biola +item.npcHarp.name=Harpa +item.npcGuitar.name=Gitar + +item.npcCoinWooden.name=Koin Kayu +item.npcCoinStone.name=Koin Batu +item.npcCoinBronze.name=Koin Perak +item.npcCoinIron.name=Koin Besi +item.npcCoinGold.name=Koin Emas +item.npcCoinDiamond.name=Koin Berlian +item.npcCoinEmerald.name=Koin Zamrud + +item.npcWoodenGun.name=Pistol Kayu +item.npcStoneGun.name=Pistol Batu +item.npcIronGun.name=Pistol Besi +item.npcGoldGun.name=Pistol Emas +item.npcDiamondGun.name=Pistol Berlian +item.npcBronzeGun.name=Pistol Perunggu +item.npcEmeraldGun.name=Pistol Zamrud +item.npcMachineGun.name=Senapan Mesin + +item.npcWoodenBullet.name=Peluru Kayu +item.npcStoneBullet.name=Peluru Batu +item.npcIronBullet.name=Peluru Besi +item.npcGoldenBullet.name=Peluru Emas +item.npcDiamondBullet.name=Peluru Berlian +item.npcBronzeBullet.name=Peluru Perunggu +item.npcEmeraldBullet.name=Peluru Zamrud +item.npcBlackBullet.name=Peluru Hitam + +item.npcWoodenTrident.name=Trisula Kayu +item.npcStoneTrident.name=Trisula Batu +item.npcIronTrident.name=Trisula Besi +item.npcGoldTrident.name=Trisula Emas +item.npcDiamondTrident.name=Trisula Berlian +item.npcBronzeTrident.name=Trisula Perunggu +item.npcEmeraldTrident.name=Trisula Zamrud +item.npcCursedTrident.name=Trisula Terkutuk + +item.npcNatureSpell.name=Sihir Alam +item.npcArcaneSpell.name=Sihir Batin +item.npcLightningSpell.name=Sihir Petir +item.npcIceSpell.name=Sihir Es +item.npcFireSpell.name=Sihir Api +item.npcDarkSpell.name=Sihir Kegelapan +item.npcHolySpell.name=Sihir Suci + +item.npcKunai.name=Kunai +item.npcReverseKunai.name=Kunai Terbalik +item.npcShuriken.name=Shuriken +item.npcGiantShuriken.name=Shuriken Besar +item.npcKatana.name=Katana +item.npcKukri.name=Kukri + +item.npcGolfClub.name=Tongkat Golf +item.npcMagicWand.name=Tongkat Sihir +item.npcChickenSword.name=Pedang Ayam +item.npcHandCuffs.name=Borgol +item.npcHammer.name=Palu +item.npcBaseballBat.name=Tongkat Baseball +item.npcLeadPipe.name=Pipa +item.npcCleaver.name=Golok +item.npcSaber.name=Pedang Saber +item.npcHockeyStick.name=Tongkat Hockey +item.npcSledgeHammer.name=Palu Besar +item.npcBrokenBottle.name=Botol Rusak +item.npcCombatKnive.name=Pisau Tarung +item.npcLighter.name=Korek +item.npcBatton.name=Tongkat Polisi +item.npcGunChainsaw.name=Senapan Gergaji +item.npcRapier.name=Pedang Tipis +item.npcCrowbar.name=Linggis +item.npcPipeWrench.name=Kunci pipa +item.npcWrench.name=Kunci inggris +item.npcSwissArmyKnife.name=Swiss Army Knife + +item.npcWoodenShield.name=Perisai Kayu Bulat +item.npcStoneShield.name=Perisai Batu Bulat +item.npcIronShield.name=Perisai Besi Bulat +item.npcGoldenShield.name=Perisai Emas Bulat +item.npcDiaShield.name=Perisai Berlian Bulat +item.npcBronzeShield.name=Perisai Perunggu Bulat +item.npcEmeraldShield.name=Perisai Zamrud Bulat +item.npcFullWoodenShield.name=Perisai Kayu +item.npcFullStoneShield.name=Perisai Batu +item.npcFullIronShield.name=Perisai Besi +item.npcFullGoldenShield.name=Perisai Emas +item.npcFullDiaShield.name=Perisai Berlian +item.npcFullBronzeShield.name=Perisai Perunggu +item.npcFullEmeraldShield.name=Perisai Zamrud + +item.npcTowerShield.name=Perisai Tower Baja +item.npcCryscentShield.name=Perisai Cryscent Baja +item.npcScutumShield.name=Perisai Scutum Baja +item.npcHeaterShield.name=Perisai Heater Baja + +item.npcWoodenSpear.name=Tombak Kayu +item.npcStoneSpear.name=Tombak Batu +item.npcIronSpear.name=Tombak Besi +item.npcGoldenSpear.name=Tombak Emas +item.npcDiamondSpear.name=Tombak Berlian +item.npcBronzeSpear.name=Tombak Perunggu +item.npcEmeraldSpear.name=Tombak Zamrud + +item.npcWoodenBattleAxe.name=Kapak Perang Kayu +item.npcStoneBattleAxe.name=Kapak Perang Batu +item.npcIronBattleAxe.name=Kapak Perang Besi +item.npcGoldenBattleAxe.name=Kapak Perang Emas +item.npcDiamondBattleAxe.name=Kapak Perang Berlian +item.npcBronzeBattleAxe.name=Kapak Perang Perunggu +item.npcEmeraldBattleAxe.name=Kapak Perang Zamrud + +item.npcWoodenMace.name=Gada Kayu +item.npcStoneMace.name=Gada Batu +item.npcIronMace.name=Gada Besi +item.npcGoldenMace.name=Gada Emas +item.npcDiamondMace.name=Gada Berlian +item.npcBronzeMace.name=Gada Perunggu +item.npcEmeraldMace.name=Gada Zamrud + +item.npcWoodenDagger.name=Pisau Belati Kayu +item.npcStoneDagger.name=Pisau Belati Batu +item.npcIronDagger.name=Pisau Belati Besi +item.npcGoldenDagger.name=Pisau Belati Emas +item.npcDiamondDagger.name=Pisau Belati Berlian +item.npcBronzeDagger.name=Pisau Belati Perunggu +item.npcEmeraldDagger.name=Pisau Belati Zamrud +item.npcWoodenReversedDagger.name=Pisau Belati Kayu Terbalik +item.npcStoneReversedDagger.name=Pisau Belati Batu Terbalik +item.npcIronReversedDagger.name=Pisau Belati Besi Terbalik +item.npcGoldenReversedDagger.name=Pisau Belati Emas Terbalik +item.npcDiamondReversedDagger.name=Pisau Belati Berlian Terbalik +item.npcBronzeReversedDagger.name=Pisau Belati Perunggu Terbalik +item.npcEmeraldReversedDagger.name=Pisau Belati Zamrud Terbalik + +item.npcWoodenStaff.name=Tongkat Kayu +item.npcStoneStaff.name=Tongkat Batu +item.npcIronStaff.name=Tongkat Besi +item.npcGoldenStaff.name=Tongkat Emas +item.npcDiamondStaff.name=Tongkat Berlian +item.npcBronzeStaff.name=Tongkat Perunggu +item.npcEmeraldStaff.name=Tongkat Zamrud +item.npcElementalStaff.name=Tongkat Elemental + +item.npcWoodenScythe.name=Sabit Kayu +item.npcStoneScythe.name=Sabit Batu +item.npcIronScythe.name=Sabit Besi +item.npcGoldenScythe.name=Sabit Emas +item.npcBronzeScythe.name=Sabit Perunggu +item.npcDiamondScythe.name=Sabit Berlian +item.npcEmeraldScythe.name=Sabit Zamrud + +item.npcWoodenGlaive.name=Pedang Kayu +item.npcStoneGlaive.name=Pedang Batu +item.npcIronGlaive.name=Pedang Besi +item.npcGoldenGlaive.name=Pedang Emas +item.npcDiamondGlaive.name=Pedang Berlian +item.npcBronzeGlaive.name=Pedang Perunggu +item.npcEmeraldGlaive.name=Pedang Zamrud + +item.npcCowleatherHead.name=Topi Kulit Sapi +item.npcCowleatherChest.name=Baju Kulit Sapi +item.npcCowleatherLegs.name=Celana Kulit Sapi +item.npcCowleatherBoots.name=Sepatu Kulit Sapi + +item.npcNanorumHead.name=Helm Nanorum +item.npcNanorumChest.name=Baju Nanorum +item.npcNanorumLegs.name=Celana Nanorum +item.npcNanorumBoots.name=Sepatu Nanorum + +item.npcTacticalHead.name=Helm Taktis +item.npcTacticalChest.name=Rompi Taktis + +item.npcFullLeatherHead.name=Helm Kulit +item.npcFullLeatherChest.name=Baju Kulit + +item.npcFullIronHead.name=Helm Besi +item.npcFullIronChest.name=Baju Besi + +item.npcFullGoldHead.name=Helm Emas +item.npcFullGoldChest.name=Baju Emas + +item.npcFullDiamondHead.name=Helm Berlian +item.npcFullDiamondChest.name=Baju Berlian + +item.npcFullBronzeHead.name=Helm Perunggu +item.npcFullBronzeChest.name=Baju Perunggu +item.npcFullBronzeLeggings.name=Celana Perunggu +item.npcFullBronzeBoots.name=Sepatu Perunggu + +item.npcFullWoodenHead.name=Helm Kayu +item.npcFullWoodenChest.name=Baju Kayu +item.npcFullWoodenLeggings.name=Celana Kayu +item.npcFullWoodenBoots.name=Sepatu Kayu + +item.npcTuxedoChest.name=Baju Tuxedo +item.npcTuxedoPants.name=Celana Tuxedo +item.npcTuxedoBottom.name=Jas Tuxedo + +item.npcWizardHead.name=Topi Penyihir +item.npcWizardChest.name=Baju Penyihir +item.npcWizardPants.name=Celana Penyihir + +item.npcAssassinHead.name=Helm Assassin +item.npcAssassinChest.name=Baju Assassin +item.npcAssassinLeggings.name=Celana Assassin +item.npcAssassinBoots.name=Sepatu Assassin + +item.npcSoldierHead.name=Helm Tentara +item.npcSoldierChest.name=Seragam Tentara +item.npcSoldierLegs.name=Celana Tentara +item.npcSoldierBottom.name=Jas Tentara + +item.npcX407Head.name=Helm X407 Prototype +item.npcX407Chest.name=Baju X407 Prototype +item.npcX407Legs.name=Celana X407 Prototype +item.npcX407Boots.name=Sepatu X407 Prototype + +item.npcCommissarHead.name=Topi Komisaris +item.npcCommissarChest.name=Baju Komisaris +item.npcCommissarLegs.name=Celana Komisaris +item.npcCommissarBottom.name=Jas Komisaris + +item.npcInfantryHelmet.name=Helm Infantri +item.npcOfficerChest.name=Topi Petugas + +item.npcCrown.name=Mahkota +item.npcCrown2.name=Mahkota + +item.npcNinjaHead.name=Masker Ninja +item.npcNinjaChest.name=Baju Ninja +item.npcNinjaPants.name=Celana Ninja + +item.npcFullEmeraldHead.name=Helm Zamrud +item.npcFullEmeraldChest.name=Baju Zamrud +item.npcFullEmeraldLeggings.name=Celana Zamrud +item.npcFullEmeraldBoots.name=Sepatu Zamrud + +item.npcOrb.name=Orb +item.npcBrokenOrb.name=Orb Rusak +item.npcMana.name=Mana + +item.npcNinjaClaw.name=Cakar Ninja +item.npcSteelClaw.name=Cakar Baja +item.npcBearClaw.name=Cakar Beruang +item.npcKatar.name=Katar + +item.npcLetter.name=Surat +item.npcPlans.name=Rencana +item.npcSatchel.name=Tas +item.npcBag.name=Tas +item.npcCrystal.name=Kristal +item.npcSeveredEar.name=Telinga Putus +item.npcPhone.name=HandPhone +item.npcBanditMask.name=Masker Bandit +item.npcBrokenArrow.name=Panah Rusah +item.npcEarthElement.name=Elemen Tanah +item.npcWaterElement.name=Elemen Air +item.npcFireElement.name=Elemen Api +item.npcAirElement.name=Elemen Udara +item.npcCarKey.name=Kunci Mobil +item.npcKey.name=Kunci +item.npcPendant.name=Medali +item.npcBlueprint.name=Cetak Biru +item.npcRing.name=Cincin + +item.npcSkull.name=Tengkorak +item.npcBronzeIngot.name=Perunggu Batangan +item.npcSaphire.name=Permata Sapphir +item.npcAmethyst.name=Permata Amethyst +item.npcRuby.name=Permata Rubi + + diff --git a/src/main/resources/assets/customnpcs/lang/ko_KR.lang b/src/main/resources/assets/customnpcs/lang/ko_KR.lang new file mode 100644 index 000000000..64c09c92f --- /dev/null +++ b/src/main/resources/assets/customnpcs/lang/ko_KR.lang @@ -0,0 +1,796 @@ +itemGroup.cnpcs=CustomNpcs 도구 +itemGroup.cnpcsw=CustomNpcs 무기 +itemGroup.cnpcsa=CustomNpcs 갑옷 +itemGroup.cnpcsb=CustomNpcs 블럭 +itemGroup.cnpcsm=CustomNpcs 기타 + +tile.npcRedstoneBlock.name=레드스톤 블럭 +tile.npcCarpentyBench.name=목공예 작업대 +tile.npcBloodBlock.name=피 블럭 +tile.npcMailbox.name=메일함 +tile.npcLocationBlock.name=위치 퀘스트 블럭 +tile.npcBanner.name=배너 +tile.npcWallBanner.name=벽 배너 +tile.npcChair.name=의자 +tile.npcCrate.name=나무상자 +tile.npcTallLamp.name=스탠드 램프 +tile.npcWeaponRack.name=무기선반 +tile.npcCouchWool.name=양모 소파 +tile.npcTable.name=나무 테이블 +tile.npcCouchWood.name=나무 소파 +tile.npcLamp.name=램프 +tile.npcCandle.name=촛불 +tile.npcStool.name=낮은 의자 +tile.npcBorder.name=이동제한 블럭 +tile.npcBigSign.name=큰 표지판 +tile.npcBarrel.name=배럴 +tile.npcShelf.name=선반 +tile.npcSign.name=표지판 +tile.npcTombstone.name=비석 +tile.npcCampfire.name=캠프파이어 +tile.npcBeam.name=빔프레임 +tile.npcPedestal.name=칼 받침 +tile.npcPlaceholder_0.name=자리표시자 +tile.npcPlaceholder_1.name=자리표시자 +tile.npcPlaceholder_2.name=자리표시자 +tile.npcPlaceholder_3.name=자리표시자 +tile.npcPlaceholder_4.name=자리표시자 +tile.npcPlaceholder_5.name=자리표시자 +tile.npcPlaceholder_6.name=자리표시자 +tile.npcPlaceholder_7.name=자리표시자 +tile.npcPlaceholder_8.name=자리표시자 +tile.npcPlaceholder_9.name=자리표시자 +tile.npcPlaceholder_10.name=자리표시자 +tile.npcPlaceholder_11.name=자리표시자 +tile.npcPlaceholder_12.name=자리표시자 +tile.npcPlaceholder_13.name=자리표시자 +tile.npcPlaceholder_14.name=자리표시자 +tile.npcPlaceholder_15.name=자리표시자 + +gui.delete=삭제하시겠습니까? +gui.add=추가 +gui.remove=삭제 +gui.save=저장 +gui.name=이름 +gui.color=색상 +gui.none=없음 +gui.time=시간 +gui.title=제목 +gui.categories=카테고리 +gui.close=닫기 +gui.disabled=비활성화 +gui.increase=증가 +gui.decrease=감소 +gui.day=낮 +gui.night=밤 +gui.constant=일정 +gui.accelerate=가속 +gui.small=작은 +gui.medium=중간 +gui.large=큰 +gui.type=타입 +gui.retaliate=보복 +gui.panic=혼란 +gui.retreat=후퇴 +gui.nothing=무반응 +gui.break=부수다 +gui.open=열기 +gui.darkness=어둠 +gui.sunlight=햇빛 +gui.always=항상 +gui.untilclose=근접할때까지 +gui.whenavailable=이동사격 +gui.ignoreDamage=손상 무시 +gui.minrange=최소 사거리 +gui.engagedistance=인지 범위 +gui.orbitdistance=궤도 범위 +gui.fightifthisclose=전투 종료 범위 +gui.ambushdistance=매복 범위 +gui.whendistant=원거리의 경우 +gui.whenhidden=숨은 경우 +gui.currentFolder=현재 폴더 +gui.play=플레이 +gui.selectSound=소리 선택 +gui.selectnpc=Npc 선택 +gui.select=선택 +gui.range=범위 +gui.name=이름 +gui.partly=부분적 +gui.copy=복사 +gui.clear=지우기 +gui.done=완료 +gui.paste=붙여넣기 +gui.settings=설정 +gui.enabled=사용 +gui.website=웹사이트 +gui.text=텍스트 +gui.detailed=자세한 +gui.server=서버 + +remote.title=근처 NPC들 +remote.reset=초기화 +remote.tp=NPC로 이동 +remote.resetall=전체 초기화 +remote.freeze=NPC들 동결 + +spawner.entities=독립체 +spawner.clones=클론 +spawner.mobspawner=몹스포너 +spawner.mount=탑승 +spawner.mountplayer=유저 탑승 + +spawner.diesafter=소환물 사망시 사망 +spawner.posoffset=위치 오프셋 +spawner.type=스폰 유형 +spawner.all=전부 +spawner.random=랜덤 +spawner.one=차례로 +spawner.despawn=대상이 사라지면 소환물 소멸 + +mailbox.name=메일함 +mailbox.sender=보낸사람 +mailbox.read=읽기 +mailbox.timesend=%s 전에 +mailbox.day=일 +mailbox.days=일 +mailbox.hour=시간 +mailbox.hours=시간 +mailbox.minute=분 +mailbox.minutes=분 +mailbox.username=유저이름 +mailbox.subject=제목 +mailbox.send=보내기 +mailbox.write=메시지 쓰기 +mailbox.succes=%s에게 성공적으로 메일을 보냈습니다. +mailbox.errorUsername=알수없는 유저이름 +mailbox.errorSubject=제목을 입력해주십시오. +mailbox.setup=메일 설정 + + +display.model=모델 +display.show=보임 +display.hide=숨김 +display.showAttacking=공격시 보임 +display.size=크기 +display.texture=택스쳐 +display.cape=망토 +display.overlay=오버레이 +display.player=유저 +display.selectTexture=택스쳐 선택 +display.livingAnimation=생활 애니메시션 +display.visible=보임 +display.bossbar=보스체력바 + +inv.minExp=최소 경험치 +inv.maxExp=최대 경험치 +inv.npcInventory=NPC 인벤토리 +inv.inventory=인벤토리 +inv.dropChance=드랍확률 + +availability.options=가능성 설정 +availability.always=항상 +availability.after=이후 +availability.before=이전 +availability.available=유효한 +availability.whenactive=활성화 +availability.whennotactive=비활성화 +availability.selectquest=퀘스트 선택 +availability.selectdialog=대화 선택 +availability.selectfaction=파벌 선택 +availability.daytime=시간 +availability.wholeday=하루종일 +availability.night=밤에만 +availability.day=낮에만 +availability.is=맞다 +availability.isnot=아니다 +availability.minlevel=제한레벨 +availability.name=가능성 +availability.areaNotAvailble=이 길을 지나갈 수 없습니다. +availability.permission=이 작업을 수행 할 수 있는 권한이 없습니다. +availability.editIcon=10초동안 당신은 우클릭으로 아이콘을 설정할 수 있습니다. + +spawning.availableBiomes=사용가능한 바이옴 +spawning.spawningBiomes=스폰가능한 바이옴 +spawning.biomes=바이옴 +spawning.weightedChance=치우친 확률 + +role.name=역할 +role.none=역할 없음 +role.trader=상인 +role.follower=수행원 +role.bank=은행 +role.transporter=텔레포터 +role.mailman=우체부 +role.marketname=연결된 마켓 이름 + +trader.insufficient=소지품 부족 + +job.name=직업 +job.none=직업 없음 +job.bard=바드 +job.guard=가드 +job.healer=힐러 +job.bard=바드 +job.itemgiver=기부자 +job.boss=보스 +job.spawner=소환사 +job.conversation=대화 +job.chunkloader=청크 로더 + + +stats.health=체력 +stats.aggro=어그로 범위 +stats.meleeproperties=근접전투 속성 +stats.rangedproperties=원거리전투 속성 +stats.projectileproperties=발사체 유형 +stats.meleestrength=근접전투 강도 +stats.meleerange=근접공격 범위 +stats.meleespeed=근접공격 속도 +stats.accuracy=정확도(%) +stats.rangedrange=원거리 범위 +stats.burstspeed=발사 속도 +stats.mindelay=최소 딜레이 +stats.maxdelay=최대 딜레이 +stats.burstcount=연발횟수 +stats.shotcount=발사횟수 +stats.walkspeed=걷는 속도 +stats.meleeeffect=효과(s) +stats.respawn=리스폰 +stats.deadbody=시체 숨기기 +stats.fireimmune=화재 면역 +stats.candrown=익사 +stats.firesound:=소리설정 +stats.creaturetype=생명체 유형 +stats.normal=일반 +stats.undead=언데드 +stats.arthropod=절지동물 +stats.nofalldamage=낙하데미지 +stats.meleeproperties=근접옵션 +stats.rangedproperties=원거리옵션 +stats.burninsun=낮에불탐 +stats.amplify=증폭 +stats.melee=근접 +stats.regenhealth=체력리젠 +stats.combatregen=전투중 체력리젠 +stats.naturallydespawns=자연적으로 사망 + +stats.size=크기 +stats.speed=속도 +stats.glows=빛남 +stats.noglow=빛나지않음 +stats.hasgravity=중력 +stats.explosive=폭발 +stats.rangedeffect=효과 +stats.trail=흔적 유형 +stats.spin=회전 +stats.stick=관통 +stats.regular=증폭안함 +stats.amplified=증폭 + +ai.standing=제자리 +ai.wandering=걷다 +ai.movingpath=이동경로 +ai.looping=반복 +ai.backtracking=역행 +ai.enemyresponse=적발견시 +ai.door=문 상호작용 +ai.avoidwater=물을 피함 +ai.return=제자리로돌아옴 +ai.swim=수영가능 +ai.shelter=선호쉼터 +ai.leapattarget=대상에게 도약 +ai.sprint=달리기가능 +ai.clearlos=대상고정 +ai.indirect=간접사격 +ai.rangemelee=원거리공격 사용 +ai.tacticalvariant=전술 변경 +ai.cobwebAffected=거미줄 영향 +ai.movement=이동설정 + +aitactics.rush=돌진 +aitactics.stagger=회피 +aitactics.orbit=포위 +aitactics.hitandrun=치고빠지기 +aitactics.ambush=매복 +aitactics.stalk=은밀히접근 + +advanced.idlesound=생활소리 +advanced.angersound=화난소리 +advanced.hurtsound=피격소리 +advanced.deathsound=사망소리 +advanced.stepsound=걷는소리 +advanced.sounds=소리설정 +advanced.lines=대화설정 +advanced.night=밤 설정 +advanced.editingmode=편집모드 +advanced.loadday=낮 불러오기 +advanced.loadnight=밤 불러오기 +advanced.haspitch=음높이 + +faction.hostiles=적대 파벌 +faction.unfriendly=적대 +faction.neutral=중립 +faction.friendly=친밀 +faction.points=영향력 +faction.ondeath=사망시 +faction.hidden=숨겨진 +faction.default=기본 +faction.attackHostile=적대파벌 공격 +faction.defend=같은파벌 도움 +faction.nostanding=You have no standings with any faction +faction.options=파벌 옵션 +faction.increasepoints=파벌 %s 의 대한 %s 영향력 증가 +faction.decreasepoints=파벌 %s 의 대한 %s 영향력 감소 +faction.attacked=몬스터에게 공격받음 + +menu.inventory=인벤토리 +menu.display=디스플레이 +menu.stats=스탯 +menu.factions=파벌 +menu.ai=인공지능 +menu.advanced=부가기능 +menu.global=글로벌 +menu.role=역할 +menu.delete=삭제 + +follower.waiting=대기 +follower.following=동행 +follower.hire=고용 +follower.health=체력 +follower.daysleft=남은 날 +follower.lastday=마지막 날 +follower.day=일 +follower.days=일 +follower.hireText=저를 고용 주셔서 감사합니다. +follower.farewellText=당신과 함께 있어서 즐거웠어. + +transporter.travel=이동 +transporter.unlock=이동지점 [%s] 등록되었습니다. +transporter.discovered=발견후 가능 +transporter.start=처음부터 가능 +transporter.interaction=상호작용후 가능 + +quest.complete=완료 +quest.turnin=퀘스트를 다시 할 수 있습니다. +quest.start=새로운 퀘스트를 시작하였습니다. + +global.banks=은행 +global.transport=텔레포트 +global.playerdata=유저데이터 +global.recipes=제작법 +global.naturalspawn=자연스론 + +bank.slot=슬롯 +bank.unlock=잠금 해제 +bank.upgrade=확장 +bank.upgradeCosts=확장 비용 +bank.unlockCosts=잠금 해제 비용 + +conversation.delay=지연시간 +conversation.line=대화내용 + +bard.jukebox=주크박스 재생 +bard.background=배경음 재생 +bard.ondistance=음악on 거리 +bard.offdistance=음악off 거리 +bard.hasoff=음악Off거리설정 + +dialog.dialog=대화 +dialog.dialogs=대화문 +dialog.options=대화 옵션 +dialog.dialogtext=대화 텍스트 +dialog.editoption=대화 옵션 편집 +dialog.optiontype=옵션 타입 +dialog.selectoption=옵션 선택 +dialog.quitoption=옵션 종료 +dialog.option=대화 옵션 +dialog.roleoption=역할 옵션 +dialog.commandoption=커맨드 옵션 +dialog.commandoptionplayer="@dp" 를 사용하여 이용 유저를 대상으로 정합니다. + +quest.quest=퀘스트 +quest.quests=퀘스트 +quest.item=아이템 +quest.kill=처치 +quest.areakill=지역 처치 +quest.dialog=대화 +quest.location=위치 +quest.completedtext=완료 텍스트 +quest.questlogtext=퀘스트일지 텍스트 +quest.complete=완료 +quest.reward=보상 +quest.repeatable=반복 +quest.mcdaily=마크 매일 +quest.mcweekly=마크 매주 +quest.rldaily=현실 매일 +quest.rlweekly=현실 매주 +quest.instant=즉시 완료 +quest.npc=Npc에게 방문 +quest.next=다음 퀘스트 +quest.found=발견 +quest.notfound=찾을수없음 +quest.completed=퀘스트 완료 +quest.newquest=새로운 퀘스트 +quest.noquests=진행중인 퀘스트가 없습니다. +quest.completewith= %s 에게 가시오. +quest.randomitem=랜덤아이템 +quest.exp=경험치 +quest.takeitems=퀘스트템 회수 +quest.objectives=목표 + +script.init=초기화 +script.interact=상호작용 +script.update=업데이트 +script.console=콘솔 +script.language=언어 +script.damaged=데미지 +script.killed=사망 +script.attack=공격 +script.target=대상 +script.availableScripts=가능한 스크립트 +script.loadedScripts=불러온 스크립트 + +item.npcWand.name=Npc 완드 +item.npcMobCloner.name=Mob 복사기 +item.npcMovingPath.name=Npc 이동위치 +item.npcMounter.name=탑승 +item.npcTeleporter.name=텔레포트 +item.npcScripter.name=스크립터 + +item.npcBanjo.name=밴조 +item.npcViolin.name=바이올린 +item.npcViolinBow.name=바이올린 활 +item.npcHarp.name=하프 +item.npcGuitar.name=기타 +item.npcFrenchHorn.name=프렌치 호른 +item.npcOcarina.name=오카리나 +item.npcClarinet.name=클라리넷 + +item.npcCoinWooden.name=나무동전 +item.npcCoinStone.name=돌동전 +item.npcCoinBronze.name=구리동전 +item.npcCoinIron.name=철동전 +item.npcCoinGold.name=금동전 +item.npcCoinDiamond.name=다이아몬드동전 +item.npcCoinEmerald.name=에메랄드동전 + +item.npcWoodenGun.name=나무 총 +item.npcStoneGun.name=돌 총 +item.npcIronGun.name=은 총 +item.npcGoldGun.name=금 총 +item.npcDiamondGun.name=다이아몬드 총 +item.npcBronzeGun.name=브론즈 총 +item.npcEmeraldGun.name=에메랄드 총 +item.npcMachineGun.name=머신건 + +item.npcWoodenBullet.name=나무 총알 +item.npcStoneBullet.name=돌 총알 +item.npcIronBullet.name=철 총알 +item.npcGoldenBullet.name=금 총알 +item.npcDiamondBullet.name=다이아몬드 총알 +item.npcBronzeBullet.name=브론즈 총알 +item.npcEmeraldBullet.name=에메랄드 총알 +item.npcBlackBullet.name=검은 총알 + +item.npcWoodenTrident.name=나무 삼지창 +item.npcStoneTrident.name=돌 삼지창 +item.npcIronTrident.name=철 삼지창 +item.npcGoldTrident.name=금 삼지창 +item.npcDiamondTrident.name=다이아몬드 삼지창 +item.npcBronzeTrident.name=브론즈 삼지창 +item.npcEmeraldTrident.name=에메랄드 삼지창 +item.npcCursedTrident.name=저주받은 삼지창 +item.npcDemonicTrident.name=데모닉 삼지창 +item.npcFrostTrident.name=얼어붙은 삼지창 + +item.npcNatureSpell.name=자연 마법 +item.npcArcaneSpell.name=비전 마법 +item.npcLightningSpell.name=전격 마법 +item.npcIceSpell.name=빙계 마법 +item.npcFireSpell.name=화염 마법 +item.npcDarkSpell.name=암흑 마법 +item.npcHolySpell.name=신성 마법 + +item.npcKunai.name=수리검 +item.npcReverseKunai.name=리버스 수리검 +item.npcShuriken.name=표창 +item.npcGiantShuriken.name=거대한 표창 +item.npcKatana.name=카타나 +item.npcKukri.name=쿠크리 + +item.npcGolfClub.name=골프 클럽 +item.npcMagicWand.name=마술봉 +item.npcChickenSword.name=닭검 +item.npcHandCuffs.name=수갑 +item.npcHammer.name=망치 +item.npcBaseballBat.name=야구방망이 +item.npcLeadPipe.name=연관 +item.npcCleaver.name=큰 식칼 +item.npcSaber.name=사브르 +item.npcHockeyStick.name=하키 스틱 +item.npcSledgeHammer.name=큰 해머 +item.npcBrokenBottle.name=부서진 병 +item.npcCombatKnive.name=컴뱃 나이프 +item.npcLighter.name=라이터 +item.npcBatton.name=Batton +item.npcGunChainsaw.name=전기톱 총 +item.npcRapier.name=양날칼 +item.npcCrowbar.name=쇠지렛대 +item.npcPipeWrench.name=파이프 렌치 +item.npcWrench.name=렌치 +item.npcSwissArmyKnife.name=스위스 군용 나이프 +item.npcLeafBlade.name=나뭇잎 검 + +item.npcWoodenShield.name=둥근 나무 방패 +item.npcStoneShield.name=둥근 돌 방패 +item.npcIronShield.name=둥근 철 방패 +item.npcGoldenShield.name=둥근 금 방패 +item.npcDiaShield.name=둥근 다이아몬드 방패 +item.npcBronzeShield.name=둥근 브론즈 방패 +item.npcEmeraldShield.name=둥근 에메랄드 방패 +item.npcFullWoodenShield.name=나무 방패 +item.npcFullStoneShield.name=돌 방패 +item.npcFullIronShield.name=철 방패 +item.npcFullGoldenShield.name=금 방패 +item.npcFullDiaShield.name=다이아몬드 방패 +item.npcFullBronzeShield.name=브론즈 방패 +item.npcFullEmeraldShield.name=에메랄드 방패 +item.npcDemonicShield.name=데모닉 방패 +item.npcFrostShield.name=얼어붙은 방패 + +item.npcTowerShield.name=강철 타워 방패 +item.npcCryscentShield.name=강철 물결 방패 +item.npcScutumShield.name=강철 사각 방패 +item.npcHeaterShield.name=강철 기사 방패 + +item.npcWoodenSpear.name=나무 스피어 +item.npcStoneSpear.name=돌 스피어 +item.npcIronSpear.name=철 스피어 +item.npcGoldenSpear.name=금 스피어 +item.npcDiamondSpear.name=다이아몬드 스피어 +item.npcBronzeSpear.name=브론즈 스피어 +item.npcEmeraldSpear.name=에메랄드 스피어 +item.npcDemonicSpear.name=데모닉 스피어 +item.npcFrostSpear.name=얼어붙은 스피어 + +item.npcWoodenBattleAxe.name=나무 배틀액스 +item.npcStoneBattleAxe.name=돌 배틀액스 +item.npcIronBattleAxe.name=철 배틀액스 +item.npcGoldenBattleAxe.name=금 배틀액스 +item.npcDiamondBattleAxe.name=다이아몬드 배틀액스 +item.npcBronzeBattleAxe.name=브론즈 배틀액스 +item.npcEmeraldBattleAxe.name=에메랄드 배틀액스 +item.npcDemonicBattleAxe.name=데모닉 배틀액스 +item.npcFrostBattleAxe.name=얼어붙은 배틀액스 + +item.npcWoodenMace.name=나무 메이스 +item.npcStoneMace.name=돌 메이스 +item.npcIronMace.name=철 메이스 +item.npcGoldenMace.name=금 메이스 +item.npcDiamondMace.name=다이아몬드 메이스 +item.npcBronzeMace.name=브론즈 메이스 +item.npcEmeraldMace.name=에메랄드 메이스 +item.npcDemonicMace.name=데모닉 메이스 +item.npcFrostMace.name=얼어붙은 메이스 + +item.npcWoodenDagger.name=나무 대거 +item.npcStoneDagger.name=돌 대거 +item.npcIronDagger.name=철 대거 +item.npcGoldenDagger.name=금 대거 +item.npcDiamondDagger.name=다이아몬드 대거 +item.npcBronzeDagger.name=브론즈 대거 +item.npcEmeraldDagger.name=에메랄드 대거 +item.npcDemonicDagger.name=데모닉 대거 +item.npcFrostDagger.name=얼어붙은 대거 +item.npcWoodenReversedDagger.name=리버스 나무 대거 +item.npcStoneReversedDagger.name=리버스 돌 대거 +item.npcIronReversedDagger.name=리버스 철 대거 +item.npcGoldenReversedDagger.name=리버스 금 대거 +item.npcDiamondReversedDagger.name=리버스 다이아몬드 대거 +item.npcBronzeReversedDagger.name=리버스 브론즈 대거 +item.npcEmeraldReversedDagger.name=리버스 에메랄드 대거 +item.npcDemonicReversedDagger.name=리버스 데모닉 대거 +item.npcFrostReversedDagger.name=리버스 얼어붙은 대거 + +item.npcWoodenStaff.name=나무 스태프 +item.npcStoneStaff.name=돌 스태프 +item.npcIronStaff.name=철 스태프 +item.npcGoldenStaff.name=금 스태프 +item.npcDiamondStaff.name=다이아몬드 스태프 +item.npcBronzeStaff.name=브론즈 스태프 +item.npcEmeraldStaff.name=에메랄드 스태프 +item.npcElementalStaff.name=엘리멘탈 스태프 +item.npcDemonicStaff.name=데모닉 스태프 +item.npcFrostStaff.name=얼어붙은 스태프 + +item.npcWoodenScythe.name=나무 낫 +item.npcStoneScythe.name=돌 낫 +item.npcIronScythe.name=철 낫 +item.npcGoldenScythe.name=금 낫 +item.npcBronzeScythe.name=브론즈 낫 +item.npcDiamondScythe.name=다이아몬드 낫 +item.npcEmeraldScythe.name=에메랄드 낫 +item.npcDemonicScythe.name=데모닉 낫 +item.npcFrostScythe.name=얼어붙은 낫 + +item.npcWoodenWarhammer.name=나무 전쟁망치 +item.npcStoneWarhammer.name=돌 전쟁망치 +item.npcIronWarhammer.name=강철 전쟁망치 +item.npcGoldenWarhammer.name=금 전쟁망치 +item.npcDiamondWarhammer.name=다이아 전쟁망치 +item.npcBronzeWarhammer.name=브론즈 전쟁망치 +item.npcEmeraldWarhammer.name=에메랄드 전쟁망치 +item.npcCursedWarhammer.name=저주 전쟁망치 +item.npcDemonicWarhammer.name=데모닉 전쟁망치 +item.npcFrostWarhammer.name=얼어붙은 전쟁망치 + +item.npcWoodenGlaive.name=나무 양날검 +item.npcStoneGlaive.name=돌 양날검 +item.npcIronGlaive.name=철 양날검 +item.npcGoldenGlaive.name=금 양날검 +item.npcDiamondGlaive.name=다이아몬드 양날검 +item.npcBronzeGlaive.name=브론즈 양날검 +item.npcEmeraldGlaive.name=에메랄드 양날검 +item.npcDemonicGlaive.name=데모닉 양날검 +item.npcFrostGlaive.name=얼어붙은 양날검 + +item.npcCowleatherHead.name=소가죽 헬멧 +item.npcCowleatherChest.name=소가죽 갑옷 +item.npcCowleatherLegs.name=소가죽 레깅스 +item.npcCowleatherBoots.name=소가죽 신발 + +item.npcNanorumHead.name=드워프 헬멧 +item.npcNanorumChest.name=드워프 갑옷 +item.npcNanorumLegs.name=드워프 레깅스 +item.npcNanorumBoots.name=드워프 신발 + +item.npcTacticalHead.name=방탄 헬멧 +item.npcTacticalChest.name=방탄 조끼 + +item.npcFullLeatherHead.name=촘촘한 가죽 헬멧 +item.npcFullLeatherChest.name=촘촘한 가죽 갑옷 + +item.npcFullIronHead.name=촘촘한 철 헬멧 +item.npcFullIronChest.name=촘촘한 철 갑옷 + +item.npcFullGoldHead.name=촘촘한 금 헬멧 +item.npcFullGoldChest.name=촘촘한 금 갑옷 + +item.npcFullDiamondHead.name=촘촘한 다이아몬드 헬멧 +item.npcFullDiamondChest.name=촘촘한 다이아몬드 갑옷 + +item.npcFullBronzeHead.name=촘촘한 브론즈 헬멧 +item.npcFullBronzeChest.name=촘촘한 브론즈 갑옷 +item.npcFullBronzeLeggings.name=촘촘한 브론즈 레깅스 +item.npcFullBronzeBoots.name=촘촘한 브론즈 신발 + +item.npcFullWoodenHead.name=촘촘한 나무 헬멧 +item.npcFullWoodenChest.name=촘촘한 나무 갑옷 +item.npcFullWoodenLeggings.name=촘촘한 나무 레깅스 +item.npcFullWoodenBoots.name=촘촘한 나무 신발 + +item.npcTuxedoChest.name=턱시도 상의 +item.npcTuxedoPants.name=턱시도 하의 +item.npcTuxedoBottom.name=턱시도 트렌치 코트 + +item.npcWizardHead.name=마법사 모자 +item.npcWizardChest.name=마법사 상의 +item.npcWizardPants.name=마법사 레깅스 + +item.npcAssassinHead.name=어쌔신 헬멧 +item.npcAssassinChest.name=어쌔신 갑옷 +item.npcAssassinLeggings.name=어쌔신 레깅스 +item.npcAssassinBoots.name=어쌔신 신발 + +item.npcSoldierHead.name=병사 헬멧 +item.npcSoldierChest.name=병사 갑옷 +item.npcSoldierLegs.name=병사 레깅스 +item.npcSoldierBottom.name=병사 트렌치 코트 + +item.npcX407Head.name=X407 프로토타입 헬멧 +item.npcX407Chest.name=X407 프로토타입 갑옷 +item.npcX407Legs.name=X407 프로토타입 레깅스 +item.npcX407Boots.name=X407 프로토타입 신발 + +item.npcCommissarHead.name=공산당 헬멧 +item.npcCommissarChest.name=공산당 갑옷 +item.npcCommissarLegs.name=공산당 레깅스 +item.npcCommissarBottom.name=공산당 트렌치 코트 + +item.npcInfantryHelmet.name=보병 헬멧 +item.npcOfficerChest.name=장교 갑옷 + +item.npcCrown.name=금왕관 +item.npcCrown2.name=보석왕관 + +item.npcNinjaHead.name=닌자 모자 +item.npcNinjaChest.name=닌자 상의 +item.npcNinjaPants.name=닌자 레깅스 + +item.npcFullEmeraldHead.name=촘촘한 에메랄드 헬멧 +item.npcFullEmeraldChest.name=촘촘한 에메랄드 갑옷 +item.npcFullEmeraldLeggings.name=촘촘한 에메랄드 레깅스 +item.npcFullEmeraldBoots.name=촘촘한 에메랄드 신발 + +item.npcOrb.name=보주 +item.npcBrokenOrb.name=부서진 보주 +item.npcMana.name=마나 + +item.npcNinjaClaw.name=닌자 갈퀴 +item.npcSteelClaw.name=강철 갈퀴 +item.npcBearClaw.name=Bear 갈퀴 +item.npcKatar.name=카타르 + +item.npcLetter.name=편지 +item.npcPlans.name=밀서 +item.npcSatchel.name=책가방 +item.npcBag.name=가방 +item.npcCrystal.name=크리스탈 +item.npcSeveredEar.name=잘린 귀 +item.npcPhone.name=휴대폰 +item.npcBanditMask.name=강도 마스크 +item.npcBrokenArrow.name=부서진 화살 +item.npcEarthElement.name=흙 원소 +item.npcWaterElement.name=물 원소 +item.npcFireElement.name=불 원소 +item.npcAirElement.name=공기 원소 +item.npcCarKey.name=자동차 열쇠 +item.npcKey.name=열쇠 +item.npcPendant.name=팬던트 +item.npcBlueprint.name=청사진 +item.npcRing.name=반지 + +item.npcSkull.name=해골 +item.npcBronzeIngot.name=브론즈 주괴 +item.npcDemonicIngot.name=데모닉 주괴 +item.npcSaphire.name=사파이어 +item.npcAmethyst.name=자수정 +item.npcRuby.name=루비 + +item.npcMacuahuitl.name=마쿠마휘틀 +item.npcBoStaff.name=지팡이 +item.npcSaiBlade.name=사이블레이드 +item.npcCrossbow.name=석궁 +item.npcCrossBolt.name=석궁 블릿 +item.npcSlingshot.name=새총 +item.npcMusket.name=소총 +item.npcExcalibur.name=엑스칼리버 +item.npcBronzeSword.name=브론즈 검 +item.npcEmeraldSword.name=에메랄드 검 +item.npcDemonicSword.name=데모닉 검 +item.npcFrostSword.name=얼어붙은 검 + +item.npcAncientCoin.name=고대 동전 +item.npcAncientScroll.name=고대 스크롤 +item.npcArtifact.name=아티팩트 +item.npcLocket.name=목걸이 +item.npcSilk.name=실크 +item.npcStatuette.name=조각상 +item.npcTablet.name=정제 + +item.npcWoodenBroadsword.name=나무 대검 +item.npcStoneBroadsword.name=돈 대검 +item.npcIronBroadsword.name=철 대검 +item.npcGoldenBroadsword.name=금 대검 +item.npcDiamondBroadsword.name=다이아 대검 +item.npcBronzeBroadsword.name=브론즈 대검 +item.npcEmeraldBroadsword.name=에메랄드 대검 +item.npcCursedBroadsword.name=저주받은 대검 +item.npcDemonicBroadsword.name=데모닉 대검 +item.npcFrostBroadsword.name=얼어붙은 대검 + +item.npcWoodenHalberd.name=나무 할버드 +item.npcStoneHalberd.name=돈 할버드 +item.npcIronHalberd.name=철 할버드 +item.npcGoldenHalberd.name=금 할버드 +item.npcDiamondHalberd.name=다이아 할버드 +item.npcBronzeHalberd.name=브론즈 할버드 +item.npcEmeraldHalberd.name=에메랄드 할버드 +item.npcCursedHalberd.name=저주받은 할버드 +item.npcDemonicHalberd.name=데모닉 할버드 +item.npcFrostHalberd.name=얼어붙은 할버드 + +enchantment.damage=데미지 +enchantment.confusion=혼란 +enchantment.infinite=무한 +enchantment.poison=독 diff --git a/src/main/resources/assets/customnpcs/lang/nl_NL.lang b/src/main/resources/assets/customnpcs/lang/nl_NL.lang new file mode 100644 index 000000000..6756f197f --- /dev/null +++ b/src/main/resources/assets/customnpcs/lang/nl_NL.lang @@ -0,0 +1,233 @@ +tile.npcRedstoneBlock.name=Blok uit Rode Stenen +tile.npcAnvilBlock.name=Aambeeld + +item.npcWand.name=Npc Toverstaf +item.npcCloner.name=Npc Kloner +item.npcSpawner.name=Mob Spawner + +item.npcBanjo.name=Banjo +item.npcViolin.name=Viool +item.npcViolinBow.name=Strijkstok +item.npcHarp.name=Harp +item.npcGuitar.name=Gitaar + +item.npcCoinWooden.name=Houten Munt +item.npcCoinStone.name=Stenen Munt +item.npcCoinBronze.name=Bronzen Munt +item.npcCoinIron.name=Ijzeren Munt +item.npcCoinGold.name=Gouden Munt +item.npcCoinDiamond.name=Diamanten Munt +item.npcCoinEmerald.name=Smaragden Munt + +item.npcWoodenGun.name=Houten Geweer +item.npcStoneGun.name=Stenen Geweer +item.npcIronGun.name=Ijzeren Geweer +item.npcGoldGun.name=Gouden Geweer +item.npcDiamondGun.name=Diamanten Geweer +item.npcBronzeGun.name=Bronzen Geweer +item.npcEmeraldGun.name=Smaragden Geweer +item.npcMachineGun.name=Machine Geweer + +item.npcWoodenBullet.name=Houten Kogel +item.npcStoneBullet.name=Stenen Kogel +item.npcIronBullet.name=Ijzeren Kogel +item.npcGoldenBullet.name=Gouden Kogel +item.npcDiamondBullet.name=Diamanten Kogel +item.npcBronzeBullet.name=Bronzen Kogel +item.npcEmeraldBullet.name=Smaragden Kogel +item.npcBlackBullet.name=Zwarte Kogel + +item.npcWoodenTrident.name=Houten Drietand +item.npcStoneTrident.name=Stenen Drietand +item.npcIronTrident.name=Ijzeren Drietand +item.npcGoldTrident.name=Gouden Drietand +item.npcDiamondTrident.name=Diamanten Drietand +item.npcBronzeTrident.name=Bronzen Drietand +item.npcEmeraldTrident.name=Smaragden Drietand +item.npcCursedTrident.name=Vervloekte Drietand + +item.npcNatureSpell.name=Natuur Toverspreuk +item.npcArcaneSpell.name=Magische Toverspreuk +item.npcLightningSpell.name=Bliksem Toverspreuk +item.npcIceSpell.name=Ijs Toverspreuk +item.npcFireSpell.name=Vuur Toverspreuk +item.npcDarkSpell.name=Donkere Toverspreuk +item.npcHolySpell.name=Heilige Toverspreuk + +item.npcKunai.name=Kunai +item.npcReverseKunai.name=Omgekeerde Kunai +item.npcShuriken.name=Shuriken +item.npcGiantShuriken.name=Grote Shuriken +item.npcKatana.name=Katana +item.npcKukri.name=Kukri + +item.npcGolfClub.name=Golfstok +item.npcMagicWand.name=Magische Toverstaf +item.npcChickenSword.name=Zwaard der Kippen +item.npcHandCuffs.name=Handboeien +item.npcHammer.name=Hamer +item.npcBaseballBat.name=Honkballknuppel +item.npcLeadPipe.name=Loden Pijp +item.npcCleaver.name=Slagers Mes +item.npcSaber.name=Sabel +item.npcHockeyStick.name=Hockeystick +item.npcSledgeHammer.name=Slaghamer +item.npcBrokenBottle.name=Gebroken Fles +item.npcCombatKnive.name=Vechtersmes +item.npcLighter.name=Aansteker +item.npcBatton.name=Speld +item.npcGunChainsaw.name=Kettingzaag Geweer +item.npcRapier.name=Dolk +item.npcCrowbar.name=Koevoet +item.npcWrench.name=Moersleutel +item.npcSwissArmyKnife.name=Zwitsers zakmes + +item.npcWoodenShield.name=Rond Houten Schild +item.npcStoneShield.name=Rond Stenen Schild +item.npcIronShield.name=Rond Ijzeren Schild +item.npcGoldenShield.name=Rond Gouden Schild +item.npcDiaShield.name=Rond Diamanten Schild +item.npcBronzeShield.name=Rond Bronzen Schild +item.npcFullWoodenShield.name=Houten Schild +item.npcFullStoneShield.name=Stenen Schild +item.npcFullIronShield.name=Ijzeren Schild +item.npcFullGoldenShield.name=Gouden Schild +item.npcFullDiaShield.name=Diamanten Schild +item.npcFullBronzeShield.name=Bronzen Schild +item.npcTowerShield.name=Ijzeren Toren Schild +item.npcCryscentShield.name=Staal Cryscent Schild +item.npcScutumShield.name=Staal Scutum Schild +item.npcHeaterShield.name=Staal Heater Schild + +item.npcWoodenSpear.name=Houten Speer +item.npcStoneSpear.name=Stenen Speer +item.npcIronSpear.name=Ijzeren Speer +item.npcGoldenSpear.name=Gouden Speer +item.npcDiamondSpear.name=Diamanten Speer +item.npcBronzeSpear.name=Bronzen Speer +item.npcEmeraldSpear.name=Smaragden Speer + +item.npcWoodenBattleAxe.name=Houten Gevechtsbijl +item.npcStoneBattleAxe.name=Stenen Gevechtsbijl +item.npcIronBattleAxe.name=Ijzeren Gevechtsbijl +item.npcGoldenBattleAxe.name=Gouden Gevechtsbijl +item.npcDiamondBattleAxe.name=Diamanten Gevechtsbijl +item.npcBronzeBattleAxe.name=Bronzen Gevechtsbijl +item.npcEmeraldBattleAxe.name=Smaragden Gevechtsbijl + +item.npcWoodenMace.name=Houten Knots +item.npcStoneMace.name=Stenen Knots +item.npcIronMace.name=Ijzeren Knots +item.npcGoldenMace.name=Gouden Knots +item.npcDiamondMace.name=Diamanten Knots +item.npcBronzeMace.name=Bronzen Knots +item.npcEmeraldMace.name=Smaragden Knots + +item.npcWoodenDagger.name=Houten Dolk +item.npcStoneDagger.name=Stenen Dolk +item.npcIronDagger.name=Ijzeren Dolk +item.npcGoldenDagger.name=Gouden Dolk +item.npcDiamondDagger.name=Diamanten Dolk +item.npcBronzeDagger.name=Bronzen Dolk +item.npcEmeraldDagger.name=Smaragden Dolk +item.npcWoodenReversedDagger.name=Omgekeerde Houten Dolk +item.npcStoneReversedDagger.name=Omgekeerde Stenen Dolk +item.npcIronReversedDagger.name=Omgekeerde Ijzeren Dolk +item.npcGoldenReversedDagger.name=Omgekeerde Gouden Dolk +item.npcDiamondReversedDagger.name=Omgekeerde Diamanten Dolk +item.npcBronzeReversedDagger.name=Omgekeerde Bronzen Dolk +item.npcEmeraldReversedDagger.name=Omgekeerde Smaragden Dolk + +item.npcWoodenStaff.name=Houten Staf +item.npcIronStaff.name=Ijzeren Staf +item.npcGoldenStaff.name=Gouden Staf +item.npcDiamondStaff.name=Diamanten Staf +item.npcElementalStaff.name=Staf der Elementen + +item.npcWoodenScythe.name=Houten Zeis +item.npcStoneScythe.name=Stenen Zeis +item.npcIronScythe.name=Ijzeren Zeis +item.npcGoldenScythe.name=Gouden Zeis +item.npcDiamondScythe.name=Diamanten Zeis +item.npcEmeraldScythe.name=Smaragden Zeis + +item.npcWoodenGlaive.name=Houten Lans +item.npcStoneGlaive.name=Stenen Lans +item.npcIronGlaive.name=Ijzeren Lans +item.npcGoldenGlaive.name=Gouden Lans +item.npcDiamondGlaive.name=Diamanten Lans +item.npcBronzeGlaive.name=Bronzen Lans +item.npcEmeraldGlaive.name=Smaragden Lans + +item.npcCowleatherHead.name=Koeienlere Helm +item.npcCowleatherChest.name=Koeienlere Borstbescherming +item.npcCowleatherLegs.name=Koeienlere Broek +item.npcCowleatherBoots.name=Koeienlere Schoenen + +item.npcNanorumHead.name=Nanorum Helm +item.npcNanorumChest.name=Nanorum Borstbescherming +item.npcNanorumLegs.name=Nanorum Broek +item.npcNanorumBoots.name=Nanorum Schoenen + +item.npcTacticalHead.name=Tactische Helm +item.npcTacticalChest.name=Tactische Vest + +item.npcFullIronHead.name=Volledig Leren Helm +item.npcFullIronChest.name=Volledig Leren Borstbescherming + +item.npcFullIronHead.name=Volledig Ijzeren Helm +item.npcFullIronChest.name=Volledig Ijzeren Borstbescherming + +item.npcFullGoldHead.name=Volledig Gouden Helm +item.npcFullGoldChest.name=Volledig Gouden Borstbescherming + +item.npcFullDiamondHead.name=Volledig Diamanten Helm +item.npcFullDiamondChest.name=Volledig Diamanten Borstbescherming + +item.npcFullBronzeHead.name=Volledig Bronzen Helm +item.npcFullBronzeChest.name=Volledig Bronzen Borstbescherming +item.npcFullBronzeLeggings.name=Volledig Bronzen Broek +item.npcFullBronzeBoots.name=Volledig Bronzen Schoenen + +item.npcFullWoodenHead.name=Volledig Houten Helm +item.npcFullWoodenChest.name=Volledig Houten Borstbescherming +item.npcFullWoodenLeggings.name=Volledig Houten Broek +item.npcFullWoodenBoots.name=Volledig Houten Schoenen + +item.npcTuxedoChest.name=Schique Vest +item.npcTuxedoPants.name=Schique Broek +item.npcTuxedoBottom.name=Schique Trenchcoat + +item.npcWizardHead.name=Tovenaars Hoed +item.npcWizardChest.name=Tovenaars Borst +item.npcWizardPants.name=Tovenaars Broek + +item.npcAssassinHead.name=Huurmoordenaars Helm +item.npcAssassinChest.name=Huurmoordenaars Borstpantser +item.npcAssassinLeggings.name=Huurmoordenaars Broek +item.npcAssassinBoots.name=Huurmoordenaars Schoenen + +item.npcSoldierHead.name=Soldaaten Helm +item.npcSoldierChest.name=Soldaaten Borstbescherming +item.npcSoldierLegs.name=Soldaaten Broek +item.npcSoldierBottom.name=Soldaaten Trenchcoat + +item.npcX407Head.name=X407 Prototype Helm +item.npcX407Chest.name=X407 Prototype Borstpantser +item.npcX407Legs.name=X407 Prototype Broek +item.npcX407Boots.name=X407 Prototype Schoenen + +item.npcCommissarHead.name=Commissaris Helm +item.npcCommissarChest.name=Commissaris Borstpantser +item.npcCommissarLegs.name=Commissaris Broek +item.npcCommissarBottom.name=Commissaris Trenchcoat + +item.npcInfantryHelmet.name=Infanterie Helm +item.npcOfficerChest.name=Officier Borstpantser + +item.npcCrown.name=Kroon +item.npcCrown2.name=Kroon + +item.npcNinjaHead.name=Ninja Helm +item.npcNinjaChest.name=Ninja Borst +item.npcNinjaPants.name=Ninja Broek \ No newline at end of file diff --git a/src/main/resources/assets/customnpcs/lang/pl_PL.lang b/src/main/resources/assets/customnpcs/lang/pl_PL.lang new file mode 100644 index 000000000..2721d5fc4 --- /dev/null +++ b/src/main/resources/assets/customnpcs/lang/pl_PL.lang @@ -0,0 +1,498 @@ +itemGroup.cnpcs=Narzędzia Custom NPC's +itemGroup.cnpcsw=Bronie Custom NPC's +itemGroup.cnpcsa=Zbroje Custom NPC's +itemGroup.cnpcsm=Różne przedmioty Custom NPC's + +tile.npcRedstoneBlock.name=Blok NPC +tile.npcCarpentyBench.name=Ławka stolarska +tile.npcBloodBlock.name=Blok Krwi + +gui.deleteConfirm=Czy jesteś pewien, że chcesz usunąć tego npc? +gui.add=Dodaj +gui.remove=Usuń +gui.edit=Edytuj +gui.name=Nazwa +gui.color=Kolor +gui.none=Nic +gui.time=Czas +gui.title=Tytuł +gui.categories=Kategorie +gui.close=Zamknij +gui.disabled=Wyłaczone +gui.increase=Zwiększ +gui.decrease=Zmniejsz +gui.day=Dzień +gui.night=Noc +gui.constant=Stałe +gui.accelerate=Przyspiesz +gui.small=Małe +gui.medium=Średnie +gui.large=Duże +gui.type=Typ +gui.always=Zawsze +gui.untilclose=Gdy cel dalej niż +gui.ignoreDamage=Ignoruj obrażenia + +display.model=Model +display.show=Pokaż +display.hide=Schowaj +display.showAttacking=Pokazuj gdy walczy +display.size=Rozmiar +display.texture=Tekstura +display.textureCape=Tekstura peleryny +display.player=Gracz +display.selectTexture=Wybierz teksture +display.livingAnimation=Animacja życia +display.tint=Odcień tekstury + +inv.minExp=Min Exp +inv.maxExp=Max Exp +inv.npcInventory=Inwentarz npc +inv.inventory=Inwentarz +inv.dropChance=Szansa upuszczenia + +availability.options=Opcje dostępności +availability.always=Zawsze +availability.after=Po +availability.before=Przed +availability.available=Dostępne +availability.whenactive=Kiedy aktywne +availability.whennotactive=Kiedy nieaktywne +availability.selectquest=Wybierz zadanie +availability.selectdialog=Wybierz dialog +availability.selectfaction=Wybierz frakcje +availability.daytime=Pora dnia +availability.wholeday=Cały dzień +availability.night=W nocy +availability.day=W dzień +availability.is=Jest +availability.isnot=Nie jest + +stats.health=Zdrowie +stats.aggro=Zasięg agresji +stats.meleeproperties=Ustawienia walki wręcz +stats.rangedproperties=Ustawienia walki dystansowej +stats.projectileproperties=Opcje pocisku +stats.meleestrength=Siła walki wręcz +stats.meleerange=Zasięg walki wręcz +stats.meleespeed=Szybkość walki wręcz +stats.accuracy=Celność(%) +stats.rangedrange=Zasięg walki dystans. +stats.burstspeed=Tempo strzelania +stats.firedelay=Przerwa między stzał. +stats.delayvariance=Rozbieżność przerwy +stats.burstcount=Rozproszenie +stats.walkspeed=Szybkość chodzenia +stats.chargespeed=Szybkość pocisku +stats.meleeeffect=Efekty(s) +stats.respawn=Respawn +stats.deadbody=Chowaj zwłoki +stats.fireimmune=Odporny na ogień +stats.candrown=Może utonąć +stats.firesound:=DźwiękFX +stats.creaturetype=Typ potwora +stats.normal=Normalny +stats.undead=Nieumarły +stats.arthropod=Stawonóg +stats.nofalldamage=Brak obrażeń upadku +stats.meleeproperties=Opcje walki wręcz +stats.rangedproperties=Opcje walki dystans. +stats.burninsun=Płonie w słońcu +stats.amplify=Wzmocniony + +stats.size=Rozmiar +stats.speed=Szybkość +stats.glows=Świeci +stats.hasgravity=Grawitacja +stats.explosive=Wybucha +stats.rangedeffect=Efekt +stats.trail=Typ śladów +stats.spin=Obraca się +stats.stick=Wbija się +stats.regular=No Amp +stats.amplified=Amp + +ai.standing=Stacjonarny +ai.wandering=Wędrujący +ai.movingpath=Poruszający się ścieżką +ai.looping=Pętla +ai.backtracking=Powrót + +ai.enemyresponse:=Gdy widzi wroga +ai.door:=Interakcja z drzw. +ai.avoidwater:=Unika wody +ai.return:=Powraca do spawnu +ai.swim:=Może pływać +ai.shelter:=Szuka schronienia +ai.leapattarget:=Skacze do celu +ai.clearlos:=Musi widzieć cel +ai.indirect:=Może strzelać niebezpośrednio +ai.rangemelee:=Używaj ataku dyst. + +faction.hostiles=Wrogie Frakcje +faction.unfriendly=Nieprzyjazny +faction.neutral=Neutralny +faction.friendly=Przyjazny +faction.points=Punkty +faction.ondeath=Przy śmierci +faction.hidden=Schowane +faction.default=Domyślne +faction.attackHostile=Atakuj wrogie frakcje +faction.defend=Broń członków frakcji +faction.nostanding=Nie masz żadnych stosunków z żadnymi frakcjami +faction.options=Opcje frakcji +faction.increasepoints=Stosunek frakcji "%s" powiększono o %s punkty/ów +faction.decreasepoints=Stosunek frakcji "%s" zmniejszono o %s punkty/ów + +menu.inventory=Inwentarz +menu.quests=Zadania +menu.display=Wyświetlanie +menu.stats=Statystyki +menu.factions=Frakcje +menu.ai=SI +menu.advanced=Zaawansowane +menu.global=Globalne +menu.delete=Usuń +menu.role=Rola + +global.banks=Banki +global.factions=Frakcje +global.dialogs=Dialogi +global.quests=Zadania +global.transport=Transport +global.playerdata=Dane Gracza +global.recipes=Receptury + +bank.slot=Miejsce +bank.unlock=Otwórz +bank.upgrade=Ulepsz +bank.upgradeCosts=Koszt ulepszenia +bank.unlockCosts=Koszt otwarcia + +follower.waiting=Czekaj +follower.following=Podążaj +follower.hire=Wynajmij +follower.health=Punkty Życia +follower.daysleft=Pozostałe dni +follower.lastday=Ostatni dzień +follower.day=dzień +follower.days=dni +follower.hireText=Dziękuje za wynajęcie mnie na +follower.farewellText=To koniec czasu wynajmu. Żegnaj + +transporter.travel=Podróżuj +transporter.unlock1=Podróż do +transporter.unlock2=została odblokowana! + +dialog.dialog=Dialog +dialog.dialogs=Dialogi +dialog.options=Opcje dialogu +dialog.dialogtext=Treść dialogu +dialog.editoption=Edytuj opcje dialogu +dialog.optiontype=Typ opcji + +quest.quest=Zadanie +quest.quests=Zadania +quest.item=Przedmioty zadania +quest.kill=Zabójstwa zadania +quest.dialog=Dialogi zadania +quest.completedtext=Tekst przy zakończeniu +quest.questlogtext=Tekst przy przyjęciu +quest.complete=Zakończone +quest.turnin=Możesz teraz zakończyć zadanie +quest.start=Przyjęto nowe zadanie +quest.reward=Nagroda +quest.repeatable=Powtarzalne +quest.daily=Codziennie +quest.weekly=Co tydzień +quest.instant=Zakończenie natychmiastowe +quest.npc=Zakończenie przy rozmowie z npc + +item.npcWand.name=Różdżka NPC +item.npcCloner.name=Duplikator NPC +item.npcSpawner.name=Spawner Mobów +item.npcMovingPath.name=Ścieżkowiec NPC + +item.npcBanjo.name=Banjo +item.npcViolin.name=Skrzypce +item.npcViolinBow.name=Skrzypek +item.npcHarp.name=Harfa +item.npcGuitar.name=Gitara + +item.npcCoinWooden.name=Drewniana Moneta +item.npcCoinStone.name=Kamienna Moneta +item.npcCoinBronze.name=Bronzowa Moneta +item.npcCoinIron.name=Żelazna Moneta +item.npcCoinGold.name=Złota Moneta +item.npcCoinDiamond.name=Diamentowa Moneta +item.npcCoinEmerald.name=Szmaragdowa Moneta + +item.npcWoodenGun.name=Drewniany Pistolet +item.npcStoneGun.name=Kamienny Pistolet +item.npcIronGun.name=Żelazny Pistolet +item.npcGoldGun.name=Złoty Pistolet +item.npcDiamondGun.name=Diamentowy Pistolet +item.npcBronzeGun.name=Bronzowy Pistolet +item.npcEmeraldGun.name=Szmaragdowy Pistolet +item.npcMachineGun.name=Karabin Maszynowy + +item.npcWoodenBullet.name=Drewniany Pocisk +item.npcStoneBullet.name=Kamienny Pocisk +item.npcIronBullet.name=Żelazny Pocisk +item.npcGoldenBullet.name=Złoty Pocisk +item.npcDiamondBullet.name=Diamentowy Pocisk +item.npcBronzeBullet.name=Bronzowy Pocisk +item.npcEmeraldBullet.name=Szmaragdowy Pocisk +item.npcBlackBullet.name=Czarny Pocisk + +item.npcWoodenTrident.name=Drewniany Trójząb +item.npcStoneTrident.name=Kamienny Trójząb +item.npcIronTrident.name=Żelazny Trójząb +item.npcGoldTrident.name=Złoty Trójząb +item.npcDiamondTrident.name=Diamentowy Trójząb +item.npcBronzeTrident.name=Bronzowy Trójząb +item.npcEmeraldTrident.name=Szmaragdowy Trójząb +item.npcCursedTrident.name=Przeklęty Trójząb + +item.npcNatureSpell.name=Zaklęcie Natury +item.npcArcaneSpell.name=Zaklęcie Tajemniczości +item.npcLightningSpell.name=Zaklęcie Piorunów +item.npcIceSpell.name=Zaklęcie Lodu +item.npcFireSpell.name=Zaklęcie Ognia +item.npcDarkSpell.name=Zaklęcie Mroku +item.npcHolySpell.name=Zaklęcie Świętości + +item.npcKunai.name=Kunai +item.npcReverseKunai.name=Odwrócone Kunai +item.npcShuriken.name=Shuriken +item.npcGiantShuriken.name=Ogromny Shuriken +item.npcKatana.name=Katana +item.npcKukri.name=Kukri + +item.npcGolfClub.name=Kij Golfowy +item.npcMagicWand.name=Magiczna Różdżka +item.npcChickenSword.name=Kurczakowy Miecz +item.npcHandCuffs.name=Kajdanki +item.npcHammer.name=Młotek +item.npcBaseballBat.name=Kij Baseballowy +item.npcLeadPipe.name=Rurka Leadera +item.npcCleaver.name=Skalper +item.npcSaber.name=Szabla +item.npcHockeyStick.name=Kij do Hockeya +item.npcSledgeHammer.name=Młot +item.npcBrokenBottle.name=Stłuczona Butelka +item.npcCombatKnive.name=Nóż Bojowy +item.npcLighter.name=Zapalniczka +item.npcBatton.name=Kij +item.npcGunChainsaw.name=Piła Mechaniczna +item.npcRapier.name=Rapier +item.npcCrowbar.name=Łom +item.npcPipeWrench.name=Klucz do Rur +item.npcWrench.name=Klucz +item.npcSwissArmyKnife.name=Scyzoryk + +item.npcWoodenShield.name=Okrągła Drewniana Tarcza +item.npcStoneShield.name=Okrągła Kamienna Tarcza +item.npcIronShield.name=Okrągła Żelazna Tarcza +item.npcGoldenShield.name=Okrągła Złota Tarcza +item.npcDiaShield.name=Okrągła Diamentowa Tarcza +item.npcBronzeShield.name=Okrągła Bronzowa Tarcza +item.npcEmeraldShield.name=Okrągła Szmaragdowa Tarcza +item.npcFullWoodenShield.name=Drewniana Tarcza +item.npcFullStoneShield.name=Kamienna Tarcza +item.npcFullIronShield.name=Żelazna Tarcza +item.npcFullGoldenShield.name=Złota Tarcza +item.npcFullDiaShield.name=Diamentowa Tarcza +item.npcFullBronzeShield.name=Bronzowa Tarcza +item.npcFullEmeraldShield.name=Szmaragdowa Tarcza + +item.npcTowerShield.name=Stalowa Tarcza Tower +item.npcCryscentShield.name=Stalowa Tarcza Cryscent +item.npcScutumShield.name=Stalowa Tarcza Scutum +item.npcHeaterShield.name=Stalowa Tarcza Heater + +item.npcWoodenSpear.name=Drewniana Włócznia +item.npcStoneSpear.name=Kamienna Włócznia +item.npcIronSpear.name=Żelazna Włócznia +item.npcGoldenSpear.name=Złota Włócznia +item.npcDiamondSpear.name=Diamentowa Włócznia +item.npcBronzeSpear.name=Bronzowa Włócznia +item.npcEmeraldSpear.name=Szmaragdowa Włócznia + +item.npcWoodenBattleAxe.name=Drewniany Topór Wojenny +item.npcStoneBattleAxe.name=Kamienny Topór Wojenny +item.npcIronBattleAxe.name=Żelazny Topór Wojenny +item.npcGoldenBattleAxe.name=Złoty Topór Wojenny +item.npcDiamondBattleAxe.name=Diamentowy Topór Wojenny +item.npcBronzeBattleAxe.name=Bronzowy Topór Wojenny +item.npcEmeraldBattleAxe.name=Szmaragdowy Topór Wojenny + +item.npcWoodenMace.name=Drewniana Buława +item.npcStoneMace.name=Kamienna Buława +item.npcIronMace.name=Żelazna Buława +item.npcGoldenMace.name=Złota Buława +item.npcDiamondMace.name=Diamentowa Buława +item.npcBronzeMace.name=Bronzowa Buława +item.npcEmeraldMace.name=Szmaragdowa Buława + +item.npcWoodenDagger.name=Drewniany Sztylet +item.npcStoneDagger.name=Kamienny Sztylet +item.npcIronDagger.name=Żelazny Sztylet +item.npcGoldenDagger.name=Złoty Sztylet +item.npcDiamondDagger.name=Diamentowy Sztylet +item.npcBronzeDagger.name=Bronzowy Sztylet +item.npcEmeraldDagger.name=Szmaragdowy Sztylet +item.npcWoodenReversedDagger.name=Odwrócony Drewniany Sztylet +item.npcStoneReversedDagger.name=Odwrócony Kamienny Sztylet +item.npcIronReversedDagger.name=Odwrócony Żelazny Sztylet +item.npcGoldenReversedDagger.name=Odwrócony Złoty Sztylet +item.npcDiamondReversedDagger.name=Odwrócony Diamentowy Sztylet +item.npcBronzeReversedDagger.name=Odwrócony Bronzowy Sztylet +item.npcEmeraldReversedDagger.name=Odwrócony Szmaragdowy Sztylet + +item.npcWoodenStaff.name=Drewniana Laska +item.npcStoneStaff.name=Kamienna Laska +item.npcIronStaff.name=Żelazna Laska +item.npcGoldenStaff.name=Złota Laska +item.npcDiamondStaff.name=Diamentowa Laska +item.npcBronzeStaff.name=Bronzowa Laska +item.npcEmeraldStaff.name=Szmaragdowa Laska +item.npcElementalStaff.name=Żywiołowa Laska + +item.npcWoodenScythe.name=Drewniana Kosa +item.npcStoneScythe.name=Kamienna Kosa +item.npcIronScythe.name=Żelazna Kosa +item.npcGoldenScythe.name=Złota Kosa +item.npcBronzeScythe.name=Bronzowa Kosa +item.npcDiamondScythe.name=Diamentowa Kosa +item.npcEmeraldScythe.name=Szmaragdowa Kosa + +item.npcWoodenGlaive.name=Drewniany Dwustronny Kij +item.npcStoneGlaive.name=Kamienny Dwustronny Kij +item.npcIronGlaive.name=Żelazny Dwustronny Kij +item.npcGoldenGlaive.name=Złoty Dwustronny Kij +item.npcDiamondGlaive.name=Diamentowy Dwustronny Kij +item.npcBronzeGlaive.name=Bronzowy Dwustronny Kij +item.npcEmeraldGlaive.name=Szmaragdowy Dwustronny Kij + +item.npcCowleatherHead.name=Czapka Krowiej Skóry +item.npcCowleatherChest.name=Tunika Krowiej Skóry +item.npcCowleatherLegs.name=Spodnie Krowiej Skóry +item.npcCowleatherBoots.name=Buty Krowiej Skóry + +item.npcNanorumHead.name=Hełm Nanorum +item.npcNanorumChest.name=Napierśnik Nanorum +item.npcNanorumLegs.name=Nogawice Nanorum +item.npcNanorumBoots.name=Buty Nanorum + +item.npcTacticalHead.name=Taktyczny Hełm +item.npcTacticalChest.name=Taktyczna Kamizelka + +item.npcFullLeatherHead.name=Pełna Skórzana Czapka +item.npcFullLeatherChest.name=Pełna Skórzana Tunika + +item.npcFullIronHead.name=Pełny Żelazny Hełm +item.npcFullIronChest.name=Pełny Żelazny Napierśnik + +item.npcFullGoldHead.name=Pełny Złoty Hełm +item.npcFullGoldChest.name=Pełny Złoty Napierśnik + +item.npcFullDiamondHead.name=Pełny Diamentowy Hełm +item.npcFullDiamondChest.name=Pełny Diamentowy Napierśnik + +item.npcFullBronzeHead.name=Pełny Bronzowy Hełm +item.npcFullBronzeChest.name=Pełny Bronzowy Napierśnik +item.npcFullBronzeLeggings.name=Pełne Bronzowe Nogawice +item.npcFullBronzeBoots.name=Pełne Bronzowe Buty + +item.npcFullWoodenHead.name=Pełny Drewniany Hełm +item.npcFullWoodenChest.name=Pełny Drewniany Napierśnik +item.npcFullWoodenLeggings.name=Pełne Drewniane Nogawice +item.npcFullWoodenBoots.name=Pełne Drewniane Buty + +item.npcTuxedoChest.name=Smoking +item.npcTuxedoPants.name=Spodnie Smokingu +item.npcTuxedoBottom.name=Trencz Smokingu + +item.npcWizardHead.name=Czapka Czarodzieja +item.npcWizardChest.name=Gors Czarodzieja +item.npcWizardPants.name=Nogawice Czarodzieja + +item.npcAssassinHead.name=Kaptur Zabójcy +item.npcAssassinChest.name=Koszula Zabójcy +item.npcAssassinLeggings.name=Spodnie Zabójcy +item.npcAssassinBoots.name=Buty Zabójcy + +item.npcSoldierHead.name=Hełm Żołnierza +item.npcSoldierChest.name=Napierśnik Żołnierza +item.npcSoldierLegs.name=Nogawice Żołnierza +item.npcSoldierBottom.name=Trencz Żołnierza + +item.npcX407Head.name=Hełm Skafandru X407 +item.npcX407Chest.name=Napierśnik Skafandru X407 +item.npcX407Legs.name=Nogawice Skafandru X407 +item.npcX407Boots.name=Buty Skafandru X407 + +item.npcCommissarHead.name=Czapka Komisarza +item.npcCommissarChest.name=Płaszcz Komisarza +item.npcCommissarLegs.name=Spodnie Komisarza +item.npcCommissarBottom.name=Trencz Komisarza + +item.npcInfantryHelmet.name=Hełm Piechoty +item.npcOfficerChest.name=Napierśnik Oficera + +item.npcCrown.name=Korona +item.npcCrown2.name=Korona + +item.npcNinjaHead.name=Czapka Ninja +item.npcNinjaChest.name=Koszula Ninja +item.npcNinjaPants.name=Spodnie Ninja + +item.npcFullEmeraldHead.name=Pełny Szmaragdowy Hełm +item.npcFullEmeraldChest.name=Pełny Szmaragdowy Napierśnik +item.npcFullEmeraldLeggings.name=Pełne Szmaragdowe Nogawice +item.npcFullEmeraldBoots.name=Pełne Szmaragdowe Buty + +item.npcOrb.name=Orb +item.npcBrokenOrb.name=Uszkodzony Orb +item.npcMana.name=Mana + +item.npcNinjaClaw.name=Pazury Ninja +item.npcSteelClaw.name=Stalowe Pazury +item.npcBearClaw.name=Niedźwiedzie Pazury +item.npcKatar.name=Katar + +item.npcLetter.name=List +item.npcPlans.name=Plany +item.npcSatchel.name=Sakiewka +item.npcBag.name=Torba +item.npcCrystal.name=Kryształ +item.npcSeveredEar.name=Severed Ear +item.npcPhone.name=Telefon +item.npcBanditMask.name=Maska Bandyty +item.npcBrokenArrow.name=Złamana Strzała +item.npcEarthElement.name=Earth Element +item.npcWaterElement.name=Water Element +item.npcFireElement.name=Fire Element +item.npcAirElement.name=Air Element +item.npcCarKey.name=Kluczyk Samochodowy +item.npcKey.name=Klucz +item.npcKey2.name=Klucz +item.npcPendant.name=Wisiorek +item.npcBlueprint.name=Schemat +item.npcRing.name=Pierścień + +item.npcSkull.name=Czaszka +item.npcBronzeIngot.name=Sztabka bronzu +item.npcSaphire.name=Szafir +item.npcAmethyst.name=Ametyst +item.npcRuby.name=Rubin + +item.npcMacuahuitl.name=Macuahuitl +item.npcBoStaff.name=Różdzka Ro +item.npcSaiBlade.name=Ostrze Sai +item.npcCrossbow.name=Kusza +item.npcCrossBolt.name=Strzałki do kuszy +item.npcSlingshot.name=Proca +item.npcMusket.name=Muszkiet +item.npcExcalibur.name=Excalibur \ No newline at end of file diff --git a/src/main/resources/assets/customnpcs/lang/pt_BR.lang b/src/main/resources/assets/customnpcs/lang/pt_BR.lang new file mode 100644 index 000000000..c8f4d9a7c --- /dev/null +++ b/src/main/resources/assets/customnpcs/lang/pt_BR.lang @@ -0,0 +1,498 @@ +itemGroup.cnpcs=CustomNpcs Ferramentas +itemGroup.cnpcsw=CustomNpcs Armas +itemGroup.cnpcsa=CustomNpcs Armaduras +itemGroup.cnpcsm=CustomNpcs Diversos + +tile.npcRedstoneBlock.name=Bloco de Redstone +tile.npcCarpentyBench.name=Mesa de Carpintaria +tile.npcBloodBlock.name=Bloco de Sangue + +gui.deleteConfirm=Tem certeza que quer deletar este npc? +gui.add=Adicionar +gui.remove=Remover +gui.edit=Editar +gui.name=Nome +gui.color=Cor +gui.none=Nenhum +gui.time=Tempo +gui.title=Título +gui.categories=Categorias +gui.close=Fechar +gui.disabled=Desativado +gui.increase=Aumentar +gui.decrease=Diminuir +gui.day=Dia +gui.night=Noite +gui.constant=Constante +gui.accelerate=Acelerar +gui.small=Pequeno +gui.medium=Médio +gui.large=Grqande +gui.type=Tipo +gui.always=Sempre +gui.untilclose=AtéFechar +gui.ignoreDamage=Ignorar dano + +display.model=Modelo +display.show=Mostrar +display.hide=Esconder +display.showAttacking=Mostrar quando atacar +display.size= Tamanho +display.texture=Textura +display.textureCape=Textura Capa +display.player=Jogador +display.selectTexture=Escolher Textura +display.livingAnimation=Tem animação de vida +display.tint=Cor da tinta + +inv.minExp=Exp Min +inv.maxExp=Exp Max +inv.npcInventory=Inventário NPC +inv.inventory=Inventário +inv.dropChance=Chance de Cair + +availability.options=Opções de Disponibilidade +availability.always=Sempre +availability.after=Depois +availability.before=Antes +availability.available=Disponível +availability.whenactive=Enquando Ativo +availability.whennotactive=Enquanto Não Ativa +availability.selectquest=Selecionar Missão +availability.selectdialog=Selecionar Diálogo +availability.selectfaction=Selecionar Facção +availability.daytime=De Dia +availability.wholeday=Dia Inteiro +availability.night=Durante a Noite +availability.day=Durante o Dia +availability.is=É +availability.isnot=Não é + +stats.health=Saúde +stats.aggro=Distância de Ira +stats.meleeproperties=Propriedades Perto +stats.rangedproperties=Propriedades Longe +stats.projectileproperties=Tipo De Projétil +stats.meleestrength=Força de Perto +stats.meleerange=Alcance Perto +stats.meleespeed=Veloc. de Perto +stats.accuracy=Precisão(%) +stats.rangedrange=Alcance Longe +stats.burstspeed=Veloc. Rajada +stats.firedelay=Atraso de Fogo +stats.delayvariance=VariaçãoAtraso +stats.burstcount=Quant. Rajada +stats.walkspeed=Veloc. do Andar +stats.chargespeed=Veloc.Correndo +stats.meleeeffect=Efeito(s) +stats.respawn=Renascer +stats.deadbody=Esconder Corpo Morto +stats.fireimmune=Imune à Fogo +stats.candrown=Pode Afogar +stats.firesound:=SomFX +stats.creaturetype=Tipo de Criatura +stats.normal=Normal +stats.undead=Morto-Vivo +stats.arthropod=Artrópode +stats.nofalldamage=SemDanoQueda +stats.meleeproperties=Opções de Perto +stats.rangedproperties=Opções de Longe +stats.burninsun=Queima no Sol +stats.amplify=Amplificado + +stats.size=Tamanho +stats.speed=Velocidade +stats.glows=Brilha +stats.hasgravity=Gravidade +stats.explosive=Explode +stats.rangedeffect=Efeito +stats.trail=TipoTrajeto +stats.spin=Girar +stats.stick=Vara +stats.regular=Sem Amp +stats.amplified=Amp + +ai.standing=Em Pé +ai.wandering=Ambulante +ai.movingpath=Seguindo Trajeto +ai.looping=Andando em Círculos +ai.backtracking=Voltando + +ai.enemyresponse:=Ao ver Inimigo +ai.door:=ReaçãoPortas +ai.avoidwater:=Evita Água +ai.return:=Volta ao Começo +ai.swim:=Pode Nadar +ai.shelter:=ProcurarAbrigo +ai.leapattarget:=Pular no Alvo +ai.clearlos:=Deve ver Alvo +ai.indirect:=PodeDispararIndireto +ai.rangemelee:=Usa ataque de Longe + +faction.hostiles=Facções Hostis +faction.unfriendly=Inamigável +faction.neutral=Neutra +faction.friendly=Amigável +faction.points=Pontos +faction.ondeath=Na morte +faction.hidden=Escondida +faction.default=Padrão +faction.attackHostile=Ataca facções hostis +faction.defend=Defende membros da facção +faction.nostanding=Você não está em nenhuma facção +faction.options=Opções de Facções +faction.increasepoints=Facção %s melhorada em %s pontos +faction.decreasepoints=Facção %s piorada em %s pontos + +menu.inventory=Inventário +menu.quests=Missões +menu.display=Exibição +menu.stats=Estát. +menu.factions=Facções +menu.ai=Inteligência +menu.advanced=Avançado +menu.global=Global +menu.delete=Deletar +menu.role=Função + +global.banks=Bancos +global.factions=Facções +global.dialogs=Diálogos +global.quests=Missões +global.transport=Transporte +global.playerdata=Dados do Jogador +global.recipes=Receita + +bank.slot=Abertura +bank.unlock=Destravar +bank.upgrade=Melhorar +bank.upgradeCosts=Custo da Melhoria +bank.unlockCosts=Custo do Desbloq. + +follower.waiting=Esperando +follower.following=Seguindo +follower.hire=Contratar +follower.health=Saúde +follower.daysleft=Dias restantes +follower.lastday=Último dia +follower.day=Dia +follower.days=Dias +follower.hireText=Obrigado por me contratar por +follower.farewellText=Meus dias com você acabaram. Adeus. + +transporter.travel=Viagem +transporter.unlock1=Transporte para +transporter.unlock2=está desbloqueado agora + +dialog.dialog=Diálogo +dialog.dialogs=Diálogos +dialog.options=Opções de Diálogo +dialog.dialogtext=Texto de Diálogo +dialog.editoption=Editar Opção de Diálogo +dialog.optiontype=Tipo de Opção + +quest.quest=Missão +quest.quests=Missões +quest.item=Missão de Item +quest.kill=Missão de Matar +quest.dialog=Missão de Diálogo +quest.completedtext=Texto Completo +quest.questlogtext=Diário de Missão +quest.complete=Completa +quest.turnin=Você agora pode entregar a missão +quest.start=Nova missão iniciada +quest.reward=Recompensa +quest.repeatable=Repetível +quest.daily=Diária +quest.weekly=Semanal +quest.instant=Completa Imediata +quest.npc=Complete pelo NPC + +item.npcWand.name=Varinha Npc +item.npcCloner.name=Clonador Npc +item.npcSpawner.name=Gerador de Monstros +item.npcMovingPath.name=Guardador Npc + +item.npcBanjo.name=Banjo +item.npcViolin.name=Violino +item.npcViolinBow.name=Arco de Violino +item.npcHarp.name=Harpa +item.npcGuitar.name=Violão + +item.npcCoinWooden.name=Moeda de Madeira +item.npcCoinStone.name=Moeda de Pedra +item.npcCoinBronze.name=Moeda de Bronze +item.npcCoinIron.name=Moeda de Ferro +item.npcCoinGold.name=Moeda de Ouro +item.npcCoinDiamond.name=Moeda de Diamante +item.npcCoinEmerald.name=Moeda de Esmeralda + +item.npcWoodenGun.name=Arma de Madeira +item.npcStoneGun.name=Arma de Pedra +item.npcIronGun.name=Arma de Ferro +item.npcGoldGun.name=Arma de Ouro +item.npcDiamondGun.name=Arma de Diamante +item.npcBronzeGun.name=Arma de Bronze +item.npcEmeraldGun.name=Arma de Esmeralda +item.npcMachineGun.name=Metraladora + +item.npcWoodenBullet.name=Bala de Madeira +item.npcStoneBullet.name=Bala de Pedra +item.npcIronBullet.name=Bala de Ferro +item.npcGoldenBullet.name=Bala de Ouro +item.npcDiamondBullet.name=Bala de Diamante +item.npcBronzeBullet.name=Bala de Bronze +item.npcEmeraldBullet.name=Bala de Esmeralda +item.npcBlackBullet.name=Bala Negra + +item.npcWoodenTrident.name=Tridente de Madeira +item.npcStoneTrident.name=Tridente de Pedra +item.npcIronTrident.name=Tridente de Ferro +item.npcGoldTrident.name=Tridente de Ouro +item.npcDiamondTrident.name=Tridente de Diamante +item.npcBronzeTrident.name=Tridente de Bronze +item.npcEmeraldTrident.name=Tridente de Esmeralda +item.npcCursedTrident.name=Tridente Amaldiçoado + +item.npcNatureSpell.name=Magia da Natureza +item.npcArcaneSpell.name=Magia Misteriosa +item.npcLightningSpell.name=Magia do Raio +item.npcIceSpell.name=Magia de Gelo +item.npcFireSpell.name=Magia de Fogo +item.npcDarkSpell.name=Magia Negra +item.npcHolySpell.name=Magia Sagrada + +item.npcKunai.name=Kunai +item.npcReverseKunai.name=Kunai Revertida +item.npcShuriken.name=Shuriken +item.npcGiantShuriken.name=Shuriken Gigante +item.npcKatana.name=Katana +item.npcKukri.name=Kukri + +item.npcGolfClub.name=Taco de Golfe +item.npcMagicWand.name=Varinha Mágica +item.npcChickenSword.name=Espada de Galinha +item.npcHandCuffs.name=Algemas +item.npcHammer.name=Martelo +item.npcBaseballBat.name=Taco de Basebol +item.npcLeadPipe.name=Cano +item.npcCleaver.name=Cutelo +item.npcSaber.name=Sabre +item.npcHockeyStick.name=Taco de Hóquei +item.npcSledgeHammer.name=Marreta +item.npcBrokenBottle.name=Garrafa Quebrada +item.npcCombatKnive.name=Faca de Combate +item.npcLighter.name=Binga +item.npcBatton.name=Bastão +item.npcGunChainsaw.name=Arma-Motoserra +item.npcRapier.name=Espadim +item.npcCrowbar.name=Pé-de-Cabra +item.npcPipeWrench.name=Chave de Tubos +item.npcWrench.name=Chave Inglesa +item.npcSwissArmyKnife.name=Canivete Suíço + +item.npcWoodenShield.name=Escudo Redondo de Madeira +item.npcStoneShield.name=Escudo Redondo de Pedra +item.npcIronShield.name=Escudo Redondo de Ferro +item.npcGoldenShield.name=Escudo Redondo de Ouro +item.npcDiaShield.name=Escudo Redondo de Diamante +item.npcBronzeShield.name=Escudo Redondo de Bronze +item.npcEmeraldShield.name=Escudo Redondo de Esmeralda +item.npcFullWoodenShield.name=Escudo de Madeira +item.npcFullStoneShield.name=Escudo de Pedra +item.npcFullIronShield.name=Escudo de Ferro +item.npcFullGoldenShield.name=Escudo de Ouro +item.npcFullDiaShield.name=Escudo de Diamante +item.npcFullBronzeShield.name=Escudo de Bronze +item.npcFullEmeraldShield.name=Escudo de Esmeralda + +item.npcTowerShield.name=Escudo de Defesa de Aço +item.npcCryscentShield.name=Grande Escudo de Aço +item.npcScutumShield.name=Escudete de Aço +item.npcHeaterShield.name=Escudo de Aço Aquecedor + +item.npcWoodenSpear.name=Wooden Spear +item.npcStoneSpear.name=Stone Spear +item.npcIronSpear.name=Iron Spear +item.npcGoldenSpear.name=Golden Spear +item.npcDiamondSpear.name=Diamond Spear +item.npcBronzeSpear.name=Bronze Spear +item.npcEmeraldSpear.name=Emerald Spear + +item.npcWoodenBattleAxe.name=Machado de Batalha de Madeira +item.npcStoneBattleAxe.name=Machado de Batalha de Pedra +item.npcIronBattleAxe.name=Machado de Batalha de Ferro +item.npcGoldenBattleAxe.name=Machado de Batalha de Ouro +item.npcDiamondBattleAxe.name=Machado de Batalha de Diamante +item.npcBronzeBattleAxe.name=Machado de Batalha de Bronze +item.npcEmeraldBattleAxe.name=Machado de Batalha de Esmeralda + +item.npcWoodenMace.name=Clava de Madeira +item.npcStoneMace.name=Clava de Pedra +item.npcIronMace.name=Clava de Ferro +item.npcGoldenMace.name=Clava de Ouro +item.npcDiamondMace.name=Clava de Diamante +item.npcBronzeMace.name=Clava de Bronze +item.npcEmeraldMace.name=Clava de Esmeralda + +item.npcWoodenDagger.name=Adaga de Madeira +item.npcStoneDagger.name=Adaga de Pedra +item.npcIronDagger.name=Adaga de Ferro +item.npcGoldenDagger.name=Adaga de Ouro +item.npcDiamondDagger.name=Adaga de Diamante +item.npcBronzeDagger.name=Adaga de Bronze +item.npcEmeraldDagger.name=Adaga de Esmeralda +item.npcWoodenReversedDagger.name=Adaga de Madeira Revertida +item.npcStoneReversedDagger.name=Adaga de Pedra Revertida +item.npcIronReversedDagger.name=Adaga de Ferro Revertida +item.npcGoldenReversedDagger.name=Adaga de Ouro Revertida +item.npcDiamondReversedDagger.name=Adaga de Diamante Revertida +item.npcBronzeReversedDagger.name=Adaga de Bronze Revertida +item.npcEmeraldReversedDagger.name=Adaga de Esmeralda Revertida + +item.npcWoodenStaff.name=Báculo de Madeira +item.npcStoneStaff.name=Báculo de Pedra +item.npcIronStaff.name=Báculo de Ferro +item.npcGoldenStaff.name=Báculo de Ouro +item.npcDiamondStaff.name=Báculo de Diamante +item.npcBronzeStaff.name=Báculo de Bronze +item.npcEmeraldStaff.name=Báculo de Esmeralda +item.npcElementalStaff.name=Báculo Elementar + +item.npcWoodenScythe.name=Foice de Madeira +item.npcStoneScythe.name=Foice de Pedra +item.npcIronScythe.name=Foice de Ferro +item.npcGoldenScythe.name=Foice de Ouro +item.npcBronzeScythe.name=Foice de Bronze +item.npcDiamondScythe.name=Foice de Diamante +item.npcEmeraldScythe.name=Foice de Esmeralda + +item.npcWoodenGlaive.name=Arco Plano de Madeira +item.npcStoneGlaive.name=Arco Plano de Pedra +item.npcIronGlaive.name=Arco Plano de Ferro +item.npcGoldenGlaive.name=Arco Plano de Ouro +item.npcDiamondGlaive.name=Arco Plano de Diamante +item.npcBronzeGlaive.name=Arco Plano de Bronze +item.npcEmeraldGlaive.name=Arco Plano de Esmeralda + +item.npcCowleatherHead.name=Elmo de Couro de Vaca +item.npcCowleatherChest.name=Peitoral de Couro de Vaca +item.npcCowleatherLegs.name=Calça de Couro de Vaca +item.npcCowleatherBoots.name=Botas de Couro de Vaca + +item.npcNanorumHead.name=Elmo Nanorum +item.npcNanorumChest.name=Peitoral Nanorum +item.npcNanorumLegs.name=Calças Nanorum +item.npcNanorumBoots.name=Botas Nanorum + +item.npcTacticalHead.name=Capacete Tático +item.npcTacticalChest.name=Colete Tático + +item.npcFullLeatherHead.name=Elmo Completo de Couro +item.npcFullLeatherChest.name=Peitoral Completo de Couro + +item.npcFullIronHead.name=Elmo Completo de Ferro +item.npcFullIronChest.name=Peitoral Completo de Ferro + +item.npcFullGoldHead.name=Elmo Completo de Ouro +item.npcFullGoldChest.name=Peitoral Completo de Ouro + +item.npcFullDiamondHead.name=Elmo Completo de Diamante +item.npcFullDiamondChest.name=Peitoral Completo de Diamante + +item.npcFullBronzeHead.name=Elmo Completo de Bronze +item.npcFullBronzeChest.name=Peitoral Completo de Bronze +item.npcFullBronzeLeggings.name=Calças Reforçadas de Bronze +item.npcFullBronzeBoots.name=Botas Reforçadas de Bronze + +item.npcFullWoodenHead.name=Elmo Completo de Madeira +item.npcFullWoodenChest.name=Peitoral Completo de Madeira +item.npcFullWoodenLeggings.name=Calças Reforçadas de Madeira +item.npcFullWoodenBoots.name=Botas Reforçadas de Madeira + +item.npcTuxedoChest.name=Roupa de Smoking +item.npcTuxedoPants.name=Calças de Smoking +item.npcTuxedoBottom.name=Revestimento de Smoking + +item.npcWizardHead.name=Capuz de Bruxo +item.npcWizardChest.name=Roupa de Bruxo +item.npcWizardPants.name=Calça de Bruxo + +item.npcAssassinHead.name=Capuz de Assassino +item.npcAssassinChest.name=Roupas de Assassino +item.npcAssassinLeggings.name=Calças de Assassino +item.npcAssassinBoots.name=Botas de Assassino + +item.npcSoldierHead.name=Capacete de Soldado +item.npcSoldierChest.name=Peitoral de Soldado +item.npcSoldierLegs.name=Calça de Soldado +item.npcSoldierBottom.name=Revestimento de Soldado + +item.npcX407Head.name=Capacete do Protótipo X407 +item.npcX407Chest.name=Peitoral do Protótipo X407 +item.npcX407Legs.name=Calças do Protótipo X407 +item.npcX407Boots.name=Botas do Protótipo X407 + +item.npcCommissarHead.name=Boina de Comissário +item.npcCommissarChest.name=Terno de Comissário +item.npcCommissarLegs.name=Calças de Comissário +item.npcCommissarBottom.name=Rvestimento de Comissário + +item.npcInfantryHelmet.name=Capacete de Infantaria +item.npcOfficerChest.name=Colete de Oficial + +item.npcCrown.name=Coroa +item.npcCrown2.name=Coroa + +item.npcNinjaHead.name=Máscara de Ninja +item.npcNinjaChest.name=Roupas de Ninja +item.npcNinjaPants.name=Calças de Ninja + +item.npcFullEmeraldHead.name=Elmo Completo de Esmeralda +item.npcFullEmeraldChest.name=Peitoral Completo de Esmeralda +Commissar Trenchcoatitem.npcFullEmeraldLeggings.name=Calças Reforçadas de Esmeralda +item.npcFullEmeraldBoots.name=Botas Reforçadas de Esmeralda + +item.npcOrb.name=Esfera +item.npcBrokenOrb.name=Esfera Quebrada +item.npcMana.name=Mana + +item.npcNinjaClaw.name=Garra Ninja +item.npcSteelClaw.name=Garra de Aço +item.npcBearClaw.name=Garra de Urso +item.npcKatar.name=Katar + +item.npcLetter.name=Carta +item.npcPlans.name=Planos +item.npcSatchel.name=Sacola +item.npcBag.name=Mochila +item.npcCrystal.name=Cristal +item.npcSeveredEar.name=Orelha Decepada +item.npcPhone.name=Celular +item.npcBanditMask.name=Máscara de Bandido +item.npcBrokenArrow.name=Flecha Quebrada +item.npcEarthElement.name=Elemento de Terra +item.npcWaterElement.name=Elemento de Água +item.npcFireElement.name=Elemento de Fogo +item.npcAirElement.name=Elemento de Ar +item.npcCarKey.name=Chave do Carro +item.npcKey.name=Chave +item.npcKey2.name=Chave +item.npcPendant.name=Pingente +item.npcBlueprint.name=Diagrama +item.npcRing.name=Anel + +item.npcSkull.name=Caveira +item.npcBronzeIngot.name=Barra de Bronze +item.npcSaphire.name=Safira +item.npcAmethyst.name=Ametista +item.npcRuby.name=Rubi + +item.npcMacuahuitl.name=Macuahuitl +item.npcBoStaff.name=Bastão Bo +item.npcSaiBlade.name=Lâmina Sai +item.npcCrossbow.name=Besta +item.npcCrossBolt.name=Flecha de Besta +item.npcSlingshot.name=Estilingue +item.npcMusket.name=Mosquete +item.npcExcalibur.name=Excalibur \ No newline at end of file diff --git a/src/main/resources/assets/customnpcs/lang/ru_RU.lang b/src/main/resources/assets/customnpcs/lang/ru_RU.lang new file mode 100644 index 000000000..d00b62f4f --- /dev/null +++ b/src/main/resources/assets/customnpcs/lang/ru_RU.lang @@ -0,0 +1,803 @@ +customnpcs.defaultTextColor=404040 + +entity.CustomNpc.name=Custom Npc + +itemGroup.cnpcs=CustomNpcs Инструменты +itemGroup.cnpcsw=CustomNpcs Оружие +itemGroup.cnpcsa=CustomNpcs Броня +itemGroup.cnpcsb=CustomNpcs Блоки +itemGroup.cnpcsm=CustomNpcs Разное + +tile.npcRedstoneBlock.name=Редстоун Блок +tile.npcCarpentyBench.name=Верстак Плотника +tile.npcBloodBlock.name=Блок Крови +tile.npcMailbox.name=Почтовый Ящик +tile.npcLocationBlock.name=Локационный Квестовый Блок +tile.npcBanner.name=Баннер +tile.npcWallBanner.name=Стена Баннер +tile.npcChair.name=Стул +tile.npcCrate.name=Ящик +tile.npcTallLamp.name=Высокая Лампа +tile.npcWeaponRack.name=Оружейная Стойка +tile.npcCouchWool.name=Шерстяной Диван +tile.npcTable.name=Деревянный Стол +tile.npcCouchWood.name=Деревянный Диван +tile.npcLamp.name=Лампа +tile.npcCandle.name=Свеча +tile.npcStool.name=Стул +tile.npcBorder.name=Граница +tile.npcBigSign.name=Большой Знак +tile.npcBarrel.name=Бочка +tile.npcShelf.name=Полка +tile.npcSign.name=Знак +tile.npcTombstone.name=Надгробная Плита +tile.npcCampfire.name=Костёр +tile.npcBeam.name=Луч +tile.npcPedestal.name=Пьедестал +tile.npcPlaceholder_0.name=Заполнитель +tile.npcPlaceholder_1.name=Заполнитель +tile.npcPlaceholder_2.name=Заполнитель +tile.npcPlaceholder_3.name=Заполнитель +tile.npcPlaceholder_4.name=Заполнитель +tile.npcPlaceholder_5.name=Заполнитель +tile.npcPlaceholder_6.name=Заполнитель +tile.npcPlaceholder_7.name=Заполнитель +tile.npcPlaceholder_8.name=Заполнитель +tile.npcPlaceholder_9.name=Заполнитель +tile.npcPlaceholder_10.name=Заполнитель +tile.npcPlaceholder_11.name=Заполнитель +tile.npcPlaceholder_12.name=Заполнитель +tile.npcPlaceholder_13.name=Заполнитель +tile.npcPlaceholder_14.name=Заполнитель +tile.npcPlaceholder_15.name=Заполнитель + +gui.deleteConfirm=Вы точно хотите удалить этого NPC? +gui.add=Добавить +gui.remove=Удалить +gui.save=Сохранить +gui.name=Имя +gui.color=Цвет +gui.none=Нет +gui.time=Время +gui.title=Название +gui.categories=Категории +gui.close=Закрыть +gui.disabled=Отключить +gui.increase=Увеличить +gui.decrease=Уменьшить +gui.day=День +gui.night=Ночь +gui.constant=Постоянный +gui.accelerate=Ускоренный +gui.small=Маленький +gui.medium=Средний +gui.large=Большой +gui.type=Тип +gui.retaliate=Месть +gui.panic=Паника +gui.retreat=Отступать +gui.nothing=Ничего +gui.break=Ломает +gui.open=Открывает +gui.darkness=Ночью +gui.sunlight=Днем +gui.always=Всегда +gui.untilclose=До закрытия +gui.whenavailable=Движение +gui.ignoreDamage=Игнорировать Урон +gui.minrange=Минимальная Дальность +gui.engagedistance=Дистанция атаки +gui.orbitdistance=Радиус +gui.fightifthisclose=Агрессия при приближении +gui.ambushdistance=Дистанция Засады +gui.whendistant=Когда Растояние +gui.whenhidden=Когда Скрытый +gui.currentFolder=Текущая Папка +gui.play=Играть +gui.selectSound=Выбрать Звуки +gui.selectnpc=Выбор NPC +gui.select=Выбор +gui.range=Растояние +gui.name=Имя +gui.partly=Частично +gui.copy=Копировать +gui.clear=Очистить +gui.done=Готово +gui.paste=Вставить +gui.settings=Настройки +gui.enabled=Включено +gui.website=Веб-сайт +gui.text=Текст +gui.detailed=Детали +gui.server=Сервер + +remote.title=Соседние NPCs +remote.reset=Пересоздать +remote.tp=Телепортироваться к +remote.resetall=Пересоздать всех +remote.freeze=Заморозить + +spawner.entities=Объект +spawner.clones=Клоны +spawner.mobspawner=Спавнер Мобов +spawner.mount=Прикрепится к +spawner.mountplayer=Крепление игрока + +mailbox.name=Почтовый Ящик +mailbox.sender=Отправитель +mailbox.read=Читать +mailbox.timesend=%s назад +mailbox.day=День +mailbox.days=Дни +mailbox.hour=Час +mailbox.hours=Часы +mailbox.minute=Минута +mailbox.minutes=Минуты +mailbox.username=Никнейм +mailbox.subject=Тема +mailbox.send=Отправить +mailbox.write=Написать Письмо +mailbox.succes=Удачно отправлено %s +mailbox.errorUsername=Неизветный Никнейм +mailbox.errorSubject=Поле темы не можеть быть пустым! +mailbox.setup=Установить письмо + +display.model=Модель +display.show=Показывать +display.hide=Спрятать +display.showAttacking=Показывать когда аттакован +display.size=Размер +display.texture=Текстура +display.cape=Текстура плаща +display.overlay=Наложение текстур +display.player=Игрок +display.selectTexture=Выбрать Текстуру +display.livingAnimation=Имеет живую анимацию +display.visible=Видимый +display.bossbar=Босс жизни + +inv.minExp=Мин. Опыта +inv.maxExp=Макс. опыта +inv.npcInventory=NPC Инвентарь +inv.inventory=Инвентарь +inv.dropChance=Шанс падения + +availability.options=Условия Диалога +availability.always=Всегда +availability.after=После +availability.before=Перед +availability.available=Доступно +availability.whenactive=Когда активен +availability.whennotactive=Когда пассивен +availability.selectquest=Выбрать Квест +availability.selectdialog=Выбрать Диалог +availability.selectfaction=Выбрать Фракцию +availability.daytime=День +availability.wholeday=Сутки +availability.night=Во Время ночи +availability.day=Во Время Дня +availability.is=Есть +availability.isnot=Не есть +availability.minlevel=Опыт Уровень +availability.name=Наличие +availability.areaNotAvailble=Вы не можете идти туда +availability.permission=У вас недостаточно прав для этого +availability.editIcon=В течение следующих 10 секунд вы можете установить любой значок щелкнув ПКМ + +spawning.availableBiomes=Доступные Биомы +spawning.spawningBiomes=Биомы Спавна +spawning.biomes=Биомы +spawning.weightedChance=Шанс Спавна + +role.name=Роль +role.none=Нет Роли +role.trader=Продавец +role.follower=Последователь +role.bank=Банк +role.transporter=Траспортер +role.mailman=Почтальон +role.marketname=Соответствующее Рыночное название + +trader.insufficient=Недостаточно валюты + +job.name=Работа +job.none=Нет Работы +job.bard=Бард +job.guard=Страж +job.healer=Целитель +job.bard=Бард +job.itemgiver=Раздатчик ресурсов +job.boss=Босс +job.spawner=Спавнер +job.conversation=Разговорщик +job.chunkloader=Носильщик + +spawner.dies=Умирает после спавна +spawner.posoffset=Смещение положения +spawner.type=Вид Спавна +spawner.all=Всё +spawner.random=Рандом +spawner.one=Поодиночке + +stats.health=Здоровье +stats.aggro=Агро Радиус +stats.meleeproperties=В близи +stats.rangedproperties=Дальняя атака +stats.projectileproperties=Пропорции +stats.meleestrength=Сила +stats.meleerange=Дальность +stats.meleespeed=Скорость +stats.accuracy=Точность(%) +stats.rangedrange=Дальность +stats.burstspeed=Задержка Огня +stats.mindelay=Минимальная Задержка +stats.maxdelay=Максимальная Задержка +stats.burstcount=Количество Взрывов +stats.shotcount=Количество Выстрелов +stats.walkspeed=Скорость Ходьбы +stats.meleeeffect=Еффект(s) +stats.respawn=Респавн +stats.deadbody=Скрыть Труп +stats.fireimmune=Иммунитет к Огню +stats.candrown=Может плавать +stats.firesound:=МузыкаFX +stats.creaturetype=Тип существа +stats.normal=Нормальный +stats.undead=Нежить +stats.arthropod=Членистоногий +stats.nofalldamage=Урон от Падения +stats.meleeproperties=Рукопашная +stats.rangedproperties=Дальнобойная +stats.burninsun=Горит на Солнце +stats.amplify=Усиление +stats.melee=Рукопашная +stats.regenhealth=Реген. Здоровья +stats.combatregen=Реген. в Бою +stats.naturallydespawns=Естевственное исчезание + +stats.size=Разм. +stats.speed=Скорость +stats.glows=Горит +stats.noglow=Не Горит +stats.hasgravity=Имеет Гравитацию +stats.explosive=Взрывается +stats.rangedeffect=Эффект +stats.trail=Тип +stats.spin=Крутится +stats.stick=Палки +stats.regular=Не Усилен +stats.amplified=Усилен + +ai.standing=Стоит +ai.wandering=Бродит +ai.movingpath=Отмеченный Путь +ai.looping=Петля +ai.backtracking=Патруль +ai.enemyresponse=Если найдет врага +ai.door=Дверь +ai.avoidwater=Избегает воды +ai.return=Вернутся на место +ai.swim=Может Плавать +ai.shelter=Искать убежище +ai.leapattarget=Прыжок на цель +ai.sprint=Может бегать +ai.clearlos=Обяз. Видеть цели +ai.indirect=Может Стрелять +ai.rangemelee=Дальняя атака +ai.tacticalvariant=Такт. Вариант +ai.cobwebAffected=Потерпевшие +ai.movement=Движение + +aitactics.rush=Бег +aitactics.stagger=Уворот +aitactics.orbit=Окружить +aitactics.hitandrun=Ударить и бежать +aitactics.ambush=Засада +aitactics.stalk=Подкрадываться + +advanced.idlesound=Живой звук +advanced.angersound=Злой Звук +advanced.hurtsound=Звук боли +advanced.deathsound=Звук смерти +advanced.stepsound=Звук шагов +advanced.sounds=Звуки +advanced.lines=Роль +advanced.night=Ночь +advanced.editingmode=Изменить +advanced.loadday=Загрузите День +advanced.loadnight=Загрузите Ночь +advanced.haspitch=Имеет поле + +faction.hostiles=Враждебные Фракции +faction.unfriendly=Недружелюбные +faction.neutral=Нейтральные +faction.friendly=Дружелюбны +faction.points=Очки +faction.ondeath=После смерти +faction.hidden=Скрытый +faction.default=По умолчанию +faction.attackHostile=Атаковать Враждебные Фракции +faction.nostanding=У Вас нет отношений ни с одной Фракцией +faction.options=Настройки Фракций +faction.increasepoints=Отношение с %s увеличилось на %s очков +faction.decreasepoints=Отношение с %s уменьшилось на %s очков +faction.attacked=Могут быть атакованы мобом + +menu.inventory=Инвентарь +menu.display=Задания +menu.stats=Характеристики +menu.factions=Фракции +menu.ai=ИИ +menu.advanced=Продвинутые +menu.global=Глобальные +menu.role=Роли + +global.banks=Банки +global.transport=Транспортеры +global.playerdata=Данные игроков +global.recipes=Рецепты +global.naturalspawn=Естевственные спавны + +bank.slot=Слот +bank.unlock=Открыть +bank.upgrade=Улучшить +bank.upgradeCosts=Стоитмость улучшения +bank.unlockCosts=Стоимость открытия + +follower.waiting=Ждать +follower.following=Следовать +follower.hire=Нанять +follower.health=Здоровье +follower.daysleft=Дней осталось +follower.lastday=Прошло дней +follower.day=День +follower.days=Дней +follower.hireText=Спасибо что наняли меня +follower.farewellText=Срок Договора Истек.Прощай! + +transporter.travel=Путешествие +transporter.unlock=Транспортировка к %s сейчас заблокирована +transporter.discovered=Доступно если обнаружено +transporter.start=Доступно с самого начала +transporter.interaction=Доступно после взаимодействия + +conversation.delay=Задержка +conversation.line=Реплики + +bard.jukebox=Музыкальный автомат +bard.background=Играть вокруг +bard.ondistance=На расстоянии +bard.offdistance=Расстояние выключения +bard.hasoff=Выключение на растоянии + +dialog.dialog=Диалог +dialog.dialogs=Диалоги +dialog.options=Опции Диалога +dialog.dialogtext=Текст Диалога +dialog.editoption=Изменить Настройки Диалога +dialog.optiontype=Тип опции +dialog.selectoption=Выбрать Опцию +dialog.quitoption=Опция выхода +dialog.option=Опции Диалога +dialog.roleoption=Опция Роли +dialog.commandoption=Опция Комманд +dialog.commandoptionplayer=Используйте "@dp" для целевого проигрывания этого + +quest.quest=Задание +quest.quests=Задания +quest.item=Задание на вещь +quest.kill=Задание на убийство +quest.areakill=Зона убийства +quest.dialog=Задание на диалог +quest.location=Локация +quest.completedtext=Завершения Текста +quest.questlogtext=Текст Квеста +quest.complete=Завершить +quest.reward=Награда +quest.repeatable=Повторяется +quest.mcdaily=Ежедневное +quest.mcweekly=Еженедельное +quest.rldaily=RL День +quest.rlweekly=RL Неделя +quest.instant=Мгновенное завершение +quest.npc=Завершенно npc +quest.next=Следующее Задание +quest.found=Найдено +quest.notfound=Не найдено +quest.completed=Задание Завершено +quest.newquest=Новое Задание +quest.noquests=У вас нет активных заданий +quest.completewith=Завершенно вместе с %s +quest.randomitem=Случайный предмет +quest.exp=Опыт +quest.takeitems=Выдать предмет +quest.objectives=Цель + +script.init=Init +script.interact=Инициализация +script.update=Обновление +script.console=Консоль +script.language=Язык +script.damaged=Поврежденный +script.killed=Убит +script.attack=Атака +script.target=Цель +script.availableScripts=Доступные сценарии +script.loadedScripts=Загруженные сценарит + +item.npcWand.name=Настройщик NPC +item.npcMobCloner.name=Клонер NPC +item.npcMovingPath.name=Путевод NPC +item.npcMounter.name=Спаунер NPC +item.npcTeleporter.name=Телепортер +item.npcScripter.name=Сценарист + +item.npcBanjo.name=Банжо +item.npcViolin.name=Скрипка +item.npcViolinBow.name=Смычок +item.npcHarp.name=Арфа +item.npcGuitar.name=Гитара +item.npcFrenchHorn.name=Валторна +item.npcOcarina.name=Окарина +item.npcClarinet.name=Кларнет + +item.npcCoinWooden.name=Деревянная Монета +item.npcCoinStone.name=Каменная Монета +item.npcCoinBronze.name=Бронзовая Монета +item.npcCoinIron.name=Железная Монета +item.npcCoinGold.name=Золотая Монета +item.npcCoinDiamond.name=Алмазная Монета +item.npcCoinEmerald.name=Изумрудная Монета + +item.npcWoodenGun.name=Деревянный Пистолет +item.npcStoneGun.name=Каменный Пистолет +item.npcIronGun.name=Железный Пистолет +item.npcGoldGun.name=Золотой Пистолет +item.npcDiamondGun.name=Алмазный Пистолет +item.npcBronzeGun.name=Бронзовый Пистолет +item.npcEmeraldGun.name=Изумрудный Пистолет +item.npcMachineGun.name=Автомат + +item.npcWoodenBullet.name=Деревянная Пуля +item.npcStoneBullet.name=Каменная Пуля +item.npcIronBullet.name=Железная Пуля +item.npcGoldenBullet.name=Золотая Пуля +item.npcDiamondBullet.name=Алмазная Пуля +item.npcBronzeBullet.name=Бронзовая Пуля +item.npcEmeraldBullet.name=Изумрудная Пуля +item.npcBlackBullet.name=Чёрная Пуля + +item.npcWoodenTrident.name=Деревянный Трезубец +item.npcStoneTrident.name=Каменный Трезубец +item.npcIronTrident.name=Железный Трезубец +item.npcGoldTrident.name=Золотой Трезуебц +item.npcDiamondTrident.name=Алмазный Трезубец +item.npcBronzeTrident.name=Бронзовый Трезубец +item.npcEmeraldTrident.name=Изумрудный Трезубец +item.npcCursedTrident.name=Проклятый Трезубец +item.npcDemonicTrident.name=Демонический Трезубец +item.npcFrostTrident.name=Ледяной Трезубец + +item.npcNatureSpell.name=Природное Заклинание +item.npcArcaneSpell.name=Тайное Заклинание +item.npcLightningSpell.name=Заклинание Молнии +item.npcIceSpell.name=Ледяное Заклинание +item.npcFireSpell.name=Огненное Заклинание +item.npcDarkSpell.name=Тёмное Заклинание +item.npcHolySpell.name=Святое Заклинание + +item.npcKunai.name=Кунай +item.npcReverseKunai.name=Оратный Кунай +item.npcShuriken.name=Сюрикен +item.npcGiantShuriken.name=Гигантский Сюрикен +item.npcKatana.name=Катана +item.npcKukri.name=Кукри + +item.npcGolfClub.name=Клюшка для гольфа +item.npcMagicWand.name=Волшебная Палочка +item.npcChickenSword.name=Цыпленок-мечь +item.npcHandCuffs.name=Наручники +item.npcHammer.name=Молот +item.npcBaseballBat.name=Бейсбольная Бита +item.npcLeadPipe.name=Ведущий трубы +item.npcCleaver.name=Топор Мясника +item.npcSaber.name=Сабля +item.npcHockeyStick.name=Хоккейная Клюшка +item.npcSledgeHammer.name=Кувалда +item.npcBrokenBottle.name=Разбитая Бутылка +item.npcCombatKnive.name=Конбинированый клинок +item.npcLighter.name=Зажигалка +item.npcBatton.name=Баттон +item.npcGunChainsaw.name=Автомат-Бензопила +item.npcRapier.name=Рапира +item.npcCrowbar.name=Лом +item.npcPipeWrench.name=Ключь для труб +item.npcWrench.name=Гаечный ключ +item.npcSwissArmyKnife.name=Швейцарский Армейский Нож +item.npcLeafBlade.name=Листовая пластинка + +item.npcWoodenShield.name=Круглый Деревянный Щит +item.npcStoneShield.name=Круглый Каменный Щит +item.npcIronShield.name=Круглый Железный Щит +item.npcGoldenShield.name=Круглый Золотой Щит +item.npcDiaShield.name=Круглый Алмазный Щит +item.npcBronzeShield.name=Круглый Бронзовый Щит +item.npcEmeraldShield.name=Круглый Изумрудный Щит +item.npcDemonicShield.name=Демонический Щит +item.npcFrostShield.name=Ледяной Щит +item.npcFullWoodenShield.name=Деревянный Щит +item.npcFullStoneShield.name=Каменный Щит +item.npcFullIronShield.name=Железный Щит +item.npcFullGoldenShield.name=Золотой Щит +item.npcFullDiaShield.name=Алмазный Щит +item.npcFullBronzeShield.name=Бронзовый Щит +item.npcFullEmeraldShield.name=Изумрудный Щит + +item.npcTowerShield.name=Стальной Щит "Башня" +item.npcCryscentShield.name=Стальной Щит "Полумесяц" +item.npcScutumShield.name=Стальной Щит "Щиток" +item.npcHeaterShield.name=Стальной Щит "Нагреватель" + +item.npcWoodenSpear.name=Деревянное Копье +item.npcStoneSpear.name=Каменное Копье +item.npcIronSpear.name=Железное Копье +item.npcGoldenSpear.name=Золотое Копье +item.npcDiamondSpear.name=Алмазное Копье +item.npcBronzeSpear.name=Бронзовое Копье +item.npcEmeraldSpear.name=Изумрудное Копье +item.npcDemonicSpear.name=Демоническое Копье +item.npcFrostSpear.name=Ледяное Копье + +item.npcWoodenBattleAxe.name=Деревянный Боевой Топор +item.npcStoneBattleAxe.name=Каменный Боевой Топор +item.npcIronBattleAxe.name=Железный Боевой Топор +item.npcGoldenBattleAxe.name=Золотой Боевой Топор +item.npcDiamondBattleAxe.name=Алмазный Боевой Топор +item.npcBronzeBattleAxe.name=Бронзовый Боевой Топор +item.npcEmeraldBattleAxe.name=Изумрудный Боевой Топор +item.npcDemonicBattleAxe.name=Демонический Боевой Топор +item.npcFrostBattleAxe.name=Ледяной Боевой Топор + +item.npcWoodenMace.name=Деревянная Булава +item.npcStoneMace.name=Каменная Булава +item.npcIronMace.name=Железная Булава +item.npcGoldenMace.name=Золотая Булава +item.npcDiamondMace.name=Алмазная Булава +item.npcBronzeMace.name=Бронзовая Булава +item.npcEmeraldMace.name=Изумрудная Булава +item.npcDemonicMace.name=Демоническая Булава +item.npcFrostMace.name=Ледяная Булава + +item.npcWoodenDagger.name=Деревянный Кинжал +item.npcStoneDagger.name=Каменный Кинжал +item.npcIronDagger.name=Железный Кинжал +item.npcGoldenDagger.name=Золотой Кинжал +item.npcDiamondDagger.name=Алмазный Кинжал +item.npcBronzeDagger.name=Бронзовый Кинжал +item.npcEmeraldDagger.name=Изумрудный Кинжал +item.npcDemonicDagger.name=Демонический Кинжал +item.npcFrostDagger.name=Ледяной Кинжал +item.npcWoodenReversedDagger.name=Обратный Деревянный Кинжал +item.npcStoneReversedDagger.name=Обратный Каменный Кинжал +item.npcIronReversedDagger.name=Обратный Железный Кинжал +item.npcGoldenReversedDagger.name=Обратный Золотой Кинжал +item.npcDiamondReversedDagger.name=Обратный Алмазный Кинжал +item.npcBronzeReversedDagger.name=Обратный Бронзовый Кинжал +item.npcEmeraldReversedDagger.name=Обратный Изумрудный Кинжал +item.npcDemonicReversedDagger.name=Обратный Демонический Кинжал +item.npcFrostReversedDagger.name=Обратный Ледяной Кинжал + +item.npcWoodenStaff.name=Деревянный Посох +item.npcStoneStaff.name=Каменный Посох +item.npcIronStaff.name=Железный Посох +item.npcGoldenStaff.name=Золотой Посох +item.npcDiamondStaff.name=Алмазный Посох +item.npcBronzeStaff.name=Бронзовый Посох +item.npcEmeraldStaff.name=Изумрудный Посох +item.npcElementalStaff.name=Элементальный Посох +item.npcDemonicStaff.name=Демонический Посох +item.npcFrostStaff.name=Ледяной Посох + +item.npcWoodenScythe.name=Деревянная Коса +item.npcStoneScythe.name=Каменная Коса +item.npcIronScythe.name=Железная Коса +item.npcGoldenScythe.name=Золотая Коса +item.npcBronzeScythe.name=Бронзовая Коса +item.npcDiamondScythe.name=Алмазная Коса +item.npcEmeraldScythe.name=Изумрудная Коса +item.npcDemonicScythe.name=Демоническая Коса +item.npcFrostScythe.name=Ледяная Коса + +item.npcWoodenGlaive.name=Деревянный Меч +item.npcStoneGlaive.name=Каменный Меч +item.npcIronGlaive.name=Железный Меч +item.npcGoldenGlaive.name=Золотой Меч +item.npcDiamondGlaive.name=Алмазный Меч +item.npcBronzeGlaive.name=Бронзовый Меч +item.npcEmeraldGlaive.name=Изумрудный Меч +item.npcDemonicGlaive.name=Демонический Меч +item.npcFrostGlaive.name=Ледяной Меч + +item.npcCowleatherHead.name=Шлем из кожи коровы +item.npcCowleatherChest.name=Нагрудник из кожи коровы +item.npcCowleatherLegs.name=Поножи из кожи коровы +item.npcCowleatherBoots.name=Ботинки из кожи коровы + +item.npcNanorumHead.name=Шлем Рыцаря +item.npcNanorumChest.name=Нагрудник Рыцаря +item.npcNanorumLegs.name=Поножи Рыцаря +item.npcNanorumBoots.name=Ботинки Рыцаря + +item.npcTacticalHead.name=Тактический Шлем +item.npcTacticalChest.name=Тактический Жилет + +item.npcFullLeatherHead.name=Полный Кожаный Шлем +item.npcFullLeatherChest.name=Полный Кожаный Нагрудник + +item.npcFullIronHead.name=Полный Железный Шлем +item.npcFullIronChest.name=Полный Железный Нагрудник + +item.npcFullGoldHead.name=Полный Золотой Шлем +item.npcFullGoldChest.name=Полный Золотой Нагрудник + +item.npcFullDiamondHead.name=Полный Алмазный Шлем +item.npcFullDiamondChest.name=Полный Алмазный Нагрудник + +item.npcFullBronzeHead.name=Полный Бронзовый Шлем +item.npcFullBronzeChest.name=Полный Бронзовый Нагрудник +item.npcFullBronzeLeggings.name=Полные Бронзовые Поножи +item.npcFullBronzeBoots.name=Полные Бронзовые Ботинки + +item.npcFullWoodenHead.name=Полный Деревянный Шлем +item.npcFullWoodenChest.name=Полный Деревянный Нагрудник +item.npcFullWoodenLeggings.name=Полный Деревянные Поножи +item.npcFullWoodenBoots.name=Полный Деревянные Ботинки + +item.npcTuxedoChest.name=Смокинг(Нагрудник) +item.npcTuxedoPants.name=Смокинг(Поножи) +item.npcTuxedoBottom.name=Смокинг(Плащ) + +item.npcWizardHead.name=Шлем Волшебника +item.npcWizardChest.name=Нагрудник Волшебника +item.npcWizardPants.name=Поножи Волшебника + +item.npcAssassinHead.name=Шлем Ассасина +item.npcAssassinChest.name=Нагрудник Ассасина +item.npcAssassinLeggings.name=Поножи Ассасина +item.npcAssassinBoots.name=Ботинки Ассасина + +item.npcSoldierHead.name=Шлем Солдата +item.npcSoldierChest.name=Нагрудник Солдата +item.npcSoldierLegs.name=Поножи Солдата +item.npcSoldierBottom.name=Плащ Солдата + +item.npcX407Head.name=X407 Прототипный Шлема +item.npcX407Chest.name=X407 Прототип Нагрудника +item.npcX407Legs.name=X407 Прототип Поножи +item.npcX407Boots.name=X407 Прототип Ботинок + +item.npcCommissarHead.name=Шлем Комиссара +item.npcCommissarChest.name=Нагрудник Комиссара +item.npcCommissarLegs.name=Поножи Комиссара +item.npcCommissarBottom.name=Плащ Комиссара + +item.npcInfantryHelmet.name=Шлем Пехоты +item.npcOfficerChest.name=Нагрудник Офицера + +item.npcCrown.name=Корона +item.npcCrown2.name=Корона +item.npcPaperCrown.name=Бумажная Корона + +item.npcNinjaHead.name=Шлем Ниндзя +item.npcNinjaChest.name=Нагрудник Ниндзя +item.npcNinjaPants.name=Поножи Ниндзя + +item.npcFullEmeraldHead.name=Полный Изумрудный Шлем +item.npcFullEmeraldChest.name=Полный Изумрудный Нагрудник +item.npcFullEmeraldLeggings.name=Полные Изумрудные Поножи +item.npcFullEmeraldBoots.name=Полные Изумрудные Ботинки + +item.npcOrb.name=Сфера +item.npcBrokenOrb.name=Разбитая Сфера +item.npcMana.name=Мана + +item.npcNinjaClaw.name=Коготь Ниндзя +item.npcSteelClaw.name=Стальной Коготь +item.npcBearClaw.name=Медвежий Коготь +item.npcKatar.name=Катар + +item.npcLetter.name=Письмо +item.npcPlans.name=Конверт +item.npcSatchel.name=Мешок +item.npcBag.name=Сумка +item.npcCrystal.name=Кристалл +item.npcSeveredEar.name=Серверированая Уха +item.npcPhone.name=Телефон +item.npcBanditMask.name=Бандитская Маска +item.npcBrokenArrow.name=Сломаная Стрела +item.npcEarthElement.name=Земляной Элемент +item.npcWaterElement.name=Водяной Элемент +item.npcFireElement.name=Огненный Элемент +item.npcAirElement.name=Воздушный Элемент +item.npcCarKey.name=Автомобильные ключи +item.npcKey.name=Ключ +item.npcKey2.name=Ключ +item.npcPendant.name=Кулон +item.npcBlueprint.name=План +item.npcRing.name=Кольцо + +item.npcSkull.name=Череп +item.npcSaphire.name=Сапфир +item.npcAmethyst.name=Аметис +item.npcRuby.name=Рубин +item.npcBronzeIngot.name=Бронзовый Слиток +item.npcDemonicIngot.name=Демонический Слиток + +item.npcMacuahuitl.name=Оружие Ацтеков +item.npcBoStaff.name=Посох Бо +item.npcSaiBlade.name=Лезвие Сай +item.npcCrossbow.name=Арбалет +item.npcCrossBolt.name=Арбалетный Болт +item.npcSlingshot.name=Рогатка +item.npcMusket.name=Мушкет +item.npcExcalibur.name=Екскалибур + +item.npcBronzeSword.name=Бронзовый Меч +item.npcEmeraldSword.name=Изумрудный Меч +item.npcDemonicSword.name=Демонический Меч +item.npcFrostSword.name=Ледяной Меч + +item.npcAncientCoin.name=Древняя Монета +item.npcAncientScroll.name=Древний Свиток +item.npcArtifact.name=Артефакт +item.npcLocket.name=Медальон +item.npcSilk.name=Шелк +item.npcStatuette.name=Статуетка +item.npcTablet.name=Скрижаль + +item.npcWoodenHalberd.name=Деревянная Алебарда +item.npcStoneHalberd.name=Каменная Алебарда +item.npcIronHalberd.name=Железная Алебарда +item.npcGoldenHalberd.name=Золотая Алебарда +item.npcDiamondHalberd.name=Алмазная Алебарда +item.npcBronzeHalberd.name=Бронзовая Алебарда +item.npcEmeraldHalberd.name=Изумрудная Алебарда +item.npcCursedHalberd.name=Проклятая Алебарда +item.npcDemonicHalberd.name=Демоническая Алебарда +item.npcFrostHalberd.name=Ледяная Алебарда + +item.npcWoodenWarhammer.name=Деревянный Боевой Молот +item.npcStoneWarhammer.name=Каменный Боевой Молот +item.npcIronWarhammer.name=Железный Боевой Молот +item.npcGoldenWarhammer.name=Золотой Боевой Молот +item.npcDiamondWarhammer.name=Алмазный Боевой Молот +item.npcBronzeWarhammer.name=Бронзовый Боевой Молот +item.npcEmeraldWarhammer.name=Изумрудный Боевой Молот +item.npcCursedWarhammer.name=Проклятый Боевой Молот +item.npcDemonicWarhammer.name=Демонический Боевой Молот +item.npcFrostWarhammer.name=Ледяной Боевой Молот + +item.npcChainSkirt.name=Кольчужная Юбка +item.npcLeatherSkirt.name=Кожаный Юбка +item.npcGoldSkirt.name=Золотой Юбка +item.npcIronSkirt.name=Железная Юбка +item.npcDiamondSkirt.name=Алмазная Юбка + +enchantment.damage=Урон +enchantment.confusion=Смятение +enchantment.infinite=Бесконечный +enchantment.poison=Зелье + +item.npcWoodenBroadsword.name=Деревянный Палаш +item.npcStoneBroadsword.name=Каменный Палаш +item.npcIronBroadsword.name=Делезный Палаш +item.npcGoldenBroadsword.name=Золотой Палаш +item.npcDiamondBroadsword.name=Алмазный Палаш +item.npcBronzeBroadsword.name=Бронзовый Палаш +item.npcEmeraldBroadsword.name=Изумрудный Палаш +item.npcCursedBroadsword.name=Проклятый Палаш +item.npcDemonicBroadsword.name=Демонический Палаш +item.npcFrostBroadsword.name=Ледяной Палаш + +#Made by nextcube.ru +#Specifically Ice Troll \ No newline at end of file diff --git a/src/main/resources/assets/customnpcs/lang/sv_SE.lang b/src/main/resources/assets/customnpcs/lang/sv_SE.lang new file mode 100644 index 000000000..91be6d6bc --- /dev/null +++ b/src/main/resources/assets/customnpcs/lang/sv_SE.lang @@ -0,0 +1,309 @@ +tile.npcRedstoneBlock.name=Rödstens Block +tile.npcCarpentyBench.name=Snickeri Bänk + +gui.deleteConfirm=Är du säker att du vill ta bort denn här NPCn? + +menu.inventory=Utrustning +menu.quests=Uppdrag +menu.display=Visa +menu.stats=Statistik +menu.advanced=Avancerat +menu.global=Globalt +menu.delete=Ta bort + +bank.slot=Lucka +bank.unlock=Låsa upp +bank.upgrade=Uppgradera +bank.upgradeCosts=Kostar att uppgradera +bank.unlockCosts=Kostart att låsa upp + +follower.waiting=Väntar +follower.following=Följer +follower.hire=Hyr +follower.health=Hälsa +follower.daysleft=Dagar kvar +follower.lastday=Sista dagen +follower.day=Dag +follower.days=Dagar +follower.hireText=Tack för att du hyr mig för +follower.farewellText=Mina dagar är över. Farväl + +transporter.travel=Res +transporter.unlock1=Transpotera till +transporter.unlock2=är nu upplåst + +quest.complete=Komplett +quest.turnin=Du kan nu lösa in uppdraget +quest.start=Starta nytt uppdrag + +item.npcWand.name=Npc Stav +item.npcCloner.name=Npc Klonare +item.npcSpawner.name=Mob Skapare + +item.npcBanjo.name=Banjo +item.npcViolin.name=Violin +item.npcViolinBow.name=Violin Båge +item.npcHarp.name=Harpa +item.npcGuitar.name=Gitarr + +item.npcCoinWooden.name=Trä Mynt +item.npcCoinStone.name=Sten Mynt +item.npcCoinBronze.name=Brons Mynt +item.npcCoinIron.name=Järn Mynt +item.npcCoinGold.name=Guld Mynt +item.npcCoinDiamond.name=Diamant Mynt +item.npcCoinEmerald.name=Smarags Mynt + +item.npcWoodenGun.name=Trä Pistol +item.npcStoneGun.name=Sten Pistol +item.npcIronGun.name=Järn Pistol +item.npcGoldGun.name=Guld Pistol +item.npcDiamondGun.name=Diamant Pistol +item.npcBronzeGun.name=Brons Pistol +item.npcEmeraldGun.name=Smaragd Pistol +item.npcMachineGun.name=Maskin Gevär + +item.npcWoodenBullet.name=Trä Skott +item.npcStoneBullet.name=Sten Skott +item.npcIronBullet.name=Järm Skott +item.npcGoldenBullet.name=Guld Skott +item.npcDiamondBullet.name=Diamant Skott +item.npcBronzeBullet.name=Brons Skott +item.npcEmeraldBullet.name=Smaragd Skott +item.npcBlackBullet.name=Svart Skott + +item.npcWoodenTrident.name=Trä Treudd +item.npcStoneTrident.name=Sten Treudd +item.npcIronTrident.name=Järn Treudd +item.npcGoldTrident.name=Guld Treudd +item.npcDiamondTrident.name=Diamant Treudd +item.npcBronzeTrident.name=Brons Treudd +item.npcEmeraldTrident.name=Smaragd Treudd +item.npcCursedTrident.name=Förbannad Treudd + +item.npcNatureSpell.name=Natur Stav +item.npcArcaneSpell.name=Hemlig Stav +item.npcLightningSpell.name=Blixt Stav +item.npcIceSpell.name=Is Stav +item.npcFireSpell.name=Eld Stav +item.npcDarkSpell.name=Mörk Stav +item.npcHolySpell.name=Helig Stav + +item.npcKunai.name=Kunai +item.npcReverseKunai.name=Omvänd Kunai +item.npcShuriken.name=Shurik +item.npcGiantShuriken.name=Stor Shurik +item.npcKatana.name=Katana +item.npcKukri.name=Kukri + +item.npcGolfClub.name=Golf Klubba +item.npcMagicWand.name=Magisk Stav +item.npcChickenSword.name=Kyckling Svärd +item.npcHandCuffs.name=Handklovar +item.npcHammer.name=Hammare +item.npcBaseballBat.name=Baseballträ +item.npcLeadPipe.name=Blyrör +item.npcCleaver.name=Köttyxa +item.npcSaber.name=Saber +item.npcHockeyStick.name=Hocky Klubba +item.npcSledgeHammer.name=Slägga +item.npcBrokenBottle.name=Trasig Flaska +item.npcCombatKnive.name=Bekämpa Kniv +item.npcLighter.name=Tändare +item.npcBatton.name=Slagträ +item.npcGunChainsaw.name=MotorsågsPistol +item.npcRapier.name=Värja +item.npcCrowbar.name=Kofot +item.npcPipeWrench.name=Rörtång +item.npcWrench.name=Skiftnyckel +item.npcSwissArmyKnife.name=Schweiziska armékniv + +item.npcWoodenShield.name=Rund Trä Sköld +item.npcStoneShield.name=Rund Sten Sköld +item.npcIronShield.name=Rund Järn Sköld +item.npcGoldenShield.name=Rund Guld Sköld +item.npcDiaShield.name=Rund Diamant Sköld +item.npcBronzeShield.name=Rund Brons Sköld +item.npcEmeraldShield.name=Rund Smaragd Sköld +item.npcFullWoodenShield.name=Trä Sköld +item.npcFullStoneShield.name=Sten Sköld +item.npcFullIronShield.name=Järn Sköld +item.npcFullGoldenShield.name=Guld Sköld +item.npcFullDiaShield.name=Diamant Sköld +item.npcFullBronzeShield.name=Brons Sköld +item.npcFullEmeraldShield.name=Smaragd Sköld + +item.npcTowerShield.name=Stål Torns Sköld +item.npcCryscentShield.name=Stål Cryscent Sköld +item.npcScutumShield.name=Stål Scutum Sköld +item.npcHeaterShield.name=Stål Heater Sköld + +item.npcWoodenSpear.name=Trä Spjut +item.npcStoneSpear.name=Sten Spjut +item.npcIronSpear.name=Järn Spjut +item.npcGoldenSpear.name=Guld Spjut +item.npcDiamondSpear.name=Diamant Spjut +item.npcBronzeSpear.name=Brons Spjut +item.npcEmeraldSpear.name=Smaragd Spjut + +item.npcWoodenBattleAxe.name=Trä Strits Yxa +item.npcStoneBattleAxe.name=Sten Strits Yxa +item.npcIronBattleAxe.name=Järn Strits Yxa +item.npcGoldenBattleAxe.name=Guld Strits Yxa +item.npcDiamondBattleAxe.name=Diamant Srtits Yxa +item.npcBronzeBattleAxe.name=Brons Strits Yxa +item.npcEmeraldBattleAxe.name=Smaragd Strits Yxa + +item.npcWoodenMace.name=Trä Spikklubba +item.npcStoneMace.name=Sten Spikklubba +item.npcIronMace.name=Järn Spikklubba +item.npcGoldenMace.name=Guld Spikklubba +item.npcDiamondMace.name=Diamant Spikklubba +item.npcBronzeMace.name=Brons Spikklubba +item.npcEmeraldMace.name=Smaragd Spikklubba + +item.npcWoodenDagger.name=Trä Dolk +item.npcStoneDagger.name=Sten Dolk +item.npcIronDagger.name=Järn Dolk +item.npcGoldenDagger.name=Guld Dolk +item.npcDiamondDagger.name=Diamant Dolk +item.npcBronzeDagger.name=Brons Dolk +item.npcEmeraldDagger.name=Smaragd Dolk +item.npcWoodenReversedDagger.name=Omvänd Trä Dolk +item.npcStoneReversedDagger.name=Omvänd Sten Dolk +item.npcIronReversedDagger.name=Omvänd Järn Dolk +item.npcGoldenReversedDagger.name=Omvänd Guld Dolk +item.npcDiamondReversedDagger.name=Omvänd Diamant Dolk +item.npcBronzeReversedDagger.name=Omvänd Brons Dolk +item.npcEmeraldReversedDagger.name=Omvänd Smaragd Dolk + +item.npcWoodenStaff.name=Trä Stav +item.npcStoneStaff.name=Sten Stav +item.npcIronStaff.name=Järn Stav +item.npcGoldenStaff.name=Guld Stav +item.npcDiamondStaff.name=Diamant Stav +item.npcBronzeStaff.name=Brons Stav +item.npcEmeraldStaff.name=Smaragd Stav +item.npcElementalStaff.name=Elemtal Stav + +item.npcWoodenScythe.name=Trä Lie +item.npcStoneScythe.name=Sten Lie +item.npcIronScythe.name=Järn Lie +item.npcGoldenScythe.name=Guld Lie +item.npcBronzeScythe.name=Brons Lie +item.npcDiamondScythe.name=Diamant Lie +item.npcEmeraldScythe.name=Smaragd Lie + +item.npcWoodenGlaive.name=Trä Glav +item.npcStoneGlaive.name=Sten Glav +item.npcIronGlaive.name=Järn Glav +item.npcGoldenGlaive.name=Guld Glav +item.npcDiamondGlaive.name=Diamant Glav +item.npcBronzeGlaive.name=Brons Glav +item.npcEmeraldGlaive.name=Smaragd Glav + +item.npcCowleatherHead.name=Koläder Hjälm +item.npcCowleatherChest.name=Koläder Harnesk +item.npcCowleatherLegs.name=Koläder Byxor +item.npcCowleatherBoots.name=Koläder Skor + +item.npcNanorumHead.name=Nanorum Hjälm +item.npcNanorumChest.name=Nanorum Harnesk +item.npcNanorumLegs.name=Nanorum Byxor +item.npcNanorumBoots.name=Nanorum Stövlar + +item.npcTacticalHead.name=Tactical Helmet +item.npcTacticalChest.name=Tactical Vest + +item.npcFullLeatherHead.name=Full Leather Helmet +item.npcFullLeatherChest.name=Full Leather ChestPlate + +item.npcFullIronHead.name=Full Iron Helmet +item.npcFullIronChest.name=Full Iron ChestPlate + +item.npcFullGoldHead.name=Full Gold Helmet +item.npcFullGoldChest.name=Full Gold ChestPlate + +item.npcFullDiamondHead.name=Full Diamond Helmet +item.npcFullDiamondChest.name=Full Diamond ChestPlate + +item.npcFullBronzeHead.name=Full Bronze Helmet +item.npcFullBronzeChest.name=Full Bronze ChestPlate +item.npcFullBronzeLeggings.name=Full Bronze Leggings +item.npcFullBronzeBoots.name=Full Bronze Boots + +item.npcFullWoodenHead.name=Full Wooden Helmet +item.npcFullWoodenChest.name=Full Wooden ChestPlate +item.npcFullWoodenLeggings.name=Full Wooden Leggings +item.npcFullWoodenBoots.name=Full Wooden Boots + +item.npcTuxedoChest.name=Tuxedo Chest +item.npcTuxedoPants.name=Tuxedo Pants +item.npcTuxedoBottom.name=Tuxedo Trenchcoat + +item.npcWizardHead.name=Wizard Head +item.npcWizardChest.name=Wizard Chest +item.npcWizardPants.name=Wizard Leggings + +item.npcAssassinHead.name=Assassins Helmet +item.npcAssassinChest.name=Assassins ChestPlate +item.npcAssassinLeggings.name=Assassins Leggings +item.npcAssassinBoots.name=Assassins Boots + +item.npcSoldierHead.name=Soldier Helmet +item.npcSoldierChest.name=Soldier ChestPlate +item.npcSoldierLegs.name=Soldier Leggings +item.npcSoldierBottom.name=Soldier Trenchcoat + +item.npcX407Head.name=X407 Prototype Helmet +item.npcX407Chest.name=X407 Prototype ChestPlate +item.npcX407Legs.name=X407 Prototype Leggings +item.npcX407Boots.name=X407 Prototype Boots + +item.npcCommissarHead.name=Commissar Helmet +item.npcCommissarChest.name=Commissar ChestPlate +item.npcCommissarLegs.name=Commissar Leggings +item.npcCommissarBottom.name=Commissar Trenchcoat + +item.npcInfantryHelmet.name=Infantry Helmet +item.npcOfficerChest.name=Officer ChestPlate + +item.npcCrown.name=Crown +item.npcCrown2.name=Crown + +item.npcNinjaHead.name=Ninja Head +item.npcNinjaChest.name=Ninja Chest +item.npcNinjaPants.name=Ninja Leggings + +item.npcFullEmeraldHead.name=Full Emerald Helmet +item.npcFullEmeraldChest.name=Full Emerald ChestPlate +item.npcFullEmeraldLeggings.name=Full Emerald Leggings +item.npcFullEmeraldBoots.name=Full Emerald Boots + +item.npcOrb.name=Orb +item.npcBrokenOrb.name=BrokenOrb +item.npcMana.name=Mana + +item.npcNinjaClaw.name=Ninja Claw +item.npcSteelClaw.name=Steel Claw +item.npcBearClaw.name=Bear Claw +item.npcKatar.name=Katar + +item.npcLetter.name=Letter +item.npcPlans.name=Plans +item.npcSatchel.name=Satchel +item.npcBag.name=Bag +item.npcCrystal.name=Crystal +item.npcSeveredEar.name=Severed Ear +item.npcPhone.name=Phone +item.npcBanditMask.name=Bandit Mask +item.npcBrokenArrow.name=Broken Arrow +item.npcEarthElement.name=Earth Element +item.npcWaterElement.name=Water Element +item.npcFireElement.name=Fire Element +item.npcAirElement.name=Air Element +item.npcCarKey.name=Car Key +item.npcKey.name=Key +item.npcPendant.name=Pendant +item.npcBlueprint.name=Blueprint +item.npcRing.name=Ring diff --git a/src/main/resources/assets/customnpcs/lang/zh_CN.lang b/src/main/resources/assets/customnpcs/lang/zh_CN.lang new file mode 100644 index 000000000..6559374fe --- /dev/null +++ b/src/main/resources/assets/customnpcs/lang/zh_CN.lang @@ -0,0 +1,770 @@ +customnpcs.defaultTextColor=404040 +itemGroup.cnpcs=自定义NPC工具 +itemGroup.cnpcsw=自定义NPC武器 +itemGroup.cnpcsa=自定义NPC护甲 +itemGroup.cnpcsb=自定义NPC方块 +itemGroup.cnpcsm=自定义NPC杂项 +tile.npcRedstoneBlock.name=红石块 +tile.npcCarpentyBench.name=木工台 +tile.npcBloodBlock.name=血迹 +tile.npcMailbox.name=信箱 +tile.npcLocationBlock.name=定点块 +tile.npcBanner.name=旗帜 +tile.npcWallBanner.name=壁挂旗帜 +tile.npcChair.name=椅子 +tile.npcCrate.name=板条箱 +tile.npcTallLamp.name=立灯 +tile.npcWeaponRack.name=武器架 +tile.npcCouchWool.name=棉花座椅 +tile.npcTable.name=木质桌子 +tile.npcCouchWood.name=木质座椅 +tile.npcLamp.name=灯笼 +tile.npcCandle.name=蜡烛 +tile.npcStool.name=凳子 +tile.npcBorder.name=结界 +tile.npcBigSign.name=大型标识牌 +tile.npcBarrel.name=桶 +tile.npcShelf.name=木架 +tile.npcSign.name=标识牌 +tile.npcTombstone.name=墓碑 +tile.npcCampfire.name=篝火 +tile.npcBeam.name=横梁 +tile.npcPedestal.name=底座 +tile.npcPlaceholder_0.name=占位符 +tile.npcPlaceholder_1.name=占位符 +tile.npcPlaceholder_2.name=占位符 +tile.npcPlaceholder_3.name=占位符 +tile.npcPlaceholder_4.name=占位符 +tile.npcPlaceholder_5.name=占位符 +tile.npcPlaceholder_6.name=占位符 +tile.npcPlaceholder_7.name=占位符 +tile.npcPlaceholder_8.name=占位符 +tile.npcPlaceholder_9.name=占位符 +tile.npcPlaceholder_10.name=占位符 +tile.npcPlaceholder_11.name=占位符 +tile.npcPlaceholder_12.name=占位符 +tile.npcPlaceholder_13.name=占位符 +tile.npcPlaceholder_14.name=占位符 +tile.npcPlaceholder_15.name=占位符 +gui.delete=你确定要删除这个NPC吗? +gui.add=添加 +gui.remove=删除 +gui.save=保存 +gui.name=姓名 +gui.color=颜色 +gui.none=无 +gui.time=时间 +gui.title=标题 +gui.categories=类别 +gui.close=关闭 +gui.disabled=无效 +gui.increase=提升 +gui.decrease=降低 +gui.day=白天 +gui.night=夜晚 +gui.constant=恒定 +gui.accelerate=加速 +gui.small=小型 +gui.medium=中等 +gui.large=大型 +gui.type=类型 +gui.retaliate=反击 +gui.panic=恐慌 +gui.retreat=撤退 +gui.nothing=无反应 +gui.break=打碎 +gui.open=开启 +gui.darkness=黑暗 +gui.sunlight=日光 +gui.always=总是允许 +gui.untilclose=直到关闭 +gui.whenavailable=准备时 +gui.ignoreDamage=无视伤害 +gui.engagedistance=交互距离 +gui.orbitdistance=轨道距离 +gui.currentFolder=当前文件夹 +gui.play=播放 +gui.selectSound=选择音效 +gui.selectnpc=选择NPC +gui.select=选择 +gui.range=范围 +gui.name=名称 +gui.partly=部分的

+

gui.copy=复制 +gui.clear=清除 +gui.done=确定 +gui.paste=粘贴 +gui.settings=设置 +gui.enabled=开启 +gui.website=网站 +gui.text=文本 +gui.detailed=详细的 +remote.title=附近的NPC +remote.reset=重置 +remote.tp=传送至 +remote.resetall=重置所有 +remote.freeze=冻结NPC +remote.freeze=冻结NPC +spawner.entities=实体 +spawner.clones=克隆NPC +spawner.mobspawner=生成刷怪笼 +spawner.mount=被选中物骑乘 +spawner.mountplayer=玩家骑乘 +mailbox.name=信箱 +mailbox.sender=发送者 +mailbox.read=阅读 +mailbox.timesend=%s 之前 +mailbox.day=天 +mailbox.days=天 +mailbox.hour=小时 +mailbox.hours=小时 +mailbox.minute=分钟 +mailbox.minutes=分钟 +mailbox.username=用户名 +mailbox.subject=标题 +mailbox.send=发送 +mailbox.write=写篇短信 +mailbox.succes=你的信息成功的发送给 %s了 +mailbox.errorUsername=未知用户名 +mailbox.errorSubject=标题不能为空 +mailbox.setup=开启信件 +display.model=模型 +display.show=显示 +display.hide=隐藏 +display.showAttacking=攻击时显示 +display.size=尺寸 +display.texture=材质 +display.cape=披风 +display.overlay=附加材质 +display.player=玩家 +display.selectTexture=选择材质 +display.livingAnimation=有活力的 +display.visible=是否可见 +display.bossbar=Boss型血条 +inv.minExp=最小经验值 +inv.maxExp=最大经验值 +inv.npcInventory=NPC物品栏 +inv.inventory=物品栏 +inv.dropChance=掉落几率 + +availability.options=可用的选项 +availability.always=总是可用 +availability.after=...之后 +availability.before=...之前 +availability.available=可用 +availability.whenactive=当激活时 +availability.whennotactive=未激活时 +availability.selectquest=选择任务 +availability.selectdialog=选择对话 +availability.selectfaction=选择阵营 +availability.daytime=时刻 +availability.wholeday=全天 +availability.night=处于夜晚时 +availability.day=处于白天时 +availability.is=是 +availability.isnot=不是 +availability.minlevel=等级 +availability.name=可用的 +availability.areaNotAvailble=你不能通过这里。 +availability.permission=你没权限干这事哦 +availability.editIcon=从现在起十秒内,你能用右击来设置任何物品的图标 +spawning.availableBiomes=可选生物群落 +spawning.spawningBiomes=在以下生物群落内生成 +spawning.biomes=生物群落 +spawning.weightedChance=生成几率 +role.name=身份 +role.none=无身份 +role.trader=商人 +role.follower=雇佣随从 +role.bank=储存者 +role.transporter=传送师 +role.mailman=信使 +role.marketname=Linked Marketname +trader.insufficient=缺少物品 +job.name=职业 +job.none=无职业 +job.bard=吟游诗人 +job.guard=守卫 +job.healer=治疗者 +job.bard=吟游诗人 +job.itemgiver=物品给予者 +job.boss=Boss +job.spawner=召唤师 +job.conersation=群体对话 +spawner.dies=召唤物全部死亡后本体死亡 +spawner.posoffset=位移 +spawner.type=生成类型 +spawner.all=全部 +spawner.random=随机 +spawner.one=顺次 +stats.health=生命 +stats.aggro=主动攻击范围 +stats.meleeproperties=近战属性 +stats.rangedproperties=远程属性 +stats.projectileproperties=弹药类型 +stats.meleestrength=近战伤害 +stats.meleerange=近战攻击距离 +stats.meleespeed=近战攻击速度 +stats.accuracy=命中率(%) +stats.rangedrange=远程攻击距离 +stats.burstspeed=连发间隔 +stats.firedelay=攻击速度 +stats.delayvariance=攻速方差 +stats.burstcount=连发数量 +stats.walkspeed=移动速度 +stats.meleeeffect=攻击效果(秒) +stats.respawn=重生 +stats.deadbody=隐藏尸体 +stats.fireimmune=火焰免疫 +stats.candrown=可以被淹死 +stats.firesound:=声音设置 +stats.creaturetype=生物类型 +stats.normal=普通 +stats.undead=不死 +stats.arthropod=节肢动物 +stats.nofalldamage=无掉落伤害 +stats.meleeproperties=近战选项 +stats.rangedproperties=远程选项 +stats.burninsun=会被阳光引燃 +stats.amplify=增益 +stats.melee=近战 +stats.regenhealth=正常生命恢复 +stats.combatregen=受攻击生命恢复 +stats.size=尺寸 +stats.speed=速度 +stats.glows=发光 +stats.hasgravity=受重力影响 +stats.explosive=爆炸 +stats.rangedeffect=效果 +stats.trail=踪迹类型 +stats.spin=旋转 +stats.stick=穿透目标 +stats.regular=无增益 +stats.amplified=增益 +ai.standing=站立 +ai.wandering=游荡 +ai.movingpath=路径移动 +ai.looping=循环 +ai.backtracking=回溯 +ai.enemyresponse=发现敌人时 +ai.door=与门交互 +ai.avoidwater=避水 +ai.return=返回起点 +ai.swim=可以游泳 +ai.shelter=寻求庇护 +ai.leapattarget=冲向目标 +ai.sprint=可以冲锋 +ai.clearlos=必须看到目标 +ai.indirect=间接点燃 +ai.rangemelee=使用远程攻击 +ai.tacticalvariant=战术变换 +ai.cobwebAffected=蜘蛛网对其是否有效 +ai.movement=移动 +aitactics.rush=突袭 +aitactics.stagger=闪避 +aitactics.orbit=包围 +aitactics.ambush=伏击 +aitactics.stalk=偷袭 +advanced.idlesound=正常音效 +advanced.angersound=愤怒音效 +advanced.hurtsound=受攻击音效 +advanced.deathsound=死亡音效 +advanced.stepsound=行走音效 +advanced.sounds=音效 +advanced.lines=台词 +advanced.night=夜晚设置 +advanced.editingmode=编辑模式 +advanced.loadday=加载白天设置 +advanced.loadnight=加载夜晚设置 +advanced.haspitch=游戏中显示 +faction.hostiles=敌对阵营 +faction.unfriendly=不友好 +faction.neutral=中立 +faction.friendly=友好 +faction.points=点数相关 +faction.ondeath=该NPC死亡后 +faction.hidden=隐藏 +faction.default=默认 +faction.attackHostile=攻击敌对阵营 +faction.defend=保护阵营中的其他人 +faction.nostanding=你现在不属于任何一个阵营 +faction.options=阵营选项 +faction.increasepoints=阵营 %s提高了了 %s 点数 +faction.decreasepoints=阵营 %s降低了 %s 点数 +faction.attacked=被其他生物攻击 +menu.inventory=物品 +menu.display=外形设置 +menu.stats=属性设置 +menu.factions=阵营 +menu.ai=AI +menu.advanced=高级设置 +menu.global=全局设置 +menu.role=职业设置 +menu.quests=任务 +global.banks=储存档案 +global.transport=传送档案 +global.playerdata=玩家档案 +global.recipes=NPC合成表 +global.naturalspawn=自然生成设置 +bank.slot=数量 +bank.unlock=解锁 +bank.upgrade=升级 +bank.upgradeCosts=升级费用 +bank.unlockCosts=解锁费用 +follower.waiting=等待 +follower.following=跟随 +follower.hire=雇佣 +follower.health=生命 +follower.daysleft=剩余时间 +follower.lastday=最后一天 +follower.day=天 +follower.days=天 +follower.hireText=感谢雇佣。 +follower.farewellText=时限已到。但愿我们下次还能再见。 + +transporter.travel=传送 +transporter.unlock=传送点%s已可使用 +transporter.discovered=发现时激活 +transporter.start=一开始就激活 +transporter.interaction=对话后激活 + +conversation.delay=延时 +conversation.line=台词 + +bard.jukebox=像唱片机一样播放 +bard.background=像背景音乐一样播放 +bard.ondistance=激活距离 +bard.offdistance=关闭距离 +bard.hasoff=可因距离关闭 + +dialog.dialog=对话 +dialog.dialogs=对话框 +dialog.options=对话框选项 +dialog.dialogtext=对话文本 +dialog.editoption=编辑对话框选项 +dialog.optiontype=选项类型 +dialog.selectoption=选择选项 +dialog.quitoption=退出选项 +dialog.option=对话选项 +dialog.roleoption=身份选项 +dialog.commandoption=指令选项 +dialog.commandoptionplayer=使用 "@dp" 来指代正在进行对话的玩家 + + +quest.quest=任务 +quest.quests=任务 +quest.item=物品收集任务 +quest.kill=击杀任务 +quest.areakill=定点击杀任务 +quest.dialog=对话任务 +quest.location=定点任务 +quest.completedtext=完成文本 +quest.questlogtext=任务简绍 +quest.complete=任务完成 +quest.reward=任务奖励 +quest.repeatable=可重复 +quest.mcdaily=MC中的一天 +quest.mcweekly=MC中的一周 +quest.rldaily=现实中的一天 +quest.rlweekly=现实中的一周 +quest.instant=立即完成 +quest.npc=交付npc +quest.next=下一个任务 +quest.found=找到 +quest.notfound=没有找到 +quest.completed=任务完成 +quest.newquest=新任务 +quest.noquests=你现在没有进行中的任务~ +quest.completewith=完成用了 %s +quest.randomitem=随机物品 +quest.exp=经验值 +quest.takeitems=是否拿取玩家物品 +quest.objectives=目标 + +script.init=运行 +script.interact=对话 +script.update=更新 +script.console=控制台 +script.language=语言 +script.damaged=伤害 +script.availableScripts=激活的脚本 +script.loadedScripts=载入的脚本 + +item.npcWand.name=Npc 魔杖 +item.npcMobCloner.name=Mob 复制魔杖 +item.npcMovingPath.name=Npc 路径魔杖 +item.npcMounter.name=骑乘魔杖 +item.npcTeleporter.name=传送魔杖 +item.npcScripter.name=脚本魔杖 + +item.npcBanjo.name=五弦琴 +item.npcViolin.name=小提琴 +item.npcViolinBow.name=提琴弓 +item.npcHarp.name=竖琴 +item.npcGuitar.name=吉他 +item.npcFrenchHorn.name=圆号 +item.npcOcarina.name=笛 +item.npcClarinet.name=单簧管 + +item.npcCoinWooden.name=木币 +item.npcCoinStone.name=石币 +item.npcCoinBronze.name=青铜币 +item.npcCoinIron.name=铁币 +item.npcCoinGold.name=金币 +item.npcCoinDiamond.name=钻石币 +item.npcCoinEmerald.name=绿宝石币 + +item.npcWoodenGun.name=木制手枪 +item.npcStoneGun.name=石制手枪 +item.npcIronGun.name=铁制手枪 +item.npcGoldGun.name=金制手枪 +item.npcDiamondGun.name=钻石手枪 +item.npcBronzeGun.name=青铜手枪 +item.npcEmeraldGun.name=绿宝石手枪 +item.npcMachineGun.name=机枪 + +item.npcWoodenBullet.name=木质子弹 +item.npcStoneBullet.name=石质子弹 +item.npcIronBullet.name=铁质子弹 +item.npcGoldenBullet.name=金质子弹 +item.npcDiamondBullet.name=钻石子弹 +item.npcBronzeBullet.name=青铜子弹 +item.npcEmeraldBullet.name=绿宝石子弹 +item.npcBlackBullet.name=黑色子弹 + +item.npcWoodenTrident.name=木质三叉戟 +item.npcStoneTrident.name=石质三叉戟 +item.npcIronTrident.name=铁质三叉戟 +item.npcGoldTrident.name=金质三叉戟 +item.npcDiamondTrident.name=钻石三叉戟 +item.npcBronzeTrident.name=青铜三叉戟 +item.npcEmeraldTrident.name=绿宝石三叉戟 +item.npcCursedTrident.name=被诅咒的三叉戟 +item.npcDemonicTrident.name=魔化三叉戟 +item.npcFrostTrident.name=冰霜三叉戟 + +item.npcNatureSpell.name=自然魔咒 +item.npcArcaneSpell.name=神秘魔咒 +item.npcLightningSpell.name=雷电魔咒 +item.npcIceSpell.name=冰霜魔咒 +item.npcFireSpell.name=火焰魔咒 +item.npcDarkSpell.name=黑暗魔咒 +item.npcHolySpell.name=神圣魔咒 + +item.npcKunai.name=苦无 +item.npcReverseKunai.name=反向苦无 +item.npcShuriken.name=飞镖 +item.npcGiantShuriken.name=巨大飞镖 +item.npcKatana.name=武士刀 +item.npcKukri.name=反曲刀 + +item.npcGolfClub.name=高尔夫杆 +item.npcMagicWand.name=魔杖 +item.npcChickenSword.name=鸡神之剑 +item.npcHandCuffs.name=手铐 +item.npcHammer.name=榔头 +item.npcBaseballBat.name=棒球棒 +item.npcLeadPipe.name=铅管 +item.npcCleaver.name=剁肉刀 +item.npcSaber.name=护手军刀 +item.npcHockeyStick.name=曲棍 +item.npcSledgeHammer.name=大锤 +item.npcBrokenBottle.name=破酒瓶 +item.npcCombatKnive.name=格斗匕首 +item.npcLighter.name=打火机 +item.npcBatton.name=警棍 +item.npcGunChainsaw.name=锯链枪 +item.npcRapier.name=指挥官之剑 +item.npcCrowbar.name=铁撬棍 +item.npcPipeWrench.name=管道扳手 +item.npcWrench.name=扳手 +item.npcSwissArmyKnife.name=瑞士军刀 +item.npcLeafBlade.name=叶刃 + +item.npcWoodenShield.name=木质圆盾 +item.npcStoneShield.name=石质圆盾 +item.npcIronShield.name=铁质圆盾 +item.npcGoldenShield.name=金质圆盾 +item.npcDiaShield.name=钻石圆盾 +item.npcBronzeShield.name=青铜圆盾 +item.npcEmeraldShield.name=绿宝石圆盾 +item.npcDemonicShield.name=魔化盾 +item.npcFrostShield.name=霜冻盾 +item.npcFullWoodenShield.name=木盾 +item.npcFullStoneShield.name=石盾 +item.npcFullIronShield.name=铁盾 +item.npcFullGoldenShield.name=金盾 +item.npcFullDiaShield.name=钻盾 +item.npcFullBronzeShield.name=青铜盾 +item.npcFullEmeraldShield.name=绿宝石盾 + + +item.npcTowerShield.name=尖钢盾 +item.npcCryscentShield.name=新月钢盾 +item.npcScutumShield.name=鳞甲钢盾 +item.npcHeaterShield.name=骑士钢盾 + +item.npcWoodenSpear.name=木制战矛 +item.npcStoneSpear.name=石制战矛 +item.npcIronSpear.name=铁制战矛 +item.npcGoldenSpear.name=金制战矛 +item.npcDiamondSpear.name=钻石战矛 +item.npcBronzeSpear.name=青铜战矛 +item.npcEmeraldSpear.name=绿宝石战矛 +item.npcDemonicSpear.name=魔化战矛 +item.npcFrostSpear.name=霜冻战矛 + +item.npcWoodenBattleAxe.name=木制战斧 +item.npcStoneBattleAxe.name=石制战斧 +item.npcIronBattleAxe.name=铁制战斧 +item.npcGoldenBattleAxe.name=金制战斧 +item.npcDiamondBattleAxe.name=钻石战斧 +item.npcBronzeBattleAxe.name=青铜战斧 +item.npcEmeraldBattleAxe.name=绿宝石战斧 +item.npcDemonicBattleAxe.name=魔化战斧 +item.npcFrostBattleAxe.name=霜冻战斧 + +item.npcWoodenMace.name=木制钉头锤 +item.npcStoneMace.name=石制钉头锤 +item.npcIronMace.name=铁制钉头锤 +item.npcGoldenMace.name=金制钉头锤 +item.npcDiamondMace.name=钻石钉头锤 +item.npcBronzeMace.name=青铜钉头锤 +item.npcEmeraldMace.name=绿宝石钉头锤 +item.npcDemonicMace.name=魔化钉头锤 +item.npcFrostMace.name=霜冻钉头锤 + +item.npcWoodenDagger.name=木质匕首 +item.npcStoneDagger.name=石质匕首 +item.npcIronDagger.name=铁质匕首 +item.npcGoldenDagger.name=金质匕首 +item.npcDiamondDagger.name=钻石匕首 +item.npcBronzeDagger.name=青铜匕首 +item.npcEmeraldDagger.name=绿宝石匕首 +item.npcDemonicDagger.name=魔化匕首 +item.npcFrostDagger.name=霜冻匕首 + +item.npcWoodenReversedDagger.name=反手木质匕首 +item.npcStoneReversedDagger.name=反手石质匕首 +item.npcIronReversedDagger.name=反手铁质匕首 +item.npcGoldenReversedDagger.name=反手金质匕首 +item.npcDiamondReversedDagger.name=反手钻石匕首 +item.npcBronzeReversedDagger.name=反手青铜匕首 +item.npcEmeraldReversedDagger.name=反手绿宝石匕首 +item.npcDemonicReversedDagger.name=反手魔化匕首 +item.npcFrostReversedDagger.name=反手霜冻匕首 + +item.npcWoodenStaff.name=木质法杖 +item.npcStoneStaff.name=石质法杖 +item.npcIronStaff.name=铁质法杖 +item.npcGoldenStaff.name=金质法杖 +item.npcDiamondStaff.name=钻石法杖 +item.npcBronzeStaff.name=青铜法杖 +item.npcEmeraldStaff.name=绿宝石法杖 +item.npcElementalStaff.name=元素法杖 +item.npcDemonicStaff.name=魔化法杖 +item.npcFrostStaff.name=冰霜法杖 + +item.npcWoodenScythe.name=木制战镰 +item.npcStoneScythe.name=木制战镰 +item.npcIronScythe.name=铁制战镰 +item.npcGoldenScythe.name=金制战镰 +item.npcBronzeScythe.name=青铜战镰 +item.npcDiamondScythe.name=钻石战镰 +item.npcEmeraldScythe.name=绿宝石战镰 +item.npcDemonicScythe.name=魔化战镰 +item.npcFrostScythe.name=霜冻战镰 + +item.npcWoodenGlaive.name=木制月刃 +item.npcStoneGlaive.name=石制月刃 +item.npcIronGlaive.name=铁制月刃 +item.npcGoldenGlaive.name=金制月刃 +item.npcDiamondGlaive.name=钻石月刃 +item.npcBronzeGlaive.name=青铜月刃 +item.npcEmeraldGlaive.name=绿宝石月刃 +item.npcDemonicGlaive.name=魔化月刃 +item.npcFrostGlaive.name=霜冻月刃 + +item.npcCowleatherHead.name=牛皮革帽 +item.npcCowleatherChest.name=牛皮胸甲 +item.npcCowleatherLegs.name=牛皮护腿 +item.npcCowleatherBoots.name=牛皮靴子 + +item.npcNanorumHead.name=矮人军盔 +item.npcNanorumChest.name=矮人战甲 +item.npcNanorumLegs.name=矮人胫甲 +item.npcNanorumBoots.name=矮人战靴 + +item.npcTacticalHead.name=军用头盔 +item.npcTacticalChest.name=军用防弹衣 + +item.npcFullLeatherHead.name=皮革覆面盔 +item.npcFullLeatherChest.name=皮革重甲 + +item.npcFullIronHead.name=铁质覆面盔 +item.npcFullIronChest.name=铁质重甲 + +item.npcFullGoldHead.name=金质覆面盔 +item.npcFullGoldChest.name=金质胸甲 + +item.npcFullDiamondHead.name=钻石覆面盔 +item.npcFullDiamondChest.name=钻石重甲 + +item.npcFullBronzeHead.name=青铜覆面盔 +item.npcFullBronzeChest.name=青铜重甲 +item.npcFullBronzeLeggings.name=青铜护腿 +item.npcFullBronzeBoots.name=青铜战靴 + +item.npcFullWoodenHead.name=木质覆面盔 +item.npcFullWoodenChest.name=木质重甲 +item.npcFullWoodenLeggings.name=木质护腿 +item.npcFullWoodenBoots.name=木质战靴 + +item.npcTuxedoChest.name=燕尾服衬衫 +item.npcTuxedoPants.name=燕尾服长裤 +item.npcTuxedoBottom.name=燕尾服外套 + +item.npcWizardHead.name=巫师兜帽 +item.npcWizardChest.name=巫师长袍 +item.npcWizardPants.name=巫师护腿 + +item.npcAssassinHead.name=刺客兜帽 +item.npcAssassinChest.name=刺客布甲 +item.npcAssassinLeggings.name=刺客绑腿 +item.npcAssassinBoots.name=刺客布靴 + +item.npcSoldierHead.name=士兵钢盔 +item.npcSoldierChest.name=士兵钢甲 +item.npcSoldierLegs.name=士兵军靴 +item.npcSoldierBottom.name=士兵绑腿 +(实际上矮人觉得有点像战锤40k里的卡迪安..帝国卫队) + +item.npcX407Head.name=X407 原型钢盔 +item.npcX407Chest.name=X407 原型钢甲 +item.npcX407Legs.name=X407 原型护腿 +item.npcX407Boots.name=X407 原型战靴 + +item.npcCommissarHead.name=统帅军帽 +item.npcCommissarChest.name=统帅胸甲 +item.npcCommissarLegs.name=统帅军靴 +item.npcCommissarBottom.name=统帅绑腿 + +item.npcInfantryHelmet.name=步兵头盔 +item.npcOfficerChest.name=军官胸甲 + +item.npcCrown.name=王冠 +item.npcCrown2.name=王冠 +item.npcPaperCrown.name=纸质王冠 + +item.npcNinjaHead.name=忍者头巾 +item.npcNinjaChest.name=忍者夜行衣 +item.npcNinjaPants.name=忍者绑腿 + +item.npcFullEmeraldHead.name=绿宝石覆面盔 +item.npcFullEmeraldChest.name=绿宝石重甲 +item.npcFullEmeraldLeggings.name=绿宝石护腿 +item.npcFullEmeraldBoots.name=绿宝石靴子 + +item.npcOrb.name=法球 +item.npcBrokenOrb.name=破损法球 +item.npcMana.name=魔能 + +item.npcNinjaClaw.name=忍者爪刃 +item.npcSteelClaw.name=钢制爪刃 +item.npcBearClaw.name=熊式爪刃 +item.npcKatar.name=拳刺 + +item.npcLetter.name=书信 +item.npcPlans.name=设计图 +item.npcSatchel.name=背包 +item.npcBag.name=背包 +item.npcCrystal.name=水晶 +item.npcSeveredEar.name=切下的耳朵 +item.npcPhone.name=手机 +item.npcBanditMask.name=强盗面具 +item.npcBrokenArrow.name=断箭 +item.npcEarthElement.name=大地元素 +item.npcWaterElement.name=水之元素 +item.npcFireElement.name=火之元素 +item.npcAirElement.name=气之元素 +item.npcCarKey.name=车钥匙 +item.npcKey.name=钥匙 +item.npcKey2.name=钥匙 +item.npcPendant.name=吊坠 +item.npcBlueprint.name=蓝图 +item.npcRing.name=戒指 + +item.npcSkull.name=颅骨 +item.npcSaphire.name=紫水晶 +item.npcAmethyst.name=蓝宝石 +item.npcRuby.name=红宝石 +item.npcBronzeIngot.name=青铜锭 +item.npcDemonicIngot.name=魔化锭 + +item.npcMacuahuitl.name=双刃刀 +item.npcBoStaff.name=长棍 +item.npcSaiBlade.name=三叉剑 +item.npcCrossbow.name=十字弩 +item.npcCrossBolt.name=弩箭 +item.npcSlingshot.name=弹弓 +item.npcMusket.name=燧发枪 +item.npcExcalibur.name=圣剑 + +item.npcBronzeSword.name=青铜剑 +item.npcEmeraldSword.name=绿宝石剑 +item.npcDemonicSword.name=魔化剑 +item.npcFrostSword.name=霜冻剑 + +item.npcAncientCoin.name=远古硬币 +item.npcAncientScroll.name=远古卷轴 +item.npcArtifact.name=远古遗物 +item.npcLocket.name=项链 +item.npcSilk.name=丝绸 +item.npcStatuette.name=雕塑 +item.npcTablet.name=碑 + +item.npcWoodenHalberd.name=木质战戟 +item.npcStoneHalberd.name=石制战戟 +item.npcIronHalberd.name=铁制战戟 +item.npcGoldenHalberd.name=金制战戟 +item.npcDiamondHalberd.name=钻石战戟 +item.npcBronzeHalberd.name=青铜战戟 +item.npcEmeraldHalberd.name=绿宝石战戟 +item.npcCursedHalberd.name=被诅咒的战戟 +item.npcDemonicHalberd.name=恶魔战戟 +item.npcFrostHalberd.name=霜冻战戟 + + +item.npcWoodenWarhammer.name=木制战锤 +item.npcStoneWarhammer.name=石制战锤 +item.npcIronWarhammer.name=铁制战锤 +item.npcGoldenWarhammer.name=金制战锤 +item.npcDiamondWarhammer.name=钻石战锤 +item.npcBronzeWarhammer.name=青铜战锤 +item.npcEmeraldWarhammer.name=绿宝石战锤 +item.npcCursedWarhammer.name=被诅咒的战锤 +item.npcDemonicWarhammer.name=恶魔战锤 +item.npcFrostWarhammer.name=霜冻战锤 + + +item.npcChainSkirt.name=锁链裙子 +item.npcLeatherSkirt.name=皮革裙子 +item.npcGoldSkirt.name=金质裙子 +item.npcIronSkirt.name=铁质裙子 +item.npcDiamondSkirt.name=钻石裙子 + +enchantment.damage=伤害 +enchantment.confusion=反胃 +enchantment.infinite=无限 +enchantment.poison=中毒 + +entity.CustomNpc.name=自定义NPC + +item.npcWoodenBroadsword.name=木质阔剑item.npcStoneBroadsword.name=石质阔剑item.npcIronBroadsword.name=铁质阔剑item.npcGoldenBroadsword.name=金质阔剑item.npcDiamondBroadsword.name=钻石阔剑item.npcBronzeBroadsword.name=青铜阔剑 +item.npcEmeraldBroadsword.name=绿宝石阔剑item.npcCursedBroadsword.name=被诅咒的阔剑item.npcDemonicBroadsword.name=魔化阔剑item.npcFrostBroadsword.name=霜冻阔剑 +job.chunkloader=区块载入者 +job.conversation=群体对话 +stats.mindelay=最快攻速 +stats.maxdelay=最慢攻速 +stats.burstcount=连发次数 +stats.shotcount=单次射击弹药量 \ No newline at end of file diff --git a/src/main/resources/assets/customnpcs/lang/zh_TW.lang b/src/main/resources/assets/customnpcs/lang/zh_TW.lang new file mode 100644 index 000000000..168709725 --- /dev/null +++ b/src/main/resources/assets/customnpcs/lang/zh_TW.lang @@ -0,0 +1,315 @@ +tile.npcRedstoneBlock.name=紅石座 +tile.npcCarpentyBench.name=木匠工作台 + +gui.deleteConfirm=你確定要刪除這個NPC? + +menu.inventory=庫存 +menu.quests=任務 +menu.display=顯示 +menu.statsCosts to unlock=解鎖的費用資料 +menu.advanced=進階 +menu.global=全球 +menu.delete=刪除 + +bank.slot=數量 +bank.unlock=開鎖 +bank.upgrade=升級 +bank.upgradeCosts=升級費用 +bank.unlockCosts=解鎖費用 + +follower.waiting=等候 +follower.following=跟隨 +follower.hire=聘請 +follower.health=血量 +follower.daysleft=剩餘天數 +follower.lastday=最後一天 +follower.day=天 +follower.days=天數 +follower.hireText=謝謝你雇用我! +follower.farewellText=我跟你協定的日期已經到了,再見。 + +transporter.travel=傳送 +transporter.unlock1=傳送到 +transporter.unlock2=現在已解鎖 + +quest.complete=完成 +quest.turnin=你現在可以執行的任務 +quest.start=開始新的任務 + +item.npcWand.name=NPC魔杖 +item.npcCloner.name=NPC複製器 +item.npcSpawner.name=生物生產器 + +item.npcBanjo.name=五弦琴 +item.npcViolin.name=小提琴 +item.npcViolinBow.name=小提琴弓 +item.npcHarp.name=豎琴 +item.npcGuitar.name=吉他 + +item.npcCoinWooden.name=木硬幣 +item.npcCoinStone.name=石硬幣 +item.npcCoinBronze.name=銅硬幣 +item.npcCoinIron.name=鐵硬幣 +item.npcCoinGold.name=金硬幣 +item.npcCoinDiamond.name=鑽石硬幣 +item.npcCoinEmerald.name=綠寶石硬幣 + +item.npcWoodenGun.name=木槍 +item.npcStoneGun.name=石槍 +item.npcIronGun.name=鐵槍 +item.npcGoldGun.name=金槍 +item.npcDiamondGun.name=鑽石槍 +item.npcBronzeGun.name=銅槍 +item.npcEmeraldGun.name=綠寶石槍 +item.npcMachineGun.name=機關槍 + +item.npcWoodenBullet.name=木子彈 +item.npcStoneBullet.name=石子彈 +item.npcIronBullet.name=鐵子彈 +item.npcGoldenBullet.name=金子彈 +item.npcDiamondBullet.name=鑽石子彈 +item.npcBronzeBullet.name=銅子彈 +item.npcEmeraldBullet.name=綠寶石子彈 +item.npcBlackBullet.name=黑子彈 + +item.npcWoodenTrident.name=木製三叉戟 +item.npcStoneTrident.name=石製三叉戟 +item.npcIronTrident.name=鐵製三叉戟 +item.npcGoldTrident.name=金製三叉戟 +item.npcDiamondTrident.name=鑽石製三叉戟 +item.npcBronzeTrident.name=銅製三叉戟 +item.npcEmeraldTrident.name=綠寶石三叉戟 +item.npcCursedTrident.name=被詛咒的三叉戟 + +item.npcNatureSpell.name=大自然法術 +item.npcArcaneSpell.name=神祕的法術 +item.npcLightningSpell.name=閃電法術 +item.npcIceSpell.name=冰系法術 +item.npcFireSpell.name=火系法術 +item.npcDarkSpell.name=黑暗法術 +item.npcHolySpell.name=聖靈法術 + +item.npcKunai.name=苦無 +item.npcReverseKunai.name=反向苦無 +item.npcShuriken.name=飛鏢 +item.npcGiantShuriken.name=巨大飛鏢 +item.npcKatana.name=武士刀 +item.npcKukri.name=喀爾克大彎刀 + +item.npcGolfClub.name=高爾夫俱樂部 +item.npcMagicWand.name=魔杖 +item.npcChickenSword.name=雞之劍 +item.npcHandCuffs.name=手銬 +item.npcHammer.name=錘 +item.npcBaseballBat.name=棒球棒 +item.npcLeadPipe.name=鉛管 +item.npcCleaver.name=肉刀 +item.npcSaber.name=軍刀 +item.npcHockeyStick.name=曲棍球棒 +item.npcSledgeHammer.name=大錘 +item.npcBrokenBottle.name=破碎的瓶子 +item.npcCombatKnive.name=戰鬥刀 +item.npcLighter.name=打火機 +item.npcBatton.name=警棍 +item.npcGunChainsaw.name=電鋸槍 +item.npcRapier.name=西洋劍 +item.npcCrowbar.name=撬棍 +item.npcPipeWrench.name=管鉗 +item.npcWrench.name=把手 +item.npcSwissArmyKnife.name=瑞士軍刀 + +item.npcWoodenShield.name=木圓盾 +item.npcStoneShield.name=石圓盾 +item.npcIronShield.name=鐵圓盾 +item.npcGoldenShield.name=金圓盾 +item.npcDiaShield.name=鑽石圓盾 +item.npcBronzeShield.name=青銅圓盾 +item.npcEmeraldShield.name=綠寶石圓盾 +item.npcFullWoodenShield.name=木盾牌 +item.npcFullStoneShield.name=石盾牌 +item.npcFullIronShield.name=鐵盾牌 +item.npcFullGoldenShield.name=金盾牌 +item.npcFullDiaShield.name=鑽石盾牌 +item.npcFullBronzeShield.name=青銅盾牌 +item.npcFullEmeraldShield.name=綠寶石盾牌 + +item.npcTowerShield.name=尖鋼盾 +item.npcCryscentShield.name=新月鋼盾 +item.npcScutumShield.name=鱗甲鋼盾 +item.npcHeaterShield.name=騎士鋼盾 + +item.npcWoodenSpear.name=木矛 +item.npcStoneSpear.name=石矛 +item.npcIronSpear.name=鐵矛 +item.npcGoldenSpear.name=金矛 +item.npcDiamondSpear.name=鑽石矛 +item.npcBronzeSpear.name=青銅矛 +item.npcEmeraldSpear.name=綠寶石矛 + +item.npcWoodenBattleAxe.name=木戰斧 +item.npcStoneBattleAxe.name=石戰斧 +item.npcIronBattleAxe.name=鐵戰斧 +item.npcGoldenBattleAxe.name=金戰斧 +item.npcDiamondBattleAxe.name=鑽石戰斧 +item.npcBronzeBattleAxe.name=青銅戰斧 +item.npcEmeraldBattleAxe.name=綠寶石戰斧 + +item.npcWoodenMace.name=木錘 +item.npcStoneMace.name=石錘 +item.npcIronMace.name=鐵錘 +item.npcGoldenMace.name=金錘 +item.npcDiamondMace.name=鑽石錘 +item.npcBronzeMace.name=青銅錘 +item.npcEmeraldMace.name=綠寶石錘 + +item.npcWoodenDagger.name=木匕首 +item.npcStoneDagger.name=石匕首 +item.npcIronDagger.name=鐵匕首 +item.npcGoldenDagger.name=金匕首 +item.npcDiamondDagger.name=鑽石匕首 +item.npcBronzeDagger.name=青銅匕首 +item.npcEmeraldDagger.name=綠寶石匕首 +item.npcWoodenReversedDagger.name=反手木匕首 +item.npcStoneReversedDagger.name=反手石匕首 +item.npcIronReversedDagger.name=反手鐵匕首 +item.npcGoldenReversedDagger.name=反手金匕首 +item.npcDiamondReversedDagger.name=反手鑽石匕首 +item.npcBronzeReversedDagger.name=反手青銅匕首 +item.npcEmeraldReversedDagger.name=反手綠寶石匕首 + +item.npcWoodenStaff.name=木魔杖 +item.npcStoneStaff.name=石魔杖 +item.npcIronStaff.name=鐵魔杖 +item.npcGoldenStaff.name=金魔杖 +item.npcDiamondStaff.name=鑽石魔杖 +item.npcBronzeStaff.name=青銅魔杖 +item.npcEmeraldStaff.name=綠寶石魔杖 +item.npcElementalStaff.name=元素魔杖 + +item.npcWoodenScythe.name=木鐮刀 +item.npcStoneScythe.name=石鐮刀 +item.npcIronScythe.name=鐵鐮刀 +item.npcGoldenScythe.name=金鐮刀 +item.npcBronzeScythe.name=青銅鐮刀 +item.npcDiamondScythe.name=鑽石鐮刀 +item.npcEmeraldScythe.name=綠寶石鐮刀 + +item.npcWoodenGlaive.name=木製長勾刀 +item.npcStoneGlaive.name=石製長勾刀 +item.npcIronGlaive.name=鐵製長勾刀 +item.npcGoldenGlaive.name=金製長勾刀 +item.npcDiamondGlaive.name=鑽石製長勾刀 +item.npcBronzeGlaive.name=青銅製長勾刀 +item.npcEmeraldGlaive.name=綠寶石長勾刀 + +item.npcCowleatherHead.name=牛皮頭盔 +item.npcCowleatherChest.name=牛皮鎧甲 +item.npcCowleatherLegs.name=牛皮護腿 +item.npcCowleatherBoots.name=牛皮靴 + +item.npcNanorumHead.name=矮人頭盔 +item.npcNanorumChest.name=矮人鎧甲 +item.npcNanorumLegs.name=矮人護腿 +item.npcNanorumBoots.name=矮人靴 + +item.npcTacticalHead.name=軍用頭盔 +item.npcTacticalChest.name=軍用背心 + +item.npcFullLeatherHead.name=純皮製頭盔 +item.npcFullLeatherChest.name=純皮製鎧甲 + +item.npcFullIronHead.name=純鐵頭盔 +item.npcFullIronChest.name=純鐵鎧甲 + +item.npcFullGoldHead.name=純金頭盔 +item.npcFullGoldChest.name=純金鎧甲 + +item.npcFullDiamondHead.name=純鑽石頭盔 +item.npcFullDiamondChest.name=純鑽石鎧甲 + +item.npcFullBronzeHead.name=純青銅頭盔 +item.npcFullBronzeChest.name=純青銅鎧甲 +item.npcFullBronzeLeggings.name=純青銅護腿 +item.npcFullBronzeBoots.name=純青銅靴 + +item.npcFullWoodenHead.name=純木製頭盔 +item.npcFullWoodenChest.name=純木製鎧甲 +item.npcFullWoodenLeggings.name=純木製護腿 +item.npcFullWoodenBoots.name=純木製靴 + +item.npcTuxedoChest.name=燕尾服式襯衫 +item.npcTuxedoPants.name=燕尾服式長褲 +item.npcTuxedoBottom.name=燕尾服式外套 + +item.npcWizardHead.name=巫師帽 +item.npcWizardChest.name=巫師布衣 +item.npcWizardPants.name=巫師布褲 + +item.npcAssassinHead.name=刺客頭盔 +item.npcAssassinChest.name=刺客鎧甲 +item.npcAssassinLeggings.name=刺客護腿 +item.npcAssassinBoots.name=刺客靴 + +item.npcSoldierHead.name=士兵鋼盔 +item.npcSoldierChest.name=士兵鋼鎧 +item.npcSoldierLegs.name=士兵護腿 +item.npcSoldierBottom.name=士兵外套 + +item.npcX407Head.name=X407原型頭盔 +item.npcX407Chest.name=X407原型鎧甲 +item.npcX407Legs.name=X407原型護腿 +item.npcX407Boots.name=X407原型靴 + +item.npcCommissarHead.name=統帥頭盔 +item.npcCommissarChest.name=統帥鎧甲 +item.npcCommissarLegs.name=統帥護腿 +item.npcCommissarBottom.name=統帥靴 + +item.npcInfantryHelmet.name=軍官頭盔 +item.npcOfficerChest.name=軍官服 + +item.npcCrown.name=王冠 +item.npcCrown2.name=王冠 + +item.npcNinjaHead.name=忍者頭 +item.npcNinjaChest.name=忍者上衣 +item.npcNinjaPants.name=忍者下衣 + +item.npcFullEmeraldHead.name=純綠寶石頭盔 +item.npcFullEmeraldChest.name=純綠寶石鎧甲 +item.npcFullEmeraldLeggings.name=純綠寶石護腿 +item.npcFullEmeraldBoots.name=純綠寶石靴 + +item.npcOrb.name=寶珠 +item.npcBrokenOrb.name=破碎的寶珠 +item.npcMana.name=魔力 + +item.npcNinjaClaw.name=忍者鉤 +item.npcSteelClaw.name=鐵鉤 +item.npcBearClaw.name=熊鉤 +item.npcKatar.name=掌心刃 + +item.npcLetter.name=信件 +item.npcPlans.name=計劃圖 +item.npcSatchel.name=冒險者背包 +item.npcBag.name=袋子 +item.npcCrystal.name=水晶 +item.npcSeveredEar.name=受盡痛苦的耳 +item.npcPhone.name=電話 +item.npcBanditMask.name=強盜面具 +item.npcBrokenArrow.name=折斷的箭 +item.npcEarthElement.name=地之元素 +item.npcWaterElement.name=水之元素 +item.npcFireElement.name=火之元素 +item.npcAirElement.name=氣之元素 +item.npcCarKey.name=鑰匙卡 +item.npcKey.name=鑰匙 +item.npcPendant.name=吊飾 +item.npcBlueprint.name=藍圖 +item.npcRing.name=戒指 + +item.npcSkull.name=骷髏頭 +item.npcBronzeIngot.name=銅錠 +item.npcSaphire.name=藍寶石 +item.npcAmethyst.name=紫水晶 +item.npcRuby.name=紅寶石 diff --git a/src/main/resources/assets/customnpcs/sounds.json b/src/main/resources/assets/customnpcs/sounds.json new file mode 100644 index 000000000..9b90149fb --- /dev/null +++ b/src/main/resources/assets/customnpcs/sounds.json @@ -0,0 +1,382 @@ +{ + "gun.empty": { + "category": "player", + "sounds": ["gun/empty"] + }, + "gun.ak47.load": { + "category": "player", + "sounds": ["gun/ak47chamberround"] + }, + "gun.pistol.shot": { + "category": "player", + "sounds": ["gun/pistolshot"] + }, + "gun.pistol.trigger": { + "category": "player", + "sounds": ["gun/pistoltrigger"] + }, + "magic.charge": { + "category": "player", + "sounds": ["magic/charge"] + }, + "magic.shot": { + "category": "player", + "sounds": ["magic/shot"] + }, + "misc.old_explode": { + "category": "player", + "sounds": ["misc/old_explode"] + }, + "misc.swosh": { + "category": "player", + "sounds": ["misc/swosh"] + }, + "songs.excalibur": { + "category": "player", + "sounds": [{"name": "songs/Failboat103 - Excalibuuur", "stream": true}] + }, + "songs.kyleb_7by8": { + "category": "player", + "sounds": [{"name": "songs/TheKyleb - 7 by 8", "stream": true}] + }, + "songs.kyleb_bard": { + "category": "player", + "sounds": [{"name": "songs/TheKyleb - Bard", "stream": true}] + }, + "human.female.evil.attack": { + "category": "player", + "sounds": ["human/female/evil/Attack 1","human/female/evil/Attack 2"] + }, + "human.female.evil.death": { + "category": "player", + "sounds": ["human/female/evil/Death 1","human/female/evil/Death 2"] + }, + "human.female.evil.hurt": { + "category": "player", + "sounds": ["human/female/evil/Hurt 1","human/female/evil/Hurt 2"] + }, + "human.female.evil.what_do_you_need": { + "category": "player", + "sounds": ["human/female/evil/What Do You Need"] + }, + "human.female.evil.what_do_you_want": { + "category": "player", + "sounds": ["human/female/evil/What Do You Want"] + }, + "human.female.evil.yes": { + "category": "player", + "sounds": ["human/female/evil/Yes"] + }, + "human.female.evil.never_defeat_me": { + "category": "player", + "sounds": ["human/female/evil/You Will Never Defeat Me"] + }, + "human.female.heroic.attack": { + "category": "player", + "sounds": ["human/female/heroic/Attack 1","human/female/heroic/Attack 2"] + }, + "human.female.heroic.death": { + "category": "player", + "sounds": ["human/female/heroic/Death 1","human/female/heroic/Death 2"] + }, + "human.female.heroic.hurt": { + "category": "player", + "sounds": ["human/female/heroic/Hurt 1","human/female/heroic/Hurt 2"] + }, + "human.female.heroic.honor_and_glory": { + "category": "player", + "sounds": ["human/female/heroic/For Honor and Glory"] + }, + "human.female.heroic.cleanse_scourge": { + "category": "player", + "sounds": ["human/female/heroic/I Shall Cleanse This Scourge"] + }, + "human.female.heroic.never_fall": { + "category": "player", + "sounds": ["human/female/heroic/I Will Never Fall"] + }, + "human.female.heroic.justice_served": { + "category": "player", + "sounds": ["human/female/heroic/Justice Served"] + }, + "human.female.heroic.be_cleansed": { + "category": "player", + "sounds": ["human/female/heroic/Thou Shall Be Cleansed"] + }, + "human.female.heroic.not_much_time": { + "category": "player", + "sounds": ["human/female/heroic/We Don't Have Much Time"] + }, + "human.female.villager.attack": { + "category": "player", + "sounds": ["human/female/villager/Attack 1","human/female/villager/Attack 2"] + }, + "human.female.villager.death": { + "category": "player", + "sounds": ["human/female/villager/Death 1","human/female/villager/Death 2"] + }, + "human.female.villager.hurt": { + "category": "player", + "sounds": ["human/female/villager/Hurt 1","human/female/villager/Hurt 2"] + }, + "human.female.villager.good_day": { + "category": "player", + "sounds": ["human/female/villager/Good Day"] + }, + "human.female.villager.heh": { + "category": "player", + "sounds": ["human/female/villager/Heh"] + }, + "human.female.villager.help": { + "category": "player", + "sounds": ["human/female/villager/Help"] + }, + "human.female.villager.hm": { + "category": "player", + "sounds": ["human/female/villager/Hm"] + }, + "human.female.villager.uhuh": { + "category": "player", + "sounds": ["human/female/villager/Uhuh"] + }, + "human.female.villager.what_brings_you_here": { + "category": "player", + "sounds": ["human/female/villager/What Brings You Here"] + }, + "human.female.villager.what_do_you_need": { + "category": "player", + "sounds": ["human/female/villager/What Do You Need"] + }, + "human.female.villager.trade": { + "category": "player", + "sounds": ["human/female/villager/Would You Like To Trade"] + }, + "human.female.villager.yes": { + "category": "player", + "sounds": ["human/female/villager/Yes"] + }, + "human.girl.evil.attack": { + "category": "player", + "sounds": ["human/girl/evil/Attack 1","human/girl/evil/Attack 2"] + }, + "human.girl.evil.death": { + "category": "player", + "sounds": ["human/girl/evil/Death 1","human/girl/evil/Death 2"] + }, + "human.girl.evil.hurt": { + "category": "player", + "sounds": ["human/girl/evil/Hurt 1","human/girl/evil/Hurt 2"] + }, + "human.girl.evil.what_do_you_need": { + "category": "player", + "sounds": ["human/girl/evil/What Do You Need"] + }, + "human.girl.evil.what_do_you_want": { + "category": "player", + "sounds": ["human/girl/evil/What Do You Want"] + }, + "human.girl.evil.yes": { + "category": "player", + "sounds": ["human/girl/evil/Yes"] + }, + "human.girl.evil.never_defeat_me": { + "category": "player", + "sounds": ["human/girl/evil/You Will Never Defeat Me"] + }, + "human.girl.heroic.attack": { + "category": "player", + "sounds": ["human/girl/heroic/Attack 1","human/girl/heroic/Attack 2"] + }, + "human.girl.heroic.death": { + "category": "player", + "sounds": ["human/girl/heroic/Death 1","human/girl/heroic/Death 2"] + }, + "human.girl.heroic.hurt": { + "category": "player", + "sounds": ["human/girl/heroic/Hurt 1","human/girl/heroic/Hurt 2"] + }, + "human.girl.heroic.honor_and_glory": { + "category": "player", + "sounds": ["human/girl/heroic/For Honor and Glory"] + }, + "human.girl.heroic.cleanse_scourge": { + "category": "player", + "sounds": ["human/girl/heroic/I Shall Cleanse This Scourge"] + }, + "human.girl.heroic.never_fall": { + "category": "player", + "sounds": ["human/girl/heroic/I Will Never Fall"] + }, + "human.girl.heroic.justice_served": { + "category": "player", + "sounds": ["human/girl/heroic/Justice Served"] + }, + "human.girl.heroic.be_cleansed": { + "category": "player", + "sounds": ["human/girl/heroic/Thou Shall Be Cleansed"] + }, + "human.girl.heroic.not_much_time": { + "category": "player", + "sounds": ["human/girl/heroic/We Don't Have Much Time"] + }, + "human.girl.villager.attack": { + "category": "player", + "sounds": ["human/girl/villager/Attack 1","human/girl/villager/Attack 2"] + }, + "human.girl.villager.death": { + "category": "player", + "sounds": ["human/girl/villager/Death 1","human/girl/villager/Death 2"] + }, + "human.girl.villager.hurt": { + "category": "player", + "sounds": ["human/girl/villager/Hurt 1","human/girl/villager/Hurt 2"] + }, + "human.girl.villager.good_day": { + "category": "player", + "sounds": ["human/girl/villager/Good Day"] + }, + "human.girl.villager.heh": { + "category": "player", + "sounds": ["human/girl/villager/Heh"] + }, + "human.girl.villager.help": { + "category": "player", + "sounds": ["human/girl/villager/Help"] + }, + "human.girl.villager.hm": { + "category": "player", + "sounds": ["human/girl/villager/Hm"] + }, + "human.girl.villager.uhuh": { + "category": "player", + "sounds": ["human/girl/villager/Uhuh"] + }, + "human.girl.villager.what_brings_you_here": { + "category": "player", + "sounds": ["human/girl/villager/What Brings You Here"] + }, + "human.girl.villager.what_do_you_need": { + "category": "player", + "sounds": ["human/girl/villager/What Do You Need"] + }, + "human.girl.villager.trade": { + "category": "player", + "sounds": ["human/girl/villager/Would You Like To Trade"] + }, + "human.girl.villager.yes": { + "category": "player", + "sounds": ["human/girl/villager/Yes"] + }, + "human.male.evil.attack": { + "category": "player", + "sounds": ["human/male/evil/Attack 1","human/male/evil/Attack 2"] + }, + "human.male.evil.death": { + "category": "player", + "sounds": ["human/male/evil/Death 1","human/male/evil/Death 2"] + }, + "human.male.evil.hurt": { + "category": "player", + "sounds": ["human/male/evil/Hurt 1","human/male/evil/Hurt 2"] + }, + "human.male.evil.what_do_you_need": { + "category": "player", + "sounds": ["human/male/evil/What Do You Need"] + }, + "human.male.evil.what_do_you_want": { + "category": "player", + "sounds": ["human/male/evil/What Do You Want"] + }, + "human.male.evil.yes": { + "category": "player", + "sounds": ["human/male/evil/Yes"] + }, + "human.male.evil.never_defeat_me": { + "category": "player", + "sounds": ["human/male/evil/You Will Never Defeat Me"] + }, + "human.male.heroic.attack": { + "category": "player", + "sounds": ["human/male/heroic/Attack 1","human/male/heroic/Attack 2"] + }, + "human.male.heroic.death": { + "category": "player", + "sounds": ["human/male/heroic/Death 1","human/male/heroic/Death 2"] + }, + "human.male.heroic.hurt": { + "category": "player", + "sounds": ["human/male/heroic/Hurt 1","human/male/heroic/Hurt 2"] + }, + "human.male.heroic.honor_and_glory": { + "category": "player", + "sounds": ["human/male/heroic/For Honor and Glory"] + }, + "human.male.heroic.cleanse_scourge": { + "category": "player", + "sounds": ["human/male/heroic/I Shall Cleanse This Scourge"] + }, + "human.male.heroic.never_fall": { + "category": "player", + "sounds": ["human/male/heroic/I Will Never Fall"] + }, + "human.male.heroic.justice_served": { + "category": "player", + "sounds": ["human/male/heroic/Justice Served"] + }, + "human.male.heroic.be_cleansed": { + "category": "player", + "sounds": ["human/male/heroic/Thou Shall Be Cleansed"] + }, + "human.male.heroic.not_much_time": { + "category": "player", + "sounds": ["human/male/heroic/We Don't Have Much Time"] + }, + "human.male.villager.attack": { + "category": "player", + "sounds": ["human/male/villager/Attack 1","human/male/villager/Attack 2"] + }, + "human.male.villager.death": { + "category": "player", + "sounds": ["human/male/villager/Death 1","human/male/villager/Death 2"] + }, + "human.male.villager.hurt": { + "category": "player", + "sounds": ["human/male/villager/Hurt 1","human/male/villager/Hurt 2"] + }, + "human.male.villager.good_day": { + "category": "player", + "sounds": ["human/male/villager/Good Day"] + }, + "human.male.villager.heh": { + "category": "player", + "sounds": ["human/male/villager/Heh"] + }, + "human.male.villager.help": { + "category": "player", + "sounds": ["human/male/villager/Help"] + }, + "human.male.villager.hm": { + "category": "player", + "sounds": ["human/male/villager/Hm"] + }, + "human.male.villager.uhuh": { + "category": "player", + "sounds": ["human/male/villager/Uhuh"] + }, + "human.male.villager.what_brings_you_here": { + "category": "player", + "sounds": ["human/male/villager/What Brings You Here"] + }, + "human.male.villager.what_do_you_need": { + "category": "player", + "sounds": ["human/male/villager/What Do You Need"] + }, + "human.male.villager.trade": { + "category": "player", + "sounds": ["human/male/villager/Would You Like To Trade"] + }, + "human.male.villager.yes": { + "category": "player", + "sounds": ["human/male/villager/Yes"] + } +} \ No newline at end of file diff --git a/src/main/resources/assets/customnpcs/sounds/gun/ak47chamberround.ogg b/src/main/resources/assets/customnpcs/sounds/gun/ak47chamberround.ogg new file mode 100644 index 000000000..31d1dfe42 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/gun/ak47chamberround.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/gun/empty.ogg b/src/main/resources/assets/customnpcs/sounds/gun/empty.ogg new file mode 100644 index 000000000..79cc53eac Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/gun/empty.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/gun/pistolshot.ogg b/src/main/resources/assets/customnpcs/sounds/gun/pistolshot.ogg new file mode 100644 index 000000000..ae4284216 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/gun/pistolshot.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/gun/pistoltrigger.ogg b/src/main/resources/assets/customnpcs/sounds/gun/pistoltrigger.ogg new file mode 100644 index 000000000..31f1d6553 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/gun/pistoltrigger.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/female/evil/Attack 1.ogg b/src/main/resources/assets/customnpcs/sounds/human/female/evil/Attack 1.ogg new file mode 100644 index 000000000..ddc2a8f8c Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/female/evil/Attack 1.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/female/evil/Attack 2.ogg b/src/main/resources/assets/customnpcs/sounds/human/female/evil/Attack 2.ogg new file mode 100644 index 000000000..8aa8b1190 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/female/evil/Attack 2.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/female/evil/Death 1.ogg b/src/main/resources/assets/customnpcs/sounds/human/female/evil/Death 1.ogg new file mode 100644 index 000000000..b1948a30d Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/female/evil/Death 1.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/female/evil/Death 2.ogg b/src/main/resources/assets/customnpcs/sounds/human/female/evil/Death 2.ogg new file mode 100644 index 000000000..08ce43135 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/female/evil/Death 2.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/female/evil/Hurt 1.ogg b/src/main/resources/assets/customnpcs/sounds/human/female/evil/Hurt 1.ogg new file mode 100644 index 000000000..9975c0359 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/female/evil/Hurt 1.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/female/evil/Hurt 2.ogg b/src/main/resources/assets/customnpcs/sounds/human/female/evil/Hurt 2.ogg new file mode 100644 index 000000000..55505e8d5 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/female/evil/Hurt 2.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/female/evil/What Do You Need.ogg b/src/main/resources/assets/customnpcs/sounds/human/female/evil/What Do You Need.ogg new file mode 100644 index 000000000..576e41682 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/female/evil/What Do You Need.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/female/evil/What Do You Want.ogg b/src/main/resources/assets/customnpcs/sounds/human/female/evil/What Do You Want.ogg new file mode 100644 index 000000000..9757aa1b0 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/female/evil/What Do You Want.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/female/evil/Yes.ogg b/src/main/resources/assets/customnpcs/sounds/human/female/evil/Yes.ogg new file mode 100644 index 000000000..9718e28f3 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/female/evil/Yes.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/female/evil/You Will Never Defeat Me.ogg b/src/main/resources/assets/customnpcs/sounds/human/female/evil/You Will Never Defeat Me.ogg new file mode 100644 index 000000000..6bb1a7dfb Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/female/evil/You Will Never Defeat Me.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/female/heroic/Attack 1.ogg b/src/main/resources/assets/customnpcs/sounds/human/female/heroic/Attack 1.ogg new file mode 100644 index 000000000..de9c20c5a Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/female/heroic/Attack 1.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/female/heroic/Attack 2.ogg b/src/main/resources/assets/customnpcs/sounds/human/female/heroic/Attack 2.ogg new file mode 100644 index 000000000..233c160f0 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/female/heroic/Attack 2.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/female/heroic/Death 1.ogg b/src/main/resources/assets/customnpcs/sounds/human/female/heroic/Death 1.ogg new file mode 100644 index 000000000..ed761ea93 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/female/heroic/Death 1.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/female/heroic/Death 2.ogg b/src/main/resources/assets/customnpcs/sounds/human/female/heroic/Death 2.ogg new file mode 100644 index 000000000..f55fe606b Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/female/heroic/Death 2.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/female/heroic/For Honor and Glory.ogg b/src/main/resources/assets/customnpcs/sounds/human/female/heroic/For Honor and Glory.ogg new file mode 100644 index 000000000..ae93831ec Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/female/heroic/For Honor and Glory.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/female/heroic/Hurt 1.ogg b/src/main/resources/assets/customnpcs/sounds/human/female/heroic/Hurt 1.ogg new file mode 100644 index 000000000..8520e3f9d Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/female/heroic/Hurt 1.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/female/heroic/Hurt 2.ogg b/src/main/resources/assets/customnpcs/sounds/human/female/heroic/Hurt 2.ogg new file mode 100644 index 000000000..81a359c69 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/female/heroic/Hurt 2.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/female/heroic/I Shall Cleanse This Scourge.ogg b/src/main/resources/assets/customnpcs/sounds/human/female/heroic/I Shall Cleanse This Scourge.ogg new file mode 100644 index 000000000..fee574d1e Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/female/heroic/I Shall Cleanse This Scourge.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/female/heroic/I Will Never Fall.ogg b/src/main/resources/assets/customnpcs/sounds/human/female/heroic/I Will Never Fall.ogg new file mode 100644 index 000000000..bc658351a Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/female/heroic/I Will Never Fall.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/female/heroic/Justice Served.ogg b/src/main/resources/assets/customnpcs/sounds/human/female/heroic/Justice Served.ogg new file mode 100644 index 000000000..fe53c101d Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/female/heroic/Justice Served.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/female/heroic/Thou Shall Be Cleansed.ogg b/src/main/resources/assets/customnpcs/sounds/human/female/heroic/Thou Shall Be Cleansed.ogg new file mode 100644 index 000000000..26bb7e4ac Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/female/heroic/Thou Shall Be Cleansed.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/female/heroic/We Don't Have Much Time.ogg b/src/main/resources/assets/customnpcs/sounds/human/female/heroic/We Don't Have Much Time.ogg new file mode 100644 index 000000000..9f27eb265 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/female/heroic/We Don't Have Much Time.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/female/villager/Attack 1.ogg b/src/main/resources/assets/customnpcs/sounds/human/female/villager/Attack 1.ogg new file mode 100644 index 000000000..85a9b39f6 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/female/villager/Attack 1.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/female/villager/Attack 2.ogg b/src/main/resources/assets/customnpcs/sounds/human/female/villager/Attack 2.ogg new file mode 100644 index 000000000..60838072e Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/female/villager/Attack 2.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/female/villager/Death 1.ogg b/src/main/resources/assets/customnpcs/sounds/human/female/villager/Death 1.ogg new file mode 100644 index 000000000..30b87d32e Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/female/villager/Death 1.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/female/villager/Death 2.ogg b/src/main/resources/assets/customnpcs/sounds/human/female/villager/Death 2.ogg new file mode 100644 index 000000000..7ea4d1bb1 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/female/villager/Death 2.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/female/villager/Good Day.ogg b/src/main/resources/assets/customnpcs/sounds/human/female/villager/Good Day.ogg new file mode 100644 index 000000000..847b83451 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/female/villager/Good Day.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/female/villager/Heh.ogg b/src/main/resources/assets/customnpcs/sounds/human/female/villager/Heh.ogg new file mode 100644 index 000000000..b75379a06 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/female/villager/Heh.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/female/villager/Help.ogg b/src/main/resources/assets/customnpcs/sounds/human/female/villager/Help.ogg new file mode 100644 index 000000000..4a201e7ff Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/female/villager/Help.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/female/villager/Hm.ogg b/src/main/resources/assets/customnpcs/sounds/human/female/villager/Hm.ogg new file mode 100644 index 000000000..9d649f8cb Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/female/villager/Hm.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/female/villager/Hurt 1.ogg b/src/main/resources/assets/customnpcs/sounds/human/female/villager/Hurt 1.ogg new file mode 100644 index 000000000..839ea05e7 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/female/villager/Hurt 1.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/female/villager/Hurt 2.ogg b/src/main/resources/assets/customnpcs/sounds/human/female/villager/Hurt 2.ogg new file mode 100644 index 000000000..5e86c7d7d Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/female/villager/Hurt 2.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/female/villager/Uhuh.ogg b/src/main/resources/assets/customnpcs/sounds/human/female/villager/Uhuh.ogg new file mode 100644 index 000000000..e29d70edc Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/female/villager/Uhuh.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/female/villager/What Brings You Here.ogg b/src/main/resources/assets/customnpcs/sounds/human/female/villager/What Brings You Here.ogg new file mode 100644 index 000000000..fff2c5468 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/female/villager/What Brings You Here.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/female/villager/What Do You Need.ogg b/src/main/resources/assets/customnpcs/sounds/human/female/villager/What Do You Need.ogg new file mode 100644 index 000000000..27340e7c6 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/female/villager/What Do You Need.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/female/villager/Would You Like To Trade.ogg b/src/main/resources/assets/customnpcs/sounds/human/female/villager/Would You Like To Trade.ogg new file mode 100644 index 000000000..5034ea12c Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/female/villager/Would You Like To Trade.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/female/villager/Yes.ogg b/src/main/resources/assets/customnpcs/sounds/human/female/villager/Yes.ogg new file mode 100644 index 000000000..ebc22a280 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/female/villager/Yes.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/girl/evil/Attack 1.ogg b/src/main/resources/assets/customnpcs/sounds/human/girl/evil/Attack 1.ogg new file mode 100644 index 000000000..2e38e5816 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/girl/evil/Attack 1.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/girl/evil/Attack 2.ogg b/src/main/resources/assets/customnpcs/sounds/human/girl/evil/Attack 2.ogg new file mode 100644 index 000000000..8eb074f5b Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/girl/evil/Attack 2.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/girl/evil/Death 1.ogg b/src/main/resources/assets/customnpcs/sounds/human/girl/evil/Death 1.ogg new file mode 100644 index 000000000..d70106bf4 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/girl/evil/Death 1.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/girl/evil/Death 2.ogg b/src/main/resources/assets/customnpcs/sounds/human/girl/evil/Death 2.ogg new file mode 100644 index 000000000..186d77862 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/girl/evil/Death 2.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/girl/evil/Hurt 1.ogg b/src/main/resources/assets/customnpcs/sounds/human/girl/evil/Hurt 1.ogg new file mode 100644 index 000000000..03e74ee42 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/girl/evil/Hurt 1.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/girl/evil/Hurt 2.ogg b/src/main/resources/assets/customnpcs/sounds/human/girl/evil/Hurt 2.ogg new file mode 100644 index 000000000..d0532ae29 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/girl/evil/Hurt 2.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/girl/evil/What Do You Need.ogg b/src/main/resources/assets/customnpcs/sounds/human/girl/evil/What Do You Need.ogg new file mode 100644 index 000000000..1214d6c00 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/girl/evil/What Do You Need.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/girl/evil/What Do You Want.ogg b/src/main/resources/assets/customnpcs/sounds/human/girl/evil/What Do You Want.ogg new file mode 100644 index 000000000..7f6fabdd0 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/girl/evil/What Do You Want.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/girl/evil/Yes.ogg b/src/main/resources/assets/customnpcs/sounds/human/girl/evil/Yes.ogg new file mode 100644 index 000000000..417ed918a Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/girl/evil/Yes.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/girl/evil/You Will Never Defeat Me.ogg b/src/main/resources/assets/customnpcs/sounds/human/girl/evil/You Will Never Defeat Me.ogg new file mode 100644 index 000000000..2f917af2c Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/girl/evil/You Will Never Defeat Me.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/girl/heroic/Attack 1.ogg b/src/main/resources/assets/customnpcs/sounds/human/girl/heroic/Attack 1.ogg new file mode 100644 index 000000000..dbd4c348d Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/girl/heroic/Attack 1.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/girl/heroic/Attack 2.ogg b/src/main/resources/assets/customnpcs/sounds/human/girl/heroic/Attack 2.ogg new file mode 100644 index 000000000..de33d0de3 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/girl/heroic/Attack 2.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/girl/heroic/Death 1.ogg b/src/main/resources/assets/customnpcs/sounds/human/girl/heroic/Death 1.ogg new file mode 100644 index 000000000..999065637 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/girl/heroic/Death 1.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/girl/heroic/Death 2.ogg b/src/main/resources/assets/customnpcs/sounds/human/girl/heroic/Death 2.ogg new file mode 100644 index 000000000..0b3028487 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/girl/heroic/Death 2.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/girl/heroic/For Honor and Glory.ogg b/src/main/resources/assets/customnpcs/sounds/human/girl/heroic/For Honor and Glory.ogg new file mode 100644 index 000000000..4faf3e51e Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/girl/heroic/For Honor and Glory.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/girl/heroic/Hurt 1.ogg b/src/main/resources/assets/customnpcs/sounds/human/girl/heroic/Hurt 1.ogg new file mode 100644 index 000000000..7641e8ccb Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/girl/heroic/Hurt 1.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/girl/heroic/Hurt 2.ogg b/src/main/resources/assets/customnpcs/sounds/human/girl/heroic/Hurt 2.ogg new file mode 100644 index 000000000..992a4bc55 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/girl/heroic/Hurt 2.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/girl/heroic/I Shall Cleanse This Scourge.ogg b/src/main/resources/assets/customnpcs/sounds/human/girl/heroic/I Shall Cleanse This Scourge.ogg new file mode 100644 index 000000000..92ec5e0f4 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/girl/heroic/I Shall Cleanse This Scourge.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/girl/heroic/I Will Never Fall.ogg b/src/main/resources/assets/customnpcs/sounds/human/girl/heroic/I Will Never Fall.ogg new file mode 100644 index 000000000..18ff829db Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/girl/heroic/I Will Never Fall.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/girl/heroic/Justice Served.ogg b/src/main/resources/assets/customnpcs/sounds/human/girl/heroic/Justice Served.ogg new file mode 100644 index 000000000..0e70bf319 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/girl/heroic/Justice Served.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/girl/heroic/Thou Shall Be Cleansed.ogg b/src/main/resources/assets/customnpcs/sounds/human/girl/heroic/Thou Shall Be Cleansed.ogg new file mode 100644 index 000000000..e62f763db Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/girl/heroic/Thou Shall Be Cleansed.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/girl/heroic/We Don't Have Much Time.ogg b/src/main/resources/assets/customnpcs/sounds/human/girl/heroic/We Don't Have Much Time.ogg new file mode 100644 index 000000000..7a1d4f7cc Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/girl/heroic/We Don't Have Much Time.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/girl/villager/Attack 1.ogg b/src/main/resources/assets/customnpcs/sounds/human/girl/villager/Attack 1.ogg new file mode 100644 index 000000000..42001e0ab Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/girl/villager/Attack 1.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/girl/villager/Attack 2.ogg b/src/main/resources/assets/customnpcs/sounds/human/girl/villager/Attack 2.ogg new file mode 100644 index 000000000..8e95b6d45 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/girl/villager/Attack 2.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/girl/villager/Death 1.ogg b/src/main/resources/assets/customnpcs/sounds/human/girl/villager/Death 1.ogg new file mode 100644 index 000000000..33c24ad29 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/girl/villager/Death 1.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/girl/villager/Death 2.ogg b/src/main/resources/assets/customnpcs/sounds/human/girl/villager/Death 2.ogg new file mode 100644 index 000000000..fa06f5669 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/girl/villager/Death 2.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/girl/villager/Good Day.ogg b/src/main/resources/assets/customnpcs/sounds/human/girl/villager/Good Day.ogg new file mode 100644 index 000000000..5cdaa77aa Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/girl/villager/Good Day.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/girl/villager/Heh.ogg b/src/main/resources/assets/customnpcs/sounds/human/girl/villager/Heh.ogg new file mode 100644 index 000000000..87f6674ec Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/girl/villager/Heh.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/girl/villager/Help.ogg b/src/main/resources/assets/customnpcs/sounds/human/girl/villager/Help.ogg new file mode 100644 index 000000000..0c2f87e15 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/girl/villager/Help.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/girl/villager/Hm.ogg b/src/main/resources/assets/customnpcs/sounds/human/girl/villager/Hm.ogg new file mode 100644 index 000000000..088e02859 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/girl/villager/Hm.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/girl/villager/Hurt 1.ogg b/src/main/resources/assets/customnpcs/sounds/human/girl/villager/Hurt 1.ogg new file mode 100644 index 000000000..12e2eb4d1 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/girl/villager/Hurt 1.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/girl/villager/Hurt 2.ogg b/src/main/resources/assets/customnpcs/sounds/human/girl/villager/Hurt 2.ogg new file mode 100644 index 000000000..b0adb9bc9 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/girl/villager/Hurt 2.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/girl/villager/Uhuh.ogg b/src/main/resources/assets/customnpcs/sounds/human/girl/villager/Uhuh.ogg new file mode 100644 index 000000000..a8324319d Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/girl/villager/Uhuh.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/girl/villager/What Brings You Here.ogg b/src/main/resources/assets/customnpcs/sounds/human/girl/villager/What Brings You Here.ogg new file mode 100644 index 000000000..81e2a4948 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/girl/villager/What Brings You Here.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/girl/villager/What Do You Need.ogg b/src/main/resources/assets/customnpcs/sounds/human/girl/villager/What Do You Need.ogg new file mode 100644 index 000000000..189824c2c Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/girl/villager/What Do You Need.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/girl/villager/Would You Like To Trade.ogg b/src/main/resources/assets/customnpcs/sounds/human/girl/villager/Would You Like To Trade.ogg new file mode 100644 index 000000000..761dfc2fb Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/girl/villager/Would You Like To Trade.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/girl/villager/Yes.ogg b/src/main/resources/assets/customnpcs/sounds/human/girl/villager/Yes.ogg new file mode 100644 index 000000000..a0a6838e2 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/girl/villager/Yes.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/male/evil/Attack 1.ogg b/src/main/resources/assets/customnpcs/sounds/human/male/evil/Attack 1.ogg new file mode 100644 index 000000000..6958132f1 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/male/evil/Attack 1.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/male/evil/Attack 2.ogg b/src/main/resources/assets/customnpcs/sounds/human/male/evil/Attack 2.ogg new file mode 100644 index 000000000..6b8541a5f Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/male/evil/Attack 2.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/male/evil/Death 1.ogg b/src/main/resources/assets/customnpcs/sounds/human/male/evil/Death 1.ogg new file mode 100644 index 000000000..b0e9c41e1 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/male/evil/Death 1.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/male/evil/Death 2.ogg b/src/main/resources/assets/customnpcs/sounds/human/male/evil/Death 2.ogg new file mode 100644 index 000000000..c8f133f47 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/male/evil/Death 2.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/male/evil/Hurt 1.ogg b/src/main/resources/assets/customnpcs/sounds/human/male/evil/Hurt 1.ogg new file mode 100644 index 000000000..b394a5be1 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/male/evil/Hurt 1.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/male/evil/Hurt 2.ogg b/src/main/resources/assets/customnpcs/sounds/human/male/evil/Hurt 2.ogg new file mode 100644 index 000000000..25bb1dbeb Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/male/evil/Hurt 2.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/male/evil/What Do You Need.ogg b/src/main/resources/assets/customnpcs/sounds/human/male/evil/What Do You Need.ogg new file mode 100644 index 000000000..2ea7fcd37 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/male/evil/What Do You Need.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/male/evil/What Do You Want.ogg b/src/main/resources/assets/customnpcs/sounds/human/male/evil/What Do You Want.ogg new file mode 100644 index 000000000..7b5430628 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/male/evil/What Do You Want.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/male/evil/Yes.ogg b/src/main/resources/assets/customnpcs/sounds/human/male/evil/Yes.ogg new file mode 100644 index 000000000..380c91d37 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/male/evil/Yes.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/male/evil/You Will Never Defeat Me.ogg b/src/main/resources/assets/customnpcs/sounds/human/male/evil/You Will Never Defeat Me.ogg new file mode 100644 index 000000000..8cd9cf727 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/male/evil/You Will Never Defeat Me.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/male/heroic/Attack 1.ogg b/src/main/resources/assets/customnpcs/sounds/human/male/heroic/Attack 1.ogg new file mode 100644 index 000000000..73dbd32f9 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/male/heroic/Attack 1.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/male/heroic/Attack 2.ogg b/src/main/resources/assets/customnpcs/sounds/human/male/heroic/Attack 2.ogg new file mode 100644 index 000000000..ef59741ec Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/male/heroic/Attack 2.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/male/heroic/Death 1.ogg b/src/main/resources/assets/customnpcs/sounds/human/male/heroic/Death 1.ogg new file mode 100644 index 000000000..3407c5849 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/male/heroic/Death 1.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/male/heroic/Death 2.ogg b/src/main/resources/assets/customnpcs/sounds/human/male/heroic/Death 2.ogg new file mode 100644 index 000000000..5b7032952 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/male/heroic/Death 2.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/male/heroic/For Honor and Glory.ogg b/src/main/resources/assets/customnpcs/sounds/human/male/heroic/For Honor and Glory.ogg new file mode 100644 index 000000000..4b14c38b0 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/male/heroic/For Honor and Glory.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/male/heroic/Hurt 1.ogg b/src/main/resources/assets/customnpcs/sounds/human/male/heroic/Hurt 1.ogg new file mode 100644 index 000000000..bfe30d869 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/male/heroic/Hurt 1.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/male/heroic/Hurt 2.ogg b/src/main/resources/assets/customnpcs/sounds/human/male/heroic/Hurt 2.ogg new file mode 100644 index 000000000..3fabab5f4 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/male/heroic/Hurt 2.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/male/heroic/I Shall Cleanse This Scourge.ogg b/src/main/resources/assets/customnpcs/sounds/human/male/heroic/I Shall Cleanse This Scourge.ogg new file mode 100644 index 000000000..963b4b4e6 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/male/heroic/I Shall Cleanse This Scourge.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/male/heroic/I Will Never Fall.ogg b/src/main/resources/assets/customnpcs/sounds/human/male/heroic/I Will Never Fall.ogg new file mode 100644 index 000000000..1e6c25ddb Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/male/heroic/I Will Never Fall.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/male/heroic/Justice Served.ogg b/src/main/resources/assets/customnpcs/sounds/human/male/heroic/Justice Served.ogg new file mode 100644 index 000000000..735f0382a Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/male/heroic/Justice Served.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/male/heroic/Thou Shall Be Cleansed.ogg b/src/main/resources/assets/customnpcs/sounds/human/male/heroic/Thou Shall Be Cleansed.ogg new file mode 100644 index 000000000..6923d97dc Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/male/heroic/Thou Shall Be Cleansed.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/male/heroic/We Don't Have Much Time.ogg b/src/main/resources/assets/customnpcs/sounds/human/male/heroic/We Don't Have Much Time.ogg new file mode 100644 index 000000000..7c353199d Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/male/heroic/We Don't Have Much Time.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/male/villager/Attack 1.ogg b/src/main/resources/assets/customnpcs/sounds/human/male/villager/Attack 1.ogg new file mode 100644 index 000000000..029b4b722 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/male/villager/Attack 1.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/male/villager/Attack 2.ogg b/src/main/resources/assets/customnpcs/sounds/human/male/villager/Attack 2.ogg new file mode 100644 index 000000000..84ef2410e Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/male/villager/Attack 2.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/male/villager/Death 1.ogg b/src/main/resources/assets/customnpcs/sounds/human/male/villager/Death 1.ogg new file mode 100644 index 000000000..6532cb3ce Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/male/villager/Death 1.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/male/villager/Death 2.ogg b/src/main/resources/assets/customnpcs/sounds/human/male/villager/Death 2.ogg new file mode 100644 index 000000000..a079a30b8 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/male/villager/Death 2.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/male/villager/Good Day.ogg b/src/main/resources/assets/customnpcs/sounds/human/male/villager/Good Day.ogg new file mode 100644 index 000000000..db3397909 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/male/villager/Good Day.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/male/villager/Heh.ogg b/src/main/resources/assets/customnpcs/sounds/human/male/villager/Heh.ogg new file mode 100644 index 000000000..1be180d19 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/male/villager/Heh.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/male/villager/Help.ogg b/src/main/resources/assets/customnpcs/sounds/human/male/villager/Help.ogg new file mode 100644 index 000000000..3c049ae83 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/male/villager/Help.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/male/villager/Hm.ogg b/src/main/resources/assets/customnpcs/sounds/human/male/villager/Hm.ogg new file mode 100644 index 000000000..8d0a5880d Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/male/villager/Hm.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/male/villager/Hurt 1.ogg b/src/main/resources/assets/customnpcs/sounds/human/male/villager/Hurt 1.ogg new file mode 100644 index 000000000..16e142e2e Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/male/villager/Hurt 1.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/male/villager/Hurt 2.ogg b/src/main/resources/assets/customnpcs/sounds/human/male/villager/Hurt 2.ogg new file mode 100644 index 000000000..470fbd11c Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/male/villager/Hurt 2.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/male/villager/Uhuh.ogg b/src/main/resources/assets/customnpcs/sounds/human/male/villager/Uhuh.ogg new file mode 100644 index 000000000..fc5fc7926 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/male/villager/Uhuh.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/male/villager/What Brings You Here.ogg b/src/main/resources/assets/customnpcs/sounds/human/male/villager/What Brings You Here.ogg new file mode 100644 index 000000000..69fd16f6f Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/male/villager/What Brings You Here.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/male/villager/What Do You Need.ogg b/src/main/resources/assets/customnpcs/sounds/human/male/villager/What Do You Need.ogg new file mode 100644 index 000000000..f0fa835ac Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/male/villager/What Do You Need.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/male/villager/Would You Like To Trade.ogg b/src/main/resources/assets/customnpcs/sounds/human/male/villager/Would You Like To Trade.ogg new file mode 100644 index 000000000..54e5c862b Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/male/villager/Would You Like To Trade.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/human/male/villager/Yes.ogg b/src/main/resources/assets/customnpcs/sounds/human/male/villager/Yes.ogg new file mode 100644 index 000000000..70a2c466c Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/human/male/villager/Yes.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/magic/charge.ogg b/src/main/resources/assets/customnpcs/sounds/magic/charge.ogg new file mode 100644 index 000000000..2bd14f99b Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/magic/charge.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/magic/shot.ogg b/src/main/resources/assets/customnpcs/sounds/magic/shot.ogg new file mode 100644 index 000000000..b524ef80d Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/magic/shot.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/misc/old_explode.ogg b/src/main/resources/assets/customnpcs/sounds/misc/old_explode.ogg new file mode 100644 index 000000000..a414ea046 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/misc/old_explode.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/misc/swosh.ogg b/src/main/resources/assets/customnpcs/sounds/misc/swosh.ogg new file mode 100644 index 000000000..2250e5d30 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/misc/swosh.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/songs/Failboat103 - Excalibuuur.ogg b/src/main/resources/assets/customnpcs/sounds/songs/Failboat103 - Excalibuuur.ogg new file mode 100644 index 000000000..ffccdde18 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/songs/Failboat103 - Excalibuuur.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/songs/TheKyleb - 7 by 8.ogg b/src/main/resources/assets/customnpcs/sounds/songs/TheKyleb - 7 by 8.ogg new file mode 100644 index 000000000..0d29e43a8 Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/songs/TheKyleb - 7 by 8.ogg differ diff --git a/src/main/resources/assets/customnpcs/sounds/songs/TheKyleb - Bard.ogg b/src/main/resources/assets/customnpcs/sounds/songs/TheKyleb - Bard.ogg new file mode 100644 index 000000000..cb0020bcd Binary files /dev/null and b/src/main/resources/assets/customnpcs/sounds/songs/TheKyleb - Bard.ogg differ diff --git a/src/main/resources/assets/customnpcs/textures/armor/assassin_1.png b/src/main/resources/assets/customnpcs/textures/armor/assassin_1.png new file mode 100644 index 000000000..453efef41 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/armor/assassin_1.png differ diff --git a/src/main/resources/assets/customnpcs/textures/armor/assassin_2.png b/src/main/resources/assets/customnpcs/textures/armor/assassin_2.png new file mode 100644 index 000000000..e01ce202e Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/armor/assassin_2.png differ diff --git a/src/main/resources/assets/customnpcs/textures/armor/commissar_1.png b/src/main/resources/assets/customnpcs/textures/armor/commissar_1.png new file mode 100644 index 000000000..d325e8bd7 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/armor/commissar_1.png differ diff --git a/src/main/resources/assets/customnpcs/textures/armor/commissar_2.png b/src/main/resources/assets/customnpcs/textures/armor/commissar_2.png new file mode 100644 index 000000000..01b42be0f Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/armor/commissar_2.png differ diff --git a/src/main/resources/assets/customnpcs/textures/armor/cowleather_1.png b/src/main/resources/assets/customnpcs/textures/armor/cowleather_1.png new file mode 100644 index 000000000..f769f803c Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/armor/cowleather_1.png differ diff --git a/src/main/resources/assets/customnpcs/textures/armor/cowleather_2.png b/src/main/resources/assets/customnpcs/textures/armor/cowleather_2.png new file mode 100644 index 000000000..2228ab24e Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/armor/cowleather_2.png differ diff --git a/src/main/resources/assets/customnpcs/textures/armor/crown1_1.png b/src/main/resources/assets/customnpcs/textures/armor/crown1_1.png new file mode 100644 index 000000000..541e418fe Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/armor/crown1_1.png differ diff --git a/src/main/resources/assets/customnpcs/textures/armor/crown2_1.png b/src/main/resources/assets/customnpcs/textures/armor/crown2_1.png new file mode 100644 index 000000000..e7e36f376 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/armor/crown2_1.png differ diff --git a/src/main/resources/assets/customnpcs/textures/armor/demonic_1.png b/src/main/resources/assets/customnpcs/textures/armor/demonic_1.png new file mode 100644 index 000000000..0a193a964 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/armor/demonic_1.png differ diff --git a/src/main/resources/assets/customnpcs/textures/armor/demonic_2.png b/src/main/resources/assets/customnpcs/textures/armor/demonic_2.png new file mode 100644 index 000000000..ecaccbf61 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/armor/demonic_2.png differ diff --git a/src/main/resources/assets/customnpcs/textures/armor/fullbronze_1.png b/src/main/resources/assets/customnpcs/textures/armor/fullbronze_1.png new file mode 100644 index 000000000..397921455 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/armor/fullbronze_1.png differ diff --git a/src/main/resources/assets/customnpcs/textures/armor/fullbronze_2.png b/src/main/resources/assets/customnpcs/textures/armor/fullbronze_2.png new file mode 100644 index 000000000..a187b5273 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/armor/fullbronze_2.png differ diff --git a/src/main/resources/assets/customnpcs/textures/armor/fullcloth_1.png b/src/main/resources/assets/customnpcs/textures/armor/fullcloth_1.png new file mode 100644 index 000000000..ae240874a Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/armor/fullcloth_1.png differ diff --git a/src/main/resources/assets/customnpcs/textures/armor/fulldiamond_1.png b/src/main/resources/assets/customnpcs/textures/armor/fulldiamond_1.png new file mode 100644 index 000000000..e4a8e28d8 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/armor/fulldiamond_1.png differ diff --git a/src/main/resources/assets/customnpcs/textures/armor/fullemerald_1.png b/src/main/resources/assets/customnpcs/textures/armor/fullemerald_1.png new file mode 100644 index 000000000..9e1abeeda Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/armor/fullemerald_1.png differ diff --git a/src/main/resources/assets/customnpcs/textures/armor/fullemerald_2.png b/src/main/resources/assets/customnpcs/textures/armor/fullemerald_2.png new file mode 100644 index 000000000..73ede57bd Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/armor/fullemerald_2.png differ diff --git a/src/main/resources/assets/customnpcs/textures/armor/fullgold_1.png b/src/main/resources/assets/customnpcs/textures/armor/fullgold_1.png new file mode 100644 index 000000000..b27e0aae4 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/armor/fullgold_1.png differ diff --git a/src/main/resources/assets/customnpcs/textures/armor/fulliron_1.png b/src/main/resources/assets/customnpcs/textures/armor/fulliron_1.png new file mode 100644 index 000000000..e06cd888c Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/armor/fulliron_1.png differ diff --git a/src/main/resources/assets/customnpcs/textures/armor/fullwood_1.png b/src/main/resources/assets/customnpcs/textures/armor/fullwood_1.png new file mode 100644 index 000000000..b6c082315 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/armor/fullwood_1.png differ diff --git a/src/main/resources/assets/customnpcs/textures/armor/fullwood_2.png b/src/main/resources/assets/customnpcs/textures/armor/fullwood_2.png new file mode 100644 index 000000000..3aba06c9d Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/armor/fullwood_2.png differ diff --git a/src/main/resources/assets/customnpcs/textures/armor/infantry_1.png b/src/main/resources/assets/customnpcs/textures/armor/infantry_1.png new file mode 100644 index 000000000..52cecd9a9 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/armor/infantry_1.png differ diff --git a/src/main/resources/assets/customnpcs/textures/armor/mask_1.png b/src/main/resources/assets/customnpcs/textures/armor/mask_1.png new file mode 100644 index 000000000..4d757c80b Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/armor/mask_1.png differ diff --git a/src/main/resources/assets/customnpcs/textures/armor/mithril_1.png b/src/main/resources/assets/customnpcs/textures/armor/mithril_1.png new file mode 100644 index 000000000..66924412e Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/armor/mithril_1.png differ diff --git a/src/main/resources/assets/customnpcs/textures/armor/mithril_2.png b/src/main/resources/assets/customnpcs/textures/armor/mithril_2.png new file mode 100644 index 000000000..8c9e43989 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/armor/mithril_2.png differ diff --git a/src/main/resources/assets/customnpcs/textures/armor/nanorum_1.png b/src/main/resources/assets/customnpcs/textures/armor/nanorum_1.png new file mode 100644 index 000000000..6b74f40ca Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/armor/nanorum_1.png differ diff --git a/src/main/resources/assets/customnpcs/textures/armor/nanorum_2.png b/src/main/resources/assets/customnpcs/textures/armor/nanorum_2.png new file mode 100644 index 000000000..d7dfb8fa2 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/armor/nanorum_2.png differ diff --git a/src/main/resources/assets/customnpcs/textures/armor/ninja_1.png b/src/main/resources/assets/customnpcs/textures/armor/ninja_1.png new file mode 100644 index 000000000..0b66ab58d Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/armor/ninja_1.png differ diff --git a/src/main/resources/assets/customnpcs/textures/armor/ninja_2.png b/src/main/resources/assets/customnpcs/textures/armor/ninja_2.png new file mode 100644 index 000000000..38579b4f9 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/armor/ninja_2.png differ diff --git a/src/main/resources/assets/customnpcs/textures/armor/officer_1.png b/src/main/resources/assets/customnpcs/textures/armor/officer_1.png new file mode 100644 index 000000000..0892d5e3d Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/armor/officer_1.png differ diff --git a/src/main/resources/assets/customnpcs/textures/armor/papercrown_1.png b/src/main/resources/assets/customnpcs/textures/armor/papercrown_1.png new file mode 100644 index 000000000..592187b10 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/armor/papercrown_1.png differ diff --git a/src/main/resources/assets/customnpcs/textures/armor/soldier_1.png b/src/main/resources/assets/customnpcs/textures/armor/soldier_1.png new file mode 100644 index 000000000..323f3f324 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/armor/soldier_1.png differ diff --git a/src/main/resources/assets/customnpcs/textures/armor/soldier_2.png b/src/main/resources/assets/customnpcs/textures/armor/soldier_2.png new file mode 100644 index 000000000..21681bbf8 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/armor/soldier_2.png differ diff --git a/src/main/resources/assets/customnpcs/textures/armor/tactical_1.png b/src/main/resources/assets/customnpcs/textures/armor/tactical_1.png new file mode 100644 index 000000000..eacf0dafc Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/armor/tactical_1.png differ diff --git a/src/main/resources/assets/customnpcs/textures/armor/tuxido_1.png b/src/main/resources/assets/customnpcs/textures/armor/tuxido_1.png new file mode 100644 index 000000000..5267f316f Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/armor/tuxido_1.png differ diff --git a/src/main/resources/assets/customnpcs/textures/armor/tuxido_2.png b/src/main/resources/assets/customnpcs/textures/armor/tuxido_2.png new file mode 100644 index 000000000..6ae10baa5 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/armor/tuxido_2.png differ diff --git a/src/main/resources/assets/customnpcs/textures/armor/wizard_1.png b/src/main/resources/assets/customnpcs/textures/armor/wizard_1.png new file mode 100644 index 000000000..f4dfa3d12 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/armor/wizard_1.png differ diff --git a/src/main/resources/assets/customnpcs/textures/armor/wizard_2.png b/src/main/resources/assets/customnpcs/textures/armor/wizard_2.png new file mode 100644 index 000000000..6000178cd Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/armor/wizard_2.png differ diff --git a/src/main/resources/assets/customnpcs/textures/armor/x407_1.png b/src/main/resources/assets/customnpcs/textures/armor/x407_1.png new file mode 100644 index 000000000..e29b2acd3 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/armor/x407_1.png differ diff --git a/src/main/resources/assets/customnpcs/textures/armor/x407_2.png b/src/main/resources/assets/customnpcs/textures/armor/x407_2.png new file mode 100644 index 000000000..889decde7 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/armor/x407_2.png differ diff --git a/src/main/resources/assets/customnpcs/textures/blocks/npcBloodBlock.png b/src/main/resources/assets/customnpcs/textures/blocks/npcBloodBlock.png new file mode 100644 index 000000000..15afd504b Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/blocks/npcBloodBlock.png differ diff --git a/src/main/resources/assets/customnpcs/textures/blocks/npcBloodBlock2.png b/src/main/resources/assets/customnpcs/textures/blocks/npcBloodBlock2.png new file mode 100644 index 000000000..c74f85d8a Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/blocks/npcBloodBlock2.png differ diff --git a/src/main/resources/assets/customnpcs/textures/blocks/npcBloodBlock3.png b/src/main/resources/assets/customnpcs/textures/blocks/npcBloodBlock3.png new file mode 100644 index 000000000..379b4f575 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/blocks/npcBloodBlock3.png differ diff --git a/src/main/resources/assets/customnpcs/textures/blocks/npcBorder.png b/src/main/resources/assets/customnpcs/textures/blocks/npcBorder.png new file mode 100644 index 000000000..26fa9f814 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/blocks/npcBorder.png differ diff --git a/src/main/resources/assets/customnpcs/textures/blocks/npcCrystal.png b/src/main/resources/assets/customnpcs/textures/blocks/npcCrystal.png new file mode 100644 index 000000000..fc29a01ba Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/blocks/npcCrystal.png differ diff --git a/src/main/resources/assets/customnpcs/textures/blocks/npcRedstoneBlock.png b/src/main/resources/assets/customnpcs/textures/blocks/npcRedstoneBlock.png new file mode 100644 index 000000000..60d18986d Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/blocks/npcRedstoneBlock.png differ diff --git a/src/main/resources/assets/customnpcs/textures/blocks/npcWaypoint.png b/src/main/resources/assets/customnpcs/textures/blocks/npcWaypoint.png new file mode 100644 index 000000000..2f80ce80b Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/blocks/npcWaypoint.png differ diff --git a/src/main/resources/assets/customnpcs/textures/blocks/placeholder_0.png b/src/main/resources/assets/customnpcs/textures/blocks/placeholder_0.png new file mode 100644 index 000000000..50b0ac3ac Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/blocks/placeholder_0.png differ diff --git a/src/main/resources/assets/customnpcs/textures/blocks/placeholder_1.png b/src/main/resources/assets/customnpcs/textures/blocks/placeholder_1.png new file mode 100644 index 000000000..03f650bdc Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/blocks/placeholder_1.png differ diff --git a/src/main/resources/assets/customnpcs/textures/blocks/placeholder_10.png b/src/main/resources/assets/customnpcs/textures/blocks/placeholder_10.png new file mode 100644 index 000000000..39bed9fab Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/blocks/placeholder_10.png differ diff --git a/src/main/resources/assets/customnpcs/textures/blocks/placeholder_11.png b/src/main/resources/assets/customnpcs/textures/blocks/placeholder_11.png new file mode 100644 index 000000000..5e56423d6 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/blocks/placeholder_11.png differ diff --git a/src/main/resources/assets/customnpcs/textures/blocks/placeholder_12.png b/src/main/resources/assets/customnpcs/textures/blocks/placeholder_12.png new file mode 100644 index 000000000..c7c355d68 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/blocks/placeholder_12.png differ diff --git a/src/main/resources/assets/customnpcs/textures/blocks/placeholder_13.png b/src/main/resources/assets/customnpcs/textures/blocks/placeholder_13.png new file mode 100644 index 000000000..a89872602 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/blocks/placeholder_13.png differ diff --git a/src/main/resources/assets/customnpcs/textures/blocks/placeholder_14.png b/src/main/resources/assets/customnpcs/textures/blocks/placeholder_14.png new file mode 100644 index 000000000..eedb2a2c9 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/blocks/placeholder_14.png differ diff --git a/src/main/resources/assets/customnpcs/textures/blocks/placeholder_15.png b/src/main/resources/assets/customnpcs/textures/blocks/placeholder_15.png new file mode 100644 index 000000000..dfc6b919e Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/blocks/placeholder_15.png differ diff --git a/src/main/resources/assets/customnpcs/textures/blocks/placeholder_2.png b/src/main/resources/assets/customnpcs/textures/blocks/placeholder_2.png new file mode 100644 index 000000000..10872e310 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/blocks/placeholder_2.png differ diff --git a/src/main/resources/assets/customnpcs/textures/blocks/placeholder_3.png b/src/main/resources/assets/customnpcs/textures/blocks/placeholder_3.png new file mode 100644 index 000000000..34f770af2 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/blocks/placeholder_3.png differ diff --git a/src/main/resources/assets/customnpcs/textures/blocks/placeholder_4.png b/src/main/resources/assets/customnpcs/textures/blocks/placeholder_4.png new file mode 100644 index 000000000..ca26974d4 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/blocks/placeholder_4.png differ diff --git a/src/main/resources/assets/customnpcs/textures/blocks/placeholder_5.png b/src/main/resources/assets/customnpcs/textures/blocks/placeholder_5.png new file mode 100644 index 000000000..c83bd5880 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/blocks/placeholder_5.png differ diff --git a/src/main/resources/assets/customnpcs/textures/blocks/placeholder_6.png b/src/main/resources/assets/customnpcs/textures/blocks/placeholder_6.png new file mode 100644 index 000000000..9aa08ba3b Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/blocks/placeholder_6.png differ diff --git a/src/main/resources/assets/customnpcs/textures/blocks/placeholder_7.png b/src/main/resources/assets/customnpcs/textures/blocks/placeholder_7.png new file mode 100644 index 000000000..cc8e28d62 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/blocks/placeholder_7.png differ diff --git a/src/main/resources/assets/customnpcs/textures/blocks/placeholder_8.png b/src/main/resources/assets/customnpcs/textures/blocks/placeholder_8.png new file mode 100644 index 000000000..05efcdf9c Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/blocks/placeholder_8.png differ diff --git a/src/main/resources/assets/customnpcs/textures/blocks/placeholder_9.png b/src/main/resources/assets/customnpcs/textures/blocks/placeholder_9.png new file mode 100644 index 000000000..518ef3ecd Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/blocks/placeholder_9.png differ diff --git a/src/main/resources/assets/customnpcs/textures/cloak/BaconCape.png b/src/main/resources/assets/customnpcs/textures/cloak/BaconCape.png new file mode 100644 index 000000000..684a060a8 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/cloak/BaconCape.png differ diff --git a/src/main/resources/assets/customnpcs/textures/cloak/BloodyCape.png b/src/main/resources/assets/customnpcs/textures/cloak/BloodyCape.png new file mode 100644 index 000000000..887d846fb Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/cloak/BloodyCape.png differ diff --git a/src/main/resources/assets/customnpcs/textures/cloak/EnderdragonCape.png b/src/main/resources/assets/customnpcs/textures/cloak/EnderdragonCape.png new file mode 100644 index 000000000..a1da17965 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/cloak/EnderdragonCape.png differ diff --git a/src/main/resources/assets/customnpcs/textures/cloak/Mojang.png b/src/main/resources/assets/customnpcs/textures/cloak/Mojang.png new file mode 100644 index 000000000..5bac1d88b Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/cloak/Mojang.png differ diff --git a/src/main/resources/assets/customnpcs/textures/cloak/RaggedBrownCloak.png b/src/main/resources/assets/customnpcs/textures/cloak/RaggedBrownCloak.png new file mode 100644 index 000000000..f87ebf6dd Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/cloak/RaggedBrownCloak.png differ diff --git a/src/main/resources/assets/customnpcs/textures/cloak/RaggedDarkBrownCloak.png b/src/main/resources/assets/customnpcs/textures/cloak/RaggedDarkBrownCloak.png new file mode 100644 index 000000000..d6a6ebbe1 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/cloak/RaggedDarkBrownCloak.png differ diff --git a/src/main/resources/assets/customnpcs/textures/cloak/RaggedDarkCloak.png b/src/main/resources/assets/customnpcs/textures/cloak/RaggedDarkCloak.png new file mode 100644 index 000000000..b64d823b3 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/cloak/RaggedDarkCloak.png differ diff --git a/src/main/resources/assets/customnpcs/textures/cloak/RaggedGreyCloak.png b/src/main/resources/assets/customnpcs/textures/cloak/RaggedGreyCloak.png new file mode 100644 index 000000000..18be764e1 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/cloak/RaggedGreyCloak.png differ diff --git a/src/main/resources/assets/customnpcs/textures/cloak/RaggedPurpleCloak.png b/src/main/resources/assets/customnpcs/textures/cloak/RaggedPurpleCloak.png new file mode 100644 index 000000000..5c0dc5453 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/cloak/RaggedPurpleCloak.png differ diff --git a/src/main/resources/assets/customnpcs/textures/cloak/SkullCape.png b/src/main/resources/assets/customnpcs/textures/cloak/SkullCape.png new file mode 100644 index 000000000..6ea816bbe Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/cloak/SkullCape.png differ diff --git a/src/main/resources/assets/customnpcs/textures/cloak/TranslatorCape.png b/src/main/resources/assets/customnpcs/textures/cloak/TranslatorCape.png new file mode 100644 index 000000000..60e4e89bf Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/cloak/TranslatorCape.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/crystal/AquaCrystal.png b/src/main/resources/assets/customnpcs/textures/entity/crystal/AquaCrystal.png new file mode 100644 index 000000000..db7dc1020 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/crystal/AquaCrystal.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/crystal/AquaCrystalFloating.png b/src/main/resources/assets/customnpcs/textures/entity/crystal/AquaCrystalFloating.png new file mode 100644 index 000000000..b64c8f68f Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/crystal/AquaCrystalFloating.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/crystal/Bank.png b/src/main/resources/assets/customnpcs/textures/entity/crystal/Bank.png new file mode 100644 index 000000000..cca9d9ed4 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/crystal/Bank.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/crystal/BurningCrystal.png b/src/main/resources/assets/customnpcs/textures/entity/crystal/BurningCrystal.png new file mode 100644 index 000000000..e0c9755a3 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/crystal/BurningCrystal.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/crystal/BurningCrystalFloating.png b/src/main/resources/assets/customnpcs/textures/entity/crystal/BurningCrystalFloating.png new file mode 100644 index 000000000..dbe635240 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/crystal/BurningCrystalFloating.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/crystal/CorruptCrystal.png b/src/main/resources/assets/customnpcs/textures/entity/crystal/CorruptCrystal.png new file mode 100644 index 000000000..3f34addec Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/crystal/CorruptCrystal.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/crystal/CorruptFloatingCrystal.png b/src/main/resources/assets/customnpcs/textures/entity/crystal/CorruptFloatingCrystal.png new file mode 100644 index 000000000..5b8edd1c9 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/crystal/CorruptFloatingCrystal.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/crystal/CrystalBlackFloating.png b/src/main/resources/assets/customnpcs/textures/entity/crystal/CrystalBlackFloating.png new file mode 100644 index 000000000..4243d4ef5 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/crystal/CrystalBlackFloating.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/crystal/ElectricCrystal.png b/src/main/resources/assets/customnpcs/textures/entity/crystal/ElectricCrystal.png new file mode 100644 index 000000000..2629fbe39 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/crystal/ElectricCrystal.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/crystal/ElectricCrystalFloating.png b/src/main/resources/assets/customnpcs/textures/entity/crystal/ElectricCrystalFloating.png new file mode 100644 index 000000000..d2eee3b16 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/crystal/ElectricCrystalFloating.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/crystal/Elemental Lava.png b/src/main/resources/assets/customnpcs/textures/entity/crystal/Elemental Lava.png new file mode 100644 index 000000000..ce12799d5 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/crystal/Elemental Lava.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/crystal/Elemental Psycic.png b/src/main/resources/assets/customnpcs/textures/entity/crystal/Elemental Psycic.png new file mode 100644 index 000000000..95b5944dd Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/crystal/Elemental Psycic.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/crystal/EnderCrystal.png b/src/main/resources/assets/customnpcs/textures/entity/crystal/EnderCrystal.png new file mode 100644 index 000000000..f825ed69e Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/crystal/EnderCrystal.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/crystal/EnderFloatingCrystal.png b/src/main/resources/assets/customnpcs/textures/entity/crystal/EnderFloatingCrystal.png new file mode 100644 index 000000000..6fdb64999 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/crystal/EnderFloatingCrystal.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/crystal/MCKBr.png b/src/main/resources/assets/customnpcs/textures/entity/crystal/MCKBr.png new file mode 100644 index 000000000..0910c436d Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/crystal/MCKBr.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/crystal/MarioNoteBlock.png b/src/main/resources/assets/customnpcs/textures/entity/crystal/MarioNoteBlock.png new file mode 100644 index 000000000..7adeb281d Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/crystal/MarioNoteBlock.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/crystal/NatureCrystal.png b/src/main/resources/assets/customnpcs/textures/entity/crystal/NatureCrystal.png new file mode 100644 index 000000000..d564f75c2 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/crystal/NatureCrystal.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/crystal/NatureCrystalFloating.png b/src/main/resources/assets/customnpcs/textures/entity/crystal/NatureCrystalFloating.png new file mode 100644 index 000000000..a863c5423 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/crystal/NatureCrystalFloating.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/dragon/BlackDragon.png b/src/main/resources/assets/customnpcs/textures/entity/dragon/BlackDragon.png new file mode 100644 index 000000000..2ea98241b Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/dragon/BlackDragon.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/dragon/BlueDragon.png b/src/main/resources/assets/customnpcs/textures/entity/dragon/BlueDragon.png new file mode 100644 index 000000000..0e54a9972 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/dragon/BlueDragon.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/dragon/CyanDragon.png b/src/main/resources/assets/customnpcs/textures/entity/dragon/CyanDragon.png new file mode 100644 index 000000000..441c7c28b Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/dragon/CyanDragon.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/dragon/GoldenDragon.png b/src/main/resources/assets/customnpcs/textures/entity/dragon/GoldenDragon.png new file mode 100644 index 000000000..124f48ec3 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/dragon/GoldenDragon.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/dragon/GrayDragon.png b/src/main/resources/assets/customnpcs/textures/entity/dragon/GrayDragon.png new file mode 100644 index 000000000..e604a7ce2 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/dragon/GrayDragon.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/dragon/GreenDragon.png b/src/main/resources/assets/customnpcs/textures/entity/dragon/GreenDragon.png new file mode 100644 index 000000000..47f021bcb Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/dragon/GreenDragon.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/dragon/MagentaDragon.png b/src/main/resources/assets/customnpcs/textures/entity/dragon/MagentaDragon.png new file mode 100644 index 000000000..bc05b9a9a Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/dragon/MagentaDragon.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/dragon/OrangeDragon.png b/src/main/resources/assets/customnpcs/textures/entity/dragon/OrangeDragon.png new file mode 100644 index 000000000..10cebed6e Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/dragon/OrangeDragon.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/dragon/PurpleDragon.png b/src/main/resources/assets/customnpcs/textures/entity/dragon/PurpleDragon.png new file mode 100644 index 000000000..ac5ed6013 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/dragon/PurpleDragon.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/dragon/RedDragon.png b/src/main/resources/assets/customnpcs/textures/entity/dragon/RedDragon.png new file mode 100644 index 000000000..4a8e88445 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/dragon/RedDragon.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/dragon/RedDragon2.png b/src/main/resources/assets/customnpcs/textures/entity/dragon/RedDragon2.png new file mode 100644 index 000000000..45710e1da Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/dragon/RedDragon2.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/dragon/Skeleton Dragon.png b/src/main/resources/assets/customnpcs/textures/entity/dragon/Skeleton Dragon.png new file mode 100644 index 000000000..6487d6ac8 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/dragon/Skeleton Dragon.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/dragon/YellowDragon.png b/src/main/resources/assets/customnpcs/textures/entity/dragon/YellowDragon.png new file mode 100644 index 000000000..e85647d67 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/dragon/YellowDragon.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/dwarffemale/BlondDwarf.png b/src/main/resources/assets/customnpcs/textures/entity/dwarffemale/BlondDwarf.png new file mode 100644 index 000000000..f96ac9abd Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/dwarffemale/BlondDwarf.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/dwarffemale/GingerDwarf.png b/src/main/resources/assets/customnpcs/textures/entity/dwarffemale/GingerDwarf.png new file mode 100644 index 000000000..05200e4cc Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/dwarffemale/GingerDwarf.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/dwarffemale/GingerDwarf2.png b/src/main/resources/assets/customnpcs/textures/entity/dwarffemale/GingerDwarf2.png new file mode 100644 index 000000000..ca7a85136 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/dwarffemale/GingerDwarf2.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/dwarffemale/Simone.png b/src/main/resources/assets/customnpcs/textures/entity/dwarffemale/Simone.png new file mode 100644 index 000000000..b9cd2aaab Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/dwarffemale/Simone.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/BeardedDwarf.png b/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/BeardedDwarf.png new file mode 100644 index 000000000..d8b5de625 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/BeardedDwarf.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/Blacksmith.png b/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/Blacksmith.png new file mode 100644 index 000000000..2f320e365 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/Blacksmith.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/Dwarf.png b/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/Dwarf.png new file mode 100644 index 000000000..dec1e3c14 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/Dwarf.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/DwarfKing.png b/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/DwarfKing.png new file mode 100644 index 000000000..910e472ad Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/DwarfKing.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/DwarfStatue.png b/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/DwarfStatue.png new file mode 100644 index 000000000..5c7bccc42 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/DwarfStatue.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/Dwarf_Blacksmith.png b/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/Dwarf_Blacksmith.png new file mode 100644 index 000000000..995d5d26d Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/Dwarf_Blacksmith.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/Dwarf_Keeper.png b/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/Dwarf_Keeper.png new file mode 100644 index 000000000..fd9492c3a Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/Dwarf_Keeper.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/Dwarf_Leader.png b/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/Dwarf_Leader.png new file mode 100644 index 000000000..6fdd4601d Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/Dwarf_Leader.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/ElderlyDwarf.png b/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/ElderlyDwarf.png new file mode 100644 index 000000000..bb157f11e Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/ElderlyDwarf.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/GingerKing.png b/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/GingerKing.png new file mode 100644 index 000000000..38dd7d7f9 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/GingerKing.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/GingerKnight.png b/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/GingerKnight.png new file mode 100644 index 000000000..69360428c Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/GingerKnight.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/Goblin.png b/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/Goblin.png new file mode 100644 index 000000000..509265c96 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/Goblin.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/High_Class_Dwarf.png b/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/High_Class_Dwarf.png new file mode 100644 index 000000000..1cd3a30ff Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/High_Class_Dwarf.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/High_Class_Dwarf_2.png b/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/High_Class_Dwarf_2.png new file mode 100644 index 000000000..78f1bd67f Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/High_Class_Dwarf_2.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/Hobbit.png b/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/Hobbit.png new file mode 100644 index 000000000..cbdb744d5 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/Hobbit.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/Miner.png b/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/Miner.png new file mode 100644 index 000000000..aee645042 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/Miner.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/MoustachedDwarf.png b/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/MoustachedDwarf.png new file mode 100644 index 000000000..357582c93 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/MoustachedDwarf.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/One_Eye_blind_Dwarf.png b/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/One_Eye_blind_Dwarf.png new file mode 100644 index 000000000..2c0c5eaca Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/One_Eye_blind_Dwarf.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/Simon.png b/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/Simon.png new file mode 100644 index 000000000..177f4cfa1 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/Simon.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/SomeDwarf.png b/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/SomeDwarf.png new file mode 100644 index 000000000..6d9290352 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/SomeDwarf.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/Viking.png b/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/Viking.png new file mode 100644 index 000000000..044912146 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/dwarfmale/Viking.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/elffemale/DarkElfFemale.png b/src/main/resources/assets/customnpcs/textures/entity/elffemale/DarkElfFemale.png new file mode 100644 index 000000000..30c226aa7 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/elffemale/DarkElfFemale.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/elffemale/ElfFemale.png b/src/main/resources/assets/customnpcs/textures/entity/elffemale/ElfFemale.png new file mode 100644 index 000000000..c7756e1cf Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/elffemale/ElfFemale.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/elffemale/ElfMage.png b/src/main/resources/assets/customnpcs/textures/entity/elffemale/ElfMage.png new file mode 100644 index 000000000..42626d7ca Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/elffemale/ElfMage.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/elffemale/ElfQueen.png b/src/main/resources/assets/customnpcs/textures/entity/elffemale/ElfQueen.png new file mode 100644 index 000000000..0aaca63b8 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/elffemale/ElfQueen.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/elffemale/ElfQueenFormal.png b/src/main/resources/assets/customnpcs/textures/entity/elffemale/ElfQueenFormal.png new file mode 100644 index 000000000..90b0d4141 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/elffemale/ElfQueenFormal.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/elffemale/ElfSoldier.png b/src/main/resources/assets/customnpcs/textures/entity/elffemale/ElfSoldier.png new file mode 100644 index 000000000..bc4be1753 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/elffemale/ElfSoldier.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/elffemale/ElfSoldierHelmet.png b/src/main/resources/assets/customnpcs/textures/entity/elffemale/ElfSoldierHelmet.png new file mode 100644 index 000000000..753c77916 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/elffemale/ElfSoldierHelmet.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/elffemale/ElfWarrior.png b/src/main/resources/assets/customnpcs/textures/entity/elffemale/ElfWarrior.png new file mode 100644 index 000000000..0d7dae186 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/elffemale/ElfWarrior.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/elffemale/WoodElfFemale.png b/src/main/resources/assets/customnpcs/textures/entity/elffemale/WoodElfFemale.png new file mode 100644 index 000000000..f1831c691 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/elffemale/WoodElfFemale.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/elfmale/BlondElf.png b/src/main/resources/assets/customnpcs/textures/entity/elfmale/BlondElf.png new file mode 100644 index 000000000..55fbee549 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/elfmale/BlondElf.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/elfmale/Blood_Elf.png b/src/main/resources/assets/customnpcs/textures/entity/elfmale/Blood_Elf.png new file mode 100644 index 000000000..e77a8d214 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/elfmale/Blood_Elf.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/elfmale/Blood_Elf_Mage.png b/src/main/resources/assets/customnpcs/textures/entity/elfmale/Blood_Elf_Mage.png new file mode 100644 index 000000000..70153857b Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/elfmale/Blood_Elf_Mage.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/elfmale/DarkElfCitizen.png b/src/main/resources/assets/customnpcs/textures/entity/elfmale/DarkElfCitizen.png new file mode 100644 index 000000000..a5dcb34a4 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/elfmale/DarkElfCitizen.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/elfmale/Dark_Elf Knight.png b/src/main/resources/assets/customnpcs/textures/entity/elfmale/Dark_Elf Knight.png new file mode 100644 index 000000000..ece92c04d Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/elfmale/Dark_Elf Knight.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/elfmale/Dark_Elf Librarian.png b/src/main/resources/assets/customnpcs/textures/entity/elfmale/Dark_Elf Librarian.png new file mode 100644 index 000000000..5c00615bb Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/elfmale/Dark_Elf Librarian.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/elfmale/Dark_Elf.png b/src/main/resources/assets/customnpcs/textures/entity/elfmale/Dark_Elf.png new file mode 100644 index 000000000..7cd538d8a Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/elfmale/Dark_Elf.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/elfmale/ElfKnight.png b/src/main/resources/assets/customnpcs/textures/entity/elfmale/ElfKnight.png new file mode 100644 index 000000000..c23bcb0cf Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/elfmale/ElfKnight.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/elfmale/ElfMale.png b/src/main/resources/assets/customnpcs/textures/entity/elfmale/ElfMale.png new file mode 100644 index 000000000..a46dab497 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/elfmale/ElfMale.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/elfmale/Elf_Asassin_2.png b/src/main/resources/assets/customnpcs/textures/entity/elfmale/Elf_Asassin_2.png new file mode 100644 index 000000000..3754b5a94 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/elfmale/Elf_Asassin_2.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/elfmale/Engineer_Elf.png b/src/main/resources/assets/customnpcs/textures/entity/elfmale/Engineer_Elf.png new file mode 100644 index 000000000..aa5d50e09 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/elfmale/Engineer_Elf.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/elfmale/ForestElf.png b/src/main/resources/assets/customnpcs/textures/entity/elfmale/ForestElf.png new file mode 100644 index 000000000..f49aa3261 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/elfmale/ForestElf.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/elfmale/High_Class_Knight_Elf.png b/src/main/resources/assets/customnpcs/textures/entity/elfmale/High_Class_Knight_Elf.png new file mode 100644 index 000000000..ba93fe898 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/elfmale/High_Class_Knight_Elf.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/elfmale/Link.png b/src/main/resources/assets/customnpcs/textures/entity/elfmale/Link.png new file mode 100644 index 000000000..4df09be8a Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/elfmale/Link.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/elfmale/WoodElf.png b/src/main/resources/assets/customnpcs/textures/entity/elfmale/WoodElf.png new file mode 100644 index 000000000..995032e16 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/elfmale/WoodElf.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/enderchibi/AlbinoChibi.png b/src/main/resources/assets/customnpcs/textures/entity/enderchibi/AlbinoChibi.png new file mode 100644 index 000000000..6c7c386cc Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/enderchibi/AlbinoChibi.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/enderchibi/EnderGhost.png b/src/main/resources/assets/customnpcs/textures/entity/enderchibi/EnderGhost.png new file mode 100644 index 000000000..01856a704 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/enderchibi/EnderGhost.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/enderchibi/FriendlyEnderchibi.png b/src/main/resources/assets/customnpcs/textures/entity/enderchibi/FriendlyEnderchibi.png new file mode 100644 index 000000000..a1f15f87b Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/enderchibi/FriendlyEnderchibi.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/enderchibi/IceEnderchibi.png b/src/main/resources/assets/customnpcs/textures/entity/enderchibi/IceEnderchibi.png new file mode 100644 index 000000000..8eb631e7d Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/enderchibi/IceEnderchibi.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/enderchibi/MrEnderchibi.png b/src/main/resources/assets/customnpcs/textures/entity/enderchibi/MrEnderchibi.png new file mode 100644 index 000000000..8d6441962 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/enderchibi/MrEnderchibi.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/enderchibi/MsEnderchibi.png b/src/main/resources/assets/customnpcs/textures/entity/enderchibi/MsEnderchibi.png new file mode 100644 index 000000000..67d65456a Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/enderchibi/MsEnderchibi.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/enderchibi/NetherChibi.png b/src/main/resources/assets/customnpcs/textures/entity/enderchibi/NetherChibi.png new file mode 100644 index 000000000..4449fec8a Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/enderchibi/NetherChibi.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/enderchibi/Slenderchibi.png b/src/main/resources/assets/customnpcs/textures/entity/enderchibi/Slenderchibi.png new file mode 100644 index 000000000..292e89cdc Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/enderchibi/Slenderchibi.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/enderman/Apparation.png b/src/main/resources/assets/customnpcs/textures/entity/enderman/Apparation.png new file mode 100644 index 000000000..8ce3613f9 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/enderman/Apparation.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/enderman/Ender Mage.png b/src/main/resources/assets/customnpcs/textures/entity/enderman/Ender Mage.png new file mode 100644 index 000000000..8d969f055 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/enderman/Ender Mage.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/enderman/Slenderman.png b/src/main/resources/assets/customnpcs/textures/entity/enderman/Slenderman.png new file mode 100644 index 000000000..60074ad47 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/enderman/Slenderman.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/enderman/enderman.png b/src/main/resources/assets/customnpcs/textures/entity/enderman/enderman.png new file mode 100644 index 000000000..47e26bd12 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/enderman/enderman.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furryfemale/BunnyFemale.png b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/BunnyFemale.png new file mode 100644 index 000000000..77e5f67d4 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/BunnyFemale.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Leopard Female.png b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Leopard Female.png new file mode 100644 index 000000000..2c27828d6 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Leopard Female.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Leopard Hunter Female.png b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Leopard Hunter Female.png new file mode 100644 index 000000000..987c395ab Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Leopard Hunter Female.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Leopard Straw Hat Female.png b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Leopard Straw Hat Female.png new file mode 100644 index 000000000..b84ab7bb2 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Leopard Straw Hat Female.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Leopard Trader Female.png b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Leopard Trader Female.png new file mode 100644 index 000000000..8405e65ad Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Leopard Trader Female.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Leopard Warrior Female.png b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Leopard Warrior Female.png new file mode 100644 index 000000000..c254de6bc Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Leopard Warrior Female.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Snow Leopard Female Hunter.png b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Snow Leopard Female Hunter.png new file mode 100644 index 000000000..947536540 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Snow Leopard Female Hunter.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Snow Leopard Female Straw Hat.png b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Snow Leopard Female Straw Hat.png new file mode 100644 index 000000000..1cd2b3f28 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Snow Leopard Female Straw Hat.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Snow Leopard Female Trader.png b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Snow Leopard Female Trader.png new file mode 100644 index 000000000..56496dd99 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Snow Leopard Female Trader.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Snow Leopard Female Warrior.png b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Snow Leopard Female Warrior.png new file mode 100644 index 000000000..38d04f96f Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Snow Leopard Female Warrior.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Snow Leopard Female.png b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Snow Leopard Female.png new file mode 100644 index 000000000..7032cdd4f Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Snow Leopard Female.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Tiger Female Hunter.png b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Tiger Female Hunter.png new file mode 100644 index 000000000..54dc52113 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Tiger Female Hunter.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Tiger Female Straw Hat.png b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Tiger Female Straw Hat.png new file mode 100644 index 000000000..427333be4 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Tiger Female Straw Hat.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Tiger Female Trader.png b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Tiger Female Trader.png new file mode 100644 index 000000000..ddda4e013 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Tiger Female Trader.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Tiger Female Warrior.png b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Tiger Female Warrior.png new file mode 100644 index 000000000..922a101fd Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Tiger Female Warrior.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Tiger Female.png b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Tiger Female.png new file mode 100644 index 000000000..c2a400bed Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/Tiger Female.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfBlack.png b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfBlack.png new file mode 100644 index 000000000..f5e825bff Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfBlack.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfBlackHunter .png b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfBlackHunter .png new file mode 100644 index 000000000..f57832027 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfBlackHunter .png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfBlackSteampunk.png b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfBlackSteampunk.png new file mode 100644 index 000000000..1c9adbcb2 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfBlackSteampunk.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfBlackTrader.png b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfBlackTrader.png new file mode 100644 index 000000000..cb9bdaf4a Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfBlackTrader.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfBlackWarrior.png b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfBlackWarrior.png new file mode 100644 index 000000000..5ddcac7aa Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfBlackWarrior.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfBrown.png b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfBrown.png new file mode 100644 index 000000000..c816a6d8c Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfBrown.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfBrownHunter.png b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfBrownHunter.png new file mode 100644 index 000000000..aa099ff27 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfBrownHunter.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfBrownSteampunk.png b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfBrownSteampunk.png new file mode 100644 index 000000000..7f03fb468 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfBrownSteampunk.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfBrownTrader.png b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfBrownTrader.png new file mode 100644 index 000000000..fc4f69687 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfBrownTrader.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfBrownWarrior.png b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfBrownWarrior.png new file mode 100644 index 000000000..505c54158 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfBrownWarrior.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfGrey.png b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfGrey.png new file mode 100644 index 000000000..ec1412c0d Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfGrey.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfGreyHunter.png b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfGreyHunter.png new file mode 100644 index 000000000..0d055f12c Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfGreyHunter.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfGreySteampunk.png b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfGreySteampunk.png new file mode 100644 index 000000000..b52a5b95d Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfGreySteampunk.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfGreyTrader.png b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfGreyTrader.png new file mode 100644 index 000000000..66a25d24a Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfGreyTrader.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfGreyWarrior.png b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfGreyWarrior.png new file mode 100644 index 000000000..fcb17b72b Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfGreyWarrior.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfLightGrey.png b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfLightGrey.png new file mode 100644 index 000000000..9d11d55f2 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfLightGrey.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfLightGreyHunter.png b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfLightGreyHunter.png new file mode 100644 index 000000000..70aa4eab7 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfLightGreyHunter.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfLightGreySteampunk.png b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfLightGreySteampunk.png new file mode 100644 index 000000000..c6179a949 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfLightGreySteampunk.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfLightGreyTrader.png b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfLightGreyTrader.png new file mode 100644 index 000000000..037ca7887 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfLightGreyTrader.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfLightGreyWarrior.png b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfLightGreyWarrior.png new file mode 100644 index 000000000..ea60e11b4 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/WolfLightGreyWarrior.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furryfemale/angelblonde.png b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/angelblonde.png new file mode 100644 index 000000000..a4e99aad4 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furryfemale/angelblonde.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furrymale/Bunny.png b/src/main/resources/assets/customnpcs/textures/entity/furrymale/Bunny.png new file mode 100644 index 000000000..f010da047 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furrymale/Bunny.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furrymale/DragonGreen.png b/src/main/resources/assets/customnpcs/textures/entity/furrymale/DragonGreen.png new file mode 100644 index 000000000..95438ee91 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furrymale/DragonGreen.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furrymale/Leopard Hunter.png b/src/main/resources/assets/customnpcs/textures/entity/furrymale/Leopard Hunter.png new file mode 100644 index 000000000..80852533e Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furrymale/Leopard Hunter.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furrymale/Leopard Straw Hat.png b/src/main/resources/assets/customnpcs/textures/entity/furrymale/Leopard Straw Hat.png new file mode 100644 index 000000000..1277e96e1 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furrymale/Leopard Straw Hat.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furrymale/Leopard Trader.png b/src/main/resources/assets/customnpcs/textures/entity/furrymale/Leopard Trader.png new file mode 100644 index 000000000..e055f2bb9 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furrymale/Leopard Trader.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furrymale/Leopard Warrior.png b/src/main/resources/assets/customnpcs/textures/entity/furrymale/Leopard Warrior.png new file mode 100644 index 000000000..4cf41644c Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furrymale/Leopard Warrior.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furrymale/Leopard.png b/src/main/resources/assets/customnpcs/textures/entity/furrymale/Leopard.png new file mode 100644 index 000000000..ab72f04f4 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furrymale/Leopard.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furrymale/Reaper.png b/src/main/resources/assets/customnpcs/textures/entity/furrymale/Reaper.png new file mode 100644 index 000000000..287fdd893 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furrymale/Reaper.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furrymale/Snow Leopard Hunter.png b/src/main/resources/assets/customnpcs/textures/entity/furrymale/Snow Leopard Hunter.png new file mode 100644 index 000000000..b8af42d73 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furrymale/Snow Leopard Hunter.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furrymale/Snow Leopard Straw Hat.png b/src/main/resources/assets/customnpcs/textures/entity/furrymale/Snow Leopard Straw Hat.png new file mode 100644 index 000000000..871ccbf26 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furrymale/Snow Leopard Straw Hat.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furrymale/Snow Leopard Trader.png b/src/main/resources/assets/customnpcs/textures/entity/furrymale/Snow Leopard Trader.png new file mode 100644 index 000000000..938ba9255 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furrymale/Snow Leopard Trader.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furrymale/Snow Leopard Warrior.png b/src/main/resources/assets/customnpcs/textures/entity/furrymale/Snow Leopard Warrior.png new file mode 100644 index 000000000..d844130a8 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furrymale/Snow Leopard Warrior.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furrymale/SnowLeopard.png b/src/main/resources/assets/customnpcs/textures/entity/furrymale/SnowLeopard.png new file mode 100644 index 000000000..1b9552c3d Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furrymale/SnowLeopard.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furrymale/Tiger Hunter.png b/src/main/resources/assets/customnpcs/textures/entity/furrymale/Tiger Hunter.png new file mode 100644 index 000000000..abad85cca Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furrymale/Tiger Hunter.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furrymale/Tiger Straw Hat.png b/src/main/resources/assets/customnpcs/textures/entity/furrymale/Tiger Straw Hat.png new file mode 100644 index 000000000..96bb3af3a Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furrymale/Tiger Straw Hat.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furrymale/Tiger Trader.png b/src/main/resources/assets/customnpcs/textures/entity/furrymale/Tiger Trader.png new file mode 100644 index 000000000..dbed8ed56 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furrymale/Tiger Trader.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furrymale/Tiger Warrior.png b/src/main/resources/assets/customnpcs/textures/entity/furrymale/Tiger Warrior.png new file mode 100644 index 000000000..47def6ed7 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furrymale/Tiger Warrior.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furrymale/Tiger.png b/src/main/resources/assets/customnpcs/textures/entity/furrymale/Tiger.png new file mode 100644 index 000000000..1e5f6f89f Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furrymale/Tiger.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfBlack.png b/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfBlack.png new file mode 100644 index 000000000..970911dce Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfBlack.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfBlackHunter.png b/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfBlackHunter.png new file mode 100644 index 000000000..6d1a9a541 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfBlackHunter.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfBlackSteamPunk.png b/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfBlackSteamPunk.png new file mode 100644 index 000000000..9f617fef3 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfBlackSteamPunk.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfBlackTrader.png b/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfBlackTrader.png new file mode 100644 index 000000000..2b54639ca Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfBlackTrader.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfBlackWarrior.png b/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfBlackWarrior.png new file mode 100644 index 000000000..25a3155d6 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfBlackWarrior.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfBrown.png b/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfBrown.png new file mode 100644 index 000000000..dd82673aa Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfBrown.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfBrownHunter.png b/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfBrownHunter.png new file mode 100644 index 000000000..e59b76397 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfBrownHunter.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfBrownSteamPunk.png b/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfBrownSteamPunk.png new file mode 100644 index 000000000..0a6ff3b9c Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfBrownSteamPunk.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfBrownTrader.png b/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfBrownTrader.png new file mode 100644 index 000000000..27cb7710e Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfBrownTrader.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfBrownWarrior.png b/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfBrownWarrior.png new file mode 100644 index 000000000..dafcf61e4 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfBrownWarrior.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfGrey.png b/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfGrey.png new file mode 100644 index 000000000..6495ed892 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfGrey.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfGreyHunter.png b/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfGreyHunter.png new file mode 100644 index 000000000..86a70688b Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfGreyHunter.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfGreySteampunk.png b/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfGreySteampunk.png new file mode 100644 index 000000000..1affa2b0b Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfGreySteampunk.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfGreyTraderWolf.png b/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfGreyTraderWolf.png new file mode 100644 index 000000000..beec704a4 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfGreyTraderWolf.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfGreyWarrior.png b/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfGreyWarrior.png new file mode 100644 index 000000000..ff2588539 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfGreyWarrior.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfLightGrey.png b/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfLightGrey.png new file mode 100644 index 000000000..5eee48ded Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfLightGrey.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfLightGreyHunter.png b/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfLightGreyHunter.png new file mode 100644 index 000000000..944ef84f3 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfLightGreyHunter.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfLightGreyModelSteamPunk.png b/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfLightGreyModelSteamPunk.png new file mode 100644 index 000000000..2e98001d3 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfLightGreyModelSteamPunk.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfLightGreyWarrior.png b/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfLightGreyWarrior.png new file mode 100644 index 000000000..65e99b50a Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfLightGreyWarrior.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfLightGreyrader.png b/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfLightGreyrader.png new file mode 100644 index 000000000..b41c88158 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/furrymale/WolfLightGreyrader.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/golem/Castle Knight.png b/src/main/resources/assets/customnpcs/textures/entity/golem/Castle Knight.png new file mode 100644 index 000000000..3976933ef Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/golem/Castle Knight.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/golem/Ender Brute.png b/src/main/resources/assets/customnpcs/textures/entity/golem/Ender Brute.png new file mode 100644 index 000000000..b2ea52cff Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/golem/Ender Brute.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/golem/Iron Golem.png b/src/main/resources/assets/customnpcs/textures/entity/golem/Iron Golem.png new file mode 100644 index 000000000..c61c40b16 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/golem/Iron Golem.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/golem/Loader.png b/src/main/resources/assets/customnpcs/textures/entity/golem/Loader.png new file mode 100644 index 000000000..2079e0aeb Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/golem/Loader.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/golem/Nether Golem.png b/src/main/resources/assets/customnpcs/textures/entity/golem/Nether Golem.png new file mode 100644 index 000000000..aa6316669 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/golem/Nether Golem.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/golem/Police Golem.png b/src/main/resources/assets/customnpcs/textures/entity/golem/Police Golem.png new file mode 100644 index 000000000..6930b2502 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/golem/Police Golem.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/golem/Sand Monster.png b/src/main/resources/assets/customnpcs/textures/entity/golem/Sand Monster.png new file mode 100644 index 000000000..91193a942 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/golem/Sand Monster.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/golem/Securitron V2.png b/src/main/resources/assets/customnpcs/textures/entity/golem/Securitron V2.png new file mode 100644 index 000000000..7b035cfec Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/golem/Securitron V2.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/golem/Stone Guardian.png b/src/main/resources/assets/customnpcs/textures/entity/golem/Stone Guardian.png new file mode 100644 index 000000000..7bc3b7403 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/golem/Stone Guardian.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanfemale/BodyguardStephanie.png b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/BodyguardStephanie.png new file mode 100644 index 000000000..f1cca1173 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/BodyguardStephanie.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanfemale/CamoRadioStephanie.png b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/CamoRadioStephanie.png new file mode 100644 index 000000000..4b39fb25d Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/CamoRadioStephanie.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanfemale/ChefStephanie.png b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/ChefStephanie.png new file mode 100644 index 000000000..30259deac Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/ChefStephanie.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanfemale/DoctorStephanie.png b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/DoctorStephanie.png new file mode 100644 index 000000000..c28dfa152 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/DoctorStephanie.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanfemale/MageStephanie.png b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/MageStephanie.png new file mode 100644 index 000000000..87e72a256 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/MageStephanie.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanfemale/MailmanStephanie.png b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/MailmanStephanie.png new file mode 100644 index 000000000..14574ee69 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/MailmanStephanie.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanfemale/McDStephanie.png b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/McDStephanie.png new file mode 100644 index 000000000..5a73d5bdd Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/McDStephanie.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanfemale/MinerStephanie.png b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/MinerStephanie.png new file mode 100644 index 000000000..9c868284a Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/MinerStephanie.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanfemale/PinstripesStephanie.png b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/PinstripesStephanie.png new file mode 100644 index 000000000..b4c329f6d Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/PinstripesStephanie.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanfemale/RaggedyBardStephanie.png b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/RaggedyBardStephanie.png new file mode 100644 index 000000000..8088a8ed1 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/RaggedyBardStephanie.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanfemale/RobesBlackStephanie.png b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/RobesBlackStephanie.png new file mode 100644 index 000000000..8ccaee042 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/RobesBlackStephanie.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanfemale/RobesBrownStephanie.png b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/RobesBrownStephanie.png new file mode 100644 index 000000000..6542d1b95 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/RobesBrownStephanie.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanfemale/RobesWhiteShepanie.png b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/RobesWhiteShepanie.png new file mode 100644 index 000000000..acf3cc1cb Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/RobesWhiteShepanie.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanfemale/Roseta.png b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/Roseta.png new file mode 100644 index 000000000..91bbe7f4f Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/Roseta.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanfemale/SteampunkStephanie.png b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/SteampunkStephanie.png new file mode 100644 index 000000000..7093ed8b4 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/SteampunkStephanie.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanfemale/Stephanie.png b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/Stephanie.png new file mode 100644 index 000000000..3109e73f3 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/Stephanie.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanfemale/TownsmanStephanie.png b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/TownsmanStephanie.png new file mode 100644 index 000000000..0e442fe19 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/TownsmanStephanie.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanfemale/TraderStepahnie.png b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/TraderStepahnie.png new file mode 100644 index 000000000..c4af7e962 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/TraderStepahnie.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanfemale/TribeElderWoman.png b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/TribeElderWoman.png new file mode 100644 index 000000000..845242971 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/TribeElderWoman.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanfemale/TribeGirl.png b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/TribeGirl.png new file mode 100644 index 000000000..ea4a6a3c8 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/TribeGirl.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanfemale/TribeWoman1.png b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/TribeWoman1.png new file mode 100644 index 000000000..0d77daf11 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/TribeWoman1.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanfemale/TribeWoman2.png b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/TribeWoman2.png new file mode 100644 index 000000000..b6a5c46a7 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/TribeWoman2.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanfemale/TribeWoman3.png b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/TribeWoman3.png new file mode 100644 index 000000000..d42c95e68 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/TribeWoman3.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanfemale/WaitressStephanie.png b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/WaitressStephanie.png new file mode 100644 index 000000000..f59b629c5 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/WaitressStephanie.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanfemale/WizardStephanie.png b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/WizardStephanie.png new file mode 100644 index 000000000..3f4ca0d86 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/WizardStephanie.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanfemale/WoundedStephanie.png b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/WoundedStephanie.png new file mode 100644 index 000000000..8900615b6 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanfemale/WoundedStephanie.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/ArcticSteve.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/ArcticSteve.png new file mode 100644 index 000000000..c0dddd283 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/ArcticSteve.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/BodyguardSteve.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/BodyguardSteve.png new file mode 100644 index 000000000..f80cd3a1e Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/BodyguardSteve.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/CamoRadioSteve.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/CamoRadioSteve.png new file mode 100644 index 000000000..c9079ee20 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/CamoRadioSteve.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/CamoSpecOpsSteve.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/CamoSpecOpsSteve.png new file mode 100644 index 000000000..0e8117982 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/CamoSpecOpsSteve.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/CamoSteve.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/CamoSteve.png new file mode 100644 index 000000000..eed2f5bf7 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/CamoSteve.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/CasualSteve.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/CasualSteve.png new file mode 100644 index 000000000..ffc236ccf Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/CasualSteve.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/ChefSteve.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/ChefSteve.png new file mode 100644 index 000000000..b1eb1fe31 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/ChefSteve.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/DoctorSteve.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/DoctorSteve.png new file mode 100644 index 000000000..7c50dc01f Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/DoctorSteve.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/ElderlySteve.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/ElderlySteve.png new file mode 100644 index 000000000..fadd29edb Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/ElderlySteve.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/Evil_Gold_Knight.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/Evil_Gold_Knight.png new file mode 100644 index 000000000..a72086158 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/Evil_Gold_Knight.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/FireSteve.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/FireSteve.png new file mode 100644 index 000000000..e07110d65 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/FireSteve.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/GangsterSteve.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/GangsterSteve.png new file mode 100644 index 000000000..78aa1478e Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/GangsterSteve.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/GuardSteve.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/GuardSteve.png new file mode 100644 index 000000000..b7217b678 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/GuardSteve.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/GuardSteve2.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/GuardSteve2.png new file mode 100644 index 000000000..635402610 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/GuardSteve2.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/King.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/King.png new file mode 100644 index 000000000..82f16a61a Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/King.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/KingSteve.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/KingSteve.png new file mode 100644 index 000000000..d5d438ed7 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/KingSteve.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/KnightSteve.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/KnightSteve.png new file mode 100644 index 000000000..3104cd5d7 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/KnightSteve.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/KungFuSteve.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/KungFuSteve.png new file mode 100644 index 000000000..012dcd4fa Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/KungFuSteve.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/LondonGuard.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/LondonGuard.png new file mode 100644 index 000000000..186831bfa Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/LondonGuard.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/MageSteve.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/MageSteve.png new file mode 100644 index 000000000..e8c407dea Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/MageSteve.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/MailmanSteve.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/MailmanSteve.png new file mode 100644 index 000000000..7b00da055 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/MailmanSteve.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/McDSteve.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/McDSteve.png new file mode 100644 index 000000000..eef5ec907 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/McDSteve.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/MercenarySteve 2.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/MercenarySteve 2.png new file mode 100644 index 000000000..6959abc75 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/MercenarySteve 2.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/MercenarySteve.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/MercenarySteve.png new file mode 100644 index 000000000..883e07146 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/MercenarySteve.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/MinerSteve.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/MinerSteve.png new file mode 100644 index 000000000..4038c07b2 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/MinerSteve.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/PinstripesSteve.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/PinstripesSteve.png new file mode 100644 index 000000000..97e95c381 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/PinstripesSteve.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/PriestSteve.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/PriestSteve.png new file mode 100644 index 000000000..164767795 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/PriestSteve.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/PrisonerSteve.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/PrisonerSteve.png new file mode 100644 index 000000000..7744c4cc5 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/PrisonerSteve.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/RaggedyBardSteve.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/RaggedyBardSteve.png new file mode 100644 index 000000000..db38b7b7d Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/RaggedyBardSteve.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/RobesBlackSteve.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/RobesBlackSteve.png new file mode 100644 index 000000000..2d5b42bd4 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/RobesBlackSteve.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/RobesBrownSteve.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/RobesBrownSteve.png new file mode 100644 index 000000000..edfa168a3 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/RobesBrownSteve.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/RobesWhiteSteve.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/RobesWhiteSteve.png new file mode 100644 index 000000000..628e592d3 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/RobesWhiteSteve.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/SteampunkSteve.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/SteampunkSteve.png new file mode 100644 index 000000000..740d66a0c Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/SteampunkSteve.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/Steve.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/Steve.png new file mode 100644 index 000000000..e2c5c44af Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/Steve.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/TownsmanSteve.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/TownsmanSteve.png new file mode 100644 index 000000000..72fd0ea20 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/TownsmanSteve.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/TraderSteve.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/TraderSteve.png new file mode 100644 index 000000000..855ff0044 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/TraderSteve.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/TribeBoy.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/TribeBoy.png new file mode 100644 index 000000000..1b720b4da Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/TribeBoy.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/TribeElder.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/TribeElder.png new file mode 100644 index 000000000..f67566678 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/TribeElder.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/TribeHunter1.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/TribeHunter1.png new file mode 100644 index 000000000..19717e31e Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/TribeHunter1.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/TribeHunter2.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/TribeHunter2.png new file mode 100644 index 000000000..eef7eecb9 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/TribeHunter2.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/TribeKimba.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/TribeKimba.png new file mode 100644 index 000000000..d2ee10eb7 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/TribeKimba.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/TribeMan.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/TribeMan.png new file mode 100644 index 000000000..3b0383cea Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/TribeMan.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/TuxedoSteve.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/TuxedoSteve.png new file mode 100644 index 000000000..5cb505efb Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/TuxedoSteve.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/VillagerOldSteve.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/VillagerOldSteve.png new file mode 100644 index 000000000..d85e14583 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/VillagerOldSteve.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/VillagerSteve.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/VillagerSteve.png new file mode 100644 index 000000000..0502165fb Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/VillagerSteve.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/VillagerSteve2.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/VillagerSteve2.png new file mode 100644 index 000000000..d993c6d62 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/VillagerSteve2.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/WaiterSteve.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/WaiterSteve.png new file mode 100644 index 000000000..bed90d33f Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/WaiterSteve.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/White_Knight_2.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/White_Knight_2.png new file mode 100644 index 000000000..99e5ec285 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/White_Knight_2.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/White_knight.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/White_knight.png new file mode 100644 index 000000000..2c6de0c25 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/White_knight.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/WizardSteve.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/WizardSteve.png new file mode 100644 index 000000000..ac9c0ec13 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/WizardSteve.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/humanmale/WoundedSteve.png b/src/main/resources/assets/customnpcs/textures/entity/humanmale/WoundedSteve.png new file mode 100644 index 000000000..707a19dfc Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/humanmale/WoundedSteve.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/monsterfemale/Herobrine.png b/src/main/resources/assets/customnpcs/textures/entity/monsterfemale/Herobrine.png new file mode 100644 index 000000000..e897afa05 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/monsterfemale/Herobrine.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/monsterfemale/ZombieStephanie.png b/src/main/resources/assets/customnpcs/textures/entity/monsterfemale/ZombieStephanie.png new file mode 100644 index 000000000..3493506a8 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/monsterfemale/ZombieStephanie.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/monstermale/Classy_Zombie.png b/src/main/resources/assets/customnpcs/textures/entity/monstermale/Classy_Zombie.png new file mode 100644 index 000000000..0fbfb1f24 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/monstermale/Classy_Zombie.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/monstermale/Death.png b/src/main/resources/assets/customnpcs/textures/entity/monstermale/Death.png new file mode 100644 index 000000000..9b6fe96e2 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/monstermale/Death.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/monstermale/DemonSalesman.png b/src/main/resources/assets/customnpcs/textures/entity/monstermale/DemonSalesman.png new file mode 100644 index 000000000..3e3de8171 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/monstermale/DemonSalesman.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/monstermale/DesertZombie.png b/src/main/resources/assets/customnpcs/textures/entity/monstermale/DesertZombie.png new file mode 100644 index 000000000..a14d251db Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/monstermale/DesertZombie.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/monstermale/DisfiguredZombie.png b/src/main/resources/assets/customnpcs/textures/entity/monstermale/DisfiguredZombie.png new file mode 100644 index 000000000..203f0fb81 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/monstermale/DisfiguredZombie.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/monstermale/EnderMage.png b/src/main/resources/assets/customnpcs/textures/entity/monstermale/EnderMage.png new file mode 100644 index 000000000..496f42958 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/monstermale/EnderMage.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/monstermale/Flesh.png b/src/main/resources/assets/customnpcs/textures/entity/monstermale/Flesh.png new file mode 100644 index 000000000..ed41a634c Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/monstermale/Flesh.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/monstermale/FrozenCorpse.png b/src/main/resources/assets/customnpcs/textures/entity/monstermale/FrozenCorpse.png new file mode 100644 index 000000000..46141743c Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/monstermale/FrozenCorpse.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/monstermale/Ghost King.png b/src/main/resources/assets/customnpcs/textures/entity/monstermale/Ghost King.png new file mode 100644 index 000000000..b4e2a8dd2 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/monstermale/Ghost King.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/monstermale/GhostGrey.png b/src/main/resources/assets/customnpcs/textures/entity/monstermale/GhostGrey.png new file mode 100644 index 000000000..f17e72c87 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/monstermale/GhostGrey.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/monstermale/GhostRed.png b/src/main/resources/assets/customnpcs/textures/entity/monstermale/GhostRed.png new file mode 100644 index 000000000..91aedf855 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/monstermale/GhostRed.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/monstermale/GhostYellow.png b/src/main/resources/assets/customnpcs/textures/entity/monstermale/GhostYellow.png new file mode 100644 index 000000000..fdfd0acf6 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/monstermale/GhostYellow.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/monstermale/Herobrine.png b/src/main/resources/assets/customnpcs/textures/entity/monstermale/Herobrine.png new file mode 100644 index 000000000..db9aee8e3 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/monstermale/Herobrine.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/monstermale/Ogre.png b/src/main/resources/assets/customnpcs/textures/entity/monstermale/Ogre.png new file mode 100644 index 000000000..e195b0b63 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/monstermale/Ogre.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/monstermale/SandMonster.png b/src/main/resources/assets/customnpcs/textures/entity/monstermale/SandMonster.png new file mode 100644 index 000000000..34a0b7ba3 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/monstermale/SandMonster.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/monstermale/Securitron.png b/src/main/resources/assets/customnpcs/textures/entity/monstermale/Securitron.png new file mode 100644 index 000000000..d5869671a Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/monstermale/Securitron.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/monstermale/Skull_Mage.png b/src/main/resources/assets/customnpcs/textures/entity/monstermale/Skull_Mage.png new file mode 100644 index 000000000..0e6ebb5d1 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/monstermale/Skull_Mage.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/monstermale/StoneGolem.png b/src/main/resources/assets/customnpcs/textures/entity/monstermale/StoneGolem.png new file mode 100644 index 000000000..99449aad9 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/monstermale/StoneGolem.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/monstermale/TecZombie.png b/src/main/resources/assets/customnpcs/textures/entity/monstermale/TecZombie.png new file mode 100644 index 000000000..061d50b2a Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/monstermale/TecZombie.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/monstermale/Undead King.png b/src/main/resources/assets/customnpcs/textures/entity/monstermale/Undead King.png new file mode 100644 index 000000000..d95a0766f Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/monstermale/Undead King.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/monstermale/Undead_Monster.png b/src/main/resources/assets/customnpcs/textures/entity/monstermale/Undead_Monster.png new file mode 100644 index 000000000..6adbfebb7 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/monstermale/Undead_Monster.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/monstermale/ZombieBloody.png b/src/main/resources/assets/customnpcs/textures/entity/monstermale/ZombieBloody.png new file mode 100644 index 000000000..8e284a257 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/monstermale/ZombieBloody.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/monstermale/ZombieMage.png b/src/main/resources/assets/customnpcs/textures/entity/monstermale/ZombieMage.png new file mode 100644 index 000000000..7b3fd0a43 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/monstermale/ZombieMage.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/monstermale/ZombieSteve.png b/src/main/resources/assets/customnpcs/textures/entity/monstermale/ZombieSteve.png new file mode 100644 index 000000000..5f39fd802 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/monstermale/ZombieSteve.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/nagafemale/Claire.png b/src/main/resources/assets/customnpcs/textures/entity/nagafemale/Claire.png new file mode 100644 index 000000000..f90339c79 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/nagafemale/Claire.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/nagafemale/Creepsnake.png b/src/main/resources/assets/customnpcs/textures/entity/nagafemale/Creepsnake.png new file mode 100644 index 000000000..f14395775 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/nagafemale/Creepsnake.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/nagafemale/Ender Snake.png b/src/main/resources/assets/customnpcs/textures/entity/nagafemale/Ender Snake.png new file mode 100644 index 000000000..26478be1b Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/nagafemale/Ender Snake.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/nagafemale/Naga Stephanie Pink.png b/src/main/resources/assets/customnpcs/textures/entity/nagafemale/Naga Stephanie Pink.png new file mode 100644 index 000000000..d6d66e18d Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/nagafemale/Naga Stephanie Pink.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/nagafemale/Naga Stephanie.png b/src/main/resources/assets/customnpcs/textures/entity/nagafemale/Naga Stephanie.png new file mode 100644 index 000000000..74d06cf72 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/nagafemale/Naga Stephanie.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/nagamale/Cobra.png b/src/main/resources/assets/customnpcs/textures/entity/nagamale/Cobra.png new file mode 100644 index 000000000..bf1a2cf53 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/nagamale/Cobra.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/nagamale/Creepersneeper.png b/src/main/resources/assets/customnpcs/textures/entity/nagamale/Creepersneeper.png new file mode 100644 index 000000000..8009d1855 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/nagamale/Creepersneeper.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/nagamale/EnderSnake.png b/src/main/resources/assets/customnpcs/textures/entity/nagamale/EnderSnake.png new file mode 100644 index 000000000..629985be8 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/nagamale/EnderSnake.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/nagamale/Naga Black.png b/src/main/resources/assets/customnpcs/textures/entity/nagamale/Naga Black.png new file mode 100644 index 000000000..39b35be7d Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/nagamale/Naga Black.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/nagamale/Naga Blue.png b/src/main/resources/assets/customnpcs/textures/entity/nagamale/Naga Blue.png new file mode 100644 index 000000000..f581bb7f9 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/nagamale/Naga Blue.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/nagamale/Naga Gray.png b/src/main/resources/assets/customnpcs/textures/entity/nagamale/Naga Gray.png new file mode 100644 index 000000000..d5065c699 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/nagamale/Naga Gray.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/nagamale/Naga Green.png b/src/main/resources/assets/customnpcs/textures/entity/nagamale/Naga Green.png new file mode 100644 index 000000000..4053d6559 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/nagamale/Naga Green.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/nagamale/Naga Red.png b/src/main/resources/assets/customnpcs/textures/entity/nagamale/Naga Red.png new file mode 100644 index 000000000..edbdaf126 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/nagamale/Naga Red.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/nagamale/Naga Steve 1.png b/src/main/resources/assets/customnpcs/textures/entity/nagamale/Naga Steve 1.png new file mode 100644 index 000000000..6c66bbd56 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/nagamale/Naga Steve 1.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/nagamale/Naga Steve 2.png b/src/main/resources/assets/customnpcs/textures/entity/nagamale/Naga Steve 2.png new file mode 100644 index 000000000..f9eec6d7b Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/nagamale/Naga Steve 2.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/nagamale/Naga Steve 3.png b/src/main/resources/assets/customnpcs/textures/entity/nagamale/Naga Steve 3.png new file mode 100644 index 000000000..d059f8ea3 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/nagamale/Naga Steve 3.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/nagamale/Naga Steve 4.png b/src/main/resources/assets/customnpcs/textures/entity/nagamale/Naga Steve 4.png new file mode 100644 index 000000000..d70b8867f Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/nagamale/Naga Steve 4.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/nagamale/Naga Steve 5.png b/src/main/resources/assets/customnpcs/textures/entity/nagamale/Naga Steve 5.png new file mode 100644 index 000000000..3f2965241 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/nagamale/Naga Steve 5.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/nagamale/Naga Steve 6.png b/src/main/resources/assets/customnpcs/textures/entity/nagamale/Naga Steve 6.png new file mode 100644 index 000000000..d802cabda Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/nagamale/Naga Steve 6.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/nagamale/Naga Steve 7.png b/src/main/resources/assets/customnpcs/textures/entity/nagamale/Naga Steve 7.png new file mode 100644 index 000000000..cfa4d6ba0 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/nagamale/Naga Steve 7.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/nagamale/Naga White.png b/src/main/resources/assets/customnpcs/textures/entity/nagamale/Naga White.png new file mode 100644 index 000000000..e6ddd9ddf Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/nagamale/Naga White.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/nagamale/Naga Yellow.png b/src/main/resources/assets/customnpcs/textures/entity/nagamale/Naga Yellow.png new file mode 100644 index 000000000..bab96a8bb Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/nagamale/Naga Yellow.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/nagamale/Snake.png b/src/main/resources/assets/customnpcs/textures/entity/nagamale/Snake.png new file mode 100644 index 000000000..a7760e446 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/nagamale/Snake.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/nagamale/finsample.png b/src/main/resources/assets/customnpcs/textures/entity/nagamale/finsample.png new file mode 100644 index 000000000..cc330ef81 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/nagamale/finsample.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/orcfemale/GenericFemaleOrc1.png b/src/main/resources/assets/customnpcs/textures/entity/orcfemale/GenericFemaleOrc1.png new file mode 100644 index 000000000..2de62b093 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/orcfemale/GenericFemaleOrc1.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/orcfemale/GenericFemaleOrc2.png b/src/main/resources/assets/customnpcs/textures/entity/orcfemale/GenericFemaleOrc2.png new file mode 100644 index 000000000..cbeb3c686 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/orcfemale/GenericFemaleOrc2.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/orcfemale/GenericFemaleOrc3.png b/src/main/resources/assets/customnpcs/textures/entity/orcfemale/GenericFemaleOrc3.png new file mode 100644 index 000000000..92bf31355 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/orcfemale/GenericFemaleOrc3.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/orcfemale/GuardFemaleOrc1.png b/src/main/resources/assets/customnpcs/textures/entity/orcfemale/GuardFemaleOrc1.png new file mode 100644 index 000000000..91aa56956 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/orcfemale/GuardFemaleOrc1.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/orcfemale/GuardFemaleOrc2.png b/src/main/resources/assets/customnpcs/textures/entity/orcfemale/GuardFemaleOrc2.png new file mode 100644 index 000000000..55d982fe7 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/orcfemale/GuardFemaleOrc2.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/orcfemale/LeatherArmoredFemaleOrc.png b/src/main/resources/assets/customnpcs/textures/entity/orcfemale/LeatherArmoredFemaleOrc.png new file mode 100644 index 000000000..fd6a940fc Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/orcfemale/LeatherArmoredFemaleOrc.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/orcfemale/MercenaryFemaleOrc1.png b/src/main/resources/assets/customnpcs/textures/entity/orcfemale/MercenaryFemaleOrc1.png new file mode 100644 index 000000000..82bfd54ef Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/orcfemale/MercenaryFemaleOrc1.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/orcfemale/MercenaryFemaleOrc2.png b/src/main/resources/assets/customnpcs/textures/entity/orcfemale/MercenaryFemaleOrc2.png new file mode 100644 index 000000000..16401d8a9 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/orcfemale/MercenaryFemaleOrc2.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/orcfemale/MercenaryFemaleOrc3.png b/src/main/resources/assets/customnpcs/textures/entity/orcfemale/MercenaryFemaleOrc3.png new file mode 100644 index 000000000..0bc3f7596 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/orcfemale/MercenaryFemaleOrc3.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/orcfemale/StrandedFemaleOrc.png b/src/main/resources/assets/customnpcs/textures/entity/orcfemale/StrandedFemaleOrc.png new file mode 100644 index 000000000..fab8d9d55 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/orcfemale/StrandedFemaleOrc.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/orcmale/GenericOrc1.png b/src/main/resources/assets/customnpcs/textures/entity/orcmale/GenericOrc1.png new file mode 100644 index 000000000..6af6698ee Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/orcmale/GenericOrc1.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/orcmale/GenericOrc2.png b/src/main/resources/assets/customnpcs/textures/entity/orcmale/GenericOrc2.png new file mode 100644 index 000000000..8e7157006 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/orcmale/GenericOrc2.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/orcmale/GenericOrc3.png b/src/main/resources/assets/customnpcs/textures/entity/orcmale/GenericOrc3.png new file mode 100644 index 000000000..6a094b02d Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/orcmale/GenericOrc3.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/orcmale/Giant.png b/src/main/resources/assets/customnpcs/textures/entity/orcmale/Giant.png new file mode 100644 index 000000000..f00589d6e Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/orcmale/Giant.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/orcmale/Giant_2.png b/src/main/resources/assets/customnpcs/textures/entity/orcmale/Giant_2.png new file mode 100644 index 000000000..9cc61a881 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/orcmale/Giant_2.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/orcmale/Giant_3.png b/src/main/resources/assets/customnpcs/textures/entity/orcmale/Giant_3.png new file mode 100644 index 000000000..294ba15c5 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/orcmale/Giant_3.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/orcmale/GuardOrc1.png b/src/main/resources/assets/customnpcs/textures/entity/orcmale/GuardOrc1.png new file mode 100644 index 000000000..ed4167ff0 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/orcmale/GuardOrc1.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/orcmale/GuardOrc2.png b/src/main/resources/assets/customnpcs/textures/entity/orcmale/GuardOrc2.png new file mode 100644 index 000000000..fe4094476 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/orcmale/GuardOrc2.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/orcmale/LeatherArmoredOrc.png b/src/main/resources/assets/customnpcs/textures/entity/orcmale/LeatherArmoredOrc.png new file mode 100644 index 000000000..463eff7be Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/orcmale/LeatherArmoredOrc.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/orcmale/MercenaryOrc1.png b/src/main/resources/assets/customnpcs/textures/entity/orcmale/MercenaryOrc1.png new file mode 100644 index 000000000..7b5e9259c Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/orcmale/MercenaryOrc1.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/orcmale/MercenaryOrc2.png b/src/main/resources/assets/customnpcs/textures/entity/orcmale/MercenaryOrc2.png new file mode 100644 index 000000000..2cc858c84 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/orcmale/MercenaryOrc2.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/orcmale/MercenaryOrc3.png b/src/main/resources/assets/customnpcs/textures/entity/orcmale/MercenaryOrc3.png new file mode 100644 index 000000000..304ba13f7 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/orcmale/MercenaryOrc3.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/orcmale/StrandedOrc.png b/src/main/resources/assets/customnpcs/textures/entity/orcmale/StrandedOrc.png new file mode 100644 index 000000000..0b9b3895b Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/orcmale/StrandedOrc.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Aloe.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Aloe.png new file mode 100644 index 000000000..8e96663f7 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Aloe.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Apple Bloom.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Apple Bloom.png new file mode 100644 index 000000000..24782cd51 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Apple Bloom.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Applejack (with hat).png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Applejack (with hat).png new file mode 100644 index 000000000..ed9ca5f44 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Applejack (with hat).png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Applejack.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Applejack.png new file mode 100644 index 000000000..ef4fe05b7 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Applejack.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Bat Pony Dee Dee.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Bat Pony Dee Dee.png new file mode 100644 index 000000000..bcedd610b Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Bat Pony Dee Dee.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Bat Pony Echo.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Bat Pony Echo.png new file mode 100644 index 000000000..941e67eb8 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Bat Pony Echo.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Bat Ponyosina.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Bat Ponyosina.png new file mode 100644 index 000000000..ad37d95d0 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Bat Ponyosina.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Berry Punch.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Berry Punch.png new file mode 100644 index 000000000..42e7c2b7a Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Berry Punch.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Big Mac.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Big Mac.png new file mode 100644 index 000000000..04c316250 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Big Mac.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Blueberry Muffin.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Blueberry Muffin.png new file mode 100644 index 000000000..4a127c64f Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Blueberry Muffin.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Bon Bon.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Bon Bon.png new file mode 100644 index 000000000..8bb0a2def Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Bon Bon.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Brolly.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Brolly.png new file mode 100644 index 000000000..1af0d3eb8 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Brolly.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Caramel.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Caramel.png new file mode 100644 index 000000000..c07679256 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Caramel.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Carrot Top.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Carrot Top.png new file mode 100644 index 000000000..f4dc9f22f Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Carrot Top.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Cheerilee.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Cheerilee.png new file mode 100644 index 000000000..237644256 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Cheerilee.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Cherries Jubilee.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Cherries Jubilee.png new file mode 100644 index 000000000..ff1998c6b Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Cherries Jubilee.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Cherry.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Cherry.png new file mode 100644 index 000000000..ca7c14baa Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Cherry.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Chocolate Sun.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Chocolate Sun.png new file mode 100644 index 000000000..193e9a261 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Chocolate Sun.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Cloud Kicker.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Cloud Kicker.png new file mode 100644 index 000000000..3a9a36e6e Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Cloud Kicker.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Colgate.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Colgate.png new file mode 100644 index 000000000..81c6af04b Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Colgate.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Crescent.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Crescent.png new file mode 100644 index 000000000..1badf2009 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Crescent.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP DJ Pon3.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP DJ Pon3.png new file mode 100644 index 000000000..d8050ed3d Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP DJ Pon3.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Derpy Hooves.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Derpy Hooves.png new file mode 100644 index 000000000..8bce86aa0 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Derpy Hooves.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Doctor Whooves.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Doctor Whooves.png new file mode 100644 index 000000000..191318491 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Doctor Whooves.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Endless Clouds.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Endless Clouds.png new file mode 100644 index 000000000..06247358e Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Endless Clouds.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Fluttershy.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Fluttershy.png new file mode 100644 index 000000000..5adbd0432 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Fluttershy.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Golden Harvest.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Golden Harvest.png new file mode 100644 index 000000000..8f5abdcf7 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Golden Harvest.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Heartstrings.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Heartstrings.png new file mode 100644 index 000000000..0f7e06f87 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Heartstrings.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Holly Dash.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Holly Dash.png new file mode 100644 index 000000000..7286c16f3 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Holly Dash.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Lemon Hearts.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Lemon Hearts.png new file mode 100644 index 000000000..0df8b15c5 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Lemon Hearts.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Lemon Tart.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Lemon Tart.png new file mode 100644 index 000000000..a2067d00d Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Lemon Tart.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Lotus.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Lotus.png new file mode 100644 index 000000000..c28c3f270 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Lotus.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Lyra.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Lyra.png new file mode 100644 index 000000000..cc2c6c272 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Lyra.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP North Pole.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP North Pole.png new file mode 100644 index 000000000..299dd40aa Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP North Pole.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Nurse Redheart.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Nurse Redheart.png new file mode 100644 index 000000000..15136be97 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Nurse Redheart.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Octavia.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Octavia.png new file mode 100644 index 000000000..b6839f7a6 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Octavia.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Orange Box.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Orange Box.png new file mode 100644 index 000000000..914ef4aee Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Orange Box.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Orange Wafer.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Orange Wafer.png new file mode 100644 index 000000000..c98029f1a Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Orange Wafer.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Orchid Dew.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Orchid Dew.png new file mode 100644 index 000000000..e27aed912 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Orchid Dew.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Pegasus Guard.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Pegasus Guard.png new file mode 100644 index 000000000..61cc78905 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Pegasus Guard.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Pinkie Pie.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Pinkie Pie.png new file mode 100644 index 000000000..8ce4d1684 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Pinkie Pie.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Princess Celestia.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Princess Celestia.png new file mode 100644 index 000000000..e405381cc Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Princess Celestia.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Princess Luna S2.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Princess Luna S2.png new file mode 100644 index 000000000..4d6a81935 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Princess Luna S2.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Rainbow Dash.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Rainbow Dash.png new file mode 100644 index 000000000..09b2ec213 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Rainbow Dash.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Raindrop.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Raindrop.png new file mode 100644 index 000000000..b866e059b Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Raindrop.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Rarity.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Rarity.png new file mode 100644 index 000000000..780b80bdd Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Rarity.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Roseluck.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Roseluck.png new file mode 100644 index 000000000..91ebb3558 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Roseluck.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Roy G Bow.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Roy G Bow.png new file mode 100644 index 000000000..f150f2348 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Roy G Bow.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Scootaloo.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Scootaloo.png new file mode 100644 index 000000000..fa0086fdd Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Scootaloo.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Soarin.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Soarin.png new file mode 100644 index 000000000..bb28707cc Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Soarin.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Sparkler.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Sparkler.png new file mode 100644 index 000000000..092606cf5 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Sparkler.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Spitfire.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Spitfire.png new file mode 100644 index 000000000..41ca0ddc6 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Spitfire.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Star Sparkle.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Star Sparkle.png new file mode 100644 index 000000000..09e02a397 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Star Sparkle.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Sweetie Belle.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Sweetie Belle.png new file mode 100644 index 000000000..c6d2ef517 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Sweetie Belle.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Trixie.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Trixie.png new file mode 100644 index 000000000..13d411f40 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Trixie.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Twilight Sparkle.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Twilight Sparkle.png new file mode 100644 index 000000000..b462c24e4 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Twilight Sparkle.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Under D Weather.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Under D Weather.png new file mode 100644 index 000000000..80f6b3ec7 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Under D Weather.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Unicorn Guard.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Unicorn Guard.png new file mode 100644 index 000000000..7e4270d72 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Unicorn Guard.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Velvet Hooves.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Velvet Hooves.png new file mode 100644 index 000000000..43d148fcd Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/MineLP Velvet Hooves.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/ponies/NormalHorse.png b/src/main/resources/assets/customnpcs/textures/entity/ponies/NormalHorse.png new file mode 100644 index 000000000..96fce7adb Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/ponies/NormalHorse.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/skeleton/Ancient Skeleton.png b/src/main/resources/assets/customnpcs/textures/entity/skeleton/Ancient Skeleton.png new file mode 100644 index 000000000..0501a78ef Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/skeleton/Ancient Skeleton.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/skeleton/Bloody Skeleton.png b/src/main/resources/assets/customnpcs/textures/entity/skeleton/Bloody Skeleton.png new file mode 100644 index 000000000..0a9ee2e5d Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/skeleton/Bloody Skeleton.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/skeleton/Golden Skeleton.png b/src/main/resources/assets/customnpcs/textures/entity/skeleton/Golden Skeleton.png new file mode 100644 index 000000000..5c71b89b1 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/skeleton/Golden Skeleton.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/skeleton/Skeleton Archer.png b/src/main/resources/assets/customnpcs/textures/entity/skeleton/Skeleton Archer.png new file mode 100644 index 000000000..0fbfc46b4 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/skeleton/Skeleton Archer.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/skeleton/Skeleton King.png b/src/main/resources/assets/customnpcs/textures/entity/skeleton/Skeleton King.png new file mode 100644 index 000000000..8546def8c Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/skeleton/Skeleton King.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/skeleton/Skeleton Mage.png b/src/main/resources/assets/customnpcs/textures/entity/skeleton/Skeleton Mage.png new file mode 100644 index 000000000..0344e603c Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/skeleton/Skeleton Mage.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/skeleton/Skeleton Priest 2.png b/src/main/resources/assets/customnpcs/textures/entity/skeleton/Skeleton Priest 2.png new file mode 100644 index 000000000..173a3e17a Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/skeleton/Skeleton Priest 2.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/skeleton/Skeleton Priest.png b/src/main/resources/assets/customnpcs/textures/entity/skeleton/Skeleton Priest.png new file mode 100644 index 000000000..f726809e6 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/skeleton/Skeleton Priest.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/skeleton/Skeleton Villager.png b/src/main/resources/assets/customnpcs/textures/entity/skeleton/Skeleton Villager.png new file mode 100644 index 000000000..e08d1d291 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/skeleton/Skeleton Villager.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/skeleton/Skeleton Warrior.png b/src/main/resources/assets/customnpcs/textures/entity/skeleton/Skeleton Warrior.png new file mode 100644 index 000000000..054c84d8f Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/skeleton/Skeleton Warrior.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/skeleton/Skeleton.png b/src/main/resources/assets/customnpcs/textures/entity/skeleton/Skeleton.png new file mode 100644 index 000000000..9d223394b Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/skeleton/Skeleton.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/slime/Chest.png b/src/main/resources/assets/customnpcs/textures/entity/slime/Chest.png new file mode 100644 index 000000000..f588c1214 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/slime/Chest.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/slime/Coal_Ore.png b/src/main/resources/assets/customnpcs/textures/entity/slime/Coal_Ore.png new file mode 100644 index 000000000..a551e8e5b Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/slime/Coal_Ore.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/slime/Cobblestone.png b/src/main/resources/assets/customnpcs/textures/entity/slime/Cobblestone.png new file mode 100644 index 000000000..826a8aec2 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/slime/Cobblestone.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/slime/Diamond_Ore.png b/src/main/resources/assets/customnpcs/textures/entity/slime/Diamond_Ore.png new file mode 100644 index 000000000..fc78c886f Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/slime/Diamond_Ore.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/slime/Dirt.png b/src/main/resources/assets/customnpcs/textures/entity/slime/Dirt.png new file mode 100644 index 000000000..f37dc0561 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/slime/Dirt.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/slime/Gold_Ore.png b/src/main/resources/assets/customnpcs/textures/entity/slime/Gold_Ore.png new file mode 100644 index 000000000..e67f3d223 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/slime/Gold_Ore.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/slime/Grass.png b/src/main/resources/assets/customnpcs/textures/entity/slime/Grass.png new file mode 100644 index 000000000..3a0541724 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/slime/Grass.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/slime/Iron_Ore.png b/src/main/resources/assets/customnpcs/textures/entity/slime/Iron_Ore.png new file mode 100644 index 000000000..cbf18a80d Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/slime/Iron_Ore.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/slime/MagmaSlime.png b/src/main/resources/assets/customnpcs/textures/entity/slime/MagmaSlime.png new file mode 100644 index 000000000..183fd3564 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/slime/MagmaSlime.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/slime/Redstone_Ore.png b/src/main/resources/assets/customnpcs/textures/entity/slime/Redstone_Ore.png new file mode 100644 index 000000000..d78e45aaf Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/slime/Redstone_Ore.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/slime/Slime.png b/src/main/resources/assets/customnpcs/textures/entity/slime/Slime.png new file mode 100644 index 000000000..fb392ffd7 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/slime/Slime.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/slime/Stone.png b/src/main/resources/assets/customnpcs/textures/entity/slime/Stone.png new file mode 100644 index 000000000..2493ee18a Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/slime/Stone.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/villagers/Bearded.png b/src/main/resources/assets/customnpcs/textures/entity/villagers/Bearded.png new file mode 100644 index 000000000..0adfbe1d7 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/villagers/Bearded.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/villagers/Companion.png b/src/main/resources/assets/customnpcs/textures/entity/villagers/Companion.png new file mode 100644 index 000000000..0d4de1d03 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/villagers/Companion.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/villagers/Fisher.png b/src/main/resources/assets/customnpcs/textures/entity/villagers/Fisher.png new file mode 100644 index 000000000..17ba6f699 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/villagers/Fisher.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/villagers/OldFarmer.png b/src/main/resources/assets/customnpcs/textures/entity/villagers/OldFarmer.png new file mode 100644 index 000000000..c57a9d7b2 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/villagers/OldFarmer.png differ diff --git a/src/main/resources/assets/customnpcs/textures/entity/villagers/shopkeeper.png b/src/main/resources/assets/customnpcs/textures/entity/villagers/shopkeeper.png new file mode 100644 index 000000000..98d3979c6 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/entity/villagers/shopkeeper.png differ diff --git a/src/main/resources/assets/customnpcs/textures/gui/arrowbuttons.png b/src/main/resources/assets/customnpcs/textures/gui/arrowbuttons.png new file mode 100644 index 000000000..75a40abe4 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/gui/arrowbuttons.png differ diff --git a/src/main/resources/assets/customnpcs/textures/gui/bankchest.png b/src/main/resources/assets/customnpcs/textures/gui/bankchest.png new file mode 100644 index 000000000..830a2b179 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/gui/bankchest.png differ diff --git a/src/main/resources/assets/customnpcs/textures/gui/bgfilled.png b/src/main/resources/assets/customnpcs/textures/gui/bgfilled.png new file mode 100644 index 000000000..5556d52ed Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/gui/bgfilled.png differ diff --git a/src/main/resources/assets/customnpcs/textures/gui/carpentry.png b/src/main/resources/assets/customnpcs/textures/gui/carpentry.png new file mode 100644 index 000000000..0e2d8104e Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/gui/carpentry.png differ diff --git a/src/main/resources/assets/customnpcs/textures/gui/color.png b/src/main/resources/assets/customnpcs/textures/gui/color.png new file mode 100644 index 000000000..3ee00e5e4 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/gui/color.png differ diff --git a/src/main/resources/assets/customnpcs/textures/gui/companion.png b/src/main/resources/assets/customnpcs/textures/gui/companion.png new file mode 100644 index 000000000..852196809 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/gui/companion.png differ diff --git a/src/main/resources/assets/customnpcs/textures/gui/companion_empty.png b/src/main/resources/assets/customnpcs/textures/gui/companion_empty.png new file mode 100644 index 000000000..916032ed5 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/gui/companion_empty.png differ diff --git a/src/main/resources/assets/customnpcs/textures/gui/companioninv.png b/src/main/resources/assets/customnpcs/textures/gui/companioninv.png new file mode 100644 index 000000000..3b99b1e21 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/gui/companioninv.png differ diff --git a/src/main/resources/assets/customnpcs/textures/gui/extrasmallbg.png b/src/main/resources/assets/customnpcs/textures/gui/extrasmallbg.png new file mode 100644 index 000000000..cf7bc2db7 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/gui/extrasmallbg.png differ diff --git a/src/main/resources/assets/customnpcs/textures/gui/follower.png b/src/main/resources/assets/customnpcs/textures/gui/follower.png new file mode 100644 index 000000000..caa83e8a7 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/gui/follower.png differ diff --git a/src/main/resources/assets/customnpcs/textures/gui/followerhire.png b/src/main/resources/assets/customnpcs/textures/gui/followerhire.png new file mode 100644 index 000000000..b486ec271 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/gui/followerhire.png differ diff --git a/src/main/resources/assets/customnpcs/textures/gui/followersetup.png b/src/main/resources/assets/customnpcs/textures/gui/followersetup.png new file mode 100644 index 000000000..d4a56fa93 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/gui/followersetup.png differ diff --git a/src/main/resources/assets/customnpcs/textures/gui/indicator.png b/src/main/resources/assets/customnpcs/textures/gui/indicator.png new file mode 100644 index 000000000..056fd1108 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/gui/indicator.png differ diff --git a/src/main/resources/assets/customnpcs/textures/gui/info.png b/src/main/resources/assets/customnpcs/textures/gui/info.png new file mode 100644 index 000000000..04bda47b1 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/gui/info.png differ diff --git a/src/main/resources/assets/customnpcs/textures/gui/inventorymenu.png b/src/main/resources/assets/customnpcs/textures/gui/inventorymenu.png new file mode 100644 index 000000000..b172ec9db Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/gui/inventorymenu.png differ diff --git a/src/main/resources/assets/customnpcs/textures/gui/invisible.png b/src/main/resources/assets/customnpcs/textures/gui/invisible.png new file mode 100644 index 000000000..06776a05b Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/gui/invisible.png differ diff --git a/src/main/resources/assets/customnpcs/textures/gui/largebg.png b/src/main/resources/assets/customnpcs/textures/gui/largebg.png new file mode 100644 index 000000000..74bd31253 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/gui/largebg.png differ diff --git a/src/main/resources/assets/customnpcs/textures/gui/logo.png b/src/main/resources/assets/customnpcs/textures/gui/logo.png new file mode 100644 index 000000000..dacca75dc Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/gui/logo.png differ diff --git a/src/main/resources/assets/customnpcs/textures/gui/menubg.png b/src/main/resources/assets/customnpcs/textures/gui/menubg.png new file mode 100644 index 000000000..84a2dd38d Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/gui/menubg.png differ diff --git a/src/main/resources/assets/customnpcs/textures/gui/menusidebutton.png b/src/main/resources/assets/customnpcs/textures/gui/menusidebutton.png new file mode 100644 index 000000000..b950a81f9 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/gui/menusidebutton.png differ diff --git a/src/main/resources/assets/customnpcs/textures/gui/menutopbutton.png b/src/main/resources/assets/customnpcs/textures/gui/menutopbutton.png new file mode 100644 index 000000000..a366f7339 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/gui/menutopbutton.png differ diff --git a/src/main/resources/assets/customnpcs/textures/gui/misc.png b/src/main/resources/assets/customnpcs/textures/gui/misc.png new file mode 100644 index 000000000..6b3fbb258 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/gui/misc.png differ diff --git a/src/main/resources/assets/customnpcs/textures/gui/npcbanksetup.png b/src/main/resources/assets/customnpcs/textures/gui/npcbanksetup.png new file mode 100644 index 000000000..97364ae02 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/gui/npcbanksetup.png differ diff --git a/src/main/resources/assets/customnpcs/textures/gui/npcinv.png b/src/main/resources/assets/customnpcs/textures/gui/npcinv.png new file mode 100644 index 000000000..042de7285 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/gui/npcinv.png differ diff --git a/src/main/resources/assets/customnpcs/textures/gui/npcitemgiver.png b/src/main/resources/assets/customnpcs/textures/gui/npcitemgiver.png new file mode 100644 index 000000000..286379a49 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/gui/npcitemgiver.png differ diff --git a/src/main/resources/assets/customnpcs/textures/gui/questreward.png b/src/main/resources/assets/customnpcs/textures/gui/questreward.png new file mode 100644 index 000000000..e892b0a82 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/gui/questreward.png differ diff --git a/src/main/resources/assets/customnpcs/textures/gui/questtypeitem.png b/src/main/resources/assets/customnpcs/textures/gui/questtypeitem.png new file mode 100644 index 000000000..4de348c5c Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/gui/questtypeitem.png differ diff --git a/src/main/resources/assets/customnpcs/textures/gui/recipes.png b/src/main/resources/assets/customnpcs/textures/gui/recipes.png new file mode 100644 index 000000000..3497d8ef7 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/gui/recipes.png differ diff --git a/src/main/resources/assets/customnpcs/textures/gui/scroll.png b/src/main/resources/assets/customnpcs/textures/gui/scroll.png new file mode 100644 index 000000000..f7a369498 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/gui/scroll.png differ diff --git a/src/main/resources/assets/customnpcs/textures/gui/slot.png b/src/main/resources/assets/customnpcs/textures/gui/slot.png new file mode 100644 index 000000000..664fde7c8 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/gui/slot.png differ diff --git a/src/main/resources/assets/customnpcs/textures/gui/smallbg.png b/src/main/resources/assets/customnpcs/textures/gui/smallbg.png new file mode 100644 index 000000000..0f54f6f7e Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/gui/smallbg.png differ diff --git a/src/main/resources/assets/customnpcs/textures/gui/standardbg.png b/src/main/resources/assets/customnpcs/textures/gui/standardbg.png new file mode 100644 index 000000000..23cc5e9f4 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/gui/standardbg.png differ diff --git a/src/main/resources/assets/customnpcs/textures/gui/talent.png b/src/main/resources/assets/customnpcs/textures/gui/talent.png new file mode 100644 index 000000000..2a9d2b139 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/gui/talent.png differ diff --git a/src/main/resources/assets/customnpcs/textures/gui/trader.png b/src/main/resources/assets/customnpcs/textures/gui/trader.png new file mode 100644 index 000000000..70f82b6cb Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/gui/trader.png differ diff --git a/src/main/resources/assets/customnpcs/textures/gui/tradersetup.png b/src/main/resources/assets/customnpcs/textures/gui/tradersetup.png new file mode 100644 index 000000000..11d611bff Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/gui/tradersetup.png differ diff --git a/src/main/resources/assets/customnpcs/textures/gui/wheel.png b/src/main/resources/assets/customnpcs/textures/gui/wheel.png new file mode 100644 index 000000000..79b3f9984 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/gui/wheel.png differ diff --git a/src/main/resources/assets/customnpcs/textures/gui/wheel1.png b/src/main/resources/assets/customnpcs/textures/gui/wheel1.png new file mode 100644 index 000000000..b82e35e3f Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/gui/wheel1.png differ diff --git a/src/main/resources/assets/customnpcs/textures/gui/wheel2.png b/src/main/resources/assets/customnpcs/textures/gui/wheel2.png new file mode 100644 index 000000000..ad9807ddc Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/gui/wheel2.png differ diff --git a/src/main/resources/assets/customnpcs/textures/gui/wheel3.png b/src/main/resources/assets/customnpcs/textures/gui/wheel3.png new file mode 100644 index 000000000..100dd0af4 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/gui/wheel3.png differ diff --git a/src/main/resources/assets/customnpcs/textures/gui/wheel4.png b/src/main/resources/assets/customnpcs/textures/gui/wheel4.png new file mode 100644 index 000000000..a75a73052 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/gui/wheel4.png differ diff --git a/src/main/resources/assets/customnpcs/textures/gui/wheel5.png b/src/main/resources/assets/customnpcs/textures/gui/wheel5.png new file mode 100644 index 000000000..5b7a02177 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/gui/wheel5.png differ diff --git a/src/main/resources/assets/customnpcs/textures/gui/wheel6.png b/src/main/resources/assets/customnpcs/textures/gui/wheel6.png new file mode 100644 index 000000000..152e02c05 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/gui/wheel6.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcAirElement.png b/src/main/resources/assets/customnpcs/textures/items/npcAirElement.png new file mode 100644 index 000000000..9f7a63fee Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcAirElement.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcAmethyst.png b/src/main/resources/assets/customnpcs/textures/items/npcAmethyst.png new file mode 100644 index 000000000..9734c3571 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcAmethyst.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcAncientCoin.png b/src/main/resources/assets/customnpcs/textures/items/npcAncientCoin.png new file mode 100644 index 000000000..9a6d8cecd Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcAncientCoin.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcAncientScroll.png b/src/main/resources/assets/customnpcs/textures/items/npcAncientScroll.png new file mode 100644 index 000000000..4813f3bc7 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcAncientScroll.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcArcaneSpell.png b/src/main/resources/assets/customnpcs/textures/items/npcArcaneSpell.png new file mode 100644 index 000000000..b949d03dd Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcArcaneSpell.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcArtifact.png b/src/main/resources/assets/customnpcs/textures/items/npcArtifact.png new file mode 100644 index 000000000..4570b104d Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcArtifact.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcAssassinBoots.png b/src/main/resources/assets/customnpcs/textures/items/npcAssassinBoots.png new file mode 100644 index 000000000..988644f3b Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcAssassinBoots.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcAssassinChest.png b/src/main/resources/assets/customnpcs/textures/items/npcAssassinChest.png new file mode 100644 index 000000000..935b8a4e4 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcAssassinChest.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcAssassinHead.png b/src/main/resources/assets/customnpcs/textures/items/npcAssassinHead.png new file mode 100644 index 000000000..83805a354 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcAssassinHead.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcAssassinLeggings.png b/src/main/resources/assets/customnpcs/textures/items/npcAssassinLeggings.png new file mode 100644 index 000000000..8f391cc6e Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcAssassinLeggings.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcBag.png b/src/main/resources/assets/customnpcs/textures/items/npcBag.png new file mode 100644 index 000000000..a71d48f23 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcBag.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcBanditMask.png b/src/main/resources/assets/customnpcs/textures/items/npcBanditMask.png new file mode 100644 index 000000000..62cea0d86 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcBanditMask.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcBanjo.png b/src/main/resources/assets/customnpcs/textures/items/npcBanjo.png new file mode 100644 index 000000000..4a041bdb6 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcBanjo.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcBaseballBat.png b/src/main/resources/assets/customnpcs/textures/items/npcBaseballBat.png new file mode 100644 index 000000000..ea825d4c0 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcBaseballBat.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcBatton.png b/src/main/resources/assets/customnpcs/textures/items/npcBatton.png new file mode 100644 index 000000000..c0c6864e5 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcBatton.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcBearClaw.png b/src/main/resources/assets/customnpcs/textures/items/npcBearClaw.png new file mode 100644 index 000000000..0e9d97975 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcBearClaw.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcBlackBullet.png b/src/main/resources/assets/customnpcs/textures/items/npcBlackBullet.png new file mode 100644 index 000000000..ba7ae7382 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcBlackBullet.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcBlueprint.png b/src/main/resources/assets/customnpcs/textures/items/npcBlueprint.png new file mode 100644 index 000000000..fdf7455a5 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcBlueprint.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcBoStaff.png b/src/main/resources/assets/customnpcs/textures/items/npcBoStaff.png new file mode 100644 index 000000000..d833ad661 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcBoStaff.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcBrokenArrow.png b/src/main/resources/assets/customnpcs/textures/items/npcBrokenArrow.png new file mode 100644 index 000000000..aaf0bdaca Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcBrokenArrow.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcBrokenBottle.png b/src/main/resources/assets/customnpcs/textures/items/npcBrokenBottle.png new file mode 100644 index 000000000..3c89d04da Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcBrokenBottle.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcBrokenOrb.png b/src/main/resources/assets/customnpcs/textures/items/npcBrokenOrb.png new file mode 100644 index 000000000..473ec5c0a Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcBrokenOrb.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcBronzeBattleAxe.png b/src/main/resources/assets/customnpcs/textures/items/npcBronzeBattleAxe.png new file mode 100644 index 000000000..2977777db Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcBronzeBattleAxe.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcBronzeBroadsword.png b/src/main/resources/assets/customnpcs/textures/items/npcBronzeBroadsword.png new file mode 100644 index 000000000..f8a0128ed Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcBronzeBroadsword.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcBronzeBullet.png b/src/main/resources/assets/customnpcs/textures/items/npcBronzeBullet.png new file mode 100644 index 000000000..bac60ed0d Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcBronzeBullet.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcBronzeDagger.png b/src/main/resources/assets/customnpcs/textures/items/npcBronzeDagger.png new file mode 100644 index 000000000..e80e33c3c Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcBronzeDagger.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcBronzeGlaive.png b/src/main/resources/assets/customnpcs/textures/items/npcBronzeGlaive.png new file mode 100644 index 000000000..fa308c910 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcBronzeGlaive.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcBronzeGun.png b/src/main/resources/assets/customnpcs/textures/items/npcBronzeGun.png new file mode 100644 index 000000000..76ca218fc Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcBronzeGun.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcBronzeHalberd.png b/src/main/resources/assets/customnpcs/textures/items/npcBronzeHalberd.png new file mode 100644 index 000000000..23e26942f Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcBronzeHalberd.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcBronzeIngot.png b/src/main/resources/assets/customnpcs/textures/items/npcBronzeIngot.png new file mode 100644 index 000000000..caf1957e0 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcBronzeIngot.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcBronzeMace.png b/src/main/resources/assets/customnpcs/textures/items/npcBronzeMace.png new file mode 100644 index 000000000..8366e5bcf Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcBronzeMace.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcBronzeScythe.png b/src/main/resources/assets/customnpcs/textures/items/npcBronzeScythe.png new file mode 100644 index 000000000..ca7e90183 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcBronzeScythe.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcBronzeShield.png b/src/main/resources/assets/customnpcs/textures/items/npcBronzeShield.png new file mode 100644 index 000000000..25170a197 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcBronzeShield.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcBronzeSkirt.png b/src/main/resources/assets/customnpcs/textures/items/npcBronzeSkirt.png new file mode 100644 index 000000000..74f8a430e Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcBronzeSkirt.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcBronzeSpear.png b/src/main/resources/assets/customnpcs/textures/items/npcBronzeSpear.png new file mode 100644 index 000000000..c8349f53a Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcBronzeSpear.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcBronzeStaff.png b/src/main/resources/assets/customnpcs/textures/items/npcBronzeStaff.png new file mode 100644 index 000000000..feb0d5242 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcBronzeStaff.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcBronzeSword.png b/src/main/resources/assets/customnpcs/textures/items/npcBronzeSword.png new file mode 100644 index 000000000..c4e2a881d Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcBronzeSword.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcBronzeTrident.png b/src/main/resources/assets/customnpcs/textures/items/npcBronzeTrident.png new file mode 100644 index 000000000..6c23b3889 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcBronzeTrident.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcBronzeWarhammer.png b/src/main/resources/assets/customnpcs/textures/items/npcBronzeWarhammer.png new file mode 100644 index 000000000..3342ea124 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcBronzeWarhammer.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcCarKey.png b/src/main/resources/assets/customnpcs/textures/items/npcCarKey.png new file mode 100644 index 000000000..9da836c7b Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcCarKey.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcChainSkirt.png b/src/main/resources/assets/customnpcs/textures/items/npcChainSkirt.png new file mode 100644 index 000000000..89b459fb4 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcChainSkirt.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcChickenSword.png b/src/main/resources/assets/customnpcs/textures/items/npcChickenSword.png new file mode 100644 index 000000000..e6b7ca725 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcChickenSword.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcClarinet.png b/src/main/resources/assets/customnpcs/textures/items/npcClarinet.png new file mode 100644 index 000000000..87d7fbe96 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcClarinet.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcCleaver.png b/src/main/resources/assets/customnpcs/textures/items/npcCleaver.png new file mode 100644 index 000000000..3c27b482f Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcCleaver.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcCoinBronze.png b/src/main/resources/assets/customnpcs/textures/items/npcCoinBronze.png new file mode 100644 index 000000000..ba129d4d8 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcCoinBronze.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcCoinDiamond.png b/src/main/resources/assets/customnpcs/textures/items/npcCoinDiamond.png new file mode 100644 index 000000000..1ef98485c Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcCoinDiamond.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcCoinEmerald.png b/src/main/resources/assets/customnpcs/textures/items/npcCoinEmerald.png new file mode 100644 index 000000000..186f88a49 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcCoinEmerald.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcCoinGold.png b/src/main/resources/assets/customnpcs/textures/items/npcCoinGold.png new file mode 100644 index 000000000..25d67ae98 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcCoinGold.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcCoinIron.png b/src/main/resources/assets/customnpcs/textures/items/npcCoinIron.png new file mode 100644 index 000000000..4ef6a2b5d Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcCoinIron.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcCoinStone.png b/src/main/resources/assets/customnpcs/textures/items/npcCoinStone.png new file mode 100644 index 000000000..3a016a797 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcCoinStone.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcCoinWooden.png b/src/main/resources/assets/customnpcs/textures/items/npcCoinWooden.png new file mode 100644 index 000000000..c23a63494 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcCoinWooden.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcCombatKnive.png b/src/main/resources/assets/customnpcs/textures/items/npcCombatKnive.png new file mode 100644 index 000000000..089036601 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcCombatKnive.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcCommissarBottom.png b/src/main/resources/assets/customnpcs/textures/items/npcCommissarBottom.png new file mode 100644 index 000000000..77fde9529 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcCommissarBottom.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcCommissarChest.png b/src/main/resources/assets/customnpcs/textures/items/npcCommissarChest.png new file mode 100644 index 000000000..6255c03f4 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcCommissarChest.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcCommissarHead.png b/src/main/resources/assets/customnpcs/textures/items/npcCommissarHead.png new file mode 100644 index 000000000..bcbb129b8 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcCommissarHead.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcCommissarLegs.png b/src/main/resources/assets/customnpcs/textures/items/npcCommissarLegs.png new file mode 100644 index 000000000..dd0be69b6 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcCommissarLegs.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcCowleatherBoots.png b/src/main/resources/assets/customnpcs/textures/items/npcCowleatherBoots.png new file mode 100644 index 000000000..74a00b447 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcCowleatherBoots.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcCowleatherChest.png b/src/main/resources/assets/customnpcs/textures/items/npcCowleatherChest.png new file mode 100644 index 000000000..cc58c3288 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcCowleatherChest.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcCowleatherHead.png b/src/main/resources/assets/customnpcs/textures/items/npcCowleatherHead.png new file mode 100644 index 000000000..c44a7ef27 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcCowleatherHead.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcCowleatherLegs.png b/src/main/resources/assets/customnpcs/textures/items/npcCowleatherLegs.png new file mode 100644 index 000000000..eb677071f Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcCowleatherLegs.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcCrossBolt.png b/src/main/resources/assets/customnpcs/textures/items/npcCrossBolt.png new file mode 100644 index 000000000..bf5354ba2 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcCrossBolt.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcCrossbow.png b/src/main/resources/assets/customnpcs/textures/items/npcCrossbow.png new file mode 100644 index 000000000..9100783c6 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcCrossbow.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcCrowbar.png b/src/main/resources/assets/customnpcs/textures/items/npcCrowbar.png new file mode 100644 index 000000000..4a55ca375 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcCrowbar.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcCrown.png b/src/main/resources/assets/customnpcs/textures/items/npcCrown.png new file mode 100644 index 000000000..6c3ef1b4e Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcCrown.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcCrown2.png b/src/main/resources/assets/customnpcs/textures/items/npcCrown2.png new file mode 100644 index 000000000..6c3fea45b Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcCrown2.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcCryscentShield.png b/src/main/resources/assets/customnpcs/textures/items/npcCryscentShield.png new file mode 100644 index 000000000..bf292d2ea Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcCryscentShield.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcCrystal.png b/src/main/resources/assets/customnpcs/textures/items/npcCrystal.png new file mode 100644 index 000000000..e5e6d3b00 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcCrystal.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcCursedTrident.png b/src/main/resources/assets/customnpcs/textures/items/npcCursedTrident.png new file mode 100644 index 000000000..14688ed4d Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcCursedTrident.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcDarkSpell.png b/src/main/resources/assets/customnpcs/textures/items/npcDarkSpell.png new file mode 100644 index 000000000..cfb5aa4b1 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcDarkSpell.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcDemonicBattleAxe.png b/src/main/resources/assets/customnpcs/textures/items/npcDemonicBattleAxe.png new file mode 100644 index 000000000..70ee10106 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcDemonicBattleAxe.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcDemonicBoots.png b/src/main/resources/assets/customnpcs/textures/items/npcDemonicBoots.png new file mode 100644 index 000000000..2d865cd01 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcDemonicBoots.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcDemonicBroadsword.png b/src/main/resources/assets/customnpcs/textures/items/npcDemonicBroadsword.png new file mode 100644 index 000000000..7e60ead87 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcDemonicBroadsword.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcDemonicChest.png b/src/main/resources/assets/customnpcs/textures/items/npcDemonicChest.png new file mode 100644 index 000000000..e1997ffbf Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcDemonicChest.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcDemonicDagger.png b/src/main/resources/assets/customnpcs/textures/items/npcDemonicDagger.png new file mode 100644 index 000000000..fdb28faa0 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcDemonicDagger.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcDemonicGlaive.png b/src/main/resources/assets/customnpcs/textures/items/npcDemonicGlaive.png new file mode 100644 index 000000000..a242436ae Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcDemonicGlaive.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcDemonicHalberd.png b/src/main/resources/assets/customnpcs/textures/items/npcDemonicHalberd.png new file mode 100644 index 000000000..321439064 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcDemonicHalberd.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcDemonicHead.png b/src/main/resources/assets/customnpcs/textures/items/npcDemonicHead.png new file mode 100644 index 000000000..ca8c160e9 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcDemonicHead.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcDemonicIngot.png b/src/main/resources/assets/customnpcs/textures/items/npcDemonicIngot.png new file mode 100644 index 000000000..5364eaf1a Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcDemonicIngot.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcDemonicLegs.png b/src/main/resources/assets/customnpcs/textures/items/npcDemonicLegs.png new file mode 100644 index 000000000..96f70fa77 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcDemonicLegs.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcDemonicMace.png b/src/main/resources/assets/customnpcs/textures/items/npcDemonicMace.png new file mode 100644 index 000000000..1847e5e42 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcDemonicMace.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcDemonicScythe.png b/src/main/resources/assets/customnpcs/textures/items/npcDemonicScythe.png new file mode 100644 index 000000000..d1d52d98d Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcDemonicScythe.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcDemonicShield.png b/src/main/resources/assets/customnpcs/textures/items/npcDemonicShield.png new file mode 100644 index 000000000..a5ac51c04 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcDemonicShield.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcDemonicSkirt.png b/src/main/resources/assets/customnpcs/textures/items/npcDemonicSkirt.png new file mode 100644 index 000000000..6df09301f Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcDemonicSkirt.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcDemonicSpear.png b/src/main/resources/assets/customnpcs/textures/items/npcDemonicSpear.png new file mode 100644 index 000000000..bb7c8e859 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcDemonicSpear.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcDemonicStaff.png b/src/main/resources/assets/customnpcs/textures/items/npcDemonicStaff.png new file mode 100644 index 000000000..bd1c5901e Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcDemonicStaff.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcDemonicSword.png b/src/main/resources/assets/customnpcs/textures/items/npcDemonicSword.png new file mode 100644 index 000000000..1a507cb37 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcDemonicSword.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcDemonicTrident.png b/src/main/resources/assets/customnpcs/textures/items/npcDemonicTrident.png new file mode 100644 index 000000000..84cd08b19 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcDemonicTrident.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcDemonicWarhammer.png b/src/main/resources/assets/customnpcs/textures/items/npcDemonicWarhammer.png new file mode 100644 index 000000000..7d7b7f65b Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcDemonicWarhammer.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcDiaShield.png b/src/main/resources/assets/customnpcs/textures/items/npcDiaShield.png new file mode 100644 index 000000000..42a23b1fa Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcDiaShield.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcDiamondBattleAxe.png b/src/main/resources/assets/customnpcs/textures/items/npcDiamondBattleAxe.png new file mode 100644 index 000000000..99719dfcb Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcDiamondBattleAxe.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcDiamondBroadsword.png b/src/main/resources/assets/customnpcs/textures/items/npcDiamondBroadsword.png new file mode 100644 index 000000000..9e5546c1d Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcDiamondBroadsword.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcDiamondBullet.png b/src/main/resources/assets/customnpcs/textures/items/npcDiamondBullet.png new file mode 100644 index 000000000..3ead3f54d Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcDiamondBullet.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcDiamondDagger.png b/src/main/resources/assets/customnpcs/textures/items/npcDiamondDagger.png new file mode 100644 index 000000000..065ab1034 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcDiamondDagger.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcDiamondGlaive.png b/src/main/resources/assets/customnpcs/textures/items/npcDiamondGlaive.png new file mode 100644 index 000000000..ce6519841 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcDiamondGlaive.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcDiamondGun.png b/src/main/resources/assets/customnpcs/textures/items/npcDiamondGun.png new file mode 100644 index 000000000..9b42c7fed Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcDiamondGun.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcDiamondHalberd.png b/src/main/resources/assets/customnpcs/textures/items/npcDiamondHalberd.png new file mode 100644 index 000000000..2ff786d15 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcDiamondHalberd.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcDiamondMace.png b/src/main/resources/assets/customnpcs/textures/items/npcDiamondMace.png new file mode 100644 index 000000000..f700186fd Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcDiamondMace.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcDiamondScythe.png b/src/main/resources/assets/customnpcs/textures/items/npcDiamondScythe.png new file mode 100644 index 000000000..50291979d Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcDiamondScythe.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcDiamondSkirt.png b/src/main/resources/assets/customnpcs/textures/items/npcDiamondSkirt.png new file mode 100644 index 000000000..bdbb4ab8f Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcDiamondSkirt.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcDiamondSpear.png b/src/main/resources/assets/customnpcs/textures/items/npcDiamondSpear.png new file mode 100644 index 000000000..e2a1e97e5 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcDiamondSpear.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcDiamondStaff.png b/src/main/resources/assets/customnpcs/textures/items/npcDiamondStaff.png new file mode 100644 index 000000000..a5dea0da0 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcDiamondStaff.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcDiamondTrident.png b/src/main/resources/assets/customnpcs/textures/items/npcDiamondTrident.png new file mode 100644 index 000000000..79c86effc Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcDiamondTrident.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcDiamondWarhammer.png b/src/main/resources/assets/customnpcs/textures/items/npcDiamondWarhammer.png new file mode 100644 index 000000000..ab274efae Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcDiamondWarhammer.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcEarthElement.png b/src/main/resources/assets/customnpcs/textures/items/npcEarthElement.png new file mode 100644 index 000000000..48b9d6d6a Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcEarthElement.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcElementalStaff.png b/src/main/resources/assets/customnpcs/textures/items/npcElementalStaff.png new file mode 100644 index 000000000..d766254b6 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcElementalStaff.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcEmeraldBattleAxe.png b/src/main/resources/assets/customnpcs/textures/items/npcEmeraldBattleAxe.png new file mode 100644 index 000000000..d03e6f14d Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcEmeraldBattleAxe.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcEmeraldBroadsword.png b/src/main/resources/assets/customnpcs/textures/items/npcEmeraldBroadsword.png new file mode 100644 index 000000000..524dcfca8 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcEmeraldBroadsword.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcEmeraldBullet.png b/src/main/resources/assets/customnpcs/textures/items/npcEmeraldBullet.png new file mode 100644 index 000000000..4d556cd4f Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcEmeraldBullet.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcEmeraldDagger.png b/src/main/resources/assets/customnpcs/textures/items/npcEmeraldDagger.png new file mode 100644 index 000000000..0e149f5bb Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcEmeraldDagger.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcEmeraldGlaive.png b/src/main/resources/assets/customnpcs/textures/items/npcEmeraldGlaive.png new file mode 100644 index 000000000..2a8fce2f4 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcEmeraldGlaive.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcEmeraldGun.png b/src/main/resources/assets/customnpcs/textures/items/npcEmeraldGun.png new file mode 100644 index 000000000..9083a2cea Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcEmeraldGun.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcEmeraldHalberd.png b/src/main/resources/assets/customnpcs/textures/items/npcEmeraldHalberd.png new file mode 100644 index 000000000..531afc976 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcEmeraldHalberd.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcEmeraldMace.png b/src/main/resources/assets/customnpcs/textures/items/npcEmeraldMace.png new file mode 100644 index 000000000..224033710 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcEmeraldMace.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcEmeraldScythe.png b/src/main/resources/assets/customnpcs/textures/items/npcEmeraldScythe.png new file mode 100644 index 000000000..4c6b62076 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcEmeraldScythe.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcEmeraldShield.png b/src/main/resources/assets/customnpcs/textures/items/npcEmeraldShield.png new file mode 100644 index 000000000..273a90fe7 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcEmeraldShield.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcEmeraldSkirt.png b/src/main/resources/assets/customnpcs/textures/items/npcEmeraldSkirt.png new file mode 100644 index 000000000..720028624 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcEmeraldSkirt.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcEmeraldSpear.png b/src/main/resources/assets/customnpcs/textures/items/npcEmeraldSpear.png new file mode 100644 index 000000000..4e2fdd9c5 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcEmeraldSpear.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcEmeraldStaff.png b/src/main/resources/assets/customnpcs/textures/items/npcEmeraldStaff.png new file mode 100644 index 000000000..373dc9d91 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcEmeraldStaff.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcEmeraldSword.png b/src/main/resources/assets/customnpcs/textures/items/npcEmeraldSword.png new file mode 100644 index 000000000..793bf4aa1 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcEmeraldSword.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcEmeraldTrident.png b/src/main/resources/assets/customnpcs/textures/items/npcEmeraldTrident.png new file mode 100644 index 000000000..f74f8e576 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcEmeraldTrident.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcEmeraldWarhammer.png b/src/main/resources/assets/customnpcs/textures/items/npcEmeraldWarhammer.png new file mode 100644 index 000000000..981ed513e Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcEmeraldWarhammer.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcExcalibur.png b/src/main/resources/assets/customnpcs/textures/items/npcExcalibur.png new file mode 100644 index 000000000..4992c8151 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcExcalibur.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcFireElement.png b/src/main/resources/assets/customnpcs/textures/items/npcFireElement.png new file mode 100644 index 000000000..4351404dd Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcFireElement.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcFireSpell.png b/src/main/resources/assets/customnpcs/textures/items/npcFireSpell.png new file mode 100644 index 000000000..6c46eea11 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcFireSpell.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcFrenchHorn.png b/src/main/resources/assets/customnpcs/textures/items/npcFrenchHorn.png new file mode 100644 index 000000000..1af1051b2 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcFrenchHorn.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcFrostBattleAxe.png b/src/main/resources/assets/customnpcs/textures/items/npcFrostBattleAxe.png new file mode 100644 index 000000000..ffd05c3c2 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcFrostBattleAxe.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcFrostBroadsword.png b/src/main/resources/assets/customnpcs/textures/items/npcFrostBroadsword.png new file mode 100644 index 000000000..d5f46d559 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcFrostBroadsword.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcFrostDagger.png b/src/main/resources/assets/customnpcs/textures/items/npcFrostDagger.png new file mode 100644 index 000000000..3a5cd1dda Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcFrostDagger.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcFrostGlaive.png b/src/main/resources/assets/customnpcs/textures/items/npcFrostGlaive.png new file mode 100644 index 000000000..1491441bd Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcFrostGlaive.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcFrostHalberd.png b/src/main/resources/assets/customnpcs/textures/items/npcFrostHalberd.png new file mode 100644 index 000000000..857492515 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcFrostHalberd.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcFrostMace.png b/src/main/resources/assets/customnpcs/textures/items/npcFrostMace.png new file mode 100644 index 000000000..e8efcbd39 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcFrostMace.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcFrostScythe.png b/src/main/resources/assets/customnpcs/textures/items/npcFrostScythe.png new file mode 100644 index 000000000..d4e023405 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcFrostScythe.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcFrostShield.png b/src/main/resources/assets/customnpcs/textures/items/npcFrostShield.png new file mode 100644 index 000000000..fb089dcc4 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcFrostShield.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcFrostSpear.png b/src/main/resources/assets/customnpcs/textures/items/npcFrostSpear.png new file mode 100644 index 000000000..d4d77dc02 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcFrostSpear.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcFrostStaff.png b/src/main/resources/assets/customnpcs/textures/items/npcFrostStaff.png new file mode 100644 index 000000000..2f2d9a2af Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcFrostStaff.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcFrostSword.png b/src/main/resources/assets/customnpcs/textures/items/npcFrostSword.png new file mode 100644 index 000000000..f4d49475b Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcFrostSword.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcFrostTrident.png b/src/main/resources/assets/customnpcs/textures/items/npcFrostTrident.png new file mode 100644 index 000000000..39b8c5d2d Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcFrostTrident.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcFrostWarhammer.png b/src/main/resources/assets/customnpcs/textures/items/npcFrostWarhammer.png new file mode 100644 index 000000000..1ed7c6726 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcFrostWarhammer.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcFullBronzeBoots.png b/src/main/resources/assets/customnpcs/textures/items/npcFullBronzeBoots.png new file mode 100644 index 000000000..b409f8cc2 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcFullBronzeBoots.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcFullBronzeChest.png b/src/main/resources/assets/customnpcs/textures/items/npcFullBronzeChest.png new file mode 100644 index 000000000..432ace534 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcFullBronzeChest.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcFullBronzeHead.png b/src/main/resources/assets/customnpcs/textures/items/npcFullBronzeHead.png new file mode 100644 index 000000000..c333e4e17 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcFullBronzeHead.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcFullBronzeLeggings.png b/src/main/resources/assets/customnpcs/textures/items/npcFullBronzeLeggings.png new file mode 100644 index 000000000..a79180a2a Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcFullBronzeLeggings.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcFullBronzeShield.png b/src/main/resources/assets/customnpcs/textures/items/npcFullBronzeShield.png new file mode 100644 index 000000000..901a48eee Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcFullBronzeShield.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcFullDiaShield.png b/src/main/resources/assets/customnpcs/textures/items/npcFullDiaShield.png new file mode 100644 index 000000000..c89ad0035 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcFullDiaShield.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcFullDiamondChest.png b/src/main/resources/assets/customnpcs/textures/items/npcFullDiamondChest.png new file mode 100644 index 000000000..883799be7 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcFullDiamondChest.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcFullDiamondHead.png b/src/main/resources/assets/customnpcs/textures/items/npcFullDiamondHead.png new file mode 100644 index 000000000..4c7fdb6b7 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcFullDiamondHead.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcFullEmeraldBoots.png b/src/main/resources/assets/customnpcs/textures/items/npcFullEmeraldBoots.png new file mode 100644 index 000000000..5e485c134 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcFullEmeraldBoots.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcFullEmeraldChest.png b/src/main/resources/assets/customnpcs/textures/items/npcFullEmeraldChest.png new file mode 100644 index 000000000..691b2befb Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcFullEmeraldChest.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcFullEmeraldHead.png b/src/main/resources/assets/customnpcs/textures/items/npcFullEmeraldHead.png new file mode 100644 index 000000000..3b858bd94 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcFullEmeraldHead.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcFullEmeraldLeggings.png b/src/main/resources/assets/customnpcs/textures/items/npcFullEmeraldLeggings.png new file mode 100644 index 000000000..6d3cde740 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcFullEmeraldLeggings.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcFullEmeraldShield.png b/src/main/resources/assets/customnpcs/textures/items/npcFullEmeraldShield.png new file mode 100644 index 000000000..28a10dea8 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcFullEmeraldShield.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcFullGoldChest.png b/src/main/resources/assets/customnpcs/textures/items/npcFullGoldChest.png new file mode 100644 index 000000000..fe3a55398 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcFullGoldChest.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcFullGoldHead.png b/src/main/resources/assets/customnpcs/textures/items/npcFullGoldHead.png new file mode 100644 index 000000000..3bcb85b0a Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcFullGoldHead.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcFullGoldenShield.png b/src/main/resources/assets/customnpcs/textures/items/npcFullGoldenShield.png new file mode 100644 index 000000000..ff6671c73 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcFullGoldenShield.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcFullIronChest.png b/src/main/resources/assets/customnpcs/textures/items/npcFullIronChest.png new file mode 100644 index 000000000..e8798b409 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcFullIronChest.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcFullIronHead.png b/src/main/resources/assets/customnpcs/textures/items/npcFullIronHead.png new file mode 100644 index 000000000..b571207c4 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcFullIronHead.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcFullIronShield.png b/src/main/resources/assets/customnpcs/textures/items/npcFullIronShield.png new file mode 100644 index 000000000..1cb7f4204 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcFullIronShield.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcFullLeatherChest.png b/src/main/resources/assets/customnpcs/textures/items/npcFullLeatherChest.png new file mode 100644 index 000000000..aedbda6a4 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcFullLeatherChest.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcFullLeatherHead.png b/src/main/resources/assets/customnpcs/textures/items/npcFullLeatherHead.png new file mode 100644 index 000000000..f7a086153 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcFullLeatherHead.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcFullStoneShield.png b/src/main/resources/assets/customnpcs/textures/items/npcFullStoneShield.png new file mode 100644 index 000000000..16f1f31e9 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcFullStoneShield.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcFullWoodenBoots.png b/src/main/resources/assets/customnpcs/textures/items/npcFullWoodenBoots.png new file mode 100644 index 000000000..a51e9032b Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcFullWoodenBoots.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcFullWoodenChest.png b/src/main/resources/assets/customnpcs/textures/items/npcFullWoodenChest.png new file mode 100644 index 000000000..2219f571e Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcFullWoodenChest.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcFullWoodenHead.png b/src/main/resources/assets/customnpcs/textures/items/npcFullWoodenHead.png new file mode 100644 index 000000000..f12aa1e10 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcFullWoodenHead.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcFullWoodenLeggings.png b/src/main/resources/assets/customnpcs/textures/items/npcFullWoodenLeggings.png new file mode 100644 index 000000000..fe86bc8f4 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcFullWoodenLeggings.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcFullWoodenShield.png b/src/main/resources/assets/customnpcs/textures/items/npcFullWoodenShield.png new file mode 100644 index 000000000..b2362efdd Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcFullWoodenShield.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcGiantShuriken.png b/src/main/resources/assets/customnpcs/textures/items/npcGiantShuriken.png new file mode 100644 index 000000000..80956d325 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcGiantShuriken.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcGoldGun.png b/src/main/resources/assets/customnpcs/textures/items/npcGoldGun.png new file mode 100644 index 000000000..81a614b0a Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcGoldGun.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcGoldSkirt.png b/src/main/resources/assets/customnpcs/textures/items/npcGoldSkirt.png new file mode 100644 index 000000000..4361612dc Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcGoldSkirt.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcGoldTrident.png b/src/main/resources/assets/customnpcs/textures/items/npcGoldTrident.png new file mode 100644 index 000000000..cc8d9ba01 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcGoldTrident.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcGoldenBattleAxe.png b/src/main/resources/assets/customnpcs/textures/items/npcGoldenBattleAxe.png new file mode 100644 index 000000000..0b83aef02 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcGoldenBattleAxe.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcGoldenBroadsword.png b/src/main/resources/assets/customnpcs/textures/items/npcGoldenBroadsword.png new file mode 100644 index 000000000..cb376dee4 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcGoldenBroadsword.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcGoldenBullet.png b/src/main/resources/assets/customnpcs/textures/items/npcGoldenBullet.png new file mode 100644 index 000000000..054d354ab Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcGoldenBullet.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcGoldenDagger.png b/src/main/resources/assets/customnpcs/textures/items/npcGoldenDagger.png new file mode 100644 index 000000000..b700db60c Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcGoldenDagger.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcGoldenGlaive.png b/src/main/resources/assets/customnpcs/textures/items/npcGoldenGlaive.png new file mode 100644 index 000000000..25750681c Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcGoldenGlaive.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcGoldenHalberd.png b/src/main/resources/assets/customnpcs/textures/items/npcGoldenHalberd.png new file mode 100644 index 000000000..cb463a06a Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcGoldenHalberd.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcGoldenMace.png b/src/main/resources/assets/customnpcs/textures/items/npcGoldenMace.png new file mode 100644 index 000000000..a9176b54f Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcGoldenMace.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcGoldenScythe.png b/src/main/resources/assets/customnpcs/textures/items/npcGoldenScythe.png new file mode 100644 index 000000000..401c48a92 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcGoldenScythe.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcGoldenShield.png b/src/main/resources/assets/customnpcs/textures/items/npcGoldenShield.png new file mode 100644 index 000000000..1388c44ef Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcGoldenShield.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcGoldenSpear.png b/src/main/resources/assets/customnpcs/textures/items/npcGoldenSpear.png new file mode 100644 index 000000000..27996fcdd Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcGoldenSpear.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcGoldenStaff.png b/src/main/resources/assets/customnpcs/textures/items/npcGoldenStaff.png new file mode 100644 index 000000000..0d14dc6bc Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcGoldenStaff.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcGoldenWarhammer.png b/src/main/resources/assets/customnpcs/textures/items/npcGoldenWarhammer.png new file mode 100644 index 000000000..b48694387 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcGoldenWarhammer.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcGolfClub.png b/src/main/resources/assets/customnpcs/textures/items/npcGolfClub.png new file mode 100644 index 000000000..20d3d29ae Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcGolfClub.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcGuitar.png b/src/main/resources/assets/customnpcs/textures/items/npcGuitar.png new file mode 100644 index 000000000..05e62a0f0 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcGuitar.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcGunChainsaw.png b/src/main/resources/assets/customnpcs/textures/items/npcGunChainsaw.png new file mode 100644 index 000000000..b61193127 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcGunChainsaw.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcHammer.png b/src/main/resources/assets/customnpcs/textures/items/npcHammer.png new file mode 100644 index 000000000..e56f88978 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcHammer.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcHandCuffs.png b/src/main/resources/assets/customnpcs/textures/items/npcHandCuffs.png new file mode 100644 index 000000000..64c3cde84 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcHandCuffs.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcHarp.png b/src/main/resources/assets/customnpcs/textures/items/npcHarp.png new file mode 100644 index 000000000..8b11bec8e Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcHarp.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcHeart.png b/src/main/resources/assets/customnpcs/textures/items/npcHeart.png new file mode 100644 index 000000000..211be9a8e Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcHeart.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcHeaterShield.png b/src/main/resources/assets/customnpcs/textures/items/npcHeaterShield.png new file mode 100644 index 000000000..91c0332dd Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcHeaterShield.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcHockeyStick.png b/src/main/resources/assets/customnpcs/textures/items/npcHockeyStick.png new file mode 100644 index 000000000..7dc674524 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcHockeyStick.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcHolySpell.png b/src/main/resources/assets/customnpcs/textures/items/npcHolySpell.png new file mode 100644 index 000000000..8feb36ba3 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcHolySpell.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcIceSpell.png b/src/main/resources/assets/customnpcs/textures/items/npcIceSpell.png new file mode 100644 index 000000000..b631ebff8 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcIceSpell.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcInfantryHelmet.png b/src/main/resources/assets/customnpcs/textures/items/npcInfantryHelmet.png new file mode 100644 index 000000000..4cfa2a9ca Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcInfantryHelmet.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcIronBattleAxe.png b/src/main/resources/assets/customnpcs/textures/items/npcIronBattleAxe.png new file mode 100644 index 000000000..4f3cd93df Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcIronBattleAxe.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcIronBroadsword.png b/src/main/resources/assets/customnpcs/textures/items/npcIronBroadsword.png new file mode 100644 index 000000000..146bef514 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcIronBroadsword.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcIronBullet.png b/src/main/resources/assets/customnpcs/textures/items/npcIronBullet.png new file mode 100644 index 000000000..77539c43e Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcIronBullet.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcIronDagger.png b/src/main/resources/assets/customnpcs/textures/items/npcIronDagger.png new file mode 100644 index 000000000..be0b90c5d Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcIronDagger.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcIronGlaive.png b/src/main/resources/assets/customnpcs/textures/items/npcIronGlaive.png new file mode 100644 index 000000000..87214cbbf Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcIronGlaive.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcIronGun.png b/src/main/resources/assets/customnpcs/textures/items/npcIronGun.png new file mode 100644 index 000000000..ec01d392a Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcIronGun.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcIronHalberd.png b/src/main/resources/assets/customnpcs/textures/items/npcIronHalberd.png new file mode 100644 index 000000000..ffb1dc2aa Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcIronHalberd.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcIronMace.png b/src/main/resources/assets/customnpcs/textures/items/npcIronMace.png new file mode 100644 index 000000000..6a586a4b5 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcIronMace.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcIronScythe.png b/src/main/resources/assets/customnpcs/textures/items/npcIronScythe.png new file mode 100644 index 000000000..b82f3c174 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcIronScythe.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcIronShield.png b/src/main/resources/assets/customnpcs/textures/items/npcIronShield.png new file mode 100644 index 000000000..b79e19987 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcIronShield.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcIronSkirt.png b/src/main/resources/assets/customnpcs/textures/items/npcIronSkirt.png new file mode 100644 index 000000000..772a983fe Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcIronSkirt.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcIronSpear.png b/src/main/resources/assets/customnpcs/textures/items/npcIronSpear.png new file mode 100644 index 000000000..91c56fcd3 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcIronSpear.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcIronStaff.png b/src/main/resources/assets/customnpcs/textures/items/npcIronStaff.png new file mode 100644 index 000000000..eebbb6deb Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcIronStaff.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcIronTrident.png b/src/main/resources/assets/customnpcs/textures/items/npcIronTrident.png new file mode 100644 index 000000000..6ed9227ec Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcIronTrident.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcIronWarhammer.png b/src/main/resources/assets/customnpcs/textures/items/npcIronWarhammer.png new file mode 100644 index 000000000..d617eff3b Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcIronWarhammer.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcKatana.png b/src/main/resources/assets/customnpcs/textures/items/npcKatana.png new file mode 100644 index 000000000..381ca28a7 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcKatana.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcKatar.png b/src/main/resources/assets/customnpcs/textures/items/npcKatar.png new file mode 100644 index 000000000..70a142743 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcKatar.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcKey.png b/src/main/resources/assets/customnpcs/textures/items/npcKey.png new file mode 100644 index 000000000..d5fd98d71 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcKey.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcKey2.png b/src/main/resources/assets/customnpcs/textures/items/npcKey2.png new file mode 100644 index 000000000..d5e55fa2c Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcKey2.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcKukri.png b/src/main/resources/assets/customnpcs/textures/items/npcKukri.png new file mode 100644 index 000000000..1ee66a727 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcKukri.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcKunai.png b/src/main/resources/assets/customnpcs/textures/items/npcKunai.png new file mode 100644 index 000000000..02d16001f Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcKunai.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcLeadPipe.png b/src/main/resources/assets/customnpcs/textures/items/npcLeadPipe.png new file mode 100644 index 000000000..6abdf3139 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcLeadPipe.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcLeafBlade.png b/src/main/resources/assets/customnpcs/textures/items/npcLeafBlade.png new file mode 100644 index 000000000..11c66486a Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcLeafBlade.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcLeatherSkirt.png b/src/main/resources/assets/customnpcs/textures/items/npcLeatherSkirt.png new file mode 100644 index 000000000..3dace3eaf Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcLeatherSkirt.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcLetter.png b/src/main/resources/assets/customnpcs/textures/items/npcLetter.png new file mode 100644 index 000000000..7eef3624e Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcLetter.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcLighter.png b/src/main/resources/assets/customnpcs/textures/items/npcLighter.png new file mode 100644 index 000000000..1b94b91a7 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcLighter.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcLightningSpell.png b/src/main/resources/assets/customnpcs/textures/items/npcLightningSpell.png new file mode 100644 index 000000000..08964145e Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcLightningSpell.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcLocket.png b/src/main/resources/assets/customnpcs/textures/items/npcLocket.png new file mode 100644 index 000000000..d054aa38e Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcLocket.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcMachineGun.png b/src/main/resources/assets/customnpcs/textures/items/npcMachineGun.png new file mode 100644 index 000000000..37219cdb2 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcMachineGun.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcMacuahuitl.png b/src/main/resources/assets/customnpcs/textures/items/npcMacuahuitl.png new file mode 100644 index 000000000..946841daf Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcMacuahuitl.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcMagicWand.png b/src/main/resources/assets/customnpcs/textures/items/npcMagicWand.png new file mode 100644 index 000000000..b1618a934 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcMagicWand.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcMana.png b/src/main/resources/assets/customnpcs/textures/items/npcMana.png new file mode 100644 index 000000000..5baf290ac Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcMana.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcMithrilBattleAxe.png b/src/main/resources/assets/customnpcs/textures/items/npcMithrilBattleAxe.png new file mode 100644 index 000000000..0d368b6b3 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcMithrilBattleAxe.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcMithrilBoots.png b/src/main/resources/assets/customnpcs/textures/items/npcMithrilBoots.png new file mode 100644 index 000000000..c5c49de04 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcMithrilBoots.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcMithrilBroadsword.png b/src/main/resources/assets/customnpcs/textures/items/npcMithrilBroadsword.png new file mode 100644 index 000000000..928d88c00 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcMithrilBroadsword.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcMithrilChest.png b/src/main/resources/assets/customnpcs/textures/items/npcMithrilChest.png new file mode 100644 index 000000000..38908e03d Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcMithrilChest.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcMithrilDagger.png b/src/main/resources/assets/customnpcs/textures/items/npcMithrilDagger.png new file mode 100644 index 000000000..00373fa5e Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcMithrilDagger.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcMithrilGlaive.png b/src/main/resources/assets/customnpcs/textures/items/npcMithrilGlaive.png new file mode 100644 index 000000000..0cbb664e4 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcMithrilGlaive.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcMithrilHalberd.png b/src/main/resources/assets/customnpcs/textures/items/npcMithrilHalberd.png new file mode 100644 index 000000000..7f489986a Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcMithrilHalberd.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcMithrilHead.png b/src/main/resources/assets/customnpcs/textures/items/npcMithrilHead.png new file mode 100644 index 000000000..5d62b345f Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcMithrilHead.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcMithrilIngot.png b/src/main/resources/assets/customnpcs/textures/items/npcMithrilIngot.png new file mode 100644 index 000000000..dc180ac4a Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcMithrilIngot.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcMithrilLegs.png b/src/main/resources/assets/customnpcs/textures/items/npcMithrilLegs.png new file mode 100644 index 000000000..94dcd0c2f Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcMithrilLegs.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcMithrilMace.png b/src/main/resources/assets/customnpcs/textures/items/npcMithrilMace.png new file mode 100644 index 000000000..13fd73e7d Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcMithrilMace.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcMithrilScythe.png b/src/main/resources/assets/customnpcs/textures/items/npcMithrilScythe.png new file mode 100644 index 000000000..3e89468ce Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcMithrilScythe.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcMithrilShield.png b/src/main/resources/assets/customnpcs/textures/items/npcMithrilShield.png new file mode 100644 index 000000000..ab67cb3b3 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcMithrilShield.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcMithrilSkirt.png b/src/main/resources/assets/customnpcs/textures/items/npcMithrilSkirt.png new file mode 100644 index 000000000..c3b7a1678 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcMithrilSkirt.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcMithrilSpear.png b/src/main/resources/assets/customnpcs/textures/items/npcMithrilSpear.png new file mode 100644 index 000000000..16b024303 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcMithrilSpear.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcMithrilStaff.png b/src/main/resources/assets/customnpcs/textures/items/npcMithrilStaff.png new file mode 100644 index 000000000..aa3755c26 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcMithrilStaff.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcMithrilSword.png b/src/main/resources/assets/customnpcs/textures/items/npcMithrilSword.png new file mode 100644 index 000000000..216739ede Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcMithrilSword.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcMithrilTrident.png b/src/main/resources/assets/customnpcs/textures/items/npcMithrilTrident.png new file mode 100644 index 000000000..66adca090 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcMithrilTrident.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcMithrilWarhammer.png b/src/main/resources/assets/customnpcs/textures/items/npcMithrilWarhammer.png new file mode 100644 index 000000000..af12babd4 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcMithrilWarhammer.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcMoney.png b/src/main/resources/assets/customnpcs/textures/items/npcMoney.png new file mode 100644 index 000000000..4b8c3e744 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcMoney.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcMusket.png b/src/main/resources/assets/customnpcs/textures/items/npcMusket.png new file mode 100644 index 000000000..ab19c3718 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcMusket.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcNanorumBoots.png b/src/main/resources/assets/customnpcs/textures/items/npcNanorumBoots.png new file mode 100644 index 000000000..10bcbc737 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcNanorumBoots.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcNanorumChest.png b/src/main/resources/assets/customnpcs/textures/items/npcNanorumChest.png new file mode 100644 index 000000000..e420b2cca Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcNanorumChest.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcNanorumHead.png b/src/main/resources/assets/customnpcs/textures/items/npcNanorumHead.png new file mode 100644 index 000000000..b6a991c0d Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcNanorumHead.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcNanorumLegs.png b/src/main/resources/assets/customnpcs/textures/items/npcNanorumLegs.png new file mode 100644 index 000000000..aba63aa6a Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcNanorumLegs.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcNatureSpell.png b/src/main/resources/assets/customnpcs/textures/items/npcNatureSpell.png new file mode 100644 index 000000000..99d627f05 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcNatureSpell.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcNecklace.png b/src/main/resources/assets/customnpcs/textures/items/npcNecklace.png new file mode 100644 index 000000000..14765c86f Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcNecklace.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcNinjaChest.png b/src/main/resources/assets/customnpcs/textures/items/npcNinjaChest.png new file mode 100644 index 000000000..551300681 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcNinjaChest.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcNinjaClaw.png b/src/main/resources/assets/customnpcs/textures/items/npcNinjaClaw.png new file mode 100644 index 000000000..5bf879a2e Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcNinjaClaw.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcNinjaHead.png b/src/main/resources/assets/customnpcs/textures/items/npcNinjaHead.png new file mode 100644 index 000000000..e13b83702 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcNinjaHead.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcNinjaPants.png b/src/main/resources/assets/customnpcs/textures/items/npcNinjaPants.png new file mode 100644 index 000000000..4499db42c Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcNinjaPants.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcOcarina.png b/src/main/resources/assets/customnpcs/textures/items/npcOcarina.png new file mode 100644 index 000000000..0d59a840f Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcOcarina.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcOfficerChest.png b/src/main/resources/assets/customnpcs/textures/items/npcOfficerChest.png new file mode 100644 index 000000000..f2b65b84e Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcOfficerChest.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcOrb.png b/src/main/resources/assets/customnpcs/textures/items/npcOrb.png new file mode 100644 index 000000000..a88d7be9d Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcOrb.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcPaperCrown.png b/src/main/resources/assets/customnpcs/textures/items/npcPaperCrown.png new file mode 100644 index 000000000..95256ad16 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcPaperCrown.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcPendant.png b/src/main/resources/assets/customnpcs/textures/items/npcPendant.png new file mode 100644 index 000000000..896524b7c Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcPendant.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcPhone.png b/src/main/resources/assets/customnpcs/textures/items/npcPhone.png new file mode 100644 index 000000000..57926138d Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcPhone.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcPipeWrench.png b/src/main/resources/assets/customnpcs/textures/items/npcPipeWrench.png new file mode 100644 index 000000000..f35ad0065 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcPipeWrench.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcPlans.png b/src/main/resources/assets/customnpcs/textures/items/npcPlans.png new file mode 100644 index 000000000..94aff68d9 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcPlans.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcRapier.png b/src/main/resources/assets/customnpcs/textures/items/npcRapier.png new file mode 100644 index 000000000..2aaa72aa5 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcRapier.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcRing.png b/src/main/resources/assets/customnpcs/textures/items/npcRing.png new file mode 100644 index 000000000..3af0297b3 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcRing.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcRuby.png b/src/main/resources/assets/customnpcs/textures/items/npcRuby.png new file mode 100644 index 000000000..fb4dacdf4 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcRuby.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcSaber.png b/src/main/resources/assets/customnpcs/textures/items/npcSaber.png new file mode 100644 index 000000000..d843ca31b Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcSaber.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcSaiBlade.png b/src/main/resources/assets/customnpcs/textures/items/npcSaiBlade.png new file mode 100644 index 000000000..faf19adee Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcSaiBlade.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcSaphire.png b/src/main/resources/assets/customnpcs/textures/items/npcSaphire.png new file mode 100644 index 000000000..94684056d Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcSaphire.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcSatchel.png b/src/main/resources/assets/customnpcs/textures/items/npcSatchel.png new file mode 100644 index 000000000..18f582cad Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcSatchel.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcScutumShield.png b/src/main/resources/assets/customnpcs/textures/items/npcScutumShield.png new file mode 100644 index 000000000..b6ea9696b Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcScutumShield.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcSeveredEar.png b/src/main/resources/assets/customnpcs/textures/items/npcSeveredEar.png new file mode 100644 index 000000000..50e879c27 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcSeveredEar.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcShuriken.png b/src/main/resources/assets/customnpcs/textures/items/npcShuriken.png new file mode 100644 index 000000000..f32d71c69 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcShuriken.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcSilk.png b/src/main/resources/assets/customnpcs/textures/items/npcSilk.png new file mode 100644 index 000000000..ff4ffa9d8 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcSilk.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcSkull.png b/src/main/resources/assets/customnpcs/textures/items/npcSkull.png new file mode 100644 index 000000000..ca8e46ac2 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcSkull.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcSledgeHammer.png b/src/main/resources/assets/customnpcs/textures/items/npcSledgeHammer.png new file mode 100644 index 000000000..d6b2f11de Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcSledgeHammer.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcSlingshot.png b/src/main/resources/assets/customnpcs/textures/items/npcSlingshot.png new file mode 100644 index 000000000..812373a5b Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcSlingshot.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcSoldierBottom.png b/src/main/resources/assets/customnpcs/textures/items/npcSoldierBottom.png new file mode 100644 index 000000000..8ccb1af8e Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcSoldierBottom.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcSoldierChest.png b/src/main/resources/assets/customnpcs/textures/items/npcSoldierChest.png new file mode 100644 index 000000000..51fd6efb4 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcSoldierChest.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcSoldierHead.png b/src/main/resources/assets/customnpcs/textures/items/npcSoldierHead.png new file mode 100644 index 000000000..2de5fe50c Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcSoldierHead.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcSoldierLegs.png b/src/main/resources/assets/customnpcs/textures/items/npcSoldierLegs.png new file mode 100644 index 000000000..f868cc624 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcSoldierLegs.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcSoulstoneEmpty.png b/src/main/resources/assets/customnpcs/textures/items/npcSoulstoneEmpty.png new file mode 100644 index 000000000..84644f850 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcSoulstoneEmpty.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcSoulstoneFilled.png b/src/main/resources/assets/customnpcs/textures/items/npcSoulstoneFilled.png new file mode 100644 index 000000000..2692d78c8 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcSoulstoneFilled.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcStatuette.png b/src/main/resources/assets/customnpcs/textures/items/npcStatuette.png new file mode 100644 index 000000000..bbea8a79f Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcStatuette.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcSteelClaw.png b/src/main/resources/assets/customnpcs/textures/items/npcSteelClaw.png new file mode 100644 index 000000000..5ee899f65 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcSteelClaw.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcStoneBattleAxe.png b/src/main/resources/assets/customnpcs/textures/items/npcStoneBattleAxe.png new file mode 100644 index 000000000..fecb95f70 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcStoneBattleAxe.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcStoneBroadsword.png b/src/main/resources/assets/customnpcs/textures/items/npcStoneBroadsword.png new file mode 100644 index 000000000..f8df4acc7 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcStoneBroadsword.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcStoneBullet.png b/src/main/resources/assets/customnpcs/textures/items/npcStoneBullet.png new file mode 100644 index 000000000..8d5d4d054 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcStoneBullet.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcStoneDagger.png b/src/main/resources/assets/customnpcs/textures/items/npcStoneDagger.png new file mode 100644 index 000000000..5356de876 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcStoneDagger.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcStoneGlaive.png b/src/main/resources/assets/customnpcs/textures/items/npcStoneGlaive.png new file mode 100644 index 000000000..a1ce5844b Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcStoneGlaive.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcStoneGun.png b/src/main/resources/assets/customnpcs/textures/items/npcStoneGun.png new file mode 100644 index 000000000..e18573320 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcStoneGun.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcStoneHalberd.png b/src/main/resources/assets/customnpcs/textures/items/npcStoneHalberd.png new file mode 100644 index 000000000..b7fd69b65 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcStoneHalberd.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcStoneMace.png b/src/main/resources/assets/customnpcs/textures/items/npcStoneMace.png new file mode 100644 index 000000000..cd9256734 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcStoneMace.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcStoneScythe.png b/src/main/resources/assets/customnpcs/textures/items/npcStoneScythe.png new file mode 100644 index 000000000..e3c62ecba Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcStoneScythe.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcStoneShield.png b/src/main/resources/assets/customnpcs/textures/items/npcStoneShield.png new file mode 100644 index 000000000..85582bd2f Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcStoneShield.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcStoneSpear.png b/src/main/resources/assets/customnpcs/textures/items/npcStoneSpear.png new file mode 100644 index 000000000..2eab76173 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcStoneSpear.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcStoneStaff.png b/src/main/resources/assets/customnpcs/textures/items/npcStoneStaff.png new file mode 100644 index 000000000..df875a218 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcStoneStaff.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcStoneTrident.png b/src/main/resources/assets/customnpcs/textures/items/npcStoneTrident.png new file mode 100644 index 000000000..2cd88764f Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcStoneTrident.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcStoneWarhammer.png b/src/main/resources/assets/customnpcs/textures/items/npcStoneWarhammer.png new file mode 100644 index 000000000..ade73b7ae Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcStoneWarhammer.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcSwissArmyKnife.png b/src/main/resources/assets/customnpcs/textures/items/npcSwissArmyKnife.png new file mode 100644 index 000000000..7bc6c3307 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcSwissArmyKnife.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcTablet.png b/src/main/resources/assets/customnpcs/textures/items/npcTablet.png new file mode 100644 index 000000000..5a070babd Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcTablet.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcTacticalChest.png b/src/main/resources/assets/customnpcs/textures/items/npcTacticalChest.png new file mode 100644 index 000000000..bebae29ff Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcTacticalChest.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcTacticalHead.png b/src/main/resources/assets/customnpcs/textures/items/npcTacticalHead.png new file mode 100644 index 000000000..061e59e00 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcTacticalHead.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcTowerShield.png b/src/main/resources/assets/customnpcs/textures/items/npcTowerShield.png new file mode 100644 index 000000000..0bbf5c177 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcTowerShield.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcTuxedoBottom.png b/src/main/resources/assets/customnpcs/textures/items/npcTuxedoBottom.png new file mode 100644 index 000000000..ab4c5e61b Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcTuxedoBottom.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcTuxedoChest.png b/src/main/resources/assets/customnpcs/textures/items/npcTuxedoChest.png new file mode 100644 index 000000000..acabbe769 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcTuxedoChest.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcTuxedoPants.png b/src/main/resources/assets/customnpcs/textures/items/npcTuxedoPants.png new file mode 100644 index 000000000..98db17349 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcTuxedoPants.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcUsbStick.png b/src/main/resources/assets/customnpcs/textures/items/npcUsbStick.png new file mode 100644 index 000000000..6588d7d47 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcUsbStick.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcViolin.png b/src/main/resources/assets/customnpcs/textures/items/npcViolin.png new file mode 100644 index 000000000..750c11b5c Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcViolin.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcViolinBow.png b/src/main/resources/assets/customnpcs/textures/items/npcViolinBow.png new file mode 100644 index 000000000..e8bbfeefd Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcViolinBow.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcWaterElement.png b/src/main/resources/assets/customnpcs/textures/items/npcWaterElement.png new file mode 100644 index 000000000..729f5e997 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcWaterElement.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcWizardChest.png b/src/main/resources/assets/customnpcs/textures/items/npcWizardChest.png new file mode 100644 index 000000000..3c3cb6e2d Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcWizardChest.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcWizardHead.png b/src/main/resources/assets/customnpcs/textures/items/npcWizardHead.png new file mode 100644 index 000000000..e57afbd01 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcWizardHead.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcWizardPants.png b/src/main/resources/assets/customnpcs/textures/items/npcWizardPants.png new file mode 100644 index 000000000..c5cac5fdc Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcWizardPants.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcWoodenBattleAxe.png b/src/main/resources/assets/customnpcs/textures/items/npcWoodenBattleAxe.png new file mode 100644 index 000000000..9001b0cff Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcWoodenBattleAxe.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcWoodenBroadsword.png b/src/main/resources/assets/customnpcs/textures/items/npcWoodenBroadsword.png new file mode 100644 index 000000000..20ba4c525 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcWoodenBroadsword.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcWoodenBullet.png b/src/main/resources/assets/customnpcs/textures/items/npcWoodenBullet.png new file mode 100644 index 000000000..edfd69702 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcWoodenBullet.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcWoodenDagger.png b/src/main/resources/assets/customnpcs/textures/items/npcWoodenDagger.png new file mode 100644 index 000000000..bf0bdc208 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcWoodenDagger.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcWoodenGlaive.png b/src/main/resources/assets/customnpcs/textures/items/npcWoodenGlaive.png new file mode 100644 index 000000000..caed1c844 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcWoodenGlaive.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcWoodenGun.png b/src/main/resources/assets/customnpcs/textures/items/npcWoodenGun.png new file mode 100644 index 000000000..67fcb436c Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcWoodenGun.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcWoodenHalberd.png b/src/main/resources/assets/customnpcs/textures/items/npcWoodenHalberd.png new file mode 100644 index 000000000..1c0277b3a Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcWoodenHalberd.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcWoodenMace.png b/src/main/resources/assets/customnpcs/textures/items/npcWoodenMace.png new file mode 100644 index 000000000..ded07fd08 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcWoodenMace.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcWoodenScythe.png b/src/main/resources/assets/customnpcs/textures/items/npcWoodenScythe.png new file mode 100644 index 000000000..a89f2f022 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcWoodenScythe.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcWoodenShield.png b/src/main/resources/assets/customnpcs/textures/items/npcWoodenShield.png new file mode 100644 index 000000000..77bc939ec Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcWoodenShield.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcWoodenSpear.png b/src/main/resources/assets/customnpcs/textures/items/npcWoodenSpear.png new file mode 100644 index 000000000..96d201da2 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcWoodenSpear.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcWoodenStaff.png b/src/main/resources/assets/customnpcs/textures/items/npcWoodenStaff.png new file mode 100644 index 000000000..78bf2e68c Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcWoodenStaff.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcWoodenTrident.png b/src/main/resources/assets/customnpcs/textures/items/npcWoodenTrident.png new file mode 100644 index 000000000..72f7257a4 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcWoodenTrident.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcWoodenWarhammer.png b/src/main/resources/assets/customnpcs/textures/items/npcWoodenWarhammer.png new file mode 100644 index 000000000..c4137118b Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcWoodenWarhammer.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcWrench.png b/src/main/resources/assets/customnpcs/textures/items/npcWrench.png new file mode 100644 index 000000000..8b434150e Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcWrench.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcX407Boots.png b/src/main/resources/assets/customnpcs/textures/items/npcX407Boots.png new file mode 100644 index 000000000..b308770f2 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcX407Boots.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcX407Chest.png b/src/main/resources/assets/customnpcs/textures/items/npcX407Chest.png new file mode 100644 index 000000000..1e7489c84 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcX407Chest.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcX407Head.png b/src/main/resources/assets/customnpcs/textures/items/npcX407Head.png new file mode 100644 index 000000000..0e97418e2 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcX407Head.png differ diff --git a/src/main/resources/assets/customnpcs/textures/items/npcX407Legs.png b/src/main/resources/assets/customnpcs/textures/items/npcX407Legs.png new file mode 100644 index 000000000..6992303ef Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/items/npcX407Legs.png differ diff --git a/src/main/resources/assets/customnpcs/textures/models/BannerFlag.png b/src/main/resources/assets/customnpcs/textures/models/BannerFlag.png new file mode 100644 index 000000000..8a3447952 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/models/BannerFlag.png differ diff --git a/src/main/resources/assets/customnpcs/textures/models/Barrel.png b/src/main/resources/assets/customnpcs/textures/models/Barrel.png new file mode 100644 index 000000000..c543012e3 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/models/Barrel.png differ diff --git a/src/main/resources/assets/customnpcs/textures/models/BigSign.png b/src/main/resources/assets/customnpcs/textures/models/BigSign.png new file mode 100644 index 000000000..07b7febac Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/models/BigSign.png differ diff --git a/src/main/resources/assets/customnpcs/textures/models/Candle.png b/src/main/resources/assets/customnpcs/textures/models/Candle.png new file mode 100644 index 000000000..9d1c207b4 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/models/Candle.png differ diff --git a/src/main/resources/assets/customnpcs/textures/models/CarpentryBench.png b/src/main/resources/assets/customnpcs/textures/models/CarpentryBench.png new file mode 100644 index 000000000..c9fa3a0ef Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/models/CarpentryBench.png differ diff --git a/src/main/resources/assets/customnpcs/textures/models/Ink.png b/src/main/resources/assets/customnpcs/textures/models/Ink.png new file mode 100644 index 000000000..48c0d83d6 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/models/Ink.png differ diff --git a/src/main/resources/assets/customnpcs/textures/models/Lamp.png b/src/main/resources/assets/customnpcs/textures/models/Lamp.png new file mode 100644 index 000000000..d5a98fd16 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/models/Lamp.png differ diff --git a/src/main/resources/assets/customnpcs/textures/models/Steel.png b/src/main/resources/assets/customnpcs/textures/models/Steel.png new file mode 100644 index 000000000..e127e1f97 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/models/Steel.png differ diff --git a/src/main/resources/assets/customnpcs/textures/models/mailbox1.png b/src/main/resources/assets/customnpcs/textures/models/mailbox1.png new file mode 100644 index 000000000..83fb64e3c Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/models/mailbox1.png differ diff --git a/src/main/resources/assets/customnpcs/textures/models/mailbox2.png b/src/main/resources/assets/customnpcs/textures/models/mailbox2.png new file mode 100644 index 000000000..cba54bb14 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/models/mailbox2.png differ diff --git a/src/main/resources/assets/customnpcs/textures/models/npcPedestal.png b/src/main/resources/assets/customnpcs/textures/models/npcPedestal.png new file mode 100644 index 000000000..19554f57e Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/models/npcPedestal.png differ diff --git a/src/main/resources/assets/customnpcs/textures/overlays/TecZombie_eyes.png b/src/main/resources/assets/customnpcs/textures/overlays/TecZombie_eyes.png new file mode 100644 index 000000000..e99e79eb1 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/overlays/TecZombie_eyes.png differ diff --git a/src/main/resources/assets/customnpcs/textures/overlays/ender_eyes.png b/src/main/resources/assets/customnpcs/textures/overlays/ender_eyes.png new file mode 100644 index 000000000..080440287 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/overlays/ender_eyes.png differ diff --git a/src/main/resources/assets/customnpcs/textures/overlays/evil_eyes.png b/src/main/resources/assets/customnpcs/textures/overlays/evil_eyes.png new file mode 100644 index 000000000..bc7c6c533 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/overlays/evil_eyes.png differ diff --git a/src/main/resources/assets/customnpcs/textures/overlays/ghost_eyes.png b/src/main/resources/assets/customnpcs/textures/overlays/ghost_eyes.png new file mode 100644 index 000000000..72331f702 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/overlays/ghost_eyes.png differ diff --git a/src/main/resources/assets/customnpcs/textures/overlays/goggles.png b/src/main/resources/assets/customnpcs/textures/overlays/goggles.png new file mode 100644 index 000000000..8833fc863 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/overlays/goggles.png differ diff --git a/src/main/resources/assets/customnpcs/textures/overlays/herobrine_eyes.png b/src/main/resources/assets/customnpcs/textures/overlays/herobrine_eyes.png new file mode 100644 index 000000000..f2e887837 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/overlays/herobrine_eyes.png differ diff --git a/src/main/resources/assets/customnpcs/textures/overlays/old_ender_eyes.png b/src/main/resources/assets/customnpcs/textures/overlays/old_ender_eyes.png new file mode 100644 index 000000000..6f478110f Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/overlays/old_ender_eyes.png differ diff --git a/src/main/resources/assets/moreplayermodels/textures/beard/beard1.png b/src/main/resources/assets/moreplayermodels/textures/beard/beard1.png new file mode 100644 index 000000000..b39495515 Binary files /dev/null and b/src/main/resources/assets/moreplayermodels/textures/beard/beard1.png differ diff --git a/src/main/resources/assets/moreplayermodels/textures/beard/beard2.png b/src/main/resources/assets/moreplayermodels/textures/beard/beard2.png new file mode 100644 index 000000000..69ac52995 Binary files /dev/null and b/src/main/resources/assets/moreplayermodels/textures/beard/beard2.png differ diff --git a/src/main/resources/assets/moreplayermodels/textures/beard/beard3.png b/src/main/resources/assets/moreplayermodels/textures/beard/beard3.png new file mode 100644 index 000000000..0ffed63ad Binary files /dev/null and b/src/main/resources/assets/moreplayermodels/textures/beard/beard3.png differ diff --git a/src/main/resources/assets/moreplayermodels/textures/beard/beard4.png b/src/main/resources/assets/moreplayermodels/textures/beard/beard4.png new file mode 100644 index 000000000..caf96c531 Binary files /dev/null and b/src/main/resources/assets/moreplayermodels/textures/beard/beard4.png differ diff --git a/src/main/resources/assets/moreplayermodels/textures/ears/bunny1.png b/src/main/resources/assets/moreplayermodels/textures/ears/bunny1.png new file mode 100644 index 000000000..e5a532202 Binary files /dev/null and b/src/main/resources/assets/moreplayermodels/textures/ears/bunny1.png differ diff --git a/src/main/resources/assets/moreplayermodels/textures/ears/type1.png b/src/main/resources/assets/moreplayermodels/textures/ears/type1.png new file mode 100644 index 000000000..5c366528d Binary files /dev/null and b/src/main/resources/assets/moreplayermodels/textures/ears/type1.png differ diff --git a/src/main/resources/assets/moreplayermodels/textures/fin/fin1.png b/src/main/resources/assets/moreplayermodels/textures/fin/fin1.png new file mode 100644 index 000000000..cc5c92c54 Binary files /dev/null and b/src/main/resources/assets/moreplayermodels/textures/fin/fin1.png differ diff --git a/src/main/resources/assets/moreplayermodels/textures/hair/hair1.png b/src/main/resources/assets/moreplayermodels/textures/hair/hair1.png new file mode 100644 index 000000000..157834dbb Binary files /dev/null and b/src/main/resources/assets/moreplayermodels/textures/hair/hair1.png differ diff --git a/src/main/resources/assets/moreplayermodels/textures/hair/hair2.png b/src/main/resources/assets/moreplayermodels/textures/hair/hair2.png new file mode 100644 index 000000000..e57d7ffd6 Binary files /dev/null and b/src/main/resources/assets/moreplayermodels/textures/hair/hair2.png differ diff --git a/src/main/resources/assets/moreplayermodels/textures/hair/hair3.png b/src/main/resources/assets/moreplayermodels/textures/hair/hair3.png new file mode 100644 index 000000000..b0cb36c37 Binary files /dev/null and b/src/main/resources/assets/moreplayermodels/textures/hair/hair3.png differ diff --git a/src/main/resources/assets/moreplayermodels/textures/hair/hair4.png b/src/main/resources/assets/moreplayermodels/textures/hair/hair4.png new file mode 100644 index 000000000..31985555a Binary files /dev/null and b/src/main/resources/assets/moreplayermodels/textures/hair/hair4.png differ diff --git a/src/main/resources/assets/moreplayermodels/textures/hair/mohawk1.png b/src/main/resources/assets/moreplayermodels/textures/hair/mohawk1.png new file mode 100644 index 000000000..4c5b73d73 Binary files /dev/null and b/src/main/resources/assets/moreplayermodels/textures/hair/mohawk1.png differ diff --git a/src/main/resources/assets/moreplayermodels/textures/legs/horse1.png b/src/main/resources/assets/moreplayermodels/textures/legs/horse1.png new file mode 100644 index 000000000..e90e6e7fe Binary files /dev/null and b/src/main/resources/assets/moreplayermodels/textures/legs/horse1.png differ diff --git a/src/main/resources/assets/moreplayermodels/textures/legs/mermaid1.png b/src/main/resources/assets/moreplayermodels/textures/legs/mermaid1.png new file mode 100644 index 000000000..c6ce1b4d0 Binary files /dev/null and b/src/main/resources/assets/moreplayermodels/textures/legs/mermaid1.png differ diff --git a/src/main/resources/assets/moreplayermodels/textures/legs/naga1.png b/src/main/resources/assets/moreplayermodels/textures/legs/naga1.png new file mode 100644 index 000000000..f393a8529 Binary files /dev/null and b/src/main/resources/assets/moreplayermodels/textures/legs/naga1.png differ diff --git a/src/main/resources/assets/moreplayermodels/textures/legs/spider1.png b/src/main/resources/assets/moreplayermodels/textures/legs/spider1.png new file mode 100644 index 000000000..5e57ba1f2 Binary files /dev/null and b/src/main/resources/assets/moreplayermodels/textures/legs/spider1.png differ diff --git a/src/main/resources/assets/moreplayermodels/textures/particle/type1.png b/src/main/resources/assets/moreplayermodels/textures/particle/type1.png new file mode 100644 index 000000000..4cef51fe9 Binary files /dev/null and b/src/main/resources/assets/moreplayermodels/textures/particle/type1.png differ diff --git a/src/main/resources/assets/moreplayermodels/textures/particle/type2.png b/src/main/resources/assets/moreplayermodels/textures/particle/type2.png new file mode 100644 index 000000000..a749a63fa Binary files /dev/null and b/src/main/resources/assets/moreplayermodels/textures/particle/type2.png differ diff --git a/src/main/resources/assets/moreplayermodels/textures/snout/bunny1.png b/src/main/resources/assets/moreplayermodels/textures/snout/bunny1.png new file mode 100644 index 000000000..44f46d580 Binary files /dev/null and b/src/main/resources/assets/moreplayermodels/textures/snout/bunny1.png differ diff --git a/src/main/resources/assets/moreplayermodels/textures/snout/large1.png b/src/main/resources/assets/moreplayermodels/textures/snout/large1.png new file mode 100644 index 000000000..34198e7cb Binary files /dev/null and b/src/main/resources/assets/moreplayermodels/textures/snout/large1.png differ diff --git a/src/main/resources/assets/moreplayermodels/textures/snout/medium1.png b/src/main/resources/assets/moreplayermodels/textures/snout/medium1.png new file mode 100644 index 000000000..637a33b06 Binary files /dev/null and b/src/main/resources/assets/moreplayermodels/textures/snout/medium1.png differ diff --git a/src/main/resources/assets/moreplayermodels/textures/snout/small1.png b/src/main/resources/assets/moreplayermodels/textures/snout/small1.png new file mode 100644 index 000000000..b698b69e9 Binary files /dev/null and b/src/main/resources/assets/moreplayermodels/textures/snout/small1.png differ diff --git a/src/main/resources/assets/moreplayermodels/textures/tail/dragon1.png b/src/main/resources/assets/moreplayermodels/textures/tail/dragon1.png new file mode 100644 index 000000000..fd2db401b Binary files /dev/null and b/src/main/resources/assets/moreplayermodels/textures/tail/dragon1.png differ diff --git a/src/main/resources/assets/moreplayermodels/textures/tail/horse1.png b/src/main/resources/assets/moreplayermodels/textures/tail/horse1.png new file mode 100644 index 000000000..df33b483c Binary files /dev/null and b/src/main/resources/assets/moreplayermodels/textures/tail/horse1.png differ diff --git a/src/main/resources/assets/moreplayermodels/textures/tail/squirrel1.png b/src/main/resources/assets/moreplayermodels/textures/tail/squirrel1.png new file mode 100644 index 000000000..af008fbd1 Binary files /dev/null and b/src/main/resources/assets/moreplayermodels/textures/tail/squirrel1.png differ diff --git a/src/main/resources/assets/moreplayermodels/textures/tail/tail1.png b/src/main/resources/assets/moreplayermodels/textures/tail/tail1.png new file mode 100644 index 000000000..8869897d5 Binary files /dev/null and b/src/main/resources/assets/moreplayermodels/textures/tail/tail1.png differ diff --git a/src/main/resources/assets/moreplayermodels/textures/tail/tail2.png b/src/main/resources/assets/moreplayermodels/textures/tail/tail2.png new file mode 100644 index 000000000..3a0de50c3 Binary files /dev/null and b/src/main/resources/assets/moreplayermodels/textures/tail/tail2.png differ diff --git a/src/main/resources/assets/moreplayermodels/textures/wings/wing1.png b/src/main/resources/assets/moreplayermodels/textures/wings/wing1.png new file mode 100644 index 000000000..e9bce91ac Binary files /dev/null and b/src/main/resources/assets/moreplayermodels/textures/wings/wing1.png differ diff --git a/src/main/resources/assets/moreplayermodels/textures/wings/wing2.png b/src/main/resources/assets/moreplayermodels/textures/wings/wing2.png new file mode 100644 index 000000000..14f93cb99 Binary files /dev/null and b/src/main/resources/assets/moreplayermodels/textures/wings/wing2.png differ diff --git a/src/main/resources/assets/moreplayermodels/textures/wings/wing3.png b/src/main/resources/assets/moreplayermodels/textures/wings/wing3.png new file mode 100644 index 000000000..acfc37ffa Binary files /dev/null and b/src/main/resources/assets/moreplayermodels/textures/wings/wing3.png differ diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info new file mode 100644 index 000000000..44984282d --- /dev/null +++ b/src/main/resources/mcmod.info @@ -0,0 +1,17 @@ +[ +{ + "modid": "customnpcs", + "name": "CustomNpcs", + "version": "1.7.10", + "mcversion": "1.7.10", + "description": "The Custom Npcs mod lets you create your own npcs and lets you customize them how you want", + "credits": "A lot of people, see the list at the forum", + "logoFile": "customnpcs:textures/gui/logo.png", + "url": "http://tinyurl.com/customnpcs", + "updateUrl": "", + "authorList": ["Noppes", "DarkSignal(AI)", "Foxz(Commands)"], + "parent":"", + "screenshots": [], + "dependencies": [] +} +] \ No newline at end of file