Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Luis C.M committed 2024-01-30 19:18:01 -06:00
commit 4a5c61ee1e
31 files changed
+216 -54

No files matched your search

@@ -0,0 +1,21 @@
package kamkeel.addon;
import kamkeel.addon.client.GeckoAddonClient;
public class AddonManager {
public static AddonManager Instance;
// Manager class to easily disable mixin manipulated
// addons for debugging and testing
public AddonManager(){
Instance = this;
load();
}
public void load(){
// Gecko Addon Initialization
new GeckoAddon();
new GeckoAddonClient();
}
}
@@ -0,0 +1,20 @@
package kamkeel.addon;
import net.minecraft.entity.EntityLivingBase;
public class GeckoAddon {
public static GeckoAddon instance;
public boolean supportEnabled = true;
/**
* This class is a shell class to be changed via mixins
* The Addon Mod will replace all blank functions within
* this class to change the ongoing code.
*/
public GeckoAddon(){
instance = this;
}
public void geckoCopyData(EntityLivingBase copied, EntityLivingBase entity){}
}
@@ -0,0 +1,37 @@
package kamkeel.addon.client;
import net.minecraft.client.model.ModelBase;
import net.minecraft.entity.EntityLivingBase;
import noppes.npcs.client.gui.model.GuiCreationScreen;
import noppes.npcs.client.gui.util.GuiNPCInterface2;
import noppes.npcs.client.gui.util.GuiNpcButton;
import noppes.npcs.client.model.ModelMPM;
import noppes.npcs.entity.EntityNPCInterface;
public class GeckoAddonClient {
public static GeckoAddonClient Instance;
public boolean supportEnabled = true;
/**
* This class is a shell class to be changed via mixins
* The Addon Mod will replace all blank functions within
* this class to change the ongoing code.
* The fewer classes modified by mixins the safer.
* These are for mixins affecting only client-side classes.
*/
public GeckoAddonClient(){
Instance = this;
}
// Creation Screen Mixins
public void showGeckoButtons(GuiCreationScreen creationScreen, EntityLivingBase entity){}
public void geckoGuiCreationScreenActionPerformed(GuiCreationScreen creationScreen, GuiNpcButton btn){}
// Npc Display Mixins
public void geckoNpcDisplayInitGui(GuiNPCInterface2 guiNPCInterface){}
public void geckoNpcDisplayActionPerformed(GuiNPCInterface2 guiNPCInterface, GuiNpcButton btn){}
// Render Npc Mixins
public boolean isGeckoModel(ModelBase mainModel){ return false;}
public void geckoRenderModel(ModelMPM mainModel, EntityNPCInterface npc, float rotationYaw, float renderPartialTicks) {}
}
+6 -5
View File
@@ -1,14 +1,14 @@
package noppes.npcs;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.*;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.*;
import cpw.mods.fml.common.network.FMLEventChannel;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.EntityRegistry;
import foxz.command.CommandNoppes;
import kamkeel.addon.AddonManager;
import kamkeel.addon.GeckoAddon;
import kamkeel.command.CommandKamkeel;
import kamkeel.developer.Developer;
import net.minecraft.block.Block;
@@ -35,7 +35,7 @@ import noppes.npcs.scripted.NpcAPI;
import java.io.File;
import java.util.Set;
@Mod(modid = "customnpcs", name = "CustomNPC+", version = "1.9-beta4")
@Mod(modid = "customnpcs", name = "CustomNPC+", version = "1.9-beta5")
public class CustomNpcs {
@SidedProxy(clientSide = "noppes.npcs.client.ClientProxy", serverSide = "noppes.npcs.CommonProxy")
@@ -168,7 +168,9 @@ public class CustomNpcs {
new CustomNpcsPermissions();
new Developer();
// Load Mod Support
PixelmonHelper.load();
new AddonManager();
}
@EventHandler
@@ -258,7 +260,6 @@ public class CustomNpcs {
EntityRegistry.registerModEntity(cl, name, NewEntityStartId++, this, range, update, velocity);
}
public static File getWorldSaveDirectory() {
MinecraftServer server = MinecraftServer.getServer();
File saves = new File(".");
+12 -13
View File
@@ -16,9 +16,7 @@ import noppes.npcs.entity.EntityNPCInterface;
import noppes.npcs.entity.data.DataSkinOverlays;
import noppes.npcs.util.ValueUtil;
import java.util.ArrayList;
import java.util.Random;
import java.util.UUID;
import java.util.*;
public class DataDisplay {
public EntityNPCInterface npc;
@@ -45,7 +43,7 @@ public class DataDisplay {
public String glowTexture = "";
public int visible = 0; //0:visible 1:Invisible 2:semi-invisible
public int modelSize = 5;
public int showName = 0;
@@ -53,7 +51,7 @@ public class DataDisplay {
public int modelType = 0;
public boolean disableLivingAnimation = false;
public byte showBossBar = 0;
public ArrayList<UUID> invisibleToList = new ArrayList<>();
@@ -80,6 +78,7 @@ public class DataDisplay {
nbttagcompound.setString("Title", title);
nbttagcompound.setString("SkinUrl", url);
nbttagcompound.setString("Texture", texture);
nbttagcompound.setString("CloakTexture", cloakTexture);
nbttagcompound.setByte("UsingSkinUrl", skinType);
nbttagcompound.setString("GlowTexture", glowTexture);
@@ -94,7 +93,7 @@ public class DataDisplay {
NBTUtil.func_152460_a(nbttagcompound1, this.playerProfile);
nbttagcompound.setTag("SkinUsername", nbttagcompound1);
}
nbttagcompound.setInteger("Size", modelSize);
nbttagcompound.setInteger("modelType", modelType);
@@ -121,12 +120,12 @@ public class DataDisplay {
setMarkovGender(nbttagcompound.getInteger("MarkovGender"));
title = nbttagcompound.getString("Title");
url = nbttagcompound.getString("SkinUrl");
int prevSkinType = skinType;
skinType = nbttagcompound.getByte("UsingSkinUrl");
this.playerProfile = null;
if(skinType == 1){
if (nbttagcompound.hasKey("SkinUsername", 10)){
@@ -139,8 +138,9 @@ public class DataDisplay {
}
String prevTexture = texture;
texture = nbttagcompound.getString("Texture");
cloakTexture = nbttagcompound.getString("CloakTexture");
glowTexture = nbttagcompound.getString("GlowTexture");
@@ -169,7 +169,7 @@ public class DataDisplay {
modelSize = ConfigMain.NpcSizeLimit;
modelType = nbttagcompound.getInteger("modelType");
showName = nbttagcompound.getInteger("ShowName");
visible = nbttagcompound.getInteger("NpcVisible");
@@ -197,7 +197,7 @@ public class DataDisplay {
npc.textureLocation = null;
npc.updateHitbox();
}
public void loadProfile(){
if (this.playerProfile != null && !StringUtils.isNullOrEmpty(this.playerProfile.getName()) && MinecraftServer.getServer() != null){
if (!this.playerProfile.isComplete() || !this.playerProfile.getProperties().containsKey("textures")){
@@ -215,7 +215,7 @@ public class DataDisplay {
}
}
}
public boolean showName() {
if(npc.isKilled())
return false;
@@ -265,5 +265,4 @@ public class DataDisplay {
return;
this.markovGeneratorId = ValueUtil.clamp(id, 0, CustomNpcs.MARKOV_GENERATOR.length-1);
}
}
@@ -22,6 +22,7 @@ public class DataInventory implements IInventory {
public HashMap<Integer,ItemStack> items = new HashMap<Integer,ItemStack>();
public HashMap<Integer,Double> dropchance = new HashMap<Integer,Double>();
public HashMap<Integer,ItemStack> weapons = new HashMap<Integer, ItemStack>();
public HashMap<Integer,ItemStack> prevWeapons = new HashMap<Integer, ItemStack>();
public HashMap<Integer,ItemStack> armor = new HashMap<Integer, ItemStack>();
public int minExp = 0;
@@ -550,7 +550,7 @@ public class ClientProxy extends CommonProxy {
public FontContainer(String fontType, int fontSize) {
textFont = new StringCache();
textFont.setDefaultFont("Arial Unicode MS", fontSize, true);
textFont.setDefaultFont("Arial", fontSize, true);
useCustomFont = !fontType.equalsIgnoreCase("minecraft");
try {
if(!useCustomFont || fontType.isEmpty() || fontType.equalsIgnoreCase("default"))
@@ -558,7 +558,7 @@ public class ClientProxy extends CommonProxy {
else
textFont.setDefaultFont(fontType, fontSize, true);
} catch (Exception e) {
LogWriter.info("Failed loading font so using Arial Unicode MS");
LogWriter.info("Failed loading font so using Arial");
}
}
@@ -1,5 +1,6 @@
package noppes.npcs.client;
import kamkeel.addon.GeckoAddon;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.boss.EntityDragon;
import net.minecraft.entity.passive.EntityChicken;
@@ -83,7 +84,9 @@ public class EntityUtil {
for(int i = 0; i < 5; i++){
entity.setCurrentItemOrArmor(i, copied.getEquipmentInSlot(i));
}
GeckoAddon.instance.geckoCopyData(copied, entity);
if(copied instanceof EntityNPCInterface && entity instanceof EntityNPCInterface){
EntityNPCInterface npc = (EntityNPCInterface) copied;
EntityNPCInterface target = (EntityNPCInterface) entity;
@@ -375,5 +375,14 @@ public class PacketHandlerClient extends PacketHandlerServer{
else if(type == EnumPacketClient.STOP_SOUNDS) {
ScriptSoundController.Instance.stopAllSounds();
}
else if(type == EnumPacketClient.SYNC_WEAPON) {
Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(buffer.readInt());
if(!(entity instanceof EntityNPCInterface))
return;
EntityNPCInterface npc = (EntityNPCInterface) entity;
int weaponSlotIndex = buffer.readInt();
ItemStack stack = ItemStack.loadItemStackFromNBT(Server.readNBT(buffer));
npc.inventory.weapons.put(weaponSlotIndex,stack);
}
}
}
@@ -1,8 +1,3 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package noppes.npcs.client.gui.custom.components;
import com.ibm.icu.text.ArabicShaping;
@@ -85,7 +85,7 @@ public class CustomGuiScrollComponent extends GuiCustomScroll implements IDataHo
}
public ICustomGuiComponent toComponent() {
ScriptGuiScroll component = new ScriptGuiScroll(this.id, this.guiLeft - GuiCustom.guiLeft, this.guiTop - GuiCustom.guiTop, this.width, this.height, (String[])this.getList().toArray(new String[0]));
ScriptGuiScroll component = new ScriptGuiScroll(this.id, this.guiLeft - GuiCustom.guiLeft, this.guiTop - GuiCustom.guiTop, this.xSize, this.ySize, (String[])this.getList().toArray(new String[0]));
component.setHoverText(this.hoverText);
component.setColor(color);
component.setAlpha(alpha);
@@ -63,7 +63,7 @@ public class CustomGuiTexturedRect extends Gui implements IGuiComponent {
}
public void onRender(Minecraft mc, int mouseX, int mouseY, int mouseWheel, float partialTicks) {
boolean hovered = mouseX >= this.x + GuiCustom.guiLeft && mouseY >= this.y + GuiCustom.guiTop && mouseX < this.x + GuiCustom.guiLeft + this.width && mouseY < this.y + GuiCustom.guiTop + this.height;
boolean hovered = mouseX >= this.x + GuiCustom.guiLeft && mouseY >= this.y + GuiCustom.guiTop && mouseX < this.x + GuiCustom.guiLeft + this.width*scale && mouseY < this.y + GuiCustom.guiTop + this.height*scale;
if (this.imageData != null && this.imageData.imageLoaded()) {
int totalWidth = this.imageData.getTotalWidth();
@@ -80,7 +80,7 @@ public class CustomGuiTexturedRect extends Gui implements IGuiComponent {
float blue = (color & 255) / 255f;
GL11.glColor4f(red, green, blue, this.alpha);
GL11.glTranslatef(GuiCustom.guiLeft + this.x - u1 * totalWidth, GuiCustom.guiTop + this.y - v1 * totalHeight, (float) this.id);
GL11.glTranslatef(GuiCustom.guiLeft + this.x, GuiCustom.guiTop + this.y, (float) this.id);
GL11.glRotatef(this.rotation, 0.0F, 0.0F, 1.0F);
GL11.glScalef(this.scale, this.scale, this.scale);
@@ -1,6 +1,7 @@
package noppes.npcs.client.gui.mainmenu;
import com.mojang.authlib.GameProfile;
import kamkeel.addon.client.GeckoAddonClient;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.DataDisplay;
@@ -95,6 +96,7 @@ public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListene
addLabel(new GuiNpcLabel(10,"display.bossbar", guiLeft + 5, y + 5));
this.addButton(new GuiNpcButton(10, guiLeft + 120, y, 110, 20, new String[]{"display.hide","display.show","display.showAttacking"}, display.showBossBar));
GeckoAddonClient.Instance.geckoNpcDisplayInitGui(this);
}
@Override
@@ -192,6 +194,8 @@ public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListene
else if(button.id == 15){
setSubGui(new SubGuiNpcName(display));
}
GeckoAddonClient.Instance.geckoNpcDisplayActionPerformed(this, button);
}
@Override
@@ -1,5 +1,7 @@
package noppes.npcs.client.gui.model;
import kamkeel.addon.GeckoAddon;
import kamkeel.addon.client.GeckoAddonClient;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
@@ -42,8 +44,7 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol
for(Object name : mapping.keySet()){
Class<?> c = (Class<?>) mapping.get(name);
try {
if(!EntityCustomNpc.class.isAssignableFrom(c) && EntityLiving.class.isAssignableFrom(c) && c.getConstructor(new Class[] {World.class}) != null && !Modifier.isAbstract(c.getModifiers())){
if(RenderManager.instance.getEntityClassRenderObject(c) instanceof RendererLivingEntity)
if(!EntityCustomNpc.class.isAssignableFrom(c) && EntityLiving.class.isAssignableFrom(c) && c.getConstructor(World.class) != null && !Modifier.isAbstract(c.getModifiers())){ if(RenderManager.instance.getEntityClassRenderObject(c) instanceof RendererLivingEntity)
data.put(name.toString(),c.asSubclass(EntityLivingBase.class));
}
} catch (SecurityException e) {
@@ -166,6 +167,8 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol
addLabel(new GuiNpcLabel(201, "Breed", guiLeft, y + 5 + i * 22, 0xFFFFFF));
addButton(new GuiNpcButton(201, guiLeft + 80, y + i * 22, 50, 20, new String[]{"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16"}, breed));
}
GeckoAddonClient.Instance.showGeckoButtons(this, entity);
}
private boolean isIgnored(String tag){
for(String s : ignoredTags)
@@ -316,6 +319,8 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol
updateTexture();
} catch (Exception ignored) {}
}
GeckoAddonClient.Instance.geckoGuiCreationScreenActionPerformed(this, button);
}
private void updateTexture(){
@@ -128,7 +128,7 @@ public class GuiCustomScroll extends GuiScreen
i -= guiLeft;
j -= guiTop;
if(Mouse.isButtonDown(0)){
if(i >= xSize-11 && i < xSize-6 && j >= 4 && j < ySize){
if(i >= xSize-9 && i < xSize-4 && j >= 4 && j < ySize){
isScrolling = true;
}
}
@@ -2,6 +2,8 @@ package noppes.npcs.client.renderer;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
import kamkeel.addon.GeckoAddon;
import kamkeel.addon.client.GeckoAddonClient;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.gui.FontRenderer;
@@ -10,7 +12,6 @@ import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.texture.ITextureObject;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.resources.IResource;
import net.minecraft.client.resources.SkinManager;
@@ -32,7 +33,6 @@ import org.lwjgl.opengl.GL11;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.security.MessageDigest;
@@ -219,7 +219,9 @@ public class RenderNPCInterface extends RenderLiving{
protected void renderModel(EntityLivingBase entityliving, float par2, float par3, float par4, float par5, float par6, float par7) {
EntityNPCInterface npc = (EntityNPCInterface) entityliving;
if (this.getEntityTexture(entityliving) != null) {
if(GeckoAddonClient.Instance.isGeckoModel(mainModel)){
GeckoAddonClient.Instance.geckoRenderModel((ModelMPM) mainModel, npc, npc.rotationYaw, Minecraft.getMinecraft().timer.renderPartialTicks);
} else if (this.getEntityTexture(entityliving) != null) {
super.renderModel(entityliving, par2, par3, par4, par5, par6, par7);
}
@@ -290,6 +292,31 @@ public class RenderNPCInterface extends RenderLiving{
npc.display.overlayRenderTicks++;
}
}
private void renderGeoModel(EntityNPCInterface npc, float rot, float partial)
{
((ModelMPM) mainModel).entity.renderYawOffset = ((ModelMPM) mainModel).entity.prevRenderYawOffset = 0;
if (!npc.isInvisible())
{
RenderManager.instance.renderEntityWithPosYaw(((ModelMPM) mainModel).entity, 0,0,0,rot,partial);
}
else if (!npc.isInvisibleToPlayer(Minecraft.getMinecraft().thePlayer))
{
GL11.glPushMatrix();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.15F);
GL11.glDepthMask(false);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F);
RenderManager.instance.renderEntityWithPosYaw(((ModelMPM) mainModel).entity, 0,0,0,rot,partial);
GL11.glDisable(GL11.GL_BLEND);
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
GL11.glPopMatrix();
GL11.glDepthMask(true);
}
}
@Override
protected float handleRotationFloat(EntityLivingBase par1EntityLiving, float par2){
EntityNPCInterface npc = (EntityNPCInterface) par1EntityLiving;
@@ -50,5 +50,6 @@ public enum EnumPacketClient {
STOP_SOUND_FOR,
PAUSE_SOUNDS,
CONTINUE_SOUNDS,
STOP_SOUNDS
STOP_SOUNDS,
SYNC_WEAPON
}
@@ -39,10 +39,9 @@ public class ContainerCustomGui extends Container {
this.addPlayerInventory(player, this.customGui.getPlayerInvX(), this.customGui.getPlayerInvY());
}
Iterator var3 = this.customGui.getSlots().iterator();
while(var3.hasNext()) {
IItemSlot slot = (IItemSlot)var3.next();
slotCount=0;
inventorySlots.clear();
for (IItemSlot slot : this.customGui.getSlots()) {
if (slot.hasStack()) {
this.addSlot(player, slot.getPosX(), slot.getPosY(), slot, slot.getStack().getMCItemStack(), player.worldObj.isRemote);
} else {
@@ -32,6 +32,7 @@ public class CustomGuiController {
public static boolean updateGui(IPlayer player, ScriptGui gui) {
if (((EntityPlayerMP)player.getMCEntity()).openContainer instanceof ContainerCustomGui) {
((ContainerCustomGui)((EntityPlayerMP)player.getMCEntity()).openContainer).setGui(gui, (EntityPlayer)player.getMCEntity());
Server.sendDataChecked((EntityPlayerMP)player.getMCEntity(), EnumPacketClient.GUI_DATA, new Object[]{gui.toNBT()});
return true;
} else {
@@ -26,6 +26,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.pathfinding.PathNavigate;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.*;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
@@ -200,6 +201,21 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
if (this.ticksExisted % 10 == 0) {
EventHooks.onNPCUpdate(this);
}
for(int i=1;i<3;i++){
ItemStack itemstack = inventory.prevWeapons.get(i);
ItemStack itemstack1 = inventory.weapons.get(i);
if (!ItemStack.areItemStacksEqual(itemstack1, itemstack))
{
NBTTagCompound itemNBT = new NBTTagCompound();
if(itemstack1!=null){
itemstack1.writeToNBT(itemNBT);
}
for(Object obj: MinecraftServer.getServer().getConfigurationManager().playerEntityList){
Server.sendData((EntityPlayerMP) obj, EnumPacketClient.SYNC_WEAPON, getEntityId(), i, itemNBT);
}
inventory.prevWeapons.put(i,itemstack1 == null ? null : itemstack1.copy());
}
}
this.timers.update();
}
}
@@ -1553,6 +1569,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
compound.setInteger("StandingState", ai.standingType.ordinal());
compound.setInteger("MovingState", ai.movingType.ordinal());
compound.setInteger("Orientation", ai.orientation);
compound.setFloat("OffsetY",ai.bodyOffsetY);
compound.setInteger("Role", advanced.role.ordinal());
compound.setInteger("Job", advanced.job.ordinal());
if(advanced.job == EnumJobType.Bard){
@@ -1585,6 +1602,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
ai.standingType = EnumStandingType.values()[compound.getInteger("StandingState") % EnumStandingType.values().length];
ai.movingType = EnumMovingType.values()[compound.getInteger("MovingState") % EnumMovingType.values().length];
ai.orientation = compound.getInteger("Orientation");
ai.bodyOffsetY=compound.getFloat("OffsetY");
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(stats.maxHealth);
inventory.setArmor(NBTTags.getItemStackList(compound.getTagList("Armor", 10)));
@@ -19,6 +19,7 @@ import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.passive.EntityTameable;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Items;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.*;
@@ -378,7 +379,7 @@ public class NpcAPI extends AbstractNpcAPI {
scriptStack = new ScriptCustomItem(itemstack);
} else if (itemstack.getItem() instanceof ItemArmor) {
scriptStack = new ScriptItemArmor(itemstack);
} else if (itemstack.getItem() instanceof ItemBook) {
} else if (itemstack.getItem() instanceof ItemWritableBook || itemstack.getItem() instanceof ItemEditableBook || itemstack.getItem() == Items.written_book || itemstack.getItem() == Items.writable_book) {
scriptStack = new ScriptItemBook(itemstack);
} else if (itemstack.getItem() instanceof ItemBlock) {
scriptStack = new ScriptItemBlock(itemstack);
@@ -1126,7 +1126,7 @@ public class ScriptWorld implements IWorld {
/**
* Sends a packet from the server to the client everytime its called. Probably should not use this too much.
* @param particle Particle name. Particle name list: http://minecraft.gamepedia.com/Particles
* @param particle Particle name. Particle name list: http://minecraft.wiki/w/Particles
* @param x The x position
* @param y The y position
* @param z The z position
@@ -2,9 +2,10 @@ package noppes.npcs.scripted.constants;
public class RoleType {
public static final int UNKNOWN = 0;
public static final int MAILMAN = 1;
public static final int TRADER = 2;
public static final int FOLLOWER = 3;
public static final int BANK = 4;
public static final int TRANSPORTER = 5;
public static final int TRADER = 1;
public static final int FOLLOWER = 2;
public static final int BANK = 3;
public static final int TRANSPORTER = 4;
public static final int POSTMAN = 5;
public static final int COMPANION = 6;
}
@@ -237,7 +237,7 @@ public class ScriptLivingBase<T extends EntityLivingBase> extends ScriptEntity<T
}
/**
* Works the same as the <a href="http://minecraft.gamepedia.com/Commands#effect">/effect command</a>
* Works the same as the <a href="http://minecraft.wiki/w/Commands#effect">/effect command</a>
* @param effect
* @param duration The duration in seconds
* @param strength The amplifier of the potion effect
@@ -404,6 +404,8 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
return new ScriptRoleTrader(npc);
else if(npc.advanced.role == EnumRoleType.Transporter)
return new ScriptRoleTransporter(npc);
else if(npc.advanced.role == EnumRoleType.Companion)
return new ScriptRoleCompanion(npc);
return new ScriptRoleInterface(npc);
}
@@ -481,7 +483,7 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
npc.inventory.setOffHand(null);
else
npc.inventory.setOffHand(item.getMCItemStack());
npc.script.clientNeedsUpdate = true;
//npc.script.clientNeedsUpdate = true;
}
/**
@@ -629,7 +629,7 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
}
/**
* @param achievement The achievement id. For a complete list see http://minecraft.gamepedia.com/Achievements
* @param achievement The achievement id. For a complete list see http://minecraft.wiki/w/Achievements
* @return Returns whether or not the player has this achievement
*/
public boolean hasAchievement(String achievement){
@@ -0,0 +1,17 @@
package noppes.npcs.scripted.roles;
import noppes.npcs.api.roles.IRoleMailman;
import noppes.npcs.entity.EntityNPCInterface;
import noppes.npcs.scripted.constants.RoleType;
public class ScriptRoleCompanion extends ScriptRoleInterface implements IRoleMailman {
public ScriptRoleCompanion(EntityNPCInterface npc) {
super(npc);
}
@Override
public int getType(){
return RoleType.COMPANION;
}
}
@@ -12,6 +12,6 @@ public class ScriptRoleMailman extends ScriptRoleInterface implements IRoleMailm
@Override
public int getType(){
return RoleType.MAILMAN;
return RoleType.POSTMAN;
}
}
@@ -63,7 +63,7 @@ public class ScriptScoreboard implements IScoreboard {
/**
* @version 1.8
* @param objective Scoreboard objective name (1-16 chars)
* @param criteria The criteria see http://minecraft.gamepedia.com/Scoreboard#Objectives
* @param criteria The criteria see http://minecraft.wiki/w/Scoreboard#Objectives
* @return Returns the created ScoreboardObjective, returns null if it failed to create
*/
public IScoreboardObjective addObjective(String objective, String criteria){