mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-18 19:39:37 +00:00
Some reformat code for 1.11.2 source (#84)
* Optimized imports * Some code reformat * Some refactoring and code reformat * Some code reformat
This commit is contained in:
1 parent
886c36a308
commit
c3809fbc27
508 files changed
+6677
-6238
No files matched your search
@@ -13,5 +13,4 @@ public final class Constants {
|
||||
public static final String LIQUID_CREOSOTE = "Creosote Oil";
|
||||
public static final String LIQUID_BIO_ETHANOL = "bioethanol";
|
||||
public static final String LIQUID_FOR_HONEY = "for.honey";
|
||||
|
||||
}
|
||||
@@ -16,7 +16,12 @@ import binnie.botany.flower.BlockFlower;
|
||||
import binnie.botany.flower.ItemBotany;
|
||||
import binnie.botany.flower.ItemInsulatedTube;
|
||||
import binnie.botany.flower.TileEntityFlower;
|
||||
import binnie.botany.gardening.*;
|
||||
import binnie.botany.gardening.BlockPlant;
|
||||
import binnie.botany.gardening.BlockSoil;
|
||||
import binnie.botany.gardening.Gardening;
|
||||
import binnie.botany.gardening.ItemSoilMeter;
|
||||
import binnie.botany.gardening.ItemTrowel;
|
||||
import binnie.botany.gardening.ModuleGardening;
|
||||
import binnie.botany.genetics.ItemDictionary;
|
||||
import binnie.botany.genetics.ModuleGenetics;
|
||||
import binnie.botany.items.ItemClay;
|
||||
@@ -51,22 +56,20 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
@Mod(modid = Constants.BOTANY_MOD_ID, name = "Binnie's Botany", useMetadata = true, dependencies = "required-after:" + Constants.CORE_MOD_ID)
|
||||
public class Botany extends AbstractMod {
|
||||
public static final float AGE_CHANCE = 0.2f;
|
||||
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@Mod.Instance(Constants.BOTANY_MOD_ID)
|
||||
public static Botany instance;
|
||||
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@SidedProxy(clientSide = "binnie.botany.proxy.ProxyClient", serverSide = "binnie.botany.proxy.ProxyServer")
|
||||
public static Proxy proxy;
|
||||
|
||||
/* MODULE GENETIC */
|
||||
public static BlockFlower flower;
|
||||
public static ItemBotany flowerItem;
|
||||
public static ItemBotany seed;
|
||||
public static ItemBotany pollen;
|
||||
public static ItemDictionary database;
|
||||
|
||||
/* MODULE GARDENING */
|
||||
public static BlockPlant plant;
|
||||
public static ItemTrowel trowelWood;
|
||||
@@ -90,8 +93,6 @@ public class Botany extends AbstractMod {
|
||||
public static BlockStainedGlass stained;
|
||||
public static BlockCeramicBrick ceramicBrick;
|
||||
|
||||
public static final float AGE_CHANCE = 0.2f;
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preInit(final FMLPreInitializationEvent evt) {
|
||||
this.preInit();
|
||||
@@ -157,24 +158,30 @@ public class Botany extends AbstractMod {
|
||||
@SubscribeEvent
|
||||
public void onShearFlower(final PlayerInteractEvent.RightClickBlock event) {
|
||||
EntityPlayer player = event.getEntityPlayer();
|
||||
if (player != null) {
|
||||
ItemStack heldItem = player.getHeldItemMainhand();
|
||||
if (!heldItem.isEmpty()) {
|
||||
TileEntity tile = event.getWorld().getTileEntity(event.getPos());
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
TileEntityFlower flower = (TileEntityFlower) tile;
|
||||
if (heldItem.getItem() == Items.SHEARS) {
|
||||
flower.onShear();
|
||||
heldItem.damageItem(1, player);
|
||||
} else if (heldItem.getItem() == Botany.pollen) {
|
||||
IFlower pollen = BotanyCore.getFlowerRoot().getMember(heldItem);
|
||||
if (pollen != null && flower.canMateWith(pollen)) {
|
||||
flower.mateWith(pollen);
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
heldItem.shrink(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack heldItem = player.getHeldItemMainhand();
|
||||
if (heldItem.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
TileEntity tile = event.getWorld().getTileEntity(event.getPos());
|
||||
if (!(tile instanceof TileEntityFlower)) {
|
||||
return;
|
||||
}
|
||||
|
||||
TileEntityFlower flower = (TileEntityFlower) tile;
|
||||
if (heldItem.getItem() == Items.SHEARS) {
|
||||
flower.onShear();
|
||||
heldItem.damageItem(1, player);
|
||||
} else if (heldItem.getItem() == Botany.pollen) {
|
||||
IFlower pollen = BotanyCore.getFlowerRoot().getMember(heldItem);
|
||||
if (pollen != null && flower.canMateWith(pollen)) {
|
||||
flower.mateWith(pollen);
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
heldItem.shrink(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -186,49 +193,60 @@ public class Botany extends AbstractMod {
|
||||
if (world == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
BlockPos pos = event.getPos();
|
||||
EntityPlayer player = event.getEntityPlayer();
|
||||
if (player != null) {
|
||||
ItemStack heldItem = player.getHeldItemMainhand();
|
||||
if (!heldItem.isEmpty()) {
|
||||
Block block = world.getBlockState(event.getPos()).getBlock();
|
||||
if (!Gardening.isSoil(block)) {
|
||||
pos = pos.down();
|
||||
block = world.getBlockState(pos).getBlock();
|
||||
}
|
||||
if (Gardening.isSoil(block)) {
|
||||
IBlockSoil soil = (IBlockSoil) block;
|
||||
int fertiliserStrength = Gardening.getFertiliserStrength(heldItem);
|
||||
if (Gardening.isNutrientFertiliser(heldItem) && soil.getType(world, pos) != EnumSoilType.FLOWERBED) {
|
||||
EnumSoilType type = soil.getType(world, pos);
|
||||
int next = Math.min(type.ordinal() + fertiliserStrength, 2);
|
||||
if (soil.fertilise(world, pos, EnumSoilType.values()[next]) && !player.capabilities.isCreativeMode) {
|
||||
heldItem.shrink(1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (Gardening.isAcidFertiliser(heldItem) && soil.getPH(world, pos) != EnumAcidity.Acid) {
|
||||
EnumAcidity pH = soil.getPH(world, pos);
|
||||
int next = Math.max(pH.ordinal() - fertiliserStrength, 0);
|
||||
if (soil.setPH(world, pos, EnumAcidity.values()[next]) && !player.capabilities.isCreativeMode) {
|
||||
heldItem.shrink(1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (Gardening.isAlkalineFertiliser(heldItem) && soil.getPH(world, pos) != EnumAcidity.Alkaline) {
|
||||
EnumAcidity pH = soil.getPH(world, pos);
|
||||
int next = Math.min(pH.ordinal() + fertiliserStrength, 2);
|
||||
if (soil.setPH(world, pos, EnumAcidity.values()[next]) && !player.capabilities.isCreativeMode) {
|
||||
heldItem.shrink(1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (Gardening.isWeedkiller(heldItem) && Gardening.addWeedKiller(world, pos) && !player.capabilities.isCreativeMode) {
|
||||
heldItem.shrink(1);
|
||||
}
|
||||
}
|
||||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack heldItem = player.getHeldItemMainhand();
|
||||
if (heldItem.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Block block = world.getBlockState(event.getPos()).getBlock();
|
||||
if (!Gardening.isSoil(block)) {
|
||||
pos = pos.down();
|
||||
block = world.getBlockState(pos).getBlock();
|
||||
}
|
||||
|
||||
if (!Gardening.isSoil(block)) {
|
||||
return;
|
||||
}
|
||||
|
||||
IBlockSoil soil = (IBlockSoil) block;
|
||||
int fertiliserStrength = Gardening.getFertiliserStrength(heldItem);
|
||||
if (Gardening.isNutrientFertiliser(heldItem) && soil.getType(world, pos) != EnumSoilType.FLOWERBED) {
|
||||
EnumSoilType type = soil.getType(world, pos);
|
||||
int next = Math.min(type.ordinal() + fertiliserStrength, 2);
|
||||
if (soil.fertilise(world, pos, EnumSoilType.values()[next]) && !player.capabilities.isCreativeMode) {
|
||||
heldItem.shrink(1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (Gardening.isAcidFertiliser(heldItem) && soil.getPH(world, pos) != EnumAcidity.ACID) {
|
||||
EnumAcidity pH = soil.getPH(world, pos);
|
||||
int next = Math.max(pH.ordinal() - fertiliserStrength, 0);
|
||||
if (soil.setPH(world, pos, EnumAcidity.values()[next]) && !player.capabilities.isCreativeMode) {
|
||||
heldItem.shrink(1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (Gardening.isAlkalineFertiliser(heldItem) && soil.getPH(world, pos) != EnumAcidity.ALKALINE) {
|
||||
EnumAcidity pH = soil.getPH(world, pos);
|
||||
int next = Math.min(pH.ordinal() + fertiliserStrength, 2);
|
||||
if (soil.setPH(world, pos, EnumAcidity.values()[next]) && !player.capabilities.isCreativeMode) {
|
||||
heldItem.shrink(1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (Gardening.isWeedkiller(heldItem) && Gardening.addWeedKiller(world, pos) && !player.capabilities.isCreativeMode) {
|
||||
heldItem.shrink(1);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@@ -318,5 +336,4 @@ public class Botany extends AbstractMod {
|
||||
super(Botany.instance);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,15 +9,15 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
public class CreativeTabBotany extends CreativeTabs {
|
||||
public static CreativeTabs instance = new CreativeTabBotany();
|
||||
|
||||
public CreativeTabBotany() {
|
||||
super("Botany");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getIconItemStack() {
|
||||
return new ItemStack(Blocks.RED_FLOWER, 1, 5);
|
||||
}
|
||||
|
||||
public CreativeTabBotany() {
|
||||
super("Botany");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getTranslatedTabLabel() {
|
||||
@@ -35,5 +35,4 @@ public class CreativeTabBotany extends CreativeTabs {
|
||||
public ItemStack getTabIconItem() {
|
||||
return new ItemStack(Blocks.YELLOW_FLOWER);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,9 +7,9 @@ import net.minecraft.util.text.translation.I18n;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public enum EnumAcidity implements IStringSerializable {
|
||||
Acid(TextFormatting.RED),
|
||||
Neutral(null),
|
||||
Alkaline(TextFormatting.AQUA);
|
||||
ACID(TextFormatting.RED),
|
||||
NEUTRAL(null),
|
||||
ALKALINE(TextFormatting.AQUA);
|
||||
|
||||
@Nullable
|
||||
final TextFormatting color;
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
package binnie.botany.api;
|
||||
|
||||
import forestry.api.genetics.*;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IAlleleArea;
|
||||
import forestry.api.genetics.IAlleleFloat;
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
import forestry.api.genetics.IAlleleTolerance;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
|
||||
@@ -19,7 +19,9 @@ public enum EnumFlowerStage implements ISpeciesType {
|
||||
}
|
||||
|
||||
public static EnumFlowerStage getStage(int age) {
|
||||
return age == 0 ? EnumFlowerStage.SEED : EnumFlowerStage.FLOWER;
|
||||
return age == 0
|
||||
? EnumFlowerStage.SEED
|
||||
: EnumFlowerStage.FLOWER;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
|
||||
@@ -7,9 +7,9 @@ import net.minecraft.util.text.translation.I18n;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public enum EnumMoisture implements IStringSerializable {
|
||||
Dry(TextFormatting.YELLOW),
|
||||
Normal(null),
|
||||
Damp(TextFormatting.DARK_BLUE);
|
||||
DRY(TextFormatting.YELLOW),
|
||||
NORMAL(null),
|
||||
DAMP(TextFormatting.DARK_BLUE);
|
||||
|
||||
@Nullable
|
||||
final TextFormatting color;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package binnie.botany.api;
|
||||
|
||||
public class FlowerManager {
|
||||
|
||||
/**
|
||||
* Convenient access to AlleleManager.alleleRegistry.getSpeciesRoot("rootFlowers")
|
||||
*/
|
||||
@@ -11,5 +10,4 @@ public class FlowerManager {
|
||||
* Used to create new flowers.
|
||||
*/
|
||||
public static IFlowerFactory flowerFactory;
|
||||
|
||||
}
|
||||
@@ -9,7 +9,6 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public interface IAlleleFlowerSpecies extends IAlleleSpecies, IAlleleProperty<IAlleleFlowerSpecies> {
|
||||
|
||||
IFlowerType getType();
|
||||
|
||||
EnumAcidity getPH();
|
||||
|
||||
@@ -3,12 +3,10 @@ package binnie.botany.api;
|
||||
import forestry.api.genetics.IAlleleSpeciesBuilder;
|
||||
|
||||
public interface IAlleleFlowerSpeciesBuilder extends IAlleleSpeciesBuilder {
|
||||
|
||||
@Override
|
||||
IAlleleFlowerSpecies build();
|
||||
|
||||
IAlleleFlowerSpeciesBuilder setPH(EnumAcidity acidity);
|
||||
|
||||
IAlleleFlowerSpeciesBuilder setMoisture(EnumMoisture moisture);
|
||||
|
||||
}
|
||||
@@ -17,10 +17,10 @@ public interface IFlower extends IIndividual {
|
||||
|
||||
int getAge();
|
||||
|
||||
void age();
|
||||
|
||||
void setAge(final int age);
|
||||
|
||||
void age();
|
||||
|
||||
IFlower getOffspring(final World world, final BlockPos pos);
|
||||
|
||||
int getMaxAge();
|
||||
|
||||
@@ -4,7 +4,6 @@ import forestry.core.genetics.IGeneticDefinition;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IFlowerDefinition extends IGeneticDefinition {
|
||||
|
||||
@Override
|
||||
IFlowerGenome getGenome();
|
||||
|
||||
@@ -12,5 +11,4 @@ public interface IFlowerDefinition extends IGeneticDefinition {
|
||||
IFlower getIndividual();
|
||||
|
||||
ItemStack getMemberStack(EnumFlowerStage flowerStage);
|
||||
|
||||
}
|
||||
@@ -4,9 +4,7 @@ import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IClassification;
|
||||
|
||||
public interface IFlowerFactory {
|
||||
|
||||
IAlleleFlowerSpeciesBuilder createSpecies(String uid, String unlocalizedName, String authority, String unlocalizedDescription, boolean isDominant, IClassification branch, String binomial, IFlowerType flowerType);
|
||||
|
||||
IFlowerMutationBuilder createMutation(IAlleleFlowerSpecies parentFlower0, IAlleleFlowerSpecies parentFlower1, IAllele[] result, int chance);
|
||||
|
||||
}
|
||||
@@ -3,5 +3,4 @@ package binnie.botany.api;
|
||||
import forestry.api.genetics.IMutationBuilder;
|
||||
|
||||
public interface IFlowerMutationBuilder extends IMutationBuilder {
|
||||
|
||||
}
|
||||
@@ -7,7 +7,6 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public interface IFlowerType<I extends IFlowerType<I>> extends Comparable<I> {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
void registerModels(Item item, IModelManager manager, EnumFlowerStage type);
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class BlockStainedGlass extends Block implements IBlockMetadata, IColored
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(final Random p_149745_1_) {
|
||||
public int quantityDropped(final Random rand) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,9 +10,16 @@ import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class CeramicColor implements IDesignMaterial {
|
||||
EnumFlowerColor color;
|
||||
private final static Map<EnumFlowerColor, CeramicColor> map = new LinkedHashMap<>();
|
||||
|
||||
static {
|
||||
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
CeramicColor.map.put(c, new CeramicColor(c));
|
||||
}
|
||||
}
|
||||
|
||||
EnumFlowerColor color;
|
||||
|
||||
CeramicColor(final EnumFlowerColor color) {
|
||||
this.color = color;
|
||||
}
|
||||
@@ -40,10 +47,4 @@ public class CeramicColor implements IDesignMaterial {
|
||||
public int getColour() {
|
||||
return this.color.getColor(false);
|
||||
}
|
||||
|
||||
static {
|
||||
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
CeramicColor.map.put(c, new CeramicColor(c));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -103,5 +103,4 @@ public class CeramicDesignSystem implements IDesignSystem {
|
||||
public IDesignMaterial getMaterial(final ItemStack itemStack) {
|
||||
return (itemStack.getItem() == Item.getItemFromBlock(Botany.ceramic)) ? this.getMaterial(itemStack.getItemDamage()) : null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,7 +10,6 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemStainedGlass extends ItemMetadata implements IColoredItem {
|
||||
|
||||
public ItemStainedGlass(Block block) {
|
||||
super(block);
|
||||
}
|
||||
@@ -20,5 +19,4 @@ public class ItemStainedGlass extends ItemMetadata implements IColoredItem {
|
||||
public int getColorFromItemstack(ItemStack stack, int tintIndex) {
|
||||
return EnumFlowerColor.get(TileEntityMetadata.getItemDamage(stack)).getColor(false);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,14 +9,14 @@ import net.minecraft.tileentity.TileEntity;
|
||||
public class TileCeramic extends TileEntity {
|
||||
protected EnumFlowerColor color = EnumFlowerColor.Black;
|
||||
|
||||
public void setColor(EnumFlowerColor color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public EnumFlowerColor getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
public void setColor(EnumFlowerColor color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
|
||||
compound.setInteger("Color", color.getID());
|
||||
@@ -39,7 +39,5 @@ public class TileCeramic extends TileEntity {
|
||||
ID = color.getID();
|
||||
}
|
||||
return new ItemStack(Botany.ceramic, amount, ID);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,7 +10,11 @@ import binnie.core.models.DefaultStateMapper;
|
||||
import binnie.core.models.ModelManager;
|
||||
import binnie.core.models.ModelMutlipass;
|
||||
import binnie.core.util.TileUtil;
|
||||
import forestry.api.core.*;
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.core.ISpriteRegister;
|
||||
import forestry.api.core.IStateMapperRegister;
|
||||
import forestry.api.core.ITextureManager;
|
||||
import forestry.core.blocks.IColoredBlock;
|
||||
import forestry.core.blocks.properties.UnlistedBlockAccess;
|
||||
import forestry.core.blocks.properties.UnlistedBlockPos;
|
||||
@@ -32,7 +36,11 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
@@ -50,8 +58,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockCeramicBrick extends Block implements IMultipassBlock<CeramicBrickPair>, IColoredBlock, ISpriteRegister, IStateMapperRegister, IItemModelRegister {
|
||||
|
||||
public static final PropertyEnum<CeramicBrickType> TYPE = PropertyEnum.create("type", CeramicBrickType.class);
|
||||
private static final PropertyEnum<CeramicBrickType> TYPE = PropertyEnum.create("type", CeramicBrickType.class);
|
||||
|
||||
public BlockCeramicBrick() {
|
||||
super(Material.ROCK);
|
||||
@@ -114,9 +121,10 @@ public class BlockCeramicBrick extends Block implements IMultipassBlock<CeramicB
|
||||
ResourceLocation resourceLocation = new ResourceLocation(Constants.BOTANY_MOD_ID, "ceramicBrick");
|
||||
ModelLoader.setCustomStateMapper(this, new DefaultStateMapper(resourceLocation));
|
||||
ModelManager.registerCustomBlockModel(new BlockModelEntry(
|
||||
new ModelResourceLocation(resourceLocation, "normal"),
|
||||
new ModelResourceLocation(resourceLocation, "inventory"),
|
||||
new ModelMutlipass<>(BlockCeramicBrick.class), this));
|
||||
new ModelResourceLocation(resourceLocation, "normal"),
|
||||
new ModelResourceLocation(resourceLocation, "inventory"),
|
||||
new ModelMutlipass<>(BlockCeramicBrick.class), this
|
||||
));
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -125,15 +133,6 @@ public class BlockCeramicBrick extends Block implements IMultipassBlock<CeramicB
|
||||
manager.registerItemModel(item, new CeramicBrickMeshDefinition());
|
||||
}
|
||||
|
||||
private class CeramicBrickMeshDefinition implements ItemMeshDefinition {
|
||||
|
||||
@Override
|
||||
public ModelResourceLocation getModelLocation(ItemStack stack) {
|
||||
return new ModelResourceLocation(Constants.BOTANY_MOD_ID + ":ceramicBrick", "inventory");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new ExtendedBlockState(this, new IProperty[]{TYPE}, new IUnlistedProperty[]{UnlistedBlockPos.POS, UnlistedBlockAccess.BLOCKACCESS});
|
||||
@@ -241,4 +240,11 @@ public class BlockCeramicBrick extends Block implements IMultipassBlock<CeramicB
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class CeramicBrickMeshDefinition implements ItemMeshDefinition {
|
||||
@Override
|
||||
public ModelResourceLocation getModelLocation(ItemStack stack) {
|
||||
return new ModelResourceLocation(Constants.BOTANY_MOD_ID + ":ceramicBrick", "inventory");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,24 +22,24 @@ public class CeramicBrickPair {
|
||||
this.ordinal = colorFirst.ordinal() + colorSecond.ordinal() * 256 + type.ordinal() * 256 * 256;
|
||||
}
|
||||
|
||||
public boolean isTwoColors() {
|
||||
return this.type.canDouble() && this.colorSecond != this.colorFirst;
|
||||
}
|
||||
|
||||
public CeramicBrickPair(ItemStack stack) {
|
||||
this(TileEntityMetadata.getItemDamage(stack));
|
||||
}
|
||||
|
||||
public ItemStack getStack(int i) {
|
||||
return new ItemStack(Botany.ceramicBrick, i, this.ordinal());
|
||||
}
|
||||
|
||||
public CeramicBrickPair(int id) {
|
||||
this.colorFirst = EnumFlowerColor.get(id & 0xFF);
|
||||
this.colorSecond = EnumFlowerColor.get(id >> 8 & 0xFF);
|
||||
this.type = CeramicBrickType.get(id >> 16 & 0xFF);
|
||||
}
|
||||
|
||||
public boolean isTwoColors() {
|
||||
return this.type.canDouble() && this.colorSecond != this.colorFirst;
|
||||
}
|
||||
|
||||
public ItemStack getStack(int i) {
|
||||
return new ItemStack(Botany.ceramicBrick, i, this.ordinal());
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
String name = this.colorFirst.getColourName();
|
||||
if (this.type.canDouble() && this.colorSecond != this.colorFirst) {
|
||||
@@ -58,7 +58,7 @@ public class CeramicBrickPair {
|
||||
Preconditions.checkState(sprites != null, "Sprites have not been registered.");
|
||||
return sprites[pass];
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Integer.hashCode(ordinal());
|
||||
@@ -66,10 +66,7 @@ public class CeramicBrickPair {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof CeramicBrickPair)) {
|
||||
return false;
|
||||
}
|
||||
return ((CeramicBrickPair) obj).ordinal() == ordinal();
|
||||
return obj instanceof CeramicBrickPair
|
||||
&& ((CeramicBrickPair) obj).ordinal() == ordinal();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,7 +25,7 @@ public class ItemCeramicBrick extends ItemBlock implements IColoredItem {
|
||||
} else if (tintIndex == 2) {
|
||||
return ceramic.colorSecond.getColor(false);
|
||||
}
|
||||
return 16777215;
|
||||
return 0xffffff;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -73,5 +73,4 @@ public class TileCeramicBrick extends TileEntity {
|
||||
colorSecond = EnumFlowerColor.VALUES[compound.getInteger("Second")];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,18 +8,18 @@ public class ControlColourMixBox extends ControlListBox<IColourMix> {
|
||||
private int index;
|
||||
private Type type;
|
||||
|
||||
@Override
|
||||
public IWidget createOption(final IColourMix value, final int y) {
|
||||
return new ControlColourMixItem(this.getContent(), value, y);
|
||||
}
|
||||
|
||||
public ControlColourMixBox(final IWidget parent, final int x, final int y, final int width, final int height, final Type type) {
|
||||
super(parent, x, y, width, height, 12);
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IWidget createOption(final IColourMix value, final int y) {
|
||||
return new ControlColourMixItem(this.getContent(), value, y);
|
||||
}
|
||||
|
||||
enum Type {
|
||||
Resultant,
|
||||
Further;
|
||||
Further,
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,11 @@
|
||||
package binnie.botany.craftgui;
|
||||
|
||||
import binnie.botany.api.IColourMix;
|
||||
import binnie.core.craftgui.*;
|
||||
import binnie.core.craftgui.Attribute;
|
||||
import binnie.core.craftgui.CraftGUI;
|
||||
import binnie.core.craftgui.ITooltip;
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.Tooltip;
|
||||
import binnie.core.craftgui.controls.core.Control;
|
||||
import binnie.core.craftgui.geometry.Point;
|
||||
import binnie.core.craftgui.resource.Texture;
|
||||
@@ -16,6 +20,13 @@ public class ControlColourMixSymbol extends Control implements ITooltip {
|
||||
IColourMix value;
|
||||
int type;
|
||||
|
||||
protected ControlColourMixSymbol(final IWidget parent, final int x, final int y, final int type, final IColourMix value) {
|
||||
super(parent, x, y, 16 + type * 16, 16);
|
||||
this.value = value;
|
||||
this.type = type;
|
||||
this.addAttribute(Attribute.MouseOver);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
@@ -27,16 +38,9 @@ public class ControlColourMixSymbol extends Control implements ITooltip {
|
||||
}
|
||||
}
|
||||
|
||||
protected ControlColourMixSymbol(final IWidget parent, final int x, final int y, final int type, final IColourMix value) {
|
||||
super(parent, x, y, 16 + type * 16, 16);
|
||||
this.value = value;
|
||||
this.type = type;
|
||||
this.addAttribute(Attribute.MouseOver);
|
||||
}
|
||||
|
||||
public void setValue(final IColourMix value) {
|
||||
this.value = value;
|
||||
this.setColour(16777215);
|
||||
this.setColour(0xffffff);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -46,5 +50,4 @@ public class ControlColourMixSymbol extends Control implements ITooltip {
|
||||
tooltip.add("Current Chance - " + chance + "%");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,11 @@
|
||||
package binnie.botany.craftgui;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.botany.api.*;
|
||||
import binnie.botany.api.EnumFlowerChromosome;
|
||||
import binnie.botany.api.EnumFlowerStage;
|
||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||
import binnie.botany.api.IFlower;
|
||||
import binnie.botany.api.IFlowerGenome;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.controls.ControlText;
|
||||
@@ -23,6 +27,13 @@ public class PageSpeciesFlowerGenome extends PageSpecies {
|
||||
super(parent, tab);
|
||||
}
|
||||
|
||||
public static String tolerated(final boolean t) {
|
||||
if (t) {
|
||||
return "Tolerated";
|
||||
}
|
||||
return "Not Tolerated";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onValueChanged(final IAlleleSpecies species) {
|
||||
this.deleteAllChildren();
|
||||
@@ -87,11 +98,4 @@ public class PageSpeciesFlowerGenome extends PageSpecies {
|
||||
contents.setSize(new Point(contents.size().x(), y));
|
||||
scrollable.setScrollableContent(contents);
|
||||
}
|
||||
|
||||
public static String tolerated(final boolean t) {
|
||||
if (t) {
|
||||
return "Tolerated";
|
||||
}
|
||||
return "Not Tolerated";
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,16 @@ import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.core.AbstractMod;
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.controls.listbox.ControlListBox;
|
||||
import binnie.core.craftgui.database.*;
|
||||
import binnie.core.craftgui.database.DatabaseTab;
|
||||
import binnie.core.craftgui.database.IDatabaseMode;
|
||||
import binnie.core.craftgui.database.PageBranchOverview;
|
||||
import binnie.core.craftgui.database.PageBranchSpecies;
|
||||
import binnie.core.craftgui.database.PageBreeder;
|
||||
import binnie.core.craftgui.database.PageSpeciesClassification;
|
||||
import binnie.core.craftgui.database.PageSpeciesMutations;
|
||||
import binnie.core.craftgui.database.PageSpeciesOverview;
|
||||
import binnie.core.craftgui.database.PageSpeciesResultant;
|
||||
import binnie.core.craftgui.database.WindowAbstractDatabase;
|
||||
import binnie.core.craftgui.geometry.Area;
|
||||
import binnie.core.craftgui.minecraft.Window;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
@@ -23,23 +23,23 @@ public class CircuitGarden extends BinnieCircuit {
|
||||
this.isManual = manual;
|
||||
this.logic = new GardenLogic(moisture, ph, this.isManual, fertilised, icon, Binnie.LANGUAGE.localise(this.getUnlocalizedName()));
|
||||
StringBuilder info = new StringBuilder("Flowers (")
|
||||
.append(TextFormatting.GRAY.toString())
|
||||
.append(Binnie.LANGUAGE.localise("botany.moisture"))
|
||||
.append(": ")
|
||||
.append(moisture.getTranslated(true));
|
||||
.append(TextFormatting.GRAY.toString())
|
||||
.append(Binnie.LANGUAGE.localise("botany.moisture"))
|
||||
.append(": ")
|
||||
.append(moisture.getTranslated(true));
|
||||
|
||||
if (ph != null) {
|
||||
info.append(TextFormatting.GRAY.toString())
|
||||
.append(", ")
|
||||
.append(Binnie.LANGUAGE.localise("botany.ph"))
|
||||
.append(": ")
|
||||
.append(ph.getTranslated(true));
|
||||
.append(", ")
|
||||
.append(Binnie.LANGUAGE.localise("botany.ph"))
|
||||
.append(": ")
|
||||
.append(ph.getTranslated(true));
|
||||
}
|
||||
String fertilizedKey = fertilised ? "for.binnie.circuit.garden.fertilized" : "for.binnie.circuit.garden.unfertilized";
|
||||
info.append(TextFormatting.RESET.toString())
|
||||
.append(" ")
|
||||
.append(Binnie.LANGUAGE.localise(fertilizedKey))
|
||||
.append(")");
|
||||
.append(" ")
|
||||
.append(Binnie.LANGUAGE.localise(fertilizedKey))
|
||||
.append(")");
|
||||
this.addTooltipString(info.toString());
|
||||
}
|
||||
|
||||
@@ -112,5 +112,4 @@ public class CircuitGarden extends BinnieCircuit {
|
||||
@Override
|
||||
public void onTick(int slot, Object tile) {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -44,6 +44,4 @@ public class FarmableFlower implements IFarmable {
|
||||
Gardening.plant(world, pos, flower, player.getGameProfile());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -34,6 +34,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class GardenLogic extends FarmLogic {
|
||||
List<IFarmable> farmables;
|
||||
private EnumMoisture moisture;
|
||||
@Nullable
|
||||
private EnumAcidity acidity;
|
||||
@@ -41,7 +42,6 @@ public class GardenLogic extends FarmLogic {
|
||||
private String name;
|
||||
private NonNullList<ItemStack> produce;
|
||||
private ItemStack icon;
|
||||
List<IFarmable> farmables;
|
||||
|
||||
public GardenLogic(EnumMoisture moisture2, @Nullable EnumAcidity acidity2, boolean isManual, boolean isFertilised, ItemStack icon2, String name2) {
|
||||
this.produce = NonNullList.create();
|
||||
@@ -68,10 +68,10 @@ public class GardenLogic extends FarmLogic {
|
||||
@Override
|
||||
public boolean isAcceptedResource(final ItemStack itemstack) {
|
||||
return Gardening.isSoil(itemstack.getItem()) ||
|
||||
itemstack.getItem() == Item.getItemFromBlock(Blocks.SAND) ||
|
||||
itemstack.getItem() == Item.getItemFromBlock(Blocks.DIRT) ||
|
||||
Gardening.isAcidFertiliser(itemstack) ||
|
||||
Gardening.isAlkalineFertiliser(itemstack);
|
||||
itemstack.getItem() == Item.getItemFromBlock(Blocks.SAND) ||
|
||||
itemstack.getItem() == Item.getItemFromBlock(Blocks.DIRT) ||
|
||||
Gardening.isAcidFertiliser(itemstack) ||
|
||||
Gardening.isAlkalineFertiliser(itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -84,8 +84,8 @@ public class GardenLogic extends FarmLogic {
|
||||
@Override
|
||||
public boolean cultivate(World world, IFarmHousing farmHousing, BlockPos pos, FarmDirection direction, int extent) {
|
||||
return this.maintainSoil(world, pos, direction, extent, farmHousing) ||
|
||||
(!this.isManual && this.maintainWater(world, pos, direction, extent, farmHousing)) ||
|
||||
this.maintainCrops(world, pos.up(), direction, extent, farmHousing);
|
||||
(!this.isManual && this.maintainWater(world, pos, direction, extent, farmHousing)) ||
|
||||
this.maintainCrops(world, pos.up(), direction, extent, farmHousing);
|
||||
}
|
||||
|
||||
private boolean isWaste(final ItemStack stack) {
|
||||
@@ -174,7 +174,7 @@ public class GardenLogic extends FarmLogic {
|
||||
} else if (world.isAirBlock(position.north())) {
|
||||
isEnclosed = false;
|
||||
}
|
||||
isEnclosed = (isEnclosed || this.moisture != EnumMoisture.Damp);
|
||||
isEnclosed = (isEnclosed || this.moisture != EnumMoisture.DAMP);
|
||||
if (isEnclosed) {
|
||||
return this.trySetWater(world, position, housing);
|
||||
}
|
||||
@@ -186,14 +186,14 @@ public class GardenLogic extends FarmLogic {
|
||||
|
||||
private ItemStack getAvailableLoam(IFarmHousing housing) {
|
||||
EnumMoisture[] moistures;
|
||||
if (this.moisture == EnumMoisture.Damp) {
|
||||
moistures = new EnumMoisture[]{EnumMoisture.Damp, EnumMoisture.Normal, EnumMoisture.Dry};
|
||||
} else if (this.moisture == EnumMoisture.Dry) {
|
||||
moistures = new EnumMoisture[]{EnumMoisture.Dry, EnumMoisture.Damp, EnumMoisture.Dry};
|
||||
if (this.moisture == EnumMoisture.DAMP) {
|
||||
moistures = new EnumMoisture[]{EnumMoisture.DAMP, EnumMoisture.NORMAL, EnumMoisture.DRY};
|
||||
} else if (this.moisture == EnumMoisture.DRY) {
|
||||
moistures = new EnumMoisture[]{EnumMoisture.DRY, EnumMoisture.DAMP, EnumMoisture.DRY};
|
||||
} else {
|
||||
moistures = new EnumMoisture[]{EnumMoisture.Dry, EnumMoisture.Normal, EnumMoisture.Damp};
|
||||
moistures = new EnumMoisture[]{EnumMoisture.DRY, EnumMoisture.NORMAL, EnumMoisture.DAMP};
|
||||
}
|
||||
final EnumAcidity[] acidities = {EnumAcidity.Neutral, EnumAcidity.Acid, EnumAcidity.Alkaline};
|
||||
final EnumAcidity[] acidities = {EnumAcidity.NEUTRAL, EnumAcidity.ACID, EnumAcidity.ALKALINE};
|
||||
for (final EnumMoisture moist : moistures) {
|
||||
for (final EnumAcidity acid : acidities) {
|
||||
for (final Block type : new Block[]{Botany.flowerbed, Botany.loam, Botany.soil}) {
|
||||
@@ -237,7 +237,7 @@ public class GardenLogic extends FarmLogic {
|
||||
|
||||
private boolean trySetWater(World world, BlockPos position, IFarmHousing housing) {
|
||||
final FluidStack water = Binnie.LIQUID.getFluidStack("water", 1000);
|
||||
if (this.moisture == EnumMoisture.Damp) {
|
||||
if (this.moisture == EnumMoisture.DAMP) {
|
||||
if (water == null || !housing.hasLiquid(water)) {
|
||||
return false;
|
||||
}
|
||||
@@ -245,7 +245,7 @@ public class GardenLogic extends FarmLogic {
|
||||
housing.removeLiquid(water);
|
||||
return true;
|
||||
} else {
|
||||
if (this.moisture != EnumMoisture.Dry) {
|
||||
if (this.moisture != EnumMoisture.DRY) {
|
||||
return trySetSoil(world, position, housing);
|
||||
}
|
||||
final ItemStack sand = new ItemStack(Blocks.SAND, 1);
|
||||
@@ -350,5 +350,4 @@ public class GardenLogic extends FarmLogic {
|
||||
}
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -29,7 +29,11 @@ import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
@@ -43,7 +47,6 @@ import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockFlower extends BlockContainer implements IColoredBlock, IStateMapperRegister {
|
||||
|
||||
public static final AxisAlignedBB FLOWER_BLOCK_AABB = new AxisAlignedBB(0.3D, 0.0D, 0.3D, 0.7D, 0.6D, 0.7D);
|
||||
/* PROPERTYS */
|
||||
public static final PropertyFlower FLOWER = new PropertyFlower("flower", IFlowerType.class);
|
||||
@@ -69,6 +72,7 @@ public class BlockFlower extends BlockContainer implements IColoredBlock, IState
|
||||
public void registerStateMapper() {
|
||||
ModelLoader.setCustomStateMapper(this, new StateMapperFlower());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
ItemStack heldItem = player.getHeldItemMainhand();
|
||||
@@ -180,7 +184,7 @@ public class BlockFlower extends BlockContainer implements IColoredBlock, IState
|
||||
}
|
||||
}
|
||||
}
|
||||
return 16777215;
|
||||
return 0xffffff;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -300,5 +304,4 @@ public class BlockFlower extends BlockContainer implements IColoredBlock, IState
|
||||
}
|
||||
return hasBeenBroken;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package binnie.botany.flower;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
enum EnumTubeInsulate {
|
||||
Clay(0xa1aacc, "Clay"),
|
||||
Cobble(0x7b7b7b, "Cobblestone"),
|
||||
Sand(0xefeab5, "Sand"),
|
||||
HardenedClay(0x935c43, "Hardened Clay"),
|
||||
Stone(0x6d6d6d, "Smooth Stone"),
|
||||
Sandstone(0xc1b989, "Sandstone");
|
||||
|
||||
int color;
|
||||
String name;
|
||||
|
||||
EnumTubeInsulate(final int color, final String name) {
|
||||
this.color = color;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public static EnumTubeInsulate get(final int i) {
|
||||
return values()[i / 128 % values().length];
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return this.color;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public ItemStack getStack() {
|
||||
switch (this) {
|
||||
case Clay: {
|
||||
return new ItemStack(Blocks.CLAY);
|
||||
}
|
||||
case Cobble: {
|
||||
return new ItemStack(Blocks.COBBLESTONE);
|
||||
}
|
||||
case HardenedClay: {
|
||||
return new ItemStack(Blocks.HARDENED_CLAY);
|
||||
}
|
||||
case Sand: {
|
||||
return new ItemStack(Blocks.SAND);
|
||||
}
|
||||
case Sandstone: {
|
||||
return new ItemStack(Blocks.SANDSTONE);
|
||||
}
|
||||
case Stone: {
|
||||
return new ItemStack(Blocks.STONE);
|
||||
}
|
||||
default: {
|
||||
throw new IllegalStateException("Unknown insulated tube type: " + this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package binnie.botany.flower;
|
||||
|
||||
enum EnumTubeMaterial {
|
||||
Copper(0xe3b78e, "Copper"),
|
||||
Tin(0xe1eef4, "Tin"),
|
||||
Bronze(0xddc276, "Bronze"),
|
||||
Iron(0xd8d8d8, "Iron");
|
||||
|
||||
int color;
|
||||
String name;
|
||||
|
||||
EnumTubeMaterial(final int color, final String name) {
|
||||
this.color = color;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public static EnumTubeMaterial get(final int i) {
|
||||
return values()[i % values().length];
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return this.color;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
}
|
||||
@@ -13,53 +13,52 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class FlowerSpriteManager {
|
||||
|
||||
private static final Map<IFlowerType, FlowerSprites> flowerSprites = new HashMap<>();
|
||||
|
||||
|
||||
public static void initSprites(IFlowerType type) {
|
||||
if(flowerSprites.containsKey(type)){
|
||||
if (flowerSprites.containsKey(type)) {
|
||||
return;
|
||||
}
|
||||
flowerSprites.put(type, new FlowerSprites(type));
|
||||
}
|
||||
|
||||
|
||||
@Nullable
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static TextureAtlasSprite getStem(IFlowerType type, int section, boolean flowered){
|
||||
public static TextureAtlasSprite getStem(IFlowerType type, int section, boolean flowered) {
|
||||
FlowerSprites flower = flowerSprites.get(type);
|
||||
if(flower == null){
|
||||
if (flower == null) {
|
||||
return null;
|
||||
}
|
||||
return flower.getStem(type, section, flowered);
|
||||
}
|
||||
|
||||
|
||||
@Nullable
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static TextureAtlasSprite getPetal(IFlowerType type, int section, boolean flowered){
|
||||
public static TextureAtlasSprite getPetal(IFlowerType type, int section, boolean flowered) {
|
||||
FlowerSprites flower = flowerSprites.get(type);
|
||||
if(flower == null){
|
||||
if (flower == null) {
|
||||
return null;
|
||||
}
|
||||
return flower.getPetal(type, section, flowered);
|
||||
}
|
||||
|
||||
|
||||
@Nullable
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static TextureAtlasSprite getVariant(IFlowerType type, int section, boolean flowered){
|
||||
public static TextureAtlasSprite getVariant(IFlowerType type, int section, boolean flowered) {
|
||||
FlowerSprites flower = flowerSprites.get(type);
|
||||
if(flower == null){
|
||||
if (flower == null) {
|
||||
return null;
|
||||
}
|
||||
return flower.getVariant(type, section, flowered);
|
||||
}
|
||||
|
||||
private static class FlowerSprites{
|
||||
|
||||
private static class FlowerSprites {
|
||||
private BinnieSprite[] stem;
|
||||
private BinnieSprite[] variant;
|
||||
private BinnieSprite[] petal;
|
||||
private BinnieSprite[] unflowered;
|
||||
private int sections;
|
||||
|
||||
|
||||
public FlowerSprites(IFlowerType type) {
|
||||
this.sections = type.getSections();
|
||||
this.stem = new BinnieSprite[sections];
|
||||
@@ -77,21 +76,19 @@ public class FlowerSpriteManager {
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public TextureAtlasSprite getStem(IFlowerType type, int section, boolean flowered){
|
||||
public TextureAtlasSprite getStem(IFlowerType type, int section, boolean flowered) {
|
||||
return stem[section % sections].getSprite();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public TextureAtlasSprite getPetal(IFlowerType type, int section, boolean flowered){
|
||||
public TextureAtlasSprite getPetal(IFlowerType type, int section, boolean flowered) {
|
||||
return (flowered ? petal[section % this.sections] : this.unflowered[section % this.sections]).getSprite();
|
||||
}
|
||||
|
||||
|
||||
@Nullable
|
||||
@SideOnly(Side.CLIENT)
|
||||
public TextureAtlasSprite getVariant(IFlowerType type, int section, boolean flowered){
|
||||
public TextureAtlasSprite getVariant(IFlowerType type, int section, boolean flowered) {
|
||||
return flowered ? variant[section % this.sections].getSprite() : null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,7 +3,12 @@ package binnie.botany.flower;
|
||||
import binnie.Binnie;
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.api.*;
|
||||
import binnie.botany.api.EnumFlowerChromosome;
|
||||
import binnie.botany.api.EnumFlowerStage;
|
||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||
import binnie.botany.api.IFlower;
|
||||
import binnie.botany.api.IFlowerGenome;
|
||||
import binnie.botany.api.IFlowerType;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.botany.genetics.Flower;
|
||||
import com.google.common.base.Preconditions;
|
||||
@@ -26,7 +31,11 @@ import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
@@ -37,7 +46,6 @@ import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemBotany extends Item implements IColoredItem, IItemModelRegister {
|
||||
|
||||
private EnumFlowerStage type;
|
||||
private String tag;
|
||||
|
||||
@@ -170,19 +178,6 @@ public class ItemBotany extends Item implements IColoredItem, IItemModelRegister
|
||||
manager.registerItemModel(item, new BotanyMeshDefinition());
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private class BotanyMeshDefinition implements ItemMeshDefinition {
|
||||
@Override
|
||||
public ModelResourceLocation getModelLocation(ItemStack stack) {
|
||||
IFlower flower = BotanyCore.getFlowerRoot().getMember(stack);
|
||||
Preconditions.checkNotNull(flower);
|
||||
IAlleleFlowerSpecies flowerSpecies = flower.getGenome().getPrimary();
|
||||
IFlowerType flowerType = flowerSpecies.getType();
|
||||
return flowerSpecies.getFlowerModel(type, flower.hasFlowered());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
@@ -239,4 +234,16 @@ public class ItemBotany extends Item implements IColoredItem, IItemModelRegister
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private class BotanyMeshDefinition implements ItemMeshDefinition {
|
||||
@Override
|
||||
public ModelResourceLocation getModelLocation(ItemStack stack) {
|
||||
IFlower flower = BotanyCore.getFlowerRoot().getMember(stack);
|
||||
Preconditions.checkNotNull(flower);
|
||||
IAlleleFlowerSpecies flowerSpecies = flower.getGenome().getPrimary();
|
||||
IFlowerType flowerType = flowerSpecies.getType();
|
||||
return flowerSpecies.getFlowerModel(type, flower.hasFlowered());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,6 @@ import forestry.core.utils.Translator;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
@@ -26,7 +25,6 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemInsulatedTube extends ItemCore implements IColoredItem {
|
||||
|
||||
public ItemInsulatedTube() {
|
||||
super("insulated_tube");
|
||||
setUnlocalizedName("insulated_tube");
|
||||
@@ -34,11 +32,31 @@ public class ItemInsulatedTube extends ItemCore implements IColoredItem {
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
private static Multimap<ICircuitLayout, ICircuit> getCircuits(ItemStack itemStack) {
|
||||
Multimap<ICircuitLayout, ICircuit> circuits = ArrayListMultimap.create();
|
||||
Collection<ICircuitLayout> allLayouts = ChipsetManager.circuitRegistry.getRegisteredLayouts().values();
|
||||
for (ICircuitLayout circuitLayout : allLayouts) {
|
||||
ICircuit circuit = SolderManager.getCircuit(circuitLayout, itemStack);
|
||||
if (circuit != null) {
|
||||
circuits.put(circuitLayout, circuit);
|
||||
}
|
||||
}
|
||||
return circuits;
|
||||
}
|
||||
|
||||
public static String getInsulate(ItemStack stack) {
|
||||
return EnumTubeInsulate.get(stack.getItemDamage()).getName();
|
||||
}
|
||||
|
||||
public static ItemStack getInsulateStack(ItemStack stack) {
|
||||
return EnumTubeInsulate.get(stack.getItemDamage()).getStack();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tab, NonNullList<ItemStack> subItems) {
|
||||
for (Material mat : Material.values()) {
|
||||
for (Insulate ins : Insulate.values()) {
|
||||
for (EnumTubeMaterial mat : EnumTubeMaterial.values()) {
|
||||
for (EnumTubeInsulate ins : EnumTubeInsulate.values()) {
|
||||
subItems.add(new ItemStack(this, 1, mat.ordinal() + ins.ordinal() * 128));
|
||||
}
|
||||
}
|
||||
@@ -47,8 +65,8 @@ public class ItemInsulatedTube extends ItemCore implements IColoredItem {
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModel(Item item, IModelManager manager) {
|
||||
for (Material mat : Material.values()) {
|
||||
for (Insulate ins : Insulate.values()) {
|
||||
for (EnumTubeMaterial mat : EnumTubeMaterial.values()) {
|
||||
for (EnumTubeInsulate ins : EnumTubeInsulate.values()) {
|
||||
manager.registerItemModel(item, mat.ordinal() + ins.ordinal() * 128);
|
||||
}
|
||||
}
|
||||
@@ -57,11 +75,11 @@ public class ItemInsulatedTube extends ItemCore implements IColoredItem {
|
||||
@Override
|
||||
public int getColorFromItemstack(ItemStack stack, int tintIndex) {
|
||||
if (tintIndex == 0) {
|
||||
return 16777215;
|
||||
return 0xffffff;
|
||||
} else if (tintIndex == 1) {
|
||||
return Material.get(stack.getItemDamage()).getColor();
|
||||
return EnumTubeMaterial.get(stack.getItemDamage()).getColor();
|
||||
}
|
||||
return Insulate.get(stack.getItemDamage()).getColor();
|
||||
return EnumTubeInsulate.get(stack.getItemDamage()).getColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -86,111 +104,9 @@ public class ItemInsulatedTube extends ItemCore implements IColoredItem {
|
||||
}
|
||||
}
|
||||
|
||||
private static Multimap<ICircuitLayout, ICircuit> getCircuits(ItemStack itemStack) {
|
||||
Multimap<ICircuitLayout, ICircuit> circuits = ArrayListMultimap.create();
|
||||
Collection<ICircuitLayout> allLayouts = ChipsetManager.circuitRegistry.getRegisteredLayouts().values();
|
||||
for (ICircuitLayout circuitLayout : allLayouts) {
|
||||
ICircuit circuit = SolderManager.getCircuit(circuitLayout, itemStack);
|
||||
if (circuit != null) {
|
||||
circuits.put(circuitLayout, circuit);
|
||||
}
|
||||
}
|
||||
return circuits;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack itemStack) {
|
||||
int meta = itemStack.getMetadata();
|
||||
return Material.get(meta).getName() + " " + Insulate.get(meta).getName() + " " + super.getItemStackDisplayName(itemStack);
|
||||
}
|
||||
|
||||
public static String getInsulate(ItemStack stack) {
|
||||
return Insulate.get(stack.getItemDamage()).getName();
|
||||
}
|
||||
|
||||
public static ItemStack getInsulateStack(ItemStack stack) {
|
||||
return Insulate.get(stack.getItemDamage()).getStack();
|
||||
}
|
||||
|
||||
enum Material {
|
||||
Copper(14923662, "Copper"),
|
||||
Tin(14806772, "Tin"),
|
||||
Bronze(14533238, "Bronze"),
|
||||
Iron(14211288, "Iron");
|
||||
|
||||
int color;
|
||||
String name;
|
||||
|
||||
public int getColor() {
|
||||
return this.color;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
Material(final int color, final String name) {
|
||||
this.color = color;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public static Material get(final int i) {
|
||||
return values()[i % values().length];
|
||||
}
|
||||
}
|
||||
|
||||
enum Insulate {
|
||||
Clay(10595020, "Clay"),
|
||||
Cobble(8092539, "Cobblestone"),
|
||||
Sand(15723189, "Sand"),
|
||||
HardenedClay(9657411, "Hardened Clay"),
|
||||
Stone(7171437, "Smooth Stone"),
|
||||
Sandstone(12695945, "Sandstone");
|
||||
|
||||
int color;
|
||||
String name;
|
||||
|
||||
public int getColor() {
|
||||
return this.color;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
Insulate(final int color, final String name) {
|
||||
this.color = color;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public static Insulate get(final int i) {
|
||||
return values()[i / 128 % values().length];
|
||||
}
|
||||
|
||||
public ItemStack getStack() {
|
||||
switch (this) {
|
||||
case Clay: {
|
||||
return new ItemStack(Blocks.CLAY);
|
||||
}
|
||||
case Cobble: {
|
||||
return new ItemStack(Blocks.COBBLESTONE);
|
||||
}
|
||||
case HardenedClay: {
|
||||
return new ItemStack(Blocks.HARDENED_CLAY);
|
||||
}
|
||||
case Sand: {
|
||||
return new ItemStack(Blocks.SAND);
|
||||
}
|
||||
case Sandstone: {
|
||||
return new ItemStack(Blocks.SANDSTONE);
|
||||
}
|
||||
case Stone: {
|
||||
return new ItemStack(Blocks.STONE);
|
||||
}
|
||||
default: {
|
||||
throw new IllegalStateException("Unknown insulated tube type: " + this);
|
||||
}
|
||||
}
|
||||
}
|
||||
return EnumTubeMaterial.get(meta).getName() + " " + EnumTubeInsulate.get(meta).getName() + " " + super.getItemStackDisplayName(itemStack);
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,6 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class PropertyFlower<I extends IFlowerType<I>> extends PropertyHelper<I> {
|
||||
|
||||
public PropertyFlower(String name, Class<I> flowerTypeClass) {
|
||||
super(name, flowerTypeClass);
|
||||
}
|
||||
@@ -48,5 +47,4 @@ public class PropertyFlower<I extends IFlowerType<I>> extends PropertyHelper<I>
|
||||
}
|
||||
return Optional.absent();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,7 +14,6 @@ import java.util.Map;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class StateMapperFlower extends StateMapperBase {
|
||||
|
||||
@Override
|
||||
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
|
||||
final Map<IProperty<?>, Comparable<?>> properties = Maps.newLinkedHashMap(state.getProperties());
|
||||
@@ -34,5 +33,4 @@ public class StateMapperFlower extends StateMapperBase {
|
||||
|
||||
return new ModelResourceLocation(Constants.BOTANY_MOD_ID + ":flower", getPropertyString(properties));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,7 +2,13 @@ package binnie.botany.flower;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.api.*;
|
||||
import binnie.botany.api.EnumFlowerStage;
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||
import binnie.botany.api.IFlower;
|
||||
import binnie.botany.api.IFlowerColour;
|
||||
import binnie.botany.api.IFlowerGenome;
|
||||
import binnie.botany.api.IFlowerType;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.botany.gardening.BlockPlant;
|
||||
import binnie.botany.gardening.Gardening;
|
||||
@@ -57,7 +63,6 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
|
||||
this.matureTime = 0;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getUpdateTag() {
|
||||
updateRender(true);
|
||||
@@ -426,47 +431,47 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
|
||||
}
|
||||
|
||||
public void spawnButterflies() {
|
||||
// if (!BinnieCore.isLepidopteryActive()) {
|
||||
// return;
|
||||
// }
|
||||
// final int x = this.xCoord;
|
||||
// final int y = this.yCoord;
|
||||
// final int z = this.zCoord;
|
||||
// final World world = this.worldObj;
|
||||
// if (this.getCaterpillar() != null) {
|
||||
// return;
|
||||
// }
|
||||
// if (world.rand.nextFloat() >= this.getFlower().getGenome().getSappiness()) {
|
||||
// return;
|
||||
// }
|
||||
// if (this.worldObj.rand.nextFloat() >= 0.2f) {
|
||||
// return;
|
||||
// }
|
||||
// final IButterfly spawn = Binnie.Genetics.getButterflyRoot().getIndividualTemplates().get(this.worldObj.rand.nextInt(Binnie.Genetics.getButterflyRoot().getIndividualTemplates().size()));
|
||||
// if (this.worldObj.rand.nextFloat() >= spawn.getGenome().getPrimary().getRarity() * 0.5f) {
|
||||
// return;
|
||||
// }
|
||||
// if (this.worldObj.countEntities(EntityButterfly.class) > 100) {
|
||||
// return;
|
||||
// }
|
||||
// if (!spawn.canSpawn(this.worldObj, x, y, z)) {
|
||||
// return;
|
||||
// }
|
||||
// if (world.isAirBlock(x, y + 1, z)) {
|
||||
// this.attemptButterflySpawn(world, spawn, x, y + 1, z);
|
||||
// }
|
||||
// else if (world.isAirBlock(x - 1, y, z)) {
|
||||
// this.attemptButterflySpawn(world, spawn, x - 1, y, z);
|
||||
// }
|
||||
// else if (world.isAirBlock(x + 1, y, z)) {
|
||||
// this.attemptButterflySpawn(world, spawn, x + 1, y, z);
|
||||
// }
|
||||
// else if (world.isAirBlock(x, y, z - 1)) {
|
||||
// this.attemptButterflySpawn(world, spawn, x, y, z - 1);
|
||||
// }
|
||||
// else if (world.isAirBlock(x, y, z + 1)) {
|
||||
// this.attemptButterflySpawn(world, spawn, x, y, z + 1);
|
||||
// }
|
||||
/*if (!BinnieCore.isLepidopteryActive()) {
|
||||
return;
|
||||
}
|
||||
final int x = this.xCoord;
|
||||
final int y = this.yCoord;
|
||||
final int z = this.zCoord;
|
||||
final World world = this.worldObj;
|
||||
if (this.getCaterpillar() != null) {
|
||||
return;
|
||||
}
|
||||
if (world.rand.nextFloat() >= this.getFlower().getGenome().getSappiness()) {
|
||||
return;
|
||||
}
|
||||
if (this.worldObj.rand.nextFloat() >= 0.2f) {
|
||||
return;
|
||||
}
|
||||
final IButterfly spawn = Binnie.Genetics.getButterflyRoot().getIndividualTemplates().get(this.worldObj.rand.nextInt(Binnie.Genetics.getButterflyRoot().getIndividualTemplates().size()));
|
||||
if (this.worldObj.rand.nextFloat() >= spawn.getGenome().getPrimary().getRarity() * 0.5f) {
|
||||
return;
|
||||
}
|
||||
if (this.worldObj.countEntities(EntityButterfly.class) > 100) {
|
||||
return;
|
||||
}
|
||||
if (!spawn.canSpawn(this.worldObj, x, y, z)) {
|
||||
return;
|
||||
}
|
||||
if (world.isAirBlock(x, y + 1, z)) {
|
||||
this.attemptButterflySpawn(world, spawn, x, y + 1, z);
|
||||
}
|
||||
else if (world.isAirBlock(x - 1, y, z)) {
|
||||
this.attemptButterflySpawn(world, spawn, x - 1, y, z);
|
||||
}
|
||||
else if (world.isAirBlock(x + 1, y, z)) {
|
||||
this.attemptButterflySpawn(world, spawn, x + 1, y, z);
|
||||
}
|
||||
else if (world.isAirBlock(x, y, z - 1)) {
|
||||
this.attemptButterflySpawn(world, spawn, x, y, z - 1);
|
||||
}
|
||||
else if (world.isAirBlock(x, y, z + 1)) {
|
||||
this.attemptButterflySpawn(world, spawn, x, y, z + 1);
|
||||
}*/
|
||||
}
|
||||
|
||||
private void attemptButterflySpawn(final World world, final IButterfly butterfly, final double x, final double y, final double z) {
|
||||
@@ -479,7 +484,6 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
|
||||
return this.getOwner();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public EnumTemperature getTemperature() {
|
||||
return EnumTemperature.getFromValue(this.world.getBiome(getPos()).getTemperature());
|
||||
@@ -507,17 +511,17 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
|
||||
return this.caterpillar;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIndividual getNanny() {
|
||||
return this.getFlower();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCaterpillar(@Nullable final IButterfly butterfly) {
|
||||
this.caterpillar = butterfly;
|
||||
this.matureTime = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIndividual getNanny() {
|
||||
return this.getFlower();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canNurse(final IButterfly butterfly) {
|
||||
return this.getFlower() != null && !this.getFlower().isWilted() && this.getFlower().getAge() > 1;
|
||||
@@ -597,14 +601,14 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
|
||||
return this.getWorld().getBiome(getPos());
|
||||
}
|
||||
|
||||
public void setErrorState(final IErrorState state) {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public IErrorState getErrorState() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setErrorState(final IErrorState state) {
|
||||
}
|
||||
|
||||
public boolean setErrorCondition(final boolean condition, final IErrorState errorState) {
|
||||
return false;
|
||||
}
|
||||
@@ -613,6 +617,21 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
|
||||
return new HashSet<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockPos getCoordinates() {
|
||||
return getPos();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPollinated() {
|
||||
return isBreeding();
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorldObj() {
|
||||
return world;
|
||||
}
|
||||
|
||||
public static class RenderInfo {
|
||||
public IFlowerColour primary;
|
||||
public IFlowerColour secondary;
|
||||
@@ -623,15 +642,6 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
|
||||
public boolean flowered;
|
||||
public byte section;
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (obj instanceof RenderInfo) {
|
||||
final RenderInfo o = (RenderInfo) obj;
|
||||
return o.age == this.age && o.wilted == this.wilted && o.flowered == this.flowered && o.primary == this.primary && o.secondary == this.secondary && o.stem == this.stem && o.type == this.type;
|
||||
}
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
||||
public RenderInfo() {
|
||||
}
|
||||
|
||||
@@ -645,22 +655,14 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
|
||||
this.flowered = flower.hasFlowered();
|
||||
this.type = flower.getGenome().getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (obj instanceof RenderInfo) {
|
||||
final RenderInfo o = (RenderInfo) obj;
|
||||
return o.age == this.age && o.wilted == this.wilted && o.flowered == this.flowered && o.primary == this.primary && o.secondary == this.secondary && o.stem == this.stem && o.type == this.type;
|
||||
}
|
||||
return super.equals(obj);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockPos getCoordinates() {
|
||||
return getPos();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPollinated() {
|
||||
return isBreeding();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public World getWorldObj() {
|
||||
return world;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -37,6 +37,14 @@ public class BlockPlant extends BlockBush implements IItemModelRegister {
|
||||
this.setSoundType(SoundType.PLANT);
|
||||
}
|
||||
|
||||
public static boolean isWeed(final IBlockAccess world, final BlockPos pos) {
|
||||
if (!(world.getBlockState(pos).getBlock() instanceof BlockPlant)) {
|
||||
return false;
|
||||
}
|
||||
final Type type = world.getBlockState(pos).getValue(PLANT_TYPE);
|
||||
return type == Type.Weeds || type == Type.WeedsLong || type == Type.WeedsVeryLong;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerModel(Item item, IModelManager manager) {
|
||||
@@ -129,14 +137,6 @@ public class BlockPlant extends BlockBush implements IItemModelRegister {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isWeed(final IBlockAccess world, final BlockPos pos) {
|
||||
if (!(world.getBlockState(pos).getBlock() instanceof BlockPlant)) {
|
||||
return false;
|
||||
}
|
||||
final Type type = world.getBlockState(pos).getValue(PLANT_TYPE);
|
||||
return type == Type.Weeds || type == Type.WeedsLong || type == Type.WeedsVeryLong;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumOffsetType getOffsetType() {
|
||||
return EnumOffsetType.XZ;
|
||||
@@ -155,14 +155,14 @@ public class BlockPlant extends BlockBush implements IItemModelRegister {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public ItemStack get() {
|
||||
return new ItemStack(Botany.plant, 1, this.ordinal());
|
||||
}
|
||||
|
||||
public static Type get(final int id) {
|
||||
return values()[id % values().length];
|
||||
}
|
||||
|
||||
public ItemStack get() {
|
||||
return new ItemStack(Botany.plant, 1, this.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
|
||||
@@ -34,13 +34,11 @@ import javax.annotation.Nullable;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockSoil extends Block implements IBlockSoil, IItemModelRegister {
|
||||
|
||||
private final boolean weedKilled;
|
||||
private final EnumSoilType type;
|
||||
|
||||
public static final PropertyEnum<EnumMoisture> MOISTURE = PropertyEnum.create("moisture", EnumMoisture.class);
|
||||
public static final PropertyEnum<EnumAcidity> ACIDITY = PropertyEnum.create("acidity", EnumAcidity.class);
|
||||
public static final AxisAlignedBB SOIL_BLOCK_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.9375D, 1.0D);
|
||||
private final boolean weedKilled;
|
||||
private final EnumSoilType type;
|
||||
|
||||
public BlockSoil(EnumSoilType type, String blockName, boolean weedKilled) {
|
||||
super(Material.GROUND);
|
||||
@@ -55,6 +53,30 @@ public class BlockSoil extends Block implements IBlockSoil, IItemModelRegister {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public static int getMeta(final EnumAcidity acid, final EnumMoisture moisture) {
|
||||
return acid.ordinal() * 3 + moisture.ordinal();
|
||||
}
|
||||
|
||||
public static String getPH(ItemStack stack, boolean withColor, boolean byNeutralNone) {
|
||||
EnumAcidity ph = EnumAcidity.values()[stack.getItemDamage() / 3];
|
||||
if (byNeutralNone) {
|
||||
if (ph == EnumAcidity.NEUTRAL) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
return TextFormatting.GRAY + Binnie.LANGUAGE.localise("botany.ph") + ": " + ph.getTranslated(withColor);
|
||||
}
|
||||
|
||||
public static String getMoisture(ItemStack stack, boolean withColor, boolean byNormalNone) {
|
||||
EnumMoisture moisure = EnumMoisture.values()[stack.getItemDamage() % 3];
|
||||
if (byNormalNone) {
|
||||
if (moisure == EnumMoisture.NORMAL) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
return TextFormatting.GRAY + Binnie.LANGUAGE.localise("botany.moisture") + ": " + moisure.getTranslated(withColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
|
||||
@@ -121,10 +143,10 @@ public class BlockSoil extends Block implements IBlockSoil, IItemModelRegister {
|
||||
for (EnumAcidity acidity : EnumAcidity.values()) {
|
||||
for (EnumMoisture moisture : EnumMoisture.values()) {
|
||||
String modelName = "";
|
||||
if (acidity != EnumAcidity.Neutral) {
|
||||
if (acidity != EnumAcidity.NEUTRAL) {
|
||||
modelName += acidity.getName();
|
||||
}
|
||||
if (moisture != EnumMoisture.Normal) {
|
||||
if (moisture != EnumMoisture.NORMAL) {
|
||||
if (!modelName.isEmpty()) {
|
||||
modelName += "_";
|
||||
}
|
||||
@@ -142,7 +164,6 @@ public class BlockSoil extends Block implements IBlockSoil, IItemModelRegister {
|
||||
manager.registerItemModel(item, moisture.ordinal() + acidity.ordinal() * 3, identifier);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -178,10 +199,10 @@ public class BlockSoil extends Block implements IBlockSoil, IItemModelRegister {
|
||||
EnumAcidity acidity = EnumAcidity.values()[meta / 3];
|
||||
EnumMoisture desiredMoisture = Gardening.getNaturalMoisture(world, pos);
|
||||
if (desiredMoisture.ordinal() > moisture.ordinal()) {
|
||||
moisture = ((moisture == EnumMoisture.Dry) ? EnumMoisture.Normal : EnumMoisture.Damp);
|
||||
moisture = ((moisture == EnumMoisture.DRY) ? EnumMoisture.NORMAL : EnumMoisture.DAMP);
|
||||
}
|
||||
if (desiredMoisture.ordinal() < moisture.ordinal()) {
|
||||
moisture = ((moisture == EnumMoisture.Damp) ? EnumMoisture.Normal : EnumMoisture.Dry);
|
||||
moisture = ((moisture == EnumMoisture.DAMP) ? EnumMoisture.NORMAL : EnumMoisture.DRY);
|
||||
}
|
||||
int meta2 = getMeta(acidity, moisture);
|
||||
if (meta != meta2) {
|
||||
@@ -248,10 +269,6 @@ public class BlockSoil extends Block implements IBlockSoil, IItemModelRegister {
|
||||
return world.setBlockState(pos, world.getBlockState(pos).withProperty(MOISTURE, moisture));
|
||||
}
|
||||
|
||||
public static int getMeta(final EnumAcidity acid, final EnumMoisture moisture) {
|
||||
return acid.ordinal() * 3 + moisture.ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor) {
|
||||
super.onNeighborChange(world, pos, neighbor);
|
||||
@@ -260,26 +277,6 @@ public class BlockSoil extends Block implements IBlockSoil, IItemModelRegister {
|
||||
}
|
||||
}
|
||||
|
||||
public static String getPH(ItemStack stack, boolean withColor, boolean byNeutralNone) {
|
||||
EnumAcidity ph = EnumAcidity.values()[stack.getItemDamage() / 3];
|
||||
if (byNeutralNone) {
|
||||
if (ph == EnumAcidity.Neutral) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
return TextFormatting.GRAY + Binnie.LANGUAGE.localise("botany.ph") + ": " + ph.getTranslated(withColor);
|
||||
}
|
||||
|
||||
public static String getMoisture(ItemStack stack, boolean withColor, boolean byNormalNone) {
|
||||
EnumMoisture moisure = EnumMoisture.values()[stack.getItemDamage() % 3];
|
||||
if (byNormalNone) {
|
||||
if (moisure == EnumMoisture.Normal) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
return TextFormatting.GRAY + Binnie.LANGUAGE.localise("botany.moisture") + ": " + moisure.getTranslated(withColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSustainPlant(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing direction, IPlantable plantable) {
|
||||
IBlockState plant = plantable.getPlant(world, pos.up());
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
package binnie.botany.gardening;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.api.*;
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
import binnie.botany.api.IBlockSoil;
|
||||
import binnie.botany.api.IFlower;
|
||||
import binnie.botany.flower.TileEntityFlower;
|
||||
import binnie.botany.items.BotanyItems;
|
||||
import binnie.core.BinnieCore;
|
||||
@@ -67,12 +71,12 @@ public class Gardening {
|
||||
}
|
||||
}
|
||||
}
|
||||
return (bias <= -1.0f) ? EnumMoisture.Dry : ((bias >= 1.0f) ? EnumMoisture.Damp : EnumMoisture.Normal);
|
||||
return (bias <= -1.0f) ? EnumMoisture.DRY : ((bias >= 1.0f) ? EnumMoisture.DAMP : EnumMoisture.NORMAL);
|
||||
}
|
||||
|
||||
public static EnumAcidity getNaturalPH(World world, BlockPos pos) {
|
||||
final float bias = getBiomePH(world, pos);
|
||||
return (bias <= -1.0f) ? EnumAcidity.Acid : ((bias >= 1.0f) ? EnumAcidity.Alkaline : EnumAcidity.Neutral);
|
||||
return (bias <= -1.0f) ? EnumAcidity.ACID : ((bias >= 1.0f) ? EnumAcidity.ALKALINE : EnumAcidity.NEUTRAL);
|
||||
}
|
||||
|
||||
public static float getBiomeMoisture(World world, BlockPos pos) {
|
||||
|
||||
@@ -24,7 +24,6 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemSoilMeter extends Item implements IItemModelRegister {
|
||||
|
||||
public ItemSoilMeter() {
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
this.setUnlocalizedName("soil_meter");
|
||||
@@ -32,6 +31,26 @@ public class ItemSoilMeter extends Item implements IItemModelRegister {
|
||||
setRegistryName("soil_meter");
|
||||
}
|
||||
|
||||
public static String getPH(ItemStack stack, boolean withColor, boolean byNeutralNone) {
|
||||
EnumAcidity ph = EnumAcidity.values()[stack.getItemDamage() / 3];
|
||||
if (byNeutralNone) {
|
||||
if (ph == EnumAcidity.NEUTRAL) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
return TextFormatting.GRAY + Binnie.LANGUAGE.localise("botany.ph") + ": " + ph.getTranslated(withColor);
|
||||
}
|
||||
|
||||
public static String getMoisture(ItemStack stack, boolean withColor, boolean byNormalNone) {
|
||||
EnumMoisture moisure = EnumMoisture.values()[stack.getItemDamage() % 3];
|
||||
if (byNormalNone) {
|
||||
if (moisure == EnumMoisture.NORMAL) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
return TextFormatting.GRAY + Binnie.LANGUAGE.localise("botany.moisture") + ": " + moisure.getTranslated(withColor);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModel(Item item, IModelManager manager) {
|
||||
@@ -63,26 +82,6 @@ public class ItemSoilMeter extends Item implements IItemModelRegister {
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
|
||||
public static String getPH(ItemStack stack, boolean withColor, boolean byNeutralNone) {
|
||||
EnumAcidity ph = EnumAcidity.values()[stack.getItemDamage() / 3];
|
||||
if (byNeutralNone) {
|
||||
if (ph == EnumAcidity.Neutral) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
return TextFormatting.GRAY + Binnie.LANGUAGE.localise("botany.ph") + ": " + ph.getTranslated(withColor);
|
||||
}
|
||||
|
||||
public static String getMoisture(ItemStack stack, boolean withColor, boolean byNormalNone) {
|
||||
EnumMoisture moisure = EnumMoisture.values()[stack.getItemDamage() % 3];
|
||||
if (byNormalNone) {
|
||||
if (moisure == EnumMoisture.Normal) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
return TextFormatting.GRAY + Binnie.LANGUAGE.localise("botany.moisture") + ": " + moisure.getTranslated(withColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(final ItemStack i) {
|
||||
return "Soil Meter";
|
||||
|
||||
@@ -21,7 +21,11 @@ import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
@@ -21,5 +21,4 @@ public class ItemWeed extends ItemBlock {
|
||||
public int getMetadata(int damage) {
|
||||
return damage;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,7 +5,14 @@ import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
import binnie.botany.ceramic.*;
|
||||
import binnie.botany.ceramic.BlockCeramic;
|
||||
import binnie.botany.ceramic.BlockCeramicPatterned;
|
||||
import binnie.botany.ceramic.BlockStainedGlass;
|
||||
import binnie.botany.ceramic.CeramicTileRecipe;
|
||||
import binnie.botany.ceramic.ItemCeramic;
|
||||
import binnie.botany.ceramic.ItemStainedGlass;
|
||||
import binnie.botany.ceramic.PigmentRecipe;
|
||||
import binnie.botany.ceramic.TileCeramic;
|
||||
import binnie.botany.ceramic.brick.BlockCeramicBrick;
|
||||
import binnie.botany.ceramic.brick.ItemCeramicBrick;
|
||||
import binnie.botany.ceramic.brick.TileCeramicBrick;
|
||||
@@ -78,17 +85,17 @@ public class ModuleGardening implements IInitializable {
|
||||
Botany.ceramic = new BlockCeramic();
|
||||
Botany.proxy.registerBlock(Botany.ceramic, new ItemCeramic(Botany.ceramic));
|
||||
BinnieCore.getBinnieProxy().registerTileEntity(TileCeramic.class, "botany.tile.ceramic");
|
||||
// BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.ceramic), new ItemMetadataRenderer());
|
||||
//BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.ceramic), new ItemMetadataRenderer());
|
||||
Botany.stained = new BlockStainedGlass();
|
||||
Botany.proxy.registerBlock(Botany.stained, new ItemStainedGlass(Botany.stained));
|
||||
// BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.stained), new ItemMetadataRenderer());
|
||||
//BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.stained), new ItemMetadataRenderer());
|
||||
Botany.ceramicTile = new BlockCeramicPatterned();
|
||||
Botany.proxy.registerBlock(Botany.ceramicTile, new ItemDesign(Botany.ceramicTile));
|
||||
Botany.ceramicBrick = new BlockCeramicBrick();
|
||||
Botany.proxy.registerBlock(Botany.ceramicBrick, new ItemCeramicBrick(Botany.ceramicBrick));
|
||||
BinnieCore.getBinnieProxy().registerTileEntity(TileCeramicBrick.class, "botany.tile.ceramicBrick");
|
||||
// BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.ceramicTile), new MultipassItemRenderer());
|
||||
// BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.ceramicBrick), new MultipassItemRenderer());
|
||||
//BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.ceramicTile), new MultipassItemRenderer());
|
||||
//BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.ceramicBrick), new MultipassItemRenderer());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -103,9 +110,9 @@ public class ModuleGardening implements IInitializable {
|
||||
for (boolean fertilised : new boolean[]{true, false}) {
|
||||
for (EnumMoisture moist : EnumMoisture.values()) {
|
||||
ItemStack icon;
|
||||
if (moist == EnumMoisture.Dry) {
|
||||
if (moist == EnumMoisture.DRY) {
|
||||
icon = yellow;
|
||||
} else if (moist == EnumMoisture.Normal) {
|
||||
} else if (moist == EnumMoisture.NORMAL) {
|
||||
icon = red;
|
||||
} else {
|
||||
icon = blue;
|
||||
@@ -115,9 +122,9 @@ public class ModuleGardening implements IInitializable {
|
||||
insulate += 3;
|
||||
}
|
||||
new CircuitGarden(moist, null, manual, fertilised, new ItemStack(Botany.insulatedTube, 1, 0 + 128 * insulate), icon);
|
||||
new CircuitGarden(moist, EnumAcidity.Acid, manual, fertilised, new ItemStack(Botany.insulatedTube, 1, 1 + 128 * insulate), icon);
|
||||
new CircuitGarden(moist, EnumAcidity.Neutral, manual, fertilised, new ItemStack(Botany.insulatedTube, 1, 2 + 128 * insulate), icon);
|
||||
new CircuitGarden(moist, EnumAcidity.Alkaline, manual, fertilised, new ItemStack(Botany.insulatedTube, 1, 3 + 128 * insulate), icon);
|
||||
new CircuitGarden(moist, EnumAcidity.ACID, manual, fertilised, new ItemStack(Botany.insulatedTube, 1, 1 + 128 * insulate), icon);
|
||||
new CircuitGarden(moist, EnumAcidity.NEUTRAL, manual, fertilised, new ItemStack(Botany.insulatedTube, 1, 2 + 128 * insulate), icon);
|
||||
new CircuitGarden(moist, EnumAcidity.ALKALINE, manual, fertilised, new ItemStack(Botany.insulatedTube, 1, 3 + 128 * insulate), icon);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import binnie.botany.api.*;
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import binnie.botany.api.EnumFlowerChromosome;
|
||||
import binnie.botany.api.EnumFlowerStage;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||
import binnie.botany.api.IAlleleFlowerSpeciesBuilder;
|
||||
import binnie.botany.api.IFlowerType;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
@@ -13,20 +19,19 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class AlleleFlowerSpecies extends AlleleSpecies implements IAlleleFlowerSpecies, IAlleleFlowerSpeciesBuilder {
|
||||
|
||||
private final IFlowerType flowerType;
|
||||
private EnumAcidity acidity = EnumAcidity.Neutral;
|
||||
private EnumMoisture moisture = EnumMoisture.Normal;
|
||||
private EnumAcidity acidity = EnumAcidity.NEUTRAL;
|
||||
private EnumMoisture moisture = EnumMoisture.NORMAL;
|
||||
|
||||
public AlleleFlowerSpecies(
|
||||
String uid,
|
||||
String unlocalizedName,
|
||||
String authority,
|
||||
String unlocalizedDescription,
|
||||
boolean isDominant,
|
||||
IClassification branch,
|
||||
String binomial,
|
||||
IFlowerType flowerType) {
|
||||
String uid,
|
||||
String unlocalizedName,
|
||||
String authority,
|
||||
String unlocalizedDescription,
|
||||
boolean isDominant,
|
||||
IClassification branch,
|
||||
String binomial,
|
||||
IFlowerType flowerType) {
|
||||
super(uid, unlocalizedName, authority, unlocalizedDescription, isDominant, branch, binomial);
|
||||
this.flowerType = flowerType;
|
||||
}
|
||||
@@ -95,5 +100,4 @@ public class AlleleFlowerSpecies extends AlleleSpecies implements IAlleleFlowerS
|
||||
public int compareTo(IAlleleFlowerSpecies o) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,6 +9,13 @@ public class ColourMix implements IColourMix {
|
||||
IFlowerColour result;
|
||||
int chance;
|
||||
|
||||
public ColourMix(final IFlowerColour colour1, final IFlowerColour colour2, final IFlowerColour result, final int chance) {
|
||||
this.colour1 = colour1;
|
||||
this.colour2 = colour2;
|
||||
this.result = result;
|
||||
this.chance = chance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlowerColour getColourFirst() {
|
||||
return this.colour1;
|
||||
@@ -33,11 +40,4 @@ public class ColourMix implements IColourMix {
|
||||
public IFlowerColour getResult() {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
public ColourMix(final IFlowerColour colour1, final IFlowerColour colour2, final IFlowerColour result, final int chance) {
|
||||
this.colour1 = colour1;
|
||||
this.colour2 = colour2;
|
||||
this.result = result;
|
||||
this.chance = chance;
|
||||
}
|
||||
}
|
||||
@@ -111,21 +111,6 @@ public enum EnumFlowerColor implements IFlowerColour, IAlleleInteger, IStringSer
|
||||
this.colorDis = (r << 16) + (g << 8) + b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor(final boolean dis) {
|
||||
return dis ? this.colorDis : this.color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAlleleInteger getAllele() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getID() {
|
||||
return this.ordinal();
|
||||
}
|
||||
|
||||
public static void addMix(final EnumFlowerColor start1, final EnumFlowerColor start2, final EnumFlowerColor result, final int chance) {
|
||||
BotanyCore.getFlowerRoot().registerColourMix(new ColourMix(start1, start2, result, chance));
|
||||
}
|
||||
@@ -2954,6 +2939,25 @@ public enum EnumFlowerColor implements IFlowerColour, IAlleleInteger, IStringSer
|
||||
}
|
||||
}
|
||||
|
||||
public static EnumFlowerColor get(final int i) {
|
||||
return values()[Math.max(0, i) % values().length];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor(final boolean dis) {
|
||||
return dis ? this.colorDis : this.color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAlleleInteger getAllele() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getID() {
|
||||
return this.ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColourName() {
|
||||
return Botany.proxy.localise("colour." + getName());
|
||||
@@ -2964,10 +2968,6 @@ public enum EnumFlowerColor implements IFlowerColour, IAlleleInteger, IStringSer
|
||||
return name().toLowerCase();
|
||||
}
|
||||
|
||||
public static EnumFlowerColor get(final int i) {
|
||||
return values()[Math.max(0, i) % values().length];
|
||||
}
|
||||
|
||||
public String getHTMLName() {
|
||||
return this.name();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import binnie.botany.api.*;
|
||||
import binnie.botany.api.EnumFlowerChromosome;
|
||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||
import binnie.botany.api.IColourMix;
|
||||
import binnie.botany.api.IFlower;
|
||||
import binnie.botany.api.IFlowerColour;
|
||||
import binnie.botany.api.IFlowerGenome;
|
||||
import binnie.botany.api.IFlowerMutation;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import forestry.api.arboriculture.EnumTreeChromosome;
|
||||
import forestry.api.genetics.IAllele;
|
||||
@@ -152,6 +158,11 @@ public class Flower extends Individual implements IFlower {
|
||||
return this.age;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAge(final int i) {
|
||||
this.age = i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void age() {
|
||||
if (this.age < 15) {
|
||||
@@ -159,11 +170,6 @@ public class Flower extends Individual implements IFlower {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAge(final int i) {
|
||||
this.age = i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxAge() {
|
||||
return this.getGenome().getLifespan();
|
||||
|
||||
@@ -9,14 +9,20 @@ import binnie.core.BinnieCore;
|
||||
import binnie.core.genetics.BreedingSystem;
|
||||
import binnie.core.genetics.ForestryAllele;
|
||||
import binnie.core.genetics.Tolerance;
|
||||
import forestry.api.genetics.*;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IMutation;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.api.genetics.ISpeciesType;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.TreeSet;
|
||||
|
||||
public class FlowerBreedingSystem extends BreedingSystem {
|
||||
|
||||
public FlowerBreedingSystem() {
|
||||
this.iconUndiscovered = Binnie.RESOURCE.getUndiscoveredBeeSprite();
|
||||
this.iconDiscovered = Binnie.RESOURCE.getDiscoveredBeeSprite();
|
||||
|
||||
@@ -1,12 +1,29 @@
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import binnie.Constants;
|
||||
import binnie.botany.api.*;
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import binnie.botany.api.EnumFlowerChromosome;
|
||||
import binnie.botany.api.EnumFlowerStage;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import binnie.botany.api.FlowerManager;
|
||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||
import binnie.botany.api.IAlleleFlowerSpeciesBuilder;
|
||||
import binnie.botany.api.IFlower;
|
||||
import binnie.botany.api.IFlowerDefinition;
|
||||
import binnie.botany.api.IFlowerGenome;
|
||||
import binnie.botany.api.IFlowerMutationBuilder;
|
||||
import binnie.botany.api.IFlowerRoot;
|
||||
import binnie.botany.api.IFlowerType;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.arboriculture.EnumTreeChromosome;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.genetics.*;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.AlleleSpeciesRegisterEvent;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IAlleleRegistry;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.IClassification;
|
||||
import forestry.core.genetics.alleles.AlleleHelper;
|
||||
import forestry.core.genetics.alleles.EnumAllele;
|
||||
import net.minecraft.init.Blocks;
|
||||
@@ -62,7 +79,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
Orchid("Orchid", "vanda", "coerulea", EnumFlowerType.Orchid, EnumFlowerColor.DeepSkyBlue) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setPH(EnumAcidity.Acid);
|
||||
flowerSpecies.setPH(EnumAcidity.ACID);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -80,7 +97,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
Allium("Allium", "allium", "giganteum", EnumFlowerType.Allium, EnumFlowerColor.MediumPurple) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setPH(EnumAcidity.Alkaline);
|
||||
flowerSpecies.setPH(EnumAcidity.ALKALINE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -98,7 +115,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
Bluet("Bluet", "houstonia", "caerulea", EnumFlowerType.Bluet, EnumFlowerColor.Lavender, EnumFlowerColor.Khaki) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setMoisture(EnumMoisture.Damp);
|
||||
flowerSpecies.setMoisture(EnumMoisture.DAMP);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -125,7 +142,6 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
AlleleHelper.getInstance().set(alleles, EnumFlowerChromosome.PH_TOLERANCE, EnumAllele.Tolerance.DOWN_1);
|
||||
AlleleHelper.getInstance().set(alleles, EnumFlowerChromosome.HUMIDITY_TOLERANCE, EnumAllele.Tolerance.BOTH_1);
|
||||
AlleleHelper.getInstance().set(alleles, EnumFlowerChromosome.STEM, EnumFlowerColor.OliveDrab);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -175,7 +191,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
Pansy("Pansy", "viola", "tricolor", EnumFlowerType.Pansy, EnumFlowerColor.Pink, EnumFlowerColor.Purple) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setPH(EnumAcidity.Acid);
|
||||
flowerSpecies.setPH(EnumAcidity.ACID);
|
||||
flowerSpecies.setTemperature(EnumTemperature.WARM);
|
||||
}
|
||||
|
||||
@@ -194,7 +210,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
Iris("Iris", "iris", "germanica", EnumFlowerType.Iris, EnumFlowerColor.LightGray, EnumFlowerColor.Purple) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setPH(EnumAcidity.Acid);
|
||||
flowerSpecies.setPH(EnumAcidity.ACID);
|
||||
flowerSpecies.setTemperature(EnumTemperature.WARM);
|
||||
}
|
||||
|
||||
@@ -229,12 +245,11 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
protected void registerMutations() {
|
||||
registerMutation(Allium, Viola, 10);
|
||||
}
|
||||
|
||||
},
|
||||
Viola("Viola", "viola", "odorata", EnumFlowerType.Viola, EnumFlowerColor.MediumPurple, EnumFlowerColor.SlateBlue) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setPH(EnumAcidity.Acid);
|
||||
flowerSpecies.setPH(EnumAcidity.ACID);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -248,7 +263,6 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
protected void registerMutations() {
|
||||
registerMutation(Orchid, Poppy, 15);
|
||||
}
|
||||
|
||||
},
|
||||
Daffodil("Daffodil", "narcissus", "pseudonarcissus", EnumFlowerType.Daffodil, EnumFlowerColor.Yellow, EnumFlowerColor.Gold) {
|
||||
@Override
|
||||
@@ -288,7 +302,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
Peony("Peony", "paeonia", "suffruticosa", EnumFlowerType.Peony, EnumFlowerColor.Thistle) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setPH(EnumAcidity.Alkaline);
|
||||
flowerSpecies.setPH(EnumAcidity.ALKALINE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -308,7 +322,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
Rose("Rose", "rosa", "rubiginosa", EnumFlowerType.Rose, EnumFlowerColor.Red) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setPH(EnumAcidity.Acid);
|
||||
flowerSpecies.setPH(EnumAcidity.ACID);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -327,7 +341,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
Lilac("Lilac", "syringa", "vulgaris", EnumFlowerType.Lilac, EnumFlowerColor.Plum) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setPH(EnumAcidity.Alkaline);
|
||||
flowerSpecies.setPH(EnumAcidity.ALKALINE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -345,7 +359,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
Hydrangea("Hydrangea", "hydrangea", "macrophylla", EnumFlowerType.Hydrangea, EnumFlowerColor.DeepSkyBlue) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setMoisture(EnumMoisture.Damp);
|
||||
flowerSpecies.setMoisture(EnumMoisture.DAMP);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -466,7 +480,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
Azalea("Azalea", "rhododendrons", "aurigeranum", EnumFlowerType.Azalea, EnumFlowerColor.HotPink) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setPH(EnumAcidity.Acid);
|
||||
flowerSpecies.setPH(EnumAcidity.ACID);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -481,7 +495,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
Primrose("Primrose", "primula", "vulgaris", EnumFlowerType.Primrose, EnumFlowerColor.Red, EnumFlowerColor.Gold) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setPH(EnumAcidity.Acid);
|
||||
flowerSpecies.setPH(EnumAcidity.ACID);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -511,12 +525,11 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
protected void registerMutations() {
|
||||
registerMutation(Daisy, Tulip, 10);
|
||||
}
|
||||
|
||||
},
|
||||
Carnation("Carnation", "dianthus", "caryophyllus", EnumFlowerType.Carnation, EnumFlowerColor.Crimson, EnumFlowerColor.White) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setPH(EnumAcidity.Alkaline);
|
||||
flowerSpecies.setPH(EnumAcidity.ALKALINE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -554,7 +567,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
Yarrow("Yarrow", "achillea", "millefolium", EnumFlowerType.Yarrow, EnumFlowerColor.Yellow) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setPH(EnumAcidity.Acid);
|
||||
flowerSpecies.setPH(EnumAcidity.ACID);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -633,7 +646,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
Dianthus("Dianthus", "dianthus", "barbatus", EnumFlowerType.Dianthus, EnumFlowerColor.Crimson, EnumFlowerColor.HotPink) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setPH(EnumAcidity.Alkaline);
|
||||
flowerSpecies.setPH(EnumAcidity.ALKALINE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -654,7 +667,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
Forget("Forget-me-nots", "myosotis", "arvensis", EnumFlowerType.Forget, EnumFlowerColor.LightSteelBlue) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setPH(EnumAcidity.Acid);
|
||||
flowerSpecies.setPH(EnumAcidity.ACID);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -708,7 +721,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
Edelweiss("Edelweiss", "leontopodium", "alpinum", EnumFlowerType.Edelweiss, EnumFlowerColor.White, EnumFlowerColor.Khaki) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setPH(EnumAcidity.Alkaline);
|
||||
flowerSpecies.setPH(EnumAcidity.ALKALINE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -765,7 +778,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
Gaillardia("Gaillardia", "gaillardia", "aristata", EnumFlowerType.Gaillardia, EnumFlowerColor.DarkOrange, EnumFlowerColor.Yellow) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setMoisture(EnumMoisture.Damp);
|
||||
flowerSpecies.setMoisture(EnumMoisture.DAMP);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -787,7 +800,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
Auricula("Auricula", "primula", "auricula", EnumFlowerType.Auricula, EnumFlowerColor.Red, EnumFlowerColor.Yellow) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setPH(EnumAcidity.Acid);
|
||||
flowerSpecies.setPH(EnumAcidity.ACID);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -807,8 +820,8 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
Camellia("Camellia", "camellia", "japonica", EnumFlowerType.Camellia, EnumFlowerColor.Crimson) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setPH(EnumAcidity.Acid);
|
||||
flowerSpecies.setMoisture(EnumMoisture.Damp);
|
||||
flowerSpecies.setPH(EnumAcidity.ACID);
|
||||
flowerSpecies.setMoisture(EnumMoisture.DAMP);
|
||||
flowerSpecies.setTemperature(EnumTemperature.WARM);
|
||||
}
|
||||
|
||||
@@ -866,7 +879,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
Penstemon("Penstemon", "penstemon", "digitalis", EnumFlowerType.Penstemon, EnumFlowerColor.MediumOrchid, EnumFlowerColor.Thistle) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setMoisture(EnumMoisture.Dry);
|
||||
flowerSpecies.setMoisture(EnumMoisture.DRY);
|
||||
flowerSpecies.setTemperature(EnumTemperature.WARM);
|
||||
}
|
||||
|
||||
@@ -888,7 +901,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
Delphinium("Delphinium", "delphinium", "staphisagria", EnumFlowerType.Delphinium, EnumFlowerColor.DarkSlateBlue) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies) {
|
||||
flowerSpecies.setMoisture(EnumMoisture.Damp);
|
||||
flowerSpecies.setMoisture(EnumMoisture.DAMP);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -925,6 +938,8 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
}
|
||||
};
|
||||
|
||||
public static FlowerDefinition[] VALUES = values();
|
||||
private final IAlleleFlowerSpecies species;
|
||||
IFlowerType<EnumFlowerType> type;
|
||||
String name;
|
||||
String binomial;
|
||||
@@ -933,28 +948,6 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
@Nullable
|
||||
IClassification branch;
|
||||
EnumFlowerColor primaryColor, secondaryColor;
|
||||
|
||||
private static void setupVariants() {
|
||||
IFlowerRoot flowerRood = BotanyCore.getFlowerRoot();
|
||||
flowerRood.addConversion(new ItemStack(Blocks.YELLOW_FLOWER, 1, 0), Dandelion.getTemplate());
|
||||
flowerRood.addConversion(new ItemStack(Blocks.RED_FLOWER, 1, 0), Poppy.getTemplate());
|
||||
flowerRood.addConversion(new ItemStack(Blocks.RED_FLOWER, 1, 1), Orchid.getTemplate());
|
||||
flowerRood.addConversion(new ItemStack(Blocks.RED_FLOWER, 1, 2), Allium.getTemplate());
|
||||
flowerRood.addConversion(new ItemStack(Blocks.RED_FLOWER, 1, 3), Bluet.getTemplate());
|
||||
flowerRood.addConversion(new ItemStack(Blocks.RED_FLOWER, 1, 7), Tulip.getTemplate());
|
||||
flowerRood.addConversion(new ItemStack(Blocks.RED_FLOWER, 1, 8), Daisy.getTemplate());
|
||||
flowerRood.addConversion(new ItemStack(Blocks.DOUBLE_PLANT, 1, 1), Lilac.getTemplate());
|
||||
flowerRood.addConversion(new ItemStack(Blocks.DOUBLE_PLANT, 1, 4), Rose.getTemplate());
|
||||
flowerRood.addConversion(new ItemStack(Blocks.DOUBLE_PLANT, 1, 5), Peony.getTemplate());
|
||||
flowerRood.addConversion(new ItemStack(Blocks.RED_FLOWER, 1, 6), Tulip.addVariant(EnumFlowerColor.White));
|
||||
flowerRood.addConversion(new ItemStack(Blocks.RED_FLOWER, 1, 4), Tulip.addVariant(EnumFlowerColor.Crimson));
|
||||
flowerRood.addConversion(new ItemStack(Blocks.RED_FLOWER, 1, 5), Tulip.addVariant(EnumFlowerColor.DarkOrange));
|
||||
}
|
||||
|
||||
public static FlowerDefinition[] VALUES = values();
|
||||
|
||||
private final IAlleleFlowerSpecies species;
|
||||
|
||||
private IAllele[] template;
|
||||
private IFlowerGenome genome;
|
||||
|
||||
@@ -991,6 +984,52 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
}
|
||||
}
|
||||
|
||||
private static void setupVariants() {
|
||||
IFlowerRoot flowerRood = BotanyCore.getFlowerRoot();
|
||||
flowerRood.addConversion(new ItemStack(Blocks.YELLOW_FLOWER, 1, 0), Dandelion.getTemplate());
|
||||
flowerRood.addConversion(new ItemStack(Blocks.RED_FLOWER, 1, 0), Poppy.getTemplate());
|
||||
flowerRood.addConversion(new ItemStack(Blocks.RED_FLOWER, 1, 1), Orchid.getTemplate());
|
||||
flowerRood.addConversion(new ItemStack(Blocks.RED_FLOWER, 1, 2), Allium.getTemplate());
|
||||
flowerRood.addConversion(new ItemStack(Blocks.RED_FLOWER, 1, 3), Bluet.getTemplate());
|
||||
flowerRood.addConversion(new ItemStack(Blocks.RED_FLOWER, 1, 7), Tulip.getTemplate());
|
||||
flowerRood.addConversion(new ItemStack(Blocks.RED_FLOWER, 1, 8), Daisy.getTemplate());
|
||||
flowerRood.addConversion(new ItemStack(Blocks.DOUBLE_PLANT, 1, 1), Lilac.getTemplate());
|
||||
flowerRood.addConversion(new ItemStack(Blocks.DOUBLE_PLANT, 1, 4), Rose.getTemplate());
|
||||
flowerRood.addConversion(new ItemStack(Blocks.DOUBLE_PLANT, 1, 5), Peony.getTemplate());
|
||||
flowerRood.addConversion(new ItemStack(Blocks.RED_FLOWER, 1, 6), Tulip.addVariant(EnumFlowerColor.White));
|
||||
flowerRood.addConversion(new ItemStack(Blocks.RED_FLOWER, 1, 4), Tulip.addVariant(EnumFlowerColor.Crimson));
|
||||
flowerRood.addConversion(new ItemStack(Blocks.RED_FLOWER, 1, 5), Tulip.addVariant(EnumFlowerColor.DarkOrange));
|
||||
}
|
||||
|
||||
public static void preInitFlowers() {
|
||||
MinecraftForge.EVENT_BUS.post(new AlleleSpeciesRegisterEvent(FlowerManager.flowerRoot, IAlleleFlowerSpecies.class));
|
||||
for (FlowerDefinition def : values()) {
|
||||
@SuppressWarnings("unchecked")
|
||||
IFlowerType<EnumFlowerType> type = def.species.getType();
|
||||
if (EnumFlowerType.highestSection < type.getSections()) {
|
||||
EnumFlowerType.highestSection = type.getSections();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void initFlowers() {
|
||||
for (FlowerDefinition flower : values()) {
|
||||
flower.init();
|
||||
}
|
||||
setupVariants();
|
||||
for (FlowerDefinition flower : values()) {
|
||||
flower.registerMutations();
|
||||
}
|
||||
}
|
||||
|
||||
private static void markAllelesAsValid(IChromosomeType existingType, IChromosomeType newType) {
|
||||
IAlleleRegistry alleleRegistry = AlleleManager.alleleRegistry;
|
||||
Collection<IAllele> alleles = alleleRegistry.getRegisteredAlleles(existingType);
|
||||
for (IAllele allele : alleles) {
|
||||
alleleRegistry.addValidAlleleTypes(allele, newType);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void setSpeciesProperties(IAlleleFlowerSpeciesBuilder flowerSpecies);
|
||||
|
||||
protected abstract void setAlleles(IAllele[] alleles);
|
||||
@@ -1013,10 +1052,6 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
return this.variantTemplates;
|
||||
}
|
||||
|
||||
public void setBranch(final IClassification branch) {
|
||||
this.branch = branch;
|
||||
}
|
||||
|
||||
public IClassification getBranch() {
|
||||
if (branch == null) {
|
||||
final String scientific = branchName.substring(0, 1).toUpperCase() + branchName.substring(1).toLowerCase();
|
||||
@@ -1030,6 +1065,10 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
return this.branch;
|
||||
}
|
||||
|
||||
public void setBranch(final IClassification branch) {
|
||||
this.branch = branch;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final IAllele[] getTemplate() {
|
||||
return Arrays.copyOf(template, template.length);
|
||||
@@ -1055,27 +1094,6 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
return BotanyCore.getFlowerRoot().getMemberStack(flower, flowerStage);
|
||||
}
|
||||
|
||||
public static void preInitFlowers() {
|
||||
MinecraftForge.EVENT_BUS.post(new AlleleSpeciesRegisterEvent(FlowerManager.flowerRoot, IAlleleFlowerSpecies.class));
|
||||
for (FlowerDefinition def : values()) {
|
||||
@SuppressWarnings("unchecked")
|
||||
IFlowerType<EnumFlowerType> type = def.species.getType();
|
||||
if (EnumFlowerType.highestSection < type.getSections()) {
|
||||
EnumFlowerType.highestSection = type.getSections();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void initFlowers() {
|
||||
for (FlowerDefinition flower : values()) {
|
||||
flower.init();
|
||||
}
|
||||
setupVariants();
|
||||
for (FlowerDefinition flower : values()) {
|
||||
flower.registerMutations();
|
||||
}
|
||||
}
|
||||
|
||||
private void init() {
|
||||
markAllelesAsValid(EnumBeeChromosome.FERTILITY, EnumFlowerChromosome.FERTILITY);
|
||||
markAllelesAsValid(EnumBeeChromosome.TERRITORY, EnumFlowerChromosome.TERRITORY);
|
||||
@@ -1100,14 +1118,6 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
}
|
||||
}
|
||||
|
||||
private static void markAllelesAsValid(IChromosomeType existingType, IChromosomeType newType) {
|
||||
IAlleleRegistry alleleRegistry = AlleleManager.alleleRegistry;
|
||||
Collection<IAllele> alleles = alleleRegistry.getRegisteredAlleles(existingType);
|
||||
for (IAllele allele : alleles) {
|
||||
alleleRegistry.addValidAlleleTypes(allele, newType);
|
||||
}
|
||||
}
|
||||
|
||||
protected final IFlowerMutationBuilder registerMutation(final FlowerDefinition parent1, final FlowerDefinition parent2, final int chance) {
|
||||
return FlowerManager.flowerFactory.createMutation(parent1.species, parent2.species, getTemplate(), chance);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import binnie.botany.api.*;
|
||||
import binnie.botany.api.FlowerManager;
|
||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||
import binnie.botany.api.IAlleleFlowerSpeciesBuilder;
|
||||
import binnie.botany.api.IFlowerFactory;
|
||||
import binnie.botany.api.IFlowerMutationBuilder;
|
||||
import binnie.botany.api.IFlowerType;
|
||||
import binnie.botany.flower.FlowerSpriteManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IClassification;
|
||||
|
||||
public class FlowerFactory implements IFlowerFactory {
|
||||
|
||||
@Override
|
||||
public IAlleleFlowerSpeciesBuilder createSpecies(String uid, String unlocalizedName, String authority, String unlocalizedDescription, boolean isDominant, IClassification branch, String binomial, IFlowerType flowerType) {
|
||||
FlowerSpriteManager.initSprites(flowerType);
|
||||
@@ -19,5 +23,4 @@ public class FlowerFactory implements IFlowerFactory {
|
||||
FlowerManager.flowerRoot.registerMutation(mutation);
|
||||
return mutation;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,10 +1,22 @@
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.botany.api.*;
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import binnie.botany.api.EnumFlowerChromosome;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import binnie.botany.api.FlowerManager;
|
||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||
import binnie.botany.api.IFlowerGenome;
|
||||
import binnie.botany.api.IFlowerType;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.genetics.*;
|
||||
import forestry.api.genetics.EnumTolerance;
|
||||
import forestry.api.genetics.IAlleleFloat;
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IAlleleTolerance;
|
||||
import forestry.api.genetics.IChromosome;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.core.genetics.Genome;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import binnie.botany.api.*;
|
||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||
import binnie.botany.api.IFlowerGenome;
|
||||
import binnie.botany.api.IFlowerMutation;
|
||||
import binnie.botany.api.IFlowerMutationBuilder;
|
||||
import binnie.botany.api.IFlowerRoot;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.genetics.IAllele;
|
||||
@@ -10,7 +14,6 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class FlowerMutation extends Mutation implements IFlowerMutation, IFlowerMutationBuilder {
|
||||
|
||||
public FlowerMutation(final IAlleleFlowerSpecies allele0, final IAlleleFlowerSpecies allele1, final IAllele[] template, final int chance) {
|
||||
super(allele0, allele1, template, chance);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,23 @@
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.api.*;
|
||||
import binnie.botany.api.EnumFlowerChromosome;
|
||||
import binnie.botany.api.EnumFlowerStage;
|
||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||
import binnie.botany.api.IBotanistTracker;
|
||||
import binnie.botany.api.IColourMix;
|
||||
import binnie.botany.api.IFlower;
|
||||
import binnie.botany.api.IFlowerGenome;
|
||||
import binnie.botany.api.IFlowerMutation;
|
||||
import binnie.botany.api.IFlowerRoot;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import forestry.api.genetics.*;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IAlyzerPlugin;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IMutation;
|
||||
import forestry.api.genetics.ISpeciesType;
|
||||
import forestry.core.genetics.SpeciesRoot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -11,15 +25,20 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
public class FlowerRoot extends SpeciesRoot implements IFlowerRoot {
|
||||
public static int flowerSpeciesCount = -1;
|
||||
static final String UID = "rootFlowers";
|
||||
public static int flowerSpeciesCount = -1;
|
||||
public static ArrayList<IFlower> flowerTemplates = new ArrayList<>();
|
||||
private static ArrayList<IFlowerMutation> flowerMutations = new ArrayList<>();
|
||||
Map<ItemStack, IFlower> conversions;
|
||||
private static ArrayList<IColourMix> colourMixes = new ArrayList<>();
|
||||
Map<ItemStack, IFlower> conversions;
|
||||
|
||||
public FlowerRoot() {
|
||||
this.conversions = new HashMap<>();
|
||||
@@ -227,7 +246,6 @@ public class FlowerRoot extends SpeciesRoot implements IFlowerRoot {
|
||||
return EnumFlowerChromosome.SPECIES;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addConversion(final ItemStack itemstack, final IAllele[] template) {
|
||||
final IFlower flower = this.getFlower(this.templateAsGenome(template));
|
||||
@@ -257,5 +275,4 @@ public class FlowerRoot extends SpeciesRoot implements IFlowerRoot {
|
||||
}
|
||||
return FlowerRoot.colourMixes;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,7 +17,6 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemDictionary extends Item implements IItemModelRegister {
|
||||
|
||||
public ItemDictionary() {
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
this.setUnlocalizedName("database");
|
||||
|
||||
@@ -52,15 +52,15 @@ public class ModuleGenetics implements IInitializable {
|
||||
public void postInit() {
|
||||
FlowerManager.flowerRegistry.registerAcceptableFlower(Botany.flower, "flowersVanilla");
|
||||
RecipeManagers.carpenterManager.addRecipe(100, Binnie.LIQUID.getFluidStack("water", 2000), ItemStack.EMPTY, new ItemStack(Botany.database),
|
||||
"X#X",
|
||||
"YEY",
|
||||
"RDR",
|
||||
'#', Blocks.GLASS_PANE,
|
||||
'X', Items.GOLD_INGOT,
|
||||
'Y', Items.GOLD_NUGGET,
|
||||
'R', Items.REDSTONE,
|
||||
'D', Items.DIAMOND,
|
||||
'E', Items.EMERALD);
|
||||
"X#X",
|
||||
"YEY",
|
||||
"RDR",
|
||||
'#', Blocks.GLASS_PANE,
|
||||
'X', Items.GOLD_INGOT,
|
||||
'Y', Items.GOLD_NUGGET,
|
||||
'R', Items.REDSTONE,
|
||||
'D', Items.DIAMOND,
|
||||
'E', Items.EMERALD
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -44,5 +44,4 @@ public class PacketFlowerUpdate extends SPacketUpdateTileEntity {
|
||||
buf.writeBoolean(this.render.wilted);
|
||||
buf.writeBoolean(this.render.flowered);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,8 +24,8 @@ public enum PacketID implements IPacketID {
|
||||
onUseFieldKit(packet.getTagCompound());
|
||||
}
|
||||
}
|
||||
|
||||
public void onUseFieldKit(NBTTagCompound data){
|
||||
|
||||
public void onUseFieldKit(NBTTagCompound data) {
|
||||
EntityPlayer player = BinnieCore.getBinnieProxy().getPlayer();
|
||||
String info = "";
|
||||
if (data == null || data.hasNoTags()) {
|
||||
|
||||
@@ -18,9 +18,9 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class AbstractMod implements IPacketProvider, IInitializable {
|
||||
protected List<IInitializable> modules;
|
||||
@Nullable
|
||||
private SimpleNetworkWrapper wrapper;
|
||||
protected List<IInitializable> modules;
|
||||
|
||||
public AbstractMod() {
|
||||
this.modules = new ArrayList<>();
|
||||
@@ -59,7 +59,7 @@ public abstract class AbstractMod implements IPacketProvider, IInitializable {
|
||||
|
||||
protected abstract Class<? extends BinniePacketHandler> getPacketHandler();
|
||||
|
||||
public Object getMod(){
|
||||
public Object getMod() {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,30 +52,23 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Mod(
|
||||
modid = Constants.CORE_MOD_ID,
|
||||
name = "Binnie Core",
|
||||
useMetadata = true,
|
||||
dependencies = "required-after:forge@[13.20.0.2279,);" +
|
||||
"required-after:forestry@[5.3.3.89,);" +
|
||||
"after:jei@[4.3.1,);"
|
||||
modid = Constants.CORE_MOD_ID,
|
||||
name = "Binnie Core",
|
||||
useMetadata = true,
|
||||
dependencies = "required-after:forge@[13.20.0.2279,);" +
|
||||
"required-after:forestry@[5.3.3.89,);" +
|
||||
"after:jei@[4.3.1,);"
|
||||
)
|
||||
public final class BinnieCore extends AbstractMod {
|
||||
|
||||
public BinnieCore() {
|
||||
FluidRegistry.enableUniversalBucket();
|
||||
}
|
||||
|
||||
private static final List<AbstractMod> modList = new ArrayList<>();
|
||||
public static int multipassRenderID;
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@Mod.Instance(Constants.CORE_MOD_ID)
|
||||
private static BinnieCore instance;
|
||||
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@SidedProxy(clientSide = "binnie.core.proxy.BinnieProxyClient", serverSide = "binnie.core.proxy.BinnieProxyServer")
|
||||
private static BinnieProxy proxy;
|
||||
|
||||
public static int multipassRenderID;
|
||||
private static final List<AbstractMod> modList = new ArrayList<>();
|
||||
|
||||
@Nullable
|
||||
private static MachineGroup packageCompartment;
|
||||
@Nullable
|
||||
@@ -83,6 +76,10 @@ public final class BinnieCore extends AbstractMod {
|
||||
@Nullable
|
||||
private static ItemFieldKit fieldKit;
|
||||
|
||||
public BinnieCore() {
|
||||
FluidRegistry.enableUniversalBucket();
|
||||
}
|
||||
|
||||
public static MachineGroup getPackageCompartment() {
|
||||
Preconditions.checkState(packageCompartment != null, "packageCompartment has not been init");
|
||||
return packageCompartment;
|
||||
@@ -114,6 +111,52 @@ public final class BinnieCore extends AbstractMod {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public static BinnieProxy getBinnieProxy() {
|
||||
return proxy;
|
||||
}
|
||||
|
||||
public static boolean isLepidopteryActive() {
|
||||
return PluginManager.configDisabledPlugins.stream().noneMatch(e -> e instanceof forestry.lepidopterology.PluginLepidopterology);
|
||||
}
|
||||
|
||||
public static boolean isApicultureActive() {
|
||||
return PluginManager.configDisabledPlugins.stream().noneMatch(e -> e instanceof forestry.arboriculture.PluginArboriculture);
|
||||
}
|
||||
|
||||
public static boolean isArboricultureActive() {
|
||||
return PluginManager.configDisabledPlugins.stream().noneMatch(e -> e instanceof forestry.arboriculture.PluginArboriculture);
|
||||
}
|
||||
|
||||
public static boolean isBotanyActive() {
|
||||
return ConfigurationMods.botany;
|
||||
}
|
||||
|
||||
public static boolean isGeneticsActive() {
|
||||
return ConfigurationMods.genetics;
|
||||
}
|
||||
|
||||
public static boolean isExtraBeesActive() {
|
||||
return ExtraBeesIntegration.isLoaded() && isApicultureActive();
|
||||
}
|
||||
|
||||
public static boolean isExtraTreesActive() {
|
||||
return ConfigurationMods.extraTrees && isArboricultureActive();
|
||||
}
|
||||
|
||||
static void registerMod(final AbstractMod mod) {
|
||||
BinnieCore.modList.add(mod);
|
||||
}
|
||||
|
||||
private static List<AbstractMod> getActiveMods() {
|
||||
final List<AbstractMod> list = new ArrayList<>();
|
||||
for (final AbstractMod mod : BinnieCore.modList) {
|
||||
if (mod.isActive()) {
|
||||
list.add(mod);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preInit(final FMLPreInitializationEvent evt) {
|
||||
MinecraftForge.EVENT_BUS.register(Binnie.LIQUID);
|
||||
@@ -150,7 +193,7 @@ public final class BinnieCore extends AbstractMod {
|
||||
if (Loader.isModLoaded("BuildCraft|Silicon")) {
|
||||
this.addModule(new ModuleTrigger());
|
||||
}
|
||||
if (ExtraBeesIntegration.isLoaded()){
|
||||
if (ExtraBeesIntegration.isLoaded()) {
|
||||
this.addModule(new ExtraBeesIntegration());
|
||||
}
|
||||
}
|
||||
@@ -170,9 +213,7 @@ public final class BinnieCore extends AbstractMod {
|
||||
return proxy;
|
||||
}
|
||||
|
||||
public static BinnieProxy getBinnieProxy() {
|
||||
return proxy;
|
||||
}
|
||||
//Module handling
|
||||
|
||||
@Override
|
||||
public String getModID() {
|
||||
@@ -218,9 +259,9 @@ public final class BinnieCore extends AbstractMod {
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void handleTextureRemap(final TextureStitchEvent.Pre event) {
|
||||
// if (event.map.getTextureType() == 0) {
|
||||
// Binnie.Liquid.reloadIcons(event.map);
|
||||
// }
|
||||
/*if (event.map.getTextureType() == 0) {
|
||||
Binnie.Liquid.reloadIcons(event.map);
|
||||
}*/
|
||||
Binnie.RESOURCE.registerSprites();
|
||||
}
|
||||
|
||||
@@ -235,49 +276,4 @@ public final class BinnieCore extends AbstractMod {
|
||||
super(BinnieCore.getInstance());
|
||||
}
|
||||
}
|
||||
|
||||
//Module handling
|
||||
|
||||
public static boolean isLepidopteryActive() {
|
||||
return PluginManager.configDisabledPlugins.stream().noneMatch(e -> e instanceof forestry.lepidopterology.PluginLepidopterology);
|
||||
}
|
||||
|
||||
public static boolean isApicultureActive() {
|
||||
return PluginManager.configDisabledPlugins.stream().noneMatch(e -> e instanceof forestry.arboriculture.PluginArboriculture);
|
||||
}
|
||||
|
||||
public static boolean isArboricultureActive() {
|
||||
return PluginManager.configDisabledPlugins.stream().noneMatch(e -> e instanceof forestry.arboriculture.PluginArboriculture);
|
||||
}
|
||||
|
||||
public static boolean isBotanyActive() {
|
||||
return ConfigurationMods.botany;
|
||||
}
|
||||
|
||||
public static boolean isGeneticsActive() {
|
||||
return ConfigurationMods.genetics;
|
||||
}
|
||||
|
||||
public static boolean isExtraBeesActive() {
|
||||
return ExtraBeesIntegration.isLoaded() && isApicultureActive();
|
||||
}
|
||||
|
||||
public static boolean isExtraTreesActive() {
|
||||
return ConfigurationMods.extraTrees && isArboricultureActive();
|
||||
}
|
||||
|
||||
static void registerMod(final AbstractMod mod) {
|
||||
BinnieCore.modList.add(mod);
|
||||
}
|
||||
|
||||
private static List<AbstractMod> getActiveMods() {
|
||||
final List<AbstractMod> list = new ArrayList<>();
|
||||
for (final AbstractMod mod : BinnieCore.modList) {
|
||||
if (mod.isActive()) {
|
||||
list.add(mod);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -37,6 +37,7 @@ import java.util.EnumMap;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public abstract class BaseBakedModel implements IPerspectiveAwareModel {
|
||||
private static final TRSRTransformation flipX = new TRSRTransformation(null, null, new Vector3f(-1, 1, 1), null);
|
||||
private final EnumMap<ItemCameraTransforms.TransformType, TRSRTransformation> transformMap = new EnumMap<>(ItemCameraTransforms.TransformType.class);
|
||||
private final ResourceLocation particle;
|
||||
|
||||
@@ -48,10 +49,24 @@ public abstract class BaseBakedModel implements IPerspectiveAwareModel {
|
||||
this.particle = particle != null ? particle : TextureMap.LOCATION_MISSING_TEXTURE;
|
||||
}
|
||||
|
||||
protected static TRSRTransformation toLeftHand(TRSRTransformation transform) {
|
||||
return TRSRTransformation.blockCenterToCorner(flipX.compose(TRSRTransformation.blockCornerToCenter(transform)).compose(flipX));
|
||||
}
|
||||
|
||||
protected static TRSRTransformation getTransformation(float tx, float ty, float tz, float ax, float ay, float az, float s) {
|
||||
return TRSRTransformation.blockCenterToCorner(new TRSRTransformation(
|
||||
new Vector3f(tx / 16, ty / 16, tz / 16),
|
||||
TRSRTransformation.quatFromXYZDegrees(new Vector3f(ax, ay, az)),
|
||||
new Vector3f(s, s, s),
|
||||
null
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) {
|
||||
return ImmutablePair.of(this,
|
||||
transformMap.containsKey(cameraTransformType) ? transformMap.get(cameraTransformType).getMatrix() : null);
|
||||
transformMap.containsKey(cameraTransformType) ? transformMap.get(cameraTransformType).getMatrix() : null
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -84,6 +99,8 @@ public abstract class BaseBakedModel implements IPerspectiveAwareModel {
|
||||
return ItemOverrideList.NONE;
|
||||
}
|
||||
|
||||
// ForgeBlockStateV1 transforms
|
||||
|
||||
public void addTransformation(ItemCameraTransforms.TransformType type, TRSRTransformation transformation) {
|
||||
transformMap.put(type, TRSRTransformation.blockCornerToCenter(transformation));
|
||||
}
|
||||
@@ -98,22 +115,6 @@ public abstract class BaseBakedModel implements IPerspectiveAwareModel {
|
||||
addTransformation(ItemCameraTransforms.TransformType.FIRST_PERSON_LEFT_HAND, toLeftHand(transformation));
|
||||
}
|
||||
|
||||
// ForgeBlockStateV1 transforms
|
||||
|
||||
private static final TRSRTransformation flipX = new TRSRTransformation(null, null, new Vector3f(-1, 1, 1), null);
|
||||
|
||||
protected static TRSRTransformation toLeftHand(TRSRTransformation transform) {
|
||||
return TRSRTransformation.blockCenterToCorner(flipX.compose(TRSRTransformation.blockCornerToCenter(transform)).compose(flipX));
|
||||
}
|
||||
|
||||
protected static TRSRTransformation getTransformation(float tx, float ty, float tz, float ax, float ay, float az, float s) {
|
||||
return TRSRTransformation.blockCenterToCorner(new TRSRTransformation(
|
||||
new Vector3f(tx / 16, ty / 16, tz / 16),
|
||||
TRSRTransformation.quatFromXYZDegrees(new Vector3f(ax, ay, az)),
|
||||
new Vector3f(s, s, s),
|
||||
null));
|
||||
}
|
||||
|
||||
public BaseBakedModel addDefaultBlockTransforms() {
|
||||
TRSRTransformation thirdperson = getTransformation(0, 2.5f, 0, 75, 45, 0, 0.375f);
|
||||
addTransformation(ItemCameraTransforms.TransformType.GUI, getTransformation(0, 0, 0, 30, 225, 0, 0.625f));
|
||||
|
||||
@@ -26,47 +26,6 @@ public class BlockMetadata extends BlockContainer implements IBlockMetadata {
|
||||
super(material);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
return getBlockDroppedAsList(this, world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) {
|
||||
return breakBlock(this, player, world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(final World var1, final int i) {
|
||||
return new TileEntityMetadata();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
||||
return getPickBlock(world, pos);
|
||||
}
|
||||
|
||||
/* IBLOCKMETADATA */
|
||||
@Override
|
||||
public String getDisplayName(final ItemStack itemStack) {
|
||||
return this.getLocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlacedMeta(final ItemStack item, final World world, final BlockPos pos, final EnumFacing clickedBlock) {
|
||||
return TileEntityMetadata.getItemDamage(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDroppedMeta(IBlockState state, int tileMetadata) {
|
||||
return getMetaFromState(state);
|
||||
}
|
||||
|
||||
public static ItemStack getBlockDropped(IBlockMetadata block, IBlockAccess world, BlockPos pos) {
|
||||
TileEntityMetadata tile = TileEntityMetadata.getTile(world, pos);
|
||||
if (tile != null && !tile.hasDroppedBlock()) {
|
||||
@@ -109,4 +68,44 @@ public class BlockMetadata extends BlockContainer implements IBlockMetadata {
|
||||
return getBlockDropped((IBlockMetadata) block, world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
return getBlockDroppedAsList(this, world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) {
|
||||
return breakBlock(this, player, world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(final World var1, final int i) {
|
||||
return new TileEntityMetadata();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
||||
return getPickBlock(world, pos);
|
||||
}
|
||||
|
||||
/* IBLOCKMETADATA */
|
||||
@Override
|
||||
public String getDisplayName(final ItemStack itemStack) {
|
||||
return this.getLocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlacedMeta(final ItemStack item, final World world, final BlockPos pos, final EnumFacing clickedBlock) {
|
||||
return TileEntityMetadata.getItemDamage(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDroppedMeta(IBlockState state, int tileMetadata) {
|
||||
return getMetaFromState(state);
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,6 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public interface IMultipassBlock<K> {
|
||||
|
||||
default AxisAlignedBB getItemBoundingBox() {
|
||||
return Block.FULL_BLOCK_AABB;
|
||||
}
|
||||
|
||||
@@ -2,37 +2,37 @@ package binnie.core.block;
|
||||
|
||||
public class ItemMetadataRenderer //implements IItemRenderer
|
||||
{
|
||||
// @Override
|
||||
// public boolean handleRenderType(final ItemStack item, final IItemRenderer.ItemRenderType type) {
|
||||
// return type == IItemRenderer.ItemRenderType.INVENTORY || type == IItemRenderer.ItemRenderType.ENTITY || type == IItemRenderer.ItemRenderType.EQUIPPED || type == IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean shouldUseRenderHelper(final IItemRenderer.ItemRenderType type, final ItemStack item, final IItemRenderer.ItemRendererHelper helper) {
|
||||
// if (type == IItemRenderer.ItemRenderType.INVENTORY) {
|
||||
// return helper == IItemRenderer.ItemRendererHelper.INVENTORY_BLOCK;
|
||||
// }
|
||||
// if (type == IItemRenderer.ItemRenderType.ENTITY) {
|
||||
// return helper == IItemRenderer.ItemRendererHelper.ENTITY_BOBBING || helper == IItemRenderer.ItemRendererHelper.ENTITY_ROTATION;
|
||||
// }
|
||||
// return (type == IItemRenderer.ItemRenderType.EQUIPPED || type == IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON) && helper == IItemRenderer.ItemRendererHelper.EQUIPPED_BLOCK;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void renderItem(final IItemRenderer.ItemRenderType type, final ItemStack item, final Object... data) {
|
||||
// GlStateManager.pushMatrix();
|
||||
// final Block block = Block.getBlockFromItem(item.getItem());
|
||||
// if (type == IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON) {
|
||||
// GlStateManager.translate(0.5, 0.5, 0.5);
|
||||
// }
|
||||
// if (type == IItemRenderer.ItemRenderType.INVENTORY && block.getRenderBlockPass() != 0) {
|
||||
// GL11.glAlphaFunc(516, 0.1f);
|
||||
// GlStateManager.enableBlend();
|
||||
// OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
// }
|
||||
// GlStateManager.pushMatrix();
|
||||
// ((RenderBlocks) data[0]).renderBlockAsItem(block, TileEntityMetadata.getItemDamage(item), 1.0f);
|
||||
// GlStateManager.popMatrix();
|
||||
// GlStateManager.popMatrix();
|
||||
// }
|
||||
/*@Override
|
||||
public boolean handleRenderType(final ItemStack item, final IItemRenderer.ItemRenderType type) {
|
||||
return type == IItemRenderer.ItemRenderType.INVENTORY || type == IItemRenderer.ItemRenderType.ENTITY || type == IItemRenderer.ItemRenderType.EQUIPPED || type == IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(final IItemRenderer.ItemRenderType type, final ItemStack item, final IItemRenderer.ItemRendererHelper helper) {
|
||||
if (type == IItemRenderer.ItemRenderType.INVENTORY) {
|
||||
return helper == IItemRenderer.ItemRendererHelper.INVENTORY_BLOCK;
|
||||
}
|
||||
if (type == IItemRenderer.ItemRenderType.ENTITY) {
|
||||
return helper == IItemRenderer.ItemRendererHelper.ENTITY_BOBBING || helper == IItemRenderer.ItemRendererHelper.ENTITY_ROTATION;
|
||||
}
|
||||
return (type == IItemRenderer.ItemRenderType.EQUIPPED || type == IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON) && helper == IItemRenderer.ItemRendererHelper.EQUIPPED_BLOCK;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(final IItemRenderer.ItemRenderType type, final ItemStack item, final Object... data) {
|
||||
GlStateManager.pushMatrix();
|
||||
final Block block = Block.getBlockFromItem(item.getItem());
|
||||
if (type == IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON) {
|
||||
GlStateManager.translate(0.5, 0.5, 0.5);
|
||||
}
|
||||
if (type == IItemRenderer.ItemRenderType.INVENTORY && block.getRenderBlockPass() != 0) {
|
||||
GL11.glAlphaFunc(516, 0.1f);
|
||||
GlStateManager.enableBlend();
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
}
|
||||
GlStateManager.pushMatrix();
|
||||
((RenderBlocks) data[0]).renderBlockAsItem(block, TileEntityMetadata.getItemDamage(item), 1.0f);
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.popMatrix();
|
||||
}*/
|
||||
}
|
||||
@@ -23,6 +23,42 @@ public class TileEntityMetadata extends TileEntity {
|
||||
this.droppedBlock = false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static TileEntityMetadata getTile(final IBlockAccess world, final BlockPos pos) {
|
||||
final TileEntity tile = world.getTileEntity(pos);
|
||||
if (!(tile instanceof TileEntityMetadata)) {
|
||||
return null;
|
||||
}
|
||||
return (TileEntityMetadata) tile;
|
||||
}
|
||||
|
||||
public static ItemStack getItemStack(final Block block, final int damage) {
|
||||
final Item item = Item.getItemFromBlock(block);
|
||||
Preconditions.checkNotNull(item, "Could not get item for block %s", block);
|
||||
final ItemStack itemStack = new ItemStack(item, 1, 0);
|
||||
setItemDamage(itemStack, damage);
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
public static void setItemDamage(final ItemStack item, final int i) {
|
||||
item.setItemDamage((i < 16387) ? i : 16387);
|
||||
final NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setInteger("meta", i);
|
||||
item.setTagCompound(tag);
|
||||
}
|
||||
|
||||
public static int getItemDamage(final ItemStack item) {
|
||||
if (item.hasTagCompound() && item.getTagCompound().hasKey("meta")) {
|
||||
return item.getTagCompound().getInteger("meta");
|
||||
}
|
||||
return item.getItemDamage();
|
||||
}
|
||||
|
||||
public static int getTileMetadata(final IBlockAccess world, final BlockPos pos) {
|
||||
final TileEntityMetadata tile = getTile(world, pos);
|
||||
return (tile == null) ? 0 : tile.getTileMetadata();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean receiveClientEvent(final int id, final int type) {
|
||||
if (id == 42) {
|
||||
@@ -78,42 +114,6 @@ public class TileEntityMetadata extends TileEntity {
|
||||
return new PacketMetadata(pos, meta, getUpdateTag());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static TileEntityMetadata getTile(final IBlockAccess world, final BlockPos pos) {
|
||||
final TileEntity tile = world.getTileEntity(pos);
|
||||
if (!(tile instanceof TileEntityMetadata)) {
|
||||
return null;
|
||||
}
|
||||
return (TileEntityMetadata) tile;
|
||||
}
|
||||
|
||||
public static ItemStack getItemStack(final Block block, final int damage) {
|
||||
final Item item = Item.getItemFromBlock(block);
|
||||
Preconditions.checkNotNull(item, "Could not get item for block %s", block);
|
||||
final ItemStack itemStack = new ItemStack(item, 1, 0);
|
||||
setItemDamage(itemStack, damage);
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
public static void setItemDamage(final ItemStack item, final int i) {
|
||||
item.setItemDamage((i < 16387) ? i : 16387);
|
||||
final NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setInteger("meta", i);
|
||||
item.setTagCompound(tag);
|
||||
}
|
||||
|
||||
public static int getItemDamage(final ItemStack item) {
|
||||
if (item.hasTagCompound() && item.getTagCompound().hasKey("meta")) {
|
||||
return item.getTagCompound().getInteger("meta");
|
||||
}
|
||||
return item.getItemDamage();
|
||||
}
|
||||
|
||||
public static int getTileMetadata(final IBlockAccess world, final BlockPos pos) {
|
||||
final TileEntityMetadata tile = getTile(world, pos);
|
||||
return (tile == null) ? 0 : tile.getTileMetadata();
|
||||
}
|
||||
|
||||
public boolean hasDroppedBlock() {
|
||||
return this.droppedBlock;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,6 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class CraftGUI {
|
||||
public static CraftGUIResourceManager resourceManager;
|
||||
public static final TextureRenderer render = new TextureRenderer();
|
||||
public static CraftGUIResourceManager resourceManager;
|
||||
}
|
||||
@@ -24,16 +24,16 @@ public interface IWidget {
|
||||
|
||||
Point getPosition();
|
||||
|
||||
Point pos();
|
||||
|
||||
void setPosition(final Point p0);
|
||||
|
||||
Point pos();
|
||||
|
||||
Point getSize();
|
||||
|
||||
Point size();
|
||||
|
||||
void setSize(final Point p0);
|
||||
|
||||
Point size();
|
||||
|
||||
Point getOriginalPosition();
|
||||
|
||||
Point getAbsolutePosition();
|
||||
@@ -42,20 +42,20 @@ public interface IWidget {
|
||||
|
||||
Point getOffset();
|
||||
|
||||
void setOffset(final Point p0);
|
||||
|
||||
Area getArea();
|
||||
|
||||
Area area();
|
||||
|
||||
void setOffset(final Point p0);
|
||||
|
||||
Point getMousePosition();
|
||||
|
||||
Point getRelativeMousePosition();
|
||||
|
||||
void setColour(final int p0);
|
||||
|
||||
int getColour();
|
||||
|
||||
void setColour(final int p0);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
void render(int guiWidth, int guiHeight);
|
||||
|
||||
|
||||
@@ -8,9 +8,9 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Tooltip {
|
||||
public int maxWidth;
|
||||
List<String> tooltip;
|
||||
ITooltipType type;
|
||||
public int maxWidth;
|
||||
private ItemStack itemStack = ItemStack.EMPTY;
|
||||
|
||||
public Tooltip() {
|
||||
@@ -19,13 +19,6 @@ public class Tooltip {
|
||||
this.maxWidth = 256;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the itemStack seen by tooltip event handlers.
|
||||
*/
|
||||
public void setItemStack(ItemStack itemStack) {
|
||||
this.itemStack = itemStack;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the itemStack seen by tooltip event handlers.
|
||||
*/
|
||||
@@ -33,6 +26,13 @@ public class Tooltip {
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the itemStack seen by tooltip event handlers.
|
||||
*/
|
||||
public void setItemStack(ItemStack itemStack) {
|
||||
this.itemStack = itemStack;
|
||||
}
|
||||
|
||||
public void add(final String string) {
|
||||
this.tooltip.add(string);
|
||||
}
|
||||
@@ -53,10 +53,6 @@ public class Tooltip {
|
||||
return this.tooltip.size() > 0;
|
||||
}
|
||||
|
||||
public void setType(final ITooltipType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public void setMaxWidth(final int w) {
|
||||
this.maxWidth = w;
|
||||
}
|
||||
@@ -65,6 +61,10 @@ public class Tooltip {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public void setType(final ITooltipType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a tooltip that also displays an itemStack on the tooltip directly.
|
||||
*/
|
||||
|
||||
@@ -7,16 +7,21 @@ import binnie.core.craftgui.geometry.Point;
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.*;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Deque;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
|
||||
public abstract class TopLevelWidget extends Widget implements ITopLevelWidget {
|
||||
protected Point mousePosition;
|
||||
@Nullable
|
||||
IWidget mousedOverWidget;
|
||||
@Nullable
|
||||
IWidget draggedWidget;
|
||||
@Nullable
|
||||
IWidget focusedWidget;
|
||||
protected Point mousePosition;
|
||||
Point dragStart;
|
||||
|
||||
public TopLevelWidget() {
|
||||
@@ -47,6 +52,25 @@ public abstract class TopLevelWidget extends Widget implements ITopLevelWidget {
|
||||
});
|
||||
}
|
||||
|
||||
public void setDraggedWidget(@Nullable final IWidget widget, final int button) {
|
||||
if (this.draggedWidget == widget) {
|
||||
return;
|
||||
}
|
||||
if (this.draggedWidget != null) {
|
||||
this.callEvent(new EventWidget.EndDrag(this.draggedWidget));
|
||||
}
|
||||
this.draggedWidget = widget;
|
||||
if (this.draggedWidget != null) {
|
||||
this.callEvent(new EventWidget.StartDrag(this.draggedWidget, button));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public IWidget getMousedOverWidget() {
|
||||
return this.mousedOverWidget;
|
||||
}
|
||||
|
||||
public void setMousedOverWidget(@Nullable final IWidget widget) {
|
||||
if (this.mousedOverWidget == widget) {
|
||||
return;
|
||||
@@ -60,21 +84,20 @@ public abstract class TopLevelWidget extends Widget implements ITopLevelWidget {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public IWidget getDraggedWidget() {
|
||||
return this.draggedWidget;
|
||||
}
|
||||
|
||||
public void setDraggedWidget(@Nullable final IWidget widget) {
|
||||
this.setDraggedWidget(widget, -1);
|
||||
}
|
||||
|
||||
public void setDraggedWidget(@Nullable final IWidget widget, final int button) {
|
||||
if (this.draggedWidget == widget) {
|
||||
return;
|
||||
}
|
||||
if (this.draggedWidget != null) {
|
||||
this.callEvent(new EventWidget.EndDrag(this.draggedWidget));
|
||||
}
|
||||
this.draggedWidget = widget;
|
||||
if (this.draggedWidget != null) {
|
||||
this.callEvent(new EventWidget.StartDrag(this.draggedWidget, button));
|
||||
}
|
||||
@Override
|
||||
@Nullable
|
||||
public IWidget getFocusedWidget() {
|
||||
return this.focusedWidget;
|
||||
}
|
||||
|
||||
public void setFocusedWidget(@Nullable final IWidget widget) {
|
||||
@@ -94,24 +117,6 @@ public abstract class TopLevelWidget extends Widget implements ITopLevelWidget {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public IWidget getMousedOverWidget() {
|
||||
return this.mousedOverWidget;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public IWidget getDraggedWidget() {
|
||||
return this.draggedWidget;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public IWidget getFocusedWidget() {
|
||||
return this.focusedWidget;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMouseOver(final IWidget widget) {
|
||||
return this.getMousedOverWidget() == widget;
|
||||
|
||||
@@ -16,17 +16,17 @@ import java.util.List;
|
||||
public class Widget implements IWidget {
|
||||
@Nullable
|
||||
private final IWidget parent;
|
||||
private List<IWidget> subWidgets;
|
||||
private List<IWidgetAttribute> attributes;
|
||||
private Point position;
|
||||
private Point size;
|
||||
private Point offset;
|
||||
@Nullable
|
||||
Area cropArea;
|
||||
@Nullable
|
||||
IWidget cropWidget;
|
||||
boolean cropped;
|
||||
int colour;
|
||||
private List<IWidget> subWidgets;
|
||||
private List<IWidgetAttribute> attributes;
|
||||
private Point position;
|
||||
private Point size;
|
||||
private Point offset;
|
||||
private Collection<EventHandler<? extends Event>> globalEventHandlers;
|
||||
private boolean enabled;
|
||||
private boolean visible;
|
||||
@@ -138,6 +138,14 @@ public class Widget implements IWidget {
|
||||
return this.pos();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setPosition(final Point vector) {
|
||||
if (!vector.equals(this.position)) {
|
||||
this.position = new Point(vector);
|
||||
this.callEvent(new EventWidget.ChangePosition(this));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Area getArea() {
|
||||
return new Area(Point.ZERO, this.size());
|
||||
@@ -178,19 +186,6 @@ public class Widget implements IWidget {
|
||||
return this.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Point getOffset() {
|
||||
return this.offset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setPosition(final Point vector) {
|
||||
if (!vector.equals(this.position)) {
|
||||
this.position = new Point(vector);
|
||||
this.callEvent(new EventWidget.ChangePosition(this));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setSize(final Point vector) {
|
||||
if (!vector.equals(this.size)) {
|
||||
@@ -199,6 +194,11 @@ public class Widget implements IWidget {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Point getOffset() {
|
||||
return this.offset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setOffset(final Point vector) {
|
||||
if (vector != this.offset) {
|
||||
@@ -207,6 +207,11 @@ public class Widget implements IWidget {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int getColour() {
|
||||
return this.colour;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setColour(final int colour) {
|
||||
if (this.colour != colour) {
|
||||
@@ -215,11 +220,6 @@ public class Widget implements IWidget {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int getColour() {
|
||||
return this.colour;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canMouseOver() {
|
||||
return this.hasAttribute(Attribute.MouseOver);
|
||||
|
||||
@@ -3,6 +3,7 @@ package binnie.core.craftgui;
|
||||
import binnie.Binnie;
|
||||
import binnie.core.AbstractMod;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.ExtraBeeTexture;
|
||||
import binnie.core.craftgui.controls.ControlText;
|
||||
import binnie.core.craftgui.controls.core.Control;
|
||||
import binnie.core.craftgui.events.EventHandler;
|
||||
@@ -18,10 +19,13 @@ import binnie.core.craftgui.minecraft.control.ControlSlot;
|
||||
import binnie.core.craftgui.resource.StyleSheetPunnett;
|
||||
import binnie.core.craftgui.resource.minecraft.StandardTexture;
|
||||
import binnie.core.machines.inventory.SlotValidator;
|
||||
import binnie.core.ExtraBeeTexture;
|
||||
import binnie.genetics.gui.ControlChromosome;
|
||||
import binnie.genetics.machine.analyser.Analyser;
|
||||
import forestry.api.genetics.*;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.Items;
|
||||
@@ -32,7 +36,11 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
public class WindowFieldKit extends Window {
|
||||
private int glassOffsetX;
|
||||
@@ -264,5 +272,4 @@ public class WindowFieldKit extends Window {
|
||||
this.getWindowInventory().decrStackSize(1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -21,7 +21,11 @@ import binnie.core.craftgui.window.Panel;
|
||||
import binnie.core.genetics.BreedingSystem;
|
||||
import binnie.core.genetics.Gene;
|
||||
import binnie.genetics.gui.ControlGenesisOption;
|
||||
import forestry.api.genetics.*;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.api.genetics.ISpeciesType;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
@@ -34,13 +34,13 @@ public class ControlText extends Control implements IControlValue<String> {
|
||||
RenderUtil.drawText(this.getArea(), this.align, this.text, this.getColour());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(final String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
return this.text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(final String text) {
|
||||
this.text = text;
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,11 @@ import binnie.core.craftgui.CraftGUI;
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.controls.core.Control;
|
||||
import binnie.core.craftgui.controls.core.IControlValue;
|
||||
import binnie.core.craftgui.events.*;
|
||||
import binnie.core.craftgui.events.EventHandler;
|
||||
import binnie.core.craftgui.events.EventKey;
|
||||
import binnie.core.craftgui.events.EventMouse;
|
||||
import binnie.core.craftgui.events.EventTextEdit;
|
||||
import binnie.core.craftgui.events.EventWidget;
|
||||
import binnie.core.craftgui.resource.minecraft.CraftGUITexture;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
@@ -33,15 +33,15 @@ public class ControlButton extends Control {
|
||||
}.setOrigin(EventHandler.Origin.Self, this));
|
||||
}
|
||||
|
||||
protected void onMouseClick(final EventMouse.Down event) {
|
||||
}
|
||||
|
||||
public ControlButton(final IWidget parent, final int x, final int y, final int width, final int height, final String text) {
|
||||
this(parent, x, y, width, height);
|
||||
this.text = text;
|
||||
this.textWidget = new ControlText(this, this.getArea(), text, TextJustification.MiddleCenter);
|
||||
}
|
||||
|
||||
protected void onMouseClick(final EventMouse.Down event) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateClient() {
|
||||
if (this.textWidget != null) {
|
||||
|
||||
@@ -40,6 +40,11 @@ public class ControlEnumButton<T> extends ControlButton implements IControlValue
|
||||
this.setValue(newEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T getValue() {
|
||||
return this.currentSelection;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(final T selection) {
|
||||
if (this.currentSelection != selection) {
|
||||
@@ -47,9 +52,4 @@ public class ControlEnumButton<T> extends ControlButton implements IControlValue
|
||||
this.callEvent(new EventValueChanged<Object>(this, this.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public T getValue() {
|
||||
return this.currentSelection;
|
||||
}
|
||||
}
|
||||
@@ -7,12 +7,12 @@ import binnie.core.craftgui.events.EventToggleButtonClicked;
|
||||
public class ControlToggleButton extends ControlButton {
|
||||
boolean toggled;
|
||||
|
||||
public ControlToggleButton(final IWidget parent, final int x, final int y, final int width, final int height) {
|
||||
super(parent, x, y, width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseClick(final EventMouse.Down event) {
|
||||
this.callEvent(new EventToggleButtonClicked(this, this.toggled));
|
||||
}
|
||||
|
||||
public ControlToggleButton(final IWidget parent, final int x, final int y, final int width, final int height) {
|
||||
super(parent, x, y, width, height);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,11 @@
|
||||
package binnie.core.craftgui.controls.core;
|
||||
|
||||
import binnie.core.craftgui.*;
|
||||
import binnie.core.craftgui.Attribute;
|
||||
import binnie.core.craftgui.ITooltip;
|
||||
import binnie.core.craftgui.ITooltipHelp;
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.Tooltip;
|
||||
import binnie.core.craftgui.Widget;
|
||||
import binnie.core.craftgui.geometry.Area;
|
||||
import binnie.core.craftgui.geometry.Point;
|
||||
import binnie.core.craftgui.minecraft.Window;
|
||||
@@ -12,9 +17,9 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Control extends Widget implements ITooltipHelp, ITooltip {
|
||||
public int extraLevel;
|
||||
List<String> helpStrings;
|
||||
List<String> tooltipStrings;
|
||||
public int extraLevel;
|
||||
|
||||
public Control(final IWidget parent, final int x, final int y, final int w, final int h) {
|
||||
super(parent);
|
||||
|
||||
@@ -14,15 +14,15 @@ import java.util.Map;
|
||||
|
||||
public class ControlList<T> extends Control implements IControlValue<T> {
|
||||
ControlListBox<T> parent;
|
||||
@Nullable
|
||||
private T defaultValue;
|
||||
@Nullable
|
||||
private T value;
|
||||
Map<T, IWidget> allOptions;
|
||||
Map<T, IWidget> optionWidgets;
|
||||
boolean creating;
|
||||
@Nullable
|
||||
IValidator<IWidget> validator;
|
||||
@Nullable
|
||||
private T defaultValue;
|
||||
@Nullable
|
||||
private T value;
|
||||
|
||||
protected ControlList(final ControlListBox<T> parent, final int x, final int y, final int w, final int h, @Nullable final T defaultValue) {
|
||||
super(parent, x, y, w, h);
|
||||
@@ -40,11 +40,6 @@ public class ControlList<T> extends Control implements IControlValue<T> {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public T getDefaultValue() {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(@Nullable final T value) {
|
||||
if (value == this.value) {
|
||||
@@ -58,14 +53,9 @@ public class ControlList<T> extends Control implements IControlValue<T> {
|
||||
this.parent.callEvent(new EventValueChanged<Object>(this.parent, value));
|
||||
}
|
||||
|
||||
public void setOptions(final Collection<T> options) {
|
||||
this.deleteAllChildren();
|
||||
this.allOptions.clear();
|
||||
for (final T option : options) {
|
||||
final IWidget optionWidget = this.parent.createOption(option, 0);
|
||||
this.allOptions.put(option, optionWidget);
|
||||
}
|
||||
this.filterOptions();
|
||||
@Nullable
|
||||
public T getDefaultValue() {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public void filterOptions() {
|
||||
@@ -90,6 +80,16 @@ public class ControlList<T> extends Control implements IControlValue<T> {
|
||||
return this.optionWidgets.keySet();
|
||||
}
|
||||
|
||||
public void setOptions(final Collection<T> options) {
|
||||
this.deleteAllChildren();
|
||||
this.allOptions.clear();
|
||||
for (final T option : options) {
|
||||
final IWidget optionWidget = this.parent.createOption(option, 0);
|
||||
this.allOptions.put(option, optionWidget);
|
||||
}
|
||||
this.filterOptions();
|
||||
}
|
||||
|
||||
public Collection<T> getAllOptions() {
|
||||
return this.allOptions.keySet();
|
||||
}
|
||||
|
||||
@@ -30,9 +30,9 @@ public class ControlOption<T> extends Control implements IControlValue<T> {
|
||||
|
||||
@Override
|
||||
public void onUpdateClient() {
|
||||
int colour = 10526880;
|
||||
int colour = 0xa0a0a0;
|
||||
if (this.isCurrentSelection()) {
|
||||
colour = 16777215;
|
||||
colour = 0xffffff;
|
||||
}
|
||||
this.setColour(colour);
|
||||
}
|
||||
|
||||
@@ -13,16 +13,16 @@ import java.util.List;
|
||||
public class ControlPages<T> extends Control implements IControlValues<T>, IControlValue<T> {
|
||||
T value;
|
||||
|
||||
@Override
|
||||
public boolean isChildVisible(final IWidget child) {
|
||||
return child != null && this.value == ((IControlValue) child).getValue();
|
||||
}
|
||||
|
||||
public ControlPages(final IWidget parent, final int x, final int y, final int w, final int h) {
|
||||
super(parent, x, y, w, h);
|
||||
this.value = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isChildVisible(final IWidget child) {
|
||||
return child != null && this.value == ((IControlValue) child).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAddChild(final IWidget widget) {
|
||||
}
|
||||
|
||||
@@ -74,6 +74,11 @@ public class ControlScrollableContent<T extends IWidget> extends Control impleme
|
||||
return this.percentageIndex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPercentageIndex(final float index) {
|
||||
this.movePercentage(index - this.percentageIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void movePercentage(final float percentage) {
|
||||
if (this.controlChild == null) {
|
||||
@@ -91,11 +96,6 @@ public class ControlScrollableContent<T extends IWidget> extends Control impleme
|
||||
this.controlChild.setOffset(new Point(0, Math.round(-this.percentageIndex * this.getMovementRange())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPercentageIndex(final float index) {
|
||||
this.movePercentage(index - this.percentageIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMovementRange() {
|
||||
if (this.controlChild == null) {
|
||||
|
||||
@@ -7,9 +7,9 @@ public interface IControlScrollable extends IWidget {
|
||||
|
||||
float getPercentageIndex();
|
||||
|
||||
void movePercentage(final float p0);
|
||||
|
||||
void setPercentageIndex(final float p0);
|
||||
|
||||
void movePercentage(final float p0);
|
||||
|
||||
float getMovementRange();
|
||||
}
|
||||
@@ -20,8 +20,8 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ControlTab<T> extends Control implements ITooltip, IControlValue<T> {
|
||||
private ControlTabBar<T> tabBar;
|
||||
protected T value;
|
||||
private ControlTabBar<T> tabBar;
|
||||
|
||||
public ControlTab(final ControlTabBar<T> parent, final int x, final int y, final int w, final int h, final T value) {
|
||||
super(parent, x, y, w, h);
|
||||
|
||||
@@ -5,12 +5,12 @@ import binnie.core.craftgui.controls.listbox.ControlListBox;
|
||||
import forestry.api.genetics.IClassification;
|
||||
|
||||
class ControlBranchBox extends ControlListBox<IClassification> {
|
||||
public ControlBranchBox(final IWidget parent, final int x, final int y, final int width, final int height) {
|
||||
super(parent, x, y, width, height, 12);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IWidget createOption(final IClassification value, final int y) {
|
||||
return new ControlBranchBoxOption(this.getContent(), value, y);
|
||||
}
|
||||
|
||||
public ControlBranchBox(final IWidget parent, final int x, final int y, final int width, final int height) {
|
||||
super(parent, x, y, width, height, 12);
|
||||
}
|
||||
}
|
||||
@@ -23,9 +23,27 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class ControlDatabaseIndividualDisplay extends ControlItemDisplay implements ITooltip {
|
||||
EnumDiscoveryState discovered;
|
||||
@Nullable
|
||||
private IAlleleSpecies species;
|
||||
EnumDiscoveryState discovered;
|
||||
|
||||
public ControlDatabaseIndividualDisplay(final IWidget parent, final int x, final int y) {
|
||||
this(parent, x, y, 16);
|
||||
}
|
||||
|
||||
public ControlDatabaseIndividualDisplay(final IWidget parent, final int x, final int y, final int size) {
|
||||
super(parent, x, y, size);
|
||||
this.species = null;
|
||||
this.discovered = EnumDiscoveryState.Show;
|
||||
this.addSelfEventHandler(new EventMouse.Down.Handler() {
|
||||
@Override
|
||||
public void onEvent(final EventMouse.Down event) {
|
||||
if (event.getButton() == 0 && ControlDatabaseIndividualDisplay.this.species != null && EnumDiscoveryState.Show == ControlDatabaseIndividualDisplay.this.discovered) {
|
||||
((WindowAbstractDatabase) ControlDatabaseIndividualDisplay.this.getTopParent()).gotoSpeciesDelayed(ControlDatabaseIndividualDisplay.this.species);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setSpecies(final IAlleleSpecies species) {
|
||||
this.setSpecies(species, EnumDiscoveryState.Show);
|
||||
@@ -49,24 +67,6 @@ public class ControlDatabaseIndividualDisplay extends ControlItemDisplay impleme
|
||||
this.addAttribute(Attribute.MouseOver);
|
||||
}
|
||||
|
||||
public ControlDatabaseIndividualDisplay(final IWidget parent, final int x, final int y) {
|
||||
this(parent, x, y, 16);
|
||||
}
|
||||
|
||||
public ControlDatabaseIndividualDisplay(final IWidget parent, final int x, final int y, final int size) {
|
||||
super(parent, x, y, size);
|
||||
this.species = null;
|
||||
this.discovered = EnumDiscoveryState.Show;
|
||||
this.addSelfEventHandler(new EventMouse.Down.Handler() {
|
||||
@Override
|
||||
public void onEvent(final EventMouse.Down event) {
|
||||
if (event.getButton() == 0 && ControlDatabaseIndividualDisplay.this.species != null && EnumDiscoveryState.Show == ControlDatabaseIndividualDisplay.this.discovered) {
|
||||
((WindowAbstractDatabase) ControlDatabaseIndividualDisplay.this.getTopParent()).gotoSpeciesDelayed(ControlDatabaseIndividualDisplay.this.species);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onRenderForeground(int guiWidth, int guiHeight) {
|
||||
|
||||
@@ -14,17 +14,17 @@ class ControlMutationBox extends ControlListBox<IMutation> {
|
||||
private Type type;
|
||||
private IAlleleSpecies species;
|
||||
|
||||
@Override
|
||||
public IWidget createOption(final IMutation value, final int y) {
|
||||
return new ControlMutationItem(this.getContent(), value, this.species, y);
|
||||
}
|
||||
|
||||
public ControlMutationBox(final IWidget parent, final int x, final int y, final int width, final int height, final Type type) {
|
||||
super(parent, x, y, width, height, 12);
|
||||
this.species = null;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IWidget createOption(final IMutation value, final int y) {
|
||||
return new ControlMutationItem(this.getContent(), value, this.species, y);
|
||||
}
|
||||
|
||||
public void setSpecies(final IAlleleSpecies species) {
|
||||
if (species != this.species) {
|
||||
this.species = species;
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
package binnie.core.craftgui.database;
|
||||
|
||||
import binnie.core.craftgui.*;
|
||||
import binnie.core.craftgui.Attribute;
|
||||
import binnie.core.craftgui.CraftGUI;
|
||||
import binnie.core.craftgui.ITooltip;
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.Tooltip;
|
||||
import binnie.core.craftgui.controls.core.Control;
|
||||
import binnie.core.craftgui.geometry.Point;
|
||||
import binnie.core.craftgui.minecraft.Window;
|
||||
@@ -20,6 +24,13 @@ class ControlMutationSymbol extends Control implements ITooltip {
|
||||
private boolean discovered;
|
||||
private int type;
|
||||
|
||||
protected ControlMutationSymbol(final IWidget parent, final int x, final int y, final int type) {
|
||||
super(parent, x, y, 16 + type * 16, 16);
|
||||
this.value = null;
|
||||
this.type = type;
|
||||
this.addAttribute(Attribute.MouseOver);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
@@ -31,13 +42,6 @@ class ControlMutationSymbol extends Control implements ITooltip {
|
||||
}
|
||||
}
|
||||
|
||||
protected ControlMutationSymbol(final IWidget parent, final int x, final int y, final int type) {
|
||||
super(parent, x, y, 16 + type * 16, 16);
|
||||
this.value = null;
|
||||
this.type = type;
|
||||
this.addAttribute(Attribute.MouseOver);
|
||||
}
|
||||
|
||||
public void setValue(final IMutation value) {
|
||||
this.value = value;
|
||||
final boolean isNEI = ((WindowAbstractDatabase) this.getTopParent()).isNEI();
|
||||
|
||||
@@ -17,16 +17,16 @@ import java.util.List;
|
||||
public class ControlSpeciesBox extends ControlListBox<IAlleleSpecies> {
|
||||
private IClassification branch;
|
||||
|
||||
@Override
|
||||
public IWidget createOption(final IAlleleSpecies value, final int y) {
|
||||
return new ControlSpeciesBoxOption(this.getContent(), value, y);
|
||||
}
|
||||
|
||||
public ControlSpeciesBox(final IWidget parent, final int x, final int y, final int width, final int height) {
|
||||
super(parent, x, y, width, height, 12);
|
||||
this.branch = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IWidget createOption(final IAlleleSpecies value, final int y) {
|
||||
return new ControlSpeciesBoxOption(this.getContent(), value, y);
|
||||
}
|
||||
|
||||
public void setBranch(final IClassification branch) {
|
||||
if (branch != this.branch) {
|
||||
this.branch = branch;
|
||||
|
||||
@@ -15,9 +15,9 @@ public class PageBranchSpecies extends PageBranch {
|
||||
private ControlText pageBranchSpecies_title;
|
||||
private ControlSpeciesBox pageBranchSpecies_speciesList;
|
||||
|
||||
// @Mod.EventHandler
|
||||
// public void onHandleEvent(final EventValueChanged<IAlleleSpecies> event) {
|
||||
// }
|
||||
/*@Mod.EventHandler
|
||||
public void onHandleEvent(final EventValueChanged<IAlleleSpecies> event) {
|
||||
}*/
|
||||
|
||||
public PageBranchSpecies(final IWidget parent, final DatabaseTab tab) {
|
||||
super(parent, tab);
|
||||
|
||||
@@ -36,14 +36,14 @@ import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
public abstract class WindowAbstractDatabase extends Window {
|
||||
private int selectionBoxWidth;
|
||||
private final int infoBoxWidth = 144;
|
||||
private final int infoBoxHeight = 176;
|
||||
private final int infoTabWidth = 16;
|
||||
private final int modeTabWidth = 22;
|
||||
private final int searchBoxHeight = 16;
|
||||
private Map<IDatabaseMode, ModeWidgets> modes;
|
||||
boolean isNEI;
|
||||
private int selectionBoxWidth;
|
||||
private Map<IDatabaseMode, ModeWidgets> modes;
|
||||
private BreedingSystem system;
|
||||
@Nullable
|
||||
private Panel panelInformation;
|
||||
@@ -54,10 +54,6 @@ public abstract class WindowAbstractDatabase extends Window {
|
||||
@Nullable
|
||||
private IAlleleSpecies gotoSpecies;
|
||||
|
||||
public void changeMode(final IDatabaseMode mode) {
|
||||
this.modePages.setValue(mode);
|
||||
}
|
||||
|
||||
public WindowAbstractDatabase(final EntityPlayer player, final Side side, final boolean nei, final BreedingSystem system, final int wid) {
|
||||
super(100, 192, player, null, side);
|
||||
this.selectionBoxWidth = 95;
|
||||
@@ -71,6 +67,14 @@ public abstract class WindowAbstractDatabase extends Window {
|
||||
this.selectionBoxWidth = wid;
|
||||
}
|
||||
|
||||
public WindowAbstractDatabase(final EntityPlayer player, final Side side, final boolean nei, final BreedingSystem system) {
|
||||
this(player, side, nei, system, 95);
|
||||
}
|
||||
|
||||
public void changeMode(final IDatabaseMode mode) {
|
||||
this.modePages.setValue(mode);
|
||||
}
|
||||
|
||||
public ControlPages<DatabaseTab> getInfoPages(final IDatabaseMode mode) {
|
||||
return this.modes.get(mode).infoPages;
|
||||
}
|
||||
@@ -83,10 +87,6 @@ public abstract class WindowAbstractDatabase extends Window {
|
||||
return this.system;
|
||||
}
|
||||
|
||||
public WindowAbstractDatabase(final EntityPlayer player, final Side side, final boolean nei, final BreedingSystem system) {
|
||||
this(player, side, nei, system, 95);
|
||||
}
|
||||
|
||||
protected ModeWidgets createMode(final IDatabaseMode mode, final ModeWidgets widgets) {
|
||||
this.modes.put(mode, widgets);
|
||||
return widgets;
|
||||
@@ -204,8 +204,8 @@ public abstract class WindowAbstractDatabase extends Window {
|
||||
public abstract static class ModeWidgets {
|
||||
public WindowAbstractDatabase database;
|
||||
public ControlPage<IDatabaseMode> modePage;
|
||||
private ControlPages<DatabaseTab> infoPages;
|
||||
public ControlListBox listBox;
|
||||
private ControlPages<DatabaseTab> infoPages;
|
||||
private ControlTabBar<DatabaseTab> infoTabs;
|
||||
|
||||
public ModeWidgets(final IDatabaseMode mode, final WindowAbstractDatabase database) {
|
||||
|
||||
@@ -12,6 +12,13 @@ public abstract class EventMouse extends Event {
|
||||
int y;
|
||||
int button;
|
||||
|
||||
public Button(final IWidget currentMousedOverWidget, final int x, final int y, final int button) {
|
||||
super(currentMousedOverWidget);
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.button = button;
|
||||
}
|
||||
|
||||
public int getX() {
|
||||
return this.x;
|
||||
}
|
||||
@@ -23,13 +30,6 @@ public abstract class EventMouse extends Event {
|
||||
public int getButton() {
|
||||
return this.button;
|
||||
}
|
||||
|
||||
public Button(final IWidget currentMousedOverWidget, final int x, final int y, final int button) {
|
||||
super(currentMousedOverWidget);
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.button = button;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Down extends Button {
|
||||
@@ -60,6 +60,12 @@ public abstract class EventMouse extends Event {
|
||||
float dx;
|
||||
float dy;
|
||||
|
||||
public Move(final IWidget origin, final float dx, final float dy) {
|
||||
super(origin);
|
||||
this.dx = dx;
|
||||
this.dy = dy;
|
||||
}
|
||||
|
||||
public float getDx() {
|
||||
return this.dx;
|
||||
}
|
||||
@@ -68,12 +74,6 @@ public abstract class EventMouse extends Event {
|
||||
return this.dy;
|
||||
}
|
||||
|
||||
public Move(final IWidget origin, final float dx, final float dy) {
|
||||
super(origin);
|
||||
this.dx = dx;
|
||||
this.dy = dy;
|
||||
}
|
||||
|
||||
public abstract static class Handler extends EventHandler<Move> {
|
||||
public Handler() {
|
||||
super(Move.class);
|
||||
|
||||
@@ -72,7 +72,7 @@ public final class Area {
|
||||
public int height() {
|
||||
return this.size().y();
|
||||
}
|
||||
|
||||
|
||||
public void setXPos(final int xPos) {
|
||||
this.pos = new Point(xPos, this.pos.y());
|
||||
}
|
||||
|
||||
@@ -98,5 +98,4 @@ public class Border {
|
||||
public String toString() {
|
||||
return this.t() + "-" + this.r() + "-" + this.b() + "-" + this.l();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -61,5 +61,4 @@ public class CraftGUIUtil {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -50,5 +50,4 @@ public class Point {
|
||||
public boolean equals(final Point other) {
|
||||
return this.x() == other.x() && this.y() == other.y();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,7 +6,14 @@ import binnie.core.craftgui.minecraft.control.EnumHighlighting;
|
||||
import binnie.core.machines.IMachine;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.machines.network.INetwork;
|
||||
import binnie.core.machines.power.*;
|
||||
import binnie.core.machines.power.ErrorState;
|
||||
import binnie.core.machines.power.IErrorStateSource;
|
||||
import binnie.core.machines.power.IPoweredMachine;
|
||||
import binnie.core.machines.power.IProcess;
|
||||
import binnie.core.machines.power.ITankMachine;
|
||||
import binnie.core.machines.power.PowerInfo;
|
||||
import binnie.core.machines.power.ProcessInfo;
|
||||
import binnie.core.machines.power.TankInfo;
|
||||
import binnie.core.machines.transfer.TransferRequest;
|
||||
import binnie.core.network.packet.MessageContainerUpdate;
|
||||
import com.google.common.base.Preconditions;
|
||||
@@ -14,16 +21,26 @@ import com.google.common.collect.Sets;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.*;
|
||||
import net.minecraft.inventory.ClickType;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IContainerListener;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
public class ContainerCraftGUI extends Container {
|
||||
private final Set<EntityPlayer> crafters = Sets.newConcurrentHashSet();
|
||||
private Window window;
|
||||
private Map<String, NBTTagCompound> syncedNBT;
|
||||
private Map<String, NBTTagCompound> sentNBT;
|
||||
@@ -34,7 +51,6 @@ public class ContainerCraftGUI extends Container {
|
||||
@Nullable
|
||||
private ErrorState error;
|
||||
private int mousedOverSlotNumber;
|
||||
private final Set<EntityPlayer> crafters = Sets.newConcurrentHashSet();
|
||||
|
||||
public ContainerCraftGUI(final Window window) {
|
||||
this.syncedNBT = new HashMap<>();
|
||||
@@ -243,7 +259,7 @@ public class ContainerCraftGUI extends Container {
|
||||
if (shouldSend) {
|
||||
//TODO INVENTORY
|
||||
this.crafters.stream().filter(Objects::nonNull).forEach(entityPlayer ->
|
||||
BinnieCore.getBinnieProxy().sendToPlayer(new MessageContainerUpdate(nbt.getValue()), entityPlayer));
|
||||
BinnieCore.getBinnieProxy().sendToPlayer(new MessageContainerUpdate(nbt.getValue()), entityPlayer));
|
||||
sentThisTime.put(nbt.getKey(), nbt.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
Loaded 100 of 508 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user