mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-17 19:15:24 +00:00
port to forestry 4.2
This commit is contained in:
1 parent
dbc5c1a564
commit
f969f63b66
3697 files changed
+78372
No files matched your search
@@ -0,0 +1,39 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import binnie.core.resource.ManagerResource;
|
||||
import binnie.core.item.ManagerItem;
|
||||
import binnie.core.machines.ManagerMachine;
|
||||
import binnie.core.liquid.ManagerLiquid;
|
||||
import binnie.core.mod.config.ManagerConfig;
|
||||
import binnie.core.genetics.ManagerGenetics;
|
||||
import binnie.core.language.ManagerLanguage;
|
||||
import binnie.core.ManagerBase;
|
||||
import java.util.List;
|
||||
|
||||
public final class Binnie
|
||||
{
|
||||
public static final List<ManagerBase> Managers;
|
||||
public static final ManagerLanguage Language;
|
||||
public static final ManagerGenetics Genetics;
|
||||
public static final ManagerConfig Configuration;
|
||||
public static final ManagerLiquid Liquid;
|
||||
public static final ManagerMachine Machine;
|
||||
public static final ManagerItem Item;
|
||||
public static final ManagerResource Resource;
|
||||
|
||||
static {
|
||||
Managers = new ArrayList<ManagerBase>();
|
||||
Language = new ManagerLanguage();
|
||||
Genetics = new ManagerGenetics();
|
||||
Configuration = new ManagerConfig();
|
||||
Liquid = new ManagerLiquid();
|
||||
Machine = new ManagerMachine();
|
||||
Item = new ManagerItem();
|
||||
Resource = new ManagerResource();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie;
|
||||
|
||||
public final class Constants
|
||||
{
|
||||
public static final String LiquidJuice = "juice";
|
||||
public static final String LiquidWater = "water";
|
||||
public static final String LiquidSeedOil = "seedoil";
|
||||
public static final String LiquidCreosote = "Creosote Oil";
|
||||
public static final String LiquidEthanol = "bioethanol";
|
||||
public static final String LiquidHoney = "for.honey";
|
||||
}
|
||||
@@ -0,0 +1,334 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany;
|
||||
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraftforge.event.entity.player.BonemealEvent;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import binnie.core.BinnieCore;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.world.BlockEvent;
|
||||
import net.minecraft.block.Block;
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
import binnie.botany.api.gardening.IBlockSoil;
|
||||
import binnie.botany.gardening.Gardening;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import binnie.botany.api.IFlower;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import binnie.botany.flower.TileEntityFlower;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import binnie.core.network.BinniePacketHandler;
|
||||
import binnie.core.proxy.IProxyCore;
|
||||
import binnie.botany.network.PacketID;
|
||||
import binnie.core.network.IPacketID;
|
||||
import binnie.botany.core.BotanyGUI;
|
||||
import binnie.core.gui.IBinnieGUID;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import binnie.botany.gardening.ModuleGardening;
|
||||
import binnie.botany.genetics.ModuleGenetics;
|
||||
import binnie.botany.core.ModuleCore;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import binnie.botany.ceramic.BlockCeramicBrick;
|
||||
import binnie.botany.ceramic.BlockStained;
|
||||
import binnie.botany.ceramic.BlockCeramicPatterned;
|
||||
import binnie.botany.ceramic.BlockCeramic;
|
||||
import binnie.botany.items.ItemClay;
|
||||
import binnie.botany.items.ItemPigment;
|
||||
import binnie.botany.flower.ItemFlower;
|
||||
import binnie.botany.genetics.ItemEncyclopedia;
|
||||
import binnie.core.item.ItemMisc;
|
||||
import binnie.botany.gardening.ItemSoilMeter;
|
||||
import binnie.botany.flower.ItemInsulatedTube;
|
||||
import binnie.botany.gardening.BlockSoil;
|
||||
import binnie.botany.gardening.ItemTrowel;
|
||||
import binnie.botany.gardening.BlockPlant;
|
||||
import binnie.botany.genetics.ItemDictionary;
|
||||
import net.minecraft.item.Item;
|
||||
import binnie.botany.flower.BlockFlower;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import binnie.botany.proxy.Proxy;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import binnie.core.AbstractMod;
|
||||
|
||||
@Mod(modid = "Botany", name = "Botany", useMetadata = true, dependencies = "after:BinnieCore")
|
||||
public class Botany extends AbstractMod
|
||||
{
|
||||
public static final float AGE_CHANCE = 0.2f;
|
||||
@Mod.Instance("Botany")
|
||||
public static Botany instance;
|
||||
@SidedProxy(clientSide = "binnie.botany.proxy.ProxyClient", serverSide = "binnie.botany.proxy.ProxyServer")
|
||||
public static Proxy proxy;
|
||||
public static BlockFlower flower;
|
||||
public static Item seed;
|
||||
public static Item pollen;
|
||||
public static ItemDictionary database;
|
||||
public static BlockPlant plant;
|
||||
public static ItemTrowel trowelWood;
|
||||
public static ItemTrowel trowelStone;
|
||||
public static ItemTrowel trowelIron;
|
||||
public static ItemTrowel trowelDiamond;
|
||||
public static ItemTrowel trowelGold;
|
||||
public static BlockSoil soil;
|
||||
public static BlockSoil loam;
|
||||
public static BlockSoil flowerbed;
|
||||
public static BlockSoil soilNoWeed;
|
||||
public static BlockSoil loamNoWeed;
|
||||
public static BlockSoil flowerbedNoWeed;
|
||||
public static ItemInsulatedTube insulatedTube;
|
||||
public static ItemSoilMeter soilMeter;
|
||||
public static ItemMisc misc;
|
||||
public static ItemEncyclopedia encyclopedia;
|
||||
public static ItemEncyclopedia encyclopediaIron;
|
||||
public static ItemFlower flowerItem;
|
||||
public static ItemPigment pigment;
|
||||
public static ItemClay clay;
|
||||
public static BlockCeramic ceramic;
|
||||
public static BlockCeramicPatterned ceramicTile;
|
||||
public static BlockStained stained;
|
||||
public static BlockCeramicBrick ceramicBrick;
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preInit(final FMLPreInitializationEvent evt) {
|
||||
this.addModule(new ModuleCore());
|
||||
this.addModule(new ModuleGenetics());
|
||||
this.addModule(new ModuleGardening());
|
||||
this.preInit();
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void init(final FMLInitializationEvent evt) {
|
||||
this.init();
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void postInit(final FMLPostInitializationEvent evt) {
|
||||
this.postInit();
|
||||
}
|
||||
|
||||
public Botany() {
|
||||
Botany.instance = this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinnieGUID[] getGUIDs() {
|
||||
return BotanyGUI.values();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?>[] getConfigs() {
|
||||
return new Class[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPacketID[] getPacketIDs() {
|
||||
return PacketID.values();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IProxyCore getProxy() {
|
||||
return Botany.proxy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getChannel() {
|
||||
return "BOT";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModID() {
|
||||
return "botany";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<? extends BinniePacketHandler> getPacketHandler() {
|
||||
return PacketHandler.class;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onShearFlower(final PlayerInteractEvent event) {
|
||||
if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
|
||||
return;
|
||||
}
|
||||
if (event.entityPlayer != null && event.entityPlayer.getHeldItem() != null && event.entityPlayer.getHeldItem().getItem() == Items.shears) {
|
||||
final TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
final TileEntityFlower flower = (TileEntityFlower) tile;
|
||||
flower.onShear();
|
||||
event.entityPlayer.getHeldItem().damageItem(1, event.entityPlayer);
|
||||
}
|
||||
}
|
||||
if (event.entityPlayer != null && event.entityPlayer.getHeldItem() != null && event.entityPlayer.getHeldItem().getItem() == Botany.pollen) {
|
||||
final TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
final TileEntityFlower flower = (TileEntityFlower) tile;
|
||||
final IFlower pollen = BotanyCore.getFlowerRoot().getMember(event.entityPlayer.getHeldItem());
|
||||
if (pollen != null && flower.canMateWith(pollen)) {
|
||||
flower.mateWith(pollen);
|
||||
if (!event.entityPlayer.capabilities.isCreativeMode) {
|
||||
final ItemStack heldItem = event.entityPlayer.getHeldItem();
|
||||
--heldItem.stackSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onFertiliseSoil(final PlayerInteractEvent event) {
|
||||
if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
|
||||
return;
|
||||
}
|
||||
if (event.world == null) {
|
||||
return;
|
||||
}
|
||||
if (event.entityPlayer != null && event.entityPlayer.getHeldItem() != null) {
|
||||
int y = event.y;
|
||||
Block block = event.world.getBlock(event.x, y, event.z);
|
||||
if (block == null || !Gardening.isSoil(block)) {
|
||||
block = event.world.getBlock(event.x, --y, event.z);
|
||||
}
|
||||
if (block == null) {
|
||||
return;
|
||||
}
|
||||
if (Gardening.isSoil(block)) {
|
||||
final IBlockSoil soil = (IBlockSoil) block;
|
||||
if (Gardening.isNutrientFertiliser(event.entityPlayer.getHeldItem()) && soil.getType(event.world, event.x, y, event.z) != EnumSoilType.FLOWERBED) {
|
||||
final EnumSoilType type = soil.getType(event.world, event.x, y, event.z);
|
||||
final int next = Math.min(type.ordinal() + Gardening.getFertiliserStrength(event.entityPlayer.getHeldItem()), 2);
|
||||
if (soil.fertilise(event.world, event.x, y, event.z, EnumSoilType.values()[next]) && !event.entityPlayer.capabilities.isCreativeMode) {
|
||||
final ItemStack heldItem = event.entityPlayer.getHeldItem();
|
||||
--heldItem.stackSize;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (Gardening.isAcidFertiliser(event.entityPlayer.getHeldItem()) && soil.getPH(event.world, event.x, y, event.z) != EnumAcidity.Acid) {
|
||||
final EnumAcidity pH = soil.getPH(event.world, event.x, y, event.z);
|
||||
final int next = Math.max(pH.ordinal() - Gardening.getFertiliserStrength(event.entityPlayer.getHeldItem()), 0);
|
||||
if (soil.setPH(event.world, event.x, y, event.z, EnumAcidity.values()[next]) && !event.entityPlayer.capabilities.isCreativeMode) {
|
||||
final ItemStack heldItem2 = event.entityPlayer.getHeldItem();
|
||||
--heldItem2.stackSize;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (Gardening.isAlkalineFertiliser(event.entityPlayer.getHeldItem()) && soil.getPH(event.world, event.x, y, event.z) != EnumAcidity.Alkaline) {
|
||||
final EnumAcidity pH = soil.getPH(event.world, event.x, y, event.z);
|
||||
final int next = Math.min(pH.ordinal() + Gardening.getFertiliserStrength(event.entityPlayer.getHeldItem()), 2);
|
||||
if (soil.setPH(event.world, event.x, y, event.z, EnumAcidity.values()[next]) && !event.entityPlayer.capabilities.isCreativeMode) {
|
||||
final ItemStack heldItem3 = event.entityPlayer.getHeldItem();
|
||||
--heldItem3.stackSize;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (Gardening.isWeedkiller(event.entityPlayer.getHeldItem()) && Gardening.addWeedKiller(event.world, event.x, y, event.z) && !event.entityPlayer.capabilities.isCreativeMode) {
|
||||
final ItemStack heldItem4 = event.entityPlayer.getHeldItem();
|
||||
--heldItem4.stackSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void plantVanilla(final BlockEvent.PlaceEvent event) {
|
||||
final World world = event.world;
|
||||
final int x = event.x;
|
||||
final int y = event.y;
|
||||
final int z = event.z;
|
||||
final Block block = world.getBlock(x, y - 1, z);
|
||||
if (!(block instanceof IBlockSoil)) {
|
||||
return;
|
||||
}
|
||||
final IFlower flower = BotanyCore.getFlowerRoot().getConversion(event.itemInHand);
|
||||
if (flower != null) {
|
||||
Gardening.plant(world, x, y, z, flower, event.player.getGameProfile());
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void onPlantVanilla(final PlayerInteractEvent event) {
|
||||
if (!BinnieCore.proxy.isSimulating(event.world)) {
|
||||
return;
|
||||
}
|
||||
if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
|
||||
return;
|
||||
}
|
||||
if (event.entityPlayer != null && event.entityPlayer.getHeldItem() != null) {
|
||||
final World world = event.world;
|
||||
final int x = event.x;
|
||||
final int y = event.y;
|
||||
final int z = event.z;
|
||||
final Block block = world.getBlock(x, y, z);
|
||||
int py = -1;
|
||||
if (block instanceof IBlockSoil && (world.isAirBlock(x, y + 1, z) || world.getBlock(x, y, z).isReplaceable(world, x, y, z))) {
|
||||
py = 1;
|
||||
}
|
||||
if (py >= 0) {
|
||||
final IFlower flower = BotanyCore.getFlowerRoot().getConversion(event.entityPlayer.getHeldItem());
|
||||
if (flower != null && Gardening.plant(world, x, y + py, z, flower, event.entityPlayer.getGameProfile()) && !event.entityPlayer.capabilities.isCreativeMode) {
|
||||
final ItemStack heldItem = event.entityPlayer.getHeldItem();
|
||||
--heldItem.stackSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onBonemeal(final BonemealEvent event) {
|
||||
final Block block = event.world.getBlock(event.x, event.y, event.z);
|
||||
if (Gardening.isSoil(block)) {
|
||||
final IBlockSoil soil = (IBlockSoil) block;
|
||||
if (soil.fertilise(event.world, event.x, event.y, event.z, EnumSoilType.LOAM)) {
|
||||
event.setResult(Event.Result.ALLOW);
|
||||
}
|
||||
}
|
||||
final TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
|
||||
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).onBonemeal()) {
|
||||
event.setResult(Event.Result.ALLOW);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return BinnieCore.isBotanyActive();
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void onIMC(final FMLInterModComms.IMCEvent event) {
|
||||
for (final FMLInterModComms.IMCMessage message : event.getMessages()) {
|
||||
if (message.key.equals("add-nutrient-fertiliser-1")) {
|
||||
ModuleGardening.queuedNutrientFertilisers.put(message.getItemStackValue(), 1);
|
||||
}
|
||||
if (message.key.equals("add-nutrient-fertiliser-2")) {
|
||||
ModuleGardening.queuedNutrientFertilisers.put(message.getItemStackValue(), 2);
|
||||
}
|
||||
if (message.key.equals("add-acid-fertiliser-1")) {
|
||||
ModuleGardening.queuedAcidFertilisers.put(message.getItemStackValue(), 1);
|
||||
}
|
||||
if (message.key.equals("add-acid-fertiliser-2")) {
|
||||
ModuleGardening.queuedAcidFertilisers.put(message.getItemStackValue(), 2);
|
||||
}
|
||||
if (message.key.equals("add-alkaline-fertiliser-1")) {
|
||||
ModuleGardening.queuedAlkalineFertilisers.put(message.getItemStackValue(), 1);
|
||||
}
|
||||
if (message.key.equals("add-alkaline-fertiliser-2")) {
|
||||
ModuleGardening.queuedAlkalineFertilisers.put(message.getItemStackValue(), 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class PacketHandler extends BinniePacketHandler
|
||||
{
|
||||
public PacketHandler() {
|
||||
super(Botany.instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
|
||||
public class CreativeTabBotany extends CreativeTabs
|
||||
{
|
||||
public static CreativeTabs instance;
|
||||
|
||||
@Override
|
||||
public ItemStack getIconItemStack() {
|
||||
return new ItemStack(Blocks.red_flower, 1, 5);
|
||||
}
|
||||
|
||||
public CreativeTabBotany() {
|
||||
super("Botany");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTranslatedTabLabel() {
|
||||
return this.getTabLabel();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getTabLabel() {
|
||||
return Botany.proxy.localise("tab.botany");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Item getTabIconItem() {
|
||||
return Item.getItemFromBlock(Blocks.yellow_flower);
|
||||
}
|
||||
|
||||
static {
|
||||
CreativeTabBotany.instance = new CreativeTabBotany();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.api;
|
||||
|
||||
public enum EnumAcidity
|
||||
{
|
||||
Acid,
|
||||
Neutral,
|
||||
Alkaline;
|
||||
|
||||
public String getID() {
|
||||
return this.name().toLowerCase();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.api;
|
||||
|
||||
import forestry.api.genetics.IAlleleFloat;
|
||||
import forestry.api.genetics.IAlleleTolerance;
|
||||
import forestry.api.genetics.IAlleleArea;
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
|
||||
public enum EnumFlowerChromosome implements IChromosomeType
|
||||
{
|
||||
SPECIES(IAlleleFlowerSpecies.class),
|
||||
PRIMARY(IAlleleInteger.class),
|
||||
SECONDARY(IAlleleInteger.class),
|
||||
FERTILITY(IAlleleInteger.class),
|
||||
TERRITORY(IAlleleArea.class),
|
||||
EFFECT(IAlleleFlowerEffect.class),
|
||||
LIFESPAN(IAlleleInteger.class),
|
||||
TEMPERATURE_TOLERANCE(IAlleleTolerance.class),
|
||||
HUMIDITY_TOLERANCE(IAlleleTolerance.class),
|
||||
PH_TOLERANCE(IAlleleTolerance.class),
|
||||
SAPPINESS(IAlleleFloat.class),
|
||||
STEM(IAlleleInteger.class);
|
||||
|
||||
private Class<? extends IAllele> cls;
|
||||
|
||||
private EnumFlowerChromosome(final Class<? extends IAllele> cls) {
|
||||
this.cls = cls;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends IAllele> getAlleleClass() {
|
||||
return this.cls;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.toString().toLowerCase();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISpeciesRoot getSpeciesRoot() {
|
||||
return AlleleManager.alleleRegistry.getSpeciesRoot("rootFlowers");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.api;
|
||||
|
||||
public enum EnumFlowerStage
|
||||
{
|
||||
FLOWER("Flower"),
|
||||
SEED("Seed"),
|
||||
POLLEN("Pollen"),
|
||||
NONE("NONE");
|
||||
|
||||
public static final EnumFlowerStage[] VALUES;
|
||||
String name;
|
||||
|
||||
private EnumFlowerStage(final String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
static {
|
||||
VALUES = values();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.api;
|
||||
|
||||
public enum EnumMoisture
|
||||
{
|
||||
Dry,
|
||||
Normal,
|
||||
Damp;
|
||||
|
||||
public String getID() {
|
||||
return this.name().toLowerCase();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.api;
|
||||
|
||||
public enum EnumSoilType
|
||||
{
|
||||
SOIL,
|
||||
LOAM,
|
||||
FLOWERBED;
|
||||
|
||||
public String getID() {
|
||||
return this.name().toLowerCase();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.api;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.api.genetics.IAlleleEffect;
|
||||
|
||||
public interface IAlleleFlowerEffect extends IAlleleEffect
|
||||
{
|
||||
IEffectData doEffect(final IFlowerGenome p0, final IEffectData p1, final World p2, final int p3, final int p4, final int p5);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.api;
|
||||
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
|
||||
public interface IAlleleFlowerSpecies extends IAlleleSpecies
|
||||
{
|
||||
IFlowerType getType();
|
||||
|
||||
EnumAcidity getPH();
|
||||
|
||||
EnumMoisture getMoisture();
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.api;
|
||||
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
|
||||
public interface IBotanistTracker extends IBreedingTracker
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.api;
|
||||
|
||||
public interface IColourMix
|
||||
{
|
||||
IFlowerColour getColour1();
|
||||
|
||||
IFlowerColour getColour2();
|
||||
|
||||
boolean isMutation(final IFlowerColour p0, final IFlowerColour p1);
|
||||
|
||||
int getChance();
|
||||
|
||||
IFlowerColour getResult();
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.api;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
|
||||
public interface IFlower extends IIndividual
|
||||
{
|
||||
@Override
|
||||
IFlowerGenome getGenome();
|
||||
|
||||
IFlowerGenome getMate();
|
||||
|
||||
void mate(final IFlower p0);
|
||||
|
||||
int getAge();
|
||||
|
||||
void age();
|
||||
|
||||
void setAge(final int p0);
|
||||
|
||||
IFlower getOffspring(final World p0);
|
||||
|
||||
int getMaxAge();
|
||||
|
||||
boolean isWilted();
|
||||
|
||||
void setWilted(final boolean p0);
|
||||
|
||||
boolean hasFlowered();
|
||||
|
||||
void setFlowered(final boolean p0);
|
||||
|
||||
void removeMate();
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.api;
|
||||
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
|
||||
public interface IFlowerColour
|
||||
{
|
||||
int getColor(final boolean p0);
|
||||
|
||||
IAlleleInteger getAllele();
|
||||
|
||||
int getID();
|
||||
|
||||
String getName();
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.api;
|
||||
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.genetics.EnumTolerance;
|
||||
import forestry.api.genetics.IGenome;
|
||||
|
||||
public interface IFlowerGenome extends IGenome
|
||||
{
|
||||
@Override
|
||||
IAlleleFlowerSpecies getPrimary();
|
||||
|
||||
@Override
|
||||
IAlleleFlowerSpecies getSecondary();
|
||||
|
||||
IFlowerColour getPrimaryColor();
|
||||
|
||||
IFlowerColour getSecondaryColor();
|
||||
|
||||
IFlowerColour getStemColor();
|
||||
|
||||
int getFertility();
|
||||
|
||||
int getLifespan();
|
||||
|
||||
IFlowerType getType();
|
||||
|
||||
EnumTolerance getToleranceTemperature();
|
||||
|
||||
EnumTolerance getToleranceMoisture();
|
||||
|
||||
EnumTolerance getTolerancePH();
|
||||
|
||||
float getAgeChance();
|
||||
|
||||
float getSappiness();
|
||||
|
||||
boolean canTolerate(final EnumAcidity p0);
|
||||
|
||||
boolean canTolerate(final EnumMoisture p0);
|
||||
|
||||
boolean canTolerate(final EnumTemperature p0);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.api;
|
||||
|
||||
import forestry.api.genetics.IGenome;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IMutation;
|
||||
|
||||
public interface IFlowerMutation extends IMutation
|
||||
{
|
||||
float getChance(final IAllele p0, final IAllele p1, final IGenome p2, final IGenome p3);
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.api;
|
||||
|
||||
import java.util.Collection;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import net.minecraft.world.World;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
|
||||
public interface IFlowerRoot extends ISpeciesRoot
|
||||
{
|
||||
@Override
|
||||
IFlower getMember(final ItemStack p0);
|
||||
|
||||
@Override
|
||||
IFlower templateAsIndividual(final IAllele[] p0);
|
||||
|
||||
@Override
|
||||
IFlower templateAsIndividual(final IAllele[] p0, final IAllele[] p1);
|
||||
|
||||
@Override
|
||||
IFlowerGenome templateAsGenome(final IAllele[] p0);
|
||||
|
||||
@Override
|
||||
IFlowerGenome templateAsGenome(final IAllele[] p0, final IAllele[] p1);
|
||||
|
||||
@Override
|
||||
IBotanistTracker getBreedingTracker(final World p0, final GameProfile p1);
|
||||
|
||||
@Override
|
||||
Collection<IFlowerMutation> getMutations(final boolean p0);
|
||||
|
||||
EnumFlowerStage getStageType(final ItemStack p0);
|
||||
|
||||
IFlower getFlower(final World p0, final IFlowerGenome p1);
|
||||
|
||||
void addConversion(final ItemStack p0, final IAllele[] p1);
|
||||
|
||||
IFlower getConversion(final ItemStack p0);
|
||||
|
||||
Collection<IColourMix> getColourMixes(final boolean p0);
|
||||
|
||||
void registerColourMix(final IColourMix p0);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.api;
|
||||
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public interface IFlowerType
|
||||
{
|
||||
IIcon getStem(final EnumFlowerStage p0, final boolean p1, final int p2);
|
||||
|
||||
IIcon getPetalIcon(final EnumFlowerStage p0, final boolean p1, final int p2);
|
||||
|
||||
IIcon getVariantIcon(final EnumFlowerStage p0, final boolean p1, final int p2);
|
||||
|
||||
int getID();
|
||||
|
||||
int getSections();
|
||||
|
||||
int ordinal();
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.api.gardening;
|
||||
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IBlockSoil
|
||||
{
|
||||
EnumAcidity getPH(final World p0, final int p1, final int p2, final int p3);
|
||||
|
||||
EnumMoisture getMoisture(final World p0, final int p1, final int p2, final int p3);
|
||||
|
||||
EnumSoilType getType(final World p0, final int p1, final int p2, final int p3);
|
||||
|
||||
boolean fertilise(final World p0, final int p1, final int p2, final int p3, final EnumSoilType p4);
|
||||
|
||||
boolean degrade(final World p0, final int p1, final int p2, final int p3, final EnumSoilType p4);
|
||||
|
||||
boolean setPH(final World p0, final int p1, final int p2, final int p3, final EnumAcidity p4);
|
||||
|
||||
boolean setMoisture(final World p0, final int p1, final int p2, final int p3, final EnumMoisture p4);
|
||||
|
||||
boolean resistsWeeds(final World p0, final int p1, final int p2, final int p3);
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.ceramic;
|
||||
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import binnie.botany.Botany;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import java.util.List;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import binnie.core.block.BlockMetadata;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import java.util.ArrayList;
|
||||
import net.minecraft.world.World;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import net.minecraft.block.material.Material;
|
||||
import binnie.core.block.IBlockMetadata;
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
public class BlockCeramic extends Block implements IBlockMetadata
|
||||
{
|
||||
public BlockCeramic() {
|
||||
super(Material.rock);
|
||||
this.setHardness(1.0f);
|
||||
this.setResistance(5.0f);
|
||||
this.setBlockName("ceramic");
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(final World world, final int x, final int y, final int z, final int blockMeta, final int fortune) {
|
||||
return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(final World world, final EntityPlayer player, final int x, final int y, final int z) {
|
||||
return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(final World var1, final int i) {
|
||||
return new TileEntityMetadata();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(final int meta) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockEventReceived(final World par1World, final int par2, final int par3, final int par4, final int par5, final int par6) {
|
||||
super.onBlockEventReceived(par1World, par2, par3, par4, par5, par6);
|
||||
final TileEntity tileentity = par1World.getTileEntity(par2, par3, par4);
|
||||
return tileentity != null && tileentity.receiveClientEvent(par5, par6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlacedMeta(final ItemStack stack, final World world, final int x, final int y, final int z, final ForgeDirection clickedBlock) {
|
||||
return TileEntityMetadata.getItemDamage(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDroppedMeta(final int blockMeta, final int tileMeta) {
|
||||
return tileMeta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName(final ItemStack par1ItemStack) {
|
||||
final int meta = TileEntityMetadata.getItemDamage(par1ItemStack);
|
||||
return EnumFlowerColor.get(meta).getName() + " Ceramic Block";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getBlockTooltip(final ItemStack par1ItemStack, final List par3List) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dropAsStack(final World world, final int x, final int y, final int z, final ItemStack drop) {
|
||||
this.dropBlockAsItem(world, x, y, z, drop);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(final Item par1, final CreativeTabs par2CreativeTabs, final List itemList) {
|
||||
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
itemList.add(TileEntityMetadata.getItemStack(this, c.ordinal()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(final IBlockAccess world, final int x, final int y, final int z, final int side) {
|
||||
final TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
return this.getIcon(side, tile.getTileMetadata());
|
||||
}
|
||||
return super.getIcon(world, x, y, z, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(final int side, final int meta) {
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(final IIconRegister register) {
|
||||
this.blockIcon = Botany.proxy.getIcon(register, "ceramic");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(final IBlockAccess world, final int x, final int y, final int z) {
|
||||
final TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
return this.getRenderColor(tile.getTileMetadata());
|
||||
}
|
||||
return 16777215;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(final World par1World, final int par2, final int par3, final int par4, final Block par5, final int par6) {
|
||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
par1World.removeTileEntity(par2, par3, par4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(final MovingObjectPosition target, final World world, final int x, final int y, final int z) {
|
||||
return BlockMetadata.getPickBlock(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderColor(final int meta) {
|
||||
return EnumFlowerColor.get(meta).getColor(false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,529 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.ceramic;
|
||||
|
||||
import binnie.botany.items.BotanyItems;
|
||||
import binnie.core.BinnieCore;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import binnie.botany.Botany;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import binnie.core.block.MultipassBlockRenderer;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import java.util.List;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import binnie.core.block.BlockMetadata;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import java.util.ArrayList;
|
||||
import net.minecraft.world.World;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import net.minecraft.block.material.Material;
|
||||
import binnie.core.block.IMultipassBlock;
|
||||
import binnie.core.block.IBlockMetadata;
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipassBlock
|
||||
{
|
||||
public BlockCeramicBrick() {
|
||||
super(Material.rock);
|
||||
this.setHardness(1.0f);
|
||||
this.setResistance(5.0f);
|
||||
this.setBlockName("ceramicBrick");
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
}
|
||||
|
||||
private static BlockType getType(final int meta) {
|
||||
return new BlockType(meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(final World world, final int x, final int y, final int z, final int blockMeta, final int fortune) {
|
||||
return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(final World world, final EntityPlayer player, final int x, final int y, final int z) {
|
||||
return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(final World var1, final int i) {
|
||||
return new TileEntityMetadata();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(final int meta) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockEventReceived(final World par1World, final int par2, final int par3, final int par4, final int par5, final int par6) {
|
||||
super.onBlockEventReceived(par1World, par2, par3, par4, par5, par6);
|
||||
final TileEntity tileentity = par1World.getTileEntity(par2, par3, par4);
|
||||
return tileentity != null && tileentity.receiveClientEvent(par5, par6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlacedMeta(final ItemStack stack, final World world, final int x, final int y, final int z, final ForgeDirection clickedBlock) {
|
||||
return TileEntityMetadata.getItemDamage(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDroppedMeta(final int blockMeta, final int tileMeta) {
|
||||
return tileMeta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName(final ItemStack par1ItemStack) {
|
||||
final int meta = TileEntityMetadata.getItemDamage(par1ItemStack);
|
||||
return getType(meta).getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getBlockTooltip(final ItemStack par1ItemStack, final List par3List) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dropAsStack(final World world, final int x, final int y, final int z, final ItemStack drop) {
|
||||
this.dropBlockAsItem(world, x, y, z, drop);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(final Item par1, final CreativeTabs par2CreativeTabs, final List itemList) {
|
||||
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
final BlockType type = new BlockType(c, c, TileType.Tile);
|
||||
itemList.add(TileEntityMetadata.getItemStack(this, type.ordinal()));
|
||||
}
|
||||
for (final TileType type2 : TileType.values()) {
|
||||
if (type2.canDouble()) {
|
||||
itemList.add(new BlockType(EnumFlowerColor.Brown, EnumFlowerColor.Gold, type2).getStack(1));
|
||||
}
|
||||
}
|
||||
itemList.add(new BlockType(EnumFlowerColor.Gold, EnumFlowerColor.Gold, TileType.Split).getStack(1));
|
||||
itemList.add(new BlockType(EnumFlowerColor.Brown, EnumFlowerColor.Brown, TileType.Chequered).getStack(1));
|
||||
itemList.add(new BlockType(EnumFlowerColor.Gold, EnumFlowerColor.Brown, TileType.LargeBrick).getStack(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(final IBlockAccess world, final int x, final int y, final int z, final int side) {
|
||||
final TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
return this.getIcon(side, tile.getTileMetadata());
|
||||
}
|
||||
return super.getIcon(world, x, y, z, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(final int side, final int meta) {
|
||||
return getType(meta).getIcon(MultipassBlockRenderer.getLayer());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(final IIconRegister register) {
|
||||
for (final TileType type : TileType.values()) {
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
type.icons[i] = Botany.proxy.getIcon(register, "ceramic." + type.id + "." + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(final IBlockAccess world, final int x, final int y, final int z) {
|
||||
final TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
return this.getRenderColor(tile.getTileMetadata());
|
||||
}
|
||||
return 16777215;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(final World par1World, final int par2, final int par3, final int par4, final Block par5, final int par6) {
|
||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
par1World.removeTileEntity(par2, par3, par4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(final MovingObjectPosition target, final World world, final int x, final int y, final int z) {
|
||||
return BlockMetadata.getPickBlock(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderColor(final int meta) {
|
||||
return this.colorMultiplier(meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNumberOfPasses() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int colorMultiplier(final int meta) {
|
||||
final BlockType type = getType(meta);
|
||||
if (MultipassBlockRenderer.getLayer() == 0) {
|
||||
return 16777215;
|
||||
}
|
||||
if (MultipassBlockRenderer.getLayer() == 1) {
|
||||
return type.color1.getColor(false);
|
||||
}
|
||||
return type.color2.getColor(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return BinnieCore.multipassRenderID;
|
||||
}
|
||||
|
||||
public enum TileType
|
||||
{
|
||||
Tile("tile", "Ceramic Tile"),
|
||||
Brick("brick", "Ceramic Bricks"),
|
||||
StripeBrick("brickstripe", "Striped Ceramic Bricks"),
|
||||
LargeBrick("bricklarge", "Large Ceramic Bricks"),
|
||||
Split("split", "Split Ceramic Tile"),
|
||||
Chequered("cheque", "Chequered Ceramic Tile"),
|
||||
Mixed("mixed", "Mixed Ceramic Tile"),
|
||||
VerticalBrick("verticalbrick", "Vertical Ceramic Bricks"),
|
||||
VerticalStripeBrick("verticalbrickstripe", "Vertical Striped Ceramic Bricks"),
|
||||
VerticalLargeBrick("verticalbricklarge", "Large Vertical Ceramic Bricks");
|
||||
|
||||
String id;
|
||||
String name;
|
||||
IIcon[] icons;
|
||||
|
||||
private TileType(final String id, final String name) {
|
||||
this.icons = new IIcon[3];
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public static TileType get(final int id) {
|
||||
return values()[id % values().length];
|
||||
}
|
||||
|
||||
public boolean canDouble() {
|
||||
return this != TileType.Tile;
|
||||
}
|
||||
|
||||
public ItemStack getRecipe(final List<ItemStack> stacks) {
|
||||
switch (this) {
|
||||
case Tile: {
|
||||
if (stacks.size() != 4) {
|
||||
return null;
|
||||
}
|
||||
int mortars = 0;
|
||||
int blocks = 0;
|
||||
int blockColor = -1;
|
||||
for (final ItemStack stack : stacks) {
|
||||
if (this.isMortar(stack)) {
|
||||
++mortars;
|
||||
}
|
||||
else {
|
||||
if (stack.getItem() != Item.getItemFromBlock(Botany.ceramic)) {
|
||||
return null;
|
||||
}
|
||||
++blocks;
|
||||
final int color = TileEntityMetadata.getItemDamage(stack);
|
||||
if (blockColor == -1) {
|
||||
blockColor = color;
|
||||
}
|
||||
else {
|
||||
if (blockColor != color) {
|
||||
return null;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mortars != 1) {
|
||||
return null;
|
||||
}
|
||||
final EnumFlowerColor c = EnumFlowerColor.get(blockColor);
|
||||
return new BlockType(c, c, TileType.Tile).getStack(3);
|
||||
}
|
||||
case Split: {
|
||||
if (stacks.size() != 4) {
|
||||
return null;
|
||||
}
|
||||
final int[] colors = { -1, -1 };
|
||||
int altCounter = 0;
|
||||
for (final ItemStack stack2 : stacks) {
|
||||
final int alt = (altCounter != 0 && altCounter != 3) ? 1 : 0;
|
||||
if (stack2.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) {
|
||||
return null;
|
||||
}
|
||||
final BlockType type = new BlockType(stack2);
|
||||
if (type.type != TileType.Tile) {
|
||||
return null;
|
||||
}
|
||||
final int color2 = type.color1.ordinal();
|
||||
if (colors[alt] == -1) {
|
||||
colors[alt] = color2;
|
||||
}
|
||||
else if (colors[alt] != color2) {
|
||||
return null;
|
||||
}
|
||||
++altCounter;
|
||||
}
|
||||
return new BlockType(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), TileType.Split).getStack(4);
|
||||
}
|
||||
case Chequered: {
|
||||
if (stacks.size() != 4) {
|
||||
return null;
|
||||
}
|
||||
final int[] colors = { -1, -1 };
|
||||
for (final ItemStack stack2 : stacks) {
|
||||
if (stack2.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) {
|
||||
return null;
|
||||
}
|
||||
final BlockType type2 = new BlockType(stack2);
|
||||
if (type2.type != TileType.Split) {
|
||||
return null;
|
||||
}
|
||||
final int color3 = type2.color1.ordinal();
|
||||
final int color4 = type2.color2.ordinal();
|
||||
if (colors[0] == -1) {
|
||||
colors[0] = color3;
|
||||
colors[1] = color4;
|
||||
}
|
||||
else {
|
||||
if (colors[0] != color3 || colors[1] != color4) {
|
||||
return null;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return new BlockType(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), TileType.Chequered).getStack(4);
|
||||
}
|
||||
case Mixed: {
|
||||
if (stacks.size() != 4) {
|
||||
return null;
|
||||
}
|
||||
final int[] colors = { -1, -1 };
|
||||
for (int index = 0; index < stacks.size(); ++index) {
|
||||
final ItemStack stack2 = stacks.get(index);
|
||||
if (stack2.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) {
|
||||
return null;
|
||||
}
|
||||
final BlockType type2 = new BlockType(stack2);
|
||||
if (type2.isTwoColors()) {
|
||||
return null;
|
||||
}
|
||||
final int color3 = type2.color1.ordinal();
|
||||
if (type2.type == TileType.Split) {
|
||||
if (colors[1] != -1) {
|
||||
return null;
|
||||
}
|
||||
colors[1] = color3;
|
||||
}
|
||||
else {
|
||||
if (type2.type != TileType.Chequered) {
|
||||
return null;
|
||||
}
|
||||
if (colors[0] == -1) {
|
||||
colors[0] = color3;
|
||||
}
|
||||
else if (colors[0] != color3) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
final int color4 = type2.color2.ordinal();
|
||||
}
|
||||
if (colors[0] == -1 || colors[1] == -1) {
|
||||
return null;
|
||||
}
|
||||
return new BlockType(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), TileType.Mixed).getStack(4);
|
||||
}
|
||||
case LargeBrick: {
|
||||
if (stacks.size() == 1) {
|
||||
final ItemStack stack3 = stacks.get(0);
|
||||
final BlockType type3 = new BlockType(stack3);
|
||||
if (type3.type == TileType.VerticalLargeBrick) {
|
||||
type3.type = this;
|
||||
return type3.getStack(1);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
if (stacks.size() != 3) {
|
||||
return null;
|
||||
}
|
||||
final int[] colors = { -1, -1 };
|
||||
int a = 0;
|
||||
int b = 0;
|
||||
for (int index2 = 0; index2 < stacks.size(); ++index2) {
|
||||
final ItemStack stack4 = stacks.get(index2);
|
||||
if (stack4.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) {
|
||||
return null;
|
||||
}
|
||||
final BlockType type4 = new BlockType(stack4);
|
||||
if (type4.type != TileType.Tile) {
|
||||
return null;
|
||||
}
|
||||
final int color5 = type4.color1.ordinal();
|
||||
if (colors[0] == -1) {
|
||||
colors[0] = color5;
|
||||
++a;
|
||||
}
|
||||
else if (colors[0] == color5) {
|
||||
++a;
|
||||
}
|
||||
else if (colors[1] == -1) {
|
||||
colors[1] = color5;
|
||||
++b;
|
||||
}
|
||||
else {
|
||||
if (colors[1] != color5) {
|
||||
return null;
|
||||
}
|
||||
++b;
|
||||
}
|
||||
}
|
||||
if (colors[1] == -1) {
|
||||
colors[1] = colors[0];
|
||||
}
|
||||
return new BlockType(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), TileType.LargeBrick).getStack(3);
|
||||
}
|
||||
}
|
||||
case Brick:
|
||||
case StripeBrick: {
|
||||
if (stacks.size() == 1) {
|
||||
final ItemStack stack5 = stacks.get(0);
|
||||
final BlockType type = new BlockType(stack5);
|
||||
if (type.type == TileType.VerticalBrick) {
|
||||
type.type = this;
|
||||
return type.getStack(1);
|
||||
}
|
||||
if (type.type == TileType.StripeBrick) {
|
||||
type.type = this;
|
||||
return type.getStack(1);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
if (stacks.size() != 4) {
|
||||
return null;
|
||||
}
|
||||
final int[] colors = { -1, -1 };
|
||||
for (int index2 = 0; index2 < stacks.size(); ++index2) {
|
||||
final ItemStack stack4 = stacks.get(index2);
|
||||
if (stack4.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) {
|
||||
return null;
|
||||
}
|
||||
final BlockType type4 = new BlockType(stack4);
|
||||
if (type4.type != TileType.LargeBrick) {
|
||||
return null;
|
||||
}
|
||||
final int color5 = type4.color1.ordinal();
|
||||
final int color6 = type4.color2.ordinal();
|
||||
int alt2 = (index2 != 0 && index2 != 3) ? 1 : 0;
|
||||
if (this == TileType.StripeBrick) {
|
||||
alt2 = 0;
|
||||
}
|
||||
if (colors[alt2] == -1) {
|
||||
colors[alt2] = color5;
|
||||
colors[1 - alt2] = color6;
|
||||
}
|
||||
else if (colors[alt2] != color5 || colors[1 - alt2] != color6) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return new BlockType(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), this).getStack(4);
|
||||
}
|
||||
}
|
||||
case VerticalLargeBrick:
|
||||
case VerticalBrick:
|
||||
case VerticalStripeBrick: {
|
||||
if (stacks.size() != 1) {
|
||||
return null;
|
||||
}
|
||||
final ItemStack stack5 = stacks.get(0);
|
||||
final BlockType type = new BlockType(stack5);
|
||||
if (type.type == TileType.LargeBrick) {
|
||||
type.type = TileType.VerticalLargeBrick;
|
||||
return type.getStack(1);
|
||||
}
|
||||
if (type.type == TileType.Brick) {
|
||||
type.type = TileType.VerticalBrick;
|
||||
return type.getStack(1);
|
||||
}
|
||||
if (type.type == TileType.StripeBrick) {
|
||||
type.type = TileType.VerticalStripeBrick;
|
||||
return type.getStack(1);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
default: {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isMortar(final ItemStack stack) {
|
||||
return stack.getItem() == Botany.misc && stack.getItemDamage() == BotanyItems.Mortar.ordinal();
|
||||
}
|
||||
}
|
||||
|
||||
public static class BlockType
|
||||
{
|
||||
EnumFlowerColor color1;
|
||||
EnumFlowerColor color2;
|
||||
TileType type;
|
||||
|
||||
private BlockType(final EnumFlowerColor color1, final EnumFlowerColor color2, final TileType type) {
|
||||
this.color1 = color1;
|
||||
this.color2 = color2;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public boolean isTwoColors() {
|
||||
return this.type.canDouble() && this.color2 != this.color1;
|
||||
}
|
||||
|
||||
public BlockType(final ItemStack stack) {
|
||||
this(TileEntityMetadata.getItemDamage(stack));
|
||||
}
|
||||
|
||||
public ItemStack getStack(final int i) {
|
||||
final ItemStack s = TileEntityMetadata.getItemStack(Botany.ceramicBrick, this.ordinal());
|
||||
s.stackSize = i;
|
||||
return s;
|
||||
}
|
||||
|
||||
public BlockType(final int id) {
|
||||
this.color1 = EnumFlowerColor.get(id & 0xFF);
|
||||
this.color2 = EnumFlowerColor.get(id >> 8 & 0xFF);
|
||||
this.type = TileType.get(id >> 16 & 0xFF);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
String name = this.color1.getName();
|
||||
if (this.type.canDouble() && this.color2 != this.color1) {
|
||||
name = name + " & " + this.color2.getName();
|
||||
}
|
||||
return name + " " + this.type.name;
|
||||
}
|
||||
|
||||
public int ordinal() {
|
||||
return this.color1.ordinal() + this.color2.ordinal() * 256 + this.type.ordinal() * 256 * 256;
|
||||
}
|
||||
|
||||
public IIcon getIcon(final int layer) {
|
||||
return this.type.icons[layer];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.ceramic;
|
||||
|
||||
import binnie.extratrees.carpentry.DesignBlock;
|
||||
import binnie.extratrees.carpentry.ModuleCarpentry;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import binnie.extratrees.api.IDesign;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import net.minecraft.block.material.Material;
|
||||
import binnie.extratrees.carpentry.BlockDesign;
|
||||
|
||||
public class BlockCeramicPatterned extends BlockDesign
|
||||
{
|
||||
public BlockCeramicPatterned() {
|
||||
super(CeramicDesignSystem.instance, Material.rock);
|
||||
this.setHardness(1.0f);
|
||||
this.setResistance(5.0f);
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
this.setBlockName("ceramicPattern");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCreativeStack(final IDesign design) {
|
||||
return ModuleCarpentry.getItemStack(this, CeramicColor.get(EnumFlowerColor.White), CeramicColor.get(EnumFlowerColor.Black), design);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName(final DesignBlock design) {
|
||||
return design.getDesign().getName() + " Ceramic Block";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,197 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.ceramic;
|
||||
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import binnie.botany.Botany;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import java.util.List;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import binnie.core.block.BlockMetadata;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import java.util.ArrayList;
|
||||
import net.minecraft.world.World;
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
import net.minecraft.util.Facing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.Random;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import net.minecraft.block.material.Material;
|
||||
import binnie.core.block.IBlockMetadata;
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
public class BlockStained extends Block implements IBlockMetadata
|
||||
{
|
||||
public BlockStained() {
|
||||
super(Material.glass);
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
this.setBlockName("stained");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(final Random p_149745_1_) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderBlockPass() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(final IBlockAccess p_149646_1_, final int p_149646_2_, final int p_149646_3_, final int p_149646_4_, final int p_149646_5_) {
|
||||
final Block block2 = p_149646_1_.getBlock(p_149646_2_ - Facing.offsetsXForSide[p_149646_5_], p_149646_3_ - Facing.offsetsYForSide[p_149646_5_], p_149646_4_ - Facing.offsetsZForSide[p_149646_5_]);
|
||||
final Block block3 = p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_);
|
||||
return block3 != this && block3 != ExtraTrees.blockStained && super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(final World world, final int x, final int y, final int z, final int blockMeta, final int fortune) {
|
||||
return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(final World world, final EntityPlayer player, final int x, final int y, final int z) {
|
||||
return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(final World var1, final int i) {
|
||||
return new TileEntityMetadata();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(final int meta) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockEventReceived(final World par1World, final int par2, final int par3, final int par4, final int par5, final int par6) {
|
||||
super.onBlockEventReceived(par1World, par2, par3, par4, par5, par6);
|
||||
final TileEntity tileentity = par1World.getTileEntity(par2, par3, par4);
|
||||
return tileentity != null && tileentity.receiveClientEvent(par5, par6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlacedMeta(final ItemStack stack, final World world, final int x, final int y, final int z, final ForgeDirection clickedBlock) {
|
||||
return TileEntityMetadata.getItemDamage(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDroppedMeta(final int blockMeta, final int tileMeta) {
|
||||
return tileMeta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName(final ItemStack par1ItemStack) {
|
||||
final int meta = TileEntityMetadata.getItemDamage(par1ItemStack);
|
||||
return EnumFlowerColor.get(meta).getName() + " Pigmented Glass";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getBlockTooltip(final ItemStack par1ItemStack, final List par3List) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dropAsStack(final World world, final int x, final int y, final int z, final ItemStack drop) {
|
||||
this.dropBlockAsItem(world, x, y, z, drop);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(final Item par1, final CreativeTabs par2CreativeTabs, final List itemList) {
|
||||
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
itemList.add(TileEntityMetadata.getItemStack(this, c.ordinal()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(final IBlockAccess world, final int x, final int y, final int z, final int side) {
|
||||
final TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
return this.getIcon(side, tile.getTileMetadata());
|
||||
}
|
||||
return super.getIcon(world, x, y, z, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(final int side, final int meta) {
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(final IIconRegister register) {
|
||||
this.blockIcon = Botany.proxy.getIcon(register, "stained");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(final IBlockAccess world, final int x, final int y, final int z) {
|
||||
final TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
return this.getRenderColor(tile.getTileMetadata());
|
||||
}
|
||||
return 16777215;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(final World par1World, final int par2, final int par3, final int par4, final Block par5, final int par6) {
|
||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
par1World.removeTileEntity(par2, par3, par4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWood(final IBlockAccess world, final int x, final int y, final int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFlammability(final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection face) {
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFlammable(final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection face) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFireSpreadSpeed(final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection face) {
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(final MovingObjectPosition target, final World world, final int x, final int y, final int z) {
|
||||
return BlockMetadata.getPickBlock(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderColor(final int meta) {
|
||||
return EnumFlowerColor.get(meta).getColor(false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.ceramic;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import binnie.botany.Botany;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import java.util.Map;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.extratrees.api.IDesignMaterial;
|
||||
|
||||
public class CeramicColor implements IDesignMaterial
|
||||
{
|
||||
EnumFlowerColor color;
|
||||
static Map<EnumFlowerColor, CeramicColor> map;
|
||||
|
||||
CeramicColor(final EnumFlowerColor color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public static CeramicColor get(final EnumFlowerColor c) {
|
||||
return CeramicColor.map.get(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStack() {
|
||||
return TileEntityMetadata.getItemStack(Botany.ceramic, this.color.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.color.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColour() {
|
||||
return this.color.getColor(false);
|
||||
}
|
||||
|
||||
static {
|
||||
CeramicColor.map = new LinkedHashMap<EnumFlowerColor, CeramicColor>();
|
||||
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
CeramicColor.map.put(c, new CeramicColor(c));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.ceramic;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import binnie.botany.items.BotanyItems;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import binnie.botany.Botany;
|
||||
import binnie.core.AbstractMod;
|
||||
import binnie.core.BinnieCore;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import binnie.extratrees.carpentry.EnumPattern;
|
||||
import binnie.extratrees.api.IPattern;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.extratrees.api.IDesignMaterial;
|
||||
import binnie.extratrees.carpentry.DesignerManager;
|
||||
import java.util.HashMap;
|
||||
import net.minecraft.util.IIcon;
|
||||
import java.util.Map;
|
||||
import binnie.extratrees.api.IDesignSystem;
|
||||
|
||||
public class CeramicDesignSystem implements IDesignSystem
|
||||
{
|
||||
public static CeramicDesignSystem instance;
|
||||
Map<Integer, IIcon> primary;
|
||||
Map<Integer, IIcon> secondary;
|
||||
|
||||
CeramicDesignSystem() {
|
||||
this.primary = new HashMap<Integer, IIcon>();
|
||||
this.secondary = new HashMap<Integer, IIcon>();
|
||||
DesignerManager.instance.registerDesignSystem(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDesignMaterial getDefaultMaterial() {
|
||||
return CeramicColor.get(EnumFlowerColor.White);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDesignMaterial getDefaultMaterial2() {
|
||||
return CeramicColor.get(EnumFlowerColor.Black);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDesignMaterial getMaterial(final int id) {
|
||||
return CeramicColor.get(EnumFlowerColor.get(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaterialIndex(final IDesignMaterial id) {
|
||||
return ((CeramicColor) id).color.ordinal();
|
||||
}
|
||||
|
||||
public String getTexturePath() {
|
||||
return "ceramic";
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getPrimaryIcon(final IPattern pattern) {
|
||||
if (pattern instanceof EnumPattern) {
|
||||
return this.primary.get(((EnumPattern) pattern).ordinal());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getSecondaryIcon(final IPattern pattern) {
|
||||
if (pattern instanceof EnumPattern) {
|
||||
return this.secondary.get(((EnumPattern) pattern).ordinal());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(final IIconRegister register) {
|
||||
for (final EnumPattern pattern : EnumPattern.values()) {
|
||||
this.primary.put(pattern.ordinal(), BinnieCore.proxy.getIcon(register, this.getMod().getModID(), this.getTexturePath() + "/" + pattern.toString().toLowerCase() + ".0"));
|
||||
this.secondary.put(pattern.ordinal(), BinnieCore.proxy.getIcon(register, this.getMod().getModID(), this.getTexturePath() + "/" + pattern.toString().toLowerCase() + ".1"));
|
||||
}
|
||||
}
|
||||
|
||||
public AbstractMod getMod() {
|
||||
return Botany.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getAdhesive() {
|
||||
return BotanyItems.Mortar.get(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDesignMaterial getMaterial(final ItemStack itemStack) {
|
||||
return (itemStack.getItem() == Item.getItemFromBlock(Botany.ceramic)) ? this.getMaterial(itemStack.getItemDamage()) : null;
|
||||
}
|
||||
|
||||
static {
|
||||
CeramicDesignSystem.instance = new CeramicDesignSystem();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.ceramic;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import binnie.botany.Botany;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
|
||||
public class CeramicTileRecipe implements IRecipe
|
||||
{
|
||||
ItemStack cached;
|
||||
|
||||
@Override
|
||||
public boolean matches(final InventoryCrafting inv, final World world) {
|
||||
this.cached = this.getCraftingResult(inv);
|
||||
return this.cached != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult(final InventoryCrafting inv) {
|
||||
final Item ceramicBlock = Item.getItemFromBlock(Botany.ceramic);
|
||||
final Item ceramicTile = Item.getItemFromBlock(Botany.ceramicTile);
|
||||
final Item ceramicBrick = Item.getItemFromBlock(Botany.ceramicBrick);
|
||||
final Item mortar = Botany.misc;
|
||||
final List<ItemStack> stacks = new ArrayList<ItemStack>();
|
||||
int ix = -1;
|
||||
int iy = -1;
|
||||
for (int i = 0; i < inv.getSizeInventory(); ++i) {
|
||||
final ItemStack stack = inv.getStackInSlot(i);
|
||||
if (stack != null) {
|
||||
final int x = i / 3;
|
||||
final int y = i % 3;
|
||||
if (ix == -1) {
|
||||
ix = x;
|
||||
iy = y;
|
||||
}
|
||||
if (x - ix >= 2 || y - iy >= 2 || y < iy || x < ix) {
|
||||
return null;
|
||||
}
|
||||
if (stack.getItem() != ceramicBlock && stack.getItem() != ceramicTile && stack.getItem() != ceramicBrick && stack.getItem() != mortar) {
|
||||
return null;
|
||||
}
|
||||
stacks.add(stack);
|
||||
}
|
||||
}
|
||||
for (final BlockCeramicBrick.TileType type : BlockCeramicBrick.TileType.values()) {
|
||||
final ItemStack stack2 = type.getRecipe(stacks);
|
||||
if (stack2 != null) {
|
||||
return stack2;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRecipeSize() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRecipeOutput() {
|
||||
return this.cached;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.ceramic;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.block.Block;
|
||||
import binnie.core.block.ItemMetadata;
|
||||
|
||||
public class ItemCeramic extends ItemMetadata
|
||||
{
|
||||
public ItemCeramic(final Block block) {
|
||||
super(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(final ItemStack stack, final int p_82790_2_) {
|
||||
return 16711935;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.ceramic;
|
||||
|
||||
import binnie.botany.api.IFlower;
|
||||
import net.minecraft.item.Item;
|
||||
import binnie.botany.Botany;
|
||||
import binnie.Binnie;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
|
||||
public class PigmentRecipe implements IRecipe
|
||||
{
|
||||
private final ItemStack unknown;
|
||||
ItemStack cached;
|
||||
|
||||
public PigmentRecipe() {
|
||||
this.unknown = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(final InventoryCrafting crafting, final World world) {
|
||||
return this.getCraftingResult(crafting) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRecipeOutput() {
|
||||
if (this.cached != null) {
|
||||
return this.cached;
|
||||
}
|
||||
return this.unknown;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult(final InventoryCrafting crafting) {
|
||||
int n = 0;
|
||||
ItemStack stack = null;
|
||||
for (int i = 0; i < crafting.getSizeInventory(); ++i) {
|
||||
if (crafting.getStackInSlot(i) != null) {
|
||||
if (++n > 1) {
|
||||
return null;
|
||||
}
|
||||
if (Binnie.Genetics.getFlowerRoot().isMember(crafting.getStackInSlot(i))) {
|
||||
final IFlower flower = Binnie.Genetics.getFlowerRoot().getMember(crafting.getStackInSlot(i));
|
||||
if (flower.getAge() >= 1) {
|
||||
stack = new ItemStack(Botany.pigment, 1, flower.getGenome().getPrimaryColor().getID());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRecipeSize() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.core;
|
||||
|
||||
import binnie.botany.genetics.FlowerHelper;
|
||||
import binnie.botany.api.IFlowerRoot;
|
||||
|
||||
public class BotanyCore
|
||||
{
|
||||
public static final int CHANCE_INTERPOLLINATION = 20;
|
||||
public static IFlowerRoot speciesRoot;
|
||||
|
||||
public static IFlowerRoot getFlowerRoot() {
|
||||
return BotanyCore.speciesRoot;
|
||||
}
|
||||
|
||||
static {
|
||||
BotanyCore.speciesRoot = new FlowerHelper();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.core;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import binnie.craftgui.botany.WindowBotanistDatabase;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import binnie.craftgui.minecraft.Window;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import binnie.core.gui.IBinnieGUID;
|
||||
|
||||
public enum BotanyGUI implements IBinnieGUID
|
||||
{
|
||||
Database,
|
||||
DatabaseNEI;
|
||||
|
||||
@Override
|
||||
public Window getWindow(final EntityPlayer player, final World world, final int x, final int y, final int z, final Side side) {
|
||||
Window window = null;
|
||||
final TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
IInventory object = null;
|
||||
if (tileEntity instanceof IInventory) {
|
||||
object = (IInventory) tileEntity;
|
||||
}
|
||||
switch (this) {
|
||||
case Database:
|
||||
case DatabaseNEI: {
|
||||
window = WindowBotanistDatabase.create(player, side, this != BotanyGUI.Database);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return window;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.core;
|
||||
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import binnie.Binnie;
|
||||
import binnie.core.resource.BinnieResource;
|
||||
import binnie.core.resource.ResourceType;
|
||||
import binnie.core.resource.IBinnieTexture;
|
||||
|
||||
public enum BotanyTexture implements IBinnieTexture
|
||||
{
|
||||
;
|
||||
String texture;
|
||||
ResourceType type;
|
||||
|
||||
private BotanyTexture(final ResourceType base, final String texture) {
|
||||
this.texture = texture;
|
||||
this.type = base;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BinnieResource getTexture() {
|
||||
return Binnie.Resource.getPNG(ExtraBees.instance, this.type, this.texture);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.core;
|
||||
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import binnie.botany.Botany;
|
||||
import binnie.Binnie;
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import binnie.core.IInitializable;
|
||||
|
||||
public class ModuleCore implements IInitializable
|
||||
{
|
||||
@Override
|
||||
public void preInit() {
|
||||
for (final EnumAcidity pH : EnumAcidity.values()) {
|
||||
Binnie.Language.addObjectName(pH, Binnie.Language.unlocalised(Botany.instance, "ph." + pH.getID()));
|
||||
}
|
||||
for (final EnumMoisture pH2 : EnumMoisture.values()) {
|
||||
Binnie.Language.addObjectName(pH2, Binnie.Language.unlocalised(Botany.instance, "moisture." + pH2.getID()));
|
||||
}
|
||||
for (final EnumSoilType pH3 : EnumSoilType.values()) {
|
||||
Binnie.Language.addObjectName(pH3, Binnie.Language.unlocalised(Botany.instance, "soil." + pH3.getID()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.farm;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.circuits.ChipsetManager;
|
||||
import forestry.api.farming.FarmDirection;
|
||||
import forestry.api.farming.IFarmHousing;
|
||||
import forestry.api.farming.IFarmLogic;
|
||||
import binnie.Binnie;
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import binnie.core.circuits.BinnieCircuit;
|
||||
|
||||
public class CircuitGarden extends BinnieCircuit
|
||||
{
|
||||
private Class<? extends FarmLogic> logicClass;
|
||||
private boolean isManual;
|
||||
private boolean isFertilised;
|
||||
private ItemStack icon;
|
||||
private EnumMoisture moisture;
|
||||
private EnumAcidity acidity;
|
||||
|
||||
public CircuitGarden(final EnumMoisture moisture, final EnumAcidity ph, final boolean manual, final boolean fertilised, final ItemStack recipe, final ItemStack icon) {
|
||||
super("garden." + moisture.getID() + ((ph != null) ? ("." + ph.getID()) : "") + (manual ? ".manual" : "") + (fertilised ? ".fert" : ""), 4, manual ? ChipsetManager.circuitRegistry.getLayout("forestry.farms.manual") : ChipsetManager.circuitRegistry.getLayout("forestry.farms.managed"), recipe);
|
||||
this.isManual = false;
|
||||
this.isFertilised = false;
|
||||
this.isManual = manual;
|
||||
this.isFertilised = fertilised;
|
||||
this.moisture = moisture;
|
||||
this.acidity = ph;
|
||||
this.icon = icon;
|
||||
String info = "";
|
||||
if (moisture == EnumMoisture.Dry) {
|
||||
info += "§eDry§f";
|
||||
}
|
||||
if (moisture == EnumMoisture.Damp) {
|
||||
info += "§9Damp§f";
|
||||
}
|
||||
if (this.acidity == EnumAcidity.Acid) {
|
||||
if (info.length() > 0) {
|
||||
info += ", ";
|
||||
}
|
||||
info += "§cAcidic§f";
|
||||
}
|
||||
if (this.acidity == EnumAcidity.Neutral) {
|
||||
if (info.length() > 0) {
|
||||
info += ", ";
|
||||
}
|
||||
info += "§aNeutral§f";
|
||||
}
|
||||
if (this.acidity == EnumAcidity.Alkaline) {
|
||||
if (info.length() > 0) {
|
||||
info += ", ";
|
||||
}
|
||||
info += "§bAlkaline§f";
|
||||
}
|
||||
if (info.length() > 0) {
|
||||
info = " (" + info + "§f)";
|
||||
}
|
||||
this.addTooltipString("Flowers" + info);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCircuitable(Object tile) {
|
||||
return tile instanceof IFarmHousing;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInsertion(int slot, Object tile) {
|
||||
if (!this.isCircuitable(tile)) {
|
||||
return;
|
||||
}
|
||||
final GardenLogic logic = new GardenLogic((IFarmHousing) tile);
|
||||
logic.setData(this.moisture, this.acidity, this.isManual, this.isFertilised, this.icon, Binnie.Language.localise(this.getName()));
|
||||
((IFarmHousing) tile).setFarmLogic(FarmDirection.values()[slot], logic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad(int slot, Object tile) {
|
||||
this.onInsertion(slot, tile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemoval(int slot, Object tile) {
|
||||
if (!this.isCircuitable(tile)) {
|
||||
return;
|
||||
}
|
||||
((IFarmHousing) tile).resetFarmLogic(FarmDirection.values()[slot]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(int arg0, Object arg1) {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.farm;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
|
||||
import forestry.api.farming.FarmDirection;
|
||||
import forestry.api.farming.IFarmHousing;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.farming.IFarmLogic;
|
||||
|
||||
public abstract class FarmLogic implements IFarmLogic
|
||||
{
|
||||
World world;
|
||||
IFarmHousing housing;
|
||||
boolean isManual;
|
||||
|
||||
public FarmLogic(final IFarmHousing housing) {
|
||||
this.housing = housing;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFarmLogic setManual(final boolean flag) {
|
||||
this.isManual = flag;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected final boolean isAirBlock(final Vect position) {
|
||||
return this.world.isAirBlock(position.x, position.y, position.z);
|
||||
}
|
||||
|
||||
protected final boolean isWaterBlock(final Vect position) {
|
||||
return this.world.getBlock(position.x, position.y, position.z) == Blocks.water;
|
||||
}
|
||||
|
||||
protected final Block getBlock(final Vect position) {
|
||||
return this.world.getBlock(position.x, position.y, position.z);
|
||||
}
|
||||
|
||||
protected final int getBlockMeta(final Vect position) {
|
||||
return this.world.getBlockMetadata(position.x, position.y, position.z);
|
||||
}
|
||||
|
||||
protected final ItemStack getAsItemStack(final Vect position) {
|
||||
return new ItemStack(this.getBlock(position), 1, this.getBlockMeta(position));
|
||||
}
|
||||
|
||||
protected final Vect translateWithOffset(final int x, final int y, final int z, final FarmDirection direction, final int step) {
|
||||
return new Vect(x + direction.getForgeDirection().offsetX * step, y + direction.getForgeDirection().offsetY * step, z + direction.getForgeDirection().offsetZ * step);
|
||||
}
|
||||
|
||||
protected final void setBlock(final Vect position, final Block block, final int meta) {
|
||||
this.world.setBlock(position.x, position.y, position.z, block, meta, 2);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.farm;
|
||||
|
||||
import binnie.botany.api.IFlower;
|
||||
import binnie.botany.gardening.Gardening;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import binnie.botany.api.EnumFlowerStage;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import forestry.api.farming.ICrop;
|
||||
import binnie.botany.Botany;
|
||||
import net.minecraft.world.World;
|
||||
import forestry.api.farming.IFarmable;
|
||||
|
||||
public class FarmableFlower implements IFarmable
|
||||
{
|
||||
@Override
|
||||
public boolean isSaplingAt(final World world, final int x, final int y, final int z) {
|
||||
return world.getBlock(x, y, z) == Botany.flower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICrop getCropAt(final World world, final int x, final int y, final int z) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGermling(final ItemStack itemstack) {
|
||||
final EnumFlowerStage stage = BotanyCore.speciesRoot.getStageType(itemstack);
|
||||
return stage == EnumFlowerStage.FLOWER || stage == EnumFlowerStage.SEED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWindfall(final ItemStack itemstack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean plantSaplingAt(final EntityPlayer player, final ItemStack germling, final World world, final int x, final int y, final int z) {
|
||||
final IFlower flower = BotanyCore.getFlowerRoot().getMember(germling);
|
||||
Gardening.plant(world, x, y, z, flower, player.getGameProfile());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.farm;
|
||||
|
||||
import binnie.botany.api.IFlower;
|
||||
import binnie.botany.gardening.Gardening;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class FarmableVanillaFlower extends FarmableFlower
|
||||
{
|
||||
@Override
|
||||
public boolean isGermling(final ItemStack itemstack) {
|
||||
return BotanyCore.getFlowerRoot().getConversion(itemstack) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean plantSaplingAt(final EntityPlayer player, final ItemStack germling, final World world, final int x, final int y, final int z) {
|
||||
final IFlower flower = BotanyCore.getFlowerRoot().getConversion(germling);
|
||||
return Gardening.plant(world, x, y, z, flower, player.getGameProfile());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,370 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.farm;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import binnie.core.Mods;
|
||||
import binnie.botany.flower.TileEntityFlower;
|
||||
import forestry.core.access.IOwnable;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import forestry.api.farming.ICrop;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import binnie.Binnie;
|
||||
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
import binnie.botany.api.gardening.IBlockSoil;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.init.Blocks;
|
||||
|
||||
import binnie.botany.gardening.Gardening;
|
||||
import forestry.api.farming.FarmDirection;
|
||||
import forestry.api.farming.IFarmHousing;
|
||||
import forestry.api.farming.IFarmable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
|
||||
public class GardenLogic extends FarmLogic
|
||||
{
|
||||
EnumMoisture moisture;
|
||||
EnumAcidity acidity;
|
||||
boolean fertilised;
|
||||
String name;
|
||||
ArrayList<ItemStack> produce;
|
||||
private ItemStack icon;
|
||||
List<IFarmable> farmables;
|
||||
|
||||
public GardenLogic(final IFarmHousing housing) {
|
||||
super(housing);
|
||||
this.produce = new ArrayList<ItemStack>();
|
||||
(this.farmables = new ArrayList<IFarmable>()).add(new FarmableFlower());
|
||||
this.farmables.add(new FarmableVanillaFlower());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFertilizerConsumption() {
|
||||
return this.fertilised ? 8 : 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWaterConsumption(final float hydrationModifier) {
|
||||
return (int) (this.moisture.ordinal() * 40 * hydrationModifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAcceptedResource(final ItemStack itemstack) {
|
||||
return Gardening.isSoil(itemstack.getItem()) || itemstack.getItem() == Item.getItemFromBlock(Blocks.sand) || itemstack.getItem() == Item.getItemFromBlock(Blocks.dirt) || Gardening.isAcidFertiliser(itemstack) || Gardening.isAlkalineFertiliser(itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ItemStack> collect() {
|
||||
final Collection<ItemStack> products = this.produce;
|
||||
this.produce = new ArrayList<ItemStack>();
|
||||
return products;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean cultivate(final int x, final int y, final int z, final FarmDirection direction, final int extent) {
|
||||
this.world = this.housing.getWorld();
|
||||
return this.maintainSoil(x, y, z, direction, extent) || (!this.isManual && this.maintainWater(x, y, z, direction, extent)) || this.maintainCrops(x, y + 1, z, direction, extent);
|
||||
}
|
||||
|
||||
private boolean isWaste(final ItemStack stack) {
|
||||
return stack.getItem() == Item.getItemFromBlock(Blocks.dirt);
|
||||
}
|
||||
|
||||
private boolean maintainSoil(final int x2, final int y2, final int z2, final FarmDirection direction, final int extent) {
|
||||
for (int i = 0; i < extent; ++i) {
|
||||
final Vect position = this.translateWithOffset(x2, y2, z2, direction, i);
|
||||
if (this.fertilised && Gardening.isSoil(this.world.getBlock(position.x, position.y, position.z))) {
|
||||
final IBlockSoil soil = (IBlockSoil) this.world.getBlock(position.x, position.y, position.z);
|
||||
if (soil.fertilise(this.world, position.x, position.y, position.z, EnumSoilType.FLOWERBED)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (this.world.getBlock(position.x, position.y + 1, position.z) == Botany.plant) {
|
||||
this.world.setBlockToAir(position.x, position.y + 1, position.z);
|
||||
}
|
||||
else {
|
||||
if (this.acidity != null && Gardening.isSoil(this.world.getBlock(position.x, position.y, position.z))) {
|
||||
final IBlockSoil soil = (IBlockSoil) this.world.getBlock(position.x, position.y, position.z);
|
||||
final EnumAcidity pH = soil.getPH(this.world, position.x, position.y, position.z);
|
||||
if (pH.ordinal() < this.acidity.ordinal()) {
|
||||
final ItemStack stack = this.getAvailableAlkaline();
|
||||
if (stack != null && soil.setPH(this.world, position.x, position.y, position.z, EnumAcidity.values()[pH.ordinal() + 1])) {
|
||||
this.housing.getFarmInventory().removeResources(new ItemStack[] { stack });
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (pH.ordinal() > this.acidity.ordinal()) {
|
||||
final ItemStack stack = this.getAvailableAcid();
|
||||
if (stack != null && soil.setPH(this.world, position.x, position.y, position.z, EnumAcidity.values()[pH.ordinal() - 1])) {
|
||||
this.housing.getFarmInventory().removeResources(new ItemStack[] { stack });
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!this.isAirBlock(position) && !this.world.getBlock(position.x, position.y, position.z).isReplaceable(this.world, position.x, position.y, position.z)) {
|
||||
final ItemStack block = this.getAsItemStack(position);
|
||||
final ItemStack loam = this.getAvailableLoam();
|
||||
if (this.isWaste(block) && loam != null) {
|
||||
this.produce.addAll(Blocks.dirt.getDrops(this.world, position.x, position.y, position.z, block.getItemDamage(), 0));
|
||||
this.setBlock(position, Blocks.air, 0);
|
||||
return this.trySetSoil(position, loam);
|
||||
}
|
||||
}
|
||||
else if (!this.isManual) {
|
||||
if (!this.isWaterBlock(position)) {
|
||||
if (i % 2 == 0) {
|
||||
return this.trySetSoil(position);
|
||||
}
|
||||
FarmDirection cclock = FarmDirection.EAST;
|
||||
if (direction == FarmDirection.EAST) {
|
||||
cclock = FarmDirection.SOUTH;
|
||||
}
|
||||
else if (direction == FarmDirection.SOUTH) {
|
||||
cclock = FarmDirection.EAST;
|
||||
}
|
||||
else if (direction == FarmDirection.WEST) {
|
||||
cclock = FarmDirection.SOUTH;
|
||||
}
|
||||
final Vect previous = this.translateWithOffset(position.x, position.y, position.z, cclock, 1);
|
||||
final ItemStack soil2 = this.getAsItemStack(previous);
|
||||
if (!Gardening.isSoil(soil2.getItem())) {
|
||||
this.trySetSoil(position);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean maintainWater(final int x, final int y, final int z, final FarmDirection direction, final int extent) {
|
||||
for (int i = 0; i < extent; ++i) {
|
||||
final Vect position = this.translateWithOffset(x, y, z, direction, i);
|
||||
if (this.isAirBlock(position) || this.world.getBlock(x, y, z).isReplaceable(this.world, position.x, position.y, position.z)) {
|
||||
if (!this.isWaterBlock(position)) {
|
||||
boolean isEnclosed = true;
|
||||
if (this.world.isAirBlock(position.x + 1, position.y, position.z)) {
|
||||
isEnclosed = false;
|
||||
}
|
||||
else if (this.world.isAirBlock(position.x - 1, position.y, position.z)) {
|
||||
isEnclosed = false;
|
||||
}
|
||||
else if (this.world.isAirBlock(position.x, position.y, position.z + 1)) {
|
||||
isEnclosed = false;
|
||||
}
|
||||
else if (this.world.isAirBlock(position.x, position.y, position.z - 1)) {
|
||||
isEnclosed = false;
|
||||
}
|
||||
isEnclosed = (isEnclosed || this.moisture != EnumMoisture.Damp);
|
||||
if (isEnclosed) {
|
||||
return this.trySetWater(position);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private ItemStack getAvailableLoam() {
|
||||
EnumMoisture[] moistures;
|
||||
if (this.moisture == EnumMoisture.Damp) {
|
||||
moistures = new EnumMoisture[] { EnumMoisture.Damp, EnumMoisture.Normal, EnumMoisture.Dry };
|
||||
}
|
||||
else if (this.moisture == EnumMoisture.Damp) {
|
||||
moistures = new EnumMoisture[] { EnumMoisture.Dry, EnumMoisture.Damp, EnumMoisture.Dry };
|
||||
}
|
||||
else {
|
||||
moistures = new EnumMoisture[] { EnumMoisture.Dry, EnumMoisture.Normal, EnumMoisture.Damp };
|
||||
}
|
||||
final EnumAcidity[] acidities = { EnumAcidity.Neutral, EnumAcidity.Acid, EnumAcidity.Alkaline };
|
||||
for (final EnumMoisture moist : moistures) {
|
||||
for (final EnumAcidity acid : acidities) {
|
||||
for (final Block type : new Block[] { Botany.flowerbed, Botany.loam, Botany.soil }) {
|
||||
final int meta = acid.ordinal() * 3 + moist.ordinal();
|
||||
final ItemStack[] resource = { new ItemStack(type, 1, meta) };
|
||||
if (this.housing.getFarmInventory().hasResources(resource)) {
|
||||
return resource[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.housing.getFarmInventory().hasResources(new ItemStack[] { new ItemStack(Blocks.dirt) })) {
|
||||
return new ItemStack(Blocks.dirt);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean trySetSoil(final Vect position) {
|
||||
return this.trySetSoil(position, this.getAvailableLoam());
|
||||
}
|
||||
|
||||
private boolean trySetSoil(final Vect position, ItemStack loam) {
|
||||
ItemStack copy = loam;
|
||||
if (loam != null) {
|
||||
if (loam.getItem() == Item.getItemFromBlock(Blocks.dirt)) {
|
||||
loam = new ItemStack(Botany.soil, 0, 4);
|
||||
}
|
||||
this.setBlock(position, ((ItemBlock) loam.getItem()).field_150939_a, loam.getItemDamage());
|
||||
this.housing.getFarmInventory().removeResources(new ItemStack[] { copy });
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean trySetWater(final Vect position) {
|
||||
final FluidStack water = Binnie.Liquid.getLiquidStack("water", 1000);
|
||||
if (this.moisture == EnumMoisture.Damp) {
|
||||
if (!this.housing.hasLiquid(water)) {
|
||||
return false;
|
||||
}
|
||||
this.setBlock(position, Blocks.water, 0);
|
||||
this.housing.removeLiquid(water);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
if (this.moisture != EnumMoisture.Dry) {
|
||||
return this.trySetSoil(position);
|
||||
}
|
||||
final ItemStack[] sand = { new ItemStack(Blocks.sand, 1) };
|
||||
if (!this.housing.getFarmInventory().hasResources(sand)) {
|
||||
return false;
|
||||
}
|
||||
this.setBlock(position, Blocks.sand, 0);
|
||||
this.housing.getFarmInventory().removeResources(sand);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public void setIcon(final ItemStack icon) {
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAcceptedGermling(final ItemStack itemstack) {
|
||||
for (final IFarmable farmable : this.farmables) {
|
||||
if (farmable.isGermling(itemstack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ICrop> harvest(final int x, final int y, final int z, final FarmDirection direction, final int extent) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon() {
|
||||
return this.icon.getIconIndex();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getSpriteSheet() {
|
||||
return TextureMap.locationBlocksTexture;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
protected boolean maintainCrops(final int x, final int y, final int z, final FarmDirection direction, final int extent) {
|
||||
for (int i = 0; i < extent; ++i) {
|
||||
final Vect position = this.translateWithOffset(x, y, z, direction, i);
|
||||
if (this.isAirBlock(position) || this.world.getBlock(x, y, z).isReplaceable(this.world, position.x, position.y, position.z)) {
|
||||
final ItemStack below = this.getAsItemStack(position.add(new Vect(0, -1, 0)));
|
||||
if (Gardening.isSoil(below.getItem())) {
|
||||
return this.trySetCrop(position);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean trySetCrop(final Vect position) {
|
||||
for (final IFarmable farmable : this.farmables) {
|
||||
final boolean success = this.housing.plantGermling(farmable, this.world, position.x, position.y, position.z);
|
||||
if (success && this.housing instanceof IOwnable) {
|
||||
final TileEntity tile = this.housing.getWorld().getTileEntity(position.x, position.y, position.z);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
try {
|
||||
final IOwnable housing2 = (IOwnable) this.housing;
|
||||
GameProfile prof = null;
|
||||
if (Mods.Forestry.dev()) {
|
||||
prof = (GameProfile) IOwnable.class.getMethod("getOwner", new Class[0]).invoke(housing2, new Object[0]);
|
||||
}
|
||||
else {
|
||||
prof = (GameProfile) IOwnable.class.getMethod("getOwnerProfile", new Class[0]).invoke(housing2, new Object[0]);
|
||||
}
|
||||
((TileEntityFlower) tile).setOwner(prof);
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public ItemStack getAvailableAcid() {
|
||||
for (final ItemStack stack : Gardening.getAcidFertilisers()) {
|
||||
if (stack != null && stack.getItem() != null && this.housing.getFarmInventory().hasResources(new ItemStack[] { stack })) {
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ItemStack getAvailableAlkaline() {
|
||||
for (final ItemStack stack : Gardening.getAlkalineFertilisers()) {
|
||||
if (stack != null && stack.getItem() != null && this.housing.getFarmInventory().hasResources(new ItemStack[] { stack })) {
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setData(final EnumMoisture moisture2, final EnumAcidity acidity2, final boolean isManual, final boolean isFertilised, final ItemStack icon2, final String name2) {
|
||||
this.moisture = moisture2;
|
||||
this.acidity = acidity2;
|
||||
this.isManual = isManual;
|
||||
this.fertilised = isFertilised;
|
||||
this.icon = icon2;
|
||||
this.name = name2;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.farm;
|
||||
|
||||
public class Vect
|
||||
{
|
||||
public int x;
|
||||
public int y;
|
||||
public int z;
|
||||
|
||||
public Vect(final int[] dim) {
|
||||
if (dim.length != 3) {
|
||||
throw new RuntimeException("Cannot instantiate a vector with less or more than 3 points.");
|
||||
}
|
||||
this.x = dim[0];
|
||||
this.y = dim[1];
|
||||
this.z = dim[2];
|
||||
}
|
||||
|
||||
public Vect(final int x, final int y, final int z) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public Vect add(final Vect other) {
|
||||
final Vect vect;
|
||||
final Vect result = vect = new Vect(this.x, this.y, this.z);
|
||||
vect.x += other.x;
|
||||
final Vect vect2 = result;
|
||||
vect2.y += other.y;
|
||||
final Vect vect3 = result;
|
||||
vect3.z += other.z;
|
||||
return result;
|
||||
}
|
||||
|
||||
public Vect multiply(final float factor) {
|
||||
final Vect vect;
|
||||
final Vect result = vect = new Vect(this.x, this.y, this.z);
|
||||
vect.x *= (int) factor;
|
||||
final Vect vect2 = result;
|
||||
vect2.y *= (int) factor;
|
||||
final Vect vect3 = result;
|
||||
vect3.z *= (int) factor;
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("%sx%sx%s;", this.x, this.y, this.z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = 31 * result + this.x;
|
||||
result = 31 * result + this.y;
|
||||
result = 31 * result + this.z;
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (this.getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final Vect other = (Vect) obj;
|
||||
return this.x == other.x && this.y == other.y && this.z == other.z;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.flower;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
import binnie.botany.Botany;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.block.Block;
|
||||
import binnie.botany.api.IFlowerType;
|
||||
import binnie.botany.api.EnumFlowerStage;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import binnie.botany.api.IFlower;
|
||||
import binnie.botany.gardening.Gardening;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.core.BinnieCore;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.block.material.Material;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import binnie.botany.genetics.EnumFlowerType;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
|
||||
public class BlockFlower extends BlockContainer
|
||||
{
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RendererBotany.renderID;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(final IIconRegister par1IconRegister) {
|
||||
for (final EnumFlowerType type : EnumFlowerType.values()) {
|
||||
type.registerIcons(par1IconRegister);
|
||||
}
|
||||
}
|
||||
|
||||
public BlockFlower() {
|
||||
super(Material.plants);
|
||||
final float f = 0.2f;
|
||||
this.setBlockBounds(0.5f - f, 0.0f, 0.5f - f, 0.5f + f, f * 3.0f, 0.5f + f);
|
||||
this.setTickRandomly(true);
|
||||
this.setBlockName("flower");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(final World var1, final int i) {
|
||||
return new TileEntityFlower();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(final World par1World, final int par2, final int par3, final int par4) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(final World world, final int x, final int y, final int z, final EntityLivingBase living, final ItemStack stack) {
|
||||
super.onBlockPlacedBy(world, x, y, z, living, stack);
|
||||
final TileEntity flower = world.getTileEntity(x, y, z);
|
||||
if (!BinnieCore.proxy.isSimulating(world)) {
|
||||
if (flower != null && flower instanceof TileEntityFlower) {
|
||||
final IFlower f = BotanyCore.getFlowerRoot().getMember(stack);
|
||||
((TileEntityFlower) flower).setRender(new TileEntityFlower.RenderInfo(f, (TileEntityFlower) flower));
|
||||
}
|
||||
return;
|
||||
}
|
||||
final TileEntity below = world.getTileEntity(x, y - 1, z);
|
||||
if (flower != null && flower instanceof TileEntityFlower) {
|
||||
if (below instanceof TileEntityFlower) {
|
||||
((TileEntityFlower) flower).setSection(((TileEntityFlower) below).getSection());
|
||||
}
|
||||
else {
|
||||
final GameProfile owner = (living instanceof EntityPlayer) ? ((EntityPlayer) living).getGameProfile() : null;
|
||||
((TileEntityFlower) flower).create(stack, owner);
|
||||
}
|
||||
}
|
||||
Gardening.tryGrowSection(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(final IBlockAccess world, final int x, final int y, final int z, final int side) {
|
||||
final TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
final TileEntityFlower f = (TileEntityFlower) tile;
|
||||
final EnumFlowerStage stage = (f.getAge() == 0) ? EnumFlowerStage.SEED : EnumFlowerStage.FLOWER;
|
||||
final IFlowerType flower = f.getType();
|
||||
final int section = f.getRenderSection();
|
||||
final boolean flowered = f.isFlowered();
|
||||
return (RendererBotany.pass == 0) ? flower.getStem(stage, flowered, section) : ((RendererBotany.pass == 1) ? flower.getPetalIcon(stage, flowered, section) : flower.getVariantIcon(stage, flowered, section));
|
||||
}
|
||||
return super.getIcon(world, x, y, z, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(final IBlockAccess world, final int x, final int y, final int z) {
|
||||
final TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
final TileEntityFlower f = (TileEntityFlower) tile;
|
||||
return (RendererBotany.pass == 0) ? f.getStemColour() : ((RendererBotany.pass == 1) ? f.getPrimaryColour() : f.getSecondaryColour());
|
||||
}
|
||||
return 16777215;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceBlockAt(final World world, final int x, final int y, final int z) {
|
||||
return super.canPlaceBlockAt(world, x, y, z) && this.canBlockStay(world, x, y, z);
|
||||
}
|
||||
|
||||
protected boolean canPlaceBlockOn(final Block block) {
|
||||
return block == Blocks.grass || block == Blocks.dirt || block == Blocks.farmland || Gardening.isSoil(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(final World world, final int x, final int y, final int z, final Block block) {
|
||||
super.onNeighborBlockChange(world, x, y, z, block);
|
||||
this.checkAndDropBlock(world, x, y, z);
|
||||
final TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
final TileEntityFlower flower = (TileEntityFlower) tile;
|
||||
if (flower.getSection() == 0 && flower.getFlower() != null && flower.getFlower().getAge() > 0 && flower.getFlower().getGenome().getPrimary().getType().getSections() > 1 && world.getBlock(x, y + 1, z) != Botany.flower) {
|
||||
this.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
||||
world.setBlockToAir(x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(final World world, final int x, final int y, final int z, final Random rand) {
|
||||
final TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
((TileEntityFlower) tile).randomUpdate(rand);
|
||||
this.checkAndDropBlock(world, x, y, z);
|
||||
return;
|
||||
}
|
||||
world.setBlockToAir(x, y, z);
|
||||
}
|
||||
|
||||
protected void checkAndDropBlock(final World world, final int x, final int y, final int z) {
|
||||
if (!this.canBlockStay(world, x, y, z)) {
|
||||
this.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
||||
world.setBlockToAir(x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBlockStay(final World world, final int x, final int y, final int z) {
|
||||
final TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).getSection() > 0) {
|
||||
return world.getBlock(x, y - 1, z) == Botany.flower;
|
||||
}
|
||||
return this.canPlaceBlockOn(world.getBlock(x, y - 1, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(final World world, final int x, final int y, final int z, final int blockMeta, final int fortune) {
|
||||
final ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
|
||||
final TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).getSection() == 0) {
|
||||
final ItemStack flower = ((TileEntityFlower) tile).getItemStack();
|
||||
if (flower != null) {
|
||||
drops.add(flower);
|
||||
}
|
||||
}
|
||||
return drops;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(final World world, final EntityPlayer player, final int x, final int y, final int z) {
|
||||
final List<ItemStack> drops = this.getDrops(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
||||
final boolean hasBeenBroken = world.setBlockToAir(x, y, z);
|
||||
if (hasBeenBroken && BinnieCore.proxy.isSimulating(world) && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) {
|
||||
for (final ItemStack drop : drops) {
|
||||
this.dropBlockAsItem(world, x, y, z, drop);
|
||||
}
|
||||
}
|
||||
return hasBeenBroken;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,288 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.flower;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.init.Blocks;
|
||||
import binnie.botany.Botany;
|
||||
import forestry.api.genetics.IPollinatable;
|
||||
import binnie.Binnie;
|
||||
import binnie.botany.api.EnumFlowerStage;
|
||||
import net.minecraft.world.World;
|
||||
import binnie.botany.api.IFlowerType;
|
||||
import binnie.botany.genetics.EnumFlowerType;
|
||||
import net.minecraft.util.IIcon;
|
||||
import forestry.core.config.Config;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import binnie.botany.api.EnumFlowerChromosome;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||
import binnie.botany.genetics.Flower;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.botany.api.IFlower;
|
||||
import java.util.List;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public abstract class ItemBotany extends Item
|
||||
{
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getSpriteNumber() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public ItemBotany(final String name) {
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
this.setUnlocalizedName(name);
|
||||
this.hasSubtypes = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDamageable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRepairable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getShareTag() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasEffect(final ItemStack itemstack) {
|
||||
if (!itemstack.hasTagCompound()) {
|
||||
return false;
|
||||
}
|
||||
final IIndividual individual = this.getIndividual(itemstack);
|
||||
return individual != null && individual.getGenome() != null && individual.hasEffect();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(final ItemStack itemstack, final EntityPlayer player, final List list, final boolean flag) {
|
||||
if (!itemstack.hasTagCompound()) {
|
||||
return;
|
||||
}
|
||||
final IFlower individual = (IFlower) this.getIndividual(itemstack);
|
||||
if (individual == null) {
|
||||
list.add("This item is bugged. Destroy it!");
|
||||
return;
|
||||
}
|
||||
list.add("§e" + individual.getGenome().getPrimaryColor().getName() + ((individual.getGenome().getPrimaryColor() == individual.getGenome().getSecondaryColor()) ? "" : (" and " + individual.getGenome().getSecondaryColor().getName())) + ", " + individual.getGenome().getStemColor().getName() + " Stem");
|
||||
if (individual.isAnalyzed()) {
|
||||
if (BinnieCore.proxy.isShiftDown()) {
|
||||
individual.addTooltip(list);
|
||||
}
|
||||
else {
|
||||
list.add("§o<Hold shift for details>");
|
||||
}
|
||||
}
|
||||
else {
|
||||
list.add("<Unknown>");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(final IIconRegister par1IconRegister) {
|
||||
}
|
||||
|
||||
protected IIndividual getIndividual(final ItemStack itemstack) {
|
||||
return new Flower(itemstack.getTagCompound());
|
||||
}
|
||||
|
||||
private IAlleleFlowerSpecies getPrimarySpecies(final ItemStack itemstack) {
|
||||
final IFlower tree = BotanyCore.speciesRoot.getMember(itemstack);
|
||||
if (tree == null) {
|
||||
return (IAlleleFlowerSpecies) BotanyCore.speciesRoot.getDefaultTemplate()[EnumFlowerChromosome.SPECIES.ordinal()];
|
||||
}
|
||||
return tree.getGenome().getPrimary();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(final ItemStack itemstack) {
|
||||
if (!itemstack.hasTagCompound()) {
|
||||
return "Unknown";
|
||||
}
|
||||
final IIndividual individual = this.getIndividual(itemstack);
|
||||
return (individual != null && individual.getGenome() != null) ? (individual.getDisplayName() + this.getTag()) : "Corrupted Flower";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(final Item item, final CreativeTabs par2CreativeTabs, final List itemList) {
|
||||
this.addCreativeItems(itemList, true);
|
||||
}
|
||||
|
||||
public void addCreativeItems(final List itemList, final boolean hideSecrets) {
|
||||
for (final IIndividual individual : BotanyCore.speciesRoot.getIndividualTemplates()) {
|
||||
if (hideSecrets && individual.isSecret() && !Config.isDebug) {
|
||||
continue;
|
||||
}
|
||||
itemList.add(BotanyCore.speciesRoot.getMemberStack(individual.copy(), this.getStage().ordinal()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColorFromItemStack(final ItemStack itemstack, final int renderPass) {
|
||||
final IFlower flower = BotanyCore.speciesRoot.getMember(itemstack);
|
||||
if (flower == null || flower.getGenome() == null) {
|
||||
return 16777215;
|
||||
}
|
||||
return (renderPass == 0) ? flower.getGenome().getStemColor().getColor(flower.isWilted()) : ((renderPass == 1) ? flower.getGenome().getPrimaryColor().getColor(flower.isWilted()) : flower.getGenome().getSecondaryColor().getColor(flower.isWilted()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresMultipleRenderPasses() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderPasses(final int metadata) {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(final ItemStack itemstack, final int renderPass) {
|
||||
final IFlower flower = BotanyCore.speciesRoot.getMember(itemstack);
|
||||
if (flower == null || flower.getGenome() == null || flower.getGenome().getPrimary() == null) {
|
||||
return EnumFlowerType.Allium.getBlank();
|
||||
}
|
||||
final IFlowerType type = flower.getGenome().getPrimary().getType();
|
||||
if (renderPass == 0) {
|
||||
return type.getStem(this.getStage(), flower.hasFlowered(), type.getSections() - 1);
|
||||
}
|
||||
if (renderPass == 1) {
|
||||
return type.getPetalIcon(this.getStage(), flower.hasFlowered(), type.getSections() - 1);
|
||||
}
|
||||
return type.getVariantIcon(this.getStage(), flower.hasFlowered(), type.getSections() - 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(final ItemStack itemstack, final EntityPlayer player, final World world, int x, int y, int z, int side, final float px, final float py, final float pz) {
|
||||
if (this.getStage() == EnumFlowerStage.POLLEN) {
|
||||
final IFlower flower = Binnie.Genetics.getFlowerRoot().getMember(itemstack);
|
||||
final TileEntity target = world.getTileEntity(x, y, z);
|
||||
if (!(target instanceof IPollinatable)) {
|
||||
return false;
|
||||
}
|
||||
final IPollinatable pollinatable = (IPollinatable) target;
|
||||
if (!pollinatable.canMateWith(flower)) {
|
||||
return false;
|
||||
}
|
||||
pollinatable.mateWith(flower);
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
--itemstack.stackSize;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
final Block blockFlower = Botany.flower;
|
||||
final Block blockAlreadyThere = world.getBlock(x, y, z);
|
||||
if (blockAlreadyThere == Blocks.snow_layer && (world.getBlockMetadata(x, y, z) & 0x7) < 1) {
|
||||
side = 1;
|
||||
}
|
||||
else if (blockAlreadyThere != Blocks.vine && blockAlreadyThere != Blocks.tallgrass && blockAlreadyThere != Blocks.deadbush && !blockAlreadyThere.isReplaceable(world, x, y, z)) {
|
||||
if (side == 0) {
|
||||
--y;
|
||||
}
|
||||
if (side == 1) {
|
||||
++y;
|
||||
}
|
||||
if (side == 2) {
|
||||
--z;
|
||||
}
|
||||
if (side == 3) {
|
||||
++z;
|
||||
}
|
||||
if (side == 4) {
|
||||
--x;
|
||||
}
|
||||
if (side == 5) {
|
||||
++x;
|
||||
}
|
||||
}
|
||||
if (itemstack.stackSize == 0) {
|
||||
return false;
|
||||
}
|
||||
if (!player.canPlayerEdit(x, y, z, side, itemstack)) {
|
||||
return false;
|
||||
}
|
||||
if (y == 255 && blockFlower.getMaterial().isSolid()) {
|
||||
return false;
|
||||
}
|
||||
if (world.canPlaceEntityOnSide(blockFlower, x, y, z, false, side, player, itemstack)) {
|
||||
final int i1 = this.getMetadata(itemstack.getItemDamage());
|
||||
final int j1 = blockFlower.onBlockPlaced(world, x, y, z, side, px, py, pz, i1);
|
||||
if (this.placeBlockAt(itemstack, player, world, x, y, z, side, px, py, pz, j1)) {
|
||||
world.playSoundEffect(x + 0.5f, y + 0.5f, z + 0.5f, blockFlower.stepSound.func_150496_b(), (blockFlower.stepSound.getVolume() + 1.0f) / 2.0f, blockFlower.stepSound.getPitch() * 0.8f);
|
||||
--itemstack.stackSize;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean func_150936_a(final World p_150936_1_, int p_150936_2_, int p_150936_3_, int p_150936_4_, int p_150936_5_, final EntityPlayer p_150936_6_, final ItemStack p_150936_7_) {
|
||||
final Block field_150939_a = Botany.flower;
|
||||
final Block block = p_150936_1_.getBlock(p_150936_2_, p_150936_3_, p_150936_4_);
|
||||
if (block == Blocks.snow_layer) {
|
||||
p_150936_5_ = 1;
|
||||
}
|
||||
else if (block != Blocks.vine && block != Blocks.tallgrass && block != Blocks.deadbush && !block.isReplaceable(p_150936_1_, p_150936_2_, p_150936_3_, p_150936_4_)) {
|
||||
if (p_150936_5_ == 0) {
|
||||
--p_150936_3_;
|
||||
}
|
||||
if (p_150936_5_ == 1) {
|
||||
++p_150936_3_;
|
||||
}
|
||||
if (p_150936_5_ == 2) {
|
||||
--p_150936_4_;
|
||||
}
|
||||
if (p_150936_5_ == 3) {
|
||||
++p_150936_4_;
|
||||
}
|
||||
if (p_150936_5_ == 4) {
|
||||
--p_150936_2_;
|
||||
}
|
||||
if (p_150936_5_ == 5) {
|
||||
++p_150936_2_;
|
||||
}
|
||||
}
|
||||
return p_150936_1_.canPlaceEntityOnSide(field_150939_a, p_150936_2_, p_150936_3_, p_150936_4_, false, p_150936_5_, (Entity) null, p_150936_7_);
|
||||
}
|
||||
|
||||
public boolean placeBlockAt(final ItemStack stack, final EntityPlayer player, final World world, final int x, final int y, final int z, final int side, final float hitX, final float hitY, final float hitZ, final int metadata) {
|
||||
final Block field_150939_a = Botany.flower;
|
||||
if (!world.setBlock(x, y, z, field_150939_a, metadata, 3)) {
|
||||
return false;
|
||||
}
|
||||
if (world.getBlock(x, y, z) == field_150939_a) {
|
||||
field_150939_a.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
field_150939_a.onPostBlockPlaced(world, x, y, z, metadata);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public abstract EnumFlowerStage getStage();
|
||||
|
||||
public abstract String getTag();
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.flower;
|
||||
|
||||
import binnie.botany.api.EnumFlowerStage;
|
||||
|
||||
public class ItemFlower extends ItemBotany
|
||||
{
|
||||
public ItemFlower() {
|
||||
super("itemFlower");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFlowerStage getStage() {
|
||||
return EnumFlowerStage.FLOWER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTag() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.flower;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import binnie.botany.Botany;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import java.util.List;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class ItemInsulatedTube extends Item
|
||||
{
|
||||
IIcon[] icons;
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(final Item p_150895_1_, final CreativeTabs p_150895_2_, final List p_150895_3_) {
|
||||
for (final Material mat : Material.values()) {
|
||||
for (final Insulate ins : Insulate.values()) {
|
||||
p_150895_3_.add(new ItemStack(this, 1, mat.ordinal() + ins.ordinal() * 128));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(final IIconRegister p_94581_1_) {
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
this.icons[i] = Botany.proxy.getIcon(p_94581_1_, "insulatedTube." + i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(final ItemStack stack, final int pass) {
|
||||
return (pass == 0) ? 16777215 : ((pass == 1) ? Material.get(stack.getItemDamage()).getColor() : Insulate.get(stack.getItemDamage()).getColor());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(final ItemStack p_77624_1_, final EntityPlayer p_77624_2_, final List p_77624_3_, final boolean p_77624_4_) {
|
||||
super.addInformation(p_77624_1_, p_77624_2_, p_77624_3_, p_77624_4_);
|
||||
p_77624_3_.add(Insulate.get(p_77624_1_.getItemDamage()).getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(final ItemStack p_77653_1_) {
|
||||
return Material.get(p_77653_1_.getItemDamage()).getName() + " Insulated Tube";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderPasses(final int metadata) {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(final ItemStack stack, final int pass) {
|
||||
return this.icons[pass % 3];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresMultipleRenderPasses() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public ItemInsulatedTube() {
|
||||
this.icons = new IIcon[3];
|
||||
this.setUnlocalizedName("insulatedTube");
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
}
|
||||
|
||||
public static String getInsulate(final ItemStack stack) {
|
||||
return Insulate.get(stack.getItemDamage()).getName();
|
||||
}
|
||||
|
||||
public static ItemStack getInsulateStack(final ItemStack stack) {
|
||||
return Insulate.get(stack.getItemDamage()).getStack();
|
||||
}
|
||||
|
||||
enum Material
|
||||
{
|
||||
Copper(14923662, "Copper"),
|
||||
Tin(14806772, "Tin"),
|
||||
Bronze(14533238, "Bronze"),
|
||||
Iron(14211288, "Iron");
|
||||
|
||||
int color;
|
||||
String name;
|
||||
|
||||
public int getColor() {
|
||||
return this.color;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
private Material(final int color, final String name) {
|
||||
this.color = color;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public static Material get(final int i) {
|
||||
return values()[i % values().length];
|
||||
}
|
||||
}
|
||||
|
||||
enum Insulate
|
||||
{
|
||||
Clay(10595020, "Clay"),
|
||||
Cobble(8092539, "Cobblestone"),
|
||||
Sand(15723189, "Sand"),
|
||||
HardenedClay(9657411, "Hardened Clay"),
|
||||
Stone(7171437, "Smooth Stone"),
|
||||
Sandstone(12695945, "Sandstone");
|
||||
|
||||
int color;
|
||||
String name;
|
||||
|
||||
public int getColor() {
|
||||
return this.color;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
private Insulate(final int color, final String name) {
|
||||
this.color = color;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public static Insulate get(final int i) {
|
||||
return values()[i / 128 % values().length];
|
||||
}
|
||||
|
||||
public ItemStack getStack() {
|
||||
switch (this) {
|
||||
case Clay: {
|
||||
return new ItemStack(Blocks.clay);
|
||||
}
|
||||
case Cobble: {
|
||||
return new ItemStack(Blocks.cobblestone);
|
||||
}
|
||||
case HardenedClay: {
|
||||
return new ItemStack(Blocks.hardened_clay);
|
||||
}
|
||||
case Sand: {
|
||||
return new ItemStack(Blocks.sand);
|
||||
}
|
||||
case Sandstone: {
|
||||
return new ItemStack(Blocks.sandstone);
|
||||
}
|
||||
case Stone: {
|
||||
return new ItemStack(Blocks.stone);
|
||||
}
|
||||
default: {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.flower;
|
||||
|
||||
import binnie.botany.api.EnumFlowerStage;
|
||||
|
||||
public class ItemPollen extends ItemBotany
|
||||
{
|
||||
public ItemPollen() {
|
||||
super("pollen");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFlowerStage getStage() {
|
||||
return EnumFlowerStage.POLLEN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTag() {
|
||||
return " Pollen";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.flower;
|
||||
|
||||
import binnie.botany.api.EnumFlowerStage;
|
||||
|
||||
public class ItemSeed extends ItemBotany
|
||||
{
|
||||
public ItemSeed() {
|
||||
super("seed");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFlowerStage getStage() {
|
||||
return EnumFlowerStage.SEED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTag() {
|
||||
return " Germling";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.flower;
|
||||
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.client.renderer.EntityRenderer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.block.Block;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
|
||||
public class RendererBotany implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
public static int renderID;
|
||||
public static int pass;
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(final Block block, final int metadata, final int modelID, final RenderBlocks renderer) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(final IBlockAccess world, final int x, final int y, final int z, final Block block, final int modelId, final RenderBlocks renderer) {
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.setBrightness(block.getMixedBrightnessForBlock(renderer.blockAccess, x, y, z));
|
||||
double d1 = x;
|
||||
final double d2 = y;
|
||||
double d3 = z;
|
||||
long i1 = x * 3129871 ^ z * 116129781L;
|
||||
i1 = i1 * i1 * 42317861L + i1 * 11L;
|
||||
d1 += ((i1 >> 16 & 0xFL) / 15.0f - 0.5) * 0.3;
|
||||
d3 += ((i1 >> 24 & 0xFL) / 15.0f - 0.5) * 0.3;
|
||||
final int rot = (int) (i1 % 4L);
|
||||
for (int j = 0; j < 3; ++j) {
|
||||
RendererBotany.pass = j;
|
||||
final int l = block.colorMultiplier(renderer.blockAccess, x, y, z);
|
||||
float f = (l >> 16 & 0xFF) / 255.0f;
|
||||
float f2 = (l >> 8 & 0xFF) / 255.0f;
|
||||
float f3 = (l & 0xFF) / 255.0f;
|
||||
if (EntityRenderer.anaglyphEnable) {
|
||||
final float f4 = (f * 30.0f + f2 * 59.0f + f3 * 11.0f) / 100.0f;
|
||||
final float f5 = (f * 30.0f + f2 * 70.0f) / 100.0f;
|
||||
final float f6 = (f * 30.0f + f3 * 70.0f) / 100.0f;
|
||||
f = f4;
|
||||
f2 = f5;
|
||||
f3 = f6;
|
||||
}
|
||||
tessellator.setColorOpaque_F(f, f2, f3);
|
||||
final IIcon iicon = block.getIcon(world, x, y, z, 0);
|
||||
renderer.drawCrossedSquares(iicon, d1, d2, d3, 1.0f);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(final int i) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return RendererBotany.renderID;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,684 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.flower;
|
||||
|
||||
import binnie.botany.api.IFlowerColour;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import forestry.api.core.IErrorState;
|
||||
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import binnie.botany.genetics.EnumFlowerType;
|
||||
import binnie.botany.api.IFlowerType;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.lepidopterology.entities.EntityButterfly;
|
||||
import binnie.botany.gardening.BlockPlant;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
|
||||
import binnie.botany.api.EnumFlowerStage;
|
||||
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
|
||||
import binnie.botany.network.MessageFlowerUpdate;
|
||||
|
||||
import net.minecraft.network.Packet;
|
||||
|
||||
import binnie.botany.api.IFlowerGenome;
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
import binnie.botany.gardening.Gardening;
|
||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import binnie.botany.core.BotanyCore;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.core.BinnieCore;
|
||||
|
||||
import net.minecraft.nbt.NBTUtil;
|
||||
|
||||
import binnie.botany.genetics.Flower;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import forestry.api.lepidopterology.IButterfly;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import binnie.botany.api.IFlower;
|
||||
import forestry.api.lepidopterology.IButterflyNursery;
|
||||
import forestry.api.genetics.IPollinatable;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
|
||||
public class TileEntityFlower extends TileEntity implements IPollinatable, IButterflyNursery
|
||||
{
|
||||
IFlower flower;
|
||||
GameProfile owner;
|
||||
int section;
|
||||
RenderInfo renderInfo;
|
||||
IButterfly caterpillar;
|
||||
int matureTime;
|
||||
|
||||
public TileEntityFlower() {
|
||||
this.flower = null;
|
||||
this.section = 0;
|
||||
this.renderInfo = null;
|
||||
this.matureTime = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(final NBTTagCompound nbttagcompound) {
|
||||
this.flower = new Flower(nbttagcompound);
|
||||
this.section = nbttagcompound.getByte("section");
|
||||
if (this.flower.getAge() == 0) {
|
||||
this.flower.setFlowered(false);
|
||||
}
|
||||
this.owner = NBTUtil.func_152459_a(nbttagcompound.getCompoundTag("owner"));
|
||||
if (nbttagcompound.hasKey("CATER") && BinnieCore.isLepidopteryActive()) {
|
||||
this.matureTime = nbttagcompound.getInteger("caterTime");
|
||||
this.caterpillar = Binnie.Genetics.getButterflyRoot().getMember(nbttagcompound.getCompoundTag("cater"));
|
||||
}
|
||||
super.readFromNBT(nbttagcompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(final NBTTagCompound nbttagcompound) {
|
||||
if (this.flower != null) {
|
||||
this.flower.writeToNBT(nbttagcompound);
|
||||
}
|
||||
if (this.owner != null) {
|
||||
final NBTTagCompound nbt = new NBTTagCompound();
|
||||
NBTUtil.func_152460_a(nbt, this.owner);
|
||||
nbttagcompound.setTag("owner", nbt);
|
||||
}
|
||||
if (this.caterpillar != null) {
|
||||
nbttagcompound.setInteger("caterTime", this.matureTime);
|
||||
final NBTTagCompound subcompound = new NBTTagCompound();
|
||||
this.caterpillar.writeToNBT(subcompound);
|
||||
nbttagcompound.setTag("cater", subcompound);
|
||||
}
|
||||
nbttagcompound.setByte("section", (byte) this.getSection());
|
||||
super.writeToNBT(nbttagcompound);
|
||||
}
|
||||
|
||||
public void create(final ItemStack stack, final GameProfile owner) {
|
||||
this.create(BotanyCore.getFlowerRoot().getMember(stack), owner);
|
||||
}
|
||||
|
||||
public void create(final IFlower stack, final GameProfile owner) {
|
||||
this.flower = stack;
|
||||
if (this.flower.getAge() == 0) {
|
||||
this.flower.setFlowered(false);
|
||||
}
|
||||
this.updateRender(true);
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumSet<EnumPlantType> getPlantType() {
|
||||
return EnumSet.of(EnumPlantType.Plains);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIndividual getPollen() {
|
||||
return this.getFlower();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canMateWith(final IIndividual individual) {
|
||||
return this.isBreeding() && individual instanceof IFlower && this.getFlower() != null && this.getFlower().getMate() == null && this.getFlower().hasFlowered() && !this.getFlower().isGeneticEqual(individual);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mateWith(final IIndividual individual) {
|
||||
if (this.getFlower() == null || !(individual instanceof IFlower)) {
|
||||
return;
|
||||
}
|
||||
final IAlleleFlowerSpecies primary = (IAlleleFlowerSpecies) individual.getGenome().getPrimary();
|
||||
final IAlleleFlowerSpecies primary2 = this.getFlower().getGenome().getPrimary();
|
||||
if (primary == primary2 || this.worldObj.rand.nextInt(4) == 0) {
|
||||
this.getFlower().mate((IFlower) individual);
|
||||
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
public IFlower getFlower() {
|
||||
if (this.getSection() <= 0) {
|
||||
return this.flower;
|
||||
}
|
||||
final TileEntity tile = this.worldObj.getTileEntity(this.xCoord, this.yCoord - this.getSection(), this.zCoord);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
return ((TileEntityFlower) tile).getFlower();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isBreeding() {
|
||||
final Block roots = this.getWorldObj().getBlock(this.xCoord, this.yCoord - 1, this.zCoord);
|
||||
return Gardening.isSoil(roots);
|
||||
}
|
||||
|
||||
public void randomUpdate(final Random rand) {
|
||||
if (this.worldObj.getBlock(this.xCoord, this.yCoord, this.zCoord) != Botany.flower) {
|
||||
this.invalidate();
|
||||
return;
|
||||
}
|
||||
if (this.getSection() > 0) {
|
||||
return;
|
||||
}
|
||||
if (this.flower == null) {
|
||||
return;
|
||||
}
|
||||
if (this.flower.getGenome() == null) {
|
||||
this.invalidate();
|
||||
return;
|
||||
}
|
||||
if (!this.isBreeding()) {
|
||||
return;
|
||||
}
|
||||
float light = this.worldObj.getBlockLightValue(this.xCoord, this.yCoord, this.zCoord);
|
||||
if (light < 6.0f) {
|
||||
for (int dx = -2; dx <= 2; ++dx) {
|
||||
for (int dy = -2; dy <= 2; ++dy) {
|
||||
light -= (this.worldObj.canBlockSeeTheSky(this.xCoord, this.yCoord, this.zCoord) ? 0.0f : 0.5f);
|
||||
}
|
||||
}
|
||||
}
|
||||
final boolean canTolerate = Gardening.canTolerate(this.getFlower(), this.worldObj, this.xCoord, this.yCoord, this.zCoord);
|
||||
final EnumSoilType soil = Gardening.getSoilType(this.worldObj, this.xCoord, this.yCoord, this.zCoord);
|
||||
if (rand.nextFloat() < this.getFlower().getGenome().getAgeChance()) {
|
||||
if (this.flower.getAge() < 1) {
|
||||
if (canTolerate && light > 6.0f) {
|
||||
this.doFlowerAge();
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.doFlowerAge();
|
||||
}
|
||||
}
|
||||
if (canTolerate && this.flower.getAge() > 1 && !this.flower.isWilted() && light > 6.0f) {
|
||||
this.flower.setFlowered(true);
|
||||
}
|
||||
if (!canTolerate && this.flower.isWilted() && rand.nextInt(2 + Math.max(this.flower.getAge(), 2)) == 0) {
|
||||
this.kill();
|
||||
return;
|
||||
}
|
||||
if (light < 2.0f && this.flower.isWilted()) {
|
||||
this.kill();
|
||||
return;
|
||||
}
|
||||
if (!canTolerate || light < 1.0f) {
|
||||
this.flower.setWilted(true);
|
||||
}
|
||||
else {
|
||||
this.flower.setWilted(false);
|
||||
}
|
||||
float CHANCE_DISPERSAL = 0.8f;
|
||||
CHANCE_DISPERSAL += 0.2f * this.flower.getGenome().getFertility();
|
||||
CHANCE_DISPERSAL *= 1.0f + soil.ordinal() * 0.5f;
|
||||
float CHANCE_POLLINATE = 1.0f;
|
||||
CHANCE_POLLINATE += 0.25f * this.flower.getGenome().getFertility();
|
||||
CHANCE_POLLINATE *= 1.0f + soil.ordinal() * 0.5f;
|
||||
final float CHANCE_SELFPOLLINATE = 0.2f * CHANCE_POLLINATE;
|
||||
if (this.worldObj.rand.nextFloat() < CHANCE_DISPERSAL && this.flower.hasFlowered() && !this.flower.isWilted()) {
|
||||
final IFlowerGenome mate = this.flower.getMate();
|
||||
if (mate != null) {
|
||||
boolean dispersed = false;
|
||||
for (int a = 0; a < 5 && !dispersed; ++a) {
|
||||
int dx2;
|
||||
int dz;
|
||||
for (dx2 = 0, dz = 0; dx2 == 0 && dz == 0; dx2 = rand.nextInt(3) - 1, dz = rand.nextInt(3) - 1) {
|
||||
}
|
||||
final Block b = this.getWorldObj().getBlock(this.xCoord + dx2, this.yCoord, this.zCoord + dz);
|
||||
final Block b2 = this.getWorldObj().getBlock(this.xCoord + dx2, this.yCoord - 1, this.zCoord + dz);
|
||||
if (b == Blocks.air && Gardening.isSoil(b2)) {
|
||||
final IFlower offspring = this.flower.getOffspring(this.getWorldObj());
|
||||
if (offspring != null) {
|
||||
Gardening.plant(this.getWorldObj(), this.xCoord + dx2, this.yCoord, this.zCoord + dz, offspring, this.getOwner());
|
||||
this.flower.removeMate();
|
||||
dispersed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.worldObj.rand.nextFloat() < CHANCE_POLLINATE && this.flower.hasFlowered() && !this.flower.isWilted()) {
|
||||
for (int a2 = 0; a2 < 4; ++a2) {
|
||||
int dx3;
|
||||
int dz2;
|
||||
for (dx3 = 0, dz2 = 0; dx3 == 0 && dz2 == 0; dx3 = rand.nextInt(5) - 2, dz2 = rand.nextInt(5) - 2) {
|
||||
}
|
||||
final TileEntity tile = this.getWorldObj().getTileEntity(this.xCoord + dx3, this.yCoord, this.zCoord + dz2);
|
||||
if (tile instanceof IPollinatable && ((IPollinatable) tile).canMateWith(this.getFlower())) {
|
||||
((IPollinatable) tile).mateWith(this.getFlower());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.worldObj.rand.nextFloat() < CHANCE_SELFPOLLINATE && this.flower.hasFlowered() && this.flower.getMate() == null) {
|
||||
this.mateWith(this.getFlower());
|
||||
}
|
||||
this.spawnButterflies();
|
||||
this.matureCaterpillar();
|
||||
this.checkIfDead(false);
|
||||
this.updateRender(true);
|
||||
}
|
||||
|
||||
private void doFlowerAge() {
|
||||
this.getFlower().age();
|
||||
if (this.getFlower().getAge() == 1) {
|
||||
Gardening.onGrowFromSeed(this.worldObj, this.xCoord, this.yCoord, this.zCoord);
|
||||
if (this.getOwner() != null && this.getFlower() != null) {
|
||||
BotanyCore.getFlowerRoot().getBreedingTracker(this.getWorldObj(), this.getOwner()).registerBirth(this.getFlower());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
if (this.renderInfo == null && this.getFlower() != null && this.getFlower().getGenome() != null) {
|
||||
this.renderInfo = new RenderInfo(this.getFlower(), this);
|
||||
}
|
||||
return (this.renderInfo != null) ? Botany.instance.getNetworkWrapper().getPacketFrom(new MessageFlowerUpdate(this.xCoord, this.yCoord, this.zCoord, this.renderInfo).GetMessage()) : null;
|
||||
}
|
||||
|
||||
public void updateRender(final boolean update) {
|
||||
if (update && this.getFlower() != null && this.getFlower().getGenome() != null) {
|
||||
final RenderInfo newInfo = new RenderInfo(this.getFlower(), this);
|
||||
if (this.renderInfo == null || !newInfo.equals(this.renderInfo)) {
|
||||
this.setRender(newInfo);
|
||||
}
|
||||
}
|
||||
final TileEntity above = this.worldObj.getTileEntity(this.xCoord, this.yCoord + 1, this.zCoord);
|
||||
if (above instanceof TileEntityFlower) {
|
||||
((TileEntityFlower) above).updateRender(true);
|
||||
}
|
||||
}
|
||||
|
||||
public int getSection() {
|
||||
return this.section;
|
||||
}
|
||||
|
||||
public void setSection(final int i) {
|
||||
this.section = i;
|
||||
if (BinnieCore.proxy.isSimulating(this.worldObj)) {
|
||||
this.updateRender(true);
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack getItemStack() {
|
||||
if (this.flower == null) {
|
||||
return null;
|
||||
}
|
||||
return Binnie.Genetics.getFlowerRoot().getMemberStack(this.getFlower(), (this.flower.getAge() == 0) ? EnumFlowerStage.SEED.ordinal() : EnumFlowerStage.FLOWER.ordinal());
|
||||
}
|
||||
|
||||
private TileEntityFlower getRoot() {
|
||||
if (this.getSection() == 0) {
|
||||
return null;
|
||||
}
|
||||
final TileEntity tile = this.worldObj.getTileEntity(this.xCoord, this.yCoord - this.getSection(), this.zCoord);
|
||||
return (tile instanceof TileEntityFlower) ? ((TileEntityFlower) tile) : null;
|
||||
}
|
||||
|
||||
public void onShear() {
|
||||
if (this.getRoot() != null) {
|
||||
this.getRoot().onShear();
|
||||
}
|
||||
if (this.getFlower() != null && this.getFlower().getAge() > 1) {
|
||||
final Random rand = new Random();
|
||||
final IFlower cutting = (IFlower) this.getFlower().copy();
|
||||
cutting.setAge(0);
|
||||
final ItemStack cuttingStack = BotanyCore.getFlowerRoot().getMemberStack(cutting, EnumFlowerStage.SEED.ordinal());
|
||||
final float f = 0.7f;
|
||||
final double d = rand.nextFloat() * f + (1.0f - f) * 0.5;
|
||||
final double d2 = rand.nextFloat() * f + (1.0f - f) * 0.5;
|
||||
final double d3 = rand.nextFloat() * f + (1.0f - f) * 0.5;
|
||||
final EntityItem entityitem = new EntityItem(this.worldObj, this.xCoord + d, this.yCoord + d2, this.zCoord + d3, cuttingStack);
|
||||
entityitem.delayBeforeCanPickup = 10;
|
||||
this.worldObj.spawnEntityInWorld(entityitem);
|
||||
for (int maxAge = this.getFlower().getMaxAge(), i = 0; i < maxAge; ++i) {
|
||||
if (rand.nextBoolean()) {
|
||||
this.getFlower().age();
|
||||
if (this.checkIfDead(true)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean checkIfDead(final boolean wasCut) {
|
||||
if (this.getSection() != 0) {
|
||||
return this.getRoot().checkIfDead(wasCut);
|
||||
}
|
||||
final EnumSoilType soil = Gardening.getSoilType(this.worldObj, this.xCoord, this.yCoord, this.zCoord);
|
||||
final int maxAge = (int) (this.flower.getMaxAge() * (1.0f + soil.ordinal() * 0.25f));
|
||||
if (this.flower.getAge() > maxAge) {
|
||||
if (!wasCut && this.flower.getMate() != null) {
|
||||
this.worldObj.setBlockToAir(this.xCoord, this.yCoord, this.zCoord);
|
||||
final IFlower offspring = this.flower.getOffspring(this.getWorldObj());
|
||||
final TileEntity above = this.worldObj.getTileEntity(this.xCoord, this.yCoord + 1, this.zCoord);
|
||||
if (above instanceof TileEntityFlower) {
|
||||
this.worldObj.setBlockToAir(this.xCoord, this.yCoord + 1, this.zCoord);
|
||||
}
|
||||
Gardening.plant(this.worldObj, this.xCoord, this.yCoord, this.zCoord, offspring, this.getOwner());
|
||||
}
|
||||
else {
|
||||
this.kill();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void kill() {
|
||||
if (this.flower.getAge() > 0) {
|
||||
this.worldObj.setBlock(this.xCoord, this.yCoord, this.zCoord, Botany.plant, BlockPlant.Type.DeadFlower.ordinal(), 2);
|
||||
}
|
||||
else {
|
||||
this.worldObj.setBlockToAir(this.xCoord, this.yCoord, this.zCoord);
|
||||
}
|
||||
for (int i = 1; this.worldObj.getTileEntity(this.xCoord, this.yCoord + i, this.zCoord) instanceof TileEntityFlower; ++i) {
|
||||
this.worldObj.setBlockToAir(this.xCoord, this.yCoord + i, this.zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean onBonemeal() {
|
||||
if (this.getFlower() == null) {
|
||||
return false;
|
||||
}
|
||||
if (!this.isBreeding()) {
|
||||
return false;
|
||||
}
|
||||
if (this.getFlower().isWilted()) {
|
||||
return false;
|
||||
}
|
||||
this.doFlowerAge();
|
||||
if (this.getFlower().getAge() > 1 && !this.getFlower().hasFlowered()) {
|
||||
this.getFlower().setFlowered(true);
|
||||
}
|
||||
this.checkIfDead(false);
|
||||
this.updateRender(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
public GameProfile getOwner() {
|
||||
return this.owner;
|
||||
}
|
||||
|
||||
public void setOwner(final GameProfile ownerName) {
|
||||
this.owner = ownerName;
|
||||
}
|
||||
|
||||
public void spawnButterflies() {
|
||||
if (!BinnieCore.isLepidopteryActive()) {
|
||||
return;
|
||||
}
|
||||
final int x = this.xCoord;
|
||||
final int y = this.yCoord;
|
||||
final int z = this.zCoord;
|
||||
final World world = this.worldObj;
|
||||
if (this.getCaterpillar() != null) {
|
||||
return;
|
||||
}
|
||||
if (world.rand.nextFloat() >= this.getFlower().getGenome().getSappiness()) {
|
||||
return;
|
||||
}
|
||||
if (this.worldObj.rand.nextFloat() >= 0.2f) {
|
||||
return;
|
||||
}
|
||||
final IButterfly spawn = Binnie.Genetics.getButterflyRoot().getIndividualTemplates().get(this.worldObj.rand.nextInt(Binnie.Genetics.getButterflyRoot().getIndividualTemplates().size()));
|
||||
if (this.worldObj.rand.nextFloat() >= spawn.getGenome().getPrimary().getRarity() * 0.5f) {
|
||||
return;
|
||||
}
|
||||
if (this.worldObj.countEntities(EntityButterfly.class) > 100) {
|
||||
return;
|
||||
}
|
||||
if (!spawn.canSpawn(this.worldObj, x, y, z)) {
|
||||
return;
|
||||
}
|
||||
if (world.isAirBlock(x, y + 1, z)) {
|
||||
this.attemptButterflySpawn(world, spawn, x, y + 1, z);
|
||||
}
|
||||
else if (world.isAirBlock(x - 1, y, z)) {
|
||||
this.attemptButterflySpawn(world, spawn, x - 1, y, z);
|
||||
}
|
||||
else if (world.isAirBlock(x + 1, y, z)) {
|
||||
this.attemptButterflySpawn(world, spawn, x + 1, y, z);
|
||||
}
|
||||
else if (world.isAirBlock(x, y, z - 1)) {
|
||||
this.attemptButterflySpawn(world, spawn, x, y, z - 1);
|
||||
}
|
||||
else if (world.isAirBlock(x, y, z + 1)) {
|
||||
this.attemptButterflySpawn(world, spawn, x, y, z + 1);
|
||||
}
|
||||
}
|
||||
|
||||
private void attemptButterflySpawn(final World world, final IButterfly butterfly, final double x, final double y, final double z) {
|
||||
if (BinnieCore.isLepidopteryActive()) {
|
||||
Binnie.Genetics.getButterflyRoot().spawnButterflyInWorld(world, butterfly.copy(), x, y + 0.10000000149011612, z);
|
||||
}
|
||||
}
|
||||
|
||||
public GameProfile getOwnerName() {
|
||||
return this.getOwner();
|
||||
}
|
||||
|
||||
public World getWorld() {
|
||||
return this.getWorldObj();
|
||||
}
|
||||
|
||||
public int getXCoord() {
|
||||
return this.xCoord;
|
||||
}
|
||||
|
||||
public int getYCoord() {
|
||||
return this.yCoord;
|
||||
}
|
||||
|
||||
public int getZCoord() {
|
||||
return this.zCoord;
|
||||
}
|
||||
|
||||
public int getBiomeId() {
|
||||
return this.worldObj.getBiomeGenForCoords(this.xCoord, this.zCoord).biomeID;
|
||||
}
|
||||
|
||||
public EnumTemperature getTemperature() {
|
||||
return EnumTemperature.getFromValue(this.worldObj.getBiomeGenForCoords(this.xCoord, this.zCoord).temperature);
|
||||
}
|
||||
|
||||
public EnumHumidity getHumidity() {
|
||||
return EnumHumidity.getFromValue(this.worldObj.getBiomeGenForCoords(this.xCoord, this.zCoord).rainfall);
|
||||
}
|
||||
|
||||
public void setErrorState(final int state) {
|
||||
}
|
||||
|
||||
public int getErrorOrdinal() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean addProduct(final ItemStack product, final boolean all) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IButterfly getCaterpillar() {
|
||||
return this.caterpillar;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIndividual getNanny() {
|
||||
return this.getFlower();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCaterpillar(final IButterfly butterfly) {
|
||||
this.caterpillar = butterfly;
|
||||
this.matureTime = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canNurse(final IButterfly butterfly) {
|
||||
return this.getFlower() != null && !this.getFlower().isWilted() && this.getFlower().getAge() > 1;
|
||||
}
|
||||
|
||||
private void matureCaterpillar() {
|
||||
if (this.getCaterpillar() == null) {
|
||||
return;
|
||||
}
|
||||
++this.matureTime;
|
||||
if (this.matureTime >= this.caterpillar.getGenome().getLifespan() / (this.caterpillar.getGenome().getFertility() * 2) && this.caterpillar.canTakeFlight(this.worldObj, this.xCoord, this.yCoord, this.zCoord)) {
|
||||
if (this.worldObj.isAirBlock(this.xCoord, this.yCoord + 1, this.zCoord)) {
|
||||
this.attemptButterflySpawn(this.worldObj, this.caterpillar, this.xCoord, this.yCoord + 1, this.zCoord);
|
||||
}
|
||||
else if (this.worldObj.isAirBlock(this.xCoord - 1, this.yCoord, this.zCoord)) {
|
||||
this.attemptButterflySpawn(this.worldObj, this.caterpillar, this.xCoord - 1, this.yCoord, this.zCoord);
|
||||
}
|
||||
else if (this.worldObj.isAirBlock(this.xCoord + 1, this.yCoord, this.zCoord)) {
|
||||
this.attemptButterflySpawn(this.worldObj, this.caterpillar, this.xCoord + 1, this.yCoord, this.zCoord);
|
||||
}
|
||||
else if (this.worldObj.isAirBlock(this.xCoord, this.yCoord, this.zCoord - 1)) {
|
||||
this.attemptButterflySpawn(this.worldObj, this.caterpillar, this.xCoord, this.yCoord, this.zCoord - 1);
|
||||
}
|
||||
else if (this.worldObj.isAirBlock(this.xCoord, this.yCoord, this.zCoord + 1)) {
|
||||
this.attemptButterflySpawn(this.worldObj, this.caterpillar, this.xCoord, this.yCoord, this.zCoord + 1);
|
||||
}
|
||||
this.setCaterpillar(null);
|
||||
}
|
||||
}
|
||||
|
||||
public void setRender(final RenderInfo render) {
|
||||
this.renderInfo = render;
|
||||
this.section = this.renderInfo.section;
|
||||
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
|
||||
}
|
||||
|
||||
public int getAge() {
|
||||
return (this.renderInfo == null) ? 1 : this.renderInfo.age;
|
||||
}
|
||||
|
||||
public int getRenderSection() {
|
||||
return (this.renderInfo == null) ? 1 : this.renderInfo.section;
|
||||
}
|
||||
|
||||
public boolean isWilted() {
|
||||
return this.renderInfo != null && this.renderInfo.wilted;
|
||||
}
|
||||
|
||||
public boolean isFlowered() {
|
||||
return this.renderInfo == null || this.renderInfo.flowered;
|
||||
}
|
||||
|
||||
public int getPrimaryColour() {
|
||||
return (this.renderInfo == null) ? EnumFlowerColor.Red.getColor(false) : this.renderInfo.primary.getColor(this.isWilted());
|
||||
}
|
||||
|
||||
public int getSecondaryColour() {
|
||||
return (this.renderInfo == null) ? EnumFlowerColor.Red.getColor(false) : this.renderInfo.secondary.getColor(this.isWilted());
|
||||
}
|
||||
|
||||
public int getStemColour() {
|
||||
return (this.renderInfo == null) ? EnumFlowerColor.Green.getColor(false) : this.renderInfo.stem.getColor(this.isWilted());
|
||||
}
|
||||
|
||||
public IFlowerType getType() {
|
||||
return (this.renderInfo == null) ? EnumFlowerType.Poppy : this.renderInfo.type;
|
||||
}
|
||||
|
||||
public BiomeGenBase getBiome() {
|
||||
return this.getWorld().getBiomeGenForCoords(this.xCoord, this.zCoord);
|
||||
}
|
||||
|
||||
public void setErrorState(final IErrorState state) {
|
||||
}
|
||||
|
||||
public IErrorState getErrorState() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean setErrorCondition(final boolean condition, final IErrorState errorState) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public Set<IErrorState> getErrorStates() {
|
||||
return new HashSet<IErrorState>();
|
||||
}
|
||||
|
||||
public static class RenderInfo
|
||||
{
|
||||
public IFlowerColour primary;
|
||||
public IFlowerColour secondary;
|
||||
public IFlowerColour stem;
|
||||
public IFlowerType type;
|
||||
public byte age;
|
||||
public boolean wilted;
|
||||
public boolean flowered;
|
||||
public byte section;
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (obj instanceof RenderInfo) {
|
||||
final RenderInfo o = (RenderInfo) obj;
|
||||
return o.age == this.age && o.wilted == this.wilted && o.flowered == this.flowered && o.primary == this.primary && o.secondary == this.secondary && o.stem == this.stem && o.type == this.type;
|
||||
}
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
||||
public RenderInfo() {
|
||||
}
|
||||
|
||||
public RenderInfo(final IFlower flower, final TileEntityFlower tile) {
|
||||
this.section = (byte) tile.getSection();
|
||||
this.primary = flower.getGenome().getPrimaryColor();
|
||||
this.secondary = flower.getGenome().getSecondaryColor();
|
||||
this.stem = flower.getGenome().getStemColor();
|
||||
this.age = (byte) flower.getAge();
|
||||
this.wilted = flower.isWilted();
|
||||
this.flowered = flower.hasFlowered();
|
||||
this.type = flower.getGenome().getType();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChunkCoordinates getCoordinates() {
|
||||
return new ChunkCoordinates(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
// TODO ??
|
||||
@Override
|
||||
public boolean isPollinated() {
|
||||
return isBreeding();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.gardening;
|
||||
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
import binnie.botany.api.gardening.IBlockSoil;
|
||||
import java.util.Random;
|
||||
import java.util.List;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.block.Block;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import binnie.botany.Botany;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import java.util.ArrayList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.block.BlockBush;
|
||||
|
||||
public class BlockPlant extends BlockBush
|
||||
{
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(final World world, final int x, final int y, final int z, final int metadata, final int fortune) {
|
||||
return new ArrayList<ItemStack>();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(final IIconRegister p_149651_1_) {
|
||||
for (final Type t : Type.values()) {
|
||||
t.icon = Botany.proxy.getIcon(p_149651_1_, t.name().toLowerCase());
|
||||
}
|
||||
}
|
||||
|
||||
public BlockPlant() {
|
||||
this.setBlockName("plant");
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
this.setTickRandomly(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canPlaceBlockOn(final Block p_149854_1_) {
|
||||
return super.canPlaceBlockOn(p_149854_1_) || Gardening.isSoil(p_149854_1_);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(final int side, final int meta) {
|
||||
return Type.values()[meta % Type.values().length].icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(final int p_149692_1_) {
|
||||
return p_149692_1_;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(final Item p_149666_1_, final CreativeTabs p_149666_2_, final List p_149666_3_) {
|
||||
for (final Type type : Type.values()) {
|
||||
p_149666_3_.add(type.get());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(final World world, final int x, final int y, final int z, final Random random) {
|
||||
final Type type = Type.get(world.getBlockMetadata(x, y, z));
|
||||
if (random.nextInt(4) == 0) {
|
||||
if (type == Type.Weeds) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, Type.WeedsLong.ordinal(), 2);
|
||||
}
|
||||
else if (type == Type.WeedsLong) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, Type.WeedsVeryLong.ordinal(), 2);
|
||||
}
|
||||
else if (type == Type.DeadFlower) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, Type.DecayingFlower.ordinal(), 2);
|
||||
}
|
||||
else if (type == Type.DecayingFlower) {
|
||||
world.setBlockToAir(x, y, z);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (random.nextInt(6) == 0) {
|
||||
if (type == Type.Weeds) {
|
||||
world.setBlockToAir(x, y, z);
|
||||
}
|
||||
else if (type == Type.WeedsLong) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, Type.Weeds.ordinal(), 2);
|
||||
}
|
||||
else if (type == Type.WeedsVeryLong) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, Type.WeedsLong.ordinal(), 2);
|
||||
}
|
||||
}
|
||||
final Block below = world.getBlock(x, y - 1, z);
|
||||
if (Gardening.isSoil(below)) {
|
||||
final IBlockSoil soil = (IBlockSoil) below;
|
||||
if (random.nextInt(3) == 0) {
|
||||
if (type == Type.Weeds || type == Type.WeedsLong || type == Type.WeedsVeryLong) {
|
||||
if (!soil.degrade(world, x, y - 1, z, EnumSoilType.LOAM)) {
|
||||
soil.degrade(world, x, y - 1, z, EnumSoilType.SOIL);
|
||||
}
|
||||
}
|
||||
else if (type == Type.DecayingFlower && !soil.fertilise(world, x, y - 1, z, EnumSoilType.LOAM)) {
|
||||
soil.fertilise(world, x, y - 1, z, EnumSoilType.FLOWERBED);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReplaceable(final IBlockAccess world, final int x, final int y, final int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isWeed(final IBlockAccess world, final int x, final int y, final int z) {
|
||||
if (!(world.getBlock(x, y, z) instanceof BlockPlant)) {
|
||||
return false;
|
||||
}
|
||||
final Type type = Type.get(world.getBlockMetadata(x, y, z));
|
||||
return type == Type.Weeds || type == Type.WeedsLong || type == Type.WeedsVeryLong;
|
||||
}
|
||||
|
||||
public enum Type
|
||||
{
|
||||
Weeds("Weeds"),
|
||||
WeedsLong("Long Weeds"),
|
||||
WeedsVeryLong("Very Long Weeds"),
|
||||
DeadFlower("Dead Flower"),
|
||||
DecayingFlower("Decaying Flower");
|
||||
|
||||
public IIcon icon;
|
||||
String name;
|
||||
|
||||
private Type(final String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public ItemStack get() {
|
||||
return new ItemStack(Botany.plant, 1, this.ordinal());
|
||||
}
|
||||
|
||||
public static Type get(final int id) {
|
||||
return values()[id % values().length];
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,220 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.gardening;
|
||||
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
import binnie.Binnie;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import java.util.Random;
|
||||
import net.minecraft.world.World;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import net.minecraft.block.material.Material;
|
||||
import binnie.botany.Botany;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.init.Blocks;
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import java.util.List;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
import net.minecraft.util.IIcon;
|
||||
import binnie.botany.api.gardening.IBlockSoil;
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
public class BlockSoil extends Block implements IBlockSoil
|
||||
{
|
||||
boolean weedKilled;
|
||||
IIcon[] iconsTop;
|
||||
IIcon[] iconsSide;
|
||||
IIcon[] iconsNoWeed;
|
||||
EnumSoilType type;
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(final Item par1, final CreativeTabs par2CreativeTabs, final List par3List) {
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
par3List.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(final IBlockAccess world, final int x, final int y, final int z, final int side) {
|
||||
return this.getIcon(side, world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(final int side, int meta) {
|
||||
meta = ((meta >= 9) ? 8 : meta);
|
||||
final EnumMoisture moisture = EnumMoisture.values()[meta % 3];
|
||||
final EnumAcidity acidity = EnumAcidity.values()[meta / 3];
|
||||
return (side == 1) ? (this.weedKilled ? this.iconsNoWeed[meta] : this.iconsTop[meta]) : ((side == 0) ? Blocks.dirt.getIcon(side, 0) : this.iconsSide[meta]);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(final IIconRegister register) {
|
||||
for (final EnumMoisture moisture : EnumMoisture.values()) {
|
||||
for (final EnumAcidity pH : EnumAcidity.values()) {
|
||||
this.iconsTop[moisture.ordinal() + pH.ordinal() * 3] = Botany.proxy.getIcon(register, "soil/" + this.getType().getID() + "." + pH.getID() + "." + moisture.getID() + ".0");
|
||||
this.iconsSide[moisture.ordinal() + pH.ordinal() * 3] = Botany.proxy.getIcon(register, "soil/" + this.getType().getID() + "." + pH.getID() + "." + moisture.getID() + ".1");
|
||||
this.iconsNoWeed[moisture.ordinal() + pH.ordinal() * 3] = Botany.proxy.getIcon(register, "soil/" + this.getType().getID() + "." + pH.getID() + "." + moisture.getID() + ".2");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public EnumSoilType getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public BlockSoil(final EnumSoilType type, final String blockName, final boolean weedKilled) {
|
||||
super(Material.ground);
|
||||
this.weedKilled = false;
|
||||
this.iconsTop = new IIcon[9];
|
||||
this.iconsSide = new IIcon[9];
|
||||
this.iconsNoWeed = new IIcon[9];
|
||||
this.weedKilled = weedKilled;
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
this.setBlockName(blockName);
|
||||
this.setTickRandomly(true);
|
||||
this.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 0.9375f, 1.0f);
|
||||
this.setLightOpacity(255);
|
||||
this.setHardness(0.5f);
|
||||
this.setStepSound(Block.soundTypeGravel);
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(final int p_149692_1_) {
|
||||
return p_149692_1_;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(final World world, final int x, final int y, final int z, final Random random) {
|
||||
final int meta = world.getBlockMetadata(x, y, z);
|
||||
EnumMoisture moisture = EnumMoisture.values()[meta % 3];
|
||||
final EnumAcidity acidity = EnumAcidity.values()[meta / 3];
|
||||
final EnumMoisture desiredMoisture = Gardening.getNaturalMoisture(world, x, y, z);
|
||||
if (desiredMoisture.ordinal() > moisture.ordinal()) {
|
||||
moisture = ((moisture == EnumMoisture.Dry) ? EnumMoisture.Normal : EnumMoisture.Damp);
|
||||
}
|
||||
if (desiredMoisture.ordinal() < moisture.ordinal()) {
|
||||
moisture = ((moisture == EnumMoisture.Damp) ? EnumMoisture.Normal : EnumMoisture.Dry);
|
||||
}
|
||||
final int meta2 = getMeta(acidity, moisture);
|
||||
if (meta != meta2) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, meta2, 2);
|
||||
}
|
||||
if (!this.weedKilled && random.nextInt(5 - this.getType(world, x, y, z).ordinal()) == 0 && world.getBlock(x, y + 1, z) == Blocks.air) {
|
||||
world.setBlock(x, y + 1, z, Botany.plant, BlockPlant.Type.Weeds.ordinal(), 2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(final World p_149668_1_, final int p_149668_2_, final int p_149668_3_, final int p_149668_4_) {
|
||||
return AxisAlignedBB.getBoundingBox(p_149668_2_ + 0, p_149668_3_ + 0, p_149668_4_ + 0, p_149668_2_ + 1, p_149668_3_ + 1, p_149668_4_ + 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumAcidity getPH(final World world, final int x, final int y, final int z) {
|
||||
return EnumAcidity.values()[world.getBlockMetadata(x, y, z) / 3];
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumMoisture getMoisture(final World world, final int x, final int y, final int z) {
|
||||
return EnumMoisture.values()[world.getBlockMetadata(x, y, z) % 3];
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumSoilType getType(final World world, final int x, final int y, final int z) {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean fertilise(final World world, final int x, final int y, final int z, final EnumSoilType maxLevel) {
|
||||
final EnumSoilType type = this.getType(world, x, y, z);
|
||||
if (type.ordinal() >= maxLevel.ordinal()) {
|
||||
return false;
|
||||
}
|
||||
final int meta = world.getBlockMetadata(x, y, z);
|
||||
return world.setBlock(x, y, z, Gardening.getSoilBlock(maxLevel, this.weedKilled), meta, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean degrade(final World world, final int x, final int y, final int z, final EnumSoilType minLevel) {
|
||||
final EnumSoilType type = this.getType(world, x, y, z);
|
||||
if (type.ordinal() <= minLevel.ordinal()) {
|
||||
return false;
|
||||
}
|
||||
final int meta = world.getBlockMetadata(x, y, z);
|
||||
return world.setBlock(x, y, z, Gardening.getSoilBlock(minLevel, this.weedKilled), meta, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setPH(final World world, final int x, final int y, final int z, final EnumAcidity pH) {
|
||||
final int meta = getMeta(pH, this.getMoisture(world, x, y, z));
|
||||
return world.setBlockMetadataWithNotify(x, y, z, meta, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setMoisture(final World world, final int x, final int y, final int z, final EnumMoisture moisture) {
|
||||
final int meta = getMeta(this.getPH(world, x, y, z), moisture);
|
||||
return world.setBlockMetadataWithNotify(x, y, z, meta, 2);
|
||||
}
|
||||
|
||||
public static int getMeta(final EnumAcidity acid, final EnumMoisture moisture) {
|
||||
return acid.ordinal() * 3 + moisture.ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(final World world, final int x, final int y, final int z, final Block p_149695_5_) {
|
||||
super.onNeighborBlockChange(world, x, y, z, p_149695_5_);
|
||||
if (world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN, false)) {
|
||||
world.setBlock(x, y, z, Blocks.dirt, 0, 2);
|
||||
}
|
||||
}
|
||||
|
||||
public static String getPH(final ItemStack stack) {
|
||||
return Binnie.Language.localise(EnumAcidity.values()[stack.getItemDamage() / 3]);
|
||||
}
|
||||
|
||||
public static String getMoisture(final ItemStack stack) {
|
||||
return Binnie.Language.localise(EnumMoisture.values()[stack.getItemDamage() % 3]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSustainPlant(final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection direction, final IPlantable plantable) {
|
||||
final Block plant = plantable.getPlant(world, x, y + 1, z);
|
||||
if (plant == Botany.flower) {
|
||||
return true;
|
||||
}
|
||||
if (plant == Botany.plant) {
|
||||
return !this.weedKilled || !BlockPlant.isWeed(world, x, y, z);
|
||||
}
|
||||
return world instanceof World && Blocks.dirt.canSustainPlant(world, x, y, z, direction, plantable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean resistsWeeds(final World world, final int x, final int y, final int z) {
|
||||
return this.weedKilled;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,264 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.gardening;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import binnie.botany.items.BotanyItems;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import java.util.Collection;
|
||||
import binnie.core.BinnieCore;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import binnie.botany.flower.TileEntityFlower;
|
||||
import binnie.botany.Botany;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import binnie.botany.api.IFlower;
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import net.minecraft.init.Blocks;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.Item;
|
||||
import binnie.botany.api.gardening.IBlockSoil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import java.util.Map;
|
||||
|
||||
public class Gardening
|
||||
{
|
||||
public static Map<ItemStack, Integer> fertiliserAcid;
|
||||
public static Map<ItemStack, Integer> fertiliserAlkaline;
|
||||
public static Map<ItemStack, Integer> fertiliserNutrient;
|
||||
|
||||
public static boolean isSoil(final Block block) {
|
||||
return block instanceof IBlockSoil;
|
||||
}
|
||||
|
||||
public static boolean isSoil(final Item item) {
|
||||
return item instanceof ItemBlock && isSoil(((ItemBlock) item).field_150939_a);
|
||||
}
|
||||
|
||||
public static boolean isSoil(final ItemStack item) {
|
||||
return isSoil(item.getItem());
|
||||
}
|
||||
|
||||
public static EnumMoisture getNaturalMoisture(final World world, final int x, final int y, final int z) {
|
||||
float bias = getBiomeMoisture(world.getBiomeGenForCoords(x, z), y);
|
||||
for (int dx = -1; dx < 2; ++dx) {
|
||||
for (int dz = -1; dz < 2; ++dz) {
|
||||
if (dx != 0 || dz != 0) {
|
||||
if (world.getBlock(x + dx, y, z + dz) == Blocks.sand) {
|
||||
bias -= 1.5;
|
||||
}
|
||||
else if (world.getBlock(x + dx, y, z + dz) == Blocks.water) {
|
||||
bias += 1.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (world.isRaining() && world.canBlockSeeTheSky(x, y + 1, z) && world.getPrecipitationHeight(x, z) <= y + 1) {
|
||||
bias += 1.5;
|
||||
}
|
||||
for (int dx = -1; dx < 2; ++dx) {
|
||||
for (int dz = -1; dz < 2; ++dz) {
|
||||
if (dx != 0 || dz != 0) {
|
||||
if (world.getBlock(x + dx, y, z + dz) == Blocks.gravel && bias > 0.0f) {
|
||||
bias *= 0.4f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return (bias <= -1.0f) ? EnumMoisture.Dry : ((bias >= 1.0f) ? EnumMoisture.Damp : EnumMoisture.Normal);
|
||||
}
|
||||
|
||||
public static EnumAcidity getNaturalPH(final World world, final int x, final int y, final int z) {
|
||||
final float bias = getBiomePH(world.getBiomeGenForCoords(x, z), y);
|
||||
return (bias <= -1.0f) ? EnumAcidity.Acid : ((bias >= 1.0f) ? EnumAcidity.Alkaline : EnumAcidity.Neutral);
|
||||
}
|
||||
|
||||
public static float getBiomeMoisture(final BiomeGenBase biome, final int H) {
|
||||
final double R = biome.rainfall;
|
||||
final double T = biome.temperature;
|
||||
final double m = 3.2 * (R - 0.5) - 0.4 * (1.0 + T + 0.5 * T * T) + 1.1 - 1.6 * (T - 0.9) * (T - 0.9) - 0.002 * (H - 64);
|
||||
return (float) ((m == 0.0) ? m : ((m < 0.0) ? (-Math.sqrt(m * m)) : Math.sqrt(m * m)));
|
||||
}
|
||||
|
||||
public static float getBiomePH(final BiomeGenBase biome, final int H) {
|
||||
final double R = biome.rainfall;
|
||||
final double T = biome.temperature;
|
||||
return (float) (-3.0 * (R - 0.5) + 0.5 * (T - 0.699999988079071) * (T - 0.699999988079071) + 0.02f * (H - 64) - 0.15000000596046448);
|
||||
}
|
||||
|
||||
public static void createSoil(final World world, final int x, final int y, final int z, final EnumSoilType soil, final EnumMoisture moisture, final EnumAcidity acidity) {
|
||||
final int meta = moisture.ordinal() + acidity.ordinal() * 3;
|
||||
world.setBlock(x, y, z, getSoilBlock(soil), meta, 2);
|
||||
}
|
||||
|
||||
public static boolean plant(final World world, final int x, final int y, final int z, final IFlower flower, final GameProfile owner) {
|
||||
final boolean set = world.setBlock(x, y, z, Botany.flower, 0, 2);
|
||||
if (!set) {
|
||||
return false;
|
||||
}
|
||||
final TileEntity tileFlower = world.getTileEntity(x, y, z);
|
||||
final TileEntity below = world.getTileEntity(x, y - 1, z);
|
||||
if (tileFlower != null && tileFlower instanceof TileEntityFlower) {
|
||||
if (below instanceof TileEntityFlower) {
|
||||
((TileEntityFlower) tileFlower).setSection(((TileEntityFlower) below).getSection());
|
||||
}
|
||||
else {
|
||||
((TileEntityFlower) tileFlower).create(flower, owner);
|
||||
}
|
||||
}
|
||||
tryGrowSection(world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void tryGrowSection(final World world, final int x, final int y, final int z) {
|
||||
if (!BinnieCore.proxy.isSimulating(world)) {
|
||||
return;
|
||||
}
|
||||
final TileEntity flower = world.getTileEntity(x, y, z);
|
||||
if (flower != null && flower instanceof TileEntityFlower) {
|
||||
final IFlower iflower = ((TileEntityFlower) flower).getFlower();
|
||||
final int section = ((TileEntityFlower) flower).getSection();
|
||||
if (iflower != null && section < iflower.getGenome().getPrimary().getType().getSections() - 1 && iflower.getAge() > 0) {
|
||||
world.setBlock(x, y + 1, z, Botany.flower, 0, 2);
|
||||
final TileEntity tileFlower = world.getTileEntity(x, y + 1, z);
|
||||
if (tileFlower != null && tileFlower instanceof TileEntityFlower) {
|
||||
((TileEntityFlower) tileFlower).setSection(section + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void onGrowFromSeed(final World world, final int x, final int y, final int z) {
|
||||
tryGrowSection(world, x, y, z);
|
||||
}
|
||||
|
||||
public static Collection<ItemStack> getAcidFertilisers() {
|
||||
return Gardening.fertiliserAcid.keySet();
|
||||
}
|
||||
|
||||
public static Collection<ItemStack> getAlkalineFertilisers() {
|
||||
return Gardening.fertiliserAlkaline.keySet();
|
||||
}
|
||||
|
||||
public static Collection<ItemStack> getNutrientFertilisers() {
|
||||
return Gardening.fertiliserNutrient.keySet();
|
||||
}
|
||||
|
||||
public static boolean isAcidFertiliser(final ItemStack itemstack) {
|
||||
for (final ItemStack stack : getAcidFertilisers()) {
|
||||
if (stack != null && stack.isItemEqual(itemstack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isAlkalineFertiliser(final ItemStack itemstack) {
|
||||
for (final ItemStack stack : getAlkalineFertilisers()) {
|
||||
if (stack != null && stack.isItemEqual(itemstack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isNutrientFertiliser(final ItemStack itemstack) {
|
||||
for (final ItemStack stack : getNutrientFertilisers()) {
|
||||
if (stack != null && stack.isItemEqual(itemstack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int getFertiliserStrength(final ItemStack stack) {
|
||||
if (stack == null) {
|
||||
return 1;
|
||||
}
|
||||
for (final Map.Entry<ItemStack, Integer> entry : Gardening.fertiliserAcid.entrySet()) {
|
||||
if (entry.getKey().isItemEqual(stack)) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
for (final Map.Entry<ItemStack, Integer> entry : Gardening.fertiliserAlkaline.entrySet()) {
|
||||
if (entry.getKey().isItemEqual(stack)) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
for (final Map.Entry<ItemStack, Integer> entry : Gardening.fertiliserNutrient.entrySet()) {
|
||||
if (entry.getKey().isItemEqual(stack)) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static boolean canTolerate(final IFlower flower, final World world, final int x, final int y, final int z) {
|
||||
if (flower == null || flower.getGenome() == null) {
|
||||
return false;
|
||||
}
|
||||
final Block soil = world.getBlock(x, y - 1, z);
|
||||
final int soilMeta = world.getBlockMetadata(x, y - 1, z);
|
||||
final BiomeGenBase biome = world.getBiomeGenForCoords(x, z);
|
||||
return canTolerate(flower, EnumAcidity.values()[soilMeta / 3 % 3], EnumMoisture.values()[soilMeta % 3], EnumTemperature.getFromValue(biome.temperature));
|
||||
}
|
||||
|
||||
public static EnumSoilType getSoilType(final World world, final int x, final int y, final int z) {
|
||||
if (world.getBlock(x, y, z) instanceof IBlockSoil) {
|
||||
return ((IBlockSoil) world.getBlock(x, y, z)).getType(world, x, y, z);
|
||||
}
|
||||
return EnumSoilType.SOIL;
|
||||
}
|
||||
|
||||
public static Block getSoilBlock(final EnumSoilType type) {
|
||||
return getSoilBlock(type, false);
|
||||
}
|
||||
|
||||
public static Block getSoilBlock(final EnumSoilType type, final boolean weedkill) {
|
||||
switch (type) {
|
||||
case FLOWERBED: {
|
||||
return weedkill ? Botany.flowerbedNoWeed : Botany.flowerbed;
|
||||
}
|
||||
case LOAM: {
|
||||
return weedkill ? Botany.loamNoWeed : Botany.loam;
|
||||
}
|
||||
default: {
|
||||
return weedkill ? Botany.soilNoWeed : Botany.soil;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean canTolerate(final IFlower flower, final EnumAcidity ePH, final EnumMoisture eMoisture, final EnumTemperature eTemp) {
|
||||
return flower.getGenome().canTolerate(ePH) && flower.getGenome().canTolerate(eMoisture) && flower.getGenome().canTolerate(eTemp);
|
||||
}
|
||||
|
||||
public static boolean isWeedkiller(final ItemStack heldItem) {
|
||||
return heldItem != null && heldItem.isItemEqual(BotanyItems.Weedkiller.get(1));
|
||||
}
|
||||
|
||||
public static boolean addWeedKiller(final World world, final int x, final int y, final int z) {
|
||||
if (!(world.getBlock(x, y, z) instanceof IBlockSoil)) {
|
||||
return false;
|
||||
}
|
||||
final EnumSoilType type = getSoilType(world, x, y, z);
|
||||
final Block block = getSoilBlock(type, true);
|
||||
final boolean done = world.setBlock(x, y, z, block, world.getBlockMetadata(x, y, z), 2);
|
||||
if (done && BlockPlant.isWeed(world, x, y + 1, z)) {
|
||||
world.setBlockToAir(x, y + 1, z);
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
static {
|
||||
Gardening.fertiliserAcid = new LinkedHashMap<ItemStack, Integer>();
|
||||
Gardening.fertiliserAlkaline = new LinkedHashMap<ItemStack, Integer>();
|
||||
Gardening.fertiliserNutrient = new LinkedHashMap<ItemStack, Integer>();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.gardening;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import java.util.List;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
|
||||
public class ItemSoil extends ItemBlock
|
||||
{
|
||||
EnumSoilType type;
|
||||
private boolean noWeed;
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(final ItemStack stack, final EntityPlayer p_77624_2_, final List p_77624_3_, final boolean p_77624_4_) {
|
||||
super.addInformation(stack, p_77624_2_, p_77624_3_, p_77624_4_);
|
||||
final EnumMoisture moisture = EnumMoisture.values()[stack.getItemDamage() % 3];
|
||||
final EnumAcidity acidity = EnumAcidity.values()[stack.getItemDamage() / 3];
|
||||
String info = "";
|
||||
if (moisture == EnumMoisture.Dry) {
|
||||
info += "§eDry§f";
|
||||
}
|
||||
if (moisture == EnumMoisture.Damp) {
|
||||
info += "§9Damp§f";
|
||||
}
|
||||
if (acidity == EnumAcidity.Acid) {
|
||||
if (info.length() > 0) {
|
||||
info += ", ";
|
||||
}
|
||||
info += "§cAcidic§f";
|
||||
}
|
||||
if (acidity == EnumAcidity.Alkaline) {
|
||||
if (info.length() > 0) {
|
||||
info += ", ";
|
||||
}
|
||||
info += "§bAlkaline§f";
|
||||
}
|
||||
if (info.length() > 0) {
|
||||
p_77624_3_.add(info);
|
||||
}
|
||||
if (this.noWeed) {
|
||||
p_77624_3_.add("Weedkiller");
|
||||
}
|
||||
}
|
||||
|
||||
public ItemSoil(final Block p_i45328_1_) {
|
||||
super(p_i45328_1_);
|
||||
this.type = ((BlockSoil) this.field_150939_a).getType();
|
||||
this.noWeed = ((BlockSoil) this.field_150939_a).weedKilled;
|
||||
this.hasSubtypes = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(final ItemStack stack) {
|
||||
return this.type.name().substring(0, 1) + this.type.name().toLowerCase().substring(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(final int p_77647_1_) {
|
||||
return p_77647_1_;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.gardening;
|
||||
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import binnie.botany.Botany;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import binnie.Binnie;
|
||||
import binnie.botany.api.gardening.IBlockSoil;
|
||||
import binnie.core.BinnieCore;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class ItemSoilMeter extends Item
|
||||
{
|
||||
@Override
|
||||
public boolean onItemUse(final ItemStack stack, final EntityPlayer player, final World world, final int x, int y, final int z, final int p_77648_7_, final float p_77648_8_, final float p_77648_9_, final float p_77648_10_) {
|
||||
Block block = world.getBlock(x, y, z);
|
||||
if (!Gardening.isSoil(block)) {
|
||||
--y;
|
||||
block = world.getBlock(x, y, z);
|
||||
}
|
||||
if (Gardening.isSoil(block) && !BinnieCore.proxy.isSimulating(world)) {
|
||||
final IBlockSoil soil = (IBlockSoil) block;
|
||||
final EnumSoilType type = soil.getType(world, x, y, z);
|
||||
final EnumMoisture moisture = soil.getMoisture(world, x, y, z);
|
||||
final EnumAcidity pH = soil.getPH(world, x, y, z);
|
||||
String info = "Type: ";
|
||||
info = info + "§" + (new char[] { '8', '6', 'd' })[type.ordinal()] + Binnie.Language.localise(type) + "§f";
|
||||
info += ", Moisture: ";
|
||||
info = info + "§" + (new char[] { 'e', '7', '9' })[moisture.ordinal()] + Binnie.Language.localise(moisture) + "§f";
|
||||
info += ", pH: ";
|
||||
info = info + "§" + (new char[] { 'c', 'a', 'b' })[pH.ordinal()] + Binnie.Language.localise(pH) + "§f";
|
||||
final IChatComponent chat = new ChatComponentText(info);
|
||||
player.addChatMessage(chat);
|
||||
}
|
||||
return super.onItemUse(stack, player, world, x, y, z, p_77648_7_, p_77648_8_, p_77648_9_, p_77648_10_);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(final IIconRegister register) {
|
||||
this.itemIcon = Botany.proxy.getIcon(register, "soilMeter");
|
||||
}
|
||||
|
||||
public ItemSoilMeter() {
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
this.setUnlocalizedName("soilMeter");
|
||||
this.setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(final ItemStack i) {
|
||||
return "Soil Meter";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.gardening;
|
||||
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import binnie.botany.Botany;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class ItemTrowel extends Item
|
||||
{
|
||||
protected Item.ToolMaterial theToolMaterial;
|
||||
String locName;
|
||||
|
||||
public ItemTrowel(final Item.ToolMaterial p_i45343_1_, final String material) {
|
||||
this.theToolMaterial = p_i45343_1_;
|
||||
this.maxStackSize = 1;
|
||||
this.setMaxDamage(p_i45343_1_.getMaxUses());
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
this.setUnlocalizedName("trowel" + material);
|
||||
this.locName = "trowel" + material;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(final IIconRegister p_94581_1_) {
|
||||
this.itemIcon = Botany.proxy.getIcon(p_94581_1_, "tools/" + this.locName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(final ItemStack stack, final EntityPlayer player, final World world, final int x, final int y, final int z, final int p_77648_7_, final float p_77648_8_, final float p_77648_9_, final float p_77648_10_) {
|
||||
if (!player.canPlayerEdit(x, y, z, p_77648_7_, stack)) {
|
||||
return false;
|
||||
}
|
||||
final Block block = world.getBlock(x, y, z);
|
||||
if (p_77648_7_ == 0 || (!world.getBlock(x, y + 1, z).isAir(world, x, y + 1, z) && world.getBlock(x, y + 1, z) != Botany.flower) || (block != Blocks.grass && block != Blocks.dirt)) {
|
||||
return false;
|
||||
}
|
||||
final Block block2 = Botany.soil;
|
||||
world.playSoundEffect(x + 0.5f, y + 0.5f, z + 0.5f, block2.stepSound.getStepResourcePath(), (block2.stepSound.getVolume() + 1.0f) / 2.0f, block2.stepSound.getPitch() * 0.8f);
|
||||
if (world.isRemote) {
|
||||
return true;
|
||||
}
|
||||
final EnumMoisture moisture = Gardening.getNaturalMoisture(world, x, y, z);
|
||||
final EnumAcidity acidity = Gardening.getNaturalPH(world, x, y, z);
|
||||
Gardening.createSoil(world, x, y, z, EnumSoilType.SOIL, moisture, acidity);
|
||||
stack.damageItem(1, player);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean isFull3D() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getToolMaterialName() {
|
||||
return this.theToolMaterial.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.gardening;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
|
||||
public class ItemWeed extends ItemBlock
|
||||
{
|
||||
public ItemWeed(final Block p_i45328_1_) {
|
||||
super(p_i45328_1_);
|
||||
this.setHasSubtypes(true);
|
||||
this.hasSubtypes = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(final ItemStack stack) {
|
||||
return BlockPlant.Type.values()[stack.getItemDamage()].getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(final int p_77647_1_) {
|
||||
return p_77647_1_;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(final int p_77617_1_) {
|
||||
return this.field_150939_a.getIcon(2, p_77617_1_);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,274 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.gardening;
|
||||
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import java.util.Map;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import binnie.core.Mods;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import binnie.botany.farm.CircuitGarden;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import net.minecraft.init.Blocks;
|
||||
import binnie.botany.ceramic.PigmentRecipe;
|
||||
import net.minecraftforge.oredict.RecipeSorter;
|
||||
import binnie.botany.ceramic.CeramicTileRecipe;
|
||||
import binnie.core.block.MultipassItemRenderer;
|
||||
import binnie.botany.ceramic.BlockCeramicBrick;
|
||||
import binnie.botany.ceramic.BlockCeramicPatterned;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import binnie.core.block.ItemMetadataRenderer;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.block.ItemMetadata;
|
||||
import binnie.botany.ceramic.BlockStained;
|
||||
import binnie.botany.ceramic.BlockCeramic;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import binnie.botany.items.ItemClay;
|
||||
import binnie.botany.items.ItemPigment;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.items.BotanyItems;
|
||||
import binnie.Binnie;
|
||||
import net.minecraft.item.Item;
|
||||
import binnie.botany.flower.ItemInsulatedTube;
|
||||
import net.minecraft.block.Block;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import java.util.HashMap;
|
||||
import binnie.core.IInitializable;
|
||||
|
||||
public class ModuleGardening implements IInitializable
|
||||
{
|
||||
public static HashMap<ItemStack, Integer> queuedAcidFertilisers;
|
||||
public static HashMap<ItemStack, Integer> queuedAlkalineFertilisers;
|
||||
public static HashMap<ItemStack, Integer> queuedNutrientFertilisers;
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
Botany.soil = new BlockSoil(EnumSoilType.SOIL, "soil", false);
|
||||
Botany.loam = new BlockSoil(EnumSoilType.LOAM, "loam", false);
|
||||
Botany.flowerbed = new BlockSoil(EnumSoilType.FLOWERBED, "flowerbed", false);
|
||||
Botany.soilNoWeed = new BlockSoil(EnumSoilType.SOIL, "soilNoWeed", true);
|
||||
Botany.loamNoWeed = new BlockSoil(EnumSoilType.LOAM, "loamNoWeed", true);
|
||||
Botany.flowerbedNoWeed = new BlockSoil(EnumSoilType.FLOWERBED, "flowerbedNoWeed", true);
|
||||
GameRegistry.registerBlock(Botany.plant = new BlockPlant(), ItemWeed.class, "plant");
|
||||
GameRegistry.registerBlock(Botany.soil, ItemSoil.class, "soil");
|
||||
GameRegistry.registerBlock(Botany.loam, ItemSoil.class, "loam");
|
||||
GameRegistry.registerBlock(Botany.flowerbed, ItemSoil.class, "flowerbed");
|
||||
GameRegistry.registerBlock(Botany.soilNoWeed, ItemSoil.class, "soilNoWeed");
|
||||
GameRegistry.registerBlock(Botany.loamNoWeed, ItemSoil.class, "loamNoWeed");
|
||||
GameRegistry.registerBlock(Botany.flowerbedNoWeed, ItemSoil.class, "flowerbedNoWeed");
|
||||
Botany.soilMeter = new ItemSoilMeter();
|
||||
Botany.insulatedTube = new ItemInsulatedTube();
|
||||
Botany.trowelWood = new ItemTrowel(Item.ToolMaterial.WOOD, "Wood");
|
||||
Botany.trowelStone = new ItemTrowel(Item.ToolMaterial.STONE, "Stone");
|
||||
Botany.trowelIron = new ItemTrowel(Item.ToolMaterial.IRON, "Iron");
|
||||
Botany.trowelDiamond = new ItemTrowel(Item.ToolMaterial.EMERALD, "Diamond");
|
||||
Botany.trowelGold = new ItemTrowel(Item.ToolMaterial.GOLD, "Gold");
|
||||
Botany.misc = Binnie.Item.registerMiscItems(BotanyItems.values(), CreativeTabBotany.instance);
|
||||
Botany.pigment = new ItemPigment();
|
||||
Botany.clay = new ItemClay();
|
||||
Botany.ceramic = new BlockCeramic();
|
||||
Botany.stained = new BlockStained();
|
||||
GameRegistry.registerBlock(Botany.ceramic, ItemMetadata.class, "ceramic");
|
||||
BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.ceramic), new ItemMetadataRenderer());
|
||||
GameRegistry.registerBlock(Botany.stained, ItemMetadata.class, "stained");
|
||||
BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.stained), new ItemMetadataRenderer());
|
||||
Botany.ceramicTile = new BlockCeramicPatterned();
|
||||
Botany.ceramicBrick = new BlockCeramicBrick();
|
||||
GameRegistry.registerBlock(Botany.ceramicTile, ItemMetadata.class, "ceramicPattern");
|
||||
GameRegistry.registerBlock(Botany.ceramicBrick, ItemMetadata.class, "ceramicBrick");
|
||||
BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.ceramicTile), new MultipassItemRenderer());
|
||||
BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.ceramicBrick), new MultipassItemRenderer());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
OreDictionary.registerOre("pigment", Botany.pigment);
|
||||
RecipeSorter.register("botany:ceramictile", CeramicTileRecipe.class, RecipeSorter.Category.SHAPED, "");
|
||||
RecipeSorter.register("botany:pigment", PigmentRecipe.class, RecipeSorter.Category.SHAPED, "");
|
||||
final ItemStack yellow = new ItemStack(Blocks.yellow_flower, 1);
|
||||
final ItemStack red = new ItemStack(Blocks.red_flower, 1);
|
||||
final ItemStack blue = new ItemStack(Blocks.red_flower, 1, 7);
|
||||
for (final boolean manual : new boolean[] { true, false }) {
|
||||
for (final boolean fertilised : new boolean[] { true, false }) {
|
||||
for (final EnumMoisture moist : EnumMoisture.values()) {
|
||||
final ItemStack icon = (moist == EnumMoisture.Dry) ? yellow : ((moist == EnumMoisture.Normal) ? red : blue);
|
||||
int insulate = 2 - moist.ordinal();
|
||||
if (fertilised) {
|
||||
insulate += 3;
|
||||
}
|
||||
new CircuitGarden(moist, null, manual, fertilised, new ItemStack(Botany.insulatedTube, 1, 0 + 128 * insulate), icon);
|
||||
new CircuitGarden(moist, EnumAcidity.Acid, manual, fertilised, new ItemStack(Botany.insulatedTube, 1, 1 + 128 * insulate), icon);
|
||||
new CircuitGarden(moist, EnumAcidity.Neutral, manual, fertilised, new ItemStack(Botany.insulatedTube, 1, 2 + 128 * insulate), icon);
|
||||
new CircuitGarden(moist, EnumAcidity.Alkaline, manual, fertilised, new ItemStack(Botany.insulatedTube, 1, 3 + 128 * insulate), icon);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
GameRegistry.addRecipe(new CeramicTileRecipe());
|
||||
for (int mat = 0; mat < 4; ++mat) {
|
||||
for (int insulate = 0; insulate < 6; ++insulate) {
|
||||
final ItemStack tubes = new ItemStack(Botany.insulatedTube, 2, mat + 128 * insulate);
|
||||
final ItemStack insulateStack = ItemInsulatedTube.getInsulateStack(tubes);
|
||||
final ItemStack forestryTube = new ItemStack(Mods.Forestry.item("thermionicTubes"), 1, mat);
|
||||
GameRegistry.addShapelessRecipe(tubes, new Object[] { forestryTube, forestryTube, insulateStack });
|
||||
}
|
||||
}
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe((Item) Botany.trowelWood, new Object[] { "d ", " x ", " s", 'd', Blocks.dirt, 's', "stickWood", 'x', "plankWood" }));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe((Item) Botany.trowelStone, new Object[] { "d ", " x ", " s", 'd', Blocks.dirt, 's', "stickWood", 'x', "cobblestone" }));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe((Item) Botany.trowelIron, new Object[] { "d ", " x ", " s", 'd', Blocks.dirt, 's', "stickWood", 'x', "ingotIron" }));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe((Item) Botany.trowelGold, new Object[] { "d ", " x ", " s", 'd', Blocks.dirt, 's', "stickWood", 'x', "ingotGold" }));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe((Item) Botany.trowelDiamond, new Object[] { "d ", " x ", " s", 'd', Blocks.dirt, 's', "stickWood", 'x', "gemDiamond" }));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe((Item) Botany.soilMeter, new Object[] { " gg", " rg", "i ", 'g', "ingotGold", 'r', "dustRedstone", 'i', "ingotIron" }));
|
||||
GameRegistry.addShapelessRecipe(BotanyItems.Weedkiller.get(4), new Object[] { new ItemStack(Items.spider_eye), new ItemStack(Items.wheat_seeds), new ItemStack(Items.wheat_seeds), new ItemStack(Items.wheat_seeds) });
|
||||
GameRegistry.addShapelessRecipe(BotanyItems.AshPowder.get(4), new Object[] { Mods.Forestry.stack("ash") });
|
||||
GameRegistry.addShapelessRecipe(BotanyItems.MulchPowder.get(4), new Object[] { Mods.Forestry.stack("mulch") });
|
||||
GameRegistry.addShapelessRecipe(BotanyItems.CompostPowder.get(4), new Object[] { Mods.Forestry.stack("fertilizerBio") });
|
||||
GameRegistry.addShapelessRecipe(BotanyItems.FertiliserPowder.get(4), new Object[] { Mods.Forestry.stack("fertilizerCompound") });
|
||||
GameRegistry.addShapelessRecipe(BotanyItems.PulpPowder.get(4), new Object[] { Mods.Forestry.stack("woodPulp") });
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(BotanyItems.SulphurPowder.get(4), new Object[] { "dustSulphur" }));
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(Botany.pigment, 2, EnumFlowerColor.Black.ordinal()), new Object[] { "pigment", "pigment", "dyeBlack" }));
|
||||
ModuleGardening.queuedAcidFertilisers.put(BotanyItems.SulphurPowder.get(1), 1);
|
||||
ModuleGardening.queuedAcidFertilisers.put(BotanyItems.MulchPowder.get(1), 1);
|
||||
ModuleGardening.queuedAcidFertilisers.put(new ItemStack(GameRegistry.findItem("Forestry", "mulch")), 2);
|
||||
for (final ItemStack stack : OreDictionary.getOres("dustSulfur")) {
|
||||
ModuleGardening.queuedAcidFertilisers.put(stack, 2);
|
||||
}
|
||||
ModuleGardening.queuedAlkalineFertilisers.put(BotanyItems.AshPowder.get(1), 1);
|
||||
ModuleGardening.queuedAlkalineFertilisers.put(BotanyItems.PulpPowder.get(1), 1);
|
||||
ModuleGardening.queuedAlkalineFertilisers.put(new ItemStack(GameRegistry.findItem("Forestry", "ash")), 2);
|
||||
ModuleGardening.queuedAlkalineFertilisers.put(new ItemStack(GameRegistry.findItem("Forestry", "woodPulp")), 2);
|
||||
ModuleGardening.queuedNutrientFertilisers.put(BotanyItems.CompostPowder.get(1), 1);
|
||||
ModuleGardening.queuedNutrientFertilisers.put(BotanyItems.FertiliserPowder.get(1), 1);
|
||||
ModuleGardening.queuedNutrientFertilisers.put(new ItemStack(GameRegistry.findItem("Forestry", "fertilizerBio")), 2);
|
||||
ModuleGardening.queuedNutrientFertilisers.put(new ItemStack(GameRegistry.findItem("Forestry", "fertilizerCompound")), 2);
|
||||
for (final Map.Entry<ItemStack, Integer> entry : ModuleGardening.queuedAcidFertilisers.entrySet()) {
|
||||
this.addAcidFertiliser(entry.getKey(), entry.getValue());
|
||||
}
|
||||
for (final Map.Entry<ItemStack, Integer> entry : ModuleGardening.queuedAlkalineFertilisers.entrySet()) {
|
||||
this.addAlkalineFertiliser(entry.getKey(), entry.getValue());
|
||||
}
|
||||
for (final Map.Entry<ItemStack, Integer> entry : ModuleGardening.queuedNutrientFertilisers.entrySet()) {
|
||||
this.addNutrientFertiliser(entry.getKey(), entry.getValue());
|
||||
}
|
||||
GameRegistry.addRecipe(BotanyItems.Mortar.get(6), new Object[] { " c ", "cgc", " c ", 'c', Items.clay_ball, 'g', Blocks.gravel });
|
||||
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
final ItemStack clay = new ItemStack(Botany.clay, 1, c.ordinal());
|
||||
final ItemStack pigment = new ItemStack(Botany.pigment, 1, c.ordinal());
|
||||
GameRegistry.addShapelessRecipe(clay, new Object[] { Items.clay_ball, Items.clay_ball, Items.clay_ball, pigment });
|
||||
GameRegistry.addSmelting(clay, TileEntityMetadata.getItemStack(Botany.ceramic, c.ordinal()), 0.0f);
|
||||
final ItemStack glass = TileEntityMetadata.getItemStack(Botany.stained, c.ordinal());
|
||||
glass.stackSize = 4;
|
||||
GameRegistry.addShapedRecipe(glass, new Object[] { " g ", "gpg", " g ", 'g', Blocks.glass, 'p', pigment });
|
||||
}
|
||||
GameRegistry.addRecipe(new PigmentRecipe());
|
||||
}
|
||||
|
||||
private ItemStack getStack(final int type, final int pH, final int moisture) {
|
||||
if (type < 0 || type > 2 || pH < 0 || pH > 2 || moisture < 0 || moisture > 2) {
|
||||
return null;
|
||||
}
|
||||
return new ItemStack(Gardening.getSoilBlock(EnumSoilType.values()[type]), 1, BlockSoil.getMeta(EnumAcidity.values()[pH], EnumMoisture.values()[moisture]));
|
||||
}
|
||||
|
||||
private void addAcidFertiliser(final ItemStack stack, final int strengthMax) {
|
||||
if (stack == null) {
|
||||
return;
|
||||
}
|
||||
Gardening.fertiliserAcid.put(stack, strengthMax);
|
||||
for (int moisture = 0; moisture < 3; ++moisture) {
|
||||
for (int pH = 0; pH < 3; ++pH) {
|
||||
for (int type = 0; type < 3; ++type) {
|
||||
int numOfBlocks = strengthMax * strengthMax;
|
||||
for (int strength = 1; strength < strengthMax; ++strength) {
|
||||
final ItemStack start = this.getStack(type, pH, moisture);
|
||||
final ItemStack end = this.getStack(type, pH - strength, moisture);
|
||||
if (end != null) {
|
||||
end.stackSize = numOfBlocks;
|
||||
final Object[] stacks = new Object[numOfBlocks + 1];
|
||||
for (int i = 0; i < numOfBlocks; ++i) {
|
||||
stacks[i] = start;
|
||||
}
|
||||
stacks[numOfBlocks] = stack.copy();
|
||||
GameRegistry.addShapelessRecipe(end, stacks);
|
||||
}
|
||||
numOfBlocks /= 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addAlkalineFertiliser(final ItemStack stack, final int strengthMax) {
|
||||
if (stack == null) {
|
||||
return;
|
||||
}
|
||||
Gardening.fertiliserAlkaline.put(stack, strengthMax);
|
||||
for (int moisture = 0; moisture < 3; ++moisture) {
|
||||
for (int pH = 0; pH < 3; ++pH) {
|
||||
for (int type = 0; type < 3; ++type) {
|
||||
int numOfBlocks = strengthMax * strengthMax;
|
||||
for (int strength = 1; strength < strengthMax; ++strength) {
|
||||
final ItemStack start = this.getStack(type, pH, moisture);
|
||||
final ItemStack end = this.getStack(type, pH + strength, moisture);
|
||||
if (end != null) {
|
||||
end.stackSize = numOfBlocks;
|
||||
final Object[] stacks = new Object[numOfBlocks + 1];
|
||||
for (int i = 0; i < numOfBlocks; ++i) {
|
||||
stacks[i] = start;
|
||||
}
|
||||
stacks[numOfBlocks] = stack.copy();
|
||||
GameRegistry.addShapelessRecipe(end, stacks);
|
||||
}
|
||||
numOfBlocks /= 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addNutrientFertiliser(final ItemStack stack, final int strengthMax) {
|
||||
if (stack == null) {
|
||||
return;
|
||||
}
|
||||
Gardening.fertiliserNutrient.put(stack, strengthMax);
|
||||
for (int moisture = 0; moisture < 3; ++moisture) {
|
||||
for (int pH = 0; pH < 3; ++pH) {
|
||||
for (int type = 0; type < 3; ++type) {
|
||||
int numOfBlocks = strengthMax * strengthMax;
|
||||
for (int strength = 1; strength < strengthMax; ++strength) {
|
||||
final ItemStack start = this.getStack(type, pH, moisture);
|
||||
final ItemStack end = this.getStack(type + strength, pH, moisture);
|
||||
if (end != null) {
|
||||
end.stackSize = numOfBlocks;
|
||||
final Object[] stacks = new Object[numOfBlocks + 1];
|
||||
for (int i = 0; i < numOfBlocks; ++i) {
|
||||
stacks[i] = start;
|
||||
}
|
||||
stacks[numOfBlocks] = stack.copy();
|
||||
GameRegistry.addShapelessRecipe(end, stacks);
|
||||
}
|
||||
numOfBlocks /= 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
ModuleGardening.queuedAcidFertilisers = new HashMap<ItemStack, Integer>();
|
||||
ModuleGardening.queuedAlkalineFertilisers = new HashMap<ItemStack, Integer>();
|
||||
ModuleGardening.queuedNutrientFertilisers = new HashMap<ItemStack, Integer>();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
|
||||
public class AlleleColor implements IAlleleInteger
|
||||
{
|
||||
String uid;
|
||||
boolean dominant;
|
||||
String name;
|
||||
int value;
|
||||
EnumFlowerColor color;
|
||||
|
||||
public AlleleColor(final EnumFlowerColor color, final String uid, final String name, final int value) {
|
||||
this.color = color;
|
||||
this.uid = uid;
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUID() {
|
||||
return this.uid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDominant() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.color.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public EnumFlowerColor getColor() {
|
||||
return this.color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return this.getUID();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import binnie.botany.api.IFlowerGenome;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import binnie.botany.api.IAlleleFlowerEffect;
|
||||
|
||||
public class AlleleEffectNone implements IAlleleFlowerEffect
|
||||
{
|
||||
@Override
|
||||
public boolean isCombinable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEffectData validateStorage(final IEffectData storedData) {
|
||||
return storedData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUID() {
|
||||
return "binnie.flowerEffectNone";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDominant() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "None";
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEffectData doEffect(final IFlowerGenome genome, final IEffectData storedData, final World world, final int x, final int y, final int z) {
|
||||
return storedData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return this.getUID();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import binnie.Binnie;
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
|
||||
import binnie.botany.api.IBotanistTracker;
|
||||
import forestry.core.genetics.BreedingTracker;
|
||||
|
||||
public class BotanistTracker extends BreedingTracker implements IBotanistTracker
|
||||
{
|
||||
public BotanistTracker(final String s) {
|
||||
super(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerPickup(final IIndividual individual) {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IBreedingTracker getBreedingTracker(final EntityPlayer player) {
|
||||
return Binnie.Genetics.getFlowerRoot().getBreedingTracker(player.worldObj, player.getGameProfile());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String speciesRootUID() {
|
||||
return "rootFlowers";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import binnie.botany.api.IFlowerColour;
|
||||
import binnie.botany.api.IColourMix;
|
||||
|
||||
public class ColourMix implements IColourMix
|
||||
{
|
||||
IFlowerColour colour1;
|
||||
IFlowerColour colour2;
|
||||
IFlowerColour result;
|
||||
int chance;
|
||||
|
||||
@Override
|
||||
public IFlowerColour getColour1() {
|
||||
return this.colour1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlowerColour getColour2() {
|
||||
return this.colour2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMutation(final IFlowerColour a, final IFlowerColour b) {
|
||||
return (a == this.colour1 && b == this.colour2) || (a == this.colour2 && b == this.colour1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getChance() {
|
||||
return this.chance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlowerColour getResult() {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
public ColourMix(final IFlowerColour colour1, final IFlowerColour colour2, final IFlowerColour result, final int chance) {
|
||||
this.colour1 = colour1;
|
||||
this.colour2 = colour2;
|
||||
this.result = result;
|
||||
this.chance = chance;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,135 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import binnie.botany.api.EnumFlowerStage;
|
||||
import net.minecraft.util.IIcon;
|
||||
import binnie.botany.api.IFlowerType;
|
||||
|
||||
public enum EnumFlowerType implements IFlowerType
|
||||
{
|
||||
Dandelion,
|
||||
Poppy,
|
||||
Orchid,
|
||||
Allium,
|
||||
Bluet,
|
||||
Tulip,
|
||||
Daisy,
|
||||
Cornflower,
|
||||
Pansy,
|
||||
Iris,
|
||||
Lavender(2),
|
||||
Viola,
|
||||
Daffodil,
|
||||
Dahlia,
|
||||
Peony(2),
|
||||
Rose(2),
|
||||
Lilac(2),
|
||||
Hydrangea(2),
|
||||
Foxglove(2),
|
||||
Zinnia,
|
||||
Mums,
|
||||
Marigold,
|
||||
Geranium,
|
||||
Azalea,
|
||||
Primrose,
|
||||
Aster,
|
||||
Carnation,
|
||||
Lily,
|
||||
Yarrow,
|
||||
Petunia,
|
||||
Agapanthus,
|
||||
Fuchsia,
|
||||
Dianthus,
|
||||
Forget,
|
||||
Anemone,
|
||||
Aquilegia,
|
||||
Edelweiss,
|
||||
Scabious,
|
||||
Coneflower,
|
||||
Gaillardia,
|
||||
Auricula,
|
||||
Camellia(2),
|
||||
Goldenrod(2),
|
||||
Althea(2),
|
||||
Penstemon(2),
|
||||
Delphinium(2),
|
||||
Hollyhock(2);
|
||||
|
||||
int sections;
|
||||
IIcon[] stem;
|
||||
IIcon[] petal;
|
||||
IIcon[] variant;
|
||||
IIcon[] unflowered;
|
||||
IIcon seedStem;
|
||||
IIcon seedPetal;
|
||||
IIcon seedVariant;
|
||||
IIcon pollenStem;
|
||||
IIcon pollenPetal;
|
||||
IIcon pollenVariant;
|
||||
IIcon blank;
|
||||
|
||||
private EnumFlowerType() {
|
||||
this(1);
|
||||
}
|
||||
|
||||
private EnumFlowerType(final int sections) {
|
||||
this.sections = 1;
|
||||
this.sections = sections;
|
||||
this.stem = new IIcon[sections];
|
||||
this.petal = new IIcon[sections];
|
||||
this.variant = new IIcon[sections];
|
||||
this.unflowered = new IIcon[sections];
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getStem(final EnumFlowerStage stage, final boolean flowered, final int section) {
|
||||
return (stage == EnumFlowerStage.SEED) ? this.seedStem : ((stage == EnumFlowerStage.POLLEN) ? this.pollenStem : this.stem[section % this.sections]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getPetalIcon(final EnumFlowerStage stage, final boolean flowered, final int section) {
|
||||
return (stage == EnumFlowerStage.SEED) ? this.seedPetal : ((stage == EnumFlowerStage.POLLEN) ? this.pollenPetal : (flowered ? this.petal[section % this.sections] : this.unflowered[section % this.sections]));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getVariantIcon(final EnumFlowerStage stage, final boolean flowered, final int section) {
|
||||
return (stage == EnumFlowerStage.SEED) ? this.seedVariant : ((stage == EnumFlowerStage.POLLEN) ? this.pollenVariant : (flowered ? this.variant[section % this.sections] : this.blank));
|
||||
}
|
||||
|
||||
public void registerIcons(final IIconRegister register) {
|
||||
for (int i = 0; i < this.sections; ++i) {
|
||||
final String suf = (i == 0) ? "" : ("" + (i + 1));
|
||||
final String pre = (this.sections == 1) ? "" : "double/";
|
||||
this.stem[i] = Botany.proxy.getIcon(register, "flowers/" + pre + this.toString().toLowerCase() + suf + ".0");
|
||||
this.petal[i] = Botany.proxy.getIcon(register, "flowers/" + pre + this.toString().toLowerCase() + suf + ".1");
|
||||
this.variant[i] = Botany.proxy.getIcon(register, "flowers/" + pre + this.toString().toLowerCase() + suf + ".2");
|
||||
this.unflowered[i] = Botany.proxy.getIcon(register, "flowers/" + pre + this.toString().toLowerCase() + suf + ".3");
|
||||
}
|
||||
this.blank = Botany.proxy.getIcon(register, "flowers/blank");
|
||||
this.seedStem = Botany.proxy.getIcon(register, "flowers/seed.0");
|
||||
this.seedPetal = Botany.proxy.getIcon(register, "flowers/seed.1");
|
||||
this.seedVariant = Botany.proxy.getIcon(register, "flowers/seed.2");
|
||||
this.pollenStem = Botany.proxy.getIcon(register, "flowers/pollen.0");
|
||||
this.pollenPetal = Botany.proxy.getIcon(register, "flowers/pollen.1");
|
||||
this.pollenVariant = Botany.proxy.getIcon(register, "flowers/pollen.2");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getID() {
|
||||
return this.ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSections() {
|
||||
return this.sections;
|
||||
}
|
||||
|
||||
public IIcon getBlank() {
|
||||
return this.blank;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,290 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import binnie.botany.api.IFlowerColour;
|
||||
import forestry.api.genetics.IGenome;
|
||||
import binnie.botany.api.IFlowerMutation;
|
||||
import binnie.botany.api.IColourMix;
|
||||
import forestry.api.arboriculture.EnumTreeChromosome;
|
||||
import net.minecraft.world.World;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.core.genetics.Chromosome;
|
||||
import forestry.api.genetics.IChromosome;
|
||||
import java.util.Random;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import binnie.botany.api.EnumFlowerChromosome;
|
||||
import java.util.List;
|
||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import binnie.botany.api.IFlowerGenome;
|
||||
import binnie.botany.api.IFlower;
|
||||
import forestry.core.genetics.Individual;
|
||||
|
||||
public class Flower extends Individual implements IFlower
|
||||
{
|
||||
public IFlowerGenome genome;
|
||||
public IFlowerGenome mate;
|
||||
int age;
|
||||
boolean wilting;
|
||||
boolean flowered;
|
||||
|
||||
public Flower(final NBTTagCompound nbttagcompound) {
|
||||
this.age = 0;
|
||||
this.wilting = false;
|
||||
this.readFromNBT(nbttagcompound);
|
||||
}
|
||||
|
||||
public Flower(final IFlowerGenome genome, final int age) {
|
||||
this.age = 0;
|
||||
this.wilting = false;
|
||||
this.genome = genome;
|
||||
this.age = age;
|
||||
if (age > 0) {
|
||||
this.flowered = true;
|
||||
}
|
||||
else {
|
||||
this.flowered = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
final IAlleleFlowerSpecies species = this.getGenome().getPrimary();
|
||||
String name = "";
|
||||
if (species != null) {
|
||||
name += species.getName();
|
||||
}
|
||||
if (this.age == 0) {
|
||||
name += "";
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTooltip(final List<String> list) {
|
||||
final IAlleleFlowerSpecies primary = this.genome.getPrimary();
|
||||
final IAlleleFlowerSpecies secondary = this.genome.getSecondary();
|
||||
if (!this.isPureBred(EnumFlowerChromosome.SPECIES)) {
|
||||
list.add("§9" + primary.getName() + "-" + secondary.getName() + " Hybrid");
|
||||
}
|
||||
list.add("§6Age: " + this.getAge());
|
||||
list.add("§6T: " + this.getGenome().getPrimary().getTemperature() + " / " + this.getGenome().getToleranceTemperature());
|
||||
list.add("§6M: " + this.getGenome().getPrimary().getMoisture() + " / " + this.getGenome().getToleranceMoisture());
|
||||
list.add("§6pH: " + this.getGenome().getPrimary().getHumidity() + " / " + this.getGenome().getTolerancePH());
|
||||
list.add("§6Fert: " + this.getGenome().getFertility() + "x");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdent() {
|
||||
return this.getGenome().getPrimary().getUID();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(final NBTTagCompound nbttagcompound) {
|
||||
super.readFromNBT(nbttagcompound);
|
||||
if (nbttagcompound == null) {
|
||||
this.genome = BotanyCore.getFlowerRoot().templateAsGenome(BotanyCore.getFlowerRoot().getDefaultTemplate());
|
||||
return;
|
||||
}
|
||||
this.age = nbttagcompound.getInteger("Age");
|
||||
this.wilting = nbttagcompound.getBoolean("Wilt");
|
||||
this.flowered = nbttagcompound.getBoolean("Flowered");
|
||||
if (nbttagcompound.hasKey("Genome")) {
|
||||
this.genome = new FlowerGenome(nbttagcompound.getCompoundTag("Genome"));
|
||||
}
|
||||
if (nbttagcompound.hasKey("Mate")) {
|
||||
this.mate = new FlowerGenome(nbttagcompound.getCompoundTag("Mate"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(final NBTTagCompound nbttagcompound) {
|
||||
super.writeToNBT(nbttagcompound);
|
||||
nbttagcompound.setInteger("Age", this.age);
|
||||
nbttagcompound.setBoolean("Wilt", this.wilting);
|
||||
nbttagcompound.setBoolean("Flowered", this.flowered);
|
||||
if (this.genome != null) {
|
||||
final NBTTagCompound NBTmachine = new NBTTagCompound();
|
||||
this.genome.writeToNBT(NBTmachine);
|
||||
nbttagcompound.setTag("Genome", NBTmachine);
|
||||
}
|
||||
if (this.mate != null) {
|
||||
final NBTTagCompound NBTmachine = new NBTTagCompound();
|
||||
this.mate.writeToNBT(NBTmachine);
|
||||
nbttagcompound.setTag("Mate", NBTmachine);
|
||||
}
|
||||
}
|
||||
|
||||
public int getMetadata() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlowerGenome getGenome() {
|
||||
return this.genome;
|
||||
}
|
||||
|
||||
private IChromosome inheritChromosome(final Random rand, final IChromosome parent1, final IChromosome parent2) {
|
||||
IAllele choice1;
|
||||
if (rand.nextBoolean()) {
|
||||
choice1 = parent1.getPrimaryAllele();
|
||||
}
|
||||
else {
|
||||
choice1 = parent1.getSecondaryAllele();
|
||||
}
|
||||
IAllele choice2;
|
||||
if (rand.nextBoolean()) {
|
||||
choice2 = parent2.getPrimaryAllele();
|
||||
}
|
||||
else {
|
||||
choice2 = parent2.getSecondaryAllele();
|
||||
}
|
||||
if (rand.nextBoolean()) {
|
||||
return new Chromosome(choice1, choice2);
|
||||
}
|
||||
return new Chromosome(choice2, choice1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mate(final IFlower other) {
|
||||
this.mate = new FlowerGenome(other.getGenome().getChromosomes());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlowerGenome getMate() {
|
||||
return this.mate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlower copy() {
|
||||
final NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
this.writeToNBT(nbttagcompound);
|
||||
return new Flower(nbttagcompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAge() {
|
||||
return this.age;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void age() {
|
||||
if (this.age < 15) {
|
||||
++this.age;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAge(final int i) {
|
||||
this.age = i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxAge() {
|
||||
return this.getGenome().getLifespan();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWilted() {
|
||||
return this.wilting;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWilted(final boolean wilted) {
|
||||
this.wilting = wilted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasFlowered() {
|
||||
return this.flowered;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFlowered(final boolean flowered) {
|
||||
this.flowered = flowered;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeMate() {
|
||||
this.mate = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlower getOffspring(final World world) {
|
||||
final IChromosome[] chromosomes = new IChromosome[this.genome.getChromosomes().length];
|
||||
IChromosome[] parent1 = this.genome.getChromosomes();
|
||||
IChromosome[] parent2 = this.mate.getChromosomes();
|
||||
parent1 = this.mutateSpecies(world, this.genome, this.mate);
|
||||
parent2 = this.mutateSpecies(world, this.mate, this.genome);
|
||||
for (int i = 0; i < parent1.length; ++i) {
|
||||
if (parent1[i] != null && parent2[i] != null) {
|
||||
chromosomes[i] = Chromosome.inheritChromosome(world.rand, parent1[i], parent2[i]);
|
||||
}
|
||||
}
|
||||
return new Flower(new FlowerGenome(chromosomes), 0);
|
||||
}
|
||||
|
||||
private IChromosome[] mutateSpecies(final World world, final IFlowerGenome genomeOne, final IFlowerGenome genomeTwo) {
|
||||
IChromosome[] parent1 = genomeOne.getChromosomes();
|
||||
final IChromosome[] parent2 = genomeTwo.getChromosomes();
|
||||
IAllele allele0;
|
||||
IAllele allele2;
|
||||
IFlowerGenome genome0;
|
||||
IFlowerGenome genome2;
|
||||
if (world.rand.nextBoolean()) {
|
||||
allele0 = parent1[EnumTreeChromosome.SPECIES.ordinal()].getPrimaryAllele();
|
||||
allele2 = parent2[EnumTreeChromosome.SPECIES.ordinal()].getSecondaryAllele();
|
||||
genome0 = genomeOne;
|
||||
genome2 = genomeTwo;
|
||||
}
|
||||
else {
|
||||
allele0 = parent2[EnumTreeChromosome.SPECIES.ordinal()].getPrimaryAllele();
|
||||
allele2 = parent1[EnumTreeChromosome.SPECIES.ordinal()].getSecondaryAllele();
|
||||
genome0 = genomeTwo;
|
||||
genome2 = genomeOne;
|
||||
}
|
||||
IFlowerColour colour1 = genome0.getPrimaryColor();
|
||||
IFlowerColour colour2 = genome2.getPrimaryColor();
|
||||
if (colour1 != colour2) {
|
||||
for (final IColourMix mutation : BotanyCore.getFlowerRoot().getColourMixes(true)) {
|
||||
if (mutation.isMutation(colour1, colour2) && world.rand.nextFloat() * 100.0f < mutation.getChance()) {
|
||||
parent1[EnumFlowerChromosome.PRIMARY.ordinal()] = new Chromosome(mutation.getResult().getAllele());
|
||||
}
|
||||
}
|
||||
}
|
||||
colour1 = genome0.getSecondaryColor();
|
||||
colour2 = genome2.getSecondaryColor();
|
||||
if (colour1 != colour2) {
|
||||
for (final IColourMix mutation : BotanyCore.getFlowerRoot().getColourMixes(true)) {
|
||||
if (mutation.isMutation(colour1, colour2) && world.rand.nextFloat() * 100.0f < mutation.getChance()) {
|
||||
parent1[EnumFlowerChromosome.SECONDARY.ordinal()] = new Chromosome(mutation.getResult().getAllele());
|
||||
}
|
||||
}
|
||||
}
|
||||
colour1 = genome0.getStemColor();
|
||||
colour2 = genome2.getStemColor();
|
||||
if (colour1 != colour2) {
|
||||
for (final IColourMix mutation : BotanyCore.getFlowerRoot().getColourMixes(true)) {
|
||||
if (mutation.isMutation(colour1, colour2) && world.rand.nextFloat() * 100.0f < mutation.getChance()) {
|
||||
parent1[EnumFlowerChromosome.STEM.ordinal()] = new Chromosome(mutation.getResult().getAllele());
|
||||
}
|
||||
}
|
||||
}
|
||||
IChromosome[] template = null;
|
||||
for (final IFlowerMutation mutation2 : BotanyCore.getFlowerRoot().getMutations(true)) {
|
||||
final float chance = mutation2.getChance(allele0, allele2, genome0, genome2);
|
||||
if (chance > 0.0f && world.rand.nextFloat() * 100.0f < chance && template == null) {
|
||||
template = BotanyCore.getFlowerRoot().templateAsChromosomes(mutation2.getTemplate());
|
||||
}
|
||||
}
|
||||
if (template != null) {
|
||||
parent1 = template;
|
||||
}
|
||||
return parent1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import binnie.Binnie;
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import forestry.api.genetics.IAlleleFloat;
|
||||
import forestry.api.genetics.IAlleleTolerance;
|
||||
import forestry.api.genetics.EnumTolerance;
|
||||
import binnie.botany.api.IFlowerType;
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import binnie.botany.api.EnumFlowerChromosome;
|
||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||
import forestry.api.genetics.IChromosome;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import binnie.botany.api.IFlowerGenome;
|
||||
import forestry.core.genetics.Genome;
|
||||
|
||||
public class FlowerGenome extends Genome implements IFlowerGenome
|
||||
{
|
||||
public FlowerGenome(final NBTTagCompound nbttagcompound) {
|
||||
super(nbttagcompound);
|
||||
}
|
||||
|
||||
public FlowerGenome(final IChromosome[] chromosomes) {
|
||||
super(chromosomes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAlleleFlowerSpecies getPrimary() {
|
||||
return (IAlleleFlowerSpecies) this.getChromosomes()[EnumFlowerChromosome.SPECIES.ordinal()].getPrimaryAllele();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAlleleFlowerSpecies getSecondary() {
|
||||
return (IAlleleFlowerSpecies) this.getChromosomes()[EnumFlowerChromosome.SPECIES.ordinal()].getSecondaryAllele();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISpeciesRoot getSpeciesRoot() {
|
||||
return BotanyCore.getFlowerRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFlowerColor getPrimaryColor() {
|
||||
return ((AlleleColor) this.getActiveAllele(EnumFlowerChromosome.PRIMARY)).getColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFlowerColor getSecondaryColor() {
|
||||
return ((AlleleColor) this.getActiveAllele(EnumFlowerChromosome.SECONDARY)).getColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFlowerColor getStemColor() {
|
||||
return ((AlleleColor) this.getActiveAllele(EnumFlowerChromosome.STEM)).getColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFertility() {
|
||||
return ((IAlleleInteger) this.getActiveAllele(EnumFlowerChromosome.FERTILITY)).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLifespan() {
|
||||
return ((IAlleleInteger) this.getActiveAllele(EnumFlowerChromosome.LIFESPAN)).getValue() / 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlowerType getType() {
|
||||
return this.getPrimary().getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumTolerance getToleranceTemperature() {
|
||||
return ((IAlleleTolerance) this.getActiveAllele(EnumFlowerChromosome.TEMPERATURE_TOLERANCE)).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumTolerance getToleranceMoisture() {
|
||||
return ((IAlleleTolerance) this.getActiveAllele(EnumFlowerChromosome.HUMIDITY_TOLERANCE)).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumTolerance getTolerancePH() {
|
||||
return ((IAlleleTolerance) this.getActiveAllele(EnumFlowerChromosome.PH_TOLERANCE)).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(final NBTTagCompound nbttagcompound) {
|
||||
super.readFromNBT(nbttagcompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getAgeChance() {
|
||||
return 1.0f * (float) Math.sqrt(2.0f / this.getLifespan());
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getSappiness() {
|
||||
return ((IAlleleFloat) this.getActiveAllele(EnumFlowerChromosome.SAPPINESS)).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTolerate(final EnumAcidity ePH) {
|
||||
final int pH = ePH.ordinal();
|
||||
final int[] pHTol = Binnie.Genetics.getTolerance(this.getTolerancePH());
|
||||
final int fPH = this.getPrimary().getPH().ordinal();
|
||||
return pH >= fPH + pHTol[0] && pH <= fPH + pHTol[1];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTolerate(final EnumMoisture eMoisture) {
|
||||
final int moisture = eMoisture.ordinal();
|
||||
final int[] moistTol = Binnie.Genetics.getTolerance(this.getToleranceMoisture());
|
||||
final int fMoisture = this.getPrimary().getMoisture().ordinal();
|
||||
return moisture >= fMoisture + moistTol[0] && moisture <= fMoisture + moistTol[1];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTolerate(final EnumTemperature eTemp) {
|
||||
final int temp = eTemp.ordinal();
|
||||
final int[] tempTol = Binnie.Genetics.getTolerance(this.getToleranceTemperature());
|
||||
final int fTemp = this.getPrimary().getTemperature().ordinal();
|
||||
return temp >= fTemp + tempTol[0] && temp <= fTemp + tempTol[1];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,286 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import forestry.api.genetics.ISpeciesType;
|
||||
import binnie.botany.api.EnumFlowerChromosome;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
|
||||
import net.minecraft.world.WorldSavedData;
|
||||
|
||||
import binnie.botany.api.IBotanistTracker;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.genetics.IMutation;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Collection;
|
||||
import java.util.Random;
|
||||
|
||||
import binnie.botany.api.IFlowerGenome;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import binnie.botany.api.EnumFlowerStage;
|
||||
|
||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import binnie.botany.api.IColourMix;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import binnie.botany.api.IFlowerMutation;
|
||||
import binnie.botany.api.IFlower;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import binnie.botany.api.IFlowerRoot;
|
||||
import forestry.core.genetics.SpeciesRoot;
|
||||
|
||||
public class FlowerHelper extends SpeciesRoot implements IFlowerRoot
|
||||
{
|
||||
public static int flowerSpeciesCount;
|
||||
static final String UID = "rootFlowers";
|
||||
public static ArrayList<IFlower> flowerTemplates;
|
||||
private static ArrayList<IFlowerMutation> flowerMutations;
|
||||
Map<ItemStack, IFlower> conversions;
|
||||
private static ArrayList<IColourMix> colourMixes;
|
||||
|
||||
public FlowerHelper() {
|
||||
this.conversions = new HashMap<ItemStack, IFlower>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUID() {
|
||||
return "rootFlowers";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSpeciesCount() {
|
||||
if (FlowerHelper.flowerSpeciesCount < 0) {
|
||||
FlowerHelper.flowerSpeciesCount = 0;
|
||||
for (final Map.Entry<String, IAllele> entry : AlleleManager.alleleRegistry.getRegisteredAlleles().entrySet()) {
|
||||
if (entry.getValue() instanceof IAlleleFlowerSpecies && ((IAlleleFlowerSpecies) entry.getValue()).isCounted()) {
|
||||
++FlowerHelper.flowerSpeciesCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
return FlowerHelper.flowerSpeciesCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMember(final ItemStack stack) {
|
||||
return stack != null && this.getStageType(stack) != EnumFlowerStage.NONE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMember(final ItemStack stack, final int type) {
|
||||
return this.getStageType(stack).ordinal() == type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMember(final IIndividual individual) {
|
||||
return individual instanceof IFlower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getMemberStack(final IIndividual flower, final int type) {
|
||||
if (!this.isMember(flower)) {
|
||||
return null;
|
||||
}
|
||||
Item flowerItem = Botany.flowerItem;
|
||||
if (type == EnumFlowerStage.SEED.ordinal()) {
|
||||
flowerItem = Botany.seed;
|
||||
}
|
||||
if (type == EnumFlowerStage.POLLEN.ordinal()) {
|
||||
flowerItem = Botany.pollen;
|
||||
}
|
||||
if (flowerItem != Botany.flowerItem) {
|
||||
((IFlower) flower).setAge(0);
|
||||
}
|
||||
final NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
flower.writeToNBT(nbttagcompound);
|
||||
final ItemStack flowerStack = new ItemStack(flowerItem);
|
||||
flowerStack.setTagCompound(nbttagcompound);
|
||||
return flowerStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFlowerStage getStageType(final ItemStack stack) {
|
||||
return (stack == null) ? EnumFlowerStage.NONE : ((stack.getItem() == Botany.flowerItem) ? EnumFlowerStage.FLOWER : ((stack.getItem() == Botany.pollen) ? EnumFlowerStage.POLLEN : ((stack.getItem() == Botany.seed) ? EnumFlowerStage.SEED : EnumFlowerStage.NONE)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlower getMember(final ItemStack stack) {
|
||||
if (!this.isMember(stack)) {
|
||||
return null;
|
||||
}
|
||||
return new Flower(stack.getTagCompound());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlower getFlower(final World world, final IFlowerGenome genome) {
|
||||
return new Flower(genome, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlowerGenome templateAsGenome(final IAllele[] template) {
|
||||
return new FlowerGenome(this.templateAsChromosomes(template));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlowerGenome templateAsGenome(final IAllele[] templateActive, final IAllele[] templateInactive) {
|
||||
return new FlowerGenome(this.templateAsChromosomes(templateActive, templateInactive));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlower templateAsIndividual(final IAllele[] template) {
|
||||
return new Flower(this.templateAsGenome(template), 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlower templateAsIndividual(final IAllele[] templateActive, final IAllele[] templateInactive) {
|
||||
return new Flower(this.templateAsGenome(templateActive, templateInactive), 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<IFlower> getIndividualTemplates() {
|
||||
return FlowerHelper.flowerTemplates;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerTemplate(final IAllele[] template) {
|
||||
this.registerTemplate(template[0].getUID(), template);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerTemplate(final String identifier, final IAllele[] template) {
|
||||
FlowerHelper.flowerTemplates.add(new Flower(this.templateAsGenome(template), 2));
|
||||
if (!this.speciesTemplates.containsKey(identifier)) {
|
||||
this.speciesTemplates.put(identifier, template);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAllele[] getTemplate(final String identifier) {
|
||||
return this.speciesTemplates.get(identifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAllele[] getDefaultTemplate() {
|
||||
return FlowerTemplates.getDefaultTemplate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAllele[] getRandomTemplate(final Random rand) {
|
||||
return this.speciesTemplates.values().toArray(new IAllele[0][])[rand.nextInt(this.speciesTemplates.values().size())];
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<IFlowerMutation> getMutations(final boolean shuffle) {
|
||||
if (shuffle) {
|
||||
Collections.shuffle(FlowerHelper.flowerMutations);
|
||||
}
|
||||
return FlowerHelper.flowerMutations;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerMutation(final IMutation mutation) {
|
||||
if (AlleleManager.alleleRegistry.isBlacklisted(mutation.getTemplate()[0].getUID())) {
|
||||
return;
|
||||
}
|
||||
if (AlleleManager.alleleRegistry.isBlacklisted(mutation.getAllele0().getUID())) {
|
||||
return;
|
||||
}
|
||||
if (AlleleManager.alleleRegistry.isBlacklisted(mutation.getAllele1().getUID())) {
|
||||
return;
|
||||
}
|
||||
FlowerHelper.flowerMutations.add((IFlowerMutation) mutation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBotanistTracker getBreedingTracker(final World world, final GameProfile player) {
|
||||
final String filename = "BotanistTracker." + ((player == null) ? "common" : player.getId());
|
||||
BotanistTracker tracker = (BotanistTracker) world.loadItemData(BotanistTracker.class, filename);
|
||||
if (tracker == null) {
|
||||
tracker = new BotanistTracker(filename);
|
||||
world.setItemData(filename, tracker);
|
||||
}
|
||||
return tracker;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIndividual getMember(final NBTTagCompound compound) {
|
||||
return new Flower(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getMemberClass() {
|
||||
return IFlower.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IChromosomeType[] getKaryotype() {
|
||||
return EnumFlowerChromosome.values();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IChromosomeType getKaryotypeKey() {
|
||||
return EnumFlowerChromosome.SPECIES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addConversion(final ItemStack itemstack, final IAllele[] template) {
|
||||
final IFlower flower = this.getFlower(null, this.templateAsGenome(template));
|
||||
this.conversions.put(itemstack, flower);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlower getConversion(final ItemStack itemstack) {
|
||||
for (final Map.Entry<ItemStack, IFlower> entry : this.conversions.entrySet()) {
|
||||
if (entry.getKey().isItemEqual(itemstack)) {
|
||||
return (IFlower) entry.getValue().copy();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerColourMix(final IColourMix colourMix) {
|
||||
FlowerHelper.colourMixes.add(colourMix);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<IColourMix> getColourMixes(final boolean shuffle) {
|
||||
if (shuffle) {
|
||||
Collections.shuffle(FlowerHelper.colourMixes);
|
||||
}
|
||||
return FlowerHelper.colourMixes;
|
||||
}
|
||||
|
||||
static {
|
||||
FlowerHelper.flowerSpeciesCount = -1;
|
||||
FlowerHelper.flowerTemplates = new ArrayList<IFlower>();
|
||||
FlowerHelper.flowerMutations = new ArrayList<IFlowerMutation>();
|
||||
FlowerHelper.colourMixes = new ArrayList<IColourMix>();
|
||||
}
|
||||
|
||||
// ??
|
||||
@Override
|
||||
public ISpeciesType getType(ItemStack itemstack) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.api.genetics.IGenome;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||
import binnie.botany.api.IFlowerMutation;
|
||||
|
||||
public class FlowerMutation implements IFlowerMutation
|
||||
{
|
||||
IAlleleFlowerSpecies allele0;
|
||||
IAlleleFlowerSpecies allele1;
|
||||
IAllele[] template;
|
||||
int chance;
|
||||
|
||||
FlowerMutation(final IAlleleFlowerSpecies allele0, final IAlleleFlowerSpecies allele1, final IAllele[] template, final int chance) {
|
||||
this.allele0 = allele0;
|
||||
this.allele1 = allele1;
|
||||
this.template = template;
|
||||
this.chance = chance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAlleleFlowerSpecies getAllele0() {
|
||||
return this.allele0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAlleleFlowerSpecies getAllele1() {
|
||||
return this.allele1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAllele[] getTemplate() {
|
||||
return this.template;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getBaseChance() {
|
||||
return this.chance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPartner(final IAllele allele) {
|
||||
return allele.getUID().equals(this.allele0.getUID()) || allele.getUID().equals(this.allele1.getUID());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAllele getPartner(final IAllele allele) {
|
||||
return allele.getUID().equals(this.allele0.getUID()) ? this.allele1 : this.allele0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSecret() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getChance(final IAllele allele0, final IAllele allele1, final IGenome genome0, final IGenome genome1) {
|
||||
if (allele0 == null || allele1 == null) {
|
||||
return 0.0f;
|
||||
}
|
||||
if (this.allele0.getUID().equals(allele0.getUID()) && this.allele1.getUID().equals(allele1.getUID())) {
|
||||
return this.getBaseChance();
|
||||
}
|
||||
if (this.allele1.getUID().equals(allele0.getUID()) && this.allele0.getUID().equals(allele1.getUID())) {
|
||||
return this.getBaseChance();
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISpeciesRoot getRoot() {
|
||||
return BotanyCore.getFlowerRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> getSpecialConditions() {
|
||||
return new ArrayList<String>();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,555 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import net.minecraft.world.World;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.core.IIconProvider;
|
||||
import binnie.Binnie;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import binnie.botany.api.EnumFlowerChromosome;
|
||||
import java.util.ArrayList;
|
||||
import forestry.api.genetics.IMutation;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.init.Blocks;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import forestry.api.genetics.IClassification;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import java.util.List;
|
||||
import forestry.api.genetics.EnumTolerance;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import binnie.botany.api.IFlowerType;
|
||||
import binnie.core.genetics.ForestryAllele;
|
||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||
|
||||
public enum FlowerSpecies implements IAlleleFlowerSpecies
|
||||
{
|
||||
Dandelion("Dandelion", "taraxacum", "officinale", EnumFlowerType.Dandelion, EnumFlowerColor.Yellow),
|
||||
Poppy("Poppy", "papaver", "rhoeas", EnumFlowerType.Poppy, EnumFlowerColor.Red),
|
||||
Orchid("Orchid", "vanda", "coerulea", EnumFlowerType.Orchid, EnumFlowerColor.DeepSkyBlue),
|
||||
Allium("Allium", "allium", "giganteum", EnumFlowerType.Allium, EnumFlowerColor.MediumPurple),
|
||||
Bluet("Bluet", "houstonia", "caerulea", EnumFlowerType.Bluet, EnumFlowerColor.Lavender, EnumFlowerColor.Khaki),
|
||||
Tulip("Tulip", "tulipa", "agenensis", EnumFlowerType.Tulip, EnumFlowerColor.Violet),
|
||||
Daisy("Daisy", "leucanthemum", "vulgare", EnumFlowerType.Daisy, EnumFlowerColor.White, EnumFlowerColor.Yellow),
|
||||
Cornflower("Cornflower", "centaurea", "cyanus", EnumFlowerType.Cornflower, EnumFlowerColor.SkyBlue),
|
||||
Pansy("Pansy", "viola", "tricolor", EnumFlowerType.Pansy, EnumFlowerColor.Pink, EnumFlowerColor.Purple),
|
||||
Iris("Iris", "iris", "germanica", EnumFlowerType.Iris, EnumFlowerColor.LightGray, EnumFlowerColor.Purple),
|
||||
Lavender("Lavender", "Lavandula", "angustifolia", EnumFlowerType.Lavender, EnumFlowerColor.MediumOrchid),
|
||||
Viola("Viola", "viola", "odorata", EnumFlowerType.Viola, EnumFlowerColor.MediumPurple, EnumFlowerColor.SlateBlue),
|
||||
Daffodil("Daffodil", "narcissus", "pseudonarcissus", EnumFlowerType.Daffodil, EnumFlowerColor.Yellow, EnumFlowerColor.Gold),
|
||||
Dahlia("Dahlia", "dahlia", "variabilis", EnumFlowerType.Dahlia, EnumFlowerColor.HotPink, EnumFlowerColor.DeepPink),
|
||||
Peony("Peony", "paeonia", "suffruticosa", EnumFlowerType.Peony, EnumFlowerColor.Thistle),
|
||||
Rose("Rose", "rosa", "rubiginosa", EnumFlowerType.Rose, EnumFlowerColor.Red),
|
||||
Lilac("Lilac", "syringa", "vulgaris", EnumFlowerType.Lilac, EnumFlowerColor.Plum),
|
||||
Hydrangea("Hydrangea", "hydrangea", "macrophylla", EnumFlowerType.Hydrangea, EnumFlowerColor.DeepSkyBlue),
|
||||
Foxglove("Foxglove", "digitalis", "purpurea", EnumFlowerType.Foxglove, EnumFlowerColor.HotPink),
|
||||
Zinnia("Zinnia", "zinnia", "elegans", EnumFlowerType.Zinnia, EnumFlowerColor.MediumVioletRed, EnumFlowerColor.Yellow),
|
||||
Chrysanthemum("Chrysanthemum", "chrysanthemum", "\u00ef?? grandiflorum", EnumFlowerType.Mums, EnumFlowerColor.Violet),
|
||||
Marigold("Marigold", "calendula", "officinalis", EnumFlowerType.Marigold, EnumFlowerColor.Gold, EnumFlowerColor.DarkOrange),
|
||||
Geranium("Geranium", "geranium", "maderense", EnumFlowerType.Geranium, EnumFlowerColor.DeepPink),
|
||||
Azalea("Azalea", "rhododendrons", "aurigeranum", EnumFlowerType.Azalea, EnumFlowerColor.HotPink),
|
||||
Primrose("Primrose", "primula", "vulgaris", EnumFlowerType.Primrose, EnumFlowerColor.Red, EnumFlowerColor.Gold),
|
||||
Aster("Aster", "aster", "amellus", EnumFlowerType.Aster, EnumFlowerColor.MediumPurple, EnumFlowerColor.Goldenrod),
|
||||
Carnation("Carnation", "dianthus", "caryophyllus", EnumFlowerType.Carnation, EnumFlowerColor.Crimson, EnumFlowerColor.White),
|
||||
Lily("Lily", "lilium", "auratum", EnumFlowerType.Lily, EnumFlowerColor.Pink, EnumFlowerColor.Gold),
|
||||
Yarrow("Yarrow", "achillea", "millefolium", EnumFlowerType.Yarrow, EnumFlowerColor.Yellow),
|
||||
Petunia("Petunia", "petunia", "\u00ef?? atkinsiana", EnumFlowerType.Petunia, EnumFlowerColor.MediumVioletRed, EnumFlowerColor.Thistle),
|
||||
Agapanthus("Agapanthus", "agapanthus", "praecox", EnumFlowerType.Agapanthus, EnumFlowerColor.DeepSkyBlue),
|
||||
Fuchsia("Fuchsia", "fuchsia", "magellanica", EnumFlowerType.Fuchsia, EnumFlowerColor.DeepPink, EnumFlowerColor.MediumOrchid),
|
||||
Dianthus("Dianthus", "dianthus", "barbatus", EnumFlowerType.Dianthus, EnumFlowerColor.Crimson, EnumFlowerColor.HotPink),
|
||||
Forget("Forget-me-nots", "myosotis", "arvensis", EnumFlowerType.Forget, EnumFlowerColor.LightSteelBlue),
|
||||
Anemone("Anemone", "anemone", "coronaria", EnumFlowerType.Anemone, EnumFlowerColor.Red, EnumFlowerColor.MistyRose),
|
||||
Aquilegia("Aquilegia", "aquilegia", "vulgaris", EnumFlowerType.Aquilegia, EnumFlowerColor.SlateBlue, EnumFlowerColor.Thistle),
|
||||
Edelweiss("Edelweiss", "leontopodium", "alpinum", EnumFlowerType.Edelweiss, EnumFlowerColor.White, EnumFlowerColor.Khaki),
|
||||
Scabious("Scabious", "scabiosa", "columbaria", EnumFlowerType.Scabious, EnumFlowerColor.RoyalBlue),
|
||||
Coneflower("Coneflower", "echinacea", "purpurea", EnumFlowerType.Coneflower, EnumFlowerColor.Violet, EnumFlowerColor.DarkOrange),
|
||||
Gaillardia("Gaillardia", "gaillardia", "aristata", EnumFlowerType.Gaillardia, EnumFlowerColor.DarkOrange, EnumFlowerColor.Yellow),
|
||||
Auricula("Auricula", "primula", "auricula", EnumFlowerType.Auricula, EnumFlowerColor.Red, EnumFlowerColor.Yellow),
|
||||
Camellia("Camellia", "camellia", "japonica", EnumFlowerType.Camellia, EnumFlowerColor.Crimson),
|
||||
Goldenrod("Goldenrod", "solidago", "canadensis", EnumFlowerType.Goldenrod, EnumFlowerColor.Gold),
|
||||
Althea("Althea", "althaea", "officinalis", EnumFlowerType.Althea, EnumFlowerColor.Thistle, EnumFlowerColor.MediumOrchid),
|
||||
Penstemon("Penstemon", "penstemon", "digitalis", EnumFlowerType.Penstemon, EnumFlowerColor.MediumOrchid, EnumFlowerColor.Thistle),
|
||||
Delphinium("Delphinium", "delphinium", "staphisagria", EnumFlowerType.Delphinium, EnumFlowerColor.DarkSlateBlue),
|
||||
Hollyhock("Hollyhock", "Alcea", "rosea", EnumFlowerType.Hollyhock, EnumFlowerColor.Black, EnumFlowerColor.Gold);
|
||||
|
||||
EnumFlowerColor stemColor;
|
||||
ForestryAllele.Fertility fert;
|
||||
ForestryAllele.Lifespan life;
|
||||
ForestryAllele.Sappiness sap;
|
||||
IFlowerType type;
|
||||
String name;
|
||||
String binomial;
|
||||
String branchName;
|
||||
EnumFlowerColor primaryColor;
|
||||
EnumFlowerColor secondaryColor;
|
||||
EnumTemperature temperature;
|
||||
EnumAcidity pH;
|
||||
EnumMoisture moisture;
|
||||
EnumTolerance tempTolerance;
|
||||
EnumTolerance pHTolerance;
|
||||
EnumTolerance moistureTolerance;
|
||||
List<IAllele[]> variantTemplates;
|
||||
IClassification branch;
|
||||
|
||||
public static void setupVariants() {
|
||||
FlowerSpecies.Dandelion.setTraits(ForestryAllele.Fertility.High, ForestryAllele.Lifespan.Shortened, ForestryAllele.Sappiness.Lower);
|
||||
FlowerSpecies.Poppy.setTraits(ForestryAllele.Fertility.High, ForestryAllele.Lifespan.Shorter, ForestryAllele.Sappiness.Average);
|
||||
FlowerSpecies.Orchid.setTraits(ForestryAllele.Fertility.Normal, ForestryAllele.Lifespan.Long, ForestryAllele.Sappiness.Low);
|
||||
FlowerSpecies.Allium.setTraits(ForestryAllele.Fertility.Normal, ForestryAllele.Lifespan.Normal, ForestryAllele.Sappiness.Low);
|
||||
FlowerSpecies.Bluet.setTraits(ForestryAllele.Fertility.Low, ForestryAllele.Lifespan.Normal, ForestryAllele.Sappiness.Lower);
|
||||
FlowerSpecies.Tulip.setTraits(ForestryAllele.Fertility.Normal, ForestryAllele.Lifespan.Long, ForestryAllele.Sappiness.Average);
|
||||
FlowerSpecies.Daisy.setTraits(ForestryAllele.Fertility.Normal, ForestryAllele.Lifespan.Normal, ForestryAllele.Sappiness.Low);
|
||||
FlowerSpecies.Cornflower.setTraits(ForestryAllele.Fertility.High, ForestryAllele.Lifespan.Shorter, ForestryAllele.Sappiness.Low);
|
||||
FlowerSpecies.Pansy.setTraits(ForestryAllele.Fertility.Normal, ForestryAllele.Lifespan.Shortened, ForestryAllele.Sappiness.Average);
|
||||
FlowerSpecies.Iris.setTraits(ForestryAllele.Fertility.High, ForestryAllele.Lifespan.Normal, ForestryAllele.Sappiness.Average);
|
||||
FlowerSpecies.Lavender.setTraits(ForestryAllele.Fertility.High, ForestryAllele.Lifespan.Normal, ForestryAllele.Sappiness.Low);
|
||||
FlowerSpecies.Viola.setTraits(ForestryAllele.Fertility.Normal, ForestryAllele.Lifespan.Shortened, ForestryAllele.Sappiness.Average);
|
||||
FlowerSpecies.Daffodil.setTraits(ForestryAllele.Fertility.High, ForestryAllele.Lifespan.Elongated, ForestryAllele.Sappiness.Average);
|
||||
FlowerSpecies.Aster.setTraits(ForestryAllele.Fertility.Normal, ForestryAllele.Lifespan.Normal, ForestryAllele.Sappiness.Higher);
|
||||
FlowerSpecies.Lilac.setTraits(ForestryAllele.Fertility.Low, ForestryAllele.Lifespan.Longer, ForestryAllele.Sappiness.Average);
|
||||
FlowerSpecies.Rose.setTraits(ForestryAllele.Fertility.Low, ForestryAllele.Lifespan.Longer, ForestryAllele.Sappiness.High);
|
||||
FlowerSpecies.Peony.setTraits(ForestryAllele.Fertility.Low, ForestryAllele.Lifespan.Long, ForestryAllele.Sappiness.Average);
|
||||
FlowerSpecies.Marigold.setTraits(ForestryAllele.Fertility.High, ForestryAllele.Lifespan.Shorter, ForestryAllele.Sappiness.Average);
|
||||
FlowerSpecies.Hydrangea.setTraits(ForestryAllele.Fertility.Low, ForestryAllele.Lifespan.Longer, ForestryAllele.Sappiness.High);
|
||||
FlowerSpecies.Foxglove.setTraits(ForestryAllele.Fertility.Low, ForestryAllele.Lifespan.Shortened, ForestryAllele.Sappiness.Low);
|
||||
FlowerSpecies.Dahlia.setTraits(ForestryAllele.Fertility.Normal, ForestryAllele.Lifespan.Normal, ForestryAllele.Sappiness.Average);
|
||||
FlowerSpecies.Chrysanthemum.setTraits(ForestryAllele.Fertility.High, ForestryAllele.Lifespan.Long, ForestryAllele.Sappiness.High);
|
||||
FlowerSpecies.Carnation.setTraits(ForestryAllele.Fertility.Normal, ForestryAllele.Lifespan.Normal, ForestryAllele.Sappiness.High);
|
||||
FlowerSpecies.Zinnia.setTraits(ForestryAllele.Fertility.Normal, ForestryAllele.Lifespan.Shorter, ForestryAllele.Sappiness.Average);
|
||||
FlowerSpecies.Primrose.setTraits(ForestryAllele.Fertility.Normal, ForestryAllele.Lifespan.Long, ForestryAllele.Sappiness.Average);
|
||||
FlowerSpecies.Azalea.setTraits(ForestryAllele.Fertility.Normal, ForestryAllele.Lifespan.Normal, ForestryAllele.Sappiness.Average);
|
||||
FlowerSpecies.Geranium.setTraits(ForestryAllele.Fertility.Low, ForestryAllele.Lifespan.Long, ForestryAllele.Sappiness.Low);
|
||||
FlowerSpecies.Lily.setTraits(ForestryAllele.Fertility.Low, ForestryAllele.Lifespan.Long, ForestryAllele.Sappiness.Low);
|
||||
FlowerSpecies.Yarrow.setTraits(ForestryAllele.Fertility.High, ForestryAllele.Lifespan.Normal, ForestryAllele.Sappiness.Low);
|
||||
FlowerSpecies.Petunia.setTraits(ForestryAllele.Fertility.Normal, ForestryAllele.Lifespan.Shorter, ForestryAllele.Sappiness.Average);
|
||||
FlowerSpecies.Agapanthus.setTraits(ForestryAllele.Fertility.Normal, ForestryAllele.Lifespan.Normal, ForestryAllele.Sappiness.Low);
|
||||
FlowerSpecies.Fuchsia.setTraits(ForestryAllele.Fertility.Normal, ForestryAllele.Lifespan.Shortened, ForestryAllele.Sappiness.Average);
|
||||
FlowerSpecies.Dianthus.setTraits(ForestryAllele.Fertility.Normal, ForestryAllele.Lifespan.Short, ForestryAllele.Sappiness.High);
|
||||
FlowerSpecies.Forget.setTraits(ForestryAllele.Fertility.Normal, ForestryAllele.Lifespan.Short, ForestryAllele.Sappiness.Lower);
|
||||
FlowerSpecies.Anemone.setTraits(ForestryAllele.Fertility.High, ForestryAllele.Lifespan.Normal, ForestryAllele.Sappiness.Low);
|
||||
FlowerSpecies.Aquilegia.setTraits(ForestryAllele.Fertility.Normal, ForestryAllele.Lifespan.Normal, ForestryAllele.Sappiness.Average);
|
||||
FlowerSpecies.Edelweiss.setTraits(ForestryAllele.Fertility.Low, ForestryAllele.Lifespan.Normal, ForestryAllele.Sappiness.Lowest);
|
||||
FlowerSpecies.Scabious.setTraits(ForestryAllele.Fertility.Normal, ForestryAllele.Lifespan.Shortened, ForestryAllele.Sappiness.Low);
|
||||
FlowerSpecies.Coneflower.setTraits(ForestryAllele.Fertility.Normal, ForestryAllele.Lifespan.Normal, ForestryAllele.Sappiness.Higher);
|
||||
FlowerSpecies.Gaillardia.setTraits(ForestryAllele.Fertility.High, ForestryAllele.Lifespan.Long, ForestryAllele.Sappiness.Higher);
|
||||
FlowerSpecies.Auricula.setTraits(ForestryAllele.Fertility.Normal, ForestryAllele.Lifespan.Elongated, ForestryAllele.Sappiness.High);
|
||||
FlowerSpecies.Camellia.setTraits(ForestryAllele.Fertility.Normal, ForestryAllele.Lifespan.Normal, ForestryAllele.Sappiness.High);
|
||||
FlowerSpecies.Goldenrod.setTraits(ForestryAllele.Fertility.High, ForestryAllele.Lifespan.Normal, ForestryAllele.Sappiness.Higher);
|
||||
FlowerSpecies.Althea.setTraits(ForestryAllele.Fertility.Low, ForestryAllele.Lifespan.Elongated, ForestryAllele.Sappiness.High);
|
||||
FlowerSpecies.Penstemon.setTraits(ForestryAllele.Fertility.Low, ForestryAllele.Lifespan.Long, ForestryAllele.Sappiness.Low);
|
||||
FlowerSpecies.Delphinium.setTraits(ForestryAllele.Fertility.Low, ForestryAllele.Lifespan.Longer, ForestryAllele.Sappiness.Low);
|
||||
FlowerSpecies.Hollyhock.setTraits(ForestryAllele.Fertility.Low, ForestryAllele.Lifespan.Long, ForestryAllele.Sappiness.High);
|
||||
FlowerSpecies.Dandelion.setPH(EnumAcidity.Neutral, EnumTolerance.BOTH_1);
|
||||
FlowerSpecies.Dandelion.setMoisture(EnumMoisture.Normal, EnumTolerance.BOTH_1);
|
||||
FlowerSpecies.Poppy.setPH(EnumAcidity.Neutral, EnumTolerance.DOWN_1);
|
||||
FlowerSpecies.Poppy.setMoisture(EnumMoisture.Normal, EnumTolerance.DOWN_1);
|
||||
FlowerSpecies.Poppy.setTemperature(EnumTemperature.WARM, EnumTolerance.BOTH_2);
|
||||
FlowerSpecies.Orchid.setPH(EnumAcidity.Acid, EnumTolerance.NONE);
|
||||
FlowerSpecies.Orchid.setMoisture(EnumMoisture.Normal, EnumTolerance.BOTH_1);
|
||||
FlowerSpecies.Allium.setPH(EnumAcidity.Alkaline, EnumTolerance.DOWN_1);
|
||||
FlowerSpecies.Allium.setMoisture(EnumMoisture.Normal, EnumTolerance.DOWN_1);
|
||||
FlowerSpecies.Bluet.setPH(EnumAcidity.Neutral, EnumTolerance.DOWN_1);
|
||||
FlowerSpecies.Bluet.setMoisture(EnumMoisture.Damp, EnumTolerance.NONE);
|
||||
FlowerSpecies.Tulip.setMoisture(EnumMoisture.Normal, EnumTolerance.BOTH_1);
|
||||
FlowerSpecies.Daisy.setPH(EnumAcidity.Neutral, EnumTolerance.DOWN_1);
|
||||
FlowerSpecies.Daisy.setMoisture(EnumMoisture.Normal, EnumTolerance.DOWN_1);
|
||||
FlowerSpecies.Daisy.setTemperature(EnumTemperature.WARM, EnumTolerance.BOTH_2);
|
||||
FlowerSpecies.Cornflower.setMutation(FlowerSpecies.Dandelion, FlowerSpecies.Tulip, 10);
|
||||
FlowerSpecies.Cornflower.setPH(EnumAcidity.Neutral, EnumTolerance.BOTH_1);
|
||||
FlowerSpecies.Pansy.setMutation(FlowerSpecies.Tulip, FlowerSpecies.Viola, 5);
|
||||
FlowerSpecies.Pansy.setPH(EnumAcidity.Acid, EnumTolerance.NONE);
|
||||
FlowerSpecies.Pansy.setTemperature(EnumTemperature.WARM, EnumTolerance.DOWN_1);
|
||||
FlowerSpecies.Iris.setMutation(FlowerSpecies.Orchid, FlowerSpecies.Viola, 10);
|
||||
FlowerSpecies.Iris.setPH(EnumAcidity.Acid, EnumTolerance.NONE);
|
||||
FlowerSpecies.Iris.setTemperature(EnumTemperature.WARM, EnumTolerance.DOWN_1);
|
||||
FlowerSpecies.Lavender.setMutation(FlowerSpecies.Allium, FlowerSpecies.Viola, 10);
|
||||
FlowerSpecies.Lavender.setPH(EnumAcidity.Neutral, EnumTolerance.UP_1);
|
||||
FlowerSpecies.Lavender.setMoisture(EnumMoisture.Normal, EnumTolerance.DOWN_1);
|
||||
FlowerSpecies.Lavender.setTemperature(EnumTemperature.WARM, EnumTolerance.DOWN_1);
|
||||
FlowerSpecies.Viola.setMutation(FlowerSpecies.Orchid, FlowerSpecies.Poppy, 15);
|
||||
FlowerSpecies.Viola.setPH(EnumAcidity.Acid, EnumTolerance.NONE);
|
||||
FlowerSpecies.Viola.setMoisture(EnumMoisture.Normal, EnumTolerance.DOWN_1);
|
||||
FlowerSpecies.Daffodil.setMutation(FlowerSpecies.Dandelion, FlowerSpecies.Poppy, 10);
|
||||
FlowerSpecies.Daffodil.setPH(EnumAcidity.Neutral, EnumTolerance.DOWN_1);
|
||||
FlowerSpecies.Aster.setMutation(FlowerSpecies.Daisy, FlowerSpecies.Tulip, 10);
|
||||
FlowerSpecies.Aster.setPH(EnumAcidity.Neutral, EnumTolerance.BOTH_1);
|
||||
FlowerSpecies.Lilac.setPH(EnumAcidity.Alkaline, EnumTolerance.DOWN_1);
|
||||
FlowerSpecies.Rose.setPH(EnumAcidity.Acid, EnumTolerance.UP_1);
|
||||
FlowerSpecies.Peony.setPH(EnumAcidity.Alkaline, EnumTolerance.DOWN_1);
|
||||
FlowerSpecies.Peony.setMoisture(EnumMoisture.Normal, EnumTolerance.UP_1);
|
||||
FlowerSpecies.Marigold.setMutation(FlowerSpecies.Daisy, FlowerSpecies.Dandelion, 10);
|
||||
FlowerSpecies.Marigold.setPH(EnumAcidity.Neutral, EnumTolerance.DOWN_1);
|
||||
FlowerSpecies.Marigold.setMoisture(EnumMoisture.Normal, EnumTolerance.UP_1);
|
||||
FlowerSpecies.Marigold.setTemperature(EnumTemperature.WARM, EnumTolerance.BOTH_2);
|
||||
FlowerSpecies.Hydrangea.setMutation(FlowerSpecies.Peony, FlowerSpecies.Bluet, 10);
|
||||
FlowerSpecies.Hydrangea.setPH(EnumAcidity.Neutral, EnumTolerance.BOTH_1);
|
||||
FlowerSpecies.Hydrangea.setMoisture(EnumMoisture.Damp, EnumTolerance.NONE);
|
||||
FlowerSpecies.Foxglove.setMutation(FlowerSpecies.Lilac, FlowerSpecies.Zinnia, 5);
|
||||
FlowerSpecies.Foxglove.setPH(EnumAcidity.Neutral, EnumTolerance.DOWN_1);
|
||||
FlowerSpecies.Foxglove.setMoisture(EnumMoisture.Normal, EnumTolerance.UP_1);
|
||||
FlowerSpecies.Dahlia.setMutation(FlowerSpecies.Daisy, FlowerSpecies.Allium, 15);
|
||||
FlowerSpecies.Dahlia.setPH(EnumAcidity.Neutral, EnumTolerance.DOWN_1);
|
||||
FlowerSpecies.Dahlia.setMoisture(EnumMoisture.Normal, EnumTolerance.UP_1);
|
||||
FlowerSpecies.Dahlia.setTemperature(EnumTemperature.NORMAL, EnumTolerance.BOTH_2);
|
||||
FlowerSpecies.Chrysanthemum.setMutation(FlowerSpecies.Geranium, FlowerSpecies.Rose, 10);
|
||||
FlowerSpecies.Chrysanthemum.setPH(EnumAcidity.Neutral, EnumTolerance.DOWN_1);
|
||||
FlowerSpecies.Chrysanthemum.setMoisture(EnumMoisture.Normal, EnumTolerance.DOWN_1);
|
||||
FlowerSpecies.Carnation.setMutation(FlowerSpecies.Dianthus, FlowerSpecies.Rose, 5);
|
||||
FlowerSpecies.Carnation.setPH(EnumAcidity.Alkaline, EnumTolerance.DOWN_1);
|
||||
FlowerSpecies.Zinnia.setMutation(FlowerSpecies.Dahlia, FlowerSpecies.Marigold, 5);
|
||||
FlowerSpecies.Zinnia.setPH(EnumAcidity.Neutral, EnumTolerance.BOTH_1);
|
||||
FlowerSpecies.Zinnia.setMoisture(EnumMoisture.Normal, EnumTolerance.DOWN_1);
|
||||
FlowerSpecies.Zinnia.setTemperature(EnumTemperature.NORMAL, EnumTolerance.BOTH_2);
|
||||
FlowerSpecies.Primrose.setMutation(FlowerSpecies.Chrysanthemum, FlowerSpecies.Auricula, 5);
|
||||
FlowerSpecies.Primrose.setPH(EnumAcidity.Acid, EnumTolerance.UP_1);
|
||||
FlowerSpecies.Primrose.setMoisture(EnumMoisture.Normal, EnumTolerance.UP_1);
|
||||
FlowerSpecies.Azalea.setMutation(FlowerSpecies.Orchid, FlowerSpecies.Geranium, 5);
|
||||
FlowerSpecies.Azalea.setPH(EnumAcidity.Acid, EnumTolerance.NONE);
|
||||
FlowerSpecies.Geranium.setMutation(FlowerSpecies.Tulip, FlowerSpecies.Orchid, 15);
|
||||
FlowerSpecies.Geranium.setPH(EnumAcidity.Neutral, EnumTolerance.BOTH_1);
|
||||
FlowerSpecies.Geranium.setTemperature(EnumTemperature.WARM, EnumTolerance.BOTH_1);
|
||||
FlowerSpecies.Lily.setMutation(FlowerSpecies.Tulip, FlowerSpecies.Chrysanthemum, 5);
|
||||
FlowerSpecies.Lily.setPH(EnumAcidity.Neutral, EnumTolerance.DOWN_1);
|
||||
FlowerSpecies.Lily.setTemperature(EnumTemperature.WARM, EnumTolerance.BOTH_1);
|
||||
FlowerSpecies.Yarrow.setMutation(FlowerSpecies.Dandelion, FlowerSpecies.Orchid, 10);
|
||||
FlowerSpecies.Yarrow.setPH(EnumAcidity.Acid, EnumTolerance.UP_1);
|
||||
FlowerSpecies.Yarrow.setMoisture(EnumMoisture.Normal, EnumTolerance.DOWN_1);
|
||||
FlowerSpecies.Petunia.setMutation(FlowerSpecies.Tulip, FlowerSpecies.Dahlia, 5);
|
||||
FlowerSpecies.Petunia.setPH(EnumAcidity.Neutral, EnumTolerance.DOWN_1);
|
||||
FlowerSpecies.Petunia.setMoisture(EnumMoisture.Normal, EnumTolerance.UP_1);
|
||||
FlowerSpecies.Petunia.setTemperature(EnumTemperature.WARM, EnumTolerance.UP_1);
|
||||
FlowerSpecies.Agapanthus.setMutation(FlowerSpecies.Allium, FlowerSpecies.Geranium, 5);
|
||||
FlowerSpecies.Agapanthus.setPH(EnumAcidity.Neutral, EnumTolerance.BOTH_1);
|
||||
FlowerSpecies.Agapanthus.setMoisture(EnumMoisture.Normal, EnumTolerance.DOWN_1);
|
||||
FlowerSpecies.Agapanthus.setTemperature(EnumTemperature.WARM, EnumTolerance.BOTH_1);
|
||||
FlowerSpecies.Fuchsia.setMutation(FlowerSpecies.Foxglove, FlowerSpecies.Dahlia, 5);
|
||||
FlowerSpecies.Fuchsia.setPH(EnumAcidity.Neutral, EnumTolerance.BOTH_1);
|
||||
FlowerSpecies.Fuchsia.setMoisture(EnumMoisture.Normal, EnumTolerance.UP_1);
|
||||
FlowerSpecies.Fuchsia.setTemperature(EnumTemperature.WARM, EnumTolerance.BOTH_1);
|
||||
FlowerSpecies.Dianthus.setMutation(FlowerSpecies.Tulip, FlowerSpecies.Poppy, 15);
|
||||
FlowerSpecies.Dianthus.setPH(EnumAcidity.Alkaline, EnumTolerance.DOWN_1);
|
||||
FlowerSpecies.Dianthus.setMoisture(EnumMoisture.Normal, EnumTolerance.DOWN_1);
|
||||
FlowerSpecies.Dianthus.setTemperature(EnumTemperature.NORMAL, EnumTolerance.BOTH_2);
|
||||
FlowerSpecies.Forget.setMutation(FlowerSpecies.Orchid, FlowerSpecies.Bluet, 10);
|
||||
FlowerSpecies.Forget.setPH(EnumAcidity.Acid, EnumTolerance.NONE);
|
||||
FlowerSpecies.Forget.setMoisture(EnumMoisture.Normal, EnumTolerance.UP_1);
|
||||
FlowerSpecies.Forget.setTemperature(EnumTemperature.NORMAL, EnumTolerance.UP_1);
|
||||
FlowerSpecies.Anemone.setMutation(FlowerSpecies.Aquilegia, FlowerSpecies.Rose, 5);
|
||||
FlowerSpecies.Anemone.setPH(EnumAcidity.Neutral, EnumTolerance.BOTH_1);
|
||||
FlowerSpecies.Anemone.setMoisture(EnumMoisture.Normal, EnumTolerance.UP_1);
|
||||
FlowerSpecies.Aquilegia.setMutation(FlowerSpecies.Iris, FlowerSpecies.Poppy, 5);
|
||||
FlowerSpecies.Aquilegia.setMoisture(EnumMoisture.Normal, EnumTolerance.UP_1);
|
||||
FlowerSpecies.Edelweiss.setMutation(FlowerSpecies.Peony, FlowerSpecies.Bluet, 5);
|
||||
FlowerSpecies.Edelweiss.setPH(EnumAcidity.Alkaline, EnumTolerance.DOWN_1);
|
||||
FlowerSpecies.Edelweiss.setMoisture(EnumMoisture.Normal, EnumTolerance.DOWN_1);
|
||||
FlowerSpecies.Edelweiss.setTemperature(EnumTemperature.NORMAL, EnumTolerance.DOWN_1);
|
||||
FlowerSpecies.Scabious.setMutation(FlowerSpecies.Allium, FlowerSpecies.Cornflower, 5);
|
||||
FlowerSpecies.Scabious.setPH(EnumAcidity.Neutral, EnumTolerance.UP_1);
|
||||
FlowerSpecies.Scabious.setTemperature(EnumTemperature.NORMAL, EnumTolerance.DOWN_1);
|
||||
FlowerSpecies.Coneflower.setMutation(FlowerSpecies.Tulip, FlowerSpecies.Cornflower, 5);
|
||||
FlowerSpecies.Coneflower.setPH(EnumAcidity.Neutral, EnumTolerance.BOTH_1);
|
||||
FlowerSpecies.Gaillardia.setMutation(FlowerSpecies.Dandelion, FlowerSpecies.Marigold, 5);
|
||||
FlowerSpecies.Gaillardia.setPH(EnumAcidity.Neutral, EnumTolerance.BOTH_1);
|
||||
FlowerSpecies.Gaillardia.setMoisture(EnumMoisture.Damp, EnumTolerance.DOWN_1);
|
||||
FlowerSpecies.Gaillardia.setTemperature(EnumTemperature.NORMAL, EnumTolerance.BOTH_2);
|
||||
FlowerSpecies.Auricula.setMutation(FlowerSpecies.Poppy, FlowerSpecies.Geranium, 10);
|
||||
FlowerSpecies.Auricula.setPH(EnumAcidity.Acid, EnumTolerance.UP_1);
|
||||
FlowerSpecies.Auricula.setMoisture(EnumMoisture.Normal, EnumTolerance.UP_1);
|
||||
FlowerSpecies.Camellia.setMutation(FlowerSpecies.Hydrangea, FlowerSpecies.Rose, 5);
|
||||
FlowerSpecies.Camellia.setPH(EnumAcidity.Acid, EnumTolerance.NONE);
|
||||
FlowerSpecies.Camellia.setMoisture(EnumMoisture.Damp, EnumTolerance.NONE);
|
||||
FlowerSpecies.Camellia.setTemperature(EnumTemperature.WARM, EnumTolerance.UP_1);
|
||||
FlowerSpecies.Goldenrod.setMutation(FlowerSpecies.Lilac, FlowerSpecies.Marigold, 10);
|
||||
FlowerSpecies.Goldenrod.setPH(EnumAcidity.Neutral, EnumTolerance.BOTH_1);
|
||||
FlowerSpecies.Althea.setMutation(FlowerSpecies.Hydrangea, FlowerSpecies.Iris, 5);
|
||||
FlowerSpecies.Althea.setPH(EnumAcidity.Neutral, EnumTolerance.DOWN_1);
|
||||
FlowerSpecies.Althea.setTemperature(EnumTemperature.WARM, EnumTolerance.BOTH_1);
|
||||
FlowerSpecies.Penstemon.setMutation(FlowerSpecies.Peony, FlowerSpecies.Lilac, 5);
|
||||
FlowerSpecies.Penstemon.setMoisture(EnumMoisture.Dry, EnumTolerance.UP_1);
|
||||
FlowerSpecies.Penstemon.setTemperature(EnumTemperature.WARM, EnumTolerance.UP_1);
|
||||
FlowerSpecies.Delphinium.setMutation(FlowerSpecies.Lilac, FlowerSpecies.Bluet, 5);
|
||||
FlowerSpecies.Delphinium.setMoisture(EnumMoisture.Damp, EnumTolerance.DOWN_1);
|
||||
FlowerSpecies.Delphinium.setTemperature(EnumTemperature.NORMAL, EnumTolerance.DOWN_1);
|
||||
FlowerSpecies.Hollyhock.setMutation(FlowerSpecies.Delphinium, FlowerSpecies.Lavender, 5);
|
||||
FlowerSpecies.Hollyhock.setPH(EnumAcidity.Neutral, EnumTolerance.UP_1);
|
||||
FlowerSpecies.Dandelion.setStemColor(EnumFlowerColor.Green);
|
||||
FlowerSpecies.Poppy.setStemColor(EnumFlowerColor.Green);
|
||||
FlowerSpecies.Orchid.setStemColor(EnumFlowerColor.Green);
|
||||
FlowerSpecies.Allium.setStemColor(EnumFlowerColor.Green);
|
||||
FlowerSpecies.Bluet.setStemColor(EnumFlowerColor.OliveDrab);
|
||||
FlowerSpecies.Tulip.setStemColor(EnumFlowerColor.OliveDrab);
|
||||
FlowerSpecies.Daisy.setStemColor(EnumFlowerColor.OliveDrab);
|
||||
FlowerSpecies.Cornflower.setStemColor(EnumFlowerColor.OliveDrab);
|
||||
FlowerSpecies.Pansy.setStemColor(EnumFlowerColor.SeaGreen);
|
||||
FlowerSpecies.Iris.setStemColor(EnumFlowerColor.SeaGreen);
|
||||
FlowerSpecies.Lavender.setStemColor(EnumFlowerColor.Green);
|
||||
FlowerSpecies.Viola.setStemColor(EnumFlowerColor.OliveDrab);
|
||||
FlowerSpecies.Daffodil.setStemColor(EnumFlowerColor.Green);
|
||||
FlowerSpecies.Dahlia.setStemColor(EnumFlowerColor.OliveDrab);
|
||||
FlowerSpecies.Peony.setStemColor(EnumFlowerColor.DarkGreen);
|
||||
FlowerSpecies.Rose.setStemColor(EnumFlowerColor.Green);
|
||||
FlowerSpecies.Lilac.setStemColor(EnumFlowerColor.OliveDrab);
|
||||
FlowerSpecies.Hydrangea.setStemColor(EnumFlowerColor.DarkGreen);
|
||||
FlowerSpecies.Foxglove.setStemColor(EnumFlowerColor.DarkGreen);
|
||||
FlowerSpecies.Zinnia.setStemColor(EnumFlowerColor.MediumSeaGreen);
|
||||
FlowerSpecies.Chrysanthemum.setStemColor(EnumFlowerColor.MediumSeaGreen);
|
||||
FlowerSpecies.Marigold.setStemColor(EnumFlowerColor.Green);
|
||||
FlowerSpecies.Geranium.setStemColor(EnumFlowerColor.MediumSeaGreen);
|
||||
FlowerSpecies.Azalea.setStemColor(EnumFlowerColor.Green);
|
||||
FlowerSpecies.Primrose.setStemColor(EnumFlowerColor.Green);
|
||||
FlowerSpecies.Aster.setStemColor(EnumFlowerColor.Green);
|
||||
FlowerSpecies.Carnation.setStemColor(EnumFlowerColor.SeaGreen);
|
||||
FlowerSpecies.Lily.setStemColor(EnumFlowerColor.Green);
|
||||
FlowerSpecies.Yarrow.setStemColor(EnumFlowerColor.DarkOliveGreen);
|
||||
FlowerSpecies.Petunia.setStemColor(EnumFlowerColor.Green);
|
||||
FlowerSpecies.Agapanthus.setStemColor(EnumFlowerColor.DarkOliveGreen);
|
||||
FlowerSpecies.Fuchsia.setStemColor(EnumFlowerColor.SeaGreen);
|
||||
FlowerSpecies.Dianthus.setStemColor(EnumFlowerColor.OliveDrab);
|
||||
FlowerSpecies.Forget.setStemColor(EnumFlowerColor.Green);
|
||||
FlowerSpecies.Anemone.setStemColor(EnumFlowerColor.DarkOliveGreen);
|
||||
FlowerSpecies.Aquilegia.setStemColor(EnumFlowerColor.MediumSeaGreen);
|
||||
FlowerSpecies.Edelweiss.setStemColor(EnumFlowerColor.DarkOliveGreen);
|
||||
FlowerSpecies.Scabious.setStemColor(EnumFlowerColor.OliveDrab);
|
||||
FlowerSpecies.Coneflower.setStemColor(EnumFlowerColor.DarkOliveGreen);
|
||||
FlowerSpecies.Gaillardia.setStemColor(EnumFlowerColor.OliveDrab);
|
||||
FlowerSpecies.Auricula.setStemColor(EnumFlowerColor.DarkOliveGreen);
|
||||
FlowerSpecies.Camellia.setStemColor(EnumFlowerColor.DarkOliveGreen);
|
||||
FlowerSpecies.Goldenrod.setStemColor(EnumFlowerColor.MediumSeaGreen);
|
||||
FlowerSpecies.Althea.setStemColor(EnumFlowerColor.DarkGreen);
|
||||
FlowerSpecies.Penstemon.setStemColor(EnumFlowerColor.OliveDrab);
|
||||
FlowerSpecies.Delphinium.setStemColor(EnumFlowerColor.DarkSeaGreen);
|
||||
FlowerSpecies.Hollyhock.setStemColor(EnumFlowerColor.Green);
|
||||
BotanyCore.getFlowerRoot().addConversion(new ItemStack(Blocks.yellow_flower, 1, 0), FlowerSpecies.Dandelion.getTemplate());
|
||||
BotanyCore.getFlowerRoot().addConversion(new ItemStack(Blocks.red_flower, 1, 0), FlowerSpecies.Poppy.getTemplate());
|
||||
BotanyCore.getFlowerRoot().addConversion(new ItemStack(Blocks.red_flower, 1, 1), FlowerSpecies.Orchid.getTemplate());
|
||||
BotanyCore.getFlowerRoot().addConversion(new ItemStack(Blocks.red_flower, 1, 2), FlowerSpecies.Allium.getTemplate());
|
||||
BotanyCore.getFlowerRoot().addConversion(new ItemStack(Blocks.red_flower, 1, 3), FlowerSpecies.Bluet.getTemplate());
|
||||
BotanyCore.getFlowerRoot().addConversion(new ItemStack(Blocks.red_flower, 1, 7), FlowerSpecies.Tulip.getTemplate());
|
||||
BotanyCore.getFlowerRoot().addConversion(new ItemStack(Blocks.red_flower, 1, 8), FlowerSpecies.Daisy.getTemplate());
|
||||
BotanyCore.getFlowerRoot().addConversion(new ItemStack(Blocks.double_plant, 1, 1), FlowerSpecies.Lilac.getTemplate());
|
||||
BotanyCore.getFlowerRoot().addConversion(new ItemStack(Blocks.double_plant, 1, 4), FlowerSpecies.Rose.getTemplate());
|
||||
BotanyCore.getFlowerRoot().addConversion(new ItemStack(Blocks.double_plant, 1, 5), FlowerSpecies.Peony.getTemplate());
|
||||
BotanyCore.getFlowerRoot().addConversion(new ItemStack(Blocks.red_flower, 1, 6), FlowerSpecies.Tulip.AddVariant(EnumFlowerColor.White));
|
||||
BotanyCore.getFlowerRoot().addConversion(new ItemStack(Blocks.red_flower, 1, 4), FlowerSpecies.Tulip.AddVariant(EnumFlowerColor.Crimson));
|
||||
BotanyCore.getFlowerRoot().addConversion(new ItemStack(Blocks.red_flower, 1, 5), FlowerSpecies.Tulip.AddVariant(EnumFlowerColor.DarkOrange));
|
||||
for (final FlowerSpecies species : values()) {
|
||||
final String scientific = species.branchName.substring(0, 1).toUpperCase() + species.branchName.substring(1).toLowerCase();
|
||||
final String uid = "flowers." + species.branchName.toLowerCase();
|
||||
IClassification branch = AlleleManager.alleleRegistry.getClassification("genus." + uid);
|
||||
if (branch == null) {
|
||||
branch = AlleleManager.alleleRegistry.createAndRegisterClassification(IClassification.EnumClassLevel.GENUS, uid, scientific);
|
||||
}
|
||||
(species.branch = branch).addMemberSpecies(species);
|
||||
}
|
||||
}
|
||||
|
||||
private void setStemColor(final EnumFlowerColor green) {
|
||||
this.stemColor = green;
|
||||
}
|
||||
|
||||
private void setTraits(final ForestryAllele.Fertility high, final ForestryAllele.Lifespan shortened, final ForestryAllele.Sappiness lower) {
|
||||
this.fert = high;
|
||||
this.life = shortened;
|
||||
this.sap = lower;
|
||||
}
|
||||
|
||||
private void setMutation(final FlowerSpecies dandelion2, final FlowerSpecies tulip2, final int i) {
|
||||
BotanyCore.getFlowerRoot().registerMutation(new FlowerMutation(dandelion2, tulip2, this.getTemplate(), i));
|
||||
}
|
||||
|
||||
private FlowerSpecies(final String name, final String branch, final String binomial, final IFlowerType type, final EnumFlowerColor colour) {
|
||||
this(name, branch, binomial, type, colour, colour);
|
||||
}
|
||||
|
||||
private FlowerSpecies(final String name, final String branch, final String binomial, final IFlowerType type, final EnumFlowerColor primaryColor, final EnumFlowerColor secondaryColor) {
|
||||
this.stemColor = EnumFlowerColor.Green;
|
||||
this.temperature = EnumTemperature.NORMAL;
|
||||
this.pH = EnumAcidity.Neutral;
|
||||
this.moisture = EnumMoisture.Normal;
|
||||
this.tempTolerance = EnumTolerance.BOTH_1;
|
||||
this.pHTolerance = EnumTolerance.NONE;
|
||||
this.moistureTolerance = EnumTolerance.NONE;
|
||||
this.variantTemplates = new ArrayList<IAllele[]>();
|
||||
this.name = name;
|
||||
this.binomial = binomial;
|
||||
this.branchName = branch;
|
||||
this.type = type;
|
||||
this.primaryColor = primaryColor;
|
||||
this.secondaryColor = secondaryColor;
|
||||
}
|
||||
|
||||
private IAllele[] AddVariant(final EnumFlowerColor a, final EnumFlowerColor b) {
|
||||
final IAllele[] template = this.getTemplate();
|
||||
template[EnumFlowerChromosome.PRIMARY.ordinal()] = a.getAllele();
|
||||
template[EnumFlowerChromosome.SECONDARY.ordinal()] = b.getAllele();
|
||||
this.variantTemplates.add(template);
|
||||
return template;
|
||||
}
|
||||
|
||||
private void setTemperature(final EnumTemperature temperature, final EnumTolerance tolerance) {
|
||||
this.temperature = temperature;
|
||||
this.tempTolerance = tolerance;
|
||||
}
|
||||
|
||||
private void setPH(final EnumAcidity temperature, final EnumTolerance tolerance) {
|
||||
this.pH = temperature;
|
||||
this.pHTolerance = tolerance;
|
||||
}
|
||||
|
||||
private void setMoisture(final EnumMoisture temperature, final EnumTolerance tolerance) {
|
||||
this.moisture = temperature;
|
||||
this.moistureTolerance = tolerance;
|
||||
}
|
||||
|
||||
private IAllele[] AddVariant(final EnumFlowerColor a) {
|
||||
return this.AddVariant(a, a);
|
||||
}
|
||||
|
||||
public List<IAllele[]> getVariants() {
|
||||
return this.variantTemplates;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumTemperature getTemperature() {
|
||||
return this.temperature;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumHumidity getHumidity() {
|
||||
return EnumHumidity.values()[this.getMoisture().ordinal()];
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumAcidity getPH() {
|
||||
return this.pH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumMoisture getMoisture() {
|
||||
return this.moisture;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasEffect() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSecret() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCounted() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBinomial() {
|
||||
return this.binomial;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAuthority() {
|
||||
return "Binnie";
|
||||
}
|
||||
|
||||
public void setBranch(final IClassification branch) {
|
||||
this.branch = branch;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IClassification getBranch() {
|
||||
return this.branch;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUID() {
|
||||
return "botany.flowers.species." + this.toString().toLowerCase();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDominant() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public IAllele[] getTemplate() {
|
||||
final IAllele[] template = FlowerTemplates.getDefaultTemplate();
|
||||
template[0] = this;
|
||||
template[EnumFlowerChromosome.PRIMARY.ordinal()] = this.primaryColor.getAllele();
|
||||
template[EnumFlowerChromosome.SECONDARY.ordinal()] = this.secondaryColor.getAllele();
|
||||
template[EnumFlowerChromosome.TEMPERATURE_TOLERANCE.ordinal()] = Binnie.Genetics.getToleranceAllele(this.tempTolerance);
|
||||
template[EnumFlowerChromosome.PH_TOLERANCE.ordinal()] = Binnie.Genetics.getToleranceAllele(this.pHTolerance);
|
||||
template[EnumFlowerChromosome.HUMIDITY_TOLERANCE.ordinal()] = Binnie.Genetics.getToleranceAllele(this.moistureTolerance);
|
||||
template[EnumFlowerChromosome.FERTILITY.ordinal()] = this.fert.getAllele();
|
||||
template[EnumFlowerChromosome.LIFESPAN.ordinal()] = this.life.getAllele();
|
||||
template[EnumFlowerChromosome.SAPPINESS.ordinal()] = this.sap.getAllele();
|
||||
template[EnumFlowerChromosome.STEM.ordinal()] = this.stemColor.getAllele();
|
||||
return template;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIconProvider getIconProvider() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISpeciesRoot getRoot() {
|
||||
return BotanyCore.getFlowerRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconColour(final int renderPass) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComplexity() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getResearchSuitability(final ItemStack itemstack) {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] getResearchBounty(final World world, final GameProfile researcher, final IIndividual individual, final int bountyLevel) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void init() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlowerType getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return this.getUID();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import binnie.botany.api.EnumFlowerChromosome;
|
||||
import forestry.api.genetics.IAllele;
|
||||
|
||||
public class FlowerTemplates
|
||||
{
|
||||
public static IAllele[] getDefaultTemplate() {
|
||||
final IAllele[] alleles = new IAllele[EnumFlowerChromosome.values().length];
|
||||
alleles[EnumFlowerChromosome.SPECIES.ordinal()] = FlowerSpecies.Poppy;
|
||||
alleles[EnumFlowerChromosome.PRIMARY.ordinal()] = EnumFlowerColor.Red.getAllele();
|
||||
alleles[EnumFlowerChromosome.SECONDARY.ordinal()] = EnumFlowerColor.Red.getAllele();
|
||||
alleles[EnumFlowerChromosome.FERTILITY.ordinal()] = AlleleManager.alleleRegistry.getAllele("forestry.fertilityNormal");
|
||||
alleles[EnumFlowerChromosome.TERRITORY.ordinal()] = AlleleManager.alleleRegistry.getAllele("forestry.territoryDefault");
|
||||
alleles[EnumFlowerChromosome.EFFECT.ordinal()] = ModuleGenetics.alleleEffectNone;
|
||||
alleles[EnumFlowerChromosome.LIFESPAN.ordinal()] = AlleleManager.alleleRegistry.getAllele("forestry.lifespanNormal");
|
||||
alleles[EnumFlowerChromosome.TEMPERATURE_TOLERANCE.ordinal()] = AlleleManager.alleleRegistry.getAllele("forestry.toleranceNone");
|
||||
alleles[EnumFlowerChromosome.HUMIDITY_TOLERANCE.ordinal()] = AlleleManager.alleleRegistry.getAllele("forestry.toleranceNone");
|
||||
alleles[EnumFlowerChromosome.PH_TOLERANCE.ordinal()] = AlleleManager.alleleRegistry.getAllele("forestry.toleranceNone");
|
||||
alleles[EnumFlowerChromosome.SAPPINESS.ordinal()] = AlleleManager.alleleRegistry.getAllele("forestry.sappinessAverage");
|
||||
alleles[EnumFlowerChromosome.STEM.ordinal()] = EnumFlowerColor.Green.getAllele();
|
||||
return alleles;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import binnie.botany.core.BotanyGUI;
|
||||
import net.minecraft.world.World;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import java.util.List;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import binnie.botany.Botany;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class ItemDictionary extends Item
|
||||
{
|
||||
IIcon iconMaster;
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(final IIconRegister register) {
|
||||
this.itemIcon = Botany.proxy.getIcon(register, "botanistDatabase");
|
||||
this.iconMaster = Botany.proxy.getIcon(register, "masterBotanistDatabase");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(final int par1) {
|
||||
return (par1 == 0) ? this.itemIcon : this.iconMaster;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(final ItemStack par1ItemStack, final EntityPlayer par2EntityPlayer, final List par3List, final boolean par4) {
|
||||
super.addInformation(par1ItemStack, par2EntityPlayer, par3List, par4);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(final Item par1, final CreativeTabs par2CreativeTabs, final List par3List) {
|
||||
super.getSubItems(par1, par2CreativeTabs, par3List);
|
||||
par3List.add(new ItemStack(par1, 1, 1));
|
||||
}
|
||||
|
||||
public ItemDictionary() {
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
this.setUnlocalizedName("database");
|
||||
this.setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(final ItemStack itemstack, final World world, final EntityPlayer player) {
|
||||
if (itemstack.getItemDamage() == 0) {
|
||||
Botany.proxy.openGui(BotanyGUI.Database, player, (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
}
|
||||
else {
|
||||
Botany.proxy.openGui(BotanyGUI.DatabaseNEI, player, (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
}
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(final ItemStack i) {
|
||||
return (i.getItemDamage() == 0) ? "Botanist Database" : "Master Botanist Database";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import net.minecraft.util.IIcon;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import binnie.botany.Botany;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class ItemEncyclopedia extends Item
|
||||
{
|
||||
boolean reinforced;
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(final IIconRegister register) {
|
||||
this.itemIcon = Botany.proxy.getIcon(register, "encylopedia" + (this.reinforced ? "Iron" : ""));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(final int par1) {
|
||||
return this.itemIcon;
|
||||
}
|
||||
|
||||
public ItemEncyclopedia(final boolean reinforced) {
|
||||
this.reinforced = false;
|
||||
this.reinforced = reinforced;
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
this.setUnlocalizedName("encylopedia" + (reinforced ? "Iron" : ""));
|
||||
this.setMaxStackSize(1);
|
||||
this.setMaxDamage(reinforced ? 480 : 120);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(final ItemStack i) {
|
||||
return (this.reinforced ? "Reinforced " : "") + "Florist's Encyclopaedia";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import binnie.Binnie;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.api.apiculture.FlowerManager;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import binnie.botany.flower.RendererBotany;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import binnie.botany.flower.TileEntityFlower;
|
||||
import binnie.core.BinnieCore;
|
||||
import net.minecraft.block.Block;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import binnie.botany.flower.ItemSeed;
|
||||
import binnie.botany.flower.ItemPollen;
|
||||
import binnie.botany.flower.ItemFlower;
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.flower.BlockFlower;
|
||||
import binnie.core.IInitializable;
|
||||
|
||||
public class ModuleGenetics implements IInitializable
|
||||
{
|
||||
static AlleleEffectNone alleleEffectNone;
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
EnumFlowerColor.setupMutations();
|
||||
Botany.flower = new BlockFlower();
|
||||
Botany.flowerItem = new ItemFlower();
|
||||
Botany.pollen = new ItemPollen();
|
||||
Botany.seed = new ItemSeed();
|
||||
AlleleManager.alleleRegistry.registerSpeciesRoot(BotanyCore.speciesRoot);
|
||||
AlleleManager.alleleRegistry.registerAllele(ModuleGenetics.alleleEffectNone);
|
||||
GameRegistry.registerBlock(Botany.flower, "flower");
|
||||
BinnieCore.proxy.registerTileEntity(TileEntityFlower.class, "botany.tile.flower", null);
|
||||
Botany.database = new ItemDictionary();
|
||||
Botany.encyclopedia = new ItemEncyclopedia(false);
|
||||
Botany.encyclopediaIron = new ItemEncyclopedia(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
for (final EnumFlowerColor color : EnumFlowerColor.values()) {
|
||||
AlleleManager.alleleRegistry.registerAllele(color.getAllele());
|
||||
}
|
||||
FlowerSpecies.setupVariants();
|
||||
for (final FlowerSpecies species : FlowerSpecies.values()) {
|
||||
AlleleManager.alleleRegistry.registerAllele(species);
|
||||
BotanyCore.getFlowerRoot().registerTemplate(species.getUID(), species.getTemplate());
|
||||
for (final IAllele[] variant : species.getVariants()) {
|
||||
BotanyCore.getFlowerRoot().registerTemplate(variant);
|
||||
}
|
||||
}
|
||||
RendererBotany.renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
BinnieCore.proxy.registerBlockRenderer(new RendererBotany());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Botany.encyclopedia), new Object[] { "fff", "fbf", "fff", 'f', new ItemStack(Blocks.red_flower, 1, 32767), 'b', Items.book }));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Botany.encyclopedia), new Object[] { "fff", "fbf", "fff", 'f', new ItemStack(Blocks.yellow_flower, 1, 32767), 'b', Items.book }));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Botany.encyclopedia), new Object[] { "fff", "fbf", "fff", 'f', new ItemStack(Botany.flower, 1, 32767), 'b', Items.book }));
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(Botany.encyclopediaIron), new Object[] { new ItemStack(Botany.encyclopedia), "ingotIron" }));
|
||||
FlowerManager.flowerRegistry.registerAcceptableFlower(Botany.flower, new String[] { "flowersVanilla" });
|
||||
RecipeManagers.carpenterManager.addRecipe(100, Binnie.Liquid.getLiquidStack("water", 2000), (ItemStack) null, new ItemStack(Botany.database), new Object[] { "X#X", "YEY", "RDR", '#', Blocks.glass_pane, 'X', Items.gold_ingot, 'Y', Items.gold_nugget, 'R', Items.redstone, 'D', Items.diamond, 'E', Items.emerald });
|
||||
}
|
||||
|
||||
static {
|
||||
ModuleGenetics.alleleEffectNone = new AlleleEffectNone();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.items;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import java.util.List;
|
||||
import binnie.botany.Botany;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import binnie.core.item.IItemMisc;
|
||||
|
||||
public enum BotanyItems implements IItemMisc
|
||||
{
|
||||
AshPowder("Ash Powder", "powderAsh"),
|
||||
PulpPowder("Wood Pulp Powder", "powderPulp"),
|
||||
MulchPowder("Mulch Powder", "powderMulch"),
|
||||
SulphurPowder("Sulphur Powder", "powderSulphur"),
|
||||
FertiliserPowder("Fertiliser Powder", "powderFertiliser"),
|
||||
CompostPowder("Compost Powder", "powderCompost"),
|
||||
Mortar("Mortar", "mortar"),
|
||||
Weedkiller("Weedkiller", "weedkiller");
|
||||
|
||||
IIcon icon;
|
||||
String name;
|
||||
String iconPath;
|
||||
|
||||
private BotanyItems(final String name, final String iconPath) {
|
||||
this.name = name;
|
||||
this.iconPath = iconPath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(final ItemStack stack) {
|
||||
return this.icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(final IIconRegister register) {
|
||||
this.icon = Botany.proxy.getIcon(register, this.iconPath);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(final List par3List) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName(final ItemStack stack) {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack get(final int size) {
|
||||
return new ItemStack(Botany.misc, size, this.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.items;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import java.util.List;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class ItemClay extends Item
|
||||
{
|
||||
public ItemClay() {
|
||||
this.setUnlocalizedName("clay");
|
||||
this.setHasSubtypes(true);
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(final ItemStack stack, final int p_82790_2_) {
|
||||
final int damage = stack.getItemDamage();
|
||||
return EnumFlowerColor.get(damage).getColor(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(final ItemStack stack) {
|
||||
return EnumFlowerColor.get(stack.getItemDamage()).getName() + " Clay";
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(final Item p_150895_1_, final CreativeTabs p_150895_2_, final List list) {
|
||||
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
list.add(new ItemStack(this, 1, c.ordinal()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(final IIconRegister register) {
|
||||
this.itemIcon = Botany.proxy.getIcon(register, "clay");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.items;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import java.util.List;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class ItemPigment extends Item
|
||||
{
|
||||
public ItemPigment() {
|
||||
this.setUnlocalizedName("pigment");
|
||||
this.setHasSubtypes(true);
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(final ItemStack stack, final int p_82790_2_) {
|
||||
final int damage = stack.getItemDamage();
|
||||
return EnumFlowerColor.get(damage).getColor(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(final ItemStack stack) {
|
||||
return EnumFlowerColor.get(stack.getItemDamage()).getName() + " Pigment";
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(final Item p_150895_1_, final CreativeTabs p_150895_2_, final List list) {
|
||||
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
list.add(new ItemStack(this, 1, c.ordinal()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(final IIconRegister register) {
|
||||
this.itemIcon = Botany.proxy.getIcon(register, "pigment");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.network;
|
||||
|
||||
import binnie.botany.genetics.EnumFlowerType;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import java.io.IOException;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import binnie.core.network.packet.MessageBinnie;
|
||||
import binnie.botany.flower.TileEntityFlower;
|
||||
import binnie.core.network.packet.MessageCoordinates;
|
||||
|
||||
public class MessageFlowerUpdate extends MessageCoordinates
|
||||
{
|
||||
public TileEntityFlower.RenderInfo render;
|
||||
|
||||
public MessageFlowerUpdate(final int posX, final int posY, final int posZ, final TileEntityFlower.RenderInfo render) {
|
||||
super(PacketID.FlowerUpdate.ordinal(), posX, posY, posZ);
|
||||
this.render = render;
|
||||
}
|
||||
|
||||
public MessageFlowerUpdate(final MessageBinnie message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeData(final ByteBuf data) throws IOException {
|
||||
super.writeData(data);
|
||||
data.writeByte(this.render.primary.getID());
|
||||
data.writeByte(this.render.secondary.getID());
|
||||
data.writeByte(this.render.stem.getID());
|
||||
data.writeByte(this.render.type.ordinal());
|
||||
data.writeByte(this.render.age);
|
||||
data.writeByte(this.render.section);
|
||||
data.writeBoolean(this.render.wilted);
|
||||
data.writeBoolean(this.render.flowered);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readData(final ByteBuf data) throws IOException {
|
||||
super.readData(data);
|
||||
this.render = new TileEntityFlower.RenderInfo();
|
||||
this.render.primary = EnumFlowerColor.values()[data.readByte()];
|
||||
this.render.secondary = EnumFlowerColor.values()[data.readByte()];
|
||||
this.render.stem = EnumFlowerColor.values()[data.readByte()];
|
||||
this.render.type = EnumFlowerType.values()[data.readByte()];
|
||||
this.render.age = data.readByte();
|
||||
this.render.section = data.readByte();
|
||||
this.render.wilted = data.readBoolean();
|
||||
this.render.flowered = data.readBoolean();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.network;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import binnie.botany.flower.TileEntityFlower;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.network.packet.MessageNBT;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import binnie.core.network.packet.MessageBinnie;
|
||||
import binnie.core.network.IPacketID;
|
||||
|
||||
public enum PacketID implements IPacketID
|
||||
{
|
||||
Encylopedia,
|
||||
FlowerUpdate;
|
||||
|
||||
@Override
|
||||
public void onMessage(final MessageBinnie message, final MessageContext context) {
|
||||
if (this == PacketID.Encylopedia && context.side == Side.CLIENT) {
|
||||
final MessageNBT packet = new MessageNBT(message);
|
||||
final NBTTagCompound data = packet.getTagCompound();
|
||||
final EntityPlayer player = BinnieCore.proxy.getPlayer();
|
||||
String info = "";
|
||||
if (data.hasNoTags()) {
|
||||
info += "Flower has not been discovered by you. Breed this flower yourself to discover.";
|
||||
}
|
||||
else {
|
||||
final IAlleleFlowerSpecies primary = (IAlleleFlowerSpecies) AlleleManager.alleleRegistry.getAllele(data.getString("Species"));
|
||||
final IAlleleFlowerSpecies secondary = (IAlleleFlowerSpecies) AlleleManager.alleleRegistry.getAllele(data.getString("Species2"));
|
||||
final float age = data.getFloat("Age");
|
||||
final EnumFlowerColor color1 = EnumFlowerColor.get(data.getShort("Colour"));
|
||||
final EnumFlowerColor color2 = EnumFlowerColor.get(data.getShort("Colour2"));
|
||||
if (primary == null || secondary == null) {
|
||||
return;
|
||||
}
|
||||
info += "A";
|
||||
if (age == 0.0f) {
|
||||
info += "";
|
||||
}
|
||||
else if (age < 0.25f) {
|
||||
info += " Young";
|
||||
}
|
||||
else if (age < 0.75f) {
|
||||
info += " Mature";
|
||||
}
|
||||
else {
|
||||
info += " Old";
|
||||
}
|
||||
if (color1 == color2) {
|
||||
info = info + " " + color1.getName();
|
||||
}
|
||||
else {
|
||||
info = info + " " + color1.getName() + " & " + color2.getName();
|
||||
}
|
||||
if (primary == secondary) {
|
||||
info = info + " " + primary.getName();
|
||||
}
|
||||
else {
|
||||
info = info + " " + primary.getName() + "-" + secondary.getName() + " Hybrid";
|
||||
}
|
||||
if (age == 0.0f) {
|
||||
info += " Germling";
|
||||
}
|
||||
if (data.getBoolean("Wilting")) {
|
||||
info += ". Shame it is Wilting!";
|
||||
}
|
||||
}
|
||||
final IChatComponent chat = new ChatComponentText(info);
|
||||
player.addChatMessage(chat);
|
||||
}
|
||||
else if (this == PacketID.FlowerUpdate) {
|
||||
final MessageFlowerUpdate packet2 = new MessageFlowerUpdate(message);
|
||||
final TileEntity tile = packet2.getTileEntity(BinnieCore.proxy.getWorld());
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
((TileEntityFlower) tile).setRender(packet2.render);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.proxy;
|
||||
|
||||
import binnie.core.proxy.IProxyCore;
|
||||
|
||||
public interface IBotanyProxy extends IProxyCore
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.proxy;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import binnie.core.proxy.BinnieModProxy;
|
||||
|
||||
public class Proxy extends BinnieModProxy implements IBotanyProxy
|
||||
{
|
||||
public Proxy() {
|
||||
super(Botany.instance);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.proxy;
|
||||
|
||||
public class ProxyClient extends Proxy implements IBotanyProxy
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.proxy;
|
||||
|
||||
public class ProxyServer extends Proxy implements IBotanyProxy
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import binnie.core.network.packet.MessageBinnie;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import binnie.core.mod.parser.FieldParser;
|
||||
import binnie.Binnie;
|
||||
import binnie.core.network.BinniePacketHandler;
|
||||
import binnie.core.proxy.IProxyCore;
|
||||
import binnie.core.gui.IBinnieGUID;
|
||||
import binnie.core.network.IPacketID;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.LinkedHashSet;
|
||||
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
|
||||
import binnie.core.network.IPacketProvider;
|
||||
|
||||
public abstract class AbstractMod implements IPacketProvider, IInitializable
|
||||
{
|
||||
private SimpleNetworkWrapper wrapper;
|
||||
private LinkedHashSet<Field> fields;
|
||||
protected List<IInitializable> modules;
|
||||
|
||||
public AbstractMod() {
|
||||
this.fields = new LinkedHashSet<Field>();
|
||||
this.modules = new ArrayList<IInitializable>();
|
||||
BinnieCore.registerMod(this);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
public abstract boolean isActive();
|
||||
|
||||
@Override
|
||||
public abstract String getChannel();
|
||||
|
||||
@Override
|
||||
public IPacketID[] getPacketIDs() {
|
||||
return new IPacketID[0];
|
||||
}
|
||||
|
||||
public IBinnieGUID[] getGUIDs() {
|
||||
return new IBinnieGUID[0];
|
||||
}
|
||||
|
||||
public Class[] getConfigs() {
|
||||
return new Class[0];
|
||||
}
|
||||
|
||||
public abstract IProxyCore getProxy();
|
||||
|
||||
public abstract String getModID();
|
||||
|
||||
public SimpleNetworkWrapper getNetworkWrapper() {
|
||||
return this.wrapper;
|
||||
}
|
||||
|
||||
protected abstract Class<? extends BinniePacketHandler> getPacketHandler();
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
if (!this.isActive()) {
|
||||
return;
|
||||
}
|
||||
if (this.getConfigs() != null) {
|
||||
for (final Class cls : this.getConfigs()) {
|
||||
Binnie.Configuration.registerConfiguration(cls, this);
|
||||
}
|
||||
}
|
||||
this.getProxy().preInit();
|
||||
for (final IInitializable module : this.modules) {
|
||||
module.preInit();
|
||||
}
|
||||
for (final Field field : this.getClass().getFields()) {
|
||||
this.fields.add(field);
|
||||
}
|
||||
for (final Class cls : this.getClass().getClasses()) {
|
||||
for (final Field field2 : this.getClass().getFields()) {
|
||||
this.fields.add(field2);
|
||||
}
|
||||
}
|
||||
for (final IInitializable module : this.modules) {
|
||||
for (final Field field3 : module.getClass().getFields()) {
|
||||
this.fields.add(field3);
|
||||
}
|
||||
}
|
||||
for (final Field field4 : this.fields) {
|
||||
try {
|
||||
FieldParser.preInitParse(field4, this);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
if (!this.isActive()) {
|
||||
return;
|
||||
}
|
||||
this.getProxy().init();
|
||||
(this.wrapper = NetworkRegistry.INSTANCE.newSimpleChannel(this.getChannel())).registerMessage((Class) this.getPacketHandler(), (Class) MessageBinnie.class, 1, Side.CLIENT);
|
||||
this.wrapper.registerMessage((Class) this.getPacketHandler(), (Class) MessageBinnie.class, 1, Side.SERVER);
|
||||
for (final IInitializable module : this.modules) {
|
||||
module.init();
|
||||
}
|
||||
for (final Field field : this.fields) {
|
||||
try {
|
||||
FieldParser.initParse(field, this);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
if (!this.isActive()) {
|
||||
return;
|
||||
}
|
||||
this.getProxy().postInit();
|
||||
for (final IInitializable module : this.modules) {
|
||||
module.postInit();
|
||||
}
|
||||
for (final Field field : this.fields) {
|
||||
try {
|
||||
FieldParser.postInitParse(field, this);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected final void addModule(final IInitializable init) {
|
||||
this.modules.add(init);
|
||||
MinecraftForge.EVENT_BUS.register(init);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,238 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core;
|
||||
|
||||
import binnie.core.network.BinniePacketHandler;
|
||||
import binnie.core.mod.config.ConfigurationMain;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import binnie.core.network.BinnieCorePacketID;
|
||||
import binnie.core.network.IPacketID;
|
||||
import binnie.core.proxy.IBinnieProxy;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import forestry.api.core.ForestryEvent;
|
||||
import java.util.ArrayList;
|
||||
import forestry.plugins.PluginManager;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import binnie.core.block.MultipassBlockRenderer;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import binnie.core.gui.BinnieGUIHandler;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import net.minecraft.item.Item;
|
||||
import binnie.core.mod.parser.ItemParser;
|
||||
import binnie.core.mod.parser.FieldParser;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import binnie.core.liquid.ItemFluidContainer;
|
||||
import binnie.core.liquid.FluidContainer;
|
||||
import binnie.core.gui.BinnieCoreGUI;
|
||||
import binnie.core.gui.IBinnieGUID;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import binnie.core.triggers.ModuleTrigger;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import binnie.core.item.ModuleItems;
|
||||
import binnie.core.machines.storage.ModuleStorage;
|
||||
import binnie.craftgui.minecraft.ModuleCraftGUI;
|
||||
import binnie.core.mod.config.ConfigurationMods;
|
||||
import binnie.Binnie;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import binnie.core.item.ItemFieldKit;
|
||||
import binnie.core.item.ItemGenesis;
|
||||
import binnie.core.machines.MachineGroup;
|
||||
import java.util.List;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import binnie.core.proxy.BinnieProxy;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
|
||||
@Mod(modid = "BinnieCore", name = "Binnie Core", useMetadata = true)
|
||||
public final class BinnieCore extends AbstractMod
|
||||
{
|
||||
@Mod.Instance("BinnieCore")
|
||||
public static BinnieCore instance;
|
||||
@SidedProxy(clientSide = "binnie.core.proxy.BinnieProxyClient", serverSide = "binnie.core.proxy.BinnieProxyServer")
|
||||
public static BinnieProxy proxy;
|
||||
public static int multipassRenderID;
|
||||
private static List<AbstractMod> modList;
|
||||
public static MachineGroup packageCompartment;
|
||||
public static ItemGenesis genesis;
|
||||
public static ItemFieldKit fieldKit;
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preInit(final FMLPreInitializationEvent evt) {
|
||||
Binnie.Configuration.registerConfiguration(ConfigurationMods.class, this);
|
||||
for (final ManagerBase baseManager : Binnie.Managers) {
|
||||
this.addModule(baseManager);
|
||||
}
|
||||
this.addModule(new ModuleCraftGUI());
|
||||
this.addModule(new ModuleStorage());
|
||||
this.addModule(new ModuleItems());
|
||||
if (Loader.isModLoaded("BuildCraft|Silicon")) {
|
||||
this.addModule(new ModuleTrigger());
|
||||
}
|
||||
this.preInit();
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void init(final FMLInitializationEvent evt) {
|
||||
this.init();
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void postInit(final FMLPostInitializationEvent evt) {
|
||||
this.postInit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinnieGUID[] getGUIDs() {
|
||||
return BinnieCoreGUI.values();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
BinnieCore.instance = this;
|
||||
for (final FluidContainer container : FluidContainer.values()) {
|
||||
final Item item = new ItemFluidContainer(container);
|
||||
GameRegistry.registerItem(item, item.getUnlocalizedName().substring(5));
|
||||
}
|
||||
FieldParser.parsers.add(new ItemParser());
|
||||
super.preInit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
for (final AbstractMod mod : getActiveMods()) {
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(mod, new BinnieGUIHandler(mod));
|
||||
}
|
||||
BinnieCore.multipassRenderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
RenderingRegistry.registerBlockHandler(new MultipassBlockRenderer());
|
||||
GameRegistry.registerTileEntity(TileEntityMetadata.class, "binnie.tile.metadata");
|
||||
}
|
||||
|
||||
public static boolean isLepidopteryActive() {
|
||||
return PluginManager.Module.LEPIDOPTEROLOGY.isEnabled();
|
||||
}
|
||||
|
||||
public static boolean isApicultureActive() {
|
||||
return PluginManager.Module.APICULTURE.isEnabled();
|
||||
}
|
||||
|
||||
public static boolean isArboricultureActive() {
|
||||
return PluginManager.Module.ARBORICULTURE.isEnabled();
|
||||
}
|
||||
|
||||
public static boolean isBotanyActive() {
|
||||
return ConfigurationMods.botany;
|
||||
}
|
||||
|
||||
public static boolean isGeneticsActive() {
|
||||
return ConfigurationMods.genetics;
|
||||
}
|
||||
|
||||
public static boolean isExtraBeesActive() {
|
||||
return ConfigurationMods.extraBees && isApicultureActive();
|
||||
}
|
||||
|
||||
public static boolean isExtraTreesActive() {
|
||||
return ConfigurationMods.extraTrees && isArboricultureActive();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
super.postInit();
|
||||
}
|
||||
|
||||
static void registerMod(final AbstractMod mod) {
|
||||
BinnieCore.modList.add(mod);
|
||||
}
|
||||
|
||||
private static List<AbstractMod> getActiveMods() {
|
||||
final List<AbstractMod> list = new ArrayList<AbstractMod>();
|
||||
for (final AbstractMod mod : BinnieCore.modList) {
|
||||
if (mod.isActive()) {
|
||||
list.add(mod);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void handleSpeciesDiscovered(final ForestryEvent.SpeciesDiscovered event) {
|
||||
try {
|
||||
final EntityPlayerMP player = MinecraftServer.getServer().getConfigurationManager().func_152612_a(event.username.getName());
|
||||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
event.tracker.synchToPlayer(player);
|
||||
final NBTTagCompound nbt = new NBTTagCompound();
|
||||
nbt.setString("species", event.species.getUID());
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getChannel() {
|
||||
return "BIN";
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinnieProxy getProxy() {
|
||||
return BinnieCore.proxy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModID() {
|
||||
return "binniecore";
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPacketID[] getPacketIDs() {
|
||||
return BinnieCorePacketID.values();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void handleTextureRemap(final TextureStitchEvent.Pre event) {
|
||||
if (event.map.getTextureType() == 0) {
|
||||
Binnie.Liquid.reloadIcons(event.map);
|
||||
}
|
||||
Binnie.Resource.registerIcons(event.map, event.map.getTextureType());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?>[] getConfigs() {
|
||||
return new Class[] { ConfigurationMain.class };
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<? extends BinniePacketHandler> getPacketHandler() {
|
||||
return PacketHandler.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return true;
|
||||
}
|
||||
|
||||
static {
|
||||
BinnieCore.modList = new ArrayList<AbstractMod>();
|
||||
}
|
||||
|
||||
public static class PacketHandler extends BinniePacketHandler
|
||||
{
|
||||
public PacketHandler() {
|
||||
super(BinnieCore.instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core;
|
||||
|
||||
public interface IInitializable
|
||||
{
|
||||
void preInit();
|
||||
|
||||
void init();
|
||||
|
||||
void postInit();
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core;
|
||||
|
||||
import binnie.Binnie;
|
||||
|
||||
public abstract class ManagerBase implements IInitializable
|
||||
{
|
||||
public ManagerBase() {
|
||||
Binnie.Managers.add(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core;
|
||||
|
||||
import cpw.mods.fml.common.versioning.ArtifactVersion;
|
||||
import cpw.mods.fml.common.versioning.Restriction;
|
||||
import cpw.mods.fml.common.versioning.DefaultArtifactVersion;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class Mods
|
||||
{
|
||||
public static Mod Forestry;
|
||||
public static Mod IC2;
|
||||
public static Mod Botania;
|
||||
private static boolean WARN;
|
||||
|
||||
private static Item findItem(final String modId, final String name) {
|
||||
final Item stack = GameRegistry.findItem(modId, name);
|
||||
if (stack == null && Mods.WARN && modId == "Forestry") {
|
||||
throw new RuntimeException("Item not found: " + modId + ":" + name);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
private static ItemStack findItemStack(final String modId, final String name, final int stackSize) {
|
||||
final ItemStack stack = GameRegistry.findItemStack(modId, name, stackSize);
|
||||
if (stack == null && Mods.WARN && modId == "Forestry") {
|
||||
throw new RuntimeException("Stack not found: " + modId + ":" + name);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
private static Block findBlock(final String modId, final String name) {
|
||||
final Block stack = GameRegistry.findBlock(modId, name);
|
||||
if (stack == null && Mods.WARN && modId == "Forestry") {
|
||||
throw new RuntimeException("Block not found: " + modId + ":" + name);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
static {
|
||||
Mods.Forestry = new Mod("Forestry") {
|
||||
@Override
|
||||
public boolean dev() {
|
||||
final String forVersion = Loader.instance().getIndexedModList().get("Forestry").getVersion();
|
||||
final Restriction rest = new Restriction(new DefaultArtifactVersion("3.6"), true, (ArtifactVersion) null, false);
|
||||
return rest.containsVersion(new DefaultArtifactVersion(forVersion));
|
||||
}
|
||||
};
|
||||
Mods.IC2 = new Mod("IC2");
|
||||
Mods.Botania = new Mod("Botania");
|
||||
Mods.WARN = true;
|
||||
}
|
||||
|
||||
public static class Mod
|
||||
{
|
||||
private String id;
|
||||
|
||||
private Mod(final String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Item item(final String name) {
|
||||
return findItem(this.id, name);
|
||||
}
|
||||
|
||||
public Block block(final String name) {
|
||||
return findBlock(this.id, name);
|
||||
}
|
||||
|
||||
public ItemStack stack(final String name, final int stackSize) {
|
||||
return findItemStack(this.id, name, stackSize);
|
||||
}
|
||||
|
||||
public ItemStack stack(final String name) {
|
||||
return this.stack(name, 1);
|
||||
}
|
||||
|
||||
public ItemStack stack(final String string, final int i, final int j) {
|
||||
return new ItemStack(this.item(string), i, j);
|
||||
}
|
||||
|
||||
public boolean active() {
|
||||
return Loader.isModLoaded(this.id);
|
||||
}
|
||||
|
||||
public boolean dev() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.block;
|
||||
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import binnie.core.BinnieCore;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import java.util.List;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import java.util.ArrayList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
|
||||
public class BlockMetadata extends BlockContainer implements IBlockMetadata
|
||||
{
|
||||
static int temporyMeta;
|
||||
|
||||
public BlockMetadata(final Material material) {
|
||||
super(material);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(final World world, final int x, final int y, final int z, final int blockMeta, final int fortune) {
|
||||
return getBlockDropped(this, world, x, y, z, blockMeta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(final World world, final EntityPlayer player, final int x, final int y, final int z) {
|
||||
return breakBlock(this, player, world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(final World var1, final int i) {
|
||||
return new TileEntityMetadata();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(final int meta) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockEventReceived(final World par1World, final int par2, final int par3, final int par4, final int par5, final int par6) {
|
||||
super.onBlockEventReceived(par1World, par2, par3, par4, par5, par6);
|
||||
final TileEntity tileentity = par1World.getTileEntity(par2, par3, par4);
|
||||
return tileentity != null && tileentity.receiveClientEvent(par5, par6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(final IBlockAccess par1IBlockAccess, final int par2, final int par3, final int par4, final int par5) {
|
||||
final int metadata = TileEntityMetadata.getTileMetadata(par1IBlockAccess, par2, par3, par4);
|
||||
return this.getIcon(par5, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName(final ItemStack par1ItemStack) {
|
||||
return this.getLocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getBlockTooltip(final ItemStack par1ItemStack, final List par3List) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlacedMeta(final ItemStack item, final World world, final int x, final int y, final int z, final ForgeDirection clickedBlock) {
|
||||
final int damage = TileEntityMetadata.getItemDamage(item);
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDroppedMeta(final int tileMeta, final int blockMeta) {
|
||||
return tileMeta;
|
||||
}
|
||||
|
||||
public static ArrayList<ItemStack> getBlockDropped(final IBlockMetadata block, final World world, final int x, final int y, final int z, final int blockMeta) {
|
||||
final ArrayList<ItemStack> array = new ArrayList<ItemStack>();
|
||||
final TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null && !tile.hasDroppedBlock()) {
|
||||
final int meta = block.getDroppedMeta(world.getBlockMetadata(x, y, z), tile.getTileMetadata());
|
||||
array.add(TileEntityMetadata.getItemStack((Block) block, meta));
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
public static boolean breakBlock(final IBlockMetadata block, final EntityPlayer player, final World world, final int i, final int j, final int k) {
|
||||
List<ItemStack> drops = new ArrayList<ItemStack>();
|
||||
final Block block2 = (Block) block;
|
||||
final TileEntityMetadata tile = TileEntityMetadata.getTile(world, i, j, k);
|
||||
if (tile != null && !tile.hasDroppedBlock()) {
|
||||
final int tileMeta = TileEntityMetadata.getTileMetadata(world, i, j, k);
|
||||
drops = block2.getDrops(world, i, j, k, world.getBlockMetadata(i, j, k), 0);
|
||||
}
|
||||
final boolean hasBeenBroken = world.setBlockToAir(i, j, k);
|
||||
if (hasBeenBroken && BinnieCore.proxy.isSimulating(world) && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) {
|
||||
for (final ItemStack drop : drops) {
|
||||
block.dropAsStack(world, i, j, k, drop);
|
||||
}
|
||||
tile.dropBlock();
|
||||
}
|
||||
return hasBeenBroken;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dropAsStack(final World world, final int x, final int y, final int z, final ItemStack drop) {
|
||||
this.dropBlockAsItem(world, x, y, z, drop);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(final World par1World, final int par2, final int par3, final int par4, final Block par5, final int par6) {
|
||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
par1World.removeTileEntity(par2, par3, par4);
|
||||
}
|
||||
|
||||
public static ItemStack getPickBlock(final World world, final int x, final int y, final int z) {
|
||||
final List<ItemStack> list = getBlockDropped((IBlockMetadata) world.getBlock(x, y, z), world, x, y, z, world.getBlockMetadata(x, y, z));
|
||||
return list.isEmpty() ? null : list.get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(final MovingObjectPosition target, final World world, final int x, final int y, final int z) {
|
||||
return getPickBlock(world, x, y, z);
|
||||
}
|
||||
|
||||
static {
|
||||
BlockMetadata.temporyMeta = -1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.block;
|
||||
|
||||
import java.util.List;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
|
||||
public interface IBlockMetadata extends ITileEntityProvider
|
||||
{
|
||||
int getPlacedMeta(final ItemStack p0, final World p1, final int p2, final int p3, final int p4, final ForgeDirection p5);
|
||||
|
||||
int getDroppedMeta(final int p0, final int p1);
|
||||
|
||||
String getBlockName(final ItemStack p0);
|
||||
|
||||
void getBlockTooltip(final ItemStack p0, final List p1);
|
||||
|
||||
void dropAsStack(final World p0, final int p1, final int p2, final int p3, final ItemStack p4);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.block;
|
||||
|
||||
public interface IMultipassBlock
|
||||
{
|
||||
int getNumberOfPasses();
|
||||
|
||||
int colorMultiplier(final int p0);
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.block;
|
||||
|
||||
import net.minecraft.util.IIcon;
|
||||
import java.util.List;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
|
||||
public class ItemMetadata extends ItemBlock
|
||||
{
|
||||
public ItemMetadata(final Block block) {
|
||||
super(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(final int par1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean placeBlockAt(final ItemStack stack, final EntityPlayer player, final World world, final int x, final int y, final int z, final int side, final float hitX, final float hitY, final float hitZ, final int metadata) {
|
||||
final Block block = this.field_150939_a;
|
||||
if (!(block instanceof IBlockMetadata)) {
|
||||
return false;
|
||||
}
|
||||
final int placedMeta = ((IBlockMetadata) block).getPlacedMeta(stack, world, x, y, z, ForgeDirection.values()[side]);
|
||||
if (placedMeta < 0) {
|
||||
return false;
|
||||
}
|
||||
if (!world.setBlock(x, y, z, block, metadata, 3)) {
|
||||
return false;
|
||||
}
|
||||
if (world.getBlock(x, y, z) == block) {
|
||||
final TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
tile.setTileMetadata(placedMeta, false);
|
||||
}
|
||||
block.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
block.onPostBlockPlaced(world, x, y, z, metadata);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getItemStackDisplayName(final ItemStack par1ItemStack) {
|
||||
return ((IBlockMetadata) this.field_150939_a).getBlockName(par1ItemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(final ItemStack par1ItemStack, final EntityPlayer par2EntityPlayer, final List par3List, final boolean par4) {
|
||||
((IBlockMetadata) this.field_150939_a).getBlockTooltip(par1ItemStack, par3List);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIconFromDamage(final int par1) {
|
||||
return this.field_150939_a.getIcon(1, par1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.block;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
public class ItemMetadataRenderer implements IItemRenderer
|
||||
{
|
||||
@Override
|
||||
public boolean handleRenderType(final ItemStack item, final IItemRenderer.ItemRenderType type) {
|
||||
return type == IItemRenderer.ItemRenderType.INVENTORY || type == IItemRenderer.ItemRenderType.ENTITY || type == IItemRenderer.ItemRenderType.EQUIPPED || type == IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(final IItemRenderer.ItemRenderType type, final ItemStack item, final IItemRenderer.ItemRendererHelper helper) {
|
||||
if (type == IItemRenderer.ItemRenderType.INVENTORY) {
|
||||
return helper == IItemRenderer.ItemRendererHelper.INVENTORY_BLOCK;
|
||||
}
|
||||
if (type == IItemRenderer.ItemRenderType.ENTITY) {
|
||||
return helper == IItemRenderer.ItemRendererHelper.ENTITY_BOBBING || helper == IItemRenderer.ItemRendererHelper.ENTITY_ROTATION;
|
||||
}
|
||||
return (type == IItemRenderer.ItemRenderType.EQUIPPED || type == IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON) && helper == IItemRenderer.ItemRendererHelper.EQUIPPED_BLOCK;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(final IItemRenderer.ItemRenderType type, final ItemStack item, final Object... data) {
|
||||
GL11.glPushMatrix();
|
||||
final Block block = Block.getBlockFromItem(item.getItem());
|
||||
if (type == IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON) {
|
||||
GL11.glTranslated(0.5, 0.5, 0.5);
|
||||
}
|
||||
if (type == IItemRenderer.ItemRenderType.INVENTORY && block.getRenderBlockPass() != 0) {
|
||||
GL11.glAlphaFunc(516, 0.1f);
|
||||
GL11.glEnable(3042);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
}
|
||||
GL11.glPushMatrix();
|
||||
((RenderBlocks) data[0]).renderBlockAsItem(block, TileEntityMetadata.getItemDamage(item), 1.0f);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.block;
|
||||
|
||||
import binnie.core.BinnieCore;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.block.Block;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
|
||||
public class MultipassBlockRenderer implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
public static MultipassBlockRenderer instance;
|
||||
private static int layer;
|
||||
|
||||
public MultipassBlockRenderer() {
|
||||
MultipassBlockRenderer.instance = this;
|
||||
}
|
||||
|
||||
private void setColour(final Tessellator tess, final int colour) {
|
||||
final float var6 = (colour >> 16 & 0xFF) / 255.0f;
|
||||
final float var7 = (colour >> 8 & 0xFF) / 255.0f;
|
||||
final float var8 = (colour & 0xFF) / 255.0f;
|
||||
GL11.glColor3f(var6, var7, var8);
|
||||
}
|
||||
|
||||
public static int getLayer() {
|
||||
return MultipassBlockRenderer.layer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(final Block block, final int meta, final int modelID, final RenderBlocks renderer) {
|
||||
block.setBlockBoundsForItemRender();
|
||||
renderer.setRenderBoundsFromBlock(block);
|
||||
GL11.glTranslatef(-0.5f, -0.5f, -0.5f);
|
||||
MultipassBlockRenderer.layer = 0;
|
||||
while (MultipassBlockRenderer.layer < ((IMultipassBlock) block).getNumberOfPasses()) {
|
||||
this.renderItem(block, renderer, meta);
|
||||
++MultipassBlockRenderer.layer;
|
||||
}
|
||||
MultipassBlockRenderer.layer = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(final IBlockAccess world, final int x, final int y, final int z, final Block block, final int modelId, final RenderBlocks renderer) {
|
||||
boolean r = true;
|
||||
MultipassBlockRenderer.layer = 0;
|
||||
while (MultipassBlockRenderer.layer < ((IMultipassBlock) block).getNumberOfPasses()) {
|
||||
r = renderer.renderStandardBlock(block, x, y, z);
|
||||
++MultipassBlockRenderer.layer;
|
||||
}
|
||||
MultipassBlockRenderer.layer = 0;
|
||||
return r;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(final int i) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return BinnieCore.multipassRenderID;
|
||||
}
|
||||
|
||||
public void renderItem(final Block block, final RenderBlocks renderer, final int meta) {
|
||||
this.setColor(((IMultipassBlock) block).colorMultiplier(meta));
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0f, -1.0f, 0.0f);
|
||||
renderer.renderFaceYNeg(block, 0.0, 0.0, 0.0, renderer.getBlockIconFromSideAndMetadata(block, 0, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0f, 1.0f, 0.0f);
|
||||
renderer.renderFaceYPos(block, 0.0, 0.0, 0.0, renderer.getBlockIconFromSideAndMetadata(block, 1, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0f, 0.0f, -1.0f);
|
||||
renderer.renderFaceZNeg(block, 0.0, 0.0, 0.0, renderer.getBlockIconFromSideAndMetadata(block, 2, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0f, 0.0f, 1.0f);
|
||||
renderer.renderFaceZPos(block, 0.0, 0.0, 0.0, renderer.getBlockIconFromSideAndMetadata(block, 3, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(-1.0f, 0.0f, 0.0f);
|
||||
renderer.renderFaceXNeg(block, 0.0, 0.0, 0.0, renderer.getBlockIconFromSideAndMetadata(block, 4, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(1.0f, 0.0f, 0.0f);
|
||||
renderer.renderFaceXPos(block, 0.0, 0.0, 0.0, renderer.getBlockIconFromSideAndMetadata(block, 5, meta));
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
public void setColor(final int l) {
|
||||
final float f = (l >> 16 & 0xFF) / 255.0f;
|
||||
final float f2 = (l >> 8 & 0xFF) / 255.0f;
|
||||
final float f3 = (l & 0xFF) / 255.0f;
|
||||
GL11.glColor3f(f, f2, f3);
|
||||
}
|
||||
|
||||
static {
|
||||
MultipassBlockRenderer.layer = 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
public class MultipassItemRenderer implements IItemRenderer
|
||||
{
|
||||
private void render(final RenderBlocks renderer, final ItemStack item, final float f, final float g, final float h) {
|
||||
GL11.glTranslatef(f, g, h);
|
||||
final Block block = ((ItemBlock) item.getItem()).field_150939_a;
|
||||
GL11.glEnable(3008);
|
||||
if (block.getRenderBlockPass() != 0) {
|
||||
GL11.glAlphaFunc(516, 0.1f);
|
||||
GL11.glEnable(3042);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
}
|
||||
else {
|
||||
GL11.glAlphaFunc(516, 0.5f);
|
||||
GL11.glDisable(3042);
|
||||
}
|
||||
MultipassBlockRenderer.instance.renderInventoryBlock(block, TileEntityMetadata.getItemDamage(item), 0, renderer);
|
||||
if (block.getRenderBlockPass() == 0) {
|
||||
GL11.glAlphaFunc(516, 0.1f);
|
||||
}
|
||||
GL11.glTranslatef(-f, -g, -h);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(final ItemStack item, final IItemRenderer.ItemRenderType type) {
|
||||
switch (type) {
|
||||
case ENTITY: {
|
||||
return true;
|
||||
}
|
||||
case EQUIPPED: {
|
||||
return true;
|
||||
}
|
||||
case INVENTORY: {
|
||||
return true;
|
||||
}
|
||||
case EQUIPPED_FIRST_PERSON: {
|
||||
return true;
|
||||
}
|
||||
default: {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(final IItemRenderer.ItemRenderType type, final ItemStack item, final IItemRenderer.ItemRendererHelper helper) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(final IItemRenderer.ItemRenderType type, final ItemStack item, final Object... data) {
|
||||
switch (type) {
|
||||
case ENTITY: {
|
||||
this.render((RenderBlocks) data[0], item, 0.0f, 0.0f, 0.0f);
|
||||
break;
|
||||
}
|
||||
case EQUIPPED:
|
||||
case EQUIPPED_FIRST_PERSON: {
|
||||
this.render((RenderBlocks) data[0], item, 0.5f, 0.5f, 0.5f);
|
||||
break;
|
||||
}
|
||||
case INVENTORY: {
|
||||
this.render((RenderBlocks) data[0], item, 0.0f, 0.0f, 0.0f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.block;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import binnie.core.network.packet.MessageMetadata;
|
||||
import binnie.core.BinnieCore;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class TileEntityMetadata extends TileEntity
|
||||
{
|
||||
private int meta;
|
||||
private boolean droppedBlock;
|
||||
|
||||
public TileEntityMetadata() {
|
||||
this.droppedBlock = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean receiveClientEvent(final int par1, final int par2) {
|
||||
if (par1 == 42) {
|
||||
this.meta = par2;
|
||||
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(final NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
this.meta = nbt.getInteger("meta");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(final NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setInteger("meta", this.meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUpdate() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getTileMetadata() {
|
||||
return this.meta;
|
||||
}
|
||||
|
||||
public void setTileMetadata(final int meta, final boolean notify) {
|
||||
if (this.meta != meta) {
|
||||
this.meta = meta;
|
||||
if (notify) {
|
||||
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
return BinnieCore.instance.getNetworkWrapper().getPacketFrom(new MessageMetadata(this.xCoord, this.yCoord, this.zCoord, this.meta).GetMessage());
|
||||
}
|
||||
|
||||
public static TileEntityMetadata getTile(final IBlockAccess world, final int x, final int y, final int z) {
|
||||
final TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (!(tile instanceof TileEntityMetadata)) {
|
||||
return null;
|
||||
}
|
||||
return (TileEntityMetadata) tile;
|
||||
}
|
||||
|
||||
public static ItemStack getItemStack(final Block block, final int damage) {
|
||||
final ItemStack item = new ItemStack(block, 1, 0);
|
||||
setItemDamage(item, damage);
|
||||
return item;
|
||||
}
|
||||
|
||||
public static void setItemDamage(final ItemStack item, final int i) {
|
||||
item.setItemDamage((i < 16387) ? i : 16387);
|
||||
final NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setInteger("meta", i);
|
||||
item.setTagCompound(tag);
|
||||
}
|
||||
|
||||
public static int getItemDamage(final ItemStack item) {
|
||||
if (item.hasTagCompound() && item.getTagCompound().hasKey("meta")) {
|
||||
return item.getTagCompound().getInteger("meta");
|
||||
}
|
||||
return item.getItemDamage();
|
||||
}
|
||||
|
||||
public static int getTileMetadata(final IBlockAccess world, final int x, final int y, final int z) {
|
||||
final TileEntityMetadata tile = getTile(world, x, y, z);
|
||||
return (tile == null) ? 0 : tile.getTileMetadata();
|
||||
}
|
||||
|
||||
public boolean hasDroppedBlock() {
|
||||
return this.droppedBlock;
|
||||
}
|
||||
|
||||
public void dropBlock() {
|
||||
this.droppedBlock = true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.circuits;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import forestry.api.circuits.ChipsetManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.circuits.ICircuitLayout;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.circuits.ICircuit;
|
||||
|
||||
public class BinnieCircuit implements ICircuit
|
||||
{
|
||||
private String uid;
|
||||
private int limit;
|
||||
private List<String> tooltips;
|
||||
|
||||
public BinnieCircuit(final String uid, final int limit, final ICircuitLayout layout, final ItemStack itemStack) {
|
||||
this.tooltips = new ArrayList<String>();
|
||||
this.uid = "binnie.circuit." + uid;
|
||||
this.limit = limit;
|
||||
ChipsetManager.circuitRegistry.registerCircuit(this);
|
||||
if (itemStack != null) {
|
||||
ChipsetManager.solderManager.addRecipe(layout, itemStack, this);
|
||||
}
|
||||
}
|
||||
|
||||
public BinnieCircuit(final String uid, final int limit, final ICircuitLayout layout, final Item item, final int itemMeta) {
|
||||
this(uid, limit, layout, new ItemStack(item, 1, itemMeta));
|
||||
}
|
||||
|
||||
public void addTooltipString(final String string) {
|
||||
this.tooltips.add(string);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUID() {
|
||||
return this.uid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresDiscovery() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLimit() {
|
||||
return this.limit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.uid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTooltip(final List<String> list) {
|
||||
for (final String string : this.tooltips) {
|
||||
list.add(" - " + string);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCircuitable(Object arg0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInsertion(int arg0, Object arg1) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad(int arg0, Object arg1) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemoval(int arg0, Object arg1) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(int arg0, Object arg1) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.circuits;
|
||||
|
||||
import binnie.Binnie;
|
||||
import forestry.api.circuits.ChipsetManager;
|
||||
import forestry.api.circuits.CircuitSocketType;
|
||||
import forestry.api.circuits.ICircuitSocketType;
|
||||
import binnie.core.AbstractMod;
|
||||
import forestry.api.circuits.ICircuitLayout;
|
||||
|
||||
public class BinnieCircuitLayout implements ICircuitLayout
|
||||
{
|
||||
private String uid;
|
||||
private AbstractMod mod;
|
||||
|
||||
public BinnieCircuitLayout(final AbstractMod mod, final String uid) {
|
||||
this.uid = uid;
|
||||
this.mod = mod;
|
||||
ChipsetManager.circuitRegistry.registerLayout(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUID() {
|
||||
return "binnie.circuitLayout" + this.uid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return Binnie.Language.localise(this.mod, "circuit.layout." + this.uid.toLowerCase());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsage() {
|
||||
return Binnie.Language.localise(this.mod, "circuit.layout." + this.uid.toLowerCase() + ".usage");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICircuitSocketType getSocketType() {
|
||||
return CircuitSocketType.NONE;// TODO hmm? CircuitSocketType
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.genetics;
|
||||
|
||||
import java.util.TreeSet;
|
||||
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeRoot;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import binnie.core.BinnieCore;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.apiculture.IApiaristTracker;
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.api.apiculture.IBeeMutation;
|
||||
import forestry.api.genetics.IAllele;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import forestry.api.genetics.IMutation;
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import binnie.Binnie;
|
||||
|
||||
class BeeBreedingSystem extends BreedingSystem
|
||||
{
|
||||
public BeeBreedingSystem() {
|
||||
this.iconUndiscovered = Binnie.Resource.getItemIcon(ExtraBees.instance, "icon/undiscoveredBee");
|
||||
this.iconDiscovered = Binnie.Resource.getItemIcon(ExtraBees.instance, "icon/discoveredBee");
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getChance(final IMutation mutation, final EntityPlayer player, final IAllele species1, final IAllele species2) {
|
||||
return ((IBeeMutation) mutation).
|
||||
getChance(new VirtualBeeHousing(player),
|
||||
(IAlleleBeeSpecies) species1,
|
||||
(IAlleleBeeSpecies) species2,
|
||||
(IBeeGenome) this.getSpeciesRoot().
|
||||
templateAsGenome(this.getSpeciesRoot().getTemplate(species1.getUID())),
|
||||
(IBeeGenome) this.getSpeciesRoot().templateAsGenome(this.getSpeciesRoot().getTemplate(species2.getUID())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISpeciesRoot getSpeciesRoot() {
|
||||
return Binnie.Genetics.getBeeRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColour() {
|
||||
return 16767232;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends IBreedingTracker> getTrackerClass() {
|
||||
return IApiaristTracker.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAlleleName(final IChromosomeType chromosome, final IAllele allele) {
|
||||
if (chromosome == EnumBeeChromosome.FERTILITY) {
|
||||
if (allele.getUID().contains("Low")) {
|
||||
return Binnie.Language.localise(BinnieCore.instance, "allele.fertility.low");
|
||||
}
|
||||
if (allele.getUID().contains("Normal")) {
|
||||
return Binnie.Language.localise(BinnieCore.instance, "allele.fertility.normal");
|
||||
}
|
||||
if (allele.getUID().contains("High")) {
|
||||
return Binnie.Language.localise(BinnieCore.instance, "allele.fertility.high");
|
||||
}
|
||||
if (allele.getUID().contains("Maximum")) {
|
||||
return Binnie.Language.localise(BinnieCore.instance, "allele.fertility.maximum");
|
||||
}
|
||||
}
|
||||
return super.getAlleleName(chromosome, allele);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDNAManipulable(final ItemStack member) {
|
||||
return ((IBeeRoot) this.getSpeciesRoot()).getType(member) == EnumBeeType.LARVAE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getActiveTypes() {
|
||||
return new int[] { EnumBeeType.DRONE.ordinal(), EnumBeeType.PRINCESS.ordinal(), EnumBeeType.QUEEN.ordinal(), EnumBeeType.LARVAE.ordinal() };
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addExtraAlleles(final IChromosomeType chromosome, final TreeSet<IAllele> alleles) {
|
||||
switch ((EnumBeeChromosome) chromosome) {
|
||||
case FERTILITY: {
|
||||
for (final ForestryAllele.Fertility a : ForestryAllele.Fertility.values()) {
|
||||
alleles.add(a.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case FLOWERING: {
|
||||
for (final ForestryAllele.Flowering a2 : ForestryAllele.Flowering.values()) {
|
||||
alleles.add(a2.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HUMIDITY_TOLERANCE:
|
||||
case TEMPERATURE_TOLERANCE: {
|
||||
for (final Tolerance a3 : Tolerance.values()) {
|
||||
alleles.add(a3.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LIFESPAN: {
|
||||
for (final ForestryAllele.Lifespan a4 : ForestryAllele.Lifespan.values()) {
|
||||
alleles.add(a4.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SPEED: {
|
||||
for (final ForestryAllele.Speed a5 : ForestryAllele.Speed.values()) {
|
||||
alleles.add(a5.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TERRITORY: {
|
||||
for (final ForestryAllele.Territory a6 : ForestryAllele.Territory.values()) {
|
||||
alleles.add(a6.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NOCTURNAL:
|
||||
case CAVE_DWELLING:
|
||||
case TOLERANT_FLYER: {
|
||||
for (final ForestryAllele.Bool a7 : ForestryAllele.Bool.values()) {
|
||||
alleles.add(a7.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.genetics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class BeeModifierLogic
|
||||
{
|
||||
private Map<EnumBeeModifier, Float[]> modifiers;
|
||||
private List<EnumBeeBooleanModifier> booleanModifiers;
|
||||
|
||||
public BeeModifierLogic() {
|
||||
this.modifiers = new HashMap<EnumBeeModifier, Float[]>();
|
||||
this.booleanModifiers = new ArrayList<EnumBeeBooleanModifier>();
|
||||
}
|
||||
|
||||
public float getModifier(final EnumBeeModifier modifier, final float currentModifier) {
|
||||
if (!this.modifiers.containsKey(modifier)) {
|
||||
return 1.0f;
|
||||
}
|
||||
final float mult = this.modifiers.get(modifier)[0];
|
||||
final float max = this.modifiers.get(modifier)[1];
|
||||
if (max >= 1.0f) {
|
||||
if (max <= currentModifier) {
|
||||
return 1.0f;
|
||||
}
|
||||
return Math.min(max / currentModifier, mult);
|
||||
}
|
||||
else {
|
||||
if (max >= currentModifier) {
|
||||
return 1.0f;
|
||||
}
|
||||
return Math.max(max / currentModifier, mult);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getModifier(final EnumBeeBooleanModifier modifier) {
|
||||
return this.booleanModifiers.contains(modifier);
|
||||
}
|
||||
|
||||
public void setModifier(final EnumBeeBooleanModifier modifier) {
|
||||
this.booleanModifiers.add(modifier);
|
||||
}
|
||||
|
||||
public void setModifier(final EnumBeeModifier modifier, final float mult, final float max) {
|
||||
this.modifiers.put(modifier, new Float[] { mult, max });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,494 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.genetics;
|
||||
|
||||
import forestry.api.genetics.IGenome;
|
||||
import java.util.TreeSet;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import forestry.api.genetics.IAlleleBoolean;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import forestry.api.core.ForestryEvent;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.IIcon;
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import net.minecraft.world.World;
|
||||
import java.util.Set;
|
||||
import binnie.extrabees.genetics.ExtraBeeMutation;
|
||||
import java.util.LinkedHashSet;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import java.util.Collection;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import binnie.core.BinnieCore;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import binnie.Binnie;
|
||||
import java.util.HashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import forestry.api.genetics.IMutation;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IClassification;
|
||||
import java.util.List;
|
||||
import binnie.core.resource.BinnieIcon;
|
||||
|
||||
public abstract class BreedingSystem implements IItemStackRepresentitive
|
||||
{
|
||||
protected BinnieIcon iconUndiscovered;
|
||||
protected BinnieIcon iconDiscovered;
|
||||
private List<IClassification> allBranches;
|
||||
List<IAlleleSpecies> allActiveSpecies;
|
||||
private List<IAlleleSpecies> allSpecies;
|
||||
private List<IMutation> allMutations;
|
||||
private Map<IAlleleSpecies, List<IMutation>> resultantMutations;
|
||||
private Map<IAlleleSpecies, List<IMutation>> furtherMutations;
|
||||
private Map<IAlleleSpecies, List<IMutation>> allResultantMutations;
|
||||
private Map<IAlleleSpecies, List<IMutation>> allFurtherMutations;
|
||||
public float discoveredSpeciesPercentage;
|
||||
public int totalSpeciesCount;
|
||||
public int discoveredSpeciesCount;
|
||||
public int totalSecretCount;
|
||||
public int discoveredSecretCount;
|
||||
public float discoveredBranchPercentage;
|
||||
public int totalBranchCount;
|
||||
public int discoveredBranchCount;
|
||||
private int totalSecretBranchCount;
|
||||
private int discoveredSecretBranchCount;
|
||||
String currentEpithet;
|
||||
|
||||
public BreedingSystem() {
|
||||
this.allBranches = new ArrayList<IClassification>();
|
||||
this.allActiveSpecies = new ArrayList<IAlleleSpecies>();
|
||||
this.allSpecies = new ArrayList<IAlleleSpecies>();
|
||||
this.allMutations = new ArrayList<IMutation>();
|
||||
this.resultantMutations = new HashMap<IAlleleSpecies, List<IMutation>>();
|
||||
this.furtherMutations = new HashMap<IAlleleSpecies, List<IMutation>>();
|
||||
this.allResultantMutations = new HashMap<IAlleleSpecies, List<IMutation>>();
|
||||
this.allFurtherMutations = new HashMap<IAlleleSpecies, List<IMutation>>();
|
||||
Binnie.Genetics.registerBreedingSystem(this);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
public String getChromosomeName(final IChromosomeType chromo) {
|
||||
return BinnieCore.proxy.localise(this.getSpeciesRoot().getUID() + ".chromosome." + chromo.getName());
|
||||
}
|
||||
|
||||
public String getChromosomeShortName(final IChromosomeType chromo) {
|
||||
return BinnieCore.proxy.localise(this.getSpeciesRoot().getUID() + ".chromosome." + chromo.getName() + ".short");
|
||||
}
|
||||
|
||||
public final String getEpitome(final float discoveredPercentage) {
|
||||
int i = 0;
|
||||
if (discoveredPercentage == 1.0f) {
|
||||
i = 6;
|
||||
}
|
||||
else if (discoveredPercentage < 0.1f) {
|
||||
i = 0;
|
||||
}
|
||||
else if (discoveredPercentage < 0.3f) {
|
||||
i = 1;
|
||||
}
|
||||
else if (discoveredPercentage < 0.5f) {
|
||||
i = 2;
|
||||
}
|
||||
else if (discoveredPercentage < 0.7f) {
|
||||
i = 3;
|
||||
}
|
||||
else if (discoveredPercentage < 0.9f) {
|
||||
i = 4;
|
||||
}
|
||||
else if (discoveredPercentage < 1.0f) {
|
||||
i = 5;
|
||||
}
|
||||
return BinnieCore.proxy.localise(this.getSpeciesRoot().getUID() + ".epitome." + i);
|
||||
}
|
||||
|
||||
public abstract ISpeciesRoot getSpeciesRoot();
|
||||
|
||||
public final List<IClassification> getAllBranches() {
|
||||
return this.allBranches;
|
||||
}
|
||||
|
||||
public final Collection<IAlleleSpecies> getAllSpecies() {
|
||||
return this.allActiveSpecies;
|
||||
}
|
||||
|
||||
public final Collection<IMutation> getAllMutations() {
|
||||
return this.allMutations;
|
||||
}
|
||||
|
||||
public void calculateArrays() {
|
||||
final Collection<IAllele> allAlleles = AlleleManager.alleleRegistry.getRegisteredAlleles().values();
|
||||
this.resultantMutations = new HashMap<IAlleleSpecies, List<IMutation>>();
|
||||
this.furtherMutations = new HashMap<IAlleleSpecies, List<IMutation>>();
|
||||
this.allResultantMutations = new HashMap<IAlleleSpecies, List<IMutation>>();
|
||||
this.allFurtherMutations = new HashMap<IAlleleSpecies, List<IMutation>>();
|
||||
this.allActiveSpecies = new ArrayList<IAlleleSpecies>();
|
||||
this.allSpecies = new ArrayList<IAlleleSpecies>();
|
||||
for (final IAllele species : allAlleles) {
|
||||
if (this.getSpeciesRoot().getTemplate(species.getUID()) != null) {
|
||||
this.resultantMutations.put((IAlleleSpecies) species, new ArrayList<IMutation>());
|
||||
this.furtherMutations.put((IAlleleSpecies) species, new ArrayList<IMutation>());
|
||||
this.allResultantMutations.put((IAlleleSpecies) species, new ArrayList<IMutation>());
|
||||
this.allFurtherMutations.put((IAlleleSpecies) species, new ArrayList<IMutation>());
|
||||
this.allSpecies.add((IAlleleSpecies) species);
|
||||
if (this.isBlacklisted(species) || species.getUID().contains("speciesBotAlfheim")) {
|
||||
continue;
|
||||
}
|
||||
this.allActiveSpecies.add((IAlleleSpecies) species);
|
||||
}
|
||||
}
|
||||
this.allMutations = new ArrayList<IMutation>();
|
||||
final Collection<IClassification> allRegBranches = AlleleManager.alleleRegistry.getRegisteredClassifications().values();
|
||||
this.allBranches = new ArrayList<IClassification>();
|
||||
for (final IClassification branch : allRegBranches) {
|
||||
if (branch.getMemberSpecies().length > 0 && this.getSpeciesRoot().getTemplate(branch.getMemberSpecies()[0].getUID()) != null) {
|
||||
boolean possible = false;
|
||||
for (final IAlleleSpecies species2 : branch.getMemberSpecies()) {
|
||||
if (this.allActiveSpecies.contains(species2)) {
|
||||
possible = true;
|
||||
}
|
||||
}
|
||||
if (!possible) {
|
||||
continue;
|
||||
}
|
||||
this.allBranches.add(branch);
|
||||
}
|
||||
}
|
||||
if (this.getSpeciesRoot().getMutations(false) != null) {
|
||||
final Set<IMutation> mutations = new LinkedHashSet<IMutation>();
|
||||
mutations.addAll(this.getSpeciesRoot().getMutations(false));
|
||||
if (this == Binnie.Genetics.beeBreedingSystem) {
|
||||
mutations.addAll(ExtraBeeMutation.mutations);
|
||||
}
|
||||
for (final IMutation mutation : mutations) {
|
||||
this.allMutations.add(mutation);
|
||||
final Set<IAlleleSpecies> participatingSpecies = new LinkedHashSet<IAlleleSpecies>();
|
||||
if (mutation.getAllele0() instanceof IAlleleSpecies) {
|
||||
participatingSpecies.add(mutation.getAllele0());
|
||||
}
|
||||
if (mutation.getAllele1() instanceof IAlleleSpecies) {
|
||||
participatingSpecies.add(mutation.getAllele1());
|
||||
}
|
||||
for (final IAlleleSpecies species3 : participatingSpecies) {
|
||||
this.allFurtherMutations.get(species3).add(mutation);
|
||||
if (this.allActiveSpecies.contains(species3)) {
|
||||
this.furtherMutations.get(species3).add(mutation);
|
||||
}
|
||||
}
|
||||
if (this.resultantMutations.containsKey(mutation.getTemplate()[0])) {
|
||||
this.allResultantMutations.get(mutation.getTemplate()[0]).add(mutation);
|
||||
this.resultantMutations.get(mutation.getTemplate()[0]).add(mutation);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public final boolean isBlacklisted(final IAllele allele) {
|
||||
return AlleleManager.alleleRegistry.isBlacklisted(allele.getUID());
|
||||
}
|
||||
|
||||
public final List<IMutation> getResultantMutations(final IAlleleSpecies species, final boolean includeInactive) {
|
||||
if (this.resultantMutations.isEmpty()) {
|
||||
this.calculateArrays();
|
||||
}
|
||||
return includeInactive ? this.allResultantMutations.get(species) : this.resultantMutations.get(species);
|
||||
}
|
||||
|
||||
public final List<IMutation> getResultantMutations(final IAlleleSpecies species) {
|
||||
if (this.resultantMutations.isEmpty()) {
|
||||
this.calculateArrays();
|
||||
}
|
||||
return this.resultantMutations.get(species);
|
||||
}
|
||||
|
||||
public final List<IMutation> getFurtherMutations(final IAlleleSpecies species, final boolean includeInactive) {
|
||||
if (this.furtherMutations.isEmpty()) {
|
||||
this.calculateArrays();
|
||||
}
|
||||
return includeInactive ? this.allFurtherMutations.get(species) : this.furtherMutations.get(species);
|
||||
}
|
||||
|
||||
public final List<IMutation> getFurtherMutations(final IAlleleSpecies species) {
|
||||
if (this.furtherMutations.isEmpty()) {
|
||||
this.calculateArrays();
|
||||
}
|
||||
return this.furtherMutations.get(species);
|
||||
}
|
||||
|
||||
public final boolean isMutationDiscovered(final IMutation mutation, final World world, final GameProfile name) {
|
||||
return this.isMutationDiscovered(mutation, this.getSpeciesRoot().getBreedingTracker(world, name));
|
||||
}
|
||||
|
||||
public final boolean isMutationDiscovered(final IMutation mutation, final IBreedingTracker tracker) {
|
||||
return tracker == null || tracker.isDiscovered(mutation);
|
||||
}
|
||||
|
||||
public final boolean isSpeciesDiscovered(final IAlleleSpecies species, final World world, final GameProfile name) {
|
||||
return this.isSpeciesDiscovered(species, this.getSpeciesRoot().getBreedingTracker(world, name));
|
||||
}
|
||||
|
||||
public final boolean isSpeciesDiscovered(final IAlleleSpecies species, final IBreedingTracker tracker) {
|
||||
return tracker == null || tracker.isDiscovered(species);
|
||||
}
|
||||
|
||||
public final boolean isSecret(final IAlleleSpecies species) {
|
||||
return !species.isCounted();
|
||||
}
|
||||
|
||||
public final boolean isSecret(final IClassification branch) {
|
||||
for (final IAlleleSpecies species : branch.getMemberSpecies()) {
|
||||
if (!this.isSecret(species)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public final Collection<IClassification> getDiscoveredBranches(final World world, final GameProfile player) {
|
||||
final List<IClassification> branches = new ArrayList<IClassification>();
|
||||
for (final IClassification branch : this.getAllBranches()) {
|
||||
boolean discovered = false;
|
||||
for (final IAlleleSpecies species : branch.getMemberSpecies()) {
|
||||
if (this.isSpeciesDiscovered(species, world, player)) {
|
||||
discovered = true;
|
||||
}
|
||||
}
|
||||
if (discovered) {
|
||||
branches.add(branch);
|
||||
}
|
||||
}
|
||||
return branches;
|
||||
}
|
||||
|
||||
public final Collection<IClassification> getDiscoveredBranches(final IBreedingTracker tracker) {
|
||||
final List<IClassification> branches = new ArrayList<IClassification>();
|
||||
for (final IClassification branch : this.getAllBranches()) {
|
||||
boolean discovered = false;
|
||||
for (final IAlleleSpecies species : branch.getMemberSpecies()) {
|
||||
if (this.isSpeciesDiscovered(species, tracker)) {
|
||||
discovered = true;
|
||||
}
|
||||
}
|
||||
if (discovered) {
|
||||
branches.add(branch);
|
||||
}
|
||||
}
|
||||
return branches;
|
||||
}
|
||||
|
||||
public final Collection<IAlleleSpecies> getDiscoveredSpecies(final World world, final GameProfile player) {
|
||||
final List<IAlleleSpecies> speciesList = new ArrayList<IAlleleSpecies>();
|
||||
for (final IAlleleSpecies species : this.getAllSpecies()) {
|
||||
if (this.isSpeciesDiscovered(species, world, player)) {
|
||||
speciesList.add(species);
|
||||
}
|
||||
}
|
||||
return speciesList;
|
||||
}
|
||||
|
||||
public final Collection<IAlleleSpecies> getDiscoveredSpecies(final IBreedingTracker tracker) {
|
||||
final List<IAlleleSpecies> speciesList = new ArrayList<IAlleleSpecies>();
|
||||
for (final IAlleleSpecies species : this.getAllSpecies()) {
|
||||
if (this.isSpeciesDiscovered(species, tracker)) {
|
||||
speciesList.add(species);
|
||||
}
|
||||
}
|
||||
return speciesList;
|
||||
}
|
||||
|
||||
public final List<IMutation> getDiscoveredMutations(final World world, final GameProfile player) {
|
||||
final List<IMutation> speciesList = new ArrayList<IMutation>();
|
||||
for (final IMutation species : this.getAllMutations()) {
|
||||
if (this.isMutationDiscovered(species, world, player)) {
|
||||
speciesList.add(species);
|
||||
}
|
||||
}
|
||||
return speciesList;
|
||||
}
|
||||
|
||||
public final List<IMutation> getDiscoveredMutations(final IBreedingTracker tracker) {
|
||||
final List<IMutation> speciesList = new ArrayList<IMutation>();
|
||||
for (final IMutation species : this.getAllMutations()) {
|
||||
if (this.isMutationDiscovered(species, tracker)) {
|
||||
speciesList.add(species);
|
||||
}
|
||||
}
|
||||
return speciesList;
|
||||
}
|
||||
|
||||
public final int getDiscoveredBranchMembers(final IClassification branch, final IBreedingTracker tracker) {
|
||||
int discoveredSpecies = 0;
|
||||
for (final IAlleleSpecies species : branch.getMemberSpecies()) {
|
||||
if (this.isSpeciesDiscovered(species, tracker)) {
|
||||
++discoveredSpecies;
|
||||
}
|
||||
}
|
||||
return discoveredSpecies;
|
||||
}
|
||||
|
||||
public IIcon getUndiscoveredIcon() {
|
||||
return this.iconUndiscovered.getIcon();
|
||||
}
|
||||
|
||||
public IIcon getDiscoveredIcon() {
|
||||
return this.iconDiscovered.getIcon();
|
||||
}
|
||||
|
||||
public abstract float getChance(final IMutation p0, final EntityPlayer p1, final IAllele p2, final IAllele p3);
|
||||
|
||||
public abstract Class<? extends IBreedingTracker> getTrackerClass();
|
||||
|
||||
@SubscribeEvent
|
||||
public final void onSyncBreedingTracker(final ForestryEvent.SyncedBreedingTracker event) {
|
||||
final IBreedingTracker tracker = event.tracker;
|
||||
if (!this.getTrackerClass().isInstance(tracker)) {
|
||||
return;
|
||||
}
|
||||
this.syncTracker(tracker);
|
||||
}
|
||||
|
||||
public final void syncTracker(final IBreedingTracker tracker) {
|
||||
this.discoveredSpeciesPercentage = 0.0f;
|
||||
this.totalSpeciesCount = 0;
|
||||
this.discoveredSpeciesCount = 0;
|
||||
this.totalSecretCount = 0;
|
||||
this.discoveredSecretCount = 0;
|
||||
final Collection<IAlleleSpecies> discoveredSpecies = this.getDiscoveredSpecies(tracker);
|
||||
final Collection<IAlleleSpecies> allSpecies = this.getAllSpecies();
|
||||
for (final IAlleleSpecies species : allSpecies) {
|
||||
if (!this.isSecret(species)) {
|
||||
++this.totalSpeciesCount;
|
||||
if (!this.isSpeciesDiscovered(species, tracker)) {
|
||||
continue;
|
||||
}
|
||||
++this.discoveredSpeciesCount;
|
||||
}
|
||||
else {
|
||||
++this.totalSecretCount;
|
||||
if (!this.isSpeciesDiscovered(species, tracker)) {
|
||||
continue;
|
||||
}
|
||||
++this.discoveredSecretCount;
|
||||
}
|
||||
}
|
||||
this.discoveredBranchPercentage = 0.0f;
|
||||
this.totalBranchCount = 0;
|
||||
this.discoveredBranchCount = 0;
|
||||
final Collection<IClassification> discoveredBranches = this.getDiscoveredBranches(tracker);
|
||||
final Collection<IClassification> allBranches = this.getAllBranches();
|
||||
for (final IClassification branch : allBranches) {
|
||||
if (!this.isSecret(branch)) {
|
||||
++this.totalBranchCount;
|
||||
if (!discoveredBranches.contains(branch)) {
|
||||
continue;
|
||||
}
|
||||
++this.discoveredBranchCount;
|
||||
}
|
||||
else {
|
||||
++this.totalSecretBranchCount;
|
||||
if (!discoveredBranches.contains(branch)) {
|
||||
continue;
|
||||
}
|
||||
++this.discoveredSecretBranchCount;
|
||||
}
|
||||
}
|
||||
this.discoveredSpeciesPercentage = this.discoveredSpeciesCount / this.totalSpeciesCount;
|
||||
this.discoveredBranchPercentage = this.discoveredBranchCount / this.totalBranchCount;
|
||||
final String epithet = this.getEpitome();
|
||||
this.onSyncBreedingTracker(tracker);
|
||||
}
|
||||
|
||||
public void onSyncBreedingTracker(final IBreedingTracker tracker) {
|
||||
}
|
||||
|
||||
public String getEpitome() {
|
||||
return this.getEpitome(this.discoveredSpeciesPercentage);
|
||||
}
|
||||
|
||||
public final String getDescriptor() {
|
||||
return BinnieCore.proxy.localise(this.getSpeciesRoot().getUID() + ".descriptor");
|
||||
}
|
||||
|
||||
public final String getIdent() {
|
||||
return this.getSpeciesRoot().getUID();
|
||||
}
|
||||
|
||||
public final IChromosomeType getChromosome(final int i) {
|
||||
for (final IChromosomeType chromosome : this.getSpeciesRoot().getKaryotype()) {
|
||||
if (i == chromosome.ordinal()) {
|
||||
return chromosome;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public abstract int getColour();
|
||||
|
||||
public String getAlleleName(final IChromosomeType chromosome, final IAllele allele) {
|
||||
if (allele instanceof IAlleleBoolean) {
|
||||
return ((IAlleleBoolean) allele).getValue() ? Binnie.Language.localise(BinnieCore.instance, "allele.true") : Binnie.Language.localise(BinnieCore.instance, "allele.false");
|
||||
}
|
||||
if (allele.getName() == "for.gui.maximum") {
|
||||
return Binnie.Language.localise(BinnieCore.instance, "allele.fertility.maximum");
|
||||
}
|
||||
return allele.getName();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return BinnieCore.proxy.localise(this.getSpeciesRoot().getUID() + ".shortName");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItemStackRepresentitive() {
|
||||
final IIndividual first = this.getSpeciesRoot().getIndividualTemplates().get(0);
|
||||
return this.getSpeciesRoot().getMemberStack(first, this.getDefaultType());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.getName();
|
||||
}
|
||||
|
||||
public abstract boolean isDNAManipulable(final ItemStack p0);
|
||||
|
||||
public IIndividual getConversion(final ItemStack stack) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public final IIndividual getDefaultIndividual() {
|
||||
return this.getSpeciesRoot().templateAsIndividual(this.getSpeciesRoot().getDefaultTemplate());
|
||||
}
|
||||
|
||||
public final int getDefaultType() {
|
||||
return this.getActiveTypes()[0];
|
||||
}
|
||||
|
||||
public abstract int[] getActiveTypes();
|
||||
|
||||
public abstract void addExtraAlleles(final IChromosomeType p0, final TreeSet<IAllele> p1);
|
||||
|
||||
public ItemStack getConversionStack(final ItemStack stack) {
|
||||
return this.getSpeciesRoot().getMemberStack(this.getConversion(stack), this.getDefaultType());
|
||||
}
|
||||
|
||||
public final Collection<IChromosomeType> getActiveKaryotype() {
|
||||
return Binnie.Genetics.getActiveChromosomes(this.getSpeciesRoot());
|
||||
}
|
||||
|
||||
public ItemStack getDefaultMember(final String uid) {
|
||||
return this.getSpeciesRoot().getMemberStack(this.getIndividual(uid), this.getDefaultType());
|
||||
}
|
||||
|
||||
public IIndividual getIndividual(final String uid) {
|
||||
return this.getSpeciesRoot().templateAsIndividual(this.getSpeciesRoot().getTemplate(uid));
|
||||
}
|
||||
|
||||
public IGenome getGenome(final String uid) {
|
||||
return this.getSpeciesRoot().templateAsGenome(this.getSpeciesRoot().getTemplate(uid));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.genetics;
|
||||
|
||||
public enum EnumBeeBooleanModifier
|
||||
{
|
||||
Sealed,
|
||||
SelfLighted,
|
||||
SunlightStimulated,
|
||||
Hellish;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.genetics;
|
||||
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.Binnie;
|
||||
|
||||
public enum EnumBeeModifier
|
||||
{
|
||||
Territory,
|
||||
Mutation,
|
||||
Lifespan,
|
||||
Production,
|
||||
Flowering,
|
||||
GeneticDecay;
|
||||
|
||||
public String getName() {
|
||||
return Binnie.Language.localise(BinnieCore.instance, "beemodifier." + this.name().toLowerCase());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.genetics;
|
||||
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import java.util.TreeSet;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import binnie.botany.api.EnumFlowerStage;
|
||||
import binnie.botany.api.IFlowerRoot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.botany.api.EnumFlowerChromosome;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import binnie.botany.api.IBotanistTracker;
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import binnie.botany.api.IFlowerMutation;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import forestry.api.genetics.IMutation;
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import binnie.Binnie;
|
||||
|
||||
class FlowerBreedingSystem extends BreedingSystem
|
||||
{
|
||||
public FlowerBreedingSystem() {
|
||||
this.iconUndiscovered = Binnie.Resource.getItemIcon(ExtraBees.instance, "icon/undiscoveredBee");
|
||||
this.iconDiscovered = Binnie.Resource.getItemIcon(ExtraBees.instance, "icon/discoveredBee");
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getChance(final IMutation mutation, final EntityPlayer player, final IAllele species1, final IAllele species2) {
|
||||
return ((IFlowerMutation) mutation).getBaseChance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISpeciesRoot getSpeciesRoot() {
|
||||
return Binnie.Genetics.getFlowerRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColour() {
|
||||
return 14563127;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends IBreedingTracker> getTrackerClass() {
|
||||
return IBotanistTracker.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAlleleName(final IChromosomeType chromosome, final IAllele allele) {
|
||||
if (chromosome == EnumFlowerChromosome.FERTILITY) {
|
||||
if (allele.getUID().contains("Low")) {
|
||||
return Binnie.Language.localise(BinnieCore.instance, "allele.fertility.low");
|
||||
}
|
||||
if (allele.getUID().contains("Normal")) {
|
||||
return Binnie.Language.localise(BinnieCore.instance, "allele.fertility.normal");
|
||||
}
|
||||
if (allele.getUID().contains("High")) {
|
||||
return Binnie.Language.localise(BinnieCore.instance, "allele.fertility.high");
|
||||
}
|
||||
if (allele.getUID().contains("Maximum")) {
|
||||
return Binnie.Language.localise(BinnieCore.instance, "allele.fertility.maximum");
|
||||
}
|
||||
}
|
||||
return super.getAlleleName(chromosome, allele);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDNAManipulable(final ItemStack member) {
|
||||
return ((IFlowerRoot) this.getSpeciesRoot()).getStageType(member) == EnumFlowerStage.POLLEN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIndividual getConversion(final ItemStack stack) {
|
||||
return BotanyCore.getFlowerRoot().getConversion(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getActiveTypes() {
|
||||
return new int[] { EnumFlowerStage.FLOWER.ordinal(), EnumFlowerStage.POLLEN.ordinal(), EnumFlowerStage.SEED.ordinal() };
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addExtraAlleles(final IChromosomeType chromosome, final TreeSet<IAllele> alleles) {
|
||||
switch ((EnumFlowerChromosome) chromosome) {
|
||||
case FERTILITY: {
|
||||
for (final ForestryAllele.Fertility a : ForestryAllele.Fertility.values()) {
|
||||
alleles.add(a.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LIFESPAN: {
|
||||
for (final ForestryAllele.Lifespan a2 : ForestryAllele.Lifespan.values()) {
|
||||
alleles.add(a2.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HUMIDITY_TOLERANCE:
|
||||
case PH_TOLERANCE:
|
||||
case TEMPERATURE_TOLERANCE: {
|
||||
for (final Tolerance a3 : Tolerance.values()) {
|
||||
alleles.add(a3.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PRIMARY:
|
||||
case SECONDARY:
|
||||
case STEM: {
|
||||
for (final EnumFlowerColor a4 : EnumFlowerColor.values()) {
|
||||
alleles.add(a4.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SAPPINESS: {
|
||||
for (final ForestryAllele.Sappiness a5 : ForestryAllele.Sappiness.values()) {
|
||||
alleles.add(a5.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TERRITORY: {
|
||||
for (final ForestryAllele.Territory a6 : ForestryAllele.Territory.values()) {
|
||||
alleles.add(a6.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loaded 100 of 3697 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user