net.minecraft.village.VillagerData Java Examples

The following examples show how to use net.minecraft.village.VillagerData. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MoonVillagerEntity.java    From Galacticraft-Rewoven with MIT License 5 votes vote down vote up
@Override
public void setVillagerData(VillagerData villagerData) {
    if (villagerData != null && Galacticraft.MOON_VILLAGER_PROFESSION_REGISTRY.getId(villagerData.getProfession()) != null
            && Galacticraft.MOON_VILLAGER_TYPE_REGISTRY.getId(villagerData.getType()) != null) {
        super.setVillagerData(villagerData);
    }
}
 
Example #2
Source File: FarmerVillagerTask_wartFarmMixin.java    From carpet-extra with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Redirect(method = "shouldRun", at = @At(
        value = "INVOKE",
        target = "Lnet/minecraft/village/VillagerData;getProfession()Lnet/minecraft/village/VillagerProfession;"
))
private VillagerProfession disguiseAsFarmer(VillagerData villagerData)
{
    isFarmingCleric = false;
    VillagerProfession profession = villagerData.getProfession();
    if (CarpetExtraSettings.clericsFarmWarts && profession == VillagerProfession.CLERIC)
    {
        isFarmingCleric = true;
        return VillagerProfession.FARMER;
    }
    return profession;
}
 
Example #3
Source File: NpcClothingFeature.java    From MineLittlePony with MIT License 5 votes vote down vote up
@Override
public void render(MatrixStack matrixStack, VertexConsumerProvider provider, int i, T entity, float f, float g, float h, float j, float k, float l) {
    if (!entity.isInvisible()) {

        VillagerData data = entity.getVillagerData();
        VillagerType type = data.getType();
        VillagerProfession profession = data.getProfession();

        HatType typeHatLayer = getHatType(typeHatCache, "type", Registry.VILLAGER_TYPE, type);
        HatType profHatLayer = getHatType(profHatCache, "profession", Registry.VILLAGER_PROFESSION, profession);
        M entityModel = getContextModel();

        entityModel.setHatVisible(
                   profHatLayer == VillagerResourceMetadata.HatType.NONE
               || (profHatLayer == VillagerResourceMetadata.HatType.PARTIAL && typeHatLayer != VillagerResourceMetadata.HatType.FULL)
        );

        Identifier typeSkin = findTexture("type", Registry.VILLAGER_TYPE.getId(type));

        getContext().getInternalRenderer().updateMetadata(typeSkin);
        renderModel(entityModel, typeSkin, matrixStack, provider, i, entity, 1, 1, 1);

        entityModel.setHatVisible(true);

        if (profession != VillagerProfession.NONE && !entity.isBaby()) {
            Identifier professionSkin = findTexture("profession", Registry.VILLAGER_PROFESSION.getId(profession));

            getContext().getInternalRenderer().updateMetadata(professionSkin);
            renderModel(entityModel, professionSkin, matrixStack, provider, i, entity, 1, 1, 1);

            if (profession != VillagerProfession.NITWIT) {
                Identifier levelSkin = findTexture("profession_level", LEVEL_TO_ID.get(MathHelper.clamp(data.getLevel(), 1, LEVEL_TO_ID.size())));

                renderModel(entityModel, levelSkin, matrixStack, provider, i, entity, 1, 1, 1);
            }
        }
    }
}
 
Example #4
Source File: PonyTextures.java    From MineLittlePony with MIT License 5 votes vote down vote up
@Override
public Identifier supplyTexture(T entity) {
    if (isBestPony(entity)) {
        return entity.isBaby() ? egg2 : egg;
    }

    VillagerData t = entity.getVillagerData();

    return getTexture(t.getType(), t.getProfession());
}
 
Example #5
Source File: ZombieVillagerEntityAccessor.java    From multiconnect with MIT License 4 votes vote down vote up
@Accessor("VILLAGER_DATA")
static TrackedData<VillagerData> getVillagerData() {
    return MixinHelper.fakeInstance();
}
 
Example #6
Source File: VillagerEntityAccessor.java    From multiconnect with MIT License 4 votes vote down vote up
@Accessor("VILLAGER_DATA")
static TrackedData<VillagerData> getVillagerData() {
    return MixinHelper.fakeInstance();
}
 
Example #7
Source File: VillagerEntity_wartFarmMixin.java    From carpet-extra with GNU Lesser General Public License v3.0 votes vote down vote up
@Shadow public abstract VillagerData getVillagerData();