mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-24 17:11:58 +01:00
AbstractProjectile now extends Entity and not ObjectEntity
This commit is contained in:
parent
8ca43c4caa
commit
046ebc03f6
@ -2,12 +2,11 @@ package net.minestom.server.entity.metadata.arrow;
|
||||
|
||||
import net.minestom.server.entity.Entity;
|
||||
import net.minestom.server.entity.Metadata;
|
||||
import net.minestom.server.entity.metadata.EntityMeta;
|
||||
import net.minestom.server.entity.metadata.ObjectDataProvider;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class ArrowMeta extends EntityMeta implements ObjectDataProvider {
|
||||
public class ArrowMeta extends AbstractArrowMeta implements ObjectDataProvider {
|
||||
|
||||
private Entity shooter;
|
||||
|
||||
|
@ -8,12 +8,13 @@ import net.minestom.server.utils.Position;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public abstract class AbstractProjectile extends ObjectEntity implements Projectile {
|
||||
public abstract class AbstractProjectile extends Entity implements Projectile {
|
||||
|
||||
private final Entity shooter;
|
||||
|
||||
public AbstractProjectile(@Nullable Entity shooter, @NotNull EntityType entityType, @NotNull Position spawnPosition) {
|
||||
super(entityType, spawnPosition);
|
||||
setGravity(0.02f, 0.04f, 1.96f);
|
||||
this.shooter = shooter;
|
||||
}
|
||||
|
||||
|
@ -119,10 +119,4 @@ public class EntityAbstractArrow extends AbstractProjectile {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getObjectData() {
|
||||
Entity shooter = getShooter();
|
||||
return shooter == null ? 0 : shooter.getEntityId() + 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package net.minestom.server.entity.type.projectile;
|
||||
import net.minestom.server.entity.Entity;
|
||||
import net.minestom.server.entity.EntityType;
|
||||
import net.minestom.server.entity.Metadata;
|
||||
import net.minestom.server.entity.metadata.arrow.ArrowMeta;
|
||||
import net.minestom.server.utils.Position;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@ -11,6 +12,7 @@ public class EntityArrow extends EntityAbstractArrow {
|
||||
|
||||
public EntityArrow(@Nullable Entity shooter, @NotNull Position spawnPosition) {
|
||||
super(shooter, EntityType.ARROW, spawnPosition);
|
||||
((ArrowMeta) getEntityMeta()).setShooter(shooter);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -40,8 +40,4 @@ public class EntityEyeOfEnder extends AbstractProjectile {
|
||||
this.metadata.setIndex((byte) 7, Metadata.Slot(itemStack));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getObjectData() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -20,11 +20,6 @@ public class EntityPotion extends AbstractProjectile {
|
||||
setPotion(potion);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getObjectData() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ItemStack getPotion() {
|
||||
return metadata.getIndex((byte) 7, ItemStack.getAirItem());
|
||||
|
@ -2,6 +2,7 @@ package net.minestom.server.entity.type.projectile;
|
||||
|
||||
import net.minestom.server.entity.Entity;
|
||||
import net.minestom.server.entity.EntityType;
|
||||
import net.minestom.server.entity.metadata.arrow.SpectralArrowMeta;
|
||||
import net.minestom.server.utils.Position;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@ -10,6 +11,7 @@ public class EntitySpectralArrow extends EntityAbstractArrow {
|
||||
|
||||
public EntitySpectralArrow(@Nullable Entity shooter, @NotNull Position spawnPosition) {
|
||||
super(shooter, EntityType.SPECTRAL_ARROW, spawnPosition);
|
||||
((SpectralArrowMeta) getEntityMeta()).setShooter(shooter);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user