use of com.tntmodders.takumi.world.TakumiExplosion in project takumicraft by TNTModders.
the class EntityBangCreeper method takumiExplodeEvent.
@Override
public boolean takumiExplodeEvent(Detonate event) {
float power = this.getPowered() ? 6f : 3f;
if (event.getExplosion() instanceof TakumiExplosion) {
power = ((TakumiExplosion) event.getExplosion()).getSize();
}
if (power > 0.5) {
for (BlockPos pos : event.getAffectedBlocks()) {
if (!this.world.isRemote && this.world.getBlockState(pos).getBlock().getExplosionResistance(world, pos, this, event.getExplosion()) >= Blocks.OBSIDIAN.getExplosionResistance(world, pos, this, event.getExplosion()) && TakumiUtils.takumiGetBlockResistance(this, this.world.getBlockState(pos), pos) != -1) {
this.world.setBlockToAir(pos);
TakumiUtils.takumiCreateExplosion(this.world, this, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, power - 0.2f, false, true);
}
}
}
return true;
}
use of com.tntmodders.takumi.world.TakumiExplosion in project takumicraft by TNTModders.
the class EntityBedCreeper method takumiExplodeEvent.
@Override
public boolean takumiExplodeEvent(Detonate event) {
if (!this.world.isRemote) {
if (event.getExplosion() instanceof TakumiExplosion) {
event.getAffectedEntities().clear();
event.getAffectedBlocks().forEach(pos -> {
if (EntityBedCreeper.this.world.getTileEntity(pos) instanceof IInventory) {
((IInventory) EntityBedCreeper.this.world.getTileEntity(pos)).clear();
EntityBedCreeper.this.world.setBlockToAir(pos);
} else if (EntityBedCreeper.this.world.getBlockState(pos).getBlock().isBed(this.world.getBlockState(pos), this.world, pos, null)) {
EntityBedCreeper.this.world.setBlockToAir(pos);
}
});
} else {
event.getAffectedEntities().forEach(entity -> {
if (entity instanceof EntityPlayer) {
BlockPos pos = ((EntityPlayer) entity).getBedLocation(this.world.provider.getDimension());
if (pos != null && this.world.getBlockState(pos).getBlock().isBed(this.world.getBlockState(pos), this.world, pos, entity)) {
TakumiUtils.takumiCreateExplosion(this.world, this, pos.getX(), pos.getY(), pos.getZ(), this.getPowered() ? 20 : 12, false, true);
}
}
});
}
}
return true;
}
use of com.tntmodders.takumi.world.TakumiExplosion in project takumicraft by TNTModders.
the class EntityWoodCreeper method takumiExplodeEvent.
@Override
public boolean takumiExplodeEvent(Detonate event) {
float power = this.getPowered() ? 6f : 3f;
if (event.getExplosion() instanceof TakumiExplosion) {
power = ((TakumiExplosion) event.getExplosion()).getSize();
}
if (power > 0.1) {
for (BlockPos pos : event.getAffectedBlocks()) {
String s = this.world.getBlockState(pos).getBlock().getHarvestTool(this.world.getBlockState(pos));
if (!this.world.isRemote && s != null && s.equalsIgnoreCase("axe") && TakumiUtils.takumiGetBlockResistance(this, this.world.getBlockState(pos), pos) != -1) {
this.world.setBlockToAir(pos);
TakumiUtils.takumiCreateExplosion(this.world, this, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, power - 0.1f, false, true);
}
}
}
return true;
}
use of com.tntmodders.takumi.world.TakumiExplosion in project takumicraft by TNTModders.
the class EntityStoneCreeper method takumiExplodeEvent.
@Override
public boolean takumiExplodeEvent(Detonate event) {
float power = this.getPowered() ? 6f : 3f;
if (event.getExplosion() instanceof TakumiExplosion) {
power = ((TakumiExplosion) event.getExplosion()).getSize();
}
if (power > 0.1) {
for (BlockPos pos : event.getAffectedBlocks()) {
String s = this.world.getBlockState(pos).getBlock().getHarvestTool(this.world.getBlockState(pos));
if (!this.world.isRemote && s != null && s.equalsIgnoreCase("pickaxe") && TakumiUtils.takumiGetBlockResistance(this, this.world.getBlockState(pos), pos) != -1) {
this.world.setBlockToAir(pos);
TakumiUtils.takumiCreateExplosion(this.world, this, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, power - 0.2f, false, true);
}
}
}
return true;
}
Aggregations