Initial 1.11.2 update
This commit is contained in:
@@ -21,10 +21,10 @@ import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class Cobwebs extends Spell {
|
||||
|
||||
|
||||
private static final int baseDuration = 400;
|
||||
|
||||
public Cobwebs() {
|
||||
public Cobwebs(){
|
||||
super(Tier.ADVANCED, 30, Element.EARTH, "cobwebs", SpellType.ATTACK, 70, EnumAction.NONE, false);
|
||||
}
|
||||
|
||||
@@ -34,41 +34,44 @@ public class Cobwebs extends Spell {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean cast(World world, EntityPlayer caster, EnumHand hand, int ticksInUse, SpellModifiers modifiers) {
|
||||
|
||||
RayTraceResult rayTrace = WizardryUtilities.rayTrace(12*modifiers.get(WizardryItems.range_upgrade), world, caster, true);
|
||||
|
||||
public boolean cast(World world, EntityPlayer caster, EnumHand hand, int ticksInUse, SpellModifiers modifiers){
|
||||
|
||||
RayTraceResult rayTrace = WizardryUtilities.rayTrace(12 * modifiers.get(WizardryItems.range_upgrade), world,
|
||||
caster, true);
|
||||
|
||||
if(rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.BLOCK){
|
||||
|
||||
|
||||
boolean flag = false;
|
||||
|
||||
|
||||
BlockPos pos = rayTrace.getBlockPos().offset(rayTrace.sideHit);
|
||||
|
||||
|
||||
if(world.isAirBlock(pos)){
|
||||
if(!world.isRemote){
|
||||
world.setBlockState(pos, WizardryBlocks.vanishing_cobweb.getDefaultState());
|
||||
if(world.getTileEntity(pos) instanceof TileEntityTimer){
|
||||
((TileEntityTimer)world.getTileEntity(pos)).setLifetime((int)(baseDuration*modifiers.get(WizardryItems.duration_upgrade)));
|
||||
((TileEntityTimer)world.getTileEntity(pos))
|
||||
.setLifetime((int)(baseDuration * modifiers.get(WizardryItems.duration_upgrade)));
|
||||
}
|
||||
}
|
||||
flag = true;
|
||||
}
|
||||
|
||||
|
||||
for(EnumFacing side : EnumFacing.values()){
|
||||
|
||||
|
||||
BlockPos pos1 = pos.offset(side);
|
||||
|
||||
|
||||
if(world.isAirBlock(pos1)){
|
||||
if(!world.isRemote){
|
||||
world.setBlockState(pos1, WizardryBlocks.vanishing_cobweb.getDefaultState());
|
||||
if(world.getTileEntity(pos1) instanceof TileEntityTimer){
|
||||
((TileEntityTimer)world.getTileEntity(pos1)).setLifetime((int)(baseDuration*modifiers.get(WizardryItems.duration_upgrade)));
|
||||
((TileEntityTimer)world.getTileEntity(pos1))
|
||||
.setLifetime((int)(baseDuration * modifiers.get(WizardryItems.duration_upgrade)));
|
||||
}
|
||||
}
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(flag){
|
||||
caster.swingArm(hand);
|
||||
WizardryUtilities.playSoundAtPlayer(caster, SoundEvents.BLOCK_LAVA_EXTINGUISH, 1.0f, 1.0f);
|
||||
@@ -77,45 +80,48 @@ public class Cobwebs extends Spell {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean cast(World world, EntityLiving caster, EnumHand hand, int ticksInUse, EntityLivingBase target, SpellModifiers modifiers) {
|
||||
|
||||
public boolean cast(World world, EntityLiving caster, EnumHand hand, int ticksInUse, EntityLivingBase target,
|
||||
SpellModifiers modifiers){
|
||||
|
||||
if(target != null){
|
||||
|
||||
int x = MathHelper.floor_double(target.posX);
|
||||
|
||||
int x = MathHelper.floor(target.posX);
|
||||
int y = (int)target.getEntityBoundingBox().minY;
|
||||
int z = MathHelper.floor_double(target.posZ);
|
||||
|
||||
int z = MathHelper.floor(target.posZ);
|
||||
|
||||
boolean flag = false;
|
||||
|
||||
|
||||
BlockPos pos = new BlockPos(x, y, z);
|
||||
|
||||
if(world.isAirBlock(pos)){
|
||||
if(!world.isRemote){
|
||||
world.setBlockState(pos, WizardryBlocks.vanishing_cobweb.getDefaultState());
|
||||
if(world.getTileEntity(pos) instanceof TileEntityTimer){
|
||||
((TileEntityTimer)world.getTileEntity(pos)).setLifetime((int)(baseDuration*modifiers.get(WizardryItems.duration_upgrade)));
|
||||
((TileEntityTimer)world.getTileEntity(pos))
|
||||
.setLifetime((int)(baseDuration * modifiers.get(WizardryItems.duration_upgrade)));
|
||||
}
|
||||
}
|
||||
flag = true;
|
||||
}
|
||||
|
||||
|
||||
for(EnumFacing side : EnumFacing.values()){
|
||||
|
||||
|
||||
BlockPos pos1 = pos.offset(side);
|
||||
|
||||
|
||||
if(world.isAirBlock(pos1)){
|
||||
if(!world.isRemote){
|
||||
world.setBlockState(pos1, WizardryBlocks.vanishing_cobweb.getDefaultState());
|
||||
if(world.getTileEntity(pos1) instanceof TileEntityTimer){
|
||||
((TileEntityTimer)world.getTileEntity(pos1)).setLifetime((int)(baseDuration*modifiers.get(WizardryItems.duration_upgrade)));
|
||||
((TileEntityTimer)world.getTileEntity(pos1))
|
||||
.setLifetime((int)(baseDuration * modifiers.get(WizardryItems.duration_upgrade)));
|
||||
}
|
||||
}
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(flag){
|
||||
caster.swingArm(hand);
|
||||
caster.playSound(SoundEvents.BLOCK_LAVA_EXTINGUISH, 1.0f, 1.0f);
|
||||
@@ -124,7 +130,7 @@ public class Cobwebs extends Spell {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canBeCastByNPCs(){
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user