Java Code Examples for net.minecraft.util.collection.DefaultedList#size()
The following examples show how to use
net.minecraft.util.collection.DefaultedList#size() .
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: ShapedCompressingRecipeSerializer.java From Galacticraft-Rewoven with MIT License | 5 votes |
@Override public T read(Identifier identifier_1, PacketByteBuf packet) { int int_1 = packet.readVarInt(); int int_2 = packet.readVarInt(); String group = packet.readString(32767); DefaultedList<Ingredient> defaultedList_1 = DefaultedList.ofSize(int_1 * int_2, Ingredient.EMPTY); for (int int_3 = 0; int_3 < defaultedList_1.size(); ++int_3) { defaultedList_1.set(int_3, Ingredient.fromPacket(packet)); } ItemStack itemStack_1 = packet.readItemStack(); return factory.create(identifier_1, group, int_1, int_2, defaultedList_1, itemStack_1); }
Example 2
Source File: ShapelessCompressingRecipeSerializer.java From Galacticraft-Rewoven with MIT License | 5 votes |
@Override public T read(Identifier id, PacketByteBuf packet) { // String group = packet.readString(32767); int ingredientCount = packet.readVarInt(); DefaultedList<Ingredient> ingredients = DefaultedList.ofSize(ingredientCount, Ingredient.EMPTY); for (int index = 0; index < ingredients.size(); ++index) { ingredients.set(index, Ingredient.fromPacket(packet)); } ItemStack result = packet.readItemStack(); return factory.create(id, /*group, */result, ingredients); }
Example 3
Source File: ShapelessCompressingRecipeSerializer.java From Galacticraft-Rewoven with MIT License | 5 votes |
@Override public T read(Identifier id, JsonObject json) { // String group = JsonHelper.getString(json, "group", ""); DefaultedList<Ingredient> ingredients = getIngredients(JsonHelper.getArray(json, "ingredients")); if (ingredients.isEmpty()) { throw new JsonParseException("No ingredients for compressing recipe"); } else if (ingredients.size() > 9) { throw new JsonParseException("Too many ingredients for compressing recipe"); } else { ItemStack result = ShapelessCompressingRecipe.getStack(JsonHelper.getObject(json, "result")); return factory.create(id, /*group, */result, ingredients); } }