mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-21 10:22:25 +00:00
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:
commit
00af353e65
602 files changed
+29702
-6562
No files matched your search
@@ -146,8 +146,20 @@ public class ScriptParticle implements IParticle {
|
||||
}
|
||||
|
||||
public void spawn(IWorld world, double x, double y, double z){
|
||||
double prevX = this.x;
|
||||
double prevY = this.y;
|
||||
double prevZ = this.z;
|
||||
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
|
||||
NBTTagCompound compound = this.writeToNBT();
|
||||
NoppesUtilServer.spawnScriptedParticle(compound, world.getDimensionID());
|
||||
|
||||
this.x = prevX;
|
||||
this.y = prevY;
|
||||
this.z = prevZ;
|
||||
}
|
||||
|
||||
public void spawnOnEntity(IEntity entity) {
|
||||
|
||||
@@ -149,4 +149,16 @@ public class ScriptLiving<T extends EntityLiving> extends ScriptLivingBase<T> im
|
||||
public boolean canBeSteered() {
|
||||
return this.entity.canBeSteered();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotation(float rotation){
|
||||
super.setRotation(rotation);
|
||||
entity.getLookHelper().setLookPosition(getX(), getY(), getZ(), rotation, getPitch());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPitch(float rotation){
|
||||
super.setPitch(rotation);
|
||||
entity.getLookHelper().setLookPosition(getX(), getY(), getZ(), getRotation(), rotation);
|
||||
}
|
||||
}
|
||||
@@ -225,6 +225,16 @@ public class ScriptLivingBase<T extends EntityLivingBase> extends ScriptEntity<T
|
||||
return getMCEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getRotation(){
|
||||
return entity.renderYawOffset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotation(float rotation){
|
||||
entity.renderYawOffset = rotation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes the entity swing its hand
|
||||
*/
|
||||
|
||||
@@ -93,21 +93,28 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
}
|
||||
|
||||
public void setRotation(float rotation){
|
||||
npc.ai.orientation = (int)rotation;
|
||||
super.setRotation(rotation);
|
||||
super.setRotation(rotation);
|
||||
int r = (int) rotation;
|
||||
if(npc.ais.orientation != r) {
|
||||
npc.updateClient = true;
|
||||
npc.rotationYawHead = npc.rotationYaw = npc.renderYawOffset = npc.ais.orientation = r;
|
||||
npc.prevRenderYawOffset = r;
|
||||
npc.prevRotationYaw = r;
|
||||
npc.prevRotationYawHead = r;
|
||||
}
|
||||
}
|
||||
|
||||
public void setRotationType(int rotationType){
|
||||
for (EnumStandingType e : EnumStandingType.values()) {
|
||||
if (e.ordinal() == rotationType) {
|
||||
npc.ai.standingType = e;
|
||||
npc.ais.standingType = e;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getRotationType(){
|
||||
return npc.ai.standingType.ordinal();
|
||||
return npc.ais.standingType.ordinal();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -116,7 +123,7 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
public void setMovingType(int movingType){
|
||||
for(EnumMovingType e : EnumMovingType.values()) {
|
||||
if (e.ordinal() == movingType) {
|
||||
npc.ai.movingType = e;
|
||||
npc.ais.movingType = e;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -126,7 +133,7 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
* @return The moving type of the npc. 0 = standing, 1 = wandering, 2 = moving path
|
||||
*/
|
||||
public int getMovingType(){
|
||||
return npc.ai.movingType.ordinal();
|
||||
return npc.ais.movingType.ordinal();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -170,7 +177,7 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
}
|
||||
|
||||
public IPos getHome() {
|
||||
return NpcAPI.Instance().getIPos(npc.ai.startPos[0],npc.ai.startPos[1],npc.ai.startPos[2]);
|
||||
return NpcAPI.Instance().getIPos(npc.ais.startPos[0],npc.ais.startPos[1],npc.ais.startPos[2]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -184,7 +191,7 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
* @param x The home x position
|
||||
*/
|
||||
public void setHomeX(int x){
|
||||
npc.ai.startPos[0] = x;
|
||||
npc.ais.startPos[0] = x;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -198,7 +205,7 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
* @param y The home y position
|
||||
*/
|
||||
public void setHomeY(int y){
|
||||
npc.ai.startPos[1] = y;
|
||||
npc.ais.startPos[1] = y;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -212,7 +219,7 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
* @param z The home x position
|
||||
*/
|
||||
public void setHomeZ(int z){
|
||||
npc.ai.startPos[2] = z;
|
||||
npc.ais.startPos[2] = z;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -221,11 +228,11 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
* @param z The home z position
|
||||
*/
|
||||
public void setHome(int x, int y, int z){
|
||||
npc.ai.startPos = new int[]{x, y, z};
|
||||
npc.ais.startPos = new int[]{x, y, z};
|
||||
}
|
||||
|
||||
public void setHome(IPos pos){
|
||||
npc.ai.startPos = new int[]{pos.getX(), pos.getY(), pos.getZ()};
|
||||
npc.ais.startPos = new int[]{pos.getX(), pos.getY(), pos.getZ()};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -240,14 +247,14 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
* @param bo Whether or not the npc will try to return to his home position
|
||||
*/
|
||||
public void setReturnToHome(boolean bo){
|
||||
npc.ai.returnToStart = bo;
|
||||
npc.ais.returnToStart = bo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Whether or not the npc returns home
|
||||
*/
|
||||
public boolean getReturnToHome(){
|
||||
return npc.ai.returnToStart;
|
||||
return npc.ais.returnToStart;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -697,29 +704,29 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
*/
|
||||
public void setAnimation(int type){
|
||||
if(type == AnimationType.NORMAL)
|
||||
npc.ai.animationType = EnumAnimation.NONE;
|
||||
npc.ais.animationType = EnumAnimation.NONE;
|
||||
else if(type == AnimationType.SITTING)
|
||||
npc.ai.animationType = EnumAnimation.SITTING;
|
||||
npc.ais.animationType = EnumAnimation.SITTING;
|
||||
else if(type == AnimationType.DANCING)
|
||||
npc.ai.animationType = EnumAnimation.DANCING;
|
||||
npc.ais.animationType = EnumAnimation.DANCING;
|
||||
else if(type == AnimationType.SNEAKING)
|
||||
npc.ai.animationType = EnumAnimation.SNEAKING;
|
||||
npc.ais.animationType = EnumAnimation.SNEAKING;
|
||||
else if(type == AnimationType.LYING)
|
||||
npc.ai.animationType = EnumAnimation.LYING;
|
||||
npc.ais.animationType = EnumAnimation.LYING;
|
||||
else if(type == AnimationType.HUGGING)
|
||||
npc.ai.animationType = EnumAnimation.HUG;
|
||||
npc.ais.animationType = EnumAnimation.HUG;
|
||||
}
|
||||
|
||||
public void setTacticalVariant(int variant){
|
||||
if(variant > EnumNavType.values().length-1 || variant < 0)
|
||||
return;
|
||||
|
||||
npc.ai.tacticalVariant = EnumNavType.values()[variant];
|
||||
npc.ai.directLOS = EnumNavType.values()[variant] != EnumNavType.Stalk && npc.ai.directLOS;
|
||||
npc.ais.tacticalVariant = EnumNavType.values()[variant];
|
||||
npc.ais.directLOS = EnumNavType.values()[variant] != EnumNavType.Stalk && npc.ais.directLOS;
|
||||
}
|
||||
|
||||
public int getTacticalVariant(){
|
||||
return npc.ai.tacticalVariant.ordinal();
|
||||
return npc.ais.tacticalVariant.ordinal();
|
||||
}
|
||||
|
||||
public void setTacticalVariant(String variant){
|
||||
@@ -732,22 +739,22 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
if(!found)
|
||||
return;
|
||||
|
||||
npc.ai.tacticalVariant = EnumNavType.valueOf(variant);
|
||||
npc.ais.tacticalVariant = EnumNavType.valueOf(variant);
|
||||
}
|
||||
|
||||
public String getTacticalVariantName(){
|
||||
return npc.ai.tacticalVariant.name();
|
||||
return npc.ais.tacticalVariant.name();
|
||||
}
|
||||
|
||||
public void setCombatPolicy(int variant){
|
||||
if(variant > EnumCombatPolicy.values().length-1 || variant < 0)
|
||||
return;
|
||||
|
||||
npc.ai.combatPolicy = EnumCombatPolicy.values()[variant];
|
||||
npc.ais.combatPolicy = EnumCombatPolicy.values()[variant];
|
||||
}
|
||||
|
||||
public int getCombatPolicy(){
|
||||
return npc.ai.combatPolicy.ordinal();
|
||||
return npc.ais.combatPolicy.ordinal();
|
||||
}
|
||||
|
||||
public void setCombatPolicy(String variant){
|
||||
@@ -760,22 +767,22 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
if(!found)
|
||||
return;
|
||||
|
||||
npc.ai.combatPolicy = EnumCombatPolicy.valueOf(variant);
|
||||
npc.ais.combatPolicy = EnumCombatPolicy.valueOf(variant);
|
||||
}
|
||||
|
||||
public String getCombatPolicyName(){
|
||||
return npc.ai.combatPolicy.name();
|
||||
return npc.ais.combatPolicy.name();
|
||||
}
|
||||
|
||||
public void setTacticalRadius(int tacticalRadius){
|
||||
if(tacticalRadius < 0)
|
||||
tacticalRadius = 0;
|
||||
|
||||
npc.ai.tacticalRadius = tacticalRadius;
|
||||
npc.ais.tacticalRadius = tacticalRadius;
|
||||
}
|
||||
|
||||
public int getTacticalRadius(){
|
||||
return npc.ai.tacticalRadius;
|
||||
return npc.ais.tacticalRadius;
|
||||
}
|
||||
|
||||
public void setIgnoreCobweb(boolean ignore){
|
||||
@@ -789,21 +796,21 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
public void setOnFoundEnemy(int onAttack){
|
||||
if(onAttack < 0 || onAttack > 3)
|
||||
return;
|
||||
npc.ai.onAttack = onAttack;
|
||||
npc.ais.onAttack = onAttack;
|
||||
}
|
||||
|
||||
public int onFoundEnemy(){
|
||||
return npc.ai.onAttack;
|
||||
return npc.ais.onAttack;
|
||||
}
|
||||
|
||||
public void setShelterFrom(int shelterFrom){
|
||||
if(shelterFrom < 0 || shelterFrom > 2)
|
||||
return;
|
||||
npc.ai.findShelter = shelterFrom;
|
||||
npc.ais.findShelter = shelterFrom;
|
||||
}
|
||||
|
||||
public int getShelterFrom(){
|
||||
return npc.ai.findShelter;
|
||||
return npc.ais.findShelter;
|
||||
}
|
||||
|
||||
public boolean hasLivingAnimation() {
|
||||
@@ -1188,7 +1195,7 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
if (type > 3)
|
||||
type = 3;
|
||||
|
||||
npc.ai.onAttack = type;
|
||||
npc.ais.onAttack = type;
|
||||
npc.updateTasks();
|
||||
}
|
||||
|
||||
@@ -1254,22 +1261,22 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
fly = 1;
|
||||
else fly = 0;
|
||||
|
||||
npc.ai.movementType = fly;
|
||||
npc.ais.movementType = fly;
|
||||
}
|
||||
|
||||
public boolean canFly(){
|
||||
return npc.ai.movementType == 1;
|
||||
return npc.ais.movementType == 1;
|
||||
}
|
||||
|
||||
public void setFlySpeed(double flySpeed){
|
||||
if(flySpeed < 0.0D)
|
||||
flySpeed = 0.0D;
|
||||
|
||||
npc.ai.flySpeed = flySpeed;
|
||||
npc.ais.flySpeed = flySpeed;
|
||||
}
|
||||
|
||||
public double getFlySpeed(double flySpeed){
|
||||
return npc.ai.flySpeed;
|
||||
return npc.ais.flySpeed;
|
||||
}
|
||||
|
||||
public void setFlyGravity(double flyGravity){
|
||||
@@ -1278,36 +1285,36 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
if(flyGravity > 1.0D)
|
||||
flyGravity = 1.0D;
|
||||
|
||||
npc.ai.flyGravity = flyGravity;
|
||||
npc.ais.flyGravity = flyGravity;
|
||||
}
|
||||
|
||||
public double getFlyGravity(double flySpeed){
|
||||
return npc.ai.flyGravity;
|
||||
return npc.ais.flyGravity;
|
||||
}
|
||||
|
||||
public void setFlyHeightLimit(int flyHeightLimit){
|
||||
if(flyHeightLimit < 0)
|
||||
flyHeightLimit = 0;
|
||||
|
||||
this.npc.ai.flyHeightLimit = flyHeightLimit;
|
||||
this.npc.ais.flyHeightLimit = flyHeightLimit;
|
||||
}
|
||||
public int getFlyHeightLimit(int flyHeightLimit){
|
||||
return this.npc.ai.flyHeightLimit;
|
||||
return this.npc.ais.flyHeightLimit;
|
||||
}
|
||||
|
||||
public void limitFlyHeight(boolean limit){
|
||||
this.npc.ai.hasFlyLimit = limit;
|
||||
this.npc.ais.hasFlyLimit = limit;
|
||||
}
|
||||
public boolean isFlyHeightLimited(boolean limit){
|
||||
return this.npc.ai.hasFlyLimit;
|
||||
return this.npc.ais.hasFlyLimit;
|
||||
}
|
||||
|
||||
public void setSpeed(double speed) {
|
||||
npc.ai.setWalkingSpeed(speed);
|
||||
npc.ais.setWalkingSpeed(speed);
|
||||
}
|
||||
|
||||
public double getSpeed() {
|
||||
return npc.ai.getWalkingSpeed();
|
||||
return npc.ais.getWalkingSpeed();
|
||||
}
|
||||
|
||||
public void setSkinType(byte type) {
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
package noppes.npcs.scripted.entity;
|
||||
|
||||
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.gui.GuiClosePacket;
|
||||
import kamkeel.npcs.network.packets.data.script.ScriptOverlayClosePacket;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -27,7 +32,6 @@ import noppes.npcs.api.item.IItemStack;
|
||||
import noppes.npcs.api.overlay.ICustomOverlay;
|
||||
import noppes.npcs.compat.PixelmonHelper;
|
||||
import noppes.npcs.config.ConfigScript;
|
||||
import noppes.npcs.constants.EnumPacketClient;
|
||||
import noppes.npcs.constants.EnumQuestRepeat;
|
||||
import noppes.npcs.constants.EnumQuestType;
|
||||
import noppes.npcs.containers.ContainerCustomGui;
|
||||
@@ -45,7 +49,6 @@ import noppes.npcs.util.ValueUtil;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T> implements IPlayer {
|
||||
public T player;
|
||||
@@ -263,8 +266,9 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
return;
|
||||
QuestData questdata = new QuestData(quest);
|
||||
data.questData.activeQuests.put(id, questdata);
|
||||
Server.sendData((EntityPlayerMP)player, EnumPacketClient.MESSAGE, "quest.newquest", quest.title);
|
||||
Server.sendData((EntityPlayerMP)player, EnumPacketClient.CHAT, "quest.newquest", ": ", quest.title);
|
||||
|
||||
AchievementPacket.sendAchievement((EntityPlayerMP) player, false, "quest.newquest", quest.title);
|
||||
ChatAlertPacket.sendChatAlert((EntityPlayerMP) player, "quest.newquest", ": ", quest.title);
|
||||
data.updateClient = true;
|
||||
}
|
||||
|
||||
@@ -756,7 +760,7 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
|
||||
public void closeGui() {
|
||||
((EntityPlayerMP)this.entity).closeContainer();
|
||||
Server.sendData((EntityPlayerMP)this.entity, EnumPacketClient.GUI_CLOSE, -1, new NBTTagCompound());
|
||||
GuiClosePacket.closeGUI(player, -1 , new NBTTagCompound());
|
||||
}
|
||||
|
||||
public void showCustomOverlay(ICustomOverlay overlay) {
|
||||
@@ -764,8 +768,8 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
}
|
||||
|
||||
public void closeOverlay(int id) {
|
||||
Server.sendData((EntityPlayerMP)this.entity, EnumPacketClient.SCRIPT_OVERLAY_CLOSE, id, new NBTTagCompound());
|
||||
}
|
||||
PacketHandler.Instance.sendToPlayer(new ScriptOverlayClosePacket(id), (EntityPlayerMP)this.entity);
|
||||
}
|
||||
|
||||
public IOverlayHandler getOverlays() {
|
||||
return this.getData().skinOverlays;
|
||||
|
||||
@@ -14,6 +14,7 @@ import noppes.npcs.api.entity.IEntity;
|
||||
import noppes.npcs.api.entity.IEntityLivingBase;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.api.event.IPlayerEvent;
|
||||
import noppes.npcs.api.handler.data.IPlayerEffect;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
import noppes.npcs.constants.EnumScriptType;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
@@ -949,4 +950,59 @@ public class PlayerEvent extends CustomNPCsEvent implements IPlayerEvent {
|
||||
return EnumScriptType.RANGED_LAUNCHED.function;
|
||||
}
|
||||
}
|
||||
|
||||
public static class EffectEvent extends PlayerEvent implements IPlayerEvent.EffectEvent {
|
||||
|
||||
public final IPlayerEffect effect;
|
||||
|
||||
public EffectEvent(IPlayer player, IPlayerEffect statusEffect) {
|
||||
super(player);
|
||||
this.effect = statusEffect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPlayerEffect getEffect() {
|
||||
return this.effect;
|
||||
}
|
||||
|
||||
public static class Added extends PlayerEvent.EffectEvent implements IPlayerEvent.EffectEvent.Added {
|
||||
|
||||
public Added(IPlayer player, IPlayerEffect statusEffect) {
|
||||
super(player, statusEffect);
|
||||
}
|
||||
|
||||
}
|
||||
public static class Ticked extends PlayerEvent.EffectEvent implements IPlayerEvent.EffectEvent.Ticked {
|
||||
|
||||
public Ticked(IPlayer player, IPlayerEffect statusEffect) {
|
||||
super(player, statusEffect);
|
||||
}
|
||||
|
||||
}
|
||||
public static class Removed extends PlayerEvent.EffectEvent implements IPlayerEvent.EffectEvent.Removed {
|
||||
|
||||
private final ExpirationType type;
|
||||
|
||||
public Removed(IPlayer player, IPlayerEffect statusEffect, ExpirationType type) {
|
||||
super(player, statusEffect);
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTimerRunOut() {
|
||||
return type == ExpirationType.RUN_OUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean causedByDeath() {
|
||||
return type == ExpirationType.DEATH;
|
||||
}
|
||||
}
|
||||
|
||||
public enum ExpirationType {
|
||||
REMOVED,
|
||||
RUN_OUT,
|
||||
DEATH
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,10 +21,7 @@ public class ScriptCustomItem extends ScriptItemStack implements IItemCustom, IN
|
||||
public boolean enabled = false;
|
||||
public boolean loaded = false;
|
||||
|
||||
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;
|
||||
@@ -36,12 +33,8 @@ public class ScriptCustomItem extends ScriptItemStack implements IItemCustom, IN
|
||||
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 Display itemDisplay = new Display();
|
||||
|
||||
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;
|
||||
public long lastInited = -1;
|
||||
|
||||
public ScriptCustomItem(ItemStack item) {
|
||||
@@ -148,13 +141,13 @@ public class ScriptCustomItem extends ScriptItemStack implements IItemCustom, IN
|
||||
}
|
||||
|
||||
public String getTexture() {
|
||||
return this.texture == null ? "" : this.texture;
|
||||
return this.itemDisplay.texture == null ? "" : this.itemDisplay.texture;
|
||||
}
|
||||
|
||||
public void setTexture(String texture){
|
||||
if(texture == null)
|
||||
texture = "";
|
||||
this.texture = texture;
|
||||
this.itemDisplay.texture = texture;
|
||||
saveItemData();
|
||||
}
|
||||
|
||||
@@ -218,29 +211,29 @@ public class ScriptCustomItem extends ScriptItemStack implements IItemCustom, IN
|
||||
}
|
||||
|
||||
public boolean getDurabilityShow() {
|
||||
return this.durabilityShow;
|
||||
return this.itemDisplay.durabilityShow;
|
||||
}
|
||||
|
||||
public void setDurabilityShow(boolean bo) {
|
||||
this.durabilityShow = bo;
|
||||
this.itemDisplay.durabilityShow = bo;
|
||||
saveItemData();
|
||||
}
|
||||
|
||||
public int getDurabilityColor() {
|
||||
return this.durabilityColor;
|
||||
return this.itemDisplay.durabilityColor;
|
||||
}
|
||||
|
||||
public void setDurabilityColor(int color) {
|
||||
this.durabilityColor = color;
|
||||
this.itemDisplay.durabilityColor = color;
|
||||
saveItemData();
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return this.itemColor;
|
||||
return this.itemDisplay.itemColor;
|
||||
}
|
||||
|
||||
public void setColor(int color) {
|
||||
this.itemColor = color;
|
||||
this.itemDisplay.itemColor = color;
|
||||
saveItemData();
|
||||
}
|
||||
|
||||
@@ -272,79 +265,79 @@ public class ScriptCustomItem extends ScriptItemStack implements IItemCustom, IN
|
||||
}
|
||||
|
||||
public void setRotation(float rotationX, float rotationY, float rotationZ){
|
||||
this.rotationX = rotationX;
|
||||
this.rotationY = rotationY;
|
||||
this.rotationZ = rotationZ;
|
||||
this.itemDisplay.rotationX = rotationX;
|
||||
this.itemDisplay.rotationY = rotationY;
|
||||
this.itemDisplay.rotationZ = rotationZ;
|
||||
saveItemData();
|
||||
}
|
||||
|
||||
public void setRotationRate(float rotationXRate, float rotationYRate, float rotationZRate){
|
||||
this.rotationXRate = rotationXRate;
|
||||
this.rotationYRate = rotationYRate;
|
||||
this.rotationZRate = rotationZRate;
|
||||
this.itemDisplay.rotationXRate = rotationXRate;
|
||||
this.itemDisplay.rotationYRate = rotationYRate;
|
||||
this.itemDisplay.rotationZRate = rotationZRate;
|
||||
saveItemData();
|
||||
}
|
||||
|
||||
public void setScale(float scaleX, float scaleY, float scaleZ){
|
||||
this.scaleX = scaleX;
|
||||
this.scaleY = scaleY;
|
||||
this.scaleZ = scaleZ;
|
||||
this.itemDisplay.scaleX = scaleX;
|
||||
this.itemDisplay.scaleY = scaleY;
|
||||
this.itemDisplay.scaleZ = scaleZ;
|
||||
saveItemData();
|
||||
}
|
||||
|
||||
public void setTranslate(float translateX, float translateY, float translateZ){
|
||||
this.translateX = translateX;
|
||||
this.translateY = translateY;
|
||||
this.translateZ = translateZ;
|
||||
this.itemDisplay.translateX = translateX;
|
||||
this.itemDisplay.translateY = translateY;
|
||||
this.itemDisplay.translateZ = translateZ;
|
||||
saveItemData();
|
||||
}
|
||||
|
||||
public float getRotationX() {
|
||||
return rotationX;
|
||||
return this.itemDisplay.rotationX;
|
||||
}
|
||||
|
||||
public float getRotationY() {
|
||||
return rotationY;
|
||||
return this.itemDisplay.rotationY;
|
||||
}
|
||||
|
||||
public float getRotationZ() {
|
||||
return rotationZ;
|
||||
return this.itemDisplay.rotationZ;
|
||||
}
|
||||
|
||||
public float getRotationXRate() {
|
||||
return rotationXRate;
|
||||
return this.itemDisplay.rotationXRate;
|
||||
}
|
||||
|
||||
public float getRotationYRate() {
|
||||
return rotationYRate;
|
||||
return this.itemDisplay.rotationYRate;
|
||||
}
|
||||
|
||||
public float getRotationZRate() {
|
||||
return rotationZRate;
|
||||
return this.itemDisplay.rotationZRate;
|
||||
}
|
||||
|
||||
public float getScaleX() {
|
||||
return scaleX;
|
||||
return this.itemDisplay.scaleX;
|
||||
}
|
||||
|
||||
public float getScaleY() {
|
||||
return scaleY;
|
||||
return this.itemDisplay.scaleY;
|
||||
}
|
||||
|
||||
public float getScaleZ() {
|
||||
return scaleZ;
|
||||
return this.itemDisplay.scaleZ;
|
||||
}
|
||||
|
||||
public float getTranslateX() {
|
||||
return translateX;
|
||||
return this.itemDisplay.translateX;
|
||||
}
|
||||
|
||||
public float getTranslateY() {
|
||||
return translateY;
|
||||
return this.itemDisplay.translateY;
|
||||
}
|
||||
|
||||
public float getTranslateZ() {
|
||||
return translateZ;
|
||||
return this.itemDisplay.translateZ;
|
||||
}
|
||||
|
||||
public NBTTagCompound getMCNbt() {
|
||||
@@ -360,28 +353,28 @@ public class ScriptCustomItem extends ScriptItemStack implements IItemCustom, IN
|
||||
}
|
||||
|
||||
public NBTTagCompound getItemNBT(NBTTagCompound compound) {
|
||||
compound.setBoolean("DurabilityShow",this.durabilityShow);
|
||||
compound.setBoolean("DurabilityShow",this.itemDisplay.durabilityShow);
|
||||
compound.setDouble("DurabilityValue",this.durabilityValue);
|
||||
compound.setInteger("DurabilityColor",this.durabilityColor );
|
||||
compound.setInteger("ItemColor",this.itemColor);
|
||||
compound.setInteger("DurabilityColor",this.itemDisplay.durabilityColor );
|
||||
compound.setInteger("ItemColor",this.itemDisplay.itemColor);
|
||||
compound.setInteger("MaxStackSize",this.stackSize);
|
||||
compound.setString("ItemTexture",this.texture);
|
||||
compound.setString("ItemTexture",this.itemDisplay.texture);
|
||||
|
||||
compound.setFloat("RotationX",this.rotationX);
|
||||
compound.setFloat("RotationY",this.rotationY);
|
||||
compound.setFloat("RotationZ",this.rotationZ);
|
||||
compound.setFloat("RotationX",this.itemDisplay.rotationX);
|
||||
compound.setFloat("RotationY",this.itemDisplay.rotationY);
|
||||
compound.setFloat("RotationZ",this.itemDisplay.rotationZ);
|
||||
|
||||
compound.setFloat("RotationXRate",this.rotationXRate);
|
||||
compound.setFloat("RotationYRate",this.rotationYRate);
|
||||
compound.setFloat("RotationZRate",this.rotationZRate);
|
||||
compound.setFloat("RotationXRate",this.itemDisplay.rotationXRate);
|
||||
compound.setFloat("RotationYRate",this.itemDisplay.rotationYRate);
|
||||
compound.setFloat("RotationZRate",this.itemDisplay.rotationZRate);
|
||||
|
||||
compound.setFloat("ScaleX",this.scaleX);
|
||||
compound.setFloat("ScaleY",this.scaleY);
|
||||
compound.setFloat("ScaleZ",this.scaleZ);
|
||||
compound.setFloat("ScaleX",this.itemDisplay.scaleX);
|
||||
compound.setFloat("ScaleY",this.itemDisplay.scaleY);
|
||||
compound.setFloat("ScaleZ",this.itemDisplay.scaleZ);
|
||||
|
||||
compound.setFloat("TranslateX",this.translateX);
|
||||
compound.setFloat("TranslateY",this.translateY);
|
||||
compound.setFloat("TranslateZ",this.translateZ);
|
||||
compound.setFloat("TranslateX",this.itemDisplay.translateX);
|
||||
compound.setFloat("TranslateY",this.itemDisplay.translateY);
|
||||
compound.setFloat("TranslateZ",this.itemDisplay.translateZ);
|
||||
|
||||
compound.setBoolean("IsTool", this.isTool);
|
||||
compound.setBoolean("IsNormalItem", this.isNormalItem);
|
||||
@@ -395,30 +388,30 @@ public class ScriptCustomItem extends ScriptItemStack implements IItemCustom, IN
|
||||
}
|
||||
|
||||
public void setItemNBT(NBTTagCompound compound) {
|
||||
this.durabilityShow = compound.getBoolean("DurabilityShow");
|
||||
this.itemDisplay.durabilityShow = compound.getBoolean("DurabilityShow");
|
||||
this.durabilityValue = compound.getDouble("DurabilityValue");
|
||||
if (compound.hasKey("DurabilityColor")) {
|
||||
this.durabilityColor = compound.getInteger("DurabilityColor");
|
||||
this.itemDisplay.durabilityColor = compound.getInteger("DurabilityColor");
|
||||
}
|
||||
this.itemColor = compound.getInteger("ItemColor");
|
||||
this.itemDisplay.itemColor = compound.getInteger("ItemColor");
|
||||
this.stackSize = compound.getInteger("MaxStackSize");
|
||||
this.texture = compound.getString("ItemTexture");
|
||||
this.itemDisplay.texture = compound.getString("ItemTexture");
|
||||
|
||||
this.rotationX = compound.getFloat("RotationX");
|
||||
this.rotationY = compound.getFloat("RotationY");
|
||||
this.rotationZ = compound.getFloat("RotationZ");
|
||||
this.itemDisplay.rotationX = compound.getFloat("RotationX");
|
||||
this.itemDisplay.rotationY = compound.getFloat("RotationY");
|
||||
this.itemDisplay.rotationZ = compound.getFloat("RotationZ");
|
||||
|
||||
this.rotationXRate = compound.getFloat("RotationXRate");
|
||||
this.rotationYRate = compound.getFloat("RotationYRate");
|
||||
this.rotationZRate = compound.getFloat("RotationZRate");
|
||||
this.itemDisplay.rotationXRate = compound.getFloat("RotationXRate");
|
||||
this.itemDisplay.rotationYRate = compound.getFloat("RotationYRate");
|
||||
this.itemDisplay.rotationZRate = compound.getFloat("RotationZRate");
|
||||
|
||||
this.scaleX = compound.getFloat("ScaleX");
|
||||
this.scaleY = compound.getFloat("ScaleY");
|
||||
this.scaleZ = compound.getFloat("ScaleZ");
|
||||
this.itemDisplay.scaleX = compound.getFloat("ScaleX");
|
||||
this.itemDisplay.scaleY = compound.getFloat("ScaleY");
|
||||
this.itemDisplay.scaleZ = compound.getFloat("ScaleZ");
|
||||
|
||||
this.translateX = compound.getFloat("TranslateX");
|
||||
this.translateY = compound.getFloat("TranslateY");
|
||||
this.translateZ = compound.getFloat("TranslateZ");
|
||||
this.itemDisplay.translateX = compound.getFloat("TranslateX");
|
||||
this.itemDisplay.translateY = compound.getFloat("TranslateY");
|
||||
this.itemDisplay.translateZ = compound.getFloat("TranslateZ");
|
||||
|
||||
this.isTool = compound.getBoolean("IsTool");
|
||||
this.isNormalItem = compound.getBoolean("IsNormalItem");
|
||||
@@ -461,4 +454,16 @@ public class ScriptCustomItem extends ScriptItemStack implements IItemCustom, IN
|
||||
this.setItemNBT(c.getCompoundTag("ItemData"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class Display {
|
||||
public String texture = "minecraft:textures/items/iron_pickaxe.png";
|
||||
public float translateX, translateY, translateZ;
|
||||
public int itemColor = 0x8B4513;
|
||||
public float scaleX = 1.0F, scaleY = 1.0F, scaleZ = 1.0F;
|
||||
public float rotationX, rotationY, rotationZ;
|
||||
public float rotationXRate, rotationYRate, rotationZRate;
|
||||
public boolean durabilityShow = false;
|
||||
public int durabilityColor = -1;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user