Jump to content
  • Home
  • Files
  • Docs
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.16.4] Get Default Item Burn Times
Currently Supported: 1.16.X (Latest) and 1.15.X (LTS)
Sign in to follow this  
Followers 1
ptolemy2002

[1.16.4] Get Default Item Burn Times

By ptolemy2002, November 21, 2020 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

ptolemy2002    0

ptolemy2002

ptolemy2002    0

  • Tree Puncher
  • ptolemy2002
  • Members
  • 0
  • 27 posts
Posted November 21, 2020

I'm trying to develop a simple mod that will export certain properties of every registered item to an external file. Most of my properties are working, but I'm having trouble trying to implement the burnTime property. First, I tried using 

item.getBurnTime(new ItemStack(item, 1))

and found that method was repeatedly returning "-1" because the value was to be determined by the vanilla Minecraft Logic. I then did some research and found that I could use this:

ForgeHooks.getBurnTime(new ItemStack(item, 1))

I found that this was continuously returning "0" instead of my desired value, presumably because the map "VANILLA_BURNS" has no entry for the item. Finally, I tried using the deprecated

FurnaceTileEntity.getBurnTimes().get(item)

where I got the error

 java.lang.IllegalStateException: Tag minecraft:non_flammable_wood used before it was bound
Stacktrace:
	at net.minecraft.tags.TagRegistry$NamedTag.getTag(TagRegistry.java:131) ~[forge-1.16.4-35.0.18_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.tags.TagRegistry$NamedTag.contains(TagRegistry.java:142) ~[forge-1.16.4-35.0.18_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.tileentity.AbstractFurnaceTileEntity.isNonFlammable(AbstractFurnaceTileEntity.java:161) ~[forge-1.16.4-35.0.18_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading}
	at net.minecraft.tileentity.AbstractFurnaceTileEntity.addItemBurnTime(AbstractFurnaceTileEntity.java:175) ~[forge-1.16.4-35.0.18_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading}
	at net.minecraft.tileentity.AbstractFurnaceTileEntity.getBurnTimes(AbstractFurnaceTileEntity.java:97) ~[forge-1.16.4-35.0.18_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading}
	at com.example.examplemod.ExampleMod.setup(ExampleMod.java:104) ~[main/:?] {re:classloading}
	at net.minecraftforge.eventbus.EventBus.doCastFilter(EventBus.java:247) ~[eventbus-3.0.5-service.jar:?] {}
	at net.minecraftforge.eventbus.EventBus.lambda$addListener$11(EventBus.java:239) ~[eventbus-3.0.5-service.jar:?] {}
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:297) ~[eventbus-3.0.5-service.jar:?] {}
	at net.minecraftforge.fml.javafmlmod.FMLModContainer.acceptEvent(FMLModContainer.java:120) ~[forge:?] {re:classloading}
	at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:121) ~[forge:?] {re:classloading}
	at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1800) ~[?:?] {}
	at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1792) ~[?:?] {}
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290) ~[?:?] {}
	at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1016) ~[?:?] {}
	at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1665) ~[?:?] {}
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1598) ~[?:?] {}
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183) ~[?:?] {}

Which seems to indicate that the burn times cannot be generated yet. I was generating my file during the "FMLCommonSetupEvent" event. How can I successfully retrieve the correct value for burnTime?

  • Quote

Share this post


Link to post
Share on other sites

Draco18s    2406

Draco18s

Draco18s    2406

  • Reality Controller
  • Draco18s
  • Members
  • 2406
  • 15940 posts
Posted November 21, 2020
4 hours ago, ptolemy2002 said:

I was generating my file during the "FMLCommonSetupEvent" event. How can I successfully retrieve the correct value for burnTime?

You need to wait until after tags have been read and generated. There's an event for that too, but I'm blanking on its name.

IIRC it doesn't happen until after you start or load a save though.

  • Thanks 1
  • Quote

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Share this post


Link to post
Share on other sites

diesieben07    7613

diesieben07

diesieben07    7613

  • Reality Controller
  • diesieben07
  • Forum Team
  • 7613
  • 55180 posts
