Blast modifier support for permafrost, plus various fixes and an attempt at slipperiness
This commit is contained in:
@@ -4,14 +4,15 @@ import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardryPotions;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import net.minecraft.block.state.BlockFaceShape;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -43,6 +44,16 @@ public class BlockPermafrost extends BlockDryFrostedIce {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNormalCube(IBlockState state){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockFaceShape getBlockFaceShape(IBlockAccess world, IBlockState state, BlockPos pos, EnumFacing face){
|
||||
return face == EnumFacing.DOWN ? BlockFaceShape.SOLID : BlockFaceShape.UNDEFINED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollision(World world, BlockPos pos, IBlockState state, Entity entity){
|
||||
|
||||
@@ -53,5 +64,28 @@ public class BlockPermafrost extends BlockDryFrostedIce {
|
||||
int amplifier = Spells.permafrost.getProperty(Spell.EFFECT_STRENGTH).intValue();
|
||||
((EntityLivingBase)entity).addPotionEffect(new PotionEffect(WizardryPotions.frost, duration, amplifier));
|
||||
}
|
||||
|
||||
// EntityLivingBase's slipperiness code doesn't get the block below it properly so slipperiness only works for
|
||||
// full blocks...
|
||||
if(entity.onGround){
|
||||
|
||||
// Not brilliant but it's about the best I can do
|
||||
entity.motionX *= 1.12 - entity.motionX * entity.motionX;
|
||||
entity.motionZ *= 1.12 - entity.motionZ * entity.motionZ;
|
||||
|
||||
// if(entity instanceof EntityLivingBase){
|
||||
// double maxVel = 0.8;
|
||||
// double x = entity.motionX;
|
||||
// double y = entity.motionY;
|
||||
// double z = entity.motionZ;
|
||||
// double vel = MathHelper.sqrt(x*x + y*y + z*z);
|
||||
// double m = vel / maxVel;
|
||||
// if(m > 1){
|
||||
// entity.motionX /= m;
|
||||
// entity.motionZ /= m;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user