use of com.nukkitx.protocol.bedrock.data.inventory.ItemData in project JukeboxMC by LucGamesYT.
the class ContainerInventory method sendContents.
@Override
public void sendContents(Player player) {
InventoryContentPacket inventoryContentPacket = new InventoryContentPacket();
inventoryContentPacket.setContainerId(WindowId.OPEN_CONTAINER.getId());
List<ItemData> itemDataList = new ArrayList<>();
for (Item content : this.getContents()) {
itemDataList.add(content.toNetwork());
}
inventoryContentPacket.setContents(itemDataList);
player.sendPacket(inventoryContentPacket);
}
use of com.nukkitx.protocol.bedrock.data.inventory.ItemData in project JukeboxMC by LucGamesYT.
the class ShapedRecipe method addOutput.
public ShapedRecipe addOutput(Item... items) {
List<ItemData> itemDataList = new ArrayList<>();
for (Item item : items) {
itemDataList.add(item.toNetwork());
}
this.outputs.addAll(itemDataList);
return this;
}
use of com.nukkitx.protocol.bedrock.data.inventory.ItemData in project JukeboxMC by LucGamesYT.
the class ShapedRecipe method doRegister.
@Override
public CraftingData doRegister(CraftingManager craftingManager, String recipeId) {
final List<ItemData> ingredients = new ArrayList<>();
for (String s : this.pattern) {
char[] chars = s.toCharArray();
for (char c : chars) {
ItemData ingredient = this.ingredients.get(c);
if (c == ' ') {
ingredients.add(new ItemAir().toNetwork());
continue;
}
if (ingredient == null) {
return null;
}
ingredients.add(ingredient);
}
}
return new CraftingData(CraftingDataType.SHAPED, recipeId, this.pattern[0].length(), this.pattern.length, -1, -1, ingredients, this.outputs, UUID.randomUUID(), "crafting_table", 1, 0xDEADBEEF);
}
use of com.nukkitx.protocol.bedrock.data.inventory.ItemData in project JukeboxMC by LucGamesYT.
the class ShapelessRecipe method addOutput.
public ShapelessRecipe addOutput(Item... items) {
List<ItemData> itemDataList = new ArrayList<>();
for (Item item : items) {
itemDataList.add(item.toNetwork());
}
this.outputs.addAll(itemDataList);
return this;
}
use of com.nukkitx.protocol.bedrock.data.inventory.ItemData in project JukeboxMC by LucGamesYT.
the class ShapelessRecipe method addIngredient.
public ShapelessRecipe addIngredient(Item... items) {
List<ItemData> itemDataList = new ArrayList<>();
for (Item item : items) {
itemDataList.add(item.toNetwork());
}
this.ingredients.addAll(itemDataList);
return this;
}
Aggregations