Clean up EnumFlowerColor

This commit is contained in:
mezz committed 2017-08-12 16:51:58 -07:00
1 parent 9acfedfa16
commit 151ce90672
7 files changed
+2961 -2932

No files matched your search

File diff suppressed because it is too large. Load diff
@@ -1,5 +1,7 @@
package binnie.botany.api.genetics;
import java.awt.Color;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IClassification;
@@ -7,4 +9,6 @@ public interface IFlowerFactory {
IAlleleFlowerSpeciesBuilder createSpecies(String uid, String unlocalizedName, String authority, String unlocalizedDescription, boolean isDominant, IClassification branch, String binomial, IFlowerType flowerType);
IFlowerMutationBuilder createMutation(IAlleleFlowerSpecies allele0, IAlleleFlowerSpecies allele1, IAllele[] result, int chance);
IAlleleFlowerColor createFlowerColorAllele(String uid, int id, Color color, Color colorWilted, String name, String unlocalizedName, boolean isDominant);
}
@@ -1,25 +1,27 @@
package binnie.botany.api.genetics;
package binnie.botany.genetics;
import java.awt.Color;
import binnie.botany.api.genetics.IAlleleFlowerColor;
import binnie.core.util.I18N;
import forestry.api.genetics.IAlleleInteger;
import net.minecraft.util.text.translation.I18n;
// TODO: move out of API
public class AlleleFlowerColor implements IAlleleFlowerColor {
private int color;
private String uid;
private boolean isDominant;
private String name;
private String unlocalizedName;
private int colorDis;
private int colorWilted;
private int id;
public AlleleFlowerColor(String uid, int id, int color, int colorDis, String name, String unlocalizedName, boolean isDominant) {
this.color = color;
public AlleleFlowerColor(String uid, int id, Color color, Color colorWilted, String name, String unlocalizedName, boolean isDominant) {
this.color = color.getRGB();
this.uid = uid;
this.isDominant = isDominant;
this.name = name;
this.unlocalizedName = unlocalizedName;
this.colorDis = colorDis;
this.colorWilted = colorWilted.getRGB();
this.id = id;
}
@@ -54,8 +56,8 @@ public class AlleleFlowerColor implements IAlleleFlowerColor {
}
@Override
public int getColor(boolean dis) {
return dis ? colorDis : color;
public int getColor(boolean wilted) {
return wilted ? colorWilted : color;
}
@Override
@@ -70,6 +72,6 @@ public class AlleleFlowerColor implements IAlleleFlowerColor {
@Override
public String getColorName() {
return I18n.translateToLocal("botany.color." + getAlleleName());
return I18N.localise("botany.color." + getAlleleName());
}
}
@@ -1,4 +1,7 @@
package binnie.botany.api.genetics;
package binnie.botany.genetics;
import binnie.botany.api.genetics.IColorMix;
import binnie.botany.api.genetics.IFlowerColor;
public final class ColorMix implements IColorMix {
private final IFlowerColor colorFirst;
File diff suppressed because it is too large. Load diff
@@ -1,5 +1,8 @@
package binnie.botany.genetics;
import java.awt.Color;
import binnie.botany.api.genetics.IAlleleFlowerColor;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IClassification;
@@ -25,4 +28,9 @@ public class FlowerFactory implements IFlowerFactory {
BotanyAPI.flowerRoot.registerMutation(mutation);
return mutation;
}
@Override
public IAlleleFlowerColor createFlowerColorAllele(String uid, int id, Color color, Color colorWilted, String name, String unlocalizedName, boolean isDominant) {
return new AlleleFlowerColor(uid, id, color, colorWilted, name, unlocalizedName, isDominant);
}
}
@@ -1,5 +1,6 @@
package binnie.botany.modules;
import binnie.botany.genetics.FlowerColorMutations;
import com.google.common.collect.ImmutableSet;
import javax.annotation.Nullable;
@@ -36,7 +37,6 @@ import binnie.botany.Botany;
import binnie.botany.CreativeTabBotany;
import binnie.botany.api.BotanyAPI;
import binnie.botany.api.gardening.IBlockSoil;
import binnie.botany.api.genetics.EnumFlowerColor;
import binnie.botany.api.genetics.EnumFlowerStage;
import binnie.botany.api.genetics.IFlower;
import binnie.botany.api.genetics.IFlowerRoot;
@@ -79,7 +79,7 @@ public class ModuleFlowers extends Module {
@Override
public void registerItemsAndBlocks() {
AlleleManager.alleleRegistry.registerAllele(ModuleFlowers.alleleEffectNone);
EnumFlowerColor.setupMutations();
FlowerColorMutations.registerFlowerColorMutations();
FlowerDefinition.preInitFlowers();
IBackpackInterface backpackInterface = BackpackManager.backpackInterface;
@@ -117,7 +117,7 @@ public class ModuleFlowers extends Module {
@Override
public void init() {
EnumFlowerColor.initColours();
FlowerColorMutations.registerFlowerColorAlleles();
FlowerDefinition.initFlowers();
}