Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fd/activator setup #13

Open
wants to merge 512 commits into
base: main
Choose a base branch
from
Open

Fd/activator setup #13

wants to merge 512 commits into from

Conversation

FavouriteDragon
Copy link
Member

Desc:
Primary focus on the Form implementations, rather than the input modules (blame Aidan for those).
Focuses on issue #2 . Does not close it, as there are issues to be solved and design ideas that need to be addressed- see my TODO and other relevant comments within the commit.

Impact:
This PR will add basic Form implementation to the API, as well as generic InputData support for chaining together any conceivable sequence of inputs from any compatible source. It does not include a thorough InputModule, but again, @aidan99davis for that.

Copy link
Member

@mahtaran mahtaran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good overall, but have another look at the formatting, naming conventions, and code comments

README.md Outdated Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will need to be changed eventually when merging into Magus, but fine for now

build.gradle Outdated Show resolved Hide resolved
Comment on lines 74 to 75
LOGGER.info("HELLO FROM PRE INIT");
LOGGER.info("DIRT BLOCK >> {}", Blocks.DIRT.getName());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean up leftover log statements

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Easy fix

Comment on lines 79 to 115
private void doClientStuff(final FMLClientSetupEvent event) {
// do something that can only be done on the client
//todo call this anytime the key mappings are updated
}

private void enqueueIMC(final InterModEnqueueEvent event) {
// some example code to dispatch IMC to another mod
InterModComms.sendTo("magus", "helloworld", () -> {
LOGGER.info("Hello world from the MDK");
return "Hello world";
});
}

private void processIMC(final InterModProcessEvent event) {
// some example code to receive and process InterModComms from other mods
LOGGER.info("Got IMC {}",
event.getIMCStream().map(message -> message.messageSupplier().get()).collect(Collectors.toList())
);
}

// You can use SubscribeEvent and let the Event Bus discover methods to call
@SubscribeEvent
public void onServerStarting(FMLDedicatedServerSetupEvent event) {
// do something when the server starts
LOGGER.info("HELLO from server starting");
}

// You can use EventBusSubscriber to automatically subscribe events on the contained class (this is subscribing to the MOD
// Event bus for receiving Registry Events)
// @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
// public static class RegistryEvents {
// @SubscribeEvent
// public static void onBlocksRegistry(final RegistryEvent.Register<Block> blockRegistryEvent) {
// // register a new block here
// LOGGER.info("HELLO from Register Block");
// }
// }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah no worries

* @param inputs Generic list of InputData to turn into InputPermutations. Good for containing inputs of multiple things
* that happen simultaneously.
*/
public record InputPermutation(List<InputData> inputs) implements InputData {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Man I love records

public static final Form STEP = new Form("step");


//These two may not be necessary.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't add them for now then

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kk, they're mainly for testing; I'm not sure we should even be registering input groups for forms right now, we may want to leave that up to each individual mod author.

Comment on lines 3 to 11
/**
* Listeners store activators. Activators have a list of pre-requisites/events.
* Listeners search for those events and trigger all activators as needed.
* 1 listener per activator.
* Activators can have hard-coded pre-requisites or loaded ones from json files.
* Upon 'skill mode' being activated (whether through a toggle key or something else), all
* skill listeners are loaded. Listeners that are always active are the toggle listeners/initialise
* listeners.
**/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could use a lil' rewrite

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that's a bit old....


private int count;

public MultiModifierData() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Be sure to document that the default is 1

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ya, I'll get Aidan to help with his part of this

FavouriteDragon and others added 28 commits September 18, 2024 14:01
Also ensured no mutability issues for a hashmap would arise
builds, but setupListener() not fully implemented
now all InputModules are inserting into static formsTree field
fixed InputConverter.buildPathFrom()
OnPlayerLeaveWorld() method not working for client side
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants