Java Code Examples for net.minecraft.block.SoundType#WOOD

The following examples show how to use net.minecraft.block.SoundType#WOOD . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EntityDabSquirrel.java    From CommunityMod with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
protected void playStepSound(BlockPos pos, Block blockIn) {
	if (!blockIn.getDefaultState().getMaterial().isLiquid()) {
		SoundType soundtype = blockIn.getSoundType(blockIn.getDefaultState(), this.world, pos, this);

		if (this.world.getBlockState(pos.up()).getBlock() == Blocks.SNOW_LAYER) {
			soundtype = Blocks.SNOW_LAYER.getSoundType(Blocks.SNOW_LAYER.getDefaultState(), this.world, pos, this);
		}

		if (this.isBeingRidden()) {
			++this.gallopTime;

			if (this.gallopTime > 5 && this.gallopTime % 3 == 0) {
				this.playGallopSound(soundtype);
			} else if (this.gallopTime <= 5) {
				this.playSound(SoundEvents.ENTITY_HORSE_STEP_WOOD, soundtype.getVolume() * 0.15F, soundtype.getPitch());
			}
		} else if (soundtype == SoundType.WOOD) {
			this.playSound(SoundEvents.ENTITY_HORSE_STEP_WOOD, soundtype.getVolume() * 0.15F, soundtype.getPitch());
		} else {
			this.playSound(SoundEvents.ENTITY_HORSE_STEP, soundtype.getVolume() * 0.15F, soundtype.getPitch());
		}
	}
}
 
Example 2
Source File: SoundPhysics.java    From Sound-Physics with GNU General Public License v3.0 5 votes vote down vote up
private static float getBlockReflectivity(Int3 blockPos)
{
	Block block = mc.theWorld.getBlockState(new BlockPos(blockPos.x, blockPos.y, blockPos.z)).getBlock();
	SoundType soundType = block.getSoundType();
	
	float reflectivity = 0.5f;
	
	if (soundType == SoundType.STONE)
		reflectivity = SoundPhysicsCore.Config.stoneReflectivity;
	else if (soundType == SoundType.WOOD)
		reflectivity = SoundPhysicsCore.Config.woodReflectivity;
	else if (soundType == SoundType.GROUND)
		reflectivity = SoundPhysicsCore.Config.groundReflectivity;
	else if (soundType == SoundType.PLANT)
		reflectivity = SoundPhysicsCore.Config.plantReflectivity;
	else if (soundType == SoundType.METAL)
		reflectivity = SoundPhysicsCore.Config.metalReflectivity;
	else if (soundType == SoundType.GLASS)
		reflectivity = SoundPhysicsCore.Config.glassReflectivity;
	else if (soundType == SoundType.CLOTH)
		reflectivity = SoundPhysicsCore.Config.clothReflectivity;
	else if (soundType == SoundType.SAND)	
		reflectivity = SoundPhysicsCore.Config.sandReflectivity;
	else if (soundType == SoundType.SNOW)
		reflectivity = SoundPhysicsCore.Config.snowReflectivity;
	else if (soundType == SoundType.LADDER)
		reflectivity = SoundPhysicsCore.Config.woodReflectivity;
	else if (soundType == SoundType.ANVIL)
		reflectivity = SoundPhysicsCore.Config.metalReflectivity;
	
	reflectivity *= SoundPhysicsCore.Config.globalBlockReflectance;
	
	return reflectivity;
}
 
Example 3
Source File: BlockTraverseWoodDoor.java    From CommunityMod with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public SoundType getSoundType(IBlockState state, World world, BlockPos pos, @Nullable Entity entity) {
    return SoundType.WOOD;
}
 
Example 4
Source File: BlockTraverseWoodDoor.java    From CommunityMod with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public SoundType getSoundType() {
    return SoundType.WOOD;
}
 
Example 5
Source File: BlockTraverseWoodSlab.java    From CommunityMod with GNU Lesser General Public License v2.1 4 votes vote down vote up
public BlockTraverseWoodSlab(String name) {
    super(name, Material.WOOD, SoundType.WOOD);
    setHarvestLevel("axe", 0);
    setHardness(2.0F);
    setResistance(15);
}
 
Example 6
Source File: BlockTraverseWoodDoor.java    From Traverse-Legacy-1-12-2 with MIT License 4 votes vote down vote up
@Override
public SoundType getSoundType(IBlockState state, World world, BlockPos pos, @Nullable Entity entity) {
    return SoundType.WOOD;
}
 
Example 7
Source File: BlockTraverseWoodDoor.java    From Traverse-Legacy-1-12-2 with MIT License 4 votes vote down vote up
@Override
public SoundType getSoundType() {
    return SoundType.WOOD;
}
 
Example 8
Source File: BlockTraverseWoodSlab.java    From Traverse-Legacy-1-12-2 with MIT License 4 votes vote down vote up
public BlockTraverseWoodSlab(String name) {
    super(name, Material.WOOD, SoundType.WOOD);
    setHarvestLevel("axe", 0);
    setHardness(2.0F);
    setResistance(15);
}