-
-
Notifications
You must be signed in to change notification settings - Fork 179
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
Move certain events to the newly introduced ServerPlayerEvent
#1153
Move certain events to the newly introduced ServerPlayerEvent
#1153
Conversation
|
src/main/java/net/neoforged/neoforge/event/entity/item/ItemTossEvent.java
Outdated
Show resolved
Hide resolved
src/main/java/net/neoforged/neoforge/event/entity/player/ServerPlayerEvent.java
Outdated
Show resolved
Hide resolved
src/main/java/net/neoforged/neoforge/event/entity/item/ItemTossEvent.java
Outdated
Show resolved
Hide resolved
This change doesn't really make sense. If we're going to make breaking changes to these events, they should be moved to their own individual files. There isn't any reason for |
I think having |
@Spinoscythe, this PR introduces breaking changes. Compatibility checks
|
I noticed a code format difference. In subclasses of public class ExampleEntityEvent extends LivingEvent {
private final ExampleEntity example;
public ExampleEntityEvent(ExampleEntity example) {
super(example);
this.example = example;
}
@Override
public ExampleEntity getEntity() {return example;}
} This implementation in contrast just casts the super invocation. Whether this or the other classes change, I think we should be consistent. |
When you can, please implement Caltinor's suggestion. It would remove the need for the casting in the server player events |
I think this c7cf777 is the opposite of what @TelepathicGrunt wanted. They wanted to remove the casts, from how I read it. |
This reverts commit c7cf777.
Yeah. Less casting. Not more |
Per a conversation in the NF discord: Introducing a generic to EntityEvent allows us to streamline more than just the server player events: Based on that, this PR is not something we want to proceed with at this time, and the refactor triggered by switching to |
Some modders in the community noticed that some
PlayerEvent
events, likePlayerEvent.PlayerLoggedInEvent
, only ever pass in a ServerPlayer instance. However, sincePlayerEvent
is aPlayer
type, you have to cast the player back toServerPlayer
.It would be worth switching to a
<? extends Player>
generic type for player events, but we don't support generic events anymore. So this seems the most ideal.Some modders = @LeScooter. ty for the idea :)
Also @Technici4n approves this idea.