Jump to content

Elrol_Arrowsend

Members
  • Posts

    182
  • Joined

  • Last visited

Everything posted by Elrol_Arrowsend

  1. Not sure exactly why, but in my config I have a list of strings. When I change the config, and reload the config, some settings work properly (things like booleans, and integers) but the list of strings get reverted back to default. I feel like it has to deal with them being ForgeConfigSpec.ConfigValue<List<String>> I can provide more code relating to it, but would prefer to not upload it all. Any help is appreciated and welcomed FeatureConfig.java @Mod.EventBusSubscriber public class FeatureConfig { public static ForgeConfigSpec.ConfigValue<String> tag; public static ForgeConfigSpec.BooleanValue color_chat_enable; public static ForgeConfigSpec.BooleanValue translation_enable; public static ForgeConfigSpec.ConfigValue<String> color_chat_perm; public static ForgeConfigSpec.ConfigValue<String> link_chat_perm; public static ForgeConfigSpec.BooleanValue rainbow_code_enable; public static ForgeConfigSpec.BooleanValue holiday_code_enable; public static ForgeConfigSpec.BooleanValue enable_global_perms; public static ForgeConfigSpec.BooleanValue enable_economy; public static ForgeConfigSpec.ConfigValue<List<String>> jan_colors; public static ForgeConfigSpec.ConfigValue<List<String>> feb_colors; public static ForgeConfigSpec.ConfigValue<List<String>> mar_colors; public static ForgeConfigSpec.ConfigValue<List<String>> apr_colors; public static ForgeConfigSpec.ConfigValue<List<String>> may_colors; public static ForgeConfigSpec.ConfigValue<List<String>> jun_colors; public static ForgeConfigSpec.ConfigValue<List<String>> jul_colors; public static ForgeConfigSpec.ConfigValue<List<String>> aug_colors; public static ForgeConfigSpec.ConfigValue<List<String>> sep_colors; public static ForgeConfigSpec.ConfigValue<List<String>> oct_colors; public static ForgeConfigSpec.ConfigValue<List<String>> nov_colors; public static ForgeConfigSpec.ConfigValue<List<String>> dec_colors; public static ForgeConfigSpec.IntValue clearlag_frequency; public static ForgeConfigSpec.BooleanValue clearlag_items; public static ForgeConfigSpec.BooleanValue clearlag_hostile; public static ForgeConfigSpec.BooleanValue clearlag_passive; public static ForgeConfigSpec.BooleanValue auto_clearlag_enabled; public static void init(ForgeConfigSpec.Builder server){ server.comment("The tag used by the mod, leave empty for no tag."); tag = server.define("tag", "&8[&9S&aU&8]"); server.comment("enabling global permissions will make all players op, then restrict command usage based on the permissions.json file (in the config directory) and the permissions the player has."); enable_global_perms = server.define("global perms", true); server.comment("disabling translations will force all messages to be in english."); translation_enable = server.define("translations", true); server.push("Auto Clearlag"); auto_clearlag_enabled = server.define("enabled", false); clearlag_frequency = server.defineInRange("frequency", 5, 0, Integer.MAX_VALUE); server.push("Entities"); clearlag_items = server.define("item", true); clearlag_passive = server.define("passive", true); clearlag_hostile = server.define("hostile", true); server.pop(); server.pop(); server.push("Color Chat"); color_chat_perm = server.define("perm", "serverutils.colorchat"); link_chat_perm = server.define("link-perm", "serverutils.linkchat"); color_chat_enable = server.define("enabled", true); server.push("Color Codes"); server.comment("This will enable the &g color code, which will change text to rainbow."); rainbow_code_enable = server.define("rainbow enabled", true); server.comment("This will enable the &h color code, which will change text based on the month it is."); holiday_code_enable = server.define("holiday enabled", true); server.push("Holiday Colors"); jan_colors = server.define("January", Arrays.asList("8", "7", "6", "f")); feb_colors = server.define("Febuary", Arrays.asList("f", "d", "5", "c")); mar_colors = server.define("March", Arrays.asList("2", "a", "f", "6")); apr_colors = server.define("April", Arrays.asList("b", "a", "9", "f")); may_colors = server.define("May", Arrays.asList("a", "e", "b", "9")); jun_colors = server.define("June", Arrays.asList("7", "f", "c")); jul_colors = server.define("July", Arrays.asList("c", "f", "9")); aug_colors = server.define("August", Arrays.asList("6", "c", "a")); sep_colors = server.define("September", Arrays.asList("8", "c", "e")); oct_colors = server.define("October", Arrays.asList("8", "6", "f")); nov_colors = server.define("November", Arrays.asList("c", "6", "e")); dec_colors = server.define("December", Arrays.asList("a", "f", "c")); server.pop(); server.pop(); server.pop(); Logger.log("Config has been initialized"); } Configs.java public class Configs { private static final ForgeConfigSpec.Builder featureBuilder = new ForgeConfigSpec.Builder(); public static final ForgeConfigSpec featureConfig; private static final ForgeConfigSpec.Builder commandBuilder = new ForgeConfigSpec.Builder(); public static final ForgeConfigSpec commandConfig; static { Main.getLogger().info("Loading configs"); FeatureConfig.init(featureBuilder); featureConfig = featureBuilder.build(); CommandConfig.init(commandBuilder); commandConfig = commandBuilder.build(); } public static void reload(){ loadConfig(featureConfig, FMLPaths.CONFIGDIR.get().resolve("ServerUtils_Features.toml").toString()); loadConfig(commandConfig, FMLPaths.CONFIGDIR.get().resolve("ServerUtils_Commands.toml").toString()); } public static void loadConfig(ForgeConfigSpec config, String path){ Main.getLogger().info("Loading config: " + path); final CommentedFileConfig file = CommentedFileConfig.builder(new File(path)).sync().autosave().writingMode(WritingMode.REPLACE).build(); Main.getLogger().info("Built config: " + path); file.load(); Main.getLogger().info("Loaded config: " + path); config.setConfig(file); } }
  2. i am aware that 1.12.2 is no longer supported, and I know that people are going to say 'update'. This is for a project for a mod that is 1.12 and hasnt updated as of yet, when they do, I will update. I am trying to use a few forge methods and I am getting very odd happenings. For example. I am trying to get the registry name of items and put them to a string. The issue is that when I use "Items.WOODEN_SHOVEL.getRegistryName()" it is returning something called "nf" and not the ResourceLocation like it should be. I have a similar issue with using the player from a break block event. Instead of the player it was returning something called "aed" Firstly, in my ide, these classes dont exist and trying to set them to it results in issues. The only methods they have are things like "arg" or "cast" and im not sure what is going on. This is the first time seeing it and it only happend recently.
  3. Well, I was already told to not do this, but what I was doing, was checking if there is any items registered to a certain tag, and if so try and get the first one so I can use it in my code to enable/disable item and recipe registration, but I am now just registering the item and I need to disable the recipes if the item doesnt exist, which is my next goal. I am not too sure how to use the conditions in the recipes to check for a mod or item
  4. I am attempting to get an Item from a tag (like 'Ingots/copper') to have my mod offer support for mods, but I am having an issue with my method returning null, so I assume that I have something wrong, or I am going about it the wrong way. public static Item getOreDict(String oreDic) { ResourceLocation tag = new ResourceLocation("forge", oreDic); Tag<Item> t = ItemTags.getCollection().get(tag); if(t == null) { Main.LOGGER.error(tag.toString()); return null; } Collection<Item> tagCollection = t.getAllElements(); for(Item item : tagCollection) { Main.LOGGER.info(item.getName().getFormattedText()); return item; } return null; }
  5. Basically what I am wanting to do is to change how minecraft/other mods check for permissions. The reason I want to do this is to be able to control which commands players can use without changing them to an operator. For my own mod, this is easy, but I am not sure how to do so with others, If you have any suggestions or questions please let me know.
  6. Not at all, never a good thing to edit vanilla, these are all running from the execution of my commands.
  7. Thats why I was worried, im using forge, and that only happens when i called my teleport method from inside a runnable that i had set on a delay. But it seems to be working now, I just wish i knew why. On top of that it normally just times the client out and kills the server because a single tick took over a min. so idk
  8. Going to be honest, I am not sure what the difference is. The code was being called in a runnable, and I managed to work around this and have the location and uuid stored and then just having another method check the stored location and teleport the player there.
  9. I am getting an error when trying to teport players to different dimensions java.lang.ArrayIndexOutOfBoundsException: 110 at it.unimi.dsi.fastutil.longs.LongLinkedOpenHashSet.rehash(LongLinkedOpenHashSet.java:1083) ~[fastutil-8.2.1.jar:?] {} at net.minecraft.world.lighting.LevelBasedGraph$1.rehash(LevelBasedGraph.java:26) ~[forge-1.14.4-28.1.62_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading} at it.unimi.dsi.fastutil.longs.LongLinkedOpenHashSet.add(LongLinkedOpenHashSet.java:368) ~[fastutil-8.2.1.jar:?] {} at net.minecraft.world.lighting.LevelBasedGraph.addToUpdate(LevelBasedGraph.java:96) ~[?:?] {re:classloading} at net.minecraft.world.lighting.LevelBasedGraph.propagateLevel(LevelBasedGraph.java:138) ~[?:?] {re:classloading} at net.minecraft.world.lighting.LevelBasedGraph.propagateLevel(LevelBasedGraph.java:150) ~[?:?] {re:classloading} at net.minecraft.world.chunk.ChunkDistanceGraph.notifyNeighbors(ChunkDistanceGraph.java:24) ~[?:?] {re:classloading} at net.minecraft.world.lighting.LevelBasedGraph.processUpdates(LevelBasedGraph.java:189) ~[?:?] {re:classloading} at net.minecraft.world.server.TicketManager$ChunkTicketTracker.func_215493_a(TicketManager.java:298) ~[?:?] {re:classloading} at net.minecraft.world.server.TicketManager.func_219353_a(TicketManager.java:98) ~[?:?] {re:classloading} at net.minecraft.world.server.ServerChunkProvider.func_217235_l(ServerChunkProvider.java:268) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.world.server.ServerChunkProvider.access$200(ServerChunkProvider.java:48) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.world.server.ServerChunkProvider$ChunkExecutor.driveOne(ServerChunkProvider.java:504) ~[?:?] {re:classloading} at net.minecraft.world.server.ServerChunkProvider.func_217234_d(ServerChunkProvider.java:264) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.server.MinecraftServer.func_213205_aW(MinecraftServer.java:731) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.server.MinecraftServer.driveOne(MinecraftServer.java:720) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.util.concurrent.ThreadTaskExecutor.driveUntil(ThreadTaskExecutor.java:123) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.server.MinecraftServer.runScheduledTasks(MinecraftServer.java:706) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:650) [?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at java.lang.Thread.run(Thread.java:748) [?:1.8.0_201] {} The methods that I am using to try to teleport the player: public static void teleport(ServerPlayerEntity player, Location loc) { PlayerData data = Main.database.get(player.getUniqueID()); if(player.world.isRemote) Logger.err("WORLD IS REMOTE"); data.prevLoc = getPlayerLocation(player); ServerWorld world = player.server.getWorld(loc.getDim()); if(Main.isDev()) { world = player.server.getWorld(loc.getDim()); if(world.isAreaLoaded(loc.getBlockPos(), 5)) { Logger.log("AREA IS LOADED"); } else { Logger.log("AREA IS BEING LOADED"); } } else { TextUtils.err(player.getCommandSource(), "The ability to teleport between dimensions has been disabled until it can be fixed."); return; } player.teleport(world, loc.x() + 0.5D, loc.y(), loc.z() + 0.5D, loc.getYaw(), loc.getPitch()); }
  10. So, it was brought to my attention that the way that I am teleporting the player using commands seems to cause some rather bad happenings on the server. When I first tried it, after they found the issue, I tried to teleport from the overworld to the end. When I did it had me suspended in what looked like the end, but nothing was loaded, no blocks could be seen, I couldn't move, nothing. Eventually my client disconnected, and then when I tried to log back in the server crashed saying that the server took a 60 seconds for a single tick. The way that I am attempting to teleport the player is just like how they do it in minecrafts code (pulled from the end portal block code) entityIn.changeDimension(worldIn.dimension.getType() == DimensionType.THE_END ? DimensionType.OVERWORLD : DimensionType.THE_END); What I am doing is this: public static void teleport(ServerPlayerEntity player, Location loc) { PlayerData data = Main.database.get(player.getUniqueID()); data.prevLoc = getPlayerLocation(player); BlockPos pos = loc.getBlockPos(); if(!player.dimension.equals(loc.getDim())) { if(Main.isDev()) { player.changeDimension(loc.getDim()); }else { TextUtils.err(player.getCommandSource(), "The ability to teleport between dimensions has been disabled until it can be fixed."); return; } } player.setPositionAndUpdate((double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D); } I feel like something I am doing must be the issue, it is normally the reason, but I was fairly certain that this would work.
  11. I have not tested that quite yet, I will do so in a bit and see what happens.
  12. Wouldn't it be relating to the client not having a mod that the server does? When I was looking around this error had been around for some time. I was thinking that it was refering to the default config for my mod having integers in the config with a min of 0. But if there is no way to fix it, and it doesn't seem to cause any issues other then on the log, should i worry about it at all?
  13. I am currently getting an issue for my mod, not a large issue, just some errors thrown into the log. From what I can tell, it is because the mod is not present on the client and it is trying to send/sync the config up with the client. And since the client doesnt have the config null is less then 0. My goal is to make a server side mod, that can be used on the client, but not required. The error is short so I will just put one of the segments here [14:01:31] [Client thread/FATAL]: Error executing task on Client java.lang.IllegalArgumentException: Default value cannot be lower than minimum value! at aju.<init>(SourceFile:21) ~[1.14.4.jar:?] at dkc.a(SourceFile:2054) ~[1.14.4.jar:?] at no.a(SourceFile:70) ~[1.14.4.jar:?] at no.a(SourceFile:15) ~[1.14.4.jar:?] at ke.a(SourceFile:21) ~[1.14.4.jar:?] at ke$$Lambda$1872/204485816.run(Unknown Source) ~[?:?] at agq.h(SourceFile:144) [1.14.4.jar:?] at agu.h(SourceFile:23) [1.14.4.jar:?] at agq.q(SourceFile:118) [1.14.4.jar:?] at agq.bh(SourceFile:103) [1.14.4.jar:?] at cyc.e(SourceFile:915) [1.14.4.jar:?] at cyc.b(SourceFile:410) [1.14.4.jar:?] at net.minecraft.client.main.Main.main(SourceFile:155) [1.14.4.jar:?]
  14. I am not sure what the issue could be, I know the file works, because I use that in a resource pack and its fine, the file is named properly, but still when I use the mod it doesnt work. What could be the issue? -Edit- Just found out that somehow it was missing a bracket. Not sure how i missed that.
  15. Alright, many thanks. I will see if that will work for what I am trying to do.
  16. I am fairly certain that unless a blockState has the property already added at initialization you cant add a property to it, but a friend told me they had seen someone do it. Just to clearify, I would make a Property and add it to, lets say for example, an air block. Normally it would throw an error saying that you cant add it to the block state, because the BlockStateContainer doesnt have that property. So my question would be is there a way around this, and if not, what would the best way of storing two things on to virtually any block in minecraft?
  17. Yeah, makes a big difference, changed it to be much lower and it loaded. Thanks for that.
  18. Ok yeah, hoenstly did not know that it made them ALL, I was thinking it just was storing the number, going to drop that down to like idk 1k or something
  19. Isnt that supposed to be the max number that should be allowed there? or does it make every blockstate value between the max and the min?
  20. I am trying to see if I would be able to add new properties to a block that already exists in the world, or change the values of a block property in the world. Currently any time I try to run my code to test, it freezes at the initalization of the Propertys public static final PropertyInteger tempProp = PropertyInteger.create("temp", 0, 2000000000); public static final PropertyBool sourceProp = PropertyBool.create("tempSource"); The reason I am wanting to do this is to make an api to handle block temps, and adding/updating temps on blocks in the world. What we were currently planning on doing, was to have certain blocks be sources of a temp, like lava or torches, and that would slowly heat up blocks around it until all the blocks in a certain area had a temp value, and have a few events check every second to update the players temp and what not. The updates would be slow, but also somewhat realistic, lighting a fire wont instantly make the room hot, it would take a bit to warm up. The only way that I could think to make this happen was to store the temps on the blocks and check the properties when we are looking for them. **SOLVED** Dont make the number so high, since it makes each of the files the max is too high it adds 4 billions states, I changed it to 2k and it works
  21. Again, thanks for this info. This will make my commands much less of a headahce and far more organized.
  22. I am not sure what is not working. this is the whole file (not including imports) for my eventHandler. @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.FORGE) public class OnPlayerJoin { static { System.out.println("PlayerLoggedInEvent registered"); } @SubscribeEvent(priority = EventPriority.HIGHEST) public void onPlayerJoin(PlayerEvent.PlayerLoggedInEvent event) { System.out.println("Player logged in"); } } The static method gets fired and prints into the console. However, when the player logs in, the print method does not print to the console. What it seems to be, is that the file is loaded, but the event isnt fired when a player logs in..
  23. I am trying to find out if there is a way to have different requirements based off of one of the arguments in a command. for example: /testCommand string String /testCommand player Elrol_Arrowsend so the first one, would require a string, because the prior argument is string, and the second would need a PlayerEntity because the prior command is player. I saw something about forks and I am thinking that it might be what I am looking for, but I am not too sure, so I figured I would ask.
  24. A little while ago I opened an issue because I could not get the config to load the changes made outside of minecraft. That has been fixed, and after I have the config loaded, I check the values: ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, Config.server_config, "server-utils.toml"); Config.loadConfig(Config.server_config, FMLPaths.CONFIGDIR.get().resolve("server-utils.toml").toString()); ... if(Config.enableSpawn.get()) { Logger.debug("Spawn has been Enabled!"); } else { Logger.debug("Spawn has been Disabled!"); } When the code runs this it shows that the values that I changed in the file are changed, for this issue, it printed that Spawn was disabled, because in the file it was set to false. So that works as expected. However, later on in the code, when I call back to the issue to check the value, it is set to true. The code that I use to check it is this: Logger.debug("The config option for EnableSpawn is set to: " + Config.enableSpawn.get().toString()); if(Config.enableSpawn.get()) { SpawnCmd.register(dispatcher); SetSpawnCmd.register(dispatcher); } else { Logger.debug("Spawn commands disabled"); } This prints out and says that the value of enableSpawn is true, when earlier it was false. This seems like I am doing something wrong still, but I have no idea. The only way that I could think of to make this work is to store the values of the config elsewhere and use those after initializing them at the start, after the config was loaded. But this seems like a bad solution. If anyone can help me understand the issue, I would be very glad.
×
×
  • Create New...

Important Information

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