1
0
mirror of https://github.com/GeyserMC/Geyser.git synced 2025-12-27 02:39:15 +00:00

API polishing; properly initialize height/width

This commit is contained in:
onebeastchris
2025-11-30 15:28:47 +01:00
parent a64865024a
commit a497d3d84c
17 changed files with 89 additions and 68 deletions

View File

@@ -180,9 +180,7 @@ public interface GeyserConnection extends Connection, CommandSource {
*
* @param emoter the player entity emoting.
* @param emoteId the emote ID to send to this client.
* @deprecated use {@link EntityData#showEmote(GeyserPlayerEntity, String)} instead
*/
@Deprecated
void showEmote(@NonNull GeyserPlayerEntity emoter, @NonNull String emoteId);
/**
@@ -250,5 +248,5 @@ public interface GeyserConnection extends Connection, CommandSource {
* Sends a request to the Java server to switch the items in the main and offhand.
* There is no guarantee of the server accepting the request.
*/
void requestHandSwap();
void switchHands();
}

View File

@@ -71,6 +71,7 @@ public interface EntityData {
* @param emoter the player entity emoting
* @param emoteId the emote ID to send to this client
*/
@Deprecated
void showEmote(@NonNull GeyserPlayerEntity emoter, @NonNull String emoteId);
/**
@@ -98,7 +99,7 @@ public interface EntityData {
boolean isMovementLocked();
/**
* @deprecated use {@link GeyserConnection#requestHandSwap()}
* @deprecated use {@link GeyserConnection#switchHands()}
*/
@Deprecated
void switchHands();

View File

@@ -84,6 +84,6 @@ public interface CustomJavaEntityType extends JavaEntityType {
* @param defaultBedrockDefinition the default Bedrock definition
* @return this builder
*/
Builder defaultBedrockDefinition(@Nullable GeyserEntityDefinition defaultBedrockDefinition);
Builder definition(@Nullable GeyserEntityDefinition defaultBedrockDefinition);
}
}

View File

@@ -112,12 +112,9 @@ public interface GeyserEntity {
}
/**
* Updates multiple properties with just one update packet.
*
* @param consumer a batch updater
* @see BatchPropertyUpdater
* @since 2.9.0
* @deprecated - use {@link #updateProperty(GeyserEntityProperty, Object)} instead
*/
@Deprecated
default void updatePropertiesBatched(Consumer<BatchPropertyUpdater> consumer) {
this.updatePropertiesBatched(consumer, false);
}

View File

@@ -27,6 +27,7 @@ package org.geysermc.geyser.api.event.lifecycle;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.geysermc.event.Event;
import org.geysermc.geyser.api.entity.custom.CustomEntityDefinition;
import org.geysermc.geyser.api.entity.custom.CustomJavaEntityType;
import org.geysermc.geyser.api.entity.definition.GeyserEntityDefinition;
@@ -37,8 +38,6 @@ import java.util.function.Consumer;
* Called when entities are defined within Geyser.
* <p>
* This event can be used to add custom entities to Geyser.
* Entity definitions can be created using the builder provided
* inside of {@link GeyserEntityDefinition}.
*/
public interface GeyserDefineEntitiesEvent extends Event {
@@ -47,11 +46,16 @@ public interface GeyserDefineEntitiesEvent extends Event {
*/
Collection<GeyserEntityDefinition> entities();
/**
* @return an immutable collection of all registered custom entity definitions
*/
Collection<CustomEntityDefinition> customEntities();
/**
* Registers a custom entity definition
* @param definition the custom entity definition to register
*/
void register(@NonNull GeyserEntityDefinition definition);
void register(@NonNull CustomEntityDefinition definition);
/**
* Registers a non-vanilla Java entity type.

View File

@@ -41,7 +41,6 @@ import org.geysermc.geyser.api.util.Identifier;
import java.util.Collection;
import java.util.List;
import java.util.function.Consumer;
/**
* Lifecycle event fired during Geyser's startup to allow custom entity properties
@@ -63,10 +62,9 @@ import java.util.function.Consumer;
* }
* }</pre>
*
* Retrieving entity instances is possible with the {@link EntityData#entityByJavaId(int)} method, or
* Retrieving entity instances is possible with, for example, the {@link EntityData#byJavaId(int)} method, or
* {@link GeyserConnection#playerEntity()} for the connection player entity.
* To update the value of a property on a specific entity, use {@link GeyserEntity#updateProperty(GeyserEntityProperty, Object)},
* or {@link GeyserEntity#updatePropertiesBatched(Consumer)} to update multiple properties efficiently at once.
* To update the value of a property on a specific entity, use {@link GeyserEntity#updateProperty(GeyserEntityProperty, Object)}.
*
* <p><b>Notes:</b>
* <ul>