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

Effects API #117

Open
wants to merge 21 commits into
base: develop
Choose a base branch
from

Conversation

paulevsGitch
Copy link
Contributor

An API for creating effects that works for all entities (including not-living ones like items and minecarts).

Effect can stay for specified amount of ticks or it can last infinity:

public TestPlayerInfEffect(Identifier id, PlayerEntity entity) {
    super(id, entity);
    ticks = INFINITY_TICKS;
}

Effects applied to the player will be visible in the top left corner:
image

In player inventory effects will display their name and description (compatible with HMI):
image

Effect names have support for minecraft color codes:
image

Effects have onStart, process, onEnd methods for large behaviour customisation, same as writeCustomData and readCustomData for storing custom values

To register effects you need to listen a specific event (common side):

@EventListener
public void registerEffects(EffectRegistryEvent event) {
	// Effect ID (Identifier), Effect class
	EffectRegistry.register(SLTest.NAMESPACE.id("test_effect"), TestPlayerEffect.class);
}

You can set affect on entity like this: player.addEffect(effectID); where effectID is Identifier.
There are also other helper functions that you can directly call from entity to operate with effects.
Effects works on both client and server.

PR is ready for review

Copy link
Member

@calmilamsy calmilamsy left a comment

Choose a reason for hiding this comment

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

At a cursory glance, this looks pretty good. Might want to get a few opinions on the GUI background though.

@mineLdiver
Copy link
Member

Change the base to 2.0-alpha.3 branch. Master is for minor updates only.

@paulevsGitch paulevsGitch changed the base branch from master to 2.0-alpha.3 June 19, 2024 15:32
@paulevsGitch
Copy link
Contributor Author

Done

@calmilamsy
Copy link
Member

Unfucked your branch for you.

@calmilamsy
Copy link
Member

calmilamsy commented Jun 21, 2024

No, don't merge your old changes. Reset to my changes.

@matthewperiut
Copy link
Contributor

Personally I think that the effect texture should match the modern effect texture, it sticks out too much looking so different from other minecraft gui stuff
effect_back_modern
^ this being the modern looking one that i made with a screenshot of modern mc effects and the texture file from this fork. I think this is the texture that should be used.

Additionally it would be nice if consistently the effect is consistent e.g.

+-----------------------------------+
|                     effect name   |
|  icon                             |
|            duration  (light grey) |
+-----------------------------------+

Similar to modern
image

@paulevsGitch
Copy link
Contributor Author

Personally I think that the effect texture should match the modern effect texture, it sticks out too much looking so different from other minecraft gui stuff

Current effect frame texture is very simple, but like any other texture it can be altered with texturepack. I'm not sure about official modern texture, current one looks fine

Additionally it would be nice if consistently the effect is consistent e.g.

There is an infinity effect in example above

@calmilamsy
Copy link
Member

I'd possibly say just use the achievement toast background directly for this. Saves adding a StAPI-specific texture.

@mineLdiver mineLdiver added this to the 2.0-alpha.3 milestone Jul 16, 2024
@mineLdiver mineLdiver added the enhancement New feature or request label Jul 16, 2024
@mineLdiver mineLdiver deleted the branch ModificationStation:develop November 30, 2024 16:31
@mineLdiver mineLdiver closed this Nov 30, 2024
@mineLdiver mineLdiver reopened this Nov 30, 2024
@mineLdiver mineLdiver changed the base branch from 2.0-alpha.3 to master November 30, 2024 16:42
@mineLdiver mineLdiver removed this from the 2.0-alpha.3 milestone Nov 30, 2024
@mineLdiver mineLdiver changed the base branch from master to develop December 1, 2024 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants