mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-22 08:02:31 +01:00
make FishingHookMeta implement ObjectDataProvider
This commit is contained in:
parent
88765dd703
commit
b1cfa3d9b2
@ -1,14 +1,17 @@
|
||||
package net.minestom.server.entity.metadata.other;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import net.minestom.server.entity.Entity;
|
||||
import net.minestom.server.entity.Metadata;
|
||||
import net.minestom.server.entity.metadata.EntityMeta;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import net.minestom.server.entity.metadata.ObjectDataProvider;
|
||||
|
||||
public class FishingHookMeta extends EntityMeta {
|
||||
public class FishingHookMeta extends EntityMeta implements ObjectDataProvider {
|
||||
|
||||
private Entity hooked;
|
||||
private Entity owner;
|
||||
|
||||
public FishingHookMeta(@NotNull Entity entity, @NotNull Metadata metadata) {
|
||||
super(entity, metadata);
|
||||
@ -24,6 +27,14 @@ public class FishingHookMeta extends EntityMeta {
|
||||
int entityID = value == null ? 0 : value.getEntityId() + 1;
|
||||
super.metadata.setIndex((byte) 7, Metadata.VarInt(entityID));
|
||||
}
|
||||
@Nullable
|
||||
public Entity getOwnerEntity() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
public void setOwnerEntity(@Nullable Entity value) {
|
||||
this.owner = value;
|
||||
}
|
||||
|
||||
public boolean isCatchable() {
|
||||
return super.metadata.getIndex((byte) 8, false);
|
||||
@ -33,4 +44,13 @@ public class FishingHookMeta extends EntityMeta {
|
||||
super.metadata.setIndex((byte) 8, Metadata.Boolean(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getObjectData() {
|
||||
return owner.getEntityId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresVelocityPacketAtSpawn() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user