Jump to content

Recommended Posts

Posted (edited)

I'm making a minecraft mod and i want to use the ItemCraftedEvent but I dont know how to use it.

i've made an shapeless Crafting recipe: GameRegistry.addShapelessRecipe(new ItemStack(Moditems.obsidiandust, 2), Blocks.OBSIDIAN , new ItemStack(Moditems.sandpaper));

but i want that the "Sandpaper" comeback into my inventory.

Please help!!!

Edited by Dodison
Posted

Use the container item system for this, not ItemCraftedEvent.

 

If the sandpaper is returned to the player without change, call Item#setContainerItem with this as the argument in the sandpaper Item's constructor to set it as its own container item.

 

If the sandpaper is changed (e.g. damaged) by the crafting, override Item#getContainerItem(ItemStack) to copy its argument (ItemStack#copy), damage the copy (ItemStack#attemptDamageItem) and return the copy.

  • Like 1

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

 

  On 7/15/2017 at 11:46 AM, Choonster said:

Use the container item system for this, not ItemCraftedEvent.

 

If the sandpaper is returned to the player without change, call Item#setContainerItem with this as the argument in the sandpaper Item's constructor to set it as its own container item.

 

If the sandpaper is changed (e.g. damaged) by the crafting, override Item#getContainerItem(ItemStack) to copy its argument (ItemStack#copy), damage the copy (ItemStack#attemptDamageItem) and return the copy.

Expand  

i dont understand you

Posted
  On 7/15/2017 at 11:54 AM, Dodison said:

i dont understand you

Expand  

 

You'll need to be more specific. Which part didn't you understand?

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted
  On 7/15/2017 at 11:54 AM, Dodison said:

 

i dont understand you

Expand  

Does your sandpaper get damaged? If so in your sandpaper's class override getContainerItem if nothing happens after it is used then

  On 7/15/2017 at 11:43 AM, Animefan8888 said:

Call Item#setContainerItem() in the constructor of your sandpaper's class. And make it your sandpaper item.

Expand  

If you don't know what a constructor is or what override means then look it up and learn the Java programming language.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted (edited)
  On 7/15/2017 at 11:59 AM, Dodison said:

everything, can you give me an example how the code needs to see?

Expand  

 

I'm not going to write your code for you.

 

I've told you exactly which methods to override and call and in what order, you just need to translate that into code.

 

If there's a specific part of my post that you didn't understand, I can try to explain it further.

Edited by Choonster

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted
  On 7/15/2017 at 11:59 AM, Dodison said:

everything, can you give me an example how the code needs to see?

Expand  

 

  On 7/15/2017 at 11:58 AM, Animefan8888 said:

Does your sandpaper get damaged? If so in your sandpaper's class override getContainerItem if nothing happens after it is used then

If you don't know what a constructor is or what override means then look it up and learn the Java programming language.

Expand  

 

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

  • 1 year later...
Posted (edited)

Add this to ModItems.java, the sandpaper will keep on the crafting table after you craft the obsidiandust .(Just like milk bukket turn to bukket when you crafting a cake.)

 

sandpaper.setContainerItem(sandpaper);

Edited by lusterofgem
Posted

Please don't necro old threads.

This is my Forum Signature, I am currently attempting to transform it into a small guide for fixing easier issues using spoiler blocks to keep things tidy.

 

As the most common issue I feel I should put this outside the main bulk:

The only official source for Forge is https://files.minecraftforge.net, and the only site I trust for getting mods is CurseForge.

If you use any site other than these, please take a look at the StopModReposts project and install their browser extension, I would also advise running a virus scan.

 

For players asking for assistance with Forge please expand the spoiler below and read the appropriate section(s) in its/their entirety.

  Reveal hidden contents

 

