Initial 1.11.2 update
This commit is contained in:
@@ -18,7 +18,7 @@ import net.minecraft.world.World;
|
||||
|
||||
public class Light extends Spell {
|
||||
|
||||
public Light() {
|
||||
public Light(){
|
||||
super(Tier.BASIC, 5, Element.SORCERY, "light", SpellType.UTILITY, 15, EnumAction.NONE, false);
|
||||
}
|
||||
|
||||
@@ -28,41 +28,43 @@ public class Light extends Spell {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean cast(World world, EntityPlayer caster, EnumHand hand, int ticksInUse, SpellModifiers modifiers) {
|
||||
|
||||
public boolean cast(World world, EntityPlayer caster, EnumHand hand, int ticksInUse, SpellModifiers modifiers){
|
||||
|
||||
RayTraceResult rayTrace = WizardryUtilities.rayTrace(4, world, caster, false);
|
||||
|
||||
|
||||
if(rayTrace != null && rayTrace.typeOfHit == RayTraceResult.Type.BLOCK){
|
||||
|
||||
|
||||
BlockPos pos = rayTrace.getBlockPos().offset(rayTrace.sideHit);
|
||||
|
||||
|
||||
if(world.isAirBlock(pos)){
|
||||
|
||||
|
||||
if(!world.isRemote){
|
||||
world.setBlockState(pos, WizardryBlocks.magic_light.getDefaultState());
|
||||
if(world.getTileEntity(pos) instanceof TileEntityTimer){
|
||||
((TileEntityTimer)world.getTileEntity(pos)).setLifetime((int)(600*modifiers.get(WizardryItems.duration_upgrade)));
|
||||
((TileEntityTimer)world.getTileEntity(pos))
|
||||
.setLifetime((int)(600 * modifiers.get(WizardryItems.duration_upgrade)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
caster.swingArm(hand);
|
||||
WizardryUtilities.playSoundAtPlayer(caster, WizardrySounds.SPELL_CONJURATION, 1.0f, 1.0f);
|
||||
return true;
|
||||
}
|
||||
}else{
|
||||
|
||||
int x = (int) (Math.floor(caster.posX) + caster.getLookVec().xCoord*4);
|
||||
int y = (int) (Math.floor(caster.posY) + caster.eyeHeight + caster.getLookVec().yCoord*4);
|
||||
int z = (int) (Math.floor(caster.posZ) + caster.getLookVec().zCoord*4);
|
||||
|
||||
|
||||
int x = (int)(Math.floor(caster.posX) + caster.getLookVec().xCoord * 4);
|
||||
int y = (int)(Math.floor(caster.posY) + caster.eyeHeight + caster.getLookVec().yCoord * 4);
|
||||
int z = (int)(Math.floor(caster.posZ) + caster.getLookVec().zCoord * 4);
|
||||
|
||||
BlockPos pos = new BlockPos(x, y, z);
|
||||
|
||||
|
||||
if(world.isAirBlock(pos)){
|
||||
//world.playSound(x, y, z, "sound.ambient.cave.cave", 1.0f, 1.5f, false);
|
||||
// world.playSound(x, y, z, "sound.ambient.cave.cave", 1.0f, 1.5f, false);
|
||||
if(!world.isRemote){
|
||||
world.setBlockState(pos, WizardryBlocks.magic_light.getDefaultState());
|
||||
if(world.getTileEntity(pos) instanceof TileEntityTimer){
|
||||
((TileEntityTimer)world.getTileEntity(pos)).setLifetime((int)(600*modifiers.get(WizardryItems.duration_upgrade)));
|
||||
((TileEntityTimer)world.getTileEntity(pos))
|
||||
.setLifetime((int)(600 * modifiers.get(WizardryItems.duration_upgrade)));
|
||||
}
|
||||
}
|
||||
caster.swingArm(hand);
|
||||
@@ -73,5 +75,4 @@ public class Light extends Spell {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user