mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-21 20:52:22 +00:00
Refactor Binnie's mods into separate modules (#260)
This commit is contained in:
1 parent
cd82361a39
commit
6ad9c979d6
4780 files changed
+4556
-4080
No files matched your search
@@ -0,0 +1,22 @@
|
||||
package binnie.botany.api;
|
||||
|
||||
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")
|
||||
*/
|
||||
public static IFlowerRoot flowerRoot;
|
||||
|
||||
/**
|
||||
* Used to create new flowers.
|
||||
*/
|
||||
public static IFlowerFactory flowerFactory;
|
||||
|
||||
/**
|
||||
* Used to manager soil.
|
||||
*/
|
||||
public static IGardeningManager gardening;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package binnie.botany.api.gardening;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
|
||||
public enum EnumAcidity implements IStringSerializable {
|
||||
ACID(TextFormatting.RED),
|
||||
NEUTRAL(null),
|
||||
ALKALINE(TextFormatting.AQUA);
|
||||
|
||||
@Nullable
|
||||
TextFormatting color;
|
||||
|
||||
EnumAcidity(@Nullable TextFormatting color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name().toLowerCase();
|
||||
}
|
||||
|
||||
public String getLocalisedName(boolean withColor) {
|
||||
String localisedName = I18n.translateToLocal("botany.ph." + getName());
|
||||
if (withColor && color != null) {
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package binnie.botany.api.gardening;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
|
||||
public enum EnumMoisture implements IStringSerializable {
|
||||
DRY(TextFormatting.YELLOW),
|
||||
NORMAL(null),
|
||||
DAMP(TextFormatting.DARK_BLUE);
|
||||
|
||||
@Nullable
|
||||
final TextFormatting color;
|
||||
|
||||
EnumMoisture(@Nullable TextFormatting color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name().toLowerCase();
|
||||
}
|
||||
|
||||
public String getLocalisedName(boolean withColor) {
|
||||
String localisedName = I18n.translateToLocal("botany.moisture." + getName());
|
||||
if (withColor && color != null) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package binnie.botany.api.gardening;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
|
||||
public enum EnumSoilType implements IStringSerializable {
|
||||
SOIL(TextFormatting.DARK_GRAY),
|
||||
LOAM(TextFormatting.GOLD),
|
||||
FLOWERBED(TextFormatting.LIGHT_PURPLE);
|
||||
|
||||
private final TextFormatting color;
|
||||
|
||||
EnumSoilType(TextFormatting color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
public String getTranslated() {
|
||||
return color + I18n.translateToLocal("botany.soil." + getName());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package binnie.botany.api.gardening;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IBlockSoil {
|
||||
EnumAcidity getPH(World world, BlockPos pos);
|
||||
|
||||
EnumMoisture getMoisture(World world, BlockPos pos);
|
||||
|
||||
EnumSoilType getType(World world, BlockPos pos);
|
||||
|
||||
boolean fertilise(World world, BlockPos pos, EnumSoilType soilType);
|
||||
|
||||
boolean degrade(World world, BlockPos pos, EnumSoilType soilType);
|
||||
|
||||
boolean setPH(World world, BlockPos pos, EnumAcidity acidity);
|
||||
|
||||
boolean setMoisture(World world, BlockPos pos, EnumMoisture moisture);
|
||||
|
||||
boolean resistsWeeds(World world, BlockPos pos);
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
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;
|
||||
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;
|
||||
}
|
||||
|
||||
boolean isSoil(Item item);
|
||||
|
||||
boolean isSoil(ItemStack item);
|
||||
|
||||
EnumMoisture getNaturalMoisture(World world, BlockPos pos);
|
||||
|
||||
EnumAcidity getNaturalPH(World world, BlockPos pos);
|
||||
|
||||
float getBiomeMoisture(World world, BlockPos pos);
|
||||
|
||||
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> getFertilisers(EnumFertiliserType type);
|
||||
|
||||
Map<EnumFertiliserType, Map<ItemStack, Integer>> getFertilisers();
|
||||
|
||||
void registerFertiliser(EnumFertiliserType type, ItemStack stack, int strength);
|
||||
|
||||
boolean isFertiliser(EnumFertiliserType type, ItemStack stack);
|
||||
|
||||
int getFertiliserStrength(ItemStack stack);
|
||||
|
||||
boolean canTolerate(@Nullable IFlower flower, World world, BlockPos pos);
|
||||
|
||||
EnumSoilType getSoilType(World world, BlockPos pos);
|
||||
|
||||
default Block getSoilBlock(EnumSoilType type) {
|
||||
return getSoilBlock(type, false);
|
||||
}
|
||||
|
||||
Block getSoilBlock(EnumSoilType type, boolean weedKill);
|
||||
|
||||
boolean canTolerate(IFlower flower, EnumAcidity acidity, EnumMoisture moisture, EnumTemperature temperature);
|
||||
|
||||
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;
|
||||
@@ -0,0 +1,75 @@
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
|
||||
// TODO: move out of API
|
||||
public class AlleleFlowerColor implements IAlleleFlowerColor {
|
||||
private int color;
|
||||
private String uid;
|
||||
private boolean isDominant;
|
||||
private String name;
|
||||
private String unlocalizedName;
|
||||
private int colorDis;
|
||||
private int id;
|
||||
|
||||
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;
|
||||
this.name = name;
|
||||
this.unlocalizedName = unlocalizedName;
|
||||
this.colorDis = colorDis;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getValue() {
|
||||
return color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUID() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDominant() {
|
||||
return isDominant;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAlleleName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return unlocalizedName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor(boolean dis) {
|
||||
return dis ? colorDis : color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAlleleInteger getAllele() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getID() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColorName() {
|
||||
return I18n.translateToLocal("botany.color." + getAlleleName());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
public final class ColorMix implements IColorMix {
|
||||
private final IFlowerColor colorFirst;
|
||||
private final IFlowerColor colorSecond;
|
||||
private final IFlowerColor result;
|
||||
private final int chance;
|
||||
|
||||
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 colorFirst;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlowerColor getColorSecond() {
|
||||
return colorSecond;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMutation(IFlowerColor colorFirst, IFlowerColor colorSecond) {
|
||||
return (colorFirst == this.colorFirst && colorSecond == this.colorSecond) || (colorFirst == this.colorSecond && colorSecond == this.colorFirst);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getChance() {
|
||||
return chance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlowerColor getResult() {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IAlleleArea;
|
||||
import forestry.api.genetics.IAlleleFloat;
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
import forestry.api.genetics.IAlleleTolerance;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
|
||||
public enum EnumFlowerChromosome implements IChromosomeType {
|
||||
SPECIES(IAlleleFlowerSpecies.class),
|
||||
PRIMARY(IAlleleInteger.class),
|
||||
SECONDARY(IAlleleInteger.class),
|
||||
FERTILITY(IAlleleInteger.class),
|
||||
TERRITORY(IAlleleArea.class),
|
||||
EFFECT(IAlleleFlowerEffect.class),
|
||||
LIFESPAN(IAlleleInteger.class),
|
||||
TEMPERATURE_TOLERANCE(IAlleleTolerance.class),
|
||||
HUMIDITY_TOLERANCE(IAlleleTolerance.class),
|
||||
PH_TOLERANCE(IAlleleTolerance.class),
|
||||
SAPPINESS(IAlleleFloat.class),
|
||||
STEM(IAlleleInteger.class);
|
||||
|
||||
private Class<? extends IAllele> cls;
|
||||
|
||||
EnumFlowerChromosome(Class<? extends IAllele> cls) {
|
||||
this.cls = cls;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends IAllele> getAlleleClass() {
|
||||
return cls;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return toString().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISpeciesRoot getSpeciesRoot() {
|
||||
return AlleleManager.alleleRegistry.getSpeciesRoot("rootFlowers");
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,29 @@
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import forestry.api.genetics.ISpeciesType;
|
||||
|
||||
public enum EnumFlowerStage implements ISpeciesType {
|
||||
FLOWER("Flower"),
|
||||
SEED("Seed"),
|
||||
POLLEN("Pollen");
|
||||
|
||||
public static final EnumFlowerStage[] VALUES = values();
|
||||
String name;
|
||||
|
||||
EnumFlowerStage(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public static EnumFlowerStage getStage(IFlower flower) {
|
||||
return getStage(flower.getAge());
|
||||
}
|
||||
|
||||
public static EnumFlowerStage getStage(int age) {
|
||||
return age == 0 ? EnumFlowerStage.SEED : EnumFlowerStage.FLOWER;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
|
||||
public interface IAlleleFlowerColor extends IFlowerColor, IAlleleInteger {
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.genetics.IAlleleEffect;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
|
||||
public interface IAlleleFlowerEffect extends IAlleleEffect {
|
||||
IEffectData doEffect(IFlowerGenome genome, IEffectData effect, World world, int x, int y, int z);
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
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();
|
||||
|
||||
EnumAcidity getPH();
|
||||
|
||||
EnumMoisture getMoisture();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
int getFlowerColor(EnumFlowerStage type, int renderPass);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
ModelResourceLocation getFlowerModel(EnumFlowerStage type, boolean flowered);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
void registerModels(Item item, IModelManager manager, EnumFlowerStage type);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
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();
|
||||
|
||||
IAlleleFlowerSpeciesBuilder setPH(EnumAcidity acidity);
|
||||
|
||||
IAlleleFlowerSpeciesBuilder setMoisture(EnumMoisture moisture);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
|
||||
public interface IBotanistTracker extends IBreedingTracker {
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
public interface IColorMix {
|
||||
IFlowerColor getColorFirst();
|
||||
|
||||
IFlowerColor getColorSecond();
|
||||
|
||||
boolean isMutation(IFlowerColor colorFirst, IFlowerColor colorSecond);
|
||||
|
||||
int getChance();
|
||||
|
||||
IFlowerColor getResult();
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
|
||||
public interface IFlowerColor {
|
||||
int getColor(boolean dis);
|
||||
|
||||
IAlleleInteger getAllele();
|
||||
|
||||
int getID();
|
||||
|
||||
String getColorName();
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.core.genetics.IGeneticDefinition;
|
||||
|
||||
public interface IFlowerDefinition extends IGeneticDefinition {
|
||||
@Override
|
||||
IFlowerGenome getGenome();
|
||||
|
||||
@Override
|
||||
IFlower getIndividual();
|
||||
|
||||
ItemStack getMemberStack(EnumFlowerStage flowerStage);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IClassification;
|
||||
|
||||
public interface IFlowerFactory {
|
||||
IAlleleFlowerSpeciesBuilder createSpecies(String uid, String unlocalizedName, String authority, String unlocalizedDescription, boolean isDominant, IClassification branch, String binomial, IFlowerType flowerType);
|
||||
|
||||
IFlowerMutationBuilder createMutation(IAlleleFlowerSpecies allele0, IAlleleFlowerSpecies allele1, IAllele[] result, int chance);
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
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();
|
||||
|
||||
@Override
|
||||
IAlleleFlowerSpecies getSecondary();
|
||||
|
||||
IFlowerColor getPrimaryColor();
|
||||
|
||||
IFlowerColor getSecondaryColor();
|
||||
|
||||
IFlowerColor getStemColor();
|
||||
|
||||
int getFertility();
|
||||
|
||||
int getLifespan();
|
||||
|
||||
IFlowerType getType();
|
||||
|
||||
EnumTolerance getToleranceTemperature();
|
||||
|
||||
EnumTolerance getToleranceMoisture();
|
||||
|
||||
EnumTolerance getTolerancePH();
|
||||
|
||||
float getAgeChance();
|
||||
|
||||
float getSappiness();
|
||||
|
||||
boolean canTolerate(EnumAcidity acidity);
|
||||
|
||||
boolean canTolerate(EnumMoisture moisture);
|
||||
|
||||
boolean canTolerate(EnumTemperature temperature);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.genetics.IMutation;
|
||||
|
||||
public interface IFlowerMutation extends IMutation {
|
||||
@Override
|
||||
IFlowerRoot getRoot();
|
||||
|
||||
float getChance(World world, BlockPos pos, IAlleleFlowerSpecies allele0, IAlleleFlowerSpecies allele1, IFlowerGenome genome0, IFlowerGenome genome1);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import forestry.api.genetics.IMutationBuilder;
|
||||
|
||||
public interface IFlowerMutationBuilder extends IMutationBuilder {
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
|
||||
public interface IFlowerRoot extends ISpeciesRoot {
|
||||
@Override
|
||||
@Nullable
|
||||
IFlower getMember(ItemStack memberStack);
|
||||
|
||||
@Override
|
||||
IFlower templateAsIndividual(IAllele[] template);
|
||||
|
||||
@Override
|
||||
IFlower templateAsIndividual(IAllele[] templateFirst, IAllele[] templateSecond);
|
||||
|
||||
@Override
|
||||
IFlowerGenome templateAsGenome(IAllele[] template);
|
||||
|
||||
@Override
|
||||
IFlowerGenome templateAsGenome(IAllele[] templateActive, IAllele[] templateInactive);
|
||||
|
||||
@Override
|
||||
IBotanistTracker getBreedingTracker(World world, @Nullable GameProfile profile);
|
||||
|
||||
@Override
|
||||
List<? extends IFlowerMutation> getMutations(boolean shuffle);
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
EnumFlowerStage getType(ItemStack itemStack);
|
||||
|
||||
IFlower getFlower(IFlowerGenome genome);
|
||||
|
||||
void addConversion(ItemStack memberStack, IAllele[] template);
|
||||
|
||||
@Nullable
|
||||
IFlower getConversion(ItemStack memberStack);
|
||||
|
||||
Collection<IColorMix> getColorMixes(boolean shuffle);
|
||||
|
||||
void registerColourMix(IColorMix colorMix);
|
||||
|
||||
boolean plant(World world, BlockPos pos, IFlower flower, GameProfile owner);
|
||||
|
||||
void tryGrowSection(World world, BlockPos pos);
|
||||
|
||||
void onGrowFromSeed(World world, BlockPos pos);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.IModelManager;
|
||||
|
||||
public interface IFlowerType<I extends IFlowerType<I>> extends Comparable<I> {
|
||||
@SideOnly(Side.CLIENT)
|
||||
void registerModels(Item item, IModelManager manager, EnumFlowerStage type);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
ModelResourceLocation getModel(EnumFlowerStage type, boolean flowered);
|
||||
|
||||
String getName();
|
||||
|
||||
int getSections();
|
||||
|
||||
int ordinal();
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
@@ -0,0 +1,7 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package binnie.botany.api;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
@@ -0,0 +1,10 @@
|
||||
package binnie.core.api;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public interface IBinnieRecipe {
|
||||
|
||||
Collection<Object> getInputs();
|
||||
|
||||
Collection<Object> getOutputs();
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package binnie.core.api;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public interface ICraftingManager<T extends IBinnieRecipe> {
|
||||
/**
|
||||
* Add a new recipe to the crafting provider.
|
||||
*
|
||||
* @return <tt>true</tt> if this collection changed as a result of the call
|
||||
*/
|
||||
boolean addRecipe(T recipe);
|
||||
|
||||
/**
|
||||
* Remove a specific recipe from the crafting provider.
|
||||
*
|
||||
* @return <tt>true</tt> if an element was removed as a result of this call
|
||||
*/
|
||||
boolean removeRecipe(T recipe);
|
||||
|
||||
/**
|
||||
* @return an unmodifiable collection of all recipes registered to the crafting provider.
|
||||
*/
|
||||
Collection<T> recipes();
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package binnie.core.api.block;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
// TODO: move out of API
|
||||
public class BlockMetadata extends BlockContainer implements IBlockMetadata {
|
||||
public BlockMetadata(final Material material) {
|
||||
super(material);
|
||||
}
|
||||
|
||||
public static ItemStack getBlockDropped(IBlockMetadata block, IBlockAccess world, BlockPos pos) {
|
||||
TileEntityMetadata tile = TileEntityMetadata.getTile(world, pos);
|
||||
if (tile != null && !tile.hasDroppedBlock()) {
|
||||
int meta = block.getDroppedMeta(world.getBlockState(pos), tile.getTileMetadata());
|
||||
return TileEntityMetadata.getItemStack((Block) block, meta);
|
||||
}
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
public static void getDrops(NonNullList<ItemStack> drops, IBlockMetadata block, IBlockAccess world, BlockPos pos) {
|
||||
ItemStack drop = getBlockDropped(block, world, pos);
|
||||
if (!drop.isEmpty()) {
|
||||
drops.add(drop);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean breakBlock(IBlockMetadata blockMetadata, @Nullable EntityPlayer player, World world, BlockPos pos) {
|
||||
List<ItemStack> drops = new ArrayList<>();
|
||||
Block block = (Block) blockMetadata;
|
||||
TileEntityMetadata tile = TileEntityMetadata.getTile(world, pos);
|
||||
if (tile != null && !tile.hasDroppedBlock()) {
|
||||
drops = block.getDrops(world, pos, world.getBlockState(pos), 0);
|
||||
}
|
||||
boolean hasBeenBroken = world.setBlockToAir(pos);
|
||||
if (hasBeenBroken && !world.isRemote && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) {
|
||||
for (ItemStack drop : drops) {
|
||||
spawnAsEntity(world, pos, drop);
|
||||
}
|
||||
if (tile != null) {
|
||||
tile.dropBlock();
|
||||
}
|
||||
}
|
||||
return hasBeenBroken;
|
||||
}
|
||||
|
||||
public static ItemStack getPickBlock(World world, BlockPos pos) {
|
||||
Block block = world.getBlockState(pos).getBlock();
|
||||
return getBlockDropped((IBlockMetadata) block, world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
getDrops(drops, this, world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) {
|
||||
return breakBlock(this, player, world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(final World var1, final int i) {
|
||||
return new TileEntityMetadata();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
||||
return getPickBlock(world, pos);
|
||||
}
|
||||
|
||||
/* IBLOCKMETADATA */
|
||||
@Override
|
||||
public String getDisplayName(final ItemStack itemStack) {
|
||||
return this.getLocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlacedMeta(final ItemStack item, final World world, final BlockPos pos, final EnumFacing clickedBlock) {
|
||||
return TileEntityMetadata.getItemDamage(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDroppedMeta(IBlockState state, int tileMetadata) {
|
||||
return getMetaFromState(state);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package binnie.core.api.block;
|
||||
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
// TODO: move out of API
|
||||
public interface IBlockMetadata extends ITileEntityProvider {
|
||||
int getPlacedMeta(ItemStack itemStack, World world, BlockPos pos, EnumFacing facing);
|
||||
|
||||
int getDroppedMeta(IBlockState state, int tileMetadata);
|
||||
|
||||
String getDisplayName(ItemStack itemStack);
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
package binnie.core.api.block;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
// TODO: move out of API
|
||||
public class TileEntityMetadata extends TileEntity {
|
||||
private int meta;
|
||||
private boolean droppedBlock;
|
||||
|
||||
public TileEntityMetadata() {
|
||||
this.droppedBlock = false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static TileEntityMetadata getTile(final IBlockAccess world, final BlockPos pos) {
|
||||
final TileEntity tile = world.getTileEntity(pos);
|
||||
if (!(tile instanceof TileEntityMetadata)) {
|
||||
return null;
|
||||
}
|
||||
return (TileEntityMetadata) tile;
|
||||
}
|
||||
|
||||
public static ItemStack getItemStack(final Block block, final int damage) {
|
||||
final Item item = Item.getItemFromBlock(block);
|
||||
Preconditions.checkNotNull(item, "Could not get item for block %s", block);
|
||||
final ItemStack itemStack = new ItemStack(item, 1, 0);
|
||||
setItemDamage(itemStack, damage);
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
public static void setItemDamage(final ItemStack item, final int i) {
|
||||
item.setItemDamage((i < 16387) ? i : 16387);
|
||||
final NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setInteger("meta", i);
|
||||
item.setTagCompound(tag);
|
||||
}
|
||||
|
||||
public static int getItemDamage(final ItemStack item) {
|
||||
if (item.hasTagCompound() && item.getTagCompound().hasKey("meta")) {
|
||||
return item.getTagCompound().getInteger("meta");
|
||||
}
|
||||
return item.getItemDamage();
|
||||
}
|
||||
|
||||
public static int getTileMetadata(final IBlockAccess world, final BlockPos pos) {
|
||||
final TileEntityMetadata tile = getTile(world, pos);
|
||||
return (tile == null) ? 0 : tile.getTileMetadata();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean receiveClientEvent(final int id, final int type) {
|
||||
if (id == 42) {
|
||||
this.meta = type;
|
||||
markDirty();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getUpdateTag() {
|
||||
return writeToNBT(new NBTTagCompound());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(final NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
if(world!=null)
|
||||
setTileMetadata(nbt.getInteger("meta"), world.isRemote);
|
||||
else
|
||||
this.meta = nbt.getInteger("meta");
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(final NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setInteger("meta", this.meta);
|
||||
return nbt;
|
||||
}
|
||||
|
||||
public int getTileMetadata() {
|
||||
return this.meta;
|
||||
}
|
||||
|
||||
public void setTileMetadata(final int meta, final boolean notify) {
|
||||
if (this.meta != meta) {
|
||||
this.meta = meta;
|
||||
if (notify) {
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
world.notifyBlockUpdate(pos, state, state, 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt) {
|
||||
super.onDataPacket(net, pkt);
|
||||
readFromNBT(pkt.getNbtCompound());
|
||||
}
|
||||
|
||||
@Override
|
||||
public SPacketUpdateTileEntity getUpdatePacket() {
|
||||
return new SPacketUpdateTileEntity(pos, 0, getUpdateTag());
|
||||
}
|
||||
|
||||
public boolean hasDroppedBlock() {
|
||||
return this.droppedBlock;
|
||||
}
|
||||
|
||||
public void dropBlock() {
|
||||
this.droppedBlock = true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
package binnie.core.api.genetics;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import forestry.api.core.ForestryEvent;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.IClassification;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IMutation;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.api.genetics.ISpeciesType;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public interface IBreedingSystem {
|
||||
ISpeciesRoot getSpeciesRoot();
|
||||
|
||||
Collection<IAlleleSpecies> getAllSpecies();
|
||||
|
||||
Collection<IAlleleSpecies> getDiscoveredSpecies(World world, GameProfile player);
|
||||
|
||||
List<IClassification> getAllBranches();
|
||||
|
||||
Collection<IClassification> getDiscoveredBranches(World world, GameProfile player);
|
||||
|
||||
List<IMutation> getDiscoveredMutations(World world, GameProfile player);
|
||||
|
||||
List<IMutation> getResultantMutations(final IAlleleSpecies species);
|
||||
|
||||
List<IMutation> getFurtherMutations(final IAlleleSpecies species);
|
||||
|
||||
boolean isMutationDiscovered(IMutation mutation, World world, GameProfile name);
|
||||
|
||||
float getChance(IMutation mutation, EntityPlayer player, IAlleleSpecies firstSpecies, IAlleleSpecies secondSpecies);
|
||||
|
||||
String getAlleleName(final IChromosomeType chromosome, final IAllele allele);
|
||||
|
||||
String getChromosomeName(final IChromosomeType chromo);
|
||||
|
||||
String getChromosomeShortName(final IChromosomeType chromo);
|
||||
|
||||
@Nullable
|
||||
IIndividual getConversion(final ItemStack stack);
|
||||
|
||||
ItemStack getConversionStack(final ItemStack stack);
|
||||
|
||||
@Nullable
|
||||
IIndividual getIndividual(String uid);
|
||||
|
||||
void calculateArrays();
|
||||
|
||||
void addExtraAlleles(final IChromosomeType p0, final TreeSet<IAllele> p1);
|
||||
|
||||
String getDescriptor();
|
||||
|
||||
String getIdent();
|
||||
|
||||
ItemStack getItemStackRepresentitive();
|
||||
|
||||
int getColour();
|
||||
|
||||
int getDiscoveredSpeciesCount();
|
||||
|
||||
int getTotalSpeciesCount();
|
||||
|
||||
float getDiscoveredSpeciesPercentage();
|
||||
|
||||
int getTotalSecretCount();
|
||||
|
||||
int getDiscoveredSecretCount();
|
||||
|
||||
float getDiscoveredBranchPercentage();
|
||||
|
||||
int getTotalBranchCount();
|
||||
|
||||
int getDiscoveredBranchCount();
|
||||
|
||||
String getEpitome();
|
||||
|
||||
String getEpitome(float discoveredPercentage);
|
||||
|
||||
Collection<IMutation> getAllMutations();
|
||||
|
||||
void calculateAlleles(ISpeciesRoot speciesRoot);
|
||||
|
||||
void calculateBranches(ISpeciesRoot speciesRoot);
|
||||
|
||||
void calculateMutations(ISpeciesRoot speciesRoot);
|
||||
|
||||
boolean isBlacklisted(IAllele allele);
|
||||
|
||||
boolean isMutationDiscovered(IMutation mutation, IBreedingTracker tracker);
|
||||
|
||||
boolean isSpeciesDiscovered(IAlleleSpecies species, World world, GameProfile name);
|
||||
|
||||
boolean isSpeciesDiscovered(IAlleleSpecies species, IBreedingTracker tracker);
|
||||
|
||||
boolean isSecret(IAlleleSpecies species);
|
||||
|
||||
boolean isSecret(IClassification branch);
|
||||
|
||||
Collection<IClassification> getDiscoveredBranches(IBreedingTracker tracker);
|
||||
|
||||
Collection<IAlleleSpecies> getDiscoveredSpecies(IBreedingTracker tracker);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
TextureAtlasSprite getUndiscoveredIcon();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
TextureAtlasSprite getDiscoveredIcon();
|
||||
|
||||
Class<? extends IBreedingTracker> getTrackerClass();
|
||||
|
||||
@SubscribeEvent
|
||||
void onSyncBreedingTracker(ForestryEvent.SyncedBreedingTracker event);
|
||||
|
||||
void syncTracker(IBreedingTracker tracker);
|
||||
|
||||
void onSyncBreedingTracker(IBreedingTracker tracker);
|
||||
|
||||
String getName();
|
||||
|
||||
boolean isDNAManipulable(ItemStack stack);
|
||||
|
||||
boolean isDNAManipulable(ISpeciesType type);
|
||||
|
||||
IIndividual getDefaultIndividual();
|
||||
|
||||
ISpeciesType getDefaultType();
|
||||
|
||||
ISpeciesType[] getActiveTypes();
|
||||
|
||||
Collection<IChromosomeType> getActiveKaryotype();
|
||||
|
||||
ItemStack getDefaultMember(String uid);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package binnie.core.api;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
@@ -0,0 +1,7 @@
|
||||
package binnie.extrabees.api;
|
||||
|
||||
import binnie.core.api.genetics.IBreedingSystem;
|
||||
|
||||
public class ExtraBeesAPI {
|
||||
public static IBreedingSystem beeBreedingSystem;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package binnie.extratrees.api;
|
||||
|
||||
public class CarpentryManager {
|
||||
public static ICarpentryInterface carpentryInterface;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package binnie.extratrees.api;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface ICarpentryInterface {
|
||||
boolean registerCarpentryWood(final int index, final IDesignMaterial material);
|
||||
|
||||
int getCarpentryWoodIndex(final IDesignMaterial material);
|
||||
|
||||
IDesignMaterial getWoodMaterial(final int p0);
|
||||
|
||||
boolean registerDesign(final int p0, final IDesign p1);
|
||||
|
||||
int getDesignIndex(final IDesign p0);
|
||||
|
||||
IDesign getDesign(final int p0);
|
||||
|
||||
@Nullable
|
||||
IDesignMaterial getWoodMaterial(final ItemStack stack);
|
||||
|
||||
boolean registerDesignCategory(final IDesignCategory p0);
|
||||
|
||||
Collection<IDesignCategory> getAllDesignCategories();
|
||||
|
||||
List<IDesign> getSortedDesigns();
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package binnie.extratrees.api;
|
||||
|
||||
public interface IDesign {
|
||||
String getName();
|
||||
|
||||
ILayout getTopPattern();
|
||||
|
||||
ILayout getBottomPattern();
|
||||
|
||||
ILayout getNorthPattern();
|
||||
|
||||
ILayout getEastPattern();
|
||||
|
||||
ILayout getSouthPattern();
|
||||
|
||||
ILayout getWestPattern();
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package binnie.extratrees.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IDesignCategory {
|
||||
String getName();
|
||||
|
||||
List<IDesign> getDesigns();
|
||||
|
||||
void addDesign(final IDesign p0);
|
||||
|
||||
String getId();
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package binnie.extratrees.api;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IDesignMaterial {
|
||||
ItemStack getStack();
|
||||
|
||||
ItemStack getStack(boolean fireproof);
|
||||
|
||||
String getDesignMaterialName();
|
||||
|
||||
int getColour();
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package binnie.extratrees.api;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public interface IDesignSystem {
|
||||
@Nullable
|
||||
@SideOnly(Side.CLIENT)
|
||||
TextureAtlasSprite getPrimarySprite(final IPattern pattern);
|
||||
|
||||
@Nullable
|
||||
@SideOnly(Side.CLIENT)
|
||||
TextureAtlasSprite getSecondarySprite(final IPattern pattern);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
void registerSprites();
|
||||
|
||||
IDesignMaterial getDefaultMaterial();
|
||||
|
||||
@Nullable
|
||||
IDesignMaterial getMaterial(final int p0);
|
||||
|
||||
int getMaterialIndex(final IDesignMaterial p0);
|
||||
|
||||
IDesignMaterial getDefaultMaterial2();
|
||||
|
||||
ItemStack getAdhesive();
|
||||
|
||||
@Nullable
|
||||
IDesignMaterial getMaterial(final ItemStack p0);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package binnie.extratrees.api;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public interface ILayout {
|
||||
IPattern getPattern();
|
||||
|
||||
boolean isInverted();
|
||||
|
||||
ILayout rotateRight();
|
||||
|
||||
ILayout rotateLeft();
|
||||
|
||||
ILayout flipHorizontal();
|
||||
|
||||
ILayout flipVertical();
|
||||
|
||||
ILayout invert();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
TextureAtlasSprite getPrimarySprite(IDesignSystem system);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
TextureAtlasSprite getSecondarySprite(IDesignSystem system);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package binnie.extratrees.api;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.ISpriteRegister;
|
||||
|
||||
public interface IPattern extends ISpriteRegister {
|
||||
@SideOnly(Side.CLIENT)
|
||||
TextureAtlasSprite getPrimarySprite(IDesignSystem system);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
TextureAtlasSprite getSecondarySprite(IDesignSystem system);
|
||||
|
||||
ILayout getRotation();
|
||||
|
||||
ILayout getHorizontalFlip();
|
||||
|
||||
int getIndex();
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package binnie.extratrees.api;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IToolHammer {
|
||||
boolean isActive(final ItemStack p0);
|
||||
|
||||
void onHammerUsed(final ItemStack p0, final EntityPlayer p1);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package binnie.extratrees.api.carpentry;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import binnie.extratrees.api.IDesignSystem;
|
||||
|
||||
public final class DesignerManager {
|
||||
public static DesignerManager instance = new DesignerManager();
|
||||
|
||||
private final List<IDesignSystem> systems;
|
||||
|
||||
private DesignerManager() {
|
||||
this.systems = new ArrayList<>();
|
||||
}
|
||||
|
||||
public void registerDesignSystem(final IDesignSystem system) {
|
||||
this.systems.add(system);
|
||||
}
|
||||
|
||||
public Collection<IDesignSystem> getDesignSystems() {
|
||||
return this.systems;
|
||||
}
|
||||
|
||||
public void addDesignSystem(final IDesignSystem system) {
|
||||
this.systems.add(system);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,415 @@
|
||||
package binnie.extratrees.api.carpentry;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.ITextureManager;
|
||||
|
||||
import binnie.extratrees.api.IDesignSystem;
|
||||
import binnie.extratrees.api.ILayout;
|
||||
import binnie.extratrees.api.IPattern;
|
||||
|
||||
// TODO: move out of API
|
||||
public enum EnumPattern implements IPattern {
|
||||
Blank,
|
||||
Octagon,
|
||||
Diamond,
|
||||
Ringed,
|
||||
Squared,
|
||||
Multiply,
|
||||
Circle,
|
||||
Plus,
|
||||
Creeper,
|
||||
Creeper2,
|
||||
Creeper3,
|
||||
Creeper4,
|
||||
Halved,
|
||||
Halved2,
|
||||
Striped,
|
||||
Striped2,
|
||||
ThinStriped,
|
||||
ThinStriped2,
|
||||
Chequered,
|
||||
Tiled,
|
||||
VeryThinCorner,
|
||||
VeryThinCorner2,
|
||||
VeryThinCorner3,
|
||||
VeryThinCorner4,
|
||||
ThinCorner,
|
||||
ThinCorner2,
|
||||
ThinCorner3,
|
||||
ThinCorner4,
|
||||
Corner,
|
||||
Corner2,
|
||||
Corner3,
|
||||
Corner4,
|
||||
ThickCorner,
|
||||
ThickCorner2,
|
||||
ThickCorner3,
|
||||
ThickCorner4,
|
||||
ThinCurvedCorner,
|
||||
ThinCurvedCorner2,
|
||||
ThinCurvedCorner3,
|
||||
ThinCurvedCorner4,
|
||||
CurvedCorner,
|
||||
CurvedCorner2,
|
||||
CurvedCorner3,
|
||||
CurvedCorner4,
|
||||
Edged,
|
||||
Edged2,
|
||||
Edged3,
|
||||
Edged4,
|
||||
ThinEdged,
|
||||
ThinEdged2,
|
||||
ThinEdged3,
|
||||
ThinEdged4,
|
||||
ThinBarred,
|
||||
ThinBarred2,
|
||||
Barred,
|
||||
Barred2,
|
||||
ThickBarred,
|
||||
ThickBarred2,
|
||||
BarredEnd,
|
||||
BarredEnd2,
|
||||
BarredEnd3,
|
||||
BarredEnd4,
|
||||
OrnateBarred,
|
||||
OrnateBarred2,
|
||||
OrnateThinBarred,
|
||||
OrnateThinBarred2,
|
||||
SplitBarred,
|
||||
SplitBarred2,
|
||||
SplitBarredCorner,
|
||||
SplitBarredCorner2,
|
||||
SplitBarredCorner3,
|
||||
SplitBarredCorner4,
|
||||
SplitBarredTSection,
|
||||
SplitBarredTSection2,
|
||||
SplitBarredTSection3,
|
||||
SplitBarredTSection4,
|
||||
SplitCrossed,
|
||||
SplitBarredEnd,
|
||||
SplitBarredEnd2,
|
||||
SplitBarredEnd3,
|
||||
SplitBarredEnd4,
|
||||
Diagonal,
|
||||
Diagonal2,
|
||||
ThickDiagonal,
|
||||
ThickDiagonal2,
|
||||
DiagonalCorner,
|
||||
DiagonalCorner2,
|
||||
DiagonalCorner3,
|
||||
DiagonalCorner4,
|
||||
DiagonalTSection,
|
||||
DiagonalTSection2,
|
||||
DiagonalTSection3,
|
||||
DiagonalTSection4,
|
||||
DiagonalCurvedCorner,
|
||||
DiagonalCurvedCorner2,
|
||||
DiagonalCurvedCorner3,
|
||||
DiagonalCurvedCorner4,
|
||||
DiagonalCurvedTSection,
|
||||
DiagonalCurvedTSection2,
|
||||
DiagonalCurvedTSection3,
|
||||
DiagonalCurvedTSection4,
|
||||
DiagonalStriped,
|
||||
DiagonalStriped2,
|
||||
ThinDiagonalStriped,
|
||||
ThinDiagonalStriped2,
|
||||
ThinSaltire,
|
||||
Saltire,
|
||||
ThickSaltire,
|
||||
ThinCrossed,
|
||||
Crossed,
|
||||
ThickCrossed,
|
||||
ThinCurvedCrossed,
|
||||
ThinTSection,
|
||||
ThinTSection2,
|
||||
ThinTSection3,
|
||||
ThinTSection4,
|
||||
TSection,
|
||||
TSection2,
|
||||
TSection3,
|
||||
TSection4,
|
||||
ThickTSection,
|
||||
ThickTSection2,
|
||||
ThickTSection3,
|
||||
ThickTSection4,
|
||||
ThinCurvedTSection,
|
||||
ThinCurvedTSection2,
|
||||
ThinCurvedTSection3,
|
||||
ThinCurvedTSection4,
|
||||
CurvedTSection,
|
||||
CurvedTSection2,
|
||||
CurvedTSection3,
|
||||
CurvedTSection4,
|
||||
ThinBarredCorner,
|
||||
ThinBarredCorner2,
|
||||
ThinBarredCorner3,
|
||||
ThinBarredCorner4,
|
||||
BarredCorner,
|
||||
BarredCorner2,
|
||||
BarredCorner3,
|
||||
BarredCorner4,
|
||||
ThickBarredCorner,
|
||||
ThickBarredCorner2,
|
||||
ThickBarredCorner3,
|
||||
ThickBarredCorner4,
|
||||
ThinCurvedBarredCorner,
|
||||
ThinCurvedBarredCorner2,
|
||||
ThinCurvedBarredCorner3,
|
||||
ThinCurvedBarredCorner4,
|
||||
BarredCurvedCorner,
|
||||
BarredCurvedCorner2,
|
||||
BarredCurvedCorner3,
|
||||
BarredCurvedCorner4,
|
||||
ThinStripedCorner,
|
||||
ThinStripedCorner2,
|
||||
ThinStripedCorner3,
|
||||
ThinStripedCorner4,
|
||||
StripedCorner,
|
||||
StripedCorner2,
|
||||
StripedCorner3,
|
||||
StripedCorner4,
|
||||
OrnateStripedCorner,
|
||||
OrnateStripedCorner2,
|
||||
OrnateStripedCorner3,
|
||||
OrnateStripedCorner4,
|
||||
Emblem1,
|
||||
Emblem2,
|
||||
Emblem3,
|
||||
Emblem4,
|
||||
Emblem5,
|
||||
LetterA,
|
||||
LetterA2,
|
||||
LetterA3,
|
||||
LetterA4,
|
||||
LetterB,
|
||||
LetterB2,
|
||||
LetterB3,
|
||||
LetterB4,
|
||||
LetterF,
|
||||
LetterF2,
|
||||
LetterF3,
|
||||
LetterF4,
|
||||
LetterS,
|
||||
LetterS2,
|
||||
LetterS3,
|
||||
LetterS4,
|
||||
LetterT,
|
||||
LetterT2,
|
||||
LetterT3,
|
||||
LetterT4,
|
||||
DiagonalHalved,
|
||||
DiagonalHalved2,
|
||||
Diagonal1Edged,
|
||||
Diagonal1Edged2,
|
||||
Diagonal1Edged3,
|
||||
Diagonal1Edged4,
|
||||
Diagonal2Edged,
|
||||
Diagonal2Edged2,
|
||||
ThickDiagonal1Edged,
|
||||
ThickDiagonal1Edged2,
|
||||
ThickDiagonal1Edged3,
|
||||
ThickDiagonal1Edged4,
|
||||
ThinBarredEnd,
|
||||
ThinBarredEnd2,
|
||||
ThinBarredEnd3,
|
||||
ThinBarredEnd4,
|
||||
ThickBarredEnd,
|
||||
ThickBarredEnd2,
|
||||
ThickBarredEnd3,
|
||||
ThickBarredEnd4,
|
||||
OverlappedSplitBarred,
|
||||
OverlappedSplitBarred2,
|
||||
OverlappedBarred,
|
||||
OverlappedBarred2;
|
||||
|
||||
static {
|
||||
setupStripedPattern(EnumPattern.ThinStriped, EnumPattern.ThinStriped2);
|
||||
setupStripedPattern(EnumPattern.Striped, EnumPattern.Striped2);
|
||||
setupStripedPattern(EnumPattern.Halved, EnumPattern.Halved2);
|
||||
setupChequeredPattern(EnumPattern.Chequered);
|
||||
setupChequeredPattern(EnumPattern.Tiled);
|
||||
setupCornerPattern(EnumPattern.VeryThinCorner, EnumPattern.VeryThinCorner2, EnumPattern.VeryThinCorner3, EnumPattern.VeryThinCorner4);
|
||||
setupCornerPattern(EnumPattern.ThinCorner, EnumPattern.ThinCorner2, EnumPattern.ThinCorner3, EnumPattern.ThinCorner4);
|
||||
setupCornerPattern(EnumPattern.Corner, EnumPattern.Corner2, EnumPattern.Corner3, EnumPattern.Corner4);
|
||||
setupCornerPattern(EnumPattern.ThickCorner, EnumPattern.ThickCorner2, EnumPattern.ThickCorner3, EnumPattern.ThickCorner4);
|
||||
setupCornerPattern(EnumPattern.ThinCurvedCorner, EnumPattern.ThinCurvedCorner2, EnumPattern.ThinCurvedCorner3, EnumPattern.ThinCurvedCorner4);
|
||||
setupCornerPattern(EnumPattern.CurvedCorner, EnumPattern.CurvedCorner2, EnumPattern.CurvedCorner3, EnumPattern.CurvedCorner4);
|
||||
setupBarredPattern(EnumPattern.BarredEnd, EnumPattern.BarredEnd2, EnumPattern.BarredEnd3, EnumPattern.BarredEnd4);
|
||||
setupEdgedPattern(EnumPattern.ThinEdged, EnumPattern.ThinEdged2, EnumPattern.ThinEdged3, EnumPattern.ThinEdged4);
|
||||
setupEdgedPattern(EnumPattern.Edged, EnumPattern.Edged2, EnumPattern.Edged3, EnumPattern.Edged4);
|
||||
setupBarredPattern(EnumPattern.ThinBarred, EnumPattern.ThinBarred2);
|
||||
setupBarredPattern(EnumPattern.Barred, EnumPattern.Barred2);
|
||||
setupBarredPattern(EnumPattern.ThickBarred, EnumPattern.ThickBarred2);
|
||||
setupDiagonalPattern(EnumPattern.Diagonal, EnumPattern.Diagonal2);
|
||||
setupDiagonalPattern(EnumPattern.ThickDiagonal, EnumPattern.ThickDiagonal2);
|
||||
setupTSectionPattern(EnumPattern.ThinTSection, EnumPattern.ThinTSection2, EnumPattern.ThinTSection3, EnumPattern.ThinTSection4);
|
||||
setupTSectionPattern(EnumPattern.TSection, EnumPattern.TSection2, EnumPattern.TSection3, EnumPattern.TSection4);
|
||||
setupTSectionPattern(EnumPattern.ThickTSection, EnumPattern.ThickTSection2, EnumPattern.ThickTSection3, EnumPattern.ThickTSection4);
|
||||
setupTSectionPattern(EnumPattern.ThinCurvedTSection, EnumPattern.ThinCurvedTSection2, EnumPattern.ThinCurvedTSection3, EnumPattern.ThinCurvedTSection4);
|
||||
setupTSectionPattern(EnumPattern.CurvedTSection, EnumPattern.CurvedTSection2, EnumPattern.CurvedTSection3, EnumPattern.CurvedTSection4);
|
||||
setupCornerPattern(EnumPattern.ThinBarredCorner, EnumPattern.ThinBarredCorner2, EnumPattern.ThinBarredCorner3, EnumPattern.ThinBarredCorner4);
|
||||
setupCornerPattern(EnumPattern.BarredCorner, EnumPattern.BarredCorner2, EnumPattern.BarredCorner3, EnumPattern.BarredCorner4);
|
||||
setupCornerPattern(EnumPattern.ThickBarredCorner, EnumPattern.ThickBarredCorner2, EnumPattern.ThickBarredCorner3, EnumPattern.ThickBarredCorner4);
|
||||
setupCornerPattern(EnumPattern.ThinCurvedBarredCorner, EnumPattern.ThinCurvedBarredCorner2, EnumPattern.ThinCurvedBarredCorner3, EnumPattern.ThinCurvedBarredCorner4);
|
||||
setupCornerPattern(EnumPattern.BarredCurvedCorner, EnumPattern.BarredCurvedCorner2, EnumPattern.BarredCurvedCorner3, EnumPattern.BarredCurvedCorner4);
|
||||
setupCornerPattern(EnumPattern.ThinStripedCorner, EnumPattern.ThinStripedCorner2, EnumPattern.ThinStripedCorner3, EnumPattern.ThinStripedCorner4);
|
||||
setupCornerPattern(EnumPattern.StripedCorner, EnumPattern.StripedCorner2, EnumPattern.StripedCorner3, EnumPattern.StripedCorner4);
|
||||
setupCornerPattern(EnumPattern.OrnateStripedCorner, EnumPattern.OrnateStripedCorner2, EnumPattern.OrnateStripedCorner3, EnumPattern.OrnateStripedCorner4);
|
||||
setupRotation(EnumPattern.LetterA, EnumPattern.LetterA2, EnumPattern.LetterA3, EnumPattern.LetterA4);
|
||||
setupRotation(EnumPattern.LetterB, EnumPattern.LetterB2, EnumPattern.LetterB3, EnumPattern.LetterB4);
|
||||
setupRotation(EnumPattern.LetterF, EnumPattern.LetterF2, EnumPattern.LetterF3, EnumPattern.LetterF4);
|
||||
setupRotation(EnumPattern.LetterS, EnumPattern.LetterS2, EnumPattern.LetterS3, EnumPattern.LetterS4);
|
||||
setupRotation(EnumPattern.LetterT, EnumPattern.LetterT2, EnumPattern.LetterT3, EnumPattern.LetterT4);
|
||||
setupEdgedPattern(EnumPattern.DiagonalCorner, EnumPattern.DiagonalCorner2, EnumPattern.DiagonalCorner3, EnumPattern.DiagonalCorner4);
|
||||
setupCornerPattern(EnumPattern.DiagonalTSection, EnumPattern.DiagonalTSection2, EnumPattern.DiagonalTSection3, EnumPattern.DiagonalTSection4);
|
||||
setupEdgedPattern(EnumPattern.DiagonalCurvedCorner, EnumPattern.DiagonalCurvedCorner2, EnumPattern.DiagonalCurvedCorner3, EnumPattern.DiagonalCurvedCorner4);
|
||||
setupCornerPattern(EnumPattern.DiagonalCurvedTSection, EnumPattern.DiagonalCurvedTSection2, EnumPattern.DiagonalCurvedTSection3, EnumPattern.DiagonalCurvedTSection4);
|
||||
setupBarredPattern(EnumPattern.OrnateBarred, EnumPattern.OrnateBarred2);
|
||||
setupBarredPattern(EnumPattern.OrnateThinBarred, EnumPattern.OrnateThinBarred2);
|
||||
setupBarredPattern(EnumPattern.SplitBarred, EnumPattern.SplitBarred2);
|
||||
setupCornerPattern(EnumPattern.SplitBarredCorner, EnumPattern.SplitBarredCorner2, EnumPattern.SplitBarredCorner3, EnumPattern.SplitBarredCorner4);
|
||||
setupTSectionPattern(EnumPattern.SplitBarredTSection, EnumPattern.SplitBarredTSection2, EnumPattern.SplitBarredTSection3, EnumPattern.SplitBarredTSection4);
|
||||
setupBarredPattern(EnumPattern.SplitBarredEnd, EnumPattern.SplitBarredEnd2, EnumPattern.SplitBarredEnd3, EnumPattern.SplitBarredEnd4);
|
||||
setupRotation(EnumPattern.Creeper, EnumPattern.Creeper2, EnumPattern.Creeper3, EnumPattern.Creeper4);
|
||||
setupDiagonalPattern(EnumPattern.DiagonalStriped, EnumPattern.DiagonalStriped2);
|
||||
setupDiagonalPattern(EnumPattern.ThinDiagonalStriped, EnumPattern.ThinDiagonalStriped2);
|
||||
setupCornerPattern(EnumPattern.Diagonal1Edged, EnumPattern.Diagonal1Edged2, EnumPattern.Diagonal1Edged3, EnumPattern.Diagonal1Edged4);
|
||||
setupCornerPattern(EnumPattern.ThickDiagonal1Edged, EnumPattern.ThickDiagonal1Edged2, EnumPattern.ThickDiagonal1Edged3, EnumPattern.ThickDiagonal1Edged4);
|
||||
setupInvert2Rot(EnumPattern.DiagonalHalved, EnumPattern.DiagonalHalved2);
|
||||
set2Rotation(EnumPattern.Diagonal2Edged, EnumPattern.Diagonal2Edged2);
|
||||
setupBarredPattern(EnumPattern.ThinBarredEnd, EnumPattern.ThinBarredEnd2, EnumPattern.ThinBarredEnd3, EnumPattern.ThinBarredEnd4);
|
||||
setupBarredPattern(EnumPattern.ThickBarredEnd, EnumPattern.ThickBarredEnd2, EnumPattern.ThickBarredEnd3, EnumPattern.ThickBarredEnd4);
|
||||
EnumPattern.OverlappedBarred.setLeftRotation(EnumPattern.OverlappedBarred2, false);
|
||||
EnumPattern.OverlappedBarred2.setLeftRotation(EnumPattern.OverlappedBarred, false);
|
||||
EnumPattern.OverlappedSplitBarred.setLeftRotation(EnumPattern.OverlappedSplitBarred2, false);
|
||||
EnumPattern.OverlappedSplitBarred2.setLeftRotation(EnumPattern.OverlappedSplitBarred, false);
|
||||
}
|
||||
|
||||
ILayout leftRotation;
|
||||
ILayout horizontalFlip;
|
||||
|
||||
EnumPattern() {
|
||||
this.leftRotation = Layout.get(this, false);
|
||||
this.horizontalFlip = Layout.get(this, false);
|
||||
}
|
||||
|
||||
static void setupStripedPattern(final EnumPattern vert, final EnumPattern hori) {
|
||||
vert.setLeftRotation(hori, true);
|
||||
hori.setLeftRotation(vert, false);
|
||||
vert.setHorizontalFlip(vert, true);
|
||||
}
|
||||
|
||||
static void setupChequeredPattern(final EnumPattern cheq) {
|
||||
cheq.setLeftRotation(cheq, true);
|
||||
cheq.setHorizontalFlip(cheq, true);
|
||||
}
|
||||
|
||||
static void setupCornerPattern(final EnumPattern tl, final EnumPattern tr, final EnumPattern br, final EnumPattern bl) {
|
||||
tl.setLeftRotation(bl, false);
|
||||
tr.setLeftRotation(tl, false);
|
||||
br.setLeftRotation(tr, false);
|
||||
bl.setLeftRotation(br, false);
|
||||
tl.setHorizontalFlip(tr, false);
|
||||
bl.setHorizontalFlip(br, false);
|
||||
}
|
||||
|
||||
static void setupInvert2Rot(final EnumPattern a, final EnumPattern b) {
|
||||
a.setLeftRotation(b, true);
|
||||
b.setLeftRotation(a, false);
|
||||
a.setHorizontalFlip(b, false);
|
||||
}
|
||||
|
||||
static void set2Rotation(final EnumPattern a, final EnumPattern b) {
|
||||
a.setLeftRotation(b, false);
|
||||
b.setLeftRotation(a, false);
|
||||
a.setHorizontalFlip(b, false);
|
||||
}
|
||||
|
||||
static void setupBarredPattern(final EnumPattern vert, final EnumPattern hori) {
|
||||
vert.setLeftRotation(hori, false);
|
||||
hori.setLeftRotation(vert, false);
|
||||
}
|
||||
|
||||
static void setupEdgedPattern(final EnumPattern l, final EnumPattern t, final EnumPattern r, final EnumPattern b) {
|
||||
l.setLeftRotation(b, false);
|
||||
t.setLeftRotation(l, false);
|
||||
r.setLeftRotation(t, false);
|
||||
b.setLeftRotation(r, false);
|
||||
l.setHorizontalFlip(r, false);
|
||||
}
|
||||
|
||||
static void setupDiagonalPattern(final EnumPattern a, final EnumPattern b) {
|
||||
a.setLeftRotation(b, false);
|
||||
b.setLeftRotation(a, false);
|
||||
a.setHorizontalFlip(b, false);
|
||||
}
|
||||
|
||||
static void setupBarredPattern(final EnumPattern l, final EnumPattern t, final EnumPattern r, final EnumPattern b) {
|
||||
l.setLeftRotation(b, false);
|
||||
t.setLeftRotation(l, false);
|
||||
r.setLeftRotation(t, false);
|
||||
b.setLeftRotation(r, false);
|
||||
l.setHorizontalFlip(r, false);
|
||||
}
|
||||
|
||||
static void setupTSectionPattern(final EnumPattern l, final EnumPattern t, final EnumPattern r, final EnumPattern b) {
|
||||
setupEdgedPattern(l, t, r, b);
|
||||
}
|
||||
|
||||
private static void setupRotation(final EnumPattern t, final EnumPattern r, final EnumPattern b, final EnumPattern l) {
|
||||
setupEdgedPattern(l, t, r, b);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public TextureAtlasSprite getPrimarySprite(IDesignSystem system) {
|
||||
return system.getPrimarySprite(this);
|
||||
}
|
||||
|
||||
private void setHorizontalFlip(final EnumPattern pattern, final boolean inverted) {
|
||||
this.horizontalFlip = Layout.get(pattern, inverted);
|
||||
pattern.horizontalFlip = Layout.get(this, inverted);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public TextureAtlasSprite getSecondarySprite(IDesignSystem system) {
|
||||
return system.getSecondarySprite(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILayout getRotation() {
|
||||
return this.leftRotation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILayout getHorizontalFlip() {
|
||||
return this.horizontalFlip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIndex() {
|
||||
return ordinal();
|
||||
}
|
||||
|
||||
protected void setLeftRotation(final EnumPattern pattern, final boolean inverted) {
|
||||
this.leftRotation = Layout.get(pattern, inverted);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerSprites(ITextureManager manager) {
|
||||
}
|
||||
|
||||
public ILayout layout() {
|
||||
return this.layout(false);
|
||||
}
|
||||
|
||||
public ILayout layout(final boolean invert) {
|
||||
return Layout.get(this, invert);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package binnie.extratrees.api.carpentry;
|
||||
|
||||
import binnie.extratrees.api.IDesignSystem;
|
||||
|
||||
public interface IBlockDesign {
|
||||
IDesignSystem getDesignSystem();
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package binnie.extratrees.api.carpentry;
|
||||
|
||||
public interface IBlockDesignProperties {
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package binnie.extratrees.api.carpentry;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import binnie.extratrees.api.IDesignSystem;
|
||||
import binnie.extratrees.api.ILayout;
|
||||
import binnie.extratrees.api.IPattern;
|
||||
|
||||
public class Layout implements ILayout {
|
||||
IPattern pattern;
|
||||
boolean inverted;
|
||||
|
||||
private Layout(final IPattern pattern, final boolean inverted) {
|
||||
this.pattern = pattern;
|
||||
this.inverted = inverted;
|
||||
}
|
||||
|
||||
public static ILayout get(final IPattern pattern, final boolean inverted) {
|
||||
return new Layout(pattern, inverted);
|
||||
}
|
||||
|
||||
public static ILayout get(final IPattern pattern) {
|
||||
return new Layout(pattern, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPattern getPattern() {
|
||||
return this.pattern;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInverted() {
|
||||
return this.inverted;
|
||||
}
|
||||
|
||||
ILayout newLayout(final ILayout newLayout) {
|
||||
return new Layout(newLayout.getPattern(), this.inverted ^ newLayout.isInverted());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILayout rotateRight() {
|
||||
return this.rotateLeft().rotateLeft().rotateLeft();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILayout rotateLeft() {
|
||||
return this.newLayout(this.pattern.getRotation());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILayout flipHorizontal() {
|
||||
return this.newLayout(this.pattern.getHorizontalFlip());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILayout flipVertical() {
|
||||
return this.newLayout(this.pattern.getHorizontalFlip().rotateLeft().rotateLeft());
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public TextureAtlasSprite getPrimarySprite(IDesignSystem system) {
|
||||
return this.inverted ? this.pattern.getSecondarySprite(system) : this.pattern.getPrimarySprite(system);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public TextureAtlasSprite getSecondarySprite(IDesignSystem system) {
|
||||
return this.inverted ? this.pattern.getPrimarySprite(system) : this.pattern.getSecondarySprite(system);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILayout invert() {
|
||||
return new Layout(this.pattern, !this.inverted);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package binnie.extratrees.api;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
@@ -0,0 +1,15 @@
|
||||
package binnie.extratrees.api.recipes;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class ExtraTreesRecipeManager {
|
||||
|
||||
@Nullable
|
||||
public static IBreweryManager breweryManager;
|
||||
@Nullable
|
||||
public static ILumbermillManager lumbermillManager;
|
||||
@Nullable
|
||||
public static IFruitPressManager fruitPressManager;
|
||||
@Nullable
|
||||
public static IDistilleryManager distilleryManager;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package binnie.extratrees.api.recipes;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public interface IBreweryCrafting {
|
||||
|
||||
@Nullable
|
||||
FluidStack getInputFluid();
|
||||
|
||||
@Nullable
|
||||
ItemStack[] getInputGrains();
|
||||
|
||||
ItemStack getIngredient();
|
||||
|
||||
ItemStack getYeast();
|
||||
|
||||
boolean hasInputGrainsEmpty();
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package binnie.extratrees.api.recipes;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import binnie.core.api.ICraftingManager;
|
||||
|
||||
public interface IBreweryManager extends ICraftingManager<IBreweryRecipe> {
|
||||
|
||||
void addRecipe(FluidStack input, FluidStack output);
|
||||
|
||||
void addRecipe(FluidStack input, FluidStack output, ItemStack yeast);
|
||||
|
||||
void addGrainRecipe(String grainOreName, FluidStack output);
|
||||
|
||||
void addGrainRecipe(String grainOreName, FluidStack output, String ingredientOreName);
|
||||
|
||||
void addGrainRecipe(String grainOreName, FluidStack output, @Nullable String ingredientOreName, ItemStack yeast);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package binnie.extratrees.api.recipes;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import binnie.core.api.IBinnieRecipe;
|
||||
|
||||
public interface IBreweryRecipe extends IBinnieRecipe {
|
||||
@Nullable
|
||||
FluidStack getOutput(IBreweryCrafting crafting);
|
||||
|
||||
FluidStack getInput();
|
||||
|
||||
FluidStack getOutput();
|
||||
|
||||
boolean isIngredient(ItemStack itemStack);
|
||||
|
||||
List<ItemStack> getIngredients();
|
||||
|
||||
boolean isGrain(ItemStack itemStack);
|
||||
|
||||
List<ItemStack> getGrains();
|
||||
|
||||
ItemStack getYeast();
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package binnie.extratrees.api.recipes;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import binnie.core.api.ICraftingManager;
|
||||
|
||||
public interface IDistilleryManager extends ICraftingManager<IDistilleryRecipe> {
|
||||
|
||||
void addRecipe(FluidStack input, FluidStack output, int level);
|
||||
|
||||
Collection<IDistilleryRecipe> recipes(int level);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package binnie.extratrees.api.recipes;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import binnie.core.api.IBinnieRecipe;
|
||||
|
||||
public interface IDistilleryRecipe extends IBinnieRecipe {
|
||||
|
||||
FluidStack getInput();
|
||||
|
||||
FluidStack getOutput();
|
||||
|
||||
int getLevel();
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package binnie.extratrees.api.recipes;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import binnie.core.api.ICraftingManager;
|
||||
|
||||
public interface IFruitPressManager extends ICraftingManager<IFruitPressRecipe> {
|
||||
|
||||
void addRecipe(ItemStack input, FluidStack output);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package binnie.extratrees.api.recipes;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import binnie.core.api.IBinnieRecipe;
|
||||
|
||||
public interface IFruitPressRecipe extends IBinnieRecipe {
|
||||
|
||||
ItemStack getInput();
|
||||
|
||||
FluidStack getOutput();
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package binnie.extratrees.api.recipes;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import binnie.core.api.ICraftingManager;
|
||||
|
||||
public interface ILumbermillManager extends ICraftingManager<ILumbermillRecipe> {
|
||||
|
||||
void addRecipe(ItemStack input, ItemStack output);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package binnie.extratrees.api.recipes;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import binnie.core.api.IBinnieRecipe;
|
||||
|
||||
public interface ILumbermillRecipe extends IBinnieRecipe {
|
||||
|
||||
ItemStack getOutput();
|
||||
|
||||
ItemStack getInput();
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package binnie.extratrees.api.recipes;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
@@ -0,0 +1,21 @@
|
||||
package binnie.genetics.api;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import forestry.api.core.INbtReadable;
|
||||
import forestry.api.core.INbtWritable;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
|
||||
public interface IGene extends INbtReadable, INbtWritable {
|
||||
IChromosomeType getChromosome();
|
||||
|
||||
String getName();
|
||||
|
||||
ISpeciesRoot getSpeciesRoot();
|
||||
|
||||
IAllele getAllele();
|
||||
|
||||
NBTTagCompound getNBTTagCompound();
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package binnie.genetics.api;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IItemAnalysable {
|
||||
boolean isAnalysed(ItemStack stack);
|
||||
|
||||
ItemStack analyse(ItemStack stack);
|
||||
|
||||
@Deprecated
|
||||
float getAnalyseTimeMult(ItemStack stack);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package binnie.genetics.api;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
|
||||
public interface IItemChargeable {
|
||||
int getCharges(ItemStack stack);
|
||||
|
||||
int getMaxCharges(ItemStack stack);
|
||||
|
||||
@Nullable
|
||||
ISpeciesRoot getSpeciesRoot(ItemStack stack);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package binnie.genetics.api;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IItemSerum extends IItemChargeable {
|
||||
IGene[] getGenes(ItemStack stack);
|
||||
|
||||
@Nullable
|
||||
IGene getGene(ItemStack stack, int chromosome);
|
||||
|
||||
ItemStack addGene(ItemStack stack, IGene gene);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package binnie.genetics.api;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
Reference in new issue
Block a user