use of net.minecraft.world.level.block.state.BlockState in project MyPet by xXKeyleXx.
the class EntityMyDonkey method playStepSound.
@Override
public void playStepSound(BlockPos blockposition, BlockState blockdata) {
if (!blockdata.getMaterial().isLiquid()) {
BlockState blockdataUp = this.level.getBlockState(blockposition.up());
SoundType soundeffecttype = blockdata.getSoundType();
if (blockdataUp.getBlock() == Blocks.SNOW) {
soundeffecttype = blockdata.getSoundType();
}
if (this.isVehicle()) {
++this.soundCounter;
if (this.soundCounter > 5 && this.soundCounter % 3 == 0) {
this.playSound(SoundEvents.HORSE_GALLOP, soundeffecttype.getVolume() * 0.16F, soundeffecttype.getPitch());
} else if (this.soundCounter <= 5) {
this.playSound(SoundEvents.HORSE_STEP_WOOD, soundeffecttype.getVolume() * 0.16F, soundeffecttype.getPitch());
}
} else if (!blockdata.getMaterial().isLiquid()) {
this.soundCounter += 1;
playSound(SoundEvents.HORSE_STEP_WOOD, soundeffecttype.getVolume() * 0.16F, soundeffecttype.getPitch());
} else {
playSound(SoundEvents.HORSE_STEP, soundeffecttype.getVolume() * 0.16F, soundeffecttype.getPitch());
}
}
}
use of net.minecraft.world.level.block.state.BlockState in project MyPet by xXKeyleXx.
the class EntityMyEnderman method updateVisuals.
@Override
public void updateVisuals() {
Optional<BlockState> block;
if (getMyPet().getBlock() != null) {
BlockState data = CraftMagicNumbers.getBlock(getMyPet().getBlock().getData());
block = Optional.ofNullable(data);
} else {
block = Optional.empty();
}
getEntityData().set(BLOCK_WATCHER, block);
getEntityData().set(SCREAMING_WATCHER, getMyPet().isScreaming());
}
use of net.minecraft.world.level.block.state.BlockState in project MyPet by xXKeyleXx.
the class EntityMyZombieHorse method playStepSound.
@Override
public void playStepSound(BlockPos blockposition, BlockState blockdata) {
if (!blockdata.getMaterial().isLiquid()) {
BlockState blockdataUp = this.level.getBlockState(blockposition.up());
SoundType soundeffecttype = blockdata.getSoundType();
if (blockdataUp.getBlock() == Blocks.SNOW) {
soundeffecttype = blockdata.getSoundType();
}
if (this.isVehicle()) {
++this.soundCounter;
if (this.soundCounter > 5 && this.soundCounter % 3 == 0) {
this.playSound(SoundEvents.HORSE_GALLOP, soundeffecttype.getVolume() * 0.15F, soundeffecttype.getPitch());
} else if (this.soundCounter <= 5) {
this.playSound(SoundEvents.HORSE_STEP_WOOD, soundeffecttype.getVolume() * 0.15F, soundeffecttype.getPitch());
}
} else if (!blockdata.getMaterial().isLiquid()) {
this.soundCounter += 1;
playSound(SoundEvents.HORSE_STEP_WOOD, soundeffecttype.getVolume() * 0.15F, soundeffecttype.getPitch());
} else {
playSound(SoundEvents.HORSE_STEP, soundeffecttype.getVolume() * 0.15F, soundeffecttype.getPitch());
}
}
}
Aggregations