This commit is contained in:
mezz committed 2017-08-28 22:59:23 -07:00
1 parent caa307e72e
commit 9342817813
418 files changed
+1966 -1834

No files matched your search

@@ -12,6 +12,7 @@ public enum EnumAcidity implements IStringSerializable {
ALKALINE(TextFormatting.AQUA);
@Nullable
private final
TextFormatting color;
EnumAcidity(@Nullable TextFormatting color) {
@@ -13,7 +13,7 @@ public enum EnumMoisture implements IStringSerializable {
DAMP(TextFormatting.DARK_BLUE);
@Nullable
final TextFormatting color;
private final TextFormatting color;
EnumMoisture(@Nullable TextFormatting color) {
this.color = color;
@@ -25,7 +25,7 @@ public enum EnumFlowerChromosome implements IChromosomeType {
SAPPINESS(IAlleleFloat.class),
STEM(IAlleleInteger.class);
private Class<? extends IAllele> cls;
private final Class<? extends IAllele> cls;
EnumFlowerChromosome(Class<? extends IAllele> cls) {
this.cls = cls;
@@ -8,7 +8,7 @@ public enum EnumFlowerStage implements ISpeciesType {
POLLEN("Pollen");
public static final EnumFlowerStage[] VALUES = values();
String name;
private final String name;
EnumFlowerStage(String name) {
this.name = name;
@@ -10,7 +10,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
import binnie.core.util.I18N;
public class CreativeTabBotany extends CreativeTabs {
public static CreativeTabs instance = new CreativeTabBotany();
public static final CreativeTabs INSTANCE = new CreativeTabBotany();
public CreativeTabBotany() {
super("Botany");
@@ -38,7 +38,7 @@ public class BlockCeramic extends Block implements IColoredBlock, IItemModelRegi
setHardness(1.0f);
setResistance(5.0f);
setRegistryName("ceramic");
setCreativeTab(CreativeTabBotany.instance);
setCreativeTab(CreativeTabBotany.INSTANCE);
}
@Override
@@ -71,7 +71,7 @@ public class BlockCeramicBrick extends Block implements IMultipassBlock<CeramicB
setHardness(1.0f);
setResistance(5.0f);
setRegistryName("ceramicBrick");
setCreativeTab(CreativeTabBotany.instance);
setCreativeTab(CreativeTabBotany.INSTANCE);
}
@Override
@@ -170,7 +170,7 @@ public class BlockCeramicBrick extends Block implements IMultipassBlock<CeramicB
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand) {
ItemStack stack = placer.getHeldItem(hand);
CeramicBrickPair pair = new CeramicBrickPair(stack);
return getDefaultState().withProperty(TYPE, pair.type);
return getDefaultState().withProperty(TYPE, pair.getType());
}
@Override
@@ -178,7 +178,7 @@ public class BlockCeramicBrick extends Block implements IMultipassBlock<CeramicB
TileCeramicBrick ceramic = TileUtil.getTile(worldIn, pos, TileCeramicBrick.class);
if (ceramic != null) {
CeramicBrickPair pair = new CeramicBrickPair(stack);
ceramic.setColors(pair.colorFirst, pair.colorSecond);
ceramic.setColors(pair.getColorFirst(), pair.getColorSecond());
}
}
@@ -249,10 +249,12 @@ public class BlockCeramicBrick extends Block implements IMultipassBlock<CeramicB
public void registerSprites(ITextureManager manager) {
TextureMap textureMap = Minecraft.getMinecraft().getTextureMapBlocks();
for (CeramicBrickType type : CeramicBrickType.VALUES) {
type.sprites = new TextureAtlasSprite[3];
TextureAtlasSprite[] sprites = new TextureAtlasSprite[3];
for (int i = 0; i < 3; ++i) {
type.sprites[i] = textureMap.registerSprite(new ResourceLocation(Constants.BOTANY_MOD_ID + ":blocks/ceramic." + type.id + "." + i));
ResourceLocation location = new ResourceLocation(Constants.BOTANY_MOD_ID + ":blocks/ceramic." + type.getId() + "." + i);
sprites[i] = textureMap.registerSprite(location);
}
type.setSprites(sprites);
}
}
@@ -4,6 +4,7 @@ import javax.annotation.Nullable;
import java.util.List;
import java.util.Random;
import binnie.botany.tile.FlowerRenderInfo;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.SoundType;
@@ -153,7 +154,7 @@ public class BlockFlower extends BlockContainer implements IColoredBlock, IState
if (flower != null && flower instanceof TileEntityFlower) {
IFlower f = flowerRoot.getMember(stack);
if (f != null) {
((TileEntityFlower) flower).setRender(new TileEntityFlower.RenderInfo(f, (TileEntityFlower) flower));
((TileEntityFlower) flower).setRender(new FlowerRenderInfo(f, (TileEntityFlower) flower));
}
}
return;
@@ -32,7 +32,7 @@ public class BlockPlant extends BlockBush implements IItemModelRegister {
public BlockPlant() {
setRegistryName("plant");
setCreativeTab(CreativeTabBotany.instance);
setCreativeTab(CreativeTabBotany.INSTANCE);
setTickRandomly(true);
setSoundType(SoundType.PLANT);
}
@@ -54,7 +54,7 @@ public class BlockSoil extends Block implements IBlockSoil, IItemModelRegister {
this.type = type;
this.weedKilled = weedKilled;
setUnlocalizedName("botany.soil." + type.getName());
setCreativeTab(CreativeTabBotany.instance);
setCreativeTab(CreativeTabBotany.INSTANCE);
setRegistryName(blockName);
setTickRandomly(true);
setLightOpacity(255);
@@ -44,7 +44,7 @@ import binnie.core.util.I18N;
public class BlockStainedGlass extends Block implements IBlockMetadata, IColoredBlock, IItemModelRegister {
public BlockStainedGlass() {
super(Material.GLASS);
setCreativeTab(CreativeTabBotany.instance);
setCreativeTab(CreativeTabBotany.INSTANCE);
setRegistryName("stained");
setSoundType(SoundType.GLASS);
setHardness(0.3F);
@@ -12,8 +12,8 @@ public enum PlantType implements IStringSerializable {
DEAD_FLOWER("dead_flower"),
DECAYING_FLOWER("decaying_flower");
String name;
boolean isWeed;
private final String name;
private final boolean isWeed;
PlantType(String name) {
this(name, false);
@@ -19,7 +19,7 @@ public class CeramicColor implements IDesignMaterial {
}
}
EnumFlowerColor color;
private final EnumFlowerColor color;
CeramicColor(EnumFlowerColor color) {
this.color = color;
@@ -48,4 +48,8 @@ public class CeramicColor implements IDesignMaterial {
public int getColour() {
return color.getFlowerColorAllele().getColor(false);
}
public int getMaterialIndex() {
return color.ordinal();
}
}
@@ -25,9 +25,9 @@ import binnie.design.api.IPattern;
import binnie.design.EnumPattern;
public class CeramicDesignSystem implements IDesignSystem {
public static CeramicDesignSystem instance = new CeramicDesignSystem();
Map<Integer, TextureAtlasSprite> primary;
Map<Integer, TextureAtlasSprite> secondary;
public static final CeramicDesignSystem instance = new CeramicDesignSystem();
private final Map<Integer, TextureAtlasSprite> primary;
private final Map<Integer, TextureAtlasSprite> secondary;
CeramicDesignSystem() {
primary = new HashMap<>();
@@ -52,7 +52,7 @@ public class CeramicDesignSystem implements IDesignSystem {
@Override
public int getMaterialIndex(IDesignMaterial id) {
return ((CeramicColor) id).color.ordinal();
return ((CeramicColor) id).getMaterialIndex();
}
public String getTexturePath() {
@@ -17,11 +17,11 @@ import binnie.core.util.I18N;
public class CeramicBrickPair {
public static final CeramicBrickPair EMPTY = new CeramicBrickPair(EnumFlowerColor.DarkSeaGreen, EnumFlowerColor.DarkSeaGreen, CeramicBrickType.TILE);
public final EnumFlowerColor colorFirst;
public final EnumFlowerColor colorSecond;
private final EnumFlowerColor colorFirst;
private final EnumFlowerColor colorSecond;
public CeramicBrickType type;
public int ordinal;
private CeramicBrickType type;
private int ordinal;
public CeramicBrickPair(EnumFlowerColor colorFirst, EnumFlowerColor colorSecond, CeramicBrickType type) {
this.colorFirst = colorFirst;
@@ -63,7 +63,7 @@ public class CeramicBrickPair {
if (type.canDouble() && colorSecond != colorFirst) {
name = name + " & " + colorSecond.getFlowerColorAllele().getColorName();
}
return I18N.localise("botany.ceramic.type." + type.id + ".name", name);
return I18N.localise("botany.ceramic.type." + type.getId() + ".name", name);
}
public int ordinal() {
@@ -72,7 +72,7 @@ public class CeramicBrickPair {
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getSprite(int pass) {
TextureAtlasSprite[] sprites = type.sprites;
TextureAtlasSprite[] sprites = type.getSprites();
Preconditions.checkState(sprites != null, "Sprites have not been registered.");
return sprites[pass];
}
@@ -87,4 +87,20 @@ public class CeramicBrickPair {
return obj instanceof CeramicBrickPair
&& ((CeramicBrickPair) obj).type == type;
}
public EnumFlowerColor getColorFirst() {
return colorFirst;
}
public EnumFlowerColor getColorSecond() {
return colorSecond;
}
public CeramicBrickType getType() {
return type;
}
public void setType(CeramicBrickType type) {
this.type = type;
}
}
@@ -69,8 +69,8 @@ public enum CeramicBrickType implements IStringSerializable {
if (stacks.size() == 1) {
ItemStack stack3 = stacks.get(0);
CeramicBrickPair type3 = new CeramicBrickPair(stack3);
if (type3.type == CeramicBrickType.VERTICAL_LARGE_BRICK) {
type3.type = this;
if (type3.getType() == CeramicBrickType.VERTICAL_LARGE_BRICK) {
type3.setType(this);
return type3.getStack(1);
}
return ItemStack.EMPTY;
@@ -86,10 +86,10 @@ public enum CeramicBrickType implements IStringSerializable {
return ItemStack.EMPTY;
}
CeramicBrickPair type4 = new CeramicBrickPair(stack4);
if (type4.type != CeramicBrickType.TILE) {
if (type4.getType() != CeramicBrickType.TILE) {
return ItemStack.EMPTY;
}
int color5 = type4.colorFirst.ordinal();
int color5 = type4.getColorFirst().ordinal();
if (colors[0] == -1) {
colors[0] = color5;
a++;
@@ -126,10 +126,10 @@ public enum CeramicBrickType implements IStringSerializable {
return ItemStack.EMPTY;
}
CeramicBrickPair type = new CeramicBrickPair(stack2);
if (type.type != CeramicBrickType.TILE) {
if (type.getType() != CeramicBrickType.TILE) {
return ItemStack.EMPTY;
}
int color2 = type.colorFirst.ordinal();
int color2 = type.getColorFirst().ordinal();
if (colors[alt] == -1) {
colors[alt] = color2;
} else if (colors[alt] != color2) {
@@ -152,11 +152,11 @@ public enum CeramicBrickType implements IStringSerializable {
return ItemStack.EMPTY;
}
CeramicBrickPair type2 = new CeramicBrickPair(stack2);
if (type2.type != CeramicBrickType.SPLIT) {
if (type2.getType() != CeramicBrickType.SPLIT) {
return ItemStack.EMPTY;
}
int color3 = type2.colorFirst.ordinal();
int color4 = type2.colorSecond.ordinal();
int color3 = type2.getColorFirst().ordinal();
int color4 = type2.getColorSecond().ordinal();
if (colors[0] == -1) {
colors[0] = color3;
colors[1] = color4;
@@ -184,14 +184,14 @@ public enum CeramicBrickType implements IStringSerializable {
if (type2.isTwoColors()) {
return ItemStack.EMPTY;
}
int color3 = type2.colorFirst.ordinal();
if (type2.type == CeramicBrickType.SPLIT) {
int color3 = type2.getColorFirst().ordinal();
if (type2.getType() == CeramicBrickType.SPLIT) {
if (colors[1] != -1) {
return ItemStack.EMPTY;
}
colors[1] = color3;
} else {
if (type2.type != CeramicBrickType.CHEQUERED) {
if (type2.getType() != CeramicBrickType.CHEQUERED) {
return ItemStack.EMPTY;
}
if (colors[0] == -1) {
@@ -200,7 +200,7 @@ public enum CeramicBrickType implements IStringSerializable {
return ItemStack.EMPTY;
}
}
int color4 = type2.colorSecond.ordinal();
int color4 = type2.getColorSecond().ordinal();
}
if (colors[0] == -1 || colors[1] == -1) {
return ItemStack.EMPTY;
@@ -229,11 +229,11 @@ public enum CeramicBrickType implements IStringSerializable {
public static final CeramicBrickType[] VALUES = values();
public String id;
private final String id;
@SideOnly(Side.CLIENT)
@Nullable
public TextureAtlasSprite[] sprites;
private TextureAtlasSprite[] sprites;
CeramicBrickType(String id) {
this.id = id;
@@ -255,18 +255,18 @@ public enum CeramicBrickType implements IStringSerializable {
}
ItemStack stack5 = stacks.get(0);
CeramicBrickPair type = new CeramicBrickPair(stack5);
if (type.type == CeramicBrickType.LARGE_BRICK) {
type.type = CeramicBrickType.VERTICAL_LARGE_BRICK;
if (type.getType() == CeramicBrickType.LARGE_BRICK) {
type.setType(CeramicBrickType.VERTICAL_LARGE_BRICK);
return type.getStack(1);
}
if (type.type == CeramicBrickType.BRICK) {
type.type = CeramicBrickType.VERTICAL_BRICK;
if (type.getType() == CeramicBrickType.BRICK) {
type.setType(CeramicBrickType.VERTICAL_BRICK);
return type.getStack(1);
}
if (type.type == CeramicBrickType.STRIPE_BRICK) {
type.type = CeramicBrickType.VERTICAL_STRIPE_BRICK;
if (type.getType() == CeramicBrickType.STRIPE_BRICK) {
type.setType(CeramicBrickType.VERTICAL_STRIPE_BRICK);
return type.getStack(1);
}
return ItemStack.EMPTY;
@@ -276,13 +276,13 @@ public enum CeramicBrickType implements IStringSerializable {
if (stacks.size() == 1) {
ItemStack stack5 = stacks.get(0);
CeramicBrickPair type = new CeramicBrickPair(stack5);
if (type.type == CeramicBrickType.VERTICAL_BRICK) {
type.type = ceramicType;
if (type.getType() == CeramicBrickType.VERTICAL_BRICK) {
type.setType(ceramicType);
return type.getStack(1);
}
if (type.type == CeramicBrickType.STRIPE_BRICK) {
type.type = ceramicType;
if (type.getType() == CeramicBrickType.STRIPE_BRICK) {
type.setType(ceramicType);
return type.getStack(1);
}
return ItemStack.EMPTY;
@@ -295,12 +295,12 @@ public enum CeramicBrickType implements IStringSerializable {
}
CeramicBrickPair type4 = new CeramicBrickPair(stack4);
if (type4.type != CeramicBrickType.LARGE_BRICK) {
if (type4.getType() != CeramicBrickType.LARGE_BRICK) {
return ItemStack.EMPTY;
}
int color5 = type4.colorFirst.ordinal();
int color6 = type4.colorSecond.ordinal();
int color5 = type4.getColorFirst().ordinal();
int color6 = type4.getColorSecond().ordinal();
int alt2 = (index2 != 0 && index2 != 3) ? 1 : 0;
if (ceramicType == CeramicBrickType.STRIPE_BRICK) {
alt2 = 0;
@@ -326,4 +326,19 @@ public enum CeramicBrickType implements IStringSerializable {
public String getName() {
return id;
}
public String getId() {
return id;
}
@Nullable
@SideOnly(Side.CLIENT)
public TextureAtlasSprite[] getSprites() {
return sprites;
}
@SideOnly(Side.CLIENT)
public void setSprites(TextureAtlasSprite[] sprites) {
this.sprites = sprites;
}
}
@@ -19,7 +19,7 @@ import binnie.core.util.I18N;
public class CircuitGarden extends BinnieCircuit {
private boolean isManual;
private GardenLogic logic;
private final GardenLogic logic;
public CircuitGarden(EnumMoisture moisture, @Nullable EnumAcidity ph, boolean manual, boolean fertilised, ItemStack recipe, ItemStack icon) {
super(getName(moisture, ph, manual, fertilised), 4, getLayout(manual), recipe);
@@ -10,7 +10,7 @@ import net.minecraft.world.World;
import forestry.api.farming.IFarmLogic;
public abstract class FarmLogic implements IFarmLogic {
boolean isManual;
private boolean isManual;
@Override
public IFarmLogic setManual(boolean flag) {
@@ -46,4 +46,8 @@ public abstract class FarmLogic implements IFarmLogic {
protected final void setBlock(World world, BlockPos pos, Block block, int meta) {
world.setBlockState(pos, block.getStateFromMeta(meta), 2);
}
public boolean isManual() {
return isManual;
}
}
@@ -10,8 +10,8 @@ import net.minecraft.util.math.BlockPos;
import forestry.api.farming.ICrop;
public class FlowerCrop implements ICrop {
NonNullList<ItemStack> drops = NonNullList.create();
BlockPos position;
private final NonNullList<ItemStack> drops = NonNullList.create();
private final BlockPos position;
public FlowerCrop(BlockPos pos, ItemStack... drops) {
Collections.addAll(this.drops, drops);
@@ -43,17 +43,17 @@ import binnie.botany.tile.TileEntityFlower;
import binnie.core.liquid.ManagerLiquid;
public class GardenLogic extends FarmLogic {
List<IFarmable> farmables;
private EnumMoisture moisture;
private final List<IFarmable> farmables;
private final EnumMoisture moisture;
@Nullable
private EnumAcidity acidity;
private boolean fertilised;
private String name;
private final EnumAcidity acidity;
private final boolean fertilised;
private final String name;
private NonNullList<ItemStack> produce;
private ItemStack icon;
public GardenLogic(EnumMoisture moisture, @Nullable EnumAcidity acidity, boolean isManual, boolean isFertilised, ItemStack icon, String name) {
this.isManual = isManual;
this.setManual(isManual);
this.moisture = moisture;
this.acidity = acidity;
this.fertilised = isFertilised;
@@ -96,7 +96,7 @@ public class GardenLogic extends FarmLogic {
@Override
public boolean cultivate(World world, IFarmHousing farmHousing, BlockPos pos, FarmDirection direction, int extent) {
return maintainSoil(world, pos, direction, extent, farmHousing) ||
(!isManual && maintainWater(world, pos, direction, extent, farmHousing)) ||
(!isManual() && maintainWater(world, pos, direction, extent, farmHousing)) ||
maintainCrops(world, pos.up(), direction, extent, farmHousing);
}
@@ -150,7 +150,7 @@ public class GardenLogic extends FarmLogic {
setBlock(world, position, Blocks.AIR, 0);
return trySetSoil(world, position, loam, housing);
}
} else if (!isManual) {
} else if (!isManual()) {
if (!isWaterBlock(world, position)) {
if (i % 2 == 0) {
return trySetSoil(world, position, housing);
@@ -317,7 +317,7 @@ public class GardenLogic extends FarmLogic {
@Override
public Collection<ICrop> harvest(World world, BlockPos pos, FarmDirection direction, int extent) {
if (isManual) {
if (isManual()) {
return Collections.emptyList();
}
return farmables.stream().map(farmable -> farmable.getCropAt(world, pos.up(), world.getBlockState(pos.up())))
@@ -7,13 +7,13 @@ import binnie.core.util.I18N;
import forestry.api.genetics.IAlleleInteger;
public class AlleleFlowerColor implements IAlleleFlowerColor {
private int color;
private String uid;
private boolean isDominant;
private String name;
private String unlocalizedName;
private int colorWilted;
private int id;
private final int color;
private final String uid;
private final boolean isDominant;
private final String name;
private final String unlocalizedName;
private final int colorWilted;
private final int id;
public AlleleFlowerColor(String uid, int id, Color color, Color colorWilted, String name, String unlocalizedName, boolean isDominant) {
this.color = color.getRGB();
@@ -67,10 +67,10 @@ public enum EnumFlowerType implements IFlowerType<EnumFlowerType> {
public static EnumFlowerType[] VALUES = values();
public static int highestSection = 2;
int sections;
ModelResourceLocation flower;
ModelResourceLocation seed;
ModelResourceLocation pollen;
private final int sections;
private ModelResourceLocation flower;
private ModelResourceLocation seed;
private ModelResourceLocation pollen;
EnumFlowerType() {
this(1);
@@ -25,10 +25,10 @@ import binnie.botany.core.BotanyCore;
import binnie.core.util.I18N;
public class Flower extends Individual implements IFlower {
public IFlowerGenome genome;
private final IFlowerGenome genome;
@Nullable
public IFlowerGenome mate;
private IFlowerGenome mate;
private int age;
private boolean wilting;
@@ -51,11 +51,11 @@ public class FlowerAlyzerPlugin implements IAlyzerPlugin {
EnumFlowerChromosome.PH_TOLERANCE
};
private int lastTopOffset;
private int rowSize = 12;
private int margin = 10;
private final int rowSize = 12;
private final int margin = 10;
private int guiLeft;
private int guiTop;
private HashMap<String, ItemStack> iconStacks = new HashMap<>();
private final HashMap<String, ItemStack> iconStacks = new HashMap<>();
public FlowerAlyzerPlugin() {
@@ -65,10 +65,12 @@ public class FlowerAlyzerPlugin implements IAlyzerPlugin {
}
@SideOnly(Side.CLIENT)
public void drawLine(GuiScreen gui, int xOffset, String msg, int color) {
gui.mc.fontRenderer.drawString(msg, guiLeft + xOffset, guiTop + lastTopOffset + margin, color);
}
@SideOnly(Side.CLIENT)
public void drawChromosome(GuiScreen gui, EnumFlowerChromosome chromosome, IFlower flower) {
drawLine(gui, COLUMN_0, StringUtils.capitalize(chromosome.getName()), 0xEEEEEE);
drawLine(gui, COLUMN_1, I18N.localise(flower.getGenome().getActiveAllele(chromosome).getUnlocalizedName()), 0xEEEEEE);
@@ -944,14 +944,15 @@ public enum FlowerDefinition implements IFlowerDefinition {
public static FlowerDefinition[] VALUES = values();
private final IAlleleFlowerSpecies species;
IFlowerType<EnumFlowerType> type;
String name;
String binomial;
String branchName;
List<IAllele[]> variantTemplates;
private final IFlowerType<EnumFlowerType> type;
private final String name;
private final String binomial;
private final String branchName;
private final List<IAllele[]> variantTemplates;
@Nullable
IClassification branch;
EnumFlowerColor primaryColor, secondaryColor;
private IClassification branch;
private final EnumFlowerColor primaryColor;
private final EnumFlowerColor secondaryColor;
private IAllele[] template;
private IFlowerGenome genome;
@@ -42,12 +42,12 @@ import binnie.botany.modules.ModuleFlowers;
import binnie.botany.tile.TileEntityFlower;
public class FlowerRoot extends SpeciesRoot implements IFlowerRoot {
static final String UID = "rootFlowers";
public static int flowerSpeciesCount = -1;
public static ArrayList<IFlower> flowerTemplates = new ArrayList<>();
private static ArrayList<IFlowerMutation> flowerMutations = new ArrayList<>();
private static ArrayList<IColorMix> colourMixes = new ArrayList<>();
Map<ItemStack, IFlower> conversions;
private static final String UID = "rootFlowers";
private static int flowerSpeciesCount = -1;
private static final ArrayList<IFlower> flowerTemplates = new ArrayList<>();
private static final ArrayList<IFlowerMutation> flowerMutations = new ArrayList<>();
private static final ArrayList<IColorMix> colourMixes = new ArrayList<>();
private final Map<ItemStack, IFlower> conversions;
public FlowerRoot() {
conversions = new HashMap<>();
@@ -6,7 +6,7 @@ import binnie.core.gui.controls.listbox.ControlListBox;
public class ControlColorMixBox extends ControlListBox<IColorMix> {
private int index;
private Type type;
private final Type type;
public ControlColorMixBox(IWidget parent, int x, int y, int width, int height, Type type) {
super(parent, x, y, width, height, 12);
@@ -19,10 +19,10 @@ import binnie.core.gui.resource.textures.StandardTexture;
import binnie.core.util.I18N;
public class ControlColorMixSymbol extends Control implements ITooltip {
static Texture MutationPlus = new StandardTexture(2, 94, 16, 16, CraftGUITextureSheet.CONTROLS);
static Texture MutationArrow = new StandardTexture(20, 94, 32, 16, CraftGUITextureSheet.CONTROLS);
IColorMix value;
int type;
private static final Texture MUTATION_PLUS = new StandardTexture(2, 94, 16, 16, CraftGUITextureSheet.CONTROLS);
private static final Texture MUTATION_ARROW = new StandardTexture(20, 94, 32, 16, CraftGUITextureSheet.CONTROLS);
private final IColorMix value;
private final int type;
protected ControlColorMixSymbol(IWidget parent, int x, int y, int type, IColorMix value) {
super(parent, x, y, 16 + type * 16, 16);
@@ -36,9 +36,9 @@ public class ControlColorMixSymbol extends Control implements ITooltip {
public void onRenderBackground(int guiWidth, int guiHeight) {
super.onRenderBackground(guiWidth, guiHeight);
if (type == 0) {
CraftGUI.RENDER.texture(ControlColorMixSymbol.MutationPlus, Point.ZERO);
CraftGUI.RENDER.texture(ControlColorMixSymbol.MUTATION_PLUS, Point.ZERO);
} else {
CraftGUI.RENDER.texture(ControlColorMixSymbol.MutationArrow, Point.ZERO);
CraftGUI.RENDER.texture(ControlColorMixSymbol.MUTATION_ARROW, Point.ZERO);
}
}
@@ -13,8 +13,8 @@ import binnie.core.gui.geometry.Point;
@SideOnly(Side.CLIENT)
public class ControlColorOption extends ControlTextOption<IFlowerColor> {
private ControlColorDisplay controlBee;
private Point boxPosition;
private final ControlColorDisplay controlBee;
private final Point boxPosition;
public ControlColorOption(ControlList<IFlowerColor> controlList, IFlowerColor option, int y) {
super(controlList, option, option.getColorName(), y);
@@ -15,8 +15,8 @@ import binnie.core.gui.database.PageAbstract;
import binnie.core.util.I18N;
public class PageColorMix extends PageAbstract<IFlowerColor> {
ControlText title;
ControlColorMixBox list;
private final ControlText title;
private final ControlColorMixBox list;
public PageColorMix(IWidget parent, DatabaseTab tab) {
super(parent, tab);
@@ -15,13 +15,13 @@ import binnie.core.gui.database.PageAbstract;
import binnie.core.util.I18N;
public class PageColorMixResultant extends PageAbstract<IFlowerColor> {
ControlText pageSpeciesFurther_Title;
ControlColorMixBox pageSpeciesFurther_List;
private final ControlText pageSpeciesFurtherTitle;
private final ControlColorMixBox pageSpeciesFurtherList;
public PageColorMixResultant(IWidget parent, DatabaseTab tab) {
super(parent, tab);
pageSpeciesFurther_Title = new ControlTextCentered(this, 8, I18N.localise(DatabaseConstants.BOTANY_PAGES_KEY + ".species_further.title"));
pageSpeciesFurther_List = new ControlColorMixBox(this, 4, 20, 136, 152, ControlColorMixBox.Type.RESULTANT);
pageSpeciesFurtherTitle = new ControlTextCentered(this, 8, I18N.localise(DatabaseConstants.BOTANY_PAGES_KEY + ".species_further.title"));
pageSpeciesFurtherList = new ControlColorMixBox(this, 4, 20, 136, 152, ControlColorMixBox.Type.RESULTANT);
}
@Override
@@ -32,6 +32,6 @@ public class PageColorMixResultant extends PageAbstract<IFlowerColor> {
mixes.add(mix);
}
}
pageSpeciesFurther_List.setOptions(mixes);
pageSpeciesFurtherList.setOptions(mixes);
}
}
@@ -6,6 +6,7 @@ import java.util.stream.Collectors;
import binnie.core.api.gui.IArea;
import binnie.core.gui.controls.page.ControlPage;
import binnie.core.gui.database.ModeWidgets;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.fml.relauncher.Side;
@@ -22,7 +22,7 @@ public enum BotanyItems implements IItemMiscProvider {
MORTAR,
WEEDKILLER;
String name;
private final String name;
BotanyItems() {
name = name().toLowerCase(Locale.ENGLISH);
@@ -15,7 +15,7 @@ import binnie.core.util.I18N;
public enum CeramicItems implements IItemMiscProvider {
MORTAR;
String name;
private final String name;
CeramicItems() {
name = name().toLowerCase(Locale.ENGLISH);
@@ -15,8 +15,8 @@ public enum EnumTubeInsulate {
public static final EnumTubeInsulate[] VALUES = values();
int color;
String uid;
private final int color;
private final String uid;
EnumTubeInsulate(int color, String uid) {
this.color = color;
@@ -10,8 +10,8 @@ public enum EnumTubeMaterial {
public static final EnumTubeMaterial[] VALUES = values();
int color;
String uid;
private final int color;
private final String uid;
EnumTubeMaterial(int color, String uid) {
this.color = color;
@@ -15,7 +15,7 @@ public class ItemBotany extends Item implements IItemModelRegister {
public ItemBotany(String registryName) {
setRegistryName(registryName);
setUnlocalizedName(registryName);
setCreativeTab(CreativeTabBotany.instance);
setCreativeTab(CreativeTabBotany.INSTANCE);
}
@SideOnly(Side.CLIENT)
@@ -27,9 +27,9 @@ public class ItemCeramicBrick extends ItemBlock implements IColoredItem {
public int getColorFromItemstack(ItemStack stack, int tintIndex) {
CeramicBrickPair ceramic = new CeramicBrickPair(stack);
if (tintIndex == 1) {
return ceramic.colorFirst.getFlowerColorAllele().getColor(false);
return ceramic.getColorFirst().getFlowerColorAllele().getColor(false);
} else if (tintIndex == 2) {
return ceramic.colorSecond.getFlowerColorAllele().getColor(false);
return ceramic.getColorSecond().getFlowerColorAllele().getColor(false);
}
return 0xffffff;
}
@@ -53,13 +53,13 @@ import binnie.botany.modules.ModuleFlowers;
import binnie.core.util.I18N;
public class ItemFlowerGE extends Item implements IColoredItem, IItemModelRegister {
private EnumFlowerStage type;
private String tag;
private final EnumFlowerStage type;
private final String tag;
public ItemFlowerGE(String name, EnumFlowerStage type, String tag) {
this.type = type;
this.tag = tag;
setCreativeTab(CreativeTabBotany.instance);
setCreativeTab(CreativeTabBotany.INSTANCE);
setUnlocalizedName(name);
setRegistryName(name);
hasSubtypes = true;
@@ -35,7 +35,7 @@ public class ItemInsulatedTube extends ItemCore implements IColoredItem {
public ItemInsulatedTube() {
super("insulated_tube");
setUnlocalizedName("botany.insulated_tube");
setCreativeTab(CreativeTabBotany.instance);
setCreativeTab(CreativeTabBotany.INSTANCE);
setHasSubtypes(true);
}
@@ -20,7 +20,7 @@ public class ItemPigment extends Item implements IItemModelRegister, IColoredIte
public ItemPigment() {
setUnlocalizedName("botany.pigment");
setHasSubtypes(true);
setCreativeTab(CreativeTabBotany.instance);
setCreativeTab(CreativeTabBotany.INSTANCE);
setRegistryName("pigment");
}
@@ -29,7 +29,7 @@ import binnie.core.util.I18N;
public class ItemSoilMeter extends Item implements IItemModelRegister {
public ItemSoilMeter() {
setCreativeTab(CreativeTabBotany.instance);
setCreativeTab(CreativeTabBotany.INSTANCE);
setUnlocalizedName("botany.soil_meter");
setMaxStackSize(1);
setRegistryName("soil_meter");
@@ -47,7 +47,7 @@ public class ItemTrowel extends Item implements IItemModelRegister {
theToolMaterial = toolMaterial;
setMaxStackSize(1);
setMaxDamage(toolMaterial.getMaxUses());
setCreativeTab(CreativeTabBotany.instance);
setCreativeTab(CreativeTabBotany.INSTANCE);
modelName = "trowel_" + materialName;
setUnlocalizedName("botany." + modelName);
setRegistryName(modelName);
@@ -20,7 +20,7 @@ public enum BotanyMachine implements IMachineType {
return null;
});
Supplier<MachinePackage> supplier;
private final Supplier<MachinePackage> supplier;
BotanyMachine(final Supplier<MachinePackage> supplier) {
this.supplier = supplier;
@@ -10,7 +10,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class ComponentBotanyGUI extends MachineComponent implements IInteraction.RightClick {
BotanyGUI id;
private final BotanyGUI id;
public ComponentBotanyGUI(final Machine machine, final BotanyGUI id) {
super(machine);
@@ -21,7 +21,7 @@ public final class PackageDesigner extends MachinePackage implements IMachineInf
private final IDesignerType type;
public PackageDesigner(final IDesignerType type) {
super(type.getName(), false);
super(type.getName());
this.type = type;
}
@@ -43,7 +43,4 @@ public final class PackageDesigner extends MachinePackage implements IMachineInf
new ComponentDesignerRecipe(machine, this.type);
}
@Override
public void register() {
}
}
@@ -55,11 +55,11 @@ public class FlowerSpriteManager {
}
private static class FlowerSprites {
private BinnieSprite[] stem;
private BinnieSprite[] variant;
private BinnieSprite[] petal;
private BinnieSprite[] unflowered;
private int sections;
private final BinnieSprite[] stem;
private final BinnieSprite[] variant;
private final BinnieSprite[] petal;
private final BinnieSprite[] unflowered;
private final int sections;
public FlowerSprites(IFlowerType type) {
sections = type.getSections();
@@ -53,7 +53,7 @@ public class ModuleCeramic implements Module {
ceramicTile = new BlockCeramicPatterned();
ceramicBrick = new BlockCeramicBrick();
misc = new ItemMisc(CreativeTabBotany.instance, CeramicItems.values(), "misc_ceramic");
misc = new ItemMisc(CreativeTabBotany.INSTANCE, CeramicItems.values(), "misc_ceramic");
pigment = new ItemPigment();
clay = new ItemClay();
@@ -7,21 +7,6 @@ import binnie.core.modules.Module;
@BinnieModule(moduleID = BotanyModuleUIDs.CORE, moduleContainerID = Constants.BOTANY_MOD_ID, name = "Core", coreModule = true)
public class ModuleCore implements Module {
@Override
public void preInit() {
// ignored
}
@Override
public void init() {
// ignored
}
@Override
public void postInit() {
// ignored
}
@Override
public boolean canBeDisabled() {
return false;
@@ -60,7 +60,7 @@ import binnie.core.util.TileUtil;
@BinnieModule(moduleID = BotanyModuleUIDs.FLOWERS, moduleContainerID = Constants.BOTANY_MOD_ID, name = "Flowers", unlocalizedDescription = "botany.module.flowers")
public class ModuleFlowers implements Module {
public static AlleleEffectNone alleleEffectNone = new AlleleEffectNone();
public static final AlleleEffectNone alleleEffectNone = new AlleleEffectNone();
@Nullable
public static Item botanistBackpack;
/* MODULE GENETIC */
@@ -89,7 +89,7 @@ public class ModuleFlowers implements Module {
BackpackManager.backpackInterface.registerBackpackDefinition("botanist", definition);
botanistBackpack = backpackInterface.createNaturalistBackpack("botanist", BotanyAPI.flowerRoot).setRegistryName("botanist_bag").setUnlocalizedName("botany.botanist_bag");
Botany.proxy.registerItem(botanistBackpack);
botanistBackpack.setCreativeTab(CreativeTabBotany.instance);
botanistBackpack.setCreativeTab(CreativeTabBotany.INSTANCE);
} else {
botanistBackpack = null;
}
@@ -80,7 +80,7 @@ public class ModuleGardening implements Module {
trowelIron = new ItemTrowel(Item.ToolMaterial.IRON, "iron");
trowelDiamond = new ItemTrowel(Item.ToolMaterial.DIAMOND, "diamond");
trowelGold = new ItemTrowel(Item.ToolMaterial.GOLD, "gold");
misc = new ItemMisc(CreativeTabBotany.instance, BotanyItems.values());
misc = new ItemMisc(CreativeTabBotany.INSTANCE, BotanyItems.values());
Botany.proxy.registerBlock(plant, new ItemWeed(plant));
Botany.proxy.registerBlock(soil, new ItemSoil(soil));
@@ -11,27 +11,27 @@ import binnie.core.models.ModelManager;
@SideOnly(Side.CLIENT)
public class ProxyClient extends Proxy implements IBotanyProxy {
public static ModelManager modelManager = new ModelManager(Constants.BOTANY_MOD_ID);
public static final ModelManager MODEL_MANAGER = new ModelManager(Constants.BOTANY_MOD_ID);
@Override
public Item registerItem(Item item) {
modelManager.registerItemClient(item);
MODEL_MANAGER.registerItemClient(item);
return super.registerItem(item);
}
@Override
public Block registerBlock(Block block) {
modelManager.registerBlockClient(block);
MODEL_MANAGER.registerBlockClient(block);
return super.registerBlock(block);
}
@Override
public void registerModels() {
modelManager.registerModels();
MODEL_MANAGER.registerModels();
}
@Override
public void registerItemAndBlockColors() {
modelManager.registerItemAndBlockColors();
MODEL_MANAGER.registerItemAndBlockColors();
}
}
@@ -0,0 +1,96 @@
package binnie.botany.tile;
import binnie.botany.api.genetics.EnumFlowerColor;
import binnie.botany.api.genetics.IFlower;
import binnie.botany.api.genetics.IFlowerColor;
import binnie.botany.api.genetics.IFlowerType;
import binnie.botany.genetics.EnumFlowerType;
import forestry.api.core.INbtWritable;
import net.minecraft.nbt.NBTTagCompound;
public class FlowerRenderInfo implements INbtWritable {
private final IFlowerColor primary;
private final IFlowerColor secondary;
private final IFlowerColor stem;
private final IFlowerType type;
private final byte age;
private final boolean wilted;
private final boolean flowered;
private final byte section;
public FlowerRenderInfo(IFlower flower, TileEntityFlower tile) {
this.section = (byte) tile.getSection();
this.primary = flower.getGenome().getPrimaryColor();
this.secondary = flower.getGenome().getSecondaryColor();
this.stem = flower.getGenome().getStemColor();
this.age = (byte) flower.getAge();
this.wilted = flower.isWilted();
this.flowered = flower.hasFlowered();
this.type = flower.getGenome().getType();
}
public FlowerRenderInfo(NBTTagCompound nbt) {
this.primary = EnumFlowerColor.values()[nbt.getByte("primary")].getFlowerColorAllele();
this.secondary = EnumFlowerColor.values()[nbt.getByte("secondary")].getFlowerColorAllele();
this.stem = EnumFlowerColor.values()[nbt.getByte("stem")].getFlowerColorAllele();
this.type = EnumFlowerType.values()[nbt.getByte("type")];
this.age = nbt.getByte("age");
this.section = nbt.getByte("section");
this.wilted = nbt.getBoolean("wilted");
this.flowered = nbt.getBoolean("flowered");
}
@Override
public boolean equals(Object obj) {
if (obj instanceof FlowerRenderInfo) {
FlowerRenderInfo o = (FlowerRenderInfo) obj;
return o.age == age && o.wilted == wilted && o.flowered == flowered && o.primary == primary && o.secondary == secondary && o.stem == stem && o.type == type;
}
return super.equals(obj);
}
public IFlowerColor getPrimary() {
return primary;
}
public IFlowerColor getSecondary() {
return secondary;
}
public IFlowerColor getStem() {
return stem;
}
public IFlowerType getType() {
return type;
}
public byte getAge() {
return age;
}
public boolean isWilted() {
return wilted;
}
public boolean isFlowered() {
return flowered;
}
public byte getSection() {
return section;
}
@Override
public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
nbt.setByte("primary", (byte) primary.getID());
nbt.setByte("secondary", (byte) secondary.getID());
nbt.setByte("stem", (byte) stem.getID());
nbt.setByte("type", (byte) type.ordinal());
nbt.setByte("age", age);
nbt.setByte("section", section);
nbt.setBoolean("wilted", wilted);
nbt.setBoolean("flowered", flowered);
return nbt;
}
}
@@ -38,7 +38,6 @@ import binnie.botany.api.gardening.IGardeningManager;
import binnie.botany.api.genetics.EnumFlowerStage;
import binnie.botany.api.genetics.IAlleleFlowerSpecies;
import binnie.botany.api.genetics.IFlower;
import binnie.botany.api.genetics.IFlowerColor;
import binnie.botany.api.genetics.IFlowerGenome;
import binnie.botany.api.genetics.IFlowerRoot;
import binnie.botany.api.genetics.IFlowerType;
@@ -52,15 +51,15 @@ import binnie.core.BinnieCore;
public class TileEntityFlower extends TileEntity implements IPollinatable, IButterflyNursery {
@Nullable
IFlower flower;
private IFlower flower;
@Nullable
GameProfile owner;
int section;
private GameProfile owner;
private int section;
@Nullable
RenderInfo renderInfo;
private FlowerRenderInfo renderInfo;
@Nullable
IButterfly caterpillar;
int matureTime;
private IButterfly caterpillar;
private int matureTime;
public TileEntityFlower() {
flower = null;
@@ -327,14 +326,7 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
private NBTTagCompound writeRenderInfo(NBTTagCompound tag) {
if (renderInfo != null) {
NBTTagCompound nbtRenderInfo = new NBTTagCompound();
nbtRenderInfo.setByte("primary", (byte) renderInfo.primary.getID());
nbtRenderInfo.setByte("secondary", (byte) renderInfo.secondary.getID());
nbtRenderInfo.setByte("stem", (byte) renderInfo.stem.getID());
nbtRenderInfo.setByte("type", (byte) renderInfo.type.ordinal());
nbtRenderInfo.setByte("age", renderInfo.age);
nbtRenderInfo.setByte("section", renderInfo.section);
nbtRenderInfo.setBoolean("wilted", renderInfo.wilted);
nbtRenderInfo.setBoolean("flowered", renderInfo.flowered);
renderInfo.writeToNBT(nbtRenderInfo);
tag.setTag("renderinfo", nbtRenderInfo);
}
return tag;
@@ -343,15 +335,7 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
private void readRenderInfo(NBTTagCompound tag) {
if (tag.hasKey("renderinfo")) {
NBTTagCompound infotag = tag.getCompoundTag("renderinfo");
RenderInfo info = new RenderInfo();
info.primary = EnumFlowerColor.values()[infotag.getByte("primary")].getFlowerColorAllele();
info.secondary = EnumFlowerColor.values()[infotag.getByte("secondary")].getFlowerColorAllele();
info.stem = EnumFlowerColor.values()[infotag.getByte("stem")].getFlowerColorAllele();
info.type = EnumFlowerType.values()[infotag.getByte("type")];
info.age = infotag.getByte("age");
info.section = infotag.getByte("section");
info.wilted = infotag.getBoolean("wilted");
info.flowered = infotag.getBoolean("flowered");
FlowerRenderInfo info = new FlowerRenderInfo(infotag);
setRender(info);
}
}
@@ -359,7 +343,6 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
@Override
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt) {
super.onDataPacket(net, pkt);
// TODO client only call?
readRenderInfo(pkt.getNbtCompound());
}
@@ -372,14 +355,14 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
@Override
public SPacketUpdateTileEntity getUpdatePacket() {
if (renderInfo == null && getFlower() != null) {
renderInfo = new RenderInfo(getFlower(), this);
renderInfo = new FlowerRenderInfo(getFlower(), this);
}
return (renderInfo != null) ? new SPacketUpdateTileEntity(pos, 0, getUpdateTag()) : null;
}
public void updateRender(boolean update) {
if (update && getFlower() != null && getFlower().getGenome() != null) {
RenderInfo newInfo = new RenderInfo(getFlower(), this);
FlowerRenderInfo newInfo = new FlowerRenderInfo(getFlower(), this);
if (renderInfo == null || !newInfo.equals(renderInfo)) {
setRender(newInfo);
}
@@ -578,17 +561,6 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
return EnumHumidity.getFromValue(world.getBiome(getPos()).getRainfall());
}
public void setErrorState(int state) {
}
public int getErrorOrdinal() {
return 0;
}
public boolean addProduct(ItemStack product, boolean all) {
return false;
}
@Override
@Nullable
public IButterfly getCaterpillar() {
@@ -637,9 +609,9 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
}*/
}
public void setRender(RenderInfo render) {
public void setRender(FlowerRenderInfo render) {
renderInfo = render;
section = renderInfo.section;
section = renderInfo.getSection();
if (!world.isRemote) {
IBlockState blockState = world.getBlockState(pos);
world.notifyBlockUpdate(pos, blockState, blockState, 0);
@@ -649,43 +621,43 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
}
public int getAge() {
return (renderInfo == null) ? 1 : renderInfo.age;
return (renderInfo == null) ? 1 : renderInfo.getAge();
}
public int getRenderSection() {
return (renderInfo == null) ? 1 : renderInfo.section;
return (renderInfo == null) ? 1 : renderInfo.getSection();
}
public boolean isWilted() {
return renderInfo != null && renderInfo.wilted;
return renderInfo != null && renderInfo.isWilted();
}
public boolean isFlowered() {
return renderInfo == null || renderInfo.flowered;
return renderInfo == null || renderInfo.isFlowered();
}
public int getPrimaryColour() {
return (renderInfo == null)
? EnumFlowerColor.Red.getFlowerColorAllele().getColor(false)
: renderInfo.primary.getColor(isWilted());
: renderInfo.getPrimary().getColor(isWilted());
}
public int getSecondaryColour() {
return (renderInfo == null)
? EnumFlowerColor.Red.getFlowerColorAllele().getColor(false)
: renderInfo.secondary.getColor(isWilted());
: renderInfo.getSecondary().getColor(isWilted());
}
public int getStemColour() {
return (renderInfo == null)
? EnumFlowerColor.Green.getFlowerColorAllele().getColor(false)
: renderInfo.stem.getColor(isWilted());
: renderInfo.getStem().getColor(isWilted());
}
public IFlowerType getType() {
return (renderInfo == null)
? EnumFlowerType.POPPY
: renderInfo.type;
: renderInfo.getType();
}
@Override
@@ -693,22 +665,6 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
return getWorld().getBiome(getPos());
}
@Nullable
public IErrorState getErrorState() {
return null;
}
public void setErrorState(IErrorState state) {
}
public boolean setErrorCondition(boolean condition, IErrorState errorState) {
return false;
}
public Set<IErrorState> getErrorStates() {
return new HashSet<>();
}
@Override
public BlockPos getCoordinates() {
return getPos();
@@ -724,37 +680,4 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
return world;
}
public static class RenderInfo {
public IFlowerColor primary;
public IFlowerColor secondary;
public IFlowerColor stem;
public IFlowerType type;
public byte age;
public boolean wilted;
public boolean flowered;
public byte section;
public RenderInfo() {
}
public RenderInfo(IFlower flower, TileEntityFlower tile) {
section = (byte) tile.getSection();
primary = flower.getGenome().getPrimaryColor();
secondary = flower.getGenome().getSecondaryColor();
stem = flower.getGenome().getStemColor();
age = (byte) flower.getAge();
wilted = flower.isWilted();
flowered = flower.hasFlowered();
type = flower.getGenome().getType();
}
@Override
public boolean equals(Object obj) {
if (obj instanceof RenderInfo) {
RenderInfo o = (RenderInfo) obj;
return o.age == age && o.wilted == wilted && o.flowered == flowered && o.primary == primary && o.secondary == secondary && o.stem == stem && o.type == type;
}
return super.equals(obj);
}
}
}
@@ -6,8 +6,8 @@ public enum Alignment {
LEFT(-1, 0),
RIGHT(1, 0);
int x;
int y;
private final int x;
private final int y;
Alignment(int x, final int y) {
this.x = x;
@@ -3,7 +3,7 @@ package binnie.core.api.gui.events;
import binnie.core.api.gui.IWidget;
public class Event {
IWidget origin;
private final IWidget origin;
public Event(final IWidget origin) {
this.origin = origin;
@@ -21,7 +21,7 @@ import binnie.core.network.packet.MessageBinnie;
import binnie.core.proxy.IProxyCore;
public abstract class AbstractMod implements IPacketProvider, IInitializable {
protected List<IInitializable> modules;
protected final List<IInitializable> modules;
@Nullable
private SimpleNetworkWrapper wrapper;
@@ -4,16 +4,4 @@ public abstract class ManagerBase implements IInitializable {
public ManagerBase() {
Binnie.MANAGERS.add(this);
}
@Override
public void preInit() {
}
@Override
public void init() {
}
@Override
public void postInit() {
}
}
+3 -3
View File
@@ -12,9 +12,9 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class Mods {
public static ModNonnull Forestry = new ModNonnull("forestry");
public static Mod IC2 = new Mod("ic2");
public static Mod Botania = new Mod("botania");
public static final ModNonnull Forestry = new ModNonnull("forestry");
public static final Mod IC2 = new Mod("ic2");
public static final Mod Botania = new Mod("botania");
public static class Mod {
protected final String id;
@@ -10,9 +10,9 @@ import forestry.api.circuits.ICircuit;
import forestry.api.circuits.ICircuitLayout;
public class BinnieCircuit implements ICircuit {
private String uid;
private int limit;
private List<String> tooltips;
private final String uid;
private final int limit;
private final List<String> tooltips;
public BinnieCircuit(final String uid, final int limit, final ICircuitLayout layout, final ItemStack itemStack) {
this.tooltips = new ArrayList<>();
@@ -9,7 +9,7 @@ import binnie.core.BinnieCore;
class BinnieConfiguration extends Configuration {
public AbstractMod mod;
private String filename;
private final String filename;
public BinnieConfiguration(final String filename, final AbstractMod mod) {
super(new File(BinnieCore.getBinnieProxy().getDirectory(), filename));
@@ -1,18 +1,20 @@
package binnie.core.config;
import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.util.LinkedHashMap;
import java.util.Map;
import binnie.core.util.Log;
import net.minecraftforge.common.config.Configuration;
import binnie.core.AbstractMod;
import binnie.core.ManagerBase;
public class ManagerConfig extends ManagerBase {
private Map<Class<?>, Configuration> configurations;
private final Map<Class<?>, Configuration> configurations;
public ManagerConfig() {
this.configurations = new LinkedHashMap<>();
@@ -35,9 +37,11 @@ public class ManagerConfig extends ManagerBase {
if (annotation.annotationType().isAnnotationPresent(ConfigProperty.Type.class)) {
final Class<?> propertyClass = annotation.annotationType().getAnnotation(ConfigProperty.Type.class).propertyClass();
try {
final PropertyBase<?, ?> property = (PropertyBase<?, ?>) propertyClass.getConstructor(Field.class, BinnieConfiguration.class, ConfigProperty.class, annotation.annotationType()).newInstance(field, config, propertyAnnot, annotation.annotationType().cast(annotation));
Constructor<?> constructor = propertyClass.getConstructor(Field.class, BinnieConfiguration.class, ConfigProperty.class, annotation.annotationType());
Annotation cast = annotation.annotationType().cast(annotation);
final PropertyBase<?, ?> property = (PropertyBase<?, ?>) constructor.newInstance(field, config, propertyAnnot, cast);
} catch (InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
e.printStackTrace();
Log.error("Failed to load configuration for property {}", propertyClass, e);
}
}
}
@@ -16,17 +16,17 @@ public @interface PropBoolean {
@Override
protected Property getProperty() {
return this.file.get(this.getCategory(), this.getKey(), this.defaultValue);
return this.getFile().get(this.getCategory(), this.getKey(), this.getDefaultValue());
}
@Override
protected Boolean getConfigValue() {
return this.property.getBoolean(this.defaultValue);
return super.getProperty().getBoolean(this.getDefaultValue());
}
@Override
protected void addComments() {
this.addComment("Default value is " + this.defaultValue + ".");
this.addComment("Default value is " + this.getDefaultValue() + ".");
}
}
}
@@ -16,17 +16,17 @@ public @interface PropDouble {
@Override
protected Property getProperty() {
return this.file.get(this.getCategory(), this.getKey(), this.defaultValue);
return this.getFile().get(this.getCategory(), this.getKey(), this.getDefaultValue());
}
@Override
protected Double getConfigValue() {
return this.property.getDouble(this.defaultValue);
return super.getProperty().getDouble(this.getDefaultValue());
}
@Override
protected void addComments() {
this.addComment("Default value is " + this.defaultValue + ".");
this.addComment("Default value is " + this.getDefaultValue() + ".");
}
}
}
@@ -16,17 +16,17 @@ public @interface PropInteger {
@Override
protected Property getProperty() {
return this.file.get(this.getCategory(), this.getKey(), this.defaultValue);
return this.getFile().get(this.getCategory(), this.getKey(), this.getDefaultValue());
}
@Override
protected Integer getConfigValue() {
return this.property.getInt(this.defaultValue);
return super.getProperty().getInt(this.getDefaultValue());
}
@Override
protected void addComments() {
this.addComment("Default value is " + this.defaultValue + ".");
this.addComment("Default value is " + this.getDefaultValue() + ".");
}
}
}
@@ -20,18 +20,18 @@ public @interface PropPercentage {
@Override
protected Integer getConfigValue() {
return this.property.getInt(this.defaultValue);
return super.getProperty().getInt(this.getDefaultValue());
}
@Override
protected void addComments() {
this.addComment("Default value is " + this.defaultValue + "%.");
this.addComment("Range is " + this.annotatedProperty.lower() + "-" + this.annotatedProperty.upper() + "%.");
this.addComment("Default value is " + this.getDefaultValue() + "%.");
this.addComment("Range is " + this.getAnnotatedProperty().lower() + "-" + this.getAnnotatedProperty().upper() + "%.");
}
@Override
protected Property getProperty() {
return this.file.get(this.getCategory(), this.getKey(), this.defaultValue);
return this.getFile().get(this.getCategory(), this.getKey(), this.getDefaultValue());
}
}
}
@@ -9,13 +9,13 @@ import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
abstract class PropertyBase<ValueType, AnnotationType extends Annotation> {
Configuration file;
Property property;
ValueType defaultValue;
AnnotationType annotatedProperty;
private ConfigProperty configProperty;
private List<String> comments;
private Field field;
private final Configuration file;
private final Property property;
private final ValueType defaultValue;
private final AnnotationType annotatedProperty;
private final ConfigProperty configProperty;
private final List<String> comments;
private final Field field;
protected PropertyBase(final Field field, final BinnieConfiguration file, final ConfigProperty configProperty, final AnnotationType annotedProperty) throws IllegalArgumentException, IllegalAccessException {
this.comments = new ArrayList<>();
@@ -33,7 +33,9 @@ abstract class PropertyBase<ValueType, AnnotationType extends Annotation> {
field.set(null, this.getConfigValue());
}
protected abstract Property getProperty();
protected Property getProperty() {
return property;
}
protected abstract ValueType getConfigValue();
@@ -62,4 +64,16 @@ abstract class PropertyBase<ValueType, AnnotationType extends Annotation> {
}
return comment.toString();
}
public Configuration getFile() {
return file;
}
public ValueType getDefaultValue() {
return defaultValue;
}
public AnnotationType getAnnotatedProperty() {
return annotatedProperty;
}
}
@@ -39,8 +39,8 @@ import binnie.core.ManagerBase;
public class ManagerGenetics extends ManagerBase {
private final Map<ISpeciesRoot, IBreedingSystem> BREEDING_SYSTEMS;
private List<IChromosomeType> invalidChromosomeTypes;
private Map<ISpeciesRoot, Map<IChromosomeType, List<IAllele>>> chromosomeArray;
private final List<IChromosomeType> invalidChromosomeTypes;
private final Map<ISpeciesRoot, Map<IChromosomeType, List<IAllele>>> chromosomeArray;
public ManagerGenetics() {
this.BREEDING_SYSTEMS = new LinkedHashMap<>();
@@ -3,16 +3,15 @@ package binnie.core.genetics;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Biomes;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import com.mojang.authlib.GameProfile;
import forestry.api.apiculture.IBee;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.apiculture.IBeeHousingInventory;
@@ -20,14 +19,13 @@ import forestry.api.apiculture.IBeeListener;
import forestry.api.apiculture.IBeeModifier;
import forestry.api.apiculture.IBeekeepingLogic;
import forestry.api.core.IErrorLogic;
import forestry.api.genetics.IIndividual;
import forestry.apiculture.FakeBeekeepingLogic;
import forestry.apiculture.InventoryBeeHousing;
import forestry.core.errors.FakeErrorLogic;
public class VirtualBeeHousing extends VirtualHousing implements IBeeHousing, IBeeModifier {
ArrayList<IBeeModifier> beeModifier = new ArrayList<>();
private InventoryBeeHousing beeInventory;
private final List<IBeeModifier> beeModifier = new ArrayList<>();
private final InventoryBeeHousing beeInventory;
public VirtualBeeHousing(final EntityPlayer player) {
super(player);
@@ -55,35 +53,6 @@ public class VirtualBeeHousing extends VirtualHousing implements IBeeHousing, IB
return 1.0f;
}
public ItemStack getQueen() {
return ItemStack.EMPTY;
}
public void setQueen(final ItemStack itemstack) {
}
public ItemStack getDrone() {
return ItemStack.EMPTY;
}
public void setDrone(final ItemStack itemstack) {
}
public boolean canBreed() {
return true;
}
@Override
public boolean addProduct(final ItemStack product, final boolean all) {
return false;
}
public void wearOutEquipment(final int amount) {
}
public void onQueenChange(final ItemStack queen) {
}
@Override
public boolean isSealed() {
return false;
@@ -109,20 +78,6 @@ public class VirtualBeeHousing extends VirtualHousing implements IBeeHousing, IB
return 1.0f;
}
public void onQueenDeath(final IBee queen) {
}
public void onPostQueenDeath(final IBee queen) {
}
public boolean onPollenRetrieved(final IBee queen, final IIndividual pollen, final boolean isHandled) {
return false;
}
public boolean onEggLaid(final IBee queen) {
return false;
}
@Override
public float getGeneticDecay(final IBeeGenome genome, final float currentModifier) {
return 1.0f;
@@ -1,10 +1,6 @@
package binnie.core.genetics;
import java.util.Collections;
import java.util.Set;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
@@ -13,11 +9,10 @@ import com.mojang.authlib.GameProfile;
import forestry.api.core.EnumHumidity;
import forestry.api.core.EnumTemperature;
import forestry.api.core.IErrorState;
import forestry.api.genetics.IHousing;
class VirtualHousing implements IHousing {
private EntityPlayer player;
private final EntityPlayer player;
public VirtualHousing(final EntityPlayer player) {
this.player = player;
@@ -47,17 +42,6 @@ class VirtualHousing implements IHousing {
return this.player.world;
}
public void setErrorState(final int state) {
}
public int getErrorOrdinal() {
return 0;
}
public boolean addProduct(final ItemStack product, final boolean all) {
return false;
}
public GameProfile getOwnerName() {
return this.player.getGameProfile();
}
@@ -66,21 +50,6 @@ class VirtualHousing implements IHousing {
return this.player.world.getBiome(getCoordinates());
}
/*public EnumErrorCode getErrorState() {
return null;
}*/
public void setErrorState(final IErrorState state) {
}
public boolean setErrorCondition(final boolean condition, final IErrorState errorState) {
return false;
}
public Set<IErrorState> getErrorStates() {
return Collections.emptySet();
}
@Override
public BlockPos getCoordinates() {
return new BlockPos(getXCoord(), getYCoord(), getZCoord());
@@ -12,7 +12,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
import binnie.core.gui.minecraft.Window;
public final class BinnieGUIHandler implements IGuiHandler {
private IBinnieGUID[] guiIds;
private final IBinnieGUID[] guiIds;
public BinnieGUIHandler(final IBinnieGUID[] guiIds) {
this.guiIds = guiIds;
@@ -14,9 +14,9 @@ public class Tooltip {
public static final byte TYPE_ITEM = 105;
public static final byte TYPE_FLUID = 102;
public int maxWidth;
List<String> tooltip;
ITooltipType type;
private int maxWidth;
private final List<String> tooltip;
private ITooltipType type;
private ItemStack itemStack = ItemStack.EMPTY;
public Tooltip() {
@@ -87,6 +87,10 @@ public class Tooltip {
this.add(NBT_SEPARATOR + nbt.toString() + NBT_SEPARATOR + string);
}
public int getMaxWidth() {
return maxWidth;
}
public enum Type implements ITooltipType {
STANDARD,
HELP,
@@ -21,12 +21,12 @@ import binnie.core.gui.events.EventWidget;
public abstract class TopLevelWidget extends Widget implements ITopLevelWidget {
protected IPoint mousePosition;
@Nullable
IWidget mousedOverWidget;
private IWidget mousedOverWidget;
@Nullable
IWidget draggedWidget;
private IWidget draggedWidget;
@Nullable
IWidget focusedWidget;
IPoint dragStart;
private IWidget focusedWidget;
private IPoint dragStart;
public TopLevelWidget() {
super(null);
@@ -36,12 +36,12 @@ public abstract class TopLevelWidget extends Widget implements ITopLevelWidget {
this.mousePosition = Point.ZERO;
this.dragStart = Point.ZERO;
this.addEventHandler(EventMouse.Down.class, event -> {
TopLevelWidget.this.setDraggedWidget(TopLevelWidget.this.mousedOverWidget, event.getButton());
TopLevelWidget.this.setFocusedWidget(TopLevelWidget.this.mousedOverWidget);
this.setDraggedWidget(this.mousedOverWidget, event.getButton());
this.setFocusedWidget(this.mousedOverWidget);
});
this.addEventHandler(EventMouse.Up.class, event -> TopLevelWidget.this.setDraggedWidget(null));
this.addEventHandler(EventMouse.Up.class, event -> this.setDraggedWidget(null));
this.addEventHandler(EventWidget.StartDrag.class, event -> {
TopLevelWidget.this.dragStart = TopLevelWidget.this.getRelativeMousePosition();
this.dragStart = this.getRelativeMousePosition();
});
}
@@ -32,12 +32,12 @@ public class Widget implements IWidget {
private IWidget cropWidget;
private boolean cropped;
private int color;
private List<IWidget> children;
private List<IWidgetAttribute> attributes;
private final List<IWidget> children;
private final List<IWidgetAttribute> attributes;
protected IPoint position;
protected IPoint size;
private IPoint offset;
private Collection<EventHandler<? extends Event>> eventHandlers;
private final Collection<EventHandler<? extends Event>> eventHandlers;
private boolean visible;
public Widget(@Nullable final IWidget parent) {
@@ -391,10 +391,7 @@ public class Widget implements IWidget {
@Override
public boolean isEnabled() {
IWidget parent = this.getParent();
if (parent != null && !parent.isEnabled()) {
return false;
}
return true;
return parent == null || parent.isEnabled();
}
@Override
@@ -15,7 +15,7 @@ import binnie.core.gui.renderer.RenderUtil;
public class ControlText extends Control implements IControlValue<String> {
private String text;
private TextJustification align;
private final TextJustification align;
public ControlText(final IWidget parent, final IPoint pos, final String text) {
this(parent, new Area(pos, new Point(500, 0)), text, TextJustification.TOP_LEFT);
@@ -18,7 +18,7 @@ import binnie.core.gui.resource.textures.CraftGUITexture;
@SideOnly(Side.CLIENT)
public class ControlTextEdit extends Control implements IControlValue<String> {
private GuiTextField field;
private final GuiTextField field;
private String cachedValue;
public ControlTextEdit(final IWidget parent, final int x, final int y, final int width, final int height) {
@@ -29,22 +29,22 @@ public class ControlTextEdit extends Control implements IControlValue<String> {
this.addAttribute(Attribute.MOUSE_OVER);
this.field.setEnableBackgroundDrawing(false);
this.addSelfEventHandler(EventKey.Down.class, event -> {
ControlTextEdit.this.field.textboxKeyTyped(event.getCharacter(), event.getKey());
final String text = ControlTextEdit.this.getValue();
if (!text.equals(ControlTextEdit.this.cachedValue)) {
ControlTextEdit.this.cachedValue = text;
ControlTextEdit.this.callEvent(new EventTextEdit(ControlTextEdit.this, ControlTextEdit.this.cachedValue));
ControlTextEdit.this.onTextEdit(ControlTextEdit.this.cachedValue);
this.field.textboxKeyTyped(event.getCharacter(), event.getKey());
final String text = this.getValue();
if (!text.equals(this.cachedValue)) {
this.cachedValue = text;
this.callEvent(new EventTextEdit(ControlTextEdit.this, this.cachedValue));
this.onTextEdit(this.cachedValue);
}
});
this.addSelfEventHandler(EventMouse.Down.class, event -> {
ControlTextEdit.this.field.mouseClicked(ControlTextEdit.this.getRelativeMousePosition().xPos(), ControlTextEdit.this.getRelativeMousePosition().yPos(), event.getButton());
this.field.mouseClicked(this.getRelativeMousePosition().xPos(), this.getRelativeMousePosition().yPos(), event.getButton());
});
this.addSelfEventHandler(EventWidget.GainFocus.class, event -> {
ControlTextEdit.this.field.setFocused(true);
this.field.setFocused(true);
});
this.addSelfEventHandler(EventWidget.LoseFocus.class, event -> {
ControlTextEdit.this.field.setFocused(false);
this.field.setFocused(false);
});
}
@@ -61,10 +61,6 @@ public class ControlTextEdit extends Control implements IControlValue<String> {
}
}
@Override
public void onUpdateClient() {
}
protected void onTextEdit(final String value) {
}
@@ -21,9 +21,9 @@ import binnie.core.gui.geometry.Border;
import binnie.core.gui.renderer.RenderUtil;
public abstract class ControlToleranceBar<T extends Enum<T>> extends Control implements ITooltip {
EnumSet<T> tolerated;
EnumSet<T> fullSet;
private Class<T> enumClass;
private final EnumSet<T> tolerated;
private final EnumSet<T> fullSet;
private final Class<T> enumClass;
public ControlToleranceBar(IWidget parent, int x, int y, int width, int height, Class<T> clss) {
super(parent, x, y, width, height);
@@ -18,15 +18,13 @@ import binnie.core.gui.geometry.Point;
import binnie.core.gui.minecraft.Window;
public class Control extends Widget implements ITooltipHelp, ITooltip {
public int extraLevel;
private List<String> helpStrings;
private List<String> tooltipStrings;
private final List<String> helpStrings;
private final List<String> tooltipStrings;
public Control(IWidget parent, int xPos, int yPos, int width, int height) {
super(parent);
this.helpStrings = new ArrayList<>();
this.tooltipStrings = new ArrayList<>();
this.extraLevel = 0;
this.position = new Point(xPos, yPos);
this.size = new Point(width, height);
}
@@ -13,14 +13,14 @@ import binnie.core.gui.geometry.Point;
import binnie.core.util.IValidator;
public class ControlList<T> extends Control implements IControlValue<T> {
ControlListBox<T> parent;
Map<T, IWidget> allOptions;
Map<T, IWidget> optionWidgets;
boolean creating;
private final ControlListBox<T> parent;
private final Map<T, IWidget> allOptions;
private final Map<T, IWidget> optionWidgets;
@Nullable
private
IValidator<IWidget> validator;
@Nullable
private T defaultValue;
private final T defaultValue;
@Nullable
private T value;
@@ -30,7 +30,6 @@ public class ControlList<T> extends Control implements IControlValue<T> {
this.defaultValue = defaultValue;
this.allOptions = new LinkedHashMap<>();
this.optionWidgets = new LinkedHashMap<>();
this.creating = false;
this.parent = parent;
}
@@ -71,7 +70,6 @@ public class ControlList<T> extends Control implements IControlValue<T> {
entry.getValue().hide();
}
}
this.creating = true;
this.setValue(this.getValue());
this.setSize(new Point(this.getSize().xPos(), height));
}
@@ -127,4 +125,10 @@ public class ControlList<T> extends Control implements IControlValue<T> {
this.filterOptions();
}
}
@Nullable
@Override
public ControlListBox<T> getParent() {
return parent;
}
}
@@ -14,19 +14,19 @@ public class ControlListBox<T> extends ControlScrollableContent<ControlList<T>>
ControlList<T> content = this.getContent();
T defaultValue = content == null ? null : content.getDefaultValue();
ControlList<T> child = new ControlList<>(this, 1, 1, this.getWidth() - 2 - this.scrollBarSize, this.getHeight() - 2, defaultValue);
ControlList<T> child = new ControlList<>(this, 1, 1, this.getWidth() - 2 - this.getScrollBarSize(), this.getHeight() - 2, defaultValue);
this.setScrollableContent(child);
this.addEventHandler(EventKey.Down.class, event -> {
if (ControlListBox.this.calculateIsMouseOver()) {
int currentIndex = ControlListBox.this.getContent().getCurrentIndex();
if (this.calculateIsMouseOver()) {
int currentIndex = this.getContent().getCurrentIndex();
if (event.getKey() == 208) {
if (++currentIndex >= ControlListBox.this.getContent().getOptions().size()) {
if (++currentIndex >= this.getContent().getOptions().size()) {
currentIndex = 0;
}
} else if (event.getKey() == 200 && --currentIndex < 0) {
currentIndex = ControlListBox.this.getContent().getOptions().size() - 1;
currentIndex = this.getContent().getOptions().size() - 1;
}
ControlListBox.this.getContent().setIndex(currentIndex);
this.getContent().setIndex(currentIndex);
}
});
}
@@ -11,7 +11,7 @@ import binnie.core.gui.controls.core.IControlValues;
import binnie.core.gui.events.EventValueChanged;
public class ControlPages<T> extends Control implements IControlValues<T>, IControlValue<T> {
T value;
private T value;
public ControlPages(final IWidget parent, final int x, final int y, final int w, final int h) {
super(parent, x, y, w, h);
@@ -4,7 +4,7 @@ import binnie.core.api.gui.IWidget;
import binnie.core.gui.controls.core.Control;
public class ControlScroll extends Control {
private IControlScrollable scrollWidget;
private final IControlScrollable scrollWidget;
public ControlScroll(final IWidget parent, final int x, final int y, final int width, final int height, final IControlScrollable scrollWidget) {
super(parent, x, y, width, height);
@@ -41,10 +41,6 @@ public class ControlScrollBar extends Control {
});
}
@Override
public void onUpdateClient() {
}
@Override
public boolean isEnabled() {
return this.scrollable.getPercentageShown() < 0.99f;
@@ -11,9 +11,9 @@ import binnie.core.gui.geometry.Point;
public class ControlScrollableContent<T extends IWidget> extends Control implements IControlScrollable {
@Nullable
protected T controlChild;
protected int scrollBarSize;
float percentageIndex;
private T controlChild;
private final int scrollBarSize;
private float percentageIndex;
public ControlScrollableContent(final IWidget parent, final int x, final int y, final int w, final int h, final int scrollBarSize) {
super(parent, x, y, w, h);
@@ -118,4 +118,8 @@ public class ControlScrollableContent<T extends IWidget> extends Control impleme
this.setPercentageIndex(minY / (1 - shownPercentage));
}
}
public int getScrollBarSize() {
return scrollBarSize;
}
}
@@ -17,7 +17,7 @@ public class ControlTabBar<T> extends Control implements IControlValue<T> {
}
private T value;
private Alignment alignment;
private final Alignment alignment;
public ControlTabBar(IWidget parent, int x, int y, int width, int height, Alignment alignment, Collection<T> values) {
this(parent, x, y, width, height, alignment, Iterables.get(values, 0));
@@ -16,9 +16,9 @@ import binnie.core.gui.resource.textures.CraftGUITextureSheet;
import binnie.core.gui.resource.textures.StandardTexture;
class ControlBreedingProgress extends Control {
private static Texture Progress = new StandardTexture(80, 22, 4, 4, CraftGUITextureSheet.CONTROLS);
private float percentage;
private int colour;
private static final Texture Progress = new StandardTexture(80, 22, 4, 4, CraftGUITextureSheet.CONTROLS);
private final float percentage;
private final int colour;
public ControlBreedingProgress(final IWidget parent, final int x, final int y, final int width, final int height, final IBreedingSystem system, final float percentage) {
super(parent, x, y, width, height);
@@ -15,7 +15,7 @@ import binnie.core.gui.minecraft.control.ControlItemDisplay;
@SideOnly(Side.CLIENT)
public class ControlItemStackOption extends ControlTextOption<ItemStack> {
private ControlItemDisplay controlBee;
private final ControlItemDisplay controlBee;
public ControlItemStackOption(final ControlList<ItemStack> controlList, final ItemStack option, final int y) {
super(controlList, option, option.getDisplayName(), y);
@@ -12,7 +12,7 @@ import binnie.core.gui.controls.listbox.ControlListBox;
import binnie.core.gui.minecraft.Window;
class ControlMutationBox extends ControlListBox<IMutation> {
private Type type;
private final Type type;
@Nullable
private IAlleleSpecies species;
@@ -19,18 +19,18 @@ class ControlMutationItem extends ControlOption<IMutation> {
ControlIndividualDisplay resultIndividual = new ControlIndividualDisplay(this, 104, 4);
ControlMutationSymbol addSymbol = new ControlMutationSymbol(this, 24, 4, 0);
ControlMutationSymbol arrowSymbol = new ControlMutationSymbol(this, 64, 4, 1);
final boolean isNEI = ((WindowAbstractDatabase) this.getTopParent()).isMaster();
final boolean isMaster = ((WindowAbstractDatabase) this.getTopParent()).isMaster();
final IBreedingSystem system = ((WindowAbstractDatabase) this.getTopParent()).getBreedingSystem();
if (this.getValue() != null) {
final boolean isMutationDiscovered = system.isMutationDiscovered(this.getValue(), Window.get(this).getWorld(), Window.get(this).getUsername());
IAlleleSpecies allele = this.getValue().getAllele0();
EnumDiscoveryState state = ((isNEI || isMutationDiscovered) ? EnumDiscoveryState.SHOW : ((species.equals(allele)) ? EnumDiscoveryState.SHOW : EnumDiscoveryState.UNDETERMINED));
EnumDiscoveryState state = ((isMaster || isMutationDiscovered) ? EnumDiscoveryState.SHOW : ((species.equals(allele)) ? EnumDiscoveryState.SHOW : EnumDiscoveryState.UNDETERMINED));
firstIndividual.setSpecies(allele, state);
allele = this.getValue().getAllele1();
state = ((isNEI || isMutationDiscovered) ? EnumDiscoveryState.SHOW : ((species.equals(allele)) ? EnumDiscoveryState.SHOW : EnumDiscoveryState.UNDETERMINED));
state = ((isMaster || isMutationDiscovered) ? EnumDiscoveryState.SHOW : ((species.equals(allele)) ? EnumDiscoveryState.SHOW : EnumDiscoveryState.UNDETERMINED));
secondIndividual.setSpecies(allele, state);
allele = (IAlleleSpecies) this.getValue().getTemplate()[0];
state = ((isNEI || isMutationDiscovered) ? EnumDiscoveryState.SHOW : ((species.equals(allele)) ? EnumDiscoveryState.SHOW : EnumDiscoveryState.UNDETERMINED));
state = ((isMaster || isMutationDiscovered) ? EnumDiscoveryState.SHOW : ((species.equals(allele)) ? EnumDiscoveryState.SHOW : EnumDiscoveryState.UNDETERMINED));
resultIndividual.setSpecies(allele, state);
addSymbol.setValue(this.getValue());
arrowSymbol.setValue(this.getValue());
@@ -23,11 +23,11 @@ import binnie.core.gui.resource.textures.StandardTexture;
import binnie.core.util.I18N;
class ControlMutationSymbol extends Control implements ITooltip {
private static Texture MutationPlus = new StandardTexture(2, 94, 16, 16, CraftGUITextureSheet.CONTROLS);
private static Texture MutationArrow = new StandardTexture(20, 94, 32, 16, CraftGUITextureSheet.CONTROLS);
private static final Texture MutationPlus = new StandardTexture(2, 94, 16, 16, CraftGUITextureSheet.CONTROLS);
private static final Texture MutationArrow = new StandardTexture(20, 94, 32, 16, CraftGUITextureSheet.CONTROLS);
private IMutation value;
private boolean discovered;
private int type;
private final int type;
protected ControlMutationSymbol(final IWidget parent, final int x, final int y, final int type) {
super(parent, x, y, 16 + type * 16, 16);
@@ -49,9 +49,9 @@ class ControlMutationSymbol extends Control implements ITooltip {
public void setValue(final IMutation value) {
this.value = value;
final boolean isNEI = ((WindowAbstractDatabase) this.getTopParent()).isMaster();
final boolean isMaster = ((WindowAbstractDatabase) this.getTopParent()).isMaster();
final IBreedingSystem system = ((WindowAbstractDatabase) this.getTopParent()).getBreedingSystem();
this.discovered = (isNEI || system.isMutationDiscovered(value, Window.get(this).getWorld(), Window.get(this).getUsername()));
this.discovered = (isMaster || system.isMutationDiscovered(value, Window.get(this).getWorld(), Window.get(this).getUsername()));
if (this.discovered) {
this.setColor(16777215);
} else {
@@ -14,7 +14,7 @@ import binnie.core.gui.geometry.Point;
@SideOnly(Side.CLIENT)
class ControlSpeciesBoxOption extends ControlTextOption<IAlleleSpecies> {
private ControlIndividualDisplay controlBee;
private final ControlIndividualDisplay controlBee;
public ControlSpeciesBoxOption(final ControlList<IAlleleSpecies> controlList, final IAlleleSpecies option, final int y) {
super(controlList, option, option.getAlleleName(), y);
@@ -6,8 +6,8 @@ import binnie.core.gui.Tooltip;
import binnie.core.util.I18N;
public class DatabaseTab implements ITooltipHelp {
private String modId;
private String unloc;
private final String modId;
private final String unloc;
public DatabaseTab(final AbstractMod mod, final String unloc) {
this.modId = mod.getModId();
@@ -0,0 +1,50 @@
package binnie.core.gui.database;
import binnie.core.api.gui.IArea;
import binnie.core.gui.controls.listbox.ControlListBox;
import binnie.core.gui.controls.page.ControlPage;
import binnie.core.gui.controls.page.ControlPages;
import binnie.core.gui.controls.tab.ControlTabBar;
import binnie.core.gui.geometry.CraftGUIUtil;
import binnie.core.gui.geometry.Point;
public final class ModeWidgets {
public ControlPage<IDatabaseMode> getModePage() {
return modePage;
}
public ControlListBox getListBox() {
return listBox;
}
@FunctionalInterface
public interface IListBoxCreator {
ControlListBox createListBox(IArea area, ControlPage<IDatabaseMode> modePage);
}
private final ControlPage<IDatabaseMode> modePage;
private final ControlListBox listBox;
private final ControlPages<DatabaseTab> infoPages;
private ControlTabBar<DatabaseTab> infoTabs;
public ModeWidgets(IDatabaseMode mode, WindowAbstractDatabase database, IListBoxCreator listBoxCreator) {
this.modePage = new ControlPage<>(database.getModePages(), 0, 0, database.getSize().xPos(), database.getSize().yPos(), mode);
final IArea listBoxArea = database.getPanelSearch().getArea().inset(2);
this.listBox = listBoxCreator.createListBox(listBoxArea, this.modePage);
CraftGUIUtil.alignToWidget(this.listBox, database.getPanelSearch());
CraftGUIUtil.moveWidget(this.listBox, new Point(2, 2));
CraftGUIUtil.alignToWidget(this.infoPages = new ControlPages<>(this.modePage, 0, 0, 144, 176), database.getPanelInformation());
}
public ControlPages<DatabaseTab> getInfoPages() {
return infoPages;
}
public ControlTabBar<DatabaseTab> getInfoTabs() {
return infoTabs;
}
public void setInfoTabs(ControlTabBar<DatabaseTab> infoTabs) {
this.infoTabs = infoTabs;
}
}
@@ -19,10 +19,10 @@ import binnie.core.util.I18N;
@SideOnly(Side.CLIENT)
public class PageBranchOverview extends PageBranch {
private ControlText branchName;
private ControlText branchScientific;
private ControlText branchAuthority;
private List<ControlText> branchDescription;
private final ControlText branchName;
private final ControlText branchScientific;
private final ControlText branchAuthority;
private final List<ControlText> branchDescription;
public PageBranchOverview(final IWidget parent, final DatabaseTab tab) {
super(parent, tab);
@@ -14,8 +14,8 @@ import binnie.core.util.I18N;
@SideOnly(Side.CLIENT)
public class PageBranchSpecies extends PageBranch {
private ControlText pageBranchSpecies_title;
private ControlSpeciesBox pageBranchSpecies_speciesList;
private final ControlText pageBranchSpecies_title;
private final ControlSpeciesBox pageBranchSpecies_speciesList;
/*@Mod.EventHandler
public void onHandleEvent(final EventValueChanged<IAlleleSpecies> event) {
@@ -12,7 +12,7 @@ import binnie.core.gui.minecraft.Window;
import binnie.core.util.I18N;
public class PageBreeder extends ControlPage<DatabaseTab> {
private GameProfile player;
private final GameProfile player;
public PageBreeder(final IWidget parent, final GameProfile player, final DatabaseTab tab) {
super(parent, 0, 0, parent.getSize().xPos(), parent.getSize().yPos(), tab);
@@ -11,8 +11,8 @@ import binnie.core.gui.controls.ControlText;
import binnie.core.gui.controls.ControlTextCentered;
public class PageSpeciesClassification extends PageSpecies {
private Map<IClassification.EnumClassLevel, ControlText> levels;
private ControlText genus;
private final Map<IClassification.EnumClassLevel, ControlText> levels;
private final ControlText genus;
public PageSpeciesClassification(final IWidget parent, final DatabaseTab tab) {
super(parent, tab);
@@ -8,8 +8,8 @@ import binnie.core.gui.controls.ControlTextCentered;
import binnie.core.util.I18N;
public class PageSpeciesMutations extends PageSpecies {
private ControlText title;
private ControlMutationBox list;
private final ControlText title;
private final ControlMutationBox list;
public PageSpeciesMutations(final IWidget parent, final DatabaseTab tab) {
super(parent, tab);
@@ -20,14 +20,14 @@ import binnie.core.util.I18N;
@SideOnly(Side.CLIENT)
public class PageSpeciesOverview extends PageSpecies {
private ControlText controlName;
private ControlText controlScientific;
private ControlText controlAuthority;
private ControlText controlComplexity;
private ControlText controlDescription;
private ControlText controlSignature;
private ControlIndividualDisplay controlInd1;
private ControlIndividualDisplay controlInd2;
private final ControlText controlName;
private final ControlText controlScientific;
private final ControlText controlAuthority;
private final ControlText controlComplexity;
private final ControlText controlDescription;
private final ControlText controlSignature;
private final ControlIndividualDisplay controlInd1;
private final ControlIndividualDisplay controlInd2;
public PageSpeciesOverview(final IWidget parent, final DatabaseTab tab) {
super(parent, tab);
@@ -8,8 +8,8 @@ import binnie.core.gui.controls.ControlTextCentered;
import binnie.core.util.I18N;
public class PageSpeciesResultant extends PageSpecies {
private ControlText title;
private ControlMutationBox list;
private final ControlText title;
private final ControlMutationBox list;
public PageSpeciesResultant(final IWidget parent, final DatabaseTab tab) {
super(parent, tab);
Loaded 100 of 418 files, more files were not shown because too many files have changed in this diff. Show more