use of net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession in project takumicraft by TNTModders.
the class EntityZombieVillagerCreeper method readEntityFromNBT.
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
@Override
public void readEntityFromNBT(NBTTagCompound compound) {
super.readEntityFromNBT(compound);
this.setProfession(compound.getInteger("Profession"));
if (compound.hasKey("ProfessionName")) {
VillagerProfession p = ForgeRegistries.VILLAGER_PROFESSIONS.getValue(new ResourceLocation(compound.getString("ProfessionName")));
if (p == null) {
p = VillagerRegistry.FARMER;
}
this.setForgeProfession(p);
}
if (compound.hasKey("ConversionTime", 99) && compound.getInteger("ConversionTime") > -1) {
this.startConverting(compound.hasUniqueId("ConversionPlayer") ? compound.getUniqueId("ConversionPlayer") : null, compound.getInteger("ConversionTime"));
}
}
use of net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession in project pnc-repressurized by TeamPneumatic.
the class VillagerHandler method init.
public static void init() {
mechanicProfession = new VillagerProfession(Names.MOD_ID + ":mechanic", Textures.VILLAGER_MECHANIC, "minecraft:textures/entity/zombie_villager/zombie_villager.png");
VillagerCareer career = new VillagerCareer(mechanicProfession, Names.MOD_ID + ".mechanic");
career.addTrade(1, new ListItemForEmeralds(Itemss.PCB_BLUEPRINT, new PriceInfo(10, 19)), new ListItemForEmeralds(Itemss.NUKE_VIRUS, new PriceInfo(1, 5)), new ListItemForEmeralds(Itemss.STOP_WORM, new PriceInfo(1, 5)));
for (int i = 0; i < ItemAssemblyProgram.PROGRAMS_AMOUNT; i++) {
career.addTrade(1, new ListItemForEmeralds(new ItemStack(Itemss.ASSEMBLY_PROGRAM, 1, i), new PriceInfo(5, 11)));
}
}
use of net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession in project BaseMetals by MinecraftModDevelopmentMods.
the class VillagerTradeHelper method insertTrades.
/**
* Inserts one or more trades to the default villager trade table.
*
* @param professionRL
* Villager profession
* @param careerID
* Villager career ID (1-3)
* @param tradeLevel
* Level of trade (1+)
* @param trades
* Trades to add to the given level
*/
public static void insertTrades(final ResourceLocation professionRL, final int careerID, final int tradeLevel, final EntityVillager.ITradeList... trades) {
final VillagerProfession profession = ForgeRegistries.VILLAGER_PROFESSIONS.getValue(professionRL);
final VillagerCareer career = profession.getCareer(careerID);
career.addTrade(tradeLevel, trades);
}
Aggregations