use of com.integral.enigmaticlegacy.packets.clients.PacketPortalParticles in project Enigmatic-Legacy by Aizistral-Studios.
the class RecallPotion method onItemUseFinish.
@Override
public ItemStack onItemUseFinish(ItemStack stack, World worldIn, LivingEntity entityLiving) {
PlayerEntity player = entityLiving instanceof PlayerEntity ? (PlayerEntity) entityLiving : null;
if (player instanceof ServerPlayerEntity) {
CriteriaTriggers.CONSUME_ITEM.trigger((ServerPlayerEntity) player, stack);
}
if (!worldIn.isRemote) {
Vec3d vec = SuperpositionHandler.getValidSpawn(worldIn, player);
worldIn.playSound(null, player.getPosition(), SoundEvents.ENTITY_ENDERMAN_TELEPORT, SoundCategory.PLAYERS, 1.0F, (float) (0.8F + (Math.random() * 0.2)));
EnigmaticLegacy.packetInstance.send(PacketDistributor.NEAR.with(() -> new PacketDistributor.TargetPoint(player.posX, player.posY, player.posZ, 128, player.dimension)), new PacketPortalParticles(player.posX, player.posY + (player.getHeight() / 2), player.posZ, 100, 1.25F, false));
player.setPositionAndUpdate(vec.x, vec.y, vec.z);
worldIn.playSound(null, player.getPosition(), SoundEvents.ENTITY_ENDERMAN_TELEPORT, SoundCategory.PLAYERS, 1.0F, (float) (0.8F + (Math.random() * 0.2)));
EnigmaticLegacy.packetInstance.send(PacketDistributor.NEAR.with(() -> new PacketDistributor.TargetPoint(player.posX, player.posY, player.posZ, 128, player.dimension)), new PacketRecallParticles(player.posX, player.posY + (player.getHeight() / 2), player.posZ, 48, false));
}
if (player == null || !player.abilities.isCreativeMode) {
stack.shrink(1);
if (stack.isEmpty()) {
return new ItemStack(Items.GLASS_BOTTLE);
}
if (player != null) {
player.inventory.addItemStackToInventory(new ItemStack(Items.GLASS_BOTTLE));
}
}
return stack;
}
use of com.integral.enigmaticlegacy.packets.clients.PacketPortalParticles in project Enigmatic-Legacy by Aizistral-Studios.
the class SuperMagnetRing method onCurioTick.
@Override
public void onCurioTick(String identifier, LivingEntity living) {
if (ConfigHandler.INVERT_MAGNETS_SHIFT.getValue() ? !living.isSneaking() : living.isSneaking() || living.world.isRemote || !(living instanceof PlayerEntity))
return;
PlayerEntity player = (PlayerEntity) living;
double x = living.posX;
double y = living.posY + 0.75;
double z = living.posZ;
List<ItemEntity> items = living.world.getEntitiesWithinAABB(ItemEntity.class, new AxisAlignedBB(x - ConfigHandler.SUPER_MAGNET_RING_RANGE.getValue(), y - ConfigHandler.SUPER_MAGNET_RING_RANGE.getValue(), z - ConfigHandler.SUPER_MAGNET_RING_RANGE.getValue(), x + ConfigHandler.SUPER_MAGNET_RING_RANGE.getValue(), y + ConfigHandler.SUPER_MAGNET_RING_RANGE.getValue(), z + ConfigHandler.SUPER_MAGNET_RING_RANGE.getValue()));
int pulled = 0;
for (ItemEntity item : items) if (canPullItem(item)) {
if (pulled > 512)
break;
if (!SuperpositionHandler.canPickStack(player, item.getItem()))
continue;
EnigmaticLegacy.packetInstance.send(PacketDistributor.NEAR.with(() -> new PacketDistributor.TargetPoint(item.posX, item.posY, item.posZ, 24, item.dimension)), new PacketPortalParticles(item.posX, item.posY + (item.getHeight() / 2), item.posZ, 24, 0.75D, true));
if (ConfigHandler.SUPER_MAGNET_RING_SOUND.getValue())
item.world.playSound(null, item.getPosition(), SoundEvents.ENTITY_ENDERMAN_TELEPORT, SoundCategory.PLAYERS, 1.0F, (float) (0.8F + (Math.random() * 0.2D)));
// item.setPositionAndUpdate(x, y, z);
item.setNoPickupDelay();
item.onCollideWithPlayer(player);
pulled++;
}
}
use of com.integral.enigmaticlegacy.packets.clients.PacketPortalParticles in project Enigmatic-Legacy by Aizistral-Studios.
the class Megasponge method onCurioTick.
@Override
public void onCurioTick(String identifier, LivingEntity living) {
if (living instanceof PlayerEntity & !living.world.isRemote) {
PlayerEntity player = (PlayerEntity) living;
cooldownMap.tick(living);
if (!cooldownMap.hasCooldown(player)) {
List<BlockPos> doomedWaterBlocks = new ArrayList<BlockPos>();
BlockPos initialPos = getCollidedWater(FluidTags.WATER, player);
BlockState initialState = initialPos != null ? player.world.getBlockState(initialPos) : null;
if (initialPos != null)
if (initialState.getFluidState() != null && initialState.getFluidState().isTagged(FluidTags.WATER)) {
doomedWaterBlocks.add(initialPos);
List<BlockPos> processedBlocks = new ArrayList<BlockPos>();
processedBlocks.add(initialPos);
for (int counter = 0; counter <= ConfigHandler.EXTRAPOLATED_MEGASPONGE_RADIUS.getValue(); counter++) {
List<BlockPos> outputBlocks = new ArrayList<BlockPos>();
for (BlockPos checkedPos : processedBlocks) {
outputBlocks.addAll(getNearbyWater(player.world, checkedPos));
}
processedBlocks.clear();
for (BlockPos thePos : outputBlocks) {
if (!doomedWaterBlocks.contains(thePos)) {
processedBlocks.add(thePos);
doomedWaterBlocks.add(thePos);
}
}
outputBlocks.clear();
}
processedBlocks.clear();
for (BlockPos exterminatedBlock : doomedWaterBlocks) absorbWaterBlock(exterminatedBlock, player.world.getBlockState(exterminatedBlock), player.world);
doomedWaterBlocks.clear();
player.world.playSound(null, player.getPosition(), SoundEvents.ITEM_BUCKET_FILL, SoundCategory.PLAYERS, 1.0F, (float) (0.8F + (Math.random() * 0.2)));
EnigmaticLegacy.packetInstance.send(PacketDistributor.NEAR.with(() -> new PacketDistributor.TargetPoint(player.posX, player.posY, player.posZ, 64, player.dimension)), new PacketPortalParticles(player.posX, player.posY + (player.getHeight() / 2), player.posZ, 40, 1.0D, false));
cooldownMap.put(player, 20);
}
}
}
}
Aggregations