Merge remote-tracking branch 'refs/remotes/origin/packet' into animation-events-2

# Conflicts:
#	src/api
#	src/main/java/noppes/npcs/CommonProxy.java
#	src/main/java/noppes/npcs/ServerEventsHandler.java
#	src/main/java/noppes/npcs/client/PacketHandlerClient.java
#	src/main/java/noppes/npcs/client/gui/global/GuiNPCManageAnimations.java
#	src/main/java/noppes/npcs/controllers/data/AnimationData.java
This commit is contained in:
luisc committed 2025-02-11 16:53:36 -06:00
commit 00af353e65
602 files changed
+29702 -6562

No files matched your search

@@ -3,6 +3,8 @@ package noppes.npcs.controllers.data;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import kamkeel.npcs.network.PacketHandler;
import kamkeel.npcs.network.packets.data.UpdateAnimationsPacket;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
@@ -18,7 +20,6 @@ import noppes.npcs.api.entity.IEntity;
import noppes.npcs.api.handler.data.IAnimation;
import noppes.npcs.api.handler.data.IAnimationData;
import noppes.npcs.constants.EnumAnimationPart;
import noppes.npcs.constants.EnumPacketClient;
import noppes.npcs.controllers.PlayerDataController;
import noppes.npcs.entity.EntityNPCInterface;
import noppes.npcs.scripted.NpcAPI;
@@ -228,7 +229,7 @@ public class AnimationData implements IAnimationData {
data.setInteger("EntityId", entity.getEntityId());
}
Server.sendData((EntityPlayerMP) ((PlayerData) parent).player, EnumPacketClient.UPDATE_ANIMATIONS, data, entity.getCommandSenderName());
PacketHandler.Instance.sendToPlayer(new UpdateAnimationsPacket(data, entity.getCommandSenderName()), (EntityPlayerMP) ((PlayerData) parent).player);
return true;
}
@@ -1,8 +1,11 @@
package noppes.npcs.controllers.data;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.MathHelper;
import net.minecraft.util.StatCollector;
import noppes.npcs.ICompatibilty;
import noppes.npcs.VersionCompatibility;
import noppes.npcs.api.entity.IPlayer;
@@ -13,6 +16,9 @@ import noppes.npcs.controllers.PlayerQuestController;
import noppes.npcs.controllers.QuestController;
import noppes.npcs.scripted.CustomNPCsException;
import java.util.ArrayList;
import java.util.List;
public class Availability implements ICompatibilty, IAvailability {
public int version = VersionCompatibility.ModRev;
@@ -124,6 +130,31 @@ public class Availability implements ICompatibilty, IAvailability {
compound.setInteger("AvailabilityMinPlayerLevel", minPlayerLevel);
return compound;
}
public boolean isDefault() {
return dialogAvailable == EnumAvailabilityDialog.Always &&
dialog2Available == EnumAvailabilityDialog.Always &&
dialog3Available == EnumAvailabilityDialog.Always &&
dialog4Available == EnumAvailabilityDialog.Always &&
dialogId == -1 &&
questAvailable == EnumAvailabilityQuest.Always &&
quest2Available == EnumAvailabilityQuest.Always &&
quest3Available == EnumAvailabilityQuest.Always &&
quest4Available == EnumAvailabilityQuest.Always &&
questId == -1 &&
factionAvailable == EnumAvailabilityFactionType.Always &&
faction2Available == EnumAvailabilityFactionType.Always &&
factionId == -1 &&
faction2Id == -1 &&
factionStance == EnumAvailabilityFaction.Friendly &&
faction2Stance == EnumAvailabilityFaction.Friendly &&
daytime == EnumDayTime.Always &&
minPlayerLevel == 0;
}
public void setFactionAvailability(int value) {
factionAvailable = EnumAvailabilityFactionType.values()[value];
}
@@ -177,6 +208,64 @@ public class Availability implements ICompatibilty, IAvailability {
return true;
}
@SideOnly(Side.CLIENT)
public List<String> isAvailableText(EntityPlayer player) {
List<String> errors = new ArrayList<String>();
// Check daytime conditions.
if (daytime == EnumDayTime.Day) {
long time = player.worldObj.getWorldTime() % 24000;
if (time > 12000) {
errors.add(StatCollector.translateToLocal("availability.error.day"));
}
} else if (daytime == EnumDayTime.Night) {
long time = player.worldObj.getWorldTime() % 24000;
if (time < 12000) {
errors.add(StatCollector.translateToLocal("availability.error.night"));
}
}
// Check dialog conditions.
if (!dialogAvailable(dialogId, dialogAvailable, player)) {
errors.add(StatCollector.translateToLocalFormatted("availability.error.dialog", dialogAvailable.toString(), dialogId));
}
if (!dialogAvailable(dialog2Id, dialog2Available, player)) {
errors.add(StatCollector.translateToLocalFormatted("availability.error.dialog", dialog2Available.toString(), dialog2Id));
}
if (!dialogAvailable(dialog3Id, dialog3Available, player)) {
errors.add(StatCollector.translateToLocalFormatted("availability.error.dialog", dialog3Available.toString(), dialog3Id));
}
if (!dialogAvailable(dialog4Id, dialog4Available, player)) {
errors.add(StatCollector.translateToLocalFormatted("availability.error.dialog", dialog4Available.toString(), dialog4Id));
}
// Check quest conditions.
if (!questAvailable(questId, questAvailable, player)) {
errors.add(StatCollector.translateToLocalFormatted("availability.error.quest", questAvailable.toString(), questId));
}
if (!questAvailable(quest2Id, quest2Available, player)) {
errors.add(StatCollector.translateToLocalFormatted("availability.error.quest", quest2Available.toString(), quest2Id));
}
if (!questAvailable(quest3Id, quest3Available, player)) {
errors.add(StatCollector.translateToLocalFormatted("availability.error.quest", quest3Available.toString(), quest3Id));
}
if (!questAvailable(quest4Id, quest4Available, player)) {
errors.add(StatCollector.translateToLocalFormatted("availability.error.quest", quest4Available.toString(), quest4Id));
}
// Check faction conditions.
if (!factionAvailable(factionId, factionStance, factionAvailable, player)) {
errors.add(StatCollector.translateToLocalFormatted("availability.error.faction", factionAvailable.toString(), factionStance.toString(), factionId));
}
if (!factionAvailable(faction2Id, faction2Stance, faction2Available, player)) {
errors.add(StatCollector.translateToLocalFormatted("availability.error.faction", faction2Available.toString(), faction2Stance.toString(), faction2Id));
}
if (player.experienceLevel < minPlayerLevel) {
errors.add(StatCollector.translateToLocalFormatted("availability.error.xp", minPlayerLevel));
}
return errors;
}
private boolean factionAvailable(int id, EnumAvailabilityFaction stance, EnumAvailabilityFactionType available, EntityPlayer player) {
if(available == EnumAvailabilityFactionType.Always)
return true;
@@ -1,5 +1,6 @@
package noppes.npcs.controllers.data;
import kamkeel.npcs.network.packets.data.large.GuiDataPacket;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.Container;
@@ -9,9 +10,7 @@ import net.minecraft.nbt.NBTTagList;
import noppes.npcs.NBTTags;
import noppes.npcs.NoppesUtilServer;
import noppes.npcs.NpcMiscInventory;
import noppes.npcs.Server;
import noppes.npcs.constants.EnumGuiType;
import noppes.npcs.constants.EnumPacketClient;
import noppes.npcs.containers.ContainerNPCBankInterface;
import noppes.npcs.controllers.BankController;
import noppes.npcs.entity.EntityNPCInterface;
@@ -108,7 +107,8 @@ public class BankData {
if (container != null)
container.setCurrency(item);
}
Server.sendDataChecked((EntityPlayerMP) player, EnumPacketClient.GUI_DATA, compound);
GuiDataPacket.sendGuiData((EntityPlayerMP) player, compound);
}
private ContainerNPCBankInterface getContainer(EntityPlayer player){
Container con = player.openContainer;
@@ -0,0 +1,318 @@
package noppes.npcs.controllers.data;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.Constants;
import noppes.npcs.NoppesUtilServer;
import noppes.npcs.api.entity.IPlayer;
import noppes.npcs.api.handler.data.ICustomEffect;
import noppes.npcs.controllers.CustomEffectController;
import noppes.npcs.scripted.event.PlayerEvent;
import java.util.function.Consumer;
public class CustomEffect implements ICustomEffect {
public int id = -1;
public String name = "";
public boolean lossOnDeath = true;
public int length = 30;
// Must be a multiple of 10
public int everyXTick = 20;
public String icon = "";
// CustomNpcPlusDBC.ID + ":textures/gui/icons.png";
public int iconX = 0, iconY = 0;
/**
* Experimental script stuff.
*/
public Consumer<PlayerEvent.EffectEvent.Added> onAddedConsumer;
public Consumer<PlayerEvent.EffectEvent.Ticked> onTickConsumer;
public Consumer<PlayerEvent.EffectEvent.Removed> onRemovedConsumer;
public String menuName = "§aNEW EFFECT";
public int width = 16, height = 16;
public int index = 0;
public CustomEffect() {}
public CustomEffect(int id) {
this.id = id;
}
public CustomEffect(int id, String name) {
this(id);
this.name = name;
}
@Override
public int getID() {
return this.id;
}
@Override
public String getName() {
return this.name;
}
@Override
public void setMenuName(String name) {
if (name != null && !name.isEmpty())
this.menuName = name.replaceAll("&", "§");
}
@Override
public String getMenuName() {
return menuName;
}
@Override
public void setName(String name) {
if (name != null && !name.isEmpty())
this.name = name;
}
@Override
public String getIcon() {
return icon;
}
@Override
public void setIcon(String icon) {
this.icon = icon;
}
@Override
public int getEveryXTick() {
return everyXTick;
}
@Override
public void setEveryXTick(int everyXTick) {
if (everyXTick < 10)
everyXTick = 10;
int remainder = everyXTick % 10;
if (remainder >= 5)
everyXTick += 10 - remainder;
else
everyXTick -= remainder;
this.everyXTick = everyXTick;
}
@Override
public int getIconX() {
return iconX;
}
@Override
public void setIconX(int iconX) {
this.iconX = iconX;
}
@Override
public int getIconY() {
return iconY;
}
@Override
public void setIconY(int iconY) {
this.iconY = iconY;
}
@Override
public int getWidth() {
return this.width;
}
@Override
public int getHeight() {
return this.height;
}
@Override
public void setWidth(int width) {
this.width = width;
}
@Override
public void setHeight(int height) {
this.height = height;
}
@Override
public boolean isLossOnDeath() {
return lossOnDeath;
}
@Override
public void setLossOnDeath(boolean lossOnDeath) {
this.lossOnDeath = lossOnDeath;
}
@Override
public ICustomEffect save() {
return CustomEffectController.getInstance().saveEffect(this);
}
@Override
public void setID(int id) {
this.id = id;
}
@Override
public int getIndex() {
return this.index;
}
public void onAdded(Consumer<PlayerEvent.EffectEvent.Added> function) {
onAddedConsumer = function;
}
public void onTick(Consumer<PlayerEvent.EffectEvent.Ticked> function) {
onTickConsumer = function;
}
public void onRemoved(Consumer<PlayerEvent.EffectEvent.Removed> function) {
onRemovedConsumer = function;
}
public void onAdded(EntityPlayer player, PlayerEffect playerEffect) {
IPlayer iPlayer = NoppesUtilServer.getIPlayer(player);
PlayerEvent.EffectEvent.Added event = new PlayerEvent.EffectEvent.Added(iPlayer, playerEffect);
if (onAddedConsumer != null) onAddedConsumer.accept(event);
EffectScript script = getScriptHandler();
if (script == null) {
return;
}
script.callScript(EffectScript.ScriptType.OnAdd, event);
}
public void onTick(EntityPlayer player, PlayerEffect playerEffect) {
IPlayer iPlayer = NoppesUtilServer.getIPlayer(player);
PlayerEvent.EffectEvent.Ticked event = new PlayerEvent.EffectEvent.Ticked(iPlayer, playerEffect);
if (onTickConsumer != null) {
onTickConsumer.accept(event);
}
EffectScript script = getScriptHandler();
if (script == null) {
return;
}
script.callScript(EffectScript.ScriptType.OnTick, event);
}
public void onRemoved(EntityPlayer player, PlayerEffect playerEffect, PlayerEvent.EffectEvent.ExpirationType type) {
IPlayer iPlayer = NoppesUtilServer.getIPlayer(player);
PlayerEvent.EffectEvent.Removed event = new PlayerEvent.EffectEvent.Removed(iPlayer, playerEffect, type);
if (onRemovedConsumer != null) {
onRemovedConsumer.accept(event);
}
EffectScript script = getScriptHandler();
if (script == null) {
return;
}
script.callScript(EffectScript.ScriptType.OnRemove, event);
}
public NBTTagCompound writeToNBT(boolean saveScripts) {
NBTTagCompound compound = new NBTTagCompound();
compound.setInteger("ID", id);
compound.setString("name", name);
compound.setString("menuName", menuName);
compound.setInteger("length", length);
compound.setInteger("everyXTick", everyXTick);
compound.setInteger("iconX", iconX);
compound.setInteger("iconY", iconY);
compound.setInteger("iconWidth", width);
compound.setInteger("iconHeight", height);
compound.setString("icon", icon);
compound.setBoolean("lossOnDeath", lossOnDeath);
// if (saveScripts && scriptContainer != null) {
if (saveScripts) {
NBTTagCompound scriptData = new NBTTagCompound();
EffectScript handler = getScriptHandler();
if (handler != null)
handler.writeToNBT(scriptData);
compound.setTag("ScriptData", scriptData);
}
return compound;
}
public void readFromNBT(NBTTagCompound compound) {
if (compound.hasKey("ID"))
id = compound.getInteger("ID");
else
id = CustomEffectController.Instance.getUnusedId();
name = compound.getString("name");
if (compound.hasKey("menuName", Constants.NBT.TAG_STRING))
menuName = compound.getString("menuName");
else
menuName = name;
length = compound.getInteger("length");
everyXTick = compound.getInteger("everyXTick");
iconX = compound.getInteger("iconX");
iconY = compound.getInteger("iconY");
if (compound.hasKey("iconWidth", Constants.NBT.TAG_INT))
width = compound.getInteger("iconWidth");
else
width = 16;
if (compound.hasKey("iconHeight", Constants.NBT.TAG_INT))
height = compound.getInteger("iconHeight");
else
height = 16;
icon = compound.getString("icon");
lossOnDeath = compound.getBoolean("lossOnDeath");
if (compound.hasKey("ScriptData", Constants.NBT.TAG_COMPOUND)) {
EffectScript handler = new EffectScript();
handler.readFromNBT(compound.getCompoundTag("ScriptData"));
setScriptHandler(handler);
}
}
public CustomEffect cloneEffect() {
CustomEffect newEffect = new CustomEffect();
newEffect.readFromNBT(this.writeToNBT(true));
newEffect.id = -1;
return newEffect;
}
public EffectScript getScriptHandler() {
return CustomEffectController.getInstance().customEffectScriptHandlers.get(this.id);
}
public void setScriptHandler(EffectScript handler) {
CustomEffectController.getInstance().customEffectScriptHandlers.put(this.id, handler);
}
public EffectScript getOrCreateScriptHandler() {
EffectScript data = getScriptHandler();
if (data == null)
setScriptHandler(data =new EffectScript());
return data;
}
public void runEffect(EntityPlayer player, PlayerEffect playerEffect) {
if (player.ticksExisted % everyXTick == 0) {
onTick(player, playerEffect);
}
}
}
@@ -18,13 +18,13 @@ public class DataTransform {
public NBTTagCompound stats;
public NBTTagCompound role;
public NBTTagCompound job;
public boolean hasDisplay, hasAi, hasAdvanced, hasInv, hasStats, hasRole, hasJob, isActive;
private EntityNPCInterface npc;
public boolean editingModus = false;
public DataTransform(EntityNPCInterface npc){
this.npc = npc;
}
@@ -47,11 +47,11 @@ public class DataTransform {
compound.setTag("TransformRole", role);
if(hasJob)
compound.setTag("TransformJob", job);
return compound;
}
public Object writeOptions(NBTTagCompound compound) {
public NBTTagCompound writeOptions(NBTTagCompound compound) {
compound.setBoolean("TransformHasDisplay", hasDisplay);
compound.setBoolean("TransformHasAI", hasAi);
compound.setBoolean("TransformHasAdvanced", hasAdvanced);
@@ -62,20 +62,20 @@ public class DataTransform {
compound.setBoolean("TransformEditingModus", editingModus);
return compound;
}
public void readToNBT(NBTTagCompound compound) {
isActive = compound.getBoolean("TransformIsActive");
readOptions(compound);
display = hasDisplay?compound.getCompoundTag("TransformDisplay"): getDisplay();
ai = hasAi?compound.getCompoundTag("TransformAI"): npc.ai.writeToNBT(new NBTTagCompound());
ai = hasAi?compound.getCompoundTag("TransformAI"): npc.ais.writeToNBT(new NBTTagCompound());
advanced = hasAdvanced?compound.getCompoundTag("TransformAdvanced"): getAdvanced();
inv = hasInv?compound.getCompoundTag("TransformInv"): npc.inventory.writeEntityToNBT(new NBTTagCompound());
stats = hasStats?compound.getCompoundTag("TransformStats"): npc.stats.writeToNBT(new NBTTagCompound());
job = hasJob?compound.getCompoundTag("TransformJob"): getJob();
role = hasRole?compound.getCompoundTag("TransformRole"): getRole();
}
public NBTTagCompound getJob() {
NBTTagCompound compound = new NBTTagCompound();
@@ -83,17 +83,17 @@ public class DataTransform {
if (npc.advanced.job != EnumJobType.None && npc.jobInterface != null) {
npc.jobInterface.writeToNBT(compound);
}
return compound;
}
public NBTTagCompound getRole() {
NBTTagCompound compound = new NBTTagCompound();
compound.setInteger("Role", npc.advanced.role.ordinal());
compound.setInteger("Role", npc.advanced.role.ordinal());
if (npc.advanced.role != EnumRoleType.None && npc.roleInterface != null) {
npc.roleInterface.writeToNBT(compound);
}
return compound;
}
@@ -102,7 +102,7 @@ public class DataTransform {
if(npc instanceof EntityCustomNpc){
compound.setTag("ModelData", ((EntityCustomNpc)npc).modelData.writeToNBT());
}
return compound;
}
@@ -119,7 +119,7 @@ public class DataTransform {
npc.advanced.job = jopType;
npc.advanced.role = roleType;
return compound;
}
@@ -132,7 +132,7 @@ public class DataTransform {
boolean hadStats = hasStats;
boolean hadRole = hasRole;
boolean hadJob = hasJob;
hasDisplay = compound.getBoolean("TransformHasDisplay");
hasAi = compound.getBoolean("TransformHasAI");
hasAdvanced = compound.getBoolean("TransformHasAdvanced");
@@ -146,7 +146,7 @@ public class DataTransform {
display = getDisplay();
}
if(hasAi && !hadAI)
ai = npc.ai.writeToNBT(new NBTTagCompound());
ai = npc.ais.writeToNBT(new NBTTagCompound());
if(hasStats && !hadStats)
stats = npc.stats.writeToNBT(new NBTTagCompound());
if(hasInv && !hadInv)
@@ -158,7 +158,7 @@ public class DataTransform {
if(hasRole && !hadRole)
role = getRole();
}
public boolean isValid(){
return hasAdvanced || hasAi || hasDisplay || hasInv || hasStats || hasJob || hasRole;
}
@@ -166,14 +166,14 @@ public class DataTransform {
public NBTTagCompound processAdvanced(NBTTagCompound compoundAdv,
NBTTagCompound compoundRole, NBTTagCompound compoundJob) {
if(hasAdvanced)
compoundAdv = advanced;
if(hasRole)
compoundRole = role;
if(hasJob)
compoundJob = job;
Set<String> names = compoundRole.func_150296_c();
for(String name : names)
compoundAdv.setTag(name, compoundRole.getTag(name));
@@ -181,10 +181,10 @@ public class DataTransform {
names = compoundJob.func_150296_c();
for(String name : names)
compoundAdv.setTag(name, compoundJob.getTag(name));
return compoundAdv;
}
public void transform(boolean isActive){
if(this.isActive == isActive)
return;
@@ -205,14 +205,14 @@ public class DataTransform {
NBTTagCompound compoundAdv = getAdvanced();
NBTTagCompound compoundRole = getRole();
NBTTagCompound compoundJob = getJob();
NBTTagCompound compound = processAdvanced(compoundAdv, compoundRole, compoundJob);
npc.advanced.readToNBT(compound);
if (npc.advanced.role != EnumRoleType.None && npc.roleInterface != null)
if (npc.advanced.role != EnumRoleType.None && npc.roleInterface != null)
npc.roleInterface.readFromNBT(NBTTags.NBTMerge(compoundRole, compound));
if (npc.advanced.job != EnumJobType.None && npc.jobInterface != null)
npc.jobInterface.readFromNBT(NBTTags.NBTMerge(compoundJob, compound));
npc.jobInterface.readFromNBT(NBTTags.NBTMerge(compoundJob, compound));
if(hasAdvanced)
advanced = compoundAdv;
if(hasRole)
@@ -221,8 +221,8 @@ public class DataTransform {
job = compoundJob;
}
if(hasAi){
NBTTagCompound compound = npc.ai.writeToNBT(new NBTTagCompound());
npc.ai.readToNBT(NBTTags.NBTMerge(compound, ai));
NBTTagCompound compound = npc.ais.writeToNBT(new NBTTagCompound());
npc.ais.readToNBT(NBTTags.NBTMerge(compound, ai));
ai = compound;
npc.setCurrentAnimation(EnumAnimation.NONE);
}
@@ -0,0 +1,37 @@
package noppes.npcs.controllers.data;
public class EffectKey {
private final int id;
private final int index;
public EffectKey(int key1, int key2) {
this.id = key1;
this.index = key2;
}
public int getId() {
return id;
}
public int getIndex() {
return index;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof EffectKey)) return false;
EffectKey that = (EffectKey) o;
return id == that.id && index == that.index;
}
@Override
public int hashCode() {
return 31 * id + index;
}
@Override
public String toString() {
return "EffectKey{" + "key1=" + id + ", key2=" + index + '}';
}
}
@@ -0,0 +1,181 @@
package noppes.npcs.controllers.data;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.Event;
import io.netty.buffer.ByteBuf;
import kamkeel.npcs.util.ByteBufUtils;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.Constants;
import noppes.npcs.config.ConfigScript;
import noppes.npcs.controllers.ScriptContainer;
import noppes.npcs.controllers.ScriptController;
import noppes.npcs.scripted.NpcAPI;
import noppes.npcs.scripted.event.PlayerEvent;
import javax.script.ScriptEngine;
import java.io.IOException;
import java.util.*;
public class EffectScript implements IScriptHandler {
public ScriptContainer container;
public String scriptLanguage = "ECMAScript";
public boolean enabled = false;
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
compound.setString("ScriptLanguage", scriptLanguage);
compound.setBoolean("ScriptEnabled", enabled);
if (container != null)
compound.setTag("ScriptContent", container.writeToNBT(new NBTTagCompound()));
return compound;
}
public EffectScript readFromNBT(NBTTagCompound compound) {
scriptLanguage = compound.getString("ScriptLanguage");
enabled = compound.getBoolean("ScriptEnabled");
if (compound.hasKey("ScriptContent", Constants.NBT.TAG_COMPOUND)) {
container = new ScriptContainer(this);
container.readFromNBT(compound.getCompoundTag("ScriptContent"));
}
return this;
}
public void callScript(ScriptType type, PlayerEvent.EffectEvent event) {
callScript(type.function, event);
}
public boolean isEnabled() {
return this.enabled && ScriptController.HasStart && container != null && ConfigScript.ScriptingEnabled;
}
@Override
public void callScript(String s, Event event) {
if (!this.isEnabled()) {
return;
}
ScriptEngine engine = container.engine;
engine.put("API", NpcAPI.Instance());
for (Map.Entry<String, Object> engineObjects : NpcAPI.engineObjects.entrySet()) {
engine.put(engineObjects.getKey(), engineObjects.getValue());
}
container.run(s, event);
}
@Override
public boolean isClient() {
return FMLCommonHandler.instance().getEffectiveSide().isClient();
}
@Override
public boolean getEnabled() {
return this.enabled;
}
@Override
public void setEnabled(boolean b) {
this.enabled = b;
}
@Override
public String getLanguage() {
return this.scriptLanguage;
}
@Override
public void setLanguage(String s) {
this.scriptLanguage = s;
}
@Override
public void setScripts(List<ScriptContainer> list) {
if (list == null || list.isEmpty()) {
container = null;
return;
}
container = list.get(0);
}
@Override
public List<ScriptContainer> getScripts() {
if (container == null)
return new ArrayList<>();
return Collections.singletonList(container);
}
@Override
public String noticeString() {
return "";
}
@Override
public Map<Long, String> getConsoleText() {
TreeMap<Long, String> map = new TreeMap();
int tab = 0;
Iterator var3 = this.getScripts().iterator();
while(var3.hasNext()) {
ScriptContainer script = (ScriptContainer)var3.next();
++tab;
Iterator var5 = script.console.entrySet().iterator();
while(var5.hasNext()) {
Map.Entry<Long, String> longStringEntry = (Map.Entry)var5.next();
map.put(longStringEntry.getKey(), " tab " + tab + ":\n" + (String)longStringEntry.getValue());
}
}
return map;
}
@Override
public void clearConsole() {
Iterator var1 = this.getScripts().iterator();
while(var1.hasNext()) {
ScriptContainer script = (ScriptContainer)var1.next();
script.console.clear();
}
}
public void saveScript(ByteBuf buffer) throws IOException {
int tab = buffer.readInt();
int totalScripts = buffer.readInt();
if (totalScripts == 0) {
this.container = null;
}
if (tab == 0) {
NBTTagCompound tabCompound = ByteBufUtils.readNBT(buffer);
ScriptContainer script = new ScriptContainer(this);
script.readFromNBT(tabCompound);
this.container = script;
} else {
NBTTagCompound compound = ByteBufUtils.readNBT(buffer);
this.setLanguage(compound.getString("ScriptLanguage"));
if (!ScriptController.Instance.languages.containsKey(this.getLanguage())) {
if (!ScriptController.Instance.languages.isEmpty()) {
this.setLanguage((String) ScriptController.Instance.languages.keySet().toArray()[0]);
} else {
this.setLanguage("ECMAScript");
}
}
this.setEnabled(compound.getBoolean("ScriptEnabled"));
}
}
public enum ScriptType {
OnAdd("onAdded"),
OnTick("onTick"),
OnRemove("onRemove");
public final String function;
ScriptType(String functionName) {
this.function = functionName;
}
}
}
@@ -0,0 +1,30 @@
package noppes.npcs.controllers.data;
public class LinkedItemData {
// Utilitzed within a Scripted Item
//
public int version = 1;
public boolean durabilityShow = false;
public double durabilityValue = 1.0D;
public int durabilityColor = -1;
public int itemColor = 0x8B4513;
public int stackSize = 64;
public int maxItemUseDuration = 20;
public int itemUseAction = 0;
public boolean isNormalItem = false;
public boolean isTool = false;
public int digSpeed = 1;
public int armorType = -2; //-2: Fits in no armor slot, -1: Fits in all slots, 0 - 4: Fits in Head -> Boots slot respectively
public int enchantability;
public String texture = "minecraft:textures/items/iron_pickaxe.png";
public float translateX, translateY, translateZ;
public float scaleX = 1.0F, scaleY = 1.0F, scaleZ = 1.0F;
public float rotationX, rotationY, rotationZ;
public float rotationXRate, rotationYRate, rotationZRate;
}
@@ -0,0 +1,165 @@
package noppes.npcs.controllers.data;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.Event;
import io.netty.buffer.ByteBuf;
import kamkeel.npcs.util.ByteBufUtils;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.Constants;
import noppes.npcs.config.ConfigScript;
import noppes.npcs.controllers.ScriptContainer;
import noppes.npcs.controllers.ScriptController;
import noppes.npcs.scripted.NpcAPI;
import javax.script.ScriptEngine;
import java.io.IOException;
import java.util.*;
public class LinkedItemScript implements IScriptHandler {
public ScriptContainer container;
public String scriptLanguage = "ECMAScript";
public boolean enabled = false;
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
compound.setString("ScriptLanguage", scriptLanguage);
compound.setBoolean("ScriptEnabled", enabled);
if (container != null)
compound.setTag("ScriptContent", container.writeToNBT(new NBTTagCompound()));
return compound;
}
public LinkedItemScript readFromNBT(NBTTagCompound compound) {
scriptLanguage = compound.getString("ScriptLanguage");
enabled = compound.getBoolean("ScriptEnabled");
if (compound.hasKey("ScriptContent", Constants.NBT.TAG_COMPOUND)) {
container = new ScriptContainer(this);
container.readFromNBT(compound.getCompoundTag("ScriptContent"));
}
return this;
}
public boolean isEnabled() {
return this.enabled && ScriptController.HasStart && container != null && ConfigScript.ScriptingEnabled;
}
@Override
public void callScript(String s, Event event) {
if (!this.isEnabled()) {
return;
}
ScriptEngine engine = container.engine;
engine.put("API", NpcAPI.Instance());
for (Map.Entry<String, Object> engineObjects : NpcAPI.engineObjects.entrySet()) {
engine.put(engineObjects.getKey(), engineObjects.getValue());
}
container.run(s, event);
}
@Override
public boolean isClient() {
return FMLCommonHandler.instance().getEffectiveSide().isClient();
}
@Override
public boolean getEnabled() {
return this.enabled;
}
@Override
public void setEnabled(boolean b) {
this.enabled = b;
}
@Override
public String getLanguage() {
return this.scriptLanguage;
}
@Override
public void setLanguage(String s) {
this.scriptLanguage = s;
}
@Override
public void setScripts(List<ScriptContainer> list) {
if (list == null || list.isEmpty()) {
container = null;
return;
}
container = list.get(0);
}
@Override
public List<ScriptContainer> getScripts() {
if (container == null)
return new ArrayList<>();
return Collections.singletonList(container);
}
@Override
public String noticeString() {
return "";
}
@Override
public Map<Long, String> getConsoleText() {
TreeMap<Long, String> map = new TreeMap();
int tab = 0;
Iterator var3 = this.getScripts().iterator();
while(var3.hasNext()) {
ScriptContainer script = (ScriptContainer)var3.next();
++tab;
Iterator var5 = script.console.entrySet().iterator();
while(var5.hasNext()) {
Map.Entry<Long, String> longStringEntry = (Map.Entry)var5.next();
map.put(longStringEntry.getKey(), " tab " + tab + ":\n" + (String)longStringEntry.getValue());
}
}
return map;
}
@Override
public void clearConsole() {
Iterator var1 = this.getScripts().iterator();
while(var1.hasNext()) {
ScriptContainer script = (ScriptContainer)var1.next();
script.console.clear();
}
}
public void saveScript(ByteBuf buffer) throws IOException {
int tab = buffer.readInt();
int totalScripts = buffer.readInt();
if (totalScripts == 0) {
this.container = null;
}
if (tab == 0) {
NBTTagCompound tabCompound = ByteBufUtils.readNBT(buffer);
ScriptContainer script = new ScriptContainer(this);
script.readFromNBT(tabCompound);
this.container = script;
} else {
NBTTagCompound compound = ByteBufUtils.readNBT(buffer);
this.setLanguage(compound.getString("ScriptLanguage"));
if (!ScriptController.Instance.languages.containsKey(this.getLanguage())) {
if (!ScriptController.Instance.languages.isEmpty()) {
this.setLanguage((String) ScriptController.Instance.languages.keySet().toArray()[0]);
} else {
this.setLanguage("ECMAScript");
}
}
this.setEnabled(compound.getBoolean("ScriptEnabled"));
}
}
}
@@ -1,54 +1,165 @@
package noppes.npcs.controllers.data;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import noppes.npcs.api.handler.data.IMagic;
import noppes.npcs.controllers.MagicController;
import java.util.HashMap;
import java.util.Map;
public class Magic implements IMagic {
public String name = "";
public int color = Integer.parseInt("FF00", 16);
public String name = "";
public int color = Integer.parseInt("FF00", 16);
public int id = -1;
public int id = -1;
public int index;
public int priority;
public Magic(){}
// Icon as an ItemStack or as a texture file
public ItemStack iconItem = null;
public String iconTexture = "";
public Magic(int id, String name, int color){
this.name = name;
this.color = color;
this.id = id;
}
public static String formatName(String name){
name = name.toLowerCase().trim();
return name.substring(0, 1).toUpperCase() + name.substring(1);
}
public void readNBT(NBTTagCompound compound){
// Weaknesses mapping: key = magic ID this magic is weak against,
// value = extra damage percentage (as a fraction, e.g. 0.2 for 20% extra damage)
public Map<Integer, Float> weaknesses = new HashMap<Integer, Float>();
public Magic() {}
public Magic(int id, String name, int color) {
this.name = name;
this.color = color;
this.id = id;
}
public Magic(int id, String name, int color, int index, int priority) {
this.name = name;
this.color = color;
this.id = id;
this.index = index;
this.priority = priority;
}
public static String formatName(String name) {
name = name.toLowerCase().trim();
return name.substring(0, 1).toUpperCase() + name.substring(1);
}
public void readNBT(NBTTagCompound compound) {
name = compound.getString("Name");
color = compound.getInteger("Color");
id = compound.getInteger("Slot");
}
public void writeNBT(NBTTagCompound compound){
compound.setInteger("Slot", id);
compound.setString("Name", name);
compound.setInteger("Color", color);
}
index = compound.getInteger("Index");
priority = compound.getInteger("Priority");
public int getId() {
return this.id;
}
if(compound.hasKey("IconItem")){
NBTTagCompound itemTag = compound.getCompoundTag("IconItem");
iconItem = ItemStack.loadItemStackFromNBT(itemTag);
}
iconTexture = compound.getString("IconTexture");
public String getName() {
return this.name;
}
// Read the weaknesses mapping from NBT.
weaknesses.clear();
if(compound.hasKey("Weaknesses")) {
NBTTagList weaknessList = compound.getTagList("Weaknesses", 10); // compound tags
for(int i = 0; i < weaknessList.tagCount(); i++){
NBTTagCompound weaknessTag = weaknessList.getCompoundTagAt(i);
int weakMagicId = weaknessTag.getInteger("MagicID");
float percentage = weaknessTag.getFloat("Percentage");
weaknesses.put(weakMagicId, percentage);
}
}
}
public void setName(String name) { this.name = name; }
public void writeNBT(NBTTagCompound compound) {
compound.setInteger("Slot", id);
compound.setString("Name", name);
compound.setInteger("Color", color);
compound.setInteger("Index", index);
compound.setInteger("Priority", priority);
public void setColor(int color) { this.color = color; }
if(iconItem != null) {
NBTTagCompound itemTag = new NBTTagCompound();
iconItem.writeToNBT(itemTag);
compound.setTag("IconItem", itemTag);
}
if(iconTexture != null && !iconTexture.isEmpty()){
compound.setString("IconTexture", iconTexture);
}
public int getColor() {
return this.color;
}
// Write the weaknesses mapping.
NBTTagList weaknessList = new NBTTagList();
for(Map.Entry<Integer, Float> entry : weaknesses.entrySet()){
NBTTagCompound weaknessTag = new NBTTagCompound();
weaknessTag.setInteger("MagicID", entry.getKey());
weaknessTag.setFloat("Percentage", entry.getValue());
weaknessList.appendTag(weaknessTag);
}
compound.setTag("Weaknesses", weaknessList);
}
public void save() {
MagicController.getInstance().saveMagic(this);
}
public int getId() {
return this.id;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public int getPriority() {
return priority;
}
public void setPriority(int priority) {
this.priority = priority;
}
public int getIndex() {
return index;
}
public void setIndex(int index) {
this.index = index;
}
public void setColor(int color) {
this.color = color;
}
public int getColor() {
return this.color;
}
public void save() {
MagicController.getInstance().saveMagic(this);
}
public void setIconItem(ItemStack item) {
this.iconItem = item;
}
public ItemStack getIconItem() {
return this.iconItem;
}
public void setIconTexture(String texture) {
this.iconTexture = texture;
}
public String getIconTexture() {
return this.iconTexture;
}
public void setWeaknesses(Map<Integer, Float> weaknesses) {
this.weaknesses = weaknesses;
}
public Map<Integer, Float> getWeaknesses() {
return this.weaknesses;
}
}
@@ -1,15 +1,15 @@
package noppes.npcs.controllers.data;
import kamkeel.npcs.network.PacketHandler;
import kamkeel.npcs.network.packets.data.MarkDataPacket;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.world.World;
import net.minecraftforge.common.IExtendedEntityProperties;
import noppes.npcs.Server;
import noppes.npcs.api.entity.data.IMark;
import noppes.npcs.api.handler.data.IAvailability;
import noppes.npcs.constants.EnumPacketClient;
import noppes.npcs.constants.MarkType;
import noppes.npcs.entity.EntityNPCInterface;
@@ -102,7 +102,7 @@ public class MarkData implements IExtendedEntityProperties {
public void init(Entity entity, World world) {}
public void syncClients() {
Server.sendToAll(EnumPacketClient.MARK_DATA, entity.getEntityId(), getNBT());
PacketHandler.Instance.sendToAll(new MarkDataPacket(entity.getEntityId(), getNBT()));
}
public class Mark implements IMark {
@@ -1,6 +1,9 @@
package noppes.npcs.controllers.data;
import kamkeel.addon.DBCAddon;
import kamkeel.npcs.addon.DBCAddon;
import kamkeel.npcs.network.packets.data.AchievementPacket;
import kamkeel.npcs.network.packets.data.ChatAlertPacket;
import kamkeel.npcs.network.packets.request.party.PartyInvitePacket;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
@@ -10,12 +13,9 @@ import net.minecraft.world.World;
import net.minecraftforge.common.IExtendedEntityProperties;
import noppes.npcs.CustomNpcs;
import noppes.npcs.LogWriter;
import noppes.npcs.PacketHandlerServer;
import noppes.npcs.Server;
import noppes.npcs.api.entity.ICustomNpc;
import noppes.npcs.api.handler.*;
import noppes.npcs.config.ConfigMain;
import noppes.npcs.constants.EnumPacketClient;
import noppes.npcs.constants.EnumRoleType;
import noppes.npcs.controllers.PartyController;
import noppes.npcs.controllers.PlayerDataController;
@@ -43,7 +43,7 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
public PlayerItemGiverData itemgiverData = new PlayerItemGiverData(this);
public PlayerMailData mailData = new PlayerMailData(this);
public AnimationData animationData = new AnimationData(this);
public PlayerEffectData effectData = new PlayerEffectData(this);
public DataTimers timers = new DataTimers(this);
public DataSkinOverlays skinOverlays = new DataSkinOverlays(this);
@@ -96,6 +96,7 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
timers.readFromNBT(data);
skinOverlays.readFromNBT(data);
animationData.readFromNBT(data);
effectData.readFromNBT(data);
if(player != null){
playername = player.getCommandSenderName();
@@ -135,6 +136,7 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
timers.writeToNBT(compound);
skinOverlays.writeToNBT(compound);
animationData.writeToNBT(compound);
effectData.writeToNBT(compound);
compound.setString("PlayerName", playername);
compound.setString("UUID", uuid);
@@ -164,6 +166,16 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
factionData.loadNBTData(data);
}
public NBTTagCompound getPlayerEffects(){
NBTTagCompound compound = new NBTTagCompound();
effectData.writeToNBT(compound);
return compound;
}
public void setPlayerEffects(NBTTagCompound data){
effectData.readFromNBT(data);
}
public NBTTagCompound getSyncNBTFull() {
if(player != null){
playername = player.getCommandSenderName();
@@ -265,15 +277,16 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
public void inviteToParty(Party party) {
if (party != null && this.partyUUID == null && !this.partyInvites.contains(party.getPartyUUID())) {
this.partyInvites.add(party.getPartyUUID());
Server.sendData((EntityPlayerMP)this.player, EnumPacketClient.PARTY_MESSAGE, "party.inviteAlert", party.getPartyLeader().getCommandSenderName());
Server.sendData((EntityPlayerMP)this.player, EnumPacketClient.CHAT, "\u00A7a", "party.inviteChat", " ", party.getPartyLeader().getCommandSenderName(), "!");
AchievementPacket.sendAchievement((EntityPlayerMP) player, true, "party.inviteAlert", party.getPartyLeader().getCommandSenderName());
ChatAlertPacket.sendChatAlert((EntityPlayerMP) player, "\u00A7a", "party.inviteChat", " ", party.getPartyLeader().getCommandSenderName(), "!");
}
}
public void ignoreInvite(UUID uuid) {
if (uuid != null) {
this.partyInvites.remove(uuid);
PacketHandlerServer.sendInviteData((EntityPlayerMP) player);
PartyInvitePacket.sendInviteData((EntityPlayerMP) player);
}
}
@@ -0,0 +1,102 @@
package noppes.npcs.controllers.data;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.api.entity.IPlayer;
import noppes.npcs.api.handler.data.IPlayerEffect;
import noppes.npcs.controllers.CustomEffectController;
public class PlayerEffect implements IPlayerEffect {
public int id;
public int duration;
public byte level;
public int index;
public PlayerEffect(int id, int duration, byte level) {
this.id = id;
this.duration = duration;
this.level = level;
}
public static PlayerEffect readEffectData(NBTTagCompound nbt) {
int id = nbt.getInteger("Id");
int index = nbt.getInteger("Index");
if (id > 0) {
CustomEffectController controller = CustomEffectController.getInstance();
boolean found = controller.has(id);
// StatusEffectController.getInstance().customEffects.containsKey(id);
if (found) {
byte level = nbt.getByte("Level");
int dur = nbt.getInteger("Dur");
return new PlayerEffect(id, dur, level);
}
}
return null;
}
public NBTTagCompound writeEffectData(NBTTagCompound nbt) {
nbt.setInteger("Id", this.id);
nbt.setByte("Level", this.level);
nbt.setInteger("Dur", this.duration);
nbt.setInteger("Index", this.index);
return nbt;
}
@Override
public void kill() {
duration = 0;
}
@Override
public int getId() {
return id;
}
@Override
public int getDuration() {
return duration;
}
@Override
public void setDuration(int duration) {
this.duration = duration;
}
@Override
public byte getLevel() {
return level;
}
@Override
public void setLevel(byte level) {
this.level = level;
}
@Override
public String getName() {
CustomEffect effect = CustomEffectController.getInstance().get(this.id);
if(effect != null)
return effect.getName();
return "UNKNOWN";
}
@Override
public void performEffect(IPlayer player) {
if (player != null && player.getMCEntity() != null && player.getMCEntity() instanceof EntityPlayer) {
CustomEffect effect = CustomEffectController.getInstance().get(this.id);
if(effect != null)
effect.onTick((EntityPlayer) player.getMCEntity(), this);
}
}
@Override
public int getIndex() {
return this.index;
}
@Override
public void setIndex(int index) {
this.index = index;
}
}
@@ -0,0 +1,87 @@
package noppes.npcs.controllers.data;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class PlayerEffectData {
private final PlayerData parent;
private ConcurrentHashMap<EffectKey, PlayerEffect> effects = new ConcurrentHashMap<>();
public PlayerEffectData(PlayerData playerData){
this.parent = playerData;
}
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
NBTTagList list = new NBTTagList();
for (Map.Entry<EffectKey, PlayerEffect> entry : effects.entrySet()) {
NBTTagCompound effectCompound = new NBTTagCompound();
effectCompound.setInteger("id", entry.getKey().getId());
effectCompound.setInteger("index", entry.getKey().getIndex());
effectCompound.setInteger("duration", entry.getValue().duration);
effectCompound.setByte("level", entry.getValue().level);
list.appendTag(effectCompound);
}
compound.setTag("Effects", list);
return compound;
}
public void readFromNBT(NBTTagCompound compound) {
HashSet<EffectKey> newKeys = new HashSet<>();
if (compound.hasKey("Effects")) {
NBTTagList list = compound.getTagList("Effects", 10);
for (int i = 0; i < list.tagCount(); i++) {
NBTTagCompound effectCompound = list.getCompoundTagAt(i);
int id = effectCompound.getInteger("id");
int index = effectCompound.getInteger("index");
int duration = effectCompound.getInteger("duration");
byte level = effectCompound.getByte("level");
EffectKey key = new EffectKey(id, index);
newKeys.add(key);
PlayerEffect effect = effects.get(key);
if (effect != null) {
effect.duration = duration;
effect.level = level;
} else {
effect = new PlayerEffect(id, duration, level);
effect.index = index;
effects.put(key, effect);
}
}
}
Iterator<EffectKey> it = effects.keySet().iterator();
while (it.hasNext()) {
EffectKey key = it.next();
if (!newKeys.contains(key)) {
it.remove();
}
}
}
public ConcurrentHashMap<EffectKey, PlayerEffect> getEffects() {
return effects;
}
public void setEffects(ConcurrentHashMap<EffectKey, PlayerEffect> effects) {
this.effects = effects;
}
public PlayerEffect getPlayerEffect(int id, int index) {
return effects.get(new EffectKey(id, index));
}
public PlayerEffect getPlayerEffect(int id) {
return getPlayerEffect(id, 0);
}
public boolean hasPlayerEffect(int id, int index) {
return effects.containsKey(new EffectKey(id, index));
}
public boolean hasPlayerEffect(int id) {
return hasPlayerEffect(id, 0);
}
}
@@ -23,9 +23,9 @@ public class PlayerMail implements IInventory, IPlayerMail {
public int questId = -1;
public String questTitle = "";
public ItemStack[] items = new ItemStack[4];
public long timePast;
public void readNBT(NBTTagCompound compound) {
subject = compound.getString("Subject");
sender = compound.getString("Sender");
@@ -81,7 +81,7 @@ public class PlayerMail implements IInventory, IPlayerMail {
compound.setTag("MailItems", nbttaglist);
return compound;
}
public boolean isValid(){
return !subject.isEmpty() && !message.hasNoTags() && !sender.isEmpty();
}
@@ -168,20 +168,20 @@ public class PlayerMail implements IInventory, IPlayerMail {
@Override
public String getInventoryName() {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean hasCustomInventoryName() {
// TODO Auto-generated method stub
return false;
}
@Override
public void markDirty() {
// TODO Auto-generated method stub
}
@Override
@@ -191,7 +191,7 @@ public class PlayerMail implements IInventory, IPlayerMail {
@Override
public void openInventory() {
}
@Override
@@ -1,16 +1,18 @@
package noppes.npcs.controllers.data;
import kamkeel.npcs.network.PacketHandler;
import kamkeel.npcs.network.packets.data.AchievementPacket;
import kamkeel.npcs.network.packets.data.ChatAlertPacket;
import kamkeel.npcs.network.packets.data.OverlayQuestTrackingPacket;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import noppes.npcs.EventHooks;
import noppes.npcs.NoppesUtilPlayer;
import noppes.npcs.Server;
import noppes.npcs.api.handler.IPlayerQuestData;
import noppes.npcs.api.handler.data.IParty;
import noppes.npcs.api.handler.data.IQuest;
import noppes.npcs.constants.EnumPacketClient;
import noppes.npcs.constants.EnumQuestCompletion;
import noppes.npcs.constants.EnumQuestRepeat;
import noppes.npcs.constants.EnumQuestType;
@@ -201,8 +203,8 @@ public class PlayerQuestData implements IPlayerQuestData {
public void untrackQuest() {
if (this.trackedQuest != null) {
this.trackedQuest = null;
Server.sendData((EntityPlayerMP) this.parent.player, EnumPacketClient.OVERLAY_QUEST_TRACKING);
}
PacketHandler.Instance.sendToPlayer(new OverlayQuestTrackingPacket(new NBTTagCompound()), (EntityPlayerMP) this.parent.player);
}
}
public IQuest getTrackedQuest() {
@@ -217,9 +219,9 @@ public class PlayerQuestData implements IPlayerQuestData {
return;
QuestData questdata = new QuestData(quest);
activeQuests.put(id, questdata);
Server.sendData((EntityPlayerMP)parent.player, EnumPacketClient.MESSAGE, "quest.newquest", quest.title);
Server.sendData((EntityPlayerMP)parent.player, EnumPacketClient.CHAT, "quest.newquest", ": ", quest.title);
AchievementPacket.sendAchievement((EntityPlayerMP) parent.player, false, "quest.newquest", quest.title);
ChatAlertPacket.sendChatAlert((EntityPlayerMP) parent.player, "quest.newquest", ": ", quest.title);
parent.updateClient = true;
}
@@ -1,5 +1,6 @@
package noppes.npcs.controllers.data;
import kamkeel.npcs.network.packets.data.QuestCompletionPacket;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTTagCompound;
@@ -7,7 +8,6 @@ import noppes.npcs.*;
import noppes.npcs.api.IContainer;
import noppes.npcs.api.entity.IPlayer;
import noppes.npcs.api.handler.data.*;
import noppes.npcs.constants.EnumPacketClient;
import noppes.npcs.constants.EnumQuestCompletion;
import noppes.npcs.constants.EnumQuestRepeat;
import noppes.npcs.constants.EnumQuestType;
@@ -139,7 +139,7 @@ public class Quest implements ICompatibilty, IQuest {
public boolean instantComplete(EntityPlayer player, QuestData data) {
if(completion == EnumQuestCompletion.Instant && NoppesUtilPlayer.questCompletion((EntityPlayerMP) player, data.quest.id)){
Server.sendData((EntityPlayerMP)player, EnumPacketClient.QUEST_COMPLETION, data.quest.writeToNBT(new NBTTagCompound()));
QuestCompletionPacket.sendQuestComplete((EntityPlayerMP)player, data.quest.writeToNBT(new NBTTagCompound()));
return true;
}
return false;
@@ -0,0 +1,151 @@
package noppes.npcs.controllers.data;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.NoppesUtilPlayer;
import noppes.npcs.NoppesUtilServer;
import noppes.npcs.api.handler.data.IAnvilRecipe;
import noppes.npcs.controllers.data.Availability;
public class RecipeAnvil implements IAnvilRecipe {
public int id = -1;
public String name = "";
public Availability availability = new Availability();
public boolean ignoreRepairItemNBT = false;
public boolean ignoreRepairMaterialNBT = false;
public boolean ignoreRepairMaterialDamage = false;
public ItemStack itemToRepair;
public ItemStack repairMaterial;
public int xpCost;
public float repairPercentage;
private boolean isAnvil = true;
public RecipeAnvil() { }
public RecipeAnvil(String name, ItemStack itemToRepair, ItemStack repairMaterial, int xpCost, float repairPercentage) {
this.name = name;
this.itemToRepair = itemToRepair;
this.repairMaterial = repairMaterial;
this.xpCost = xpCost;
this.repairPercentage = repairPercentage;
}
public static RecipeAnvil read(NBTTagCompound compound) {
RecipeAnvil recipe = new RecipeAnvil();
recipe.id = compound.getInteger("ID");
recipe.name = compound.getString("Name");
recipe.availability.readFromNBT(compound.getCompoundTag("Availability"));
recipe.xpCost = compound.getInteger("XPCost");
recipe.repairPercentage = compound.getFloat("RepairPercentage");
recipe.itemToRepair = NoppesUtilServer.readItem(compound.getCompoundTag("ItemToRepair"));
recipe.repairMaterial = NoppesUtilServer.readItem(compound.getCompoundTag("RepairMaterial"));
recipe.ignoreRepairMaterialNBT = compound.getBoolean("IgnoreRepairMatNBT");
recipe.ignoreRepairItemNBT = compound.getBoolean("IgnoreRepairItemNBT");
recipe.ignoreRepairMaterialDamage = compound.getBoolean("IgnoreRepairMatDamage");
recipe.isAnvil = true;
return recipe;
}
public NBTTagCompound writeNBT() {
NBTTagCompound compound = new NBTTagCompound();
compound.setInteger("ID", id);
compound.setString("Name", name);
compound.setTag("Availability", availability.writeToNBT(new NBTTagCompound()));
compound.setInteger("XPCost", xpCost);
compound.setFloat("RepairPercentage", repairPercentage);
if(itemToRepair != null){
compound.setTag("ItemToRepair", NoppesUtilServer.writeItem(itemToRepair, new NBTTagCompound()));
}
if(repairMaterial != null){
compound.setTag("RepairMaterial", NoppesUtilServer.writeItem(repairMaterial, new NBTTagCompound()));
}
compound.setBoolean("IgnoreRepairMatNBT", ignoreRepairMaterialNBT);
compound.setBoolean("IgnoreRepairItemNBT", ignoreRepairItemNBT);
compound.setBoolean("IgnoreRepairMatDamage", ignoreRepairMaterialDamage);
compound.setBoolean("IsAnvil", true);
return compound;
}
@Override
public int getXpCost() {
return xpCost;
}
@Override
public float getRepairPercentage() {
return repairPercentage;
}
@Override
public boolean matches(ItemStack inputItem, ItemStack inputRepairMaterial) {
if (inputItem == null || inputRepairMaterial == null) return false;
if (!NoppesUtilPlayer.compareItems(this.itemToRepair, inputItem, true, this.ignoreRepairItemNBT)) {
return false;
}
if (!NoppesUtilPlayer.compareItems(this.repairMaterial, inputRepairMaterial, this.ignoreRepairMaterialDamage, this.ignoreRepairMaterialNBT)) {
return false;
}
return true;
}
@Override
public ItemStack getResult(ItemStack inputItem) {
if (inputItem == null)
return null;
ItemStack result = inputItem.copy();
if (!result.isItemStackDamageable())
return result;
int maxDamage = result.getMaxDamage();
int repairAmount = (int) (maxDamage * repairPercentage);
int currentDamage = result.getItemDamage();
int newDamage = currentDamage - repairAmount;
if (newDamage < 0) newDamage = 0;
result.setItemDamage(newDamage);
return result;
}
@Override
public String getName() {
return name;
}
@Override
public int getID() {
return this.id;
}
public static RecipeAnvil saveRecipe(RecipeAnvil recipe, ItemStack output, ItemStack repairMaterial) {
if (output != null) {
recipe.itemToRepair = output.copy();
if (recipe.itemToRepair.isItemStackDamageable()) {
recipe.itemToRepair.setItemDamage(0);
}
} else {
recipe.itemToRepair = null;
}
recipe.repairMaterial = (repairMaterial == null ? null : repairMaterial.copy());
return recipe;
}
public boolean isValid() {
return itemToRepair != null && repairMaterial != null;
}
/**
* Creates and returns a deep copy of this RecipeAnvil.
*/
public void copy(RecipeAnvil recipe) {
this.id = recipe.id;
this.name = recipe.name;
this.availability = recipe.availability;
this.ignoreRepairMaterialDamage = recipe.ignoreRepairMaterialDamage;
this.ignoreRepairItemNBT = recipe.ignoreRepairItemNBT;
this.ignoreRepairMaterialNBT = recipe.ignoreRepairMaterialNBT;
this.repairPercentage = recipe.repairPercentage;;
this.xpCost = recipe.xpCost;
}
}
@@ -23,7 +23,7 @@ public class RecipeCarpentry extends ShapedRecipes implements IRecipe {
public boolean isGlobal = false;
public boolean ignoreDamage = false;
public boolean ignoreNBT = false;
public RecipeCarpentry(int width, int height, ItemStack[] recipe, ItemStack result){
super(width, height, recipe, result);
@@ -32,9 +32,9 @@ public class RecipeCarpentry extends ShapedRecipes implements IRecipe {
super(0, 0, new ItemStack[0], null);
this.name = name;
}
public static RecipeCarpentry read(NBTTagCompound compound){
RecipeCarpentry recipe = new RecipeCarpentry(compound.getInteger("Width"), compound.getInteger("Height"),
RecipeCarpentry recipe = new RecipeCarpentry(compound.getInteger("Width"), compound.getInteger("Height"),
NBTTags.getItemStackArray(compound.getTagList("Materials", 10)), NoppesUtilServer.readItem(compound.getCompoundTag("Item")));
recipe.name = compound.getString("Name");
recipe.id = compound.getInteger("ID");
@@ -42,7 +42,7 @@ public class RecipeCarpentry extends ShapedRecipes implements IRecipe {
recipe.ignoreDamage = compound.getBoolean("IgnoreDamage");
recipe.ignoreNBT = compound.getBoolean("IgnoreNBT");
recipe.isGlobal = compound.getBoolean("Global");
return recipe;
}
@@ -188,15 +188,14 @@ public class RecipeCarpentry extends ShapedRecipes implements IRecipe {
var15[var9] = null;
}
}
RecipeCarpentry newrecipe = new RecipeCarpentry(var5, var6, var15, par1ItemStack);
RecipeCarpentry newrecipe = new RecipeCarpentry(var5, var6, var15, par1ItemStack);
newrecipe.copy(recipe);
if(var5 == 4 || var6 == 4)
newrecipe.isGlobal = false;
return newrecipe;
}
public void copy(RecipeCarpentry recipe) {
this.id = recipe.id;
this.name = recipe.name;
@@ -205,7 +204,7 @@ public class RecipeCarpentry extends ShapedRecipes implements IRecipe {
this.ignoreDamage = recipe.ignoreDamage;
this.ignoreNBT = recipe.ignoreNBT;
}
public ItemStack getCraftingItem(int i){
if(recipeItems == null || i >= recipeItems.length)
return null;
@@ -18,18 +18,18 @@ public class RecipesDefault {
item = new ItemStack((Block)ob);
else
item = (ItemStack) ob;
RecipeCarpentry recipeAnvil = new RecipeCarpentry(name);
recipeAnvil.isGlobal = isGlobal;
recipeAnvil = RecipeCarpentry.saveRecipe(recipeAnvil, item, recipe);
RecipeController.Instance.addRecipe(recipeAnvil);
RecipeCarpentry recipeCarpentry = new RecipeCarpentry(name);
recipeCarpentry.isGlobal = isGlobal;
recipeCarpentry = RecipeCarpentry.saveRecipe(recipeCarpentry, item, recipe);
RecipeController.Instance.addRecipe(recipeCarpentry);
}
public static void loadDefaultRecipes(int i) {
if(i < 0){
addRecipe("Npc Wand", CustomItems.wand, true, "XX"," Y"," Y",'X', Items.bread,'Y', Items.stick);
addRecipe("Mob Cloner", CustomItems.cloner, true, "XX","XY"," Y",'X', Items.bread,'Y', Items.stick);
addRecipe("Carpentry Bench", CustomItems.carpentyBench, true, "XYX","Z Z","Z Z", 'X', Blocks.planks, 'Z', Items.stick, 'Y', Blocks.crafting_table);
if(!ConfigMain.DisableExtraItems){
addRecipe("Mana", CustomItems.mana, true, "XY",'X',Items.redstone,'Y',Items.glowstone_dust);
addRecipe("Gun Wooden", CustomItems.gunWood, false, "XXXY"," ZM "," M ",'Y', Blocks.lever, 'M', Items.stick, 'Z', Blocks.stone_button,'X', Blocks.planks);
@@ -39,7 +39,7 @@ public class RecipesDefault {
addRecipe("Gun Diamond", CustomItems.gunDiamond, false, "XXXY"," ZM "," M ",'Y', Blocks.lever, 'M', Items.stick, 'Z', Blocks.stone_button,'X', Items.diamond);
addRecipe("Gun Emerald", CustomItems.gunEmerald, false, "XXXY"," ZM "," M ",'Y', Blocks.lever, 'M', Items.stick, 'Z', Blocks.stone_button,'X', Items.emerald);
addRecipe("Gun Bronze", CustomItems.gunBronze, false, "XXXY"," ZM "," M ",'Y', Blocks.lever, 'M', Items.stick, 'Z', Blocks.stone_button,'X', CustomItems.bronze_ingot);
addRecipe("Bullet Wooden", CustomItems.bulletWood, true, "X",'X', Blocks.planks);
addRecipe("Bullet Stone", CustomItems.bulletStone, true, "X",'X', Blocks.cobblestone);
addRecipe("Bullet Iron", CustomItems.bulletIron, true, "X",'X', Items.iron_ingot);
@@ -56,96 +56,96 @@ public class RecipesDefault {
addRecipe("WallBanner Iron", new ItemStack(CustomItems.wallBanner, 1, 2), false, "XXX","ZZZ","ZZZ","Z Z",'Z', Blocks.wool, 'X', Items.iron_ingot);
addRecipe("WallBanner Gold", new ItemStack(CustomItems.wallBanner, 1, 3), false, "XXX","ZZZ","ZZZ","Z Z",'Z', Blocks.wool, 'X', Items.gold_ingot);
addRecipe("WallBanner Diamond", new ItemStack(CustomItems.wallBanner, 1, 4), false, "XXX","ZZZ","ZZZ","Z Z",'Z', Blocks.wool, 'X', Items.diamond);
addRecipe("Banner Wooden", new ItemStack(CustomItems.banner, 1, 0), false, " X "," Z "," Z ","ZZZ", 'X', new ItemStack(CustomItems.wallBanner,1,0), 'Z', Blocks.planks);
addRecipe("Banner Stone", new ItemStack(CustomItems.banner, 1, 1), false, " X "," Z "," Z ","ZZZ", 'X', new ItemStack(CustomItems.wallBanner,1,1), 'Z', Blocks.cobblestone);
addRecipe("Banner Iron", new ItemStack(CustomItems.banner, 1, 2), false, " X "," Z "," Z ","ZZZ", 'X', new ItemStack(CustomItems.wallBanner,1,2), 'Z', Items.iron_ingot);
addRecipe("Banner Gold", new ItemStack(CustomItems.banner, 1, 3), false, " X "," Z "," Z ","ZZZ", 'X', new ItemStack(CustomItems.wallBanner,1,3), 'Z', Items.gold_ingot);
addRecipe("Banner Diamond", new ItemStack(CustomItems.banner, 1, 4), false, " X "," Z "," Z ","ZZZ", 'X', new ItemStack(CustomItems.wallBanner,1,4), 'Z', Items.diamond);
addRecipe("Lamp Wooden", new ItemStack(CustomItems.tallLamp, 1, 0), false, "YXY"," Z "," Z ","ZZZ", 'X', Blocks.torch, 'Y', Blocks.wool, 'Z', Blocks.planks);
addRecipe("Lamp Stone", new ItemStack(CustomItems.tallLamp, 1, 1), false, "YXY"," Z "," Z ","ZZZ", 'X', Blocks.torch, 'Y', Blocks.wool, 'Z', Blocks.cobblestone);
addRecipe("Lamp Iron", new ItemStack(CustomItems.tallLamp, 1, 2), false, "YXY"," Z "," Z ","ZZZ", 'X', Blocks.torch, 'Y', Blocks.wool, 'Z', Items.iron_ingot);
addRecipe("Lamp Gold", new ItemStack(CustomItems.tallLamp, 1, 3), false, "YXY"," Z "," Z ","ZZZ", 'X', Blocks.torch, 'Y', Blocks.wool, 'Z', Items.gold_ingot);
addRecipe("Lamp Diamond", new ItemStack(CustomItems.tallLamp, 1, 4), false, "YXY"," Z "," Z ","ZZZ", 'X', Blocks.torch, 'Y', Blocks.wool, 'Z', Items.diamond);
addRecipe("Chair Wooden1", new ItemStack(CustomItems.chair, 1, 0), false, " X", " X","XXX","X X", 'X', new ItemStack(Blocks.planks,1,0));
addRecipe("Chair Wooden2", new ItemStack(CustomItems.chair, 1, 1), false, " X", " X","XXX","X X", 'X', new ItemStack(Blocks.planks,1,1));
addRecipe("Chair Wooden3", new ItemStack(CustomItems.chair, 1, 2), false, " X", " X","XXX","X X", 'X', new ItemStack(Blocks.planks,1,2));
addRecipe("Chair Wooden4", new ItemStack(CustomItems.chair, 1, 3), false, " X", " X","XXX","X X", 'X', new ItemStack(Blocks.planks,1,3));
addRecipe("Chair Wooden5", new ItemStack(CustomItems.chair, 1, 4), false, " X", " X","XXX","X X", 'X', new ItemStack(Blocks.planks,1,4));
addRecipe("Chair Wooden6", new ItemStack(CustomItems.chair, 1, 5), false, " X", " X","XXX","X X", 'X', new ItemStack(Blocks.planks,1,5));
addRecipe("Crate Wooden1", new ItemStack(CustomItems.crate, 1, 0), false, "XXXX","X X","X X","XXXX", 'X', new ItemStack(Blocks.planks,1,0));
addRecipe("Crate Wooden2", new ItemStack(CustomItems.crate, 1, 1), false, "XXXX","X X","X X","XXXX", 'X', new ItemStack(Blocks.planks,1,1));
addRecipe("Crate Wooden3", new ItemStack(CustomItems.crate, 1, 2), false, "XXXX","X X","X X","XXXX", 'X', new ItemStack(Blocks.planks,1,2));
addRecipe("Crate Wooden4", new ItemStack(CustomItems.crate, 1, 3), false, "XXXX","X X","X X","XXXX", 'X', new ItemStack(Blocks.planks,1,3));
addRecipe("Crate Wooden5", new ItemStack(CustomItems.crate, 1, 4), false, "XXXX","X X","X X","XXXX", 'X', new ItemStack(Blocks.planks,1,4));
addRecipe("Crate Wooden6", new ItemStack(CustomItems.crate, 1, 5), false, "XXXX","X X","X X","XXXX", 'X', new ItemStack(Blocks.planks,1,5));
addRecipe("WeaponRack Wooden1", new ItemStack(CustomItems.weaponsRack, 1, 0), false, "XXX","XYX","XYX","XXX", 'X', new ItemStack(Blocks.planks,1,0),'Y', Items.stick);
addRecipe("WeaponRack Wooden2", new ItemStack(CustomItems.weaponsRack, 1, 1), false, "XXX","XYX","XYX","XXX", 'X', new ItemStack(Blocks.planks,1,1),'Y', Items.stick);
addRecipe("WeaponRack Wooden3", new ItemStack(CustomItems.weaponsRack, 1, 2), false, "XXX","XYX","XYX","XXX", 'X', new ItemStack(Blocks.planks,1,2),'Y', Items.stick);
addRecipe("WeaponRack Wooden4", new ItemStack(CustomItems.weaponsRack, 1, 3), false, "XXX","XYX","XYX","XXX", 'X', new ItemStack(Blocks.planks,1,3),'Y', Items.stick);
addRecipe("WeaponRack Wooden5", new ItemStack(CustomItems.weaponsRack, 1, 4), false, "XXX","XYX","XYX","XXX", 'X', new ItemStack(Blocks.planks,1,4),'Y', Items.stick);
addRecipe("WeaponRack Wooden6", new ItemStack(CustomItems.weaponsRack, 1, 5), false, "XXX","XYX","XYX","XXX", 'X', new ItemStack(Blocks.planks,1,5),'Y', Items.stick);
addRecipe("Couch Wooden1", new ItemStack(CustomItems.couchWood, 1, 0), false, " X"," X","XXXX","X X", 'X', new ItemStack(Blocks.planks,1,0));
addRecipe("Couch Wooden2", new ItemStack(CustomItems.couchWood, 1, 1), false, " X"," X","XXXX","X X", 'X', new ItemStack(Blocks.planks,1,1));
addRecipe("Couch Wooden3", new ItemStack(CustomItems.couchWood, 1, 2), false, " X"," X","XXXX","X X", 'X', new ItemStack(Blocks.planks,1,2));
addRecipe("Couch Wooden4", new ItemStack(CustomItems.couchWood, 1, 3), false, " X"," X","XXXX","X X", 'X', new ItemStack(Blocks.planks,1,3));
addRecipe("Couch Wooden5", new ItemStack(CustomItems.couchWood, 1, 4), false, " X"," X","XXXX","X X", 'X', new ItemStack(Blocks.planks,1,4));
addRecipe("Couch Wooden6", new ItemStack(CustomItems.couchWood, 1, 5), false, " X"," X","XXXX","X X", 'X', new ItemStack(Blocks.planks,1,5));
addRecipe("Couch Wool1", new ItemStack(CustomItems.couchWool, 1, 0), false, " Z", " Z","ZZZZ","X X", 'X', new ItemStack(Blocks.planks,1,0), 'Z', Blocks.wool);
addRecipe("Couch Wool2", new ItemStack(CustomItems.couchWool, 1, 1), false, " Z", " Z","ZZZZ","X X", 'X', new ItemStack(Blocks.planks,1,1), 'Z', Blocks.wool);
addRecipe("Couch Wool3", new ItemStack(CustomItems.couchWool, 1, 2), false, " Z", " Z","ZZZZ","X X", 'X', new ItemStack(Blocks.planks,1,2), 'Z', Blocks.wool);
addRecipe("Couch Wool4", new ItemStack(CustomItems.couchWool, 1, 3), false, " Z", " Z","ZZZZ","X X", 'X', new ItemStack(Blocks.planks,1,3), 'Z', Blocks.wool);
addRecipe("Couch Wool5", new ItemStack(CustomItems.couchWool, 1, 4), false, " Z", " Z","ZZZZ","X X", 'X', new ItemStack(Blocks.planks,1,4), 'Z', Blocks.wool);
addRecipe("Couch Wool6", new ItemStack(CustomItems.couchWool, 1, 5), false, " Z", " Z","ZZZZ","X X", 'X', new ItemStack(Blocks.planks,1,5), 'Z', Blocks.wool);
addRecipe("Table Wood1", new ItemStack(CustomItems.table, 1, 0), false, "XXXX","X X","X X", 'X', new ItemStack(Blocks.planks,1,0), 'Z', Blocks.wool);
addRecipe("Table Wood2", new ItemStack(CustomItems.table, 1, 1), false, "XXXX","X X","X X", 'X', new ItemStack(Blocks.planks,1,1), 'Z', Blocks.wool);
addRecipe("Table Wood3", new ItemStack(CustomItems.table, 1, 2), false, "XXXX","X X","X X", 'X', new ItemStack(Blocks.planks,1,2), 'Z', Blocks.wool);
addRecipe("Table Wood4", new ItemStack(CustomItems.table, 1, 3), false, "XXXX","X X","X X", 'X', new ItemStack(Blocks.planks,1,3), 'Z', Blocks.wool);
addRecipe("Table Wood5", new ItemStack(CustomItems.table, 1, 4), false, "XXXX","X X","X X", 'X', new ItemStack(Blocks.planks,1,4), 'Z', Blocks.wool);
addRecipe("Table Wood6", new ItemStack(CustomItems.table, 1, 5), false, "XXXX","X X","X X", 'X', new ItemStack(Blocks.planks,1,5), 'Z', Blocks.wool);
addRecipe("Stool Wood1", new ItemStack(CustomItems.stool, 1, 0), false, "XXX"," X ","X X", 'X', new ItemStack(Blocks.planks,1,0));
addRecipe("Stool Wood2", new ItemStack(CustomItems.stool, 1, 1), false, "XXX"," X ","X X", 'X', new ItemStack(Blocks.planks,1,1));
addRecipe("Stool Wood3", new ItemStack(CustomItems.stool, 1, 2), false, "XXX"," X ","X X", 'X', new ItemStack(Blocks.planks,1,2));
addRecipe("Stool Wood4", new ItemStack(CustomItems.stool, 1, 3), false, "XXX"," X ","X X", 'X', new ItemStack(Blocks.planks,1,3));
addRecipe("Stool Wood5", new ItemStack(CustomItems.stool, 1, 4), false, "XXX"," X ","X X", 'X', new ItemStack(Blocks.planks,1,4));
addRecipe("Stool Wood6", new ItemStack(CustomItems.stool, 1, 5), false, "XXX"," X ","X X", 'X', new ItemStack(Blocks.planks,1,5));
addRecipe("noppes.npcs.client.model.blocks.Stool Wood1", new ItemStack(CustomItems.stool, 1, 0), false, "XXX"," X ","X X", 'X', new ItemStack(Blocks.planks,1,0));
addRecipe("noppes.npcs.client.model.blocks.Stool Wood2", new ItemStack(CustomItems.stool, 1, 1), false, "XXX"," X ","X X", 'X', new ItemStack(Blocks.planks,1,1));
addRecipe("noppes.npcs.client.model.blocks.Stool Wood3", new ItemStack(CustomItems.stool, 1, 2), false, "XXX"," X ","X X", 'X', new ItemStack(Blocks.planks,1,2));
addRecipe("noppes.npcs.client.model.blocks.Stool Wood4", new ItemStack(CustomItems.stool, 1, 3), false, "XXX"," X ","X X", 'X', new ItemStack(Blocks.planks,1,3));
addRecipe("noppes.npcs.client.model.blocks.Stool Wood5", new ItemStack(CustomItems.stool, 1, 4), false, "XXX"," X ","X X", 'X', new ItemStack(Blocks.planks,1,4));
addRecipe("noppes.npcs.client.model.blocks.Stool Wood6", new ItemStack(CustomItems.stool, 1, 5), false, "XXX"," X ","X X", 'X', new ItemStack(Blocks.planks,1,5));
addRecipe("Barrel Wood1", new ItemStack(CustomItems.barrel, 1, 0), false, "XXX","X X","X X", "XXX", 'X', new ItemStack(Blocks.planks,1,0));
addRecipe("Barrel Wood2", new ItemStack(CustomItems.barrel, 1, 1), false, "XXX","X X","X X", "XXX", 'X', new ItemStack(Blocks.planks,1,1));
addRecipe("Barrel Wood3", new ItemStack(CustomItems.barrel, 1, 2), false, "XXX","X X","X X", "XXX", 'X', new ItemStack(Blocks.planks,1,2));
addRecipe("Barrel Wood4", new ItemStack(CustomItems.barrel, 1, 3), false, "XXX","X X","X X", "XXX", 'X', new ItemStack(Blocks.planks,1,3));
addRecipe("Barrel Wood5", new ItemStack(CustomItems.barrel, 1, 4), false, "XXX","X X","X X", "XXX", 'X', new ItemStack(Blocks.planks,1,4));
addRecipe("Barrel Wood6", new ItemStack(CustomItems.barrel, 1, 5), false, "XXX","X X","X X", "XXX", 'X', new ItemStack(Blocks.planks,1,5));
addRecipe("Shelf Wood1", new ItemStack(CustomItems.shelf, 2, 0), false, "XXX","XY ","X ", 'Y', Items.stick, 'X', new ItemStack(Blocks.planks,1,0));
addRecipe("Shelf Wood2", new ItemStack(CustomItems.shelf, 2, 1), false, "XXX","XY ","X ", 'Y', Items.stick, 'X', new ItemStack(Blocks.planks,1,1));
addRecipe("Shelf Wood3", new ItemStack(CustomItems.shelf, 2, 2), false, "XXX","XY ","X ", 'Y', Items.stick, 'X', new ItemStack(Blocks.planks,1,2));
addRecipe("Shelf Wood4", new ItemStack(CustomItems.shelf, 2, 3), false, "XXX","XY ","X ", 'Y', Items.stick, 'X', new ItemStack(Blocks.planks,1,3));
addRecipe("Shelf Wood5", new ItemStack(CustomItems.shelf, 2, 4), false, "XXX","XY ","X ", 'Y', Items.stick, 'X', new ItemStack(Blocks.planks,1,4));
addRecipe("Shelf Wood6", new ItemStack(CustomItems.shelf, 2, 5), false, "XXX","XY ","X ", 'Y', Items.stick, 'X', new ItemStack(Blocks.planks,1,5));
addRecipe("Beam Wood1", new ItemStack(CustomItems.beam, 2, 0), false, "XXX", "XXX", 'X', new ItemStack(Blocks.planks,1,0));
addRecipe("Beam Wood2", new ItemStack(CustomItems.beam, 2, 1), false, "XXX", "XXX", 'X', new ItemStack(Blocks.planks,1,1));
addRecipe("Beam Wood3", new ItemStack(CustomItems.beam, 2, 2), false, "XXX", "XXX", 'X', new ItemStack(Blocks.planks,1,2));
addRecipe("Beam Wood4", new ItemStack(CustomItems.beam, 2, 3), false, "XXX", "XXX", 'X', new ItemStack(Blocks.planks,1,3));
addRecipe("Beam Wood5", new ItemStack(CustomItems.beam, 2, 4), false, "XXX", "XXX", 'X', new ItemStack(Blocks.planks,1,4));
addRecipe("Beam Wood6", new ItemStack(CustomItems.beam, 2, 5), false, "XXX", "XXX", 'X', new ItemStack(Blocks.planks,1,5));
addRecipe("Sign Wood1", new ItemStack(CustomItems.sign, 1, 0), false, "YYY", "XXX", "XXX", 'X', new ItemStack(Blocks.planks,1,0), 'Y', Items.iron_ingot);
addRecipe("Sign Wood2", new ItemStack(CustomItems.sign, 1, 1), false, "YYY", "XXX", "XXX", 'X', new ItemStack(Blocks.planks,1,1), 'Y', Items.iron_ingot);
addRecipe("Sign Wood3", new ItemStack(CustomItems.sign, 1, 2), false, "YYY", "XXX", "XXX", 'X', new ItemStack(Blocks.planks,1,2), 'Y', Items.iron_ingot);
addRecipe("Sign Wood4", new ItemStack(CustomItems.sign, 1, 3), false, "YYY", "XXX", "XXX", 'X', new ItemStack(Blocks.planks,1,3), 'Y', Items.iron_ingot);
addRecipe("Sign Wood5", new ItemStack(CustomItems.sign, 1, 4), false, "YYY", "XXX", "XXX", 'X', new ItemStack(Blocks.planks,1,4), 'Y', Items.iron_ingot);
addRecipe("Sign Wood6", new ItemStack(CustomItems.sign, 1, 5), false, "YYY", "XXX", "XXX", 'X', new ItemStack(Blocks.planks,1,5), 'Y', Items.iron_ingot);
addRecipe("Lamp", new ItemStack(CustomItems.lamp), false, "XXX","YZY","XXX", 'X', Items.iron_ingot, 'Y', Blocks.glass, 'Z', Blocks.torch);
addRecipe("Candle", new ItemStack(CustomItems.candle), false, "XZX"," X ", 'X', Items.iron_ingot, 'Z', Blocks.torch);
addRecipe("BigSign", new ItemStack(CustomItems.bigsign, 2), false, "XXX","XXX","XXX", 'X', Blocks.planks);
@@ -159,7 +159,7 @@ public class RecipesDefault {
addRecipe("Battle Axe5", CustomItems.battleAxeDiamond, false, "XX","XY"," Y", " Y", 'Y', Items.stick, 'X', Items.diamond);
addRecipe("Battle Axe6", CustomItems.battleAxeBronze, false, "XX","XY"," Y", " Y", 'Y', Items.stick, 'X', CustomItems.bronze_ingot);
addRecipe("Battle Axe7", CustomItems.battleAxeEmerald, false, "XX","XY"," Y", " Y", 'Y', Items.stick, 'X', Items.emerald);
addRecipe("Halberd1", CustomItems.halberdWood, false, " X ","XYX"," Y ", " Y ", 'Y', Items.stick, 'X', Blocks.planks);
addRecipe("Halberd2", CustomItems.halberdStone, false, " X ","XYX"," Y ", " Y ", 'Y', Items.stick, 'X', Blocks.cobblestone);
addRecipe("Halberd3", CustomItems.halberdIron, false, " X ","XYX"," Y ", " Y ", 'Y', Items.stick, 'X', Items.iron_ingot);
@@ -167,7 +167,7 @@ public class RecipesDefault {
addRecipe("Halberd5", CustomItems.halberdDiamond, false, " X ","XYX"," Y ", " Y ", 'Y', Items.stick, 'X', Items.diamond);
addRecipe("Halberd6", CustomItems.halberdBronze, false, " X ","XYX"," Y ", " Y ", 'Y', Items.stick, 'X', CustomItems.bronze_ingot);
addRecipe("Halberd7", CustomItems.halberdEmerald, false, " X ","XYX"," Y ", " Y ", 'Y', Items.stick, 'X', Items.emerald);
addRecipe("Glaive1", CustomItems.glaiveWood, false, "X "," Y "," Y ", " X", 'Y', Items.stick, 'X', Blocks.planks);
addRecipe("Glaive2", CustomItems.glaiveStone, false, "X "," Y "," Y ", " X", 'Y', Items.stick, 'X', Blocks.cobblestone);
addRecipe("Glaive3", CustomItems.glaiveIron, false, "X "," Y "," Y ", " X", 'Y', Items.stick, 'X', Items.iron_ingot);
@@ -175,7 +175,7 @@ public class RecipesDefault {
addRecipe("Glaive5", CustomItems.glaiveDiamond, false, "X "," Y "," Y ", " X", 'Y', Items.stick, 'X', Items.diamond);
addRecipe("Glaive6", CustomItems.glaiveBronze, false, "X "," Y "," Y ", " X", 'Y', Items.stick, 'X', CustomItems.bronze_ingot);
addRecipe("Glaive7", CustomItems.glaiveEmerald, false, "X "," Y "," Y ", " X", 'Y', Items.stick, 'X', Items.emerald);
addRecipe("Trident1", CustomItems.tridentWood, false, "X X"," X "," Y ", " Y ", 'Y', Items.stick, 'X', Blocks.planks);
addRecipe("Trident2", CustomItems.tridentStone, false, "X X"," X "," Y ", " Y ", 'Y', Items.stick, 'X', Blocks.cobblestone);
addRecipe("Trident3", CustomItems.tridentIron, false, "X X"," X "," Y ", " Y ", 'Y', Items.stick, 'X', Items.iron_ingot);
@@ -183,7 +183,7 @@ public class RecipesDefault {
addRecipe("Trident5", CustomItems.tridentDiamond, false, "X X"," X "," Y ", " Y ", 'Y', Items.stick, 'X', Items.diamond);
addRecipe("Trident6", CustomItems.tridentBronze, false, "X X"," X "," Y ", " Y ", 'Y', Items.stick, 'X', CustomItems.bronze_ingot);
addRecipe("Trident7", CustomItems.tridentEmerald, false, "X X"," X "," Y ", " Y ", 'Y', Items.stick, 'X', Items.emerald);
}
}
}