mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-20 04:10:07 +00:00
Improve Modules
This commit is contained in:
1 parent
cb81d0ead4
commit
235dfca751
155 files changed
+2919
-2072
No files matched your search
@@ -1,61 +1,29 @@
|
||||
package binnie.botany;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.event.entity.player.BonemealEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.event.world.BlockEvent;
|
||||
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.SidedProxy;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
import binnie.Constants;
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
import binnie.botany.api.IBlockSoil;
|
||||
import binnie.botany.api.IFlower;
|
||||
import binnie.botany.api.IFlowerRoot;
|
||||
import binnie.botany.api.IGardeningManager;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.botany.core.BotanyGUI;
|
||||
import binnie.botany.core.ModuleCore;
|
||||
import binnie.botany.flower.BlockFlower;
|
||||
import binnie.botany.flower.ItemBotany;
|
||||
import binnie.botany.flower.TileEntityFlower;
|
||||
import binnie.botany.gardening.ModuleGardening;
|
||||
import binnie.botany.genetics.ItemDictionary;
|
||||
import binnie.botany.genetics.ModuleGenetics;
|
||||
import binnie.botany.gui.BotanyGUI;
|
||||
import binnie.botany.network.PacketID;
|
||||
import binnie.botany.proxy.Proxy;
|
||||
import binnie.core.AbstractMod;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.gui.IBinnieGUID;
|
||||
import binnie.core.network.BinniePacketHandler;
|
||||
import binnie.core.network.IPacketID;
|
||||
import binnie.core.proxy.IProxyCore;
|
||||
import binnie.modules.BlankModuleContainer;
|
||||
import binnie.modules.ModuleManager;
|
||||
|
||||
@Mod(
|
||||
modid = Constants.BOTANY_MOD_ID,
|
||||
name = "Binnie's Botany",
|
||||
dependencies = "required-after:" + Constants.CORE_MOD_ID
|
||||
)
|
||||
public class Botany extends AbstractMod {
|
||||
public class Botany extends BlankModuleContainer {
|
||||
public static final float AGE_CHANCE = 0.2f;
|
||||
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@@ -64,50 +32,33 @@ public class Botany extends AbstractMod {
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@SidedProxy(clientSide = "binnie.botany.proxy.ProxyClient", serverSide = "binnie.botany.proxy.ProxyServer")
|
||||
public static Proxy proxy;
|
||||
/* MODULE GENETIC */
|
||||
public static BlockFlower flower;
|
||||
public static ItemBotany flowerItem;
|
||||
public static ItemBotany seed;
|
||||
public static ItemBotany pollen;
|
||||
public static ItemDictionary database;
|
||||
@Nullable
|
||||
public static Item botanistBackpack;
|
||||
|
||||
@Nullable
|
||||
private static ModuleGardening gardening;
|
||||
@Nullable
|
||||
private static ModuleGenetics genetics;
|
||||
public Botany() {
|
||||
ModuleManager.register(this);
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent evt) {
|
||||
preInit();
|
||||
ModuleManager.register(evt, this);
|
||||
ModuleManager.runPreInit(evt, this);
|
||||
getProxy().registerModels();
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void init(FMLInitializationEvent evt) {
|
||||
init();
|
||||
ModuleManager.runInit(evt, this);
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void postInit(FMLPostInitializationEvent evt) {
|
||||
postInit();
|
||||
ModuleManager.runPostInit(evt, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerModules() {
|
||||
addModule(new ModuleCore());
|
||||
addModule(genetics = new ModuleGenetics());
|
||||
addModule(gardening = new ModuleGardening());
|
||||
}
|
||||
|
||||
public static ModuleGardening gardening() {
|
||||
Preconditions.checkState(gardening != null);
|
||||
return gardening;
|
||||
}
|
||||
|
||||
public static ModuleGenetics genetics() {
|
||||
Preconditions.checkState(genetics != null);
|
||||
return genetics;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -150,164 +101,8 @@ public class Botany extends AbstractMod {
|
||||
return BinnieCore.isBotanyActive();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onShearFlower(PlayerInteractEvent.RightClickBlock event) {
|
||||
EntityPlayer player = event.getEntityPlayer();
|
||||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack heldItem = player.getHeldItemMainhand();
|
||||
if (heldItem.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
TileEntity tile = event.getWorld().getTileEntity(event.getPos());
|
||||
if (!(tile instanceof TileEntityFlower)) {
|
||||
return;
|
||||
}
|
||||
|
||||
TileEntityFlower flower = (TileEntityFlower) tile;
|
||||
if (heldItem.getItem() == Items.SHEARS) {
|
||||
flower.onShear();
|
||||
heldItem.damageItem(1, player);
|
||||
} else if (heldItem.getItem() == Botany.pollen) {
|
||||
IFlower pollen = BotanyCore.getFlowerRoot().getMember(heldItem);
|
||||
if (pollen != null && flower.canMateWith(pollen)) {
|
||||
flower.mateWith(pollen);
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
heldItem.shrink(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onFertiliseSoil(PlayerInteractEvent.RightClickBlock event) {
|
||||
World world = event.getWorld();
|
||||
if (world == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
BlockPos pos = event.getPos();
|
||||
EntityPlayer player = event.getEntityPlayer();
|
||||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack heldItem = player.getHeldItemMainhand();
|
||||
if (heldItem.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
IGardeningManager gardening = BotanyCore.getGardening();
|
||||
Block block = world.getBlockState(event.getPos()).getBlock();
|
||||
if (!gardening.isSoil(block)) {
|
||||
pos = pos.down();
|
||||
block = world.getBlockState(pos).getBlock();
|
||||
}
|
||||
|
||||
if (!gardening.isSoil(block)) {
|
||||
return;
|
||||
}
|
||||
|
||||
IBlockSoil soil = (IBlockSoil) block;
|
||||
int fertiliserStrength = gardening.getFertiliserStrength(heldItem);
|
||||
if (gardening.isNutrientFertiliser(heldItem) && soil.getType(world, pos) != EnumSoilType.FLOWERBED) {
|
||||
EnumSoilType type = soil.getType(world, pos);
|
||||
int next = Math.min(type.ordinal() + fertiliserStrength, 2);
|
||||
if (soil.fertilise(world, pos, EnumSoilType.values()[next]) && !player.capabilities.isCreativeMode) {
|
||||
heldItem.shrink(1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (gardening.isAcidFertiliser(heldItem) && soil.getPH(world, pos) != EnumAcidity.ACID) {
|
||||
EnumAcidity pH = soil.getPH(world, pos);
|
||||
int next = Math.max(pH.ordinal() - fertiliserStrength, 0);
|
||||
if (soil.setPH(world, pos, EnumAcidity.values()[next]) && !player.capabilities.isCreativeMode) {
|
||||
heldItem.shrink(1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (gardening.isAlkalineFertiliser(heldItem) && soil.getPH(world, pos) != EnumAcidity.ALKALINE) {
|
||||
EnumAcidity pH = soil.getPH(world, pos);
|
||||
int next = Math.min(pH.ordinal() + fertiliserStrength, 2);
|
||||
if (soil.setPH(world, pos, EnumAcidity.values()[next]) && !player.capabilities.isCreativeMode) {
|
||||
heldItem.shrink(1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (gardening.isWeedkiller(heldItem) && gardening.addWeedKiller(world, pos) && !player.capabilities.isCreativeMode) {
|
||||
heldItem.shrink(1);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void plantVanilla(BlockEvent.PlaceEvent event) {
|
||||
World world = event.getWorld();
|
||||
BlockPos pos = event.getPos();
|
||||
Block block = world.getBlockState(pos.down()).getBlock();
|
||||
if (!BotanyCore.getGardening().isSoil(block)) {
|
||||
return;
|
||||
}
|
||||
|
||||
EntityPlayer player = event.getPlayer();
|
||||
ItemStack heldItem = player.getHeldItem(event.getHand());
|
||||
IFlowerRoot flowerRoot = BotanyCore.getFlowerRoot();
|
||||
IFlower flower = flowerRoot.getConversion(heldItem);
|
||||
if (flower != null) {
|
||||
flowerRoot.plant(world, pos, flower, player.getGameProfile());
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void onPlantVanilla(PlayerInteractEvent.RightClickBlock event) {
|
||||
BlockPos pos = event.getPos();
|
||||
World world = event.getWorld();
|
||||
EntityPlayer player = event.getEntityPlayer();
|
||||
ItemStack heldItem = player.getHeldItemMainhand();
|
||||
if (!BinnieCore.getBinnieProxy().isSimulating(event.getWorld())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (heldItem.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Block block = world.getBlockState(pos).getBlock();
|
||||
int py = -1;
|
||||
if (block instanceof IBlockSoil && (world.isAirBlock(pos.up()) || block.isReplaceable(world, pos))) {
|
||||
py = 1;
|
||||
}
|
||||
if (py < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
IFlowerRoot flowerRoot = BotanyCore.getFlowerRoot();
|
||||
IFlower flower = flowerRoot.getConversion(heldItem);
|
||||
if (flower != null && flowerRoot.plant(world, pos.add(0, py, 0), flower, player.getGameProfile()) && !player.capabilities.isCreativeMode) {
|
||||
heldItem.shrink(1);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onBonemeal(BonemealEvent event) {
|
||||
BlockPos pos = event.getPos();
|
||||
Block block = event.getBlock().getBlock();
|
||||
if (BotanyCore.getGardening().isSoil(block)) {
|
||||
IBlockSoil soil = (IBlockSoil) block;
|
||||
if (soil.fertilise(event.getWorld(), pos, EnumSoilType.LOAM)) {
|
||||
event.setResult(Event.Result.ALLOW);
|
||||
}
|
||||
}
|
||||
|
||||
TileEntity tile = event.getWorld().getTileEntity(pos);
|
||||
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).onBonemeal()) {
|
||||
event.setResult(Event.Result.ALLOW);
|
||||
}
|
||||
public static boolean isModuleActive(String moduleUID){
|
||||
return instance.isModuleEnabled(moduleUID);
|
||||
}
|
||||
|
||||
public static class PacketHandler extends BinniePacketHandler {
|
||||
|
||||
@@ -16,11 +16,6 @@ public class CreativeTabBotany extends CreativeTabs {
|
||||
super("Botany");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getIconItemStack() {
|
||||
return new ItemStack(Blocks.RED_FLOWER, 1, 5);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getTranslatedTabLabel() {
|
||||
@@ -36,6 +31,6 @@ public class CreativeTabBotany extends CreativeTabs {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ItemStack getTabIconItem() {
|
||||
return new ItemStack(Blocks.YELLOW_FLOWER);
|
||||
return new ItemStack(Blocks.RED_FLOWER, 1, 5);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,274 @@
|
||||
package binnie.botany;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
import forestry.api.climate.IClimateInfo;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
|
||||
import binnie.botany.api.gardening.EnumAcidity;
|
||||
import binnie.botany.api.gardening.EnumFertiliserType;
|
||||
import binnie.botany.api.gardening.EnumMoisture;
|
||||
import binnie.botany.api.gardening.EnumSoilType;
|
||||
import binnie.botany.api.gardening.IBlockSoil;
|
||||
import binnie.botany.api.gardening.IGardeningManager;
|
||||
import binnie.botany.api.genetics.IFlower;
|
||||
import binnie.botany.api.genetics.IFlowerGenome;
|
||||
import binnie.botany.blocks.BlockPlant;
|
||||
import binnie.botany.blocks.BlockSoil;
|
||||
import binnie.botany.modules.ModuleGardening;
|
||||
import binnie.core.util.OreDictionaryUtil;
|
||||
|
||||
public class GardeningManager implements IGardeningManager {
|
||||
private final Map<EnumFertiliserType, Map<ItemStack, Integer>> fertilisers = new LinkedHashMap<>();
|
||||
|
||||
public GardeningManager() {
|
||||
for(EnumFertiliserType type : EnumFertiliserType.values()){
|
||||
fertilisers.put(type, new LinkedHashMap<>());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSoil(Block block) {
|
||||
return block instanceof IBlockSoil;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSoil(Item item) {
|
||||
return item instanceof ItemBlock && isSoil(((ItemBlock) item).getBlock());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSoil(ItemStack item) {
|
||||
return isSoil(item.getItem());
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumMoisture getNaturalMoisture(World world, BlockPos pos) {
|
||||
float moisture = getBiomeMoisture(world, pos);
|
||||
|
||||
for (int offsetX = -1; offsetX < 2; ++offsetX) {
|
||||
for (int offsetY = -1; offsetY < 2; ++offsetY) {
|
||||
if (offsetX != 0 || offsetY != 0) {
|
||||
Block block = world.getBlockState(pos.add(offsetX, 0, offsetY)).getBlock();
|
||||
if (block == Blocks.SAND) {
|
||||
moisture -= 1.5;
|
||||
} else if (block == Blocks.WATER) {
|
||||
moisture += 1.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (world.isRainingAt(pos.up())) {
|
||||
moisture += 1.5;
|
||||
}
|
||||
|
||||
for (int offsetX = -1; offsetX < 2; ++offsetX) {
|
||||
for (int offsetY = -1; offsetY < 2; ++offsetY) {
|
||||
if (offsetX != 0 || offsetY != 0) {
|
||||
Block block = world.getBlockState(pos.add(offsetX, 0, offsetY)).getBlock();
|
||||
if (block == Blocks.GRAVEL && moisture > 0.0f) {
|
||||
moisture *= 0.4f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return EnumMoisture.getFromValue(moisture);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumAcidity getNaturalPH(World world, BlockPos pos) {
|
||||
float acidity = getBiomePH(world, pos);
|
||||
return EnumAcidity.getFromValue(acidity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getBiomeMoisture(World world, BlockPos pos) {
|
||||
IClimateInfo info = ForestryAPI.climateManager.getInfo(world, pos);
|
||||
double humidity = info.getHumidity();
|
||||
double temperature = info.getTemperature();
|
||||
double moisture = 3.2 * (humidity - 0.5) - 0.4 * (1.0 + temperature + 0.5 * temperature * temperature) + 1.1 - 1.6 * (temperature - 0.9) * (temperature - 0.9) - 0.002 * (pos.getY() - 64);
|
||||
return (float) ((moisture == 0.0) ? moisture : ((moisture < 0.0) ? (-Math.sqrt(moisture * moisture)) : Math.sqrt(moisture * moisture)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getBiomePH(World world, BlockPos pos) {
|
||||
IClimateInfo info = ForestryAPI.climateManager.getInfo(world, pos);
|
||||
double humidity = info.getHumidity();
|
||||
double temperature = info.getTemperature();
|
||||
return (float) (-3.0 * (humidity - 0.5) + 0.5 * (temperature - 0.699999988079071) * (temperature - 0.699999988079071) + 0.02f * (pos.getY() - 64) - 0.15000000596046448);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getSoil(EnumSoilType soil, boolean weedKill, EnumMoisture moisture, EnumAcidity acidity) {
|
||||
IBlockState blockState = getSoilBlock(soil, weedKill).getDefaultState();
|
||||
return blockState.withProperty(BlockSoil.MOISTURE, moisture).withProperty(BlockSoil.ACIDITY, acidity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void plantSoil(World world, BlockPos pos, EnumSoilType soil, EnumMoisture moisture, EnumAcidity acidity) {
|
||||
IBlockState blockState = getSoil(soil, false, moisture, acidity);
|
||||
world.setBlockState(pos, blockState, 2);
|
||||
}
|
||||
|
||||
public Map<EnumFertiliserType, Map<ItemStack, Integer>> getFertilisers() {
|
||||
return fertilisers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ItemStack> getFertilisers(EnumFertiliserType type) {
|
||||
Set<ItemStack> items = fertilisers.get(type).keySet();
|
||||
return Collections.unmodifiableSet(items);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFertiliser(EnumFertiliserType type, ItemStack stack) {
|
||||
Collection<ItemStack> fertilisers = getFertilisers(type);
|
||||
for (ItemStack fertiliser : fertilisers) {
|
||||
if (!fertiliser.isEmpty() && fertiliser.isItemEqual(stack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerFertiliser(EnumFertiliserType type, ItemStack stack, int strength) {
|
||||
fertilisers.get(type).put(stack, strength);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFertiliserStrength(ItemStack stack) {
|
||||
for(EnumFertiliserType type : EnumFertiliserType.values()) {
|
||||
for (Map.Entry<ItemStack, Integer> entry : fertilisers.get(type).entrySet()) {
|
||||
if (entry.getKey().isItemEqual(stack)) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onFertiliseSoil(ItemStack heldItem, IBlockSoil soil, World world, BlockPos pos, EntityPlayer player) {
|
||||
int fertiliserStrength = getFertiliserStrength(heldItem);
|
||||
if (isFertiliser(EnumFertiliserType.NUTRIENT, heldItem) && soil.getType(world, pos) != EnumSoilType.FLOWERBED) {
|
||||
EnumSoilType type = soil.getType(world, pos);
|
||||
int next = Math.min(type.ordinal() + fertiliserStrength, 2);
|
||||
if (soil.fertilise(world, pos, EnumSoilType.values()[next])) {
|
||||
if(!player.capabilities.isCreativeMode) {
|
||||
heldItem.shrink(1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (isFertiliser(EnumFertiliserType.ACID, heldItem) && soil.getPH(world, pos) != EnumAcidity.ACID) {
|
||||
EnumAcidity pH = soil.getPH(world, pos);
|
||||
int next = Math.max(pH.ordinal() - fertiliserStrength, 0);
|
||||
if (soil.setPH(world, pos, EnumAcidity.values()[next])) {
|
||||
if(!player.capabilities.isCreativeMode) {
|
||||
heldItem.shrink(1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (isFertiliser(EnumFertiliserType.ALKALINE, heldItem) && soil.getPH(world, pos) != EnumAcidity.ALKALINE) {
|
||||
EnumAcidity pH = soil.getPH(world, pos);
|
||||
int next = Math.min(pH.ordinal() + fertiliserStrength, 2);
|
||||
if (soil.setPH(world, pos, EnumAcidity.values()[next])) {
|
||||
if(!player.capabilities.isCreativeMode) {
|
||||
heldItem.shrink(1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTolerate(@Nullable IFlower flower, World world, BlockPos pos) {
|
||||
if (flower == null) {
|
||||
return false;
|
||||
}
|
||||
IBlockState soil = world.getBlockState(pos.down());
|
||||
Biome biome = world.getBiome(pos);
|
||||
EnumAcidity acidity = soil.getValue(BlockSoil.ACIDITY);
|
||||
EnumMoisture moisture = soil.getValue(BlockSoil.MOISTURE);
|
||||
EnumTemperature temperature = EnumTemperature.getFromValue(biome.getTemperature());
|
||||
return canTolerate(flower, acidity, moisture, temperature);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumSoilType getSoilType(World world, BlockPos pos) {
|
||||
IBlockState blockState = world.getBlockState(pos);
|
||||
if (blockState.getBlock() instanceof IBlockSoil) {
|
||||
IBlockSoil soil = ((IBlockSoil) blockState.getBlock());
|
||||
return soil.getType(world, pos);
|
||||
}
|
||||
return EnumSoilType.SOIL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getSoilBlock(EnumSoilType type) {
|
||||
return getSoilBlock(type, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getSoilBlock(EnumSoilType type, boolean weedKill) {
|
||||
switch (type) {
|
||||
case FLOWERBED:
|
||||
return weedKill ? ModuleGardening.flowerbedNoWeed : ModuleGardening.flowerbed;
|
||||
|
||||
case LOAM:
|
||||
return weedKill ? ModuleGardening.loamNoWeed : ModuleGardening.loam;
|
||||
default:
|
||||
return weedKill ? ModuleGardening.soilNoWeed : ModuleGardening.soil;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTolerate(IFlower flower, EnumAcidity acidity, EnumMoisture moisture, EnumTemperature temperature) {
|
||||
IFlowerGenome genome = flower.getGenome();
|
||||
return genome.canTolerate(acidity) && genome.canTolerate(moisture) && genome.canTolerate(temperature);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWeedkiller(ItemStack heldItem) {
|
||||
return OreDictionaryUtil.hasOreName(heldItem, "weedkiller");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addWeedKiller(World world, BlockPos pos) {
|
||||
IBlockState oldState = world.getBlockState(pos);
|
||||
if (!(oldState.getBlock() instanceof IBlockSoil)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
EnumSoilType type = getSoilType(world, pos);
|
||||
IBlockState newState = getSoil(type, true, oldState.getValue(BlockSoil.MOISTURE), oldState.getValue(BlockSoil.ACIDITY));
|
||||
boolean done = world.setBlockState(pos, newState, 2);
|
||||
if (done && BlockPlant.isWeed(world, pos.up())) {
|
||||
world.setBlockToAir(pos.up());
|
||||
}
|
||||
return done;
|
||||
}
|
||||
}
|
||||
+5
-1
@@ -1,6 +1,10 @@
|
||||
package binnie.botany.api;
|
||||
|
||||
public class FlowerManager {
|
||||
import binnie.botany.api.gardening.IGardeningManager;
|
||||
import binnie.botany.api.genetics.IFlowerFactory;
|
||||
import binnie.botany.api.genetics.IFlowerRoot;
|
||||
|
||||
public class BotanyAPI {
|
||||
/**
|
||||
* Convenient access to AlleleManager.alleleRegistry.getSpeciesRoot("rootFlowers")
|
||||
*/
|
||||
@@ -1,38 +0,0 @@
|
||||
package binnie.botany.api;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.genetics.IIndividual;
|
||||
|
||||
public interface IFlower extends IIndividual {
|
||||
@Override
|
||||
IFlowerGenome getGenome();
|
||||
|
||||
@Nullable
|
||||
IFlowerGenome getMate();
|
||||
|
||||
void mate(IFlower flower);
|
||||
|
||||
int getAge();
|
||||
|
||||
void setAge(int age);
|
||||
|
||||
void age();
|
||||
|
||||
IFlower getOffspring(World world, BlockPos pos);
|
||||
|
||||
int getMaxAge();
|
||||
|
||||
boolean isWilted();
|
||||
|
||||
void setWilted(boolean p0);
|
||||
|
||||
boolean hasFlowered();
|
||||
|
||||
void setFlowered(boolean p0);
|
||||
|
||||
void removeMate();
|
||||
}
|
||||
+12
-2
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.api;
|
||||
package binnie.botany.api.gardening;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@@ -27,8 +27,18 @@ public enum EnumAcidity implements IStringSerializable {
|
||||
public String getLocalisedName(boolean withColor) {
|
||||
String localisedName = I18N.localise("botany.ph." + getName());
|
||||
if (withColor && color != null) {
|
||||
localisedName += color;
|
||||
localisedName = color + localisedName;
|
||||
}
|
||||
return localisedName;
|
||||
}
|
||||
|
||||
public static EnumAcidity getFromValue(float rawAcidity) {
|
||||
if(rawAcidity <= -1.0f){
|
||||
return EnumAcidity.ACID;
|
||||
}else if(rawAcidity >= 1.0f){
|
||||
return EnumAcidity.ALKALINE;
|
||||
}else{
|
||||
return EnumAcidity.NEUTRAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package binnie.botany.api.gardening;
|
||||
|
||||
public enum EnumFertiliserType {
|
||||
ACID, ALKALINE, NUTRIENT
|
||||
}
|
||||
+12
-2
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.api;
|
||||
package binnie.botany.api.gardening;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@@ -27,8 +27,18 @@ public enum EnumMoisture implements IStringSerializable {
|
||||
public String getLocalisedName(boolean withColor) {
|
||||
String localisedName = I18N.localise("botany.moisture." + getName());
|
||||
if (withColor && color != null) {
|
||||
localisedName += color;
|
||||
localisedName = color + localisedName + TextFormatting.GRAY;
|
||||
}
|
||||
return localisedName;
|
||||
}
|
||||
|
||||
public static EnumMoisture getFromValue(float rawMoisture) {
|
||||
if(rawMoisture <= -1.0f){
|
||||
return EnumMoisture.DRY;
|
||||
}else if(rawMoisture >= 1.0f){
|
||||
return EnumMoisture.DAMP;
|
||||
}else{
|
||||
return EnumMoisture.NORMAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.api;
|
||||
package binnie.botany.api.gardening;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.api;
|
||||
package binnie.botany.api.gardening;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
+14
-15
@@ -1,9 +1,12 @@
|
||||
package binnie.botany.api;
|
||||
package binnie.botany.api.gardening;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -11,6 +14,8 @@ import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.core.EnumTemperature;
|
||||
|
||||
import binnie.botany.api.genetics.IFlower;
|
||||
|
||||
public interface IGardeningManager {
|
||||
default boolean isSoil(Block block) {
|
||||
return block instanceof IBlockSoil;
|
||||
@@ -28,25 +33,17 @@ public interface IGardeningManager {
|
||||
|
||||
float getBiomePH(World world, BlockPos pos);
|
||||
|
||||
IBlockState getSoil(EnumSoilType soil, boolean weedKill, EnumMoisture moisture, EnumAcidity acidity);
|
||||
|
||||
void plantSoil(World world, BlockPos pos, EnumSoilType soil, EnumMoisture moisture, EnumAcidity acidity);
|
||||
|
||||
Collection<ItemStack> getAcidFertilisers();
|
||||
Collection<ItemStack> getFertilisers(EnumFertiliserType type);
|
||||
|
||||
Collection<ItemStack> getAlkalineFertilisers();
|
||||
Map<EnumFertiliserType, Map<ItemStack, Integer>> getFertilisers();
|
||||
|
||||
Collection<ItemStack> getNutrientFertilisers();
|
||||
void registerFertiliser(EnumFertiliserType type, ItemStack stack, int strength);
|
||||
|
||||
void registerAcidFertiliser(ItemStack stack, int strength);
|
||||
|
||||
void registerAlkalineFertiliser(ItemStack stack, int strength);
|
||||
|
||||
void registerNutrientFertiliser(ItemStack stack, int strength);
|
||||
|
||||
boolean isAcidFertiliser(ItemStack stack);
|
||||
|
||||
boolean isAlkalineFertiliser(ItemStack stack);
|
||||
|
||||
boolean isNutrientFertiliser(ItemStack stack);
|
||||
boolean isFertiliser(EnumFertiliserType type, ItemStack stack);
|
||||
|
||||
int getFertiliserStrength(ItemStack stack);
|
||||
|
||||
@@ -65,4 +62,6 @@ public interface IGardeningManager {
|
||||
boolean isWeedkiller(ItemStack heldItem);
|
||||
|
||||
boolean addWeedKiller(World world, BlockPos pos);
|
||||
|
||||
boolean onFertiliseSoil(ItemStack heldItem, IBlockSoil soil, World world, BlockPos pos, EntityPlayer player);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package binnie.botany.api.gardening;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.api;
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
+2
-4
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.api;
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import forestry.api.genetics.ISpeciesType;
|
||||
|
||||
@@ -19,9 +19,7 @@ public enum EnumFlowerStage implements ISpeciesType {
|
||||
}
|
||||
|
||||
public static EnumFlowerStage getStage(int age) {
|
||||
return age == 0
|
||||
? EnumFlowerStage.SEED
|
||||
: EnumFlowerStage.FLOWER;
|
||||
return age == 0 ? EnumFlowerStage.SEED : EnumFlowerStage.FLOWER;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.api;
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
+4
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.api;
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -10,6 +10,9 @@ import forestry.api.core.IModelManager;
|
||||
import forestry.api.genetics.IAlleleProperty;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
|
||||
import binnie.botany.api.gardening.EnumAcidity;
|
||||
import binnie.botany.api.gardening.EnumMoisture;
|
||||
|
||||
public interface IAlleleFlowerSpecies extends IAlleleSpecies, IAlleleProperty<IAlleleFlowerSpecies> {
|
||||
IFlowerType getType();
|
||||
|
||||
+4
-1
@@ -1,7 +1,10 @@
|
||||
package binnie.botany.api;
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import forestry.api.genetics.IAlleleSpeciesBuilder;
|
||||
|
||||
import binnie.botany.api.gardening.EnumAcidity;
|
||||
import binnie.botany.api.gardening.EnumMoisture;
|
||||
|
||||
public interface IAlleleFlowerSpeciesBuilder extends IAlleleSpeciesBuilder {
|
||||
@Override
|
||||
IAlleleFlowerSpecies build();
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.api;
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.api;
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
public interface IColorMix {
|
||||
IFlowerColor getColorFirst();
|
||||
@@ -0,0 +1,76 @@
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.genetics.IIndividual;
|
||||
|
||||
public interface IFlower extends IIndividual {
|
||||
/**
|
||||
* @return Flowers's genetic information.
|
||||
*/
|
||||
@Override
|
||||
IFlowerGenome getGenome();
|
||||
|
||||
/**
|
||||
* @return Genetic information of the flower's mate, null if unmated.
|
||||
*/
|
||||
@Nullable
|
||||
IFlowerGenome getMate();
|
||||
|
||||
/**
|
||||
* Mate with the given flower.
|
||||
*
|
||||
* @param flower the {@link IFlower} to mate this one with.
|
||||
*/
|
||||
void mate(IFlower flower);
|
||||
|
||||
/**
|
||||
* Remove the mate of the flower.
|
||||
*/
|
||||
void removeMate();
|
||||
|
||||
IFlower getOffspring(World world, BlockPos pos);
|
||||
|
||||
/**
|
||||
* @return The current age of the flower.
|
||||
*/
|
||||
int getAge();
|
||||
|
||||
/**
|
||||
* Set the current age of the flower.
|
||||
*/
|
||||
void setAge(int age);
|
||||
|
||||
/**
|
||||
* Age the flower.
|
||||
*/
|
||||
void age();
|
||||
|
||||
/**
|
||||
* @return Maximum age of the flower.
|
||||
*/
|
||||
int getMaxAge();
|
||||
|
||||
/**
|
||||
* @return true if the flower is wilted.
|
||||
*/
|
||||
boolean isWilted();
|
||||
|
||||
/**
|
||||
* Set that the flower is wilted.
|
||||
*/
|
||||
void setWilted(boolean wilted);
|
||||
|
||||
/**
|
||||
* @return true if the flower has flowered.
|
||||
*/
|
||||
boolean hasFlowered();
|
||||
|
||||
/**
|
||||
* Set that the flower has flowered.
|
||||
*/
|
||||
void setFlowered(boolean flowered);
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.api;
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.api;
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.api;
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IClassification;
|
||||
+4
-1
@@ -1,9 +1,12 @@
|
||||
package binnie.botany.api;
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.genetics.EnumTolerance;
|
||||
import forestry.api.genetics.IGenome;
|
||||
|
||||
import binnie.botany.api.gardening.EnumAcidity;
|
||||
import binnie.botany.api.gardening.EnumMoisture;
|
||||
|
||||
public interface IFlowerGenome extends IGenome {
|
||||
@Override
|
||||
IAlleleFlowerSpecies getPrimary();
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.api;
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.api;
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import forestry.api.genetics.IMutationBuilder;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.api;
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.api;
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -0,0 +1,7 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
+2
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.ceramic;
|
||||
package binnie.botany.blocks;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
@@ -29,6 +29,7 @@ import forestry.core.blocks.IColoredBlock;
|
||||
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.botany.tile.TileCeramic;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.util.TileUtil;
|
||||
|
||||
+5
-2
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.ceramic.brick;
|
||||
package binnie.botany.blocks;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
@@ -52,8 +52,11 @@ import forestry.core.models.BlockModelEntry;
|
||||
|
||||
import binnie.Constants;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.ceramic.TileCeramic;
|
||||
import binnie.botany.ceramic.brick.CeramicBrickPair;
|
||||
import binnie.botany.ceramic.brick.CeramicBrickType;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.botany.tile.TileCeramic;
|
||||
import binnie.botany.tile.TileCeramicBrick;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.block.IMultipassBlock;
|
||||
import binnie.core.models.DefaultStateMapper;
|
||||
+3
-1
@@ -1,9 +1,11 @@
|
||||
package binnie.botany.ceramic;
|
||||
package binnie.botany.blocks;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.ceramic.CeramicColor;
|
||||
import binnie.botany.ceramic.CeramicDesignSystem;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.core.util.I18N;
|
||||
import binnie.extratrees.api.IDesign;
|
||||
+324
-320
@@ -1,320 +1,324 @@
|
||||
package binnie.botany.flower;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
import net.minecraft.block.properties.PropertyInteger;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.IStateMapperRegister;
|
||||
import forestry.core.blocks.IColoredBlock;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.api.IFlower;
|
||||
import binnie.botany.api.IFlowerGenome;
|
||||
import binnie.botany.api.IFlowerRoot;
|
||||
import binnie.botany.api.IFlowerType;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.botany.genetics.EnumFlowerType;
|
||||
import binnie.botany.genetics.FlowerDefinition;
|
||||
import binnie.botany.network.PacketID;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.network.packet.MessageNBT;
|
||||
import binnie.core.util.TileUtil;
|
||||
|
||||
public class BlockFlower extends BlockContainer implements IColoredBlock, IStateMapperRegister {
|
||||
public static final AxisAlignedBB FLOWER_BLOCK_AABB = new AxisAlignedBB(0.3D, 0.0D, 0.3D, 0.7D, 0.6D, 0.7D);
|
||||
/* PROPERTIES */
|
||||
public static final PropertyFlower FLOWER = new PropertyFlower("flower", IFlowerType.class);
|
||||
public static final PropertyInteger SECTION = PropertyInteger.create("section", 0, EnumFlowerType.highestSection - 1);
|
||||
public static final PropertyBool FLOWERED = PropertyBool.create("flowered");
|
||||
public static final PropertyBool SEED = PropertyBool.create("seed");
|
||||
|
||||
public BlockFlower() {
|
||||
super(Material.PLANTS);
|
||||
setTickRandomly(true);
|
||||
setRegistryName("flower");
|
||||
setSoundType(SoundType.PLANT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityFlower();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerStateMapper() {
|
||||
ModelLoader.setCustomStateMapper(this, new StateMapperFlower());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
ItemStack heldItem = player.getHeldItemMainhand();
|
||||
if (heldItem.isEmpty() || heldItem.getItem() != BinnieCore.getFieldKit() || !player.isSneaking()) {
|
||||
return false;
|
||||
}
|
||||
if (world.isRemote) {
|
||||
return true;
|
||||
}
|
||||
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (!(tile instanceof TileEntityFlower)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
TileEntityFlower tileFlower = (TileEntityFlower) tile;
|
||||
IFlower flower = tileFlower.getFlower();
|
||||
if (flower == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
IFlowerGenome flowerGenome = flower.getGenome();
|
||||
NBTTagCompound info = new NBTTagCompound();
|
||||
info.setString("Species", flowerGenome.getPrimary().getUID());
|
||||
info.setString("Species2", flowerGenome.getSecondary().getUID());
|
||||
info.setFloat("Age", flower.getAge() / flowerGenome.getLifespan());
|
||||
info.setShort("Colour", (short) flowerGenome.getPrimaryColor().getID());
|
||||
info.setShort("Colour2", (short) flowerGenome.getSecondaryColor().getID());
|
||||
info.setBoolean("Wilting", flower.isWilted());
|
||||
info.setBoolean("Flowered", flower.hasFlowered());
|
||||
Botany.proxy.sendToPlayer(new MessageNBT(PacketID.FIELDKIT.ordinal(), info), player);
|
||||
heldItem.damageItem(1, player);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
TileEntity tile = source.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
TileEntityFlower flower = (TileEntityFlower) tile;
|
||||
if (flower.getType().getSections() > 1) {
|
||||
return FULL_BLOCK_AABB;
|
||||
}
|
||||
}
|
||||
return FLOWER_BLOCK_AABB;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getSelectedBoundingBox(IBlockState state, World world, BlockPos pos) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
TileEntityFlower flower = (TileEntityFlower) tile;
|
||||
if (flower.getType().getSections() > 1) {
|
||||
return FULL_BLOCK_AABB.offset(pos);
|
||||
}
|
||||
}
|
||||
return FLOWER_BLOCK_AABB.offset(pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
|
||||
super.onBlockPlacedBy(world, pos, state, placer, stack);
|
||||
IFlowerRoot flowerRoot = BotanyCore.getFlowerRoot();
|
||||
TileEntity flower = world.getTileEntity(pos);
|
||||
if (!BinnieCore.getBinnieProxy().isSimulating(world)) {
|
||||
if (flower != null && flower instanceof TileEntityFlower) {
|
||||
IFlower f = flowerRoot.getMember(stack);
|
||||
if (f != null) {
|
||||
((TileEntityFlower) flower).setRender(new TileEntityFlower.RenderInfo(f, (TileEntityFlower) flower));
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
TileEntity below = world.getTileEntity(pos.down());
|
||||
if (flower != null && flower instanceof TileEntityFlower) {
|
||||
if (below instanceof TileEntityFlower) {
|
||||
((TileEntityFlower) flower).setSection(((TileEntityFlower) below).getSection());
|
||||
} else {
|
||||
GameProfile owner = (placer instanceof EntityPlayer) ? ((EntityPlayer) placer).getGameProfile() : null;
|
||||
((TileEntityFlower) flower).create(stack, owner);
|
||||
}
|
||||
}
|
||||
flowerRoot.tryGrowSection(world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(IBlockState state, @Nullable IBlockAccess world, @Nullable BlockPos pos, int tintIndex) {
|
||||
if (world != null && pos != null) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
TileEntityFlower flower = (TileEntityFlower) tile;
|
||||
if (tintIndex == 0) {
|
||||
return flower.getStemColour();
|
||||
} else if (tintIndex == 1) {
|
||||
return flower.getPrimaryColour();
|
||||
}
|
||||
return flower.getSecondaryColour();
|
||||
}
|
||||
}
|
||||
return 0xffffff;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceBlockAt(World world, BlockPos pos) {
|
||||
return super.canPlaceBlockAt(world, pos) && canBlockStay(world, pos);
|
||||
}
|
||||
|
||||
public boolean canBlockStay(World world, BlockPos pos) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
IBlockState downState = world.getBlockState(pos.down());
|
||||
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).getSection() > 0) {
|
||||
return downState.getBlock() == Botany.flower;
|
||||
}
|
||||
return canPlaceBlockOn(downState.getBlock());
|
||||
}
|
||||
|
||||
protected boolean canPlaceBlockOn(Block block) {
|
||||
return block == Blocks.GRASS
|
||||
|| block == Blocks.DIRT
|
||||
|| block == Blocks.FARMLAND
|
||||
|| BotanyCore.getGardening().isSoil(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public EnumBlockRenderType getRenderType(IBlockState state) {
|
||||
return EnumBlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public EnumOffsetType getOffsetType() {
|
||||
return EnumOffsetType.XZ;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
TileEntityFlower flower = TileUtil.getTile(world, pos, TileEntityFlower.class);
|
||||
if (flower != null && flower.getType() != null) {
|
||||
state = state.withProperty(FLOWER, flower.getType());
|
||||
state = state.withProperty(FLOWERED, flower.isFlowered());
|
||||
state = state.withProperty(SECTION, flower.getRenderSection());
|
||||
state = state.withProperty(SEED, flower.getAge() == 0);
|
||||
} else {
|
||||
state = state.withProperty(FLOWER, FlowerDefinition.Dandelion.getSpecies().getType());
|
||||
state = state.withProperty(FLOWERED, false);
|
||||
state = state.withProperty(SEED, false);
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, FLOWER, FLOWERED, SECTION, SEED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos) {
|
||||
checkAndDropBlock(worldIn, pos);
|
||||
TileEntity tile = worldIn.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
TileEntityFlower flower = (TileEntityFlower) tile;
|
||||
if (flower.getSection() == 0 && flower.getFlower() != null && flower.getFlower().getAge() > 0 && flower.getFlower().getGenome().getPrimary().getType().getSections() > 1 && worldIn.getBlockState(pos.up()).getBlock() != Botany.flower) {
|
||||
dropBlockAsItem(worldIn, pos, worldIn.getBlockState(pos), 0);
|
||||
worldIn.setBlockToAir(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
((TileEntityFlower) tile).randomUpdate(rand);
|
||||
checkAndDropBlock(world, pos);
|
||||
return;
|
||||
}
|
||||
world.setBlockToAir(pos);
|
||||
}
|
||||
|
||||
protected void checkAndDropBlock(World world, BlockPos pos) {
|
||||
if (!canBlockStay(world, pos)) {
|
||||
dropBlockAsItem(world, pos, world.getBlockState(pos), 0);
|
||||
world.setBlockToAir(pos);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public NonNullList<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
NonNullList<ItemStack> drops = NonNullList.create();
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).getSection() == 0) {
|
||||
ItemStack flower = ((TileEntityFlower) tile).getItemStack();
|
||||
if (!flower.isEmpty()) {
|
||||
drops.add(flower);
|
||||
}
|
||||
}
|
||||
return drops;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) {
|
||||
List<ItemStack> drops = getDrops(world, pos, world.getBlockState(pos), 0);
|
||||
boolean hasBeenBroken = world.setBlockToAir(pos);
|
||||
if (hasBeenBroken && BinnieCore.getBinnieProxy().isSimulating(world) && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) {
|
||||
for (ItemStack drop : drops) {
|
||||
spawnAsEntity(world, pos, drop);
|
||||
}
|
||||
}
|
||||
return hasBeenBroken;
|
||||
}
|
||||
}
|
||||
package binnie.botany.blocks;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
import net.minecraft.block.properties.PropertyInteger;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.IStateMapperRegister;
|
||||
import forestry.core.blocks.IColoredBlock;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.api.genetics.IFlower;
|
||||
import binnie.botany.api.genetics.IFlowerGenome;
|
||||
import binnie.botany.api.genetics.IFlowerRoot;
|
||||
import binnie.botany.api.genetics.IFlowerType;
|
||||
import binnie.botany.blocks.properties.PropertyFlower;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.botany.genetics.EnumFlowerType;
|
||||
import binnie.botany.genetics.FlowerDefinition;
|
||||
import binnie.botany.models.StateMapperFlower;
|
||||
import binnie.botany.modules.ModuleFlowers;
|
||||
import binnie.botany.network.PacketID;
|
||||
import binnie.botany.tile.TileEntityFlower;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.network.packet.MessageNBT;
|
||||
import binnie.core.util.TileUtil;
|
||||
|
||||
public class BlockFlower extends BlockContainer implements IColoredBlock, IStateMapperRegister {
|
||||
public static final AxisAlignedBB FLOWER_BLOCK_AABB = new AxisAlignedBB(0.3D, 0.0D, 0.3D, 0.7D, 0.6D, 0.7D);
|
||||
/* PROPERTIES */
|
||||
public static final PropertyFlower FLOWER = new PropertyFlower("flower", IFlowerType.class);
|
||||
public static final PropertyInteger SECTION = PropertyInteger.create("section", 0, EnumFlowerType.highestSection - 1);
|
||||
public static final PropertyBool FLOWERED = PropertyBool.create("flowered");
|
||||
public static final PropertyBool SEED = PropertyBool.create("seed");
|
||||
|
||||
public BlockFlower() {
|
||||
super(Material.PLANTS);
|
||||
setTickRandomly(true);
|
||||
setRegistryName("flower");
|
||||
setSoundType(SoundType.PLANT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityFlower();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerStateMapper() {
|
||||
ModelLoader.setCustomStateMapper(this, new StateMapperFlower());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
ItemStack heldItem = player.getHeldItemMainhand();
|
||||
if (heldItem.isEmpty() || heldItem.getItem() != BinnieCore.getFieldKit() || !player.isSneaking()) {
|
||||
return false;
|
||||
}
|
||||
if (world.isRemote) {
|
||||
return true;
|
||||
}
|
||||
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (!(tile instanceof TileEntityFlower)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
TileEntityFlower tileFlower = (TileEntityFlower) tile;
|
||||
IFlower flower = tileFlower.getFlower();
|
||||
if (flower == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
IFlowerGenome flowerGenome = flower.getGenome();
|
||||
NBTTagCompound info = new NBTTagCompound();
|
||||
info.setString("Species", flowerGenome.getPrimary().getUID());
|
||||
info.setString("Species2", flowerGenome.getSecondary().getUID());
|
||||
info.setFloat("Age", flower.getAge() / flowerGenome.getLifespan());
|
||||
info.setShort("Colour", (short) flowerGenome.getPrimaryColor().getID());
|
||||
info.setShort("Colour2", (short) flowerGenome.getSecondaryColor().getID());
|
||||
info.setBoolean("Wilting", flower.isWilted());
|
||||
info.setBoolean("Flowered", flower.hasFlowered());
|
||||
Botany.proxy.sendToPlayer(new MessageNBT(PacketID.FIELDKIT.ordinal(), info), player);
|
||||
heldItem.damageItem(1, player);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
TileEntity tile = source.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
TileEntityFlower flower = (TileEntityFlower) tile;
|
||||
if (flower.getType().getSections() > 1) {
|
||||
return FULL_BLOCK_AABB;
|
||||
}
|
||||
}
|
||||
return FLOWER_BLOCK_AABB.move(getOffset(state, source, pos));
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getSelectedBoundingBox(IBlockState state, World world, BlockPos pos) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
TileEntityFlower flower = (TileEntityFlower) tile;
|
||||
if (flower.getType().getSections() > 1) {
|
||||
return FULL_BLOCK_AABB.offset(pos);
|
||||
}
|
||||
}
|
||||
return FLOWER_BLOCK_AABB.offset(pos).move(getOffset(state, world, pos));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
|
||||
super.onBlockPlacedBy(world, pos, state, placer, stack);
|
||||
IFlowerRoot flowerRoot = BotanyCore.getFlowerRoot();
|
||||
TileEntity flower = world.getTileEntity(pos);
|
||||
if (!BinnieCore.getBinnieProxy().isSimulating(world)) {
|
||||
if (flower != null && flower instanceof TileEntityFlower) {
|
||||
IFlower f = flowerRoot.getMember(stack);
|
||||
if (f != null) {
|
||||
((TileEntityFlower) flower).setRender(new TileEntityFlower.RenderInfo(f, (TileEntityFlower) flower));
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
TileEntity below = world.getTileEntity(pos.down());
|
||||
if (flower != null && flower instanceof TileEntityFlower) {
|
||||
if (below instanceof TileEntityFlower) {
|
||||
((TileEntityFlower) flower).setSection(((TileEntityFlower) below).getSection());
|
||||
} else {
|
||||
GameProfile owner = (placer instanceof EntityPlayer) ? ((EntityPlayer) placer).getGameProfile() : null;
|
||||
((TileEntityFlower) flower).create(stack, owner);
|
||||
}
|
||||
}
|
||||
flowerRoot.tryGrowSection(world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(IBlockState state, @Nullable IBlockAccess world, @Nullable BlockPos pos, int tintIndex) {
|
||||
if (world != null && pos != null) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
TileEntityFlower flower = (TileEntityFlower) tile;
|
||||
if (tintIndex == 0) {
|
||||
return flower.getStemColour();
|
||||
} else if (tintIndex == 1) {
|
||||
return flower.getPrimaryColour();
|
||||
}
|
||||
return flower.getSecondaryColour();
|
||||
}
|
||||
}
|
||||
return 0xffffff;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceBlockAt(World world, BlockPos pos) {
|
||||
return super.canPlaceBlockAt(world, pos) && canBlockStay(world, pos);
|
||||
}
|
||||
|
||||
public boolean canBlockStay(World world, BlockPos pos) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
IBlockState downState = world.getBlockState(pos.down());
|
||||
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).getSection() > 0) {
|
||||
return downState.getBlock() == ModuleFlowers.flower;
|
||||
}
|
||||
return canPlaceBlockOn(downState.getBlock());
|
||||
}
|
||||
|
||||
protected boolean canPlaceBlockOn(Block block) {
|
||||
return block == Blocks.GRASS
|
||||
|| block == Blocks.DIRT
|
||||
|| block == Blocks.FARMLAND
|
||||
|| BotanyCore.getGardening().isSoil(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public EnumBlockRenderType getRenderType(IBlockState state) {
|
||||
return EnumBlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public EnumOffsetType getOffsetType() {
|
||||
return EnumOffsetType.XZ;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
TileEntityFlower flower = TileUtil.getTile(world, pos, TileEntityFlower.class);
|
||||
if (flower != null && flower.getType() != null) {
|
||||
state = state.withProperty(FLOWER, flower.getType());
|
||||
state = state.withProperty(FLOWERED, flower.isFlowered());
|
||||
state = state.withProperty(SECTION, flower.getRenderSection());
|
||||
state = state.withProperty(SEED, flower.getAge() == 0);
|
||||
} else {
|
||||
state = state.withProperty(FLOWER, FlowerDefinition.Dandelion.getSpecies().getType());
|
||||
state = state.withProperty(FLOWERED, false);
|
||||
state = state.withProperty(SEED, false);
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, FLOWER, FLOWERED, SECTION, SEED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos) {
|
||||
checkAndDropBlock(worldIn, pos);
|
||||
TileEntity tile = worldIn.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
TileEntityFlower flower = (TileEntityFlower) tile;
|
||||
if (flower.getSection() == 0 && flower.getFlower() != null && flower.getFlower().getAge() > 0 && flower.getFlower().getGenome().getPrimary().getType().getSections() > 1 && worldIn.getBlockState(pos.up()).getBlock() != ModuleFlowers.flower) {
|
||||
dropBlockAsItem(worldIn, pos, worldIn.getBlockState(pos), 0);
|
||||
worldIn.setBlockToAir(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
((TileEntityFlower) tile).randomUpdate(rand);
|
||||
checkAndDropBlock(world, pos);
|
||||
return;
|
||||
}
|
||||
world.setBlockToAir(pos);
|
||||
}
|
||||
|
||||
protected void checkAndDropBlock(World world, BlockPos pos) {
|
||||
if (!canBlockStay(world, pos)) {
|
||||
dropBlockAsItem(world, pos, world.getBlockState(pos), 0);
|
||||
world.setBlockToAir(pos);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public NonNullList<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
NonNullList<ItemStack> drops = NonNullList.create();
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).getSection() == 0) {
|
||||
ItemStack flower = ((TileEntityFlower) tile).getItemStack();
|
||||
if (!flower.isEmpty()) {
|
||||
drops.add(flower);
|
||||
}
|
||||
}
|
||||
return drops;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) {
|
||||
List<ItemStack> drops = getDrops(world, pos, world.getBlockState(pos), 0);
|
||||
boolean hasBeenBroken = world.setBlockToAir(pos);
|
||||
if (hasBeenBroken && BinnieCore.getBinnieProxy().isSimulating(world) && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) {
|
||||
for (ItemStack drop : drops) {
|
||||
spawnAsEntity(world, pos, drop);
|
||||
}
|
||||
}
|
||||
return hasBeenBroken;
|
||||
}
|
||||
}
|
||||
+7
-8
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.gardening;
|
||||
package binnie.botany.blocks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -25,8 +25,8 @@ import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
import binnie.botany.api.IBlockSoil;
|
||||
import binnie.botany.api.gardening.EnumSoilType;
|
||||
import binnie.botany.api.gardening.IBlockSoil;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
|
||||
public class BlockPlant extends BlockBush implements IItemModelRegister {
|
||||
@@ -52,10 +52,9 @@ public class BlockPlant extends BlockBush implements IItemModelRegister {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerModel(Item item, IModelManager manager) {
|
||||
int index = 0;
|
||||
for (PlantType type : PlantType.values()) {
|
||||
manager.registerItemModel(item, index, type.getName());
|
||||
index++;
|
||||
for (int i = 0;i < PlantType.values().length;i++) {
|
||||
PlantType type = PlantType.getType(i);
|
||||
manager.registerItemModel(item, i, type.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,7 +70,7 @@ public class BlockPlant extends BlockBush implements IItemModelRegister {
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return getDefaultState().withProperty(PLANT_TYPE, PlantType.values()[meta]);
|
||||
return getDefaultState().withProperty(PLANT_TYPE, PlantType.getType(meta));
|
||||
}
|
||||
|
||||
@Override
|
||||
+20
-12
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.gardening;
|
||||
package binnie.botany.blocks;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Random;
|
||||
@@ -29,14 +29,18 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import binnie.Constants;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
import binnie.botany.api.IBlockSoil;
|
||||
import binnie.botany.api.gardening.EnumAcidity;
|
||||
import binnie.botany.api.gardening.EnumMoisture;
|
||||
import binnie.botany.api.gardening.EnumSoilType;
|
||||
import binnie.botany.api.gardening.IBlockSoil;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.botany.modules.BotanyModuleUIDs;
|
||||
import binnie.botany.modules.ModuleFlowers;
|
||||
import binnie.botany.modules.ModuleGardening;
|
||||
import binnie.core.util.I18N;
|
||||
import binnie.modules.ModuleManager;
|
||||
|
||||
public class BlockSoil extends Block implements IBlockSoil, IItemModelRegister {
|
||||
public static final PropertyEnum<EnumMoisture> MOISTURE = PropertyEnum.create("moisture", EnumMoisture.class);
|
||||
@@ -223,7 +227,7 @@ public class BlockSoil extends Block implements IBlockSoil, IItemModelRegister {
|
||||
if (!world.isAirBlock(pos)) {
|
||||
return;
|
||||
}
|
||||
world.setBlockState(pos, Botany.gardening().plant.getStateFromMeta(PlantType.WEEDS.ordinal()), 2);
|
||||
world.setBlockState(pos, ModuleGardening.plant.getStateFromMeta(PlantType.WEEDS.ordinal()), 2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,7 +262,8 @@ public class BlockSoil extends Block implements IBlockSoil, IItemModelRegister {
|
||||
return false;
|
||||
}
|
||||
IBlockState old = world.getBlockState(pos);
|
||||
return world.setBlockState(pos, BotanyCore.getGardening().getSoilBlock(maxLevel, weedKilled).getDefaultState().withProperty(ACIDITY, old.getValue(ACIDITY)).withProperty(MOISTURE, old.getValue(MOISTURE)), 2);
|
||||
IBlockState newState = BotanyCore.getGardening().getSoil(maxLevel, weedKilled, old.getValue(MOISTURE), old.getValue(ACIDITY));
|
||||
return world.setBlockState(pos, newState, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -268,7 +273,8 @@ public class BlockSoil extends Block implements IBlockSoil, IItemModelRegister {
|
||||
return false;
|
||||
}
|
||||
IBlockState old = world.getBlockState(pos);
|
||||
return world.setBlockState(pos, BotanyCore.getGardening().getSoilBlock(minLevel, weedKilled).getDefaultState().withProperty(ACIDITY, old.getValue(ACIDITY)).withProperty(MOISTURE, old.getValue(MOISTURE)), 2);
|
||||
IBlockState newState = BotanyCore.getGardening().getSoil(minLevel, weedKilled, old.getValue(MOISTURE), old.getValue(ACIDITY));
|
||||
return world.setBlockState(pos, newState, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -294,11 +300,13 @@ public class BlockSoil extends Block implements IBlockSoil, IItemModelRegister {
|
||||
@Override
|
||||
public boolean canSustainPlant(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing direction, IPlantable plantable) {
|
||||
IBlockState plant = plantable.getPlant(world, pos.up());
|
||||
if (plant.getBlock() == Botany.flower) {
|
||||
return true;
|
||||
if(ModuleManager.isEnabled(Constants.BOTANY_MOD_ID, BotanyModuleUIDs.FLOWERS)) {
|
||||
if (plant.getBlock() == ModuleFlowers.flower) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (plant.getBlock() == Botany.gardening().plant) {
|
||||
if (plant.getBlock() == ModuleGardening.plant) {
|
||||
return !weedKilled || !BlockPlant.isWeed(world, pos);
|
||||
}
|
||||
return world instanceof World && Blocks.DIRT.canSustainPlant(state, world, pos, direction, plantable);
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.ceramic;
|
||||
package binnie.botany.blocks;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
+10
-3
@@ -1,9 +1,9 @@
|
||||
package binnie.botany.gardening;
|
||||
package binnie.botany.blocks;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.modules.ModuleGardening;
|
||||
|
||||
public enum PlantType implements IStringSerializable {
|
||||
WEEDS("weeds", true),
|
||||
@@ -24,12 +24,19 @@ public enum PlantType implements IStringSerializable {
|
||||
this.isWeed = isWeed;
|
||||
}
|
||||
|
||||
public static PlantType getType(int meta){
|
||||
if(meta >= values().length){
|
||||
meta = values().length-1;
|
||||
}
|
||||
return values()[meta];
|
||||
}
|
||||
|
||||
public static PlantType get(int id) {
|
||||
return values()[id % values().length];
|
||||
}
|
||||
|
||||
public ItemStack get() {
|
||||
return new ItemStack(Botany.gardening().plant, 1, ordinal());
|
||||
return new ItemStack(ModuleGardening.plant, 1, ordinal());
|
||||
}
|
||||
|
||||
public boolean isWeed() {
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.botany.flower;
|
||||
package binnie.botany.blocks;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.flower;
|
||||
package binnie.botany.blocks.properties;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
@@ -11,8 +11,8 @@ import net.minecraft.block.properties.PropertyHelper;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
|
||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||
import binnie.botany.api.IFlowerType;
|
||||
import binnie.botany.api.genetics.IAlleleFlowerSpecies;
|
||||
import binnie.botany.api.genetics.IFlowerType;
|
||||
|
||||
public class PropertyFlower<I extends IFlowerType<I>> extends PropertyHelper<I> {
|
||||
public PropertyFlower(String name, Class<I> flowerTypeClass) {
|
||||
@@ -0,0 +1,9 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.botany.blocks.properties;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
@@ -5,8 +5,8 @@ import java.util.Map;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.botany.modules.ModuleCeramic;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import binnie.extratrees.api.IDesignMaterial;
|
||||
|
||||
@@ -31,7 +31,7 @@ public class CeramicColor implements IDesignMaterial {
|
||||
|
||||
@Override
|
||||
public ItemStack getStack() {
|
||||
return TileEntityMetadata.getItemStack(Botany.gardening().ceramic, color.ordinal());
|
||||
return TileEntityMetadata.getItemStack(ModuleCeramic.ceramic, color.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,7 +16,8 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.botany.items.BotanyItems;
|
||||
import binnie.botany.items.CeramicItems;
|
||||
import binnie.botany.modules.ModuleCeramic;
|
||||
import binnie.core.AbstractMod;
|
||||
import binnie.extratrees.api.IDesignMaterial;
|
||||
import binnie.extratrees.api.IDesignSystem;
|
||||
@@ -97,13 +98,13 @@ public class CeramicDesignSystem implements IDesignSystem {
|
||||
|
||||
@Override
|
||||
public ItemStack getAdhesive() {
|
||||
return BotanyItems.MORTAR.get(1);
|
||||
return CeramicItems.MORTAR.get(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public IDesignMaterial getMaterial(ItemStack itemStack) {
|
||||
return (itemStack.getItem() == Item.getItemFromBlock(Botany.gardening().ceramic))
|
||||
return (itemStack.getItem() == Item.getItemFromBlock(ModuleCeramic.ceramic))
|
||||
? getMaterial(itemStack.getItemDamage())
|
||||
: null;
|
||||
}
|
||||
|
||||
@@ -10,8 +10,8 @@ import net.minecraft.nbt.NBTTagInt;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.botany.modules.ModuleCeramic;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
public class CeramicBrickPair {
|
||||
@@ -23,7 +23,7 @@ public class CeramicBrickPair {
|
||||
public CeramicBrickType type;
|
||||
public int ordinal;
|
||||
|
||||
CeramicBrickPair(EnumFlowerColor colorFirst, EnumFlowerColor colorSecond, CeramicBrickType type) {
|
||||
public CeramicBrickPair(EnumFlowerColor colorFirst, EnumFlowerColor colorSecond, CeramicBrickType type) {
|
||||
this.colorFirst = colorFirst;
|
||||
this.colorSecond = colorSecond;
|
||||
this.type = type;
|
||||
@@ -53,7 +53,7 @@ public class CeramicBrickPair {
|
||||
}
|
||||
|
||||
public ItemStack getStack(int i) {
|
||||
ItemStack stack = new ItemStack(Botany.gardening().ceramicBrick, i);
|
||||
ItemStack stack = new ItemStack(ModuleCeramic.ceramicBrick, i);
|
||||
stack.setTagInfo("id", new NBTTagInt(ordinal()));
|
||||
return stack;
|
||||
}
|
||||
|
||||
@@ -11,9 +11,9 @@ import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.botany.items.BotanyItems;
|
||||
import binnie.botany.items.CeramicItems;
|
||||
import binnie.botany.modules.ModuleCeramic;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
|
||||
public enum CeramicBrickType implements IStringSerializable {
|
||||
@@ -30,7 +30,7 @@ public enum CeramicBrickType implements IStringSerializable {
|
||||
if (isMortar(stack)) {
|
||||
++mortars;
|
||||
} else {
|
||||
if (stack.getItem() != Item.getItemFromBlock(Botany.gardening().ceramic)) {
|
||||
if (stack.getItem() != Item.getItemFromBlock(ModuleCeramic.ceramic)) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
++blocks;
|
||||
@@ -82,7 +82,7 @@ public enum CeramicBrickType implements IStringSerializable {
|
||||
int a = 0;
|
||||
int b = 0;
|
||||
for (ItemStack stack4 : stacks) {
|
||||
if (stack4.getItem() != Item.getItemFromBlock(Botany.gardening().ceramicBrick)) {
|
||||
if (stack4.getItem() != Item.getItemFromBlock(ModuleCeramic.ceramicBrick)) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
CeramicBrickPair type4 = new CeramicBrickPair(stack4);
|
||||
@@ -122,7 +122,7 @@ public enum CeramicBrickType implements IStringSerializable {
|
||||
int altCounter = 0;
|
||||
for (ItemStack stack2 : stacks) {
|
||||
int alt = (altCounter != 0 && altCounter != 3) ? 1 : 0;
|
||||
if (stack2.getItem() != Item.getItemFromBlock(Botany.gardening().ceramicBrick)) {
|
||||
if (stack2.getItem() != Item.getItemFromBlock(ModuleCeramic.ceramicBrick)) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
CeramicBrickPair type = new CeramicBrickPair(stack2);
|
||||
@@ -148,7 +148,7 @@ public enum CeramicBrickType implements IStringSerializable {
|
||||
}
|
||||
int[] colors = {-1, -1};
|
||||
for (ItemStack stack2 : stacks) {
|
||||
if (stack2.getItem() != Item.getItemFromBlock(Botany.gardening().ceramicBrick)) {
|
||||
if (stack2.getItem() != Item.getItemFromBlock(ModuleCeramic.ceramicBrick)) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
CeramicBrickPair type2 = new CeramicBrickPair(stack2);
|
||||
@@ -177,7 +177,7 @@ public enum CeramicBrickType implements IStringSerializable {
|
||||
}
|
||||
int[] colors = {-1, -1};
|
||||
for (ItemStack stack2 : stacks) {
|
||||
if (stack2.getItem() != Item.getItemFromBlock(Botany.gardening().ceramicBrick)) {
|
||||
if (stack2.getItem() != Item.getItemFromBlock(ModuleCeramic.ceramicBrick)) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
CeramicBrickPair type2 = new CeramicBrickPair(stack2);
|
||||
@@ -233,7 +233,7 @@ public enum CeramicBrickType implements IStringSerializable {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Nullable
|
||||
TextureAtlasSprite[] sprites;
|
||||
public TextureAtlasSprite[] sprites;
|
||||
|
||||
CeramicBrickType(String id) {
|
||||
this.id = id;
|
||||
@@ -290,7 +290,7 @@ public enum CeramicBrickType implements IStringSerializable {
|
||||
int[] colors = {-1, -1};
|
||||
for (int index2 = 0; index2 < stacks.size(); ++index2) {
|
||||
ItemStack stack4 = stacks.get(index2);
|
||||
if (stack4.getItem() != Item.getItemFromBlock(Botany.gardening().ceramicBrick)) {
|
||||
if (stack4.getItem() != Item.getItemFromBlock(ModuleCeramic.ceramicBrick)) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@@ -319,7 +319,7 @@ public enum CeramicBrickType implements IStringSerializable {
|
||||
}
|
||||
|
||||
protected boolean isMortar(ItemStack stack) {
|
||||
return stack.getItem() == Botany.gardening().misc && stack.getItemDamage() == BotanyItems.MORTAR.ordinal();
|
||||
return stack.getItem() == ModuleCeramic.misc && stack.getItemDamage() == CeramicItems.MORTAR.ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
package binnie.botany.core;
|
||||
|
||||
import binnie.botany.api.FlowerManager;
|
||||
import binnie.botany.api.IFlowerRoot;
|
||||
import binnie.botany.api.IGardeningManager;
|
||||
import binnie.botany.gardening.Gardening;
|
||||
import binnie.botany.GardeningManager;
|
||||
import binnie.botany.api.BotanyAPI;
|
||||
import binnie.botany.api.gardening.IGardeningManager;
|
||||
import binnie.botany.api.genetics.IFlowerRoot;
|
||||
import binnie.botany.genetics.FlowerRoot;
|
||||
|
||||
public class BotanyCore {
|
||||
public static final int CHANCE_INTERPOLLINATION = 20;
|
||||
|
||||
public static IFlowerRoot getFlowerRoot() {
|
||||
if (FlowerManager.flowerRoot == null) {
|
||||
FlowerManager.flowerRoot = new FlowerRoot();
|
||||
if (BotanyAPI.flowerRoot == null) {
|
||||
BotanyAPI.flowerRoot = new FlowerRoot();
|
||||
}
|
||||
return FlowerManager.flowerRoot;
|
||||
return BotanyAPI.flowerRoot;
|
||||
}
|
||||
|
||||
public static IGardeningManager getGardening() {
|
||||
if (FlowerManager.gardening == null) {
|
||||
FlowerManager.gardening = new Gardening();
|
||||
if (BotanyAPI.gardening == null) {
|
||||
BotanyAPI.gardening = new GardeningManager();
|
||||
}
|
||||
return FlowerManager.gardening;
|
||||
return BotanyAPI.gardening;
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package binnie.botany.core;
|
||||
|
||||
import binnie.core.IInitializable;
|
||||
|
||||
public class ModuleCore implements IInitializable {
|
||||
@Override
|
||||
public void preInit() {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.farm;
|
||||
package binnie.botany.farming;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
@@ -12,8 +12,8 @@ import forestry.api.circuits.ICircuitLayout;
|
||||
import forestry.api.farming.FarmDirection;
|
||||
import forestry.api.farming.IFarmHousing;
|
||||
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import binnie.botany.api.gardening.EnumAcidity;
|
||||
import binnie.botany.api.gardening.EnumMoisture;
|
||||
import binnie.core.circuits.BinnieCircuit;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
@@ -25,12 +25,12 @@ public class CircuitGarden extends BinnieCircuit {
|
||||
super(getName(moisture, ph, manual, fertilised), 4, getLayout(manual), recipe);
|
||||
isManual = manual;
|
||||
logic = new GardenLogic(moisture, ph, isManual, fertilised, icon, I18N.localise(getUnlocalizedName()));
|
||||
String info = I18N.localise("botany.moisture") + ": " + moisture.getLocalisedName(true);
|
||||
String info = I18N.localise("botany.moisture") + ": " + moisture.getLocalisedName(true) + TextFormatting.GRAY + ", ";
|
||||
if (ph != null) {
|
||||
info += TextFormatting.GRAY + ", " + I18N.localise("botany.ph") + ": " + moisture.getLocalisedName(true);
|
||||
info += I18N.localise("botany.ph") + ": " + ph.getLocalisedName(true) + TextFormatting.GRAY + ", ";
|
||||
}
|
||||
String fertilizedKey = fertilised ? "for.binnie.circuit.garden.fertilized" : "for.binnie.circuit.garden.unfertilized";
|
||||
info += TextFormatting.GRAY + " " + I18N.localise(fertilizedKey);
|
||||
info += (fertilised ? TextFormatting.GREEN : TextFormatting.RED) + I18N.localise(fertilizedKey) + TextFormatting.GRAY;
|
||||
addTooltipString(I18N.localise("for.binnie.circuit.garden.info", info));
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.farm;
|
||||
package binnie.botany.farming;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
+8
-8
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.farm;
|
||||
package binnie.botany.farming;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@@ -12,17 +12,17 @@ import net.minecraft.world.World;
|
||||
import forestry.api.farming.ICrop;
|
||||
import forestry.api.farming.IFarmable;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.api.EnumFlowerStage;
|
||||
import binnie.botany.api.IFlower;
|
||||
import binnie.botany.api.IFlowerRoot;
|
||||
import binnie.botany.api.genetics.EnumFlowerStage;
|
||||
import binnie.botany.api.genetics.IFlower;
|
||||
import binnie.botany.api.genetics.IFlowerRoot;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.botany.flower.TileEntityFlower;
|
||||
import binnie.botany.modules.ModuleFlowers;
|
||||
import binnie.botany.tile.TileEntityFlower;
|
||||
|
||||
public class FarmableFlower implements IFarmable {
|
||||
@Override
|
||||
public boolean isSaplingAt(World world, BlockPos pos) {
|
||||
return world.getBlockState(pos) == Botany.flower;
|
||||
return world.getBlockState(pos) == ModuleFlowers.flower;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -38,7 +38,7 @@ public class FarmableFlower implements IFarmable {
|
||||
IFlowerRoot flowerRoot = BotanyCore.getFlowerRoot();
|
||||
ItemStack mature = flowerRoot.getMemberStack(flower, EnumFlowerStage.FLOWER);
|
||||
ItemStack seed = flowerRoot.getMemberStack(flower, EnumFlowerStage.SEED);
|
||||
if (mature != null && seed != null) {
|
||||
if (!mature.isEmpty() && !seed.isEmpty()) {
|
||||
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
|
||||
return new FlowerCrop(pos, mature, seed);
|
||||
}
|
||||
+3
-3
@@ -1,12 +1,12 @@
|
||||
package binnie.botany.farm;
|
||||
package binnie.botany.farming;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import binnie.botany.api.IFlower;
|
||||
import binnie.botany.api.IFlowerRoot;
|
||||
import binnie.botany.api.genetics.IFlower;
|
||||
import binnie.botany.api.genetics.IFlowerRoot;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
|
||||
public class FarmableVanillaFlower extends FarmableFlower {
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.farm;
|
||||
package binnie.botany.farming;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collections;
|
||||
+25
-37
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.farm;
|
||||
package binnie.botany.farming;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
@@ -30,14 +30,15 @@ import forestry.core.owner.IOwnedTile;
|
||||
import forestry.core.utils.BlockUtil;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
import binnie.botany.api.IBlockSoil;
|
||||
import binnie.botany.api.IGardeningManager;
|
||||
import binnie.botany.api.gardening.EnumAcidity;
|
||||
import binnie.botany.api.gardening.EnumFertiliserType;
|
||||
import binnie.botany.api.gardening.EnumMoisture;
|
||||
import binnie.botany.api.gardening.EnumSoilType;
|
||||
import binnie.botany.api.gardening.IBlockSoil;
|
||||
import binnie.botany.api.gardening.IGardeningManager;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.botany.flower.TileEntityFlower;
|
||||
import binnie.botany.modules.ModuleGardening;
|
||||
import binnie.botany.tile.TileEntityFlower;
|
||||
import binnie.core.liquid.ManagerLiquid;
|
||||
|
||||
public class GardenLogic extends FarmLogic {
|
||||
@@ -50,18 +51,18 @@ public class GardenLogic extends FarmLogic {
|
||||
private NonNullList<ItemStack> produce;
|
||||
private ItemStack icon;
|
||||
|
||||
public GardenLogic(EnumMoisture moisture2, @Nullable EnumAcidity acidity2, boolean isManual, boolean isFertilised, ItemStack icon2, String name2) {
|
||||
public GardenLogic(EnumMoisture moisture, @Nullable EnumAcidity acidity, boolean isManual, boolean isFertilised, ItemStack icon, String name) {
|
||||
this.isManual = isManual;
|
||||
this.moisture = moisture;
|
||||
this.acidity = acidity;
|
||||
this.fertilised = isFertilised;
|
||||
this.icon = icon;
|
||||
this.name = name;
|
||||
|
||||
produce = NonNullList.create();
|
||||
farmables = new ArrayList<>();
|
||||
farmables.add(new FarmableFlower());
|
||||
farmables.add(new FarmableVanillaFlower());
|
||||
|
||||
moisture = moisture2;
|
||||
acidity = acidity2;
|
||||
fertilised = isFertilised;
|
||||
icon = icon2;
|
||||
name = name2;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -80,8 +81,8 @@ public class GardenLogic extends FarmLogic {
|
||||
return gardening.isSoil(itemstack.getItem()) ||
|
||||
itemstack.getItem() == Item.getItemFromBlock(Blocks.SAND) ||
|
||||
itemstack.getItem() == Item.getItemFromBlock(Blocks.DIRT) ||
|
||||
gardening.isAcidFertiliser(itemstack) ||
|
||||
gardening.isAlkalineFertiliser(itemstack);
|
||||
gardening.isFertiliser(EnumFertiliserType.ACID, itemstack) ||
|
||||
gardening.isFertiliser(EnumFertiliserType.ALKALINE, itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -113,14 +114,14 @@ public class GardenLogic extends FarmLogic {
|
||||
}
|
||||
}
|
||||
|
||||
if (getBlock(world, position.up()) == Botany.gardening().plant) {
|
||||
if (getBlock(world, position.up()) == ModuleGardening.plant) {
|
||||
world.setBlockToAir(position.up());
|
||||
} else {
|
||||
if (acidity != null && gardening.isSoil(getBlock(world, position))) {
|
||||
IBlockSoil soil = (IBlockSoil) getBlock(world, position);
|
||||
EnumAcidity pH = soil.getPH(world, position);
|
||||
if (pH.ordinal() < acidity.ordinal()) {
|
||||
ItemStack stack = getAvailableAlkaline(housing);
|
||||
ItemStack stack = getAvailableFertiliser(housing, EnumFertiliserType.ALKALINE);
|
||||
if (!stack.isEmpty() && soil.setPH(world, position, EnumAcidity.values()[pH.ordinal() + 1])) {
|
||||
NonNullList<ItemStack> resources = NonNullList.create();
|
||||
resources.add(stack);
|
||||
@@ -129,7 +130,7 @@ public class GardenLogic extends FarmLogic {
|
||||
}
|
||||
}
|
||||
if (pH.ordinal() > acidity.ordinal()) {
|
||||
ItemStack stack = getAvailableAcid(housing);
|
||||
ItemStack stack = getAvailableFertiliser(housing, EnumFertiliserType.ACID);
|
||||
if (!stack.isEmpty() && soil.setPH(world, position, EnumAcidity.values()[pH.ordinal() - 1])) {
|
||||
NonNullList<ItemStack> resources = NonNullList.create();
|
||||
resources.add(stack);
|
||||
@@ -231,7 +232,7 @@ public class GardenLogic extends FarmLogic {
|
||||
|
||||
for (EnumMoisture moist : moistures) {
|
||||
for (EnumAcidity acid : acidities) {
|
||||
for (Block type : new Block[]{Botany.gardening().flowerbed, Botany.gardening().loam, Botany.gardening().soil}) {
|
||||
for (Block type : new Block[]{ModuleGardening.flowerbed, ModuleGardening.loam, ModuleGardening.soil}) {
|
||||
int meta = acid.ordinal() * 3 + moist.ordinal();
|
||||
NonNullList<ItemStack> resources = NonNullList.create();
|
||||
ItemStack resourceStack = new ItemStack(type, 1, meta);
|
||||
@@ -263,7 +264,7 @@ public class GardenLogic extends FarmLogic {
|
||||
}
|
||||
|
||||
if (loam.getItem() == Item.getItemFromBlock(Blocks.DIRT)) {
|
||||
loam = new ItemStack(Botany.gardening().soil, 1, 4);
|
||||
loam = new ItemStack(ModuleGardening.soil, 1, 4);
|
||||
}
|
||||
|
||||
setBlock(world, position, ((ItemBlock) loam.getItem()).getBlock(), loam.getItemDamage());
|
||||
@@ -370,21 +371,8 @@ public class GardenLogic extends FarmLogic {
|
||||
return false;
|
||||
}
|
||||
|
||||
public ItemStack getAvailableAcid(IFarmHousing housing) {
|
||||
for (ItemStack stack : BotanyCore.getGardening().getAcidFertilisers()) {
|
||||
if (!stack.isEmpty()) {
|
||||
NonNullList<ItemStack> resources = NonNullList.create();
|
||||
resources.add(stack);
|
||||
if (housing.getFarmInventory().hasResources(resources)) {
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
public ItemStack getAvailableAlkaline(IFarmHousing housing) {
|
||||
for (ItemStack stack : BotanyCore.getGardening().getAlkalineFertilisers()) {
|
||||
public ItemStack getAvailableFertiliser(IFarmHousing housing, EnumFertiliserType type) {
|
||||
for (ItemStack stack : BotanyCore.getGardening().getFertilisers(type)) {
|
||||
if (!stack.isEmpty()) {
|
||||
NonNullList<ItemStack> resources = NonNullList.create();
|
||||
resources.add(stack);
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.botany.gardening;
|
||||
package binnie.botany.farming;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
@@ -1,272 +0,0 @@
|
||||
package binnie.botany.gardening;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
import forestry.api.climate.IClimateInfo;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
import binnie.botany.api.IBlockSoil;
|
||||
import binnie.botany.api.IFlower;
|
||||
import binnie.botany.api.IGardeningManager;
|
||||
import binnie.botany.items.BotanyItems;
|
||||
|
||||
public class Gardening implements IGardeningManager {
|
||||
private final Map<ItemStack, Integer> fertiliserAcid = new LinkedHashMap<>();
|
||||
private final Map<ItemStack, Integer> fertiliserAlkaline = new LinkedHashMap<>();
|
||||
private final Map<ItemStack, Integer> fertiliserNutrient = new LinkedHashMap<>();
|
||||
|
||||
public Gardening() {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSoil(Block block) {
|
||||
return block instanceof IBlockSoil;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSoil(Item item) {
|
||||
return item instanceof ItemBlock && isSoil(((ItemBlock) item).getBlock());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSoil(ItemStack item) {
|
||||
return isSoil(item.getItem());
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumMoisture getNaturalMoisture(World world, BlockPos pos) {
|
||||
float bias = getBiomeMoisture(world, pos);
|
||||
for (int dx = -1; dx < 2; ++dx) {
|
||||
for (int dz = -1; dz < 2; ++dz) {
|
||||
if (dx != 0 || dz != 0) {
|
||||
if (world.getBlockState(pos.add(dx, 0, dz)) == Blocks.SAND) {
|
||||
bias -= 1.5;
|
||||
} else if (world.getBlockState(pos.add(dx, 0, dz)) == Blocks.WATER) {
|
||||
bias += 1.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (world.isRaining() && world.canBlockSeeSky(pos.up()) && world.getPrecipitationHeight(pos).getY() <= pos.getY() + 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.getBlockState(pos.add(dx, 0, dz)).getBlock() == Blocks.GRAVEL && bias > 0.0f) {
|
||||
bias *= 0.4f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return (bias <= -1.0f) ? EnumMoisture.DRY : ((bias >= 1.0f) ? EnumMoisture.DAMP : EnumMoisture.NORMAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumAcidity getNaturalPH(World world, BlockPos pos) {
|
||||
float bias = getBiomePH(world, pos);
|
||||
if (bias <= -1.0f) {
|
||||
return EnumAcidity.ACID;
|
||||
}
|
||||
return (bias >= 1.0f) ? EnumAcidity.ALKALINE : EnumAcidity.NEUTRAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getBiomeMoisture(World world, BlockPos pos) {
|
||||
IClimateInfo info = ForestryAPI.climateManager.getInfo(world, pos);
|
||||
double humidity = info.getHumidity();
|
||||
double temperature = info.getTemperature();
|
||||
double m = 3.2 * (humidity - 0.5) - 0.4 * (1.0 + temperature + 0.5 * temperature * temperature) + 1.1 - 1.6 * (temperature - 0.9) * (temperature - 0.9) - 0.002 * (pos.getY() - 64);
|
||||
return (float) ((m == 0.0) ? m : ((m < 0.0) ? (-Math.sqrt(m * m)) : Math.sqrt(m * m)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getBiomePH(World world, BlockPos pos) {
|
||||
IClimateInfo info = ForestryAPI.climateManager.getInfo(world, pos);
|
||||
double humidity = info.getHumidity();
|
||||
double temperature = info.getTemperature();
|
||||
return (float) (-3.0 * (humidity - 0.5) + 0.5 * (temperature - 0.699999988079071) * (temperature - 0.699999988079071) + 0.02f * (pos.getY() - 64) - 0.15000000596046448);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void plantSoil(World world, BlockPos pos, EnumSoilType soil, EnumMoisture moisture, EnumAcidity acidity) {
|
||||
int meta = moisture.ordinal() + acidity.ordinal() * 3;
|
||||
world.setBlockState(pos, getSoilBlock(soil).getStateFromMeta(meta), 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ItemStack> getAcidFertilisers() {
|
||||
return Collections.unmodifiableSet(fertiliserAcid.keySet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ItemStack> getAlkalineFertilisers() {
|
||||
return Collections.unmodifiableSet(fertiliserAlkaline.keySet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ItemStack> getNutrientFertilisers() {
|
||||
return Collections.unmodifiableSet(fertiliserNutrient.keySet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerAcidFertiliser(ItemStack stack, int strength) {
|
||||
ModuleGardening.queuedAcidFertilisers.put(stack, strength);
|
||||
fertiliserAcid.put(stack, strength);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerAlkalineFertiliser(ItemStack stack, int strength) {
|
||||
ModuleGardening.queuedAlkalineFertilisers.put(stack, strength);
|
||||
fertiliserAlkaline.put(stack, strength);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerNutrientFertiliser(ItemStack stack, int strength) {
|
||||
ModuleGardening.queuedNutrientFertilisers.put(stack, strength);
|
||||
fertiliserNutrient.put(stack, strength);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAcidFertiliser(ItemStack itemstack) {
|
||||
for (ItemStack stack : getAcidFertilisers()) {
|
||||
if (!stack.isEmpty() && stack.isItemEqual(itemstack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAlkalineFertiliser(ItemStack itemstack) {
|
||||
for (ItemStack stack : getAlkalineFertilisers()) {
|
||||
if (!stack.isEmpty() && stack.isItemEqual(itemstack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNutrientFertiliser(ItemStack itemstack) {
|
||||
for (ItemStack stack : getNutrientFertilisers()) {
|
||||
if (!stack.isEmpty() && stack.isItemEqual(itemstack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFertiliserStrength(ItemStack stack) {
|
||||
for (Map.Entry<ItemStack, Integer> entry : fertiliserAcid.entrySet()) {
|
||||
if (entry.getKey().isItemEqual(stack)) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
for (Map.Entry<ItemStack, Integer> entry : fertiliserAlkaline.entrySet()) {
|
||||
if (entry.getKey().isItemEqual(stack)) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
for (Map.Entry<ItemStack, Integer> entry : fertiliserNutrient.entrySet()) {
|
||||
if (entry.getKey().isItemEqual(stack)) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTolerate(@Nullable IFlower flower, World world, BlockPos pos) {
|
||||
if (flower == null) {
|
||||
return false;
|
||||
}
|
||||
IBlockState soil = world.getBlockState(pos.down());
|
||||
Block soilBlock = soil.getBlock();
|
||||
int soilMeta = soilBlock.getMetaFromState(soil);
|
||||
Biome biome = world.getBiome(pos);
|
||||
return canTolerate(
|
||||
flower,
|
||||
EnumAcidity.values()[soilMeta / 3 % 3],
|
||||
EnumMoisture.values()[soilMeta % 3],
|
||||
EnumTemperature.getFromValue(biome.getTemperature())
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumSoilType getSoilType(World world, BlockPos pos) {
|
||||
if (world.getBlockState(pos).getBlock() instanceof IBlockSoil) {
|
||||
return ((IBlockSoil) world.getBlockState(pos).getBlock()).getType(world, pos);
|
||||
}
|
||||
return EnumSoilType.SOIL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getSoilBlock(EnumSoilType type) {
|
||||
return getSoilBlock(type, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getSoilBlock(EnumSoilType type, boolean weedKill) {
|
||||
switch (type) {
|
||||
case FLOWERBED:
|
||||
return weedKill ? Botany.gardening().flowerbedNoWeed : Botany.gardening().flowerbed;
|
||||
|
||||
case LOAM:
|
||||
return weedKill ? Botany.gardening().loamNoWeed : Botany.gardening().loam;
|
||||
}
|
||||
return weedKill ? Botany.gardening().soilNoWeed : Botany.gardening().soil;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTolerate(IFlower flower, EnumAcidity acidity, EnumMoisture moisture, EnumTemperature temperature) {
|
||||
return flower.getGenome().canTolerate(acidity)
|
||||
&& flower.getGenome().canTolerate(moisture)
|
||||
&& flower.getGenome().canTolerate(temperature);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWeedkiller(ItemStack heldItem) {
|
||||
return heldItem.isItemEqual(BotanyItems.WEEDKILLER.get(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addWeedKiller(World world, BlockPos pos) {
|
||||
if (!(world.getBlockState(pos).getBlock() instanceof IBlockSoil)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
EnumSoilType type = getSoilType(world, pos);
|
||||
Block block = getSoilBlock(type, true);
|
||||
IBlockState oldState = world.getBlockState(pos);
|
||||
IBlockState newState = block.getStateFromMeta(oldState.getBlock().getMetaFromState(oldState));
|
||||
boolean done = world.setBlockState(pos, newState, 2);
|
||||
if (done && BlockPlant.isWeed(world, pos.up())) {
|
||||
world.setBlockToAir(pos.up());
|
||||
}
|
||||
return done;
|
||||
}
|
||||
}
|
||||
@@ -1,395 +0,0 @@
|
||||
package binnie.botany.gardening;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraftforge.oredict.RecipeSorter;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
import binnie.botany.api.IGardeningManager;
|
||||
import binnie.botany.ceramic.BlockCeramic;
|
||||
import binnie.botany.ceramic.BlockCeramicPatterned;
|
||||
import binnie.botany.ceramic.BlockStainedGlass;
|
||||
import binnie.botany.ceramic.CeramicTileRecipe;
|
||||
import binnie.botany.ceramic.ItemCeramic;
|
||||
import binnie.botany.ceramic.ItemStainedGlass;
|
||||
import binnie.botany.ceramic.PigmentRecipe;
|
||||
import binnie.botany.ceramic.TileCeramic;
|
||||
import binnie.botany.ceramic.brick.BlockCeramicBrick;
|
||||
import binnie.botany.ceramic.brick.ItemCeramicBrick;
|
||||
import binnie.botany.ceramic.brick.TileCeramicBrick;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.botany.farm.CircuitGarden;
|
||||
import binnie.botany.flower.ItemInsulatedTube;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.botany.items.BotanyItems;
|
||||
import binnie.botany.items.ItemClay;
|
||||
import binnie.botany.items.ItemPigment;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.IInitializable;
|
||||
import binnie.core.Mods;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import binnie.core.item.ItemMisc;
|
||||
import binnie.extratrees.carpentry.ItemDesign;
|
||||
|
||||
public class ModuleGardening implements IInitializable {
|
||||
public static final HashMap<ItemStack, Integer> queuedAcidFertilisers = new HashMap<>();
|
||||
public static final HashMap<ItemStack, Integer> queuedAlkalineFertilisers = new HashMap<>();
|
||||
public static final HashMap<ItemStack, Integer> queuedNutrientFertilisers = new HashMap<>();
|
||||
|
||||
public BlockPlant plant;
|
||||
public ItemTrowel trowelWood;
|
||||
public ItemTrowel trowelStone;
|
||||
public ItemTrowel trowelIron;
|
||||
public ItemTrowel trowelDiamond;
|
||||
public ItemTrowel trowelGold;
|
||||
public BlockSoil soil;
|
||||
public BlockSoil loam;
|
||||
public BlockSoil flowerbed;
|
||||
public BlockSoil soilNoWeed;
|
||||
public BlockSoil loamNoWeed;
|
||||
public BlockSoil flowerbedNoWeed;
|
||||
public ItemInsulatedTube insulatedTube;
|
||||
public ItemSoilMeter soilMeter;
|
||||
public ItemMisc misc;
|
||||
public ItemPigment pigment;
|
||||
public ItemClay clay;
|
||||
public BlockCeramic ceramic;
|
||||
public BlockCeramicPatterned ceramicTile;
|
||||
public BlockStainedGlass stained;
|
||||
public BlockCeramicBrick ceramicBrick;
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
plant = new BlockPlant();
|
||||
soil = new BlockSoil(EnumSoilType.SOIL, "soil", false);
|
||||
loam = new BlockSoil(EnumSoilType.LOAM, "loam", false);
|
||||
flowerbed = new BlockSoil(EnumSoilType.FLOWERBED, "flowerbed", false);
|
||||
soilNoWeed = new BlockSoil(EnumSoilType.SOIL, "soil_no_weed", true);
|
||||
loamNoWeed = new BlockSoil(EnumSoilType.LOAM, "loam_no_weed", true);
|
||||
flowerbedNoWeed = new BlockSoil(EnumSoilType.FLOWERBED, "flowerbed_no_weed", true);
|
||||
soilMeter = new ItemSoilMeter();
|
||||
insulatedTube = new ItemInsulatedTube();
|
||||
trowelWood = new ItemTrowel(Item.ToolMaterial.WOOD, "wood");
|
||||
trowelStone = new ItemTrowel(Item.ToolMaterial.STONE, "stone");
|
||||
trowelIron = new ItemTrowel(Item.ToolMaterial.IRON, "iron");
|
||||
trowelDiamond = new ItemTrowel(Item.ToolMaterial.DIAMOND, "diamond");
|
||||
trowelGold = new ItemTrowel(Item.ToolMaterial.GOLD, "gold");
|
||||
misc = new ItemMisc(CreativeTabBotany.instance, BotanyItems.values());
|
||||
pigment = new ItemPigment();
|
||||
clay = new ItemClay();
|
||||
ceramic = new BlockCeramic();
|
||||
stained = new BlockStainedGlass();
|
||||
ceramicTile = new BlockCeramicPatterned();
|
||||
ceramicBrick = new BlockCeramicBrick();
|
||||
|
||||
Botany.proxy.registerBlock(plant, new ItemWeed(plant));
|
||||
Botany.proxy.registerBlock(soil, new ItemSoil(soil));
|
||||
Botany.proxy.registerBlock(loam, new ItemSoil(loam));
|
||||
Botany.proxy.registerBlock(flowerbed, new ItemSoil(flowerbed));
|
||||
Botany.proxy.registerBlock(soilNoWeed, new ItemSoil(soilNoWeed));
|
||||
Botany.proxy.registerBlock(loamNoWeed, new ItemSoil(loamNoWeed));
|
||||
Botany.proxy.registerBlock(flowerbedNoWeed, new ItemSoil(flowerbedNoWeed));
|
||||
Botany.proxy.registerItem(soilMeter);
|
||||
Botany.proxy.registerItem(insulatedTube);
|
||||
Botany.proxy.registerItem(trowelWood);
|
||||
Botany.proxy.registerItem(trowelStone);
|
||||
Botany.proxy.registerItem(trowelIron);
|
||||
Botany.proxy.registerItem(trowelDiamond);
|
||||
Botany.proxy.registerItem(trowelGold);
|
||||
Botany.proxy.registerItem(misc);
|
||||
Botany.proxy.registerItem(pigment);
|
||||
Botany.proxy.registerItem(clay);
|
||||
Botany.proxy.registerBlock(ceramic, new ItemCeramic(ceramic));
|
||||
Botany.proxy.registerBlock(stained, new ItemStainedGlass(stained));
|
||||
Botany.proxy.registerBlock(ceramicTile, new ItemDesign(ceramicTile));
|
||||
Botany.proxy.registerBlock(ceramicBrick, new ItemCeramicBrick(ceramicBrick));
|
||||
|
||||
BinnieCore.getBinnieProxy().registerTileEntity(TileCeramic.class, "botany.tile.ceramic");
|
||||
//BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(ceramic), new ItemMetadataRenderer());
|
||||
//BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(stained), new ItemMetadataRenderer());
|
||||
BinnieCore.getBinnieProxy().registerTileEntity(TileCeramicBrick.class, "botany.tile.ceramicBrick");
|
||||
//BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(ceramicTile), new MultipassItemRenderer());
|
||||
//BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(ceramicBrick), new MultipassItemRenderer());
|
||||
|
||||
OreDictionary.registerOre("pigment", pigment);
|
||||
OreDictionary.registerOre("toolTrowel", trowelWood);
|
||||
OreDictionary.registerOre("toolTrowel", trowelStone);
|
||||
OreDictionary.registerOre("toolTrowel", trowelIron);
|
||||
OreDictionary.registerOre("toolTrowel", trowelGold);
|
||||
OreDictionary.registerOre("toolTrowel", trowelDiamond);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
RecipeSorter.register("botany:ceramictile", CeramicTileRecipe.class, RecipeSorter.Category.SHAPED, "");
|
||||
RecipeSorter.register("botany:pigment", PigmentRecipe.class, RecipeSorter.Category.SHAPED, "");
|
||||
ItemStack yellow = new ItemStack(Blocks.YELLOW_FLOWER, 1);
|
||||
ItemStack red = new ItemStack(Blocks.RED_FLOWER, 1);
|
||||
ItemStack blue = new ItemStack(Blocks.RED_FLOWER, 1, 7);
|
||||
for (boolean manual : new boolean[]{true, false}) {
|
||||
for (boolean fertilised : new boolean[]{true, false}) {
|
||||
for (EnumMoisture moist : EnumMoisture.values()) {
|
||||
ItemStack icon;
|
||||
if (moist == EnumMoisture.DRY) {
|
||||
icon = yellow;
|
||||
} else if (moist == EnumMoisture.NORMAL) {
|
||||
icon = red;
|
||||
} else {
|
||||
icon = blue;
|
||||
}
|
||||
int insulate = 2 - moist.ordinal();
|
||||
if (fertilised) {
|
||||
insulate += 3;
|
||||
}
|
||||
new CircuitGarden(moist, null, manual, fertilised, new ItemStack(insulatedTube, 1, 128 * insulate), icon);
|
||||
new CircuitGarden(moist, EnumAcidity.ACID, manual, fertilised, new ItemStack(insulatedTube, 1, 1 + 128 * insulate), icon);
|
||||
new CircuitGarden(moist, EnumAcidity.NEUTRAL, manual, fertilised, new ItemStack(insulatedTube, 1, 2 + 128 * insulate), icon);
|
||||
new CircuitGarden(moist, EnumAcidity.ALKALINE, manual, fertilised, new ItemStack(insulatedTube, 1, 3 + 128 * insulate), icon);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
IGardeningManager gardening = BotanyCore.getGardening();
|
||||
GameRegistry.addRecipe(new CeramicTileRecipe());
|
||||
for (int mat = 0; mat < 4; ++mat) {
|
||||
for (int insulate = 0; insulate < 6; ++insulate) {
|
||||
ItemStack tubes = new ItemStack(insulatedTube, 2, mat + 128 * insulate);
|
||||
ItemStack insulateStack = ItemInsulatedTube.getInsulateStack(tubes);
|
||||
ItemStack forestryTube = new ItemStack(Mods.Forestry.item("thermionic_tubes"), 1, mat);
|
||||
GameRegistry.addShapelessRecipe(tubes, forestryTube, forestryTube, insulateStack);
|
||||
}
|
||||
}
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
trowelWood,
|
||||
"d ", " x ", " s",
|
||||
'd', Blocks.DIRT,
|
||||
's', "stickWood",
|
||||
'x', "plankWood")
|
||||
);
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
trowelStone,
|
||||
"d ", " x ", " s",
|
||||
'd', Blocks.DIRT,
|
||||
's', "stickWood",
|
||||
'x', "cobblestone"
|
||||
));
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
trowelIron,
|
||||
"d ", " x ", " s",
|
||||
'd', Blocks.DIRT,
|
||||
's', "stickWood",
|
||||
'x', "ingotIron"
|
||||
));
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
trowelGold,
|
||||
"d ", " x ", " s",
|
||||
'd', Blocks.DIRT,
|
||||
's', "stickWood",
|
||||
'x', "ingotGold"
|
||||
));
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
trowelDiamond,
|
||||
"d ", " x ", " s",
|
||||
'd', Blocks.DIRT,
|
||||
's', "stickWood",
|
||||
'x', "gemDiamond"
|
||||
));
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
soilMeter,
|
||||
" gg", " rg", "i ",
|
||||
'g', "ingotGold",
|
||||
'r', "dustRedstone",
|
||||
'i', "ingotIron"
|
||||
));
|
||||
|
||||
GameRegistry.addShapelessRecipe(
|
||||
BotanyItems.WEEDKILLER.get(4),
|
||||
new ItemStack(Items.SPIDER_EYE),
|
||||
new ItemStack(Items.WHEAT_SEEDS),
|
||||
new ItemStack(Items.WHEAT_SEEDS),
|
||||
new ItemStack(Items.WHEAT_SEEDS)
|
||||
);
|
||||
|
||||
GameRegistry.addShapelessRecipe(
|
||||
BotanyItems.POWDER_ASH.get(4),
|
||||
Mods.Forestry.stack("ash")
|
||||
);
|
||||
|
||||
GameRegistry.addShapelessRecipe(
|
||||
BotanyItems.POWDER_MULCH.get(4),
|
||||
Mods.Forestry.stack("mulch")
|
||||
);
|
||||
|
||||
GameRegistry.addShapelessRecipe(
|
||||
BotanyItems.POWDER_COMPOST.get(4),
|
||||
Mods.Forestry.stack("fertilizer_bio")
|
||||
);
|
||||
|
||||
GameRegistry.addShapelessRecipe(
|
||||
BotanyItems.POWDER_FERTILISER.get(4),
|
||||
Mods.Forestry.stack("fertilizer_compound")
|
||||
);
|
||||
|
||||
GameRegistry.addShapelessRecipe(
|
||||
BotanyItems.POWDER_PULP.get(4),
|
||||
Mods.Forestry.stack("wood_pulp")
|
||||
);
|
||||
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(
|
||||
BotanyItems.POWDER_SULPHUR.get(4),
|
||||
"dustSulphur"
|
||||
));
|
||||
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(
|
||||
new ItemStack(pigment, 2, EnumFlowerColor.Black.ordinal()),
|
||||
"pigment", "pigment", "dyeBlack"
|
||||
));
|
||||
|
||||
gardening.registerAcidFertiliser(BotanyItems.POWDER_SULPHUR.get(1), 1);
|
||||
gardening.registerAcidFertiliser(BotanyItems.POWDER_MULCH.get(1), 1);
|
||||
gardening.registerAcidFertiliser(Mods.Forestry.stack("mulch"), 2);
|
||||
for (ItemStack stack : OreDictionary.getOres("dustSulfur")) {
|
||||
gardening.registerAcidFertiliser(stack, 2);
|
||||
}
|
||||
|
||||
gardening.registerAlkalineFertiliser(BotanyItems.POWDER_ASH.get(1), 1);
|
||||
gardening.registerAlkalineFertiliser(BotanyItems.POWDER_PULP.get(1), 1);
|
||||
gardening.registerAlkalineFertiliser(Mods.Forestry.stack("ash"), 2);
|
||||
gardening.registerAlkalineFertiliser(Mods.Forestry.stack("wood_pulp"), 2);
|
||||
gardening.registerNutrientFertiliser(BotanyItems.POWDER_COMPOST.get(1), 1);
|
||||
gardening.registerNutrientFertiliser(BotanyItems.POWDER_FERTILISER.get(1), 1);
|
||||
gardening.registerNutrientFertiliser(Mods.Forestry.stack("fertilizer_bio"), 2);
|
||||
gardening.registerNutrientFertiliser(Mods.Forestry.stack("fertilizer_compound"), 2);
|
||||
|
||||
for (Map.Entry<ItemStack, Integer> entry : ModuleGardening.queuedAcidFertilisers.entrySet()) {
|
||||
addAcidFertiliserRecipe(entry.getKey(), entry.getValue());
|
||||
}
|
||||
for (Map.Entry<ItemStack, Integer> entry : ModuleGardening.queuedAlkalineFertilisers.entrySet()) {
|
||||
addAlkalineFertiliserRecipe(entry.getKey(), entry.getValue());
|
||||
}
|
||||
for (Map.Entry<ItemStack, Integer> entry : ModuleGardening.queuedNutrientFertilisers.entrySet()) {
|
||||
addNutrientFertiliserRecipe(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
GameRegistry.addRecipe(BotanyItems.MORTAR.get(6), " c ", "cgc", " c ", 'c', Items.CLAY_BALL, 'g', Blocks.GRAVEL);
|
||||
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
ItemStack clay = new ItemStack(this.clay, 1, c.ordinal());
|
||||
ItemStack pigment = new ItemStack(this.pigment, 1, c.ordinal());
|
||||
GameRegistry.addShapelessRecipe(clay, Items.CLAY_BALL, Items.CLAY_BALL, Items.CLAY_BALL, pigment);
|
||||
GameRegistry.addSmelting(clay, TileEntityMetadata.getItemStack(ceramic, c.ordinal()), 0.0f);
|
||||
ItemStack glass = TileEntityMetadata.getItemStack(stained, c.ordinal());
|
||||
glass.setCount(4);
|
||||
|
||||
GameRegistry.addShapedRecipe(
|
||||
glass,
|
||||
" g ", "gpg", " g ",
|
||||
'g', Blocks.GLASS,
|
||||
'p', pigment
|
||||
);
|
||||
}
|
||||
GameRegistry.addRecipe(new PigmentRecipe());
|
||||
}
|
||||
|
||||
private ItemStack getStack(int type, int pH, int moisture) {
|
||||
if (type >= 0 && type <= 2 && pH >= 0 && pH <= 2 && moisture >= 0 && moisture <= 2) {
|
||||
return new ItemStack(BotanyCore.getGardening().getSoilBlock(EnumSoilType.values()[type]), 1, BlockSoil.getMeta(EnumAcidity.values()[pH], EnumMoisture.values()[moisture]));
|
||||
}
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
private void addAcidFertiliserRecipe(ItemStack stack, int 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) {
|
||||
ItemStack start = getStack(type, pH, moisture);
|
||||
ItemStack end = getStack(type, pH - strength, moisture);
|
||||
if (!start.isEmpty() && !end.isEmpty()) {
|
||||
end.setCount(numOfBlocks);
|
||||
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 addAlkalineFertiliserRecipe(ItemStack stack, int 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) {
|
||||
ItemStack start = getStack(type, pH, moisture);
|
||||
ItemStack end = getStack(type, pH + strength, moisture);
|
||||
if (!end.isEmpty()) {
|
||||
end.setCount(numOfBlocks);
|
||||
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 addNutrientFertiliserRecipe(ItemStack stack, int 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) {
|
||||
ItemStack start = getStack(type, pH, moisture);
|
||||
ItemStack end = getStack(type + strength, pH, moisture);
|
||||
if (!end.isEmpty()) {
|
||||
end.setCount(numOfBlocks);
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import forestry.api.genetics.IIndividual;
|
||||
import forestry.core.genetics.BreedingTracker;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.botany.api.IBotanistTracker;
|
||||
import binnie.botany.api.genetics.IBotanistTracker;
|
||||
|
||||
public class BotanistTracker extends BreedingTracker implements IBotanistTracker {
|
||||
public BotanistTracker(String s) {
|
||||
|
||||
@@ -1,35 +1,34 @@
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import binnie.botany.api.IColorMix;
|
||||
import binnie.botany.api.IFlowerColor;
|
||||
import binnie.botany.api.genetics.IColorMix;
|
||||
import binnie.botany.api.genetics.IFlowerColor;
|
||||
|
||||
public class ColorMix implements IColorMix {
|
||||
IFlowerColor color1;
|
||||
IFlowerColor color2;
|
||||
IFlowerColor colorFirst;
|
||||
IFlowerColor colorSecond;
|
||||
IFlowerColor result;
|
||||
int chance;
|
||||
|
||||
public ColorMix(IFlowerColor color1, IFlowerColor color2, IFlowerColor result, int chance) {
|
||||
this.color1 = color1;
|
||||
this.color2 = color2;
|
||||
public ColorMix(IFlowerColor colorFirst, IFlowerColor colorSecond, IFlowerColor result, int chance) {
|
||||
this.colorFirst = colorFirst;
|
||||
this.colorSecond = colorSecond;
|
||||
this.result = result;
|
||||
this.chance = chance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlowerColor getColorFirst() {
|
||||
return color1;
|
||||
return colorFirst;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlowerColor getColorSecond() {
|
||||
return color2;
|
||||
return colorSecond;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMutation(IFlowerColor colorFirst, IFlowerColor colorSecond) {
|
||||
return (colorFirst == color1 && colorSecond == color2)
|
||||
|| (colorFirst == color2 && colorSecond == color1);
|
||||
return (colorFirst == this.colorFirst && colorSecond == this.colorSecond) || (colorFirst == this.colorSecond && colorSecond == this.colorFirst);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -5,6 +5,7 @@ import net.minecraft.util.IStringSerializable;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.botany.genetics.allele.AlleleFlowerColor;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
//TODO: Clean Up
|
||||
@@ -92,7 +93,7 @@ public enum EnumFlowerColor implements IStringSerializable {
|
||||
|
||||
public static final EnumFlowerColor[] VALUES = values();
|
||||
|
||||
private FlowerColorAllele allele;
|
||||
private AlleleFlowerColor allele;
|
||||
|
||||
EnumFlowerColor(String ident, int c) {
|
||||
this(c);
|
||||
@@ -107,7 +108,7 @@ public enum EnumFlowerColor implements IStringSerializable {
|
||||
b = (int) (0.45 * (b + 131));
|
||||
int colorDis = (r << 16) + (g << 8) + b;
|
||||
String uid = "botany.color" + name();
|
||||
allele = new FlowerColorAllele(uid, ordinal(), color, colorDis, name().toLowerCase(), uid, true);
|
||||
allele = new AlleleFlowerColor(uid, ordinal(), color, colorDis, name().toLowerCase(), uid, true);
|
||||
}
|
||||
|
||||
public static void addMix(EnumFlowerColor start1, EnumFlowerColor start2, EnumFlowerColor result, int chance) {
|
||||
@@ -2955,7 +2956,7 @@ public enum EnumFlowerColor implements IStringSerializable {
|
||||
return name();
|
||||
}
|
||||
|
||||
public FlowerColorAllele getFlowerColorAllele() {
|
||||
public AlleleFlowerColor getFlowerColorAllele() {
|
||||
return allele;
|
||||
}
|
||||
}
|
||||
@@ -12,57 +12,57 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import forestry.api.core.IModelManager;
|
||||
|
||||
import binnie.Constants;
|
||||
import binnie.botany.api.EnumFlowerStage;
|
||||
import binnie.botany.api.IFlowerType;
|
||||
import binnie.botany.api.genetics.EnumFlowerStage;
|
||||
import binnie.botany.api.genetics.IFlowerType;
|
||||
|
||||
public enum EnumFlowerType implements IFlowerType<EnumFlowerType> {
|
||||
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,
|
||||
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);
|
||||
AGAPANTHUS,
|
||||
FUCHSIA,
|
||||
DIANTHUS,
|
||||
FORGET,
|
||||
ANEMONE,
|
||||
AQUILEGIA,
|
||||
EDELWEISS,
|
||||
SCABIOUS,
|
||||
CONEFLOWER,
|
||||
GAILLARDIA,
|
||||
AURICULA,
|
||||
CAMELLIA(2),
|
||||
GOLDENROD(2),
|
||||
ALTHEA(2),
|
||||
PENSTEMON(2),
|
||||
DELPHINIUM(2),
|
||||
HOLLYHOCK(2);
|
||||
|
||||
public static EnumFlowerType[] VALUES = values();
|
||||
public static int highestSection = 2;
|
||||
|
||||
@@ -2,7 +2,6 @@ package binnie.botany.genetics;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -10,19 +9,18 @@ import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.arboriculture.EnumTreeChromosome;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IChromosome;
|
||||
import forestry.core.genetics.Chromosome;
|
||||
import forestry.core.genetics.Individual;
|
||||
import forestry.core.utils.Translator;
|
||||
|
||||
import binnie.botany.api.EnumFlowerChromosome;
|
||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||
import binnie.botany.api.IColorMix;
|
||||
import binnie.botany.api.IFlower;
|
||||
import binnie.botany.api.IFlowerColor;
|
||||
import binnie.botany.api.IFlowerGenome;
|
||||
import binnie.botany.api.IFlowerMutation;
|
||||
import binnie.botany.api.genetics.EnumFlowerChromosome;
|
||||
import binnie.botany.api.genetics.IAlleleFlowerSpecies;
|
||||
import binnie.botany.api.genetics.IColorMix;
|
||||
import binnie.botany.api.genetics.IFlower;
|
||||
import binnie.botany.api.genetics.IFlowerColor;
|
||||
import binnie.botany.api.genetics.IFlowerGenome;
|
||||
import binnie.botany.api.genetics.IFlowerMutation;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
@@ -36,31 +34,31 @@ public class Flower extends Individual implements IFlower {
|
||||
private boolean wilting;
|
||||
private boolean flowered;
|
||||
|
||||
public Flower(NBTTagCompound nbt) {
|
||||
super(nbt);
|
||||
public Flower(NBTTagCompound compound) {
|
||||
super(compound);
|
||||
|
||||
if (nbt.hasKey("Age")) {
|
||||
age = nbt.getInteger("Age");
|
||||
if (compound.hasKey("Age")) {
|
||||
age = compound.getInteger("Age");
|
||||
} else {
|
||||
age = 0;
|
||||
}
|
||||
|
||||
wilting = nbt.hasKey("Wilt") && nbt.getBoolean("Wilt");
|
||||
wilting = compound.hasKey("Wilt") && compound.getBoolean("Wilt");
|
||||
|
||||
if (nbt.hasKey("Flowered")) {
|
||||
flowered = nbt.getBoolean("Flowered");
|
||||
if (compound.hasKey("Flowered")) {
|
||||
flowered = compound.getBoolean("Flowered");
|
||||
} else {
|
||||
flowered = age > 0;
|
||||
}
|
||||
|
||||
if (nbt.hasKey("Genome")) {
|
||||
genome = new FlowerGenome(nbt.getCompoundTag("Genome"));
|
||||
if (compound.hasKey("Genome")) {
|
||||
genome = new FlowerGenome(compound.getCompoundTag("Genome"));
|
||||
} else {
|
||||
genome = BotanyCore.getFlowerRoot().templateAsGenome(BotanyCore.getFlowerRoot().getDefaultTemplate());
|
||||
}
|
||||
|
||||
if (nbt.hasKey("Mate")) {
|
||||
mate = new FlowerGenome(nbt.getCompoundTag("Mate"));
|
||||
if (compound.hasKey("Mate")) {
|
||||
mate = new FlowerGenome(compound.getCompoundTag("Mate"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,20 +100,20 @@ public class Flower extends Individual implements IFlower {
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound2) {
|
||||
NBTTagCompound nbttagcompound = super.writeToNBT(nbttagcompound2);
|
||||
nbttagcompound.setInteger("Age", age);
|
||||
nbttagcompound.setBoolean("Wilt", wilting);
|
||||
nbttagcompound.setBoolean("Flowered", flowered);
|
||||
NBTTagCompound nbtGenome = new NBTTagCompound();
|
||||
genome.writeToNBT(nbtGenome);
|
||||
nbttagcompound.setTag("Genome", nbtGenome);
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
|
||||
super.writeToNBT(compound);
|
||||
compound.setInteger("Age", age);
|
||||
compound.setBoolean("Wilt", wilting);
|
||||
compound.setBoolean("Flowered", flowered);
|
||||
NBTTagCompound compoundGenome = new NBTTagCompound();
|
||||
genome.writeToNBT(compoundGenome);
|
||||
compound.setTag("Genome", compoundGenome);
|
||||
if (mate != null) {
|
||||
NBTTagCompound nbtMate = new NBTTagCompound();
|
||||
mate.writeToNBT(nbtMate);
|
||||
nbttagcompound.setTag("Mate", nbtMate);
|
||||
NBTTagCompound compundMate = new NBTTagCompound();
|
||||
mate.writeToNBT(compundMate);
|
||||
compound.setTag("Mate", compundMate);
|
||||
}
|
||||
return nbttagcompound;
|
||||
return compound;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -123,25 +121,6 @@ public class Flower extends Individual implements IFlower {
|
||||
return genome;
|
||||
}
|
||||
|
||||
private IChromosome inheritChromosome(Random rand, IChromosome parentFirst, IChromosome parentSecond) {
|
||||
IAllele choiceFirst;
|
||||
if (rand.nextBoolean()) {
|
||||
choiceFirst = parentFirst.getPrimaryAllele();
|
||||
} else {
|
||||
choiceFirst = parentFirst.getSecondaryAllele();
|
||||
}
|
||||
IAllele choiceSecond;
|
||||
if (rand.nextBoolean()) {
|
||||
choiceSecond = parentSecond.getPrimaryAllele();
|
||||
} else {
|
||||
choiceSecond = parentSecond.getSecondaryAllele();
|
||||
}
|
||||
if (rand.nextBoolean()) {
|
||||
return new Chromosome(choiceFirst, choiceSecond);
|
||||
}
|
||||
return new Chromosome(choiceSecond, choiceFirst);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mate(IFlower other) {
|
||||
mate = new FlowerGenome(other.getGenome().getChromosomes());
|
||||
@@ -155,9 +134,9 @@ public class Flower extends Individual implements IFlower {
|
||||
|
||||
@Override
|
||||
public IFlower copy() {
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
writeToNBT(nbttagcompound);
|
||||
return new Flower(nbttagcompound);
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
writeToNBT(compound);
|
||||
return new Flower(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -229,17 +208,17 @@ public class Flower extends Individual implements IFlower {
|
||||
private IChromosome[] mutateSpecies(World world, BlockPos pos, IFlowerGenome genomeFirst, IFlowerGenome genomeSecond) {
|
||||
IChromosome[] parentFirst = genomeFirst.getChromosomes();
|
||||
IChromosome[] parentSecond = genomeSecond.getChromosomes();
|
||||
IAlleleFlowerSpecies alleleFrist;
|
||||
IAlleleFlowerSpecies alleleFirst;
|
||||
IAlleleFlowerSpecies alleleSecond;
|
||||
IFlowerGenome genome0;
|
||||
IFlowerGenome genome2;
|
||||
if (world.rand.nextBoolean()) {
|
||||
alleleFrist = (IAlleleFlowerSpecies) parentFirst[EnumTreeChromosome.SPECIES.ordinal()].getPrimaryAllele();
|
||||
alleleFirst = (IAlleleFlowerSpecies) parentFirst[EnumTreeChromosome.SPECIES.ordinal()].getPrimaryAllele();
|
||||
alleleSecond = (IAlleleFlowerSpecies) parentSecond[EnumTreeChromosome.SPECIES.ordinal()].getSecondaryAllele();
|
||||
genome0 = genomeFirst;
|
||||
genome2 = genomeSecond;
|
||||
} else {
|
||||
alleleFrist = (IAlleleFlowerSpecies) parentSecond[EnumTreeChromosome.SPECIES.ordinal()].getPrimaryAllele();
|
||||
alleleFirst = (IAlleleFlowerSpecies) parentSecond[EnumTreeChromosome.SPECIES.ordinal()].getPrimaryAllele();
|
||||
alleleSecond = (IAlleleFlowerSpecies) parentFirst[EnumTreeChromosome.SPECIES.ordinal()].getSecondaryAllele();
|
||||
genome0 = genomeSecond;
|
||||
genome2 = genomeFirst;
|
||||
@@ -276,7 +255,7 @@ public class Flower extends Individual implements IFlower {
|
||||
|
||||
IChromosome[] template = null;
|
||||
for (IFlowerMutation mutation2 : BotanyCore.getFlowerRoot().getMutations(true)) {
|
||||
float chance = mutation2.getChance(world, pos, alleleFrist, alleleSecond, genome0, genome2);
|
||||
float chance = mutation2.getChance(world, pos, alleleFirst, alleleSecond, genome0, genome2);
|
||||
if (chance > 0.0f && world.rand.nextFloat() * 100.0f < chance && template == null) {
|
||||
template = BotanyCore.getFlowerRoot().templateAsChromosomes(mutation2.getTemplate());
|
||||
}
|
||||
|
||||
@@ -18,10 +18,10 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
import forestry.api.genetics.IAlyzerPlugin;
|
||||
|
||||
import binnie.botany.api.EnumFlowerChromosome;
|
||||
import binnie.botany.api.EnumFlowerStage;
|
||||
import binnie.botany.api.FlowerManager;
|
||||
import binnie.botany.api.IFlower;
|
||||
import binnie.botany.api.BotanyAPI;
|
||||
import binnie.botany.api.genetics.EnumFlowerChromosome;
|
||||
import binnie.botany.api.genetics.EnumFlowerStage;
|
||||
import binnie.botany.api.genetics.IFlower;
|
||||
import binnie.core.gui.geometry.Area;
|
||||
import binnie.core.gui.renderer.RenderUtil;
|
||||
import binnie.core.util.I18N;
|
||||
@@ -69,7 +69,7 @@ public class FlowerAlyzerPlugin implements IAlyzerPlugin {
|
||||
gui.mc.fontRendererObj.drawString(msg, guiLeft + xOffset, guiTop + lastTopOffset + margin, color);
|
||||
}
|
||||
|
||||
public void drawChromosom(GuiScreen gui, EnumFlowerChromosome chromosome, IFlower flower) {
|
||||
public void drawChromosome(GuiScreen gui, EnumFlowerChromosome chromosome, IFlower flower) {
|
||||
drawLine(gui, COLUMN_0, StringUtils.capitalize(chromosome.getName()), 0xEEEEEE);
|
||||
drawLine(gui, COLUMN_1, I18N.localise(flower.getGenome().getActiveAllele(chromosome).getUnlocalizedName()), 0xEEEEEE);
|
||||
drawLine(gui, COLUMN_2, I18N.localise(flower.getGenome().getInactiveAllele(chromosome).getUnlocalizedName()), 0xEEEEEE);
|
||||
@@ -86,7 +86,7 @@ public class FlowerAlyzerPlugin implements IAlyzerPlugin {
|
||||
lastTopOffset = 10;
|
||||
guiLeft = (gui.width - 246) / 2;
|
||||
guiTop = (gui.height - 238) / 2;
|
||||
IFlower flower = FlowerManager.flowerRoot.getMember(itemStack);
|
||||
IFlower flower = BotanyAPI.flowerRoot.getMember(itemStack);
|
||||
if (flower == null) {
|
||||
return;
|
||||
}
|
||||
@@ -109,7 +109,7 @@ public class FlowerAlyzerPlugin implements IAlyzerPlugin {
|
||||
|
||||
guiTop += rowSize * 3;
|
||||
for (EnumFlowerChromosome chromosom : firstPageChromosome) {
|
||||
drawChromosom(gui, chromosom, flower);
|
||||
drawChromosome(gui, chromosom, flower);
|
||||
|
||||
}
|
||||
|
||||
@@ -122,17 +122,17 @@ public class FlowerAlyzerPlugin implements IAlyzerPlugin {
|
||||
guiLeft = (gui.width - 246) / 2;
|
||||
guiTop = (gui.height - 238) / 2;
|
||||
|
||||
IFlower f = FlowerManager.flowerRoot.getMember(itemStack);
|
||||
IFlower f = BotanyAPI.flowerRoot.getMember(itemStack);
|
||||
|
||||
for (EnumFlowerChromosome chromosome : secondPageColorChromosome) {
|
||||
drawChromosom(gui, chromosome, f);
|
||||
drawChromosome(gui, chromosome, f);
|
||||
RenderUtil.drawSolidRect(new Area(guiLeft + COLUMN_1, guiTop + lastTopOffset + margin, 50, 10), ((IAlleleInteger) f.getGenome().getActiveAllele(chromosome)).getValue());
|
||||
RenderUtil.drawSolidRect(new Area(guiLeft + COLUMN_2, guiTop + lastTopOffset + margin, 50, 10), ((IAlleleInteger) f.getGenome().getInactiveAllele(chromosome)).getValue());
|
||||
newLine();
|
||||
}
|
||||
|
||||
for (EnumFlowerChromosome chromosome : secondPageToleranceChromosome) {
|
||||
drawChromosom(gui, chromosome, f);
|
||||
drawChromosome(gui, chromosome, f);
|
||||
newLine();
|
||||
}
|
||||
|
||||
|
||||
@@ -15,9 +15,9 @@ import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.api.genetics.ISpeciesType;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.botany.api.EnumFlowerChromosome;
|
||||
import binnie.botany.api.EnumFlowerStage;
|
||||
import binnie.botany.api.IBotanistTracker;
|
||||
import binnie.botany.api.genetics.EnumFlowerChromosome;
|
||||
import binnie.botany.api.genetics.EnumFlowerStage;
|
||||
import binnie.botany.api.genetics.IBotanistTracker;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.core.genetics.BreedingSystem;
|
||||
import binnie.core.genetics.ForestryAllele;
|
||||
@@ -94,42 +94,42 @@ public class FlowerBreedingSystem extends BreedingSystem {
|
||||
public void addExtraAlleles(IChromosomeType chromosome, TreeSet<IAllele> alleles) {
|
||||
switch ((EnumFlowerChromosome) chromosome) {
|
||||
case FERTILITY:
|
||||
for (ForestryAllele.Fertility a : ForestryAllele.Fertility.values()) {
|
||||
alleles.add(a.getAllele());
|
||||
for (ForestryAllele.Fertility fertility : ForestryAllele.Fertility.values()) {
|
||||
alleles.add(fertility.getAllele());
|
||||
}
|
||||
break;
|
||||
|
||||
case LIFESPAN:
|
||||
for (ForestryAllele.Lifespan a2 : ForestryAllele.Lifespan.values()) {
|
||||
alleles.add(a2.getAllele());
|
||||
for (ForestryAllele.Lifespan lifespan : ForestryAllele.Lifespan.values()) {
|
||||
alleles.add(lifespan.getAllele());
|
||||
}
|
||||
break;
|
||||
|
||||
case HUMIDITY_TOLERANCE:
|
||||
case PH_TOLERANCE:
|
||||
case TEMPERATURE_TOLERANCE:
|
||||
for (Tolerance a3 : Tolerance.values()) {
|
||||
alleles.add(a3.getAllele());
|
||||
for (Tolerance tolerance : Tolerance.values()) {
|
||||
alleles.add(tolerance.getAllele());
|
||||
}
|
||||
break;
|
||||
|
||||
case PRIMARY:
|
||||
case SECONDARY:
|
||||
case STEM:
|
||||
for (EnumFlowerColor a4 : EnumFlowerColor.values()) {
|
||||
alleles.add(a4.getFlowerColorAllele());
|
||||
for (EnumFlowerColor color : EnumFlowerColor.values()) {
|
||||
alleles.add(color.getFlowerColorAllele());
|
||||
}
|
||||
break;
|
||||
|
||||
case SAPPINESS:
|
||||
for (ForestryAllele.Sappiness a5 : ForestryAllele.Sappiness.values()) {
|
||||
alleles.add(a5.getAllele());
|
||||
for (ForestryAllele.Sappiness sappiness : ForestryAllele.Sappiness.values()) {
|
||||
alleles.add(sappiness.getAllele());
|
||||
}
|
||||
break;
|
||||
|
||||
case TERRITORY:
|
||||
for (ForestryAllele.Territory a6 : ForestryAllele.Territory.values()) {
|
||||
alleles.add(a6.getAllele());
|
||||
for (ForestryAllele.Territory territory : ForestryAllele.Territory.values()) {
|
||||
alleles.add(territory.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -24,23 +24,23 @@ import forestry.core.genetics.alleles.AlleleHelper;
|
||||
import forestry.core.genetics.alleles.EnumAllele;
|
||||
|
||||
import binnie.Constants;
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import binnie.botany.api.EnumFlowerChromosome;
|
||||
import binnie.botany.api.EnumFlowerStage;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import binnie.botany.api.FlowerManager;
|
||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||
import binnie.botany.api.IAlleleFlowerSpeciesBuilder;
|
||||
import binnie.botany.api.IFlower;
|
||||
import binnie.botany.api.IFlowerDefinition;
|
||||
import binnie.botany.api.IFlowerGenome;
|
||||
import binnie.botany.api.IFlowerMutationBuilder;
|
||||
import binnie.botany.api.IFlowerRoot;
|
||||
import binnie.botany.api.IFlowerType;
|
||||
import binnie.botany.api.BotanyAPI;
|
||||
import binnie.botany.api.gardening.EnumAcidity;
|
||||
import binnie.botany.api.gardening.EnumMoisture;
|
||||
import binnie.botany.api.genetics.EnumFlowerChromosome;
|
||||
import binnie.botany.api.genetics.EnumFlowerStage;
|
||||
import binnie.botany.api.genetics.IAlleleFlowerSpecies;
|
||||
import binnie.botany.api.genetics.IAlleleFlowerSpeciesBuilder;
|
||||
import binnie.botany.api.genetics.IFlower;
|
||||
import binnie.botany.api.genetics.IFlowerDefinition;
|
||||
import binnie.botany.api.genetics.IFlowerGenome;
|
||||
import binnie.botany.api.genetics.IFlowerMutationBuilder;
|
||||
import binnie.botany.api.genetics.IFlowerRoot;
|
||||
import binnie.botany.api.genetics.IFlowerType;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
|
||||
public enum FlowerDefinition implements IFlowerDefinition {
|
||||
Dandelion("Dandelion", "taraxacum", "officinale", EnumFlowerType.Dandelion, EnumFlowerColor.Yellow) {
|
||||
Dandelion("Dandelion", "taraxacum", "officinale", binnie.botany.genetics.EnumFlowerType.DANDELION, EnumFlowerColor.Yellow) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
}
|
||||
@@ -59,7 +59,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
// vanilla
|
||||
}
|
||||
},
|
||||
Poppy("Poppy", "papaver", "rhoeas", EnumFlowerType.Poppy, EnumFlowerColor.Red) {
|
||||
Poppy("Poppy", "papaver", "rhoeas", binnie.botany.genetics.EnumFlowerType.POPPY, EnumFlowerColor.Red) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setTemperature(EnumTemperature.WARM);
|
||||
@@ -79,7 +79,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
// vanilla
|
||||
}
|
||||
},
|
||||
Orchid("Orchid", "vanda", "coerulea", EnumFlowerType.Orchid, EnumFlowerColor.DeepSkyBlue) {
|
||||
Orchid("Orchid", "vanda", "coerulea", binnie.botany.genetics.EnumFlowerType.ORCHID, EnumFlowerColor.DeepSkyBlue) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setPH(EnumAcidity.ACID);
|
||||
@@ -97,7 +97,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
// vanilla
|
||||
}
|
||||
},
|
||||
Allium("Allium", "allium", "giganteum", EnumFlowerType.Allium, EnumFlowerColor.MediumPurple) {
|
||||
Allium("Allium", "allium", "giganteum", binnie.botany.genetics.EnumFlowerType.ALLIUM, EnumFlowerColor.MediumPurple) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setPH(EnumAcidity.ALKALINE);
|
||||
@@ -115,7 +115,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
// vanilla
|
||||
}
|
||||
},
|
||||
Bluet("Bluet", "houstonia", "caerulea", EnumFlowerType.Bluet, EnumFlowerColor.Lavender, EnumFlowerColor.Khaki) {
|
||||
Bluet("Bluet", "houstonia", "caerulea", binnie.botany.genetics.EnumFlowerType.BLUET, EnumFlowerColor.Lavender, EnumFlowerColor.Khaki) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setMoisture(EnumMoisture.DAMP);
|
||||
@@ -134,7 +134,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
// vanilla
|
||||
}
|
||||
},
|
||||
Tulip("Tulip", "tulipa", "agenensis", EnumFlowerType.Tulip, EnumFlowerColor.Violet) {
|
||||
Tulip("Tulip", "tulipa", "agenensis", binnie.botany.genetics.EnumFlowerType.TULIP, EnumFlowerColor.Violet) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
}
|
||||
@@ -152,7 +152,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
// vanilla
|
||||
}
|
||||
},
|
||||
Daisy("Daisy", "leucanthemum", "vulgare", EnumFlowerType.Daisy, EnumFlowerColor.White, EnumFlowerColor.Yellow) {
|
||||
Daisy("Daisy", "leucanthemum", "vulgare", binnie.botany.genetics.EnumFlowerType.DAISY, EnumFlowerColor.White, EnumFlowerColor.Yellow) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setTemperature(EnumTemperature.WARM);
|
||||
@@ -172,7 +172,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
// vanilla
|
||||
}
|
||||
},
|
||||
Cornflower("Cornflower", "centaurea", "cyanus", EnumFlowerType.Cornflower, EnumFlowerColor.SkyBlue) {
|
||||
Cornflower("Cornflower", "centaurea", "cyanus", binnie.botany.genetics.EnumFlowerType.CORNFLOWER, EnumFlowerColor.SkyBlue) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
}
|
||||
@@ -191,7 +191,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
registerMutation(Dandelion, Tulip, 10);
|
||||
}
|
||||
},
|
||||
Pansy("Pansy", "viola", "tricolor", EnumFlowerType.Pansy, EnumFlowerColor.Pink, EnumFlowerColor.Purple) {
|
||||
Pansy("Pansy", "viola", "tricolor", binnie.botany.genetics.EnumFlowerType.PANSY, EnumFlowerColor.Pink, EnumFlowerColor.Purple) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setPH(EnumAcidity.ACID);
|
||||
@@ -210,7 +210,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
registerMutation(Tulip, Viola, 5);
|
||||
}
|
||||
},
|
||||
Iris("Iris", "iris", "germanica", EnumFlowerType.Iris, EnumFlowerColor.LightGray, EnumFlowerColor.Purple) {
|
||||
Iris("Iris", "iris", "germanica", binnie.botany.genetics.EnumFlowerType.IRIS, EnumFlowerColor.LightGray, EnumFlowerColor.Purple) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setPH(EnumAcidity.ACID);
|
||||
@@ -229,7 +229,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
registerMutation(Orchid, Viola, 10);
|
||||
}
|
||||
},
|
||||
Lavender("Lavender", "Lavandula", "angustifolia", EnumFlowerType.Lavender, EnumFlowerColor.MediumOrchid) {
|
||||
Lavender("Lavender", "Lavandula", "angustifolia", binnie.botany.genetics.EnumFlowerType.LAVENDER, EnumFlowerColor.MediumOrchid) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setTemperature(EnumTemperature.WARM);
|
||||
@@ -249,7 +249,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
registerMutation(Allium, Viola, 10);
|
||||
}
|
||||
},
|
||||
Viola("Viola", "viola", "odorata", EnumFlowerType.Viola, EnumFlowerColor.MediumPurple, EnumFlowerColor.SlateBlue) {
|
||||
Viola("Viola", "viola", "odorata", binnie.botany.genetics.EnumFlowerType.VIOLA, EnumFlowerColor.MediumPurple, EnumFlowerColor.SlateBlue) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setPH(EnumAcidity.ACID);
|
||||
@@ -267,7 +267,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
registerMutation(Orchid, Poppy, 15);
|
||||
}
|
||||
},
|
||||
Daffodil("Daffodil", "narcissus", "pseudonarcissus", EnumFlowerType.Daffodil, EnumFlowerColor.Yellow, EnumFlowerColor.Gold) {
|
||||
Daffodil("Daffodil", "narcissus", "pseudonarcissus", binnie.botany.genetics.EnumFlowerType.DAFFODIL, EnumFlowerColor.Yellow, EnumFlowerColor.Gold) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
}
|
||||
@@ -284,7 +284,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
registerMutation(Dandelion, Poppy, 10);
|
||||
}
|
||||
},
|
||||
Dahlia("Dahlia", "dahlia", "variabilis", EnumFlowerType.Dahlia, EnumFlowerColor.HotPink, EnumFlowerColor.DeepPink) {
|
||||
Dahlia("Dahlia", "dahlia", "variabilis", binnie.botany.genetics.EnumFlowerType.DAHLIA, EnumFlowerColor.HotPink, EnumFlowerColor.DeepPink) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
}
|
||||
@@ -302,7 +302,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
registerMutation(Daisy, Allium, 15);
|
||||
}
|
||||
},
|
||||
Peony("Peony", "paeonia", "suffruticosa", EnumFlowerType.Peony, EnumFlowerColor.Thistle) {
|
||||
Peony("Peony", "paeonia", "suffruticosa", binnie.botany.genetics.EnumFlowerType.PEONY, EnumFlowerColor.Thistle) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setPH(EnumAcidity.ALKALINE);
|
||||
@@ -322,7 +322,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
// vanilla
|
||||
}
|
||||
},
|
||||
Rose("Rose", "rosa", "rubiginosa", EnumFlowerType.Rose, EnumFlowerColor.Red) {
|
||||
Rose("ROSE", "rosa", "rubiginosa", binnie.botany.genetics.EnumFlowerType.ROSE, EnumFlowerColor.Red) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setPH(EnumAcidity.ACID);
|
||||
@@ -341,7 +341,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
// vanilla
|
||||
}
|
||||
},
|
||||
Lilac("Lilac", "syringa", "vulgaris", EnumFlowerType.Lilac, EnumFlowerColor.Plum) {
|
||||
Lilac("Lilac", "syringa", "vulgaris", binnie.botany.genetics.EnumFlowerType.LILAC, EnumFlowerColor.Plum) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setPH(EnumAcidity.ALKALINE);
|
||||
@@ -359,7 +359,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
protected void registerMutations() {
|
||||
}
|
||||
},
|
||||
Hydrangea("Hydrangea", "hydrangea", "macrophylla", EnumFlowerType.Hydrangea, EnumFlowerColor.DeepSkyBlue) {
|
||||
Hydrangea("Hydrangea", "hydrangea", "macrophylla", binnie.botany.genetics.EnumFlowerType.HYDRANGEA, EnumFlowerColor.DeepSkyBlue) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setMoisture(EnumMoisture.DAMP);
|
||||
@@ -379,7 +379,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
registerMutation(Peony, Bluet, 10);
|
||||
}
|
||||
},
|
||||
Foxglove("Foxglove", "digitalis", "purpurea", EnumFlowerType.Foxglove, EnumFlowerColor.HotPink) {
|
||||
Foxglove("Foxglove", "digitalis", "purpurea", binnie.botany.genetics.EnumFlowerType.FOXGLOVE, EnumFlowerColor.HotPink) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
}
|
||||
@@ -400,7 +400,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
// vanilla
|
||||
}
|
||||
},
|
||||
Zinnia("Zinnia", "zinnia", "elegans", EnumFlowerType.Zinnia, EnumFlowerColor.MediumVioletRed, EnumFlowerColor.Yellow) {
|
||||
Zinnia("Zinnia", "zinnia", "elegans", binnie.botany.genetics.EnumFlowerType.ZINNIA, EnumFlowerColor.MediumVioletRed, EnumFlowerColor.Yellow) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
}
|
||||
@@ -419,7 +419,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
Zinnia.registerMutation(Dahlia, Marigold, 5);
|
||||
}
|
||||
},
|
||||
Chrysanthemum("Chrysanthemum", "chrysanthemum", "\u00ef?? grandiflorum", EnumFlowerType.Mums, EnumFlowerColor.Violet) {
|
||||
Chrysanthemum("Chrysanthemum", "chrysanthemum", "\u00ef?? grandiflorum", binnie.botany.genetics.EnumFlowerType.MUMS, EnumFlowerColor.Violet) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
}
|
||||
@@ -439,7 +439,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
registerMutation(Geranium, Rose, 10);
|
||||
}
|
||||
},
|
||||
Marigold("Marigold", "calendula", "officinalis", EnumFlowerType.Marigold, EnumFlowerColor.Gold, EnumFlowerColor.DarkOrange) {
|
||||
Marigold("Marigold", "calendula", "officinalis", binnie.botany.genetics.EnumFlowerType.MARIGOLD, EnumFlowerColor.Gold, EnumFlowerColor.DarkOrange) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setTemperature(EnumTemperature.WARM);
|
||||
@@ -459,7 +459,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
registerMutation(Daisy, Dandelion, 10);
|
||||
}
|
||||
},
|
||||
Geranium("Geranium", "geranium", "maderense", EnumFlowerType.Geranium, EnumFlowerColor.DeepPink) {
|
||||
Geranium("Geranium", "geranium", "maderense", binnie.botany.genetics.EnumFlowerType.GERANIUM, EnumFlowerColor.DeepPink) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setTemperature(EnumTemperature.WARM);
|
||||
@@ -480,7 +480,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
registerMutation(Tulip, Orchid, 15);
|
||||
}
|
||||
},
|
||||
Azalea("Azalea", "rhododendrons", "aurigeranum", EnumFlowerType.Azalea, EnumFlowerColor.HotPink) {
|
||||
Azalea("Azalea", "rhododendrons", "aurigeranum", binnie.botany.genetics.EnumFlowerType.AZALEA, EnumFlowerColor.HotPink) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setPH(EnumAcidity.ACID);
|
||||
@@ -495,7 +495,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
registerMutation(Orchid, Geranium, 5);
|
||||
}
|
||||
},
|
||||
Primrose("Primrose", "primula", "vulgaris", EnumFlowerType.Primrose, EnumFlowerColor.Red, EnumFlowerColor.Gold) {
|
||||
Primrose("Primrose", "primula", "vulgaris", binnie.botany.genetics.EnumFlowerType.PRIMROSE, EnumFlowerColor.Red, EnumFlowerColor.Gold) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setPH(EnumAcidity.ACID);
|
||||
@@ -513,7 +513,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
registerMutation(Chrysanthemum, Auricula, 5);
|
||||
}
|
||||
},
|
||||
Aster("Aster", "aster", "amellus", EnumFlowerType.Aster, EnumFlowerColor.MediumPurple, EnumFlowerColor.Goldenrod) {
|
||||
Aster("Aster", "aster", "amellus", binnie.botany.genetics.EnumFlowerType.ASTER, EnumFlowerColor.MediumPurple, EnumFlowerColor.Goldenrod) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
}
|
||||
@@ -529,7 +529,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
registerMutation(Daisy, Tulip, 10);
|
||||
}
|
||||
},
|
||||
Carnation("Carnation", "dianthus", "caryophyllus", EnumFlowerType.Carnation, EnumFlowerColor.Crimson, EnumFlowerColor.White) {
|
||||
Carnation("Carnation", "dianthus", "caryophyllus", binnie.botany.genetics.EnumFlowerType.CARNATION, EnumFlowerColor.Crimson, EnumFlowerColor.White) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setPH(EnumAcidity.ALKALINE);
|
||||
@@ -547,7 +547,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
registerMutation(Dianthus, Rose, 5);
|
||||
}
|
||||
},
|
||||
Lily("Lily", "lilium", "auratum", EnumFlowerType.Lily, EnumFlowerColor.Pink, EnumFlowerColor.Gold) {
|
||||
Lily("Lily", "lilium", "auratum", binnie.botany.genetics.EnumFlowerType.LILY, EnumFlowerColor.Pink, EnumFlowerColor.Gold) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setTemperature(EnumTemperature.WARM);
|
||||
@@ -567,7 +567,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
registerMutation(Tulip, Chrysanthemum, 5);
|
||||
}
|
||||
},
|
||||
Yarrow("Yarrow", "achillea", "millefolium", EnumFlowerType.Yarrow, EnumFlowerColor.Yellow) {
|
||||
Yarrow("Yarrow", "achillea", "millefolium", binnie.botany.genetics.EnumFlowerType.YARROW, EnumFlowerColor.Yellow) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setPH(EnumAcidity.ACID);
|
||||
@@ -587,7 +587,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
registerMutation(Dandelion, Orchid, 10);
|
||||
}
|
||||
},
|
||||
Petunia("Petunia", "petunia", "\u00ef?? atkinsiana", EnumFlowerType.Petunia, EnumFlowerColor.MediumVioletRed, EnumFlowerColor.Thistle) {
|
||||
Petunia("Petunia", "petunia", "\u00ef?? atkinsiana", binnie.botany.genetics.EnumFlowerType.Petunia, EnumFlowerColor.MediumVioletRed, EnumFlowerColor.Thistle) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setTemperature(EnumTemperature.WARM);
|
||||
@@ -606,7 +606,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
registerMutation(Tulip, Dahlia, 5);
|
||||
}
|
||||
},
|
||||
Agapanthus("Agapanthus", "agapanthus", "praecox", EnumFlowerType.Agapanthus, EnumFlowerColor.DeepSkyBlue) {
|
||||
Agapanthus("Agapanthus", "agapanthus", "praecox", binnie.botany.genetics.EnumFlowerType.AGAPANTHUS, EnumFlowerColor.DeepSkyBlue) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setTemperature(EnumTemperature.WARM);
|
||||
@@ -626,7 +626,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
registerMutation(Allium, Geranium, 5);
|
||||
}
|
||||
},
|
||||
Fuchsia("Fuchsia", "fuchsia", "magellanica", EnumFlowerType.Fuchsia, EnumFlowerColor.DeepPink, EnumFlowerColor.MediumOrchid) {
|
||||
Fuchsia("Fuchsia", "fuchsia", "magellanica", binnie.botany.genetics.EnumFlowerType.FUCHSIA, EnumFlowerColor.DeepPink, EnumFlowerColor.MediumOrchid) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setTemperature(EnumTemperature.WARM);
|
||||
@@ -646,7 +646,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
registerMutation(Foxglove, Dahlia, 5);
|
||||
}
|
||||
},
|
||||
Dianthus("Dianthus", "dianthus", "barbatus", EnumFlowerType.Dianthus, EnumFlowerColor.Crimson, EnumFlowerColor.HotPink) {
|
||||
Dianthus("Dianthus", "dianthus", "barbatus", binnie.botany.genetics.EnumFlowerType.DIANTHUS, EnumFlowerColor.Crimson, EnumFlowerColor.HotPink) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setPH(EnumAcidity.ALKALINE);
|
||||
@@ -667,7 +667,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
registerMutation(Tulip, Poppy, 15);
|
||||
}
|
||||
},
|
||||
Forget("Forget-me-nots", "myosotis", "arvensis", EnumFlowerType.Forget, EnumFlowerColor.LightSteelBlue) {
|
||||
Forget("Forget-me-nots", "myosotis", "arvensis", binnie.botany.genetics.EnumFlowerType.FORGET, EnumFlowerColor.LightSteelBlue) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setPH(EnumAcidity.ACID);
|
||||
@@ -686,7 +686,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
registerMutation(Orchid, Bluet, 10);
|
||||
}
|
||||
},
|
||||
Anemone("Anemone", "anemone", "coronaria", EnumFlowerType.Anemone, EnumFlowerColor.Red, EnumFlowerColor.MistyRose) {
|
||||
Anemone("Anemone", "anemone", "coronaria", binnie.botany.genetics.EnumFlowerType.ANEMONE, EnumFlowerColor.Red, EnumFlowerColor.MistyRose) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
}
|
||||
@@ -705,7 +705,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
FlowerDefinition.Anemone.registerMutation(FlowerDefinition.Aquilegia, FlowerDefinition.Rose, 5);
|
||||
}
|
||||
},
|
||||
Aquilegia("Aquilegia", "aquilegia", "vulgaris", EnumFlowerType.Aquilegia, EnumFlowerColor.SlateBlue, EnumFlowerColor.Thistle) {
|
||||
Aquilegia("Aquilegia", "aquilegia", "vulgaris", binnie.botany.genetics.EnumFlowerType.AQUILEGIA, EnumFlowerColor.SlateBlue, EnumFlowerColor.Thistle) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
}
|
||||
@@ -721,7 +721,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
registerMutation(Iris, Poppy, 5);
|
||||
}
|
||||
},
|
||||
Edelweiss("Edelweiss", "leontopodium", "alpinum", EnumFlowerType.Edelweiss, EnumFlowerColor.White, EnumFlowerColor.Khaki) {
|
||||
Edelweiss("Edelweiss", "leontopodium", "alpinum", binnie.botany.genetics.EnumFlowerType.EDELWEISS, EnumFlowerColor.White, EnumFlowerColor.Khaki) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setPH(EnumAcidity.ALKALINE);
|
||||
@@ -742,7 +742,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
FlowerDefinition.Edelweiss.registerMutation(FlowerDefinition.Peony, FlowerDefinition.Bluet, 5);
|
||||
}
|
||||
},
|
||||
Scabious("Scabious", "scabiosa", "columbaria", EnumFlowerType.Scabious, EnumFlowerColor.RoyalBlue) {
|
||||
Scabious("Scabious", "scabiosa", "columbaria", binnie.botany.genetics.EnumFlowerType.SCABIOUS, EnumFlowerColor.RoyalBlue) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
}
|
||||
@@ -761,7 +761,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
registerMutation(Allium, Cornflower, 5);
|
||||
}
|
||||
},
|
||||
Coneflower("Coneflower", "echinacea", "purpurea", EnumFlowerType.Coneflower, EnumFlowerColor.Violet, EnumFlowerColor.DarkOrange) {
|
||||
Coneflower("Coneflower", "echinacea", "purpurea", binnie.botany.genetics.EnumFlowerType.CONEFLOWER, EnumFlowerColor.Violet, EnumFlowerColor.DarkOrange) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
}
|
||||
@@ -778,7 +778,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
registerMutation(Tulip, Cornflower, 5);
|
||||
}
|
||||
},
|
||||
Gaillardia("Gaillardia", "gaillardia", "aristata", EnumFlowerType.Gaillardia, EnumFlowerColor.DarkOrange, EnumFlowerColor.Yellow) {
|
||||
Gaillardia("Gaillardia", "gaillardia", "aristata", binnie.botany.genetics.EnumFlowerType.GAILLARDIA, EnumFlowerColor.DarkOrange, EnumFlowerColor.Yellow) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setMoisture(EnumMoisture.DAMP);
|
||||
@@ -800,7 +800,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
registerMutation(Dandelion, Marigold, 5);
|
||||
}
|
||||
},
|
||||
Auricula("Auricula", "primula", "auricula", EnumFlowerType.Auricula, EnumFlowerColor.Red, EnumFlowerColor.Yellow) {
|
||||
Auricula("Auricula", "primula", "auricula", binnie.botany.genetics.EnumFlowerType.AURICULA, EnumFlowerColor.Red, EnumFlowerColor.Yellow) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setPH(EnumAcidity.ACID);
|
||||
@@ -820,7 +820,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
registerMutation(Poppy, Geranium, 10);
|
||||
}
|
||||
},
|
||||
Camellia("Camellia", "camellia", "japonica", EnumFlowerType.Camellia, EnumFlowerColor.Crimson) {
|
||||
Camellia("Camellia", "camellia", "japonica", binnie.botany.genetics.EnumFlowerType.CAMELLIA, EnumFlowerColor.Crimson) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setPH(EnumAcidity.ACID);
|
||||
@@ -840,7 +840,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
registerMutation(Hydrangea, Rose, 5);
|
||||
}
|
||||
},
|
||||
Goldenrod("Goldenrod", "solidago", "canadensis", EnumFlowerType.Goldenrod, EnumFlowerColor.Gold) {
|
||||
Goldenrod("Goldenrod", "solidago", "canadensis", binnie.botany.genetics.EnumFlowerType.GOLDENROD, EnumFlowerColor.Gold) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
}
|
||||
@@ -858,7 +858,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
registerMutation(Lilac, Marigold, 10);
|
||||
}
|
||||
},
|
||||
Althea("Althea", "althaea", "officinalis", EnumFlowerType.Althea, EnumFlowerColor.Thistle, EnumFlowerColor.MediumOrchid) {
|
||||
Althea("Althea", "althaea", "officinalis", binnie.botany.genetics.EnumFlowerType.ALTHEA, EnumFlowerColor.Thistle, EnumFlowerColor.MediumOrchid) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setTemperature(EnumTemperature.WARM);
|
||||
@@ -879,7 +879,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
registerMutation(Hydrangea, Iris, 5);
|
||||
}
|
||||
},
|
||||
Penstemon("Penstemon", "penstemon", "digitalis", EnumFlowerType.Penstemon, EnumFlowerColor.MediumOrchid, EnumFlowerColor.Thistle) {
|
||||
Penstemon("Penstemon", "penstemon", "digitalis", binnie.botany.genetics.EnumFlowerType.PENSTEMON, EnumFlowerColor.MediumOrchid, EnumFlowerColor.Thistle) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setMoisture(EnumMoisture.DRY);
|
||||
@@ -901,7 +901,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
registerMutation(Peony, Lilac, 5);
|
||||
}
|
||||
},
|
||||
Delphinium("Delphinium", "delphinium", "staphisagria", EnumFlowerType.Delphinium, EnumFlowerColor.DarkSlateBlue) {
|
||||
Delphinium("Delphinium", "delphinium", "staphisagria", binnie.botany.genetics.EnumFlowerType.DELPHINIUM, EnumFlowerColor.DarkSlateBlue) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setMoisture(EnumMoisture.DAMP);
|
||||
@@ -922,7 +922,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
registerMutation(Lilac, Bluet, 5);
|
||||
}
|
||||
},
|
||||
Hollyhock("Hollyhock", "Alcea", "rosea", EnumFlowerType.Hollyhock, EnumFlowerColor.Black, EnumFlowerColor.Gold) {
|
||||
Hollyhock("Hollyhock", "Alcea", "rosea", binnie.botany.genetics.EnumFlowerType.HOLLYHOCK, EnumFlowerColor.Black, EnumFlowerColor.Gold) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
}
|
||||
@@ -943,7 +943,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
|
||||
public static FlowerDefinition[] VALUES = values();
|
||||
private final IAlleleFlowerSpecies species;
|
||||
IFlowerType<EnumFlowerType> type;
|
||||
IFlowerType<binnie.botany.genetics.EnumFlowerType> type;
|
||||
String name;
|
||||
String binomial;
|
||||
String branchName;
|
||||
@@ -954,19 +954,19 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
private IAllele[] template;
|
||||
private IFlowerGenome genome;
|
||||
|
||||
FlowerDefinition(String name, String branch, String binomial, IFlowerType<EnumFlowerType> type, EnumFlowerColor colour) {
|
||||
FlowerDefinition(String name, String branch, String binomial, IFlowerType<binnie.botany.genetics.EnumFlowerType> type, EnumFlowerColor colour) {
|
||||
this(name, branch, binomial, type, false, colour, colour);
|
||||
}
|
||||
|
||||
FlowerDefinition(String name, String branch, String binomial, IFlowerType<EnumFlowerType> type, EnumFlowerColor primaryColor, EnumFlowerColor secondaryColor) {
|
||||
FlowerDefinition(String name, String branch, String binomial, IFlowerType<binnie.botany.genetics.EnumFlowerType> type, EnumFlowerColor primaryColor, EnumFlowerColor secondaryColor) {
|
||||
this(name, branch, binomial, type, true, primaryColor, secondaryColor);
|
||||
}
|
||||
|
||||
FlowerDefinition(String name, String branch, String binomial, IFlowerType<EnumFlowerType> type, boolean isDominant, EnumFlowerColor colour) {
|
||||
FlowerDefinition(String name, String branch, String binomial, IFlowerType<binnie.botany.genetics.EnumFlowerType> type, boolean isDominant, EnumFlowerColor colour) {
|
||||
this(name, branch, binomial, type, isDominant, colour, colour);
|
||||
}
|
||||
|
||||
FlowerDefinition(String name, String branch, String binomial, IFlowerType<EnumFlowerType> flowerType, boolean isDominant, EnumFlowerColor primaryColor, EnumFlowerColor secondaryColor) {
|
||||
FlowerDefinition(String name, String branch, String binomial, IFlowerType<binnie.botany.genetics.EnumFlowerType> flowerType, boolean isDominant, EnumFlowerColor primaryColor, EnumFlowerColor secondaryColor) {
|
||||
String uid = Constants.BOTANY_MOD_ID + ".flower" + this;
|
||||
String unlocalizedDescription = "botany.description.flower" + this;
|
||||
String unlocalizedName = "botany.flowers.species." + name;
|
||||
@@ -979,7 +979,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
this.primaryColor = primaryColor;
|
||||
this.secondaryColor = secondaryColor;
|
||||
|
||||
IAlleleFlowerSpeciesBuilder speciesBuilder = FlowerManager.flowerFactory.createSpecies(uid, unlocalizedName, "Binnie's Mod Team", unlocalizedDescription, isDominant, getBranch(), binomial, flowerType);
|
||||
IAlleleFlowerSpeciesBuilder speciesBuilder = BotanyAPI.flowerFactory.createSpecies(uid, unlocalizedName, "Binnie's Mod Team", unlocalizedDescription, isDominant, getBranch(), binomial, flowerType);
|
||||
setSpeciesProperties(speciesBuilder);
|
||||
species = speciesBuilder.build();
|
||||
if (this.branch != null) {
|
||||
@@ -1005,12 +1005,12 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
}
|
||||
|
||||
public static void preInitFlowers() {
|
||||
MinecraftForge.EVENT_BUS.post(new AlleleSpeciesRegisterEvent(FlowerManager.flowerRoot, IAlleleFlowerSpecies.class));
|
||||
MinecraftForge.EVENT_BUS.post(new AlleleSpeciesRegisterEvent(BotanyAPI.flowerRoot, IAlleleFlowerSpecies.class));
|
||||
for (FlowerDefinition def : values()) {
|
||||
@SuppressWarnings("unchecked")
|
||||
IFlowerType<EnumFlowerType> type = def.species.getType();
|
||||
if (EnumFlowerType.highestSection < type.getSections()) {
|
||||
EnumFlowerType.highestSection = type.getSections();
|
||||
IFlowerType<binnie.botany.genetics.EnumFlowerType> type = def.species.getType();
|
||||
if (binnie.botany.genetics.EnumFlowerType.highestSection < type.getSections()) {
|
||||
binnie.botany.genetics.EnumFlowerType.highestSection = type.getSections();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1106,7 +1106,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
markAllelesAsValid(EnumBeeChromosome.HUMIDITY_TOLERANCE, EnumFlowerChromosome.PH_TOLERANCE);
|
||||
markAllelesAsValid(EnumTreeChromosome.SAPPINESS, EnumFlowerChromosome.SAPPINESS);
|
||||
|
||||
template = Arrays.copyOf(FlowerTemplates.getDefaultTemplate(), EnumFlowerChromosome.values().length);
|
||||
template = Arrays.copyOf(BotanyAPI.flowerRoot.getDefaultTemplate(), EnumFlowerChromosome.values().length);
|
||||
AlleleHelper.getInstance().set(template, EnumFlowerChromosome.SPECIES, species);
|
||||
AlleleHelper.getInstance().set(template, EnumFlowerChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.BOTH_1);
|
||||
AlleleHelper.getInstance().set(template, EnumFlowerChromosome.PRIMARY, primaryColor.getFlowerColorAllele());
|
||||
@@ -1122,6 +1122,6 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
}
|
||||
|
||||
protected final IFlowerMutationBuilder registerMutation(FlowerDefinition parent1, FlowerDefinition parent2, int chance) {
|
||||
return FlowerManager.flowerFactory.createMutation(parent1.species, parent2.species, getTemplate(), chance);
|
||||
return BotanyAPI.flowerFactory.createMutation(parent1.species, parent2.species, getTemplate(), chance);
|
||||
}
|
||||
}
|
||||
@@ -3,13 +3,14 @@ package binnie.botany.genetics;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IClassification;
|
||||
|
||||
import binnie.botany.api.FlowerManager;
|
||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||
import binnie.botany.api.IAlleleFlowerSpeciesBuilder;
|
||||
import binnie.botany.api.IFlowerFactory;
|
||||
import binnie.botany.api.IFlowerMutationBuilder;
|
||||
import binnie.botany.api.IFlowerType;
|
||||
import binnie.botany.flower.FlowerSpriteManager;
|
||||
import binnie.botany.api.BotanyAPI;
|
||||
import binnie.botany.api.genetics.IAlleleFlowerSpecies;
|
||||
import binnie.botany.api.genetics.IAlleleFlowerSpeciesBuilder;
|
||||
import binnie.botany.api.genetics.IFlowerFactory;
|
||||
import binnie.botany.api.genetics.IFlowerMutationBuilder;
|
||||
import binnie.botany.api.genetics.IFlowerType;
|
||||
import binnie.botany.genetics.allele.AlleleFlowerSpecies;
|
||||
import binnie.botany.models.FlowerSpriteManager;
|
||||
|
||||
public class FlowerFactory implements IFlowerFactory {
|
||||
@Override
|
||||
@@ -21,7 +22,7 @@ public class FlowerFactory implements IFlowerFactory {
|
||||
@Override
|
||||
public IFlowerMutationBuilder createMutation(IAlleleFlowerSpecies allele0, IAlleleFlowerSpecies allele1, IAllele[] result, int chance) {
|
||||
FlowerMutation mutation = new FlowerMutation(allele0, allele1, result, chance);
|
||||
FlowerManager.flowerRoot.registerMutation(mutation);
|
||||
BotanyAPI.flowerRoot.registerMutation(mutation);
|
||||
return mutation;
|
||||
}
|
||||
}
|
||||
@@ -16,14 +16,15 @@ import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.core.genetics.Genome;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import binnie.botany.api.EnumFlowerChromosome;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import binnie.botany.api.FlowerManager;
|
||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||
import binnie.botany.api.IFlowerGenome;
|
||||
import binnie.botany.api.IFlowerType;
|
||||
import binnie.botany.api.BotanyAPI;
|
||||
import binnie.botany.api.gardening.EnumAcidity;
|
||||
import binnie.botany.api.gardening.EnumMoisture;
|
||||
import binnie.botany.api.genetics.EnumFlowerChromosome;
|
||||
import binnie.botany.api.genetics.IAlleleFlowerSpecies;
|
||||
import binnie.botany.api.genetics.IFlowerGenome;
|
||||
import binnie.botany.api.genetics.IFlowerType;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.botany.genetics.allele.AlleleFlowerColor;
|
||||
|
||||
public class FlowerGenome extends Genome implements IFlowerGenome {
|
||||
public FlowerGenome(NBTTagCompound nbttagcompound) {
|
||||
@@ -36,15 +37,15 @@ public class FlowerGenome extends Genome implements IFlowerGenome {
|
||||
|
||||
@Nullable
|
||||
public static IAlleleFlowerSpecies getSpecies(ItemStack itemStack) {
|
||||
if (!FlowerManager.flowerRoot.isMember(itemStack)) {
|
||||
if (!BotanyAPI.flowerRoot.isMember(itemStack)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
IAlleleSpecies species = getSpeciesDirectly(FlowerManager.flowerRoot, itemStack);
|
||||
IAlleleSpecies species = getSpeciesDirectly(BotanyAPI.flowerRoot, itemStack);
|
||||
if (species instanceof IAlleleFlowerSpecies) {
|
||||
return (IAlleleFlowerSpecies) species;
|
||||
}
|
||||
return (IAlleleFlowerSpecies) getActiveAllele(itemStack, EnumFlowerChromosome.SPECIES, FlowerManager.flowerRoot);
|
||||
return (IAlleleFlowerSpecies) getActiveAllele(itemStack, EnumFlowerChromosome.SPECIES, BotanyAPI.flowerRoot);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -63,18 +64,18 @@ public class FlowerGenome extends Genome implements IFlowerGenome {
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlowerColorAllele getPrimaryColor() {
|
||||
return ((FlowerColorAllele) getActiveAllele(EnumFlowerChromosome.PRIMARY));
|
||||
public AlleleFlowerColor getPrimaryColor() {
|
||||
return ((AlleleFlowerColor) getActiveAllele(EnumFlowerChromosome.PRIMARY));
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlowerColorAllele getSecondaryColor() {
|
||||
return ((FlowerColorAllele) getActiveAllele(EnumFlowerChromosome.SECONDARY));
|
||||
public AlleleFlowerColor getSecondaryColor() {
|
||||
return ((AlleleFlowerColor) getActiveAllele(EnumFlowerChromosome.SECONDARY));
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlowerColorAllele getStemColor() {
|
||||
return ((FlowerColorAllele) getActiveAllele(EnumFlowerChromosome.STEM));
|
||||
public AlleleFlowerColor getStemColor() {
|
||||
return ((AlleleFlowerColor) getActiveAllele(EnumFlowerChromosome.STEM));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -8,11 +8,11 @@ import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IMutation;
|
||||
import forestry.core.genetics.mutations.Mutation;
|
||||
|
||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||
import binnie.botany.api.IFlowerGenome;
|
||||
import binnie.botany.api.IFlowerMutation;
|
||||
import binnie.botany.api.IFlowerMutationBuilder;
|
||||
import binnie.botany.api.IFlowerRoot;
|
||||
import binnie.botany.api.genetics.IAlleleFlowerSpecies;
|
||||
import binnie.botany.api.genetics.IFlowerGenome;
|
||||
import binnie.botany.api.genetics.IFlowerMutation;
|
||||
import binnie.botany.api.genetics.IFlowerMutationBuilder;
|
||||
import binnie.botany.api.genetics.IFlowerRoot;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
|
||||
public class FlowerMutation extends Mutation implements IFlowerMutation, IFlowerMutationBuilder {
|
||||
|
||||
@@ -25,18 +25,20 @@ import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IMutation;
|
||||
import forestry.api.genetics.ISpeciesType;
|
||||
import forestry.core.genetics.SpeciesRoot;
|
||||
import forestry.core.genetics.alleles.AlleleHelper;
|
||||
import forestry.core.genetics.alleles.EnumAllele;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.api.EnumFlowerChromosome;
|
||||
import binnie.botany.api.EnumFlowerStage;
|
||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||
import binnie.botany.api.IBotanistTracker;
|
||||
import binnie.botany.api.IColorMix;
|
||||
import binnie.botany.api.IFlower;
|
||||
import binnie.botany.api.IFlowerGenome;
|
||||
import binnie.botany.api.IFlowerMutation;
|
||||
import binnie.botany.api.IFlowerRoot;
|
||||
import binnie.botany.flower.TileEntityFlower;
|
||||
import binnie.botany.api.genetics.EnumFlowerChromosome;
|
||||
import binnie.botany.api.genetics.EnumFlowerStage;
|
||||
import binnie.botany.api.genetics.IAlleleFlowerSpecies;
|
||||
import binnie.botany.api.genetics.IBotanistTracker;
|
||||
import binnie.botany.api.genetics.IColorMix;
|
||||
import binnie.botany.api.genetics.IFlower;
|
||||
import binnie.botany.api.genetics.IFlowerGenome;
|
||||
import binnie.botany.api.genetics.IFlowerMutation;
|
||||
import binnie.botany.api.genetics.IFlowerRoot;
|
||||
import binnie.botany.modules.ModuleFlowers;
|
||||
import binnie.botany.tile.TileEntityFlower;
|
||||
|
||||
public class FlowerRoot extends SpeciesRoot implements IFlowerRoot {
|
||||
static final String UID = "rootFlowers";
|
||||
@@ -97,11 +99,11 @@ public class FlowerRoot extends SpeciesRoot implements IFlowerRoot {
|
||||
@Nullable
|
||||
public EnumFlowerStage getType(ItemStack stack) {
|
||||
Item item = stack.getItem();
|
||||
if (Botany.flowerItem == item) {
|
||||
if (ModuleFlowers.flowerItem == item) {
|
||||
return EnumFlowerStage.SEED;
|
||||
} else if (Botany.pollen == item) {
|
||||
} else if (ModuleFlowers.pollen == item) {
|
||||
return EnumFlowerStage.POLLEN;
|
||||
} else if (Botany.seed == item) {
|
||||
} else if (ModuleFlowers.seed == item) {
|
||||
return EnumFlowerStage.SEED;
|
||||
}
|
||||
return null;
|
||||
@@ -113,13 +115,13 @@ public class FlowerRoot extends SpeciesRoot implements IFlowerRoot {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
Item flowerItem = Botany.flowerItem;
|
||||
Item flowerItem = ModuleFlowers.flowerItem;
|
||||
if (type == EnumFlowerStage.SEED) {
|
||||
flowerItem = Botany.seed;
|
||||
flowerItem = ModuleFlowers.seed;
|
||||
} else if (type == EnumFlowerStage.POLLEN) {
|
||||
flowerItem = Botany.pollen;
|
||||
flowerItem = ModuleFlowers.pollen;
|
||||
}
|
||||
if (flowerItem != Botany.flowerItem) {
|
||||
if (flowerItem != ModuleFlowers.flowerItem) {
|
||||
((IFlower) flower).setAge(0);
|
||||
}
|
||||
|
||||
@@ -189,7 +191,20 @@ public class FlowerRoot extends SpeciesRoot implements IFlowerRoot {
|
||||
|
||||
@Override
|
||||
public IAllele[] getDefaultTemplate() {
|
||||
return FlowerTemplates.getDefaultTemplate();
|
||||
IAllele[] alleles = new IAllele[EnumFlowerChromosome.values().length];
|
||||
AlleleHelper.getInstance().set(alleles, EnumFlowerChromosome.SPECIES, FlowerDefinition.Poppy.getSpecies());
|
||||
AlleleHelper.getInstance().set(alleles, EnumFlowerChromosome.PRIMARY, EnumFlowerColor.Red.getFlowerColorAllele());
|
||||
AlleleHelper.getInstance().set(alleles, EnumFlowerChromosome.SECONDARY, EnumFlowerColor.Red.getFlowerColorAllele());
|
||||
AlleleHelper.getInstance().set(alleles, EnumFlowerChromosome.FERTILITY, EnumAllele.Fertility.NORMAL);
|
||||
AlleleHelper.getInstance().set(alleles, EnumFlowerChromosome.TERRITORY, EnumAllele.Territory.AVERAGE);
|
||||
AlleleHelper.getInstance().set(alleles, EnumFlowerChromosome.EFFECT, ModuleFlowers.alleleEffectNone);
|
||||
AlleleHelper.getInstance().set(alleles, EnumFlowerChromosome.LIFESPAN, EnumAllele.Lifespan.NORMAL);
|
||||
AlleleHelper.getInstance().set(alleles, EnumFlowerChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.NONE);
|
||||
AlleleHelper.getInstance().set(alleles, EnumFlowerChromosome.HUMIDITY_TOLERANCE, EnumAllele.Tolerance.NONE);
|
||||
AlleleHelper.getInstance().set(alleles, EnumFlowerChromosome.PH_TOLERANCE, EnumAllele.Tolerance.NONE);
|
||||
AlleleHelper.getInstance().set(alleles, EnumFlowerChromosome.SAPPINESS, EnumAllele.Sappiness.AVERAGE);
|
||||
AlleleHelper.getInstance().set(alleles, EnumFlowerChromosome.STEM, EnumFlowerColor.Green.getFlowerColorAllele());
|
||||
return alleles;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -281,7 +296,7 @@ public class FlowerRoot extends SpeciesRoot implements IFlowerRoot {
|
||||
}
|
||||
|
||||
public boolean plant(World world, BlockPos pos, IFlower flower, GameProfile owner) {
|
||||
boolean set = world.setBlockState(pos, Botany.flower.getDefaultState());
|
||||
boolean set = world.setBlockState(pos, ModuleFlowers.flower.getDefaultState());
|
||||
if (!set) {
|
||||
return false;
|
||||
}
|
||||
@@ -318,7 +333,7 @@ public class FlowerRoot extends SpeciesRoot implements IFlowerRoot {
|
||||
return;
|
||||
}
|
||||
|
||||
world.setBlockState(pos.up(), Botany.flower.getDefaultState());
|
||||
world.setBlockState(pos.up(), ModuleFlowers.flower.getDefaultState());
|
||||
TileEntity flowerAbove = world.getTileEntity(pos.up());
|
||||
if (flowerAbove != null && flowerAbove instanceof TileEntityFlower) {
|
||||
((TileEntityFlower) flowerAbove).setSection(section + 1);
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.core.genetics.alleles.AlleleHelper;
|
||||
import forestry.core.genetics.alleles.EnumAllele;
|
||||
|
||||
import binnie.botany.api.EnumFlowerChromosome;
|
||||
|
||||
public class FlowerTemplates {
|
||||
public static IAllele[] getDefaultTemplate() {
|
||||
IAllele[] alleles = new IAllele[EnumFlowerChromosome.values().length];
|
||||
AlleleHelper.getInstance().set(alleles, EnumFlowerChromosome.SPECIES, FlowerDefinition.Poppy.getSpecies());
|
||||
AlleleHelper.getInstance().set(alleles, EnumFlowerChromosome.PRIMARY, EnumFlowerColor.Red.getFlowerColorAllele());
|
||||
AlleleHelper.getInstance().set(alleles, EnumFlowerChromosome.SECONDARY, EnumFlowerColor.Red.getFlowerColorAllele());
|
||||
AlleleHelper.getInstance().set(alleles, EnumFlowerChromosome.FERTILITY, EnumAllele.Fertility.NORMAL);
|
||||
AlleleHelper.getInstance().set(alleles, EnumFlowerChromosome.TERRITORY, EnumAllele.Territory.AVERAGE);
|
||||
AlleleHelper.getInstance().set(alleles, EnumFlowerChromosome.EFFECT, ModuleGenetics.alleleEffectNone);
|
||||
AlleleHelper.getInstance().set(alleles, EnumFlowerChromosome.LIFESPAN, EnumAllele.Lifespan.NORMAL);
|
||||
AlleleHelper.getInstance().set(alleles, EnumFlowerChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.NONE);
|
||||
AlleleHelper.getInstance().set(alleles, EnumFlowerChromosome.HUMIDITY_TOLERANCE, EnumAllele.Tolerance.NONE);
|
||||
AlleleHelper.getInstance().set(alleles, EnumFlowerChromosome.PH_TOLERANCE, EnumAllele.Tolerance.NONE);
|
||||
AlleleHelper.getInstance().set(alleles, EnumFlowerChromosome.SAPPINESS, EnumAllele.Sappiness.AVERAGE);
|
||||
AlleleHelper.getInstance().set(alleles, EnumFlowerChromosome.STEM, EnumFlowerColor.Green.getFlowerColorAllele());
|
||||
return alleles;
|
||||
}
|
||||
}
|
||||
@@ -1,110 +0,0 @@
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.api.storage.BackpackManager;
|
||||
import forestry.api.storage.IBackpackInterface;
|
||||
import forestry.core.recipes.RecipeUtil;
|
||||
import forestry.storage.BackpackDefinition;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.api.EnumFlowerStage;
|
||||
import binnie.botany.api.FlowerManager;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.botany.flower.BlockFlower;
|
||||
import binnie.botany.flower.ItemBotany;
|
||||
import binnie.botany.flower.TileEntityFlower;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.IInitializable;
|
||||
import binnie.core.liquid.ManagerLiquid;
|
||||
|
||||
public class ModuleGenetics implements IInitializable {
|
||||
static AlleleEffectNone alleleEffectNone = new AlleleEffectNone();
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
/* INIT API*/
|
||||
FlowerManager.flowerFactory = new FlowerFactory();
|
||||
AlleleManager.alleleRegistry.registerSpeciesRoot(BotanyCore.getFlowerRoot());
|
||||
AlleleManager.alleleRegistry.registerAllele(ModuleGenetics.alleleEffectNone);
|
||||
EnumFlowerColor.setupMutations();
|
||||
FlowerDefinition.preInitFlowers();
|
||||
|
||||
/* BACKPACK*/
|
||||
IBackpackInterface backpackInterface = BackpackManager.backpackInterface;
|
||||
|
||||
if (ForestryAPI.enabledPlugins.contains("forestry.storage")) {
|
||||
Predicate<ItemStack> filter = BackpackManager.backpackInterface.createNaturalistBackpackFilter("rootFlowers");
|
||||
BackpackDefinition definition = new BackpackDefinition(new Color(0xf6e83e), Color.WHITE, filter);
|
||||
BackpackManager.backpackInterface.registerBackpackDefinition("botanist", definition);
|
||||
Item botanistBackpack = Botany.botanistBackpack = backpackInterface.createNaturalistBackpack("botanist", FlowerManager.flowerRoot).setRegistryName("botanist_bag").setUnlocalizedName("botany.botanist_bag");
|
||||
Botany.proxy.registerItem(botanistBackpack);
|
||||
botanistBackpack.setCreativeTab(CreativeTabBotany.instance);
|
||||
} else {
|
||||
Botany.botanistBackpack = null;
|
||||
}
|
||||
|
||||
/* ITEMS */
|
||||
Botany.flower = new BlockFlower();
|
||||
Botany.flowerItem = new ItemBotany("itemFlower", EnumFlowerStage.FLOWER, "");
|
||||
Botany.pollen = new ItemBotany("pollen", EnumFlowerStage.POLLEN, "pollen");
|
||||
Botany.seed = new ItemBotany("seed", EnumFlowerStage.SEED, "germling");
|
||||
Botany.database = new ItemDictionary();
|
||||
|
||||
Botany.proxy.registerBlock(Botany.flower);
|
||||
Botany.proxy.registerItem(Botany.flowerItem);
|
||||
Botany.proxy.registerItem(Botany.pollen);
|
||||
Botany.proxy.registerItem(Botany.seed);
|
||||
Botany.proxy.registerItem(Botany.database);
|
||||
|
||||
BinnieCore.getBinnieProxy().registerTileEntity(TileEntityFlower.class, "botany.tile.flower", null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
EnumFlowerColor.initColours();
|
||||
FlowerDefinition.initFlowers();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
forestry.api.apiculture.FlowerManager.flowerRegistry.registerAcceptableFlower(Botany.flower, "flowersVanilla");
|
||||
RecipeManagers.carpenterManager.addRecipe(
|
||||
100,
|
||||
Binnie.LIQUID.getFluidStack(ManagerLiquid.WATER, 2000),
|
||||
ItemStack.EMPTY,
|
||||
new ItemStack(Botany.database),
|
||||
"X#X",
|
||||
"YEY",
|
||||
"RDR",
|
||||
'#', Blocks.GLASS_PANE,
|
||||
'X', Items.GOLD_INGOT,
|
||||
'Y', Items.GOLD_NUGGET,
|
||||
'R', Items.REDSTONE,
|
||||
'D', Items.DIAMOND,
|
||||
'E', Items.EMERALD
|
||||
);
|
||||
RecipeUtil.addRecipe
|
||||
(Botany.botanistBackpack,
|
||||
"X#X",
|
||||
"VYZ",
|
||||
"X#X",
|
||||
'#', Blocks.WOOL,
|
||||
'X', Items.STRING,
|
||||
'V', Botany.gardening().soilMeter,
|
||||
'Z', "toolTrowel",
|
||||
'Y', "chestWood"
|
||||
);
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -1,11 +1,11 @@
|
||||
package binnie.botany.genetics;
|
||||
package binnie.botany.genetics.allele;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.genetics.IEffectData;
|
||||
|
||||
import binnie.botany.api.IAlleleFlowerEffect;
|
||||
import binnie.botany.api.IFlowerGenome;
|
||||
import binnie.botany.api.genetics.IAlleleFlowerEffect;
|
||||
import binnie.botany.api.genetics.IFlowerGenome;
|
||||
|
||||
public class AlleleEffectNone implements IAlleleFlowerEffect {
|
||||
@Override
|
||||
+4
-4
@@ -1,11 +1,11 @@
|
||||
package binnie.botany.genetics;
|
||||
package binnie.botany.genetics.allele;
|
||||
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
|
||||
import binnie.botany.api.IFlowerColor;
|
||||
import binnie.botany.api.genetics.IFlowerColor;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
public class FlowerColorAllele implements IFlowerColor, IAlleleInteger {
|
||||
public class AlleleFlowerColor implements IFlowerColor, IAlleleInteger {
|
||||
private int color;
|
||||
private String uid;
|
||||
private boolean isDominant;
|
||||
@@ -14,7 +14,7 @@ public class FlowerColorAllele implements IFlowerColor, IAlleleInteger {
|
||||
private int colorDis;
|
||||
private int id;
|
||||
|
||||
public FlowerColorAllele(String uid, int id, int color, int colorDis, String name, String unlocalizedName, boolean isDominant) {
|
||||
public AlleleFlowerColor(String uid, int id, int color, int colorDis, String name, String unlocalizedName, boolean isDominant) {
|
||||
this.color = color;
|
||||
this.uid = uid;
|
||||
this.isDominant = isDominant;
|
||||
+8
-8
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.genetics;
|
||||
package binnie.botany.genetics.allele;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -12,13 +12,13 @@ import forestry.api.genetics.IClassification;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.core.genetics.alleles.AlleleSpecies;
|
||||
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import binnie.botany.api.EnumFlowerChromosome;
|
||||
import binnie.botany.api.EnumFlowerStage;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||
import binnie.botany.api.IAlleleFlowerSpeciesBuilder;
|
||||
import binnie.botany.api.IFlowerType;
|
||||
import binnie.botany.api.gardening.EnumAcidity;
|
||||
import binnie.botany.api.gardening.EnumMoisture;
|
||||
import binnie.botany.api.genetics.EnumFlowerChromosome;
|
||||
import binnie.botany.api.genetics.EnumFlowerStage;
|
||||
import binnie.botany.api.genetics.IAlleleFlowerSpecies;
|
||||
import binnie.botany.api.genetics.IAlleleFlowerSpeciesBuilder;
|
||||
import binnie.botany.api.genetics.IFlowerType;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
|
||||
public class AlleleFlowerSpecies extends AlleleSpecies implements IAlleleFlowerSpecies, IAlleleFlowerSpeciesBuilder {
|
||||
@@ -0,0 +1,9 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.botany.genetics.allele;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
+3
-11
@@ -1,9 +1,6 @@
|
||||
package binnie.botany.core;
|
||||
package binnie.botany.gui;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
@@ -14,19 +11,14 @@ import binnie.core.gui.minecraft.Window;
|
||||
|
||||
public enum BotanyGUI implements IBinnieGUID {
|
||||
DATABASE,
|
||||
DATABASE_NEI;
|
||||
DATABASE_MASTER;
|
||||
|
||||
@Override
|
||||
public Window getWindow(EntityPlayer player, World world, int x, int y, int z, Side side) {
|
||||
Window window = null;
|
||||
TileEntity tileEntity = world.getTileEntity(new BlockPos(x, y, z));
|
||||
IInventory object = null;
|
||||
if (tileEntity instanceof IInventory) {
|
||||
object = (IInventory) tileEntity;
|
||||
}
|
||||
switch (this) {
|
||||
case DATABASE:
|
||||
case DATABASE_NEI: {
|
||||
case DATABASE_MASTER: {
|
||||
window = WindowBotanistDatabase.create(player, side, this != BotanyGUI.DATABASE);
|
||||
break;
|
||||
}
|
||||
@@ -3,7 +3,7 @@ package binnie.botany.gui.database;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import binnie.botany.api.IFlowerColor;
|
||||
import binnie.botany.api.genetics.IFlowerColor;
|
||||
import binnie.core.gui.Attribute;
|
||||
import binnie.core.gui.ITooltip;
|
||||
import binnie.core.gui.IWidget;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package binnie.botany.gui.database;
|
||||
|
||||
import binnie.botany.api.IColorMix;
|
||||
import binnie.botany.api.genetics.IColorMix;
|
||||
import binnie.core.gui.IWidget;
|
||||
import binnie.core.gui.controls.listbox.ControlListBox;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package binnie.botany.gui.database;
|
||||
|
||||
import binnie.botany.api.IColorMix;
|
||||
import binnie.botany.api.genetics.IColorMix;
|
||||
import binnie.core.gui.controls.listbox.ControlList;
|
||||
import binnie.core.gui.controls.listbox.ControlOption;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package binnie.botany.gui.database;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import binnie.botany.api.IColorMix;
|
||||
import binnie.botany.api.genetics.IColorMix;
|
||||
import binnie.core.gui.Attribute;
|
||||
import binnie.core.gui.CraftGUI;
|
||||
import binnie.core.gui.ITooltip;
|
||||
|
||||
@@ -3,7 +3,7 @@ package binnie.botany.gui.database;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import binnie.botany.api.IFlowerColor;
|
||||
import binnie.botany.api.genetics.IFlowerColor;
|
||||
import binnie.core.gui.Attribute;
|
||||
import binnie.core.gui.CraftGUI;
|
||||
import binnie.core.gui.controls.listbox.ControlList;
|
||||
|
||||
@@ -3,8 +3,8 @@ package binnie.botany.gui.database;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import binnie.botany.api.IColorMix;
|
||||
import binnie.botany.api.IFlowerColor;
|
||||
import binnie.botany.api.genetics.IColorMix;
|
||||
import binnie.botany.api.genetics.IFlowerColor;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.core.gui.IWidget;
|
||||
import binnie.core.gui.controls.ControlText;
|
||||
|
||||
@@ -3,8 +3,8 @@ package binnie.botany.gui.database;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import binnie.botany.api.IColorMix;
|
||||
import binnie.botany.api.IFlowerColor;
|
||||
import binnie.botany.api.genetics.IColorMix;
|
||||
import binnie.botany.api.genetics.IFlowerColor;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.core.gui.IWidget;
|
||||
import binnie.core.gui.controls.ControlText;
|
||||
|
||||
@@ -7,11 +7,11 @@ import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.botany.api.EnumFlowerChromosome;
|
||||
import binnie.botany.api.EnumFlowerStage;
|
||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||
import binnie.botany.api.IFlower;
|
||||
import binnie.botany.api.IFlowerGenome;
|
||||
import binnie.botany.api.genetics.EnumFlowerChromosome;
|
||||
import binnie.botany.api.genetics.EnumFlowerStage;
|
||||
import binnie.botany.api.genetics.IAlleleFlowerSpecies;
|
||||
import binnie.botany.api.genetics.IFlower;
|
||||
import binnie.botany.api.genetics.IFlowerGenome;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.core.gui.IWidget;
|
||||
import binnie.core.gui.controls.ControlText;
|
||||
|
||||
@@ -11,7 +11,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.api.IFlowerColor;
|
||||
import binnie.botany.api.genetics.IFlowerColor;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.core.AbstractMod;
|
||||
import binnie.core.gui.IWidget;
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.botany.farm;
|
||||
package binnie.botany.gui;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
@@ -5,7 +5,7 @@ import java.util.Locale;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.modules.ModuleGardening;
|
||||
import binnie.core.item.IItemMiscProvider;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
@@ -27,7 +27,9 @@ public enum BotanyItems implements IItemMiscProvider {
|
||||
|
||||
@Override
|
||||
public void addInformation(List<String> tooltip) {
|
||||
// ignored
|
||||
if(this == MORTAR){
|
||||
tooltip.add(I18N.localise("item.botany.mortar.tooltip"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -42,7 +44,7 @@ public enum BotanyItems implements IItemMiscProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack get(int size) {
|
||||
return new ItemStack(Botany.gardening().misc, size, ordinal());
|
||||
return new ItemStack(ModuleGardening.misc, size, ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
package binnie.botany.items;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import binnie.botany.modules.ModuleCeramic;
|
||||
import binnie.core.item.IItemMiscProvider;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
public enum CeramicItems implements IItemMiscProvider {
|
||||
MORTAR;
|
||||
|
||||
String name;
|
||||
|
||||
CeramicItems() {
|
||||
name = name().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(List<String> tooltip) {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName(ItemStack stack) {
|
||||
return I18N.localise("item.botany." + name + ".name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModelPath() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack get(int size) {
|
||||
return new ItemStack(ModuleCeramic.misc, size, ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.flower;
|
||||
package binnie.botany.items;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.flower;
|
||||
package binnie.botany.items;
|
||||
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package binnie.botany.items;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
|
||||
public class ItemBotany extends Item implements IItemModelRegister {
|
||||
|
||||
public ItemBotany(String registryName) {
|
||||
setRegistryName(registryName);
|
||||
setUnlocalizedName(registryName);
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModel(Item item, IModelManager manager) {
|
||||
manager.registerItemModel(item, 0);
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.ceramic;
|
||||
package binnie.botany.items;
|
||||
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -8,6 +8,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.core.items.IColoredItem;
|
||||
|
||||
import binnie.botany.blocks.BlockCeramic;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
+4
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.ceramic.brick;
|
||||
package binnie.botany.items;
|
||||
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -8,6 +8,9 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.core.items.IColoredItem;
|
||||
|
||||
import binnie.botany.blocks.BlockCeramicBrick;
|
||||
import binnie.botany.ceramic.brick.CeramicBrickPair;
|
||||
|
||||
public class ItemCeramicBrick extends ItemBlock implements IColoredItem {
|
||||
public ItemCeramicBrick(BlockCeramicBrick block) {
|
||||
super(block);
|
||||
@@ -12,16 +12,14 @@ import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.core.items.IColoredItem;
|
||||
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
public class ItemClay extends Item implements IColoredItem, IItemModelRegister {
|
||||
public class ItemClay extends ItemBotany implements IColoredItem, IItemModelRegister {
|
||||
public ItemClay() {
|
||||
super("clay");
|
||||
setUnlocalizedName("botany.clay");
|
||||
setHasSubtypes(true);
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
setRegistryName("clay");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
+8
-10
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.genetics;
|
||||
package binnie.botany.items;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -16,16 +16,14 @@ import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.core.BotanyGUI;
|
||||
import binnie.botany.gui.BotanyGUI;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
public class ItemDictionary extends Item implements IItemModelRegister {
|
||||
public ItemDictionary() {
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
setUnlocalizedName("database");
|
||||
public class ItemDatabaseBotany extends ItemBotany implements IItemModelRegister {
|
||||
public ItemDatabaseBotany() {
|
||||
super("database");
|
||||
setMaxStackSize(1);
|
||||
setRegistryName("database");
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -39,7 +37,7 @@ public class ItemDictionary extends Item implements IItemModelRegister {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerModel(Item item, IModelManager manager) {
|
||||
manager.registerItemModel(item, 0, "botanist_database");
|
||||
manager.registerItemModel(item, 1, "master_botanist_database");
|
||||
manager.registerItemModel(item, 1, "botanist_database_master");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -48,7 +46,7 @@ public class ItemDictionary extends Item implements IItemModelRegister {
|
||||
if (itemStack.getMetadata() == 0) {
|
||||
Botany.proxy.openGui(BotanyGUI.DATABASE, playerIn, playerIn.getPosition());
|
||||
} else {
|
||||
Botany.proxy.openGui(BotanyGUI.DATABASE_NEI, playerIn, playerIn.getPosition());
|
||||
Botany.proxy.openGui(BotanyGUI.DATABASE_MASTER, playerIn, playerIn.getPosition());
|
||||
}
|
||||
return super.onItemRightClick(worldIn, playerIn, handIn);
|
||||
}
|
||||
+15
-15
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.flower;
|
||||
package binnie.botany.items;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
@@ -38,23 +38,24 @@ import forestry.core.config.Config;
|
||||
import forestry.core.items.IColoredItem;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.api.EnumFlowerChromosome;
|
||||
import binnie.botany.api.EnumFlowerStage;
|
||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||
import binnie.botany.api.IFlower;
|
||||
import binnie.botany.api.IFlowerGenome;
|
||||
import binnie.botany.api.IFlowerType;
|
||||
import binnie.botany.api.genetics.EnumFlowerChromosome;
|
||||
import binnie.botany.api.genetics.EnumFlowerStage;
|
||||
import binnie.botany.api.genetics.IAlleleFlowerSpecies;
|
||||
import binnie.botany.api.genetics.IFlower;
|
||||
import binnie.botany.api.genetics.IFlowerGenome;
|
||||
import binnie.botany.api.genetics.IFlowerType;
|
||||
import binnie.botany.blocks.BlockFlower;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.botany.genetics.Flower;
|
||||
import binnie.botany.modules.ModuleFlowers;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
public class ItemBotany extends Item implements IColoredItem, IItemModelRegister {
|
||||
public class ItemFlowerGE extends Item implements IColoredItem, IItemModelRegister {
|
||||
private EnumFlowerStage type;
|
||||
private String tag;
|
||||
|
||||
public ItemBotany(String name, EnumFlowerStage type, String tag) {
|
||||
public ItemFlowerGE(String name, EnumFlowerStage type, String tag) {
|
||||
this.type = type;
|
||||
this.tag = tag;
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
@@ -220,9 +221,9 @@ public class ItemBotany extends Item implements IColoredItem, IItemModelRegister
|
||||
pos = pos.offset(facing);
|
||||
}
|
||||
|
||||
if (stack.getCount() != 0 && player.canPlayerEdit(pos, facing, stack) && world.mayPlace(Botany.flower, pos, false, facing, null)) {
|
||||
if (stack.getCount() != 0 && player.canPlayerEdit(pos, facing, stack) && world.mayPlace(ModuleFlowers.flower, pos, false, facing, null)) {
|
||||
int i = getMetadata(stack.getMetadata());
|
||||
IBlockState stateForPlacement = Botany.flower.getStateForPlacement(world, pos, facing, hitX, hitY, hitZ, i, player, hand);
|
||||
IBlockState stateForPlacement = ModuleFlowers.flower.getStateForPlacement(world, pos, facing, hitX, hitY, hitZ, i, player, hand);
|
||||
|
||||
if (placeBlockAt(stack, player, world, pos, facing, hitX, hitY, hitZ, stateForPlacement)) {
|
||||
SoundType soundType = block.getSoundType(stateForPlacement, world, pos, player);
|
||||
@@ -241,9 +242,9 @@ public class ItemBotany extends Item implements IColoredItem, IItemModelRegister
|
||||
}
|
||||
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
if (state.getBlock() == Botany.flower) {
|
||||
if (state.getBlock() == ModuleFlowers.flower) {
|
||||
ItemBlock.setTileEntityNBT(world, player, pos, stack);
|
||||
Botany.flower.onBlockPlacedBy(world, pos, state, player, stack);
|
||||
ModuleFlowers.flower.onBlockPlacedBy(world, pos, state, player, stack);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -256,7 +257,6 @@ public class ItemBotany extends Item implements IColoredItem, IItemModelRegister
|
||||
IFlower flower = BotanyCore.getFlowerRoot().getMember(stack);
|
||||
Preconditions.checkNotNull(flower);
|
||||
IAlleleFlowerSpecies flowerSpecies = flower.getGenome().getPrimary();
|
||||
IFlowerType flowerType = flowerSpecies.getType();
|
||||
return flowerSpecies.getFlowerModel(type, flower.hasFlowered());
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.flower;
|
||||
package binnie.botany.items;
|
||||
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
+14
-10
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.gardening;
|
||||
package binnie.botany.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -10,7 +10,8 @@ import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
import binnie.botany.api.gardening.EnumSoilType;
|
||||
import binnie.botany.blocks.BlockSoil;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
public class ItemSoil extends ItemBlock {
|
||||
@@ -27,15 +28,18 @@ public class ItemSoil extends ItemBlock {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
|
||||
String info = "";
|
||||
info += BlockSoil.getMoisture(stack, true, true);
|
||||
if (info.length() > 0) {
|
||||
info += ", ";
|
||||
}
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append(BlockSoil.getMoisture(stack, true, true));
|
||||
|
||||
info += BlockSoil.getPH(stack, true, true);
|
||||
if (info.length() > 0) {
|
||||
tooltip.add(info);
|
||||
String phInfo = BlockSoil.getPH(stack, true, true);
|
||||
if (phInfo.length() > 0) {
|
||||
if(builder.length() > 0){
|
||||
builder.append(", ");
|
||||
}
|
||||
builder.append(phInfo);
|
||||
}
|
||||
if(builder.length() > 0){
|
||||
tooltip.add(builder.toString());
|
||||
}
|
||||
|
||||
if (noWeed) {
|
||||
+5
-5
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.gardening;
|
||||
package binnie.botany.items;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -20,10 +20,10 @@ import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import binnie.botany.api.IBlockSoil;
|
||||
import binnie.botany.api.IGardeningManager;
|
||||
import binnie.botany.api.gardening.EnumAcidity;
|
||||
import binnie.botany.api.gardening.EnumMoisture;
|
||||
import binnie.botany.api.gardening.IBlockSoil;
|
||||
import binnie.botany.api.gardening.IGardeningManager;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.util.I18N;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.ceramic;
|
||||
package binnie.botany.items;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
+9
-7
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.gardening;
|
||||
package binnie.botany.items;
|
||||
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
@@ -29,13 +29,15 @@ import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
|
||||
import binnie.Constants;
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
import binnie.botany.api.IGardeningManager;
|
||||
import binnie.botany.api.gardening.EnumAcidity;
|
||||
import binnie.botany.api.gardening.EnumMoisture;
|
||||
import binnie.botany.api.gardening.EnumSoilType;
|
||||
import binnie.botany.api.gardening.IGardeningManager;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.botany.modules.BotanyModuleUIDs;
|
||||
import binnie.botany.modules.ModuleFlowers;
|
||||
import binnie.modules.ModuleManager;
|
||||
|
||||
public class ItemTrowel extends Item implements IItemModelRegister {
|
||||
protected final ToolMaterial theToolMaterial;
|
||||
@@ -66,7 +68,7 @@ public class ItemTrowel extends Item implements IItemModelRegister {
|
||||
}
|
||||
|
||||
Block block = worldIn.getBlockState(pos).getBlock();
|
||||
if (facing == EnumFacing.DOWN || (!worldIn.isAirBlock(pos.up()) && worldIn.getBlockState(pos.up()).getBlock() != Botany.flower) || (block != Blocks.GRASS && block != Blocks.DIRT && block != Blocks.GRASS_PATH)) {
|
||||
if (facing == EnumFacing.DOWN || (!worldIn.isAirBlock(pos.up()) && ModuleManager.isEnabled(Constants.BOTANY_MOD_ID, BotanyModuleUIDs.FLOWERS) && worldIn.getBlockState(pos.up()).getBlock() != ModuleFlowers.flower) || (block != Blocks.GRASS && block != Blocks.DIRT && block != Blocks.GRASS_PATH)) {
|
||||
return EnumActionResult.PASS;
|
||||
}
|
||||
|
||||
+2
-1
@@ -1,9 +1,10 @@
|
||||
package binnie.botany.gardening;
|
||||
package binnie.botany.items;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import binnie.botany.blocks.PlantType;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
public class ItemWeed extends ItemBlock {
|
||||
Loaded 100 of 155 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user