mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-26 15:03:14 +00:00
port to forestry 4.2
This commit is contained in:
1 parent
dbc5c1a564
commit
f969f63b66
3697 files changed
+78372
No files matched your search
@@ -0,0 +1,251 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extratrees.genetics;
|
||||
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
import java.util.EnumSet;
|
||||
import forestry.api.lepidopterology.EnumFlutterType;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import net.minecraft.world.World;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import binnie.core.Mods;
|
||||
import net.minecraft.init.Items;
|
||||
import forestry.api.lepidopterology.IButterflyRoot;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.core.IIconProvider;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import binnie.core.resource.ResourceType;
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
import binnie.Binnie;
|
||||
import java.util.HashMap;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import java.util.Map;
|
||||
import forestry.api.genetics.IClassification;
|
||||
import binnie.core.resource.BinnieResource;
|
||||
import forestry.api.lepidopterology.IAlleleButterflySpecies;
|
||||
|
||||
public enum ButterflySpecies implements IAlleleButterflySpecies
|
||||
{
|
||||
WhiteAdmiral("White Admiral", "Limenitis camilla", 16448250),
|
||||
PurpleEmperor("Purple Emperor", "Apatura iris", 4338374),
|
||||
RedAdmiral("Red Admiral", "Vanessa atalanta", 15101764),
|
||||
PaintedLady("Painted Lady", "Vanessa cardui", 15573064),
|
||||
SmallTortoiseshell("Small Tortoiseshell", "Aglais urticae", 15365387),
|
||||
CamberwellBeauty("Camberwell Beauty", "Aglais antiopa", 9806540),
|
||||
Peacock("Peacock", "Inachis io", 13842434),
|
||||
Wall("Wall", "Lasiommata megera", 15707678),
|
||||
CrimsonRose("Crimson Rose", "Atrophaneura hector", 16736891),
|
||||
KaiserIHind("Kaiser-i-Hind", "Teinopalpus imperialis", 7839808),
|
||||
GoldenBirdwing("Golden Birdwing", "Troides aeacus", 16374814),
|
||||
MarshFritillary("Marsh Fritillary", "Euphydryas aurinia", 16747520),
|
||||
PearlBorderedFritillary("Pearl-bordered Fritillary", "Boloria euphrosyne", 16747267),
|
||||
QueenOfSpainFritillary("Queen of Spain Fritillary", "Issoria lathonia", 16765247),
|
||||
SpeckledWood("Speckled Wood", "Pararge aegeria", 16119949),
|
||||
ScotchAngus("Scotch Angus", "Erebia aethiops", 12735523),
|
||||
Gatekeeper("Gatekeeper", "Pyronia tithonus", 16433962),
|
||||
MeadowBrown("Meadow Brown", "Maniola jurtina", 14914841),
|
||||
SmallHeath("Small Heath", "Coenonympha pamphilus", 16754226),
|
||||
Ringlet("Ringlet", "Aphantopus hyperantus", 9919799),
|
||||
Monarch("Monarch", "Danaus plexippus", 16757254),
|
||||
MarbledWhite("Marbled White", "Melanargia galathea", 15527148);
|
||||
|
||||
String name;
|
||||
String branchName;
|
||||
String scientific;
|
||||
BinnieResource texture;
|
||||
public IClassification branch;
|
||||
int colour;
|
||||
private Map<ItemStack, Float> butterflyLoot;
|
||||
private Map<ItemStack, Float> caterpillarLoot;
|
||||
|
||||
private ButterflySpecies(final String name, final String scientific, final int colour) {
|
||||
this.butterflyLoot = new HashMap<ItemStack, Float>();
|
||||
this.caterpillarLoot = new HashMap<ItemStack, Float>();
|
||||
this.name = name;
|
||||
this.branchName = scientific.split(" ")[0].toLowerCase();
|
||||
this.scientific = scientific.split(" ")[1];
|
||||
this.texture = Binnie.Resource.getPNG(ExtraTrees.instance, ResourceType.Entity, this.toString());
|
||||
this.colour = colour;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumTemperature getTemperature() {
|
||||
return EnumTemperature.NORMAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumHumidity getHumidity() {
|
||||
return EnumHumidity.NORMAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasEffect() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSecret() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCounted() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBinomial() {
|
||||
return this.scientific;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAuthority() {
|
||||
return "Binnie";
|
||||
}
|
||||
|
||||
@Override
|
||||
public IClassification getBranch() {
|
||||
return this.branch;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIconProvider getIconProvider() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUID() {
|
||||
return "extrabutterflies.species." + this.toString().toLowerCase();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDominant() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEntityTexture() {
|
||||
return this.texture.getResourceLocation().toString();
|
||||
}
|
||||
|
||||
public IAllele[] getTemplate() {
|
||||
final IAllele[] def = this.getRoot().getDefaultTemplate().clone();
|
||||
def[0] = this;
|
||||
return def;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IButterflyRoot getRoot() {
|
||||
return Binnie.Genetics.getButterflyRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getRarity() {
|
||||
return 0.5f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNocturnal() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconColour(final int renderPass) {
|
||||
return (renderPass > 0) ? 16777215 : this.colour;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<ItemStack, Float> getButterflyLoot() {
|
||||
return new HashMap<ItemStack, Float>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<ItemStack, Float> getCaterpillarLoot() {
|
||||
return new HashMap<ItemStack, Float>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComplexity() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getResearchSuitability(final ItemStack itemstack) {
|
||||
if (itemstack == null) {
|
||||
return 0.0f;
|
||||
}
|
||||
if (itemstack.getItem() == Items.glass_bottle) {
|
||||
return 0.9f;
|
||||
}
|
||||
for (final ItemStack stack : this.butterflyLoot.keySet()) {
|
||||
if (stack.isItemEqual(itemstack)) {
|
||||
return 1.0f;
|
||||
}
|
||||
}
|
||||
for (final ItemStack stack : this.caterpillarLoot.keySet()) {
|
||||
if (stack.isItemEqual(itemstack)) {
|
||||
return 1.0f;
|
||||
}
|
||||
}
|
||||
if (itemstack.getItem() == Mods.Forestry.item("honeyDrop")) {
|
||||
return 0.5f;
|
||||
}
|
||||
if (itemstack.getItem() == Mods.Forestry.item("honeydew")) {
|
||||
return 0.7f;
|
||||
}
|
||||
if (itemstack.getItem() == Mods.Forestry.item("beeComb")) {
|
||||
return 0.4f;
|
||||
}
|
||||
if (AlleleManager.alleleRegistry.isIndividual(itemstack)) {
|
||||
return 1.0f;
|
||||
}
|
||||
for (final Map.Entry<ItemStack, Float> entry : this.getRoot().getResearchCatalysts().entrySet()) {
|
||||
if (entry.getKey().isItemEqual(itemstack)) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] getResearchBounty(final World world, final GameProfile researcher, final IIndividual individual, final int bountyLevel) {
|
||||
return new ItemStack[] { this.getRoot().getMemberStack(individual.copy(), EnumFlutterType.SERUM.ordinal()) };
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumSet<BiomeDictionary.Type> getSpawnBiomes() {
|
||||
return EnumSet.noneOf(BiomeDictionary.Type.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean strictSpawnMatch() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getFlightDistance() {
|
||||
return 5.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return this.getUID();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extratrees.genetics;
|
||||
|
||||
import forestry.api.genetics.IFruitFamily;
|
||||
|
||||
public enum ExtraTreeFruitFamily implements IFruitFamily
|
||||
{
|
||||
Berry("Berries", "berry", "berri"),
|
||||
Citrus("Citrus", "citrus", "citrus");
|
||||
|
||||
String name;
|
||||
String uid;
|
||||
String scientific;
|
||||
|
||||
private ExtraTreeFruitFamily(final String name, final String uid, final String scientific) {
|
||||
this.name = name;
|
||||
this.uid = uid;
|
||||
this.scientific = scientific;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUID() {
|
||||
return "binnie.family." + this.uid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getScientific() {
|
||||
return this.scientific;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return this.name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,481 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extratrees.genetics;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockLog;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.Direction;
|
||||
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.arboriculture.EnumTreeChromosome;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import forestry.api.arboriculture.ITreeGenome;
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
|
||||
import forestry.api.arboriculture.IAlleleTreeSpecies;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import binnie.Binnie;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import forestry.arboriculture.FruitProviderNone;
|
||||
import forestry.arboriculture.genetics.alleles.AlleleTreeSpecies;
|
||||
import binnie.extratrees.config.ConfigurationMain;
|
||||
import binnie.extratrees.item.Food;
|
||||
|
||||
import net.minecraft.init.Items;
|
||||
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import binnie.extratrees.block.FruitPod;
|
||||
import forestry.api.genetics.IFruitFamily;
|
||||
import forestry.api.arboriculture.IFruitProvider;
|
||||
import forestry.api.arboriculture.IAlleleFruit;
|
||||
|
||||
public enum ExtraTreeFruitGene implements IAlleleFruit, IFruitProvider
|
||||
{
|
||||
Blackthorn(10, 7180062, 14561129, FruitSprite.Small),
|
||||
CherryPlum(10, 7180062, 15211595, FruitSprite.Small),
|
||||
Peach(10, 7180062, 16424995, FruitSprite.Average),
|
||||
Nectarine(10, 7180062, 16405795, FruitSprite.Average),
|
||||
Apricot(10, 7180062, 16437027, FruitSprite.Average),
|
||||
Almond(10, 7180062, 9364342, FruitSprite.Small),
|
||||
WildCherry(10, 7180062, 16711680, FruitSprite.Tiny),
|
||||
SourCherry(10, 7180062, 10225963, FruitSprite.Tiny),
|
||||
BlackCherry(10, 7180062, 4852249, FruitSprite.Tiny),
|
||||
Orange(10, 3665987, 16749578, FruitSprite.Average),
|
||||
Manderin(10, 3665987, 16749578, FruitSprite.Average),
|
||||
Tangerine(10, 3665987, 16749578, FruitSprite.Average),
|
||||
Satsuma(10, 3665987, 16749578, FruitSprite.Average),
|
||||
KeyLime(10, 3665987, 10223428, FruitSprite.Small),
|
||||
Lime(10, 3665987, 10223428, FruitSprite.Average),
|
||||
FingerLime(10, 3665987, 11156280, FruitSprite.Small),
|
||||
Pomelo(10, 3665987, 6083402, FruitSprite.Larger),
|
||||
Grapefruit(10, 3665987, 16749578, FruitSprite.Large),
|
||||
Kumquat(10, 3665987, 16749578, FruitSprite.Small),
|
||||
Citron(10, 3665987, 16772192, FruitSprite.Large),
|
||||
BuddhaHand(10, 3665987, 16772192, FruitSprite.Large),
|
||||
Apple(10, 7915859, 16193046, FruitSprite.Average),
|
||||
Crabapple(10, 7915859, 16760140, FruitSprite.Average),
|
||||
Banana("Banana", FruitPod.Banana),
|
||||
RedBanana("Red Banana", FruitPod.RedBanana),
|
||||
Plantain("Platain", FruitPod.Plantain),
|
||||
Hazelnut(7, 8223006, 14463606, FruitSprite.Small),
|
||||
Butternut(7, 11712336, 16102498, FruitSprite.Small),
|
||||
Beechnut(8, 14401148, 6241845, FruitSprite.Tiny),
|
||||
Pecan(8, 10660940, 15781769, FruitSprite.Small),
|
||||
BrazilNut(10, 5875561, 9852208, FruitSprite.Large),
|
||||
Fig(9, 14201186, 7094086, FruitSprite.Small),
|
||||
Acorn(6, 7516710, 11364893, FruitSprite.Tiny),
|
||||
Elderberry(9, 7444317, 5331779, FruitSprite.Tiny),
|
||||
Olive(9, 8887861, 6444842, FruitSprite.Small),
|
||||
GingkoNut(7, 9213787, 15063725, FruitSprite.Tiny),
|
||||
Coffee(8, 7433501, 16273254, FruitSprite.Tiny),
|
||||
Pear(10, 10456913, 10474833, FruitSprite.Pear),
|
||||
OsangeOsange(10, 9934674, 10665767, FruitSprite.Larger),
|
||||
Clove(9, 6847532, 11224133, FruitSprite.Tiny),
|
||||
Coconut("Coconut", FruitPod.Coconut),
|
||||
Cashew(8, 12879132, 15289111, FruitSprite.Average),
|
||||
Avacado(10, 10272370, 2170640, FruitSprite.Pear),
|
||||
Nutmeg(9, 14861101, 11305813, FruitSprite.Tiny),
|
||||
Allspice(9, 15180922, 7423542, FruitSprite.Tiny),
|
||||
Chilli(10, 7430757, 15145010, FruitSprite.Small),
|
||||
StarAnise(8, 8733742, 13917189, FruitSprite.Tiny),
|
||||
Mango(10, 6654997, 15902262, FruitSprite.Average),
|
||||
Starfruit(10, 9814541, 15061550, FruitSprite.Average),
|
||||
Candlenut(8, 8235123, 14600882, FruitSprite.Small),
|
||||
Papayimar("Papayimar", FruitPod.Papayimar),
|
||||
Blackcurrant(8, 9407571, 4935251, FruitSprite.Tiny),
|
||||
Redcurrant(8, 13008910, 15080974, FruitSprite.Tiny),
|
||||
Blackberry(8, 9399665, 4801393, FruitSprite.Tiny),
|
||||
Raspberry(8, 15520197, 14510449, FruitSprite.Tiny),
|
||||
Blueberry(8, 10203799, 6329278, FruitSprite.Tiny),
|
||||
Cranberry(8, 12232496, 14555696, FruitSprite.Tiny),
|
||||
Juniper(8, 10194034, 6316914, FruitSprite.Tiny),
|
||||
Gooseberry(8, 12164944, 12177232, FruitSprite.Tiny),
|
||||
GoldenRaspberry(8, 12496955, 15970363, FruitSprite.Tiny);
|
||||
|
||||
IFruitFamily family;
|
||||
boolean isRipening;
|
||||
int diffR;
|
||||
int diffG;
|
||||
int diffB;
|
||||
FruitPod pod;
|
||||
int ripeningPeriod;
|
||||
int colourUnripe;
|
||||
int colour;
|
||||
FruitSprite index;
|
||||
HashMap<ItemStack, Float> products;
|
||||
|
||||
public static void init() {
|
||||
final IFruitFamily familyPrune = AlleleManager.alleleRegistry.getFruitFamily("forestry.prunes");
|
||||
final IFruitFamily familyPome = AlleleManager.alleleRegistry.getFruitFamily("forestry.pomes");
|
||||
final IFruitFamily familyJungle = AlleleManager.alleleRegistry.getFruitFamily("forestry.jungle");
|
||||
final IFruitFamily familyNuts = AlleleManager.alleleRegistry.getFruitFamily("forestry.nuts");
|
||||
final IFruitFamily familyBerry = ExtraTreeFruitFamily.Berry;
|
||||
final IFruitFamily familyCitrus = ExtraTreeFruitFamily.Citrus;
|
||||
AlleleManager.alleleRegistry.registerFruitFamily(familyBerry);
|
||||
AlleleManager.alleleRegistry.registerFruitFamily(familyCitrus);
|
||||
ExtraTreeFruitGene.Apple.addProduct(new ItemStack(Items.apple), 1.0f);
|
||||
ExtraTreeFruitGene.Apple.setFamily(familyPome);
|
||||
ExtraTreeFruitGene.Crabapple.addProduct(Food.Crabapple.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.Crabapple.setFamily(familyPome);
|
||||
ExtraTreeFruitGene.Orange.addProduct(Food.Orange.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.Orange.setFamily(familyCitrus);
|
||||
ExtraTreeFruitGene.Manderin.addProduct(Food.Manderin.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.Manderin.setFamily(familyCitrus);
|
||||
ExtraTreeFruitGene.Tangerine.addProduct(Food.Tangerine.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.Tangerine.setFamily(familyCitrus);
|
||||
ExtraTreeFruitGene.Satsuma.addProduct(Food.Satsuma.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.Satsuma.setFamily(familyCitrus);
|
||||
ExtraTreeFruitGene.KeyLime.addProduct(Food.KeyLime.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.KeyLime.setFamily(familyCitrus);
|
||||
ExtraTreeFruitGene.Lime.addProduct(Food.Lime.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.Lime.setFamily(familyCitrus);
|
||||
ExtraTreeFruitGene.FingerLime.addProduct(Food.FingerLime.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.FingerLime.setFamily(familyCitrus);
|
||||
ExtraTreeFruitGene.Pomelo.addProduct(Food.Pomelo.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.Pomelo.setFamily(familyCitrus);
|
||||
ExtraTreeFruitGene.Grapefruit.addProduct(Food.Grapefruit.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.Grapefruit.setFamily(familyCitrus);
|
||||
ExtraTreeFruitGene.Kumquat.addProduct(Food.Kumquat.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.Kumquat.setFamily(familyCitrus);
|
||||
ExtraTreeFruitGene.Citron.addProduct(Food.Citron.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.Citron.setFamily(familyCitrus);
|
||||
ExtraTreeFruitGene.BuddhaHand.addProduct(Food.BuddhaHand.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.BuddhaHand.setFamily(familyCitrus);
|
||||
ExtraTreeFruitGene.Blackthorn.addProduct(Food.Blackthorn.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.Blackthorn.setFamily(familyPrune);
|
||||
ExtraTreeFruitGene.CherryPlum.addProduct(Food.CherryPlum.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.CherryPlum.setFamily(familyPrune);
|
||||
ExtraTreeFruitGene.Peach.addProduct(Food.Peach.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.Peach.setFamily(familyPrune);
|
||||
ExtraTreeFruitGene.Nectarine.addProduct(Food.Nectarine.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.Nectarine.setFamily(familyPrune);
|
||||
ExtraTreeFruitGene.Apricot.addProduct(Food.Apricot.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.Apricot.setFamily(familyPrune);
|
||||
ExtraTreeFruitGene.Almond.addProduct(Food.Almond.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.Almond.setFamily(familyPrune);
|
||||
ExtraTreeFruitGene.WildCherry.addProduct(Food.WildCherry.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.WildCherry.setFamily(familyPrune);
|
||||
ExtraTreeFruitGene.SourCherry.addProduct(Food.SourCherry.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.SourCherry.setFamily(familyPrune);
|
||||
ExtraTreeFruitGene.BlackCherry.addProduct(Food.BlackCherry.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.BlackCherry.setFamily(familyPrune);
|
||||
ExtraTreeFruitGene.Hazelnut.addProduct(Food.Hazelnut.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.Hazelnut.setFamily(familyNuts);
|
||||
ExtraTreeFruitGene.Butternut.addProduct(Food.Butternut.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.Butternut.setFamily(familyNuts);
|
||||
ExtraTreeFruitGene.Beechnut.addProduct(Food.Beechnut.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.Beechnut.setFamily(familyNuts);
|
||||
ExtraTreeFruitGene.Pecan.addProduct(Food.Pecan.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.Pecan.setFamily(familyNuts);
|
||||
ExtraTreeFruitGene.Banana.addProduct(Food.Banana.get(2), 1.0f);
|
||||
ExtraTreeFruitGene.Banana.setFamily(familyJungle);
|
||||
ExtraTreeFruitGene.RedBanana.addProduct(Food.RedBanana.get(2), 1.0f);
|
||||
ExtraTreeFruitGene.RedBanana.setFamily(familyJungle);
|
||||
ExtraTreeFruitGene.Plantain.addProduct(Food.Plantain.get(2), 1.0f);
|
||||
ExtraTreeFruitGene.Plantain.setFamily(familyJungle);
|
||||
ExtraTreeFruitGene.BrazilNut.addProduct(Food.BrazilNut.get(4), 1.0f);
|
||||
ExtraTreeFruitGene.BrazilNut.setFamily(familyNuts);
|
||||
ExtraTreeFruitGene.Fig.addProduct(Food.Fig.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.Fig.setFamily(familyPrune);
|
||||
ExtraTreeFruitGene.Acorn.addProduct(Food.Acorn.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.Acorn.setFamily(familyNuts);
|
||||
ExtraTreeFruitGene.Elderberry.addProduct(Food.Elderberry.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.Elderberry.setFamily(familyPrune);
|
||||
ExtraTreeFruitGene.Olive.addProduct(Food.Olive.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.Olive.setFamily(familyPrune);
|
||||
ExtraTreeFruitGene.GingkoNut.addProduct(Food.GingkoNut.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.GingkoNut.setFamily(familyNuts);
|
||||
ExtraTreeFruitGene.Coffee.addProduct(Food.Coffee.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.Coffee.setFamily(familyJungle);
|
||||
ExtraTreeFruitGene.Pear.addProduct(Food.Pear.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.Pear.setFamily(familyPome);
|
||||
ExtraTreeFruitGene.OsangeOsange.addProduct(Food.OsangeOrange.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.OsangeOsange.setFamily(familyPome);
|
||||
ExtraTreeFruitGene.Clove.addProduct(Food.Clove.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.Clove.setFamily(familyNuts);
|
||||
ExtraTreeFruitGene.Blackcurrant.addProduct(Food.Blackcurrant.get(2), 1.0f);
|
||||
ExtraTreeFruitGene.Blackcurrant.setFamily(familyBerry);
|
||||
ExtraTreeFruitGene.Redcurrant.addProduct(Food.Redcurrant.get(2), 1.0f);
|
||||
ExtraTreeFruitGene.Redcurrant.setFamily(familyBerry);
|
||||
ExtraTreeFruitGene.Blackberry.addProduct(Food.Blackberry.get(2), 1.0f);
|
||||
ExtraTreeFruitGene.Blackberry.setFamily(familyBerry);
|
||||
ExtraTreeFruitGene.Raspberry.addProduct(Food.Raspberry.get(2), 1.0f);
|
||||
ExtraTreeFruitGene.Raspberry.setFamily(familyBerry);
|
||||
ExtraTreeFruitGene.Blueberry.addProduct(Food.Blueberry.get(2), 1.0f);
|
||||
ExtraTreeFruitGene.Blueberry.setFamily(familyBerry);
|
||||
ExtraTreeFruitGene.Cranberry.addProduct(Food.Cranberry.get(2), 1.0f);
|
||||
ExtraTreeFruitGene.Cranberry.setFamily(familyBerry);
|
||||
ExtraTreeFruitGene.Juniper.addProduct(Food.Juniper.get(2), 1.0f);
|
||||
ExtraTreeFruitGene.Juniper.setFamily(familyBerry);
|
||||
ExtraTreeFruitGene.Gooseberry.addProduct(Food.Gooseberry.get(2), 1.0f);
|
||||
ExtraTreeFruitGene.Gooseberry.setFamily(familyBerry);
|
||||
ExtraTreeFruitGene.GoldenRaspberry.addProduct(Food.GoldenRaspberry.get(2), 1.0f);
|
||||
ExtraTreeFruitGene.GoldenRaspberry.setFamily(familyBerry);
|
||||
ExtraTreeFruitGene.Coconut.addProduct(Food.Coconut.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.Coconut.setFamily(familyJungle);
|
||||
ExtraTreeFruitGene.Cashew.addProduct(Food.Cashew.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.Cashew.setFamily(familyJungle);
|
||||
ExtraTreeFruitGene.Avacado.addProduct(Food.Avacado.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.Avacado.setFamily(familyJungle);
|
||||
ExtraTreeFruitGene.Nutmeg.addProduct(Food.Nutmeg.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.Nutmeg.setFamily(familyJungle);
|
||||
ExtraTreeFruitGene.Allspice.addProduct(Food.Allspice.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.Allspice.setFamily(familyJungle);
|
||||
ExtraTreeFruitGene.Chilli.addProduct(Food.Chilli.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.Chilli.setFamily(familyJungle);
|
||||
ExtraTreeFruitGene.StarAnise.addProduct(Food.StarAnise.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.StarAnise.setFamily(familyJungle);
|
||||
ExtraTreeFruitGene.Mango.addProduct(Food.Mango.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.Mango.setFamily(familyPome);
|
||||
ExtraTreeFruitGene.Starfruit.addProduct(Food.Starfruit.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.Starfruit.setFamily(familyJungle);
|
||||
ExtraTreeFruitGene.Candlenut.addProduct(Food.Candlenut.get(1), 1.0f);
|
||||
ExtraTreeFruitGene.Candlenut.setFamily(familyJungle);
|
||||
if (ConfigurationMain.alterLemon) {
|
||||
try {
|
||||
final IAlleleFruit lemon = (IAlleleFruit) AlleleManager.alleleRegistry.getAllele("forestry.fruitLemon");
|
||||
final FruitProviderNone prov = (FruitProviderNone) lemon.getProvider();
|
||||
final Field f = FruitProviderNone.class.getDeclaredField("family");
|
||||
final Field modifiersField = Field.class.getDeclaredField("modifiers");
|
||||
f.setAccessible(true);
|
||||
modifiersField.setAccessible(true);
|
||||
modifiersField.setInt(f, f.getModifiers() & 0xFFFFFFEF);
|
||||
f.set(prov, familyCitrus);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
for (final IAlleleSpecies tree : Binnie.Genetics.treeBreedingSystem.getAllSpecies()) {
|
||||
if (tree instanceof AlleleTreeSpecies && ((IAlleleTreeSpecies) tree).getSuitableFruit().contains(familyPrune)) {
|
||||
((AlleleTreeSpecies) tree).addFruitFamily(familyCitrus);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setFamily(final IFruitFamily family) {
|
||||
this.family = family;
|
||||
}
|
||||
|
||||
private ExtraTreeFruitGene(final int time, final int unripe, final int colour, final FruitSprite index) {
|
||||
this.isRipening = false;
|
||||
this.diffB = 0;
|
||||
this.pod = null;
|
||||
this.ripeningPeriod = 0;
|
||||
this.products = new HashMap<ItemStack, Float>();
|
||||
this.colour = colour;
|
||||
this.index = index;
|
||||
this.setRipening(time, unripe);
|
||||
}
|
||||
|
||||
private ExtraTreeFruitGene(final String name, final FruitPod pod) {
|
||||
this.isRipening = false;
|
||||
this.diffB = 0;
|
||||
this.pod = null;
|
||||
this.ripeningPeriod = 0;
|
||||
this.products = new HashMap<ItemStack, Float>();
|
||||
this.pod = pod;
|
||||
this.ripeningPeriod = 2;
|
||||
}
|
||||
|
||||
public void setRipening(final int time, final int unripe) {
|
||||
this.ripeningPeriod = time;
|
||||
this.colourUnripe = unripe;
|
||||
this.isRipening = true;
|
||||
this.diffR = (this.colour >> 16 & 0xFF) - (unripe >> 16 & 0xFF);
|
||||
this.diffG = (this.colour >> 8 & 0xFF) - (unripe >> 8 & 0xFF);
|
||||
this.diffB = (this.colour & 0xFF) - (unripe & 0xFF);
|
||||
}
|
||||
|
||||
public void addProduct(final ItemStack product, final float chance) {
|
||||
this.products.put(product, chance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUID() {
|
||||
return "extratrees.fruit." + this.toString().toLowerCase();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDominant() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFruitProvider getProvider() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] getProducts() {
|
||||
return this.products.keySet().toArray(new ItemStack[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] getSpecialty() {
|
||||
return new ItemStack[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return ExtraTrees.proxy.localise("item.food." + this.name().toLowerCase());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFruitFamily getFamily() {
|
||||
return this.family;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColour(final ITreeGenome genome, final IBlockAccess world, final int x, final int y, final int z, final int ripeningTime) {
|
||||
if (!this.isRipening) {
|
||||
return this.colour;
|
||||
}
|
||||
final float stage = this.getRipeningStage(ripeningTime);
|
||||
final int r = (this.colourUnripe >> 16 & 0xFF) + (int) (this.diffR * stage);
|
||||
final int g = (this.colourUnripe >> 8 & 0xFF) + (int) (this.diffG * stage);
|
||||
final int b = (this.colourUnripe & 0xFF) + (int) (this.diffB * stage);
|
||||
return (r & 0xFF) << 16 | (g & 0xFF) << 8 | (b & 0xFF);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean markAsFruitLeaf(final ITreeGenome genome, final World world, final int x, final int y, final int z) {
|
||||
return this.pod == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRipeningPeriod() {
|
||||
return this.ripeningPeriod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] getFruits(final ITreeGenome genome, final World world, final int x, final int y, final int z, final int ripeningTime) {
|
||||
if (this.pod != null) {
|
||||
if (ripeningTime >= 2) {
|
||||
final List<ItemStack> product = new ArrayList<ItemStack>();
|
||||
for (final Map.Entry<ItemStack, Float> entry : this.products.entrySet()) {
|
||||
final ItemStack single = entry.getKey().copy();
|
||||
single.stackSize = 1;
|
||||
for (int i = 0; i < entry.getKey().stackSize; ++i) {
|
||||
if (world.rand.nextFloat() <= entry.getValue()) {
|
||||
product.add(single.copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
return product.toArray(new ItemStack[0]);
|
||||
}
|
||||
return new ItemStack[0];
|
||||
}
|
||||
else {
|
||||
final ArrayList<ItemStack> product2 = new ArrayList<ItemStack>();
|
||||
final float stage = this.getRipeningStage(ripeningTime);
|
||||
if (stage < 0.5f) {
|
||||
return new ItemStack[0];
|
||||
}
|
||||
final float modeYieldMod = 1.0f;
|
||||
for (final Map.Entry<ItemStack, Float> entry2 : this.products.entrySet()) {
|
||||
if (world.rand.nextFloat() <= genome.getYield() * modeYieldMod * entry2.getValue() * 5.0f * stage) {
|
||||
product2.add(entry2.getKey().copy());
|
||||
}
|
||||
}
|
||||
return product2.toArray(new ItemStack[0]);
|
||||
}
|
||||
}
|
||||
|
||||
private float getRipeningStage(final int ripeningTime) {
|
||||
if (ripeningTime >= this.ripeningPeriod) {
|
||||
return 1.0f;
|
||||
}
|
||||
return ripeningTime / this.ripeningPeriod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresFruitBlocks() {
|
||||
return this.pod != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean trySpawnFruitBlock(final ITreeGenome genome, final World world, final int x, final int y, final int z) {
|
||||
return this.pod != null && world.rand.nextFloat() <= genome.getSappiness() && Binnie.Genetics.getTreeRoot().setFruitBlock(world, (IAlleleFruit) genome.getActiveAllele(EnumTreeChromosome.FRUITS), genome.getSappiness(), this.pod.getTextures(), x, y, z);
|
||||
}
|
||||
|
||||
public boolean setFruitBlock(final World world, final IAlleleFruit allele, final float sappiness, final int x, final int y, final int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static int getDirectionalMetadata(final World world, final int x, final int y, final int z) {
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
if (isValidPot(world, x, y, z, i)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static boolean isValidPot(final World world, int x, final int y, int z, final int notchDirection) {
|
||||
x += Direction.offsetX[notchDirection];
|
||||
z += Direction.offsetZ[notchDirection];
|
||||
final Block block = world.getBlock(x, y, z);
|
||||
if (block == Blocks.log || block == Blocks.log2) {
|
||||
return BlockLog.func_150165_c(world.getBlockMetadata(x, y, z)) == 3;
|
||||
}
|
||||
return block != null && block.isWood(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public short getIconIndex(final ITreeGenome genome, final IBlockAccess world, final int x, final int y, final int z, final int ripeningTime, final boolean fancy) {
|
||||
return this.index.getIndex();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(final IIconRegister register) {
|
||||
if (this.ordinal() == 0) {
|
||||
for (final FruitSprite sprite : FruitSprite.values()) {
|
||||
sprite.registerIcons(register);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.getDescription();
|
||||
}
|
||||
|
||||
public String getNameOfFruit() {
|
||||
if (this == ExtraTreeFruitGene.Apple) {
|
||||
return "Apple";
|
||||
}
|
||||
for (final ItemStack stack : this.products.keySet()) {
|
||||
if (stack.getItem() == ExtraTrees.itemFood) {
|
||||
return Food.values()[stack.getItemDamage()].toString();
|
||||
}
|
||||
}
|
||||
return "NoFruit";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return this.getUID();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extratrees.genetics;
|
||||
|
||||
import forestry.api.arboriculture.EnumGrowthConditions;
|
||||
import net.minecraft.world.World;
|
||||
import forestry.api.arboriculture.ITreeGenome;
|
||||
import forestry.api.arboriculture.IGrowthProvider;
|
||||
import forestry.api.arboriculture.IAlleleGrowth;
|
||||
|
||||
public class ExtraTreeGrowthProvider implements IAlleleGrowth, IGrowthProvider
|
||||
{
|
||||
@Override
|
||||
public String getUID() {
|
||||
return "extratrees.fruit." + this.toString().toLowerCase();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDominant() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGrowthProvider getProvider() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canGrow(final ITreeGenome genome, final World world, final int xPos, final int yPos, final int zPos, final int expectedGirth, final int expectedHeight) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumGrowthConditions getGrowthConditions(final ITreeGenome genome, final World world, final int xPos, final int yPos, final int zPos) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getInfo() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.getProvider().getDescription();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return this.getUID();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,268 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extratrees.genetics;
|
||||
|
||||
import forestry.api.arboriculture.ITreeGenome;
|
||||
import forestry.api.arboriculture.ITreeRoot;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.genetics.IMutation;
|
||||
import binnie.Binnie;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.arboriculture.IAlleleTreeSpecies;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.arboriculture.ITreeMutation;
|
||||
|
||||
public class ExtraTreeMutation implements ITreeMutation
|
||||
{
|
||||
int chance;
|
||||
boolean isSecret;
|
||||
IAlleleTreeSpecies allele0;
|
||||
IAlleleTreeSpecies allele1;
|
||||
IAllele[] template;
|
||||
private float minTemperature;
|
||||
private float maxTemperature;
|
||||
private float minRainfall;
|
||||
private float maxRainfall;
|
||||
private float height;
|
||||
|
||||
public static void init() {
|
||||
final IAlleleTreeSpecies lemon = (IAlleleTreeSpecies) getVanilla("Lemon");
|
||||
new ExtraTreeMutation(getVanilla("Cherry"), lemon, ExtraTreeSpecies.KeyLime, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.KeyLime, lemon, ExtraTreeSpecies.FingerLime, 10);
|
||||
new ExtraTreeMutation(getVanilla("Cherry"), lemon, ExtraTreeSpecies.Pomelo, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.Pomelo, getVanilla("Cherry"), ExtraTreeSpecies.Manderin, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.Pomelo, lemon, ExtraTreeSpecies.Citron, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.Manderin, getVanilla("Cherry"), ExtraTreeSpecies.Kumquat, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.Pomelo, ExtraTreeSpecies.Manderin, ExtraTreeSpecies.Orange, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.Citron, ExtraTreeSpecies.Manderin, ExtraTreeSpecies.BuddhaHand, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.Kumquat, ExtraTreeSpecies.Manderin, ExtraTreeSpecies.Tangerine, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.Kumquat, ExtraTreeSpecies.Manderin, ExtraTreeSpecies.Satsuma, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.Pomelo, ExtraTreeSpecies.Orange, ExtraTreeSpecies.Grapefruit, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.Pomelo, ExtraTreeSpecies.KeyLime, ExtraTreeSpecies.Lime, 10);
|
||||
new ExtraTreeMutation(getVanilla("Oak"), getVanilla("Cherry"), ExtraTreeSpecies.OrchardApple, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.OrchardApple, getVanilla("Maple"), ExtraTreeSpecies.SweetCrabapple, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.OrchardApple, ExtraTreeSpecies.SweetCrabapple, ExtraTreeSpecies.FloweringCrabapple, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.OrchardApple, getVanilla("Birch"), ExtraTreeSpecies.PrairieCrabapple, 10);
|
||||
new ExtraTreeMutation(getVanilla("Plum"), ExtraTreeSpecies.OrchardApple, ExtraTreeSpecies.Blackthorn, 10);
|
||||
new ExtraTreeMutation(getVanilla("Plum"), getVanilla("Cherry"), ExtraTreeSpecies.CherryPlum, 10);
|
||||
new ExtraTreeMutation(getVanilla("Plum"), getVanilla("Chestnut"), ExtraTreeSpecies.Peach, 10);
|
||||
new ExtraTreeMutation(getVanilla("Plum"), ExtraTreeSpecies.Peach, ExtraTreeSpecies.Nectarine, 10);
|
||||
new ExtraTreeMutation(getVanilla("Plum"), ExtraTreeSpecies.Peach, ExtraTreeSpecies.Apricot, 10);
|
||||
new ExtraTreeMutation(getVanilla("Plum"), getVanilla("Walnut"), ExtraTreeSpecies.Almond, 10);
|
||||
new ExtraTreeMutation(getVanilla("Lime"), getVanilla("Cherry"), ExtraTreeSpecies.WildCherry, 10);
|
||||
new ExtraTreeMutation(getVanilla("Willow"), getVanilla("Cherry"), ExtraTreeSpecies.SourCherry, 10);
|
||||
new ExtraTreeMutation(getVanilla("Ebony"), getVanilla("Cherry"), ExtraTreeSpecies.BlackCherry, 10);
|
||||
new ExtraTreeMutation(getVanilla("Balsa"), getVanilla("Jungle"), ExtraTreeSpecies.Banana, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.Banana, getVanilla("Kapok"), ExtraTreeSpecies.RedBanana, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.Banana, getVanilla("Teak"), ExtraTreeSpecies.Plantain, 10);
|
||||
new ExtraTreeMutation(getVanilla("Birch"), getVanilla("Oak"), ExtraTreeSpecies.Beech, 10);
|
||||
new ExtraTreeMutation(getVanilla("Birch"), ExtraTreeSpecies.Beech, ExtraTreeSpecies.Alder, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.Alder, ExtraTreeSpecies.Beech, ExtraTreeSpecies.Aspen, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.Aspen, ExtraTreeSpecies.Alder, ExtraTreeSpecies.Rowan, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.Beech, ExtraTreeSpecies.Aspen, ExtraTreeSpecies.Hazel, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.Beech, ExtraTreeSpecies.Rowan, ExtraTreeSpecies.Hawthorn, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.Alder, ExtraTreeSpecies.Aspen, ExtraTreeSpecies.Elder, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.Alder, ExtraTreeSpecies.Rowan, ExtraTreeSpecies.Holly, 10);
|
||||
new ExtraTreeMutation(getVanilla("Willow"), ExtraTreeSpecies.Aspen, ExtraTreeSpecies.Sallow, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.Beech, getVanilla("Birch"), ExtraTreeSpecies.Pecan, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.Beech, getVanilla("Spruce"), ExtraTreeSpecies.CopperBeech, 10);
|
||||
new ExtraTreeMutation(getVanilla("Lime"), getVanilla("Spruce"), ExtraTreeSpecies.Ash, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.Ash, getVanilla("Birch"), ExtraTreeSpecies.Whitebeam, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.Ash, getVanilla("Pine"), ExtraTreeSpecies.Elm, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.Ash, getVanilla("Larch"), ExtraTreeSpecies.Hornbeam, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.Ash, getVanilla("Maple"), ExtraTreeSpecies.Sycamore, 10);
|
||||
new ExtraTreeMutation(getVanilla("Larch"), getVanilla("Spruce"), ExtraTreeSpecies.Yew, 10);
|
||||
new ExtraTreeMutation(getVanilla("Larch"), ExtraTreeSpecies.Alder, ExtraTreeSpecies.BalsamFir, 10);
|
||||
new ExtraTreeMutation(getVanilla("Pine"), ExtraTreeSpecies.BalsamFir, ExtraTreeSpecies.Fir, 10);
|
||||
new ExtraTreeMutation(getVanilla("Pine"), ExtraTreeSpecies.Fir, ExtraTreeSpecies.Hemlock, 10).setHeight(80);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.Fir, getVanilla("Larch"), ExtraTreeSpecies.Cedar, 10).setHeight(60);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.Fir, getVanilla("Spruce"), ExtraTreeSpecies.DouglasFir, 10).setHeight(60);
|
||||
new ExtraTreeMutation(getVanilla("Pine"), getVanilla("Spruce"), ExtraTreeSpecies.Cypress, 10);
|
||||
new ExtraTreeMutation(getVanilla("Pine"), getVanilla("Spruce"), ExtraTreeSpecies.LoblollyPine, 10);
|
||||
new ExtraTreeMutation(getVanilla("Walnut"), getVanilla("Cherry"), ExtraTreeSpecies.Butternut, 10);
|
||||
new ExtraTreeMutation(getVanilla("Walnut"), getVanilla("Oak"), ExtraTreeSpecies.AcornOak, 10);
|
||||
new ExtraTreeMutation(getVanilla("Cherry"), ExtraTreeSpecies.Alder, ExtraTreeSpecies.Olive, 10);
|
||||
new ExtraTreeMutation(getVanilla("Maple"), getVanilla("Lime"), ExtraTreeSpecies.RedMaple, 10);
|
||||
new ExtraTreeMutation(getVanilla("Maple"), getVanilla("Larch"), ExtraTreeSpecies.Sweetgum, 10);
|
||||
new ExtraTreeMutation(getVanilla("Balsa"), getVanilla("Lime"), ExtraTreeSpecies.Locust, 10);
|
||||
new ExtraTreeMutation(getVanilla("Balsa"), getVanilla("Teak"), ExtraTreeSpecies.Iroko, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.OrchardApple, getVanilla("Birch"), ExtraTreeSpecies.Pear, 10);
|
||||
new ExtraTreeMutation(getVanilla("Ebony"), getVanilla("Teak"), ExtraTreeSpecies.OldFustic, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.OldFustic, getVanilla("Kapok"), ExtraTreeSpecies.OsangeOsange, 10);
|
||||
new ExtraTreeMutation(getVanilla("Ebony"), getVanilla("Teak"), ExtraTreeSpecies.Brazilwood, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.Brazilwood, getVanilla("Kapok"), ExtraTreeSpecies.Purpleheart, 10);
|
||||
new ExtraTreeMutation(getVanilla("Ebony"), getVanilla("Teak"), ExtraTreeSpecies.Rosewood, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.Rosewood, getVanilla("Kapok"), ExtraTreeSpecies.Logwood, 10);
|
||||
new ExtraTreeMutation(getVanilla("Wenge"), getVanilla("Lime"), ExtraTreeSpecies.Gingko, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.Beech, getVanilla("Jungle"), ExtraTreeSpecies.Brazilnut, 10);
|
||||
new ExtraTreeMutation(getVanilla("Balsa"), getVanilla("Jungle"), ExtraTreeSpecies.RoseGum, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.RoseGum, getVanilla("Mahogony"), ExtraTreeSpecies.SwampGum, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.Coffee, getVanilla("Teak"), ExtraTreeSpecies.Clove, 10);
|
||||
new ExtraTreeMutation(getVanilla("Cherry"), getVanilla("Jungle"), ExtraTreeSpecies.Coffee, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.Holly, ExtraTreeSpecies.Alder, ExtraTreeSpecies.Box, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.Hemlock, getVanilla("Jungle"), ExtraTreeSpecies.MonkeyPuzzle, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.RoseGum, getVanilla("Balsa"), ExtraTreeSpecies.RainbowGum, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.RoseGum, ExtraTreeSpecies.Brazilwood, ExtraTreeSpecies.PinkIvory, 10);
|
||||
new ExtraTreeMutation(getVanilla("Cherry"), ExtraTreeSpecies.Elder, ExtraTreeSpecies.Raspberry, 10);
|
||||
new ExtraTreeMutation(getVanilla("Cherry"), ExtraTreeSpecies.Elder, ExtraTreeSpecies.Redcurrant, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.BlackCherry, ExtraTreeSpecies.Redcurrant, ExtraTreeSpecies.Blackcurrant, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.BlackCherry, ExtraTreeSpecies.Raspberry, ExtraTreeSpecies.Blackberry, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.Blackberry, ExtraTreeSpecies.Raspberry, ExtraTreeSpecies.Blueberry, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.Blackberry, ExtraTreeSpecies.CherryPlum, ExtraTreeSpecies.Cranberry, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.Raspberry, ExtraTreeSpecies.Fir, ExtraTreeSpecies.Juniper, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.Raspberry, ExtraTreeSpecies.Lime, ExtraTreeSpecies.Gooseberry, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.Raspberry, ExtraTreeSpecies.Orange, ExtraTreeSpecies.GoldenRaspberry, 10);
|
||||
new ExtraTreeMutation(getVanilla("Teak"), ExtraTreeSpecies.Rosewood, ExtraTreeSpecies.Cinnamon, 10);
|
||||
new ExtraTreeMutation(getVanilla("Balsa"), ExtraTreeSpecies.Brazilnut, ExtraTreeSpecies.Coconut, 10);
|
||||
new ExtraTreeMutation(getVanilla("Teak"), getVanilla("Oak"), ExtraTreeSpecies.Cashew, 10);
|
||||
new ExtraTreeMutation(getVanilla("Wenge"), getVanilla("Oak"), ExtraTreeSpecies.Avacado, 10);
|
||||
new ExtraTreeMutation(getVanilla("Teak"), ExtraTreeSpecies.Clove, ExtraTreeSpecies.Nutmeg, 10);
|
||||
new ExtraTreeMutation(getVanilla("Teak"), ExtraTreeSpecies.Clove, ExtraTreeSpecies.Allspice, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.Allspice, ExtraTreeSpecies.Clove, ExtraTreeSpecies.StarAnise, 10);
|
||||
new ExtraTreeMutation(getVanilla("Jungle"), ExtraTreeSpecies.Orange, ExtraTreeSpecies.Mango, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.StarAnise, ExtraTreeSpecies.Mango, ExtraTreeSpecies.Starfruit, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.Hazel, ExtraTreeSpecies.Gingko, ExtraTreeSpecies.Candlenut, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.Hazel, ExtraTreeSpecies.Gingko, ExtraTreeSpecies.Chilli, 10);
|
||||
new ExtraTreeMutation(ExtraTreeSpecies.Hazel, ExtraTreeSpecies.Alder, ExtraTreeSpecies.DwarfHazel, 10);
|
||||
}
|
||||
|
||||
public static IAllele getVanilla(final String uid) {
|
||||
final IAllele allele = AlleleManager.alleleRegistry.getAllele("forestry.tree" + uid);
|
||||
if (allele == null) {
|
||||
throw new RuntimeException("No forestry species with id " + uid);
|
||||
}
|
||||
return allele;
|
||||
}
|
||||
|
||||
public ExtraTreeMutation(final IAllele allele0, final IAllele allele1, final IAllele result, final int chance) {
|
||||
this(allele0, allele1, Binnie.Genetics.getTreeRoot().getTemplate(result.getUID()), chance);
|
||||
}
|
||||
|
||||
public ExtraTreeMutation(final IAllele allele0, final IAllele allele1, final IAllele[] template, final int chance) {
|
||||
this.isSecret = false;
|
||||
this.minTemperature = 0.0f;
|
||||
this.maxTemperature = 2.0f;
|
||||
this.minRainfall = 0.0f;
|
||||
this.maxRainfall = 2.0f;
|
||||
this.height = -1.0f;
|
||||
this.allele0 = (IAlleleTreeSpecies) allele0;
|
||||
this.allele1 = (IAlleleTreeSpecies) allele1;
|
||||
this.template = template;
|
||||
this.chance = chance;
|
||||
Binnie.Genetics.getTreeRoot().registerMutation(this);
|
||||
}
|
||||
|
||||
public ExtraTreeMutation setIsSecret() {
|
||||
this.isSecret = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ExtraTreeMutation setTemperature(final float minTemperature, final float maxTemperature) {
|
||||
this.minTemperature = minTemperature;
|
||||
this.maxTemperature = maxTemperature;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ExtraTreeMutation setRainfall(final float minRainfall, final float maxRainfall) {
|
||||
this.minRainfall = minRainfall;
|
||||
this.maxRainfall = maxRainfall;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ExtraTreeMutation setTemperatureRainfall(final float minTemperature, final float maxTemperature, final float minRainfall, final float maxRainfall) {
|
||||
this.minTemperature = minTemperature;
|
||||
this.maxTemperature = maxTemperature;
|
||||
this.minRainfall = minRainfall;
|
||||
this.maxRainfall = maxRainfall;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ExtraTreeMutation setHeight(final int minHeight) {
|
||||
this.height = minHeight;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAlleleTreeSpecies getAllele0() {
|
||||
return this.allele0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAlleleTreeSpecies getAllele1() {
|
||||
return this.allele1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getBaseChance() {
|
||||
return this.chance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAllele[] getTemplate() {
|
||||
return this.template;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPartner(final IAllele allele) {
|
||||
return this.allele0.getUID().equals(allele.getUID()) || this.allele1.getUID().equals(allele.getUID());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAllele getPartner(final IAllele allele) {
|
||||
if (this.allele0.getUID().equals(allele.getUID())) {
|
||||
return this.allele1;
|
||||
}
|
||||
return this.allele0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSecret() {
|
||||
return this.isSecret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getChance(final World world, final int x, final int y, final int z, final IAlleleTreeSpecies allele0, final IAlleleTreeSpecies allele1, final ITreeGenome genome0, final ITreeGenome genome1) {
|
||||
final int processedChance = this.chance;
|
||||
final BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(x, z);
|
||||
if (biome.temperature < this.minTemperature || biome.temperature > this.maxTemperature) {
|
||||
return 0.0f;
|
||||
}
|
||||
if (biome.rainfall < this.minRainfall || biome.rainfall > this.maxRainfall) {
|
||||
return 0.0f;
|
||||
}
|
||||
if (this.height > 0.0f && y < this.height) {
|
||||
return 0.0f;
|
||||
}
|
||||
if (this.allele0.getUID().equals(allele0.getUID()) && this.allele1.getUID().equals(allele1.getUID())) {
|
||||
return processedChance;
|
||||
}
|
||||
if (this.allele1.getUID().equals(allele0.getUID()) && this.allele0.getUID().equals(allele1.getUID())) {
|
||||
return processedChance;
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> getSpecialConditions() {
|
||||
final List<String> conditions = new ArrayList<String>();
|
||||
if (this.height > 0.0f) {
|
||||
conditions.add("Minimum height from bedrock of " + this.height);
|
||||
}
|
||||
return conditions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITreeRoot getRoot() {
|
||||
return Binnie.Genetics.getTreeRoot();
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extratrees.genetics;
|
||||
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
import binnie.Binnie;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.util.IIcon;
|
||||
import binnie.core.resource.BinnieIcon;
|
||||
import forestry.api.core.IIconProvider;
|
||||
|
||||
public enum FruitSprite implements IIconProvider
|
||||
{
|
||||
Tiny,
|
||||
Small,
|
||||
Average,
|
||||
Large,
|
||||
Larger,
|
||||
Pear;
|
||||
|
||||
BinnieIcon icon;
|
||||
|
||||
public short getIndex() {
|
||||
return (short) (this.ordinal() + 4200);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(final short texUID) {
|
||||
final int index = texUID - 4200;
|
||||
if (index >= 0 && index < values().length) {
|
||||
return values()[index].icon.getIcon();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(final IIconRegister register) {
|
||||
this.icon = Binnie.Resource.getBlockIcon(ExtraTrees.instance, "fruit/" + this.toString().toLowerCase());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extratrees.genetics;
|
||||
|
||||
import java.util.Locale;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IClassification;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.Binnie;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import binnie.core.IInitializable;
|
||||
|
||||
public class ModuleGenetics implements IInitializable
|
||||
{
|
||||
String[] branches;
|
||||
List<List<String>> classifications;
|
||||
|
||||
public ModuleGenetics() {
|
||||
this.branches = new String[] { "Malus Maleae Amygdaloideae Rosaceae", "Musa Musaceae Zingiberales Commelinids Angiosperms", "Sorbus Maleae", "Tsuga Pinaceae", "Fraxinus Oleeae Oleaceae Lamiales Asterids Angiospems" };
|
||||
this.classifications = new ArrayList<List<String>>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
for (final ExtraTreeFruitGene fruit : ExtraTreeFruitGene.values()) {
|
||||
AlleleManager.alleleRegistry.registerAllele(fruit);
|
||||
}
|
||||
for (final ExtraTreeSpecies species : ExtraTreeSpecies.values()) {
|
||||
AlleleManager.alleleRegistry.registerAllele(species);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
ExtraTreeSpecies.init();
|
||||
ExtraTreeFruitGene.init();
|
||||
for (final ExtraTreeSpecies species : ExtraTreeSpecies.values()) {
|
||||
Binnie.Genetics.getTreeRoot().registerTemplate(species.getTemplate());
|
||||
}
|
||||
ExtraTreeMutation.init();
|
||||
if (BinnieCore.isLepidopteryActive()) {
|
||||
for (final ButterflySpecies species2 : ButterflySpecies.values()) {
|
||||
AlleleManager.alleleRegistry.registerAllele(species2);
|
||||
Binnie.Genetics.getButterflyRoot().registerTemplate(species2.getTemplate());
|
||||
final String scientific = species2.branchName.substring(0, 1).toUpperCase() + species2.branchName.substring(1).toLowerCase();
|
||||
final String uid = "trees." + species2.branchName.toLowerCase();
|
||||
IClassification branch = AlleleManager.alleleRegistry.getClassification("genus." + uid);
|
||||
if (branch == null) {
|
||||
branch = AlleleManager.alleleRegistry.createAndRegisterClassification(IClassification.EnumClassLevel.GENUS, uid, scientific);
|
||||
}
|
||||
(species2.branch = branch).addMemberSpecies(species2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void generateBranches() {
|
||||
for (final String hierarchy : this.branches) {
|
||||
final List<String> set = new ArrayList<String>();
|
||||
for (final String string : hierarchy.split(" ", 0)) {
|
||||
set.add(string.toLowerCase());
|
||||
}
|
||||
this.classifications.add(set);
|
||||
}
|
||||
for (final ExtraTreeSpecies species : ExtraTreeSpecies.values()) {
|
||||
final IClassification branch = this.getOrCreateClassification(IClassification.EnumClassLevel.GENUS, species.branchName);
|
||||
branch.addMemberSpecies(species);
|
||||
species.branch = branch;
|
||||
IClassification clss = branch;
|
||||
int currentLevel = IClassification.EnumClassLevel.GENUS.ordinal();
|
||||
while (clss.getParent() == null) {
|
||||
for (final List<String> set2 : this.classifications) {
|
||||
if (set2.contains(clss.getScientific().toLowerCase())) {
|
||||
String nextLevel = "";
|
||||
int index = set2.indexOf(clss.getScientific().toLowerCase()) + 1;
|
||||
while (nextLevel.length() == 0) {
|
||||
try {
|
||||
nextLevel = set2.get(index++);
|
||||
} catch (IndexOutOfBoundsException ex) {
|
||||
throw new RuntimeException("Reached end point at " + set2.get(index - 2));
|
||||
}
|
||||
--currentLevel;
|
||||
}
|
||||
final IClassification parent = this.getOrCreateClassification(IClassification.EnumClassLevel.values()[currentLevel], nextLevel);
|
||||
parent.addMemberGroup(clss);
|
||||
System.out.println("Went from " + clss.getScientific() + " to " + parent.getScientific());
|
||||
clss = parent;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private IClassification getOrCreateClassification(final IClassification.EnumClassLevel level, String name) {
|
||||
if (level == IClassification.EnumClassLevel.GENUS) {
|
||||
name = "trees." + name;
|
||||
}
|
||||
final String uid = level.name().toLowerCase(Locale.ENGLISH) + "." + name.toLowerCase();
|
||||
if (AlleleManager.alleleRegistry.getClassification(uid) != null) {
|
||||
return AlleleManager.alleleRegistry.getClassification(uid);
|
||||
}
|
||||
return AlleleManager.alleleRegistry.createAndRegisterClassification(level, name.toLowerCase(), name);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user