squidlex
Members-
Posts
183 -
Joined
-
Last visited
Everything posted by squidlex
-
Reliable way to check if a key has been tapped once
squidlex replied to squidlex's topic in Modder Support
That explains it, thank's so much for the in-depth explanation diesieben! -
Doing this using .isKeyDown() and .isKeyPressed() (I don't have my IDE on my laptop but I think that's what they're called) is tempremental and both allow me to just hold it. Using the Key input event will fire when I let go of a key and using a tick event on the client side will often not read my input. Is there a reliable way to do something if and only if a key has been tapped? Or better yet what key triggered the keyboard input event?
-
[Solved] How to see which face of a block the player has collided with
squidlex replied to squidlex's topic in Modder Support
Perfect! That's exactly what I was looking for, thank you -
[Solved] How to see which face of a block the player has collided with
squidlex replied to squidlex's topic in Modder Support
That's where I'm stumped. Of course there is PlayerEntity.collidedHorizontally but that's a boolean and doesn't give the side. (used to be called EnumFacing not sure if it's the same or changed nowadays) -
[Solved] How to see which face of a block the player has collided with
squidlex replied to squidlex's topic in Modder Support
A quick follow up question for anybody that knows. Is there anyway to get the side of the block a player is touching? E.g if they are touching the north face of a block -
[Solved] How to see which face of a block the player has collided with
squidlex replied to squidlex's topic in Modder Support
My lord that's elegantly put. Thanks for the help! I'll get to work messing around with these -
As the title suggests! In a similar veign, I'm also trying to work out how to check if the block infront of the player's head and the block above that are air blocks. For example: X = PLAYER, O = BLOCK (from a side on perspective) X X O would be fine but... O X XO would not be I know it's a weird question but I've always wondered how mods work out stuff like this. I hope my terrible text diagrams help illustrate my question. Thanks for your help!
-
[1.16.1] NoSuchMethodError on latest version of forge
squidlex replied to squidlex's topic in Modder Support
Thanks Diesieben! -
Update: I read through the changelog and saw that Command registry has been updated. I'm guessing this is my issue
-
That was the problem! Thanks for spotting that, I'm really bad at spotting little errors like this. Thank you so much I can finally finish porting my mod!
-
Not to worry, I appreciate the time you took to respond
-
Thanks for your reply, but I'm now seeing either I worded my question poorly or I don't quite understand your reply. It doesn't sugget @p or anything like that at all when I type /commandtree edit_a_float but it does when I type /commandtree. When I type /commandtree edit_a_float and then type anything after that it returns Unknown Command.
-
Update: I'm definitely misunderstanding this. Here's my code: public class Command { public static void register(CommandDispatcher<CommandSource> dispatcher) { final LiteralArgumentBuilder<CommandSource> root = Commands.literal("commandtree"); root.then(Commands.literal("edit_a_float").then(Commands.argument("float", FloatArgumentType.floatArg()))).executes(source -> { return editPower(source.getSource(), source.getSource().asPlayer(), FloatArgumentType.getFloat(source, "float")); }).then(Commands.argument("player", EntityArgument.player())).executes(source -> { return editPower(source.getSource(), EntityArgument.getPlayer(source, "player"), FloatArgumentType.getFloat(source, "float")); }); root.then(Commands.literal("edit_a_cooldown").then(Commands.argument("ticks", IntegerArgumentType.integer()))).executes(source -> { return editCooldown(source.getSource(), source.getSource().asPlayer(), IntegerArgumentType.getInteger(source, "ticks")); }).then(Commands.argument("player", EntityArgument.player())).executes(source -> { return editCooldown(source.getSource(), EntityArgument.getPlayer(source, "player"), IntegerArgumentType.getInteger(source, "ticks")); }); dispatcher.register(root); } private static int editPower(CommandSource source, PlayerEntity player, float amount) { System.out.println("Adjusted power by " + amount + "!"); return 1; } private static int editCooldown(CommandSource source, PlayerEntity player, int ticks) { System.out.println("Adjusted cooldown by " + ticks + "!"); return 1; } } When entering my command, edit_a_float and edit_a_cooldown are recommended, but it also recommends usernames and all the @s. When typing in a command I get the message 'Unknown Command' or 'Incorrect argument for command'. Please could someone explain to me where I'm going wrong?
-
I'm looking to update a command tree I made for 1.12 to 1.15.2. Obviously Commands have changed to the CommandDispatcher now, so does anybody know of any good/simple source code I could look at for a basic command tree? Thanks for your help!
-
[1.15.2] Make a method return a value from a capability
squidlex replied to squidlex's topic in Modder Support
Finally got around to watching this, For anyone stumbling upon this thread I would highly recommend! Helped me see how much I'm treating a simple Minecraft mod like a huge project for my work, thanks for sharing Draco . -
[1.15.2] Make a method return a value from a capability
squidlex replied to squidlex's topic in Modder Support
That's very true, I only have this as a method as my mod add's one feauture with loads of checks (capability, command, potion effect, config options etc.), so it helps readability to seperate them all into methods instead of having one massive if statement. Actually looking over everything, I'll do it using ifPresent() to avoid any issues, thanks! -
[1.15.2] Make a method return a value from a capability
squidlex replied to squidlex's topic in Modder Support
Absolute lifesaver, thank you -
Hi there, I need a method to return a capability for a specific player. Here's what I'm trying to achieve (obviously this code doesn't work). private boolean returnFromACapability { player.getCapability(CapabilityProvider.SOME_CAP).ifPresent(cd -> { return cd.getBooleanValue(); // The method returnFromACapibility would return this }); return false; } I don't want to make any static variables as instances of this class are used on the Server side by different players and I'd rather not make a load of public variables outside this method as I have many similar ones and my code would get very messy. I think I'm too close to this and there's probably a super simple solution, so I figured I'd ask here. Thanks for your help!
-
[1.15.2] How to exclude JARs from the run config in build.gradle
squidlex replied to squidlex's topic in Modder Support
Sorry! it wasn't for me but it was obviously just a problem on my end -
[1.15.2] How to exclude JARs from the run config in build.gradle
squidlex replied to squidlex's topic in Modder Support
bump because this isn't showing up even when I log out of this account -
[1.15.2] How to exclude JARs from the run config in build.gradle
squidlex replied to squidlex's topic in Modder Support
This isn't showing up on the posts section for some reason -
I have a class that is only used when Game Stages is installed, however when running runClient with it as a dependency I get a crash. (The mod author is aware of this and other people have experienced it) If I remove the mod my classes that reference the mod show errors, which is frustrating. I want runClient to exclude running this mod, so I don't recieve errors in my IDE or in Minecraft, how would I go about blacklisting them? Thanks for your help!
-
What does it actually mean to be tracking an entity?
squidlex replied to squidlex's topic in Modder Support
I just looked and wow, you're not wrong there! Thank you for your really clear explanation of that concept, it's perfect for what I'm trying to achieve I hope you have/had a great day! -
I've seen a lot of stuff based around tracking an entity in events and networking in Forge's code, but I'm not sure what this actually means? I've googled it but can't find any clear cut explanation other than 'entities have different tracking distances based on their type'. Could anybody tell me what these are as well? Thank you for your help!