Merge branch 'master' into dev

# Conflicts:
#	src/main/java/noppes/npcs/scripted/ScriptFaction.java
#	src/main/java/noppes/npcs/scripted/ScriptWorld.java
#	src/main/java/noppes/npcs/scripted/entity/ScriptNpc.java
#	src/main/java/noppes/npcs/scripted/entity/ScriptPlayer.java
#	src/main/java/noppes/npcs/scripted/interfaces/IEntity.java
#	src/main/java/noppes/npcs/scripted/interfaces/IWorld.java
#	src/main/java/noppes/npcs/scripted/interfaces/entity/ICustomNpc.java
#	src/main/java/noppes/npcs/scripted/interfaces/entity/IPlayer.java
This commit is contained in:
Luis C.M committed 2022-05-27 15:31:02 -05:00
commit ec5fc71413
300 files changed
+9920 -2959

No files matched your search

+321 -58
View File
@@ -6,92 +6,355 @@
package noppes.npcs.scripted;
import java.io.File;
import java.util.List;
import java.util.Map;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.eventhandler.EventBus;
import net.minecraft.block.Block;
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.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.*;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EntityDamageSource;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import noppes.npcs.scripted.entity.ScriptPlayer;
import noppes.npcs.CustomNpcs;
import noppes.npcs.NoppesUtilServer;
import noppes.npcs.controllers.*;
import noppes.npcs.controllers.data.SkinOverlay;
import noppes.npcs.items.ItemScripted;
import noppes.npcs.containers.ContainerNpcInterface;
import noppes.npcs.entity.EntityCustomNpc;
import noppes.npcs.entity.EntityNPCInterface;
import noppes.npcs.scripted.entity.*;
import noppes.npcs.scripted.gui.ScriptGui;
import noppes.npcs.scripted.interfaces.entity.IPlayer;
import noppes.npcs.scripted.interfaces.handler.*;
import noppes.npcs.scripted.interfaces.*;
import noppes.npcs.scripted.interfaces.entity.ICustomNpc;
import noppes.npcs.scripted.interfaces.entity.IEntity;
import noppes.npcs.scripted.interfaces.gui.ICustomGui;
import noppes.npcs.scripted.interfaces.item.IItemStack;
import noppes.npcs.scripted.interfaces.AbstractNpcAPI;
import noppes.npcs.scripted.interfaces.overlay.ICustomOverlay;
import noppes.npcs.scripted.item.*;
import noppes.npcs.scripted.overlay.ScriptOverlay;
import noppes.npcs.util.JsonException;
import noppes.npcs.util.LRUHashMap;
import noppes.npcs.util.NBTJsonUtil;
public abstract class NpcAPI {
private static NpcAPI instance = null;
public class NpcAPI extends AbstractNpcAPI {
private static final Map<Integer, ScriptWorld> worldCache = new LRUHashMap(10);
public static final EventBus EVENT_BUS = new EventBus();
private static AbstractNpcAPI instance = null;
public NpcAPI() {
}
public abstract ICustomNpc createNPC(World var1);
public abstract ICustomNpc spawnNPC(World var1, int var2, int var3, int var4);
public abstract IEntity getIEntity(Entity var1);
public abstract IBlock getIBlock(World var1, BlockPos var2);
public abstract IBlock getIBlock(World world, int x, int y, int z);
public abstract IContainer getIContainer(IInventory var1);
public abstract IContainer getIContainer(Container var1);
public abstract IItemStack getIItemStack(ItemStack var1);
public abstract IWorld getIWorld(WorldServer var1);
public abstract IWorld getIWorld(int var1);
public abstract IWorld[] getIWorlds();
public abstract IDamageSource getIDamageSource(DamageSource var1);
public abstract EventBus events();
public abstract File getGlobalDir();
public abstract File getWorldDir();
public static boolean IsAvailable() {
return Loader.isModLoaded("customnpcs");
public static void clearCache() {
worldCache.clear();
}
public static NpcAPI Instance() {
if (instance != null) {
return instance;
} else if (!IsAvailable()) {
return null;
} else {
try {
Class c = Class.forName("noppes.npcs.scripted.wrapper.WrapperNpcAPI");
instance = (NpcAPI) c.getMethod("Instance").invoke((Object) null);
} catch (Exception var1) {
var1.printStackTrace();
}
public IFactionHandler getFactions() {
this.checkWorld();
return FactionController.getInstance();
}
return instance;
public IRecipeHandler getRecipes() {
this.checkWorld();
return RecipeController.instance;
}
public IQuestHandler getQuests() {
this.checkWorld();
return QuestController.instance;
}
public IDialogHandler getDialogs() {
return DialogController.instance;
}
public ICloneHandler getClones() {
return ServerCloneController.Instance;
}
public IEntity getIEntity(Entity entity) {
if(entity == null)
return null;
if(entity instanceof EntityNPCInterface)
return ((EntityNPCInterface)entity).wrappedNPC;
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;
}
}
public abstract void executeCommand(IWorld var1, String var2);
public IBlock getIBlock(World world, BlockPos pos) {
return new ScriptBlock(world, world.getBlock(pos.getX(),pos.getY(),pos.getZ()), pos);
}
public abstract String getRandomName(int var1, int var2);
public IBlock getIBlock(World world, Block block, BlockPos pos) {
return new ScriptBlock(world, block, pos);
}
public abstract INbt getINbt(NBTTagCompound entityData);
public IBlock getIBlock(World world, int x, int y, int z) {
return new ScriptBlock(world, world.getBlock(x, y, z), new BlockPos(x,y,z));
}
public abstract ScriptPlayer[] getAllServerPlayers();
public INbt getINbt(NBTTagCompound nbtTagCompound) {
return nbtTagCompound == null?new ScriptNbt(new NBTTagCompound()):new ScriptNbt(nbtTagCompound);
}
public abstract ScriptItemStack createItem(String id, int damage, int size);
public INbt stringToNbt(String str) {
if (str != null && !str.isEmpty()) {
try {
return this.getINbt(NBTJsonUtil.Convert(str));
} catch (JsonException var3) {
throw new CustomNPCsException(var3, "Failed converting " + str, new Object[0]);
}
} else {
throw new CustomNPCsException("Cant cast empty string to nbt", new Object[0]);
}
}
public abstract ScriptEntityParticle createEntityParticle(String directory);
public ICustomNpc createNPC(World world) {
if (world.isRemote) {
return null;
} else {
EntityCustomNpc npc = new EntityCustomNpc(world);
return npc.wrappedNPC;
}
}
public abstract int getServerTime();
public ICustomNpc spawnNPC(World world, int x, int y, int z) {
if (world.isRemote) {
return null;
} else {
EntityCustomNpc npc = new EntityCustomNpc(world);
npc.setPositionAndRotation((double)x + 0.5D, (double)y, (double)z + 0.5D, 0.0F, 0.0F);
npc.setHealth(npc.getMaxHealth());
world.spawnEntityInWorld(npc);
return npc.wrappedNPC;
}
}
public static AbstractNpcAPI Instance() {
if (instance == null) {
instance = new NpcAPI();
}
return instance;
}
public EventBus events() {
return EVENT_BUS;
}
public IItemStack getIItemStack(ItemStack itemstack) {
if(itemstack == null)
return null;
if (itemstack.getItem() instanceof ItemScripted) {
return new ScriptCustomItem(itemstack);
} else if(itemstack.getItem() instanceof ItemArmor) {
return new ScriptItemArmor(itemstack);
} else if(itemstack.getItem() instanceof ItemBook) {
return new ScriptItemBook(itemstack);
} else if(itemstack.getItem() instanceof ItemBlock) {
return new ScriptItemBlock(itemstack);
} else {
return new ScriptItemStack(itemstack);
}
}
public IItemStack createItem(String id, int damage, int size) {
Item item = (Item) Item.itemRegistry.getObject(id);
if (item == null)
return null;
return getIItemStack(new ItemStack(item, size, damage));
}
public IWorld getIWorld(WorldServer world) {
ScriptWorld w = (ScriptWorld)worldCache.get(world.provider.dimensionId);
if (w != null) {
w.world = world;
return w;
} else {
worldCache.put(world.provider.dimensionId, w = ScriptWorld.createNew(world));
return w;
}
}
public IWorld getIWorld(int dimensionId) {
WorldServer[] var2 = CustomNpcs.getServer().worldServers;
int var3 = var2.length;
for(int var4 = 0; var4 < var3; ++var4) {
WorldServer world = var2[var4];
if (world.provider.dimensionId == dimensionId) {
return this.getIWorld(world);
}
}
throw new CustomNPCsException("Unknown dimension id: " + dimensionId, new Object[0]);
}
public IContainer getIContainer(IInventory inventory) {
return new ScriptContainer(inventory);
}
public IContainer getIContainer(Container container) {
return (IContainer)(container instanceof ContainerNpcInterface ? ContainerNpcInterface.getOrCreateIContainer((ContainerNpcInterface)container) : new ScriptContainer(container));
}
private void checkWorld() {
if (CustomNpcs.getServer() == null || CustomNpcs.getServer().isServerStopped()) {
throw new CustomNPCsException("No world is loaded right now", new Object[0]);
}
}
public IWorld[] getIWorlds() {
this.checkWorld();
IWorld[] worlds = new IWorld[CustomNpcs.getServer().worldServers.length];
for(int i = 0; i < CustomNpcs.getServer().worldServers.length; ++i) {
worlds[i] = this.getIWorld(CustomNpcs.getServer().worldServers[i]);
}
return worlds;
}
public File getGlobalDir() {
return CustomNpcs.Dir;
}
public File getWorldDir() {
return CustomNpcs.getWorldSaveDirectory();
}
public IDamageSource getIDamageSource(DamageSource damagesource) {
return new ScriptDamageSource(damagesource);
}
public IDamageSource getIDamageSource(IEntity entity) {
if(entity.getType() == 1)//if player
return new ScriptDamageSource(new EntityDamageSource("player",entity.getMCEntity()));
else
return new ScriptDamageSource(new EntityDamageSource(entity.getTypeName(),entity.getMCEntity()));
}
public void executeCommand(IWorld world, String command) {
//if(!world.getMCWorld().isRemote)
NoppesUtilServer.runCommand(world.getMCWorld(), "API", command);
}
public String getRandomName(int dictionary, int gender) {
return CustomNpcs.MARKOV_GENERATOR[dictionary].fetch(gender);
}
public IPlayer[] getAllServerPlayers(){
List<EntityPlayer> list = MinecraftServer.getServer().getConfigurationManager().playerEntityList;
IPlayer[] arr = new IPlayer[list.size()];
for(int i = 0; i < list.size(); i++){
arr[i] = (IPlayer) NpcAPI.Instance().getIEntity(list.get(i));
}
return arr;
}
public void playSoundAtEntity(IEntity entity, String sound, float volume, float pitch){
entity.getWorld().getMCWorld().playSoundAtEntity(entity.getMCEntity(), sound, volume, pitch);
}
public void playSoundToNearExcept(IPlayer player, String sound, float volume, float pitch){
player.getWorld().getMCWorld().playSoundToNearExcept((EntityPlayerMP) player.getMCEntity(), sound, volume, pitch);
}
public String getMOTD()
{
return MinecraftServer.getServer().getMOTD();
}
public void setMOTD(String motd)
{
MinecraftServer.getServer().setMOTD(motd);
}
public IParticle createParticle(String directory){
return new ScriptParticle(directory);
}
@Deprecated
public IParticle createEntityParticle(String directory){
return new ScriptParticle(directory);
}
public int getServerTime() {
return MinecraftServer.getServer().getTickCounter();
}
public boolean arePlayerScriptsEnabled() {
return CustomNpcs.GlobalPlayerScripts;
}
public boolean areForgeScriptsEnabled() {
return CustomNpcs.GlobalForgeScripts;
}
public boolean areGlobalNPCScriptsEnabled() {
return CustomNpcs.GlobalNPCScripts;
}
public void enablePlayerScripts(boolean enable) {
CustomNpcs.GlobalPlayerScripts = enable;
}
public void enableForgeScripts(boolean enable) {
CustomNpcs.GlobalForgeScripts = enable;
}
public void enableGlobalNPCScripts(boolean enable) {
CustomNpcs.GlobalNPCScripts = enable;
}
public ICustomGui createCustomGui(int id, int width, int height, boolean pauseGame) {
return new ScriptGui(id, width, height, pauseGame);
}
public ICustomOverlay createCustomOverlay(int id) {
return new ScriptOverlay(id);
}
public ISkinOverlay createSkinOverlay(String texture) {
return new SkinOverlay(texture);
}
}
@@ -18,7 +18,7 @@ import noppes.npcs.scripted.interfaces.*;
import noppes.npcs.util.LRUHashMap;
public class ScriptBlock implements IBlock {
private static final Map<String, ScriptBlock> blockCache = new LRUHashMap(400);
private static final Map<String, IBlock> blockCache = new LRUHashMap(400);
protected final IWorld world;
protected final Block block;
protected final BlockPos pos;
@@ -34,6 +34,7 @@ public class ScriptBlock implements IBlock {
}
protected void setTile(TileEntity tile) {
world.setTileEntity(pos.getX(),pos.getY(), pos.getZ(),new ScriptTileEntity(tile));
this.tile = tile;
}
@@ -61,19 +62,19 @@ public class ScriptBlock implements IBlock {
return this.block.isAir(this.world.getMCWorld(), getX(), getY(), getZ());
}
public ScriptBlock setBlock(String name) {
Block block = (Block)Block.blockRegistry.getObject(new ResourceLocation(name));
public IBlock setBlock(String blockName) {
Block block = (Block)Block.blockRegistry.getObject(new ResourceLocation(blockName));
if(block == null) {
return this;
} else {
this.world.getMCWorld().setBlock(getX(),getY(),getZ(),block);
return new ScriptBlock(this.world.getMCWorld(), block, this.pos);
return NpcAPI.Instance().getIBlock(world.getMCWorld(), block, new BlockPos(getX(),getY(),getZ()));
}
}
public ScriptBlock setBlock(IBlock block) {
public IBlock setBlock(IBlock block) {
this.world.getMCWorld().setBlock(getX(),getY(),getZ(),block.getMCBlock());
return new ScriptBlock(this.world.getMCWorld(), block.getMCBlock(), this.pos);
return NpcAPI.Instance().getIBlock(world.getMCWorld(), block.getMCBlock(), new BlockPos(getX(),getY(),getZ()));
}
public boolean isContainer() {
@@ -112,6 +113,15 @@ public class ScriptBlock implements IBlock {
return this.tile != null;
}
public ITileEntity getTileEntity() {
return new ScriptTileEntity(this.tile);
}
public void setTileEntity(ITileEntity tileEntity){
world.setTileEntity(pos.getX(),pos.getY(), pos.getZ(),tileEntity);
this.tile = tileEntity.getMCTileEntity();
}
public TileEntity getMCTileEntity() {
return this.tile;
}
@@ -6,13 +6,15 @@
package noppes.npcs.scripted;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import noppes.npcs.NoppesUtilPlayer;
import noppes.npcs.containers.ContainerCustomGui;
import noppes.npcs.scripted.interfaces.IContainer;
import noppes.npcs.scripted.interfaces.IItemStack;
import noppes.npcs.scripted.interfaces.entity.IPlayer;
import noppes.npcs.scripted.interfaces.item.IItemStack;
public class ScriptContainer implements IContainer {
private IInventory inventory;
@@ -87,4 +89,12 @@ public class ScriptContainer implements IContainer {
public boolean isCustomGUI() {
return this.container instanceof ContainerCustomGui;
}
public void detectAndSendChanges() {
container.detectAndSendChanges();
}
public boolean isPlayerNotUsingContainer(IPlayer player){
return container.isPlayerNotUsingContainer((EntityPlayerMP) player.getMCEntity());
}
}
@@ -3,12 +3,12 @@
// (powered by FernFlower decompiler)
//
package noppes.npcs.scripted.wrapper;
package noppes.npcs.scripted;
import net.minecraft.util.DamageSource;
import noppes.npcs.controllers.ScriptController;
import noppes.npcs.scripted.interfaces.IDamageSource;
import noppes.npcs.scripted.NpcAPI;
import noppes.npcs.scripted.interfaces.IEntity;
import noppes.npcs.scripted.interfaces.entity.IEntity;
public class ScriptDamageSource implements IDamageSource {
private DamageSource source;
@@ -4,15 +4,20 @@ import noppes.npcs.controllers.Faction;
import noppes.npcs.controllers.FactionController;
import noppes.npcs.scripted.entity.ScriptNpc;
import noppes.npcs.scripted.entity.ScriptPlayer;
import net.minecraft.entity.player.EntityPlayer;
import noppes.npcs.controllers.data.Faction;
import noppes.npcs.entity.EntityNPCInterface;
import noppes.npcs.scripted.interfaces.entity.ICustomNpc;
import noppes.npcs.scripted.interfaces.entity.IPlayer;
public class ScriptFaction {
private Faction faction;
public void saveFaction() {
FactionController.getInstance().saveFaction(faction);
}
public ScriptFaction(Faction faction){
this.faction = faction;
}
@@ -34,76 +39,76 @@ public class ScriptFaction {
public void setName(String name) {
faction.name = name;
}
public int getDefaultPoints(){
return faction.defaultPoints;
}
public void setDefaultPoints(int p) {
faction.defaultPoints = p;
}
public int getFriendlyPoints() {
return faction.friendlyPoints;
}
public void setFriendlyPoints(int p) {
faction.friendlyPoints = p;
}
public int getNeutralPoints() {
return faction.neutralPoints;
}
public void setNeutralPoints(int p) {
faction.neutralPoints = p;
}
public boolean getHideFaction() {
return faction.hideFaction;
}
public void setHideFaction(boolean b) {
faction.hideFaction = b;
}
public boolean getGetsAttacked() {
return faction.getsAttacked;
}
public void setGetsAttacked(boolean b) {
faction.getsAttacked = b;
}
public int getColor(){
return faction.color;
}
public void setColor(int c) {
faction.color = c;
}
public boolean isFriendlyToPlayer(ScriptPlayer player){
return faction.isFriendlyToPlayer(player.player);
public boolean isFriendlyToPlayer(IPlayer player){
return faction.isFriendlyToPlayer((EntityPlayer) player.getMCEntity());
}
public boolean isNeutralToPlayer(ScriptPlayer player){
return faction.isNeutralToPlayer(player.player);
public boolean isNeutralToPlayer(IPlayer player){
return faction.isNeutralToPlayer((EntityPlayer) player.getMCEntity());
}
public boolean isAggressiveToPlayer(ScriptPlayer player){
return faction.isAggressiveToPlayer(player.player);
public boolean isAggressiveToPlayer(IPlayer player){
return faction.isAggressiveToPlayer((EntityPlayer) player.getMCEntity());
}
public boolean isAggressiveToNpc(ScriptNpc npc){
return faction.isAggressiveToNpc(npc.npc);
public boolean isAggressiveToNpc(ICustomNpc npc){
return faction.isAggressiveToNpc((EntityNPCInterface) npc.getMCEntity());
}
public Integer[] getEnemyFactionIds() {
if (faction.attackFactions == null) return new Integer[0];
return faction.attackFactions.toArray(new Integer[faction.attackFactions.size()]);
}
public boolean isEnemyFaction(int id) {
if (faction.attackFactions == null) return false;
Integer[] enemies = getEnemyFactionIds();
@@ -112,13 +117,13 @@ public class ScriptFaction {
}
return false;
}
public void addFactionEnemy(int id) {
if (!faction.attackFactions.contains(id)) faction.attackFactions.add(id);
}
public void removeFactionEnemy(int id) {
faction.attackFactions.remove(id);
}
}
@@ -200,7 +200,7 @@ public class ScriptNbt implements INbt {
}
public boolean isEqual(INbt nbt) {
return nbt == null?false:this.compound.equals(nbt.getMCNBT());
return nbt != null && this.compound.equals(nbt.getMCNBT());
}
public void clear() {
@@ -1,20 +1,23 @@
package noppes.npcs.scripted;
import noppes.npcs.NoppesUtilServer;
import noppes.npcs.scripted.entity.ScriptEntity;
import noppes.npcs.scripted.interfaces.IParticle;
import noppes.npcs.scripted.interfaces.entity.IEntity;
/**
* Created by luisc on 9/8/2021.
*/
public class ScriptEntityParticle {
public class ScriptParticle implements IParticle {
private String directory;
private int HEXcolor = 0xFFFFFF;
private int HEXColor = 0xFFFFFF;
private int HEXColor2 = 0xFFFFFF;
private float HEXColorRate = 0.0f;
private int HEXColorStart = 0;
private int amount = 1;
private int maxAge = 20;
private double x = 0,y = 0,z = 0;
private double motionX = 0,motionY = 0,motionZ = 0;
private float gravity = 0;
private float scale1 = 1.0f,scale2 = 1.0f,scaleRate = 0.0f;
private float scale1 = 20.0f,scale2 = 20.0f,scaleRate = 0.0f;
private float alpha1 = 1.0f,alpha2 = 1.0f,alphaRate = 0.0f;
private int scaleRateStart = 0, alphaRateStart = 0;
@@ -33,13 +36,24 @@ public class ScriptEntityParticle {
public float rotationZRate = 0.0F;
public int rotationZRateStart = 0;
public ScriptEntityParticle(String directory){
public int width = -1, height = -1;
public int offsetX = 0, offsetY = 0;
public int animRate = 0;
public boolean animLoop = true;
public int animStart = 0, animEnd = -1;
public boolean facePlayer = true;
public ScriptParticle(String directory){
this.directory = directory;
}
public void spawnOnEntity(ScriptEntity entity){
public void spawnOnEntity(IEntity entity){
int entityID = entity.getMCEntity().getEntityId();
NoppesUtilServer.spawnScriptedParticle(directory, HEXcolor, amount, maxAge,
NoppesUtilServer.spawnScriptedParticle(directory,
HEXColor, HEXColor2, HEXColorRate, HEXColorStart,
amount, maxAge,
x, y, z,
motionX, motionY, motionZ, gravity,
scale1, scale2, scaleRate, scaleRateStart,
@@ -47,26 +61,100 @@ public class ScriptEntityParticle {
rotationX1, rotationX2, rotationXRate, rotationXRateStart,
rotationY1, rotationY2, rotationYRate, rotationYRateStart,
rotationZ1, rotationZ2, rotationZRate, rotationZRateStart,
entityID
facePlayer, width, height, offsetX, offsetY,
animRate, animLoop, animStart, animEnd,
entityID, entity.getWorld().getDimensionID()
);
}
public void spawnInWorld(ScriptWorld world){
NoppesUtilServer.spawnScriptedParticle(directory,
HEXColor, HEXColor2, HEXColorRate, HEXColorStart,
amount, maxAge,
x, y, z,
motionX, motionY, motionZ, gravity,
scale1, scale2, scaleRate, scaleRateStart,
alpha1, alpha2, alphaRate, alphaRateStart,
rotationX1, rotationX2, rotationXRate, rotationXRateStart,
rotationY1, rotationY2, rotationYRate, rotationYRateStart,
rotationZ1, rotationZ2, rotationZRate, rotationZRateStart,
facePlayer, width, height, offsetX, offsetY,
animRate, animLoop, animStart, animEnd,
-1, world.getDimensionID()
);
}
public void spawnInWorld(ScriptWorld world, double x, double y, double z){
NoppesUtilServer.spawnScriptedParticle(directory,
HEXColor, HEXColor2, HEXColorRate, HEXColorStart,
amount, maxAge,
x, y, z,
motionX, motionY, motionZ, gravity,
scale1, scale2, scaleRate, scaleRateStart,
alpha1, alpha2, alphaRate, alphaRateStart,
rotationX1, rotationX2, rotationXRate, rotationXRateStart,
rotationY1, rotationY2, rotationYRate, rotationYRateStart,
rotationZ1, rotationZ2, rotationZRate, rotationZRateStart,
facePlayer, width, height, offsetX, offsetY,
animRate, animLoop, animStart, animEnd,
-1, world.getDimensionID()
);
}
public void setFacePlayer(boolean facePlayer) { this.facePlayer = facePlayer; }
public boolean getFacePlayer() { return facePlayer; }
public String getDirectory() {
return directory;
}
public int getHEXcolor() {
return HEXcolor;
public void setDirectory(String directory) {
this.directory = directory;
}
public void setAmount(int amount) {
this.amount = amount;
}
public int getAmount() {
return amount;
}
public void setMaxAge(int maxAge) {
this.maxAge = maxAge;
}
public int getMaxAge() {
return maxAge;
}
public void setSize(int width, int height){
this.width = width;
this.height = height;
}
public int getWidth() { return width; }
public int getHeight() { return height; }
public void setOffset(int offsetX, int offsetY){
this.offsetX = offsetX;
this.offsetY = offsetY;
}
public int getOffsetX() { return offsetX; }
public int getOffsetY() { return offsetY; }
public void setAnim(int animRate, boolean animLoop, int animStart, int animEnd){
this.animRate = animRate;
this.animLoop = animLoop;
this.animStart = animStart;
this.animEnd = animEnd;
}
public int getAnimRate() { return animRate; }
public boolean getAnimLoop() { return animLoop; }
public int getAnimStart() { return animStart; }
public int getAnimEnd() { return animEnd; }
public void setPosition(double x, double y, double z){
this.x = x;
this.y = y;
this.z = z;
}
public double getX() {
return x;
}
@@ -77,6 +165,12 @@ public class ScriptEntityParticle {
return z;
}
public void setMotion(double motionX, double motionY, double motionZ, float gravity){
this.motionX = motionX;
this.motionY = motionY;
this.motionZ = motionZ;
this.gravity = gravity;
}
public double getMotionX() {
return motionX;
}
@@ -90,6 +184,31 @@ public class ScriptEntityParticle {
return gravity;
}
public void setHEXColor(int HEXColor, int HEXColor2, float HEXColorRate, int HEXColorStart) {
this.HEXColor = HEXColor;
this.HEXColor2 = HEXColor2;
this.HEXColorRate = HEXColorRate;
this.HEXColorStart = HEXColorStart;
}
public int getHEXColor1() {
return HEXColor;
}
public int getHEXColor2() {
return HEXColor2;
}
public float getHEXColorRate() {
return HEXColorRate;
}
public int getHEXColorStart() {
return HEXColorStart;
}
public void setAlpha(float alpha1, float alpha2, float alphaRate, int alphaRateStart){
this.alpha1 = alpha1;
this.alpha2 = alpha2;
this.alphaRate = alphaRate;
this.alphaRateStart = alphaRateStart;
}
public float getAlpha1() {
return alpha1;
}
@@ -103,6 +222,12 @@ public class ScriptEntityParticle {
return alphaRateStart;
}
public void setScale(float scale1, float scale2, float scaleRate, int scaleRateStart){
this.scale1 = scale1;
this.scale2 = scale2;
this.scaleRate = scaleRate;
this.scaleRateStart = scaleRateStart;
}
public float getScale1() {
return scale1;
}
@@ -116,119 +241,16 @@ public class ScriptEntityParticle {
return scaleRateStart;
}
public float getRotationX1() {return rotationX1;}
public float getRotationX2() {return rotationX2;}
public float getRotationXRate() {return rotationXRate;}
public int getRotationXRateStart() {return rotationXRateStart;}
public float getRotationY1() {return rotationY1;}
public float getRotationY2() {return rotationY2;}
public float getRotationYRate() {return rotationYRate;}
public int getRotationYRateStart() {return rotationYRateStart;}
public float getRotationZ1() {return rotationZ1;}
public float getRotationZ2() {return rotationZ2;}
public float getRotationZRate() {return rotationZRate;}
public int getRotationZRateStart() {return rotationZRateStart;}
public void setDirectory(String directory) {
this.directory = directory;
}
public void setHEXColor(int HEXcolor) {
this.HEXcolor = HEXcolor;
}
public void setAmount(int amount) {
this.amount = amount;
}
public void setMaxAge(int maxAge) {
this.maxAge = maxAge;
}
public void setPosition(double x, double y, double z){
this.x = x;
this.y = y;
this.z = z;
}
public void setX(double x) {
this.x = x;
}
public void setY(double y) {
this.y = y;
}
public void setZ(double z) {
this.z = z;
}
public void setMotion(double motionX, double motionY, double motionZ, float gravity){
this.motionX = motionX;
this.motionY = motionY;
this.motionZ = motionZ;
this.gravity = gravity;
}
public void setMotionX(double motionX) {
this.motionX = motionX;
}
public void setMotionY(double motionY) {
this.motionY = motionY;
}
public void setMotionZ(double motionZ) {
this.motionZ = motionZ;
}
public void setGravity(float gravity) {
this.gravity = gravity;
}
public void setScale(float scale1, float scale2, float scaleRate, int scaleRateStart){
this.scale1 = scale1;
this.scale2 = scale2;
this.scaleRate = scaleRate;
this.scaleRateStart = scaleRateStart;
}
public void setScale1(float scale1) {
this.scale1 = scale1;
}
public void setScale2(float scale2) {
this.scale2 = scale2;
}
public void setScaleRate(float scaleRate) {
this.scaleRate = scaleRate;
}
public void setScaleRateStart(int scaleRateStart) {
this.scaleRateStart = scaleRateStart;
}
public void setAlpha(float alpha1, float alpha2, float alphaRate, int alphaRateStart){
this.alpha1 = alpha1;
this.alpha2 = alpha2;
this.alphaRate = alphaRate;
this.alphaRateStart = alphaRateStart;
}
public void setAlpha1(float alpha1) {
this.alpha1 = alpha1;
}
public void setAlpha2(float alpha2) {
this.alpha2 = alpha2;
}
public void setAlphaRate(float alphaRate) {
this.alphaRate = alphaRate;
}
public void setAlphaRateStart(int alphaRateStart) {
this.alphaRateStart = alphaRateStart;
}
public void setRotationX(float rotationX1, float rotationX2, float rotationXRate, int rotationXRateStart){
this.rotationX1 = rotationX1;
this.rotationX2 = rotationX2;
this.rotationXRate = rotationXRate;
this.rotationXRateStart = rotationXRateStart;
}
public void setRotationX1(float rotationX1) {this.rotationX1 = rotationX1;}
public void setRotationX2(float rotationX2) {this.rotationX2 = rotationX2;}
public void setRotationXRate(float rotationXRate) {this.rotationXRate = rotationXRate;}
public void setRotationXRateStart(int rotationXRateStart) {this.rotationXRateStart = rotationXRateStart;}
public float getRotationX1() {return rotationX1;}
public float getRotationX2() {return rotationX2;}
public float getRotationXRate() {return rotationXRate;}
public int getRotationXRateStart() {return rotationXRateStart;}
public void setRotationY(float rotationY1, float rotationY2, float rotationYRate, int rotationYRateStart){
this.rotationY1 = rotationY1;
@@ -236,10 +258,10 @@ public class ScriptEntityParticle {
this.rotationYRate = rotationYRate;
this.rotationYRateStart = rotationYRateStart;
}
public void setRotationY1(float rotationY1) {this.rotationY1 = rotationY1;}
public void setRotationY2(float rotationY2) {this.rotationY2 = rotationY2;}
public void setRotationYRate(float rotationYRate) {this.rotationYRate = rotationYRate;}
public void setRotationYRateStart(int rotationYRateStart) {this.rotationYRateStart = rotationYRateStart;}
public float getRotationY1() {return rotationY1;}
public float getRotationY2() {return rotationY2;}
public float getRotationYRate() {return rotationYRate;}
public int getRotationYRateStart() {return rotationYRateStart;}
public void setRotationZ(float rotationZ1, float rotationZ2, float rotationZRate, int rotationZRateStart){
this.rotationZ1 = rotationZ1;
@@ -247,8 +269,17 @@ public class ScriptEntityParticle {
this.rotationZRate = rotationZRate;
this.rotationZRateStart = rotationZRateStart;
}
public void setRotationZ1(float rotationZ1) {this.rotationZ1 = rotationZ1;}
public void setRotationZ2(float rotationZ2) {this.rotationZ2 = rotationZ2;}
public void setRotationZRate(float rotationZRate) {this.rotationZRate = rotationZRate;}
public void setRotationZRateStart(int rotationZRateStart) {this.rotationZRateStart = rotationZRateStart;}
public float getRotationZ1() {return rotationZ1;}
public float getRotationZ2() {return rotationZ2;}
public float getRotationZRate() {return rotationZRate;}
public int getRotationZRateStart() {return rotationZRateStart;}
@Deprecated
public void setHEXColor(int HEXColor) {
this.HEXColor = HEXColor;
}
@Deprecated
public int getHEXColor() {
return HEXColor;
}
}
@@ -0,0 +1,61 @@
package noppes.npcs.scripted;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.WorldServer;
import noppes.npcs.scripted.interfaces.IBlock;
import noppes.npcs.scripted.interfaces.INbt;
import noppes.npcs.scripted.interfaces.ITileEntity;
public class ScriptTileEntity<T extends TileEntity> implements ITileEntity {
protected T tileEntity;
public ScriptTileEntity(T tileEntity) { this.tileEntity = tileEntity; }
public int getBlockMetadata(){
return tileEntity.getBlockMetadata();
}
public ScriptWorld getWorld(){
return (ScriptWorld) NpcAPI.Instance().getIWorld((WorldServer) tileEntity.getWorldObj());
}
public TileEntity getMCTileEntity() {
return this.tileEntity;
}
public void readFromNBT(INbt nbt){
this.tileEntity.readFromNBT(nbt.getMCNBT());
}
public double getDistanceFrom(double x, double y, double z){
return this.tileEntity.getDistanceFrom(x,y,z);
}
public IBlock getBlockType(){
return NpcAPI.Instance().getIBlock(tileEntity.getWorldObj(), tileEntity.getBlockType(), new BlockPos(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord));
}
public boolean isInvalid(){
return tileEntity.isInvalid();
}
public void invalidate(){
tileEntity.invalidate();
}
public void validate() {
tileEntity.validate();
}
public void updateContainingBlockInfo(){
tileEntity.updateContainingBlockInfo();
}
public INbt getNBT() {
NBTTagCompound compound = new NBTTagCompound();
this.tileEntity.writeToNBT(compound);
return NpcAPI.Instance().getINbt(compound);
}
}
@@ -3,14 +3,14 @@ package noppes.npcs.scripted;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
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.entity.player.EntityPlayerMP;
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;
@@ -25,10 +25,13 @@ import noppes.npcs.NoppesUtilServer;
import noppes.npcs.blocks.tiles.TileBigSign;
import noppes.npcs.controllers.ScriptController;
import noppes.npcs.controllers.ServerCloneController;
import noppes.npcs.scripted.entity.ScriptEntity;
import noppes.npcs.scripted.entity.ScriptPlayer;
import noppes.npcs.scripted.interfaces.IBlock;
import noppes.npcs.scripted.interfaces.IPos;
import noppes.npcs.scripted.interfaces.IParticle;
import noppes.npcs.scripted.interfaces.ITileEntity;
import noppes.npcs.scripted.interfaces.entity.IEntity;
import noppes.npcs.scripted.interfaces.entity.IPlayer;
import noppes.npcs.scripted.interfaces.item.IItemStack;
import noppes.npcs.scripted.interfaces.IWorld;
public class ScriptWorld implements IWorld {
@@ -55,7 +58,11 @@ public class ScriptWorld implements IWorld {
public long getTotalTime(){
return world.getTotalWorldTime();
}
public boolean areAllPlayersAsleep(){
return world.areAllPlayersAsleep();
}
/**
* @param x World position x
* @param y World position y
@@ -66,9 +73,133 @@ public class ScriptWorld implements IWorld {
Block block = world.getBlock(x, y, z);
if(block == null || block.isAir(world, x, y, z))
return null;
return new ScriptBlock(world, block, new BlockPos(x,y,z));
return NpcAPI.Instance().getIBlock(world, block, new BlockPos(x,y,z));
}
public boolean isBlockFreezable(int x, int y, int z){
return world.isBlockFreezable(x,y,z);
}
public boolean isBlockFreezableNaturally(int x, int y, int z){
return world.isBlockFreezableNaturally(x,y,z);
}
public boolean canBlockFreeze(int x, int y, int z, boolean adjacentToWater){
return world.canBlockFreeze(x,y,z,adjacentToWater);
}
public boolean canBlockFreezeBody(int x, int y, int z, boolean adjacentToWater){
return world.canBlockFreezeBody(x,y,z,adjacentToWater);
}
public boolean canSnowAt(int x, int y, int z, boolean checkLight){
return world.func_147478_e(x,y,z,checkLight);
}
public boolean canSnowAtBody(int x, int y, int z, boolean checkLight){
return world.canSnowAtBody(x,y,z,checkLight);
}
public IBlock getTopBlock(int x, int z){
int y;
for (y = 63; !world.isAirBlock(x, y + 1, z); ++y) {;}
Block block = world.getBlock(x, y, z);
return NpcAPI.Instance().getIBlock(world, block, new BlockPos(x,y,z));
}
public int getHeightValue(int x, int z){
return world.getHeightValue(x,z);
}
public int getChunkHeightMapMinimum(int x, int z){
return world.getChunkHeightMapMinimum(x,z);
}
public int getBlockMetadata(int x, int y, int z){
return world.getBlockMetadata(x,y,z);
}
public boolean setBlockMetadataWithNotify(int x, int y, int z, int metadata, int flag){
return world.setBlockMetadataWithNotify(x,y,z,metadata,flag);
}
public boolean canBlockSeeTheSky(int x, int y, int z){
return world.canBlockSeeTheSky(x,y,z);
}
public int getFullBlockLightValue(int x, int y, int z){
return world.getFullBlockLightValue(x,y,z);
}
public int getBlockLightValue(int x, int y, int z){
return world.getBlockLightValue(x,y,z);
}
public void playSoundAtEntity(IEntity entity, String sound, float volume, float pitch){
world.playSoundAtEntity(entity.getMCEntity(), sound, volume, pitch);
}
public void playSoundToNearExcept(IPlayer player, String sound, float volume, float pitch){
world.playSoundToNearExcept((EntityPlayerMP) player.getMCEntity(), sound, volume, pitch);
}
public IEntity getEntityByID(int id){
return NpcAPI.Instance().getIEntity(world.getEntityByID(id));
}
public boolean spawnEntityInWorld(IEntity entity){
return world.spawnEntityInWorld(entity.getMCEntity());
}
public IPlayer getClosestPlayerToEntity(IEntity entity, double range){
return (IPlayer) NpcAPI.Instance().getIEntity(world.getClosestPlayerToEntity(entity.getMCEntity(), range));
}
public IPlayer getClosestPlayer(double x, double y, double z, double range){
return (IPlayer) NpcAPI.Instance().getIEntity(world.getClosestPlayer(x,y,z, range));
}
public IPlayer getClosestVulnerablePlayerToEntity(IEntity entity, double range){
return (IPlayer) NpcAPI.Instance().getIEntity(world.getClosestVulnerablePlayerToEntity(entity.getMCEntity(), range));
}
public IPlayer getClosestVulnerablePlayer(double x, double y, double z, double range){
return (IPlayer) NpcAPI.Instance().getIEntity(world.getClosestVulnerablePlayer(x,y,z, range));
}
public int countEntities(IEntity entity){
return world.countEntities(entity.getMCEntity().getClass());
}
public void setTileEntity(int x, int y, int z, ITileEntity tileEntity){
world.setTileEntity(x,y,z,tileEntity.getMCTileEntity());
}
public void removeTileEntity(int x, int y, int z){
world.removeTileEntity(x,y,z);
}
public boolean isBlockFullCube(int x, int y, int z){
return world.func_147469_q(x,y,z);
}
public long getSeed(){
return world.getSeed();
}
public void setSpawnLocation(int x, int y, int z){
world.setSpawnLocation(x,y,z);
}
public boolean canLightningStrikeAt(int x, int y, int z){
return world.canLightningStrikeAt(x,y,z);
}
public boolean isBlockHighHumidity(int x, int y, int z){
return world.isBlockHighHumidity(x,y,z);
}
/**
* @param pos
* @return The block at the given position. Returns null if there isn't a block
@@ -109,19 +240,19 @@ public class ScriptWorld implements IWorld {
}
world.setBlock(x, y, z, block.getMCBlock());
}
/**
* @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){
public void setBlock(int x, int y, int z, IItemStack item){
if(item == null){
removeBlock(x, y, z);
return;
}
Block block = Block.getBlockFromItem(item.item.getItem());
Block block = Block.getBlockFromItem(item.getMCItemStack().getItem());
if(block == null || block == Blocks.air)
return;
world.setBlock(x, y, z, block);
@@ -138,9 +269,9 @@ public class ScriptWorld implements IWorld {
/**
* starting at the start position, draw a line in the lookVector direction until a block is detected
* @param startPos
* @param startPos
* @param lookVector should be a normalized direction vector
* @param maxDistance
* @param maxDistance
* @return the first detected block but null if maxDistance is reached
*/
public IBlock rayCastBlock(double[] startPos, double[] lookVector, int maxDistance) {
@@ -163,18 +294,18 @@ public class ScriptWorld implements IWorld {
//System.out.println("ScriptWorld:WARNING: Repeated a ray cast to many times");
return null;
}
/**
* starting at the start position, draw a line in the lookVector direction until a block is detected
* @param startPos
* @param startPos
* @param lookVector will normalize x, y, z to get a direction vector
* @param maxDistance
* @param maxDistance
* @return the first detected block but null if maxDistance is reached
*/
public IBlock rayCastBlock(IPos startPos, IPos lookVector, int maxDistance) {
return rayCastBlock(new double[] {startPos.getX(), startPos.getY(), startPos.getZ()}, lookVector.normalize(), maxDistance);
}
public IPos getNearestAir(IPos pos, int maxHeight) {
if (pos == null) return null;
IPos currentPos = pos;
@@ -203,24 +334,28 @@ public class ScriptWorld implements IWorld {
}
return currentPos;
}
public boolean canSeeSky(int x, int y, int z) {
return world.canBlockSeeTheSky(x, y, z);
}
public boolean canSeeSky(IPos pos) {
return canSeeSky(pos.getX(), pos.getY(), pos.getZ());
}
/**
* @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){
public IPlayer getPlayer(String name){
EntityPlayer player = world.getPlayerEntityByName(name);
if(player == null)
return null;
return (ScriptPlayer) ScriptController.Instance.getScriptForEntity(player);
return (IPlayer) NpcAPI.Instance().getIEntity(player);
}
public IPlayer getPlayerByUUID(String uuid){
return (IPlayer) NpcAPI.Instance().getIEntity(world.func_152378_a(UUID.fromString(uuid)));
}
/**
@@ -229,7 +364,7 @@ public class ScriptWorld implements IWorld {
public void setTime(long time){
world.setWorldTime(time);
}
/**
* @return Whether or not its daytime
*/
@@ -282,21 +417,19 @@ public class ScriptWorld implements IWorld {
* @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));
public IItemStack createItem(String id, int damage, int size){
return NpcAPI.Instance().createItem(id,damage,size);
}
/**
* @param directory The particle's texture directory. Use only forward slashes when writing a directory. Example: "customnpcs:textures/particle/tail.png"
* @return Returns ScriptEntityParticle object
* @param directory The particle's texture directory. Use only forward slashes when writing a directory. Example: "customnpcs:textures/particle/bubble.png"
* @return Returns ScriptParticle object
*/
public ScriptEntityParticle createEntityParticle(String directory){
return new ScriptEntityParticle(directory);
@Deprecated
public IParticle createEntityParticle(String directory){
return NpcAPI.Instance().createEntityParticle(directory);
}
/**
* @param key Get temp data for this key
* @return Returns the stored temp data
@@ -400,23 +533,16 @@ public class ScriptWorld implements IWorld {
world.newExplosion(null, x, y, z, range, fire, grief);
}
public ScriptPlayer[] getAllServerPlayers(){
public IPlayer[] getAllServerPlayers(){
List<EntityPlayer> list = MinecraftServer.getServer().getConfigurationManager().playerEntityList;
ScriptPlayer[] arr = new ScriptPlayer[list.size()];
IPlayer[] arr = new IPlayer[list.size()];
for(int i = 0; i < list.size(); i++){
arr[i] = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(list.get(i));
arr[i] = (IPlayer) NpcAPI.Instance().getIEntity(list.get(i));
}
return arr;
}
public String[] getPlayerNames() {
ScriptPlayer[] players = getAllServerPlayers();
String[] names = new String[players.length];
for (int i = 0; i < names.length; ++i) names[i] = players[i].getDisplayName();
return names;
}
/**
* @since 1.7.10c
* @param x Position x
@@ -436,14 +562,14 @@ public class ScriptWorld implements IWorld {
* @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){
public IEntity 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);
return NpcAPI.Instance().getIEntity(entity);
}
public ScriptScoreboard getScoreboard(){
@@ -2,7 +2,7 @@ package noppes.npcs.scripted.entity;
import net.minecraft.entity.passive.EntityAnimal;
import noppes.npcs.scripted.constants.EntityType;
import noppes.npcs.scripted.interfaces.IAnimal;
import noppes.npcs.scripted.interfaces.entity.IAnimal;
public class ScriptAnimal<T extends EntityAnimal> extends ScriptLiving<T> implements IAnimal {
@@ -5,11 +5,8 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import noppes.npcs.scripted.CustomNPCsException;
import noppes.npcs.scripted.interfaces.item.IItemStack;
import noppes.npcs.scripted.NpcAPI;
import noppes.npcs.scripted.ScriptItemStack;
import java.util.ArrayList;
import java.util.Locale;
public class ScriptDBCPlayer<T extends EntityPlayerMP> extends ScriptPlayer<T>{
public T player;
@@ -430,15 +427,15 @@ public class ScriptDBCPlayer<T extends EntityPlayerMP> extends ScriptPlayer<T>{
return compound.getCompoundTag("JRMCEP").getString("extracode");
}
public ScriptItemStack[] getInventory(){
public IItemStack[] getInventory(){
NBTTagCompound compound = new NBTTagCompound();
this.player.writeToNBT(compound);
NBTTagList list = compound.getCompoundTag("JRMCEP").getTagList("dbcExtraInvTag",10);
ScriptItemStack[] itemList = new ScriptItemStack[list.tagCount()];
IItemStack[] itemList = new IItemStack[list.tagCount()];
for (int i = 0; i < list.tagCount(); i++) {
ItemStack itemStack = ItemStack.loadItemStackFromNBT(list.getCompoundTagAt(i));
itemList[i] = new ScriptItemStack(itemStack);
itemList[i] = NpcAPI.Instance().getIItemStack(itemStack);
}
return itemList;
@@ -21,7 +21,6 @@ import net.minecraft.util.MathHelper;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.WorldServer;
import noppes.npcs.NoppesUtilServer;
import noppes.npcs.controllers.ScriptController;
import noppes.npcs.controllers.ServerCloneController;
import noppes.npcs.entity.EntityNPCInterface;
import noppes.npcs.scripted.CustomNPCsException;
@@ -31,9 +30,11 @@ import noppes.npcs.scripted.ScriptEntityParticle;
import noppes.npcs.scripted.ScriptItemStack;
import noppes.npcs.scripted.ScriptWorld;
import noppes.npcs.scripted.constants.EntityType;
import noppes.npcs.scripted.interfaces.IEntity;
import noppes.npcs.scripted.interfaces.entity.IEntity;
import noppes.npcs.scripted.interfaces.INbt;
import noppes.npcs.scripted.interfaces.IPos;
import noppes.npcs.scripted.interfaces.item.IItemStack;
import noppes.npcs.scripted.NpcAPI;
public class ScriptEntity<T extends Entity> implements IEntity {
protected T entity;
@@ -68,6 +69,7 @@ public class ScriptEntity<T extends Entity> implements IEntity {
* @param scaleRate Multiplier for the particle's transparency growth rate
* @param alphaRateStart The time at which the particle begins appearing/fading
*/
@Deprecated
public void spawnParticle(String directory, int HEXcolor, int amount, int maxAge,
double x, double y, double z,
double motionX, double motionY, double motionZ, float gravity,
@@ -79,7 +81,9 @@ public class ScriptEntity<T extends Entity> implements IEntity {
float rotationZ1, float rotationZ2, float rotationZRate, int rotationZRateStart
) {
int entityID = entity.getEntityId();
NoppesUtilServer.spawnScriptedParticle(directory, HEXcolor, amount, maxAge,
NoppesUtilServer.spawnScriptedParticle(directory,
HEXcolor, HEXcolor, 0, 0,
amount, maxAge,
x, y, z,
motionX, motionY, motionZ, gravity,
scale1, scale2, scaleRate, scaleRateStart,
@@ -87,9 +91,13 @@ public class ScriptEntity<T extends Entity> implements IEntity {
rotationX1, rotationX2, rotationXRate, rotationXRateStart,
rotationY1, rotationY2, rotationYRate, rotationYRateStart,
rotationZ1, rotationZ2, rotationZRate, rotationZRateStart,
entityID
true, -1, -1, 0,0,
0, true, 0, 0,
entityID, entity.dimension
);
}
@Deprecated
public void spawnParticle(String directory, int HEXcolor, int amount, int maxAge,
double x, double y, double z,
double motionX, double motionY, double motionZ, float gravity,
@@ -97,7 +105,9 @@ public class ScriptEntity<T extends Entity> implements IEntity {
float alpha1, float alpha2, float alphaRate, int alphaRateStart
) {
int entityID = entity.getEntityId();
NoppesUtilServer.spawnScriptedParticle(directory, HEXcolor, amount, maxAge,
NoppesUtilServer.spawnScriptedParticle(directory,
HEXcolor, HEXcolor, 0, 0,
amount, maxAge,
x, y, z,
motionX, motionY, motionZ, gravity,
scale1, scale2, scaleRate, scaleRateStart,
@@ -105,16 +115,22 @@ public class ScriptEntity<T extends Entity> implements IEntity {
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
entityID
true, -1, -1, 0,0,
0, true, 0, 0,
entityID, entity.dimension
);
}
@Deprecated
public void spawnParticle(String directory, int HEXcolor, int amount, int maxAge,
double x, double y, double z,
double motionX, double motionY, double motionZ, float gravity,
float scale1, float scale2, float scaleRate, int scaleRateStart
) {
int entityID = entity.getEntityId();
NoppesUtilServer.spawnScriptedParticle(directory, HEXcolor, amount, maxAge,
NoppesUtilServer.spawnScriptedParticle(directory,
HEXcolor, HEXcolor, 0, 0,
amount, maxAge,
x, y, z,
motionX, motionY, motionZ, gravity,
scale1, scale2, scaleRate, scaleRateStart,
@@ -122,15 +138,21 @@ public class ScriptEntity<T extends Entity> implements IEntity {
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
entityID
true, -1, -1, 0,0,
0, true, 0, 0,
entityID, entity.dimension
);
}
@Deprecated
public void spawnParticle(String directory, int HEXcolor, int amount, int maxAge,
double x, double y, double z,
double motionX, double motionY, double motionZ, float gravity
) {
int entityID = entity.getEntityId();
NoppesUtilServer.spawnScriptedParticle(directory, HEXcolor, amount, maxAge,
NoppesUtilServer.spawnScriptedParticle(directory,
HEXcolor, HEXcolor, 0, 0,
amount, maxAge,
x, y, z,
motionX, motionY, motionZ, gravity,
0, 0, 0, 0,
@@ -138,14 +160,20 @@ public class ScriptEntity<T extends Entity> implements IEntity {
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
entityID
true, -1, -1, 0,0,
0, true, 0, 0,
entityID, entity.dimension
);
}
@Deprecated
public void spawnParticle(String directory, int HEXcolor, int amount, int maxAge,
double x, double y, double z
) {
int entityID = entity.getEntityId();
NoppesUtilServer.spawnScriptedParticle(directory, HEXcolor, amount, maxAge,
NoppesUtilServer.spawnScriptedParticle(directory,
HEXcolor, HEXcolor, 0, 0,
amount, maxAge,
x, y, z,
0, 0, 0, 0,
0, 0, 0, 0,
@@ -153,13 +181,19 @@ public class ScriptEntity<T extends Entity> implements IEntity {
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
entityID
true, -1, -1, 0,0,
0, true, 0, 0,
entityID, entity.dimension
);
}
@Deprecated
public void spawnParticle(String directory, int HEXcolor, int amount, int maxAge
) {
int entityID = entity.getEntityId();
NoppesUtilServer.spawnScriptedParticle(directory, HEXcolor, amount, maxAge,
NoppesUtilServer.spawnScriptedParticle(directory,
HEXcolor, HEXcolor, 0, 0,
amount, maxAge,
0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
@@ -167,10 +201,21 @@ public class ScriptEntity<T extends Entity> implements IEntity {
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
entityID
true, -1, -1, 0,0,
0, true, 0, 0,
entityID, entity.dimension
);
}
public void spawnParticle(ScriptEntityParticle entityParticle) { entityParticle.spawnOnEntity(this); }
public void spawnParticle(ScriptParticle entityParticle) { entityParticle.spawnOnEntity(this); }
public int getEntityId(){
return entity.getEntityId();
}
public String getUniqueID(){
return entity.getUniqueID().toString();
}
public double getYOffset() { return entity.getYOffset(); }
@@ -319,18 +364,22 @@ public class ScriptEntity<T extends Entity> implements IEntity {
this.entity.setPosition((double)((float)pos.getX() + 0.5F), (double)pos.getY(), (double)((float)pos.getZ() + 0.5F));
}
public int getDimension(){
return entity.dimension;
}
/**
* @param range The search range for entities around this entity
* @return Array of entities within range
*/
public ScriptEntity[] getSurroundingEntities(int range){
public IEntity[] getSurroundingEntities(int range){
List<Entity> entities = entity.worldObj.getEntitiesWithinAABB(Entity.class, entity.boundingBox.expand(range, range, range));
List<ScriptEntity> list = new ArrayList<ScriptEntity>();
List<IEntity> list = new ArrayList<IEntity>();
for(Entity living : entities){
if(living != entity)
list.add(ScriptController.Instance.getScriptForEntity(living));
list.add(NpcAPI.Instance().getIEntity(living));
}
return list.toArray(new ScriptEntity[list.size()]);
return list.toArray(new IEntity[list.size()]);
}
/**
@@ -338,7 +387,7 @@ public class ScriptEntity<T extends Entity> implements IEntity {
* @param type The EntityType you want to find
* @return Array of entities within range
*/
public ScriptEntity[] getSurroundingEntities(int range, int type){
public IEntity[] getSurroundingEntities(int range, int type){
Class cls = Entity.class;
if(type == EntityType.LIVING)
cls = EntityLivingBase.class;
@@ -352,12 +401,12 @@ public class ScriptEntity<T extends Entity> implements IEntity {
cls = EntityNPCInterface.class;
List<Entity> entities = entity.worldObj.getEntitiesWithinAABB(cls, entity.boundingBox.expand(range, range, range));
List<ScriptEntity> list = new ArrayList<ScriptEntity>();
List<IEntity> list = new ArrayList<IEntity>();
for(Entity living : entities){
if(living != entity)
list.add(ScriptController.Instance.getScriptForEntity(living));
list.add(NpcAPI.Instance().getIEntity(living));
}
return list.toArray(new ScriptEntity[list.size()]);
return list.toArray(new IEntity[list.size()]);
}
@@ -549,23 +598,23 @@ public class ScriptEntity<T extends Entity> implements IEntity {
/**
* @param item Item to be dropped
*/
public void dropItem(ScriptItemStack item){
entity.entityDropItem(item.item, 0);
public void dropItem(IItemStack item){
entity.entityDropItem(item.getMCItemStack(), 0);
}
/**
* @return Return the rider
*/
public ScriptEntity getRider(){
return ScriptController.Instance.getScriptForEntity(entity.riddenByEntity);
public IEntity getRider(){
return NpcAPI.Instance().getIEntity(entity.riddenByEntity);
}
/**
* @param entity The entity to ride this entity
*/
public void setRider(ScriptEntity entity){
public void setRider(IEntity entity){
if(entity != null){
entity.entity.mountEntity(this.entity);;
entity.getMCEntity().mountEntity(this.entity);;
}
else if(this.entity.riddenByEntity != null)
this.entity.riddenByEntity.mountEntity(null);
@@ -574,18 +623,18 @@ public class ScriptEntity<T extends Entity> implements IEntity {
/**
* @return Return the entity, this entity is riding
*/
public ScriptEntity getMount(){
return ScriptController.Instance.getScriptForEntity(entity.ridingEntity);
public IEntity getMount(){
return NpcAPI.Instance().getIEntity(entity.ridingEntity);
}
/**
* @param entity The entity this entity will mount
*/
public void setMount(ScriptEntity entity){
public void setMount(IEntity entity){
if(entity == null)
this.entity.mountEntity(null);
else
this.entity.mountEntity(entity.entity);
this.entity.mountEntity(entity.getMCEntity());
}
/**
@@ -644,6 +693,18 @@ public class ScriptEntity<T extends Entity> implements IEntity {
entity.hurtResistantTime = ticks;
};
public void setInvisible(boolean invisible){
entity.setInvisible(invisible);
}
public void setSneaking(boolean sneaking){
entity.setSneaking(sneaking);
}
public void setSprinting(boolean sprinting){
entity.setSprinting(sprinting);
}
public boolean hasCollided() {
return entity.isCollided;
}
@@ -697,6 +758,6 @@ public class ScriptEntity<T extends Entity> implements IEntity {
}
public ScriptWorld getWorld() {
return (ScriptWorld)NpcAPI.Instance().getIWorld((WorldServer) entity.worldObj);
return (ScriptWorld) NpcAPI.Instance().getIWorld((WorldServer) entity.worldObj);
}
}
@@ -1,8 +1,10 @@
package noppes.npcs.scripted.entity;
import net.minecraft.entity.EntityLiving;
import noppes.npcs.controllers.ScriptController;
import noppes.npcs.scripted.interfaces.IEntityLiving;
import noppes.npcs.scripted.NpcAPI;
import noppes.npcs.scripted.interfaces.entity.IEntity;
import noppes.npcs.scripted.interfaces.entity.IEntityLiving;
import noppes.npcs.scripted.interfaces.entity.IEntityLivingBase;
public class ScriptLiving<T extends EntityLiving> extends ScriptLivingBase<T> implements IEntityLiving {
@@ -18,17 +20,17 @@ public class ScriptLiving<T extends EntityLiving> extends ScriptLivingBase<T> im
}
@Override
public void setAttackTarget(ScriptLivingBase living){
public void setAttackTarget(IEntityLivingBase living){
if(living == null)
entity.setAttackTarget(null);
else
entity.setAttackTarget(living.entity);
entity.setAttackTarget(living.getMCEntity());
super.setAttackTarget(living);
}
@Override
public ScriptLivingBase getAttackTarget(){
ScriptLivingBase base = (ScriptLivingBase)ScriptController.Instance.getScriptForEntity(entity.getAttackTarget());
public IEntityLivingBase getAttackTarget(){
IEntityLivingBase base = (IEntityLivingBase) NpcAPI.Instance().getIEntity(entity.getAttackTarget());
return (base != null)? base: super.getAttackTarget();
}
@@ -58,7 +60,7 @@ public class ScriptLiving<T extends EntityLiving> extends ScriptLivingBase<T> im
}
@Override
public boolean canSeeEntity(ScriptEntity entity){
return this.entity.getEntitySenses().canSee(entity.entity);
public boolean canSeeEntity(IEntity entity){
return this.entity.getEntitySenses().canSee(entity.getMCEntity());
}
}
@@ -2,17 +2,16 @@ package noppes.npcs.scripted.entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EntityDamageSource;
import net.minecraft.util.MathHelper;
import noppes.npcs.controllers.ScriptController;
import noppes.npcs.scripted.ScriptItemStack;
import noppes.npcs.scripted.interfaces.entity.IEntity;
import noppes.npcs.scripted.interfaces.item.IItemStack;
import noppes.npcs.scripted.constants.EntityType;
import noppes.npcs.scripted.interfaces.IEntityLivingBase;
import noppes.npcs.scripted.wrapper.ScriptDamageSource;
import noppes.npcs.scripted.interfaces.entity.IEntityLivingBase;
import noppes.npcs.scripted.NpcAPI;
import noppes.npcs.scripted.ScriptDamageSource;
public class ScriptLivingBase<T extends EntityLivingBase> extends ScriptEntity<T> implements IEntityLivingBase {
protected T entity;
@@ -40,7 +39,7 @@ public class ScriptLivingBase<T extends EntityLivingBase> extends ScriptEntity<T
entity.attackEntityFrom(DamageSource.generic,damage);
}
public void hurt(float damage, ScriptEntity source) {
public void hurt(float damage, IEntity source) {
if(source.getType() == 1)//if player
entity.attackEntityFrom(new EntityDamageSource("player",source.getMCEntity()),damage);
else
@@ -67,18 +66,18 @@ public class ScriptLivingBase<T extends EntityLivingBase> extends ScriptEntity<T
/**
* @param living Entity which this entity will attack
*/
public void setAttackTarget(ScriptLivingBase living){
public void setAttackTarget(IEntityLivingBase living){
if(living == null)
entity.setRevengeTarget(null);
else
entity.setRevengeTarget(living.entity);
entity.setRevengeTarget(living.getMCEntity());
}
/**
* @return The entity which this entity is attacking
*/
public ScriptLivingBase getAttackTarget(){
return (ScriptLivingBase)ScriptController.Instance.getScriptForEntity(entity.getAITarget());
public IEntityLivingBase getAttackTarget(){
return (IEntityLivingBase)NpcAPI.Instance().getIEntity(entity.getAITarget());
}
@Override
@@ -89,14 +88,14 @@ public class ScriptLivingBase<T extends EntityLivingBase> extends ScriptEntity<T
@Override
public boolean typeOf(int type){
return type == EntityType.LIVING?true:super.typeOf(type);
return type == EntityType.LIVING || 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);
public boolean canSeeEntity(IEntity entity){
return this.entity.canEntityBeSeen(entity.getMCEntity());
}
/**
@@ -117,6 +116,10 @@ public class ScriptLivingBase<T extends EntityLivingBase> extends ScriptEntity<T
public void swingHand(){
entity.swingItem();
}
public String getLookVec(){
return entity.getLookVec().toString();
}
/**
* Works the same as the <a href="http://minecraft.gamepedia.com/Commands#effect">/effect command</a>
@@ -169,11 +172,8 @@ public class ScriptLivingBase<T extends EntityLivingBase> extends ScriptEntity<T
* @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);
public IItemStack getHeldItem(){
return NpcAPI.Instance().getIItemStack(entity.getHeldItem());
}
/**
@@ -181,8 +181,8 @@ public class ScriptLivingBase<T extends EntityLivingBase> extends ScriptEntity<T
* @since 1.7.10c
* @param item The item to be set
*/
public void setHeldItem(ScriptItemStack item){
entity.setCurrentItemOrArmor(0, item == null?null:item.item);
public void setHeldItem(IItemStack item){
entity.setCurrentItemOrArmor(0, item == null?null:item.getMCItemStack());
}
/**
@@ -190,11 +190,8 @@ public class ScriptLivingBase<T extends EntityLivingBase> extends ScriptEntity<T
* @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);
public IItemStack getArmor(int slot){
return NpcAPI.Instance().getIItemStack(entity.getEquipmentInSlot(slot + 1));
}
/**
@@ -203,7 +200,7 @@ public class ScriptLivingBase<T extends EntityLivingBase> extends ScriptEntity<T
* @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);
public void setArmor(int slot, IItemStack item){
entity.setCurrentItemOrArmor(slot + 1, item == null?null:item.getMCItemStack());
}
}
@@ -2,7 +2,7 @@ package noppes.npcs.scripted.entity;
import net.minecraft.entity.monster.EntityMob;
import noppes.npcs.scripted.constants.EntityType;
import noppes.npcs.scripted.interfaces.IMonster;
import noppes.npcs.scripted.interfaces.entity.IMonster;
public class ScriptMonster<T extends EntityMob> extends ScriptLiving<T> implements IMonster {
@@ -1,17 +1,20 @@
package noppes.npcs.scripted.entity;
import net.minecraft.item.ItemStack;
import net.minecraft.entity.player.EntityPlayer;
import noppes.npcs.CustomNpcs;
import noppes.npcs.NoppesUtilServer;
import noppes.npcs.constants.*;
import noppes.npcs.controllers.Line;
import noppes.npcs.controllers.data.Line;
import noppes.npcs.entity.EntityCustomNpc;
import noppes.npcs.entity.EntityNPCInterface;
import noppes.npcs.scripted.ScriptFaction;
import noppes.npcs.scripted.ScriptItemStack;
import noppes.npcs.scripted.interfaces.entity.IEntityLivingBase;
import noppes.npcs.scripted.interfaces.entity.IPlayer;
import noppes.npcs.scripted.interfaces.handler.IOverlayHandler;
import noppes.npcs.scripted.interfaces.item.IItemStack;
import noppes.npcs.scripted.constants.AnimationType;
import noppes.npcs.scripted.constants.EntityType;
import noppes.npcs.scripted.interfaces.ICustomNpc;
import noppes.npcs.scripted.interfaces.entity.ICustomNpc;
import noppes.npcs.scripted.interfaces.ITimers;
import noppes.npcs.scripted.roles.ScriptJobBard;
import noppes.npcs.scripted.roles.ScriptJobConversation;
@@ -28,6 +31,7 @@ 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.scripted.NpcAPI;
import noppes.npcs.util.ValueUtil;
import java.util.ArrayList;
@@ -259,26 +263,26 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
* @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){
public void shootItem(IEntityLivingBase target, IItemStack 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);
npc.shoot(target.getMCEntity(), accuracy, item.getMCItemStack(), false);
}
public void setProjectilesKeepTerrain(boolean t) {
npc.stats.projectilesKeepTerrain = t;
}
public boolean getProjectilesKeepTerrain() {
return npc.stats.projectilesKeepTerrain;
}
/**
* @param message The message the npc will say
*/
@@ -289,10 +293,10 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
/**
* @param message The message the npc will say
*/
public void say(ScriptPlayer player, String message){
public void say(IPlayer player, String message){
if(player == null || message == null || message.isEmpty())
return;
npc.say(player.player, new Line(message));
npc.say((EntityPlayer) player.getMCEntity(), new Line(message));
}
/**
@@ -325,6 +329,7 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
return new ScriptRoleTransporter(npc);
return new ScriptRoleInterface(npc);
}
public void setRole(int role){
for (EnumRoleType e : EnumRoleType.values()) {
if (e.ordinal() == role) {
@@ -356,6 +361,7 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
return new ScriptJobSpawner(npc);
return new ScriptJobInterface(npc);
}
public void setJob(int job){
for (EnumJobType e : EnumJobType.values()) {
if (e.ordinal() == job) {
@@ -368,63 +374,54 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
/**
* @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);
public IItemStack getRightItem(){
return NpcAPI.Instance().getIItemStack(npc.inventory.getWeapon());
}
/**
* @param item Item to be held in the right hand
*/
public void setRightItem(ScriptItemStack item){
public void setRightItem(IItemStack item){
if(item == null)
npc.inventory.setWeapon(null);
else
npc.inventory.setWeapon(item.item);
npc.inventory.setWeapon(item.getMCItemStack());
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);
public IItemStack getLefttItem(){
return NpcAPI.Instance().getIItemStack(npc.getOffHand());
}
/**
* @param item Item to be held in the left hand
*/
public void setLeftItem(ScriptItemStack item){
public void setLeftItem(IItemStack item){
if(item == null)
npc.inventory.setOffHand(null);
else
npc.inventory.setOffHand(item.item);
npc.inventory.setOffHand(item.getMCItemStack());
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);
public IItemStack getProjectileItem(){
return NpcAPI.Instance().getIItemStack(npc.inventory.getProjectile());
}
/**
* @param item Item to be used as projectile
*/
public void setProjectileItem(ScriptItemStack item){
public void setProjectileItem(IItemStack item){
if(item == null)
npc.inventory.setProjectile(null);
else
npc.inventory.setProjectile(item.item);
npc.inventory.setProjectile(item.getMCItemStack());
npc.script.aiNeedsUpdate = true;
}
@@ -498,11 +495,8 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
* @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);
public IItemStack getArmor(int slot){
return NpcAPI.Instance().getIItemStack(npc.inventory.armor.get(slot));
}
/**
@@ -510,11 +504,11 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
* @param item Item to be set as armor
*/
@Override
public void setArmor(int slot, ScriptItemStack item){
public void setArmor(int slot, IItemStack item){
if(item == null)
npc.inventory.armor.put(slot, null);
else
npc.inventory.armor.put(slot, item.item);
npc.inventory.armor.put(slot, item.getMCItemStack());
npc.script.clientNeedsUpdate = true;
}
@@ -524,8 +518,8 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
* @param slot The slot from the NPC's drop list to return (0-8)
* @return
*/
public ScriptItemStack getLootItem(int slot) {
return new ScriptItemStack(npc.inventory.getStackInSlot(slot+7));
public IItemStack getLootItem(int slot) {
return NpcAPI.Instance().getIItemStack(npc.inventory.getStackInSlot(slot+7));
}
/**
@@ -533,9 +527,8 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
* @param slot The slot from the NPC's drop list to change
* @param item The item the drop list slot will be changed to
*/
public void setLootItem(int slot, ScriptItemStack item) {
if (item == null) npc.inventory.setInventorySlotContents(slot+7, null);
else npc.inventory.setInventorySlotContents(slot+7, item.item);
public void setLootItem(int slot, IItemStack item) {
npc.inventory.setInventorySlotContents(slot+7, item.getMCItemStack());
}
/**
@@ -714,8 +707,8 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
return npc.display.visible;
}
public void setVisibleTo(ScriptPlayer player, boolean visible) {
UUID uuid = player.player.getPersistentID();
public void setVisibleTo(IPlayer player, boolean visible) {
UUID uuid = player.getMCEntity().getPersistentID();
ArrayList<UUID> uuidList = npc.display.invisibleToList;
if(uuidList != null) {
if (!uuidList.contains(uuid)) {
@@ -728,8 +721,8 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
npc.script.clientNeedsUpdate = true;
}
public boolean isVisibleTo(ScriptPlayer player) {
return !npc.scriptInvisibleToPlayer(player.player);
public boolean isVisibleTo(IPlayer player) {
return !npc.scriptInvisibleToPlayer((EntityPlayer) player.getMCEntity());
}
/**
@@ -870,8 +863,8 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
npc.stats.playerSetCanDespawn = canDespawn;
}
public void giveItem(ScriptPlayer player, ScriptItemStack item){
npc.givePlayerItem(player.player, item.item);
public void giveItem(IPlayer player, IItemStack item){
npc.givePlayerItem((EntityPlayer) player.getMCEntity(), item.getMCItemStack());
}
public void executeCommand(String command){
@@ -1018,7 +1011,7 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
public void setCanDrown(boolean d) {
npc.stats.canDrown = d;
}
@Override
public long getAge(){
return npc.totalTicksAlive;
@@ -1121,12 +1114,19 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
}
public void setOverlayTexture(String overlayTexture) {
npc.display.glowTexture = overlayTexture;
this.getOverlays().add(0, NpcAPI.Instance().createSkinOverlay(overlayTexture));
npc.updateClient = true;
}
public String getOverlayTexture() {
return npc.display.glowTexture;
if (!npc.display.skinOverlayData.overlayList.containsKey(0))
return "";
return npc.display.skinOverlayData.overlayList.get(0).getTexture();
}
public IOverlayHandler getOverlays() {
return npc.display.skinOverlayData;
}
public void setCollisionType(int type){
@@ -3,7 +3,7 @@ package noppes.npcs.scripted.entity;
import net.minecraft.entity.passive.EntityTameable;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.controllers.PixelmonHelper;
import noppes.npcs.scripted.interfaces.IPixelmon;
import noppes.npcs.scripted.interfaces.entity.IPixelmon;
import noppes.npcs.util.ValueUtil;
public class ScriptPixelmon<T extends EntityTameable> extends ScriptAnimal<T> implements IPixelmon {
@@ -5,6 +5,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Set;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -37,10 +38,13 @@ import noppes.npcs.controllers.PlayerQuestData;
import noppes.npcs.controllers.Quest;
import noppes.npcs.controllers.QuestController;
import noppes.npcs.controllers.QuestData;
import noppes.npcs.controllers.*;
import noppes.npcs.controllers.data.*;
import noppes.npcs.entity.EntityDialogNpc;
import noppes.npcs.scripted.NpcAPI;
import noppes.npcs.scripted.ScriptItemStack;
import noppes.npcs.scripted.ScriptPixelmonPlayerData;
import noppes.npcs.scripted.*;
import noppes.npcs.scripted.constants.EntityType;
import noppes.npcs.scripted.gui.ScriptGui;
import noppes.npcs.scripted.handler.data.IQuest;
@@ -50,9 +54,20 @@ import noppes.npcs.scripted.interfaces.ICustomGui;
import noppes.npcs.scripted.interfaces.ICustomOverlay;
import noppes.npcs.scripted.interfaces.IPlayer;
import noppes.npcs.scripted.interfaces.ITimers;
import noppes.npcs.scripted.interfaces.entity.IEntity;
import noppes.npcs.scripted.interfaces.handler.IOverlayHandler;
import noppes.npcs.scripted.interfaces.handler.data.IQuest;
import noppes.npcs.scripted.interfaces.*;
import noppes.npcs.scripted.interfaces.entity.IPlayer;
import noppes.npcs.scripted.interfaces.gui.ICustomGui;
import noppes.npcs.scripted.interfaces.item.IItemStack;
import noppes.npcs.scripted.interfaces.overlay.ICustomOverlay;
import noppes.npcs.scripted.overlay.ScriptOverlay;
import noppes.npcs.scripted.NpcAPI;
import noppes.npcs.util.ValueUtil;
import java.util.*;
public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T> implements IPlayer {
public T player;
private PlayerData data;
@@ -111,11 +126,6 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
player.getFoodStats().addStats(0,saturation-prevSaturation);
}
public int getDimension(){
return player.dimension;
}
public boolean hasFinishedQuest(int id){
PlayerQuestData data = PlayerDataController.instance.getPlayerData(player).questData;
@@ -139,11 +149,11 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
PlayerDialogData data = PlayerDataController.instance.getPlayerData(player).dialogData;
return data.dialogsRead.contains(id);
}
public void readDialog(int id) {
PlayerDataController.instance.getPlayerData(player).dialogData.dialogsRead.add(id);
}
public void unreadDialog(int id) {
PlayerDataController.instance.getPlayerData(player).dialogData.dialogsRead.remove(id);
}
@@ -159,7 +169,7 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
PlayerData data = PlayerDataController.instance.getPlayerData(player);
if(data.questData.activeQuests.containsKey(id))
return;
QuestData questdata = new QuestData(quest);
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);
@@ -227,7 +237,7 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
PlayerData data = PlayerDataController.instance.getPlayerData(player);
data.factionData.increasePoints(faction, points-getFactionPoints(faction), player);
}
/**
* @param faction The faction id
* @return points
@@ -257,7 +267,7 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
chat.setChatStyle(style);
player.addChatMessage(chat);
}
/**
* @param message The message you want to send
*/
@@ -273,7 +283,7 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
chat.setChatStyle(style);
player.addChatMessage(chat);
}
/**
* @return Return gamemode. 0: Survival, 1: Creative, 2: Adventure
*/
@@ -292,10 +302,10 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
* @param item The item to be checked
* @return How many of this item the player has
*/
public int inventoryItemCount(ScriptItemStack item){
public int inventoryItemCount(IItemStack item){
int i = 0;
for(ItemStack is : player.inventory.mainInventory){
if (is != null && is.isItemEqual(item.item))
if (is != null && is.isItemEqual(item.getMCItemStack()))
i += is.stackSize;
}
return i;
@@ -305,12 +315,12 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
* @since 1.7.10d
* @return Returns a IItemStack array size 36
*/
public ScriptItemStack[] getInventory(){
ScriptItemStack[] items = new ScriptItemStack[36];
public IItemStack[] getInventory(){
IItemStack[] items = new IItemStack[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);
items[i] = NpcAPI.Instance().getIItemStack(item);
}
return items;
}
@@ -320,7 +330,7 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
* @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){
public boolean removeItem(IItemStack item, int amount){
int count = inventoryItemCount(item);
if(amount > count)
return false;
@@ -329,7 +339,7 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
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 (is != null && is.isItemEqual(item.getMCItemStack())){
if(amount > is.stackSize){
player.inventory.mainInventory[i] = null;
amount -= is.stackSize;
@@ -356,7 +366,7 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
Item item = (Item)Item.itemRegistry.getObject(id);
if(item == null)
return false;
return removeItem(new ScriptItemStack(new ItemStack(item, 1, damage)), amount);
return removeItem(NpcAPI.Instance().getIItemStack(new ItemStack(item, 1, damage)), amount);
}
/**
@@ -365,7 +375,7 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
* @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){
public boolean giveItem(IItemStack item, int amount){
if(item != null && item.getMCItemStack() != null) {
item.setStackSize(amount);
boolean bool = this.player.inventory.addItemStackToInventory(item.getMCItemStack());
@@ -410,14 +420,14 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
/**
* @param item The item to be removed from the players inventory
*/
public void removeAllItems(ScriptItemStack item){
public void removeAllItems(IItemStack item){
for(int i = 0; i < player.inventory.mainInventory.length; i++){
ItemStack is = player.inventory.mainInventory[i];
if (is != null && is.isItemEqual(item.item))
if (is != null && is.isItemEqual(item.getMCItemStack()))
player.inventory.mainInventory[i] = null;
}
}
public void clearInventory() {
for(int i = 0; i < player.inventory.mainInventory.length; i++) player.inventory.mainInventory[i] = null;
for(int i = 0; i < player.inventory.armorInventory.length; i++) player.inventory.armorInventory[i] = null;
@@ -430,7 +440,39 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
public void setRotation(float rotationYaw, float rotationPitch){
NoppesUtilPlayer.teleportPlayer(player, player.posX, player.posY, player.posZ, rotationYaw, rotationPitch, player.dimension);
}
public void swingHand(){
NoppesUtilPlayer.swingPlayerArm(player);
}
public void stopUsingItem(){
player.stopUsingItem();
}
public void clearItemInUse(){
player.clearItemInUse();
}
public void playSound(String name, float volume, float pitch){
player.playSound(name, volume, pitch);
}
public void mountEntity(Entity ridingEntity){
player.mountEntity(ridingEntity);
}
public IEntity dropOneItem(boolean dropStack){
return NpcAPI.Instance().getIEntity(player.dropOneItem(dropStack));
}
public boolean canHarvestBlock(IBlock block){
return player.canHarvestBlock(block.getMCBlock());
}
public boolean interactWith(IEntity entity){
return player.interactWith(entity.getMCEntity());
}
/**
* @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
@@ -477,12 +519,12 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
return null;
return new ScriptPixelmonPlayerData(player);
}
public IBlock getLookingAtBlock(int maxDistance) {
Vec3 lookVec = player.getLookVec();
return getWorld().rayCastBlock(
new double[] {player.posX, player.posY+player.getEyeHeight(), player.posZ},
new double[] {lookVec.xCoord, lookVec.yCoord, lookVec.zCoord},
new double[] {player.posX, player.posY+player.getEyeHeight(), player.posZ},
new double[] {lookVec.xCoord, lookVec.yCoord, lookVec.zCoord},
maxDistance);
}
@@ -497,6 +539,7 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
questData.checkQuestCompletion(playerData, EnumQuestType.Item);
}
@Deprecated
public boolean checkGUIOpen() {
NoppesUtilPlayer.isGUIOpen(player);
PlayerData data = PlayerDataController.instance.getPlayerData(player);
@@ -566,7 +609,11 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
}
public void closeOverlay(int id) {
Server.sendData((EntityPlayerMP)this.entity, EnumPacketClient.OVERLAY_CLOSE, id, new NBTTagCompound());
Server.sendData((EntityPlayerMP)this.entity, EnumPacketClient.SCRIPT_OVERLAY_CLOSE, id, new NBTTagCompound());
}
public IOverlayHandler getOverlays() {
return this.getData().skinOverlays;
}
public IQuest[] getFinishedQuests() {
@@ -1,9 +1,9 @@
package noppes.npcs.scripted.event;
import cpw.mods.fml.common.eventhandler.Event;
import noppes.npcs.scripted.interfaces.ICustomGui;
import noppes.npcs.scripted.interfaces.IItemStack;
import noppes.npcs.scripted.interfaces.IPlayer;
import noppes.npcs.scripted.interfaces.gui.ICustomGui;
import noppes.npcs.scripted.interfaces.item.IItemStack;
import noppes.npcs.scripted.interfaces.entity.IPlayer;
public class CustomGuiEvent extends Event {
public final IPlayer player;
@@ -6,10 +6,10 @@
package noppes.npcs.scripted.event;
import cpw.mods.fml.common.eventhandler.Event;
import noppes.npcs.scripted.NpcAPI;
import noppes.npcs.scripted.interfaces.AbstractNpcAPI;
public class CustomNPCsEvent extends Event{
public final NpcAPI API = NpcAPI.Instance();
public final AbstractNpcAPI API = AbstractNpcAPI.Instance();
public CustomNPCsEvent() {
}
@@ -1,7 +1,7 @@
package noppes.npcs.scripted.event;
import noppes.npcs.scripted.handler.data.IDialog;
import noppes.npcs.scripted.interfaces.IPlayer;
import noppes.npcs.scripted.interfaces.handler.data.IDialog;
import noppes.npcs.scripted.interfaces.entity.IPlayer;
public class DialogEvent extends CustomNPCsEvent {
public final IDialog dialog;
@@ -1,7 +1,7 @@
package noppes.npcs.scripted.event;
import noppes.npcs.scripted.handler.data.IFaction;
import noppes.npcs.scripted.interfaces.IPlayer;
import noppes.npcs.scripted.interfaces.handler.data.IFaction;
import noppes.npcs.scripted.interfaces.entity.IPlayer;
public class FactionEvent extends CustomNPCsEvent {
public final IFaction faction;
@@ -8,7 +8,7 @@ package noppes.npcs.scripted.event;
import cpw.mods.fml.common.eventhandler.Cancelable;
import cpw.mods.fml.common.eventhandler.Event;
import noppes.npcs.scripted.interfaces.IWorld;
import noppes.npcs.scripted.interfaces.IEntity;
import noppes.npcs.scripted.interfaces.entity.IEntity;
@Cancelable
public class ForgeEvent extends CustomNPCsEvent {
@@ -0,0 +1,128 @@
package noppes.npcs.scripted.event;
import cpw.mods.fml.common.eventhandler.Cancelable;
import noppes.npcs.scripted.interfaces.item.IItemCustom;
import noppes.npcs.scripted.interfaces.entity.IEntity;
import noppes.npcs.scripted.interfaces.entity.IPlayer;
public class ItemEvent extends CustomNPCsEvent {
public IItemCustom item;
public ItemEvent(IItemCustom item) {
this.item = item;
}
public static class InitEvent extends ItemEvent {
public InitEvent(IItemCustom item) {
super(item);
}
}
public static class UpdateEvent extends ItemEvent {
public IEntity entity;
public UpdateEvent(IItemCustom item, IEntity entity) {
super(item);
this.entity = entity;
}
}
@Cancelable
public static class TossedEvent extends ItemEvent {
public IEntity entity;
public IPlayer player;
public TossedEvent(IItemCustom item, IPlayer player, IEntity entity) {
super(item);
this.entity = entity;
this.player = player;
}
}
public static class PickedUpEvent extends ItemEvent {
public IPlayer player;
public PickedUpEvent(IItemCustom item, IPlayer player) {
super(item);
this.player = player;
}
}
@Cancelable
public static class SpawnEvent extends ItemEvent {
public IEntity entity;
public SpawnEvent(IItemCustom item, IEntity entity){
super(item);
this.entity = entity;
}
}
@Cancelable
public static class InteractEvent extends ItemEvent {
public final int type;
public final Object target;
public IPlayer player;
public InteractEvent(IItemCustom item, IPlayer player, int type, Object target) {
super(item);
this.type = type;
this.target = target;
this.player = player;
}
}
@Cancelable
public static class AttackEvent extends ItemEvent {
public final int type;//1: Hit, 2: Whiff
public final Object target;
public IEntity swingingEntity;
public AttackEvent(IItemCustom item, IEntity swingingEntity, int type, Object target) {
super(item);
this.type = type;
this.target = target;
this.swingingEntity = swingingEntity;
}
}
public static class StartUsingItem extends ItemEvent {
public final IPlayer player;
public final int duration;
public StartUsingItem(IItemCustom item, IPlayer player, int duration){
super(item);
this.player = player;
this.duration = duration;
}
}
public static class UsingItem extends ItemEvent {
public final IPlayer player;
public final int duration;
public UsingItem(IItemCustom item, IPlayer player, int duration){
super(item);
this.player = player;
this.duration = duration;
}
}
public static class StopUsingItem extends ItemEvent {
public final IPlayer player;
public final int duration;
public StopUsingItem(IItemCustom item, IPlayer player, int duration){
super(item);
this.player = player;
this.duration = duration;
}
}
public static class FinishUsingItem extends ItemEvent {
public final IPlayer player;
public final int duration;
public FinishUsingItem(IItemCustom item, IPlayer player, int duration){
super(item);
this.player = player;
this.duration = duration;
}
}
}
@@ -10,9 +10,14 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.DamageSource;
import noppes.npcs.controllers.Dialog;
import noppes.npcs.scripted.NpcAPI;
import noppes.npcs.controllers.data.Dialog;
import noppes.npcs.scripted.interfaces.*;
import noppes.npcs.scripted.interfaces.entity.ICustomNpc;
import noppes.npcs.scripted.interfaces.entity.IEntity;
import noppes.npcs.scripted.interfaces.entity.IEntityLivingBase;
import noppes.npcs.scripted.interfaces.entity.IPlayer;
import noppes.npcs.scripted.interfaces.item.IItemStack;
import noppes.npcs.scripted.NpcAPI;
public class NpcEvent extends CustomNPCsEvent {
public final ICustomNpc npc;
@@ -156,7 +161,7 @@ public class NpcEvent extends CustomNPCsEvent {
public TargetLostEvent(ICustomNpc npc, EntityLivingBase entity) {
super(npc);
this.entity = (IEntityLivingBase)NpcAPI.Instance().getIEntity(entity);
this.entity = (IEntityLivingBase) NpcAPI.Instance().getIEntity(entity);
}
}
@@ -6,17 +6,18 @@
package noppes.npcs.scripted.event;
import cpw.mods.fml.common.eventhandler.Cancelable;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityXPOrb;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import noppes.npcs.scripted.*;
import noppes.npcs.scripted.entity.ScriptLivingBase;
import noppes.npcs.scripted.interfaces.*;
import noppes.npcs.scripted.interfaces.entity.IEntity;
import noppes.npcs.scripted.interfaces.entity.IEntityLivingBase;
import noppes.npcs.scripted.interfaces.entity.IPlayer;
import noppes.npcs.scripted.interfaces.item.IItemStack;
import noppes.npcs.scripted.NpcAPI;
public class PlayerEvent extends CustomNPCsEvent {
public final IPlayer player;
@@ -181,7 +182,7 @@ public class PlayerEvent extends CustomNPCsEvent {
public KilledEntityEvent(IPlayer player, EntityLivingBase entity) {
super(player);
this.entity = new ScriptLivingBase<>(entity);//NpcAPI.Instance().getIEntity(entity);
this.entity = (IEntityLivingBase) NpcAPI.Instance().getIEntity(entity);
}
}
@@ -374,7 +375,7 @@ public class PlayerEvent extends CustomNPCsEvent {
public UseHoe(IPlayer player, ItemStack item, int x, int y, int z) {
super(player);
this.hoe = new ScriptItemStack(item);
this.hoe = NpcAPI.Instance().getIItemStack(item);
this.x = x;
this.y = y;
this.z = z;
@@ -418,8 +419,8 @@ public class PlayerEvent extends CustomNPCsEvent {
public FillBucket(IPlayer player, ItemStack current, ItemStack result) {
super(player);
this.current = new ScriptItemStack(current);
this.result = new ScriptItemStack(result);
this.current = NpcAPI.Instance().getIItemStack(current);
this.result = NpcAPI.Instance().getIItemStack(result);
}
}
@@ -1,9 +1,9 @@
package noppes.npcs.scripted.event;
import cpw.mods.fml.common.eventhandler.Cancelable;
import noppes.npcs.scripted.handler.data.IQuest;
import noppes.npcs.scripted.interfaces.IItemStack;
import noppes.npcs.scripted.interfaces.IPlayer;
import noppes.npcs.scripted.interfaces.handler.data.IQuest;
import noppes.npcs.scripted.interfaces.item.IItemStack;
import noppes.npcs.scripted.interfaces.entity.IPlayer;
public class QuestEvent extends CustomNPCsEvent {
public final IQuest quest;
@@ -1,26 +1,26 @@
package noppes.npcs.scripted.event;
import net.minecraft.entity.EntityLivingBase;
import noppes.npcs.controllers.ScriptController;
import noppes.npcs.scripted.entity.ScriptLivingBase;
import noppes.npcs.scripted.NpcAPI;
import noppes.npcs.scripted.interfaces.entity.IEntityLivingBase;
public class ScriptEventAttack extends ScriptEvent{
private float damage;
private ScriptLivingBase target;
private IEntityLivingBase 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);
this.target = (IEntityLivingBase) NpcAPI.Instance().getIEntity(target);
}
/**
* @return The source of the damage
* @deprecated
*/
public ScriptLivingBase getTarget(){
public IEntityLivingBase getTarget(){
return target;
}
@@ -2,26 +2,26 @@ package noppes.npcs.scripted.event;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.DamageSource;
import noppes.npcs.controllers.ScriptController;
import noppes.npcs.scripted.entity.ScriptLivingBase;
import noppes.npcs.scripted.NpcAPI;
import noppes.npcs.scripted.interfaces.entity.IEntityLivingBase;
public class ScriptEventDamaged extends ScriptEvent{
private float damage;
private boolean clear = false;
private ScriptLivingBase source;
private IEntityLivingBase 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);
this.source = (IEntityLivingBase) NpcAPI.Instance().getIEntity(attackingEntity);
}
/**
* @return The source of the damage
*/
public ScriptLivingBase getSource(){
public IEntityLivingBase getSource(){
return source;
}
@@ -1,9 +1,9 @@
package noppes.npcs.scripted.event;
import net.minecraft.entity.player.EntityPlayer;
import noppes.npcs.controllers.Dialog;
import noppes.npcs.controllers.data.Dialog;
import noppes.npcs.scripted.NpcAPI;
import noppes.npcs.scripted.interfaces.IPlayer;
import noppes.npcs.scripted.interfaces.entity.IPlayer;
public class ScriptEventDialog extends ScriptEvent{
public IPlayer player;
@@ -12,7 +12,7 @@ public class ScriptEventDialog extends ScriptEvent{
public Dialog dialogObj;
public ScriptEventDialog(EntityPlayer player, int dialog, int option, Dialog dialogObj){
this.player = (IPlayer)NpcAPI.Instance().getIEntity(player);
this.player = (IPlayer) NpcAPI.Instance().getIEntity(player);
this.dialog = dialog;
this.option = option;
this.dialogObj = dialogObj;
@@ -2,26 +2,28 @@ package noppes.npcs.scripted.event;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.DamageSource;
import noppes.npcs.controllers.ScriptController;
import noppes.npcs.scripted.entity.ScriptLivingBase;
import noppes.npcs.scripted.NpcAPI;
import noppes.npcs.scripted.interfaces.IDamageSource;
import noppes.npcs.scripted.interfaces.entity.IEntityLivingBase;
public class ScriptEventKilled extends ScriptEvent{
private ScriptLivingBase source;
private IEntityLivingBase source;
private DamageSource damagesource;
public ScriptEventKilled(EntityLivingBase target, DamageSource damagesource){
this.damagesource = damagesource;
this.source = (ScriptLivingBase)ScriptController.Instance.getScriptForEntity(target);
this.source = (IEntityLivingBase) NpcAPI.Instance().getIEntity(target);
}
/**
* @return The source of the damage
*/
public ScriptLivingBase getSource(){
public IEntityLivingBase getSource(){
return source;
}
public IDamageSource getDamageSource() { return NpcAPI.Instance().getIDamageSource(damagesource); }
/**
* @return Returns the damage type
*/
@@ -1,27 +1,26 @@
package noppes.npcs.scripted.event;
import net.minecraft.entity.EntityLivingBase;
import noppes.npcs.controllers.ScriptController;
import noppes.npcs.scripted.entity.ScriptLivingBase;
import noppes.npcs.scripted.NpcAPI;
import noppes.npcs.scripted.interfaces.entity.IEntityLivingBase;
public class ScriptEventTarget extends ScriptEvent {
private ScriptLivingBase target;
private IEntityLivingBase target;
public ScriptEventTarget(EntityLivingBase target){
if(target != null)
this.target = (ScriptLivingBase)ScriptController.Instance.getScriptForEntity(target);
this.target = (IEntityLivingBase) NpcAPI.Instance().getIEntity(target);
}
/**
* @return The source of the damage
*/
public ScriptLivingBase getTarget(){
public IEntityLivingBase getTarget(){
return target;
}
public void setTarget(ScriptLivingBase target){
public void setTarget(IEntityLivingBase target){
this.target = target;
}
}
@@ -13,12 +13,10 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import noppes.npcs.controllers.ScriptController;
import noppes.npcs.controllers.data.PlayerDataScript;
import noppes.npcs.scripted.interfaces.*;
import noppes.npcs.scripted.interfaces.ICustomGuiComponent;
import noppes.npcs.scripted.entity.ScriptPlayer;
import noppes.npcs.scripted.interfaces.gui.*;
import noppes.npcs.controllers.CustomGuiController;
import noppes.npcs.controllers.ScriptContainer;
import noppes.npcs.scripted.interfaces.ICustomGui;
import noppes.npcs.scripted.interfaces.entity.IPlayer;
import noppes.npcs.scripted.interfaces.item.IItemStack;
public class ScriptGui implements ICustomGui {
int id;
@@ -216,7 +214,7 @@ public class ScriptGui implements ICustomGui {
}
public void update(IPlayer player) {
CustomGuiController.updateGui((ScriptPlayer)player, this);
CustomGuiController.updateGui(player, this);
}
public boolean getShowPlayerInv() {
@@ -1,8 +1,8 @@
package noppes.npcs.scripted.gui;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.scripted.interfaces.IButton;
import noppes.npcs.scripted.interfaces.ICustomGuiComponent;
import noppes.npcs.scripted.interfaces.gui.IButton;
import noppes.npcs.scripted.interfaces.gui.ICustomGuiComponent;
public class ScriptGuiButton extends ScriptGuiComponent implements IButton {
int width;
@@ -3,8 +3,7 @@ package noppes.npcs.scripted.gui;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagString;
import noppes.npcs.scripted.interfaces.ICustomGuiComponent;
import noppes.npcs.scripted.interfaces.ICustomOverlayComponent;
import noppes.npcs.scripted.interfaces.gui.ICustomGuiComponent;
public abstract class ScriptGuiComponent implements ICustomGuiComponent {
int id;
@@ -3,9 +3,9 @@ package noppes.npcs.scripted.gui;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.scripted.interfaces.gui.IItemSlot;
import noppes.npcs.scripted.interfaces.item.IItemStack;
import noppes.npcs.scripted.NpcAPI;
import noppes.npcs.scripted.interfaces.IItemSlot;
import noppes.npcs.scripted.interfaces.IItemStack;
public class ScriptGuiItemSlot extends ScriptGuiComponent implements IItemSlot {
IItemStack stack;
@@ -1,7 +1,7 @@
package noppes.npcs.scripted.gui;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.scripted.interfaces.ILabel;
import noppes.npcs.scripted.interfaces.gui.ILabel;
public class ScriptGuiLabel extends ScriptGuiComponent implements ILabel {
String label;
@@ -20,7 +20,7 @@ public class ScriptGuiLabel extends ScriptGuiComponent implements ILabel {
this.setText(label);
this.setPos(x, y);
this.setSize(width, height);
this.enableShadow(false);
this.setShadow(false);
}
public ScriptGuiLabel(int id, String label, int x, int y, int width, int height, int color) {
@@ -60,11 +60,11 @@ public class ScriptGuiLabel extends ScriptGuiComponent implements ILabel {
return this;
}
public boolean hasShadow(){
public boolean getShadow(){
return this.shadow;
}
public void enableShadow(boolean shadow){
public void setShadow(boolean shadow){
this.shadow = shadow;
}
@@ -86,7 +86,7 @@ public class ScriptGuiLabel extends ScriptGuiComponent implements ILabel {
this.setText(nbt.getString("label"));
this.setSize(nbt.getIntArray("size")[0], nbt.getIntArray("size")[1]);
this.setScale(nbt.getFloat("scale"));
this.enableShadow(nbt.getBoolean("shadow"));
this.setShadow(nbt.getBoolean("shadow"));
return this;
}
}
@@ -1,7 +1,7 @@
package noppes.npcs.scripted.gui;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.scripted.interfaces.ILine;
import noppes.npcs.scripted.interfaces.gui.ILine;
public class ScriptGuiLine extends ScriptGuiComponent implements ILine {
int x1;
@@ -3,7 +3,7 @@ package noppes.npcs.scripted.gui;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagString;
import noppes.npcs.scripted.interfaces.IScroll;
import noppes.npcs.scripted.interfaces.gui.IScroll;
public class ScriptGuiScroll extends ScriptGuiComponent implements IScroll {
int width;
@@ -1,7 +1,7 @@
package noppes.npcs.scripted.gui;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.scripted.interfaces.ITextField;
import noppes.npcs.scripted.interfaces.gui.ITextField;
public class ScriptGuiTextField extends ScriptGuiComponent implements ITextField {
int width;
@@ -1,7 +1,7 @@
package noppes.npcs.scripted.gui;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.scripted.interfaces.ITexturedRect;
import noppes.npcs.scripted.interfaces.gui.ITexturedRect;
public class ScriptGuiTexturedRect extends ScriptGuiComponent implements ITexturedRect {
int width;
@@ -1,4 +0,0 @@
package noppes.npcs.scripted.handler.data;
public interface IQuestInterface {
}
@@ -0,0 +1,205 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package noppes.npcs.scripted.interfaces;
import java.io.File;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.eventhandler.EventBus;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.DamageSource;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import noppes.npcs.CustomNpcs;
import noppes.npcs.controllers.*;
import noppes.npcs.scripted.gui.ScriptGui;
import noppes.npcs.scripted.interfaces.entity.ICustomNpc;
import noppes.npcs.scripted.interfaces.entity.IEntity;
import noppes.npcs.scripted.interfaces.entity.IPlayer;
import noppes.npcs.scripted.interfaces.gui.ICustomGui;
import noppes.npcs.scripted.interfaces.handler.*;
import noppes.npcs.scripted.interfaces.item.IItemStack;
import noppes.npcs.scripted.interfaces.overlay.ICustomOverlay;
import noppes.npcs.scripted.overlay.ScriptOverlay;
/**
* This object stores functions available to all scripting handlers through the "API" keyword.
*
*/
public abstract class AbstractNpcAPI {
private static AbstractNpcAPI instance = null;
public AbstractNpcAPI() {
}
public abstract IFactionHandler getFactions();
public abstract IRecipeHandler getRecipes();
public abstract IQuestHandler getQuests();
public abstract IDialogHandler getDialogs();
public abstract ICloneHandler getClones();
public abstract ICustomNpc createNPC(World var1);
/**
*
* Spawns a new NPC in the world at the given coordinates and returns an ICustomNpc object of it.
*/
public abstract ICustomNpc spawnNPC(World var1, int var2, int var3, int var4);
public abstract IEntity getIEntity(Entity var1);
public abstract IBlock getIBlock(World var1, BlockPos var2);
public abstract IBlock getIBlock(World world, Block block, BlockPos pos);
public abstract IBlock getIBlock(World world, int x, int y, int z);
public abstract IContainer getIContainer(IInventory var1);
public abstract IContainer getIContainer(Container var1);
public abstract IItemStack getIItemStack(ItemStack var1);
public abstract IWorld getIWorld(WorldServer var1);
public abstract IWorld getIWorld(int var1);
public abstract IWorld[] getIWorlds();
public abstract IDamageSource getIDamageSource(DamageSource var1);
public abstract EventBus events();
public abstract File getGlobalDir();
public abstract File getWorldDir();
public static boolean IsAvailable() {
return Loader.isModLoaded("customnpcs");
}
public static AbstractNpcAPI Instance() {
if (instance != null) {
return instance;
} else if (!IsAvailable()) {
return null;
} else {
try {
Class c = Class.forName("noppes.npcs.scripted.NpcAPI");
instance = (AbstractNpcAPI) c.getMethod("Instance").invoke((Object) null);
} catch (Exception var1) {
var1.printStackTrace();
}
return instance;
}
}
public abstract void executeCommand(IWorld var1, String var2);
/**
* Generates a new name as a String using the Markov name generator.
*
* @param dictionary An integer representing which dictionary to use:
* 0: Roman
* 1: Japanese
* 2: Slavic
* 3: Welsh
* 4: Saami
* 5: Old Norse
* 6: Ancient Greek
* 7: Aztec
* 8: CustomNPCs Classic
* 9: Spanish
* @param gender The gender of the name:
* 0: Random
* 1: Male
* 2: Female
*/
public abstract String getRandomName(int dictionary, int gender);
public abstract INbt getINbt(NBTTagCompound nbtTagCompound);
public abstract IPlayer[] getAllServerPlayers();
public abstract IItemStack createItem(String id, int damage, int size);
public abstract void playSoundAtEntity(IEntity entity, String sound, float volume, float pitch);
public abstract void playSoundToNearExcept(IPlayer player, String sound, float volume, float pitch);
/**
*
* @return Returns the server's Message of The Day.
*/
public abstract String getMOTD();
/**
* @param motd The server's new Message of The Day.
*/
public abstract void setMOTD(String motd);
/**
*
* @return A new IParticle object initialized with the given texture.
*/
public abstract IParticle createParticle(String directory);
@Deprecated
public abstract IParticle createEntityParticle(String directory);
/**
*
* @return The uptime of the server in MC ticks.
*/
public abstract int getServerTime();
public abstract boolean arePlayerScriptsEnabled();
public abstract boolean areForgeScriptsEnabled();
public abstract boolean areGlobalNPCScriptsEnabled();
public abstract void enablePlayerScripts(boolean enable);
public abstract void enableForgeScripts(boolean enable);
public abstract void enableGlobalNPCScripts(boolean enable);
/**
*
* @param id The id of the custom GUI.
* @param width The width of the GUI in pixels.
* @param height The height of the GUI in pixels.
* @param pauseGame Whether the GUI pauses the game or not.
* @return A new ICustomGui object with the given attributes.
*/
public abstract ICustomGui createCustomGui(int id, int width, int height, boolean pauseGame);
/**
*
* @return A new ICustomOverlay overlay object with the given ID.
*/
public abstract ICustomOverlay createCustomOverlay(int id);
/**
*
* @return A new ISkinOverlay object initialized with the given texture.
*/
public abstract ISkinOverlay createSkinOverlay(String texture);
}
@@ -15,27 +15,92 @@ public interface IBlock {
int getZ();
/**
*
* @return An IPos object with the block's XYZ position.
*/
IPos getPos();
/**
*
* @return The block name as it appears in the block registry. Return example: "minecraft:stone"
*/
String getName();
/**
* Deletes the block, setting it to air.
*/
void remove();
boolean isAir();
IBlock setBlock(String var1);
/**
*
* @param blockName The name of the block to be set in place of this block.
* @return The new block set in place of this block as an IBlock object.
*/
IBlock setBlock(String blockName);
IBlock setBlock(IBlock var1);
/**
*
* @param block Input IBlock object to replace this block.
* @return The new block set in place of the previous block.
*/
IBlock setBlock(IBlock block);
/**
*
* @return True if the block can contain items like a chest does.
*/
boolean isContainer();
/**
*
* @return The container object of this block. If this block is not a container, an exception will be thrown.
*/
IContainer getContainer();
/**
*
* @return An IWorld object of the world this block is in.
*/
IWorld getWorld();
/**
*
* @return True if this block has a tile entity. Blocks with custom data like signs, player skulls, chests, etc. will have tile entities.
*/
boolean hasTileEntity();
/**
*
* @return An ITileEntity object which can modify this block's tile entity.
*/
ITileEntity getTileEntity();
/**
*
* @param tileEntity Replaces this block's tile entity based on the data given by this parameter.
*/
void setTileEntity(ITileEntity tileEntity);
/**
*
* @return An obfuscated MC object for the block's tile entity.
*/
TileEntity getMCTileEntity();
/**
*
* @return An obfuscated MC block object.
*/
Block getMCBlock();
String getDisplayName();
/**
*
* @return An INbt object which can modify the block's tile entity's NBT data.
*/
INbt getTileEntityNBT();
}
@@ -7,21 +7,58 @@ package noppes.npcs.scripted.interfaces;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import noppes.npcs.scripted.interfaces.entity.IPlayer;
import noppes.npcs.scripted.interfaces.item.IItemStack;
public interface IContainer {
int getSize();
IItemStack getSlot(int var1);
IItemStack getSlot(int slot);
/**
*
* @param slot The slot to be replaced
* @param item The item replacing the previous item in that slot, as an IItemStack object
*/
void setSlot(int slot, IItemStack item);
/**
*
* @return An obfuscated MC inventory object.
*/
IInventory getMCInventory();
/**
*
* @return An obfuscated MC container object.
*/
Container getMCContainer();
int count(IItemStack var1, boolean var2, boolean var3);
/**
*
* @param itemStack The item stack to be searched in the container
* @param ignoreDamage Whether damage should be ignored when searching
* @param ignoreNBT Whether NBT values should be ignored when searching
* @return The amount of the item stack found, based on the flags given above.
*/
int count(IItemStack itemStack, boolean ignoreDamage, boolean ignoreNBT);
/**
*
* @return A list of all item stacks in the container as a list of IItemStack objects.
*/
IItemStack[] getItems();
/**
*
* @return True if this container belongs to a Custom GUI.
*/
boolean isCustomGUI();
/**
* Sends changes to be reflected on the player's client.
*/
void detectAndSendChanges();
boolean isPlayerNotUsingContainer(IPlayer player);
}
@@ -1,4 +0,0 @@
package noppes.npcs.scripted.interfaces;
public interface ICustomOverlay {
}
@@ -6,15 +6,34 @@
package noppes.npcs.scripted.interfaces;
import net.minecraft.util.DamageSource;
import noppes.npcs.scripted.interfaces.entity.IEntity;
public interface IDamageSource {
/**
*
* @return The damage type of the damage source as a string. Ex: "lava", "explosion", "magic", "outOfWorld", etc.
*/
String getType();
boolean isUnblockable();
boolean isProjectile();
/**
*
* @return The entity source of where the damage source originated. If a player was shot by an arrow from a skeleton, this would return an IEntity object of the skeleton.
*/
IEntity getTrueSource();
/**
*
* @return The entity source of where the damage source originated. If a player was shot by an arrow from a skeleton, this would return an IEntity object of the arrow.
*/
IEntity getImmediateSource();
/**
*
* @return An obfuscated MC damage source object.
*/
DamageSource getMCDamageSource();
}
@@ -7,70 +7,136 @@ package noppes.npcs.scripted.interfaces;
import net.minecraft.nbt.NBTTagCompound;
/**
* A scripted data representation of an MC NBTTagCompound object. Using these functions modifies the compound tag
* associated with this object. Any changes made to the compound tag are made directly to its "tagMap" attribute,
* minimizing the impact of setting/getting NBT data with this object on performance.
*
* Compound tags, unlike list tags, can contain multiple types of NBT tag types. Compound tags can even
* contain compound tags inside them, and if that compound tag is accessed, an object like this one will also be returned!
*
* Every tag inside a compound tag has a -unique- "key". If you try to put another tag of the same key inside the
* compound tag, it will replace the previous tag.
*
* The types and their type as an integer are as follows:
* 1: Byte
* 2: Short
* 3: Int
* 4: Long
* 5: Float
* 6: Double
* 7: Byte array
* 8: String
* 9: Tag list
* 10: Compound
* 11: Integer array
*
*/
public interface INbt {
void remove(String var1);
/**
* Returns the tag with the given key from the compound tag.
*/
void remove(String key);
boolean has(String var1);
/**
* @return True if the compound tag has a tag with the given key.
*/
boolean has(String key);
boolean getBoolean(String var1);
boolean getBoolean(String key);
void setBoolean(String var1, boolean var2);
void setBoolean(String key, boolean value);
short getShort(String var1);
short getShort(String key);
void setShort(String var1, short var2);
void setShort(String key, short value);
int getInteger(String var1);
int getInteger(String key);
void setInteger(String var1, int var2);
void setInteger(String key, int value);
byte getByte(String var1);
byte getByte(String key);
void setByte(String var1, byte var2);
void setByte(String key, byte value);
long getLong(String var1);
long getLong(String key);
void setLong(String var1, long var2);
void setLong(String key, long value);
double getDouble(String var1);
double getDouble(String key);
void setDouble(String var1, double var2);
void setDouble(String key, double value);
float getFloat(String var1);
float getFloat(String key);
void setFloat(String var1, float var2);
void setFloat(String key, float value);
String getString(String var1);
String getString(String key);
void setString(String var1, String var2);
void setString(String key, String value);
byte[] getByteArray(String var1);
byte[] getByteArray(String key);
void setByteArray(String var1, byte[] var2);
void setByteArray(String key, byte[] value);
int[] getIntegerArray(String var1);
int[] getIntegerArray(String key);
void setIntegerArray(String var1, int[] var2);
void setIntegerArray(String key, int[] value);
Object[] getList(String var1, int var2);
/**
* Returns a tag list of objects with this key in the compound tag. All the objects in the list
* will always be of the same type.
*
* @return The tag list of objects, depending on the tag type.
*/
Object[] getList(String key, int value);
int getListType(String var1);
/**
* Returns the type of the tag list with this key, as an integer.
*/
int getListType(String key);
void setList(String var1, Object[] var2);
/**
* Adds a new tag list to the compound tag with the given key.
*
* @param key The key for the list tag
* @param value The list of objects to be in the list. The type of the first element in this list becomes the tag
* list's type, and if later objects are not of this type, they will not be added.
*/
void setList(String key, Object[] value);
INbt getCompound(String var1);
INbt getCompound(String key);
void setCompound(String var1, INbt var2);
void setCompound(String key, INbt value);
/**
*
* @return A list of all the compound tag's keys.
*/
String[] getKeys();
int getType(String var1);
/**
*
* @return The type of the tag with the input key as an integer.
*/
int getType(String key);
/**
*
* @return An obfuscated MC NBTTagCompound object.
*/
NBTTagCompound getMCNBT();
/**
*
* @return A curly-bracket formatted JSON string of all the compound tag.
*/
String toJsonString();
boolean isEqual(INbt var1);
boolean isEqual(INbt nbt);
/**
* Completely clears the compound tag of all tags inside it.
*/
void clear();
}
@@ -0,0 +1,214 @@
package noppes.npcs.scripted.interfaces;
import noppes.npcs.NoppesUtilServer;
import noppes.npcs.scripted.ScriptWorld;
import noppes.npcs.scripted.interfaces.entity.IEntity;
/**
* A particle that can be spawned in the world, complete with translation, scale, rotate, and color transformations.
* (CNPC+ original!)
*
* To create a particle object:
* API.createParticle(directory);
* Then modify its attributes as you please, and call the particle's spawn functions to see it in the world.
*
* Spawning this particle in the world sends a hefty packet with all its data to the client. The particle is then
* rendered with a custom renderer based on all the given attributes.
*
* If a particle appears to not appear at first, try increasing its scale or changing its position. The entity it's
* being spawned on or a block in the world may be blocking it.
*
*/
public interface IParticle {
/**
*
* @param entity Spawns this particle object on the given entity. When spawned this way, the particle will always have its origin at the entity.
*/
void spawnOnEntity(IEntity entity);
/**
*
* @param world Spawns the particle in the given world, at a position corresponding to this particle's position variables.
*/
void spawnInWorld(ScriptWorld world);
/**
*
* @param world Spawns the particle in the given world, at a position determined by the input parameters.
* @param x The X position the particle will spawn in the world.
* @param y The Y position the particle will spawn in the world.
* @param z The Z position the particle will spawn in the world.
*/
void spawnInWorld(ScriptWorld world, double x, double y, double z);
/**
*
* @param facePlayer Whether the particle is always facing the player's camera. If this is disabled, the particle will appear to be laying flat face down on the ground if its rotation is unchanged.
*/
void setFacePlayer(boolean facePlayer);
boolean getFacePlayer();
/**
*
* @param directory The directory of this particle's texture. This can be any texture in a resource pack or mod, and even a URL!
*/
void setDirectory(String directory);
String getDirectory();
/**
*
* @param amount The amount of multiples of this particle to spawn in the world. Not too good looking if used, but has some edge cases where it's alright.
*/
void setAmount(int amount);
int getAmount();
/**
*
* @param maxAge The maximum age this particle will be around for, in MC ticks.
*/
void setMaxAge(int maxAge);
int getMaxAge();
/**
* The width and height of the particle's texture you want to render in pixels. Anything more gets cut off.
* @param width The width of the particle's texture, in pixels.
* @param height The height of the particle's texture, in pixels.
*/
void setSize(int width, int height);
int getWidth();
int getHeight();
/**
* The horizontal and vertical offset of the particle's texture from the top-left, starts rendering the particle at this point.
* @param offsetX The horizontal offset, in pixels (u).
* @param offsetY The vertical offset, in pixels (v).
*/
void setOffset(int offsetX, int offsetY);
int getOffsetX();
int getOffsetY();
/**
* Enables animation on the particle. Must set a custom width and height first using the setSize(width,height) function.
* Every frame of animation the particle goes through should be saved on a single image file.
*
* The renderer will read the frames of animation based on the given width and height of the particle, starting from the given X & Y offsets.
* The renderer then goes rightwards (width) pixels for every frame. Once it can't go rightwards anymore,
* the animation goes down (height) pixels, and once again keeps going rightwards if it has to.
*
* If the animation loops, once there is nowhere downward to go, the animation will start over at the X & Y offset.
*
* @param animRate The frame rate of the particle's animation, in MC ticks. (20 ticks = 1 second)
* @param animLoop Whether the animation loops or not.
* @param animStart The amount of ticks before the particle starts animating.
* @param animEnd The amount of ticks the particle is around for before it stops animating.
*/
void setAnim(int animRate, boolean animLoop, int animStart, int animEnd);
int getAnimRate();
boolean getAnimLoop();
int getAnimStart();
int getAnimEnd();
/**
*
* @param x The X position from the particle's origin the particle will spawn at.
* @param y The Y position from the particle's origin the particle will spawn at.
* @param z The Z position from the particle's origin the particle will spawn at.
*/
void setPosition(double x, double y, double z);
double getX();
double getY();
double getZ();
void setMotion(double motionX, double motionY, double motionZ, float gravity);
double getMotionX();
double getMotionY();
double getMotionZ();
float getGravity();
/**
*
* @param HEXColor The starting HEX color of the particle.
* @param HEXColor2 The ending HEX color of the particle.
* @param HEXColorRate The rate of interpolation between the two HEX colors.
* @param HEXColorStart The amount of ticks the particle is around for before its colors begin interpolating between HEXColor and HEXColor2.
*/
void setHEXColor(int HEXColor, int HEXColor2, float HEXColorRate, int HEXColorStart);
int getHEXColor1();
int getHEXColor2();
float getHEXColorRate();
int getHEXColorStart();
/**
*
* @param alpha1 The starting transparency of the particle.
* @param alpha2 The ending transparency of the particle.
* @param alphaRate The rate of interpolation between the two transparency values.
* @param alphaRateStart The amount of ticks the particle is around for before its colors begin interpolating between alpha1 and alpha2.
*/
void setAlpha(float alpha1, float alpha2, float alphaRate, int alphaRateStart);
float getAlpha1();
float getAlpha2();
float getAlphaRate();
int getAlphaRateStart();
/**
*
* @param scale1 The starting scale/size of the particle.
* @param scale2 The ending scale/size of the particle.
* @param scaleRate The rate of interpolation between the two scale values.
* @param scaleRateStart The amount of ticks the particle is around for before its colors begin interpolating between scale1 and scale2.
*/
void setScale(float scale1, float scale2, float scaleRate, int scaleRateStart);
float getScale1();
float getScale2();
float getScaleRate();
int getScaleRateStart();
/**
* Enables rotation about the X axis.
* If the particle is set to always face the player, this axis is a constant horizontal line on the player's camera.
*
* @param rotationX1 The starting X rotation of the particle.
* @param rotationX2 The ending X rotation of the particle.
* @param rotationXRate The rate of interpolation between the two X rotation values.
* @param rotationXRateStart The amount of ticks the particle is around for before its colors begin interpolating between rotationX1 and rotationX2.
*/
void setRotationX(float rotationX1, float rotationX2, float rotationXRate, int rotationXRateStart);
float getRotationX1();
float getRotationX2();
float getRotationXRate();
int getRotationXRateStart();
/**
* Enables rotation about the Y axis.
* If the particle is set to always face the player, this axis is a constant vertical line on the player's camera.
*
* @param rotationY1 The starting Y rotation of the particle.
* @param rotationY2 The ending Y rotation of the particle.
* @param rotationYRate The rate of interpolation between the two Y rotation values.
* @param rotationYRateStart The amount of ticks the particle is around for before its colors begin interpolating between rotationY1 and rotationY2.
*/
void setRotationY(float rotationY1, float rotationY2, float rotationYRate, int rotationYRateStart);
float getRotationY1();
float getRotationY2();
float getRotationYRate();
int getRotationYRateStart();
/**
* Enables rotation about the Y axis.
* If the particle is set to always face the player, this axis is a constant line going into the player's camera.
* You'll be using this one most often if the particle is set to face the player.
*
* @param rotationZ1 The starting Z rotation of the particle.
* @param rotationZ2 The ending Z rotation of the particle.
* @param rotationZRate The rate of interpolation between the two Z rotation values.
* @param rotationZRateStart The amount of ticks the particle is around for before its colors begin interpolating between rotationZ1 and rotationZ2.
*/
void setRotationZ(float rotationZ1, float rotationZ2, float rotationZRate, int rotationZRateStart);
float getRotationZ1();
float getRotationZ2();
float getRotationZRate();
int getRotationZRateStart();
}
@@ -1,11 +0,0 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package noppes.npcs.scripted.interfaces;
import net.minecraft.entity.passive.EntityTameable;
public interface IPixelmon<T extends EntityTameable> extends IAnimal<T> {
}
@@ -14,45 +14,154 @@ public interface IPos {
int getZ();
/**
* Shifts the IPos up by 1 block and returns the new object.
*
*/
IPos up();
IPos up(int var1);
/**
*
* @param n The number of blocks to move the position up by.
* @return The new IPos object.
*/
IPos up(int n);
/**
* Shifts the IPos down by 1 block and returns the new object.
*
*/
IPos down();
IPos down(int var1);
/**
*
* @param n The number of blocks to move the position down by.
* @return The new IPos object.
*/
IPos down(int n);
/**
* Shifts the IPos north by 1 block and returns the new object.
*
*/
IPos north();
IPos north(int var1);
/**
*
* @param n The number of blocks to move the position north by.
* @return The new IPos object.
*/
IPos north(int n);
/**
* Shifts the IPos east by 1 block and returns the new object.
*
*/
IPos east();
IPos east(int var1);
/**
*
* @param n The number of blocks to move the position east by.
* @return The new IPos object.
*/
IPos east(int n);
/**
* Shifts the IPos south by 1 block and returns the new object.
*
*/
IPos south();
IPos south(int var1);
/**
*
* @param n The number of blocks to move the position south by.
* @return The new IPos object.
*/
IPos south(int n);
/**
* Shifts the IPos west by 1 block and returns the new object.
*
*/
IPos west();
IPos west(int var1);
/**
*
* @param n The number of blocks to move the position west by.
* @return The new IPos object.
*/
IPos west(int n);
IPos add(int var1, int var2, int var3);
/**
* Adds the IPos' coordinates by each of the parameters given.
*
* @param x X coordinate amount to be added
* @param y Y coordinate amount to be added
* @param z Z coordinate amount to be added
* @return The resulting IPos from the addition.
*/
IPos add(int x, int y, int z);
IPos add(IPos var1);
/**
* Directly adds the coordinates of two IPos objects and returns the resulting IPos sum.
* For example, if one IPos was represented by the coordinates (0,60,5), and another by (-10,-30,25),
* the resulting object's coordinates are (0 - 10,60 - 30,5 + 25) = (-10,30,30).
*
* @param pos The position to be added to this IPos object.
* @return The sum of the two IPos objects as a new IPos object.
*/
IPos add(IPos pos);
IPos subtract(int var1, int var2, int var3);
/**
* Subtracts the IPos' coordinates by each of the parameters given.
*
* @param x X coordinate amount to be subtracted
* @param y Y coordinate amount to be subtracted
* @param z Z coordinate amount to be subtracted
* @return The resulting IPos from the subtraction.
*/
IPos subtract(int x, int y, int z);
IPos subtract(IPos var1);
/**
* Directly subtracts the coordinates of two IPos objects and returns the resulting IPos difference.
* For example, if one IPos was represented by the coordinates (0,60,5), and another by (-10,-30,25),
* the resulting object's coordinates are (0 + 10,60 + 30,5 - 25) = (10,90,-20).
*
* @param pos The position to be subtracted from this IPos object.
* @return The difference of the two IPos objects as a new IPos object.
*/
IPos subtract(IPos pos);
/**
* Returns a normalized vector of this block's position, calculated by:
*
*
* @return The normalized vector of this block position.
*/
double[] normalize();
/**
*
* @return An obfuscated MC BlockPos object.
*/
BlockPos getMCBlockPos();
IPos offset(int var1);
/**
* Offsets the block by 1 block in the given direction and returns the resulting IPos object
*
*/
IPos offset(int direction);
IPos offset(int var1, int var2);
/**
* Offsets the block by n blocks in the given direction and returns the resulting IPos object
*
*/
IPos offset(int direction, int n);
double distanceTo(IPos var1);
/**
*
* @param pos The IPos object to calculate the distance to
* @return The distance between this IPos object and the other.
*/
double distanceTo(IPos pos);
}
@@ -0,0 +1,66 @@
package noppes.npcs.scripted.interfaces;
import net.minecraft.util.ResourceLocation;
/**
* A skin overlay object for both NPCs and players. Several skin overlays at a time can be layered on top of each other.
* In an NPC's case, the old overlay texture is now the skin overlay with ID 0.
*
* Modifying these attributes, an overlay can be made to look like a powered creeper effect, just a new skin, or both!
*/
public interface ISkinOverlay {
/**
* Sets the directory texture of the overlay. Does not support URLs.
*/
void setTexture(String texture);
String getTexture();
/**
* Sets whether this overlay glows in the dark or not.
*/
void setGlow(boolean glow);
boolean getGlow();
/**
* Sets the transparency of the overlay, from 0 to 1.
*/
void setAlpha(float alpha);
float getAlpha();
/**
* Sets the size of the entire overlay when rendered on the entity. By default, overlays render slightly on top of
* the entity's model.
*/
void setSize(float size);
float getSize();
/**
* Sets the texture scale of the overlay. Higher values will "zoom in" to the texture more.
*/
void setScale(float scaleX, float scaleY);
float getScaleX();
float getScaleY();
/**
* Sets the "texture speed" by which the texture shifts on each render tick. Used to create a powered creeper effect!
* This does not move the entire overlay, it just moves the position at which the texture begins rendering.
*/
void setSpeed(float speedX, float speedY);
float getSpeedX();
float getSpeedY();
/**
* Sets the amount in each direction by which the overlay will be offset from the entity.
*/
void setOffset(float offsetX, float offsetY, float offsetZ);
float getOffsetX();
float getOffsetY();
float getOffsetZ();
/**
*
* @return The MC resource location object used to bind the overlay's texture.
*/
ResourceLocation getLocation();
void setLocation(ResourceLocation location);
}
@@ -0,0 +1,68 @@
package noppes.npcs.scripted.interfaces;
import net.minecraft.tileentity.TileEntity;
import noppes.npcs.scripted.ScriptBlock;
import noppes.npcs.scripted.ScriptWorld;
public interface ITileEntity {
/**
*
* @return An integer representing the metadata of this block. Blocks with different states will
* return different values. For example, each stage of growth for a wheat crop will return a different value, each
* orientation of a stair block will return a different value, etc.
*/
int getBlockMetadata();
/**
*
* @return The world this tile entity is in.
*/
ScriptWorld getWorld();
/**
*
* @return An obfuscated MC tile entity object.
*/
TileEntity getMCTileEntity();
/**
* Reads an INbt compound tag, creates a tile entity based on the data, and replaces this entity with the new one.
*/
void readFromNBT(INbt nbt);
/**
* @return The distance of this tile entity from the point given by the x, y, and z parameters.
*/
double getDistanceFrom(double x, double y, double z);
/**
* @return A new IBlock object based on this tile entity's type.
*/
IBlock getBlockType();
/**
*
* @return True if the tile entity is invalid, false otherwise.
*/
boolean isInvalid();
/**
* Invalidates the tile entity.
*/
void invalidate();
/**
* Validates the tile entity for use.
*/
void validate();
/**
* Updates the block's tile entity to the values set in this object.
*/
void updateContainingBlockInfo();
/**
* Writes the tile entity to NBT and returns the compound tag.
*/
INbt getNBT();
}
@@ -6,29 +6,84 @@
package noppes.npcs.scripted.interfaces;
public interface ITimers {
void start(int var1, int var2, boolean var3);
/**
* Adds a timer to the NPC or player with the given attributes. If this function is used and there is already a
* timer with the given ID, an exception will be thrown.
*
* @param id The id of the timer.
* @param ticks The amount of ticks before the timer ends.
* @param repeat Whether this timer repeats when it reaches its maximum amount of ticks.
*/
void start(int id, int ticks, boolean repeat);
void forceStart(int var1, int var2, boolean var3);
/**
* Adds a timer to the NPC or player with the given attributes. No exception will be thrown if there is already a
* timer with the given ID when using this function.
*
* @param id The id of the timer.
* @param ticks The amount of ticks before the timer ends.
* @param repeat Whether this timer repeats when it reaches its maximum amount of ticks.
*/
void forceStart(int id, int ticks, boolean repeat);
boolean has(int var1);
/**
*
* @return True if the set of timers contains a timer with the given id, false otherwise.
*/
boolean has(int id);
boolean stop(int var1);
/**
* Stops the timer with the given id
*
* @return True if there was a timer with the given id.
*/
boolean stop(int id);
void reset(int var1);
/**
* Resets the ticks elapsed in the timer with the given id to 0.
*/
void reset(int id);
/**
* Removes all timers.
*/
void clear();
/**
* @return The amount of ticks elapsed in the timer.
*/
int ticks(int id);
/**
* Sets the amount of ticks elapsed in the timer with the given id to a different value.
*
* @param ticks The new ticks elapsed by the timer.
*/
void setTicks(int id, int ticks);
/**
* @return The maximum amount of ticks the timer with the given id runs for before it stops.
*/
int maxTicks(int id);
/**
* Sets the maximum amount of ticks the timer with the given id can run for before it stops.
*/
void setMaxTicks(int id, int maxTicks);
/**
* @return True if the timer with the given id repeats, false otherwise.
*/
boolean repeats(int id);
/**
* Sets whether the timer with the given id repeats or not.
*/
void setRepeats(int id, boolean repeat);
/**
*
* @return The amount of timers in the set of timers.
*/
int size();
}
@@ -7,17 +7,23 @@ import noppes.npcs.scripted.ScriptItemStack;
import noppes.npcs.scripted.ScriptScoreboard;
import noppes.npcs.scripted.entity.ScriptEntity;
import noppes.npcs.scripted.entity.ScriptPlayer;
import noppes.npcs.scripted.*;
import noppes.npcs.scripted.interfaces.entity.IEntity;
import noppes.npcs.scripted.interfaces.entity.IPlayer;
import noppes.npcs.scripted.interfaces.item.IItemStack;
public interface IWorld {
/**
* @return The worlds time
*/
public long getTime();
long getTime();
/**
* @return The total world time
*/
public long getTotalTime();
long getTotalTime();
boolean areAllPlayersAsleep();
/**
* @param x World position x
@@ -26,13 +32,101 @@ public interface IWorld {
* @return The block at the given position. Returns null if there isn't a block
*/
public IBlock getBlock(int x, int y, int z);
/**
* @param pos
* @return The block at the given position. Returns null if there isn't a block
*/
public IBlock getBlock(IPos pos);
/**
*
* @return The top-most block in the world as an IBlock object.
*/
IBlock getTopBlock(int x, int z);
boolean isBlockFreezable(int x, int y, int z);
boolean isBlockFreezableNaturally(int x, int y, int z);
boolean canBlockFreeze(int x, int y, int z, boolean adjacentToWater);
boolean canBlockFreezeBody(int x, int y, int z, boolean adjacentToWater);
boolean canSnowAt(int x, int y, int z, boolean checkLight);
boolean canSnowAtBody(int x, int y, int z, boolean checkLight);
/**
* @return The Y-value of the world at this x & z value based on the height map of the world.
*/
int getHeightValue(int x, int z);
/**
* @return The minimum Y-value of the world at this x & z value based on the height map of the world.
*/
int getChunkHeightMapMinimum(int x, int z);
/**
* @return The metadata of the block at this position.
*/
int getBlockMetadata(int x, int y, int z);
boolean setBlockMetadataWithNotify(int x, int y, int z, int metadata, int flag);
boolean canBlockSeeTheSky(int x, int y, int z);
int getFullBlockLightValue(int x, int y, int z);
int getBlockLightValue(int x, int y, int z);
void playSoundAtEntity(IEntity entity, String sound, float volume, float pitch);
void playSoundToNearExcept(IPlayer player, String sound, float volume, float pitch);
IEntity getEntityByID(int id);
boolean spawnEntityInWorld(IEntity entity);
IPlayer getClosestPlayerToEntity(IEntity entity, double range);
IPlayer getClosestPlayer(double x, double y, double z, double range);
IPlayer getClosestVulnerablePlayerToEntity(IEntity entity, double range);
IPlayer getClosestVulnerablePlayer(double x, double y, double z, double range);
/**
*
* @param entity The entity whose type will be used as a parameter
* @return The amount of entities of the given type in the world.
*/
int countEntities(IEntity entity);
/**
* Sets the block's tile entity at the given position.
*/
void setTileEntity(int x, int y, int z, ITileEntity tileEntity);
/**
* Removes the block's tile entity at the given position.
*/
void removeTileEntity(int x, int y, int z);
/**
*
* @return True if the block at this position is of cubic shape. (Not a stair, slab, etc.)
*/
boolean isBlockFullCube(int x, int y, int z);
long getSeed();
void setSpawnLocation(int x, int y, int z);
boolean canLightningStrikeAt(int x, int y, int z);
boolean isBlockHighHumidity(int x, int y, int z);
/**
* @param x World position x
* @param y World position y
@@ -40,7 +134,7 @@ public interface IWorld {
* @return Text from signs
* @since 1.7.10d
*/
public String getSignText(int x, int y, int z);
String getSignText(int x, int y, int z);
/**
* @param x World position x
@@ -48,8 +142,8 @@ public interface IWorld {
* @param z World position z
* @param item The block to be set
*/
public void setBlock(int x, int y, int z, ScriptItemStack item);
public void setBlock(int x, int y, int z, IItemStack item);
/**
* @param x World position x
* @param y World position y
@@ -57,39 +151,39 @@ public interface IWorld {
* @param block The block to be set
*/
public void setBlock(int x, int y, int z, IBlock 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);
/**
* starting at the start position, draw a line in the lookVector direction until a block is detected
* @param startPos
* @param startPos
* @param lookVector should be a normalized direction vector
* @param maxDistance
* @param maxDistance
* @return the first detected block but null if maxDistance is reached
*/
public IBlock rayCastBlock(double[] startPos, double[] lookVector, int maxDistance);
/**
* starting at the start position, draw a line in the lookVector direction until a block is detected
* @param startPos
* @param startPos
* @param lookVector will normalize x, y, z to get a direction vector
* @param maxDistance
* @param maxDistance
* @return the first detected block but null if maxDistance is reached
*/
public IBlock rayCastBlock(IPos startPos, IPos lookVector, int maxDistance);
/**
* @param startPos
* @param maxHeight
* @return the position of the closest block of air to startPos
* @return the position of the closest block of air to startPos
*/
public IPos getNearestAir(IPos startPos, int maxHeight);
/**
* @param x
* @param y
@@ -97,7 +191,7 @@ public interface IWorld {
* @return can the block at this position see the sky or are there no blocks above this one
*/
public boolean canSeeSky(int x, int y, int z);
/**
* @param pos
* @return can the block at this position see the sky or are there no blocks above this one
@@ -108,34 +202,36 @@ public interface IWorld {
* @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);
IPlayer getPlayer(String name);
IPlayer getPlayerByUUID(String uuid);
/**
* @param time The world time to be set
*/
public void setTime(long time);
void setTime(long time);
/**
* @return Whether or not its daytime
*/
public boolean isDay();
boolean isDay();
/**
* @return Whether or not its currently raining
*/
public boolean isRaining();
boolean isRaining();
/**
* @param bo Set if it's raining
*/
public void setRaining(boolean bo);
void setRaining(boolean 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);
void thunderStrike(double x, double y, double z);
/**
* Sends a packet from the server to the client everytime its called. Probably should not use this too much.
@@ -149,7 +245,7 @@ public interface IWorld {
* @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);
void spawnParticle(String particle, double x, double y, double z, double dx, double dy, double dz, double speed, int count);
/**
* @param id The items name
@@ -157,71 +253,72 @@ public interface IWorld {
* @param size The number of items in the item
* @return Returns the item
*/
public ScriptItemStack createItem(String id, int damage, int size);
IItemStack createItem(String id, int damage, int size);
/**
* @param directory The particle's texture directory. Use only forward slashes when writing a directory. Example: "customnpcs:textures/particle/tail.png"
* @return Returns ScriptEntityParticle object
* @return Returns IEntityParticle object
*/
public ScriptEntityParticle createEntityParticle(String directory);
@Deprecated
IParticle createEntityParticle(String directory);
/**
* @param key Get temp data for this key
* @return Returns the stored temp data
*/
public Object getTempData(String key);
Object getTempData(String 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);
void setTempData(String key, Object 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);
boolean hasTempData(String key);
/**
* @param key The key for the temp data to be removed
*/
public void removeTempData(String key);
void removeTempData(String key);
/**
* Removes all tempdata
*/
public void clearTempData();
void clearTempData();
/**
* @param key The key of the data to be returned
* @return Returns the stored data
*/
public Object getStoredData(String key);
Object getStoredData(String key);
/**
* 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);
void setStoredData(String key, Object value);
/**
* @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);
boolean hasStoredData(String key);
/**
* @param key The key of the data to be removed
*/
public void removeStoredData(String key);
void removeStoredData(String key);
/**
* Remove all stored data
*/
public void clearStoredData();
void clearStoredData();
/**
* @param x Position x
@@ -231,10 +328,10 @@ public interface IWorld {
* @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);
void explode(double x, double y, double z, float range, boolean fire, boolean grief);
IPlayer[] getAllServerPlayers();
public ScriptPlayer[] getAllServerPlayers();
public String[] getPlayerNames();
/**
@@ -243,7 +340,7 @@ public interface IWorld {
* @param z Position z
* @return Returns the name of the biome
*/
public String getBiomeName(int x, int z);
String getBiomeName(int x, int z);
/**
* Lets you spawn a server side cloned entity
@@ -254,10 +351,14 @@ public interface IWorld {
* @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);
public ScriptScoreboard getScoreboard();
IEntity spawnClone(int x, int y, int z, int tab, String name);
ScriptScoreboard getScoreboard();
/**
*
* @return An obfuscated MC BlockPos object.
*/
BlockPos getMCBlockPos(int x, int y, int z);
/**
@@ -265,7 +366,11 @@ public interface IWorld {
* Expert use only
* @return Returns minecraft world object
*/
public WorldServer getMCWorld();
WorldServer getMCWorld();
public int getDimensionID();
/**
*
* @return The ID of this world's dimension. 0 for overworld, 1 for End, -1 for Nether, etc.
*/
int getDimensionID();
}
@@ -3,7 +3,7 @@
// (powered by Fernflower decompiler)
//
package noppes.npcs.scripted.interfaces;
package noppes.npcs.scripted.interfaces.entity;
import net.minecraft.entity.passive.EntityAnimal;
@@ -3,359 +3,368 @@
// (powered by FernFlower decompiler)
//
package noppes.npcs.scripted.interfaces;
package noppes.npcs.scripted.interfaces.entity;
import net.minecraft.entity.EntityCreature;
import noppes.npcs.constants.EnumNavType;
import noppes.npcs.scripted.ScriptFaction;
import noppes.npcs.scripted.ScriptItemStack;
import noppes.npcs.scripted.entity.ScriptLivingBase;
import noppes.npcs.scripted.entity.ScriptPlayer;
import noppes.npcs.scripted.interfaces.ISkinOverlay;
import noppes.npcs.scripted.interfaces.handler.IOverlayHandler;
import noppes.npcs.scripted.interfaces.item.IItemStack;
import noppes.npcs.scripted.interfaces.ITimers;
import noppes.npcs.scripted.roles.*;
public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T> {
/**
* @return Returns the current npcs size 1-30
*/
public int getSize();
int getSize();
/**
* @param size The size of the npc (1-30) default is 5
*/
public void setSize(int size);
void setSize(int size);
/**
* @return Returns the current npcs modelType of the NPC
*/
public int getModelType();
int getModelType();
/**
* @param modelType The modelType of the NPC. 0: Steve, 1: Steve64, 2: Alex
*/
public void setModelType(int modelType);
void setModelType(int modelType);
/**
* @return The npcs name
*/
public String getName();
String getName();
void setRotation(float rotation);
void setRotationType(int rotationType);
int getRotationType();
public void setRotation(float rotation);
/**
* @param name The name of the npc
*/
public void setName(String name);
void setName(String name);
/**
* @since 1.7.10
* @return The npcs title
*/
public String getTitle();
String getTitle();
/**
* @since 1.7.10
* @param title The title of the npc
*/
public void setTitle(String title);
void setTitle(String title);
/**
* @return The npcs texture
*/
public String getTexture();
String getTexture();
/**
* @param texture The texture of the npc
*/
public void setTexture(String texture);
void setTexture(String texture);
/**
* @return Home position x
*/
public int getHomeX();
int getHomeX();
/**
* @param x The home x position
*/
public void setHomeX(int x);
void setHomeX(int x);
/**
* @return Home position x
*/
public int getHomeY();
int getHomeY();
/**
* @param y The home y position
*/
public void setHomeY(int y);
void setHomeY(int y);
/**
* @return Home position x
*/
public int getHomeZ();
int getHomeZ();
/**
* @param z The home x position
*/
public void setHomeZ(int z);
void setHomeZ(int 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);
void setHome(int x, int y, int z);
/**
* @param health New max health
*/
public void setMaxHealth(double health);
void setMaxHealth(double health);
/**
* @param bo Whether or not the npc will try to return to his home position
*/
public void setReturnToHome(boolean bo);
void setReturnToHome(boolean bo);
/**
* @return Whether or not the npc returns home
*/
public boolean getReturnToHome();
boolean getReturnToHome();
/**
* @return The faction of the npc
*/
public ScriptFaction getFaction();
ScriptFaction getFaction();
/**
* @param id The id of the new faction
*/
public void setFaction(int id);
void setFaction(int id);
/**
*
* @param attackOtherFactions True if you want the NPC to attack other factions, false otherwise.
*/
public void setAttackFactions(boolean attackOtherFactions);
void setAttackFactions(boolean attackOtherFactions);
/**
*
* @return Returns true if the NPC attacks other factions, false otherwise.
*/
public boolean getAttackFactions();
boolean getAttackFactions();
/**
*
* @param defendFaction True if the NPC should defend faction members, false otherwise.
*/
public void setDefendFaction(boolean defendFaction);
void setDefendFaction(boolean defendFaction);
/**
*
* @return Returns true if the NPC should defend faction members, false otherwise.
*/
public boolean getDefendFaction();
boolean getDefendFaction();
public int getType();
int getType();
public boolean typeOf(int type);
boolean typeOf(int 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);
public void setProjectilesKeepTerrain(boolean b);
public boolean getProjectilesKeepTerrain();
void shootItem(IEntityLivingBase target, IItemStack item, int accuracy);
void setProjectilesKeepTerrain(boolean b);
boolean getProjectilesKeepTerrain();
/**
* @param message The message the npc will say
*/
public void say(String message);
void say(String message);
/**
* @param message The message the npc will say
*/
public void say(ScriptPlayer player, String message);
void say(IPlayer player, String message);
/**
* Kill the npc, doesnt't despawn it
*/
public void kill();
void kill();
/**
* Basically completely resets the npc. This will also call the Init script
*/
public void reset();
void reset();
/**
* @return Returns the npcs current role
*/
public ScriptRoleInterface getRole();
ScriptRoleInterface getRole();
void setRole(int role);
/**
* @return Returns the npcs current job
*/
public ScriptJobInterface getJob();
ScriptJobInterface getJob();
void setJob(int job);
/**
* @return The item held in the right hand
*/
public ScriptItemStack getRightItem();
IItemStack getRightItem();
/**
* @param item Item to be held in the right hand
*/
public void setRightItem(ScriptItemStack item);
void setRightItem(IItemStack item);
/**
* @return The item held in the left hand
*/
public ScriptItemStack getLefttItem();
IItemStack getLefttItem();
/**
* @param item Item to be held in the left hand
*/
public void setLeftItem(ScriptItemStack item);
void setLeftItem(IItemStack item);
/**
* @return Returns the projectile the npc uses
*/
public ScriptItemStack getProjectileItem();
IItemStack getProjectileItem();
/**
* @param item Item to be used as projectile
*/
public void setProjectileItem(ScriptItemStack item);
void setProjectileItem(IItemStack item);
/**
*
* @return Returns true if the NPC can aim while shooting.
*/
public boolean canAimWhileShooting();
boolean canAimWhileShooting();
/**
*
* @param aimWhileShooting Set to true if you want the NPC to aim while shooting, false otherwise.
*/
public void aimWhileShooting(boolean aimWhileShooting);
void aimWhileShooting(boolean aimWhileShooting);
public void setMinProjectileDelay(int minDelay);
public int getMinProjectileDelay();
void setMinProjectileDelay(int minDelay);
int getMinProjectileDelay();
public void setMaxProjectileDelay(int maxDelay);
public int getMaxProjectileDelay();
void setMaxProjectileDelay(int maxDelay);
int getMaxProjectileDelay();
public void setRangedRage(int rangedRange);
public int getRangedRage();
void setRangedRage(int rangedRange);
int getRangedRage();
public void setFireRate(int rate);
public int getFireRate();
void setFireRate(int rate);
int getFireRate();
public void setBurstCount(int burstCount);
public int getBurstCount();
void setBurstCount(int burstCount);
int getBurstCount();
public void setShotCount(int shotCount);
public int getShotCount();
void setShotCount(int shotCount);
int getShotCount();
public void setAccuracy(int accuracy);
public int getAccuracy();
void setAccuracy(int accuracy);
int getAccuracy();
/**
*
* @return The directory of the sound that plays when a projectile is shot
*/
public String getFireSound();
String getFireSound();
/**
*
* @param fireSound The new directory of the sound that plays when a projectile is shot
*/
public void setFireSound(String fireSound);
void setFireSound(String fireSound);
/**
* @param slot The armor slot to return. 0:head, 1:body, 2:legs, 3:boots
* @return Returns the worn armor in slot
*/
public ScriptItemStack getArmor(int slot);
IItemStack getArmor(int slot);
/**
* @param slot The armor slot to set. 0:head, 1:body, 2:legs, 3:boots
* @param item Item to be set as armor
*/
public void setArmor(int slot, ScriptItemStack item);
void setArmor(int slot, IItemStack item);
/**
*
* @param slot The slot from the NPC's drop list to return (0-8)
* @return The item in the NPC's drop list slot
*/
public ScriptItemStack getLootItem(int slot);
IItemStack getLootItem(int slot);
/**
*
* @param slot The slot from the NPC's drop list to change
* @param item The item the drop list slot will be changed to
*/
public void setLootItem(int slot, ScriptItemStack item);
void setLootItem(int slot, IItemStack item);
/**
*
* @param slot The slot from the NPC's drop list to return (0-8)
* @return The chance of dropping the item in this slot. Returns 100 if the slot is not found.
*/
public double getLootChance(int slot);
double getLootChance(int slot);
/**
*
* @param slot The slot from the NPC's drop list to change
* @param chance The new chance of dropping the item in this slot
*/
public void setLootChance(int slot, double chance);
void setLootChance(int slot, double chance);
/**
*
* @return The NPC's loot mode. 0 = Normal, 1 = Auto Pickup
*/
public int getLootMode();
int getLootMode();
/**
*
* @param lootMode The NPC's loot mode. 0 = Normal, 1 = Auto Pickup
*/
public void setLootMode(int lootMode);
void setLootMode(int lootMode);
/**
*
* @param lootXP The new minimum XP gained from killing the NPC. If greater than the max XP, it will be set to it.
*/
public void setMinLootXP(int lootXP);
void setMinLootXP(int lootXP);
/**
*
* @param lootXP The new maximum XP gained from killing the NPC. If less than the min XP, it will be set to it.
*/
public void setMaxLootXP(int lootXP);
void setMaxLootXP(int lootXP);
/**
*
* @return The minimum XP gained from killing the NPC.
*/
public int getMinLootXP();
int getMinLootXP();
/**
*
* @return The maximum XP gained from killing the NPC.
*/
public int getMaxLootXP();
public boolean getCanDrown();
public void setCanDrown(boolean b);
int getMaxLootXP();
boolean getCanDrown();
void setCanDrown(boolean b);
/**
* @param type The AnimationType
*/
public void setAnimation(int type);
void setAnimation(int type);
/**
*
@@ -369,7 +378,7 @@ public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T> {
* 6 - None
*
*/
public void setTacticalVariant(int variant);
void setTacticalVariant(int variant);
/**
*
@@ -383,43 +392,43 @@ public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T> {
* 6 - None
*
*/
public int getTacticalVariant();
int getTacticalVariant();
/**
*
* @param variant Sets the NPC's tactical variant by name.
*/
public void setTacticalVariant(String variant);
void setTacticalVariant(String variant);
/**
*
* @return Returns the name of the NPc's tactical variant.
*/
public String getTacticalVariantName();
String getTacticalVariantName();
/**
*
* @param tacticalRadius Sets the radius in which the tactical variant is affected, if any. Effective for all tactical variants except Rush and None.
*/
public void setTacticalRadius(int tacticalRadius);
void setTacticalRadius(int tacticalRadius);
/**
*
* @return Gets the radius in which the tactical variant is affected, if any. Effective for all tactical variants except Rush and None.
*/
public int getTacticalRadius();
int getTacticalRadius();
/**
*
* @param ignore True if the NPC goes through cobwebs
*/
public void setIgnoreCobweb(boolean ignore);
void setIgnoreCobweb(boolean ignore);
/**
*
* @return True if the NPC goes through cobwebs
*/
public boolean getIgnoreCobweb();
boolean getIgnoreCobweb();
/**
*
@@ -429,7 +438,7 @@ public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T> {
* 2 - Retreat
* 3 - Nothing
*/
public void setOnFoundEnemy(int onAttack);
void setOnFoundEnemy(int onAttack);
/**
*
@@ -439,7 +448,7 @@ public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T> {
* 2 - Retreat
* 3 - Nothing
*/
public int onFoundEnemy();
int onFoundEnemy();
/**
*
@@ -448,7 +457,7 @@ public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T> {
* 1 - Sunlight
* 2 - Disabled
*/
public void setShelterFrom(int shelterFrom);
void setShelterFrom(int shelterFrom);
/**
*
@@ -457,36 +466,36 @@ public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T> {
* 1 - Sunlight
* 2 - Disabled
*/
public int getShelterFrom();
int getShelterFrom();
/**
*
* @return Whether the NPC has a living animation
*/
public boolean hasLivingAnimation();
boolean hasLivingAnimation();
/**
*
* @param livingAnimation True if you want the NPC to have a living animation, false otherwise
*/
public void setLivingAnimation(boolean livingAnimation);
void setLivingAnimation(boolean livingAnimation);
/**
* @param type The visibility type of the npc, 0:visible, 1:invisible, 2:semi-visible
*/
public void setVisibleType(int type);
void setVisibleType(int type);
/**
* @return The visibility type of the npc, 0:visible, 1:invisible, 2:semi-visible
*/
public int getVisibleType();
int getVisibleType();
/**
*
* @param player The player this NPC becomes visible/invisible to
* @param visible True if you want the NPC to be invisible to the player, false otherwise
*/
public void setVisibleTo(ScriptPlayer player, boolean visible);
void setVisibleTo(IPlayer player, boolean visible);
/**
*
@@ -495,251 +504,263 @@ public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T> {
* If setVisibleTo(player,visible) was not called to make this NPC invisible to the player at any point
* in the NPC's life, this function will return true regardless of the value of isVisible().
*/
public boolean isVisibleTo(ScriptPlayer player);
boolean isVisibleTo(IPlayer player);
/**
* @param type The visibility type of the name, 0:visible, 1:invisible, 2:when-attacking
*/
public void setShowName(int type);
void setShowName(int type);
/**
* @return Returns the visibility type of the name, 0:visible, 1:invisible, 2:when-attacking
*/
public int getShowName();
int getShowName();
/**
* @return Returns the visiblity of the boss bar, 0:invisible, 1:visible, 2:when-attacking
*/
public int getShowBossBar();
int getShowBossBar();
/**
* @param type The visibility type of the boss bar, 0:invisible, 1:visible, 2:when-attacking
*/
public void setShowBossBar(int type);
void setShowBossBar(int type);
/**
* @return The melee strength
*/
public float getMeleeStrength();
float getMeleeStrength();
/**
* @param strength The melee strength
*/
public void setMeleeStrength(float strength);
void setMeleeStrength(float strength);
/**
* @return The melee speed
*/
public int getMeleeSpeed();
int getMeleeSpeed();
/**
* @param speed The melee speed
*/
public void setMeleeSpeed(int speed);
void setMeleeSpeed(int speed);
/**
* @return The ranged strength
*/
public float getRangedStrength();
float getRangedStrength();
/**
* @param strength The ranged strength
*/
public void setRangedStrength(float strength);
void setRangedStrength(float strength);
/**
* @return The ranged speed
*/
public int getRangedSpeed();
int getRangedSpeed();
/**
* @param speed The ranged speed
*/
public void setRangedSpeed(int speed);
void setRangedSpeed(int speed);
/**
* @return The ranged burst count
*/
public int getRangedBurst();
int getRangedBurst();
/**
* @param count The ranged burst count
*/
public void setRangedBurst(int count);
void setRangedBurst(int count);
/**
*
* @return The amount of ticks before this entity respawns
*/
public int getRespawnTime();
int getRespawnTime();
/**
*
* @param time The new amount of ticks before this entity respawns
*/
public void setRespawnTime(int time);
void setRespawnTime(int time);
/**
*
* @return Respawn: 0 - Yes (Always), 1 - Day, 2 - Night, 3 - No (Dies permanently)
*/
public int getRespawnCycle();
int getRespawnCycle();
/**
*
* @param cycle Sets when the NPC respawns. Respawn: 0 - Yes (Always), 1 - Day, 2 - Night, 3 - No (Dies permanently)
*/
public void setRespawnCycle(int cycle);
void setRespawnCycle(int cycle);
/**
*
* @return Whether the NPC is hidden when it dies
*/
public boolean getHideKilledBody();
boolean getHideKilledBody();
/**
*
* @param hide True if the NPC is hidden when it dies. False otherwise.
*/
public void hideKilledBody(boolean hide);
void hideKilledBody(boolean hide);
/**
*
* @return Returns true if the NPC naturally despawns.
*/
public boolean naturallyDespawns();
boolean naturallyDespawns();
/**
*
* @param canDespawn True if the NPC should naturally despawn. False otherwise.
*/
public void setNaturallyDespawns(boolean canDespawn);
void setNaturallyDespawns(boolean canDespawn);
/**
* @param player The player to give the item to
* @param item The item given to the player
*/
public void giveItem(ScriptPlayer player, ScriptItemStack item);
void giveItem(IPlayer player, IItemStack 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);
void executeCommand(String command);
public void setHeadScale(float x, float y, float z);
void setHeadScale(float x, float y, float z);
public void setBodyScale(float x, float y, float z);
void setBodyScale(float x, float y, float z);
public void setArmsScale(float x, float y, float z);
void setArmsScale(float x, float y, float z);
public void setLegsScale(float x, float y, float z);
void setLegsScale(float x, float y, float z);
/**
* @since 1.7.10c
* @param resistance Explosion resistance (0-2) default is 1
*/
public void setExplosionResistance(float resistance);
void setExplosionResistance(float resistance);
/**
* @since 1.7.10c
* @return Returns Explosion Resistance
*/
public float getExplosionResistance();
float getExplosionResistance();
/**
* @param resistance Melee resistance (0-2) default is 1
*/
public void setMeleeResistance(float resistance);
void setMeleeResistance(float resistance);
/**
* @return Returns Melee Resistance
*/
public float getMeleeResistance();
float getMeleeResistance();
/**
* @param resistance Arrow resistance (0-2) default is 1
*/
public void setArrowResistance(float resistance);
void setArrowResistance(float resistance);
/**
* @return Returns Arrow Resistance
*/
public float getArrowResistance();
float getArrowResistance();
/**
* @param resistance Knockback resistance (0-2) default is 1
*/
public void setKnockbackResistance(float resistance);
void setKnockbackResistance(float resistance);
/**
* @return Returns Knockback Resistance
*/
public float getKnockbackResistance();
float getKnockbackResistance();
/**
* @param type Retaliation type. 0:normal, 1:panic, 2:retreat, 3:nothing
*/
public void setRetaliateType(int type);
void setRetaliateType(int type);
/**
* @return Returns the combat health regen per second
*/
public float getCombatRegen();
float getCombatRegen();
/**
* @param regen The combat health regen per second
*/
public void setCombatRegen(float regen);
void setCombatRegen(float regen);
/**
* @return Returns the health regen per second when not in combat
*/
public float getHealthRegen();
float getHealthRegen();
/**
* @param regen The health regen per second when not in combat
*/
public void setHealthRegen(float regen);
void setHealthRegen(float regen);
public long getAge();
long getAge();
public void setFly(int fly);
ITimers getTimers();
public boolean canFly();
void setFly(int fly);
public void setFlySpeed(double flySpeed);
boolean canFly();
public double getFlySpeed(double flySpeed);
void setFlySpeed(double flySpeed);
public void setFlyGravity(double flyGravity);
double getFlySpeed(double flySpeed);
public double getFlyGravity(double flyGravity);
void setFlyGravity(double flyGravity);
public void setSpeed(int speed);
double getFlyGravity(double flyGravity);
public int getSpeed();
void setFlyHeightLimit(int flyHeightLimit);
public void setSkinType(byte type);
int getFlyHeightLimit(int flyHeightLimit);
public byte getSkinType();
void limitFlyHeight(boolean limit);
public void setSkinUrl(String url);
boolean isFlyHeightLimited(boolean limit);
public String getSkinUrl();
void setSpeed(int speed);
public void setCloakTexture(String cloakTexture);
int getSpeed();
public String getCloakTexture();
void setSkinType(byte type);
public void setOverlayTexture(String overlayTexture);
byte getSkinType();
public String getOverlayTexture();
void setSkinUrl(String url);
public void setCollisionType(int type);
String getSkinUrl();
public int getCollisionType();
void setCloakTexture(String cloakTexture);
public void updateClient();
String getCloakTexture();
void setOverlayTexture(String overlayTexture);
String getOverlayTexture();
IOverlayHandler getOverlays();
void setCollisionType(int type);
int getCollisionType();
void updateClient();
}
@@ -0,0 +1,346 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package noppes.npcs.scripted.interfaces.entity;
import net.minecraft.entity.Entity;
import noppes.npcs.scripted.ScriptParticle;
import noppes.npcs.scripted.ScriptWorld;
import noppes.npcs.scripted.interfaces.INbt;
import noppes.npcs.scripted.interfaces.IPos;
import noppes.npcs.scripted.interfaces.item.IItemStack;
public interface IEntity<T extends Entity> {
void spawnParticle(ScriptParticle entityParticle);
int getEntityId();
String getUniqueID();
double getYOffset();
/**
* @return The entities width
*/
double getWidth();
/**
* @return The entities height
*/
double getHeight();
/**
* @return The entities x position
*/
double getX();
/**
* @param x The entities x position
*/
void setX(double x);
/**
* @return The entities y position
*/
double getY();
/**
* @param y The entities y position
*/
void setY(double y);
/**
* @return The entities x position
*/
double getZ();
/**
* @param z The entities x position
*/
void setZ(double z);
/**
* @return The entities z motion
*/
double getMotionX();
/**
* @param x The entities x motion
*/
void setMotionX(double x);
/**
* @return The entities x motion
*/
double getMotionY();
/**
* @param y The entities y motion
*/
void setMotionY(double y);
/**
* @return The entities y motion
*/
double getMotionZ();
/**
* @param z The entities z motion
*/
void setMotionZ(double z);
void setMotion(double x, double y, double z);
boolean isAirborne();
/**
* @return The block x position
*/
int getBlockX();
/**
* @return The block y position
*/
int getBlockY();
/**
* @return The block z position
*/
int getBlockZ();
/**
* @param x The x position
* @param y The y position
* @param z The z position
*/
void setPosition(double x, double y, double z);
IPos getPos();
void setPos(IPos pos);
int getDimension();
/**
* @param range The search range for entities around this entity
* @return Array of entities within range
*/
IEntity[] getSurroundingEntities(int range);
/**
* @param range The search range for entities around this entity
* @param type The EntityType you want to find
* @return Array of entities within range
*/
IEntity[] getSurroundingEntities(int range, int type);
/**
* @return Whether the entity is alive or not
*/
boolean isAlive();
/**
* @param key Get temp data for this key
* @return Returns the stored temp data
*/
Object getTempData(String 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
*/
void setTempData(String key, Object value);
/**
* @param key The key thats going to be tested against the temp data
* @return Whether or not temp data containes the key
*/
boolean hasTempData(String key);
/**
* @param key The key for the temp data to be removed
*/
void removeTempData(String key);
/**
* Remove all tempdata
*/
void clearTempData();
/**
* @param key The key of the data to be returned
* @return Returns the stored data
*/
Object getStoredData(String key);
/**
* 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
*/
void setStoredData(String key, Object value);
/**
* @param key The key of the data to be checked
* @return Returns whether or not the stored data contains the key
*/
boolean hasStoredData(String key);
/**
* @param key The key of the data to be removed
*/
void removeStoredData(String key);
/**
* Remove all stored data
*/
void clearStoredData();
/**
* @return The age of this entity in ticks
*/
long getAge();
/**
* Despawns this entity. Removes it permanently
*/
void despawn();
/**
* @return Return whether or not this entity is standing in water
*/
boolean inWater();
/**
* @return Return whether or not this entity is standing in lava
*/
boolean inLava();
/**
* @return Return whether or not this entity is standing in fire
*/
boolean inFire();
/**
* @return Return whether or not this entity is on fire
*/
boolean isBurning();
/**
* @param ticks Amount of world ticks this entity will burn. 20 ticks equals 1 second
*/
void setBurning(int ticks);
/**
* Removes fire from this entity
*/
void extinguish();
/**
* @return Name as which it's registered in minecraft
*/
String getTypeName();
/**
* @param item Item to be dropped
*/
void dropItem(IItemStack item);
/**
* @return Return the rider
*/
IEntity getRider();
/**
* @param entity The entity to ride this entity
*/
void setRider(IEntity entity);
/**
* @return Return the entity, this entity is riding
*/
IEntity getMount();
/**
* @param entity The entity this entity will mount
*/
void setMount(IEntity entity);
/**
* @see noppes.npcs.scripted.constants.EntityType
* @return Returns the EntityType of this entity
*/
int getType();
/**
* @since 1.7.10c
* @param type @EntityType to check
* @return Returns whether the entity is type of the given @EntityType
*/
boolean typeOf(int type);
/**
* @param rotation The rotation to be set (0-360)
*/
void setRotation(float rotation);
/**
* @return Current rotation of the npc
*/
float getRotation();
public void setPitch(float pitch);
public float getPitch();
/**
* @param power How strong the knockback is
* @param direction The direction in which he flies back (0-360). Usually based on getRotation()
*/
void knockback(int power, float direction);
void knockback(int xpower, int ypower, int zpower, float direction);
void setImmune(int ticks);
public void setInvisible(boolean invisible);
public void setSneaking(boolean sneaking);
public void setSprinting(boolean sprinting);
boolean hasCollided();
/**
* @since 1.7.10c
* @return Returns whether or not this entity is sneaking
*/
boolean isSneaking();
/**
* @since 1.7.10c
* @return Returns whether or not this entity is sprinting
*/
boolean isSprinting();
/**
* @since 1.7.10c
* Expert users only
* @return Returns minecrafts entity
*/
T getMCEntity();
public INbt getNbt();
public INbt getAllNbt();
public void setNbt(INbt nbt);
void storeAsClone(int tab, String name);
ScriptWorld getWorld();
}
@@ -3,7 +3,7 @@
// (powered by Fernflower decompiler)
//
package noppes.npcs.scripted.interfaces;
package noppes.npcs.scripted.interfaces.entity;
import net.minecraft.entity.EntityLiving;
@@ -1,60 +1,65 @@
package noppes.npcs.scripted.interfaces;
package noppes.npcs.scripted.interfaces.entity;
import net.minecraft.entity.EntityLivingBase;
import noppes.npcs.scripted.entity.ScriptEntity;
import noppes.npcs.scripted.ScriptItemStack;
import noppes.npcs.scripted.entity.ScriptLivingBase;
import noppes.npcs.scripted.interfaces.item.IItemStack;
import noppes.npcs.scripted.ScriptDamageSource;
public interface IEntityLivingBase<T extends EntityLivingBase> extends IEntity<T> {
/**
* @return The entity's current health
*/
public float getHealth();
float getHealth();
/**
* @param health The new health of this entity
*/
public void setHealth(float health);
void setHealth(float health);
void hurt(float damage);
void hurt(float damage, IEntity source);
void hurt(float damage, ScriptDamageSource damageSource);
/**
* @return Entity's max health
*/
public double getMaxHealth();
double getMaxHealth();
/**
* @return Whether or not this entity is attacking something
*/
public boolean isAttacking();
boolean isAttacking();
/**
* @param living Entity which this entity will attack
*/
public void setAttackTarget(ScriptLivingBase living);
void setAttackTarget(IEntityLivingBase living);
/**
* @return The entity which this entity is attacking
*/
public ScriptLivingBase getAttackTarget();
IEntityLivingBase getAttackTarget();
public int getType();
int getType();
public boolean typeOf(int type);
boolean typeOf(int type);
/**
* @param entity Entity to check
* @return Whether or not this entity can see the given entity
*/
public boolean canSeeEntity(ScriptEntity entity);
boolean canSeeEntity(IEntity entity);
/**
* Expert use only
* @return Returns the minecraft entity object
*/
public T getMCEntity();
T getMCEntity();
/**
* Makes the entity swing its hand
*/
public void swingHand();
void swingHand();
/**
* Works the same as the <a href="http://minecraft.gamepedia.com/Commands#effect">/effect command</a>
@@ -63,40 +68,40 @@ public interface IEntityLivingBase<T extends EntityLivingBase> extends IEntity<T
* @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);
void addPotionEffect(int effect, int duration, int strength, boolean hideParticles);
/**
* Clears all potion effects
*/
public void clearPotionEffects();
void clearPotionEffects();
/**
* @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);
int getPotionEffect(int effect);
/**
* Note not all Living Entities support this
* @since 1.7.10c
* @return The item the entity is holding
*/
public ScriptItemStack getHeldItem();
IItemStack getHeldItem();
/**
* Note not all Living Entities support this
* @since 1.7.10c
* @param item The item to be set
*/
public void setHeldItem(ScriptItemStack item);
void setHeldItem(IItemStack 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);
IItemStack getArmor(int slot);
/**
* Note not all Living Entities support this
@@ -104,5 +109,5 @@ public interface IEntityLivingBase<T extends EntityLivingBase> extends IEntity<T
* @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);
void setArmor(int slot, IItemStack item);
}
@@ -3,7 +3,7 @@
// (powered by Fernflower decompiler)
//
package noppes.npcs.scripted.interfaces;
package noppes.npcs.scripted.interfaces.entity;
import net.minecraft.entity.monster.EntityMob;
@@ -0,0 +1,101 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package noppes.npcs.scripted.interfaces.entity;
import net.minecraft.entity.passive.EntityTameable;
public interface IPixelmon<T extends EntityTameable> extends IAnimal<T> {
boolean getIsShiny();
void setIsShiny(boolean bo);
int getLevel();
void setLevel(int level);
/**
* @param type 0:HP, 1:Attack, 2:Defense, 3:SpAttack, 4:SpDefense, 5:Speed
*/
int getIV(int type);
/**
* @param type 0:HP, 1:Attack, 2:Defense, 3:SpAttack, 4:SpDefense, 5:Speed
*/
void setIV(int type, int value);
/**
* @param type 0:HP, 1:Attack, 2:Defense, 3:SpAttack, 4:SpDefense, 5:Speed
*/
int getEV(int type);
/**
* @param type 0:HP, 1:Attack, 2:Defense, 3:SpAttack, 4:SpDefense, 5:Speed
*/
void setEV(int type, int value);
/**
* @param type 0:HP, 1:Attack, 2:Defense, 3:SpAttack, 4:SpDefense, 5:Speed
*/
int getStat(int type);
/**
* @param type 0:HP, 1:Attack, 2:Defense, 3:SpAttack, 4:SpDefense, 5:Speed
*/
void setStat(int type, int value);
/**
* @return type 0:Pygmy, 1:Runt, 2:Small, 3:Normal, 4:Huge, 5:Giant, 6:Enormous, 7:Ginormous, 8:Microscopic
*/
int getSize();
/**
* @param type 0:Pygmy, 1:Runt, 2:Small, 3:Normal, 4:Huge, 5:Giant, 6:Enormous, 7:Ginormous, 8:Microscopic
*/
void setSize(int type);
/**
* @return 0-255
*/
int getHapiness();
/**
* @param value 0-255
*/
void setHapiness(int value);
/**
* @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
*/
int getNature();
/**
* @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
*/
void setNature(int type);
/**
* @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
*/
int getPokeball();
/**
* @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
*/
void setPokeball(int type);
String getNickname();
boolean hasNickname();
void setNickname(String name);
String getMove(int slot);
void setMove(int slot, String move);
}
@@ -1,117 +1,138 @@
package noppes.npcs.scripted.interfaces;
package noppes.npcs.scripted.interfaces.entity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.Vec3;
import noppes.npcs.scripted.ScriptItemStack;
import noppes.npcs.scripted.ScriptBlock;
import noppes.npcs.scripted.entity.ScriptDBCPlayer;
import noppes.npcs.scripted.interfaces.handler.IOverlayHandler;
import noppes.npcs.scripted.interfaces.handler.data.IQuest;
import noppes.npcs.scripted.interfaces.*;
import noppes.npcs.scripted.interfaces.gui.ICustomGui;
import noppes.npcs.scripted.interfaces.item.IItemStack;
import noppes.npcs.scripted.interfaces.overlay.ICustomOverlay;
import noppes.npcs.scripted.ScriptPixelmonPlayerData;
public interface IPlayer<T extends EntityPlayerMP> extends IEntityLivingBase<T> {
/**
* @return Returns the displayed name of the player
*/
public String getDisplayName();
String getDisplayName();
/**
* @return Returns the players name
*/
public String getName();
String getName();
public void setPosition(double x, double y, double z);
void setPosition(double x, double y, double z);
public void setPosition(double x, double y, double z, int dimensionId);
void setPosition(double x, double y, double z, int dimensionId);
public boolean hasFinishedQuest(int id);
int getHunger();
public boolean hasActiveQuest(int id);
void setHunger(int hunger);
public void showDialog(int id);
float getSaturation();
void setSaturation(float saturation);
public boolean hasReadDialog(int id);
public void readDialog(int id);
public void unreadDialog(int id);
boolean hasFinishedQuest(int id);
boolean hasActiveQuest(int id);
/**
* Add the quest from active quest list
* @param id The Quest ID
*/
public void startQuest(int id);
void startQuest(int id);
/**
* Add the quest from finished quest list
* @param id The Quest ID
*/
public void finishQuest(int id);
void finishQuest(int id);
/**
* Removes the quest from active quest list
* @param id The Quest ID
*/
public void stopQuest(int id);
void stopQuest(int id);
/**
* Removes the quest from active and finished quest list
* @param id The Quest ID
*/
public void removeQuest(int id);
void removeQuest(int id);
public int getType();
IQuest[] getFinishedQuests();
public boolean typeOf(int type);
int getType();
boolean typeOf(int type);
/**
* @param faction The faction id
* @param points The points to increase. Use negative values to decrease
*/
public void addFactionPoints(int faction, int points);
void addFactionPoints(int faction, int points);
/**
* @param faction The faction id
* @param points The new point value for this faction
*/
public void setFactionPoints(int faction, int points);
void setFactionPoints(int faction, int points);
/**
* @param faction The faction id
* @return points
*/
public int getFactionPoints(int faction);
int getFactionPoints(int faction);
/**
* @param message The message you want to send
*/
void sendMessage(String message);
public void sendMessage(String message);
public void sendMessage(String message, EnumChatFormatting color, boolean bold, boolean italic, boolean underlined);
public void sendMessage(String message, EnumChatFormatting color, boolean bold, boolean italic, boolean obfuscated, boolean strikethrough, boolean underlined);
/**
* @return Return gamemode. 0: Survival, 1: Creative, 2: Adventure
*/
public int getMode();
int getMode();
/**
* @param type The gamemode type. 0:SURVIVAL, 1:CREATIVE, 2:ADVENTURE
*/
public void setMode(int type);
void setMode(int type);
/**
* @param item The item to be checked
* @return How many of this item the player has
*/
public int inventoryItemCount(ScriptItemStack item);
int inventoryItemCount(IItemStack item);
/**
* @since 1.7.10d
* @return Returns a IItemStack array size 36
*/
public ScriptItemStack[] getInventory();
IItemStack[] getInventory();
/**
* @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);
boolean removeItem(IItemStack item, int amount);
/**
* @since 1.7.10c
@@ -120,7 +141,7 @@ public interface IPlayer<T extends EntityPlayerMP> extends IEntityLivingBase<T>
* @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);
boolean removeItem(String id, int damage, int amount);
/**
* @since 1.7.10c
@@ -128,7 +149,7 @@ public interface IPlayer<T extends EntityPlayerMP> extends IEntityLivingBase<T>
* @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);
boolean giveItem(IItemStack item, int amount);
/**
* @since 1.7.10c
@@ -137,7 +158,7 @@ public interface IPlayer<T extends EntityPlayerMP> extends IEntityLivingBase<T>
* @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);
boolean giveItem(String id, int damage, int amount);
/**
* Same as the /spawnpoint command
@@ -145,53 +166,86 @@ public interface IPlayer<T extends EntityPlayerMP> extends IEntityLivingBase<T>
* @param y The y position
* @param z The z position
*/
public void setSpawnpoint(int x, int y, int z);
void setSpawnpoint(int x, int y, int z);
public void resetSpawnpoint();
void resetSpawnpoint();
/**
* @param item The item to be removed from the players inventory
*/
public void removeAllItems(ScriptItemStack item);
void removeAllItems(IItemStack item);
void setRotation(float rotationYaw, float rotationPitch);
void stopUsingItem();
void clearItemInUse();
public void clearInventory();
void playSound(String name, float volume, float pitch);
void mountEntity(Entity ridingEntity);
IEntity dropOneItem(boolean dropStack);
boolean canHarvestBlock(IBlock block);
boolean interactWith(IEntity entity);
/**
* @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);
boolean hasAchievement(String achievement);
/**
* @param permission Bukkit/Cauldron permission
* @return Returns whether or not the player has the permission
*/
public boolean hasBukkitPermission(String permission);
boolean hasBukkitPermission(String permission);
/**
* @since 1.7.10c
* @return Returns the exp level
*/
public int getExpLevel();
int getExpLevel();
/**
* @since 1.7.10c
* @param level The new exp level you want to set
*/
public void setExpLevel(int level);
void setExpLevel(int level);
/**
* Requires pixelmon to be installed
* @since 1.7.10d
*/
public ScriptPixelmonPlayerData getPixelmonData();
public IBlock getLookingAtBlock(int maxDistance);
ScriptPixelmonPlayerData getPixelmonData();
public ITimers getTimers();
IBlock getLookingAtBlock(int maxDistance);
public void updatePlayerInventory();
ITimers getTimers();
public boolean checkGUIOpen();
void updatePlayerInventory();
ScriptDBCPlayer<T> getDBCPlayer();
boolean blocking();
IQuest[] getActiveQuests();
IContainer getOpenContainer();
void showCustomGui(ICustomGui gui);
ICustomGui getCustomGui();
void closeGui();
void showCustomOverlay(ICustomOverlay overlay);
void closeOverlay(int id);
IOverlayHandler getOverlays();
}
@@ -3,7 +3,7 @@
// (powered by FernFlower decompiler)
//
package noppes.npcs.scripted.interfaces;
package noppes.npcs.scripted.interfaces.gui;
public interface IButton extends ICustomGuiComponent {
int getWidth();
@@ -3,7 +3,11 @@
// (powered by FernFlower decompiler)
//
package noppes.npcs.scripted.interfaces;
package noppes.npcs.scripted.interfaces.gui;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.scripted.interfaces.item.IItemStack;
import noppes.npcs.scripted.interfaces.entity.IPlayer;
import java.util.List;
@@ -61,4 +65,14 @@ public interface ICustomGui {
void updateComponent(ICustomGuiComponent var1);
void update(IPlayer var1);
boolean getShowPlayerInv();
int getPlayerInvX();
int getPlayerInvY();
ICustomGui fromNBT(NBTTagCompound tag);
NBTTagCompound toNBT();
}
@@ -3,7 +3,10 @@
// (powered by FernFlower decompiler)
//
package noppes.npcs.scripted.interfaces;
package noppes.npcs.scripted.interfaces.gui;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.scripted.gui.ScriptGuiComponent;
public interface ICustomGuiComponent {
int getID();
@@ -23,4 +26,20 @@ public interface ICustomGuiComponent {
ICustomGuiComponent setHoverText(String var1);
ICustomGuiComponent setHoverText(String[] var1);
int getColor();
ICustomGuiComponent setColor(int color);
float getAlpha();
void setAlpha(float alpha);
float getRotation();
void setRotation(float rotation);
NBTTagCompound toNBT(NBTTagCompound nbt);
ScriptGuiComponent fromNBT(NBTTagCompound nbt);
}
@@ -3,9 +3,10 @@
// (powered by FernFlower decompiler)
//
package noppes.npcs.scripted.interfaces;
package noppes.npcs.scripted.interfaces.gui;
import net.minecraft.inventory.Slot;
import noppes.npcs.scripted.interfaces.item.IItemStack;
public interface IItemSlot extends ICustomGuiComponent {
boolean hasStack();
@@ -3,7 +3,7 @@
// (powered by FernFlower decompiler)
//
package noppes.npcs.scripted.interfaces;
package noppes.npcs.scripted.interfaces.gui;
public interface ILabel extends ICustomGuiComponent {
String getText();
@@ -19,4 +19,8 @@ public interface ILabel extends ICustomGuiComponent {
float getScale();
ILabel setScale(float var1);
boolean getShadow();
void setShadow(boolean shadow);
}
@@ -1,4 +1,4 @@
package noppes.npcs.scripted.interfaces;
package noppes.npcs.scripted.interfaces.gui;
public interface ILine extends ICustomGuiComponent {
int getX1();
@@ -3,7 +3,7 @@
// (powered by FernFlower decompiler)
//
package noppes.npcs.scripted.interfaces;
package noppes.npcs.scripted.interfaces.gui;
public interface IScroll extends ICustomGuiComponent {
int getWidth();
@@ -3,7 +3,7 @@
// (powered by FernFlower decompiler)
//
package noppes.npcs.scripted.interfaces;
package noppes.npcs.scripted.interfaces.gui;
public interface ITextField extends ICustomGuiComponent {
int getWidth();
@@ -3,7 +3,7 @@
// (powered by FernFlower decompiler)
//
package noppes.npcs.scripted.interfaces;
package noppes.npcs.scripted.interfaces.gui;
public interface ITexturedRect extends ICustomGuiComponent {
String getTexture();
@@ -3,10 +3,10 @@
// (powered by FernFlower decompiler)
//
package noppes.npcs.scripted.handler;
package noppes.npcs.scripted.interfaces.handler;
import noppes.npcs.scripted.interfaces.IWorld;
import noppes.npcs.scripted.interfaces.IEntity;
import noppes.npcs.scripted.interfaces.entity.IEntity;
public interface ICloneHandler {
IEntity spawn(double var1, double var3, double var5, int var7, String var8, IWorld var9);
@@ -3,10 +3,10 @@
// (powered by FernFlower decompiler)
//
package noppes.npcs.scripted.handler;
package noppes.npcs.scripted.interfaces.handler;
import noppes.npcs.scripted.handler.data.IDialog;
import noppes.npcs.scripted.handler.data.IDialogCategory;
import noppes.npcs.scripted.interfaces.handler.data.IDialog;
import noppes.npcs.scripted.interfaces.handler.data.IDialogCategory;
import java.util.List;
@@ -3,9 +3,9 @@
// (powered by FernFlower decompiler)
//
package noppes.npcs.scripted.handler;
package noppes.npcs.scripted.interfaces.handler;
import noppes.npcs.scripted.handler.data.IFaction;
import noppes.npcs.scripted.interfaces.handler.data.IFaction;
import java.util.List;
@@ -0,0 +1,18 @@
package noppes.npcs.scripted.interfaces.handler;
import noppes.npcs.scripted.interfaces.ISkinOverlay;
public interface IOverlayHandler {
void add(int id, ISkinOverlay overlay);
ISkinOverlay get(int id);
boolean has(int id);
boolean remove(int id);
int size();
void clear();
}
@@ -3,10 +3,10 @@
// (powered by FernFlower decompiler)
//
package noppes.npcs.scripted.handler;
package noppes.npcs.scripted.interfaces.handler;
import noppes.npcs.scripted.handler.data.IQuest;
import noppes.npcs.scripted.handler.data.IQuestCategory;
import noppes.npcs.scripted.interfaces.handler.data.IQuest;
import noppes.npcs.scripted.interfaces.handler.data.IQuestCategory;
import java.util.List;
@@ -3,11 +3,11 @@
// (powered by FernFlower decompiler)
//
package noppes.npcs.scripted.handler;
package noppes.npcs.scripted.interfaces.handler;
import java.util.List;
import net.minecraft.item.ItemStack;
import noppes.npcs.scripted.handler.data.IRecipe;
import noppes.npcs.scripted.interfaces.handler.data.IRecipe;
public interface IRecipeHandler {
List<IRecipe> getGlobalList();
@@ -3,9 +3,9 @@
// (powered by FernFlower decompiler)
//
package noppes.npcs.scripted.handler.data;
package noppes.npcs.scripted.interfaces.handler.data;
import noppes.npcs.scripted.interfaces.IPlayer;
import noppes.npcs.scripted.interfaces.entity.IPlayer;
public interface IAvailability {
boolean isAvailable(IPlayer var1);
@@ -3,7 +3,7 @@
// (powered by FernFlower decompiler)
//
package noppes.npcs.scripted.handler.data;
package noppes.npcs.scripted.interfaces.handler.data;
import java.util.List;
@@ -3,7 +3,7 @@
// (powered by FernFlower decompiler)
//
package noppes.npcs.scripted.handler.data;
package noppes.npcs.scripted.interfaces.handler.data;
import java.util.List;
@@ -3,7 +3,7 @@
// (powered by FernFlower decompiler)
//
package noppes.npcs.scripted.handler.data;
package noppes.npcs.scripted.interfaces.handler.data;
public interface IDialogOption {
int getSlot();
@@ -3,10 +3,10 @@
// (powered by FernFlower decompiler)
//
package noppes.npcs.scripted.handler.data;
package noppes.npcs.scripted.interfaces.handler.data;
import noppes.npcs.scripted.interfaces.ICustomNpc;
import noppes.npcs.scripted.interfaces.IPlayer;
import noppes.npcs.scripted.interfaces.entity.ICustomNpc;
import noppes.npcs.scripted.interfaces.entity.IPlayer;
public interface IFaction {
int getId();
@@ -3,10 +3,10 @@
// (powered by FernFlower decompiler)
//
package noppes.npcs.scripted.handler.data;
package noppes.npcs.scripted.interfaces.handler.data;
import noppes.npcs.scripted.interfaces.IContainer;
import noppes.npcs.scripted.interfaces.IPlayer;
import noppes.npcs.scripted.interfaces.entity.IPlayer;
public interface IQuest {
int getId();
@@ -3,7 +3,7 @@
// (powered by FernFlower decompiler)
//
package noppes.npcs.scripted.handler.data;
package noppes.npcs.scripted.interfaces.handler.data;
import java.util.List;
@@ -1,4 +1,4 @@
package noppes.npcs.scripted.handler.data;
package noppes.npcs.scripted.interfaces.handler.data;
public interface IQuestDialog extends IQuestInterface {
}
@@ -0,0 +1,4 @@
package noppes.npcs.scripted.interfaces.handler.data;
public interface IQuestInterface {
}
@@ -1,4 +1,4 @@
package noppes.npcs.scripted.handler.data;
package noppes.npcs.scripted.interfaces.handler.data;
public interface IQuestItem extends IQuestInterface {
void setLeaveItems(boolean leaveItems);
@@ -1,4 +1,4 @@
package noppes.npcs.scripted.handler.data;
package noppes.npcs.scripted.interfaces.handler.data;
public interface IQuestKill extends IQuestInterface {
void setTargetType(int type);
@@ -1,4 +1,4 @@
package noppes.npcs.scripted.handler.data;
package noppes.npcs.scripted.interfaces.handler.data;
public interface IQuestLocation extends IQuestInterface {
void setLocation1(String loc1);
@@ -3,7 +3,7 @@
// (powered by FernFlower decompiler)
//
package noppes.npcs.scripted.handler.data;
package noppes.npcs.scripted.interfaces.handler.data;
public interface IQuestObjective {
int getProgress();
@@ -3,7 +3,7 @@
// (powered by FernFlower decompiler)
//
package noppes.npcs.scripted.handler.data;
package noppes.npcs.scripted.interfaces.handler.data;
import net.minecraft.item.ItemStack;
@@ -0,0 +1,7 @@
package noppes.npcs.scripted.interfaces.item;
public interface IItemArmor {
int getArmorSlot();
String getArmorMaterial();
}
@@ -0,0 +1,5 @@
package noppes.npcs.scripted.interfaces.item;
public interface IItemBlock {
String getBlockName();
}
@@ -0,0 +1,15 @@
package noppes.npcs.scripted.interfaces.item;
public interface IItemBook {
String[] getText();
void setText(String[] var1);
String getAuthor();
void setAuthor(String var1);
String getTitle();
void setTitle(String var1);
}
@@ -0,0 +1,133 @@
package noppes.npcs.scripted.interfaces.item;
import cpw.mods.fml.common.eventhandler.Event;
import noppes.npcs.constants.EnumScriptType;
import noppes.npcs.controllers.ScriptContainer;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
public interface IItemCustom extends IItemStack {
void callScript(EnumScriptType type, Event event);
boolean isClient();
boolean getEnabled();
void setEnabled(boolean bo);
String getLanguage();
void setLanguage(String lang);
List<ScriptContainer> getScripts();
String noticeString();
Map<Long, String> getConsoleText();
void clearConsole();
String getTexture();
void setTexture(String var2);
int getArmorType();
void setIsTool(boolean isTool);
boolean isTool();
void setDigSpeed(int digSpeed);
int getDigSpeed();
void setMaxStackSize(int var1);
double getDurabilityValue();
void setDurabilityValue(float var1);
boolean getDurabilityShow();
void setDurabilityShow(boolean var1);
int getDurabilityColor();
void setDurabilityColor(int var1);
int getColor();
void setColor(int var1);
int getMaxItemUseDuration();
void setMaxItemUseDuration(int duration);
void setItemUseAction(int action);
int getItemUseAction();
int getEnchantability();
void setEnchantability(int enchantability);
void setRotation(float rotationX, float rotationY, float rotationZ);
void setRotationRate(float rotationXRate, float rotationYRate, float rotationZRate);
void setScale(float scaleX, float scaleY, float scaleZ);
void setTranslate(float translateX, float translateY, float translateZ);
void setRotationX(float rotationX);
void setRotationY(float rotationY);
void setRotationZ(float rotationZ);
void setRotationXRate(float rotationXRate);
void setRotationYRate(float rotationYRate);
void setRotationZRate(float rotationZRate);
void setScaleX(float scaleX);
void setScaleY(float scaleY);
void setScaleZ(float scaleZ);
void setTranslateX(float translateX);
void setTranslateY(float translateY);
void setTranslateZ(float translateZ);
float getRotationX();
float getRotationY();
float getRotationZ();
float getRotationXRate();
float getRotationYRate();
float getRotationZRate();
float getScaleX();
float getScaleY();
float getScaleZ();
float getTranslateX();
float getTranslateY();
float getTranslateZ();
}
@@ -1,115 +1,146 @@
package noppes.npcs.scripted.interfaces;
package noppes.npcs.scripted.interfaces.item;
import com.google.common.collect.Multimap;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagString;
import noppes.npcs.scripted.interfaces.INbt;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
public interface IItemStack {
public String getName();
String getName();
/**
* @return Returns the stacksize
*/
public int getStackSize();
int getStackSize();
/**
* @return Return whether or not the item has a custom name
*/
public boolean hasCustomName();
boolean hasCustomName();
/**
* @param name The custom name this item will get
*/
public void setCustomName(String name);
void setCustomName(String name);
/**
* @return Return the ingame displayed name. This is either the item name or the custom name if it has one.
*/
public String getDisplayName();
String 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();
String getItemName();
/**
* @param size The size of the itemstack. A number between 1 and 64
*/
public void setStackSize(int size);
void setStackSize(int size);
int getMaxStackSize();
/**
* @return Returns the item damage of this item. For tools this is the durability for other items the color and more.
*/
public int getItemDamage();
int 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);
void setItemDamage(int 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);
void setTag(String key, Object value);
/**
* @param key The key of the NBTTag
* @return Returns whether or not the key exists
*/
public boolean hasTag(String key);
boolean hasTag(String 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);
Object getTag(String key);
public INbt removeTags();
INbt removeTags();
public boolean isEnchanted();
boolean isEnchanted();
/**
* @since 1.7.10d
* @param id The enchantment id
* @return
*/
public boolean hasEnchant(int id);
boolean hasEnchant(int id);
void addEnchant(int id, int strength);
void setAttribute(String name, double value);
double getAttribute(String name);
String[] getLore();
boolean hasLore();
void setLore(String[] lore);
boolean hasAttribute(String name);
/**
* @since 1.7.10d
* @return Returns whether this item is a book
*/
public boolean isWrittenBook();
boolean isWrittenBook();
/**
* @since 1.7.10d
* @return Returns the books title
*/
public String getBookTitle();
String getBookTitle();
/**
* @since 1.7.10d
* @return Returns the books author
*/
public String getBookAuthor();
String getBookAuthor();
/**
* @since 1.7.10d
* @return If the item is a book, returns a string array with book pages
*/
public String[] getBookText();
String[] getBookText();
/**
* @return Returns whether or not this item is a block
*/
public boolean isBlock();
boolean isBlock();
public INbt getNbt();
INbt getNbt();
public INbt getItemNbt();
INbt getItemNbt();
/**
* No support is given for this method. Dont use if you dont know what you are doing.
* @return Minecraft ItemStack
*/
public ItemStack getMCItemStack();
ItemStack getMCItemStack();
NBTTagCompound getMCNbt();
void setMCNbt(NBTTagCompound compound);
}
@@ -0,0 +1,40 @@
package noppes.npcs.scripted.interfaces.overlay;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.scripted.interfaces.entity.IPlayer;
import java.util.List;
public interface ICustomOverlay {
int getID();
List<ICustomOverlayComponent> getComponents();
int getDefaultAlignment();
void setDefaultAlignment(int defaultAlignment);
IOverlayTexturedRect addTexturedRect(int id, String texture, int x, int y, int width, int height);
IOverlayTexturedRect addTexturedRect(int id, String texture, int x, int y, int width, int height, int textureX, int textureY);
IOverlayLabel addLabel(int id, String label, int x, int y, int width, int height);
IOverlayLabel addLabel(int id, String label, int x, int y, int width, int height, int color);
IOverlayLine addLine(int id, int x1, int y1, int x2, int y2, int color, int thickness);
IOverlayLine addLine(int id, int x1, int y1, int x2, int y2);
ICustomOverlayComponent getComponent(int componentID);
void removeComponent(int componentID);
void updateComponent(ICustomOverlayComponent component);
void update(IPlayer player);
ICustomOverlay fromNBT(NBTTagCompound tag);
NBTTagCompound toNBT();
}
@@ -1,4 +1,7 @@
package noppes.npcs.scripted.interfaces;
package noppes.npcs.scripted.interfaces.overlay;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.scripted.overlay.ScriptOverlayComponent;
public interface ICustomOverlayComponent {
int getID();
@@ -26,4 +29,8 @@ public interface ICustomOverlayComponent {
float getRotation();
void setRotation(float rotation);
NBTTagCompound toNBT(NBTTagCompound nbt);
ScriptOverlayComponent fromNBT(NBTTagCompound nbt);
}
@@ -1,4 +1,4 @@
package noppes.npcs.scripted.interfaces;
package noppes.npcs.scripted.interfaces.overlay;
public interface IOverlayLabel extends ICustomOverlayComponent {
String getText();
@@ -14,4 +14,8 @@ public interface IOverlayLabel extends ICustomOverlayComponent {
float getScale();
IOverlayLabel setScale(float var1);
boolean getShadow();
void setShadow(boolean shadow);
}
Loaded 100 of 300 files, more files were not shown because too many files have changed in this diff. Show more