3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-10-03 08:21:06 +02:00

Merge branch 'master' of https://github.com/GeyserMC/Geyser into biome-redefinition-1.18

Dieser Commit ist enthalten in:
Camotoy 2021-12-26 19:50:46 -05:00
Commit 830baf06ca
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 7EEFB66FE798081F
157 geänderte Dateien mit 641 neuen und 698 gelöschten Zeilen

Datei anzeigen

@ -29,6 +29,7 @@ import lombok.AllArgsConstructor;
import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.ServerPing; import net.md_5.bungee.api.ServerPing;
import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.config.ListenerInfo; import net.md_5.bungee.api.config.ListenerInfo;
import net.md_5.bungee.api.connection.PendingConnection; import net.md_5.bungee.api.connection.PendingConnection;
import net.md_5.bungee.api.event.ProxyPingEvent; import net.md_5.bungee.api.event.ProxyPingEvent;
@ -52,8 +53,11 @@ public class GeyserBungeePingPassthrough implements IGeyserPingPassthrough, List
public GeyserPingInfo getPingInformation(InetSocketAddress inetSocketAddress) { public GeyserPingInfo getPingInformation(InetSocketAddress inetSocketAddress) {
CompletableFuture<ProxyPingEvent> future = new CompletableFuture<>(); CompletableFuture<ProxyPingEvent> future = new CompletableFuture<>();
proxyServer.getPluginManager().callEvent(new ProxyPingEvent(new GeyserPendingConnection(inetSocketAddress), getPingInfo(), (event, throwable) -> { proxyServer.getPluginManager().callEvent(new ProxyPingEvent(new GeyserPendingConnection(inetSocketAddress), getPingInfo(), (event, throwable) -> {
if (throwable != null) future.completeExceptionally(throwable); if (throwable != null) {
else future.complete(event); future.completeExceptionally(throwable);
} else {
future.complete(event);
}
})); }));
ProxyPingEvent event = future.join(); ProxyPingEvent event = future.join();
ServerPing response = event.getResponse(); ServerPing response = event.getResponse();
@ -76,9 +80,12 @@ public class GeyserBungeePingPassthrough implements IGeyserPingPassthrough, List
private ServerPing getPingInfo() { private ServerPing getPingInfo() {
return new ServerPing( return new ServerPing(
new ServerPing.Protocol(proxyServer.getName() + " " + proxyServer.getGameVersion(), ProtocolConstants.SUPPORTED_VERSION_IDS.get(ProtocolConstants.SUPPORTED_VERSION_IDS.size() - 1)), new ServerPing.Protocol(
proxyServer.getName() + " " + ProtocolConstants.SUPPORTED_VERSIONS.get(0) + "-" + ProtocolConstants.SUPPORTED_VERSIONS.get(ProtocolConstants.SUPPORTED_VERSIONS.size() - 1),
ProtocolConstants.SUPPORTED_VERSION_IDS.get(ProtocolConstants.SUPPORTED_VERSION_IDS.size() - 1)),
new ServerPing.Players(getDefaultListener().getMaxPlayers(), proxyServer.getOnlineCount(), null), new ServerPing.Players(getDefaultListener().getMaxPlayers(), proxyServer.getOnlineCount(), null),
getDefaultListener().getMotd(), proxyServer.getConfig().getFaviconObject() TextComponent.fromLegacyText(getDefaultListener().getMotd())[0],
proxyServer.getConfig().getFaviconObject()
); );
} }

Datei anzeigen

@ -57,8 +57,8 @@ public class GeyserSpigotPingPassthrough implements IGeyserPingPassthrough {
Bukkit.getOnlinePlayers().stream().map(Player::getName).forEach(geyserPingInfo.getPlayerList()::add); Bukkit.getOnlinePlayers().stream().map(Player::getName).forEach(geyserPingInfo.getPlayerList()::add);
return geyserPingInfo; return geyserPingInfo;
} catch (Exception e) { } catch (Exception e) {
logger.debug("Error while getting Bukkit ping passthrough: " + e.toString()); logger.debug("Error while getting Bukkit ping passthrough: " + e);
return new GeyserPingInfo(null, null, null); return null;
} }
} }
@ -79,5 +79,4 @@ public class GeyserSpigotPingPassthrough implements IGeyserPingPassthrough {
return Collections.emptyIterator(); return Collections.emptyIterator();
} }
} }
} }

Datei anzeigen

@ -11,7 +11,7 @@
<artifactId>bootstrap-standalone</artifactId> <artifactId>bootstrap-standalone</artifactId>
<properties> <properties>
<log4j.version>2.16.0</log4j.version> <log4j.version>2.17.0</log4j.version>
</properties> </properties>
<dependencies> <dependencies>

Datei anzeigen

@ -83,7 +83,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.nukkitx.fastutil</groupId> <groupId>com.nukkitx.fastutil</groupId>
<artifactId>fastutil-long-long-maps</artifactId> <artifactId>fastutil-int-long-maps</artifactId>
<version>${fastutil.version}</version> <version>${fastutil.version}</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
@ -155,7 +155,7 @@
<dependency> <dependency>
<groupId>com.github.GeyserMC</groupId> <groupId>com.github.GeyserMC</groupId>
<artifactId>MCProtocolLib</artifactId> <artifactId>MCProtocolLib</artifactId>
<version>c247b1f</version> <version>6a23a780</version>
<scope>compile</scope> <scope>compile</scope>
<exclusions> <exclusions>
<exclusion> <exclusion>

Datei anzeigen

