You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I am new to java, learning coding and such. but I am also looking into adding support for Controlify to this or that mod or atleast want to see it happen possibly. The problem i am having is your GUI for CraftingTerminalScreen.class does not support in Controlify's virtual mouse snapping that is configured to my xbox controllers DPAD, it works for everything else but GUI that are in this mod.
I have been working with chatgpt also trying to learn while also doing codeacademy for java. Analyzing what is what and such.
but here is what i got it to give me if this means anything to you or helps you out if you would help add this to it?
import dev.isxander.controlify.api.vmousesnapping.SnapPoint;
import dev.isxander.controlify.api.vmousesnapping.ISnapBehaviour;
import org.joml.Vector2i;
import java.util.Set;
import java.util.HashSet;
public class CraftingTerminalScreen extends AbstractStorageTerminalScreen<CraftingTerminalMenu> implements ISnapBehaviour {
// Constructor and other methods...
@Override
public Set<SnapPoint> getSnapPoints() {
Set<SnapPoint> snapPoints = new HashSet<>();
// Example: add a snap point at the center of a button
snapPoints.add(new SnapPoint(new Vector2i(buttonXCenter, buttonYCenter), 10)); // 10 is the radius
return snapPoints;
//buttonXCenter and buttonYCenter should be the coordinates of the center of the buttons or other interactive elements within your GUI.
}
}
warno: I just learned the very basics of java literally this week off codeacademy so i did try seeing what all ai can do lol and partially lazy, but I'm interested in learning lol. The funny part is i have been spending too dam long on this to try add a feature to a mod that mods controls for a game that dont have stock controller support like bedrock but also first time playing java edition this much and spent more time researching this than playing lmao....
Response ChatGPT
The code you've provided offers valuable insights into how Controlify handles virtual mouse snapping and interacts with different GUI elements in Minecraft. To make your CraftingTerminalScreen work with the Controlify mod, you'll need to focus on implementing interfaces and potentially using utilities that Controlify expects other screens or GUI elements to use.
Steps to Implement Controlify's Snapping Functionality
Implement ISnapBehaviour in CraftingTerminalScreen:
The ISnapBehaviour interface defines a method getSnapPoints() that you should implement in your CraftingTerminalScreen. This method should return a set of SnapPoint objects, each representing a point on the screen where the virtual mouse should snap to.
java
import dev.isxander.controlify.api.vmousesnapping.SnapPoint;
import dev.isxander.controlify.api.vmousesnapping.ISnapBehaviour;
import org.joml.Vector2i;
import java.util.Set;
import java.util.HashSet;
public class CraftingTerminalScreen extends AbstractStorageTerminalScreen<CraftingTerminalMenu> implements ISnapBehaviour {
// Constructor and other methods...
@Override
public Set<SnapPoint> getSnapPoints() {
Set<SnapPoint> snapPoints = new HashSet<>();
// Example: add a snap point at the center of a button
snapPoints.add(new SnapPoint(new Vector2i(buttonXCenter, buttonYCenter), 10)); // 10 is the radius
return snapPoints;
}
}
buttonXCenter and buttonYCenter should be the coordinates of the center of the buttons or other interactive elements within your GUI.
Use SnapUtils as a reference:
The provided SnapUtils class shows how snap points are added for different components like buttons within a recipe book. You can use this logic as a model for adding snap points to the components of your CraftingTerminalScreen.
Specifically, look at how it calculates the center and adds a snap point. You would do something similar for each interactive element in your custom GUI.
Examine the Mixin Configuration:
The JSON configuration suggests that Controlify uses a comprehensive set of mixins to modify and extend the behavior of many classes in Minecraft. While you don't need to modify this directly, understanding that it is adjusting a wide range of classes can help you ensure that your screen behaves consistently with others that are modified by Controlify.
Implementing Snapping Functionality Directly
If your CraftingTerminalScreen has buttons or interactive elements, determine their x and y coordinates, preferably in the center of these elements. Use these coordinates to create SnapPoint instances as shown in the ISnapBehaviour implementation. This way, when Controlify's virtual mouse functionality is active, it will be able to snap to these elements on your custom screen.
Testing and Debugging
After implementing the changes:
Test Thoroughly: Make sure that when Controlify is active, and the CraftingTerminalScreen is displayed, the virtual mouse snaps to the defined points correctly.
Debug as Needed: If snapping doesn't work as expected, check the coordinates and radii used for the snap points. Also, ensure that CraftingTerminalScreen is correctly recognized by the mod as implementing ISnapBehaviour.
This approach ensures that your custom GUI integrates smoothly with Controlify’s system, leveraging its built-in functionality for enhanced controller support.
Controlify api.vmousesnapping
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
Hello, I am new to java, learning coding and such. but I am also looking into adding support for Controlify to this or that mod or atleast want to see it happen possibly. The problem i am having is your GUI for CraftingTerminalScreen.class does not support in Controlify's virtual mouse snapping that is configured to my xbox controllers DPAD, it works for everything else but GUI that are in this mod.
I have been working with chatgpt also trying to learn while also doing codeacademy for java. Analyzing what is what and such.
but here is what i got it to give me if this means anything to you or helps you out if you would help add this to it?
Edit: here is link to chatgpt convo if intersted (it has some of the controlify shit in there if need). https://chatgpt.com/share/6765e9b2-b5a4-800e-9a41-ed3dcecfa936
warno: I just learned the very basics of java literally this week off codeacademy so i did try seeing what all ai can do lol and partially lazy, but I'm interested in learning lol. The funny part is i have been spending too dam long on this to try add a feature to a mod that mods controls for a game that dont have stock controller support like bedrock but also first time playing java edition this much and spent more time researching this than playing lmao....
Response ChatGPT
The code you've provided offers valuable insights into how Controlify handles virtual mouse snapping and interacts with different GUI elements in Minecraft. To make your CraftingTerminalScreen work with the Controlify mod, you'll need to focus on implementing interfaces and potentially using utilities that Controlify expects other screens or GUI elements to use.Steps to Implement Controlify's Snapping Functionality
Implement ISnapBehaviour in CraftingTerminalScreen:
The ISnapBehaviour interface defines a method getSnapPoints() that you should implement in your CraftingTerminalScreen. This method should return a set of SnapPoint objects, each representing a point on the screen where the virtual mouse should snap to.
java
buttonXCenter and buttonYCenter should be the coordinates of the center of the buttons or other interactive elements within your GUI.
Use SnapUtils as a reference:
The provided SnapUtils class shows how snap points are added for different components like buttons within a recipe book. You can use this logic as a model for adding snap points to the components of your CraftingTerminalScreen.
Specifically, look at how it calculates the center and adds a snap point. You would do something similar for each interactive element in your custom GUI.
Examine the Mixin Configuration:
The JSON configuration suggests that Controlify uses a comprehensive set of mixins to modify and extend the behavior of many classes in Minecraft. While you don't need to modify this directly, understanding that it is adjusting a wide range of classes can help you ensure that your screen behaves consistently with others that are modified by Controlify.
Implementing Snapping Functionality Directly
If your CraftingTerminalScreen has buttons or interactive elements, determine their x and y coordinates, preferably in the center of these elements. Use these coordinates to create SnapPoint instances as shown in the ISnapBehaviour implementation. This way, when Controlify's virtual mouse functionality is active, it will be able to snap to these elements on your custom screen.
Testing and Debugging
After implementing the changes:
Test Thoroughly: Make sure that when Controlify is active, and the CraftingTerminalScreen is displayed, the virtual mouse snaps to the defined points correctly.
Debug as Needed: If snapping doesn't work as expected, check the coordinates and radii used for the snap points. Also, ensure that CraftingTerminalScreen is correctly recognized by the mod as implementing ISnapBehaviour.
This approach ensures that your custom GUI integrates smoothly with Controlify’s system, leveraging its built-in functionality for enhanced controller support.
Controlify api.vmousesnapping
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package dev.isxander.controlify.api.vmousesnapping;
import java.util.Set;
public interface ISnapBehaviour {
Set getSnapPoints();
}
{
"package": "dev.isxander.controlify.mixins",
"required": true,
"minVersion": "0.8",
"minMixinExtrasVersion": "0.5.0-beta.1",
"injectors": {
"defaultRequire": 1
},
"compatibilityLevel": "JAVA_17",
"client": [
"core.ClientPacketListenerMixin",
"core.GLXMixin",
"core.GuiMixin",
"core.KeyboardHandlerMixin",
"core.MinecraftMixin",
"core.MouseHandlerMixin",
"feature.accessibility.LocalPlayerMixin",
"feature.autoswitch.SystemToastAccessor",
"feature.autoswitch.ToastManagerAccessor",
"feature.bind.ClientPacketListenerMixin",
"feature.bind.GuiMixin",
"feature.bind.KeyMappingMixin",
"feature.bind.MinecraftMixin",
"feature.bind.ToggleKeyMappingMixin",
"feature.font.FontAccessor",
"feature.font.KeybindContentsMixin",
"feature.guide.ingame.ClientPacketListenerMixin",
"feature.guide.ingame.GuiMixin",
"feature.guide.screen.AbstractContainerScreenAccessor",
"feature.guide.screen.AbstractWidgetMixin",
"feature.guide.screen.TabNavigationBarMixin",
"feature.hdhaptics.JOrbisAudioStreamMixin",
"feature.input.DebugScreenOverlayAccessor",
"feature.input.MinecraftMixin",
"feature.nomousetutorial.MovementTutorialStepInstanceMixin",
"feature.oofinput.GameRendererMixin",
"feature.patches.boatfix.BoatMixin",
"feature.patches.boatfix.LocalPlayerMixin",
"feature.reacharound.GameRendererMixin",
"feature.rumble.MinecraftMixin",
"feature.rumble.blockbreak.MultiPlayerGameModeMixin",
"feature.rumble.damage.LivingEntityMixin",
"feature.rumble.damage.LocalPlayerMixin",
"feature.rumble.damage.PlayerMixin",
"feature.rumble.explosion.ClientPacketListenerMixin",
"feature.rumble.explosion.LightningBoltMixin",
"feature.rumble.fishing.FishingHookMixin",
"feature.rumble.itembreak.LivingEntityMixin",
"feature.rumble.itembreak.LocalPlayerMixin",
"feature.rumble.levelevents.LevelRendererMixin",
"feature.rumble.slowblock.LocalPlayerMixin",
"feature.rumble.useitem.ClientPacketListenerMixin",
"feature.rumble.useitem.LivingEntityMixin",
"feature.rumble.useitem.LocalPlayerMixin",
"feature.rumble.waterland.LocalPlayerMixin",
"feature.rumble.waterland.PlayerMixin",
"feature.screenkeyboard.ChatComponentMixin",
"feature.screenkeyboard.ChatScreenMixin",
"feature.screenkeyboard.CommandSuggestionsMixin",
"feature.screenop.ContainerEventHandlerMixin",
"feature.screenop.MinecraftMixin",
"feature.screenop.ScreenAccessor",
"feature.screenop.ScreenMixin",
"feature.screenop.vanilla.AbstractButtonMixin",
"feature.screenop.vanilla.AbstractContainerEventHandlerMixin",
"feature.screenop.vanilla.AbstractContainerScreenMixin",
"feature.screenop.vanilla.AbstractRecipeBookScreenMixin",
"feature.screenop.vanilla.AbstractSelectionListMixin",
"feature.screenop.vanilla.AbstractSignEditScreenMixin",
"feature.screenop.vanilla.AbstractSliderButtonMixin",
"feature.screenop.vanilla.bundle.BundleMouseActionsMixin",
"feature.screenop.vanilla.ContainerObjectSelectionListEntryMixin",
"feature.screenop.vanilla.CreateWorldScreenMixin",
"feature.screenop.vanilla.CreativeModeInventoryScreenMixin",
"feature.screenop.vanilla.EditBoxMixin",
"feature.screenop.vanilla.JoinMultiplayerScreenAccessor",
"feature.screenop.vanilla.JoinMultiplayerScreenMixin",
"feature.screenop.vanilla.LanguageSelectionListEntryMixin",
"feature.screenop.vanilla.OptionsSubScreenAccessor",
"feature.screenop.vanilla.PauseScreenAccessor",
"feature.screenop.vanilla.PauseScreenMixin",
"feature.screenop.vanilla.SelectWorldScreenAccessor",
"feature.screenop.vanilla.SelectWorldScreenMixin",
"feature.screenop.vanilla.ServerSelectionListEntryMixin",
"feature.screenop.vanilla.TabNavigationBarAccessor",
"feature.screenop.vanilla.TitleScreenMixin",
"feature.screenop.vanilla.WorldSelectionListEntryMixin",
"feature.settingsbutton.ControlsScreenMixin",
"feature.steamdeck.ScreenshotAccessor",
"feature.util.ConnectScreenMixin",
"feature.virtualmouse.InputConstantsMixin",
"feature.virtualmouse.KeyboardHandlerAccessor",
"feature.virtualmouse.MinecraftMixin",
"feature.virtualmouse.MouseHandlerAccessor",
"feature.virtualmouse.MouseHandlerMixin",
"feature.virtualmouse.snapping.AbstractContainerScreenMixin",
"feature.virtualmouse.snapping.AbstractRecipeBookScreenMixin",
"feature.virtualmouse.snapping.CreativeModeInventoryScreenMixin",
"feature.virtualmouse.snapping.RecipeBookComponentAccessor",
"feature.virtualmouse.snapping.RecipeBookPageAccessor",
"feature.virtualmouse.snapping.ScreenMixin"
],
"mixins": [
"feature.font.TranslatableContentsMixin",
"feature.guide.ingame.PlayerAccessor"
],
"refmap": "Controlify-1.21.4-fabric-refmap.json"
}
controlify.virtualmouse
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package dev.isxander.controlify.virtualmouse;
import dev.isxander.controlify.api.vmousesnapping.SnapPoint;
import dev.isxander.controlify.mixins.feature.virtualmouse.snapping.RecipeBookComponentAccessor;
import dev.isxander.controlify.mixins.feature.virtualmouse.snapping.RecipeBookPageAccessor;
import java.util.Collection;
import net.minecraft.class_361;
import net.minecraft.class_507;
import org.joml.Vector2i;
public final class SnapUtils {
private SnapUtils() {
}
}
Thank you in advanced!
The text was updated successfully, but these errors were encountered: