Jump to content

ultra_reemun

Members
  • Posts

    60
  • Joined

  • Last visited

Everything posted by ultra_reemun

  1. Oh I see. Do you know how I'd go about checking if it was a subclass of Pickaxeitem? That would at least give me compatability with a couple mods, aswell as all the vanilla ones. Thank you for all your help today!
  2. Is there anyway to check if the player is holding a tool by its type type? e.g is the player holding a pickaxe? This could be any pickaxe. Thank you for your help.
  3. Excellent! That's exactly what I'm looking for thank you.
  4. Oh I see, sorry @RicoMmbo for the false information.
  5. I wan't to stop my player from being able to damage mobs and other players in my LivingAttackEvent under certain conditions, however I don't know how to check if the attack is coming from the player. At the moment my code disables ALL damage, including that from mobs to my player, which is not what I want. Basically, how do I only fire my code for my player? Any help would be greatly appreciated!
  6. The forge installer seems to work offline in my testing so: Download it on your phone from here and then run it on your computer. The file you want is the latest installer as many 1.15.2 mods require it.
  7. @Ugdhar 's post is your best bet. It is also worth noting that Optifine 1.15.2 is only in the preview stage, and you may have to wait for it to get updated for this to fix. Thankfully the optifine team are pretty good at this! For now however you may have to either choice between 1 of the two mods, or alternatively backport to 1.14.4. If you need to stay in 1.15.2 for whatever reason, I would recommend using TerraForged (which I have no affiliation with whatsoever but can highly recommend) in place of BOP as in my experience this is compatable with optifine. Hope this helps!
  8. My bad, I missed the point of the class, I see what you mean now. Thank you!
  9. Thank you for the advice but I simply want to detect when the player has swung one of the vanilla tools. How would I go about using this event to stop the player from being able to damage other entities? Thank you for all your help.
  10. Apologies for not being specific enough. I want to check if a player has attacked with a tool, so left clicked but not to mine a block. I'm also looking to temporarily stop them from being able to do so, or at least stop it from inflicting damage.
  11. Are you using Optifine? That can often cause that renderer exception.
  12. Hi all, Is there an event I can use to check if the player has swung their weapon? Thank you!
  13. I have looked around the internet for this, and most pages recomend LWJGL's Keyboard class, however this is gone in my latest mappings, and is also outdated as the values have since changed. I have been using this website to figure them out, however I want my Keybind to be L_ALT and don't know how to go about adding it as it requires a left side modifier. Thank you for your help!
  14. Good point, I'm overcomplicating things ?
  15. Try searching for .getHandle() instead, then find what that's in?
  16. I want my users to be able to enter a String into the config in order to change a HUD texture. I'm using ForgeConfigSpec but can't find anyway to add a String. Any help would be greatly appreciated! I tried .ConfigValue<String> but am clearly using it wrong, and I can't find any information on this. Thank you for your time
  17. For anybody in the future finding this, I rewrote my code using TheElectronWill / night-config. https://github.com/TheElectronWill/night-config
  18. I have added config files to my mod, however only the first value in each can be changed For example one of my configs looks like this: [dodge] #The time it takes for your dodge to refresh. #Note that this value must be an integer (whole number) that is 2 or higher, or else things will not fire properly. #Default: 4 #Range: 2 ~ 20 cooldown_time = 4 #Whether or not you have to be touching the ground to dodge. #Without this enabled the dodge ability can be used like a dash whilst jumping, which may be overpowered. #Default: true requires_ground = false And no matter what I do to requires_ground, it always will equal its default value, however I can change cooldown_time. Here is my Config builder: @Mod.EventBusSubscriber public class Config { private static final ForgeConfigSpec.Builder server_builder = new ForgeConfigSpec.Builder(); public static final ForgeConfigSpec server_config; private static final ForgeConfigSpec.Builder client_builder = new ForgeConfigSpec.Builder(); public static final ForgeConfigSpec client_config; static { DodgeConfig.init(server_builder, client_builder); server_config = server_builder.build(); client_config = client_builder.build(); } public static void loadConfig(ForgeConfigSpec config, String path) { Dodge.LOGGER.info("Loading config: " + path); final CommentedFileConfig file = CommentedFileConfig.builder(new File(path)).sync().autosave().writingMode(WritingMode.REPLACE).build(); Dodge.LOGGER.info("Built config: " + path); file.load(); Dodge.LOGGER.info("Loaded config: " + path); config.setConfig(file); } } And here is my Config: public class DodgeConfig { public static ForgeConfigSpec.IntValue cooldown_time; public static ForgeConfigSpec.BooleanValue requires_ground; public static void init(ForgeConfigSpec.Builder server, ForgeConfigSpec.Builder client) { server.comment("dodge config"); cooldown_time = server .comment("The time it takes for your dodge to refresh. \nNote that this value must be an integer (whole number) that is 2 or higher, or else things will not fire properly. \nDefault: 4") .defineInRange("dodge.cooldown_time", 4, 2, 20); requires_ground = server .comment("Whether or not you have to be touching the ground to dodge. \nWithout this enabled the dodge ability can be used like a dash whilst jumping, which may be overpowered. \nDefault: true") .define("dodge.requires_ground", false); } } It is also worth noting that I have updated my DodgeConfig class and deleted my server-config.toml, however upon running minecraft server-config.toml reverts to how it was before I applied my changes. I'm so confused so any help would be greatly appreciated. Alternatively, if you know a better way to create a config in1.15.2 please share!
  19. An unideal fix I have found for this is to base my timer off of the length of the cooldown bar. I'm worried however that this will lead to unpredictable values aswell as my time not being entirely accurate.
  20. Thank you for your reply. I've tried rounding it when I draw it however I am running into the same issue, the cooldown ends before the GUI shows it does.
  21. Hi there, I am currently trying to make a cooldown bar decrement gradually over a set time, however am unable to do so as that would require me to decrement each tick by a double, which ingameGUI.blit does not support. Is there anyway around this? My problem is this: 182 needs to gradually go down to 0 over X amount of ticks, by even decrements. However, each decrement must be an int. Is there anyway to allow this to happen? Currently X = 80, which means if it decrements evenly each tick it must be a float, 2,275, which blit does not support. I have tried Math.round() and Math.ceil(), however that messes up the timing of my cooldown Here's my code: @SubscribeEvent public static void playerTick(TickEvent.PlayerTickEvent event) { if (event.phase == TickEvent.Phase.END) { Minecraft mc = Minecraft.getInstance(); PlayerEntity player = event.player; if (player == mc.player) { if (player.world.isRemote) { cooldown++; //DodgeGui.dlen is the length of the dodge bar // Handle GUI. every tick, it needs to go down by cooldownLength/182 if (DodgeGui.dlen > 0) { DodgeGui.dlen = (int) (DodgeGui.dlen-Math.ceil(182/80)); System.out.println(80/182); } if (cooldown == cooldownLength) { Minecraft.getInstance().player.playSound(SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP, 1f, 1); DodgeGui.dlen = 0; //Ensure it's hidden } } } } } } Any help would be greatly appreciated!
×
×
  • Create New...

Important Information

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