Added placement sound for microblocks

This commit is contained in:
izstas committed 2013-08-05 13:02:23 +04:00
1 parent ca8f7d0dc2
commit af4ff6c722
3 files changed
+9

No files matched your search

@@ -106,6 +106,8 @@ class BlockMicroMaterial(val block:Block, val meta:Int = 0) extends IMicroMateri
def toolClasses = Seq("axe", "pickaxe", "shovel")
def getCutterStrength = toolClasses.foldLeft(0)((level, tool) => Math.max(level, MinecraftForge.getBlockHarvestLevel(block, meta, tool)))
def getSound = block.stepSound
}
object BlockMicroMaterial
@@ -73,6 +73,10 @@ class ItemMicroPart(id:Int) extends Item(id)
placement.place(world, player, item)
if(!player.capabilities.isCreativeMode)
placement.consume(world, player, item)
val sound = MicroMaterialRegistry.getMaterial(material).getSound
if(sound != null)
world.playSoundEffect(placement.pos.x + 0.5D, placement.pos.y + 0.5D, placement.pos.z + 0.5D, sound.getPlaceSound, (sound.getVolume + 1.0F) / 2.0F, sound.getPitch * 0.8F)
}
return true
@@ -17,6 +17,7 @@ import net.minecraft.entity.player.EntityPlayer
import codechicken.lib.render.Vertex5
import net.minecraft.item.ItemStack
import scala.collection.mutable.ListBuffer
import net.minecraft.block.StepSound
object MicroMaterialRegistry
{
@@ -46,6 +47,8 @@ object MicroMaterialRegistry
def getCutterStrength():Int
def getSound():StepSound
def isSolid() = !isTransparent
//todo, get material properties
}