-
How get player inventory
player its player🤷♂️ @SubscribeEvent*/ public static void renderEnergy(RenderGameOverlayEvent.Post event) { if( in the hands of the required item ){ Minecraft.getInstance().fontRenderer.drawString(event.getMatrixStack(), "TEXT", event.getWindow().getScaledWidth()-10, event.getWindow().getScaledHeight()-2, 255); } }
-
How get player inventory
I have an event handler, but there is no reference to the player or his inventory in event. How to get what item the player is holding from the handler that does not have a link to the inventory?
-
1.16.4 Crafting with vanilla items
I still don't know what to do ( You speak as if it is very easy. So if it's easy, just show where and what to write. I will understand how IRecipeSerializer works faster
-
1.16.4 Crafting with vanilla items
Then? public class Mortar implements IRecipeSerializer<IRecipe<?>>{ @Override public IRecipeSerializer<?> setRegistryName(ResourceLocation name) { // TODO Auto-generated method stub return null; } @Override public ResourceLocation getRegistryName() { // TODO Auto-generated method stub return null; } @Override public Class<IRecipeSerializer<?>> getRegistryType() { // TODO Auto-generated method stub return null; } @Override public IRecipe<?> read(ResourceLocation recipeId, JsonObject json) { // TODO Auto-generated method stub return null; } @Override public IRecipe<?> read(ResourceLocation recipeId, PacketBuffer buffer) { // TODO Auto-generated method stub return null; } @Override public void write(PacketBuffer buffer, IRecipe<?> recipe) { // TODO Auto-generated method stub } }
-
1.16.4 Crafting with vanilla items
public static final DeferredRegister<IRecipeSerializer<?>> RECIPE = DeferredRegister.create(ForgeRegistries.RECIPE_SERIALIZERS, Main.MOD_ID); public static final RegistryObject<IRecipeSerializer<IRecipe<?>>> WHITE_DUST_RECIPE = RECIPE.register("white_dust_recipe", () -> new NEXT IDK
-
1.16.4 Crafting with vanilla items
Yes, but the only thing I came up with is this: public static final RegistryObject<IRecipeSerializer<IRecipe<?>>> WHITE_DUST = IRecipeSerializer.CRAFTING_SHAPELESS.IDK(((; But I understand that this is nonsense
-
1.16.4 Crafting with vanilla items
Yes, but I don't even know where and how to build the "register IRecipeSerializer" correctly
-
1.16.4 Crafting with vanilla items
- How to solve quantum entanglement? - Solve quantum entanglement - THX!!!!!!!!!!!!!!!!!!!!!!!!!! 😒
-
1.16.4 Crafting with vanilla items
Is it real? Only three Google pages? 99.9% of the results are not about what is needed, but 0.1% is the CLICK, and they did not help him... Really worst help. How are they recruited into the forum team? It's the same as if you ask "How to put the door?" And I answer "Put the door"
-
1.16.4 Crafting with vanilla items
WHERE? IN WHICH PLACE? Where does this documentation refer to the IRecipeSerializer? Maybe I'm blind, but I haven't read the worse documentation yet
-
1.16.4 Crafting with vanilla items
I'll tell you in detail: I added three items to the game - 1.pounder 2.Ore 3.milled ore I also made a recipe: 1.bowl 2.Ore 3.pounder Result: 1.milled ore The recipe is shapeless. I have implemented functions so that when crafting the pestle is not wasted, but -1 damage. It remains to make sure that the bowl does not disappear.
-
1.16.4 Crafting with vanilla items
(
-
1.16.4 Crafting with vanilla items
What is a complex recipe? I have a simple craft on the workbench
-
1.16.4 Crafting with vanilla items
God, how difficult. Why is there no documentation? public class White_dust extends SpecialRecipe{ public White_dust(ResourceLocation idIn) { super(idIn); } public boolean matches(CraftingInventory inv, World worldIn) { DyeColor dyecolor = null; ItemStack itemstack = null; ItemStack itemstack1 = null; for(int i = 0; i < inv.getSizeInventory(); ++i) { ItemStack itemstack2 = inv.getStackInSlot(i); Item item = itemstack2.getItem(); if (item instanceof BannerItem) { BannerItem banneritem = (BannerItem)item; if (dyecolor == null) { dyecolor = banneritem.getColor(); } else if (dyecolor != banneritem.getColor()) { return false; } int j = BannerTileEntity.getPatterns(itemstack2); if (j > 6) { return false; } if (j > 0) { if (itemstack != null) { return false; } itemstack = itemstack2; } else { if (itemstack1 != null) { return false; } itemstack1 = itemstack2; } } } return itemstack != null && itemstack1 != null; } /** * Returns an Item that is the result of this recipe */ public ItemStack getCraftingResult(CraftingInventory inv) { for(int i = 0; i < inv.getSizeInventory(); ++i) { ItemStack itemstack = inv.getStackInSlot(i); if (!itemstack.isEmpty()) { int j = BannerTileEntity.getPatterns(itemstack); if (j > 0 && j <= 6) { ItemStack itemstack1 = itemstack.copy(); itemstack1.setCount(1); return itemstack1; } } } return ItemStack.EMPTY; } public NonNullList<ItemStack> getRemainingItems(CraftingInventory inv) { NonNullList<ItemStack> nonnulllist = NonNullList.withSize(inv.getSizeInventory(), ItemStack.EMPTY); for(int i = 0; i < nonnulllist.size(); ++i) { ItemStack itemstack = inv.getStackInSlot(i); if (!itemstack.isEmpty()) { if (itemstack.hasContainerItem()) { nonnulllist.set(i, itemstack.getContainerItem()); } else if (itemstack.hasTag() && BannerTileEntity.getPatterns(itemstack) > 0) { ItemStack itemstack1 = itemstack.copy(); itemstack1.setCount(1); nonnulllist.set(i, itemstack1); } } } return nonnulllist; } public IRecipeSerializer<?> getSerializer() { return IRecipeSerializer.CRAFTING_SPECIAL_BANNERDUPLICATE; } public boolean canFit(int width, int height) { return width * height >= 2; } } I just look and do not understand what and why it causes? What are all these methods for? I only figured out "public IRecipeSerializer <?> GetSerializer ()", then it seems that I should return not CRAFTING_SPECIAL_BANNERDUPLICATE, but CRAFTING_SHAPELESS. But I'm not sure about that either
-
1.16.4 Crafting with vanilla items
Will I need to add a recipe using code and not a json file?
IPS spam blocked by CleanTalk.