use of net.minecraft.sound.SoundEvent in project bewitchment by MoriyaShiine.
the class BWSoundEvents method create.
private static SoundEvent create(String name) {
Identifier id = new Identifier(Bewitchment.MODID, name);
SoundEvent soundEvent = new SoundEvent(id);
SOUND_EVENTS.put(soundEvent, id);
return soundEvent;
}
use of net.minecraft.sound.SoundEvent in project WK by witches-kitchen.
the class WKSoundEvents method register.
private static SoundEvent register(String name) {
Identifier id = new Identifier(WK.MODID, name);
SoundEvent soundEvent = new SoundEvent(id);
SOUND_EVENTS.put(id, soundEvent);
return soundEvent;
}
use of net.minecraft.sound.SoundEvent in project WK by witches-kitchen.
the class PhasingStatusEffect method applyUpdateEffect.
@Override
public void applyUpdateEffect(LivingEntity entity, int amplifier) {
World world = entity.getEntityWorld();
if (!world.isClient) {
double d = entity.getX();
double e = entity.getY();
double f = entity.getZ();
for (int i = 0; i < 16; ++i) {
double g = entity.getX() + (entity.getRandom().nextDouble() - 0.5D) * 16.0D;
double h = MathHelper.clamp(entity.getY() + (double) (entity.getRandom().nextInt(16) - 8), world.getBottomY(), world.getBottomY() + ((ServerWorld) world).getLogicalHeight() - 1);
double j = entity.getZ() + (entity.getRandom().nextDouble() - 0.5D) * 16.0D;
if (entity.hasVehicle()) {
entity.stopRiding();
}
if (entity.teleport(g, h, j, true)) {
SoundEvent soundEvent = entity instanceof FoxEntity ? SoundEvents.ENTITY_FOX_TELEPORT : SoundEvents.ITEM_CHORUS_FRUIT_TELEPORT;
world.playSound(null, d, e, f, soundEvent, SoundCategory.PLAYERS, 1.0F, 1.0F);
entity.playSound(soundEvent, 1.0F, 1.0F);
break;
}
}
}
}
use of net.minecraft.sound.SoundEvent in project Liminal-Library by LudoCrypt.
the class LiminalSoundRegistry method getCurrent.
public static Optional<SoundEvent> getCurrent(ServerWorld from, ServerWorld to) {
MutableObject<Optional<SoundEvent>> mutableSound = new MutableObject<Optional<SoundEvent>>(Optional.of(SoundEvents.BLOCK_PORTAL_TRAVEL));
Optional<LiminalTravelSound> toTravelSound = ((DimensionTypeAccess) to.getDimension()).getLiminalEffects().getTravel();
Optional<LiminalTravelSound> fromTravelSound = ((DimensionTypeAccess) from.getDimension()).getLiminalEffects().getTravel();
if (fromTravelSound.isPresent()) {
fromTravelSound.get().hookSound(from, to, mutableSound);
}
if (toTravelSound.isPresent()) {
toTravelSound.get().hookSound(from, to, mutableSound);
}
List<LiminalTravelSound> list = Lists.newArrayList(OVERRIDE_TRAVEL_SOUND.iterator());
Collections.sort(list, (a, b) -> Integer.compare(a == null ? 1000 : a.priority(), b == null ? 1000 : b.priority()));
for (LiminalTravelSound sound : list) {
sound.hookSound(from, to, mutableSound);
}
return mutableSound.getValue();
}
use of net.minecraft.sound.SoundEvent in project wildmod by Osmiooo.
the class MangroveBoatEntity method tick.
public void tick() {
this.lastLocation = this.location;
this.location = this.checkLocation();
if (this.location != MangroveBoatEntity.Location.UNDER_WATER && this.location != MangroveBoatEntity.Location.UNDER_FLOWING_WATER) {
this.ticksUnderwater = 0.0F;
} else {
++this.ticksUnderwater;
}
if (!this.world.isClient && this.ticksUnderwater >= 60.0F) {
this.removeAllPassengers();
}
if (this.getDamageWobbleTicks() > 0) {
this.setDamageWobbleTicks(this.getDamageWobbleTicks() - 1);
}
if (this.getDamageWobbleStrength() > 0.0F) {
this.setDamageWobbleStrength(this.getDamageWobbleStrength() - 1.0F);
}
super.tick();
this.method_7555();
if (this.isLogicalSideForUpdatingMovement()) {
if (!(this.getFirstPassenger() instanceof PlayerEntity)) {
this.setPaddleMovings(false, false);
}
this.updateVelocity();
if (this.world.isClient) {
this.updatePaddles();
this.world.sendPacket(new BoatPaddleStateC2SPacket(this.isPaddleMoving(0), this.isPaddleMoving(1)));
}
this.move(MovementType.SELF, this.getVelocity());
} else {
this.setVelocity(Vec3d.ZERO);
}
this.handleBubbleColumn();
for (int i = 0; i <= 1; ++i) {
if (this.isPaddleMoving(i)) {
if (!this.isSilent() && (double) (this.paddlePhases[i] % 6.2831855F) <= 0.7853981852531433D && ((double) this.paddlePhases[i] + 0.39269909262657166D) % 6.2831854820251465D >= 0.7853981852531433D) {
SoundEvent soundEvent = this.getPaddleSoundEvent();
if (soundEvent != null) {
Vec3d vec3d = this.getRotationVec(1.0F);
double d = i == 1 ? -vec3d.z : vec3d.z;
double e = i == 1 ? vec3d.x : -vec3d.x;
this.world.playSound((PlayerEntity) null, this.getX() + d, this.getY(), this.getZ() + e, soundEvent, this.getSoundCategory(), 1.0F, 0.8F + 0.4F * this.random.nextFloat());
this.world.emitGameEvent(this.getPrimaryPassenger(), GameEvent.SPLASH, new BlockPos(this.getX() + d, this.getY(), this.getZ() + e));
}
}
float[] var10000 = this.paddlePhases;
var10000[i] = (float) ((double) var10000[i] + 0.39269909262657166D);
} else {
this.paddlePhases[i] = 0.0F;
}
}
this.checkBlockCollision();
List<Entity> list = this.world.getOtherEntities(this, this.getBoundingBox().expand(0.20000000298023224D, -0.009999999776482582D, 0.20000000298023224D), EntityPredicates.canBePushedBy(this));
if (!list.isEmpty()) {
boolean bl = !this.world.isClient && !(this.getPrimaryPassenger() instanceof PlayerEntity);
for (int j = 0; j < list.size(); ++j) {
Entity entity = (Entity) list.get(j);
if (!entity.hasPassenger(this)) {
if (bl && this.getPassengerList().size() < 2 && !entity.hasVehicle() && entity.getWidth() < this.getWidth() && entity instanceof LivingEntity && !(entity instanceof WaterCreatureEntity) && !(entity instanceof PlayerEntity)) {
entity.startRiding(this);
} else {
this.pushAwayFrom(entity);
}
}
}
}
}
Aggregations