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
@@ -5,6 +5,7 @@ import electroblob.wizardry.registry.WizardryBlocks;
import electroblob.wizardry.registry.WizardrySounds;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.MoverType;
import net.minecraft.entity.item.EntityFallingBlock;
import net.minecraft.init.Blocks;
import net.minecraft.nbt.NBTTagCompound;
@@ -14,99 +15,106 @@ import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class EntityMeteor extends EntityFallingBlock {
/** The entity blast multiplier. Only some projectiles cause a blast, which is why this isn't in EntityMagicProjectile. */
/**
* The entity blast multiplier. Only some projectiles cause a blast, which is why this isn't in
* EntityMagicProjectile.
*/
public float blastMultiplier;
public EntityMeteor(World world){
super(world);
// Superconstructor doesn't call this.
this.setSize(0.98F, 0.98F);
}
public EntityMeteor(World world){
super(world);
// Superconstructor doesn't call this.
this.setSize(0.98F, 0.98F);
}
public EntityMeteor(World world, double x, double y, double z, float blastMultiplier){
super(world, x, y, z, WizardryBlocks.meteor.getDefaultState());
this.motionY = -1.0D;
this.setFire(200);
this.blastMultiplier = blastMultiplier;
}
@Override
public double getYOffset() {
return this.height / 2.0F;
}
public EntityMeteor(World world, double x, double y, double z, float blastMultiplier){
super(world, x, y, z, WizardryBlocks.meteor.getDefaultState());
this.motionY = -1.0D;
this.setFire(200);
this.blastMultiplier = blastMultiplier;
}
@Override
public void onUpdate(){
if(this.ticksExisted % 16 == 1 && worldObj.isRemote){
Wizardry.proxy.playMovingSound(this, WizardrySounds.SPELL_LOOP_FIRE, 3.0f, 1.0f, false);
@Override
public double getYOffset(){
return this.height / 2.0F;
}
@Override
public void onUpdate(){
if(this.ticksExisted % 16 == 1 && world.isRemote){
Wizardry.proxy.playMovingSound(this, WizardrySounds.SPELL_LOOP_FIRE, 3.0f, 1.0f, false);
}
// You'd think the best way to do this would be to call super and do all the exploding stuff in fall() instead.
// However, for some reason, fallTile is null on the client side, causing an NPE in super.onUpdate()
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
++this.fallTime;
this.motionY -= 0.1d; //0.03999999910593033D;
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9800000190734863D;
this.motionY *= 0.9800000190734863D;
this.motionZ *= 0.9800000190734863D;
if(!this.worldObj.isRemote){
if(this.onGround){
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
this.motionY *= -0.5D;
this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 2.0f*blastMultiplier, true);
for(int i1=-3; i1<4; i1++){
for(int j1=-3; j1<4; j1++){
int y = WizardryUtilities.getNearestFloorLevelB(this.worldObj, new BlockPos(this.posX + i1, this.posY, this.posZ + j1), 7);
//System.out.println(y);
// You'd think the best way to do this would be to call super and do all the exploding stuff in fall() instead.
// However, for some reason, fallTile is null on the client side, causing an NPE in super.onUpdate()
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
++this.fallTime;
this.motionY -= 0.1d; // 0.03999999910593033D;
this.move(MoverType.SELF, this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9800000190734863D;
this.motionY *= 0.9800000190734863D;
this.motionZ *= 0.9800000190734863D;
if(!this.world.isRemote){
if(this.onGround){
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
this.motionY *= -0.5D;
this.world.createExplosion(this, this.posX, this.posY, this.posZ, 2.0f * blastMultiplier, true);
for(int i1 = -3; i1 < 4; i1++){
for(int j1 = -3; j1 < 4; j1++){
int y = WizardryUtilities.getNearestFloorLevelB(this.world,
new BlockPos(this.posX + i1, this.posY, this.posZ + j1), 7);
// System.out.println(y);
double dist = this.getDistance((int)this.posX + i1, y, (int)this.posZ + j1);
// Randomised with weighting so that the nearer the block the more likely it is to be set on fire.
if(y != -1 && rand.nextInt((int)dist*2 + 1) < 3 && dist < 4){
this.worldObj.setBlockState(new BlockPos(this.posX + i1, y, this.posZ + j1), Blocks.FIRE.getDefaultState());
// Randomised with weighting so that the nearer the block the more likely it is to be set on
// fire.
if(y != -1 && rand.nextInt((int)dist * 2 + 1) < 3 && dist < 4){
this.world.setBlockState(new BlockPos(this.posX + i1, y, this.posZ + j1),
Blocks.FIRE.getDefaultState());
}
}
}
this.setDead();
}
}
}
this.setDead();
}
}
}
@Override
public void fall(float distance, float damageMultiplier){
// Don't need to do anything here, the meteor should have already exploded.
}
@SideOnly(Side.CLIENT)
@Override
public boolean canRenderOnFire(){
return true;
}
@Override
public void fall(float distance, float damageMultiplier){
// Don't need to do anything here, the meteor should have already exploded.
}
@Override
public IBlockState getBlock(){
return WizardryBlocks.meteor.getDefaultState(); // For some reason the superclass version returns null on the client
}
@SideOnly(Side.CLIENT)
@Override
public int getBrightnessForRender(float partialTicks){
return 15728880;
}
@SideOnly(Side.CLIENT)
@Override
public boolean canRenderOnFire(){
return true;
}
@Override
public IBlockState getBlock(){
return WizardryBlocks.meteor.getDefaultState(); // For some reason the superclass version returns null on the
// client
}
@SideOnly(Side.CLIENT)
@Override
public int getBrightnessForRender(float partialTicks){
return 15728880;
}
@Override
public float getBrightness(float partialTicks){
return 1.0F;
}
@Override
public float getBrightness(float partialTicks){
return 1.0F;
}
@Override
public boolean isInRangeToRenderDist(double distance){
return true;
@@ -114,8 +122,8 @@ public class EntityMeteor extends EntityFallingBlock {
@Override
public void readEntityFromNBT(NBTTagCompound nbttagcompound){
super.readEntityFromNBT(nbttagcompound);
blastMultiplier = nbttagcompound.getFloat("blastMultiplier");
super.readEntityFromNBT(nbttagcompound);
blastMultiplier = nbttagcompound.getFloat("blastMultiplier");
}
@Override
@@ -123,5 +131,5 @@ public class EntityMeteor extends EntityFallingBlock {
super.writeEntityToNBT(nbttagcompound);
nbttagcompound.setFloat("blastMultiplier", blastMultiplier);
}
}