@ -32,7 +32,6 @@ import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import lombok.Setter; import lombok.Setter;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.entity.factory.BaseEntityFactory;
import org.geysermc.geyser.entity.factory.EntityFactory; import org.geysermc.geyser.entity.factory.EntityFactory;
import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.Entity;
import org.geysermc.geyser.registry.Registries; import org.geysermc.geyser.registry.Registries;
@ -52,10 +51,6 @@ import java.util.function.BiConsumer;
public record EntityDefinition<T extends Entity>(EntityFactory<T> factory, EntityType entityType, String identifier, public record EntityDefinition<T extends Entity>(EntityFactory<T> factory, EntityType entityType, String identifier,
float width, float height, float offset, List<EntityMetadataTranslator<? super T, ?, ?>> translators) { float width, float height, float offset, List<EntityMetadataTranslator<? super T, ?, ?>> translators) {
public static <T extends Entity> Builder<T> inherited(BaseEntityFactory<T> factory, EntityDefinition<? super T> parent) {
return inherited((EntityFactory<T>) factory, parent);
}
public static <T extends Entity> Builder<T> inherited(EntityFactory<T> factory, EntityDefinition<? super T> parent) { public static <T extends Entity> Builder<T> inherited(EntityFactory<T> factory, EntityDefinition<? super T> parent) {
return new Builder<>(factory, parent.entityType, parent.identifier, parent.width, parent.height, parent.offset, new ObjectArrayList<>(parent.translators)); return new Builder<>(factory, parent.entityType, parent.identifier, parent.width, parent.height, parent.offset, new ObjectArrayList<>(parent.translators));
} }
@ -64,7 +59,6 @@ public record EntityDefinition<T extends Entity>(EntityFactory<T> factory, Entit
return new Builder<>(factory); return new Builder<>(factory);
} }
public <M> void translateMetadata(T entity, EntityMetadata<M, ? extends MetadataType<M>> metadata) { public <M> void translateMetadata(T entity, EntityMetadata<M, ? extends MetadataType<M>> metadata) {
EntityMetadataTranslator<? super T, M, EntityMetadata<M, ? extends MetadataType<M>>> translator = (EntityMetadataTranslator<? super T, M, EntityMetadata<M, ? extends MetadataType<M>>>) this.translators.get(metadata.getId()); EntityMetadataTranslator<? super T, M, EntityMetadata<M, ? extends MetadataType<M>>> translator = (EntityMetadataTranslator<? super T, M, EntityMetadata<M, ? extends MetadataType<M>>>) this.translators.get(metadata.getId());
if (translator == null) { if (translator == null) {

Datei anzeigen

@ -31,9 +31,6 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.FloatEnt
import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.geyser.entity.factory.BaseEntityFactory;
import org.geysermc.geyser.entity.factory.ExperienceOrbEntityFactory;
import org.geysermc.geyser.entity.factory.PaintingEntityFactory;
import org.geysermc.geyser.entity.type.*; import org.geysermc.geyser.entity.type.*;
import org.geysermc.geyser.entity.type.living.*; import org.geysermc.geyser.entity.type.living.*;
import org.geysermc.geyser.entity.type.living.animal.*; import org.geysermc.geyser.entity.type.living.animal.*;
@ -50,8 +47,8 @@ import org.geysermc.geyser.entity.type.living.monster.raid.RaidParticipantEntity
import org.geysermc.geyser.entity.type.living.monster.raid.SpellcasterIllagerEntity; import org.geysermc.geyser.entity.type.living.monster.raid.SpellcasterIllagerEntity;
import org.geysermc.geyser.entity.type.living.monster.raid.VindicatorEntity; import org.geysermc.geyser.entity.type.living.monster.raid.VindicatorEntity;
import org.geysermc.geyser.entity.type.player.PlayerEntity; import org.geysermc.geyser.entity.type.player.PlayerEntity;
import org.geysermc.geyser.translator.text.MessageTranslator;
import org.geysermc.geyser.registry.Registries; import org.geysermc.geyser.registry.Registries;
import org.geysermc.geyser.translator.text.MessageTranslator;
public final class EntityDefinitions { public final class EntityDefinitions {
public static final EntityDefinition<AreaEffectCloudEntity> AREA_EFFECT_CLOUD; public static final EntityDefinition<AreaEffectCloudEntity> AREA_EFFECT_CLOUD;
@ -82,7 +79,7 @@ public final class EntityDefinitions {
public static final EntityDefinition<ThrowableItemEntity> ENDER_PEARL; public static final EntityDefinition<ThrowableItemEntity> ENDER_PEARL;
public static final EntityDefinition<EnderCrystalEntity> END_CRYSTAL; public static final EntityDefinition<EnderCrystalEntity> END_CRYSTAL;
public static final EntityDefinition<SpellcasterIllagerEntity> EVOKER; public static final EntityDefinition<SpellcasterIllagerEntity> EVOKER;
public static final EntityDefinition<Entity> EVOKER_FANGS; public static final EntityDefinition<EvokerFangsEntity> EVOKER_FANGS;
public static final EntityDefinition<ThrowableItemEntity> EXPERIENCE_BOTTLE; public static final EntityDefinition<ThrowableItemEntity> EXPERIENCE_BOTTLE;
public static final EntityDefinition<ExpOrbEntity> EXPERIENCE_ORB; public static final EntityDefinition<ExpOrbEntity> EXPERIENCE_ORB;
public static final EntityDefinition<Entity> EYE_OF_ENDER; public static final EntityDefinition<Entity> EYE_OF_ENDER;
@ -177,14 +174,14 @@ public final class EntityDefinitions {
public static final EntityDefinition<WitherSkullEntity> WITHER_SKULL_DANGEROUS; public static final EntityDefinition<WitherSkullEntity> WITHER_SKULL_DANGEROUS;
static { static {
EntityDefinition<Entity> entityBase = EntityDefinition.builder((BaseEntityFactory<Entity>) Entity::new) EntityDefinition<Entity> entityBase = EntityDefinition.builder(Entity::new)
.addTranslator(MetadataType.BYTE, Entity::setFlags) .addTranslator(MetadataType.BYTE, Entity::setFlags)
.addTranslator(MetadataType.INT, Entity::setAir) // Air/bubbles .addTranslator(MetadataType.INT, Entity::setAir) // Air/bubbles
.addTranslator(MetadataType.OPTIONAL_CHAT, Entity::setDisplayName) .addTranslator(MetadataType.OPTIONAL_CHAT, Entity::setDisplayName)
.addTranslator(MetadataType.BOOLEAN, Entity::setDisplayNameVisible) .addTranslator(MetadataType.BOOLEAN, Entity::setDisplayNameVisible)
.addTranslator(MetadataType.BOOLEAN, (entity, entityMetadata) -> entity.setFlag(EntityFlag.SILENT, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue())) .addTranslator(MetadataType.BOOLEAN, (entity, entityMetadata) -> entity.setFlag(EntityFlag.SILENT, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue()))
.addTranslator(MetadataType.BOOLEAN, Entity::setGravity) .addTranslator(MetadataType.BOOLEAN, Entity::setGravity)
.addTranslator(MetadataType.POSE, Entity::setPose) .addTranslator(MetadataType.POSE, (entity, entityMetadata) -> entity.setPose(entityMetadata.getValue()))
.addTranslator(MetadataType.INT, Entity::setFreezing) .addTranslator(MetadataType.INT, Entity::setFreezing)
.build(); .build();
@ -224,11 +221,11 @@ public final class EntityDefinitions {
.addTranslator(MetadataType.BOOLEAN, .addTranslator(MetadataType.BOOLEAN,
(enderCrystalEntity, entityMetadata) -> enderCrystalEntity.setFlag(EntityFlag.SHOW_BOTTOM, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue())) // There is a base located on the ender crystal (enderCrystalEntity, entityMetadata) -> enderCrystalEntity.setFlag(EntityFlag.SHOW_BOTTOM, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue())) // There is a base located on the ender crystal
.build(); .build();
EXPERIENCE_ORB = EntityDefinition.inherited((ExperienceOrbEntityFactory) ExpOrbEntity::new, entityBase) EXPERIENCE_ORB = EntityDefinition.<ExpOrbEntity>inherited(null, entityBase)
.type(EntityType.EXPERIENCE_ORB) .type(EntityType.EXPERIENCE_ORB)
.identifier("minecraft:xp_orb") .identifier("minecraft:xp_orb")
.build(); .build();
EVOKER_FANGS = EntityDefinition.inherited(entityBase.factory(), entityBase) EVOKER_FANGS = EntityDefinition.builder(EvokerFangsEntity::new) // No entity metadata to listen to as of 1.18.1
.type(EntityType.EVOKER_FANGS) .type(EntityType.EVOKER_FANGS)
.height(0.8f).width(0.5f) .height(0.8f).width(0.5f)
.identifier("minecraft:evocation_fang") .identifier("minecraft:evocation_fang")
@ -275,7 +272,7 @@ public final class EntityDefinitions {
.type(EntityType.LLAMA_SPIT) .type(EntityType.LLAMA_SPIT)
.heightAndWidth(0.25f) .heightAndWidth(0.25f)
.build(); .build();
PAINTING = EntityDefinition.inherited((PaintingEntityFactory) PaintingEntity::new, entityBase) PAINTING = EntityDefinition.<PaintingEntity>inherited(null, entityBase)
.type(EntityType.PAINTING) .type(EntityType.PAINTING)
.build(); .build();
SHULKER_BULLET = EntityDefinition.inherited(ThrowableEntity::new, entityBase) SHULKER_BULLET = EntityDefinition.inherited(ThrowableEntity::new, entityBase)

Datei anzeigen

@ -1,39 +0,0 @@
/*
* Copyright (c) 2019-2021 GeyserMC. http://geysermc.org
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* @author GeyserMC
* @link https://github.com/GeyserMC/Geyser
*/
package org.geysermc.geyser.entity.factory;
import com.nukkitx.math.vector.Vector3f;
import org.geysermc.geyser.entity.type.Entity;
import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.session.GeyserSession;
import java.util.UUID;
@FunctionalInterface
public interface BaseEntityFactory<T extends Entity> extends EntityFactory<T> {
T create(GeyserSession session, long javaId, long bedrockId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw);
}

Datei anzeigen

@ -25,7 +25,17 @@
package org.geysermc.geyser.entity.factory; package org.geysermc.geyser.entity.factory;
import com.nukkitx.math.vector.Vector3f;
import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.Entity;
import org.geysermc.geyser.session.GeyserSession;
import java.util.UUID;
/**
* Represents a constructor to create an entity.
*/
public interface EntityFactory<T extends Entity> { public interface EntityFactory<T extends Entity> {
T create(GeyserSession session, int javaId, long bedrockId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw);
} }

Datei anzeigen

@ -1,36 +0,0 @@
/*
* Copyright (c) 2019-2021 GeyserMC. http://geysermc.org
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* @author GeyserMC
* @link https://github.com/GeyserMC/Geyser
*/
package org.geysermc.geyser.entity.factory;
import com.nukkitx.math.vector.Vector3f;
import org.geysermc.geyser.entity.type.ExpOrbEntity;
import org.geysermc.geyser.session.GeyserSession;
@FunctionalInterface
public interface ExperienceOrbEntityFactory extends EntityFactory<ExpOrbEntity> {
ExpOrbEntity create(GeyserSession session, int amount, long entityId, long geyserId, Vector3f position);
}

Datei anzeigen

@ -1,38 +0,0 @@
/*
* Copyright (c) 2019-2021 GeyserMC. http://geysermc.org
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* @author GeyserMC
* @link https://github.com/GeyserMC/Geyser
*/
package org.geysermc.geyser.entity.factory;
import com.nukkitx.math.vector.Vector3f;
import org.geysermc.geyser.entity.type.PaintingEntity;
import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.level.PaintingType;
import java.util.UUID;
public interface PaintingEntityFactory extends EntityFactory<PaintingEntity> {
PaintingEntity create(GeyserSession session, long entityId, long geyserId, UUID uuid, Vector3f position, PaintingType paintingName, int direction);
}

Datei anzeigen

@ -36,7 +36,7 @@ import java.util.UUID;
public class AbstractArrowEntity extends Entity { public class AbstractArrowEntity extends Entity {
public AbstractArrowEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public AbstractArrowEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
// Set the correct texture if using the resource pack // Set the correct texture if using the resource pack

Datei anzeigen

@ -39,7 +39,7 @@ import java.util.UUID;
public class AreaEffectCloudEntity extends Entity { public class AreaEffectCloudEntity extends Entity {
public AreaEffectCloudEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public AreaEffectCloudEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }
@ -47,18 +47,19 @@ public class AreaEffectCloudEntity extends Entity {
protected void initializeMetadata() { protected void initializeMetadata() {
super.initializeMetadata(); super.initializeMetadata();
// Without this the cloud doesn't appear, // Without this the cloud doesn't appear,
dirtyMetadata.put(EntityData.AREA_EFFECT_CLOUD_DURATION, 600); dirtyMetadata.put(EntityData.AREA_EFFECT_CLOUD_DURATION, Integer.MAX_VALUE);
// This disabled client side shrink of the cloud // This disabled client side shrink of the cloud
dirtyMetadata.put(EntityData.AREA_EFFECT_CLOUD_RADIUS, 0.0f); dirtyMetadata.put(EntityData.AREA_EFFECT_CLOUD_RADIUS, 0.0f);
dirtyMetadata.put(EntityData.AREA_EFFECT_CLOUD_CHANGE_RATE, -0.005f); dirtyMetadata.put(EntityData.AREA_EFFECT_CLOUD_CHANGE_RATE, Float.MIN_VALUE);
dirtyMetadata.put(EntityData.AREA_EFFECT_CLOUD_CHANGE_ON_PICKUP, -0.5f); dirtyMetadata.put(EntityData.AREA_EFFECT_CLOUD_CHANGE_ON_PICKUP, Float.MIN_VALUE);
setFlag(EntityFlag.FIRE_IMMUNE, true); setFlag(EntityFlag.FIRE_IMMUNE, true);
} }
public void setRadius(FloatEntityMetadata entityMetadata) { public void setRadius(FloatEntityMetadata entityMetadata) {
float value = entityMetadata.getPrimitiveValue(); // Anything less than 0.5 will cause the cloud to despawn
float value = Math.max(entityMetadata.getPrimitiveValue(), 0.5f);
dirtyMetadata.put(EntityData.AREA_EFFECT_CLOUD_RADIUS, value); dirtyMetadata.put(EntityData.AREA_EFFECT_CLOUD_RADIUS, value);
dirtyMetadata.put(EntityData.BOUNDING_BOX_WIDTH, 2.0f * value); dirtyMetadata.put(EntityData.BOUNDING_BOX_WIDTH, 2.0f * value);
} }

Datei anzeigen

@ -65,7 +65,7 @@ public class BoatEntity extends Entity {
// Looks too fast and too choppy with 0.1f, which is how I believe the Microsoftian client handles it // Looks too fast and too choppy with 0.1f, which is how I believe the Microsoftian client handles it
private final float ROWING_SPEED = 0.05f; private final float ROWING_SPEED = 0.05f;
public BoatEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public BoatEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
// Initial rotation is incorrect // Initial rotation is incorrect
super(session, entityId, geyserId, uuid, definition, position.add(0d, definition.offset(), 0d), motion, yaw + 90, 0, yaw + 90); super(session, entityId, geyserId, uuid, definition, position.add(0d, definition.offset(), 0d), motion, yaw + 90, 0, yaw + 90);
@ -84,8 +84,12 @@ public class BoatEntity extends Entity {
MoveEntityAbsolutePacket moveEntityPacket = new MoveEntityAbsolutePacket(); MoveEntityAbsolutePacket moveEntityPacket = new MoveEntityAbsolutePacket();
moveEntityPacket.setRuntimeEntityId(geyserId); moveEntityPacket.setRuntimeEntityId(geyserId);
// Minimal glitching when ClientboundMoveVehiclePacket is sent if (session.getPlayerEntity().getVehicle() == this && session.getPlayerEntity().isRidingInFront()) {
moveEntityPacket.setPosition(session.getRidingVehicleEntity() == this ? position.up(EntityDefinitions.PLAYER.offset() - this.definition.offset()) : this.position); // Minimal glitching when ClientboundMoveVehiclePacket is sent
moveEntityPacket.setPosition(position.up(EntityDefinitions.PLAYER.offset() - this.definition.offset()));
} else {
moveEntityPacket.setPosition(this.position);
}
moveEntityPacket.setRotation(getBedrockRotation()); moveEntityPacket.setRotation(getBedrockRotation());
moveEntityPacket.setOnGround(isOnGround); moveEntityPacket.setOnGround(isOnGround);
moveEntityPacket.setTeleported(teleported); moveEntityPacket.setTeleported(teleported);
@ -128,7 +132,7 @@ public class BoatEntity extends Entity {
paddleTimeLeft = 0f; paddleTimeLeft = 0f;
if (!this.passengers.isEmpty()) { if (!this.passengers.isEmpty()) {
// Get the entity by the first stored passenger and convey motion in this manner // Get the entity by the first stored passenger and convey motion in this manner
Entity entity = session.getEntityCache().getEntityByJavaId(this.passengers.iterator().nextLong()); Entity entity = this.passengers.get(0);
if (entity != null) { if (entity != null) {
updateLeftPaddle(session, entity); updateLeftPaddle(session, entity);
} }
@ -144,7 +148,7 @@ public class BoatEntity extends Entity {
if (isPaddlingRight) { if (isPaddlingRight) {
paddleTimeRight = 0f; paddleTimeRight = 0f;
if (!this.passengers.isEmpty()) { if (!this.passengers.isEmpty()) {
Entity entity = session.getEntityCache().getEntityByJavaId(this.passengers.iterator().nextLong()); Entity entity = this.passengers.get(0);
if (entity != null) { if (entity != null) {
updateRightPaddle(session, entity); updateRightPaddle(session, entity);
} }

Datei anzeigen

@ -34,7 +34,7 @@ import java.util.UUID;
public class CommandBlockMinecartEntity extends DefaultBlockMinecartEntity { public class CommandBlockMinecartEntity extends DefaultBlockMinecartEntity {
public CommandBlockMinecartEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public CommandBlockMinecartEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -43,7 +43,7 @@ public class DefaultBlockMinecartEntity extends MinecartEntity {
public int customBlockOffset = 0; public int customBlockOffset = 0;
public boolean showCustomBlock = false; public boolean showCustomBlock = false;
public DefaultBlockMinecartEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public DefaultBlockMinecartEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
dirtyMetadata.put(EntityData.CUSTOM_DISPLAY, (byte) 1); dirtyMetadata.put(EntityData.CUSTOM_DISPLAY, (byte) 1);

Datei anzeigen

@ -39,7 +39,7 @@ import java.util.UUID;
public class EnderCrystalEntity extends Entity { public class EnderCrystalEntity extends Entity {
public EnderCrystalEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public EnderCrystalEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -39,7 +39,6 @@ import com.nukkitx.protocol.bedrock.packet.AddEntityPacket;
import com.nukkitx.protocol.bedrock.packet.MoveEntityAbsolutePacket; import com.nukkitx.protocol.bedrock.packet.MoveEntityAbsolutePacket;
import com.nukkitx.protocol.bedrock.packet.RemoveEntityPacket; import com.nukkitx.protocol.bedrock.packet.RemoveEntityPacket;
import com.nukkitx.protocol.bedrock.packet.SetEntityDataPacket; import com.nukkitx.protocol.bedrock.packet.SetEntityDataPacket;
import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@ -48,8 +47,11 @@ import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.entity.GeyserDirtyMetadata; import org.geysermc.geyser.entity.GeyserDirtyMetadata;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.translator.text.MessageTranslator; import org.geysermc.geyser.translator.text.MessageTranslator;
import org.geysermc.geyser.util.EntityUtils;
import org.geysermc.geyser.util.MathUtils; import org.geysermc.geyser.util.MathUtils;
import java.util.Collections;
import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.UUID; import java.util.UUID;
@ -58,7 +60,7 @@ import java.util.UUID;
public class Entity { public class Entity {
protected final GeyserSession session; protected final GeyserSession session;
protected long entityId; protected int entityId;
protected final long geyserId; protected final long geyserId;
protected UUID uuid; protected UUID uuid;
@ -79,6 +81,9 @@ public class Entity {
protected EntityDefinition<?> definition; protected EntityDefinition<?> definition;
/**
* Indicates if the entity has been initialized and spawned
*/
protected boolean valid; protected boolean valid;
/* Metadata about this specific entity */ /* Metadata about this specific entity */
@ -90,7 +95,8 @@ public class Entity {
protected String nametag = ""; protected String nametag = "";
/* Metadata end */ /* Metadata end */
protected LongOpenHashSet passengers = new LongOpenHashSet(); protected List<Entity> passengers = Collections.emptyList();
protected Entity vehicle;
/** /**
* A container to store temporary metadata before it's sent to Bedrock. * A container to store temporary metadata before it's sent to Bedrock.
*/ */
@ -109,7 +115,7 @@ public class Entity {
@Setter(AccessLevel.PROTECTED) // For players @Setter(AccessLevel.PROTECTED) // For players
private boolean flagsDirty = false; private boolean flagsDirty = false;
public Entity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public Entity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
this.session = session; this.session = session;
this.entityId = entityId; this.entityId = entityId;
@ -181,11 +187,11 @@ public class Entity {
public boolean despawnEntity() { public boolean despawnEntity() {
if (!valid) return true; if (!valid) return true;
for (long passenger : passengers) { // Make sure all passengers on the despawned entity are updated for (Entity passenger : passengers) { // Make sure all passengers on the despawned entity are updated
Entity entity = session.getEntityCache().getEntityByJavaId(passenger); if (passenger == null) continue;
if (entity == null) continue; passenger.setVehicle(null);
entity.setFlag(EntityFlag.RIDING, false); passenger.setFlag(EntityFlag.RIDING, false);
entity.updateBedrockMetadata(); passenger.updateBedrockMetadata();
} }
RemoveEntityPacket removeEntityPacket = new RemoveEntityPacket(); RemoveEntityPacket removeEntityPacket = new RemoveEntityPacket();
@ -369,9 +375,7 @@ public class Entity {
/** /**
* Usually used for bounding box and not animation. * Usually used for bounding box and not animation.
*/ */
public void setPose(EntityMetadata<Pose, ?> entityMetadata) { public void setPose(Pose pose) {
Pose pose = entityMetadata.getValue();
setFlag(EntityFlag.SLEEPING, pose.equals(Pose.SLEEPING)); setFlag(EntityFlag.SLEEPING, pose.equals(Pose.SLEEPING));
// Triggered when crawling // Triggered when crawling
setFlag(EntityFlag.SWIMMING, pose.equals(Pose.SWIMMING)); setFlag(EntityFlag.SWIMMING, pose.equals(Pose.SWIMMING));
@ -387,11 +391,15 @@ public class Entity {
setBoundingBoxWidth(definition.width()); setBoundingBoxWidth(definition.width());
} }
public void setBoundingBoxHeight(float height) { public boolean setBoundingBoxHeight(float height) {
if (height != boundingBoxHeight) { if (height != boundingBoxHeight) {
boundingBoxHeight = height; boundingBoxHeight = height;
dirtyMetadata.put(EntityData.BOUNDING_BOX_HEIGHT, boundingBoxHeight); dirtyMetadata.put(EntityData.BOUNDING_BOX_HEIGHT, boundingBoxHeight);
updatePassengerOffsets();
return true;
} }
return false;
} }
public void setBoundingBoxWidth(float width) { public void setBoundingBoxWidth(float width) {
@ -435,6 +443,30 @@ public class Entity {
return Vector3f.from(pitch, headYaw, yaw); return Vector3f.from(pitch, headYaw, yaw);
} }
/**
* Update the mount offsets of each passenger on this vehicle
*/
protected void updatePassengerOffsets() {
for (Entity passenger : passengers) {
if (passenger != null) {
boolean rider = passengers.get(0) == this;
EntityUtils.updateMountOffset(passenger, this, rider, true, passengers.size() > 1);
passenger.updateBedrockMetadata();
}
}
}
/**
* Update this entity's mount offset
*/
protected void updateMountOffset() {
if (vehicle != null) {
boolean rider = vehicle.getPassengers().get(0) == this;
EntityUtils.updateMountOffset(this, vehicle, rider, true, vehicle.getPassengers().size() > 1);
updateBedrockMetadata();
}
}
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public <I extends Entity> I as(Class<I> entityClass) { public <I extends Entity> I as(Class<I> entityClass) {
return entityClass.isInstance(this) ? (I) this : null; return entityClass.isInstance(this) ? (I) this : null;

Datei anzeigen

@ -0,0 +1,71 @@
/*
* Copyright (c) 2019-2021 GeyserMC. http://geysermc.org
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* @author GeyserMC
* @link https://github.com/GeyserMC/Geyser
*/
package org.geysermc.geyser.entity.type;
import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
import com.nukkitx.protocol.bedrock.packet.PlaySoundPacket;
import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.session.GeyserSession;
import java.util.UUID;
import java.util.concurrent.ThreadLocalRandom;
public class EvokerFangsEntity extends Entity implements Tickable {
private int limitedLife = 22;
private boolean attackStarted = false;
public EvokerFangsEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
// As of 1.18.2 Bedrock, this line is required for the entity to be visible
// 22 is the starting number on Java Edition
dirtyMetadata.put(EntityData.LIMITED_LIFE, this.limitedLife);
}
@Override
public void tick() {
if (attackStarted) {
if (--this.limitedLife > 0 && this.limitedLife % 2 == 0) { // Matches Bedrock behavior
dirtyMetadata.put(EntityData.LIMITED_LIFE, this.limitedLife);
updateBedrockMetadata();
}
}
}
public void setAttackStarted() {
this.attackStarted = true;
if (!getFlag(EntityFlag.SILENT)) {
// Play the chomp sound
PlaySoundPacket packet = new PlaySoundPacket();
packet.setPosition(this.position);
packet.setSound("mob.evocation_fangs.attack");
packet.setVolume(1.0f);
packet.setPitch(ThreadLocalRandom.current().nextFloat() * 0.2f + 0.85f);
session.sendUpstreamPacket(packet);
}
}
}

Datei anzeigen

@ -32,7 +32,7 @@ import org.geysermc.geyser.session.GeyserSession;
public class ExpOrbEntity extends Entity { public class ExpOrbEntity extends Entity {
public ExpOrbEntity(GeyserSession session, int amount, long entityId, long geyserId, Vector3f position) { public ExpOrbEntity(GeyserSession session, int amount, int entityId, long geyserId, Vector3f position) {
super(session, entityId, geyserId, null, EntityDefinitions.EXPERIENCE_ORB, position, Vector3f.ZERO, 0, 0, 0); super(session, entityId, geyserId, null, EntityDefinitions.EXPERIENCE_ORB, position, Vector3f.ZERO, 0, 0, 0);
this.dirtyMetadata.put(EntityData.EXPERIENCE_VALUE, amount); this.dirtyMetadata.put(EntityData.EXPERIENCE_VALUE, amount);

Datei anzeigen

@ -36,7 +36,7 @@ import java.util.UUID;
public class FallingBlockEntity extends Entity { public class FallingBlockEntity extends Entity {
public FallingBlockEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, Vector3f position, Vector3f motion, float yaw, float pitch, int javaId) { public FallingBlockEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, Vector3f position, Vector3f motion, float yaw, float pitch, int javaId) {
super(session, entityId, geyserId, uuid, EntityDefinitions.FALLING_BLOCK, position, motion, yaw, pitch, 0f); super(session, entityId, geyserId, uuid, EntityDefinitions.FALLING_BLOCK, position, motion, yaw, pitch, 0f);
this.dirtyMetadata.put(EntityData.VARIANT, session.getBlockMappings().getBedrockBlockId(javaId)); this.dirtyMetadata.put(EntityData.VARIANT, session.getBlockMappings().getBedrockBlockId(javaId));

Datei anzeigen

@ -39,7 +39,7 @@ public class FireballEntity extends ThrowableEntity {
*/ */
protected int futureTicks = 3; protected int futureTicks = 3;
public FireballEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public FireballEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, Vector3f.ZERO, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, Vector3f.ZERO, yaw, pitch, headYaw);
float magnitude = motion.length(); float magnitude = motion.length();

Datei anzeigen

@ -50,7 +50,7 @@ import java.util.UUID;
public class FireworkEntity extends Entity { public class FireworkEntity extends Entity {
public FireworkEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public FireworkEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -50,13 +50,13 @@ public class FishingHookEntity extends ThrowableEntity {
private boolean inWater = false; private boolean inWater = false;
@Getter @Getter
private final boolean isOwnerSessionPlayer; private final long bedrockOwnerId;
@Getter @Getter
private long bedrockTargetId; private long bedrockTargetId;
private final BoundingBox boundingBox; private final BoundingBox boundingBox;
public FishingHookEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, Vector3f position, Vector3f motion, float yaw, float pitch, PlayerEntity owner) { public FishingHookEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, Vector3f position, Vector3f motion, float yaw, float pitch, PlayerEntity owner) {
super(session, entityId, geyserId, uuid, EntityDefinitions.FISHING_BOBBER, position, motion, yaw, pitch, 0f); super(session, entityId, geyserId, uuid, EntityDefinitions.FISHING_BOBBER, position, motion, yaw, pitch, 0f);
this.boundingBox = new BoundingBox(0.125, 0.125, 0.125, 0.25, 0.25, 0.25); this.boundingBox = new BoundingBox(0.125, 0.125, 0.125, 0.25, 0.25, 0.25);
@ -66,25 +66,13 @@ public class FishingHookEntity extends ThrowableEntity {
// so that it can be handled by moveAbsoluteImmediate. // so that it can be handled by moveAbsoluteImmediate.
setBoundingBoxHeight(128); setBoundingBoxHeight(128);
isOwnerSessionPlayer = owner.getGeyserId() == session.getPlayerEntity().getGeyserId(); this.bedrockOwnerId = owner.getGeyserId();
this.dirtyMetadata.put(EntityData.OWNER_EID, owner.getGeyserId()); this.dirtyMetadata.put(EntityData.OWNER_EID, this.bedrockOwnerId);
}
@Override
public void spawnEntity() {
super.spawnEntity();
} }
public void setHookedEntity(IntEntityMetadata entityMetadata) { public void setHookedEntity(IntEntityMetadata entityMetadata) {
int hookedEntityId = entityMetadata.getPrimitiveValue() - 1; int hookedEntityId = entityMetadata.getPrimitiveValue() - 1;
Entity entity; Entity entity = session.getEntityCache().getEntityByJavaId(hookedEntityId);
if (session.getPlayerEntity().getEntityId() == hookedEntityId) {
entity = session.getPlayerEntity();
} else {
entity = session.getEntityCache().getEntityByJavaId(hookedEntityId);
}
if (entity != null) { if (entity != null) {
bedrockTargetId = entity.getGeyserId(); bedrockTargetId = entity.getGeyserId();
dirtyMetadata.put(EntityData.TARGET_EID, bedrockTargetId); dirtyMetadata.put(EntityData.TARGET_EID, bedrockTargetId);

Datei anzeigen

@ -37,7 +37,7 @@ import java.util.UUID;
public class FurnaceMinecartEntity extends DefaultBlockMinecartEntity { public class FurnaceMinecartEntity extends DefaultBlockMinecartEntity {
private boolean hasFuel = false; private boolean hasFuel = false;
public FurnaceMinecartEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public FurnaceMinecartEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -46,7 +46,7 @@ public class ItemEntity extends ThrowableEntity {
private int waterLevel = -1; private int waterLevel = -1;
public ItemEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public ItemEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -77,7 +77,7 @@ public class ItemFrameEntity extends Entity {
*/ */
private boolean changed = true; private boolean changed = true;
public ItemFrameEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, Direction direction) { public ItemFrameEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, Direction direction) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, 0f); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, 0f);
NbtMapBuilder blockBuilder = NbtMap.builder() NbtMapBuilder blockBuilder = NbtMap.builder()

Datei anzeigen

@ -33,7 +33,7 @@ import java.util.UUID;
public class LeashKnotEntity extends Entity { public class LeashKnotEntity extends Entity {
public LeashKnotEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public LeashKnotEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
// Position is incorrect by default // Position is incorrect by default
super(session, entityId, geyserId, uuid, definition, position.add(0.5f, 0.25f, 0.5f), motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position.add(0.5f, 0.25f, 0.5f), motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -35,7 +35,7 @@ import java.util.concurrent.ThreadLocalRandom;
public class LightningEntity extends Entity { public class LightningEntity extends Entity {
public LightningEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public LightningEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -80,7 +80,7 @@ public class LivingEntity extends Entity {
*/ */
private boolean isMaxFrozenState = false; private boolean isMaxFrozenState = false;
public LivingEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public LivingEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -36,7 +36,7 @@ import java.util.UUID;
public class MinecartEntity extends Entity { public class MinecartEntity extends Entity {
public MinecartEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public MinecartEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position.add(0d, definition.offset(), 0d), motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position.add(0d, definition.offset(), 0d), motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -38,7 +38,7 @@ public class PaintingEntity extends Entity {
private final PaintingType paintingName; private final PaintingType paintingName;
private final int direction; private final int direction;
public PaintingEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, Vector3f position, PaintingType paintingName, int direction) { public PaintingEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, Vector3f position, PaintingType paintingName, int direction) {
super(session, entityId, geyserId, uuid, EntityDefinitions.PAINTING, position, Vector3f.ZERO, 0f, 0f, 0f); super(session, entityId, geyserId, uuid, EntityDefinitions.PAINTING, position, Vector3f.ZERO, 0f, 0f, 0f);
this.paintingName = paintingName; this.paintingName = paintingName;
this.direction = direction; this.direction = direction;

Datei anzeigen

@ -35,7 +35,7 @@ import java.util.UUID;
public class SpawnerMinecartEntity extends DefaultBlockMinecartEntity { public class SpawnerMinecartEntity extends DefaultBlockMinecartEntity {
public SpawnerMinecartEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public SpawnerMinecartEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -38,7 +38,7 @@ import java.util.UUID;
public class TNTEntity extends Entity implements Tickable { public class TNTEntity extends Entity implements Tickable {
private int currentTick; private int currentTick;
public TNTEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public TNTEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -44,7 +44,7 @@ public class ThrowableEntity extends Entity implements Tickable {
protected Vector3f lastJavaPosition; protected Vector3f lastJavaPosition;
public ThrowableEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public ThrowableEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
this.lastJavaPosition = position; this.lastJavaPosition = position;
} }

Datei anzeigen

@ -44,7 +44,7 @@ public class ThrowableItemEntity extends ThrowableEntity {
private int age; private int age;
private boolean invisible; private boolean invisible;
public ThrowableItemEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public ThrowableItemEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
setFlag(EntityFlag.INVISIBLE, true); setFlag(EntityFlag.INVISIBLE, true);
invisible = false; invisible = false;

Datei anzeigen

@ -44,7 +44,7 @@ import java.util.UUID;
public class ThrownPotionEntity extends ThrowableItemEntity { public class ThrownPotionEntity extends ThrowableItemEntity {
private static final EnumSet<Potion> NON_ENCHANTED_POTIONS = EnumSet.of(Potion.WATER, Potion.MUNDANE, Potion.THICK, Potion.AWKWARD); private static final EnumSet<Potion> NON_ENCHANTED_POTIONS = EnumSet.of(Potion.WATER, Potion.MUNDANE, Potion.THICK, Potion.AWKWARD);
public ThrownPotionEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public ThrownPotionEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -39,7 +39,7 @@ import java.util.UUID;
*/ */
public class TippedArrowEntity extends AbstractArrowEntity { public class TippedArrowEntity extends AbstractArrowEntity {
public TippedArrowEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public TippedArrowEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -33,7 +33,7 @@ import java.util.UUID;
public class TridentEntity extends AbstractArrowEntity { public class TridentEntity extends AbstractArrowEntity {
public TridentEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public TridentEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }
} }

Datei anzeigen

@ -36,7 +36,7 @@ import java.util.UUID;
public class WitherSkullEntity extends FireballEntity { public class WitherSkullEntity extends FireballEntity {
private boolean isCharged; private boolean isCharged;
public WitherSkullEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public WitherSkullEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
this.futureTicks = 1; this.futureTicks = 1;

Datei anzeigen

@ -34,7 +34,7 @@ import java.util.UUID;
public class AbstractFishEntity extends WaterEntity { public class AbstractFishEntity extends WaterEntity {
public AbstractFishEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public AbstractFishEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
setFlag(EntityFlag.CAN_SWIM, true); setFlag(EntityFlag.CAN_SWIM, true);

Datei anzeigen

@ -36,7 +36,7 @@ import java.util.UUID;
public class AgeableEntity extends CreatureEntity { public class AgeableEntity extends CreatureEntity {
public AgeableEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public AgeableEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -33,7 +33,7 @@ import java.util.UUID;
public class AmbientEntity extends MobEntity { public class AmbientEntity extends MobEntity {
public AmbientEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public AmbientEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }
} }

Datei anzeigen

@ -78,7 +78,7 @@ public class ArmorStandEntity extends LivingEntity {
*/ */
private boolean positionUpdateRequired = false; private boolean positionUpdateRequired = false;
public ArmorStandEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public ArmorStandEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }
@ -146,13 +146,14 @@ public class ArmorStandEntity extends LivingEntity {
isMarker = (xd & 0x10) == 0x10; isMarker = (xd & 0x10) == 0x10;
if (oldIsMarker != isMarker) { if (oldIsMarker != isMarker) {
if (isMarker) { if (isMarker) {
dirtyMetadata.put(EntityData.BOUNDING_BOX_WIDTH, 0.0f); setBoundingBoxWidth(0.0f);
dirtyMetadata.put(EntityData.BOUNDING_BOX_HEIGHT, 0.0f); setBoundingBoxHeight(0.0f);
dirtyMetadata.put(EntityData.SCALE, 0f); dirtyMetadata.put(EntityData.SCALE, 0f);
} else { } else {
toggleSmallStatus(); toggleSmallStatus();
} }
updateMountOffset();
updateSecondEntityStatus(false); updateSecondEntityStatus(false);
} }
@ -376,8 +377,8 @@ public class ArmorStandEntity extends LivingEntity {
* If this armor stand is not a marker, set its bounding box size and scale. * If this armor stand is not a marker, set its bounding box size and scale.
*/ */
private void toggleSmallStatus() { private void toggleSmallStatus() {
dirtyMetadata.put(EntityData.BOUNDING_BOX_WIDTH, isSmall ? 0.25f : definition.width()); setBoundingBoxWidth(isSmall ? 0.25f : definition.width());
dirtyMetadata.put(EntityData.BOUNDING_BOX_HEIGHT, isSmall ? 0.9875f : definition.height()); setBoundingBoxHeight(isSmall ? 0.9875f : definition.height());
dirtyMetadata.put(EntityData.SCALE, isSmall ? 0.55f : 1f); dirtyMetadata.put(EntityData.SCALE, isSmall ? 0.55f : 1f);
} }

Datei anzeigen

@ -35,7 +35,7 @@ import java.util.UUID;
public class BatEntity extends AmbientEntity { public class BatEntity extends AmbientEntity {
public BatEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public BatEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -33,7 +33,7 @@ import java.util.UUID;
public class CreatureEntity extends MobEntity { public class CreatureEntity extends MobEntity {
public CreatureEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public CreatureEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }
} }

Datei anzeigen

@ -33,7 +33,7 @@ import java.util.UUID;
public class FlyingEntity extends MobEntity { public class FlyingEntity extends MobEntity {
public FlyingEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public FlyingEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }
} }

Datei anzeigen

@ -32,7 +32,7 @@ import org.geysermc.geyser.session.GeyserSession;
import java.util.UUID; import java.util.UUID;
public class GlowSquidEntity extends SquidEntity { public class GlowSquidEntity extends SquidEntity {
public GlowSquidEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public GlowSquidEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }
} }

Datei anzeigen

@ -33,7 +33,7 @@ import java.util.UUID;
public class GolemEntity extends CreatureEntity { public class GolemEntity extends CreatureEntity {
public GolemEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public GolemEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }
} }

Datei anzeigen

@ -35,7 +35,7 @@ import java.util.UUID;
public class IronGolemEntity extends GolemEntity { public class IronGolemEntity extends GolemEntity {
public IronGolemEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public IronGolemEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
// Indicate that we should show cracks through a resource pack // Indicate that we should show cracks through a resource pack
setFlag(EntityFlag.BRIBED, true); setFlag(EntityFlag.BRIBED, true);

Datei anzeigen

@ -34,7 +34,7 @@ import java.util.UUID;
public class MagmaCubeEntity extends SlimeEntity { public class MagmaCubeEntity extends SlimeEntity {
public MagmaCubeEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public MagmaCubeEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -43,7 +43,7 @@ public class MobEntity extends LivingEntity {
@Getter @Getter
private long leashHolderBedrockId; private long leashHolderBedrockId;
public MobEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public MobEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -35,7 +35,7 @@ import java.util.UUID;
public class SlimeEntity extends MobEntity { public class SlimeEntity extends MobEntity {
public SlimeEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public SlimeEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -35,7 +35,7 @@ import java.util.UUID;
public class SnowGolemEntity extends GolemEntity { public class SnowGolemEntity extends GolemEntity {
public SnowGolemEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public SnowGolemEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -41,7 +41,7 @@ public class SquidEntity extends WaterEntity implements Tickable {
private boolean inWater; private boolean inWater;
public SquidEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public SquidEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -33,7 +33,7 @@ import java.util.UUID;
public class WaterEntity extends CreatureEntity { public class WaterEntity extends CreatureEntity {
public WaterEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public WaterEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }
} }

Datei anzeigen

@ -35,7 +35,7 @@ import java.util.UUID;
public class AnimalEntity extends AgeableEntity { public class AnimalEntity extends AgeableEntity {
public AnimalEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public AnimalEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -37,7 +37,7 @@ import org.geysermc.geyser.registry.type.ItemMapping;
import java.util.UUID; import java.util.UUID;
public class AxolotlEntity extends AnimalEntity { public class AxolotlEntity extends AnimalEntity {
public AxolotlEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public AxolotlEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -40,7 +40,7 @@ import java.util.UUID;
public class BeeEntity extends AnimalEntity { public class BeeEntity extends AnimalEntity {
public BeeEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public BeeEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -34,7 +34,7 @@ import java.util.UUID;
public class ChickenEntity extends AnimalEntity { public class ChickenEntity extends AnimalEntity {
public ChickenEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public ChickenEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -38,7 +38,7 @@ import java.util.UUID;
public class FoxEntity extends AnimalEntity { public class FoxEntity extends AnimalEntity {
public FoxEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public FoxEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -41,7 +41,7 @@ public class GoatEntity extends AnimalEntity {
@Getter @Getter
private boolean isScreamer; private boolean isScreamer;
public GoatEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public GoatEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -29,16 +29,15 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanE
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.registry.type.ItemMapping;
import org.geysermc.geyser.util.DimensionUtils; import org.geysermc.geyser.session.GeyserSession;
import java.util.UUID; import java.util.UUID;
public class HoglinEntity extends AnimalEntity { public class HoglinEntity extends AnimalEntity {
private boolean isImmuneToZombification; private boolean isImmuneToZombification;
public HoglinEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public HoglinEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }
@ -50,7 +49,7 @@ public class HoglinEntity extends AnimalEntity {
@Override @Override
protected boolean isShaking() { protected boolean isShaking() {
return (!isImmuneToZombification && !session.getDimension().equals(DimensionUtils.NETHER)) || super.isShaking(); return (!isImmuneToZombification && !session.isDimensionPiglinSafe()) || super.isShaking();
} }
@Override @Override

Datei anzeigen

@ -33,7 +33,7 @@ import java.util.UUID;
public class MooshroomEntity extends AnimalEntity { public class MooshroomEntity extends AnimalEntity {
public MooshroomEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public MooshroomEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }
} }

Datei anzeigen

@ -34,7 +34,7 @@ import java.util.UUID;
public class OcelotEntity extends AnimalEntity { public class OcelotEntity extends AnimalEntity {
public OcelotEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public OcelotEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -42,7 +42,7 @@ public class PandaEntity extends AnimalEntity {
private int mainGene; private int mainGene;
private int hiddenGene; private int hiddenGene;
public PandaEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public PandaEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -34,7 +34,7 @@ import java.util.UUID;
public class PigEntity extends AnimalEntity { public class PigEntity extends AnimalEntity {
public PigEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public PigEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -34,7 +34,7 @@ import java.util.UUID;
public class PolarBearEntity extends AnimalEntity { public class PolarBearEntity extends AnimalEntity {
public PolarBearEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public PolarBearEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -36,7 +36,7 @@ import java.util.UUID;
public class PufferFishEntity extends AbstractFishEntity { public class PufferFishEntity extends AbstractFishEntity {
public PufferFishEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public PufferFishEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -38,7 +38,7 @@ import java.util.UUID;
public class RabbitEntity extends AnimalEntity { public class RabbitEntity extends AnimalEntity {
public RabbitEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public RabbitEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -36,7 +36,7 @@ import java.util.UUID;
public class SheepEntity extends AnimalEntity { public class SheepEntity extends AnimalEntity {
public SheepEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public SheepEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -39,7 +39,7 @@ public class StriderEntity extends AnimalEntity {
private boolean isCold = false; private boolean isCold = false;
public StriderEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public StriderEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
setFlag(EntityFlag.FIRE_IMMUNE, true); setFlag(EntityFlag.FIRE_IMMUNE, true);
@ -60,12 +60,8 @@ public class StriderEntity extends AnimalEntity {
// Needs to copy the parent state // Needs to copy the parent state
if (getFlag(EntityFlag.RIDING)) { if (getFlag(EntityFlag.RIDING)) {
boolean parentShaking = false; boolean parentShaking = false;
//TODO optimize if (vehicle instanceof StriderEntity) {
for (Entity ent : session.getEntityCache().getEntities().values()) { parentShaking = vehicle.getFlag(EntityFlag.SHAKING);
if (ent.getPassengers().contains(entityId) && ent instanceof StriderEntity) {
parentShaking = ent.getFlag(EntityFlag.SHAKING);
break;
}
} }
setFlag(EntityFlag.BREATHING, !parentShaking); setFlag(EntityFlag.BREATHING, !parentShaking);
@ -76,10 +72,9 @@ public class StriderEntity extends AnimalEntity {
} }
// Update the passengers if we have any // Update the passengers if we have any
for (long passenger : passengers) { for (Entity passenger : passengers) {
Entity passengerEntity = session.getEntityCache().getEntityByJavaId(passenger); if (passenger != null) {
if (passengerEntity != null) { passenger.updateBedrockMetadata();
passengerEntity.updateBedrockMetadata();
} }
} }

Datei anzeigen

@ -48,7 +48,7 @@ public class TropicalFishEntity extends AbstractFishEntity {
private static final List<String> VARIANT_NAMES = ImmutableList.of("kob", "sunstreak", "snooper", "dasher", "brinely", "spotty", "flopper", "stripey", "glitter", "blockfish", "betty", "clayfish"); private static final List<String> VARIANT_NAMES = ImmutableList.of("kob", "sunstreak", "snooper", "dasher", "brinely", "spotty", "flopper", "stripey", "glitter", "blockfish", "betty", "clayfish");
private static final List<String> COLOR_NAMES = ImmutableList.of("white", "orange", "magenta", "light_blue", "yellow", "lime", "pink", "gray", "light_gray", "cyan", "purple", "blue", "brown", "green", "red", "black"); private static final List<String> COLOR_NAMES = ImmutableList.of("white", "orange", "magenta", "light_blue", "yellow", "lime", "pink", "gray", "light_gray", "cyan", "purple", "blue", "brown", "green", "red", "black");
public TropicalFishEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public TropicalFishEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -36,7 +36,7 @@ import java.util.UUID;
public class TurtleEntity extends AnimalEntity { public class TurtleEntity extends AnimalEntity {
public TurtleEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public TurtleEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -51,7 +51,7 @@ public class AbstractHorseEntity extends AnimalEntity {
private static final Set<String> DONKEY_AND_HORSE_FOODS = ImmutableSet.of("golden_apple", "enchanted_golden_apple", private static final Set<String> DONKEY_AND_HORSE_FOODS = ImmutableSet.of("golden_apple", "enchanted_golden_apple",
"golden_carrot", "sugar", "apple", "wheat", "hay_block"); "golden_carrot", "sugar", "apple", "wheat", "hay_block");
public AbstractHorseEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public AbstractHorseEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
// Specifies the size of the entity's inventory. Required to place slots in the entity. // Specifies the size of the entity's inventory. Required to place slots in the entity.

Datei anzeigen

@ -33,7 +33,7 @@ import java.util.UUID;
public class ChestedHorseEntity extends AbstractHorseEntity { public class ChestedHorseEntity extends AbstractHorseEntity {
public ChestedHorseEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public ChestedHorseEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -35,7 +35,7 @@ import java.util.UUID;
public class HorseEntity extends AbstractHorseEntity { public class HorseEntity extends AbstractHorseEntity {
public HorseEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public HorseEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -38,7 +38,7 @@ import java.util.UUID;
public class LlamaEntity extends ChestedHorseEntity { public class LlamaEntity extends ChestedHorseEntity {
public LlamaEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public LlamaEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
dirtyMetadata.put(EntityData.CONTAINER_STRENGTH_MODIFIER, 3); // Presumably 3 slots for every 1 strength dirtyMetadata.put(EntityData.CONTAINER_STRENGTH_MODIFIER, 3); // Presumably 3 slots for every 1 strength

Datei anzeigen

@ -34,7 +34,7 @@ import java.util.UUID;
public class TraderLlamaEntity extends LlamaEntity { public class TraderLlamaEntity extends LlamaEntity {
public TraderLlamaEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public TraderLlamaEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -41,7 +41,7 @@ public class CatEntity extends TameableEntity {
private byte collarColor; private byte collarColor;
public CatEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public CatEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -34,7 +34,7 @@ import java.util.UUID;
public class ParrotEntity extends TameableEntity { public class ParrotEntity extends TameableEntity {
public ParrotEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public ParrotEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -46,7 +46,7 @@ public class TameableEntity extends AnimalEntity {
@Getter @Getter
protected long ownerBedrockId; protected long ownerBedrockId;
public TameableEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public TameableEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -49,7 +49,7 @@ public class WolfEntity extends TameableEntity {
private byte collarColor; private byte collarColor;
public WolfEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public WolfEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -34,7 +34,7 @@ import java.util.UUID;
public class AbstractMerchantEntity extends AgeableEntity { public class AbstractMerchantEntity extends AgeableEntity {
public AbstractMerchantEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public AbstractMerchantEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }
} }

Datei anzeigen

@ -88,7 +88,7 @@ public class VillagerEntity extends AbstractMerchantEntity {
@Getter @Getter
private boolean canTradeWith; private boolean canTradeWith;
public VillagerEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public VillagerEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -35,7 +35,7 @@ import java.util.UUID;
public class AbstractSkeletonEntity extends MonsterEntity { public class AbstractSkeletonEntity extends MonsterEntity {
public AbstractSkeletonEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public AbstractSkeletonEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -30,14 +30,13 @@ import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.util.DimensionUtils;
import java.util.UUID; import java.util.UUID;
public class BasePiglinEntity extends MonsterEntity { public class BasePiglinEntity extends MonsterEntity {
private boolean isImmuneToZombification; private boolean isImmuneToZombification;
public BasePiglinEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public BasePiglinEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }
@ -49,6 +48,6 @@ public class BasePiglinEntity extends MonsterEntity {
@Override @Override
protected boolean isShaking() { protected boolean isShaking() {
return (!isImmuneToZombification && !session.getDimension().equals(DimensionUtils.NETHER)) || super.isShaking(); return (!isImmuneToZombification && !session.isDimensionPiglinSafe()) || super.isShaking();
} }
} }

Datei anzeigen

@ -35,7 +35,7 @@ import java.util.UUID;
public class BlazeEntity extends MonsterEntity { public class BlazeEntity extends MonsterEntity {
public BlazeEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public BlazeEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -41,7 +41,7 @@ public class CreeperEntity extends MonsterEntity {
*/ */
private boolean ignitedByFlintAndSteel = false; private boolean ignitedByFlintAndSteel = false;
public CreeperEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public CreeperEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -34,7 +34,7 @@ import java.util.UUID;
public class ElderGuardianEntity extends GuardianEntity { public class ElderGuardianEntity extends GuardianEntity {
public ElderGuardianEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public ElderGuardianEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -79,7 +79,7 @@ public class EnderDragonEntity extends MobEntity implements Tickable {
private float wingPosition; private float wingPosition;
private float lastWingPosition; private float lastWingPosition;
public EnderDragonEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public EnderDragonEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -34,7 +34,7 @@ import org.geysermc.geyser.session.GeyserSession;
public class EnderDragonPartEntity extends Entity { public class EnderDragonPartEntity extends Entity {
public EnderDragonPartEntity(GeyserSession session, long entityId, long geyserId, float width, float height) { public EnderDragonPartEntity(GeyserSession session, int entityId, long geyserId, float width, float height) {
super(session, entityId, geyserId, null, EntityDefinitions.ENDER_DRAGON_PART, Vector3f.ZERO, Vector3f.ZERO, 0, 0, 0); super(session, entityId, geyserId, null, EntityDefinitions.ENDER_DRAGON_PART, Vector3f.ZERO, Vector3f.ZERO, 0, 0, 0);
dirtyMetadata.put(EntityData.BOUNDING_BOX_WIDTH, width); dirtyMetadata.put(EntityData.BOUNDING_BOX_WIDTH, width);

Datei anzeigen

@ -39,7 +39,7 @@ import java.util.UUID;
public class EndermanEntity extends MonsterEntity { public class EndermanEntity extends MonsterEntity {
public EndermanEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public EndermanEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -36,7 +36,7 @@ import java.util.UUID;
public class GhastEntity extends FlyingEntity { public class GhastEntity extends FlyingEntity {
public GhastEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public GhastEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -34,7 +34,7 @@ import java.util.UUID;
public class GiantEntity extends MonsterEntity { public class GiantEntity extends MonsterEntity {
public GiantEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public GiantEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
dirtyMetadata.put(EntityData.SCALE, 6f); dirtyMetadata.put(EntityData.SCALE, 6f);

Datei anzeigen

@ -36,19 +36,13 @@ import java.util.UUID;
public class GuardianEntity extends MonsterEntity { public class GuardianEntity extends MonsterEntity {
public GuardianEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public GuardianEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }
public void setGuardianTarget(IntEntityMetadata entityMetadata) { public void setGuardianTarget(IntEntityMetadata entityMetadata) {
int entityId = entityMetadata.getPrimitiveValue(); int entityId = entityMetadata.getPrimitiveValue();
Entity entity; Entity entity = session.getEntityCache().getEntityByJavaId(entityId);
if (session.getPlayerEntity().getEntityId() == entityId) {
entity = session.getPlayerEntity();
} else {
entity = session.getEntityCache().getEntityByJavaId(entityId);
}
if (entity != null) { if (entity != null) {
dirtyMetadata.put(EntityData.TARGET_EID, entity.getGeyserId()); dirtyMetadata.put(EntityData.TARGET_EID, entity.getGeyserId());
} else { } else {

Datei anzeigen

@ -34,7 +34,7 @@ import java.util.UUID;
public class MonsterEntity extends CreatureEntity { public class MonsterEntity extends CreatureEntity {
public MonsterEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public MonsterEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }
} }

Datei anzeigen

@ -35,7 +35,7 @@ import org.geysermc.geyser.session.GeyserSession;
import java.util.UUID; import java.util.UUID;
public class PhantomEntity extends FlyingEntity { public class PhantomEntity extends FlyingEntity {
public PhantomEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public PhantomEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Datei anzeigen

@ -36,7 +36,7 @@ import java.util.UUID;
public class PiglinEntity extends BasePiglinEntity { public class PiglinEntity extends BasePiglinEntity {
public PiglinEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public PiglinEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }
@ -44,6 +44,8 @@ public class PiglinEntity extends BasePiglinEntity {
boolean isBaby = entityMetadata.getPrimitiveValue(); boolean isBaby = entityMetadata.getPrimitiveValue();
dirtyMetadata.put(EntityData.SCALE, isBaby? .55f : 1f); dirtyMetadata.put(EntityData.SCALE, isBaby? .55f : 1f);
setFlag(EntityFlag.BABY, isBaby); setFlag(EntityFlag.BABY, isBaby);
updateMountOffset();
} }
public void setChargingCrossbow(BooleanEntityMetadata entityMetadata) { public void setChargingCrossbow(BooleanEntityMetadata entityMetadata) {

Datei anzeigen

@ -39,7 +39,7 @@ import java.util.UUID;
public class ShulkerEntity extends GolemEntity { public class ShulkerEntity extends GolemEntity {
public ShulkerEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public ShulkerEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
// Indicate that invisibility should be fixed through the resource pack // Indicate that invisibility should be fixed through the resource pack
setFlag(EntityFlag.BRIBED, true); setFlag(EntityFlag.BRIBED, true);

Datei anzeigen

@ -36,7 +36,7 @@ import java.util.UUID;
public class SkeletonEntity extends AbstractSkeletonEntity { public class SkeletonEntity extends AbstractSkeletonEntity {
private boolean convertingToStray = false; private boolean convertingToStray = false;
public SkeletonEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public SkeletonEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
} }

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen