
arturkr
Members-
Posts
31 -
Joined
-
Last visited
Everything posted by arturkr
-
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); } }
-
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?
-
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
-
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 } }
-
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
-
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
-
Yes, but I don't even know where and how to build the "register IRecipeSerializer" correctly
-
- How to solve quantum entanglement? - Solve quantum entanglement - THX!!!!!!!!!!!!!!!!!!!!!!!!!! 😒
-
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"
-
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
-
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.
-
(
-
What is a complex recipe? I have a simple craft on the workbench
-
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
-
Will I need to add a recipe using code and not a json file?
-
I don't know where to define getRemainingItems and how to make it "work" later
-
can someone really help?
-
Really? You have an inflated sense of self-importance thx for hepl😒
-
Then you can tell me where the getRemainingItems method is located, so that I can study it
-
And where can I see the documentation for getRemainingItems?
-
I have a recipe in which I use a vanilla item from minecraft. But when crafting, this item disappears, how to make sure that the vanilla item does not disappear when crafting?😅
-
Ha-ha ItemInit.java public class ItemInit{ public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, Main.MOD_ID); public static final RegistryObject<Item> pounder = ItemInit.ITEMS.register("pounder", () -> new Pounder(new Item.Properties().group(ItemGroup.TOOLS).maxStackSize(1).setNoRepair().maxDamage(63))); } Pounder.java public class Pounder extends Item{ public Pounder(Properties properties) { super(properties); } @Override public boolean hasContainerItem(ItemStack stack) { return true; } @Override public ItemStack getContainerItem(ItemStack stack) { ItemStack ret = stack.copy(); if(ret.attemptDamageItem(1, Main.random, null)) return ItemStack.EMPTY; else return ret; } } Main.java public class Main { public static Random random = new Random(); public static final Logger LOGGER = LogManager.getLogger(); public static final String MOD_ID = "magic"; public Main() { IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus(); bus.addListener(this::setup); ItemInit.ITEMS.register(bus); MinecraftForge.EVENT_BUS.register(this); } private void setup(final FMLCommonSetupEvent event) { } } ITS WORK and in recipes need add for item "data": 32767. Yeeeey
-
k, i go learn shJava. thx for help)
-
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA. You understand that I am stupid and do not know Java. Could you write for me where to click and where to write?)
-
It's true. I know C ++ well and I thought that there was not much difference there ... But Java is just a different world) But still, can you help with the code?