Guest
This topic is now closed to further replies.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • wait, i just did that. why didn't it work? also it's the same. help me!!!!
    • Culprit has been located! It was Tough As Nails + (plus) which was among one of the mods *added* before re-entering, in an attempt to improve compatibility. It, for some reason or another, did not want to work!
    • "You can either try to load it with only the vanilla data pack ("safe mode"), or go back to the title screen and fix it manually." Hello! I encountered this error just now while attempting to re-enter my world for the first time. Notably, no mods were removed before encountering this error and, while being able to find this error elsewhere on the internet, in my scenario it is seemingly caused by a specific mod, of which I cannot isolate. Things I have tried: - Enter "Safe Mode" (fails) - Remove datapacks (no change) - Reverted to old save data (no change) Here is the server log: https://mclo.gs/9vJQEfN I use Modrinth mod loader so please let me know how to share my mod list, and if it is needed.
    • So, i'm hosting (or attempting to host) a port-forwarded modded server for 1.12.2. There's quite a few mods in this pack, but they all run and have no compatibility issues (besides something causing the game to crash if you go fullscreen, a problem ive given up trying to identify or fix). It can run on 6gb of ram or less, and works fine in singleplayer. All of my friends that want to join have the exact same mod/config/game setup as I do (I personally helped them set everything up). Just to be safe, we've all allocated 12 gigabytes of RAM to the installation, and I've also allocated 12GB to the server itself. I am able to join with no issue and it runs fine. However, when they try to join, it gets stuck in the 'logging in' screen before their game becomes unresponsive. When they close it, it gives them the exit code 805306369, which usually means not enough RAM, but this cant be the case. On my screen, in the server, it shows them joining, and then disconnecting, so I dont think its a port-forwarding issue. They can all run it just fine in singleplayer as well. The annoying bit about this particular issue is that it generates no crash log. Does anyone have any suggestions? Thanks! Here is my debug log, and his, starting from the same place. MINE: [132647] [Netty Client IO #5INFO] [FML] Attempting connection with missing mods [ctm, fusion] at SERVER 132653.817 [132653] [Client threadINFO] [minecraftGuiConnecting] Connecting to 0, 25565 132654.682 [132654] [Netty Client IO #9INFO] [STDOUT] [xaero.common.core.transformer.ClassNodeTransformertransform29] Transforming class brz net.minecraft.client.network.NetHandlerPlayClient 132654.684 [132654] [Netty Client IO #9INFO] [STDOUT] [xaero.map.core.transformer.ClassNodeTransformertransform29] Transforming class net.minecraft.client.network.NetHandlerPlayClient 132654.764 [132654] [Netty Client IO #9INFO] [FML] Server protocol version 2 132654.777 [132654] [Netty Client IO #9INFO] [FML] Attempting connection with missing mods [ctm, fusion] at SERVER 132656.193 [132656] [Client threadINFO] [FML] Injecting existing registry data into this client instance 132659.081 [132659] [Client threadINFO] [FML] Applying holder lookups 132659.082 [132659] [Client threadINFO] [FML] Holder lookups applied 132659.092 [132659] [Netty Client IO #9INFO] [FML] [Netty Client IO #9] Client side modded connection established HIS: [13:12:16] [Netty Client IO #0/INFO] [FML]: Attempting connection with missing mods [ctm, fusion] at SERVER 13:12:25.597 [13:12:25] [Client thread/INFO] [minecraft/GuiConnecting]: Connecting to (my IP address and the server port 25565) 13:12:26.805 [13:12:26] [Netty Client IO #1/INFO] [STDOUT]: [xaero.common.core.transformer.ClassNodeTransformer:transform:29]: Transforming class brz net.minecraft.client.network.NetHandlerPlayClient 13:12:26.808 [13:12:26] [Netty Client IO #1/INFO] [STDOUT]: [xaero.map.core.transformer.ClassNodeTransformer:transform:29]: Transforming class net.minecraft.client.network.NetHandlerPlayClient 13:12:26.936 [13:12:26] [Netty Client IO #1/INFO] [FML]: Server protocol version 2 13:12:27.114 [13:12:27] [Netty Client IO #1/INFO] [FML]: Attempting connection with missing mods [ctm, fusion] at SERVER 13:12:27.480 [13:12:27] [Client thread/INFO] [FML]: Injecting existing registry data into this client instance 13:12:30.669 [13:12:30] [Client thread/INFO] [FML]: Applying holder lookups 13:12:30.671 [13:12:30] [Client thread/INFO] [FML]: Holder lookups applied 13:13:04.700 Process crashed with exit code -805306369 P.S - Both mods "CTM" and "FUSION" are present in both our folders so idk what that's about.
    • Please read the FAQ (link is orange banner at top of page), and post logs as described there, to an external site such as https://mclo.gs  
  • Topics

  • Who's Online (See full list)

    • There are no registered users currently online
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.