Java Code Examples for cn.nukkit.utils.BinaryStream#putSlot()
The following examples show how to use
cn.nukkit.utils.BinaryStream#putSlot() .
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: CraftingDataPacket.java From Jupiter with GNU General Public License v3.0 | 6 votes |
private static int writeShapedRecipe(ShapedRecipe recipe, BinaryStream stream) { stream.putVarInt(recipe.getWidth()); stream.putVarInt(recipe.getHeight()); for (int z = 0; z < recipe.getHeight(); ++z) { for (int x = 0; x < recipe.getWidth(); ++x) { stream.putSlot(recipe.getIngredient(x, z)); } } stream.putUnsignedVarInt(1); stream.putSlot(recipe.getResult()); stream.putUUID(recipe.getId()); return CraftingDataPacket.ENTRY_SHAPED; }
Example 2
Source File: CraftingDataPacket.java From Nukkit with GNU General Public License v3.0 | 6 votes |
private static int writeShapedRecipe(ShapedRecipe recipe, BinaryStream stream) { stream.putVarInt(recipe.getWidth()); stream.putVarInt(recipe.getHeight()); for (int z = 0; z < recipe.getHeight(); ++z) { for (int x = 0; x < recipe.getWidth(); ++x) { stream.putSlot(recipe.getIngredient(x, z)); } } stream.putUnsignedVarInt(1); stream.putSlot(recipe.getResult()); stream.putUUID(recipe.getId()); return CraftingDataPacket.ENTRY_SHAPED; }
Example 3
Source File: CraftingDataPacket.java From Jupiter with GNU General Public License v3.0 | 5 votes |
private static int writeShapelessRecipe(ShapelessRecipe recipe, BinaryStream stream) { stream.putUnsignedVarInt(recipe.getIngredientCount()); for (Item item : recipe.getIngredientList()) { stream.putSlot(item); } stream.putUnsignedVarInt(1); stream.putSlot(recipe.getResult()); stream.putUUID(recipe.getId()); return CraftingDataPacket.ENTRY_SHAPELESS; }
Example 4
Source File: CraftingDataPacket.java From Jupiter with GNU General Public License v3.0 | 5 votes |
private static int writeFurnaceRecipe(FurnaceRecipe recipe, BinaryStream stream) { if (recipe.getInput().hasMeta()) { //Data recipe stream.putVarInt(recipe.getInput().getId()); stream.putVarInt(recipe.getInput().getDamage()); stream.putSlot(recipe.getResult()); return CraftingDataPacket.ENTRY_FURNACE_DATA; } else { stream.putVarInt(recipe.getInput().getId()); stream.putSlot(recipe.getResult()); return CraftingDataPacket.ENTRY_FURNACE; } }
Example 5
Source File: CraftingDataPacket.java From Nukkit with GNU General Public License v3.0 | 5 votes |
private static int writeShapelessRecipe(ShapelessRecipe recipe, BinaryStream stream) { stream.putUnsignedVarInt(recipe.getIngredientCount()); for (Item item : recipe.getIngredientList()) { stream.putSlot(item); } stream.putUnsignedVarInt(1); stream.putSlot(recipe.getResult()); stream.putUUID(recipe.getId()); return CraftingDataPacket.ENTRY_SHAPELESS; }
Example 6
Source File: CraftingDataPacket.java From Nukkit with GNU General Public License v3.0 | 5 votes |
private static int writeFurnaceRecipe(FurnaceRecipe recipe, BinaryStream stream) { if (recipe.getInput().hasMeta()) { //Data recipe stream.putVarInt(recipe.getInput().getId()); stream.putVarInt(recipe.getInput().getDamage()); stream.putSlot(recipe.getResult()); return CraftingDataPacket.ENTRY_FURNACE_DATA; } else { stream.putVarInt(recipe.getInput().getId()); stream.putSlot(recipe.getResult()); return CraftingDataPacket.ENTRY_FURNACE; } }