mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-04 07:17:46 +01:00
SPIGOT-7550: Fix creation of Arrow instances
By: Doc <nachito94@msn.com>
This commit is contained in:
parent
1b81fe827e
commit
67a231d8d9
@ -93,7 +93,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
CraftEntityTypes.EntityTypeData<?, T> entityTypeData = CraftEntityTypes.getEntityTypeData(CraftEntityType.minecraftToBukkit(entity.getType()));
|
||||
|
||||
if (entityTypeData != null) {
|
||||
return entityTypeData.convertFunction().apply(server, entity);
|
||||
return (CraftEntity) entityTypeData.convertFunction().apply(server, entity);
|
||||
}
|
||||
|
||||
throw new AssertionError("Unknown entity " + (entity == null ? null : entity.getClass()));
|
||||
|
@ -184,7 +184,7 @@ public final class CraftEntityTypes {
|
||||
|
||||
public record EntityTypeData<E extends Entity, M extends net.minecraft.world.entity.Entity>(EntityType entityType,
|
||||
Class<E> entityClass,
|
||||
BiFunction<CraftServer, M, CraftEntity> convertFunction,
|
||||
BiFunction<CraftServer, M, E> convertFunction,
|
||||
Function<SpawnData, M> spawnFunction) {
|
||||
}
|
||||
|
||||
@ -340,7 +340,7 @@ public final class CraftEntityTypes {
|
||||
register(new EntityTypeData<>(EntityType.GLOW_ITEM_FRAME, GlowItemFrame.class, CraftGlowItemFrame::new, createHanging(GlowItemFrame.class, (spawnData, hangingData) -> new net.minecraft.world.entity.decoration.GlowItemFrame(spawnData.minecraftWorld(), hangingData.position(), hangingData.direction()))));
|
||||
|
||||
// Move no rotation
|
||||
register(new EntityTypeData<>(EntityType.ARROW, Arrow.class, CraftArrow::new, createAndMoveEmptyRot(EntityTypes.ARROW)));
|
||||
register(new EntityTypeData<>(EntityType.ARROW, Arrow.class, CraftTippedArrow::new, createAndMoveEmptyRot(EntityTypes.ARROW)));
|
||||
register(new EntityTypeData<>(EntityType.ENDER_PEARL, EnderPearl.class, CraftEnderPearl::new, createAndMoveEmptyRot(EntityTypes.ENDER_PEARL)));
|
||||
register(new EntityTypeData<>(EntityType.THROWN_EXP_BOTTLE, ThrownExpBottle.class, CraftThrownExpBottle::new, createAndMoveEmptyRot(EntityTypes.EXPERIENCE_BOTTLE)));
|
||||
register(new EntityTypeData<>(EntityType.SPECTRAL_ARROW, SpectralArrow.class, CraftSpectralArrow::new, createAndMoveEmptyRot(EntityTypes.SPECTRAL_ARROW)));
|
||||
|
Loading…
Reference in New Issue
Block a user