ratquaza
Members-
Posts
10 -
Joined
-
Last visited
ratquaza's Achievements
Tree Puncher (2/8)
0
Reputation
-
ratquaza started following Use argument in command to redirect
-
Hey, I'm trying to create a /contract command that allows players to create a contract and send it to a player, the typical steps to make one are /contract create myContract mymod:forage_contract /contract edit myContract [some key] [some value] OR /contract edit myContract [add | remove] [some value] The mymod:forage_contract is a resource location that points to a registered Criteria object, and I want the arguments past edit myContract to be determined by the criteria the player selected I've figured out that I can use ArgumentBuilder#fork to redirect the command, and have created this abstract function in the Criteria class public abstract CommandNode<CommandSourceStack> getCommand(); Issue is, I don't know how to obtain the selected Criteria that the player has written in the chat so far, in order to redirect/fork it in the first place. This is my current code public static void register(CommandDispatcher<CommandSourceStack> dispatcher) { RequiredArgumentBuilder<CommandSourceStack, ?> criteriaNode = Commands.argument("criteria", ResourceLocationArgument.id()) .suggests((s, v) -> { CriteriaType.TYPE_REGISTRY.get().getKeys().forEach(r -> v.suggest(r.toString())); return v.buildFuture(); } ); dispatcher.register( Commands.literal("contract").requires(CommandSourceStack::isPlayer).then( Commands.literal("edit").then( Commands.argument("name", StringArgumentType.string()).then(criteriaNode) ) ) ); }
-
Realised my build.gradle was missing some things that lead to it not properly shading. It's fixed now!
-
What does that mean then? Do I have to reference the driver using Class.forName() and include the "shaded" part?
-
Currently trying to add H2 Database support with my mod. I've shaded the h2 database engine in my build.gradle like so: shadowJar { dependencies { include dependency("org.json:json:20180813"), include dependency("com.h2database:h2:1.0.60") } relocate("org.json", "shaded.org.json") relocate("com.h2database","shaded.com.h2database") } ... reobf { shadowJar { mappingType = 'SEARGE' } } Issue is, everytime I attempt to establish a connection using my H2Connection class like so: H2Connection db = new H2Connection("jdbc:h2:D:/H2db/test/test", "admin", "password"); I get an error saying: java.sql.SQLException: No suitable driver found for jdbc:h2:D:/H2db/test/test Anyone know whats up? Am I doing this right? This is my H2Connectionclass: public class H2Connection { private Connection conn; public H2Connection() {} public H2Connection(String url, String user, String pass) throws SQLException, ClassNotFoundException { connect(url, user, pass); } public void connect(String url, String user, String pass) throws SQLException, ClassNotFoundException { conn = DriverManager.getConnection(url,user,pass); } public ResultSet query(String query) throws SQLException { return conn.createStatement().executeQuery(query); } }
-
[1.12.2] Create Crafting Recipes without using JSON files?
ratquaza replied to ratquaza's topic in Modder Support
Well with my plugin I wish to enable users to create recipes with my own .json format that supports NBT and register that through my code. It's hard to do so when the recipes for a forge mod/plugin are stored within the assets of said mod/plugin, meaning players would have to store the json files within the actual jar itself. I want the mod/plugin to have command support too to register the items. -
[1.12.2] Create Crafting Recipes without using JSON files?
ratquaza replied to ratquaza's topic in Modder Support
So there's no way I can register a new ShapedCraftingRecipe from my plugin's code without .json files? -
[1.12.2] Create Crafting Recipes without using JSON files?
ratquaza posted a topic in Modder Support
Working on a current server plugin and I was wondering if its possible to create Crafting recipes through Java code alone within my plugin rather than storing the recipes in `assets/modid/recipes` ? I'd want to parse my own .json files within the plugins config folder and generate and register crafting recipes like so. -
No, I want it to apply to every item. Is this possible?
-
I'm looking for a crafting event that allows me to modify the item being crafted. Sponge has a similar event, CraftItemEvent.Preview which allows me to modify the item being crafted. The reason for this is that I'm creating a plugin that introduces random ranks to items, and I want the crafting event to calculate the average of all item's and their ranks, and apply it to the item being crafted.