This commit is contained in:
fewizz committed 2016-04-05 13:41:09 +03:00
1 parent 0b8b56a74b
commit 3aef354b3a
16 files changed
+325 -269

No files matched your search

+4 -3
View File
@@ -1,6 +1,5 @@
package emt;
import ic2.core.Ic2Items;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
@@ -32,12 +31,14 @@ import org.apache.logging.log4j.Logger;
name = ModInformation.name,
version = ModInformation.version,
guiFactory = ModInformation.guiFactory,
dependencies = ModInformation.depend)
dependencies = ModInformation.depend
)
public class ElectroMagicTools {
@SidedProxy(
clientSide = ModInformation.clientProxy,
serverSide = ModInformation.commonProxy)
serverSide = ModInformation.commonProxy
)
public static CommonProxy proxy;
public static CreativeTabs tabEMT = new EMTCreativeTab(ModInformation.modid + ".creativeTab");
public static Logger logger = LogManager.getLogger(ModInformation.name);
@@ -1,84 +0,0 @@
package emt.client.renderer;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.ResourceLocation;
import static org.lwjgl.opengl.GL11.*;
import java.util.Random;
import emt.entity.EntityElectroBall;
import emt.util.EMTRandomHelper.Bolt;
import emt.util.EMTRandomHelper.Point;
public class RenderElectroBall extends Render {
@Override
public void doRender(Entity entity, double x, double y, double z, float p1, float p2) {
EntityElectroBall ball = (EntityElectroBall) entity;
if (ball.shootingEntity == null) {
if (ball.worldObj.isRemote) {
Tessellator tessellator = Tessellator.instance;
glPushMatrix();
glDisable(GL_LIGHTING);
glDisable(GL_FOG);
glDisable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
glTranslated(x, y, z);
renderBolt(ball, tessellator, 0, 0, 0, 8);
if (ball.inTile) {
renderBolt(ball, tessellator, 0, 0, 0, 0.5F);
if (ball.entityPositions != null) {
for (Point pos : ball.entityPositions) {
double trX = pos.x - entity.posX;
double trY = pos.y - entity.posY;
double trZ = pos.z - entity.posZ;
renderBolt(ball, tessellator, trX, trY, trZ, 8);
}
}
}
glPopMatrix();
glEnable(GL_FOG);
glEnable(GL_TEXTURE_2D);
}
}
}
public void renderBolt(EntityElectroBall ball, Tessellator tess, double x, double y, double z, double scale) {
for (int i = 0; i < ball.bolts.length; i++) {
Bolt bolt = ball.bolts[i];
glPushMatrix();
glTranslated(x, y, z);
glRotatef(bolt.angleZ, 0, 0, 1);
glRotatef(bolt.angleY, 0, 1, 0);
glLineWidth(2);
tess.startDrawing(GL_LINE_STRIP);
tess.setColorRGBA(255, 255, 255, 255);
for (Point point : bolt.points) {
tess.addVertex((point.x / scale), (point.y / scale), (point.z / scale));
}
tess.draw();
glPopMatrix();
}
}
@Override
protected ResourceLocation getEntityTexture(Entity entity) {
return null;
}
}
@@ -0,0 +1,116 @@
package emt.client.renderer;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.ResourceLocation;
import static org.lwjgl.opengl.GL11.*;
import java.util.Random;
import emt.entity.EntityEnergyBall;
import emt.util.EMTRandomHelper.Bolt;
import emt.util.EMTRandomHelper.Point;
public class RenderEnergyBall extends Render {
@Override
public void doRender(Entity entity, double x, double y, double z, float p1, float p2) {
EntityEnergyBall ball = (EntityEnergyBall) entity;
if (ball.shootingEntity == null) {
if (ball.worldObj.isRemote) {
Tessellator tess = Tessellator.instance;
glPushMatrix();
glDisable(GL_LIGHTING);
glDisable(GL_FOG);
glDisable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
glTranslated(x, y, z);
/*******************************************/
for (int i = 0; i < ball.bolts.length; i++) {
Bolt bolt = ball.bolts[i];
glPushMatrix();
glRotatef(bolt.angleZ, 0, 0, 1);
glRotatef(bolt.angleY, 0, 1, 0);
glLineWidth(2);
tess.startDrawing(GL_LINE_STRIP);
for (Point point : bolt.points) {
tess.setColorRGBA(point.r & 0xff, point.g & 0xff, point.b & 0xff, 255);
tess.addVertex((point.x / 10), (point.y / 10), (point.z / 10));
}
tess.draw();
glPopMatrix();
}
/*******************************************/
if (ball.inTile) {
/** Horizontal **/
for (int i = 0; i < ball.bolts.length; i++) {
Bolt bolt = ball.bolts[i];
glPushMatrix();
glRotatef(bolt.angleY, 0, 1, 0);
glLineWidth(2);
tess.startDrawing(GL_LINE_STRIP);
tess.setColorRGBA(255, 255, 255, 255);
for (Point point : bolt.points) {
tess.addVertex(point.x / (60 / ball.ticksAlive), point.y / 4, point.z / (60 / ball.ticksAlive));
}
tess.draw();
glPopMatrix();
}
/****************/
if (ball.entityPositions != null) {
for (int i = 0; i < ball.entityPositions.length; i++) {
Point pos = ball.entityPositions[i];
double trX = pos.x - entity.posX;
double trY = pos.y - entity.posY;
double trZ = pos.z - entity.posZ;
for(int e = 0; e < ball.MAX_COUNT_OF_BOLTS; e++) {
Bolt bolt = ball.entityBolts[i][e];
glPushMatrix();
glTranslated(trX, trY, trZ);
glRotatef(bolt.angleZ, 0, 0, 1);
glRotatef(bolt.angleY, 0, 1, 0);
glLineWidth(2);
tess.startDrawing(GL_LINE_STRIP);
for (Point point : bolt.points) {
tess.setColorRGBA(point.r & 0xff, point.g & 0xff, point.b & 0xff, 255);
tess.addVertex(point.x / 4 , point.y / 4, point.z / 4);
}
tess.draw();
glPopMatrix();
}
}
}
}
glPopMatrix();
glEnable(GL_FOG);
glEnable(GL_TEXTURE_2D);
}
}
}
@Override
protected ResourceLocation getEntityTexture(Entity entity) {
return null;
}
}
@@ -14,13 +14,14 @@ public class RenderLaser extends Render {
private static final ResourceLocation laserTexture = new ResourceLocation(ModInformation.texturePath, "textures/models/lasermodel.png");
@Override
public void doRender(Entity entityLaser, double x, double y, double z, float par8, float par9) {
this.bindEntityTexture(entityLaser);
GL11.glPushMatrix();
GL11.glTranslated(x, y, z);
GL11.glRotatef(entityLaser.prevRotationYaw + (entityLaser.rotationYaw - entityLaser.prevRotationYaw) * par9 - 90, 0, 1, 0);
GL11.glRotatef(entityLaser.prevRotationPitch + (entityLaser.rotationPitch - entityLaser.prevRotationPitch) * par9, 0, 0, 1);
Tessellator tessellator = Tessellator.instance;
Tessellator tess = Tessellator.instance;
byte b0 = 0;
float f2 = 0.4f;
float f3 = 0.7f;
@@ -38,22 +39,21 @@ public class RenderLaser extends Render {
for (int i = 0; i < 4; ++i) {
GL11.glRotatef(90, 1, 0, 0);
GL11.glNormal3f(0, 0, f10);
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(-8, 0, 0, f2, f4);
tessellator.addVertexWithUV(8, 0, 0, f3, f4);
tessellator.addVertexWithUV(8, 4, 0, f3, f5);
tessellator.addVertexWithUV(-8, 4, 0, f2, f5);
tessellator.draw();
tess.startDrawingQuads();
tess.addVertexWithUV(-8, 0, 0, f2, f4);
tess.addVertexWithUV(8, 0, 0, f3, f4);
tess.addVertexWithUV(8, 4, 0, f3, f5);
tess.addVertexWithUV(-8, 4, 0, f2, f5);
tess.draw();
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(8, 0, 0, f2, f4);
tessellator.addVertexWithUV(-8, 0, 0, f3, f4);
tessellator.addVertexWithUV(-8, 4, 0, f3, f5);
tessellator.addVertexWithUV(8, 4, 0, f2, f5);
tessellator.draw();
tess.startDrawingQuads();
tess.addVertexWithUV(8, 0, 0, f2, f4);
tess.addVertexWithUV(-8, 0, 0, f3, f4);
tess.addVertexWithUV(-8, 4, 0, f3, f5);
tess.addVertexWithUV(8, 4, 0, f2, f5);
tess.draw();
}
GL11.glPopAttrib();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
@@ -62,7 +62,8 @@ public class RenderLaser extends Render {
return laserTexture;
}
protected ResourceLocation getEntityTexture(Entity par1Entity) {
return this.getArrowTextures((EntityLaser) par1Entity);
@Override
protected ResourceLocation getEntityTexture(Entity entity) {
return this.getArrowTextures((EntityLaser) entity);
}
}
@@ -69,6 +69,7 @@ public class RenderShield extends Render {
GL11.glEndList();
}
@Override
public void doRender(Entity entityShield, double x, double y, double z, float par8, float par9) {
this.bindEntityTexture(entityShield);
+19 -17
View File
@@ -25,9 +25,9 @@ import net.minecraftforge.common.IExtendedEntityProperties;
public class EntityArcher extends EntitySnowman implements IExtendedEntityProperties {
public EntityArcher(World par1World) {
super(par1World);
this.isImmuneToFire = true;
public EntityArcher(World world) {
super(world);
this.tasks.addTask(1, new EntityAISwimming(this));
this.tasks.addTask(2, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, true, false, IMob.mobSelector));
@@ -37,13 +37,15 @@ public class EntityArcher extends EntitySnowman implements IExtendedEntityProper
@Override
protected void applyEntityAttributes() {
super.applyEntityAttributes();
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.30D);
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(40.0D);
}
@Override
public void onDeath(DamageSource par1DamageSource) {
super.onDeath(par1DamageSource);
public void onDeath(DamageSource damageSource) {
super.onDeath(damageSource);
this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 1, true);
this.setDead();
}
@@ -54,16 +56,16 @@ public class EntityArcher extends EntitySnowman implements IExtendedEntityProper
}
@Override
protected void dropFewItems(boolean par1, int par2) {
protected void dropFewItems(boolean hitByPlayer, int levelOfLooting) {
int j;
int k;
j = this.rand.nextInt(3 + par2);
j = this.rand.nextInt(3 + levelOfLooting);
for (k = 0; k < j; ++k) {
this.dropItem(Items.arrow, 1);
}
j = this.rand.nextInt(3 + par2);
j = this.rand.nextInt(3 + levelOfLooting);
for (k = 0; k < j; ++k) {
this.dropItem(Items.bone, 1);
@@ -71,7 +73,7 @@ public class EntityArcher extends EntitySnowman implements IExtendedEntityProper
}
@Override
protected void dropRareDrop(int par1) {
protected void dropRareDrop(int ch) {
this.entityDropItem(new ItemStack(Items.snowball, 1, 1), 0.0F);
}
@@ -81,18 +83,18 @@ public class EntityArcher extends EntitySnowman implements IExtendedEntityProper
}
@Override
public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) {
EntityArrow entityarrow = new EntityArrow(this.worldObj, this, par1EntityLivingBase, 1.6F, (float) (14 - this.worldObj.difficultySetting.getDifficultyId() * 4));
int i = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, this.getHeldItem());
int j = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, this.getHeldItem());
public void attackEntityWithRangedAttack(EntityLivingBase entity, float par2) {
EntityArrow entityarrow = new EntityArrow(this.worldObj, this, entity, 1.6F, (float) (14 - this.worldObj.difficultySetting.getDifficultyId() * 4));
int powerLevel = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, this.getHeldItem());
int punchLevel = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, this.getHeldItem());
entityarrow.setDamage((double) (par2 * 2.0F) + this.rand.nextGaussian() * 0.25D + (double) ((float) this.worldObj.difficultySetting.getDifficultyId() * 0.11F));
if (i > 0) {
entityarrow.setDamage(entityarrow.getDamage() + (double) i * 0.5D + 0.5D);
if (powerLevel > 0) {
entityarrow.setDamage(entityarrow.getDamage() + (double) powerLevel * 0.5D + 0.5D);
}
if (j > 0) {
entityarrow.setKnockbackStrength(j);
if (punchLevel > 0) {
entityarrow.setKnockbackStrength(punchLevel);
}
if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, this.getHeldItem()) > 0) {
@@ -25,22 +25,27 @@ import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
public class EntityElectroBall extends Entity implements IProjectile, IEntityAdditionalSpawnData {
public class EntityEnergyBall extends Entity implements IProjectile, IEntityAdditionalSpawnData {
public static final int RADIUS = 8;
public static final float LENGTH = 16f;
public static final float DIST = 1f;
public static final float HEIGHT = 8f;
public static final int MAX_TICKS_IN_TILE = 60;
public static final int MAX_COUNT_OF_BOLTS = 25;
public EntityLivingBase shootingEntity;
public Bolt[] bolts = new Bolt[25];
public Bolt[] bolts = new Bolt[MAX_COUNT_OF_BOLTS];
public Point[] entityPositions;
public Bolt[][] entityBolts;
public boolean inTile = false;
private int ticksAlive;
private int ticksInAir;
public double accelerationX;
public double accelerationY;
public double accelerationZ;
public static final int radius = 8;
public static final float length = 16f;
public static final float dist = 1f;
public static final float height = 8f;
public int ticksAlive = 1; /** Pls, don't ask me why 1 =) **/
public int ticksInAir = 1;
public double accelerationX = 0;
public double accelerationY = 0;
public double accelerationZ = 0;
public EntityElectroBall(World world, EntityLivingBase shootingEntity, double rotX, double rotY, double rotZ) {
public EntityEnergyBall(World world, EntityLivingBase shootingEntity, double rotX, double rotY, double rotZ) {
this(world, shootingEntity);
rotX += this.rand.nextGaussian() * 0.4D;
@@ -52,14 +57,14 @@ public class EntityElectroBall extends Entity implements IProjectile, IEntityAdd
this.accelerationZ = rotZ / len * 0.1D;
}
public EntityElectroBall(World world, EntityLivingBase shootingEntity) {
public EntityEnergyBall(World world, EntityLivingBase shootingEntity) {
this(world);
this.shootingEntity = shootingEntity;
this.setLocationAndAngles(shootingEntity.posX, shootingEntity.posY, shootingEntity.posZ, shootingEntity.rotationYaw, shootingEntity.rotationPitch);
this.setLocationAndAngles(shootingEntity.posX, shootingEntity.posY + shootingEntity.getEyeHeight(), shootingEntity.posZ, shootingEntity.rotationYaw, shootingEntity.rotationPitch);
}
public EntityElectroBall(World world) {
public EntityEnergyBall(World world) {
super(world);
this.setSize(1.0F, 1.0F);
@@ -69,7 +74,7 @@ public class EntityElectroBall extends Entity implements IProjectile, IEntityAdd
this.motionX = this.motionY = this.motionZ = 0.0D;
for (int i = 0; i < bolts.length; i++) {
bolts[i] = new Bolt(dist, length, height);
bolts[i] = new Bolt(DIST, LENGTH, HEIGHT);
}
}
@@ -95,14 +100,14 @@ public class EntityElectroBall extends Entity implements IProjectile, IEntityAdd
if (this.inTile) {
this.ticksAlive++;
if (this.ticksAlive >= 60) {
if (this.ticksAlive >= MAX_TICKS_IN_TILE) {
this.setDead();
}
/** Generating Coords for every Entity **/
ArrayList<Entity> entities = new ArrayList();
int chunkSize = ((radius - 1) >> 4) + 2;
int chunkSize = ((RADIUS - 1) >> 4) + 2;
for (int chX = -chunkSize; chX < chunkSize; chX++) {
for (int chZ = -chunkSize; chZ < chunkSize; chZ++) {
@@ -117,10 +122,10 @@ public class EntityElectroBall extends Entity implements IProjectile, IEntityAdd
double length = entity.posZ - this.posZ;
double hyp = MathHelper.sqrt_double((width * width) + (length * length) + (height * height));
if (hyp <= radius) {
if (hyp <= RADIUS) {
entities.add(entity);
/** Closer - Harder */
entity.attackEntityFrom(DamageSource.magic, (float) (radius - hyp));
entity.attackEntityFrom(DamageSource.magic, (float) (RADIUS - hyp));
entity.performHurtAnimation();
}
}
@@ -128,11 +133,27 @@ public class EntityElectroBall extends Entity implements IProjectile, IEntityAdd
}
}
}
if(worldObj.isRemote) {
entityBolts = new Bolt[entities.size()][MAX_COUNT_OF_BOLTS];
}
entityPositions = new Point[entities.size()];
for (int i = 0; i < entities.size(); i++) {
Entity entity = entities.get(i);
entityPositions[i] = new Point(entity.posX, entity.posY, entity.posZ);
if (this.worldObj.isRemote) {
for (int e = 0; e < bolts.length; e++) {
float h = entity.height;
if(h < 4) {
h = 4;
}
entityBolts[i][e] = new Bolt(h / 10, h, h / 2);
}
}
}
/************************************************************************/
@@ -195,7 +216,7 @@ public class EntityElectroBall extends Entity implements IProjectile, IEntityAdd
}
protected float getMotionFactor() {
return 0.75F;
return 0.85F;
}
@Override
@@ -242,6 +263,6 @@ public class EntityElectroBall extends Entity implements IProjectile, IEntityAdd
}
@Override
public void setThrowableHeading(double x, double y, double z, float p1, float p2) {
public void setThrowableHeading(double x, double y, double z, float p1, float p2) {
}
}
+61 -80
View File
@@ -19,58 +19,35 @@ import net.minecraft.world.World;
import java.util.List;
public class EntityLaser extends Entity implements IProjectile {
private Block inTile;
public Entity shootingEntity;
private int xTile = -1;
private int yTile = -1;
private int zTile = -1;
private Block inTile;
private int inData;
private boolean inGround;
public Entity shootingEntity;
private int ticksInGround;
private int ticksInAir;
private float explosionStrength = 2f;
public EntityLaser(World par1World) {
super(par1World);
public EntityLaser(World world) {
super(world);
this.renderDistanceWeight = 10.0D;
this.setSize(0.5F, 0.5F);
}
public EntityLaser(World par1World, double par2, double par4, double par6) {
super(par1World);
public EntityLaser(World world, double x, double y, double z) {
super(world);
this.renderDistanceWeight = 10.0D;
this.setSize(0.5F, 0.5F);
this.setPosition(par2, par4, par6);
this.setPosition(x, y, z);
this.yOffset = 0.0F;
}
public EntityLaser(World world, EntityLivingBase entity, EntityLivingBase par3EntityLivingBase, float par4, float par5) {
super(world);
this.renderDistanceWeight = 10.0D;
this.shootingEntity = entity;
this.posY = entity.posY + (double) entity.getEyeHeight() - 0.10000000149011612D;
double d0 = par3EntityLivingBase.posX - entity.posX;
double d1 = par3EntityLivingBase.boundingBox.minY + (double) (par3EntityLivingBase.height / 3.0F) - this.posY;
double d2 = par3EntityLivingBase.posZ - entity.posZ;
double d3 = (double) MathHelper.sqrt_double(d0 * d0 + d2 * d2);
if (d3 >= 1.0E-7D) {
float f2 = (float) (Math.atan2(d2, d0) * 180.0D / Math.PI) - 90.0F;
float f3 = (float) (-(Math.atan2(d1, d3) * 180.0D / Math.PI));
double d4 = d0 / d3;
double d5 = d2 / d3;
this.setLocationAndAngles(entity.posX + d4, this.posY, entity.posZ + d5, f2, f3);
this.yOffset = 0.0F;
float f4 = (float) d3 * 0.2F;
this.setThrowableHeading(d0, d1 + (double) f4, d2, par4, par5);
}
}
public EntityLaser(World world, EntityLivingBase entity, float par3) {
public EntityLaser(World world, EntityLivingBase entity, float speed) {
super(world);
this.renderDistanceWeight = 10.0D;
this.shootingEntity = entity;
@@ -85,53 +62,54 @@ public class EntityLaser extends Entity implements IProjectile {
this.motionX = (double) (-MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI));
this.motionZ = (double) (MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI));
this.motionY = (double) (-MathHelper.sin(this.rotationPitch / 180.0F * (float) Math.PI));
this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, par3 * 1.5F, 1.0F);
this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, speed * 1.5F, 1.0F);
}
public void setExplosionStrengthModifier(float f)
{
public void setExplosionStrengthModifier(float f) {
explosionStrength = f;
}
@Override
protected void entityInit() {
}
public void setThrowableHeading(double par1, double par3, double par5, float par7, float par8) {
float f2 = MathHelper.sqrt_double(par1 * par1 + par3 * par3 + par5 * par5);
par1 /= (double) f2;
par3 /= (double) f2;
par5 /= (double) f2;
par1 += this.rand.nextGaussian() * (double) (this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double) par8;
par3 += this.rand.nextGaussian() * (double) (this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double) par8;
par5 += this.rand.nextGaussian() * (double) (this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double) par8;
par1 *= (double) par7;
par3 *= (double) par7;
par5 *= (double) par7;
this.motionX = par1;
this.motionY = par3;
this.motionZ = par5;
float f3 = MathHelper.sqrt_double(par1 * par1 + par5 * par5);
this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(par1, par5) * 180.0D / Math.PI);
this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(par3, (double) f3) * 180.0D / Math.PI);
@Override
public void setThrowableHeading(double x, double y, double z, float speed, float scale) {
float len = MathHelper.sqrt_double(x * x + y * y + z * z);
x /= (double) len;
y /= (double) len;
z /= (double) len;
x += this.rand.nextGaussian() * (double) (this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double) scale;
y += this.rand.nextGaussian() * (double) (this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double) scale;
z += this.rand.nextGaussian() * (double) (this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double) scale;
x *= (double) speed;
y *= (double) speed;
z *= (double) speed;
this.motionX = x;
this.motionY = y;
this.motionZ = z;
float f3 = MathHelper.sqrt_double(x * x + z * z);
this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(x, z) * 180.0D / Math.PI);
this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(y, (double) f3) * 180.0D / Math.PI);
this.ticksInGround = 0;
}
@SideOnly(Side.CLIENT)
public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9) {
this.setPosition(par1, par3, par5);
this.setRotation(par7, par8);
public void setPositionAndRotation2(double x, double y, double z, float rotX, float rotY, int rotZ) {
this.setPosition(x, y, z);
this.setRotation(rotX, rotY);
}
@SideOnly(Side.CLIENT)
public void setVelocity(double par1, double par3, double par5) {
this.motionX = par1;
this.motionY = par3;
this.motionZ = par5;
public void setVelocity(double velX, double velY, double velZ) {
this.motionX = velX;
this.motionY = velY;
this.motionZ = velZ;
if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) {
float f = MathHelper.sqrt_double(par1 + par5);
this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(par1, par5) / Math.PI);
this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(par3, (double) f) / Math.PI);
float f = MathHelper.sqrt_double(velX + velZ);
this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(velX, velZ) / Math.PI);
this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(velY, (double) f) / Math.PI);
this.prevRotationPitch = this.rotationPitch;
this.prevRotationYaw = this.rotationYaw;
this.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
@@ -139,6 +117,7 @@ public class EntityLaser extends Entity implements IProjectile {
}
}
@Override
public void onUpdate() {
super.onUpdate();
@@ -157,10 +136,10 @@ public class EntityLaser extends Entity implements IProjectile {
this.inGround = true;
}
}
Block i = this.worldObj.getBlock(this.xTile, this.yTile, this.zTile);
Block tile = this.worldObj.getBlock(this.xTile, this.yTile, this.zTile);
i.setBlockBoundsBasedOnState(this.worldObj, this.xTile, this.yTile, this.zTile);
AxisAlignedBB axisalignedbb = i.getCollisionBoundingBoxFromPool(this.worldObj, this.xTile, this.yTile, this.zTile);
tile.setBlockBoundsBasedOnState(this.worldObj, this.xTile, this.yTile, this.zTile);
AxisAlignedBB axisalignedbb = tile.getCollisionBoundingBoxFromPool(this.worldObj, this.xTile, this.yTile, this.zTile);
if (axisalignedbb != null && axisalignedbb.isVecInside(Vec3.createVectorHelper(this.posX, this.posY, this.posZ))) {
this.inGround = true;
@@ -192,14 +171,14 @@ public class EntityLaser extends Entity implements IProjectile {
}
else {
++this.ticksInAir;
Vec3 vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
Vec3 vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
MovingObjectPosition movingobjectposition = this.worldObj.func_147447_a(vec31, vec3, false, true, false);
vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
Vec3 vec3 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
Vec3 vec3next = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
MovingObjectPosition movingobjectposition = this.worldObj.func_147447_a(vec3, vec3next, false, true, false);
vec3 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
vec3next = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
if (movingobjectposition != null) {
vec3 = Vec3.createVectorHelper(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord);
vec3next = Vec3.createVectorHelper(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord);
}
Entity entity = null;
@@ -214,10 +193,10 @@ public class EntityLaser extends Entity implements IProjectile {
if (entity1.canBeCollidedWith() && (entity1 != this.shootingEntity || this.ticksInAir >= 5)) {
f1 = 0.3F;
AxisAlignedBB axisalignedbb1 = entity1.boundingBox.expand((double) f1, (double) f1, (double) f1);
MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept(vec3, vec31);
MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept(vec3next, vec3);
if (movingobjectposition1 != null) {
double d1 = vec3.distanceTo(movingobjectposition1.hitVec);
double d1 = vec3next.distanceTo(movingobjectposition1.hitVec);
if (d1 < d0 || d0 == 0.0D) {
entity = entity1;
@@ -309,34 +288,36 @@ public class EntityLaser extends Entity implements IProjectile {
}
}
@Override
public void writeEntityToNBT(NBTTagCompound nbt) {
nbt.setShort("xTile", (short) this.xTile);
nbt.setShort("yTile", (short) this.yTile);
nbt.setShort("zTile", (short) this.zTile);
nbt.setByte("inTile", (byte) Block.getIdFromBlock(this.inTile));
nbt.setShort("inTile", (short) Block.getIdFromBlock(this.inTile));
nbt.setByte("inData", (byte) this.inData);
nbt.setBoolean("inGround", this.inGround);
nbt.setFloat("explosionStrength", this.explosionStrength);
}
@Override
public void readEntityFromNBT(NBTTagCompound nbt) {
this.xTile = nbt.getShort("xTile");
this.yTile = nbt.getShort("yTile");
this.zTile = nbt.getShort("zTile");
this.inTile = Block.getBlockById(nbt.getByte("inTile") & 255);
this.inTile = Block.getBlockById(nbt.getShort("inTile"));
this.inData = nbt.getByte("inData") & 255;
this.inGround = nbt.getBoolean("inGround");
this.explosionStrength = nbt.getFloat("explosionStrength");
}
public void onCollide(Entity par1Entity) {
if (!this.worldObj.isRemote)
{
if (!this.worldObj.isRemote) {
this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, explosionStrength, true);
}
}
@SideOnly(Side.CLIENT)
@Override
public float getShadowSize() {
return 0.0F;
}
+14 -10
View File
@@ -18,6 +18,7 @@ import net.minecraft.world.World;
public class EntityShield extends Entity {
public EntityPlayer owner;
public boolean needCheck = true;
public EntityShield(World world) {
@@ -46,6 +47,7 @@ public class EntityShield extends Entity {
protected void writeEntityToNBT(NBTTagCompound nbt) {
}
@Override
public AxisAlignedBB getBoundingBox() {
return this.boundingBox;
}
@@ -54,12 +56,13 @@ public class EntityShield extends Entity {
public boolean canBePushed() {
return true;
}
@Override
public boolean canBeCollidedWith() {
return true;
}
@Override
public void setPosition(double x, double y, double z) {
this.posX = x;
this.posY = y + 0.5f;
@@ -69,18 +72,19 @@ public class EntityShield extends Entity {
this.boundingBox.setBounds(x - (double) f, y - (double) this.yOffset - 2 + (double) this.ySize, z - (double) f, x + (double) f, y - (double) this.yOffset - 2 + (double) this.ySize + (double) f1, z + (double) f);
}
@Override
public void onUpdate() {
super.onUpdate();
if(needCheck && owner == null) {
if (needCheck && owner == null) {
owner = this.worldObj.getPlayerEntityByName(dataWatcher.getWatchableObjectString(11));
needCheck = false;
}
if(!needCheck && owner == null){
if (!needCheck && owner == null) {
this.setDead();
return;
}
if (!this.worldObj.isRemote && owner != null) {
this.setPosition(owner.posX, owner.posY, owner.posZ);
if (!owner.isUsingItem()) {
@@ -88,11 +92,11 @@ public class EntityShield extends Entity {
}
}
}
@SideOnly(Side.CLIENT)
public int getBrightnessForRender(float p_70070_1_){
return 240;
}
@SideOnly(Side.CLIENT)
public int getBrightnessForRender(float p_70070_1_) {
return 240;
}
public void applyEntityCollision(Entity entity) {
if (entity.riddenByEntity != this && entity.ridingEntity != this) {
+2 -2
View File
@@ -3,7 +3,7 @@ package emt.init;
import cpw.mods.fml.common.registry.EntityRegistry;
import emt.ElectroMagicTools;
import emt.entity.EntityArcher;
import emt.entity.EntityElectroBall;
import emt.entity.EntityEnergyBall;
import emt.entity.EntityLaser;
import emt.entity.EntityShield;
import net.minecraft.entity.Entity;
@@ -36,6 +36,6 @@ public class EMTEntities {
EntityRegistry.registerModEntity(EntityArcher.class, "archer", entityIDs++, ElectroMagicTools.instance, 80, 3, true);
registerEntityEgg(EntityArcher.class, 0x99111F, 0xE5685);
EntityRegistry.registerModEntity(EntityShield.class, "shield", entityIDs++, ElectroMagicTools.instance, 80, 3, true);
EntityRegistry.registerModEntity(EntityElectroBall.class, "electroBall", entityIDs++, ElectroMagicTools.instance, 80, 60, true);
EntityRegistry.registerModEntity(EntityEnergyBall.class, "energyBall", entityIDs++, ElectroMagicTools.instance, 80, 60, true);
}
}
+2 -2
View File
@@ -22,7 +22,7 @@ import emt.item.armor.wings.ItemThaumiumReinforcedWing;
import emt.item.focus.ItemChargeFocus;
import emt.item.focus.ItemChristmasFocus;
import emt.item.focus.ItemExplosionFocus;
import emt.item.focus.ItemNoNameFocus;
import emt.item.focus.ItemEnergyBallFocus;
import emt.item.focus.ItemShieldFocus;
import emt.item.focus.ItemWandChargingFocus;
import emt.item.tool.ItemElectricHoeGrowth;
@@ -188,7 +188,7 @@ public class EMTItems {
wandChargeFocus = new ItemWandChargingFocus();
GameRegistry.registerItem(wandChargeFocus, "WandChargingFocus");
noNameFocus = new ItemNoNameFocus();
noNameFocus = new ItemEnergyBallFocus();
GameRegistry.registerItem(noNameFocus, "NoNameFocus");
}
}
@@ -1,6 +1,6 @@
package emt.item.focus;
import emt.entity.EntityElectroBall;
import emt.entity.EntityEnergyBall;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityLargeFireball;
import net.minecraft.entity.projectile.EntitySmallFireball;
@@ -12,10 +12,10 @@ import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.wands.ItemFocusBasic;
public class ItemNoNameFocus extends ItemBaseFocus {
public class ItemEnergyBallFocus extends ItemBaseFocus {
public ItemNoNameFocus() {
super("noName");
public ItemEnergyBallFocus() {
super("energyBall");
}
@Override
@@ -25,16 +25,16 @@ public class ItemNoNameFocus extends ItemBaseFocus {
@Override
public String getSortingHelper(ItemStack itemstack) {
return "NONAME";
return "ENERGYBALL";
}
@Override
public ItemStack onFocusRightClick(ItemStack stack, World world, EntityPlayer player, MovingObjectPosition paramMovingObjectPosition) {
public ItemStack onFocusRightClick(ItemStack stack, World world, EntityPlayer player, MovingObjectPosition mop) {
if (!world.isRemote) {
float rotX = (-MathHelper.sin(player.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(player.rotationPitch / 180.0F * (float) Math.PI)) * 100;
float rotY = (-MathHelper.sin(player.rotationPitch / 180.0F * (float) Math.PI)) * 100;
float rotZ = (MathHelper.cos(player.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(player.rotationPitch / 180.0F * (float) Math.PI)) * 100;
world.spawnEntityInWorld(new EntityElectroBall(world, player, rotX, rotY, rotZ));
world.spawnEntityInWorld(new EntityEnergyBall(world, player, rotX, rotY, rotZ));
}
return stack;
}
@@ -13,7 +13,6 @@ import thaumcraft.api.wands.FocusUpgradeType;
import thaumcraft.common.items.wands.ItemWandCasting;
public class ItemExplosionFocus extends ItemBaseFocus {
private static final AspectList visCost = new AspectList().add(Aspect.FIRE, 200).add(Aspect.ENTROPY, 200);
public ItemExplosionFocus() {
+4 -3
View File
@@ -9,11 +9,11 @@ import net.minecraft.client.settings.KeyBinding;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
import emt.client.EMTKeys;
import emt.client.renderer.RenderElectroBall;
import emt.client.renderer.RenderEnergyBall;
import emt.client.renderer.RenderLaser;
import emt.client.renderer.RenderShield;
import emt.entity.EntityArcher;
import emt.entity.EntityElectroBall;
import emt.entity.EntityEnergyBall;
import emt.entity.EntityLaser;
import emt.entity.EntityShield;
@@ -25,10 +25,11 @@ public class ClientProxy extends CommonProxy {
EMTKeys.registerKeys();
}
@Override
public void registerRenders() {
RenderingRegistry.registerEntityRenderingHandler(EntityLaser.class, new RenderLaser());
RenderingRegistry.registerEntityRenderingHandler(EntityArcher.class, new RenderSnowMan());
RenderingRegistry.registerEntityRenderingHandler(EntityShield.class, new RenderShield());
RenderingRegistry.registerEntityRenderingHandler(EntityElectroBall.class, new RenderElectroBall());
RenderingRegistry.registerEntityRenderingHandler(EntityEnergyBall.class, new RenderEnergyBall());
}
}
+20 -20
View File
@@ -26,16 +26,16 @@ public class CommonProxy implements IGuiHandler {
TileEntity entity = world.getTileEntity(x, y, z);
switch (ID) {
case 0:
if (entity != null && entity instanceof TileEntityIndustrialWandRecharge) {
return new ContainerIndustrialWandRecharge(player.inventory, (TileEntityIndustrialWandRecharge) entity);
}
case 1:
if (entity != null && entity instanceof TileEntityEtherealMacerator) {
return new ContainerEtheralMacerator(player.inventory, (TileEntityEtherealMacerator) entity);
}
default:
return null;
case 0:
if (entity != null && entity instanceof TileEntityIndustrialWandRecharge) {
return new ContainerIndustrialWandRecharge(player.inventory, (TileEntityIndustrialWandRecharge) entity);
}
case 1:
if (entity != null && entity instanceof TileEntityEtherealMacerator) {
return new ContainerEtheralMacerator(player.inventory, (TileEntityEtherealMacerator) entity);
}
default:
return null;
}
}
@@ -44,16 +44,16 @@ public class CommonProxy implements IGuiHandler {
TileEntity entity = world.getTileEntity(x, y, z);
switch (ID) {
case 0:
if (entity != null && entity instanceof TileEntityIndustrialWandRecharge) {
return new GuiIndustrialWandRecharger(player.inventory, (TileEntityIndustrialWandRecharge) entity);
}
case 1:
if (entity != null && entity instanceof TileEntityEtherealMacerator) {
return new GuiEtherealMacerator(player.inventory, (TileEntityEtherealMacerator) entity);
}
default:
return null;
case 0:
if (entity != null && entity instanceof TileEntityIndustrialWandRecharge) {
return new GuiIndustrialWandRecharger(player.inventory, (TileEntityIndustrialWandRecharge) entity);
}
case 1:
if (entity != null && entity instanceof TileEntityEtherealMacerator) {
return new GuiEtherealMacerator(player.inventory, (TileEntityEtherealMacerator) entity);
}
default:
return null;
}
}
}
+14 -1
View File
@@ -58,7 +58,8 @@ public class EMTRandomHelper {
float y = prevY + (rnd.nextInt((int) height) - (height / 2));
float z = prevZ + (rnd.nextInt((int) height) - (height / 2));
points.add(new Point(x, y, z));
byte color = (byte) ((198 / (length / dist)) * x);
points.add(new Point(x, y, z, (byte)(255 - color), (byte)(255 - color), (byte)255));
}
}
}
@@ -67,12 +68,24 @@ public class EMTRandomHelper {
public float x = 0;
public float y = 0;
public float z = 0;
public byte r = 0;
public byte g = 0;
public byte b = 0;
public Point(float x, float y, float z) {
this.x = x;
this.y = y;
this.z = z;
}
public Point(float x, float y, float z, byte r, byte g, byte b) {
this.x = x;
this.y = y;
this.z = z;
this.r = r;
this.g = g;
this.b = b;
}
public Point(double x, double y, double z) {
this.x = (float) x;