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

[1.14.4] How to get the file location of the current game


Elrol_Arrowsend
 Share

Recommended Posts

I am looking to save a json for use in my mod. And since it will contain information realting to the specific game/server I would need to save the file in different locations for each, or change my json to have different trees for each save. I think the easiest way would just be to change the file location, but if I cant, then I would want to get the name of the singleplayer worlds, to seperate the json files.


Any help is appreciated.

Link to comment
Share on other sites

3 minutes ago, Elrol_Arrowsend said:

Any help is appreciated.

If your data is World specific then you might want to use a Capability.

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.

Link to comment
Share on other sites

2 minutes ago, Elrol_Arrowsend said:

Basically what I am making is a config file that is world dependent so that wouldn't work I dont think.

Ok that's a little more troubling. Also sounds a little inconvenient for the user. What configurations are you proposing? Maybe you should just put them in the Forge specified configs. Maybe a little thought to be put into this. Anyways new File(".") will give you the working directory, so new File(./saves) will give you the saves directory in SinglePlayer. And the World's name would be in World#getWorldInfo()

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.

Link to comment
Share on other sites

8 minutes ago, Elrol_Arrowsend said:

store configurations made while ingame

Oh well then a Capability would definitely work.

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.

Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

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

    • So I'm trying to make an ore generate in the end, and the veins are generating in huge sizes which are not desired. The first screenshot refers to a test where I set the max vein size to 3, and the second screenshot when I set it to 1. Screenshots   public class ModOreGeneration { public static void generateOres(final BiomeLoadingEvent event){ for(OreType ore: OreType.values()){ OreFeatureConfig oreFeatureConfig = new OreFeatureConfig( new BlockMatchRuleTest(Blocks.END_STONE), ore.getBlock().get().defaultBlockState(), ore.getMaxHeight() ); ConfiguredPlacement<TopSolidRangeConfig> configuredPlacement = Placement.RANGE.configured( new TopSolidRangeConfig(ore.getMinHeight(),ore.getMinHeight(), ore.getMaxHeight()) ); ConfiguredFeature<?,?> oreFeature = registerOreFeature(ore, oreFeatureConfig,configuredPlacement); event.getGeneration().addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, oreFeature); } } private static ConfiguredFeature<?,?> registerOreFeature(OreType ore, OreFeatureConfig oreFeatureConfig, ConfiguredPlacement configuredPlacement){ return Registry.register(WorldGenRegistries.CONFIGURED_FEATURE, ore.getBlock().get().getRegistryName(), Feature.ORE.configured(oreFeatureConfig).decorated(configuredPlacement).squared().count(ore.getMaxVeinSize())); } } public enum OreType { RUMBANITE(Lazy.of(ModBlocks.RUMBANITE_ORE),1,15,40); private final Lazy<Block> block; private final int maxVeinSize; private final int minHeight; private final int maxHeight; OreType(Lazy<Block> block, int maxVeinSize, int minHeight, int maxHeight) { this.block = block; this.maxVeinSize = maxVeinSize; this.minHeight = minHeight; this.maxHeight = maxHeight; } public Lazy<Block> getBlock() { return block; } public int getMaxVeinSize() { return maxVeinSize; } public int getMinHeight() { return minHeight; } public int getMaxHeight() { return maxHeight; } public static OreType get(Block block){ for(OreType ore : values()){ if(block == ore.block){ return ore; } } return null; } }  
    • What diesieben07 says, except the error's caused by Xaero's World Map, not the mini map   You're running XaerosWorldMap_1.19.0_Forge_1.18.jar which was released on Dec 28, 2021. They've since updated this mod a lot since they're currently at XaerosWorldMap_1.22.0_Forge_1.18.2.jar If I counted correctly, you're 11 updates behind on their releases, so it may be wise to either start a regular updating schedule or figure out a way to setup automated updates 😅 When you're waiting with updates until issues/errors arise, you're technically putting the server's data integrity at risk. Granted, this won't often result in permanent damages, but it could 😛  Also, there could be vulnerability patches that you're missing out on, which by the time they're patched become public-record, thus also known amongst any hacker that would want to exploit it. tl;dr: Updating the Xaero's mod will fix the issue, but given the severity of the outdated-ness, making changes as to how/when you're updating the software would be strongly advisable.
    • I wanted to make a block that melts like ice. I use the tick method in the BlockEntity to periodically check the light level. However  level.getBrightness(LightLayer.BLOCK,pos); always returns 0.
    • Double post, answered here  ^ (posting this to prevent someone wasting their time)
    • Your "XP Tome" mod causes a modified response when handling the "onAnvilChange" action, which calls for a registry object (xpbook:xp_book) that doesn't exist. The script calls for a non-existent object, hence the NullPointerException, which results in an empty response where the script expects and requires data from the missing object. Since the mod's scripts apparently lack a non-intrusive/efficient error handling that would ensure Minecraft continues, regardless of its own functionality, you're left with this crash 🧐   EDIT: I just looked up their source, to see if I could find the error, but they've already patched it in their most recent version:   // file: mod/xptome/XPTome.java public class XPTome { ... @SubscribeEvent public static void onAnvilUpdate(AnvilUpdateEvent event) { //prevention for a crash that should theoretically not happen, but apparently does XP_BOOK.ifPresent(xpBook -> { if(event.getLeft().getItem() == xpBook || event.getRight().getItem() == xpBook) event.setCanceled(true); }); XP_TOME.ifPresent(xpTome -> { if(event.getLeft().getItem() == xpTome || event.getRight().getItem() == xpTome) event.setCanceled(true); }); } }  
  • Topics

×
×
  • Create New...

Important Information

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