Posted November 21, 2020

Draco is correct, you have to wait until you are in game and then call ForgeHooks.getBurnTime.

  • Quote

Share this post


Link to post
Share on other sites

ptolemy2002    0

ptolemy2002

ptolemy2002    0

  • Tree Puncher
  • ptolemy2002
  • Members
  • 0
  • 27 posts
Posted November 21, 2020

Which event should I be using to accomplish this? Currently I am trying to subscribe to the TagsUpdatedEvent, but it doesn't appear to be called at all.

@Mod.EventBusSubscriber(bus=Bus.FORGE)
public static class GenericEvents {
  	@SubscribeEvent
    public static void onTagsUpdated(TagsUpdatedEvent event) {
    ...
    }
}

 

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    7613

diesieben07

diesieben07    7613

  • Reality Controller
  • diesieben07
  • Forum Team
  • 7613
  • 55180 posts
Posted November 21, 2020

PlayerLoggedInEvent.

  • Thanks 1
  • Quote

Share this post


Link to post
Share on other sites

ptolemy2002    0

ptolemy2002

ptolemy2002    0

  • Tree Puncher
  • ptolemy2002
  • Members
  • 0
  • 27 posts
Posted November 21, 2020

Thank you. My mod is working now.

  • Quote

Share this post


Link to post
Share on other sites

Draco18s    2406

Draco18s

Draco18s    2406

  • Reality Controller
  • Draco18s
  • Members
  • 2406
  • 15940 posts
Posted November 21, 2020
1 hour ago, ptolemy2002 said:

but it doesn't appear to be called at all.

Probably the wrong bus. But I'd go with D7's suggestion of the player logged in event.

  • Quote

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

    • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 1
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • fckurshitsite
      "shaderpacks" folder does not appear in Minecraft folder!

      By fckurshitsite · Posted 6 minutes ago

      so rude and useless :^)
    • Silivek
      Mod won't load when in dev environment

      By Silivek · Posted 24 minutes ago

      I ran it using the runClient configuration generated by  gradlew genEclipseRuns in the command line.
    • kiou.23
      Mod won't load when in dev environment

      By kiou.23 · Posted 28 minutes ago

      That's odd, I couldn't find anything wrong with the code. could you describe exactly what steps you are taking to run the mod?   also: your group in build.gradle and your main path doesn't follow the convention, seeing that you have a github, you could use that http://maven.apache.org/guides/mini/guide-naming-conventions.html   EDIT: Ideally I would pull the repo to my machine and try running the mod myself, but my weak computer takes 4 hours to decompile mc, So... sorry I can't do that
    • cadbane86140
      The Dream Skin Invasion!

      By cadbane86140 · Posted 29 minutes ago

      Hello There! This is a very weird but something worth documenting video on my channel, so late last night I see the usual stuff trending on twitter but decide to go into the server and well this happened... Our reactions are hilarious and I know you guys are gonna love it! I hope you all enjoy this video and if you did don't forget to like and sub for more!  
    • kiou.23
      Crafting Damage (1.16)

      By kiou.23 · Posted 33 minutes ago

      you don't need the existing damage, you can call ItemStack#damage() on the stack
  • Topics

    • DenizAri
      6
      "shaderpacks" folder does not appear in Minecraft folder!

      By DenizAri
      Started January 24, 2020

    • Silivek
      6
      Mod won't load when in dev environment

      By Silivek
      Started Thursday at 05:46 PM

    • cadbane86140
      0
      The Dream Skin Invasion!

      By cadbane86140
      Started 30 minutes ago

    • DeadZone
      4
      Crafting Damage (1.16)

      By DeadZone
      Started 2 hours ago

    • GermanBucket
      1
      IntelliJ doesn't include resources folder while debugging

      By GermanBucket
      Started 45 minutes ago

  • Who's Online (See full list)

    • Alloy1981
    • Godis_apan
    • Initifi
    • Draco18s
    • fckurshitsite
    • Silivek
    • LUCy2021
    • LeiteDesnatado
    • Extrodonary
    • HowBoutNo
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.16.4] Get Default Item Burn Times
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community