use of net.minecraft.world.level.block.state.BlockState in project MyPet by xXKeyleXx.
the class EntityMySkeletonHorse method playStepSound.
@Override
public void playStepSound(BlockPos blockposition, BlockState blockdata) {
if (!blockdata.getMaterial().isLiquid()) {
BlockState blockdataUp = this.level.getBlockState(blockposition.above());
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());
}
}
}
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.above());
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 Totemic by TeamTotemic.
the class TotemPoleBlock method updateShape.
@Override
public BlockState updateShape(BlockState state, Direction facing, BlockState facingState, LevelAccessor world, BlockPos currentPos, BlockPos facingPos) {
if (facing == Direction.UP) {
for (int i = 0; i < TotemEffectAPI.MAX_POLE_SIZE; i++) {
BlockPos searchPos = currentPos.below(i + 1);
BlockState searchState = world.getBlockState(searchPos);
if (searchState.getBlock() instanceof TotemBaseBlock) {
searchState.updateShape(Direction.UP, state, world, searchPos, currentPos);
} else if (!(searchState.getBlock() instanceof TotemPoleBlock))
break;
}
}
return state;
}
use of net.minecraft.world.level.block.state.BlockState in project SpongeCommon by SpongePowered.
the class ReplaceBlockEntity method captureState.
@Override
protected void captureState() {
super.captureState();
final BlockState currentState = this.worldSupplier.get().getBlockState(this.affectedPosition);
final SpongeBlockSnapshot snapshot = TrackingUtil.createPooledSnapshot(currentState, this.affectedPosition, BlockChangeFlags.NONE, Constants.World.DEFAULT_BLOCK_CHANGE_LIMIT, this.removed, this.worldSupplier, Optional::empty, Optional::empty);
snapshot.blockChange = BlockChange.MODIFY;
this.removedSnapshot = snapshot;
}
use of net.minecraft.world.level.block.state.BlockState in project SpongeCommon by SpongePowered.
the class CheckBlockPostPlacementIsSameEffect method processSideEffect.
@Override
public EffectResult processSideEffect(final BlockPipeline pipeline, final PipelineCursor oldState, final BlockState newState, final SpongeBlockChangeFlag flag, final int limit) {
final LevelChunkSection chunkSection = pipeline.getAffectedSection();
final int x = oldState.pos.getX() & 15;
final int y = oldState.pos.getY() & 15;
final int z = oldState.pos.getZ() & 15;
final BlockState currentState = chunkSection.getBlockState(x, y, z);
if (currentState.getBlock() != newState.getBlock()) {
return EffectResult.NULL_RETURN;
}
return EffectResult.NULL_PASS;
}
Aggregations