use of net.minecraft.block.AbstractFireBlock in project bewitchment by MoriyaShiine.
the class MakeEntitiesWetRitualFunction method start.
@Override
public void start(ServerWorld world, BlockPos glyphPos, BlockPos effectivePos, Inventory inventory, boolean catFamiliar) {
int radius = catFamiliar ? 9 : 3;
world.getEntitiesByClass(Entity.class, new Box(effectivePos).expand(radius), Entity::isAlive).forEach(entity -> BWComponents.ADDITIONAL_WATER_DATA_COMPONENT.get(entity).setWetTimer(6000 * (catFamiliar ? 3 : 1)));
BWUtil.getBlockPoses(effectivePos, radius, currentPos -> world.getBlockState(currentPos).getBlock() instanceof AbstractFireBlock).forEach(foundPos -> world.setBlockState(foundPos, Blocks.AIR.getDefaultState()));
super.start(world, glyphPos, effectivePos, inventory, catFamiliar);
}
use of net.minecraft.block.AbstractFireBlock in project relics by SSKirillSS.
the class BlazingFlaskItem method collectFire.
protected void collectFire(PlayerEntity player, ItemStack stack) {
World world = player.getCommandSenderWorld();
int fire = NBTUtils.getInt(stack, TAG_FIRE_AMOUNT, 0);
if (player.isSpectator() || fire >= stats.capacity)
return;
List<BlockPos> positions = WorldUtils.getBlockSphere(player.blockPosition(), stats.consumptionRadius).stream().filter(pos -> (world.getBlockState(pos).getBlock() instanceof AbstractFireBlock)).collect(Collectors.toList());
for (BlockPos pos : positions) {
Vector3d blockVec = new Vector3d(pos.getX() + 0.5D, pos.getY() + 0.5D, pos.getZ() + 0.5D);
double distance = player.position().add(0, 1, 0).distanceTo(blockVec);
Vector3d direction = player.position().add(0, 1, 0).subtract(blockVec).normalize();
world.addParticle(new CircleTintData((world.getBlockState(pos).getBlock() instanceof SoulFireBlock) ? new Color(0, 200, 255) : new Color(255, 122, 0), (float) (distance * 0.075F), (int) distance * 5, 0.95F, false), blockVec.x(), blockVec.y(), blockVec.z(), direction.x * 0.2F, direction.y * 0.2F, direction.z * 0.2F);
if (player.tickCount % stats.consumptionCooldown == 0) {
world.playSound(null, pos, SoundEvents.FURNACE_FIRE_CRACKLE, SoundCategory.PLAYERS, 1.0F, 1.0F);
NBTUtils.setInt(stack, TAG_FIRE_AMOUNT, Math.min(stats.capacity, fire + positions.size()));
}
}
}
Aggregations