All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.nukkit.entity.provider.CustomEntityProvider Maven / Gradle / Ivy

There is a newer version: 1.20.40-r1
Show newest version
package cn.nukkit.entity.provider;

import cn.nukkit.api.PowerNukkitXOnly;
import cn.nukkit.api.Since;
import cn.nukkit.entity.Entity;
import cn.nukkit.entity.custom.CustomEntityDefinition;
import cn.nukkit.level.format.FullChunk;
import cn.nukkit.nbt.tag.CompoundTag;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

@PowerNukkitXOnly
@Since("1.19.21-r2")
public abstract class CustomEntityProvider implements EntityProvider {
    private CustomEntityDefinition customEntityDefinition;

    public CustomEntityProvider(CustomEntityDefinition customEntityDefinition) {
        this.customEntityDefinition = customEntityDefinition;
    }

    public CustomEntityDefinition getCustomEntityDefinition() {
        return customEntityDefinition;
    }

    public void setCustomEntityDefinition(CustomEntityDefinition customEntityDefinition) {
        this.customEntityDefinition = customEntityDefinition;
    }

    @Override
    public Entity provideEntity(@NotNull FullChunk chunk, @NotNull CompoundTag nbt, @Nullable Object... args) {
        return null;
    }

    @Override
    public int getNetworkId() {
        return customEntityDefinition.getRuntimeId();
    }

    @NotNull
    @Override
    public String getName() {
        return customEntityDefinition.getStringId();
    }

    @NotNull
    @Override
    public String getSimpleName() {
        return customEntityDefinition.getStringId();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy