mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-13 03:07:34 +00:00
Merge branch 'master' of https://github.com/KAMKEEL/CustomNPC-Plus
This commit is contained in:
commit
d867017871
26 files changed
+477
-342
No files matched your search
@@ -312,11 +312,14 @@ public class NoppesUtilServer {
|
||||
Server.sendAssociatedData(entity, EnumPacketClient.PARTICLE, entity.posX, entity.posY, entity.posZ, entity.height, entity.width, entity.yOffset, particle);
|
||||
}
|
||||
|
||||
public static void spawnScriptedParticle(Entity entity, String directory, int HEXcolor, int amount, int maxAge,
|
||||
public static void spawnScriptedParticle(String directory, int HEXcolor, int amount, int maxAge,
|
||||
double x, double y, double z,
|
||||
double motionX, double motionY, double motionZ, float gravity,
|
||||
float scale1, float scale2, float scaleRate, int scaleRateStart,
|
||||
float alpha1, float alpha2, float alphaRate, int alphaRateStart,
|
||||
float rotationX1, float rotationX2, float rotationXRate, int rotationXRateStart,
|
||||
float rotationY1, float rotationY2, float rotationYRate, int rotationYRateStart,
|
||||
float rotationZ1, float rotationZ2, float rotationZRate, int rotationZRateStart,
|
||||
int entityID
|
||||
){
|
||||
Server.sendToAll(EnumPacketClient.SCRIPTED_PARTICLE,
|
||||
@@ -325,6 +328,9 @@ public class NoppesUtilServer {
|
||||
motionX, motionY, motionZ, gravity,
|
||||
scale1, scale2, scaleRate, scaleRateStart,
|
||||
alpha1, alpha2, alphaRate, alphaRateStart,
|
||||
rotationX1, rotationX2, rotationXRate, rotationXRateStart,
|
||||
rotationY1, rotationY2, rotationYRate, rotationYRateStart,
|
||||
rotationZ1, rotationZ2, rotationZRate, rotationZRateStart,
|
||||
entityID
|
||||
);
|
||||
}
|
||||
|
||||
@@ -308,7 +308,16 @@ public class ServerEventsHandler {
|
||||
}
|
||||
String name = entityName;
|
||||
QuestKill quest = (QuestKill) data.quest.questInterface;
|
||||
if(quest.targetType == 1 && !(entity instanceof EntityNPCInterface))
|
||||
|
||||
Class entityType = EntityNPCInterface.class;
|
||||
if(quest.targetType == 2) {
|
||||
try {
|
||||
entityType = Class.forName(quest.customTargetType);
|
||||
} catch (ClassNotFoundException notFoundException) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if(quest.targetType > 0 && !(entityType.isInstance(entity)))
|
||||
continue;
|
||||
if(quest.targets.containsKey(entity.getCommandSenderName()))
|
||||
name = entity.getCommandSenderName();
|
||||
|
||||
@@ -166,79 +166,27 @@ public class FlyPathFinder extends PathFinder
|
||||
b0 = 1;
|
||||
}
|
||||
|
||||
FlyPathPoint pathpoint3 = this.getSafePoint(p_75860_1_, p_75860_2_.xCoord, p_75860_2_.yCoord, p_75860_2_.zCoord + 1, p_75860_3_, b0);
|
||||
FlyPathPoint pathpoint4 = this.getSafePoint(p_75860_1_, p_75860_2_.xCoord - 1, p_75860_2_.yCoord, p_75860_2_.zCoord, p_75860_3_, b0);
|
||||
FlyPathPoint pathpoint5 = this.getSafePoint(p_75860_1_, p_75860_2_.xCoord + 1, p_75860_2_.yCoord, p_75860_2_.zCoord, p_75860_3_, b0);
|
||||
FlyPathPoint pathpoint6 = this.getSafePoint(p_75860_1_, p_75860_2_.xCoord, p_75860_2_.yCoord, p_75860_2_.zCoord - 1, p_75860_3_, b0);
|
||||
for(int y = -1; y <= 1; y ++) {
|
||||
FlyPathPoint pathpoint3 = this.getSafePoint(p_75860_1_, p_75860_2_.xCoord, p_75860_2_.yCoord + y, p_75860_2_.zCoord + 1, p_75860_3_, b0);
|
||||
FlyPathPoint pathpoint4 = this.getSafePoint(p_75860_1_, p_75860_2_.xCoord - 1, p_75860_2_.yCoord + y, p_75860_2_.zCoord, p_75860_3_, b0);
|
||||
FlyPathPoint pathpoint5 = this.getSafePoint(p_75860_1_, p_75860_2_.xCoord + 1, p_75860_2_.yCoord + y, p_75860_2_.zCoord, p_75860_3_, b0);
|
||||
FlyPathPoint pathpoint6 = this.getSafePoint(p_75860_1_, p_75860_2_.xCoord, p_75860_2_.yCoord + y, p_75860_2_.zCoord - 1, p_75860_3_, b0);
|
||||
|
||||
FlyPathPoint pathpoint7 = this.getSafePoint(p_75860_1_, p_75860_2_.xCoord, p_75860_2_.yCoord + 1, p_75860_2_.zCoord + 1, p_75860_3_, b0);
|
||||
FlyPathPoint pathpoint8 = this.getSafePoint(p_75860_1_, p_75860_2_.xCoord - 1, p_75860_2_.yCoord + 1, p_75860_2_.zCoord, p_75860_3_, b0);
|
||||
FlyPathPoint pathpoint9 = this.getSafePoint(p_75860_1_, p_75860_2_.xCoord + 1, p_75860_2_.yCoord + 1, p_75860_2_.zCoord, p_75860_3_, b0);
|
||||
FlyPathPoint pathpoint10 = this.getSafePoint(p_75860_1_, p_75860_2_.xCoord, p_75860_2_.yCoord + 1, p_75860_2_.zCoord - 1, p_75860_3_, b0);
|
||||
if (pathpoint3 != null && !pathpoint3.isFirst && pathpoint3.distanceTo(p_75860_4_) < p_75860_5_) {
|
||||
this.pathOptions[i++] = pathpoint3;
|
||||
}
|
||||
|
||||
FlyPathPoint pathpoint11 = this.getSafePoint(p_75860_1_, p_75860_2_.xCoord, p_75860_2_.yCoord - 1, p_75860_2_.zCoord + 1, p_75860_3_, b0);
|
||||
FlyPathPoint pathpoint12 = this.getSafePoint(p_75860_1_, p_75860_2_.xCoord - 1, p_75860_2_.yCoord - 1, p_75860_2_.zCoord, p_75860_3_, b0);
|
||||
FlyPathPoint pathpoint13 = this.getSafePoint(p_75860_1_, p_75860_2_.xCoord + 1, p_75860_2_.yCoord - 1, p_75860_2_.zCoord, p_75860_3_, b0);
|
||||
FlyPathPoint pathpoint14 = this.getSafePoint(p_75860_1_, p_75860_2_.xCoord, p_75860_2_.yCoord - 1, p_75860_2_.zCoord - 1, p_75860_3_, b0);
|
||||
if (pathpoint4 != null && !pathpoint4.isFirst && pathpoint4.distanceTo(p_75860_4_) < p_75860_5_) {
|
||||
this.pathOptions[i++] = pathpoint4;
|
||||
}
|
||||
|
||||
if (pathpoint3 != null && !pathpoint3.isFirst && pathpoint3.distanceTo(p_75860_4_) < p_75860_5_)
|
||||
{
|
||||
this.pathOptions[i++] = pathpoint3;
|
||||
}
|
||||
if (pathpoint5 != null && !pathpoint5.isFirst && pathpoint5.distanceTo(p_75860_4_) < p_75860_5_) {
|
||||
this.pathOptions[i++] = pathpoint5;
|
||||
}
|
||||
|
||||
if (pathpoint4 != null && !pathpoint4.isFirst && pathpoint4.distanceTo(p_75860_4_) < p_75860_5_)
|
||||
{
|
||||
this.pathOptions[i++] = pathpoint4;
|
||||
}
|
||||
|
||||
if (pathpoint5 != null && !pathpoint5.isFirst && pathpoint5.distanceTo(p_75860_4_) < p_75860_5_)
|
||||
{
|
||||
this.pathOptions[i++] = pathpoint5;
|
||||
}
|
||||
|
||||
if (pathpoint6 != null && !pathpoint6.isFirst && pathpoint6.distanceTo(p_75860_4_) < p_75860_5_)
|
||||
{
|
||||
this.pathOptions[i++] = pathpoint6;
|
||||
}
|
||||
|
||||
if (pathpoint7 != null && !pathpoint7.isFirst && pathpoint7.distanceTo(p_75860_4_) < p_75860_5_)
|
||||
{
|
||||
this.pathOptions[i++] = pathpoint7;
|
||||
}
|
||||
|
||||
if (pathpoint8 != null && !pathpoint8.isFirst && pathpoint8.distanceTo(p_75860_4_) < p_75860_5_)
|
||||
{
|
||||
this.pathOptions[i++] = pathpoint8;
|
||||
}
|
||||
|
||||
if (pathpoint9 != null && !pathpoint9.isFirst && pathpoint9.distanceTo(p_75860_4_) < p_75860_5_)
|
||||
{
|
||||
this.pathOptions[i++] = pathpoint9;
|
||||
}
|
||||
|
||||
if (pathpoint10 != null && !pathpoint10.isFirst && pathpoint10.distanceTo(p_75860_4_) < p_75860_5_)
|
||||
{
|
||||
this.pathOptions[i++] = pathpoint10;
|
||||
}
|
||||
|
||||
if (pathpoint11 != null && !pathpoint11.isFirst && pathpoint11.distanceTo(p_75860_4_) < p_75860_5_)
|
||||
{
|
||||
this.pathOptions[i++] = pathpoint11;
|
||||
}
|
||||
|
||||
if (pathpoint12 != null && !pathpoint12.isFirst && pathpoint12.distanceTo(p_75860_4_) < p_75860_5_)
|
||||
{
|
||||
this.pathOptions[i++] = pathpoint12;
|
||||
}
|
||||
|
||||
if (pathpoint13 != null && !pathpoint13.isFirst && pathpoint13.distanceTo(p_75860_4_) < p_75860_5_)
|
||||
{
|
||||
this.pathOptions[i++] = pathpoint13;
|
||||
}
|
||||
|
||||
if (pathpoint14 != null && !pathpoint14.isFirst && pathpoint14.distanceTo(p_75860_4_) < p_75860_5_)
|
||||
{
|
||||
this.pathOptions[i++] = pathpoint14;
|
||||
if (pathpoint6 != null && !pathpoint6.isFirst && pathpoint6.distanceTo(p_75860_4_) < p_75860_5_) {
|
||||
this.pathOptions[i++] = pathpoint6;
|
||||
}
|
||||
}
|
||||
|
||||
return i;
|
||||
|
||||
@@ -29,48 +29,36 @@ public class FlyingMoveHelper extends EntityMoveHelper{
|
||||
if (this.update) {
|
||||
this.update = false;
|
||||
|
||||
double speed = this.entity.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue();
|
||||
double speedMult = 0.6000000238418579D / 0.5D;
|
||||
double speed = this.speed * this.entity.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue() * this.entity.ai.flySpeed;
|
||||
|
||||
double d0 = this.posX - this.entity.posX;
|
||||
double d1 = this.posY - this.entity.posY;
|
||||
double d1 = this.posY - MathHelper.floor_double(this.entity.boundingBox.minY + 0.05D);
|
||||
double d2 = this.posZ - this.entity.posZ;
|
||||
double d4 = d0 * d0 + d1 * d1 + d2 * d2;
|
||||
double d5 = MathHelper.sqrt_double(d4);
|
||||
|
||||
if (this.entity.hurtTime == 0 && d4 > 0.5D) {
|
||||
if (this.posY != this.entity.posY) {
|
||||
if (this.entity.motionY * Math.signum(this.entity.posY - this.posY) > 0.0D) {
|
||||
this.entity.motionY = 0.0D;
|
||||
double heightOffGround = 0;
|
||||
if(this.entity.ai.hasFlyLimit) {
|
||||
for (int blockY = (int) this.posY; blockY > 0; blockY--) {
|
||||
heightOffGround = this.posY - blockY;
|
||||
if (this.entity.worldObj.getBlock((int) this.posX, blockY, (int) this.posZ) != Blocks.air || heightOffGround > this.entity.ai.flyHeightLimit){
|
||||
break;
|
||||
}
|
||||
|
||||
double verticalSpeed = Math.abs(this.entity.posY - this.posY);
|
||||
if(verticalSpeed > speed * speedMult)
|
||||
verticalSpeed = speed * speedMult;
|
||||
verticalSpeed += this.entity.ai.flySpeed/2.0D;
|
||||
|
||||
if(verticalSpeed > Math.abs(this.entity.posY - this.posY))
|
||||
verticalSpeed = Math.abs(this.entity.posY - this.posY);
|
||||
|
||||
int blockY = (int) this.posY;
|
||||
double heightOffGround = 0;
|
||||
if(this.entity.ai.hasFlyLimit) {
|
||||
for (blockY = (int) this.posY; blockY > 0; blockY--) {
|
||||
heightOffGround = this.posY - blockY;
|
||||
if (this.entity.worldObj.getBlock((int) this.posX, blockY, (int) this.posZ) != Blocks.air || heightOffGround > this.entity.ai.flyHeightLimit){
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(heightOffGround < this.entity.ai.flyHeightLimit || !this.entity.ai.hasFlyLimit)
|
||||
this.entity.motionY -= Math.signum(this.entity.posY - this.posY) * verticalSpeed;
|
||||
}
|
||||
|
||||
double d5 = MathHelper.sqrt_double(d4);
|
||||
this.entity.motionX += (d0 / d5 * speed - this.entity.motionX) * speed * speedMult;
|
||||
this.entity.motionZ += (d2 / d5 * speed - this.entity.motionZ) * speed * speedMult;
|
||||
}
|
||||
|
||||
this.entity.rotationYaw = this.limitAngle(this.entity.rotationYaw,(float) ((Math.atan2(-d0, -d2) + Math.PI) * -(180F / Math.PI)),30.0F);
|
||||
if (this.entity.hurtTime == 0 && d4 > 0.5D) {
|
||||
this.entity.motionX += (d0 / d5 * speed - this.entity.motionX) * speed;
|
||||
this.entity.motionZ += (d2 / d5 * speed - this.entity.motionZ) * speed;
|
||||
|
||||
if (heightOffGround < this.entity.ai.flyHeightLimit || !this.entity.ai.hasFlyLimit) {
|
||||
this.entity.motionY += (d1 / d5 * speed - this.entity.motionY) * speed;
|
||||
}
|
||||
|
||||
this.entity.velocityChanged = true;
|
||||
}
|
||||
|
||||
this.entity.rotationYaw = this.limitAngle(this.entity.rotationYaw,(float) ((Math.atan2(-d0, -d2) + Math.PI) * -(180F / Math.PI)),18.0F);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -289,15 +289,15 @@ public class PathNavigateFlying extends PathNavigate {
|
||||
|
||||
private Vec3 getEntityPosition()
|
||||
{
|
||||
return Vec3.createVectorHelper(this.theEntity.posX, (double)this.getPathableYPos(), this.theEntity.posZ);
|
||||
return Vec3.createVectorHelper(this.theEntity.posX, this.getPathableYPos(), this.theEntity.posZ);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the safe pathing Y position for the entity depending on if it can path swim or not
|
||||
*/
|
||||
private int getPathableYPos()
|
||||
private double getPathableYPos()
|
||||
{
|
||||
return (int)(this.theEntity.boundingBox.minY + 0.5D);
|
||||
return this.theEntity.boundingBox.minY + 0.05D;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -98,6 +98,21 @@ public class NoppesUtil {
|
||||
float alphaRate = buffer.readFloat();
|
||||
int alphaRateStart = buffer.readInt();
|
||||
|
||||
float rotationX1 = buffer.readFloat();
|
||||
float rotationX2 = buffer.readFloat();
|
||||
float rotationXRate = buffer.readFloat();
|
||||
int rotationXRateStart = buffer.readInt();
|
||||
|
||||
float rotationY1 = buffer.readFloat();
|
||||
float rotationY2 = buffer.readFloat();
|
||||
float rotationYRate = buffer.readFloat();
|
||||
int rotationYRateStart = buffer.readInt();
|
||||
|
||||
float rotationZ1 = buffer.readFloat();
|
||||
float rotationZ2 = buffer.readFloat();
|
||||
float rotationZRate = buffer.readFloat();
|
||||
int rotationZRateStart = buffer.readInt();
|
||||
|
||||
int entityID = buffer.readInt();
|
||||
|
||||
World worldObj = Minecraft.getMinecraft().theWorld;
|
||||
@@ -113,6 +128,9 @@ public class NoppesUtil {
|
||||
motionX, motionY, motionZ, gravity,
|
||||
scale1, scale2, scaleRate, scaleRateStart,
|
||||
alpha1, alpha2, alphaRate, alphaRateStart,
|
||||
rotationX1, rotationX2, rotationXRate, rotationXRateStart,
|
||||
rotationY1, rotationY2, rotationYRate, rotationYRateStart,
|
||||
rotationZ1, rotationZ2, rotationZRate, rotationZRateStart,
|
||||
maxAge
|
||||
);
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.client.ClientProxy;
|
||||
import org.lwjgl.Sys;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class EntityCustomFX extends EntityFX {
|
||||
@@ -27,10 +26,31 @@ public class EntityCustomFX extends EntityFX {
|
||||
public float alphaRate = 0.0F;
|
||||
public int alphaRateStart = 0;
|
||||
|
||||
public float rotationX = 0;
|
||||
public float rotationX1 = 0;
|
||||
public float rotationX2 = 0;
|
||||
public float rotationXRate = 0.0F;
|
||||
public int rotationXRateStart = 0;
|
||||
|
||||
public float rotationY = 0;
|
||||
public float rotationY1 = 0;
|
||||
public float rotationY2 = 0;
|
||||
public float rotationYRate = 0.0F;
|
||||
public int rotationYRateStart = 0;
|
||||
|
||||
public float rotationZ = 0;
|
||||
public float rotationZ1 = 0;
|
||||
public float rotationZ2 = 0;
|
||||
public float rotationZRate = 0.0F;
|
||||
public int rotationZRateStart = 0;
|
||||
|
||||
public EntityCustomFX(Entity entity, String directory, int HEXColor, double x, double y, double z,
|
||||
double motionX, double motionY, double motionZ, float gravity,
|
||||
float scale1, float scale2, float scaleRate, int scaleRateStart,
|
||||
float alpha1, float alpha2, float alphaRate, int alphaRateStart,
|
||||
float rotationX1, float rotationX2, float rotationXRate, int rotationXRateStart,
|
||||
float rotationY1, float rotationY2, float rotationYRate, int rotationYRateStart,
|
||||
float rotationZ1, float rotationZ2, float rotationZRate, int rotationZRateStart,
|
||||
int age) {
|
||||
super(entity.worldObj, x, y, z, motionX, motionY, motionZ);
|
||||
|
||||
@@ -50,6 +70,30 @@ public class EntityCustomFX extends EntityFX {
|
||||
if(alpha1 > alpha2)
|
||||
this.alphaRate *= -1;
|
||||
|
||||
this.rotationX1 = rotationX1;
|
||||
this.rotationX2 = rotationX2;
|
||||
this.rotationXRate = Math.abs(rotationXRate);
|
||||
this.rotationXRateStart = rotationXRateStart;
|
||||
rotationX = rotationX1;
|
||||
if(rotationX1 > rotationX2)
|
||||
this.rotationXRate *= -1;
|
||||
|
||||
this.rotationY1 = rotationY1;
|
||||
this.rotationY2 = rotationY2;
|
||||
this.rotationYRate = Math.abs(rotationYRate);
|
||||
this.rotationYRateStart = rotationYRateStart;
|
||||
rotationY = rotationY1;
|
||||
if(rotationY1 > rotationY2)
|
||||
this.rotationYRate *= -1;
|
||||
|
||||
this.rotationZ1 = rotationZ1;
|
||||
this.rotationZ2 = rotationZ2;
|
||||
this.rotationZRate = Math.abs(rotationZRate);
|
||||
this.rotationZRateStart = rotationZRateStart;
|
||||
rotationZ = rotationZ1;
|
||||
if(rotationZ1 > rotationZ2)
|
||||
this.rotationZRate *= -1;
|
||||
|
||||
particleGravity = gravity/0.04F;
|
||||
particleMaxAge = age;
|
||||
|
||||
@@ -74,148 +118,92 @@ public class EntityCustomFX extends EntityFX {
|
||||
location = new ResourceLocation(directory);
|
||||
}
|
||||
|
||||
/*
|
||||
par2 = partial tick time
|
||||
par3 = ActiveRenderInfo.rotationX;
|
||||
par4 = ActiveRenderInfo.rotationZ;
|
||||
par5 = ActiveRenderInfo.rotationYZ;
|
||||
par6 = ActiveRenderInfo.rotationXY;
|
||||
par7 = ActiveRenderInfo.rotationXZ;
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
|
||||
public void renderParticle(Tessellator tessellator, float partialTick, float cosYaw, float cosPitch, float sinYaw, float sinSinPitch, float cosSinPitch)
|
||||
{
|
||||
if(move){
|
||||
startX = (float)(entity.prevPosX + (entity.posX - entity.prevPosX) * (double)par2);
|
||||
startY = (float)(entity.prevPosY + (entity.posY - entity.prevPosY) * (double)par2);
|
||||
startZ = (float)(entity.prevPosZ + (entity.posZ - entity.prevPosZ) * (double)par2);
|
||||
}
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.draw();
|
||||
|
||||
float scale = this.scaleRate / (float)particleMaxAge;
|
||||
if((this.scaleRate < 0 && particleScale+scale < this.scale2) || (this.scaleRate > 0 && particleScale+scale > this.scale2))
|
||||
particleScale = this.scale2;
|
||||
else if(particleAge >= this.scaleRateStart)
|
||||
particleScale += scale;
|
||||
|
||||
float alpha = this.alphaRate / (float)particleMaxAge;
|
||||
if((this.alphaRate < 0 && particleAlpha+alpha < this.alpha2) || (this.alphaRate > 0 && particleAlpha+alpha > this.alpha2))
|
||||
particleAlpha = this.alpha2;
|
||||
else if(particleAge >= this.alphaRateStart)
|
||||
particleAlpha += alpha;
|
||||
|
||||
ClientProxy.bindTexture(location);
|
||||
|
||||
float f = 0.0f;
|
||||
float f1 = 1.0f;
|
||||
float f2 = 0.0f;
|
||||
float f3 = 1.0f;
|
||||
float f4 = 0.1F * particleScale;
|
||||
float f5 = (float)(((prevPosX + (posX - prevPosX) * (double)par2) - interpPosX) + startX);
|
||||
float f6 = (float)(((prevPosY + (posY - prevPosY) * (double)par2) - interpPosY) + startY);
|
||||
float f7 = (float)(((prevPosZ + (posZ - prevPosZ) * (double)par2) - interpPosZ) + startZ);
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setBrightness(240);
|
||||
par1Tessellator.setColorOpaque_F(1, 1, 1);
|
||||
par1Tessellator.setColorRGBA_F(particleRed, particleGreen, particleBlue, particleAlpha);
|
||||
par1Tessellator.addVertexWithUV(f5 - par3 * f4 - par6 * f4, f6 - par4 * f4, f7 - par5 * f4 - par7 * f4, f1, f3);
|
||||
par1Tessellator.addVertexWithUV((f5 - par3 * f4) + par6 * f4, f6 + par4 * f4, (f7 - par5 * f4) + par7 * f4, f1, f2);
|
||||
par1Tessellator.addVertexWithUV(f5 + par3 * f4 + par6 * f4, f6 + par4 * f4, f7 + par5 * f4 + par7 * f4, f, f2);
|
||||
par1Tessellator.addVertexWithUV((f5 + par3 * f4) - par6 * f4, f6 - par4 * f4, (f7 + par5 * f4) - par7 * f4, f, f3);
|
||||
|
||||
/*
|
||||
Minecraft minecraft = Minecraft.getMinecraft();
|
||||
EntityPlayer player = minecraft.thePlayer;
|
||||
|
||||
double angle = Minecraft.getMinecraft().theWorld.getWorldTime()%360;
|
||||
double angleRad = (angle/180)*Math.PI;
|
||||
|
||||
double diffX = player.posX - this.startX;
|
||||
double diffY = player.posY - player.getYOffset() - this.startY;
|
||||
double diffZ = player.posZ - this.startZ;
|
||||
|
||||
double yaw = (player.rotationYaw/180)*Math.PI;
|
||||
double pitch = (player.rotationPitch/180)*Math.PI;
|
||||
|
||||
double angleX = Math.sin(yaw)*Math.cos(pitch);
|
||||
if(Math.abs(angleX) < 0.0001){
|
||||
angleX = 0.0D;
|
||||
}
|
||||
double angleY = Math.sin(pitch);
|
||||
if(Math.abs(angleY) < 0.0001){
|
||||
angleY = 0.0D;
|
||||
}
|
||||
double angleZ = -Math.cos(yaw)*Math.cos(pitch);
|
||||
if(Math.abs(angleZ) < 0.0001){
|
||||
angleZ = 0.0D;
|
||||
}
|
||||
|
||||
double angleXtranslateX = 0.0D;
|
||||
double angleXtranslateY = 0.0D;//(-diffY + Math.cos(angleRad)*diffY) + (-Math.sin(angleRad)*diffZ);
|
||||
double angleXtranslateZ = 0.0D;//(Math.sin(angleRad)*diffY) + (-diffZ + Math.cos(angleRad)*diffZ);
|
||||
|
||||
double angleYtranslateX = 0.0D;//(-diffX + Math.cos(angleRad)*diffX) + (Math.sin(angleRad)*diffZ);
|
||||
double angleYtranslateY = 0.0D;
|
||||
double angleYtranslateZ = 0.0D;//(-Math.sin(angleRad)*diffX) + (-diffZ + Math.cos(angleRad)*diffZ);
|
||||
|
||||
double angleZtranslateX = 0.0D;//(-diffX + Math.cos(angleRad)*diffX) + (-Math.sin(angleRad)*diffY);
|
||||
double angleZtranslateY = 0.0D;//(Math.sin(angleRad)*diffX) + (-diffY + Math.cos(angleRad)*diffY);
|
||||
double angleZtranslateZ = 0.0D;
|
||||
|
||||
double translateX = angleXtranslateX + angleYtranslateX + angleZtranslateX;
|
||||
double translateY = angleXtranslateY + angleYtranslateY + angleZtranslateY;
|
||||
double translateZ = angleXtranslateZ + angleYtranslateZ + angleZtranslateZ;
|
||||
|
||||
//distance in the X & Z plane
|
||||
double distXZ = Math.sqrt(Math.pow(diffX,2) + Math.pow(diffZ,2));
|
||||
//distance in the X & Y plane
|
||||
double distXY = Math.sqrt(Math.pow(diffX,2) + Math.pow(diffY,2));
|
||||
//distance in the Y & Z plane
|
||||
double distYZ = Math.sqrt(Math.pow(diffY,2) + Math.pow(diffZ,2));
|
||||
|
||||
double signDiffX = Math.signum(diffX);
|
||||
double signDiffY = Math.signum(diffY);
|
||||
double signDiffZ = Math.signum(diffZ);
|
||||
|
||||
double angleXtoNorm = Math.sin(Math.acos(diffX/distXZ));
|
||||
double angleZtoNorm = Math.sin(Math.acos(diffZ/distXZ));
|
||||
|
||||
double angleDiffX = (Math.abs(Math.cos(yaw))-angleXtoNorm);
|
||||
double angleDiffZ = (Math.abs(Math.cos(yaw))-angleZtoNorm);
|
||||
|
||||
double translateX = -Math.abs(angleDiffX*angleZ*distXZ)*signDiffX;
|
||||
double translateY = 0;
|
||||
double translateZ = -Math.abs(angleDiffX*angleX*distXZ)*signDiffZ + Math.cos(angleRad)*Math.abs(angleDiffX*angleX*distXZ)*signDiffZ;
|
||||
|
||||
if(minecraft.currentScreen == null) {
|
||||
System.out.println();
|
||||
//System.out.printf("diffX: %f, diffY: %f, diffZ: %f\n", diffX, diffY, diffZ);
|
||||
//System.out.printf("angleX: %f, angleY: %f, angleZ: %f\n", angleX, angleY, angleZ);
|
||||
//System.out.printf("angleXtoNorm: %f, angleZtoNorm: %f\n", angleXtoNorm, angleZtoNorm);
|
||||
System.out.printf("Math.sin(yaw): %f\n", Math.sin(yaw));
|
||||
System.out.printf("Math.cos(yaw): %f\n", Math.cos(yaw));
|
||||
//System.out.printf("Math.sin(pitch): %f\n", Math.sin(pitch));
|
||||
//System.out.printf("Math.cos(pitch): %f\n", Math.cos(pitch));
|
||||
System.out.printf("angleDiffX: %f\n", angleDiffX);
|
||||
System.out.printf("angleDiffZ: %f\n", angleDiffZ);
|
||||
System.out.printf("translateX: %f\n", Math.cos(angleRad)*Math.abs(angleDiffX*angleZ*distXZ)*signDiffX);
|
||||
System.out.printf("translateZ: %f\n", Math.cos(angleRad)*Math.abs(angleDiffX*angleX*distXZ)*signDiffZ);
|
||||
}
|
||||
*/
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glColor4f(1, 1, 1, 1.0F);
|
||||
ClientProxy.bindTexture(location);
|
||||
|
||||
//GL11.glTranslated(translateX,translateY,translateZ);
|
||||
//GL11.glRotated(angle, angleX, angleY, angleZ);
|
||||
if(move){
|
||||
startX = (float)(entity.prevPosX + (entity.posX - entity.prevPosX) * (double)partialTick);
|
||||
startY = (float)(entity.prevPosY + (entity.posY - entity.prevPosY) * (double)partialTick);
|
||||
startZ = (float)(entity.prevPosZ + (entity.posZ - entity.prevPosZ) * (double)partialTick);
|
||||
}
|
||||
|
||||
float scaleChange = this.scaleRate / (float)particleMaxAge;
|
||||
if((this.scaleRate < 0 && particleScale+scaleChange < this.scale2) || (this.scaleRate > 0 && particleScale+scaleChange > this.scale2))
|
||||
particleScale = this.scale2;
|
||||
else if(particleAge >= this.scaleRateStart)
|
||||
particleScale += scaleChange;
|
||||
|
||||
float alphaChange = this.alphaRate / (float)particleMaxAge;
|
||||
if((this.alphaRate < 0 && particleAlpha+alphaChange < this.alpha2) || (this.alphaRate > 0 && particleAlpha+alphaChange > this.alpha2))
|
||||
particleAlpha = this.alpha2;
|
||||
else if(particleAge >= this.alphaRateStart)
|
||||
particleAlpha += alphaChange;
|
||||
|
||||
float rotationXChange = this.rotationXRate / (float)particleMaxAge;
|
||||
if((this.rotationXRate < 0 && rotationX+rotationXChange < this.rotationX2) || (this.rotationXRate > 0 && rotationX+rotationXChange > this.rotationX2))
|
||||
rotationX = this.rotationX2;
|
||||
else if(particleAge >= this.rotationXRateStart)
|
||||
rotationX += rotationXChange;
|
||||
|
||||
float rotationYChange = this.rotationYRate / (float)particleMaxAge;
|
||||
if((this.rotationYRate < 0 && rotationY+rotationYChange < this.rotationY2) || (this.rotationYRate > 0 && rotationY+rotationYChange > this.rotationY2))
|
||||
rotationY = this.rotationY2;
|
||||
else if(particleAge >= this.rotationYRateStart)
|
||||
rotationY += rotationYChange;
|
||||
|
||||
float rotationZChange = this.rotationZRate / (float)particleMaxAge;
|
||||
if((this.rotationZRate < 0 && rotationZ+rotationZChange < this.rotationZ2) || (this.rotationZRate > 0 && rotationZ+rotationZChange > this.rotationZ2))
|
||||
rotationZ = this.rotationZ2;
|
||||
else if(particleAge >= this.rotationZRateStart)
|
||||
rotationZ += rotationZChange;
|
||||
|
||||
float u1 = 0.0f;
|
||||
float u2 = 1.0f;
|
||||
float v1 = 0.0f;
|
||||
float v2 = 1.0f;
|
||||
|
||||
float renderScale = 0.1F * particleScale;
|
||||
|
||||
float posX = (float)(((prevPosX + (this.posX - prevPosX) * (double)partialTick) - interpPosX) + startX);
|
||||
float posY = (float)(((prevPosY + (this.posY - prevPosY) * (double)partialTick) - interpPosY) + startY);
|
||||
float posZ = (float)(((prevPosZ + (this.posZ - prevPosZ) * (double)partialTick) - interpPosZ) + startZ);
|
||||
|
||||
GL11.glTranslated((double)posX, (double)posY, (double)posZ);
|
||||
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
double yaw = (player.rotationYaw/180)*Math.PI;
|
||||
double pitch = (player.rotationPitch/180)*Math.PI;
|
||||
|
||||
if(Math.abs(rotationX%360) >= 90 && Math.abs(rotationX%360) < 270) {
|
||||
rotationX += 180*Math.signum(rotationX);
|
||||
}
|
||||
if(Math.abs(rotationY%360) >= 90 && Math.abs(rotationY%360) < 270) {
|
||||
rotationY += 180*Math.signum(rotationY);
|
||||
}
|
||||
|
||||
GL11.glRotated(rotationX, Math.cos(yaw)*Math.cos(pitch),0.0,Math.sin(yaw)*Math.cos(pitch));
|
||||
GL11.glRotated(rotationY, -Math.sin(yaw)*Math.sin(pitch), Math.cos(pitch), Math.cos(yaw)*Math.sin(pitch));
|
||||
GL11.glRotated(rotationZ, Math.sin(yaw)*Math.cos(pitch), Math.sin(pitch), -Math.cos(yaw)*Math.cos(pitch));
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setBrightness(240);
|
||||
tessellator.setColorOpaque_F(1, 1, 1);
|
||||
tessellator.setColorRGBA_F(particleRed, particleGreen, particleBlue, particleAlpha);
|
||||
tessellator.addVertexWithUV( - cosYaw * renderScale - sinSinPitch * renderScale, - cosPitch * renderScale, - sinYaw * renderScale - cosSinPitch * renderScale, u2, v2);
|
||||
tessellator.addVertexWithUV(( - cosYaw * renderScale) + sinSinPitch * renderScale, + cosPitch * renderScale, ( - sinYaw * renderScale) + cosSinPitch * renderScale, u2, v1);
|
||||
tessellator.addVertexWithUV( + cosYaw * renderScale + sinSinPitch * renderScale, + cosPitch * renderScale, + sinYaw * renderScale + cosSinPitch * renderScale, u1, v1);
|
||||
tessellator.addVertexWithUV(( + cosYaw * renderScale) - sinSinPitch * renderScale, - cosPitch * renderScale, ( + sinYaw * renderScale) - cosSinPitch * renderScale, u1, v2);
|
||||
|
||||
tessellator.draw();
|
||||
ClientProxy.bindTexture(resource);
|
||||
tessellator.startDrawingQuads();
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glColor4f(1, 1, 1, 1.0F);
|
||||
ClientProxy.bindTexture(resource);
|
||||
tessellator.startDrawingQuads();
|
||||
}
|
||||
|
||||
public int getFXLayer(){
|
||||
|
||||
@@ -513,7 +513,7 @@ public class GuiCustom extends GuiScreen implements ICustomScrollListener, IGuiD
|
||||
}
|
||||
|
||||
protected void keyTyped(char typedChar, int keyCode) {
|
||||
if (keyCode == 1 || keyCode == this.mc.gameSettings.keyBindInventory.getKeyCode())
|
||||
if (keyCode == 1)
|
||||
{
|
||||
this.mc.thePlayer.closeScreen();
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ public class CustomGuiLabel extends Gui implements IGuiComponent {
|
||||
}
|
||||
|
||||
public void onRender(Minecraft mc, int mouseX, int mouseY, int mouseWheel, float partialTicks) {
|
||||
boolean hovered = mouseX >= this.field_146162_g && mouseY >= this.field_146174_h && mouseX < this.field_146162_g + this.field_146167_a && mouseY < this.field_146174_h + this.field_146161_f;
|
||||
boolean hovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.field_146167_a && mouseY < this.y + this.field_146161_f;
|
||||
this.drawLabel();
|
||||
if (hovered && this.hoverText != null && this.hoverText.length > 0) {
|
||||
this.parent.hoverText = this.hoverText;
|
||||
@@ -146,6 +146,8 @@ public class CustomGuiLabel extends Gui implements IGuiComponent {
|
||||
lbl.color = component.getColor();
|
||||
lbl.alpha = component.getAlpha();
|
||||
lbl.rotation = component.getRotation();
|
||||
lbl.field_146167_a = component.getWidth();
|
||||
lbl.field_146161_f = component.getHeight();
|
||||
|
||||
return lbl;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,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 && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
|
||||
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;
|
||||
mc.getTextureManager().bindTexture(this.texture);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
@@ -46,13 +46,14 @@ public class GuiNPCInv extends GuiContainerNPCInterface2 implements IGuiData, IT
|
||||
addLabel(new GuiNpcLabel(0,"inv.minExp", guiLeft + 118, guiTop + 18));
|
||||
addTextField(new GuiNpcTextField(0,this, fontRendererObj, guiLeft + 108, guiTop + 29, 60, 20, npc.inventory.minExp + ""));
|
||||
getTextField(0).integersOnly = true;
|
||||
getTextField(0).setMinMaxDefault(0, npc.inventory.maxExp, 0);
|
||||
|
||||
addLabel(new GuiNpcLabel(1,"inv.maxExp", guiLeft + 118, guiTop + 52));
|
||||
addTextField(new GuiNpcTextField(1,this, fontRendererObj, guiLeft + 108, guiTop + 63, 60, 20, npc.inventory.maxExp + ""));
|
||||
getTextField(1).integersOnly = true;
|
||||
getTextField(1).setMinMaxDefault(npc.inventory.maxExp, Short.MAX_VALUE, 0);
|
||||
|
||||
|
||||
getTextField(0).setMinMaxDefault(0, getTextField(1).getInteger(), 0);
|
||||
getTextField(1).setMinMaxDefault(getTextField(0).getInteger(), Short.MAX_VALUE, 0);
|
||||
|
||||
addButton(new GuiNpcButton(10, guiLeft + 88, guiTop + 88, 80, 20, new String[]{"stats.normal", "inv.auto"}, npc.inventory.lootMode));
|
||||
|
||||
addLabel(new GuiNpcLabel(2,"inv.npcInventory", guiLeft + 191, guiTop + 5));
|
||||
@@ -194,7 +195,9 @@ public class GuiNPCInv extends GuiContainerNPCInterface2 implements IGuiData, IT
|
||||
public void unFocused(GuiNpcTextField textfield) {
|
||||
if(textfield.id >= 2){
|
||||
chances.put(textfield.id-2, Double.parseDouble(textfield.getText()));
|
||||
this.save();
|
||||
}
|
||||
getTextField(0).setMinMaxDefault(0, getTextField(1).getInteger(), 0);
|
||||
getTextField(1).setMinMaxDefault(getTextField(0).getInteger(), Short.MAX_VALUE, 0);
|
||||
this.save();
|
||||
}
|
||||
}
|
||||
@@ -88,8 +88,12 @@ public class GuiNpcQuestTypeKill extends SubGuiInterface implements ITextfieldLi
|
||||
addScroll(scroll);
|
||||
|
||||
guiTop += 50;
|
||||
this.addButton(new GuiNpcButton(0, guiLeft + 4, guiTop + 300, 98, 20, "gui.back"));
|
||||
this.addButton(new GuiNpcButton(1, guiLeft + 4, guiTop + 260, 98, 20, new String[]{"Any", "NPCs"}, quest.targetType));
|
||||
this.addButton(new GuiNpcButton(0, guiLeft + 4, guiTop + 310, 98, 20, "gui.back"));
|
||||
this.addButton(new GuiNpcButton(1, guiLeft + 4, guiTop + 260, 98, 20, new String[]{"Any", "NPCs", "Custom"}, quest.targetType));
|
||||
|
||||
this.addTextField(new GuiNpcTextField(36, this, fontRendererObj, guiLeft + 4, guiTop + 282, 180, 20, quest.customTargetType));
|
||||
this.getTextField(36).setVisible(this.getButton(1).getValue() == 2);
|
||||
|
||||
guiTop -= 50;
|
||||
|
||||
scroll.visible = GuiNpcTextField.isFieldActive();
|
||||
@@ -101,7 +105,8 @@ public class GuiNpcQuestTypeKill extends SubGuiInterface implements ITextfieldLi
|
||||
close();
|
||||
}
|
||||
if (guibutton.id == 1) {
|
||||
quest.targetType = guibutton.displayString.equals("NPCs") ? 1 : 0;
|
||||
quest.targetType = this.getButton(1).getValue();
|
||||
this.getTextField(36).setVisible(this.getButton(1).getValue() == 2);
|
||||
}
|
||||
}
|
||||
public void mouseClicked(int i, int j, int k)
|
||||
@@ -117,6 +122,9 @@ public class GuiNpcQuestTypeKill extends SubGuiInterface implements ITextfieldLi
|
||||
if(guiNpcTextField.id < 12)
|
||||
lastSelected = guiNpcTextField;
|
||||
|
||||
if(guiNpcTextField.id == 36)
|
||||
quest.customTargetType = guiNpcTextField.getText();
|
||||
|
||||
saveTargets();
|
||||
}
|
||||
private void saveTargets(){
|
||||
|
||||
@@ -163,8 +163,6 @@ public class GuiNpcPuppet extends GuiModelInterface implements ISliderListener{
|
||||
}
|
||||
if(btn.id == 170 || btn.id == 171 || btn.id == 172){
|
||||
if(btn.id == 170){
|
||||
// System.out.println(part.rotationX);
|
||||
/// System.out.println(rotateX.sliderValue);
|
||||
part.rotationX = 0.0f;
|
||||
rotateX.sliderValue = 0.5f;
|
||||
int percent = (int) ((rotateX.sliderValue) * 360);
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
package noppes.npcs.entity;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.EntityAISwimming;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class EntityNPCFlying extends EntityNPCInterface {
|
||||
@@ -30,17 +26,21 @@ public abstract class EntityNPCFlying extends EntityNPCInterface {
|
||||
super.updateFallState(p_180433_1_, p_180433_3_);
|
||||
}
|
||||
|
||||
public void onLivingUpdate()
|
||||
@Override
|
||||
public boolean isOnLadder(){
|
||||
return false;
|
||||
}
|
||||
|
||||
public void moveEntityWithHeading(float p_70612_1_, float p_70612_2_)
|
||||
{
|
||||
super.onLivingUpdate();
|
||||
if(!canFly()){
|
||||
if(!this.canFly() || this.hurtTime != 0) {
|
||||
super.moveEntityWithHeading(p_70612_1_, p_70612_2_);
|
||||
return;
|
||||
}
|
||||
|
||||
int blockY = (int) this.posY;
|
||||
double heightOffGround = 0;
|
||||
if(this.ai.hasFlyLimit) {
|
||||
for (blockY = (int) this.posY; blockY > 0; blockY--) {
|
||||
for (int blockY = (int) this.posY; blockY > 0; blockY--) {
|
||||
heightOffGround = this.posY - blockY;
|
||||
if (this.worldObj.getBlock((int) this.posX, blockY, (int) this.posZ) != Blocks.air || heightOffGround > this.ai.flyHeightLimit){
|
||||
break;
|
||||
@@ -48,24 +48,19 @@ public abstract class EntityNPCFlying extends EntityNPCInterface {
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.onGround && !this.velocityChanged && this.motionY < 0 && this.hurtTime == 0)
|
||||
{
|
||||
if(heightOffGround >= this.ai.flyHeightLimit && this.ai.hasFlyLimit){
|
||||
this.motionY *= 0.8D;
|
||||
this.velocityChanged = true;
|
||||
} else {
|
||||
this.motionY *= this.ai.flyGravity;
|
||||
this.velocityChanged = true;
|
||||
}
|
||||
if(heightOffGround > this.ai.flyHeightLimit && this.ai.hasFlyLimit){
|
||||
super.moveEntityWithHeading(p_70612_1_,p_70612_2_);
|
||||
return;
|
||||
}
|
||||
|
||||
double d3 = this.motionY;
|
||||
super.moveEntityWithHeading(p_70612_1_, p_70612_2_);
|
||||
this.motionY = d3;
|
||||
|
||||
this.fallDistance = 0.0F;
|
||||
this.velocityChanged = true;
|
||||
|
||||
if(this.getNavigator().noPath())
|
||||
this.motionY = 0.0D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnLadder(){
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -243,6 +243,11 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
script.setWorld(world);
|
||||
}
|
||||
|
||||
public int getMaxSafePointTries()
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attackEntityAsMob(Entity par1Entity){
|
||||
float f = stats.getAttackStrength();
|
||||
@@ -1812,4 +1817,6 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
{
|
||||
this.display.modelType = val;
|
||||
}
|
||||
|
||||
protected void updateLeashedState(){}
|
||||
}
|
||||
@@ -55,6 +55,42 @@ public class DataTimers implements ITimers {
|
||||
}
|
||||
}
|
||||
|
||||
public int ticks(int id){
|
||||
return this.timers.get(Integer.valueOf(id)).ticks;
|
||||
}
|
||||
|
||||
public void setTicks(int id, int ticks){
|
||||
DataTimers.Timer timer = (DataTimers.Timer)this.timers.get(Integer.valueOf(id));
|
||||
if(ticks < 0)
|
||||
ticks = 0;
|
||||
if(ticks > timer.timerTicks)
|
||||
ticks = timer.timerTicks;
|
||||
|
||||
timer.ticks = ticks;
|
||||
}
|
||||
|
||||
public int maxTicks(int id){
|
||||
return this.timers.get(Integer.valueOf(id)).timerTicks;
|
||||
}
|
||||
|
||||
public void setMaxTicks(int id, int maxTicks){
|
||||
DataTimers.Timer timer = (DataTimers.Timer)this.timers.get(Integer.valueOf(id));
|
||||
if(maxTicks < 0)
|
||||
maxTicks = 0;
|
||||
if(timer.ticks > maxTicks)
|
||||
timer.ticks = maxTicks;
|
||||
|
||||
timer.timerTicks = maxTicks;
|
||||
}
|
||||
|
||||
public boolean repeats(int id){
|
||||
return this.timers.get(Integer.valueOf(id)).repeat;
|
||||
}
|
||||
|
||||
public void setRepeats(int id, boolean repeat){
|
||||
this.timers.get(Integer.valueOf(id)).repeat = repeat;
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound compound) {
|
||||
NBTTagList list = new NBTTagList();
|
||||
Iterator var3 = this.timers.values().iterator();
|
||||
|
||||
@@ -20,12 +20,14 @@ import noppes.npcs.scripted.handler.data.IQuestObjective;
|
||||
public class QuestKill extends QuestInterface implements IQuestKill {
|
||||
public HashMap<String,Integer> targets = new HashMap<String,Integer>();
|
||||
public int targetType = 0;
|
||||
public String customTargetType = "noppes.npcs.entity.EntityCustomNpc";
|
||||
|
||||
@Override
|
||||
public void writeEntityToNBT(NBTTagCompound compound) {
|
||||
compound.setTag("QuestKills", NBTTags.nbtStringIntegerMap(targets));
|
||||
//compound.setTag("QuestDialogs", NBTTags.nbtStringIntegerMap(targets));
|
||||
compound.setInteger("TargetType",targetType);
|
||||
compound.setString("CustomTargetType",customTargetType);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -40,6 +42,7 @@ public class QuestKill extends QuestInterface implements IQuestKill {
|
||||
|
||||
//targets = NBTTags.getStringIntegerMap(compound.getTagList("QuestDialogs", 10));
|
||||
targetType = compound.getInteger("TargetType");
|
||||
customTargetType = compound.getString("CustomTargetType");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -106,8 +109,8 @@ public class QuestKill extends QuestInterface implements IQuestKill {
|
||||
public void setTargetType(int type) {
|
||||
if(type < 0)
|
||||
type = 0;
|
||||
if(type > 1)
|
||||
type = 1;
|
||||
if(type > 2)
|
||||
type = 2;
|
||||
|
||||
this.targetType = type;
|
||||
}
|
||||
|
||||
@@ -18,17 +18,35 @@ public class ScriptEntityParticle {
|
||||
private float alpha1 = 1.0f,alpha2 = 1.0f,alphaRate = 0.0f;
|
||||
private int scaleRateStart = 0, alphaRateStart = 0;
|
||||
|
||||
public float rotationX1 = 0;
|
||||
public float rotationX2 = 0;
|
||||
public float rotationXRate = 0.0F;
|
||||
public int rotationXRateStart = 0;
|
||||
|
||||
public float rotationY1 = 0;
|
||||
public float rotationY2 = 0;
|
||||
public float rotationYRate = 0.0F;
|
||||
public int rotationYRateStart = 0;
|
||||
|
||||
public float rotationZ1 = 0;
|
||||
public float rotationZ2 = 0;
|
||||
public float rotationZRate = 0.0F;
|
||||
public int rotationZRateStart = 0;
|
||||
|
||||
public ScriptEntityParticle(String directory){
|
||||
this.directory = directory;
|
||||
}
|
||||
|
||||
public void spawnOnEntity(ScriptEntity entity){
|
||||
int entityID = entity.getMCEntity().getEntityId();
|
||||
NoppesUtilServer.spawnScriptedParticle(entity.getMCEntity(), directory, HEXcolor, amount, maxAge,
|
||||
NoppesUtilServer.spawnScriptedParticle(directory, HEXcolor, amount, maxAge,
|
||||
x, y, z,
|
||||
motionX, motionY, motionZ, gravity,
|
||||
scale1, scale2, scaleRate, scaleRateStart,
|
||||
alpha1, alpha2, alphaRate, alphaRateStart,
|
||||
rotationX1, rotationX2, rotationXRate, rotationXRateStart,
|
||||
rotationY1, rotationY2, rotationYRate, rotationYRateStart,
|
||||
rotationZ1, rotationZ2, rotationZRate, rotationZRateStart,
|
||||
entityID
|
||||
);
|
||||
}
|
||||
@@ -52,11 +70,9 @@ public class ScriptEntityParticle {
|
||||
public double getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public double getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public double getZ() {
|
||||
return z;
|
||||
}
|
||||
@@ -64,50 +80,56 @@ public class ScriptEntityParticle {
|
||||
public double getMotionX() {
|
||||
return motionX;
|
||||
}
|
||||
|
||||
public double getMotionY() {
|
||||
return motionY;
|
||||
}
|
||||
|
||||
public double getMotionZ() {
|
||||
return motionZ;
|
||||
}
|
||||
|
||||
public float getGravity() {
|
||||
return gravity;
|
||||
}
|
||||
|
||||
public float getScale1() {
|
||||
return scale1;
|
||||
}
|
||||
|
||||
public float getScale2() {
|
||||
return scale2;
|
||||
}
|
||||
|
||||
public float getScaleRate() {
|
||||
return scaleRate;
|
||||
}
|
||||
|
||||
public float getAlpha1() {
|
||||
return alpha1;
|
||||
}
|
||||
|
||||
public float getAlpha2() {
|
||||
return alpha2;
|
||||
}
|
||||
|
||||
public float getAlphaRate() {
|
||||
return alphaRate;
|
||||
}
|
||||
public int getAlphaRateStart() {
|
||||
return alphaRateStart;
|
||||
}
|
||||
|
||||
public float getScale1() {
|
||||
return scale1;
|
||||
}
|
||||
public float getScale2() {
|
||||
return scale2;
|
||||
}
|
||||
public float getScaleRate() {
|
||||
return scaleRate;
|
||||
}
|
||||
public int getScaleRateStart() {
|
||||
return scaleRateStart;
|
||||
}
|
||||
|
||||
public int getAlphaRateStart() {
|
||||
return alphaRateStart;
|
||||
}
|
||||
public float getRotationX1() {return rotationX1;}
|
||||
public float getRotationX2() {return rotationX2;}
|
||||
public float getRotationXRate() {return rotationXRate;}
|
||||
public int getRotationXRateStart() {return rotationXRateStart;}
|
||||
|
||||
public float getRotationY1() {return rotationY1;}
|
||||
public float getRotationY2() {return rotationY2;}
|
||||
public float getRotationYRate() {return rotationYRate;}
|
||||
public int getRotationYRateStart() {return rotationYRateStart;}
|
||||
|
||||
public float getRotationZ1() {return rotationZ1;}
|
||||
public float getRotationZ2() {return rotationZ2;}
|
||||
public float getRotationZRate() {return rotationZRate;}
|
||||
public int getRotationZRateStart() {return rotationZRateStart;}
|
||||
|
||||
public void setDirectory(String directory) {
|
||||
this.directory = directory;
|
||||
@@ -130,15 +152,12 @@ public class ScriptEntityParticle {
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public void setX(double x) {
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
public void setY(double y) {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public void setZ(double z) {
|
||||
this.z = z;
|
||||
}
|
||||
@@ -149,19 +168,15 @@ public class ScriptEntityParticle {
|
||||
this.motionZ = motionZ;
|
||||
this.gravity = gravity;
|
||||
}
|
||||
|
||||
public void setMotionX(double motionX) {
|
||||
this.motionX = motionX;
|
||||
}
|
||||
|
||||
public void setMotionY(double motionY) {
|
||||
this.motionY = motionY;
|
||||
}
|
||||
|
||||
public void setMotionZ(double motionZ) {
|
||||
this.motionZ = motionZ;
|
||||
}
|
||||
|
||||
public void setGravity(float gravity) {
|
||||
this.gravity = gravity;
|
||||
}
|
||||
@@ -172,19 +187,15 @@ public class ScriptEntityParticle {
|
||||
this.scaleRate = scaleRate;
|
||||
this.scaleRateStart = scaleRateStart;
|
||||
}
|
||||
|
||||
public void setScale1(float scale1) {
|
||||
this.scale1 = scale1;
|
||||
}
|
||||
|
||||
public void setScale2(float scale2) {
|
||||
this.scale2 = scale2;
|
||||
}
|
||||
|
||||
public void setScaleRate(float scaleRate) {
|
||||
this.scaleRate = scaleRate;
|
||||
}
|
||||
|
||||
public void setScaleRateStart(int scaleRateStart) {
|
||||
this.scaleRateStart = scaleRateStart;
|
||||
}
|
||||
@@ -195,20 +206,49 @@ public class ScriptEntityParticle {
|
||||
this.alphaRate = alphaRate;
|
||||
this.alphaRateStart = alphaRateStart;
|
||||
}
|
||||
|
||||
public void setAlpha1(float alpha1) {
|
||||
this.alpha1 = alpha1;
|
||||
}
|
||||
|
||||
public void setAlpha2(float alpha2) {
|
||||
this.alpha2 = alpha2;
|
||||
}
|
||||
|
||||
public void setAlphaRate(float alphaRate) {
|
||||
this.alphaRate = alphaRate;
|
||||
}
|
||||
|
||||
public void setAlphaRateStart(int alphaRateStart) {
|
||||
this.alphaRateStart = alphaRateStart;
|
||||
}
|
||||
|
||||
public void setRotationX(float rotationX1, float rotationX2, float rotationXRate, int rotationXRateStart){
|
||||
this.rotationX1 = rotationX1;
|
||||
this.rotationX2 = rotationX2;
|
||||
this.rotationXRate = rotationXRate;
|
||||
this.rotationXRateStart = rotationXRateStart;
|
||||
}
|
||||
public void setRotationX1(float rotationX1) {this.rotationX1 = rotationX1;}
|
||||
public void setRotationX2(float rotationX2) {this.rotationX2 = rotationX2;}
|
||||
public void setRotationXRate(float rotationXRate) {this.rotationXRate = rotationXRate;}
|
||||
public void setRotationXRateStart(int rotationXRateStart) {this.rotationXRateStart = rotationXRateStart;}
|
||||
|
||||
public void setRotationY(float rotationY1, float rotationY2, float rotationYRate, int rotationYRateStart){
|
||||
this.rotationY1 = rotationY1;
|
||||
this.rotationY2 = rotationY2;
|
||||
this.rotationYRate = rotationYRate;
|
||||
this.rotationYRateStart = rotationYRateStart;
|
||||
}
|
||||
public void setRotationY1(float rotationY1) {this.rotationY1 = rotationY1;}
|
||||
public void setRotationY2(float rotationY2) {this.rotationY2 = rotationY2;}
|
||||
public void setRotationYRate(float rotationYRate) {this.rotationYRate = rotationYRate;}
|
||||
public void setRotationYRateStart(int rotationYRateStart) {this.rotationYRateStart = rotationYRateStart;}
|
||||
|
||||
public void setRotationZ(float rotationZ1, float rotationZ2, float rotationZRate, int rotationZRateStart){
|
||||
this.rotationZ1 = rotationZ1;
|
||||
this.rotationZ2 = rotationZ2;
|
||||
this.rotationZRate = rotationZRate;
|
||||
this.rotationZRateStart = rotationZRateStart;
|
||||
}
|
||||
public void setRotationZ1(float rotationZ1) {this.rotationZ1 = rotationZ1;}
|
||||
public void setRotationZ2(float rotationZ2) {this.rotationZ2 = rotationZ2;}
|
||||
public void setRotationZRate(float rotationZRate) {this.rotationZRate = rotationZRate;}
|
||||
public void setRotationZRateStart(int rotationZRateStart) {this.rotationZRateStart = rotationZRateStart;}
|
||||
}
|
||||
@@ -224,23 +224,33 @@ public class ScriptItemStack implements IItemStack {
|
||||
}
|
||||
|
||||
public String[] getLore() {
|
||||
NBTTagCompound compound = this.item.getTagCompound().getCompoundTag("display");
|
||||
if (compound != null && compound.func_150299_b("Lore") == 9) {
|
||||
NBTTagList nbttaglist = compound.getTagList("Lore", 8);
|
||||
if (nbttaglist.tagCount() < 1) {
|
||||
return new String[0];
|
||||
} else {
|
||||
List<String> lore = new ArrayList();
|
||||
if (this.item.getTagCompound() != null) {
|
||||
NBTTagCompound compound = this.item.getTagCompound().getCompoundTag("display");
|
||||
if(compound != null && compound.func_150299_b("Lore") == 9) {
|
||||
NBTTagList nbttaglist = compound.getTagList("Lore", 8);
|
||||
if (nbttaglist.tagCount() > 0) {
|
||||
List<String> lore = new ArrayList();
|
||||
|
||||
for(int i = 0; i < nbttaglist.tagCount(); ++i) {
|
||||
lore.add(nbttaglist.getStringTagAt(i));
|
||||
for (int i = 0; i < nbttaglist.tagCount(); ++i) {
|
||||
lore.add(nbttaglist.getStringTagAt(i));
|
||||
}
|
||||
|
||||
return (String[]) ((String[]) lore.toArray(new String[lore.size()]));
|
||||
}
|
||||
|
||||
return (String[])((String[])lore.toArray(new String[lore.size()]));
|
||||
}
|
||||
} else {
|
||||
return new String[0];
|
||||
}
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
public boolean hasLore() {
|
||||
if (this.item.getTagCompound() != null) {
|
||||
NBTTagCompound compound = this.item.getTagCompound().getCompoundTag("display");
|
||||
if (compound != null && compound.func_150299_b("Lore") == 9) {
|
||||
NBTTagList nbttaglist = compound.getTagList("Lore", 8);
|
||||
return nbttaglist.tagCount() > 0;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setLore(String[] lore) {
|
||||
|
||||
@@ -445,6 +445,26 @@ public class ScriptDBCPlayer<T extends EntityPlayerMP> extends ScriptPlayer<T>{
|
||||
}
|
||||
|
||||
public void setForm(byte form){
|
||||
if(form < 0)
|
||||
return;
|
||||
|
||||
switch(getRace()){
|
||||
case 0:
|
||||
case 3:
|
||||
if(form > 3)
|
||||
return;
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
if(form > 15)
|
||||
return;
|
||||
break;
|
||||
case 4:
|
||||
if(form > 7)
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
player.getEntityData().getCompoundTag("PlayerPersisted").setByte("jrmcState",form);
|
||||
}
|
||||
public byte getForm(){
|
||||
|
||||
@@ -67,14 +67,21 @@ public class ScriptEntity<T extends Entity> implements IEntity {
|
||||
double x, double y, double z,
|
||||
double motionX, double motionY, double motionZ, float gravity,
|
||||
float scale1, float scale2, float scaleRate, int scaleRateStart,
|
||||
float alpha1, float alpha2, float alphaRate, int alphaRateStart
|
||||
float alpha1, float alpha2, float alphaRate, int alphaRateStart,
|
||||
float rotation1, float rotation2, float rotationRate, int rotationRateStart,
|
||||
float rotationX1, float rotationX2, float rotationXRate, int rotationXRateStart,
|
||||
float rotationY1, float rotationY2, float rotationYRate, int rotationYRateStart,
|
||||
float rotationZ1, float rotationZ2, float rotationZRate, int rotationZRateStart
|
||||
) {
|
||||
int entityID = entity.getEntityId();
|
||||
NoppesUtilServer.spawnScriptedParticle(entity, directory, HEXcolor, amount, maxAge,
|
||||
NoppesUtilServer.spawnScriptedParticle(directory, HEXcolor, amount, maxAge,
|
||||
x, y, z,
|
||||
motionX, motionY, motionZ, gravity,
|
||||
scale1, scale2, scaleRate, scaleRateStart,
|
||||
alpha1, alpha2, alphaRate, alphaRateStart,
|
||||
rotationX1, rotationX2, rotationXRate, rotationXRateStart,
|
||||
rotationY1, rotationY2, rotationYRate, rotationYRateStart,
|
||||
rotationZ1, rotationZ2, rotationZRate, rotationZRateStart,
|
||||
entityID
|
||||
);
|
||||
}
|
||||
|
||||
@@ -13,4 +13,10 @@ public class CustomNPCsEvent extends Event{
|
||||
|
||||
public CustomNPCsEvent() {
|
||||
}
|
||||
|
||||
public void setCancelled(boolean bo){
|
||||
this.setCanceled(bo);
|
||||
}
|
||||
|
||||
public boolean isCancelled(){return this.isCanceled();}
|
||||
}
|
||||
@@ -11,4 +11,12 @@ class ScriptEvent{
|
||||
public boolean isCancelled(){
|
||||
return isCancelled;
|
||||
}
|
||||
|
||||
public void setCanceled(boolean bo){
|
||||
isCancelled = bo;
|
||||
}
|
||||
|
||||
public boolean isCanceled(){
|
||||
return isCancelled;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package noppes.npcs.scripted.gui;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.gui.custom.GuiCustom;
|
||||
import noppes.npcs.scripted.interfaces.ITexturedRect;
|
||||
|
||||
public class ScriptGuiTexturedRect extends ScriptGuiComponent implements ITexturedRect {
|
||||
|
||||
@@ -34,12 +34,36 @@ public interface IEntity<T extends Entity> {
|
||||
* @param alpha2 The particle's ending transparency
|
||||
* @param scaleRate Multiplier for the particle's transparency growth rate
|
||||
* @param alphaRateStart The time at which the particle begins appearing/fading
|
||||
*
|
||||
* @param rotation1 The particle's starting rotation angle with respect to the player's vision
|
||||
* @param rotation2 The particle's final rotation angle with respect to the player's vision
|
||||
* @param rotationRate The rate at which the particle rotates with respect to the player's vision
|
||||
* @param rotationRateStart The time at which the particle begins rotating
|
||||
|
||||
* @param rotationX1 The particle's starting rotation angle with respect to the X-axis
|
||||
* @param rotationX2 The particle's final rotation angle with respect to the X-axis
|
||||
* @param rotationXRate The rate at which the particle rotates with respect to the X-axis
|
||||
* @param rotationXRateStart The time at which the particle begins rotating over the X-axis
|
||||
|
||||
* @param rotationY1 The particle's starting rotation angle with respect to the Y-axis
|
||||
* @param rotationY2 The particle's final rotation angle with respect to the Y-axis
|
||||
* @param rotationYRate The rate at which the particle rotates with respect to the Y-axis
|
||||
* @param rotationYRateStart The time at which the particle begins rotating over the Y-axis
|
||||
|
||||
* @param rotationZ1 The particle's starting rotation angle with respect to the Z-axis
|
||||
* @param rotationZ2 The particle's final rotation angle with respect to the Z-axis
|
||||
* @param rotationZRate The rate at which the particle rotates with respect to the Z-axis
|
||||
* @param rotationZRateStart The time at which the particle begins rotating over the Z-axis
|
||||
*/
|
||||
public void spawnParticle(String directory, int HEXcolor, int amount, int maxAge,
|
||||
double x, double y, double z,
|
||||
double motionX, double motionY, double motionZ, float gravity,
|
||||
float scale1, float scale2, float scaleRate, int scaleRateStart,
|
||||
float alpha1, float alpha2, float alphaRate, int alphaRateStart
|
||||
void spawnParticle(String directory, int HEXcolor, int amount, int maxAge,
|
||||
double x, double y, double z,
|
||||
double motionX, double motionY, double motionZ, float gravity,
|
||||
float scale1, float scale2, float scaleRate, int scaleRateStart,
|
||||
float alpha1, float alpha2, float alphaRate, int alphaRateStart,
|
||||
float rotation1, float rotation2, float rotationRate, int rotationRateStart,
|
||||
float rotationX1, float rotationX2, float rotationXRate, int rotationXRateStart,
|
||||
float rotationY1, float rotationY2, float rotationYRate, int rotationYRateStart,
|
||||
float rotationZ1, float rotationZ2, float rotationZRate, int rotationZRateStart
|
||||
);
|
||||
|
||||
public double getYOffset();
|
||||
|
||||
@@ -18,5 +18,17 @@ public interface ITimers {
|
||||
|
||||
void clear();
|
||||
|
||||
int ticks(int id);
|
||||
|
||||
void setTicks(int id, int ticks);
|
||||
|
||||
int maxTicks(int id);
|
||||
|
||||
void setMaxTicks(int id, int maxTicks);
|
||||
|
||||
boolean repeats(int id);
|
||||
|
||||
void setRepeats(int id, boolean repeat);
|
||||
|
||||
int size();
|
||||
}
|
||||
Reference in new issue
Block a user