Initial 1.11.2 update

This commit is contained in:
Electroblob
2018-02-07 21:15:50 +00:00
parent 67f6be0671
commit 3df5597dcc
368 changed files with 17234 additions and 15082 deletions
@@ -19,96 +19,107 @@ import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
public class EntitySparkBomb extends EntityBomb {
/** For client use, because thrower field is not visible. */
/** For client use, because thrower field is not visible. */
private int casterID;
public EntitySparkBomb(World par1World)
{
super(par1World);
}
public EntitySparkBomb(World par1World, EntityLivingBase par2EntityLivingBase)
{
super(par1World, par2EntityLivingBase);
}
public EntitySparkBomb(World par1World, EntityLivingBase par2EntityLivingBase, float damageMultiplier, float blastMultiplier)
{
super(par1World, par2EntityLivingBase, damageMultiplier, blastMultiplier);
}
public EntitySparkBomb(World par1World){
super(par1World);
}
public EntitySparkBomb(World par1World, double par2, double par4, double par6)
{
super(par1World, par2, par4, par6);
}
public EntitySparkBomb(World par1World, EntityLivingBase par2EntityLivingBase){
super(par1World, par2EntityLivingBase);
}
/**
* Called when this EntityThrowable hits a block or entity.
*/
protected void onImpact(RayTraceResult par1RayTraceResult)
{
this.playSound(SoundEvents.ENTITY_FIREWORK_BLAST_FAR, 0.5f, 0.5f);
public EntitySparkBomb(World par1World, EntityLivingBase par2EntityLivingBase, float damageMultiplier,
float blastMultiplier){
super(par1World, par2EntityLivingBase, damageMultiplier, blastMultiplier);
}
Entity entityHit = par1RayTraceResult.entityHit;
if (entityHit != null)
{
// This is if the spark bomb gets a direct hit
float damage = 6 * damageMultiplier;
this.playSound(SoundEvents.ENTITY_GENERIC_HURT, 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
public EntitySparkBomb(World par1World, double par2, double par4, double par6){
super(par1World, par2, par4, par6);
}
entityHit.attackEntityFrom(MagicDamage.causeIndirectMagicDamage(this, this.getThrower(), DamageType.SHOCK).setProjectile(), damage);
}
/**
* Called when this EntityThrowable hits a block or entity.
*/
protected void onImpact(RayTraceResult par1RayTraceResult){
this.playSound(SoundEvents.ENTITY_FIREWORK_BLAST_FAR, 0.5f, 0.5f);
// Particle effect
if(worldObj.isRemote){
for(int i=0;i<8;i++){
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARK, worldObj, this.posX + rand.nextFloat() - 0.5, this.posY + this.height/2 + rand.nextFloat() - 0.5, this.posZ + rand.nextFloat() - 0.5, 0, 0, 0, 3);
worldObj.spawnParticle(EnumParticleTypes.SMOKE_LARGE, this.posX + rand.nextFloat() - 0.5, this.posY + this.height/2 + rand.nextFloat() - 0.5, this.posZ + rand.nextFloat() - 0.5, 0, 0, 0);
Entity entityHit = par1RayTraceResult.entityHit;
if(entityHit != null){
// This is if the spark bomb gets a direct hit
float damage = 6 * damageMultiplier;
this.playSound(SoundEvents.ENTITY_GENERIC_HURT, 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
entityHit.attackEntityFrom(
MagicDamage.causeIndirectMagicDamage(this, this.getThrower(), DamageType.SHOCK).setProjectile(),
damage);
}
// Particle effect
if(world.isRemote){
for(int i = 0; i < 8; i++){
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARK, world, this.posX + rand.nextFloat() - 0.5,
this.posY + this.height / 2 + rand.nextFloat() - 0.5, this.posZ + rand.nextFloat() - 0.5, 0, 0,
0, 3);
world.spawnParticle(EnumParticleTypes.SMOKE_LARGE, this.posX + rand.nextFloat() - 0.5,
this.posY + this.height / 2 + rand.nextFloat() - 0.5, this.posZ + rand.nextFloat() - 0.5, 0, 0,
0);
}
}
double seekerRange = 5.0d * blastMultiplier;
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(seekerRange, this.posX, this.posY, this.posZ, this.worldObj);
for(int i=0; i<Math.min(targets.size(), 4); i++){
boolean flag = targets.get(i) != entityHit && targets.get(i) != this.getThrower() && !(targets.get(i) instanceof EntityPlayer && ((EntityPlayer)targets.get(i)).capabilities.isCreativeMode);
}
double seekerRange = 5.0d * blastMultiplier;
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(seekerRange, this.posX, this.posY,
this.posZ, this.world);
for(int i = 0; i < Math.min(targets.size(), 4); i++){
boolean flag = targets.get(i) != entityHit && targets.get(i) != this.getThrower()
&& !(targets.get(i) instanceof EntityPlayer
&& ((EntityPlayer)targets.get(i)).capabilities.isCreativeMode);
// Detects (client side) if target is the thrower, to stop particles being spawned around them.
if(flag && worldObj.isRemote && targets.get(i).getEntityId() == this.casterID) flag = false;
if(flag && world.isRemote && targets.get(i).getEntityId() == this.casterID) flag = false;
if(flag){
EntityLivingBase target = targets.get(i);
if(!this.worldObj.isRemote){
EntityArc arc = new EntityArc(this.worldObj);
arc.setEndpointCoords(this.posX, this.posY, this.posZ,
target.posX, target.posY + target.height/2, target.posZ);
this.worldObj.spawnEntityInWorld(arc);
if(!this.world.isRemote){
EntityArc arc = new EntityArc(this.world);
arc.setEndpointCoords(this.posX, this.posY, this.posZ, target.posX, target.posY + target.height / 2,
target.posZ);
this.world.spawnEntity(arc);
target.playSound(WizardrySounds.SPELL_SPARK, 1.0F, rand.nextFloat() * 0.4F + 1.5F);
target.attackEntityFrom(MagicDamage.causeIndirectMagicDamage(this, this.getThrower(), DamageType.SHOCK), 5.0f * damageMultiplier);
target.attackEntityFrom(
MagicDamage.causeIndirectMagicDamage(this, this.getThrower(), DamageType.SHOCK),
5.0f * damageMultiplier);
}else{
// Particle effect
for(int j=0;j<8;j++){
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARK, worldObj, target.posX + rand.nextFloat() - 0.5, target.getEntityBoundingBox().minY + target.height*rand.nextFloat(), target.posZ + rand.nextFloat() - 0.5, 0, 0, 0, 3);
worldObj.spawnParticle(EnumParticleTypes.SMOKE_LARGE, target.posX + rand.nextFloat() - 0.5, target.getEntityBoundingBox().minY + target.height*rand.nextFloat(), target.posZ + rand.nextFloat() - 0.5, 0, 0, 0);
for(int j = 0; j < 8; j++){
Wizardry.proxy.spawnParticle(WizardryParticleType.SPARK, world,
target.posX + rand.nextFloat() - 0.5,
target.getEntityBoundingBox().minY + target.height * rand.nextFloat(),
target.posZ + rand.nextFloat() - 0.5, 0, 0, 0, 3);
world.spawnParticle(EnumParticleTypes.SMOKE_LARGE, target.posX + rand.nextFloat() - 0.5,
target.getEntityBoundingBox().minY + target.height * rand.nextFloat(),
target.posZ + rand.nextFloat() - 0.5, 0, 0, 0);
}
}
}
}
this.setDead();
}
this.setDead();
}
@Override
public void writeSpawnData(ByteBuf data){