mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 04:05:12 +00:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
514e14e13d
29 files changed
+276
-205
No files matched your search
@@ -13,11 +13,19 @@ import java.util.List;
|
||||
|
||||
|
||||
public class CustomNpcsPermissions{
|
||||
public static final Permission NPC_DELETE = new Permission("customnpcs.npc.delete");
|
||||
// Open GUI
|
||||
public static final Permission NPC_GUI = new Permission("customnpcs.npc.gui");
|
||||
|
||||
// Modify NPC
|
||||
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_RESET = new Permission("customnpcs.npc.reset");
|
||||
|
||||
// Extra NPCs
|
||||
public static final Permission NPC_FREEZE = new Permission("customnpcs.npc.freeze");
|
||||
public static final Permission NPC_TELEPORT = new Permission("customnpcs.npc.teleport");
|
||||
|
||||
// Save NPC
|
||||
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");
|
||||
@@ -25,7 +33,10 @@ public class CustomNpcsPermissions{
|
||||
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_REMOTE = new Permission("customnpcs.global.remote");
|
||||
|
||||
// Save Globel Preferences
|
||||
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");
|
||||
@@ -35,24 +46,43 @@ public class CustomNpcsPermissions{
|
||||
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 GLOBAL_TAG = new Permission("customnpcs.global.tag");
|
||||
public static final Permission GLOBAL_ANIMATION = new Permission("customnpcs.global.animation");
|
||||
|
||||
public static final Permission SPAWNER_MOB = new Permission("customnpcs.spawner.mob");
|
||||
public static final Permission SPAWNER_CREATE = new Permission("customnpcs.spawner.create");
|
||||
|
||||
|
||||
// Open / Use Wands
|
||||
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 TOOL_CLONER = new Permission("customnpcs.tool.cloner");
|
||||
public static final Permission TOOL_SCRIPTED_ITEM = new Permission("customnpcs.tool.scripteditem");
|
||||
|
||||
// Edit Villager
|
||||
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 EDIT_REDSTONE = new Permission("customnpcs.edit.redstone");
|
||||
public static final Permission EDIT_BOOK = new Permission("customnpcs.edit.book");
|
||||
public static final Permission EDIT_TOMBSTONE = new Permission("customnpcs.edit.tombsone");
|
||||
public static final Permission EDIT_WAYPOINT = new Permission("customnpcs.edit.waypoint");
|
||||
public static final Permission EDIT_BIGSIGN = new Permission("customnpcs.edit.bigsign");
|
||||
|
||||
public static final Permission SOULSTONE_ALL = new Permission("customnpcs.soulstone.all");
|
||||
|
||||
// Modify / Save Scripts
|
||||
public static final Permission SCRIPT_NPC = new Permission("customnpcs.script.npc");
|
||||
public static final Permission SCRIPT_FORGE = new Permission("customnpcs.script.forge");
|
||||
public static final Permission SCRIPT_PLAYER = new Permission("customnpcs.script.player");
|
||||
public static final Permission SCRIPT_GLOBAL = new Permission("customnpcs.script.global");
|
||||
public static final Permission SCRIPT_ITEM = new Permission("customnpcs.script.item");
|
||||
public static final Permission SCRIPT_BLOCK = new Permission("customnpcs.script.block");
|
||||
|
||||
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 {
|
||||
@@ -73,7 +103,7 @@ public class CustomNpcsPermissions{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static boolean hasPermission(EntityPlayer player, Permission permission){
|
||||
if(player != null){
|
||||
if(Developer.Instance.hasUniversal(player.getUniqueID())){
|
||||
|
||||
@@ -75,7 +75,7 @@ public class NoppesUtilServer {
|
||||
NBTTagCompound comp = new NBTTagCompound();
|
||||
npc.roleInterface.writeToNBT(comp);
|
||||
comp.setInteger("EntityId", npc.getEntityId());
|
||||
comp.setInteger("Role", npc.advanced.role.ordinal());
|
||||
comp.setInteger("Role", npc.advanced.role.ordinal());
|
||||
Server.sendData((EntityPlayerMP)player, EnumPacketClient.ROLE, comp);
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ public class NoppesUtilServer {
|
||||
}
|
||||
sendScrollData(player, map);
|
||||
}
|
||||
|
||||
|
||||
public static void sendBankDataAll(EntityPlayerMP player) {
|
||||
Map<String,Integer> map = new HashMap<String,Integer>();
|
||||
for(Bank bank : BankController.getInstance().banks.values()){
|
||||
@@ -110,7 +110,7 @@ public class NoppesUtilServer {
|
||||
}
|
||||
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());
|
||||
@@ -148,7 +148,7 @@ public class NoppesUtilServer {
|
||||
}
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
|
||||
public static Item getByNameOrId(String id)
|
||||
{
|
||||
Item item = (Item)Item.itemRegistry.getObject(id);
|
||||
@@ -167,7 +167,7 @@ public class NoppesUtilServer {
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
public static void openDialog(EntityPlayer player, EntityNPCInterface npc, Dialog dia, int optionId){
|
||||
Dialog dialog = dia.copy(player);
|
||||
|
||||
@@ -189,7 +189,7 @@ public class NoppesUtilServer {
|
||||
dia.factionOptions.addPoints(player);
|
||||
if(dialog.hasQuest())
|
||||
PlayerQuestController.addActiveQuest(new QuestData(dialog.getQuest()),player);
|
||||
if(!dialog.command.isEmpty()){
|
||||
if(!dialog.command.isEmpty()){
|
||||
runCommand(player, npc.getCommandSenderName(), dialog.command);
|
||||
}
|
||||
if(dialog.mail.isValid())
|
||||
@@ -202,7 +202,7 @@ public class NoppesUtilServer {
|
||||
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());
|
||||
@@ -212,7 +212,7 @@ public class NoppesUtilServer {
|
||||
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);
|
||||
@@ -231,17 +231,17 @@ public class NoppesUtilServer {
|
||||
logic.func_145754_b("@"+name);
|
||||
logic.func_145755_a(world);
|
||||
}
|
||||
|
||||
|
||||
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));
|
||||
}
|
||||
@@ -259,7 +259,7 @@ public class NoppesUtilServer {
|
||||
final EnumGuiType gui, final EntityNPCInterface npc, final int i, final int j, final int k) {
|
||||
if(!(player instanceof EntityPlayerMP))
|
||||
return;
|
||||
|
||||
|
||||
setEditingNpc(player, npc);
|
||||
sendExtraData(player, npc,gui, i, j, k);
|
||||
|
||||
@@ -398,11 +398,11 @@ public class NoppesUtilServer {
|
||||
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")));
|
||||
}
|
||||
|
||||
@@ -416,7 +416,7 @@ public class NoppesUtilServer {
|
||||
|
||||
public static void sendPlayerData(EnumPlayerData type, EntityPlayerMP player, String name) throws IOException {
|
||||
Map<String,Integer> map = new HashMap<String,Integer>();
|
||||
|
||||
|
||||
if(type == EnumPlayerData.Players){
|
||||
for(String username : PlayerDataController.Instance.nameUUIDs.keySet()){
|
||||
map.put(username, 0);
|
||||
@@ -429,7 +429,7 @@ public class NoppesUtilServer {
|
||||
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)
|
||||
@@ -439,7 +439,7 @@ public class NoppesUtilServer {
|
||||
}
|
||||
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)
|
||||
@@ -455,7 +455,7 @@ public class NoppesUtilServer {
|
||||
}
|
||||
else if(type == EnumPlayerData.Transport){
|
||||
PlayerTransportData data = playerdata.transportData;
|
||||
|
||||
|
||||
for(int questId : data.transports){
|
||||
TransportLocation location = TransportController.getInstance().getTransport(questId);
|
||||
if(location == null)
|
||||
@@ -465,7 +465,7 @@ public class NoppesUtilServer {
|
||||
}
|
||||
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)
|
||||
@@ -483,10 +483,10 @@ public class NoppesUtilServer {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NoppesUtilServer.sendScrollData(player, map);
|
||||
}
|
||||
|
||||
|
||||
public static void removePlayerData(ByteBuf buffer, EntityPlayerMP player) throws IOException {
|
||||
int id = buffer.readInt();
|
||||
if(EnumPlayerData.values().length <= id)
|
||||
@@ -554,7 +554,7 @@ public class NoppesUtilServer {
|
||||
public static void regenPlayerData(EntityPlayerMP player) throws IOException {
|
||||
PlayerDataController.Instance.generatePlayerMap(player);
|
||||
}
|
||||
|
||||
|
||||
public static void sendRecipeData(EntityPlayerMP player, int size) {
|
||||
HashMap<String,Integer> map = new HashMap<String,Integer>();
|
||||
if(size == 3){
|
||||
@@ -653,7 +653,7 @@ public class NoppesUtilServer {
|
||||
}
|
||||
sendScrollData(player, map);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void sendNpcDialogs(EntityPlayer player) {
|
||||
EntityNPCInterface npc = getEditingNpc(player);
|
||||
@@ -663,11 +663,11 @@ public class NoppesUtilServer {
|
||||
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);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -693,22 +693,28 @@ public class NoppesUtilServer {
|
||||
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 setClonerGui(EntityPlayerMP player, int x, int y, int z){
|
||||
if(player == null)
|
||||
return;
|
||||
Server.sendData(player, EnumPacketClient.CLONER, x, y, z);
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
|
||||
@@ -657,6 +657,12 @@ public class PacketHandlerServer{
|
||||
LogWriter.script(String.format("[%s] (Player) %s OPEN NPC %s (%s, %s, %s) [%s]", "WAND", player.getCommandSenderName(), ((EntityNPCInterface)entity).display.getName(), entity.posX, entity.posY, entity.posZ, entity.worldObj.getWorldInfo().getWorldName()));
|
||||
}
|
||||
}
|
||||
else if(type == EnumPacketServer.RemoteGlobalMenu){
|
||||
NoppesUtilServer.sendOpenGui(player, EnumGuiType.GlobalRemote, null);
|
||||
if(ConfigDebug.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
|
||||
LogWriter.script(String.format("[%s] (Player) %s OPEN GLOBAL MENU", "WAND", player.getCommandSenderName()));
|
||||
}
|
||||
}
|
||||
else if(type == EnumPacketServer.RemoteDelete){
|
||||
Entity entity = player.worldObj.getEntityByID(buffer.readInt());
|
||||
if(entity == null || !(entity instanceof EntityNPCInterface))
|
||||
@@ -671,7 +677,6 @@ public class PacketHandlerServer{
|
||||
}
|
||||
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;
|
||||
@@ -953,7 +958,7 @@ public class PacketHandlerServer{
|
||||
else if(type == EnumPacketServer.PlayerDataRemove){
|
||||
NoppesUtilServer.removePlayerData(buffer,player);
|
||||
}
|
||||
else if(type == EnumPacketServer.PlayerDataRegen){
|
||||
else if(type == EnumPacketServer.PlayerDataMapRegen){
|
||||
NoppesUtilServer.regenPlayerData(player);
|
||||
}
|
||||
else if(type == EnumPacketServer.MainmenuDisplayGet){
|
||||
|
||||
@@ -88,6 +88,8 @@ public class ServerEventsHandler {
|
||||
}
|
||||
}
|
||||
else if(item.getItem() == CustomItems.cloner && !isRemote && !(event.target instanceof EntityPlayer)){
|
||||
if(!CustomNpcsPermissions.Instance.hasPermission(event.entityPlayer, CustomNpcsPermissions.TOOL_CLONER))
|
||||
return;
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
if(!event.target.writeToNBTOptional(compound))
|
||||
return;
|
||||
@@ -102,7 +104,7 @@ public class ServerEventsHandler {
|
||||
event.setCanceled(true);
|
||||
}
|
||||
else if(item.getItem() == CustomItems.scripter && !isRemote && npcInteracted){
|
||||
if(!CustomNpcsPermissions.Instance.hasPermission(event.entityPlayer, CustomNpcsPermissions.NPC_GUI))
|
||||
if(!CustomNpcsPermissions.Instance.hasPermission(event.entityPlayer, CustomNpcsPermissions.TOOL_SCRIPTER))
|
||||
return;
|
||||
NoppesUtilServer.setEditingNpc(event.entityPlayer, (EntityNPCInterface)event.target);
|
||||
event.setCanceled(true);
|
||||
@@ -401,4 +403,4 @@ public class ServerEventsHandler {
|
||||
public void populateChunk(PopulateChunkEvent.Post event){
|
||||
NPCSpawning.performWorldGenSpawning(event.world, event.chunkX, event.chunkZ, event.rand);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,27 +24,27 @@ import noppes.npcs.blocks.tiles.TileColorable;
|
||||
import noppes.npcs.constants.EnumGuiType;
|
||||
|
||||
public class BlockBigSign extends BlockContainer{
|
||||
|
||||
|
||||
public int renderId = -1;
|
||||
|
||||
public BlockBigSign() {
|
||||
super(Material.wood);
|
||||
}
|
||||
|
||||
@Override
|
||||
@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
|
||||
@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)) {
|
||||
if (currentItem != null && currentItem.getItem() == CustomItems.wand && CustomNpcsPermissions.hasPermission(player, CustomNpcsPermissions.EDIT_BIGSIGN)) {
|
||||
TileBigSign tile = (TileBigSign) par1World.getTileEntity(i, j, k);
|
||||
tile.canEdit = true;
|
||||
NoppesUtilServer.sendOpenGui(player, EnumGuiType.BigSign, null, i, j, k);
|
||||
@@ -52,14 +52,14 @@ public class BlockBigSign extends BlockContainer{
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
@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){
|
||||
@@ -67,7 +67,7 @@ public class BlockBigSign extends BlockContainer{
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z){
|
||||
TileEntity tileentity = world.getTileEntity(x, y, z);
|
||||
if(!(tileentity instanceof TileColorable)){
|
||||
@@ -91,25 +91,25 @@ public class BlockBigSign extends BlockContainer{
|
||||
setBlockBounds(xStart, 0, zStart, xEnd, 1, zEnd);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public boolean isOpaqueCube(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public boolean renderAsNormalBlock(){
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
@Override
|
||||
public int getRenderType(){
|
||||
return renderId;
|
||||
return renderId;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
@@ -20,8 +20,8 @@ public class BlockBook extends BlockRotated{
|
||||
super(Blocks.planks);
|
||||
setBlockBounds(0, 0, 0, 1, 0.2f, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@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;
|
||||
@@ -29,14 +29,14 @@ public class BlockBook extends BlockRotated{
|
||||
if(!(tile instanceof TileBook))
|
||||
return false;
|
||||
ItemStack currentItem = player.inventory.getCurrentItem();
|
||||
if (currentItem != null && currentItem.getItem() == CustomItems.wand && CustomNpcsPermissions.hasPermission(player, CustomNpcsPermissions.EDIT_BLOCKS)) {
|
||||
if (currentItem != null && currentItem.getItem() == CustomItems.wand && CustomNpcsPermissions.hasPermission(player, CustomNpcsPermissions.EDIT_BOOK)) {
|
||||
((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
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(){
|
||||
return "item.book";
|
||||
}
|
||||
|
||||
@@ -23,12 +23,12 @@ public class BlockNpcRedstone extends BlockContainer{
|
||||
super(Material.rock);
|
||||
}
|
||||
|
||||
@Override
|
||||
@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)) {
|
||||
if (currentItem != null && currentItem.getItem() == CustomItems.wand && CustomNpcsPermissions.hasPermission(player, CustomNpcsPermissions.EDIT_REDSTONE)) {
|
||||
TileEntity tile = par1World.getTileEntity(i, j, k);
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
tile.writeToNBT(compound);
|
||||
@@ -37,7 +37,7 @@ public class BlockNpcRedstone extends BlockContainer{
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World par1World, int par2, int par3, int par4){
|
||||
par1World.notifyBlocksOfNeighborChange(par2, par3, par4, this);
|
||||
@@ -66,24 +66,24 @@ public class BlockNpcRedstone extends BlockContainer{
|
||||
if(isActivated(par1IBlockAccess, par2, par3, par4) > 0)
|
||||
return 0xFF6B68;
|
||||
else
|
||||
return super.colorMultiplier(par1IBlockAccess, par2, par3, par4);
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -29,25 +29,25 @@ import noppes.npcs.constants.EnumGuiType;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockTombstone extends BlockContainer{
|
||||
|
||||
|
||||
public int renderId = -1;
|
||||
|
||||
public BlockTombstone() {
|
||||
super(Material.rock);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public int damageDropped(int par1){
|
||||
return par1;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
|
||||
@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)) {
|
||||
if (currentItem != null && currentItem.getItem() == CustomItems.wand && CustomNpcsPermissions.hasPermission(player, CustomNpcsPermissions.EDIT_TOMBSTONE)) {
|
||||
TileBigSign tile = (TileBigSign) par1World.getTileEntity(i, j, k);
|
||||
if(tile.getBlockMetadata() >= 2)
|
||||
return false;
|
||||
@@ -57,14 +57,14 @@ public class BlockTombstone extends BlockContainer{
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
@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){
|
||||
@@ -76,7 +76,7 @@ public class BlockTombstone extends BlockContainer{
|
||||
return super.getCollisionBoundingBoxFromPool(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z){
|
||||
TileEntity tileentity = world.getTileEntity(x, y, z);
|
||||
if(!(tileentity instanceof TileColorable)){
|
||||
@@ -86,36 +86,36 @@ public class BlockTombstone extends BlockContainer{
|
||||
TileColorable tile = (TileColorable) tileentity;
|
||||
if(tile.rotation % 2 == 0)
|
||||
setBlockBounds(0, 0, 0.3f, 1, 1, 0.7f);
|
||||
else
|
||||
else
|
||||
setBlockBounds(0.3f, 0, 0, 0.7f, 1, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@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
|
||||
@Override
|
||||
public boolean isOpaqueCube(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public boolean renderAsNormalBlock(){
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
@Override
|
||||
public int getRenderType(){
|
||||
return renderId;
|
||||
return renderId;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
@@ -24,13 +24,13 @@ public class BlockWaypoint extends BlockContainer{
|
||||
this.setCreativeTab(CustomItems.tab);
|
||||
}
|
||||
|
||||
@Override
|
||||
@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)) {
|
||||
if (currentItem != null && currentItem.getItem() == CustomItems.wand && CustomNpcsPermissions.hasPermission(player, CustomNpcsPermissions.EDIT_WAYPOINT)) {
|
||||
TileEntity tile = par1World.getTileEntity(i, j, k);
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
tile.writeToNBT(compound);
|
||||
@@ -39,14 +39,14 @@ public class BlockWaypoint extends BlockContainer{
|
||||
}
|
||||
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();
|
||||
|
||||
@@ -3,29 +3,13 @@ package noppes.npcs.blocks.tiles;
|
||||
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);
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -382,6 +382,9 @@ public class ClientProxy extends CommonProxy {
|
||||
else if (gui == EnumGuiType.ScriptBlock)
|
||||
return new GuiScriptBlock(x,y,z);
|
||||
|
||||
else if (gui == EnumGuiType.GlobalRemote)
|
||||
return new GuiNPCGlobalMainMenu(null);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -195,6 +195,12 @@ public class PacketHandlerClient extends PacketHandlerServer{
|
||||
NBTTagCompound compound = Server.readNBT(buffer);
|
||||
NoppesUtil.openGUI(player, new GuiNpcMobSpawnerAdd(compound));
|
||||
}
|
||||
else if(type == EnumPacketClient.CLONER){
|
||||
int x = buffer.readInt();
|
||||
int y = buffer.readInt();
|
||||
int z = buffer.readInt();
|
||||
CustomNpcs.proxy.openGui(x, y, z, EnumGuiType.MobSpawner, player);
|
||||
}
|
||||
else if(type == EnumPacketClient.GUI_DATA){
|
||||
GuiScreen gui = Minecraft.getMinecraft().currentScreen;
|
||||
if(gui == null)
|
||||
|
||||
@@ -16,7 +16,7 @@ import java.util.HashMap;
|
||||
import java.util.Vector;
|
||||
|
||||
public class GuiNpcRemoteEditor extends GuiNPCInterface implements IScrollData, GuiYesNoCallback{
|
||||
|
||||
|
||||
private GuiCustomScroll scroll;
|
||||
private HashMap<String, Integer> data = new HashMap<String, Integer>();
|
||||
public GuiNpcRemoteEditor() {
|
||||
@@ -35,10 +35,10 @@ public class GuiNpcRemoteEditor extends GuiNPCInterface implements IScrollData,
|
||||
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"));
|
||||
@@ -73,12 +73,12 @@ public class GuiNpcRemoteEditor extends GuiNPCInterface implements IScrollData,
|
||||
}
|
||||
if(id == 6){
|
||||
NoppesUtil.setLastNpc(null);
|
||||
NoppesUtil.openGUI(player, new GuiNPCGlobalMainMenu(null));
|
||||
Client.sendData(EnumPacketServer.RemoteGlobalMenu);
|
||||
}
|
||||
|
||||
|
||||
if(!data.containsKey(scroll.getSelected()))
|
||||
return;
|
||||
|
||||
|
||||
if(id == 0){
|
||||
Client.sendData(EnumPacketServer.RemoteMainMenu,data.get(scroll.getSelected()));
|
||||
}
|
||||
@@ -97,7 +97,7 @@ public class GuiNpcRemoteEditor extends GuiNPCInterface implements IScrollData,
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int i, int j, int k)
|
||||
{
|
||||
@@ -115,7 +115,7 @@ public class GuiNpcRemoteEditor extends GuiNPCInterface implements IScrollData,
|
||||
@Override
|
||||
public void save() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
@Override
|
||||
public void setData(Vector<String> list, HashMap<String, Integer> data) {
|
||||
|
||||
@@ -169,7 +169,7 @@ public class GuiNpcManagePlayerData extends GuiNPCInterface2 implements IScrollD
|
||||
@Override
|
||||
public void confirmClicked(boolean confirm, int id){
|
||||
if(confirm){
|
||||
Client.sendData(EnumPacketServer.PlayerDataRegen);
|
||||
Client.sendData(EnumPacketServer.PlayerDataMapRegen);
|
||||
close();
|
||||
}
|
||||
else
|
||||
|
||||
@@ -26,9 +26,6 @@ public class GuiCNPCInventory extends GuiNPCInterface {
|
||||
super.initGui();
|
||||
guiTop +=10;
|
||||
|
||||
TabRegistry.addTabsToList(buttonList);
|
||||
TabRegistry.updateTabValues(guiLeft, guiTop, InventoryTabCustomNpc.class);
|
||||
|
||||
GuiMenuSideButton questsButton = new GuiMenuSideButton(100, guiLeft + xSize + 37, this.guiTop + 3, 22, 22, "");
|
||||
questsButton.rightSided = true;
|
||||
questsButton.active = activeTab == 0;
|
||||
@@ -40,7 +37,7 @@ public class GuiCNPCInventory extends GuiNPCInterface {
|
||||
partyButton.active = activeTab == 1;
|
||||
partyButton.renderStack = new ItemStack(CustomItems.bag);
|
||||
addButton(partyButton);
|
||||
|
||||
|
||||
if(ConfigClient.enableFactionTab){
|
||||
GuiMenuSideButton factionButton = new GuiMenuSideButton(102, guiLeft + xSize + 37, this.guiTop + 3 + 21*2, 22, 22, "");
|
||||
factionButton.rightSided = true;
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.ArrayList;
|
||||
public class GuiFaction extends GuiCNPCInventory implements IGuiData{
|
||||
|
||||
private final ResourceLocation resource = new ResourceLocation("customnpcs","textures/gui/standardbg.png");
|
||||
|
||||
|
||||
private ArrayList<Faction> playerFactions = new ArrayList<Faction>();
|
||||
private Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
@@ -46,8 +46,8 @@ public class GuiFaction extends GuiCNPCInventory implements IGuiData{
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
TabRegistry.addTabsToList(buttonList);
|
||||
TabRegistry.updateTabValues(guiLeft, guiTop, InventoryTabCustomNpc.class);
|
||||
TabRegistry.addTabsToList(buttonList);
|
||||
TabRegistry.updateTabValues(guiLeft, guiTop, InventoryTabCustomNpc.class);
|
||||
|
||||
this.buttonList.add(buttonNextPage = new GuiButtonNextPage(1, (guiLeft + (xSize + 35) / 2) + 25, guiTop + 170, true));
|
||||
this.buttonList.add(buttonPreviousPage = new GuiButtonNextPage(2, (guiLeft + (xSize + 35) / 2) - 40, guiTop + 170, false));
|
||||
@@ -62,16 +62,16 @@ public class GuiFaction extends GuiCNPCInventory implements IGuiData{
|
||||
mc.renderEngine.bindTexture(resource);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, 252, 195);
|
||||
drawTexturedModalRect(guiLeft + 252, guiTop, 188, 0, 67, 195);
|
||||
|
||||
|
||||
if(playerFactions.isEmpty()){
|
||||
String noFaction = StatCollector.translateToLocal("faction.nostanding");
|
||||
fontRendererObj.drawString(noFaction,guiLeft + (xSize - fontRendererObj.getStringWidth(noFaction)) / 2,guiTop + 80, CustomNpcResourceListener.DefaultTextColor);
|
||||
}
|
||||
else
|
||||
renderScreen();
|
||||
|
||||
|
||||
super.drawScreen(i, j, f);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void renderScreen(){
|
||||
@@ -131,21 +131,21 @@ public class GuiFaction extends GuiCNPCInventory implements IGuiData{
|
||||
fontRendererObj.drawString(s, guiLeft + (xSize + 45 - fontRendererObj.getStringWidth(s)) / 2, guiTop + 175, CustomNpcResourceListener.DefaultTextColor);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton){
|
||||
if (guibutton.id >= 100) {
|
||||
if (guibutton.id == 100 && activeTab != 0) {
|
||||
activeTab = 0;
|
||||
mc.displayGuiScreen(new GuiQuestLog(mc.thePlayer));
|
||||
mc.displayGuiScreen(new GuiQuestLog(mc.thePlayer));
|
||||
}
|
||||
if (guibutton.id == 101 && activeTab != 1) {
|
||||
activeTab = 1;
|
||||
mc.displayGuiScreen(new GuiParty(mc.thePlayer));
|
||||
mc.displayGuiScreen(new GuiParty(mc.thePlayer));
|
||||
}
|
||||
if (guibutton.id == 102 && activeTab != 2) {
|
||||
activeTab = 2;
|
||||
mc.displayGuiScreen(new GuiFaction());
|
||||
mc.displayGuiScreen(new GuiFaction());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,9 +166,9 @@ public class GuiFaction extends GuiCNPCInventory implements IGuiData{
|
||||
}
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void keyTyped(char c, int i)
|
||||
{
|
||||
@@ -199,13 +199,13 @@ public class GuiFaction extends GuiCNPCInventory implements IGuiData{
|
||||
faction.defaultPoints = points;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pages = (playerFactions.size() - 1) / 10 ;
|
||||
pages++;
|
||||
|
||||
|
||||
page = 1;
|
||||
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -55,11 +55,12 @@ public class GuiParty extends GuiCNPCInventory implements ITextfieldListener, IT
|
||||
|
||||
public void initGui(){
|
||||
super.initGui();
|
||||
this.selectedInvite = this.selectedPlayer = null;
|
||||
Party party = ClientCacheHandler.party;
|
||||
TabRegistry.addTabsToList(buttonList);
|
||||
TabRegistry.updateTabValues(guiLeft, guiTop, InventoryTabCustomNpc.class);
|
||||
|
||||
this.selectedInvite = this.selectedPlayer = null;
|
||||
Party party = ClientCacheHandler.party;
|
||||
|
||||
if (receivedData) {
|
||||
if (party == null) {
|
||||
//
|
||||
|
||||
@@ -53,8 +53,9 @@ public class GuiQuestLog extends GuiCNPCInventory implements ITopButtonListener,
|
||||
public void initGui(){
|
||||
super.initGui();
|
||||
sideButtons.clear();
|
||||
TabRegistry.addTabsToList(buttonList);
|
||||
TabRegistry.updateTabValues(guiLeft, guiTop, InventoryTabCustomNpc.class);
|
||||
|
||||
TabRegistry.addTabsToList(buttonList);
|
||||
TabRegistry.updateTabValues(guiLeft, guiTop, InventoryTabCustomNpc.class);
|
||||
|
||||
noQuests = false;
|
||||
|
||||
|
||||
@@ -147,9 +147,8 @@ public class ConfigScript
|
||||
}
|
||||
|
||||
public static boolean isScriptDev(EntityPlayer player) {
|
||||
if(ScriptOpsOnly && !MinecraftServer.getServer().getConfigurationManager().func_152596_g(player.getGameProfile()) ||
|
||||
Developer.ScriptUser.contains(player.getUniqueID()) || Developer.Universal.contains(player.getUniqueID())){
|
||||
return true;
|
||||
} else return ScriptDevIDs.isEmpty();
|
||||
return ScriptOpsOnly && MinecraftServer.getServer().getConfigurationManager().func_152596_g(player.getGameProfile()) ||
|
||||
Developer.ScriptUser.contains(player.getUniqueID()) ||
|
||||
Developer.Universal.contains(player.getUniqueID());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,7 @@ public enum EnumGuiType {
|
||||
ManageRecipes,
|
||||
QuestItem,
|
||||
NpcRemote,
|
||||
GlobalRemote,
|
||||
ScriptEvent,
|
||||
MoneyBag,
|
||||
MainMenuAI,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package
|
||||
package
|
||||
noppes.npcs.constants;
|
||||
|
||||
public enum EnumPacketClient {
|
||||
CHAT,
|
||||
CHAT,
|
||||
MESSAGE,
|
||||
PARTY_MESSAGE,
|
||||
SYNCRECIPES_ADD,
|
||||
@@ -33,6 +33,7 @@ public enum EnumPacketClient {
|
||||
CHATBUBBLE,
|
||||
SYNCRECIPES_CARPENTRYBENCH,
|
||||
CLONE,
|
||||
CLONER,
|
||||
OPEN_BOOK,
|
||||
DIALOG_DUMMY,
|
||||
CONFIG,
|
||||
|
||||
@@ -4,26 +4,28 @@ import noppes.npcs.CustomNpcsPermissions;
|
||||
|
||||
public enum EnumPacketServer {
|
||||
Delete(CustomNpcsPermissions.NPC_DELETE, true),
|
||||
RemoteMainMenu(CustomNpcsPermissions.NPC_GUI),
|
||||
RemoteMainMenu(CustomNpcsPermissions.NPC_GUI),
|
||||
RemoteGlobalMenu(CustomNpcsPermissions.GLOBAL_REMOTE),
|
||||
NpcMenuClose(CustomNpcsPermissions.NPC_GUI, true),
|
||||
RemoteDelete(CustomNpcsPermissions.NPC_DELETE, true),
|
||||
RemoteFreeze(CustomNpcsPermissions.NPC_FREEZE),
|
||||
RemoteReset(CustomNpcsPermissions.NPC_RESET),
|
||||
SpawnMob(CustomNpcsPermissions.SPAWNER_MOB),
|
||||
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),
|
||||
|
||||
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),
|
||||
|
||||
ModelDataSave(CustomNpcsPermissions.NPC_DISPLAY, true),
|
||||
|
||||
MainmenuAdvancedSave(CustomNpcsPermissions.NPC_ADVANCED,true), MainmenuAdvancedGet(true),
|
||||
DialogNpcSet(CustomNpcsPermissions.NPC_ADVANCED),
|
||||
DialogNpcSet(CustomNpcsPermissions.NPC_ADVANCED),
|
||||
DialogNpcRemove(CustomNpcsPermissions.NPC_ADVANCED, true),
|
||||
FactionSet(CustomNpcsPermissions.NPC_ADVANCED, true),
|
||||
TagSet(CustomNpcsPermissions.NPC_ADVANCED, true),
|
||||
TransportSave(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),
|
||||
@@ -32,40 +34,48 @@ public enum EnumPacketServer {
|
||||
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, CloneTagList, CloneAllTags, CloneAllTagsShort,
|
||||
|
||||
ScriptGlobalGuiDataSave(CustomNpcsPermissions.TOOL_SCRIPTER, false),
|
||||
ScriptGlobalGuiDataSave(CustomNpcsPermissions.SCRIPT_GLOBAL, false),
|
||||
ScriptGlobalGuiDataGet(false),
|
||||
|
||||
ScriptPlayerSave(CustomNpcsPermissions.TOOL_SCRIPTER, false),
|
||||
ScriptPlayerSave(CustomNpcsPermissions.SCRIPT_PLAYER, false),
|
||||
ScriptPlayerGet(false),
|
||||
|
||||
ScriptForgeSave(CustomNpcsPermissions.TOOL_SCRIPTER, false),
|
||||
ScriptForgeSave(CustomNpcsPermissions.SCRIPT_FORGE, false),
|
||||
ScriptForgeGet(false),
|
||||
|
||||
ScriptGlobalNPCSave(CustomNpcsPermissions.TOOL_SCRIPTER, false),
|
||||
ScriptGlobalNPCSave(CustomNpcsPermissions.SCRIPT_GLOBAL, false),
|
||||
ScriptGlobalNPCGet(false),
|
||||
|
||||
ScriptItemDataSave(CustomNpcsPermissions.TOOL_SCRIPTER, false),
|
||||
ScriptItemDataSave(CustomNpcsPermissions.SCRIPT_ITEM, false),
|
||||
ScriptItemDataGet(false),
|
||||
ScriptBlockDataSave(CustomNpcsPermissions.TOOL_SCRIPTER, false),
|
||||
|
||||
ScriptBlockDataSave(CustomNpcsPermissions.SCRIPT_BLOCK, false),
|
||||
ScriptBlockDataGet(false),
|
||||
|
||||
LinkedGetAll, LinkedRemove(CustomNpcsPermissions.GLOBAL_LINKED), LinkedAdd(CustomNpcsPermissions.GLOBAL_LINKED),
|
||||
ScriptDataSave(CustomNpcsPermissions.TOOL_SCRIPTER, true), ScriptDataGet(true),
|
||||
EventScriptDataSave(CustomNpcsPermissions.TOOL_SCRIPTER, true), EventScriptDataGet(true),
|
||||
PlayerDataRemove(CustomNpcsPermissions.GLOBAL_PLAYERDATA), PlayerDataRegen(CustomNpcsPermissions.GLOBAL_PLAYERDATA),
|
||||
BankSave(CustomNpcsPermissions.GLOBAL_BANK), BanksGet, BankGet,
|
||||
BankRemove(CustomNpcsPermissions.GLOBAL_BANK),
|
||||
DialogCategorySave(CustomNpcsPermissions.GLOBAL_DIALOG), DialogCategoriesGet, DialogsGetFromDialog,
|
||||
DialogCategoryRemove(CustomNpcsPermissions.GLOBAL_DIALOG), DialogCategoryGet,
|
||||
LinkedGetAll,
|
||||
LinkedRemove(CustomNpcsPermissions.GLOBAL_LINKED), LinkedAdd(CustomNpcsPermissions.GLOBAL_LINKED),
|
||||
|
||||
ScriptDataSave(CustomNpcsPermissions.SCRIPT_NPC, true), ScriptDataGet(true),
|
||||
EventScriptDataSave(CustomNpcsPermissions.SCRIPT_NPC, true), EventScriptDataGet(true),
|
||||
|
||||
PlayerDataRemove(CustomNpcsPermissions.GLOBAL_PLAYERDATA),
|
||||
PlayerDataMapRegen(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),
|
||||
DialogRemove(CustomNpcsPermissions.GLOBAL_DIALOG),
|
||||
|
||||
TransportCategoryRemove(CustomNpcsPermissions.GLOBAL_TRANSPORT), TransportGetLocation(true),
|
||||
TransportRemove(CustomNpcsPermissions.GLOBAL_TRANSPORT), TransportsGet,
|
||||
TransportCategorySave(CustomNpcsPermissions.GLOBAL_TRANSPORT), TransportCategoriesGet,
|
||||
FactionRemove(CustomNpcsPermissions.GLOBAL_FACTION),
|
||||
FactionRemove(CustomNpcsPermissions.GLOBAL_FACTION),
|
||||
FactionSave(CustomNpcsPermissions.GLOBAL_FACTION), FactionsGet, FactionGet,
|
||||
TagRemove(CustomNpcsPermissions.GLOBAL_TAG),
|
||||
TagSave(CustomNpcsPermissions.GLOBAL_TAG), TagsGet, TagGet, NpcTagsGet,
|
||||
@@ -73,24 +83,26 @@ public enum EnumPacketServer {
|
||||
QuestRemove(CustomNpcsPermissions.GLOBAL_QUEST),
|
||||
QuestCategoryRemove(CustomNpcsPermissions.GLOBAL_QUEST),
|
||||
QuestRewardSave(CustomNpcsPermissions.GLOBAL_QUEST),
|
||||
QuestSave(CustomNpcsPermissions.GLOBAL_QUEST), QuestsGetFromQuest, QuestsGet,
|
||||
QuestSave(CustomNpcsPermissions.GLOBAL_QUEST), QuestsGetFromQuest, QuestsGet,
|
||||
QuestDialogGetTitle(CustomNpcsPermissions.GLOBAL_QUEST),
|
||||
RecipeSave(CustomNpcsPermissions.GLOBAL_RECIPE),
|
||||
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),
|
||||
PlayerRider(CustomNpcsPermissions.TOOL_MOUNTER),
|
||||
SpawnRider(CustomNpcsPermissions.TOOL_MOUNTER),
|
||||
MovingPathSave(CustomNpcsPermissions.TOOL_PATHER,true), MovingPathGet(true),
|
||||
MovingPathSave(CustomNpcsPermissions.TOOL_PATHER,true), MovingPathGet(true),
|
||||
DialogNpcGet,
|
||||
|
||||
AnimationsGet, AnimationGet, AnimationRemove, AnimationSave,
|
||||
AnimationsGet, AnimationGet,
|
||||
AnimationRemove(CustomNpcsPermissions.GLOBAL_ANIMATION), AnimationSave(CustomNpcsPermissions.GLOBAL_ANIMATION),
|
||||
|
||||
RecipesGet, RecipeGet, QuestOpenGui, PlayerDataGet, QuestLogToServer,
|
||||
|
||||
RemoteNpcsGet(CustomNpcsPermissions.NPC_GUI),
|
||||
RemoteTpToNpc,QuestGet, QuestCategoryGet,
|
||||
RemoteNpcsGet(CustomNpcsPermissions.NPC_GUI),
|
||||
RemoteTpToNpc(CustomNpcsPermissions.NPC_TELEPORT),
|
||||
QuestGet, QuestCategoryGet,
|
||||
SaveTileEntity,
|
||||
NaturalSpawnGetAll, MailOpenSetup,
|
||||
DimensionsGet, DimensionTeleport, GetTileEntity, Gui, IsGuiOpen, CacheAnimation,
|
||||
|
||||
@@ -54,10 +54,12 @@ public class AnimationData implements IAnimationData {
|
||||
EntityLivingBase sendingEntity = parent instanceof PlayerData ? ((PlayerData) parent).player : parent instanceof DataDisplay ? ((DataDisplay) parent).npc : null;
|
||||
float range = parent instanceof PlayerData ? 160 : 60;
|
||||
if (sendingEntity != null) {
|
||||
if(sendingEntity instanceof EntityNPCInterface && sendingEntity.dimension != sendingEntity.worldObj.provider.dimensionId)
|
||||
sendingEntity.dimension = sendingEntity.worldObj.provider.dimensionId;
|
||||
|
||||
List<EntityPlayer> entities = sendingEntity.worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(
|
||||
sendingEntity.posX - range, sendingEntity.posY - range, sendingEntity.posZ - range,
|
||||
sendingEntity.posX + range, sendingEntity.posY + range, sendingEntity.posZ + range));
|
||||
sendingEntity.posX - range, sendingEntity.posY - range, sendingEntity.posZ - range,
|
||||
sendingEntity.posX + range, sendingEntity.posY + range, sendingEntity.posZ + range));
|
||||
|
||||
entities.removeIf(player -> Arrays.stream(excludedPlayers).anyMatch(exp -> player == exp));
|
||||
|
||||
|
||||
@@ -5,16 +5,20 @@ import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
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;
|
||||
|
||||
public class ItemNpcCloner extends Item{
|
||||
|
||||
|
||||
public ItemNpcCloner(){
|
||||
maxStackSize = 1;
|
||||
setCreativeTab(CustomItems.tab);
|
||||
@@ -22,8 +26,10 @@ public class ItemNpcCloner extends Item{
|
||||
|
||||
@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);
|
||||
if(par3World.isRemote || !CustomNpcsPermissions.Instance.hasPermission(par2EntityPlayer, CustomNpcsPermissions.TOOL_CLONER))
|
||||
return true;
|
||||
|
||||
NoppesUtilServer.setClonerGui((EntityPlayerMP) par2EntityPlayer, par4, par5, par6);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -36,7 +42,7 @@ public class ItemNpcCloner extends Item{
|
||||
public boolean requiresMultipleRenderPasses(){
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons(IIconRegister par1IconRegister){
|
||||
|
||||
@@ -12,6 +12,7 @@ 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.config.ConfigScript;
|
||||
import noppes.npcs.constants.EnumGuiType;
|
||||
|
||||
@@ -21,12 +22,12 @@ public class ItemNpcScripter extends Item{
|
||||
maxStackSize = 1;
|
||||
setCreativeTab(CustomItems.tab);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getColorFromItemStack(ItemStack par1ItemStack, int par2){
|
||||
return 0x8B4513;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean requiresMultipleRenderPasses(){
|
||||
return true;
|
||||
@@ -36,7 +37,7 @@ public class ItemNpcScripter extends Item{
|
||||
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player){
|
||||
if(!world.isRemote)
|
||||
return itemStack;
|
||||
if(!ConfigScript.isScriptDev(player)){
|
||||
if(!ConfigScript.isScriptDev(player) && !CustomNpcsPermissions.hasPermission(player, CustomNpcsPermissions.TOOL_SCRIPTER)){
|
||||
player.addChatMessage(new ChatComponentTranslation("availability.permission"));
|
||||
} else {
|
||||
CustomNpcs.proxy.openGui(0, 0, 0, EnumGuiType.ScriptEvent, player);
|
||||
|
||||
@@ -20,17 +20,21 @@ import noppes.npcs.constants.EnumGuiType;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
|
||||
public class ItemNpcWand extends Item{
|
||||
|
||||
|
||||
public ItemNpcWand(){
|
||||
maxStackSize = 1;
|
||||
setCreativeTab(CustomItems.tab);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer){
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer player){
|
||||
if(!par2World.isRemote)
|
||||
return par1ItemStack;
|
||||
CustomNpcs.proxy.openGui(0, 0, 0, EnumGuiType.NpcRemote, par3EntityPlayer);
|
||||
else if(CustomNpcsPermissions.hasPermission(player, CustomNpcsPermissions.NPC_GUI)){
|
||||
CustomNpcs.proxy.openGui(0, 0, 0, EnumGuiType.NpcRemote, player);
|
||||
}
|
||||
else
|
||||
player.addChatMessage(new ChatComponentTranslation("availability.permission"));
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@@ -45,7 +49,7 @@ public class ItemNpcWand extends Item{
|
||||
else if(CustomNpcsPermissions.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);
|
||||
@@ -57,7 +61,7 @@ public class ItemNpcWand extends Item{
|
||||
player.addChatMessage(new ChatComponentTranslation("availability.permission"));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getColorFromItemStack(ItemStack par1ItemStack, int par2){
|
||||
return 0x8B4513;
|
||||
@@ -66,7 +70,7 @@ public class ItemNpcWand extends Item{
|
||||
public boolean requiresMultipleRenderPasses(){
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons(IIconRegister par1IconRegister){
|
||||
|
||||
@@ -16,6 +16,7 @@ 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.EventHooks;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
import noppes.npcs.config.ConfigScript;
|
||||
@@ -58,7 +59,7 @@ public class ItemScripted extends Item implements ItemRenderInterface {
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
if(player.isSneaking() && player.capabilities.isCreativeMode) {
|
||||
if(!ConfigScript.isScriptDev(player)){
|
||||
if(!ConfigScript.isScriptDev(player) && !CustomNpcsPermissions.Instance.hasPermission(player, CustomNpcsPermissions.TOOL_SCRIPTED_ITEM)){
|
||||
player.addChatMessage(new ChatComponentTranslation("availability.permission"));
|
||||
} else {
|
||||
CustomNpcs.proxy.openGui(0, 0, 0, EnumGuiType.ScriptItem, player);
|
||||
|
||||
@@ -4,6 +4,7 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import noppes.npcs.CustomItems;
|
||||
import noppes.npcs.client.gui.player.inventory.GuiCNPCInventory;
|
||||
import noppes.npcs.client.gui.player.inventory.GuiQuestLog;
|
||||
|
||||
public class InventoryTabCustomNpc extends AbstractTab {
|
||||
@@ -16,6 +17,8 @@ public class InventoryTabCustomNpc extends AbstractTab {
|
||||
|
||||
@Override
|
||||
public void onTabClicked() {
|
||||
|
||||
|
||||
Thread t = new Thread(){
|
||||
@Override
|
||||
public void run(){
|
||||
@@ -25,6 +28,9 @@ public class InventoryTabCustomNpc extends AbstractTab {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
if(mc.currentScreen instanceof GuiCNPCInventory)
|
||||
return;
|
||||
|
||||
mc.displayGuiScreen(new GuiQuestLog(mc.thePlayer));
|
||||
}
|
||||
};
|
||||
@@ -35,4 +41,4 @@ public class InventoryTabCustomNpc extends AbstractTab {
|
||||
public boolean shouldAddToList() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user