Created
January 21, 2016 17:18
-
-
Save Wehavecookies56/5a118cdec49aca781e6c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(!world.isRemote){ | |
if(world.getBlockState(pos).getBlock() instanceof BlockDoor) { | |
String sound; | |
if(world.getBlockState(pos).getValue(BlockDoor.HALF) == EnumDoorHalf.UPPER){ | |
world.setBlockState(pos.down(), world.getBlockState(pos.down()).withProperty(BlockDoor.OPEN, !world.getBlockState(pos.down()).getValue(BlockDoor.OPEN))); | |
sound = world.getBlockState(pos.down()).getValue(BlockDoor.OPEN) ? "random.door_close" : "random.door_open"; | |
world.playSoundAtEntity(player, sound, 1.0f, 1.0f); | |
return true; | |
} else { | |
world.setBlockState(pos, world.getBlockState(pos).withProperty(BlockDoor.OPEN, !world.getBlockState(pos).getValue(BlockDoor.OPEN))); | |
sound = world.getBlockState(pos).getValue(BlockDoor.OPEN) ? "random.door_close" : "random.door_open"; | |
world.playSoundAtEntity(player, sound, 1.0f, 1.0f); | |
return true; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment