use of forestry.apiculture.items.ItemRegistryApiculture in project ForestryMC by ForestryMC.
the class ModuleApiculture method registerBeehiveDrops.
private static void registerBeehiveDrops() {
ItemRegistryApiculture items = getItems();
ItemStack honeyComb = items.beeComb.get(EnumHoneyComb.HONEY, 1);
HiveRegistry hiveRegistry = getHiveRegistry();
hiveRegistry.addDrops(HiveType.FOREST.getHiveUid(), new HiveDrop(0.80, BeeDefinition.FOREST, honeyComb).setIgnobleShare(0.7), new HiveDrop(0.08, BeeDefinition.FOREST.getRainResist(), honeyComb), new HiveDrop(0.03, BeeDefinition.VALIANT, honeyComb));
hiveRegistry.addDrops(HiveType.MEADOWS.getHiveUid(), new HiveDrop(0.80, BeeDefinition.MEADOWS, honeyComb).setIgnobleShare(0.7), new HiveDrop(0.03, BeeDefinition.VALIANT, honeyComb));
ItemStack parchedComb = items.beeComb.get(EnumHoneyComb.PARCHED, 1);
hiveRegistry.addDrops(HiveType.DESERT.getHiveUid(), new HiveDrop(0.80, BeeDefinition.MODEST, parchedComb).setIgnobleShare(0.7), new HiveDrop(0.03, BeeDefinition.VALIANT, parchedComb));
ItemStack silkyComb = items.beeComb.get(EnumHoneyComb.SILKY, 1);
hiveRegistry.addDrops(HiveType.JUNGLE.getHiveUid(), new HiveDrop(0.80, BeeDefinition.TROPICAL, silkyComb).setIgnobleShare(0.7), new HiveDrop(0.03, BeeDefinition.VALIANT, silkyComb));
ItemStack mysteriousComb = items.beeComb.get(EnumHoneyComb.MYSTERIOUS, 1);
hiveRegistry.addDrops(HiveType.END.getHiveUid(), new HiveDrop(0.90, BeeDefinition.ENDED, mysteriousComb));
ItemStack frozenComb = items.beeComb.get(EnumHoneyComb.FROZEN, 1);
hiveRegistry.addDrops(HiveType.SNOW.getHiveUid(), new HiveDrop(0.80, BeeDefinition.WINTRY, frozenComb).setIgnobleShare(0.5), new HiveDrop(0.03, BeeDefinition.VALIANT, frozenComb));
ItemStack mossyComb = items.beeComb.get(EnumHoneyComb.MOSSY, 1);
hiveRegistry.addDrops(HiveType.SWAMP.getHiveUid(), new HiveDrop(0.80, BeeDefinition.MARSHY, mossyComb).setIgnobleShare(0.4), new HiveDrop(0.03, BeeDefinition.VALIANT, mossyComb));
}
use of forestry.apiculture.items.ItemRegistryApiculture in project ForestryMC by ForestryMC.
the class ModuleApiculture method doInit.
// TODO: Buildcraft for 1.9
// @Override
// public void registerTriggers() {
// ApicultureTriggers.initialize();
// }
@Override
public void doInit() {
File configFile = new File(Forestry.instance.getConfigFolder(), CONFIG_CATEGORY + ".cfg");
LocalizedConfiguration config = new LocalizedConfiguration(configFile, "3.0.0");
if (!Objects.equals(config.getLoadedConfigVersion(), config.getDefinedConfigVersion())) {
boolean deleted = configFile.delete();
if (deleted) {
config = new LocalizedConfiguration(configFile, "3.0.0");
}
}
initFlowerRegistry();
List<IBeekeepingMode> beekeepingModes = BeeManager.beeRoot.getBeekeepingModes();
String[] validBeekeepingModeNames = new String[beekeepingModes.size()];
for (int i = 0; i < beekeepingModes.size(); i++) {
validBeekeepingModeNames[i] = beekeepingModes.get(i).getName();
}
beekeepingMode = config.getStringLocalized("beekeeping", "mode", "NORMAL", validBeekeepingModeNames);
Log.debug("Beekeeping mode read from config: " + beekeepingMode);
secondPrincessChance = config.getFloatLocalized("beekeeping", "second.princess", secondPrincessChance, 0.0f, 100.0f);
maxFlowersSpawnedPerHive = config.getIntLocalized("beekeeping", "flowers.spawn", 20, 0, 1000);
String[] blacklist = config.getStringListLocalized("species", "blacklist", Constants.EMPTY_STRINGS);
parseBeeBlacklist(blacklist);
ticksPerBeeWorkCycle = config.getIntLocalized("beekeeping", "ticks.work", 550, 250, 850);
hivesDamageOnPeaceful = config.getBooleanLocalized("beekeeping", "hivedamage.peaceful", false);
doSelfPollination = config.getBooleanLocalized("beekeeping", "self.pollination", false);
config.save();
// Genetics
createAlleles();
BeeDefinition.initBees();
// Hives
createHives();
registerBeehiveDrops();
ItemRegistryApiculture items = getItems();
BlockRegistryApiculture blocks = getBlocks();
// Inducers for swarmer
BeeManager.inducers.put(items.royalJelly.getItemStack(), 10);
GameRegistry.registerTileEntity(TileAlvearyPlain.class, "forestry.Alveary");
GameRegistry.registerTileEntity(TileHive.class, "forestry.Swarm");
GameRegistry.registerTileEntity(TileAlvearySwarmer.class, "forestry.AlvearySwarmer");
GameRegistry.registerTileEntity(TileAlvearyHeater.class, "forestry.AlvearyHeater");
GameRegistry.registerTileEntity(TileAlvearyFan.class, "forestry.AlvearyFan");
GameRegistry.registerTileEntity(TileAlvearyHygroregulator.class, "forestry.AlvearyHygro");
GameRegistry.registerTileEntity(TileAlvearyStabiliser.class, "forestry.AlvearyStabiliser");
GameRegistry.registerTileEntity(TileAlvearySieve.class, "forestry.AlvearySieve");
GameRegistry.registerTileEntity(TileCandle.class, "forestry.Candle");
ResourceLocation beeHouseCartResource = new ResourceLocation(Constants.MOD_ID, "cart.beehouse");
EntityUtil.registerEntity(beeHouseCartResource, EntityMinecartBeehouse.class, "cart.beehouse", 1, 0x000000, 0xffffff, 256, 3, true);
ResourceLocation apiaryCartResource = new ResourceLocation(Constants.MOD_ID, "cart.apiary");
EntityUtil.registerEntity(apiaryCartResource, EntityMinecartApiary.class, "cart.apiary", 2, 0x000000, 0xffffff, 256, 3, true);
BeeManager.commonVillageBees.add(BeeDefinition.FOREST.getGenome());
BeeManager.commonVillageBees.add(BeeDefinition.MEADOWS.getGenome());
BeeManager.commonVillageBees.add(BeeDefinition.MODEST.getGenome());
BeeManager.commonVillageBees.add(BeeDefinition.MARSHY.getGenome());
BeeManager.commonVillageBees.add(BeeDefinition.WINTRY.getGenome());
BeeManager.commonVillageBees.add(BeeDefinition.TROPICAL.getGenome());
BeeManager.uncommonVillageBees.add(BeeDefinition.FOREST.getRainResist().getGenome());
BeeManager.uncommonVillageBees.add(BeeDefinition.COMMON.getGenome());
BeeManager.uncommonVillageBees.add(BeeDefinition.VALIANT.getGenome());
if (Config.enableVillagers) {
// Register villager stuff
VillageCreationApiculture villageHandler = new VillageCreationApiculture();
VillagerRegistry villagerRegistry = VillagerRegistry.instance();
villagerRegistry.registerVillageCreationHandler(villageHandler);
villagerApiarist = new VillagerRegistry.VillagerProfession(Constants.ID_VILLAGER_APIARIST, Constants.TEXTURE_SKIN_BEEKPEEPER, Constants.TEXTURE_SKIN_ZOMBIE_BEEKPEEPER);
IForgeRegistry<VillagerRegistry.VillagerProfession> villagerProfessions = ForgeRegistries.VILLAGER_PROFESSIONS;
villagerProfessions.register(villagerApiarist);
ItemStack wildcardPrincess = new ItemStack(items.beePrincessGE, 1);
ItemStack wildcardDrone = new ItemStack(items.beeDroneGE, 1);
ItemStack apiary = new ItemStack(blocks.apiary);
ItemStack provenFrames = items.frameProven.getItemStack();
ItemStack monasticDrone = BeeDefinition.MONASTIC.getMemberStack(EnumBeeType.DRONE);
ItemStack endDrone = BeeDefinition.ENDED.getMemberStack(EnumBeeType.DRONE);
ItemStack propolis = new ItemStack(items.propolis, 1);
VillagerRegistry.VillagerCareer apiaristCareer = new VillagerRegistry.VillagerCareer(villagerApiarist, "apiarist");
apiaristCareer.addTrade(1, new VillagerApiaristTrades.GiveRandomCombsForItems(items.beeComb, new ItemStack(Items.WHEAT), new EntityVillager.PriceInfo(8, 12), new EntityVillager.PriceInfo(2, 4)), new VillagerApiaristTrades.GiveRandomCombsForItems(items.beeComb, new ItemStack(Items.CARROT), new EntityVillager.PriceInfo(8, 12), new EntityVillager.PriceInfo(2, 4)), new VillagerApiaristTrades.GiveRandomCombsForItems(items.beeComb, new ItemStack(Items.POTATO), new EntityVillager.PriceInfo(8, 12), new EntityVillager.PriceInfo(2, 4)));
apiaristCareer.addTrade(2, new VillagerTradeLists.GiveItemForEmeralds(new EntityVillager.PriceInfo(1, 4), new ItemStack(items.smoker), null), new VillagerTradeLists.GiveItemForLogsAndEmeralds(apiary, new EntityVillager.PriceInfo(1, 1), new EntityVillager.PriceInfo(16, 32), new EntityVillager.PriceInfo(1, 2)), new VillagerApiaristTrades.GiveRandomHiveDroneForItems(propolis, null, wildcardDrone, new EntityVillager.PriceInfo(2, 4)));
apiaristCareer.addTrade(3, new VillagerTradeLists.GiveEmeraldForItems(wildcardPrincess, null), new VillagerTradeLists.GiveItemForEmeralds(new EntityVillager.PriceInfo(1, 2), provenFrames, new EntityVillager.PriceInfo(1, 6)));
apiaristCareer.addTrade(4, new VillagerTradeLists.GiveItemForItemAndEmerald(wildcardPrincess, null, new EntityVillager.PriceInfo(10, 64), monasticDrone, null), new VillagerTradeLists.GiveItemForTwoItems(wildcardPrincess, null, new ItemStack(Items.ENDER_EYE), new EntityVillager.PriceInfo(12, 16), endDrone, null));
}
blocks.apiary.init();
blocks.beeHouse.init();
blocks.beeChest.init();
}
use of forestry.apiculture.items.ItemRegistryApiculture in project ForestryMC by ForestryMC.
the class ApicultureJeiPlugin method registerItemSubtypes.
@Override
public void registerItemSubtypes(ISubtypeRegistry subtypeRegistry) {
if (!ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.APICULTURE))) {
return;
}
ItemRegistryApiculture items = ModuleApiculture.getItems();
Preconditions.checkNotNull(items);
ISubtypeRegistry.ISubtypeInterpreter beeSubtypeInterpreter = itemStack -> {
IAlleleSpecies species = Genome.getSpeciesDirectly(BeeManager.beeRoot, itemStack);
return species == null ? ISubtypeRegistry.ISubtypeInterpreter.NONE : species.getUID();
};
subtypeRegistry.registerSubtypeInterpreter(items.beeDroneGE, beeSubtypeInterpreter);
subtypeRegistry.registerSubtypeInterpreter(items.beePrincessGE, beeSubtypeInterpreter);
subtypeRegistry.registerSubtypeInterpreter(items.beeQueenGE, beeSubtypeInterpreter);
}
use of forestry.apiculture.items.ItemRegistryApiculture in project ForestryMC by ForestryMC.
the class BeeRoot method getType.
@Nullable
@Override
public EnumBeeType getType(ItemStack stack) {
Item item = stack.getItem();
ItemRegistryApiculture apicultureItems = ModuleApiculture.getItems();
if (apicultureItems.beeDroneGE == item) {
return EnumBeeType.DRONE;
} else if (apicultureItems.beePrincessGE == item) {
return EnumBeeType.PRINCESS;
} else if (apicultureItems.beeQueenGE == item) {
return EnumBeeType.QUEEN;
} else if (apicultureItems.beeLarvaeGE == item) {
return EnumBeeType.LARVAE;
}
return null;
}
use of forestry.apiculture.items.ItemRegistryApiculture in project ForestryMC by ForestryMC.
the class BeeRoot method getMemberStack.
@Override
public ItemStack getMemberStack(IIndividual individual, ISpeciesType type) {
Preconditions.checkArgument(individual instanceof IBee, "individual is not a bee");
Preconditions.checkArgument(type instanceof EnumBeeType, "type is not an EnumBeeType");
ItemRegistryApiculture apicultureItems = ModuleApiculture.getItems();
IBee bee = (IBee) individual;
Item beeItem;
switch((EnumBeeType) type) {
case QUEEN:
beeItem = apicultureItems.beeQueenGE;
// ensure a queen is always mated
if (bee.getMate() == null) {
bee.mate(bee);
}
break;
case PRINCESS:
beeItem = apicultureItems.beePrincessGE;
break;
case DRONE:
beeItem = apicultureItems.beeDroneGE;
break;
case LARVAE:
beeItem = apicultureItems.beeLarvaeGE;
break;
default:
throw new RuntimeException("Cannot instantiate a bee of type " + type);
}
NBTTagCompound nbttagcompound = new NBTTagCompound();
bee.writeToNBT(nbttagcompound);
ItemStack beeStack = new ItemStack(beeItem);
beeStack.setTagCompound(nbttagcompound);
return beeStack;
}
Aggregations