squidlex
Members-
Posts
183 -
Joined
-
Last visited
Everything posted by squidlex
-
I'm trying to setup a common config that is read from the physical server over the physical client, however the physical client is taking presedence over it. Why is this happening and how can I fix it? Config: @EventBusSubscriber(modid = Dodge.MODID, bus = EventBusSubscriber.Bus.MOD) public final class ConfigHandler { public static class Common { public final ForgeConfigSpec.DoubleValue dodgePower; public final ForgeConfigSpec.IntValue hungerRequirement; public final ForgeConfigSpec.BooleanValue allowDodgeWhileAirborne; public final ForgeConfigSpec.BooleanValue enableCooldown; public final ForgeConfigSpec.IntValue cooldownLength; public final ForgeConfigSpec.BooleanValue displayParticles; public final ForgeConfigSpec.BooleanValue fancyParticles; public Common(ForgeConfigSpec.Builder builder) { // BALANCE dodgePower = builder .comment("How powerful each player's dodge is. Defaults at 1 which is just under 3 blocks.") .defineInRange("balance.power", 1, 0, Double.MAX_VALUE); hungerRequirement = builder.comment( "How many half drumsticks the player needs to dodge. Set this to -1 to disable this feature. By default it's the same as sprinting, 6.") .defineInRange("balance.hungerRequirement", 6, -1, 20); allowDodgeWhileAirborne = builder.comment( "Set this to true to allow the player to dodge whilst in midair. Note the player always has this ability in creative mode.") .define("balance.allowDodgeWhileAirborne", false); // COOLDOWN enableCooldown = builder.comment("Set this to false to disable the cooldown bar completely.") .define("cooldown.enabled", true); cooldownLength = builder .comment("How long the dodge takes to cooldown in (roughly) seconds. This defaults to 4.") .defineInRange("cooldown.duration", 3, 1, Integer.MAX_VALUE); // PARTICLES displayParticles = builder .comment("Set this to false to disable the particles emitted when a player dodges") .define("particles.enableParticles", true); fancyParticles = builder.comment( "Set this to true to enable fancy particles, many prefer the old particles so that is now the default.") .define("particles.fancy", false); } } public static final Common COMMON; public static final ForgeConfigSpec COMMON_SPEC; static { final Pair<Common, ForgeConfigSpec> specPair = new ForgeConfigSpec.Builder().configure(Common::new); COMMON_SPEC = specPair.getRight(); COMMON = specPair.getLeft(); } // Bakers @SubscribeEvent public static void onModConfigEvent(final ModConfig.ModConfigEvent configEvent) { if (configEvent.getConfig().getSpec() == ConfigHandler.COMMON_SPEC) { bakeCommonConfig(); } } // Common public static double dodgePower; public static int hungerRequirement, cooldownLength; public static boolean allowDodgeWhileAirborne, enableCooldown, displayParticles, fancyParticles; public static void bakeCommonConfig() { dodgePower = COMMON.dodgePower.get(); hungerRequirement = COMMON.hungerRequirement.get(); cooldownLength = COMMON.cooldownLength.get() * 20; allowDodgeWhileAirborne = COMMON.allowDodgeWhileAirborne.get(); enableCooldown = COMMON.enableCooldown.get(); displayParticles = COMMON.displayParticles.get(); fancyParticles = COMMON.fancyParticles.get(); } } Where it is used: public class DodgeEvents { @SubscribeEvent public void onKeyPressed(InputEvent.KeyInputEvent event) { if (Dodge.DodgeClient.DODGE_KEY.isKeyDown() && DodgeGui.len <= 0 && spamPreventer >= 12) { if (player.isCreative() || player.isSpectator() || player.onGround || ConfigHandler.allowDodgeWhileAirborne) { //DO STUFF } } } How it is called in my main class: public Dodge() { ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, ConfigHandler.COMMON_SPEC); DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> { MinecraftForge.EVENT_BUS.register(new DodgeEvents()); } I think it has something to do with my DistExecutor, is there any workaround for this?
-
[1.15.2] Can you make server configs non-save specific
squidlex replied to squidlex's topic in Modder Support
I'd completely misunderstood how they work, thank you so much for the clarification So if I wanted a config that would apply to all worlds, and be read from the physical server over the physical client I could use common? Thanks for your in-depth answer I really appreciate it. -
As my server config is world save specific, is there anyway modpack creators can create a default one for any world created with my mod installed? I've seen alot of people use common configs but I don't think they sync across the server and client. Thank you!
-
[1.15.2] How to check if a key is double tapped
squidlex replied to squidlex's topic in Modder Support
Thanks for the code I really appreciate it! For some reason even with this code, which I agree should definitely work, it constantly outputs that it has been double pressed. Thanks for your help though -
[1.15.2] How to check if a key is double tapped
squidlex replied to squidlex's topic in Modder Support
Thanks for the replying, how did you go about implementing your boolean? I tried using one as so if (Minecraft.getInstance().gameSettings.keyBindLeft.isKeyPressed && notPressed) { if (timer > 0) { timer = 0; // Do something from double tap } else { timer = 10; } notPressed = false; } else if(!Minecraft.getInstance().gameSettings.keyBindLeft.isKeyPressed) { notPressed = true; } This however never fired. -
[1.15.2] How to check if a key is double tapped
squidlex replied to squidlex's topic in Modder Support
Hi again, sorry to be a pain but do you have any source code I can look at? I'm having some issues with this firing multiple times. No worries if not -
Currently my mod is using both a server config and a client config, the issue here is that the server config appears to be save specific, which would cause issues for modpack creators. Is there any way I can make my common config sync with a server's common config? The config is used for balancing and if the player can change it just for themselves issues would arise. Thanks for your help!
-
[1.15.2] How to check if a key is double tapped
squidlex replied to squidlex's topic in Modder Support
Is anyone aware of an alternate method to this? I'd imagine it works but I'm getting some odd behaviour in using both onKeyPressed() and isKeyDown() whilst using a boolean flag to make it only fire once. I've tried this in KeyInputEvent, ClientTickEvent and PlayerTickEvent. The issue is that when I hold down the key it will fire randomly at times and act as a double press. Edit: I tried onKeyPressed() by itself, and seperately tried isKeyDown() whilst using a boolean flag. -
[1.15.2] How to check if a key is double tapped
squidlex replied to squidlex's topic in Modder Support
Thanks for the reply! -
I want to check if the default move back key is double tapped. I've tried looking into how Minecraft handles sprinting but I can't find the actual check for a double tap. Thanks for your help!
-
I'm currently using ForgeConfigSpec builder which populates the config in the order it loads. Is there anyway to make it populate in the order of my code? I found another forum post on this that suggests using CommentedFileConfig builder, so if anyone knows of anywhere I can learn how to use it I'd appreciate it! Thanks for the help! Edit, I learned what define does I'm an idiot
-
[1.15.2] Disable vanilla experience bar without affecting other mods
squidlex replied to squidlex's topic in Modder Support
Thank you all for your help! -
[1.15.2] Disable vanilla experience bar without affecting other mods
squidlex replied to squidlex's topic in Modder Support
No worries at all man! You can find it on Mine and Slash's curse page and then click source. The issue is that MY mod breaks mine and slash but you can see that its HUD is rendered as the EXPERIENCE type in its source code. If you find a solution please let me know -
[1.15.2] Disable vanilla experience bar without affecting other mods
squidlex replied to squidlex's topic in Modder Support
It's not because this stops rendering mods that use ElementType.EXPERIENCE as I said in my OP. If you don't believe me, look at the source code for mods such as mine and slash. The given code would stop that mod from loading all of its HUD. -
[1.15.2] Disable vanilla experience bar without affecting other mods
squidlex replied to squidlex's topic in Modder Support
If anyone knows how to stop rendering specific parts of the HUD I'd really appreciate it -
[1.15.2] Disable vanilla experience bar without affecting other mods
squidlex replied to squidlex's topic in Modder Support
Good point, I want it to not render. Sorry for not being clear. -
I want to disable the vanilla experience bar, however my current method of if (event.getType() == RenderGameOverlayEvent.ElementType.EXPERIENCE) { event.setCanceled(true); } Also disables any other mods HUDs that use ElementType.EXPERIENCE. is there anyway I can disable the vanilla exp bar without affecting anything else? Thanks for your help!
-
[1.15.2] Is there anyway to safely remove a basegame enchantment
squidlex replied to squidlex's topic in Modder Support
Can confirm this works, thank you very much : ) -
[1.15.2] Is there anyway to safely remove a basegame enchantment
squidlex replied to squidlex's topic in Modder Support
Wow, thank you for such an in depth response! I'll get to work on testing it out ? -
[1.15.2] [Solved] Custom arrow entity not rendering
squidlex replied to squidlex's topic in Modder Support
Ah that's not what I'm after, I'll rewrite my code for the entity type and get back to you. Many thanks. Edit: Turns out I didn't set up my deffered register correctly, works a charm now! Thanks for the support. -
[1.15.2] [Solved] Custom arrow entity not rendering
squidlex replied to squidlex's topic in Modder Support
Thanks for all your help diesieben07 but I ended up just using the vanilla EntityType.ARROW for now. Are there any issues with this approach if I'm happy with my arrow looking like the vanilla one? I'll take a look at those, thanks for the advice