Created
December 16, 2014 04:51
-
-
Save Cazzar/b8348f4f6959d8801eef to your computer and use it in GitHub Desktop.
This file contains hidden or 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
implicit class RichByteBuf(buf: ByteBuf) { | |
def writeString(str: String) = ByteBufUtils.writeUTF8String(buf, String) | |
def readString() = ByteBufUtils.readUTF8String(buf) | |
def writeItemStack(is: ItemStack) = ByteBufUtils.writeItemStack(buf, is) | |
def readItemStack() = ByteBufUtils.readItemStack(buf) | |
def writePos(pos: BlockPos): Unit = { | |
buf.writeInt(pos.getX) | |
buf.writeInt(pos.getY) | |
buf.writeInt(pos.getZ) | |
} | |
def readPos() = { | |
val x = buf.readInt() | |
val y = buf.readInt() | |
val z = buf.readInt() | |
new BlockPos(x, y, z) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment