Improve code readability in binnie.extrabees package and other packages

* Improve code readability in binnie.extrabees package and other packages
* Fix compile error after refactoring
This commit is contained in:
Alexander Kornilov authored and marcin212 committed 2017-04-29 13:43:35 +02:00
1 parent b609d6688f
commit c09ad04284
95 files changed
+3916 -3900

No files matched your search

@@ -1,47 +1,62 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.extrabees.genetics;
import forestry.api.genetics.IAlleleSpecies;
import binnie.Binnie;
import binnie.core.genetics.ForestryAllele;
import forestry.api.apiculture.BeeManager;
import forestry.api.apiculture.IAlleleBeeSpecies;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.apiculture.IBeeMutation;
import forestry.api.apiculture.IBeeRoot;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IAlleleSpecies;
import forestry.api.genetics.IGenome;
import net.minecraft.world.World;
import net.minecraftforge.common.BiomeDictionary;
import java.util.ArrayList;
import java.util.Collection;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.World;
import forestry.api.genetics.IGenome;
import forestry.api.apiculture.BeeManager;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.genetics.IMutation;
import binnie.Binnie;
import net.minecraftforge.common.BiomeDictionary;
import binnie.core.genetics.ForestryAllele;
import forestry.api.genetics.IAllele;
import forestry.api.apiculture.IAlleleBeeSpecies;
import java.util.Collections;
import java.util.List;
import forestry.api.apiculture.IBeeMutation;
public class ExtraBeeMutation implements IBeeMutation
{
public class ExtraBeeMutation implements IBeeMutation {
public static List<IBeeMutation> mutations;
MutationRequirement req;
IAlleleBeeSpecies species0;
IAlleleBeeSpecies species1;
IAllele[] template;
int chance;
static {
ExtraBeeMutation.mutations = new ArrayList<>();
}
protected MutationRequirement req;
protected IAlleleBeeSpecies species0;
protected IAlleleBeeSpecies species1;
protected IAllele[] template;
protected int chance;
public ExtraBeeMutation(IAlleleBeeSpecies allele0, IAlleleBeeSpecies allele1, ExtraBeesSpecies mutation, int chance) {
this(allele0, allele1, mutation.getTemplate(), chance, null);
}
public ExtraBeeMutation(IAlleleBeeSpecies allele0, IAlleleBeeSpecies allele1, ExtraBeesSpecies mutation, int chance, MutationRequirement req) {
this(allele0, allele1, mutation.getTemplate(), chance, req);
}
public ExtraBeeMutation(IAlleleBeeSpecies allele0, IAlleleBeeSpecies allele1, IAllele[] mutation, int chance) {
this(allele0, allele1, mutation, chance, null);
}
public ExtraBeeMutation(IAlleleBeeSpecies allele0, IAlleleBeeSpecies allele1, IAllele[] mutation, int chance, MutationRequirement req) {
this.chance = 80;
this.chance = chance;
this.req = req;
species0 = allele0;
species1 = allele1;
template = mutation;
if (species0 != null && species1 != null && template != null) {
ExtraBeeMutation.mutations.add(this);
}
}
public static void doInit() {
final IAlleleBeeSpecies[] vanilla = new IAlleleBeeSpecies[0];
new ExtraBeeMutation(ForestryAllele.BeeSpecies.Meadows.getAllele(), ForestryAllele.BeeSpecies.Frugal.getAllele(), ExtraBeesSpecies.ARID, 10);
new ExtraBeeMutation(ForestryAllele.BeeSpecies.Forest.getAllele(), ForestryAllele.BeeSpecies.Frugal.getAllele(), ExtraBeesSpecies.ARID, 10);
new ExtraBeeMutation(ExtraBeesSpecies.ARID, ForestryAllele.BeeSpecies.Common.getAllele(), ExtraBeesSpecies.BARREN, 8);
@@ -194,66 +209,39 @@ public class ExtraBeeMutation implements IBeeMutation
new ExtraBeeMutation(ExtraBeesSpecies.UNUSUAL, ForestryAllele.BeeSpecies.Hermitic.getAllele(), ExtraBeesSpecies.SPATIAL, 5);
new ExtraBeeMutation(ExtraBeesSpecies.SPATIAL, ForestryAllele.BeeSpecies.Spectral.getAllele(), ExtraBeesSpecies.QUANTUM, 5);
new ExtraBeeMutation(ForestryAllele.BeeSpecies.Noble.getAllele(), ForestryAllele.BeeSpecies.Monastic.getAllele(), ExtraBeesSpecies.MYSTICAL, 5);
for (final IBeeMutation mutation : ExtraBeeMutation.mutations) {
for (IBeeMutation mutation : ExtraBeeMutation.mutations) {
Binnie.Genetics.getBeeRoot().registerMutation(mutation);
}
}
public ExtraBeeMutation(final IAlleleBeeSpecies allele0, final IAlleleBeeSpecies allele1, final ExtraBeesSpecies mutation, final int chance) {
this(allele0, allele1, mutation.getTemplate(), chance, null);
}
public ExtraBeeMutation(final IAlleleBeeSpecies allele0, final IAlleleBeeSpecies allele1, final ExtraBeesSpecies mutation, final int chance, final MutationRequirement req) {
this(allele0, allele1, mutation.getTemplate(), chance, req);
}
public ExtraBeeMutation(final IAlleleBeeSpecies allele0, final IAlleleBeeSpecies allele1, final IAllele[] mutation, final int chance) {
this(allele0, allele1, mutation, chance, null);
}
public ExtraBeeMutation(final IAlleleBeeSpecies allele0, final IAlleleBeeSpecies allele1, final IAllele[] mutation, final int chance, final MutationRequirement req) {
this.species0 = null;
this.species1 = null;
this.template = new IAllele[0];
this.chance = 80;
this.chance = chance;
this.req = req;
this.species0 = allele0;
this.species1 = allele1;
this.template = mutation;
if (this.species0 != null && this.species1 != null && this.template != null) {
ExtraBeeMutation.mutations.add(this);
}
}
@Override
public IAlleleSpecies getAllele0() {
return this.species0;
return species0;
}
@Override
public IAlleleSpecies getAllele1() {
return this.species1;
return species1;
}
@Override
public IAllele[] getTemplate() {
return this.template;
return template;
}
@Override
public float getBaseChance() {
return this.chance;
return chance;
}
@Override
public boolean isPartner(final IAllele allele) {
return allele.getUID().equals(this.species0.getUID()) || allele.getUID().equals(this.species1.getUID());
public boolean isPartner(IAllele allele) {
return allele.getUID().equals(species0.getUID()) || allele.getUID().equals(species1.getUID());
}
@Override
public IAllele getPartner(final IAllele allele) {
return allele.getUID().equals(this.species0.getUID()) ? this.species1 : this.species0;
public IAllele getPartner(IAllele allele) {
return allele.getUID().equals(species0.getUID()) ? species1 : species0;
}
@Override
@@ -262,23 +250,22 @@ public class ExtraBeeMutation implements IBeeMutation
}
@Override
public float getChance(final IBeeHousing housing, final IAlleleBeeSpecies allele0, final IAlleleBeeSpecies allele1, final IBeeGenome genome0, final IBeeGenome genome1) {
if (this.species0 == null || this.species1 == null || allele0 == null || allele1 == null) {
public float getChance(IBeeHousing housing, IAlleleBeeSpecies allele0, IAlleleBeeSpecies allele1, IBeeGenome genome0, IBeeGenome genome1) {
if (species0 == null || species1 == null || allele0 == null || allele1 == null) {
return 0.0f;
}
final World world = housing.getWorld();
final BiomeGenBase biome = housing.getBiome();
if (this.req != null && !this.req.fufilled(housing, allele0, allele1, genome0, genome1)) {
World world = housing.getWorld();
if (req != null && !req.fufilled(housing, allele0, allele1, genome0, genome1)) {
return 0.0f;
}
final int processedChance = Math.round(this.chance * BeeManager.beeRoot.createBeeHousingModifier(housing).getMutationModifier(genome0, genome1, 1.0f)
int processedChance = Math.round(chance * BeeManager.beeRoot.createBeeHousingModifier(housing).getMutationModifier(genome0, genome1, 1.0f)
* Binnie.Genetics.getBeeRoot().getBeekeepingMode(world).getBeeModifier().getMutationModifier(genome0, genome1, 1.0f));
if (this.species0.getUID().equals(allele0.getUID()) && this.species1.getUID().equals(allele1.getUID())) {
if (species0.getUID().equals(allele0.getUID()) && species1.getUID().equals(allele1.getUID())) {
return processedChance;
}
if (this.species1.getUID().equals(allele0.getUID()) && this.species0.getUID().equals(allele1.getUID())) {
if (species1.getUID().equals(allele0.getUID()) && species0.getUID().equals(allele1.getUID())) {
return processedChance;
}
return 0.0f;
@@ -286,11 +273,9 @@ public class ExtraBeeMutation implements IBeeMutation
@Override
public Collection<String> getSpecialConditions() {
final List<String> conditions = new ArrayList<String>();
if (this.req != null) {
for (final String s : this.req.tooltip()) {
conditions.add(s);
}
List<String> conditions = new ArrayList<>();
if (req != null) {
Collections.addAll(conditions, req.tooltip());
}
return conditions;
}
@@ -300,52 +285,46 @@ public class ExtraBeeMutation implements IBeeMutation
return Binnie.Genetics.getBeeRoot();
}
static {
ExtraBeeMutation.mutations = new ArrayList<IBeeMutation>();
}
abstract static class MutationRequirement
{
abstract static class MutationRequirement {
public abstract String[] tooltip();
public abstract boolean fufilled(final IBeeHousing p0, final IAllele p1, final IAllele p2, final IGenome p3, final IGenome p4);
public abstract boolean fufilled(IBeeHousing housing, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1);
}
static class RequirementBiomeType extends MutationRequirement
{
BiomeDictionary.Type type;
static class RequirementBiomeType extends MutationRequirement {
protected BiomeDictionary.Type type;
public RequirementBiomeType(final BiomeDictionary.Type type) {
public RequirementBiomeType(BiomeDictionary.Type type) {
this.type = type;
}
@Override
public String[] tooltip() {
return new String[] { "Is restricted to " + this.type + "-like biomes." };
return new String[]{"Is restricted to " + type + "-like biomes."};
}
@Override
public boolean fufilled(final IBeeHousing housing, final IAllele allele0, final IAllele allele1, final IGenome genome0, final IGenome genome1) {
return BiomeDictionary.isBiomeOfType(housing.getBiome(), this.type);
public boolean fufilled(IBeeHousing housing, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
return BiomeDictionary.isBiomeOfType(housing.getBiome(), type);
}
}
static class RequirementPerson extends MutationRequirement
{
String name;
static class RequirementPerson extends MutationRequirement {
protected String name;
public RequirementPerson(final String name) {
public RequirementPerson(String name) {
this.name = name;
}
@Override
public String[] tooltip() {
return new String[] { "Can only be bred by " + this.name };
return new String[]{"Can only be bred by " + name};
}
@Override
public boolean fufilled(final IBeeHousing housing, final IAllele allele0, final IAllele allele1, final IGenome genome0, final IGenome genome1) {
return housing.getOwner().getName() != null && housing.getOwner().getName().equals(this.name);
public boolean fufilled(IBeeHousing housing, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
return housing.getOwner().getName() != null
&& housing.getOwner().getName().equals(name);
}
}
}
@@ -1,19 +1,15 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.extrabees.genetics;
import forestry.api.genetics.IAlleleSpecies;
import forestry.api.genetics.AlleleManager;
import java.util.LinkedHashSet;
import binnie.extrabees.ExtraBees;
import forestry.api.apiculture.IAlleleBeeSpecies;
import java.util.Set;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAlleleSpecies;
import forestry.api.genetics.IClassification;
public enum ExtraBeesBranch implements IClassification
{
import java.util.LinkedHashSet;
import java.util.Set;
public enum ExtraBeesBranch implements IClassification {
BARREN("Vacapis"),
HOSTILE("Infenapis"),
ROCKY("Monapis"),
@@ -44,59 +40,28 @@ public enum ExtraBeesBranch implements IClassification
QUANTUM("Quantapis"),
BOTANIA("Botaniapis");
protected IClassification parent;
private String uid;
private String scientific;
private Set<IAlleleBeeSpecies> speciesSet;
IClassification parent;
@Override
public String getUID() {
return "extrabees.genus." + this.uid;
}
@Override
public String getName() {
return ExtraBees.proxy.localise("branch." + this.toString().toLowerCase() + ".name");
}
@Override
public String getScientific() {
return this.scientific;
}
@Override
public String getDescription() {
return ExtraBees.proxy.localiseOrBlank("branch." + this.toString().toLowerCase() + ".desc");
}
private ExtraBeesBranch(final String scientific) {
this.uid = "";
this.scientific = "";
this.speciesSet = new LinkedHashSet<IAlleleBeeSpecies>();
ExtraBeesBranch(String scientific) {
this.scientific = scientific;
this.uid = this.toString().toLowerCase();
}
public void register() {
if (!this.speciesSet.isEmpty()) {
AlleleManager.alleleRegistry.registerClassification(this);
final IClassification parent = AlleleManager.alleleRegistry.getClassification("family.apidae");
if (parent != null) {
parent.addMemberGroup(this);
this.setParent(parent);
}
}
speciesSet = new LinkedHashSet<>();
uid = toString().toLowerCase();
}
public static void doInit() {
final IClassification frozenBranch = AlleleManager.alleleRegistry.getClassification("genus.bees.frozen");
IClassification frozenBranch = AlleleManager.alleleRegistry.getClassification("genus.bees.frozen");
if (frozenBranch != null) {
frozenBranch.addMemberSpecies(ExtraBeesSpecies.ARTIC);
ExtraBeesSpecies.ARTIC.setBranch(frozenBranch);
frozenBranch.addMemberSpecies(ExtraBeesSpecies.FREEZING);
ExtraBeesSpecies.FREEZING.setBranch(frozenBranch);
}
final IClassification agrarianBranch = AlleleManager.alleleRegistry.getClassification("genus.bees.agrarian");
IClassification agrarianBranch = AlleleManager.alleleRegistry.getClassification("genus.bees.agrarian");
if (agrarianBranch != null) {
agrarianBranch.addMemberSpecies(ExtraBeesSpecies.FARM);
ExtraBeesSpecies.FARM.setBranch(agrarianBranch);
@@ -104,7 +69,8 @@ public enum ExtraBeesBranch implements IClassification
ExtraBeesSpecies.THRIVING.setBranch(agrarianBranch);
ExtraBeesSpecies.BLOOMING.setBranch(agrarianBranch);
}
final IClassification boggyBranch = AlleleManager.alleleRegistry.getClassification("genus.bees.boggy");
IClassification boggyBranch = AlleleManager.alleleRegistry.getClassification("genus.bees.boggy");
if (boggyBranch != null) {
boggyBranch.addMemberSpecies(ExtraBeesSpecies.SWAMP);
boggyBranch.addMemberSpecies(ExtraBeesSpecies.BOGGY);
@@ -113,57 +79,68 @@ public enum ExtraBeesBranch implements IClassification
ExtraBeesSpecies.BOGGY.setBranch(boggyBranch);
ExtraBeesSpecies.FUNGAL.setBranch(boggyBranch);
}
final IClassification festiveBranch = AlleleManager.alleleRegistry.getClassification("genus.bees.festive");
IClassification festiveBranch = AlleleManager.alleleRegistry.getClassification("genus.bees.festive");
if (festiveBranch != null) {
festiveBranch.addMemberSpecies(ExtraBeesSpecies.CELEBRATORY);
ExtraBeesSpecies.CELEBRATORY.setBranch(festiveBranch);
}
final IClassification austereBranch = AlleleManager.alleleRegistry.getClassification("genus.bees.austere");
IClassification austereBranch = AlleleManager.alleleRegistry.getClassification("genus.bees.austere");
if (austereBranch != null) {
austereBranch.addMemberSpecies(ExtraBeesSpecies.HAZARDOUS);
ExtraBeesSpecies.HAZARDOUS.setBranch(austereBranch);
}
ExtraBeesBranch.FARMING.addMemberSpecies(ExtraBeesSpecies.ALCOHOL);
ExtraBeesBranch.FARMING.addMemberSpecies(ExtraBeesSpecies.MILK);
ExtraBeesBranch.FARMING.addMemberSpecies(ExtraBeesSpecies.COFFEE);
ExtraBeesBranch.FARMING.addMemberSpecies(ExtraBeesSpecies.CITRUS);
ExtraBeesBranch.FARMING.addMemberSpecies(ExtraBeesSpecies.MINT);
ExtraBeesBranch.FARMING.register();
ExtraBeesBranch.BARREN.addMemberSpecies(ExtraBeesSpecies.ARID);
ExtraBeesBranch.BARREN.addMemberSpecies(ExtraBeesSpecies.BARREN);
ExtraBeesBranch.BARREN.addMemberSpecies(ExtraBeesSpecies.DESOLATE);
ExtraBeesBranch.BARREN.addMemberSpecies(ExtraBeesSpecies.DECOMPOSING);
ExtraBeesBranch.BARREN.addMemberSpecies(ExtraBeesSpecies.GNAWING);
ExtraBeesBranch.BARREN.register();
ExtraBeesBranch.HOSTILE.addMemberSpecies(ExtraBeesSpecies.ROTTEN);
ExtraBeesBranch.HOSTILE.addMemberSpecies(ExtraBeesSpecies.BONE);
ExtraBeesBranch.HOSTILE.addMemberSpecies(ExtraBeesSpecies.CREEPER);
ExtraBeesBranch.HOSTILE.register();
ExtraBeesBranch.ROCKY.addMemberSpecies(ExtraBeesSpecies.ROCK);
ExtraBeesBranch.ROCKY.addMemberSpecies(ExtraBeesSpecies.STONE);
ExtraBeesBranch.ROCKY.addMemberSpecies(ExtraBeesSpecies.GRANITE);
ExtraBeesBranch.ROCKY.addMemberSpecies(ExtraBeesSpecies.MINERAL);
ExtraBeesBranch.ROCKY.register();
ExtraBeesBranch.METALLIC.addMemberSpecies(ExtraBeesSpecies.IRON);
ExtraBeesBranch.METALLIC.addMemberSpecies(ExtraBeesSpecies.COPPER);
ExtraBeesBranch.METALLIC.addMemberSpecies(ExtraBeesSpecies.TIN);
ExtraBeesBranch.METALLIC.addMemberSpecies(ExtraBeesSpecies.LEAD);
ExtraBeesBranch.METALLIC.register();
ExtraBeesBranch.METALLIC2.addMemberSpecies(ExtraBeesSpecies.NICKEL);
ExtraBeesBranch.METALLIC2.addMemberSpecies(ExtraBeesSpecies.ZINC);
ExtraBeesBranch.METALLIC2.addMemberSpecies(ExtraBeesSpecies.TUNGSTATE);
ExtraBeesBranch.METALLIC2.addMemberSpecies(ExtraBeesSpecies.TITANIUM);
ExtraBeesBranch.METALLIC2.register();
ExtraBeesBranch.ALLOY.addMemberSpecies(ExtraBeesSpecies.BRONZE);
ExtraBeesBranch.ALLOY.addMemberSpecies(ExtraBeesSpecies.BRASS);
ExtraBeesBranch.ALLOY.addMemberSpecies(ExtraBeesSpecies.STEEL);
ExtraBeesBranch.ALLOY.addMemberSpecies(ExtraBeesSpecies.INVAR);
ExtraBeesBranch.ALLOY.register();
ExtraBeesBranch.PRECIOUS.addMemberSpecies(ExtraBeesSpecies.SILVER);
ExtraBeesBranch.PRECIOUS.addMemberSpecies(ExtraBeesSpecies.GOLD);
ExtraBeesBranch.PRECIOUS.addMemberSpecies(ExtraBeesSpecies.ELECTRUM);
ExtraBeesBranch.PRECIOUS.addMemberSpecies(ExtraBeesSpecies.PLATINUM);
ExtraBeesBranch.PRECIOUS.register();
ExtraBeesBranch.MINERAL.addMemberSpecies(ExtraBeesSpecies.LAPIS);
ExtraBeesBranch.MINERAL.addMemberSpecies(ExtraBeesSpecies.SODALITE);
ExtraBeesBranch.MINERAL.addMemberSpecies(ExtraBeesSpecies.PYRITE);
@@ -171,12 +148,14 @@ public enum ExtraBeesBranch implements IClassification
ExtraBeesBranch.MINERAL.addMemberSpecies(ExtraBeesSpecies.CINNABAR);
ExtraBeesBranch.MINERAL.addMemberSpecies(ExtraBeesSpecies.SPHALERITE);
ExtraBeesBranch.MINERAL.register();
ExtraBeesBranch.GEMSTONE.addMemberSpecies(ExtraBeesSpecies.EMERALD);
ExtraBeesBranch.GEMSTONE.addMemberSpecies(ExtraBeesSpecies.RUBY);
ExtraBeesBranch.GEMSTONE.addMemberSpecies(ExtraBeesSpecies.SAPPHIRE);
ExtraBeesBranch.GEMSTONE.addMemberSpecies(ExtraBeesSpecies.OLIVINE);
ExtraBeesBranch.GEMSTONE.addMemberSpecies(ExtraBeesSpecies.DIAMOND);
ExtraBeesBranch.GEMSTONE.register();
ExtraBeesBranch.NUCLEAR.addMemberSpecies(ExtraBeesSpecies.UNSTABLE);
ExtraBeesBranch.NUCLEAR.addMemberSpecies(ExtraBeesSpecies.NUCLEAR);
ExtraBeesBranch.NUCLEAR.addMemberSpecies(ExtraBeesSpecies.RADIOACTIVE);
@@ -184,62 +163,75 @@ public enum ExtraBeesBranch implements IClassification
ExtraBeesBranch.NUCLEAR.addMemberSpecies(ExtraBeesSpecies.CYANITE);
ExtraBeesBranch.NUCLEAR.addMemberSpecies(ExtraBeesSpecies.BLUTONIUM);
ExtraBeesBranch.NUCLEAR.register();
ExtraBeesBranch.HISTORIC.addMemberSpecies(ExtraBeesSpecies.ANCIENT);
ExtraBeesBranch.HISTORIC.addMemberSpecies(ExtraBeesSpecies.PRIMEVAL);
ExtraBeesBranch.HISTORIC.addMemberSpecies(ExtraBeesSpecies.PREHISTORIC);
ExtraBeesBranch.HISTORIC.addMemberSpecies(ExtraBeesSpecies.RELIC);
ExtraBeesBranch.HISTORIC.register();
ExtraBeesBranch.FOSSILIZED.addMemberSpecies(ExtraBeesSpecies.COAL);
ExtraBeesBranch.FOSSILIZED.addMemberSpecies(ExtraBeesSpecies.RESIN);
ExtraBeesBranch.FOSSILIZED.addMemberSpecies(ExtraBeesSpecies.OIL);
ExtraBeesBranch.FOSSILIZED.addMemberSpecies(ExtraBeesSpecies.PEAT);
ExtraBeesBranch.FOSSILIZED.register();
ExtraBeesBranch.REFINED.addMemberSpecies(ExtraBeesSpecies.DISTILLED);
ExtraBeesBranch.REFINED.addMemberSpecies(ExtraBeesSpecies.FUEL);
ExtraBeesBranch.REFINED.addMemberSpecies(ExtraBeesSpecies.CREOSOTE);
ExtraBeesBranch.REFINED.addMemberSpecies(ExtraBeesSpecies.LATEX);
ExtraBeesBranch.REFINED.register();
ExtraBeesBranch.AQUATIC.addMemberSpecies(ExtraBeesSpecies.WATER);
ExtraBeesBranch.AQUATIC.addMemberSpecies(ExtraBeesSpecies.RIVER);
ExtraBeesBranch.AQUATIC.addMemberSpecies(ExtraBeesSpecies.OCEAN);
ExtraBeesBranch.AQUATIC.addMemberSpecies(ExtraBeesSpecies.INK);
ExtraBeesBranch.AQUATIC.register();
ExtraBeesBranch.SACCHARINE.addMemberSpecies(ExtraBeesSpecies.SWEET);
ExtraBeesBranch.SACCHARINE.addMemberSpecies(ExtraBeesSpecies.SUGAR);
ExtraBeesBranch.SACCHARINE.addMemberSpecies(ExtraBeesSpecies.FRUIT);
ExtraBeesBranch.SACCHARINE.addMemberSpecies(ExtraBeesSpecies.RIPENING);
ExtraBeesBranch.SACCHARINE.register();
ExtraBeesBranch.CLASSICAL.addMemberSpecies(ExtraBeesSpecies.MARBLE);
ExtraBeesBranch.CLASSICAL.addMemberSpecies(ExtraBeesSpecies.ROMAN);
ExtraBeesBranch.CLASSICAL.addMemberSpecies(ExtraBeesSpecies.GREEK);
ExtraBeesBranch.CLASSICAL.addMemberSpecies(ExtraBeesSpecies.CLASSICAL);
ExtraBeesBranch.CLASSICAL.register();
ExtraBeesBranch.VOLCANIC.addMemberSpecies(ExtraBeesSpecies.BASALT);
ExtraBeesBranch.VOLCANIC.addMemberSpecies(ExtraBeesSpecies.TEMPERED);
ExtraBeesBranch.VOLCANIC.addMemberSpecies(ExtraBeesSpecies.ANGRY);
ExtraBeesBranch.VOLCANIC.addMemberSpecies(ExtraBeesSpecies.VOLCANIC);
ExtraBeesBranch.VOLCANIC.addMemberSpecies(ExtraBeesSpecies.GLOWSTONE);
ExtraBeesBranch.VOLCANIC.register();
ExtraBeesBranch.VISCOUS.addMemberSpecies(ExtraBeesSpecies.VISCOUS);
ExtraBeesBranch.VISCOUS.addMemberSpecies(ExtraBeesSpecies.GLUTINOUS);
ExtraBeesBranch.VISCOUS.addMemberSpecies(ExtraBeesSpecies.STICKY);
ExtraBeesBranch.VISCOUS.register();
ExtraBeesBranch.VIRULENT.addMemberSpecies(ExtraBeesSpecies.MALICIOUS);
ExtraBeesBranch.VIRULENT.addMemberSpecies(ExtraBeesSpecies.INFECTIOUS);
ExtraBeesBranch.VIRULENT.addMemberSpecies(ExtraBeesSpecies.VIRULENT);
ExtraBeesBranch.VIRULENT.register();
ExtraBeesBranch.CAUSTIC.addMemberSpecies(ExtraBeesSpecies.CORROSIVE);
ExtraBeesBranch.CAUSTIC.addMemberSpecies(ExtraBeesSpecies.CAUSTIC);
ExtraBeesBranch.CAUSTIC.addMemberSpecies(ExtraBeesSpecies.ACIDIC);
ExtraBeesBranch.CAUSTIC.register();
ExtraBeesBranch.ENERGETIC.addMemberSpecies(ExtraBeesSpecies.EXCITED);
ExtraBeesBranch.ENERGETIC.addMemberSpecies(ExtraBeesSpecies.ENERGETIC);
ExtraBeesBranch.ENERGETIC.addMemberSpecies(ExtraBeesSpecies.ECSTATIC);
ExtraBeesBranch.ENERGETIC.register();
ExtraBeesBranch.SHADOW.addMemberSpecies(ExtraBeesSpecies.SHADOW);
ExtraBeesBranch.SHADOW.addMemberSpecies(ExtraBeesSpecies.DARKENED);
ExtraBeesBranch.SHADOW.addMemberSpecies(ExtraBeesSpecies.ABYSS);
ExtraBeesBranch.SHADOW.register();
ExtraBeesBranch.PRIMARY.addMemberSpecies(ExtraBeesSpecies.RED);
ExtraBeesBranch.PRIMARY.addMemberSpecies(ExtraBeesSpecies.YELLOW);
ExtraBeesBranch.PRIMARY.addMemberSpecies(ExtraBeesSpecies.BLUE);
@@ -248,6 +240,7 @@ public enum ExtraBeesBranch implements IClassification
ExtraBeesBranch.PRIMARY.addMemberSpecies(ExtraBeesSpecies.WHITE);
ExtraBeesBranch.PRIMARY.addMemberSpecies(ExtraBeesSpecies.BROWN);
ExtraBeesBranch.PRIMARY.register();
ExtraBeesBranch.SECONDARY.addMemberSpecies(ExtraBeesSpecies.ORANGE);
ExtraBeesBranch.SECONDARY.addMemberSpecies(ExtraBeesSpecies.CYAN);
ExtraBeesBranch.SECONDARY.addMemberSpecies(ExtraBeesSpecies.PURPLE);
@@ -256,19 +249,56 @@ public enum ExtraBeesBranch implements IClassification
ExtraBeesBranch.SECONDARY.addMemberSpecies(ExtraBeesSpecies.PINK);
ExtraBeesBranch.SECONDARY.addMemberSpecies(ExtraBeesSpecies.LIMEGREEN);
ExtraBeesBranch.SECONDARY.register();
ExtraBeesBranch.TERTIARY.addMemberSpecies(ExtraBeesSpecies.MAGENTA);
ExtraBeesBranch.TERTIARY.addMemberSpecies(ExtraBeesSpecies.LIGHTGRAY);
ExtraBeesBranch.TERTIARY.register();
ExtraBeesBranch.FTB.addMemberSpecies(ExtraBeesSpecies.JADED);
ExtraBeesBranch.FTB.register();
ExtraBeesBranch.QUANTUM.addMemberSpecies(ExtraBeesSpecies.UNUSUAL);
ExtraBeesBranch.QUANTUM.addMemberSpecies(ExtraBeesSpecies.SPATIAL);
ExtraBeesBranch.QUANTUM.addMemberSpecies(ExtraBeesSpecies.QUANTUM);
ExtraBeesBranch.QUANTUM.register();
ExtraBeesBranch.BOTANIA.addMemberSpecies(ExtraBeesSpecies.MYSTICAL);
ExtraBeesBranch.BOTANIA.register();
}
@Override
public String getUID() {
return "extrabees.genus." + uid;
}
@Override
public String getName() {
return ExtraBees.proxy.localise("branch." + toString().toLowerCase() + ".name");
}
@Override
public String getScientific() {
return scientific;
}
@Override
public String getDescription() {
return ExtraBees.proxy.localiseOrBlank("branch." + toString().toLowerCase() + ".desc");
}
public void register() {
if (speciesSet.isEmpty()) {
return;
}
AlleleManager.alleleRegistry.registerClassification(this);
IClassification parent = AlleleManager.alleleRegistry.getClassification("family.apidae");
if (parent != null) {
parent.addMemberGroup(this);
setParent(parent);
}
}
@Override
public IClassification.EnumClassLevel getLevel() {
return IClassification.EnumClassLevel.GENUS;
@@ -280,17 +310,17 @@ public enum ExtraBeesBranch implements IClassification
}
@Override
public void addMemberGroup(final IClassification group) {
public void addMemberGroup(IClassification group) {
}
@Override
public IAlleleSpecies[] getMemberSpecies() {
return this.speciesSet.toArray(new IAlleleSpecies[0]);
return speciesSet.toArray(new IAlleleSpecies[0]);
}
@Override
public void addMemberSpecies(final IAlleleSpecies species) {
this.speciesSet.add((IAlleleBeeSpecies) species);
public void addMemberSpecies(IAlleleSpecies species) {
speciesSet.add((IAlleleBeeSpecies) species);
if (species instanceof ExtraBeesSpecies) {
((ExtraBeesSpecies) species).setBranch(this);
}
@@ -298,11 +328,11 @@ public enum ExtraBeesBranch implements IClassification
@Override
public IClassification getParent() {
return this.parent;
return parent;
}
@Override
public void setParent(final IClassification parent) {
public void setParent(IClassification parent) {
this.parent = parent;
}
}
@@ -1,49 +1,35 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.extrabees.genetics;
import forestry.api.apiculture.FlowerManager;
import forestry.api.genetics.IFlower;
import net.minecraft.item.Item;
import java.util.HashSet;
import java.util.List;
import java.util.ArrayList;
import java.util.Set;
import binnie.core.Mods;
import binnie.extrabees.ExtraBees;
import forestry.api.apiculture.FlowerManager;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IAlleleFlowers;
import forestry.api.genetics.IChromosomeType;
import forestry.api.genetics.IFlower;
import forestry.api.genetics.IFlowerProvider;
import forestry.api.genetics.IFruitBearer;
import net.minecraft.world.IBlockAccess;
import net.minecraft.block.material.Material;
import forestry.api.genetics.IIndividual;
import java.util.EnumSet;
import forestry.api.genetics.IPollinatable;
import forestry.api.genetics.ISpeciesRoot;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.EnumPlantType;
import forestry.api.genetics.IPollinatable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import net.minecraft.world.World;
import net.minecraft.init.Items;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IChromosomeType;
import forestry.api.genetics.ISpeciesRoot;
import binnie.extrabees.ExtraBees;
import forestry.api.genetics.IAlleleFlowers;
import forestry.api.genetics.IFlowerProvider;
public enum ExtraBeesFlowers implements IFlowerProvider, IAlleleFlowers, IChromosomeType
{
public enum ExtraBeesFlowers implements IFlowerProvider, IAlleleFlowers, IChromosomeType {
WATER,
SUGAR,
ROCK,
@@ -52,24 +38,30 @@ public enum ExtraBeesFlowers implements IFlowerProvider, IAlleleFlowers, IChromo
REDSTONE,
WOOD,
LEAVES,
Sapling,
Fruit,
Mystical;
SAPLING,
FRUIT,
MYSTICAL;
boolean dominant;
protected boolean dominant;
private ExtraBeesFlowers() {
this.dominant = true;
ExtraBeesFlowers() {
dominant = true;
}
public static void doInit() {
for (ExtraBeesFlowers effect : values()) {
effect.register();
}
}
@Override
public String getUID() {
return "extrabees.flower." + this.toString().toLowerCase();
return "extrabees.flower." + toString().toLowerCase();
}
@Override
public boolean isDominant() {
return this.dominant;
return dominant;
}
@Override
@@ -79,12 +71,11 @@ public enum ExtraBeesFlowers implements IFlowerProvider, IAlleleFlowers, IChromo
@Override
public String getDescription() {
return ExtraBees.proxy.localise("flowers." + this.name().toString().toLowerCase() + ".name");
return ExtraBees.proxy.localise("flowers." + name().toString().toLowerCase() + ".name");
}
public void register() {
// AlleleManager.alleleRegistry.registerAllele((IAllele)this);
for (ItemStack stack : getItemStacks()) {
FlowerManager.flowerRegistry.registerAcceptableFlower(Block.getBlockFromItem(stack.getItem()), getUID());
}
@@ -92,135 +83,125 @@ public enum ExtraBeesFlowers implements IFlowerProvider, IAlleleFlowers, IChromo
AlleleManager.alleleRegistry.registerAllele(this, this);
}
public static void doInit() {
for (final ExtraBeesFlowers effect : values()) {
effect.register();
}
}
public ItemStack[] getItemStacks() {
switch (this) {
case WATER: {
return new ItemStack[] { new ItemStack(Blocks.waterlily) };
}
case SUGAR: {
return new ItemStack[] { new ItemStack(Blocks.reeds) };
}
case ROCK: {
return new ItemStack[] { new ItemStack(Blocks.cobblestone) };
}
case BOOK: {
return new ItemStack[] { new ItemStack(Blocks.bookshelf) };
}
case REDSTONE: {
return new ItemStack[] { new ItemStack(Blocks.redstone_torch) };
}
case DEAD: {
return new ItemStack[] { new ItemStack(Blocks.deadbush) };
}
case Fruit: {
return new ItemStack[] { new ItemStack(Items.apple) };
}
case LEAVES: {
return new ItemStack[] { new ItemStack(Blocks.leaves) };
}
case Sapling: {
return new ItemStack[] { new ItemStack(Blocks.sapling) };
}
case WOOD: {
return new ItemStack[] { new ItemStack(Blocks.log) };
}
default: {
return new ItemStack[0];
}
case WATER:
return new ItemStack[]{new ItemStack(Blocks.waterlily)};
case SUGAR:
return new ItemStack[]{new ItemStack(Blocks.reeds)};
case ROCK:
return new ItemStack[]{new ItemStack(Blocks.cobblestone)};
case BOOK:
return new ItemStack[]{new ItemStack(Blocks.bookshelf)};
case REDSTONE:
return new ItemStack[]{new ItemStack(Blocks.redstone_torch)};
case DEAD:
return new ItemStack[]{new ItemStack(Blocks.deadbush)};
case FRUIT:
return new ItemStack[]{new ItemStack(Items.apple)};
case LEAVES:
return new ItemStack[]{new ItemStack(Blocks.leaves)};
case SAPLING:
return new ItemStack[]{new ItemStack(Blocks.sapling)};
case WOOD:
return new ItemStack[]{new ItemStack(Blocks.log)};
}
return new ItemStack[0];
}
@Override
public boolean isAcceptedPollinatable(final World world, final IPollinatable pollinatable) {
final EnumSet<EnumPlantType> types = pollinatable.getPlantType();
public boolean isAcceptedPollinatable(World world, IPollinatable pollinatable) {
EnumSet<EnumPlantType> types = pollinatable.getPlantType();
return types.size() > 1 || !types.contains(EnumPlantType.Nether);
}
public boolean isAcceptedFlower(final World world, final IIndividual individual, final int x, final int y, final int z) {
final Block block = world.getBlock(x, y, z);
public boolean isAcceptedFlower(World world, IIndividual individual, int x, int y, int z) {
Block block = world.getBlock(x, y, z);
if (block == null) {
return false;
}
switch (this) {
case WATER: {
return block == Blocks.waterlily;
}
case ROCK: {
return block.getMaterial() == Material.rock;
}
case SUGAR: {
return block == Blocks.reeds;
}
case BOOK: {
return block == Blocks.bookshelf;
}
case REDSTONE: {
return block == Blocks.redstone_torch;
}
case DEAD: {
return block == Blocks.deadbush;
}
case WOOD: {
return block.isWood(world, x, y, z);
}
case Fruit: {
return world.getTileEntity(x, y, z) instanceof IFruitBearer;
}
case LEAVES: {
return block.isLeaves(world, x, y, z);
}
case Sapling: {
return block.getClass().getName().toLowerCase().contains("sapling");
}
case Mystical: {
return block == Mods.Botania.block("flower");
}
default: {
return false;
}
case WATER:
return block == Blocks.waterlily;
case ROCK:
return block.getMaterial() == Material.rock;
case SUGAR:
return block == Blocks.reeds;
case BOOK:
return block == Blocks.bookshelf;
case REDSTONE:
return block == Blocks.redstone_torch;
case DEAD:
return block == Blocks.deadbush;
case WOOD:
return block.isWood(world, x, y, z);
case FRUIT:
return world.getTileEntity(x, y, z) instanceof IFruitBearer;
case LEAVES:
return block.isLeaves(world, x, y, z);
case SAPLING:
return block.getClass().getName().toLowerCase().contains("sapling");
case MYSTICAL:
return block == Mods.Botania.block("flower");
}
return false;
}
@Override
public boolean growFlower(final World world, final IIndividual individual, final int x, final int y, final int z) {
public boolean growFlower(World world, IIndividual individual, int x, int y, int z) {
switch (this) {
case WATER: {
return world.isAirBlock(x, y, z) && world.getBlock(x, y - 1, z) == Blocks.water && world.setBlock(x, y, z, Blocks.waterlily, 0, 2);
}
case SUGAR: {
return world.getBlock(x, y - 1, z) == Blocks.reeds && world.isAirBlock(x, y, z) && world.setBlock(x, y, z, Blocks.reeds, 0, 0);
}
default: {
return false;
}
case WATER:
return world.isAirBlock(x, y, z)
&& world.getBlock(x, y - 1, z) == Blocks.water
&& world.setBlock(x, y, z, Blocks.waterlily, 0, 2);
case SUGAR:
return world.getBlock(x, y - 1, z) == Blocks.reeds
&& world.isAirBlock(x, y, z)
&& world.setBlock(x, y, z, Blocks.reeds, 0, 0);
}
return false;
}
@Override
public ItemStack[] affectProducts(final World world, final IIndividual individual, final int x, final int y, final int z, final ItemStack[] products) {
if (this == ExtraBeesFlowers.Mystical) {
final List<ItemStack> prods = new ArrayList<ItemStack>();
for (final ItemStack stack : products) {
prods.add(stack);
}
public ItemStack[] affectProducts(World world, IIndividual individual, int x, int y, int z, ItemStack[] products) {
if (this == ExtraBeesFlowers.MYSTICAL) {
List<ItemStack> prods = new ArrayList<>();
Collections.addAll(prods, products);
for (int k = 0; k < 50; ++k) {
final int tX = 7;
final int tY = 7;
final int tZ = 3;
final int x2 = x - tX + world.rand.nextInt(1 + 2 * tX);
final int y2 = y - tY + world.rand.nextInt(1 + 2 * tY);
final int z2 = z - tZ + world.rand.nextInt(1 + 2 * tZ);
final Block block = world.getBlock(x2, y2, z2);
int tX = 7;
int tY = 7;
int tZ = 3;
int x2 = x - tX + world.rand.nextInt(1 + 2 * tX);
int y2 = y - tY + world.rand.nextInt(1 + 2 * tY);
int z2 = z - tZ + world.rand.nextInt(1 + 2 * tZ);
Block block = world.getBlock(x2, y2, z2);
if (block != null) {
if (block == Mods.Botania.block("flower")) {
final int meta = world.getBlockMetadata(x2, y2, z2);
final Item item = Mods.Botania.item("petal");
int meta = world.getBlockMetadata(x2, y2, z2);
Item item = Mods.Botania.item("petal");
if (item != null) {
prods.add(new ItemStack(item, 1, meta));
}
@@ -234,22 +215,22 @@ public enum ExtraBeesFlowers implements IFlowerProvider, IAlleleFlowers, IChromo
@Override
public String getName() {
return this.getDescription();
return getDescription();
}
@Override
public String getUnlocalizedName() {
return this.getUID();
return getUID();
}
@Override
public String getFlowerType() {
return this.getUID();
return getUID();
}
@Override
public Set<IFlower> getFlowers() {
return new HashSet<IFlower>();
return new HashSet<>();
}
@Override
File diff suppressed because it is too large. Load diff
@@ -1,36 +1,48 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.extrabees.genetics;
import net.minecraft.block.Block;
import binnie.Binnie;
import binnie.core.BinnieCore;
import binnie.core.IInitializable;
import binnie.extrabees.ExtraBees;
import binnie.extrabees.genetics.effect.BlockEctoplasm;
import binnie.extrabees.genetics.effect.ExtraBeesEffect;
import binnie.extrabees.genetics.items.ItemDictionary;
import cpw.mods.fml.common.registry.GameRegistry;
import forestry.api.apiculture.EnumBeeType;
import forestry.api.apiculture.IAlleleBeeSpecies;
import forestry.api.apiculture.IBee;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.genetics.IIndividual;
import forestry.api.apiculture.EnumBeeType;
import binnie.core.BinnieCore;
import forestry.api.genetics.IGenome;
import forestry.api.apiculture.IAlleleBeeSpecies;
import net.minecraft.init.Items;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import binnie.Binnie;
import forestry.api.recipes.RecipeManagers;
import binnie.extrabees.genetics.effect.ExtraBeesEffect;
import cpw.mods.fml.common.registry.GameRegistry;
import binnie.extrabees.genetics.effect.BlockEctoplasm;
import binnie.extrabees.ExtraBees;
import binnie.extrabees.genetics.items.ItemDictionary;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.AlleleManager;
import binnie.core.IInitializable;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IGenome;
import forestry.api.recipes.RecipeManagers;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
public class ModuleGenetics implements IInitializable {
public static IGenome getGenome(IAlleleBeeSpecies allele0) {
return Binnie.Genetics.getBeeRoot().templateAsGenome(Binnie.Genetics.getBeeRoot().getTemplate(allele0.getUID()));
}
// TODO unsused method?
public static ItemStack getBeeIcon(IAlleleBeeSpecies species) {
if (species == null) {
return null;
}
IAllele[] template = Binnie.Genetics.getBeeRoot().getTemplate(species.getUID());
if (template == null) {
return null;
}
IBeeGenome genome = Binnie.Genetics.getBeeRoot().templateAsGenome(template);
IBee bee = Binnie.Genetics.getBeeRoot().getBee(BinnieCore.proxy.getWorld(), genome);
ItemStack item = Binnie.Genetics.getBeeRoot().getMemberStack(bee, EnumBeeType.PRINCESS.ordinal());
return item;
}
public class ModuleGenetics implements IInitializable
{
@Override
public void preInit() {
for (final ExtraBeesSpecies species : ExtraBeesSpecies.values()) {
for (ExtraBeesSpecies species : ExtraBeesSpecies.values()) {
AlleleManager.alleleRegistry.registerAllele(species);
}
ExtraBees.dictionary = new ItemDictionary();
@@ -48,32 +60,15 @@ public class ModuleGenetics implements IInitializable
@Override
public void postInit() {
int ebSpeciesCount = 0;
// unused code?
/*int ebSpeciesCount = 0;
int ebTotalSpeciesCount = 0;
for (final ExtraBeesSpecies species : ExtraBeesSpecies.values()) {
for (ExtraBeesSpecies species : ExtraBeesSpecies.values()) {
++ebTotalSpeciesCount;
if (!AlleleManager.alleleRegistry.isBlacklisted(species.getUID())) {
++ebSpeciesCount;
}
}
RecipeManagers.carpenterManager.addRecipe(100, Binnie.Liquid.getLiquidStack("water", 2000), (ItemStack) null, new ItemStack(ExtraBees.dictionary), new Object[] { "X#X", "YEY", "RDR", '#', Blocks.glass_pane, 'X', Items.gold_ingot, 'Y', "ingotTin", 'R', Items.redstone, 'D', Items.diamond, 'E', Items.emerald });
}
public static IGenome getGenome(final IAlleleBeeSpecies allele0) {
return Binnie.Genetics.getBeeRoot().templateAsGenome(Binnie.Genetics.getBeeRoot().getTemplate(allele0.getUID()));
}
public static ItemStack getBeeIcon(final IAlleleBeeSpecies species) {
if (species == null) {
return null;
}
final IAllele[] template = Binnie.Genetics.getBeeRoot().getTemplate(species.getUID());
if (template == null) {
return null;
}
final IBeeGenome genome = Binnie.Genetics.getBeeRoot().templateAsGenome(template);
final IBee bee = Binnie.Genetics.getBeeRoot().getBee(BinnieCore.proxy.getWorld(), genome);
final ItemStack item = Binnie.Genetics.getBeeRoot().getMemberStack(bee, EnumBeeType.PRINCESS.ordinal());
return item;
}*/
RecipeManagers.carpenterManager.addRecipe(100, Binnie.Liquid.getLiquidStack("water", 2000), null, new ItemStack(ExtraBees.dictionary), "X#X", "YEY", "RDR", '#', Blocks.glass_pane, 'X', Items.gold_ingot, 'Y', "ingotTin", 'R', Items.redstone, 'D', Items.diamond, 'E', Items.emerald);
}
}
@@ -1,38 +1,34 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.extrabees.genetics.effect;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import java.util.Random;
import binnie.extrabees.ExtraBees;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import binnie.extrabees.ExtraBees;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.block.BlockWeb;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import java.util.Random;
public class BlockEctoplasm extends BlockWeb {
public BlockEctoplasm() {
setLightOpacity(1);
setHardness(0.5f);
}
public class BlockEctoplasm extends BlockWeb
{
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(final IIconRegister register) {
this.blockIcon = ExtraBees.proxy.getIcon(register, "ectoplasm");
}
public BlockEctoplasm() {
this.setLightOpacity(1);
this.setHardness(0.5f);
public void registerBlockIcons(IIconRegister register) {
blockIcon = ExtraBees.proxy.getIcon(register, "ectoplasm");
}
@Override
public int quantityDropped(final Random rand) {
public int quantityDropped(Random rand) {
return (rand.nextInt(5) == 0) ? 1 : 0;
}
@Override
public Item getItemDropped(final int p_149650_1_, final Random p_149650_2_, final int p_149650_3_) {
public Item getItemDropped(int meta, Random rand, int fortune) {
return Items.slime_ball;
}
@@ -1,60 +1,56 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.extrabees.genetics.effect;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.block.Block;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.init.Blocks;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraft.entity.effect.EntityLightningBolt;
public class EntityBeeLightning extends EntityLightningBolt
{
import java.util.List;
public class EntityBeeLightning extends EntityLightningBolt {
int lightningState;
int boltLivingTime;
public EntityBeeLightning(final World par1World, final double par2, final double par4, final double par6) {
public EntityBeeLightning(World par1World, double par2, double par4, double par6) {
super(par1World, par2, par4, par6);
this.lightningState = 2;
this.boltLivingTime = this.rand.nextInt(3) + 1;
lightningState = 2;
boltLivingTime = rand.nextInt(3) + 1;
}
@Override
public void onUpdate() {
this.onEntityUpdate();
--this.lightningState;
if (this.lightningState < 0) {
if (this.boltLivingTime == 0) {
this.setDead();
}
else if (this.lightningState < -this.rand.nextInt(10)) {
--this.boltLivingTime;
this.lightningState = 1;
this.boltVertex = this.rand.nextLong();
if (!this.worldObj.isRemote && this.worldObj.doChunksNearChunkExist(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ), 10)) {
final int i = MathHelper.floor_double(this.posX);
final int j = MathHelper.floor_double(this.posY);
final int k = MathHelper.floor_double(this.posZ);
if (this.worldObj.getBlock(i, j, k) == null && Blocks.fire.canPlaceBlockAt(this.worldObj, i, j, k)) {
this.worldObj.setBlock(i, j, k, Blocks.fire);
onEntityUpdate();
lightningState--;
if (lightningState < 0) {
if (boltLivingTime == 0) {
setDead();
} else if (lightningState < -rand.nextInt(10)) {
boltLivingTime--;
lightningState = 1;
boltVertex = rand.nextLong();
if (!worldObj.isRemote && worldObj.doChunksNearChunkExist(MathHelper.floor_double(posX), MathHelper.floor_double(posY), MathHelper.floor_double(posZ), 10)) {
int i = MathHelper.floor_double(posX);
int j = MathHelper.floor_double(posY);
int k = MathHelper.floor_double(posZ);
if (worldObj.getBlock(i, j, k) == null && Blocks.fire.canPlaceBlockAt(worldObj, i, j, k)) {
worldObj.setBlock(i, j, k, Blocks.fire);
}
}
}
}
if (this.lightningState >= 0) {
if (this.worldObj.isRemote) {
this.worldObj.lastLightningBolt = 2;
}
else {
final double d0 = 3.0;
final List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, AxisAlignedBB.getBoundingBox(this.posX - d0, this.posY - d0, this.posZ - d0, this.posX + d0, this.posY + 6.0 + d0, this.posZ + d0));
for (int l = 0; l < list.size(); ++l) {
final Entity entity = (Entity) list.get(l);
if (lightningState >= 0) {
if (worldObj.isRemote) {
worldObj.lastLightningBolt = 2;
} else {
double offset = 3.0;
List list = worldObj.getEntitiesWithinAABBExcludingEntity(this, AxisAlignedBB.getBoundingBox(posX - offset, posY - offset, posZ - offset, posX + offset, posY + 6.0 + offset, posZ + offset));
for (Object aList : list) {
Entity entity = (Entity) aList;
entity.onStruckByLightning(this);
}
}
File diff suppressed because it is too large. Load diff
@@ -1,87 +1,84 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.extrabees.genetics.effect;
import net.minecraft.init.Items;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import java.util.ArrayList;
public class FireworkCreator
{
public enum Shape
{
public class FireworkCreator {
public enum Shape {
Ball,
LargeBall,
Star,
Creeper,
Burst;
Burst
}
public static class Firework
{
boolean flicker;
boolean trail;
ArrayList<Integer> colors;
byte shape;
public static class Firework {
protected boolean flicker;
protected boolean trail;
protected ArrayList<Integer> colors;
protected byte shape;
public Firework() {
this.flicker = false;
this.trail = false;
this.colors = new ArrayList<Integer>();
this.shape = 0;
flicker = false;
trail = false;
colors = new ArrayList<>();
shape = 0;
}
public void setFlicker() {
this.flicker = true;
flicker = true;
}
public void setTrail() {
this.trail = true;
trail = true;
}
public void setShape(final Shape shape) {
public void setShape(Shape shape) {
this.shape = (byte) shape.ordinal();
}
public void addColor(final int color) {
this.colors.add(color);
public void addColor(int color) {
colors.add(color);
}
NBTTagCompound getNBT() {
final NBTTagCompound nbt = new NBTTagCompound();
if (this.flicker) {
NBTTagCompound nbt = new NBTTagCompound();
if (flicker) {
nbt.setBoolean("Flicker", true);
}
if (this.trail) {
if (trail) {
nbt.setBoolean("Trail", true);
}
if (this.colors.size() == 0) {
this.addColor(16777215);
if (colors.size() == 0) {
addColor(0xffffff);
}
final int[] array = new int[this.colors.size()];
for (int i = 0; i < this.colors.size(); ++i) {
array[i] = this.colors.get(i);
int[] array = new int[colors.size()];
for (int i = 0; i < colors.size(); ++i) {
array[i] = colors.get(i);
}
nbt.setIntArray("Colors", array);
nbt.setByte("Type", this.shape);
nbt.setByte("Type", shape);
return nbt;
}
public ItemStack getFirework() {
final NBTTagCompound var15 = new NBTTagCompound();
final NBTTagCompound var16 = new NBTTagCompound();
final NBTTagList var17 = new NBTTagList();
var17.appendTag(this.getNBT());
var16.setTag("Explosions", var17);
var16.setByte("Flight", (byte) 0);
var15.setTag("Fireworks", var16);
final ItemStack item = new ItemStack(Items.fireworks);
item.setTagCompound(var15);
NBTTagCompound fireworksNbt = new NBTTagCompound();
NBTTagCompound fireworkNbt = new NBTTagCompound();
NBTTagList explosions = new NBTTagList();
explosions.appendTag(getNBT());
fireworkNbt.setTag("Explosions", explosions);
fireworkNbt.setByte("Flight", (byte) 0);
fireworksNbt.setTag("Fireworks", fireworkNbt);
ItemStack item = new ItemStack(Items.fireworks);
item.setTagCompound(fireworksNbt);
return item;
}
}
@@ -1,75 +1,72 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.extrabees.genetics.items;
import binnie.extrabees.ExtraBees;
import binnie.extrabees.core.ExtraBeeGUID;
import net.minecraft.world.World;
import forestry.api.core.Tabs;
import net.minecraft.creativetab.CreativeTabs;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import binnie.extrabees.ExtraBees;
import forestry.api.core.Tabs;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
public class ItemDictionary extends Item
{
IIcon iconMaster;
import java.util.List;
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(final IIconRegister register) {
this.itemIcon = ExtraBees.proxy.getIcon(register, "apiaristDatabase");
this.iconMaster = ExtraBees.proxy.getIcon(register, "masterApiaristDatabase");
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIconFromDamage(final int par1) {
return (par1 == 0) ? this.itemIcon : this.iconMaster;
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(final ItemStack par1ItemStack, final EntityPlayer par2EntityPlayer, final List par3List, final boolean par4) {
super.addInformation(par1ItemStack, par2EntityPlayer, par3List, par4);
if (par1ItemStack.getItemDamage() > 0) {
par3List.add("Flora-in-a-box");
}
}
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(final Item par1, final CreativeTabs par2CreativeTabs, final List par3List) {
super.getSubItems(par1, par2CreativeTabs, par3List);
par3List.add(new ItemStack(par1, 1, 1));
}
public class ItemDictionary extends Item {
protected IIcon iconMaster;
public ItemDictionary() {
this.setCreativeTab(Tabs.tabApiculture);
this.setUnlocalizedName("dictionary");
this.setMaxStackSize(1);
setCreativeTab(Tabs.tabApiculture);
setUnlocalizedName("dictionary");
setMaxStackSize(1);
}
@Override
public ItemStack onItemRightClick(final ItemStack itemstack, final World world, final EntityPlayer player) {
if (itemstack.getItemDamage() == 0) {
ExtraBees.proxy.openGui(ExtraBeeGUID.Database, player, (int) player.posX, (int) player.posY, (int) player.posZ);
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister register) {
itemIcon = ExtraBees.proxy.getIcon(register, "apiaristDatabase");
iconMaster = ExtraBees.proxy.getIcon(register, "masterApiaristDatabase");
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIconFromDamage(int par1) {
return (par1 == 0) ? itemIcon : iconMaster;
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
super.addInformation(stack, player, tooltip, advanced);
if (stack.getItemDamage() > 0) {
tooltip.add("Flora-in-a-box");
}
else {
}
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tab, List list) {
super.getSubItems(item, tab, list);
list.add(new ItemStack(item, 1, 1));
}
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
if (stack.getItemDamage() == 0) {
ExtraBees.proxy.openGui(ExtraBeeGUID.Database, player, (int) player.posX, (int) player.posY, (int) player.posZ);
} else {
ExtraBees.proxy.openGui(ExtraBeeGUID.DatabaseNEI, player, (int) player.posX, (int) player.posY, (int) player.posZ);
}
return itemstack;
return stack;
}
@Override
public String getItemStackDisplayName(final ItemStack i) {
return (i.getItemDamage() == 0) ? "Apiarist Database" : "Master Apiarist Database";
public String getItemStackDisplayName(ItemStack stack) {
return (stack.getItemDamage() == 0) ?
"Apiarist Database" :
"Master Apiarist Database";
}
}
@@ -1,41 +1,37 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.extrabees.genetics.items;
import binnie.extrabees.ExtraBees;
import binnie.extrabees.core.ExtraBeeGUID;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import net.minecraft.item.ItemStack;
import net.minecraft.creativetab.CreativeTabs;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import binnie.extrabees.ExtraBees;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
// TODO unused class?
public class ItemPunnettSquare extends Item {
public ItemPunnettSquare() {
setCreativeTab(CreativeTabs.tabTools);
setMaxStackSize(1);
}
public class ItemPunnettSquare extends Item
{
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(final IIconRegister register) {
this.itemIcon = ExtraBees.proxy.getIcon(register, "");
}
public ItemPunnettSquare() {
this.setCreativeTab(CreativeTabs.tabTools);
this.setMaxStackSize(1);
public void registerIcons(IIconRegister register) {
itemIcon = ExtraBees.proxy.getIcon(register, "");
}
@Override
public String getItemStackDisplayName(final ItemStack itemstack) {
public String getItemStackDisplayName(ItemStack itemstack) {
return "Punnett Square";
}
@Override
public ItemStack onItemRightClick(final ItemStack itemstack, final World world, final EntityPlayer player) {
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
ExtraBees.proxy.openGui(ExtraBeeGUID.PunnettSquare, player, (int) player.posX, (int) player.posY, (int) player.posZ);
return itemstack;
return stack;
}
}