Usage - GiantLuigi4/Minecraft_Effekseer_Implementation GitHub Wiki
Gradle
Fabric
repositories {
...
maven { url "https://www.cursemaven.com" }
...
}
dependencies {
...
modImplementation 'curse.maven:mei-479584:3301016'
...
}
Forge
repositories {
...
maven { url "https://www.cursemaven.com" }
...
}
dependencies {
...
implementation fg.deobf('curse.maven:mei-479584:3301016')
...
}
API
Client
Client side, the usage is exactly the same on both loaders:
Effek effek = Effeks.get("mc_effekseer_impl:example");
if (effek != null) {
EffekEmitter emitter = effek.getOrCreate("test:test");
emitter.setPosition(0, 10, 0);
}
This would create an emitter of the example effect which comes packaged in the assets of Minecraft Effekseer Implementation at 0, 10, 0 in the world
Yep, it's that easy
Server
On server however, it varies depending on mod loader, and you'll likely want a packet to tell the server to respawn the particles when the resource manager reloads via making a check for if the Effek is null, storing it to a field, then waiting until the Effek is no longer null, then sending a packet
Anyway, to send a Effek spawn packet, all you need to do is this:
Networking.sendStartEffekPacket(
(player)->true, world,
new ResourceLocation("mc_effekseer_impl:example"),
new ResourceLocation("test:test"),
0, new Vector3d(0, 10, 0)
);
This will produce the same results as the client code above, but it'll spawned from a packet sent from the server instead of the client
For fabric users, call NetworkingFabric
instead of Networking
If you want to move an existing effect, just rerun the code with the same emitter name and it'll move it
If you want to delete an emitter, call Effek$delete if it's an effect which only plays once, or Effek$markFree if it can be reused
Finally, if you want to delete an emitter from the server,
Networking.sendEndEffekPacket(
PacketDistributor.DIMENSION.with(()->world.getDimensionKey()),
new ResourceLocation("mc_effekseer_impl:example"),
new ResourceLocation("test:test"), true
);
This is for forge, and currently there is a method in fabric which is not present in forge
NetworkingFabric.sendEndEffekPacket(
world,
new Identifier("mc_effekseer_impl:example"),
new Identifier("test:test"), true
);