Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

addScheduledTask in Newer Versions (1.16.x/ 1.17.x) [Solved]


urbanxx001
 Share

Recommended Posts

As the title says, I was wondering what the updated method/process for addScheduledTask is. I need this for an event similar to:

@SubscribeEvent
public void onEntityJoin(final EntityJoinWorldEvent event) {
	Minecraft.getInstance() //(not recognized)--> .addScheduledTask(new Runnable() {
	    @Override
	    public void run() { }
	});
}

For the FML setup event I've used:

event.enqueueWork(() -> { }

But I'm not sure what's required for a simple event. The context for this is collecting what language the client is using and then sending a packet to sync with the server. But the packet must be delayed or it fails in this event.

Edit: Actually I can do the same thing when the player loads a container needing it. So the event's probably unnecessary

Edited by urbanxx001
Link to comment
Share on other sites

  • urbanxx001 changed the title to addScheduledTask in Newer Versions (1.16.x/ 1.17.x)
  • urbanxx001 changed the title to addScheduledTask in Newer Versions (1.16.x/ 1.17.x) [Solved]

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.   Restore formatting

  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.

 Share



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • I don't know what you used to post the log here, but next time please upload the log to a paste site, this is horrible to look at with all the formatting removed One of your server configs is failing to load properly, if you have not modified it delete ironfurnaces-server.toml
    • Did you download the server-specific files for the pack or did you copy the mods from the client and hope?
    • 1.12 is no longer supported on this forum. Please update to a modern version of Minecraft to receive support.
    • [18:32:34] [Server thread/WARN] [ne.mi.co.ForgeConfigSpec/CORE]: Configuration file .\saves\New World (2)\serverconfig\forge-server.toml is not correct. Correcting [18:32:34] [Server thread/WARN] [ne.mi.co.ForgeConfigSpec/CORE]: Incorrect key server was corrected from null to its default, SimpleCommentedConfig:{   Using that code and before I get that. And my mob still don't work.
    • Hey, I'm new to the forge data generators and was trying to get them up and running. At the moments they aren't crashing or anything but they also don't seem to be generating any data, as far as I can tell they're set up correctly and I've tried both runClient and runData and as far as I can tell they neither loaded the models correctly into the game nor output them in any files I can see. I have no real idea what I'm doing though. so I have my main data generator class that looks a bit like this: @Mod.EventBusSubscriber(modid = GaiaTerrainMod.MODID, bus = Mod.EventBusSubscriber.Bus.MOD) public class GaiaDataManager { @SubscribeEvent public static void gatherData(final GatherDataEvent event) { GaiaTerrainMod.LOGGER.info("gathering data!"); DataGenerator generate = event.getGenerator(); ExistingFileHelper existingFileHelper = event.getExistingFileHelper(); generate.addProvider(new GaiaBlockStateGenerator(generate,existingFileHelper)); generate.addProvider(new GaiaItemModelGenerator(generate, existingFileHelper)); GaiaBlockTagGenerator blockTags = new GaiaBlockTagGenerator(generate, existingFileHelper); generate.addProvider(blockTags); generate.addProvider(new GaiaItemTagGenerator(generate, blockTags, existingFileHelper)); generate.addProvider(new GaiaLootTableGenerator(generate)); generate.addProvider(new GaiaRecipeGenerator(generate)); GaiaTerrainMod.LOGGER.info("gathered data!"); } } originally it didn't have the "@Mod.EventBusSubscriber(modid = GaiaTerrainM..." line at the top and instead was only invoked through a line in the GaiaTerrainMod constructor that looked like this: public GaiaTerrainMod() { IEventBus registry_bus = FMLJavaModLoadingContext.get().getModEventBus(); registry_bus.addListener(this::setup); MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(GaiaDataManager.class); ModWoodTypes.init(); ModBlocks.BLOCKS.register(registry_bus); ModItems.ITEMS.register(registry_bus); GaiaBiomeSelector.initBiomeMappings(); } as you can see at the start and end of my gatherData function I have logs and when I hit "runData" they fired and I could see them as the last 2 things outputted by the console, however in GaiaBlockStateGenerator, the first data provider added to my data generator, I also put 2 logs at the start and end of the overriden registerStatesAndModels() function. These never fired, I assume they should after my gatherData logs fired. Not sure though, as far as i can tell the issue should be somewhere in these files (unless it's somewhere weird), again I'm not getting any crashes or errors just a plain old, doesn't do the thing I want it to which clearly indicates I've done something dumb somewhere.
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.